com.threerings.opengl.gui
Class TabbedPane

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.TabbedPane
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Selectable<Component>

public class TabbedPane
extends Container
implements Selectable<Component>

Displays one of a set of components (tabs) depending on which tab is selected.


Nested Class Summary
protected static class TabbedPane.Tab
           
 
Nested classes/interfaces inherited from class com.threerings.opengl.gui.Container
Container.ChildOp
 
Field Summary
protected  Container _buttons
           
protected  Button _close
           
protected  ActionListener _closer
           
protected  ActionListener _selector
           
protected  int _selidx
           
protected  ArrayList<TabbedPane.Tab> _tabs
           
protected  Container _top
           
static String SELECTION_CHANGED
          Deprecated. 
 
Fields inherited from class com.threerings.opengl.gui.Container
_children, _layout
 
Fields inherited from class com.threerings.opengl.gui.Component
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Fields inherited from interface com.threerings.opengl.gui.Selectable
SELECT
 
Constructor Summary
TabbedPane(GlContext ctx)
          Creates a tabbed pane with left justified buttons.
TabbedPane(GlContext ctx, GroupLayout.Justification tabAlign)
          Creates a tabbed pane.
TabbedPane(GlContext ctx, GroupLayout.Justification tabAlign, int gap)
          Creates a tabbed pane.
 
Method Summary
 void addTab(String title, Component tab)
          Adds a tab to the pane using the specified title with no close button.
 void addTab(String title, Component tab, boolean hasClose)
          Adds a tab to the pane using the specified title.
 void addTab(String title, Component tab, boolean hasClose, ConfigReference<StyleConfig> style)
          Adds a tab to the pane using the specified title.
protected  String getDefaultStyleConfig()
          Returns the name of the default config to be used for all instances of this component.
 Component getSelected()
          Get the selected item, if any.
 int getSelectedIndex()
          Get the index of the selected item, or -1.
 Component getSelectedTab()
          Deprecated. 
 int getSelectedTabIndex()
          Deprecated. 
 Component getTab(int idx)
          Returns the tab at the specified index.
 ToggleButton getTabButton(Component tab)
          Returns a reference to the tab button for the given tab.
 ToggleButton getTabButton(int idx)
          Returns a reference to the tab button at the given index.
 int getTabCount()
          Returns the number of tabs in this pane.
 int indexOfTab(Component tab)
          Returns the index of the given tab.
 void removeAllTabs()
          Removes all tabs.
 void removeTab(Component tab)
          Removes the specified tab.
 void removeTab(int tabidx)
          Removes the tab at the specified index.
 void removeTab(int tabidx, boolean btnClose)
          Removes the tab at the specified index.
 void replaceTab(Component otab, Component ntab)
          Replaces the specified tab component.
 void replaceTab(int tabidx, Component ntab)
          Replaces the tab component at the specified index.
 void selectTab(Component tab)
          Deprecated. 
 void selectTab(int tabidx)
          Deprecated. 
protected  void selectTab(int tabidx, long when, int modifiers)
          Selects the tab with the specified index.
 void setGap(int gap)
          Sets the gap between the tab buttons.
 void setSelected(Component tab)
          Set the selected item.
 void setSelectedIndex(int index)
          Set the index of the selected item.
 void setTabAlignment(GroupLayout.Justification tabAlign)
          Sets the justification for the tab buttons.
protected  void tabWasRemoved(Component tab, boolean btnClose)
          Called when a tab was removed.
protected  void updateClose(boolean showClose)
          Updates the visibility of the close tab button.
 
Methods inherited from class com.threerings.opengl.gui.Container
add, add, add, add, applyOperation, computePreferredSize, getComponent, getComponentCount, getComponentIndex, getFirstDescendantFocus, getHitComponent, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, layout, remove, remove, removeAll, renderComponent, replace, setAlpha, setEnabled, setHoverable, setLayoutManager, validate, wasAdded, wasRemoved
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, changeCursor, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFallbackState, getFocusTarget, getHeight, getInsets, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getWindow, getX, getY, hasFocus, intersectScissor, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, scrollRectToVisible, scrollRectToVisible, setBackground, setBounds, setCursor, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, stateDidChange, updateCursor, updateFromStyleConfig, updateFromStyleConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTION_CHANGED

