de.matthiasmann.twl
Class TabbedPane

java.lang.Object
  extended by de.matthiasmann.twl.Widget
      extended by de.matthiasmann.twl.TabbedPane

public class TabbedPane
extends Widget

A tabbed pane with support for scrolling the tabs


Nested Class Summary
 class TabbedPane.Tab
           
static class TabbedPane.TabPosition
           
 
Nested classes/interfaces inherited from class de.matthiasmann.twl.Widget
Widget.OffscreenMouseAdjustments, Widget.RenderOffscreen
 
Field Summary
static AnimationState.StateKey STATE_FIRST_TAB
           
static AnimationState.StateKey STATE_LAST_TAB
           
 
Fields inherited from class de.matthiasmann.twl.Widget
STATE_DISABLED, STATE_HAS_FOCUSED_CHILD, STATE_HAS_OPEN_POPUPS, STATE_KEYBOARD_FOCUS
 
Constructor Summary
TabbedPane()
           
 
Method Summary
 TabbedPane.Tab addTab(java.lang.String title, Widget pane)
           
 void cycleTabs(int direction)
           
 TabbedPane.Tab getActiveTab()
           
 int getActiveTabIndex()
           
 int getMinHeight()
          Returns the minimum height of the widget.
 int getMinWidth()
          Returns the minimum width of the widget.
 int getNumTabs()
           
 int getPreferredInnerHeight()
          Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children.
 int getPreferredInnerWidth()
          Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children.
 TabbedPane.Tab getTab(int index)
           
 TabbedPane.TabPosition getTabPosition()
           
 void insertChild(Widget child, int index)
          Inserts a new child into this widget.
 boolean isScrollTabs()
           
protected  void layout()
          Called when the layoutInvalid flag is set.
 void removeAllChildren()
          Removes all children of this widget.
 void removeAllTabs()
           
 Widget removeChild(int index)
          Removes the specified child from this widget.
 void removeTab(TabbedPane.Tab tab)
           
 void setActiveTab(TabbedPane.Tab tab)
           
 void setScrollTabs(boolean scrollTabs)
          Allow the tabs to be scrolled if they don't fit into the available space.
 void setTabPosition(TabbedPane.TabPosition tabPosition)
           
protected  void updateTabStates()
           
 
Methods inherited from class de.matthiasmann.twl.Widget
add, addActionMapping, addPropertyChangeListener, addPropertyChangeListener, adjustSize, afterAddToGUI, allChildrenRemoved, applyTheme, applyThemeBackground, applyThemeBorder, applyThemeInputMap, applyThemeMaxSize, applyThemeMinSize, applyThemeMouseCursor, applyThemeOffscreenExtra, applyThemeOverlay, applyThemeTooltip, beforeRemoveFromGUI, borderChanged, canAcceptKeyboardFocus, childAdded, childInvalidateLayout, childRemoved, childVisibilityChanged, computeSize, destroy, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, focusFirstChild, focusLastChild, focusNextChild, focusPrevChild, getActionMap, getAnimationState, getBackground, getBorderBottom, getBorderHorizontal, getBorderLeft, getBorderRight, getBorderTop, getBorderVertical, getBottom, getChild, getChildAt, getChildIndex, getGUI, getHeight, getInnerBottom, getInnerHeight, getInnerRight, getInnerWidth, getInnerX, getInnerY, getInputMap, getKeyboardFocusOrder, getMaxHeight, getMaxWidth, getMouseCursor, getMouseCursor, getNumChildren, getOffscreenExtraBottom, getOffscreenExtraLeft, getOffscreenExtraRight, getOffscreenExtraTop, getOrCreateActionMap, getOverlay, getParent, getPreferredHeight, getPreferredWidth, getRenderOffscreen, getRight, getRootWidget, getTheme, getThemePath, getThemeTooltipContent, getTintAnimator, getTooltipContent, getTooltipContentAt, getWidgetAt, getWidth, getX, getY, giveupKeyboardFocus, handleEvent, handleKeyStrokeAction, hasKeyboardFocus, hasOpenPopups, hasSharedAnimationState, invalidateLayout, invalidateLayoutLocally, isAbsoluteTheme, isClip, isDepthFocusTraversal, isEnabled, isFocusKeyEnabled, isInside, isLocallyEnabled, isMouseInside, isVisible, keyboardFocusChildChanged, keyboardFocusGained, keyboardFocusGained, keyboardFocusLost, layoutChildFullInnerArea, layoutChildrenFullInnerArea, moveChild, paint, paintBackground, paintChild, paintChildren, paintDragOverlay, paintOverlay, paintWidget, positionChanged, reapplyTheme, removeChild, removePropertyChangeListener, removePropertyChangeListener, requestKeyboardFocus, requestKeyboardFocus, resetTooltip, setActionMap, setBackground, setBorderSize, setBorderSize, setBorderSize, setBorderSize, setCanAcceptKeyboardFocus, setClip, setDepthFocusTraversal, setEnabled, setFocusKeyEnabled, setInnerSize, setInputMap, setMaxSize, setMinSize, setMouseCursor, setOffscreenExtra, setOffscreenExtra, setOverlay, setPosition, setRenderOffscreen, setSize, setTheme, setTintAnimator, setTooltipContent, setVisible, sizeChanged, updateTintAnimation, updateTooltip, validateLayout, widgetDisabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_FIRST_TAB

