bibliothek.gui.dock
Class DefaultDockable

java.lang.Object
  extended by bibliothek.gui.dock.dockable.AbstractDockable
      extended by bibliothek.gui.dock.DefaultDockable
All Implemented Interfaces:
DockElement, DockElementRepresentative, PlaceholderListItem<Dockable>, Dockable
Direct Known Subclasses:
DefaultCommonDockable

public class DefaultDockable
extends AbstractDockable

A Dockable which consists only of one Component called "content pane". It's possible to add or remove components from the content pane at any time.

Author:
Benjamin Sigg

Constructor Summary
DefaultDockable()
          Constructs a new DefaultDockable
DefaultDockable(java.awt.Component component)
          Constructs a new DefaultDockable and places one component onto the content pane.
DefaultDockable(java.awt.Component component, javax.swing.Icon icon)
          Constructs a new DefaultDockable, sets an icon and places one component.
DefaultDockable(java.awt.Component component, java.lang.String title)
          Constructs a new DefaultDockable, sets the title and places one component.
DefaultDockable(java.awt.Component component, java.lang.String title, javax.swing.Icon icon)
          Constructs a new DefaultDockable, sets the icon and the title, and places a component.
DefaultDockable(javax.swing.Icon icon)
          Constructs a new DefaultDockable and sets the icon.
DefaultDockable(java.lang.String title)
          Constructs a new DefaultDockable and sets the title.
 
Method Summary
 void add(java.awt.Component component)
          Adds component to the content pane.
 void add(java.awt.Component component, java.lang.Object constraints)
          Adds component to the content pane.
 DockStation asDockStation()
          Returns this if this is an instance of DockStation.
protected  DockIcon createTitleIcon()
          Creates the DockIcon which represents this Dockable or this DockStation.
 java.awt.Component getComponent()
          Gets the Component which represents the element.
 java.awt.Container getContentPane()
          Gets a panel for children of this Dockable.
 java.lang.String getFactoryID()
          Gets the unique name of the DockFactory which can read and write elements of this type.
 void remove(java.awt.Component component)
          Removes component from the content pane.
 void setController(DockController controller)
          Sets the controller in whose realm this Dockable is.
 void setFactoryID(java.lang.String factoryId)
          Sets the id for the DockFactory which will be used to store and load this dockable.
 void setLayout(java.awt.LayoutManager layout)
          Sets the layout of the content pane.
 
Methods inherited from class bibliothek.gui.dock.dockable.AbstractDockable
accept, accept, addDockableListener, addDockableStateListener, addDockHierarchyListener, addKeyListener, addMouseInputListener, asDockable, bind, configureDisplayerHints, fireTitleBound, fireTitleExchanged, fireTitleExchanged, fireTitleIconChanged, fireTitleTextChanged, fireTitleTooltipChanged, fireTitleUnbound, getConfigurableDisplayerHints, getController, getDockableStateListeners, getDockElementObserver, getDockParent, getElement, getGlobalActionOffers, getLocalActionOffers, getPopupLocation, getTitleIcon, getTitleText, getTitleToolTip, isDockableVisible, isUsedAsTitle, listBoundTitles, removeDockableListener, removeDockableStateListener, removeDockHierarchyListener, removeKeyListener, removeMouseInputListener, requestDockTitle, resetTitleIcon, setActionOffers, setDockParent, setTitleIcon, setTitleText, setTitleToolTip, shouldFocus, shouldTransfersFocus, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDockable

public DefaultDockable()
Constructs a new DefaultDockable


DefaultDockable

public DefaultDockable(javax.swing.Icon icon)
Constructs a new DefaultDockable and sets the icon.

Parameters:
icon - the icon, to be shown at various places

DefaultDockable

public DefaultDockable(java.lang.String title)
Constructs a new DefaultDockable and sets the title.

Parameters:
title - the title, to be shown at various places

DefaultDockable

public DefaultDockable(java.awt.Component component)
Constructs a new DefaultDockable and places one component onto the content pane.

Parameters:
component - the only child of the content pane

DefaultDockable

public DefaultDockable(java.awt.Component component,
                       javax.swing.Icon icon)
Constructs a new DefaultDockable, sets an icon and places one component.

Parameters:
component - the only child of the content pane
icon - the icon, to be shown at various places

DefaultDockable

public DefaultDockable(java.awt.Component component,
                       java.lang.String title)
Constructs a new DefaultDockable, sets the title and places one component.

Parameters:
component - the only child of the content pane
title - the title, to be shown at various places

DefaultDockable

public DefaultDockable(java.awt.Component component,
                       java.lang.String title,
                       javax.swing.Icon icon)
Constructs a new DefaultDockable, sets the icon and the title, and places a component.

Parameters:
component - the only child of the content pane
title - the title, to be shown at various places
icon - the icon, to be shown at various places
Method Detail

createTitleIcon

protected DockIcon createTitleIcon()
Description copied from class: AbstractDockable
Creates the DockIcon which represents this Dockable or this DockStation. The icon must call AbstractDockable.fireTitleIconChanged(Icon, Icon) if the icon changes.

Specified by:
createTitleIcon in class AbstractDockable
Returns:
the default icon for this element

getFactoryID

public java.lang.String getFactoryID()
Description copied from interface: DockElement
Gets the unique name of the DockFactory which can read and write elements of this type.

Returns:
the id of the factory

setFactoryID

public void setFactoryID(java.lang.String factoryId)
Sets the id for the DockFactory which will be used to store and load this dockable.

Parameters:
factoryId - the id of the factory

getComponent

public java.awt.Component getComponent()
Description copied from interface: DockElementRepresentative
Gets the Component which represents the element. The result of this method must not change.

Returns:
the component, never null

asDockStation

public DockStation asDockStation()
Description copied from interface: DockElement
Returns this if this is an instance of DockStation. Otherwise null is returned.

Returns:
this or null. Must not return null if DockElement.asDockable() already returns null

getContentPane

public java.awt.Container getContentPane()
Gets a panel for children of this Dockable. Clients can do whatever they like, except removing the content pane from its parent.

Returns:
the representation of this dockable

add

public void add(java.awt.Component component)
Adds component to the content pane.

Parameters:
component - the new child

add

public void add(java.awt.Component component,
                java.lang.Object constraints)
Adds component to the content pane.

Parameters:
component - the new child
constraints - information for th LayoutManager

remove

public void remove(java.awt.Component component)
Removes component from the content pane.

Parameters:
component - the child to remove

setLayout

public void setLayout(java.awt.LayoutManager layout)
Sets the layout of the content pane. The layout is normaly a FlowLayout, except the constructor has added a component to the layout. In that case, the layout is a GridLayout.

Parameters:
layout - the new layout of the content pane

setController

public void setController(DockController controller)
Description copied from interface: Dockable
Sets the controller in whose realm this Dockable is. A value of null means that this Dockable is not managed by a controller.
Note: this method has to inform all DockHierarchyListeners about the change.
Note: when using a DockHierarchyObserver, invoke DockHierarchyObserver.controllerChanged(DockController)

Specified by:
setController in interface Dockable
Overrides:
setController in class AbstractDockable
Parameters:
controller - the owner, may be null