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>

@Tag("div") @CssImport("./absolute-layout.css") public class AbsoluteLayout extends AbstractLayout implements LayoutEvents.LayoutClickNotifier
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
    • 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.
    • 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.

      Specified by:
      replaceComponent in interface ComponentContainer
      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
      Specified by:
      getComponentCount in interface ComponentContainer
      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
    • 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:
      addLayoutClickListener in interface LayoutEvents.LayoutClickNotifier
      Parameters:
      listener - The listener to add
      Returns:
      a registration object for removing the listener
      See Also:
      • Registration
    • removeLayoutClickListener

      @Deprecated public void removeLayoutClickListener(LayoutEvents.LayoutClickListener listener)
      Deprecated.