@Deprecated
public static final String SELECTION_CHANGED
Deprecated. 
See Also:
Constant Field Values

_selector

protected ActionListener _selector

_closer

protected ActionListener _closer

_tabs

protected ArrayList<TabbedPane.Tab> _tabs

_selidx

protected int _selidx

_top

protected Container _top

_buttons

protected Container _buttons

_close

protected Button _close
Constructor Detail

TabbedPane

public TabbedPane(GlContext ctx)
Creates a tabbed pane with left justified buttons.


TabbedPane

public TabbedPane(GlContext ctx,
                  GroupLayout.Justification tabAlign)
Creates a tabbed pane.

Parameters:
tabAlign - the justification for the tab buttons.

TabbedPane

public TabbedPane(GlContext ctx,
                  GroupLayout.Justification tabAlign,
                  int gap)
Creates a tabbed pane.

Parameters:
tabAlign - the justification for the tab buttons.
gap - the number of pixels space between each tab button.
Method Detail

setTabAlignment

public void setTabAlignment(GroupLayout.Justification tabAlign)
Sets the justification for the tab buttons.


setGap

public void setGap(int gap)
Sets the gap between the tab buttons.


addTab

public void addTab(String title,
                   Component tab)
Adds a tab to the pane using the specified title with no close button.


addTab

public void addTab(String title,
                   Component tab,
                   boolean hasClose)
Adds a tab to the pane using the specified title.


addTab

public void addTab(String title,
                   Component tab,
                   boolean hasClose,
                   ConfigReference<StyleConfig> style)
Adds a tab to the pane using the specified title.


replaceTab

public void replaceTab(Component otab,
                       Component ntab)
Replaces the specified tab component.


replaceTab

public void replaceTab(int tabidx,
                       Component ntab)
Replaces the tab component at the specified index.


removeTab

public void removeTab(Component tab)
Removes the specified tab.


removeTab

public void removeTab(int tabidx)
Removes the tab at the specified index.


removeTab

public void removeTab(int tabidx,
                      boolean btnClose)
Removes the tab at the specified index.

Parameters:
btnClose - set to true if the tab was removed by the close button

removeAllTabs

public void removeAllTabs()
Removes all tabs.


getTabCount

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


getSelected

public Component getSelected()
Description copied from interface: Selectable
Get the selected item, if any.

Specified by:
getSelected in interface Selectable<Component>

setSelected

public void setSelected(Component tab)
Description copied from interface: Selectable
Set the selected item.

Specified by:
setSelected in interface Selectable<Component>

getSelectedIndex

public int getSelectedIndex()
Description copied from interface: Selectable
Get the index of the selected item, or -1.

Specified by:
getSelectedIndex in interface Selectable<Component>

setSelectedIndex

public void setSelectedIndex(int index)
Description copied from interface: Selectable
Set the index of the selected item.

Specified by:
setSelectedIndex in interface Selectable<Component>

selectTab

@Deprecated
public void selectTab(Component tab)
Deprecated. 


selectTab

@Deprecated
public void selectTab(int tabidx)
Deprecated. 


getSelectedTab

@Deprecated
public Component getSelectedTab()
Deprecated. 


getSelectedTabIndex

@Deprecated
public int getSelectedTabIndex()
Deprecated. 


getTabButton

public ToggleButton getTabButton(Component tab)
Returns a reference to the tab button for the given tab.


getTabButton

public ToggleButton getTabButton(int idx)
Returns a reference to the tab button at the given index.


getTab

public Component getTab(int idx)
Returns the tab at the specified index.


indexOfTab

public int indexOfTab(Component tab)
Returns the index of the given tab.


selectTab

protected void selectTab(int tabidx,
                         long when,
                         int modifiers)
Selects the tab with the specified index.


updateClose

protected void updateClose(boolean showClose)
Updates the visibility of the close tab button.


tabWasRemoved

protected void tabWasRemoved(Component tab,
                             boolean btnClose)
Called when a tab was removed.

Parameters:
btnClose - set to true if the tab was removed by the close button

getDefaultStyleConfig

protected String getDefaultStyleConfig()
Description copied from class: Component
Returns the name of the default config to be used for all instances of this component. Derived classes will likely want to override this method and set up a default config for their type of component.

Overrides:
getDefaultStyleConfig in class Container