Class 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
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumnumeration of all available orientation for VaadinSplitLayout componentstatic class -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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.SplitLayout(SplitLayout.Orientation orientation) Constructs a SplitLayout with the orientation. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddSplitterDragEndListener(com.vaadin.flow.component.ComponentEventListener<SplitLayout.SplitterDragEndEvent> listener) Adds a listener for thesplitter-dragendevent, which is fired when the user has stopped resizing the splitter with drag and drop.voidaddToPrimary(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.voidaddToSecondary(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.getI18n()Gets the internationalization object previously set for this component.Get the orientation of the SplitLayout.com.vaadin.flow.component.ComponentGet the component currently set to the primary split.com.vaadin.flow.component.ComponentGet the component currently set to the secondary split.Gets the relative position of the splitter as a percentage value between 0 and 100.voidremove(com.vaadin.flow.component.Component... components) Removes the given child components from this component.voidRemoves the primary and the secondary components.voidsetI18n(SplitLayoutI18n i18n) Sets the internationalization object for this component.voidsetOrientation(SplitLayout.Orientation orientation) Set the orientation of the SplitLayout.voidsetPrimaryStyle(String styleName, String value) Deprecated, for removal: This API element is subject to removal in a future version.voidsetSecondaryStyle(String styleName, String value) Deprecated, for removal: This API element is subject to removal in a future version.since 25.3, usegetSecondaryComponent()and set styles on the secondary component directly instead.voidsetSplitterPosition(double position) Sets the relative position of the splitter in percentages.Methods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisibleMethods 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.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants
-
Constructor Details
-
SplitLayout
public SplitLayout()Constructs an empty SplitLayout. -
SplitLayout
Constructs a SplitLayout with the orientation.- Parameters:
orientation- the orientation set to the layout- Since:
- 23.1
-
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 splitsecondaryComponent- 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 splitsecondaryComponent- the component set to the secondary splitorientation- the orientation set to the layout- Since:
- 23.1
-
-
Method Details
-
setOrientation
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, nevernull
-
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
orientationproperty 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
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 theSplitLayout.SplitterDragEndEvent.- Returns:
- the splitter position, may be null
- Since:
- 24.2
-
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
@Deprecated(since="25.3", forRemoval=true) public void setPrimaryStyle(String styleName, String value) Deprecated, for removal: This API element is subject to removal in a future version.since 25.3, usegetPrimaryComponent()and set styles on the primary component directly instead.Set a style to the component in the primary split.- Parameters:
styleName- name of the style to setvalue- the value to set
-
setSecondaryStyle
@Deprecated(since="25.3", forRemoval=true) public void setSecondaryStyle(String styleName, String value) Deprecated, for removal: This API element is subject to removal in a future version.since 25.3, usegetSecondaryComponent()and set styles on the secondary component directly instead.Set a style to the component in the secondary split.- Parameters:
styleName- name of the style to setvalue- 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 thesplitter-dragendevent, 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
- Since:
- 25.0
-
getI18n
Gets the internationalization object previously set for this component.NOTE: Updating the instance that is returned from this method will not update the component if not set again using
setI18n(SplitLayoutI18n).- Returns:
- the i18n object or
nullif no i18n object has been set - Since:
- 25.3
-
setI18n
Sets the internationalization object for this component. It enables you to customize and translate the accessible labels used in the split layout.Note: updating the object properties after setting the i18n will not update the component. To make the changes effective, you need to set the updated object again.
- Parameters:
i18n- the i18n object, notnull- Since:
- 25.3
-
getPrimaryComponent()and set styles on the primary component directly instead.