Package snap.view

Class TabView

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

public class TabView extends ParentView implements Selectable<Tab>
A View subclass to show multiple children under user selectable tabs.
  • Field Details

  • Constructor Details

    • TabView

      public TabView()
      Creates a new TabView.
  • Method Details

    • getTabSide

      public Side getTabSide()
      Returns the side where tabs are shown.
    • setTabSide

      public void setTabSide(Side aSide)
      Sets the side where tabs are shown.
    • isClassic

      public boolean isClassic()
      Returns whether tab view should render tabs in classic style.
    • setClassic

      public void setClassic(boolean aValue)
      Sets whether tab view should render tabs in classic style.
    • getTabBar

      public TabBar getTabBar()
      Returns the TabBar.
    • getContentBox

      public BoxView getContentBox()
      Returns the ContentBox.
    • 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.
    • addTab

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

      public boolean isAnimateTabChange()
      Returns whether to animate tab changes.
    • setAnimateTabChange

      public void setAnimateTabChange(boolean aValue)
      Sets whether to animate tab changes.
    • 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>
    • getContent

      public View getContent()
      Returns the selected child.
    • setContent

      protected void setContent(View aView)
      Sets the current tab content.
    • 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 ColView layout.
      Overrides:
      layoutImpl in class ParentView
    • paintAbove

      protected void paintAbove(Painter aPntr)
      Override to clear border under selected tab if tabs are configured like actual tabs.
      Overrides:
      paintAbove in class ParentView
    • setShowing

      protected void setShowing(boolean aValue)
      Override to trigger content contentBoxDidContentChange() when first showing.
      Overrides:
      setShowing in class ParentView
    • themeChanged

      protected void themeChanged()
      Called when Theme changes.
      Overrides:
      themeChanged in class ParentView
    • tabBarDidFireAction

      protected void tabBarDidFireAction(ViewEvent anEvent)
      Called when TabBar does fireAction
    • setOwnerChildren

      protected void setOwnerChildren(ViewOwner anOwner)
      Override to suppress so TabBar doesn't fireAction to Owner.
      Overrides:
      setOwnerChildren in class ParentView
    • toXMLView

      public XMLElement toXMLView(XMLArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLView in class ParentView
    • toXMLChildren

      public void toXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML archival deep.
      Overrides:
      toXMLChildren in class ParentView
    • fromXMLChildren

      public void fromXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival for children. Only panels do anything here so far.
      Overrides:
      fromXMLChildren in class ParentView