Package com.vaadin.featurepack.desktop
Class Box
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.featurepack.desktop.AbstractContainer
com.vaadin.featurepack.desktop.Box
- All Implemented Interfaces:
HasLayout,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable,com.vaadin.flow.component.FocusNotifier,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.HasSize,com.vaadin.flow.component.HasStyle,Serializable
The
Box class is a container component that uses BoxLayout,
and provides methods to create invisible components.- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.Focusable
com.vaadin.flow.component.Focusable.FocusJsNested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.vaadin.flow.component.ComponentCreates an invisible component that expands to fill the space between its neighboring components.static BoxCreates a Box that places components from left to right.static com.vaadin.flow.component.ComponentcreateHorizontalStrut(int width) Creates an invisible, fixed-width component.static BoxCreates a Box that places components from top to bottom.static com.vaadin.flow.component.ComponentcreateVerticalStrut(int height) Creates an invisible, fixed-height component.Gets the layout for the container.voidsetLayout(AbstractLayout layout) Sets the layout for this box.Methods inherited from class com.vaadin.featurepack.desktop.AbstractContainer
add, getComponent, getComponentCount, getInsets, remove, removeAllMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, 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.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
addMethods inherited from interface com.vaadin.flow.component.HasComponentsOfType
add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, indexOf, remove, replaceMethods 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.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, setClassName
-
Constructor Details
-
Box
public Box(int axis) Creates a new Box with the specified axis.- Parameters:
axis- axis to use for placing components
-
Box
Creates a new Box with the specified axis.- Parameters:
axis- axis to use for placing components
-
-
Method Details
-
getLayout
Description copied from interface:HasLayoutGets the layout for the container.- Specified by:
getLayoutin interfaceHasLayout- Overrides:
getLayoutin classAbstractContainer- Returns:
- the layout instance or
nullif no layout is set
-
createHorizontalStrut
public static com.vaadin.flow.component.Component createHorizontalStrut(int width) Creates an invisible, fixed-width component. In a horizontal box, this can be used to force a certain amount of space between two components. In a vertical box, this can be used to force the box to be at least the specified width.- Parameters:
width- the width of the invisible component, in pixels- Returns:
- the component
-
createVerticalStrut
public static com.vaadin.flow.component.Component createVerticalStrut(int height) Creates an invisible, fixed-height component. In a vertical box, this can be used to force a certain amount of space between two components. In a horizontal box, this can be used to force the box to be at least the specified height.- Parameters:
height- the height of the invisible component, in pixels- Returns:
- the component
-
createGlue
public static com.vaadin.flow.component.Component createGlue()Creates an invisible component that expands to fill the space between its neighboring components. This only works if the box has width or height specified to be larger than the combined size of child components, so that the glue could take all the remaining space.- Returns:
- the component
-
setLayout
Sets the layout for this box.- Specified by:
setLayoutin interfaceHasLayout- Overrides:
setLayoutin classAbstractContainer- Parameters:
layout- the layout to use- Throws:
IllegalArgumentException- if the layout is not a BoxLayout
-
createHorizontalBox
Creates a Box that places components from left to right.- Returns:
- the box
-
createVerticalBox
Creates a Box that places components from top to bottom.- Returns:
- the box
-