buoyx.docking
Class DockableWidget

java.lang.Object
  extended by buoy.event.EventSource
      extended by buoy.widget.Widget
          extended by buoy.widget.WidgetContainer
              extended by buoyx.docking.DockableWidget

public class DockableWidget
extends WidgetContainer

This is a Widget that can be added to a DockingContainer, and rearranged by the user. It is a container which holds a single content Widget and draws a border around it. By clicking on the border, the user can drag the DockableWidget to any other DockingContainer in the same window, group the Widgets in a DockingContainer into tabs, and reorder the Widgets within a tab.

The border drawn by this class consists of a fairly simple title bar. You can change the appearance of the border by creating a subclass and overriding getBorderInsets(), paintBorder(java.awt.Graphics2D), and isInDragRegion(java.awt.Point).

Author:
Peter Eastman

Constructor Summary
DockableWidget()
          Create a DockableWidget with no content Widget or label.
DockableWidget(Widget content, java.lang.String label)
          Create a DockableWidget.
 
Method Summary
 java.awt.Rectangle getBounds()
          Get the current location and size of this Widget.
 int getChildCount()
          Get the number of children in this container.
 java.util.Collection<Widget> getChildren()
          Get a Collection containing all child Widgets of this container.
 Widget getContent()
          Get the content Widget.
 java.lang.String getLabel()
          Get the label which appears in the title bar.
 java.awt.Dimension getMinimumSize()
          Get the smallest size at which this Widget can reasonably be drawn.
 java.awt.Dimension getPreferredSize()
          Get the preferred size at which this Widget will look best.
 void layoutChildren()
          Layout the child Widgets.
 void remove(Widget widget)
          Remove a child Widget from this container.
 void removeAll()
          Remove all child Widgets from this container.
 void setContent(Widget widget)
          Set the content Widget.
 void setLabel(java.lang.String label)
          Set the label which appears in the title bar.
 
Methods inherited from class buoy.widget.WidgetContainer
isOpaque, setOpaque
 
Methods inherited from class buoy.widget.Widget
addEventLink, dispatchEvent, getBackground, getComponent, getCursor, getFont, getMaximumSize, getName, getParent, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
 
Methods inherited from class buoy.event.EventSource
addEventLink, addEventLink, removeEventLink
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockableWidget

public DockableWidget()
Create a DockableWidget with no content Widget or label.


DockableWidget

public DockableWidget(Widget content,
                      java.lang.String label)
Create a DockableWidget.

Parameters:
content - the content Widget
label - the label to appear in the title bar
Method Detail

getContent

public Widget getContent()
Get the content Widget.


setContent

public void setContent(Widget widget)
Set the content Widget.


getLabel

public java.lang.String getLabel()
Get the label which appears in the title bar.


setLabel

public void setLabel(java.lang.String label)
Set the label which appears in the title bar.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: Widget
Get the preferred size at which this Widget will look best. When a WidgetContainer lays out its contents, it will attempt to make this Widget as close as possible to its preferred size.

Overrides:
getPreferredSize in class Widget

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: Widget
Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out its contents, it will attempt never to make this Widget smaller than its minimum size.

Overrides:
getMinimumSize in class Widget

getChildCount

public int getChildCount()
Description copied from class: WidgetContainer
Get the number of children in this container.

Specified by:
getChildCount in class WidgetContainer

getChildren

public java.util.Collection<Widget> getChildren()
Description copied from class: WidgetContainer
Get a Collection containing all child Widgets of this container.

Specified by:
getChildren in class WidgetContainer

remove

public void remove(Widget widget)
Description copied from class: WidgetContainer
Remove a child Widget from this container.

Specified by:
remove in class WidgetContainer

removeAll

public void removeAll()
Description copied from class: WidgetContainer
Remove all child Widgets from this container.

Specified by:
removeAll in class WidgetContainer

layoutChildren

public void layoutChildren()
Description copied from class: WidgetContainer
Layout the child Widgets. This may be invoked whenever something has changed (the size of this WidgetContainer, the preferred size of one of its children, etc.) that causes the layout to no longer be correct. If a child is itself a WidgetContainer, its layoutChildren() method will be called in turn.

Specified by:
layoutChildren in class WidgetContainer

getBounds

public java.awt.Rectangle getBounds()
Description copied from class: Widget
Get the current location and size of this Widget.

Overrides:
getBounds in class Widget


Written by Peter Eastman.