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
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(Component component)
          Constructs a new DefaultDockable and places one component onto the content pane.
DefaultDockable(Component component, Icon icon)
          Constructs a new DefaultDockable, sets an icon and places one component.
DefaultDockable(Component component, String title)
          Constructs a new DefaultDockable, sets the title and places one component.
DefaultDockable(Component component, String title, Icon icon)
          Constructs a new DefaultDockable, sets the icon and the title, and places a component.
DefaultDockable(Icon icon)
          Constructs a new DefaultDockable and sets the icon.
DefaultDockable(String title)
          Constructs a new DefaultDockable and sets the title.
 
Method Summary
 void add(Component component)
          Adds component to the content pane.
 void add(Component component, Object constraints)
          Adds component to the content pane.
 DockStation asDockStation()
          Returns this if this is an instance of DockStation.
 Component getComponent()
          Gets the Component which represents the element.
 Container getContentPane()
          Gets a panel for children of this Dockable.
 String getFactoryID()
          Gets the unique name of the DockFactory which can read and write elements of this type.
 void remove(Component component)
          Removes component from the content pane.
 void setFactoryID(String factoryId)
          Sets the id for the DockFactory which will be used to store and load this dockable.
 void setLayout(LayoutManager layout)
          Sets the layout of the content pane.
 
Methods inherited from class bibliothek.gui.dock.dockable.AbstractDockable
accept, accept, addDockableListener, addDockHierarchyListener, addKeyListener, addMouseInputListener, asDockable, bind, configureDisplayerHints, fireTitleBound, fireTitleExchanged, fireTitleExchanged, fireTitleIconChanged, fireTitleTextChanged, fireTitleTooltipChanged, fireTitleUnbound, getConfigurableDisplayerHints, getController, getDockParent, getElement, getGlobalActionOffers, getLocalActionOffers, getPopupLocation, getTitleIcon, getTitleText, getTitleToolTip, isUsedAsTitle, listBoundTitles, removeDockableListener, removeDockHierarchyListener, removeKeyListener, removeMouseInputListener, requestDockTitle, setActionOffers, setController, setDockParent, setTitleIcon, setTitleText, setTitleToolTip, 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(Icon icon)
Constructs a new DefaultDockable and sets the icon.

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

DefaultDockable

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

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

DefaultDockable

public DefaultDockable(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(Component component,
                       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(Component component,
                       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(Component component,
                       String title,
                       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

getFactoryID

public 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(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 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

getContentPane

public 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(Component component)
Adds component to the content pane.

Parameters:
component - the new child

add

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

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

remove

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

Parameters:
component - the child to remove

setLayout

public void setLayout(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