bibliothek.gui.dock.station.stack
Class DefaultStackDockComponent

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTabbedPane
                  extended by bibliothek.gui.dock.station.stack.DefaultStackDockComponent
All Implemented Interfaces:
StackDockComponent, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
BasicStackDockComponent

public class DefaultStackDockComponent
extends JTabbedPane
implements StackDockComponent

The standard-implementation of StackDockComponent. This implementation uses a JTabbedPane to display its children.

Author:
Janni Kovacs, Benjamin Sigg
See Also:
StackDockComponent, JTabbedPane, Serialized Form

Nested Class Summary
 class DefaultStackDockComponent.Tab
          Representation of a single tab of this StackDockComponent.
 
Nested classes/interfaces inherited from class javax.swing.JTabbedPane
JTabbedPane.AccessibleJTabbedPane, JTabbedPane.ModelListener
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JTabbedPane
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DefaultStackDockComponent()
          Constructs the component, sets the location of the tabs to bottom.
 
Method Summary
 void addStackDockComponentListener(StackDockComponentListener listener)
          Adds a listener to this component, it will be called if the selection changes.
 void addTab(String title, Icon icon, Component comp, Dockable dockable)
          Adds a new child at an unspecified location.
 DockElementRepresentative createDefaultRepresentation(DockElement target)
          Creates and returns a new DockElementRepresentative representing target, the new representation is to be used to cover all the empty areas on this StackDockComponent.
protected  DefaultStackDockComponent.Tab createTab(Dockable dockable)
          Creates a new representation of a tab on this component.
 Component getComponent()
          Gets a Component on which the children of this StackDockComponent will be displayed.
 Dockable getDockableAt(int index)
          Gets the Dockable which was placed at the index'th position.
 TabPlacement getDockTabPlacement()
          Tells at which side tabs should be displayer.
 int getIndexOfTabAt(Point mouseLocation)
          Gets the index of the tab that is beneath mouseLocation.
 Dimension getMinimumSize()
           
 DockElementRepresentative getTabAt(int index)
          The structure of the JTabbedPane does not allow its tabs to recognized as DockElementRepresentative, hence this method always returns null.
 boolean hasBorder()
          Whether this kind of component already has a border.
 int indexOf(Dockable dockable)
           
 void insertTab(String title, Icon icon, Component comp, Dockable dockable, int index)
          Adds a new child at the location index.
 boolean isSingleTabComponent()
          Tells whether this StackDockComponent should be shown even if the StackDockStation has only one child.
 void moveTab(int source, int destination)
          Moves the tab at source to location destination.
 void remove(int index)
          Removes the child at location index.
 void removeAll()
          Removes all children from this component
 void removeStackDockComponentListener(StackDockComponentListener listener)
          Removes listener from this component.
 void setController(DockController controller)
          Sets the controller for which this component manages its children.
 void setDockTabPlacement(TabPlacement tabSide)
          Sets at which side tabs should be displayed.
 void setTitleAt(int index, String title)
          Sets the title of the child at location index.
 void setTooltipAt(int index, String newTooltip)
          Sets the tooltip of the child at location index.
 
Methods inherited from class javax.swing.JTabbedPane
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, fireStateChanged, getAccessibleContext, getBackgroundAt, getBoundsAt, getChangeListeners, getComponentAt, getDisabledIconAt, getDisplayedMnemonicIndexAt, getForegroundAt, getIconAt, getMnemonicAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getTitleAt, getToolTipText, getToolTipTextAt, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, insertTab, isEnabledAt, paramString, remove, removeChangeListener, removeTabAt, setBackgroundAt, setComponentAt, setDisabledIconAt, setDisplayedMnemonicIndexAt, setEnabledAt, setForegroundAt, setIconAt, setMnemonicAt, setModel, setSelectedComponent, setSelectedIndex, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, setToolTipTextAt, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.station.stack.StackDockComponent
getBoundsAt, getSelectedIndex, getTabCount, setComponentAt, setIconAt, setSelectedIndex
 

Constructor Detail

DefaultStackDockComponent

public DefaultStackDockComponent()
Constructs the component, sets the location of the tabs to bottom.

Method Detail

addStackDockComponentListener

public void addStackDockComponentListener(StackDockComponentListener listener)
Description copied from interface: StackDockComponent
Adds a listener to this component, it will be called if the selection changes.

Specified by:
addStackDockComponentListener in interface StackDockComponent
Parameters:
listener - the new listener, not null

removeStackDockComponentListener

public void removeStackDockComponentListener(StackDockComponentListener listener)
Description copied from interface: StackDockComponent
Removes listener from this component.

Specified by:
removeStackDockComponentListener in interface StackDockComponent
Parameters:
listener - the listener to remove

setDockTabPlacement

public void setDockTabPlacement(TabPlacement tabSide)
Description copied from interface: StackDockComponent
Sets at which side tabs should be displayed.

Specified by:
setDockTabPlacement in interface StackDockComponent
Parameters:
tabSide - the side, not null

