Class SlideTab
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.littemplate.LitTemplate
com.lipisak.vaadin.slidetab.SlideTab
- All Implemented Interfaces:
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.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.internal.Template, Serializable
@Tag("slide-tab")
@JsModule("./src/slide-tab.js")
public class SlideTab
extends com.vaadin.flow.component.littemplate.LitTemplate
implements com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
A component for showing a tab that when clicked expands a panel
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA utility class for wrapping a command in a TimerTask and running it in the UI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddToggleListener(com.vaadin.flow.component.ComponentEventListener<SlideToggleEvent> listener) Adds a listener that will be notified when the panel expands or collapsesvoidcollapse()Collapses the SlideTab panelvoidexpand()Expands the SlideTab panelintReturns the animation duration when expanding or collapsing the panelReturns the caption of the tabcom.vaadin.flow.component.ComponentReturns the component that is shown next to the caption in the tab when the component is expanded, or null if one has not been explicitly set.com.vaadin.flow.component.ComponentReturns the component that is shown next to the caption in the tab when the component is collapsed, or null if one has not been explicitly set.intReturns the fixed size of the content in pixels, may be 0intReturns the z-index of the panelbooleanReturns if the panel should close when clicking outside itbooleanReturns true if expanded or is expandingbooleanReturns true if the tab is visiblebooleanReturns whether or not the panel can be expanded/collapsedvoidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidCalled by the client when clicking outside the panelvoidsetAnimationDuration(int animationDuration) set the animation duration by default 500msvoidsetCaption(String caption) Sets the caption of the tabvoidsetClosingOnOutsideClick(boolean autoCollapsing) Sets if the panel should close when clicking outside itvoidsetCollapseComponent(com.vaadin.flow.component.Component component) Sets the component that should be shown next to the caption in the tab when the component is expanded.voidsetExpandComponent(com.vaadin.flow.component.Component component) Sets the component that should be shown next to the caption in the tab when the component is collapsed.voidsetExpanded(boolean expanded, boolean animated) Expands or collapses the panelvoidsetFixedContentSize(int pixelHeight) Sets a fixed size for the content in pixelsvoidsetTabPosition(SlideTabPosition tabPosition) Controls the position of the tab-panelvoidsetTabVisible(boolean visible) Sets the visibility of the tab.voidsetToggleEnabled(boolean enabled) If set, the panel can not be expanded or collapsedvoidsetZIndex(int zIndex) Defines the z-index of the panel, default 1voidscheduleCollapse(int delayMillis) schedule a collapse in future. will trigger a timer that will collapse the slider a recall within the schedule will cancel the previous onevoidscheduleExpand(boolean value, boolean animated, int delayMillis) schedule a state change of the slider a recall within the schedule will cancel the previous onevoidscheduleExpand(int delayMillis) schedule an expand in future. will trigger a timer that will expand the slider a recall within the schedule will cancel the previous onevoidscheduleToggle(int delayMillis) schedule a change from expand to collapse vice versa in future. a recall within the schedule will cancel the previous onevoidtoggle()Called by the client when clicking on the tabMethods inherited from class com.vaadin.flow.component.littemplate.LitTemplate
getChildrenMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class 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.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
SlideTab
-
-
Method Details
-
expand
public void expand()Expands the SlideTab panel -
collapse
public void collapse()Collapses the SlideTab panel -
toggle
@ClientCallable public void toggle()Called by the client when clicking on the tab -
onOutsideClicked
@ClientCallable public void onOutsideClicked()Called by the client when clicking outside the panel -
setCaption
Sets the caption of the tab -
getCaption
Returns the caption of the tab -
setExpandComponent
public void setExpandComponent(com.vaadin.flow.component.Component component) Sets the component that should be shown next to the caption in the tab when the component is collapsed. -
getExpandComponent
public com.vaadin.flow.component.Component getExpandComponent()Returns the component that is shown next to the caption in the tab when the component is collapsed, or null if one has not been explicitly set. -
setCollapseComponent
public void setCollapseComponent(com.vaadin.flow.component.Component component) Sets the component that should be shown next to the caption in the tab when the component is expanded. -
getCollapseComponent
public com.vaadin.flow.component.Component getCollapseComponent()Returns the component that is shown next to the caption in the tab when the component is expanded, or null if one has not been explicitly set. -
setTabPosition
Controls the position of the tab-panel- Parameters:
tabPosition- by default MIDDLE
-
setClosingOnOutsideClick
public void setClosingOnOutsideClick(boolean autoCollapsing) Sets if the panel should close when clicking outside it -
isClosingOnOutsideClick
public boolean isClosingOnOutsideClick()Returns if the panel should close when clicking outside it -
getAnimationDuration
public int getAnimationDuration()Returns the animation duration when expanding or collapsing the panel- Returns:
- duration in milliseconds
-
setAnimationDuration
public void setAnimationDuration(int animationDuration) set the animation duration by default 500ms- Parameters:
animationDuration- in milliseconds
-
setFixedContentSize
public void setFixedContentSize(int pixelHeight) Sets a fixed size for the content in pixels -
getFixedContentSize
public int getFixedContentSize()Returns the fixed size of the content in pixels, may be 0 -
setZIndex
public void setZIndex(int zIndex) Defines the z-index of the panel, default 1 -
getZIndex
public int getZIndex()Returns the z-index of the panel -
setTabVisible
public void setTabVisible(boolean visible) Sets the visibility of the tab. If the tab is not visible, it can not be used to open or close the panel. -
isTabVisible
public boolean isTabVisible()Returns true if the tab is visible -
setExpanded
public void setExpanded(boolean expanded, boolean animated) Expands or collapses the panel- Parameters:
expanded- true to expandanimated- should be animated or not
-
isExpanded
public boolean isExpanded()Returns true if expanded or is expanding -
scheduleExpand
public void scheduleExpand(boolean value, boolean animated, int delayMillis) schedule a state change of the slider a recall within the schedule will cancel the previous one- Parameters:
value- true means expandanimated- should be animated or notdelayMillis- millis in future the task will happen
-
scheduleToggle
public void scheduleToggle(int delayMillis) schedule a change from expand to collapse vice versa in future. a recall within the schedule will cancel the previous one- Parameters:
delayMillis- millis in future the task will happen
-
scheduleCollapse
public void scheduleCollapse(int delayMillis) schedule a collapse in future. will trigger a timer that will collapse the slider a recall within the schedule will cancel the previous one- Parameters:
delayMillis- millis in future the task will happen
-
scheduleExpand
public void scheduleExpand(int delayMillis) schedule an expand in future. will trigger a timer that will expand the slider a recall within the schedule will cancel the previous one- Parameters:
delayMillis- millis in future the task will happen
-
addToggleListener
public com.vaadin.flow.shared.Registration addToggleListener(com.vaadin.flow.component.ComponentEventListener<SlideToggleEvent> listener) Adds a listener that will be notified when the panel expands or collapses -
setToggleEnabled
public void setToggleEnabled(boolean enabled) If set, the panel can not be expanded or collapsed -
isToggleEnabled
public boolean isToggleEnabled()Returns whether or not the panel can be expanded/collapsed -
onAttach
public void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-