Class AbsoluteLayout
- All Implemented Interfaces:
LayoutEvents.LayoutClickNotifier,ClientConnector,Sizeable,ComponentContainer,HasComponents,HasComponents.ComponentAttachDetachNotifier,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasStyle,Serializable,Iterable<com.vaadin.flow.component.Component>
It is a layout implementation that mimics html absolute positioning.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe ComponentPosition class represents a component's position within the absolute layout.Nested classes/interfaces inherited from interface com.vaadin.classic.v8.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListenerNested classes/interfaces inherited from interface com.vaadin.classic.v8.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerNested classes/interfaces inherited from interface com.vaadin.classic.v8.server.Sizeable
Sizeable.Unit -
Field Summary
FieldsFields inherited from interface com.vaadin.classic.v8.server.Sizeable
SIZE_UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(com.vaadin.flow.component.Component c) Adds the component into this container.voidaddComponent(com.vaadin.flow.component.Component c, String cssPosition) Adds a component to the layout.com.vaadin.flow.shared.RegistrationDeprecated.intGets the number of children thisComponentContainerhasgetPosition(com.vaadin.flow.component.Component component) Gets the position of a component in the layout.Iterator<com.vaadin.flow.component.Component>iterator()Gets the component container iterator for going through all the components in the container.voidremoveComponent(com.vaadin.flow.component.Component component) Removes the component from this container.voidDeprecated.voidreplaceComponent(com.vaadin.flow.component.Component oldComponent, com.vaadin.flow.component.Component newComponent) Replaces the component in the container with another one without changing position.voidsetPosition(com.vaadin.flow.component.Component component, AbsoluteLayout.ComponentPosition position) Sets the position of a component in the layout.Methods inherited from class com.vaadin.classic.v8.ui.AbstractComponentContainer
add, addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, remove, removeAll, removeAllComponents, setHeight, setWidthMethods inherited from class com.vaadin.classic.v8.ui.AbstractComponent
addInternalStyles, addListener, addShortcutListener, addStyleName, addStyleNames, beforeClientResponse, doSetHeight, doSetWidth, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getCustomStyles, getData, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getInternalStyles, getLocale, getPrimaryStyleName, getState, getState, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, notifyParentAboutStyleChanges, onEnabledStateChanged, removeInternalStyles, removeStyleName, removeStyleNames, setCaption, setCaptionAsHtml, setComponentError, setData, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefinedMethods inherited from class com.vaadin.classic.v8.server.AbstractClientConnector
addExtension, addLegacyAttachListener, addLegacyDetachListener, addListener, addListener, addMethodInvocationToQueue, attach, createState, detach, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getResource, getSession, handleConnectorRequest, hasListeners, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, onAttach, onDetach, registerRpc, registerRpc, removeExtension, setErrorHandler, setResource, updateDiffstateMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, addComponentAsFirst, addComponentAtIndex, removeMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
CLASSNAME
Class name, prefix in styling.- See Also:
-
-
Constructor Details
-
AbsoluteLayout
public AbsoluteLayout()Creates an AbsoluteLayout with full size.
-
-
Method Details
-
addComponent
public void addComponent(com.vaadin.flow.component.Component c) Description copied from interface:ComponentContainerAdds the component into this container.- Specified by:
addComponentin interfaceComponentContainer- Overrides:
addComponentin classAbstractComponentContainer- Parameters:
c- the component to be added.
-
addComponent
Adds a component to the layout. The component can be positioned by providing a string formatted in CSS-format.For example the string "top:10px;left:10px" will position the component 10 pixels from the left and 10 pixels from the top. The identifiers: "top","left","right" and "bottom" can be used to specify the position.
- Parameters:
c- The component to add to the layoutcssPosition- The css position string
-
removeComponent
public void removeComponent(com.vaadin.flow.component.Component component) Description copied from interface:ComponentContainerRemoves the component from this container.- Specified by:
removeComponentin interfaceComponentContainer- Overrides:
removeComponentin classAbstractComponentContainer- Parameters:
component- the component to be removed.
-
replaceComponent
public void replaceComponent(com.vaadin.flow.component.Component oldComponent, com.vaadin.flow.component.Component newComponent) Description copied from interface:ComponentContainerReplaces the component in the container with another one without changing position.This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.
- Specified by:
replaceComponentin interfaceComponentContainer- Parameters:
oldComponent- the old component that will be replaced.newComponent- the new component to be replaced.
-
getComponentCount
public int getComponentCount()Description copied from interface:ComponentContainerGets the number of children thisComponentContainerhas- Specified by:
getComponentCountin interfaceComponentContainer- Returns:
- The number of child components this container has.
-
iterator
Description copied from class:AbstractComponentContainerGets the component container iterator for going through all the components in the container.- Specified by:
iteratorin interfaceHasComponents- Specified by:
iteratorin interfaceIterable<com.vaadin.flow.component.Component>- Overrides:
iteratorin classAbstractComponentContainer- Returns:
- the Iterator of the components inside the container.
-
getPosition
Gets the position of a component in the layout. Returns null if component is not attached to the layout.Note that you cannot update the position by updating this object. Call
setPosition(Component, ComponentPosition)with the updatedAbsoluteLayout.ComponentPositionobject.- Parameters:
component- The component which position is needed- Returns:
- An instance of ComponentPosition containing the position of the component, or null if the component is not enclosed in the layout.
-
setPosition
public void setPosition(com.vaadin.flow.component.Component component, AbsoluteLayout.ComponentPosition position) Sets the position of a component in the layout.- Parameters:
component- the component to modifyposition- the new position of the component
-
addLayoutClickListener
public com.vaadin.flow.shared.Registration addLayoutClickListener(LayoutEvents.LayoutClickListener listener) Deprecated.Not supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/classic-component-pack for mitigation options.- Specified by:
addLayoutClickListenerin interfaceLayoutEvents.LayoutClickNotifier- Parameters:
listener- The listener to add- Returns:
- a registration object for removing the listener
- See Also:
-
Registration
-
removeLayoutClickListener
Deprecated.
-