Class AbsoluteLayout
- All Implemented Interfaces:
ClientConnector,FAbstractClientConnector,FSizeable,Sizeable,ComponentContainer,FAbstractComponent,HasComponents,HasComponents.ComponentAttachDetachNotifier,Layout,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.shared.HasTooltip,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.featurepack.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListenerNested classes/interfaces inherited from interface com.vaadin.featurepack.server.FAbstractClientConnector
FAbstractClientConnector.LegacyMethodEventNested classes/interfaces inherited from interface com.vaadin.featurepack.ui.FAbstractComponent
FAbstractComponent.DataKeyNested classes/interfaces inherited from interface com.vaadin.featurepack.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerNested classes/interfaces inherited from interface com.vaadin.featurepack.ui.Layout
Layout.AlignmentHandler, Layout.MarginHandler, Layout.SpacingHandler -
Field Summary
FieldsFields inherited from interface com.vaadin.featurepack.server.Sizeable
SIZE_UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSee addComponent(Component c, String cssPosition)voidaddComponent(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.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.voidreplace(com.vaadin.flow.component.Component oldComponent, com.vaadin.flow.component.Component newComponent) 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.featurepack.ui.AbstractComponentContainer
add, addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, remove, removeAll, removeAllComponents, setHeight, setWidthMethods inherited from class com.vaadin.featurepack.ui.AbstractComponent
addClassName, addClassNames, addInternalStyles, beforeClientResponse, doSetHeight, doSetWidth, fireComponentEvent, fireEvent, focus, getClassName, getClassNames, getCustomStyles, getHeight, getHeightUnits, getInternalStyles, getLocale, getStyle, getTooltip, getWidth, getWidthUnits, hasClassName, isOrHasAncestor, isVisible, onEnabledStateChanged, removeClassName, removeClassNames, removeInternalStyles, setClassName, setClassName, setHeight, setHeightFull, setHeightUndefined, setParent, setSizeFull, setSizeUndefined, setTooltipText, setVisible, setWidth, setWidthFull, setWidthUndefinedMethods inherited from class com.vaadin.featurepack.server.AbstractClientConnector
getSession, onAttach, onDetachMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, findAncestor, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, whenAttachedMethods 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.featurepack.ui.ComponentContainer
addComponents, moveComponentsFrom, removeAllComponentsMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.featurepack.server.FAbstractClientConnector
addLegacyAttachListener, addLegacyDetachListener, addListener, addListener, attach, detach, doConnectorOnAttach, doConnectorOnDetach, fireEvent, fireEvent, getAllChildrenIterable, getFListeners, getFlowComponent, getResource, hasListeners, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeListener, removeListener, setResourceMethods inherited from interface com.vaadin.featurepack.ui.FAbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, addStyleNames, getCaption, getComponentError, getData, getDescription, getFErrorIndicator, getFErrorMessage, getFId, getFParent, getIcon, getIconResource, getPrimaryStyleName, getStyleName, isCaptionAsHtml, isImmediate, isResponsive, notifyParentAboutStyleChanges, removeContextClickListener, removeShortcutListener, removeStyleName, removeStyleNames, setCaption, setCaptionAsHtml, setComponentError, setData, setDescription, setDescription, setIcon, setIcon, setIconResource, setImmediate, setLabelComponent, setLocale, setPrimaryStyleName, setResponsive, setStyleName, setStyleNameMethods inherited from interface com.vaadin.featurepack.server.FSizeable
getFHeight, getFWidthMethods inherited from interface com.vaadin.flow.component.HasComponents
addMethods inherited from interface com.vaadin.featurepack.ui.HasComponents.ComponentAttachDetachNotifier
addComponentAttachListener, addComponentDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponentsOfType
add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, indexOf, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasStyle
bindClassName, bindClassNamesMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
setTooltipMarkdownMethods 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
-
add
See addComponent(Component c, String cssPosition)- Parameters:
c-cssPosition-
-
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.
-
replace
public void replace(com.vaadin.flow.component.Component oldComponent, com.vaadin.flow.component.Component newComponent) -
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.
- 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- 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
-