public static final AnimationState.StateKey STATE_FIRST_TAB

STATE_LAST_TAB

public static final AnimationState.StateKey STATE_LAST_TAB
Constructor Detail

TabbedPane

public TabbedPane()
Method Detail

getTabPosition

public TabbedPane.TabPosition getTabPosition()

setTabPosition

public void setTabPosition(TabbedPane.TabPosition tabPosition)

isScrollTabs

public boolean isScrollTabs()

setScrollTabs

public void setScrollTabs(boolean scrollTabs)
Allow the tabs to be scrolled if they don't fit into the available space. Default is false. If disabled the minimum size of the tabbed pane ensures that all tabs fit. If enabled additional scroll controlls are displayed.

Parameters:
scrollTabs - true if tabs should scroll

addTab

public TabbedPane.Tab addTab(java.lang.String title,
                             Widget pane)

getActiveTab

public TabbedPane.Tab getActiveTab()

setActiveTab

public void setActiveTab(TabbedPane.Tab tab)

removeTab

public void removeTab(TabbedPane.Tab tab)

removeAllTabs

public void removeAllTabs()

getNumTabs

public int getNumTabs()

getTab

public TabbedPane.Tab getTab(int index)

getActiveTabIndex

public int getActiveTabIndex()

cycleTabs

public void cycleTabs(int direction)

getMinWidth

public int getMinWidth()
Description copied from class: Widget
Returns the minimum width of the widget. Layout manager will allocate atleast the minimum width to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Overrides:
getMinWidth in class Widget
Returns:
the minimum width of the widget

getMinHeight

public int getMinHeight()
Description copied from class: Widget
Returns the minimum height of the widget. Layout manager will allocate atleast the minimum height to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Overrides:
getMinHeight in class Widget
Returns:
the minimum height of the widget

getPreferredInnerWidth

public int getPreferredInnerWidth()
Description copied from class: Widget
Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerWidth in class Widget
Returns:
the preferred inner width

getPreferredInnerHeight

public int getPreferredInnerHeight()
Description copied from class: Widget
Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerHeight in class Widget
Returns:
the preferred inner height

layout

protected void layout()
Description copied from class: Widget
Called when the layoutInvalid flag is set. The default implementation does nothing.

Overrides:
layout in class Widget

insertChild

public void insertChild(Widget child,
                        int index)
Description copied from class: Widget
Inserts a new child into this widget. The position of the child is treated as relative to this widget and adjusted. If a theme was applied to this widget then this theme is also applied to the new child.

Overrides:
insertChild in class Widget
Parameters:
child - the child that should be inserted
index - the index where it should be inserted

removeAllChildren

public void removeAllChildren()
Description copied from class: Widget
Removes all children of this widget. The position of the all removed children is changed to the relative position to this widget. Calls allChildrenRemoved after removing all children.

Overrides:
removeAllChildren in class Widget
See Also:
Widget.allChildrenRemoved()

removeChild

public Widget removeChild(int index)
Description copied from class: Widget
Removes the specified child from this widget. The position of the removed child is changed to the relative position to this widget. Calls invalidateLayout after removing the child.

Overrides:
removeChild in class Widget
Parameters:
index - the index of the child
Returns:
the removed widget
See Also:
Widget.invalidateLayout()

updateTabStates

protected void updateTabStates()