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 Classes
    Modifier and Type
    Class
    Description
    class 
    A utility class for wrapping a command in a TimerTask and running it in the UI
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    void
    Collapses the SlideTab panel
    void
    Expands the SlideTab panel
    int
    Returns the animation duration when expanding or collapsing the panel
    Returns the caption of the tab
    com.vaadin.flow.component.Component
    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.
    com.vaadin.flow.component.Component
    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.
    int
    Returns the fixed size of the content in pixels, may be 0
    int
    Returns the z-index of the panel
    boolean
    Returns if the panel should close when clicking outside it
    boolean
    Returns true if expanded or is expanding
    boolean
    Returns true if the tab is visible
    boolean
    Returns whether or not the panel can be expanded/collapsed
    void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    void
    Called by the client when clicking outside the panel
    void
    setAnimationDuration(int animationDuration)
    set the animation duration by default 500ms
    void
    setCaption(String caption)
    Sets the caption of the tab
    void
    setClosingOnOutsideClick(boolean autoCollapsing)
    Sets if the panel should close when clicking outside it
    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.
    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.
    void
    setExpanded(boolean expanded, boolean animated)
    Expands or collapses the panel
    void
    setFixedContentSize(int pixelHeight)
    Sets a fixed size for the content in pixels
    void
    Controls the position of the tab-panel
    void
    setTabVisible(boolean visible)
    Sets the visibility of the tab.
    void
    setToggleEnabled(boolean enabled)
    If set, the panel can not be expanded or collapsed
    void
    setZIndex(int zIndex)
    Defines the z-index of the panel, default 1
    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
    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
    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
    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
    void
    Called by the client when clicking on the tab

    Methods inherited from class com.vaadin.flow.component.littemplate.LitTemplate

    getChildren

    Methods 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, setVisible

    Methods inherited from class 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.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

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

    getElement

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

    isEnabled, setEnabled

    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
  • Constructor Details

  • 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

      public void setCaption(String caption)
      Sets the caption of the tab
    • getCaption

      public String 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

      public void setTabPosition(SlideTabPosition tabPosition)
      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 expand
      animated - 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 expand
      animated - should be animated or not
      delayMillis - 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:
      onAttach in class com.vaadin.flow.component.Component