Class SplitLayout

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.splitlayout.SplitLayout
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<SplitLayout>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasThemeVariant<SplitLayoutVariant>, Serializable

@Tag("vaadin-split-layout") @NpmPackage(value="@vaadin/split-layout", version="25.0.0-alpha20") @JsModule("@vaadin/split-layout/src/vaadin-split-layout.js") public class SplitLayout extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.ClickNotifier<SplitLayout>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasThemeVariant<SplitLayoutVariant>
Split Layout is a component with two content areas and a draggable split handle between them.
Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    numeration of all available orientation for VaadinSplitLayout component
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty SplitLayout.
    SplitLayout(com.vaadin.flow.component.Component primaryComponent, com.vaadin.flow.component.Component secondaryComponent)
    Constructs a SplitLayout with the given initial components to set to the primary and secondary splits.
    SplitLayout(com.vaadin.flow.component.Component primaryComponent, com.vaadin.flow.component.Component secondaryComponent, SplitLayout.Orientation orientation)
    Constructs a SplitLayout with the given initial components to set to the primary and secondary splits and with the orientation.
    Constructs a SplitLayout with the orientation.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addSplitterDragendListener(com.vaadin.flow.component.ComponentEventListener<SplitLayout.SplitterDragendEvent> listener)
    Adds a listener for the splitter-dragend event, which is fired when the user has stopped resizing the splitter with drag and drop.
    void
    addToPrimary(com.vaadin.flow.component.Component... components)
    Sets the given components to the primary split of this layout, i.e. the left split if in horizontal mode and the top split if in vertical mode.
    void
    addToSecondary(com.vaadin.flow.component.Component... components)
    Sets the given components to the secondary split of this layout, i.e. the right split if in horizontal mode and the bottom split if in vertical mode.
    Get the orientation of the SplitLayout.
    com.vaadin.flow.component.Component
    Get the component currently set to the primary split.
    com.vaadin.flow.component.Component
    Get the component currently set to the secondary split.
    Gets the relative position of the splitter as a percentage value between 0 and 100.
    void
    remove(com.vaadin.flow.component.Component... components)
    Removes the given child components from this component.
    void
    Removes the primary and the secondary components.
    void
    Set the orientation of the SplitLayout.
    void
    setPrimaryStyle(String styleName, String value)
    Set a style to the component in the primary split.
    void
    setSecondaryStyle(String styleName, String value)
    Set a style to the component in the secondary split.
    void
    setSplitterPosition(double position)
    Sets the relative position of the splitter in percentages.

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants
  • Constructor Details

    • SplitLayout

      public SplitLayout()
      Constructs an empty SplitLayout.
    • SplitLayout

      public SplitLayout(SplitLayout.Orientation orientation)
      Constructs a SplitLayout with the orientation.
      Parameters:
      orientation - the orientation set to the layout
    • SplitLayout

      public SplitLayout(com.vaadin.flow.component.Component primaryComponent, com.vaadin.flow.component.Component secondaryComponent)
      Constructs a SplitLayout with the given initial components to set to the primary and secondary splits.
      Parameters:
      primaryComponent - the component set to the primary split
      secondaryComponent - the component set to the secondary split
    • SplitLayout

      public SplitLayout(com.vaadin.flow.component.Component primaryComponent, com.vaadin.flow.component.Component secondaryComponent, SplitLayout.Orientation orientation)
      Constructs a SplitLayout with the given initial components to set to the primary and secondary splits and with the orientation.
      Parameters:
      primaryComponent - the component set to the primary split
      secondaryComponent - the component set to the secondary split
      orientation - the orientation set to the layout
  • Method Details

    • setOrientation

      public void setOrientation(SplitLayout.Orientation orientation)
      Set the orientation of the SplitLayout.

      Default value is SplitLayout.Orientation.HORIZONTAL.

      Parameters:
      orientation - the orientation of the SplitLayout. Valid enumerate values are VERTICAL and HORIZONTAL, never null
    • getOrientation

      public SplitLayout.Orientation getOrientation()
      Get the orientation of the SplitLayout.

      Default value is SplitLayout.Orientation.HORIZONTAL.

      NOTE: This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

      Returns:
      the orientation property of the SplitLayout.
    • addToPrimary

      public void addToPrimary(com.vaadin.flow.component.Component... components)
      Sets the given components to the primary split of this layout, i.e. the left split if in horizontal mode and the top split if in vertical mode.

      Note: Calling this method with multiple arguments will wrap the components inside a <div> element.

      Note: Removing the primary component through the component API will move the secondary component to the primary split, causing this layout to desync with the server. This is a known issue.

      See Also:
    • getPrimaryComponent

      public com.vaadin.flow.component.Component getPrimaryComponent()
      Get the component currently set to the primary split.
      Returns:
      the primary component, may be null
    • addToSecondary

      public void addToSecondary(com.vaadin.flow.component.Component... components)
      Sets the given components to the secondary split of this layout, i.e. the right split if in horizontal mode and the bottom split if in vertical mode.

      Note: Calling this method with multiple arguments will wrap the components inside a <div> element.

      See Also:
    • getSecondaryComponent

      public com.vaadin.flow.component.Component getSecondaryComponent()
      Get the component currently set to the secondary split.
      Returns:
      the primary component, may be null
    • getSplitterPosition

      public Double getSplitterPosition()
      Gets the relative position of the splitter as a percentage value between 0 and 100. The value will be null unless the splitter position has been explicitly set on the server-side, or the splitter has been moved on the client side. The splitter position is automatically updated when as part of the SplitLayout.SplitterDragendEvent.
      Returns:
      the splitter position, may be null
    • setSplitterPosition

      public void setSplitterPosition(double position)
      Sets the relative position of the splitter in percentages. The given value is used to set how much space is given to the primary component relative to the secondary component. In horizontal mode this is the width of the component and in vertical mode this is the height. The given value will automatically be clamped to the range [0, 100]. Note that when using vertical orientation, this method only works if the split layout has an explicit height, either as an absolute value or as percentage. When using a percentage value, ensure that ancestors have an explicit height as well.
      Parameters:
      position - the relative position of the splitter, in percentages
    • setPrimaryStyle

      public void setPrimaryStyle(String styleName, String value)
      Set a style to the component in the primary split.
      Parameters:
      styleName - name of the style to set
      value - the value to set
    • setSecondaryStyle

      public void setSecondaryStyle(String styleName, String value)
      Set a style to the component in the secondary split.
      Parameters:
      styleName - name of the style to set
      value - the value to set
    • remove

      public void remove(com.vaadin.flow.component.Component... components)
      Removes the given child components from this component.
      Parameters:
      components - The components to remove.
      Throws:
      IllegalArgumentException - if any of the components is not a child of this component.
    • removeAll

      public void removeAll()
      Removes the primary and the secondary components.
    • addSplitterDragendListener

      public com.vaadin.flow.shared.Registration addSplitterDragendListener(com.vaadin.flow.component.ComponentEventListener<SplitLayout.SplitterDragendEvent> listener)
      Adds a listener for the splitter-dragend event, which is fired when the user has stopped resizing the splitter with drag and drop.
      Parameters:
      listener - the listener to add
      Returns:
      a registration for removing the listener