Package com.storedobject.ui
Class FoldingLayout
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
com.storedobject.ui.FoldingLayout
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasStyle
,Serializable
public class FoldingLayout
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
A responsive layout that can contain only sizeable components (
HasSize
). On a screen with its width less than
its height or its width less than getFoldingPoint()
, it displays its components horizontally. Otherwise,
it displays the components vertically.- Author:
- Syam
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFoldingLayout
(int viewWidth, int viewHeight, com.vaadin.flow.component.HasSize... components) Constructor with fixed view-width and view-height.FoldingLayout
(com.vaadin.flow.component.HasSize... components) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(com.vaadin.flow.component.HasSize... components) Add components.final int
Set the folding point (Point at which folding is initiated).final int
getGap()
Get the gap between components.protected com.vaadin.flow.component.Component
protected void
onAttach
(com.vaadin.flow.component.AttachEvent attachEvent) protected void
onDetach
(com.vaadin.flow.component.DetachEvent detachEvent) void
remove
(com.vaadin.flow.component.HasSize... components) Remove components.void
Remove all components.void
setFoldingPoint
(int foldingPoint) Set the folding point (Point at which folding is initiated).void
setGap
(int gap) Set the gap between components.void
setProportionalHeight
(int... heights) Set proportional widths for the components.void
setProportionalWidths
(int... widths) Set proportional widths for the components.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, 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.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
FoldingLayout
public FoldingLayout(com.vaadin.flow.component.HasSize... components) Constructor.- Parameters:
components
- Components to add.
-
FoldingLayout
public FoldingLayout(int viewWidth, int viewHeight, com.vaadin.flow.component.HasSize... components) Constructor with fixed view-width and view-height. This is useful only if you are adding this to aView
withView.setWindowMode(boolean)
set to true (For example:DataForm
).- Parameters:
viewWidth
- View width (typically between 1 and 100).viewHeight
- View height (typically between 1 and 100).components
- Components to add.
-
-
Method Details
-
initContent
protected com.vaadin.flow.component.Component initContent()- Overrides:
initContent
in classcom.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttach
in classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetach
in classcom.vaadin.flow.component.Component
-
setGap
public void setGap(int gap) Set the gap between components. (Default gap is 1%).- Parameters:
gap
- Gap in percentage.
-
getGap
public final int getGap()Get the gap between components.- Returns:
- Gap in percentage.
-
setFoldingPoint
public void setFoldingPoint(int foldingPoint) Set the folding point (Point at which folding is initiated).- Parameters:
foldingPoint
- Folding point. (Default is 800).
-
getFoldingPoint
public final int getFoldingPoint()Set the folding point (Point at which folding is initiated).- Returns:
- Folding point. (Default is 800).
-
add
public void add(com.vaadin.flow.component.HasSize... components) Add components.- Parameters:
components
- Components to add.
-
remove
public void remove(com.vaadin.flow.component.HasSize... components) Remove components.- Parameters:
components
- Components to remove.
-
removeAll
public void removeAll()Remove all components. -
setProportionalWidths
public void setProportionalWidths(int... widths) Set proportional widths for the components. These values are used to spread the components horizontally.- Parameters:
widths
- Widths.
-
setProportionalHeight
public void setProportionalHeight(int... heights) Set proportional widths for the components. These values are used to spread the components vertically.- Parameters:
heights
- Heights.
-