Package snap.view

Class TabBar

All Implemented Interfaces:
PropChange.DoChange, Selectable<Tab>, XMLArchiver.Archivable

public class TabBar extends ParentView implements Selectable<Tab>
This class manages and displays a list of tabs.
  • Field Details

  • Constructor Details

    • TabBar

      public TabBar()
      Constructor.
  • Method Details

    • getTabs

      public List<Tab> getTabs()
      Returns the tabs.
    • getTabCount

      public int getTabCount()
      Returns the number of tabs in pane.
    • getTab

      public Tab getTab(int anIndex)
      Returns the tab at given index.
    • addTab

      public void addTab(Tab aTab)
      Adds a tab.
    • addTab

      public void addTab(Tab aTab, int anIndex)
      Adds a tab at given index.
    • removeTab

      public void removeTab(int anIndex)
      Removes the tab at given index.
    • removeTab

      public void removeTab(Tab aTab)
      Removes the given tab.
    • removeTabs

      public void removeTabs()
      Removes all tabs.
    • addTab

      public void addTab(String aTitle, View aView)
      Creates and adds a tab for given name and content view.
    • isAllowEmptySelection

      public boolean isAllowEmptySelection()
      Returns whether it is acceptable for tool bar to have no button selected. If true, clicking the selected button results in it being deselected.
    • setAllowEmptySelection

      public void setAllowEmptySelection(boolean aValue)
      Sets whether it is acceptable for tool bar to have no button selected.
    • getTabCloseActionHandler

      public BiConsumer<ViewEvent,Tab> getTabCloseActionHandler()
      Returns the tab close action handler, called when a tab button close box is triggered.
    • setTabCloseActionHandler

      public void setTabCloseActionHandler(BiConsumer<ViewEvent,Tab> eventListener)
      Sets the tab close action handler, called when a tab button close box is triggered.
    • getTabTitle

      public String getTabTitle(int anIndex)
      Returns tab content at index.
    • getTabMinWidth

      public double getTabMinWidth()
      Returns the tab min width.
    • setTabMinWidth

      public void setTabMinWidth(double aValue)
      Sets the tab min width.
    • getSelIndex

      public int getSelIndex()
      Returns the tap pane's selected index.
      Specified by:
      getSelIndex in interface Selectable<Tab>
    • setSelIndex

      public void setSelIndex(int anIndex)
      Sets the TabView's selected index.
      Specified by:
      setSelIndex in interface Selectable<Tab>
    • getSelItem

      public Tab getSelItem()
      Returns the selected item (tab).
      Specified by:
      getSelItem in interface Selectable<Tab>
    • setSelItem

      public void setSelItem(Tab aTab)
      Sets the selected item (tab).
      Specified by:
      setSelItem in interface Selectable<Tab>
    • getTabButton

      public ToggleButton getTabButton(int anIndex)
      Returns a tab button.
    • getTabsBox

      public ParentView getTabsBox()
      Returns the actual box that holds the tabs.
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to layout children with BoxView layout.
      Overrides:
      layoutImpl in class ParentView
    • tabButtonDidFireAction

      protected void tabButtonDidFireAction(ViewEvent anEvent)
      Called when tab button fires action.
    • getChildForName

      public View getChildForName(String aName)
      Override to search Tabs.Content not showing.
      Overrides:
      getChildForName in class ParentView