getDockTabPlacement

public TabPlacement getDockTabPlacement()
Description copied from interface: StackDockComponent
Tells at which side tabs should be displayer.

Specified by:
getDockTabPlacement in interface StackDockComponent
Returns:
the placement, not null
See Also:
StackDockComponent.setDockTabPlacement(TabPlacement)

insertTab

public void insertTab(String title,
                      Icon icon,
                      Component comp,
                      Dockable dockable,
                      int index)
Description copied from interface: StackDockComponent
Adds a new child at the location index.

Specified by:
insertTab in interface StackDockComponent
Parameters:
title - the title of the child
icon - an icon to display for the child or null
comp - the new child to display
dockable - the Dockable for which the tab is used
index - the index that the new child should have

createTab

protected DefaultStackDockComponent.Tab createTab(Dockable dockable)
Creates a new representation of a tab on this component.

Parameters:
dockable - the element which is represented by the tab
Returns:
the new tab

addTab

public void addTab(String title,
                   Icon icon,
                   Component comp,
                   Dockable dockable)
Description copied from interface: StackDockComponent
Adds a new child at an unspecified location.

Specified by:
addTab in interface StackDockComponent
Parameters:
title - the title of the child
icon - an icon to display for the child or null
comp - the new child to display
dockable - the Dockable for which the tab is used

getDockableAt

public Dockable getDockableAt(int index)
Description copied from interface: StackDockComponent
Gets the Dockable which was placed at the index'th position.

Specified by:
getDockableAt in interface StackDockComponent
Parameters:
index - the position of the element
Returns:
the element

getTabAt

public DockElementRepresentative getTabAt(int index)
The structure of the JTabbedPane does not allow its tabs to recognized as DockElementRepresentative, hence this method always returns null.

Specified by:
getTabAt in interface StackDockComponent
Parameters:
index - ignored
Returns:
null

moveTab

public void moveTab(int source,
                    int destination)
Description copied from interface: StackDockComponent
Moves the tab at source to location destination.

Specified by:
moveTab in interface StackDockComponent
Parameters:
source - the item to move
destination - the target destination

removeAll

public void removeAll()
Description copied from interface: StackDockComponent
Removes all children from this component

Specified by:
removeAll in interface StackDockComponent
Overrides:
removeAll in class JTabbedPane

remove

public void remove(int index)
Description copied from interface: StackDockComponent
Removes the child at location index.

Specified by:
remove in interface StackDockComponent
Overrides:
remove in class JTabbedPane
Parameters:
index - the index of the child

getComponent

public Component getComponent()
Description copied from interface: StackDockComponent
Gets a Component on which the children of this StackDockComponent will be displayed.

Specified by:
getComponent in interface StackDockComponent
Returns:
the Component

setTitleAt

public void setTitleAt(int index,
                       String title)
Description copied from interface: StackDockComponent
Sets the title of the child at location index.

Specified by:
setTitleAt in interface StackDockComponent
Overrides:
setTitleAt in class JTabbedPane
Parameters:
index - the index of the child
title - the new title

setTooltipAt

public void setTooltipAt(int index,
                         String newTooltip)
Description copied from interface: StackDockComponent
Sets the tooltip of the child at location index.

Specified by:
setTooltipAt in interface StackDockComponent
Parameters:
index - the index of the child
newTooltip - the new tooltip, can be null

setController

public void setController(DockController controller)
Description copied from interface: StackDockComponent
Sets the controller for which this component manages its children.

Specified by:
setController in interface StackDockComponent
Parameters:
controller - the controller or null

hasBorder

public boolean hasBorder()
Description copied from interface: StackDockComponent
Whether this kind of component already has a border.

Specified by:
hasBorder in interface StackDockComponent
Returns:
true if this has a border, false if the parent should paint one.

isSingleTabComponent

public boolean isSingleTabComponent()
Description copied from interface: StackDockComponent
Tells whether this StackDockComponent should be shown even if the StackDockStation has only one child.

Specified by:
isSingleTabComponent in interface StackDockComponent
Returns:
true if this component should always be shown

createDefaultRepresentation

public DockElementRepresentative createDefaultRepresentation(DockElement target)
Description copied from interface: StackDockComponent
Creates and returns a new DockElementRepresentative representing target, the new representation is to be used to cover all the empty areas on this StackDockComponent.

Specified by:
createDefaultRepresentation in interface StackDockComponent
Parameters:
target - the target for the new representative, may or may not be a child of this component, not null
Returns:
the new representation, can be null if this StackDockComponent does not allow to use its free spaces

getIndexOfTabAt

public int getIndexOfTabAt(Point mouseLocation)
Description copied from interface: StackDockComponent
Gets the index of the tab that is beneath mouseLocation.

Specified by:
getIndexOfTabAt in interface StackDockComponent
Parameters:
mouseLocation - the location of the mouse on the component
Returns:
the index of a tab or -1

indexOf

public int indexOf(Dockable dockable)

getMinimumSize

public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent