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>

@Tag("div") @CssImport("./absolute-layout.css") public class AbsoluteLayout extends AbstractLayout
Classic Component implementation of V8's com.vaadin.ui.AbsoluteLayout.

It is a layout implementation that mimics html absolute positioning.

See Also:
  • Field Details

  • 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: ComponentContainer
      Adds the component into this container.
      Specified by:
      addComponent in interface ComponentContainer
      Overrides:
      addComponent in class AbstractComponentContainer
      Parameters:
      c - the component to be added.
    • addComponent

      public void addComponent(com.vaadin.flow.component.Component c, String cssPosition)
      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 layout
      cssPosition - The css position string
    • add

      public void add(com.vaadin.flow.component.Component c, String cssPosition)
      See addComponent(Component c, String cssPosition)
      Parameters:
      c -
      cssPosition -
    • removeComponent

      public void removeComponent(com.vaadin.flow.component.Component component)
      Description copied from interface: ComponentContainer
      Removes the component from this container.
      Specified by:
      removeComponent in interface ComponentContainer
      Overrides:
      removeComponent in class AbstractComponentContainer
      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: ComponentContainer
      Replaces 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: ComponentContainer
      Gets the number of children this ComponentContainer has
      Returns:
      The number of child components this container has.
    • iterator

      public Iterator<com.vaadin.flow.component.Component> iterator()
      Description copied from class: AbstractComponentContainer
      Gets the component container iterator for going through all the components in the container.
      Specified by:
      iterator in interface HasComponents
      Specified by:
      iterator in interface Iterable<com.vaadin.flow.component.Component>
      Overrides:
      iterator in class AbstractComponentContainer
      Returns:
      the Iterator of the components inside the container.
    • getPosition

      public AbsoluteLayout.ComponentPosition getPosition(com.vaadin.flow.component.Component component)
      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 updated AbsoluteLayout.ComponentPosition object.

      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 modify
      position - the new position of the component