edu.washington.cs.supple.render
Class AbstractContainerWidget

java.lang.Object
  extended byedu.washington.cs.supple.render.AbstractWidget
      extended byedu.washington.cs.supple.render.AbstractContainerWidget
All Implemented Interfaces:
java.lang.Cloneable, ContainerWidget, java.util.EventListener, java.beans.PropertyChangeListener, UnwrappedWidget, Widget
Direct Known Subclasses:
ContainerAwtWidget, ContainerHtmlWidget, ContainerSwingWidget, ContainerWapWidget

public abstract class AbstractContainerWidget
extends AbstractWidget
implements ContainerWidget

Author:
kgajos An abstraction for complex widgets used for laying out simpler components

Field Summary
protected  java.util.Hashtable children
           
protected  ContainerType containerType
           
 
Fields inherited from class edu.washington.cs.supple.render.AbstractWidget
bag, cost, engaged, object, parent, stateVar, textLabel, type, widgetDescriptor, wrapper
 
Fields inherited from interface edu.washington.cs.supple.render.Widget
MAX_HINT, NO_BORDER, NO_NAME, TOP_LEVEL_WIDGET
 
Constructor Summary
AbstractContainerWidget(UiObject object)
           
 
Method Summary
 java.util.Iterator childIterator()
          Returns an iterator over child widgets.
 void disengage()
          Used to break the connection between the widget and the underlying ui object
 void engage()
          Used to tie the widgets with the underlying ui objects
protected  Widget getChild(UiObject object)
          Returns the widget object of a child corresponding to the description contained in the object
protected  Widget getChildFor(UiObject object)
          Returns the widget for a given child object
protected  java.awt.Dimension getMaxChildSize(int hints)
          Calls the enclosing WidgetBag to obtain the info
protected  java.awt.Dimension getMaxChildSize(int hints, java.util.Collection objects)
          Calls the enclosing WidgetBag to obtain the info
protected  java.awt.Dimension getMinChildSize(int hints, UiObject object)
           
protected  java.awt.Dimension getSumChildSize(int hints)
          Calls the enclosing WidgetBag to obtain the info
protected  java.awt.Dimension getSumChildSize(int hints, java.util.Collection objects)
          Calls the enclosing WidgetBag to obtain the info
 WidgetProperties getWidgetProperties()
          Returns the corresponding WidgetProperties
 boolean hasChildren()
           
 void makeVisible(UiObject target)
          This piece of functionality is necessary for interfaces with shortcuts -- it forces the container widget to make a particular child visible; this base implementation assumes that widgets are rendered side by side so it only makes sure that the target is a legal child.
 void setChildren(java.util.Hashtable h)
          Called by the WidgetBag when the solution is finalized
 java.lang.String toString()
           
 
Methods inherited from class edu.washington.cs.supple.render.AbstractWidget
anotherPropertyChanged, clone, clone, dismissCurrentView, displayDynamic, equals, executeAction, generateWidgetDescriptor, getBag, getConcreteWidget, getConcreteWidget, getCost, getParent, getPath, getSize, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, indexChanged, isEngaged, isEquivalent, legalValuesChanged, likelyValuesChanged, propertyChange, rendersObject, reportActionExecutionEvent, reportValueChangedEvent, setBag, setCost, setEnabled, setParent, setSizeCache, setValue, setWrapper, unwrapWidget, valueChanged
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.washington.cs.supple.render.Widget
clone, clone, getBag, getConcreteWidget, getConcreteWidget, getCost, getEffortEstimate, getPath, getSize, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, isEngaged, isEquivalent, setBag, setCost, setEnabled, setParent, setSizeCache, setWrapper, unwrapWidget
 

Field Detail

containerType

protected ContainerType containerType

children

protected java.util.Hashtable children
Constructor Detail

AbstractContainerWidget

public AbstractContainerWidget(UiObject object)
Method Detail

getWidgetProperties

public WidgetProperties getWidgetProperties()
Description copied from interface: Widget
Returns the corresponding WidgetProperties

Specified by:
getWidgetProperties in interface Widget
Overrides:
getWidgetProperties in class AbstractWidget
Returns:
properties associated with this widget

getMaxChildSize

protected java.awt.Dimension getMaxChildSize(int hints)
Calls the enclosing WidgetBag to obtain the info

Parameters:
hints - the rendering hints
Returns:
the maximum dimensions reported by any of the child bags; 0x0 if there is not enclosing bag

getMinChildSize

protected java.awt.Dimension getMinChildSize(int hints,
                                             UiObject object)

getMaxChildSize

protected java.awt.Dimension getMaxChildSize(int hints,
                                             java.util.Collection objects)
Calls the enclosing WidgetBag to obtain the info

Parameters:
hints - the rendering hints
objects - the subset of children for which calculation will be performed
Returns:
the maximum dimensions reported by any of the child bags; 0x0 if there is not enclosing bag

getSumChildSize

protected java.awt.Dimension getSumChildSize(int hints)
Calls the enclosing WidgetBag to obtain the info

Parameters:
hints - the rendering hints
Returns:
the sum of dimensions reported by the child bags; 0x0 if there is not enclosing bag

getSumChildSize

protected java.awt.Dimension getSumChildSize(int hints,
                                             java.util.Collection objects)
Calls the enclosing WidgetBag to obtain the info

Parameters:
hints - the rendering hints
objects - the subset of children for which calculation will be performed
Returns:
the sum of dimensions reported by the child bags; 0x0 if there is not enclosing bag

getChild

protected Widget getChild(UiObject object)
Returns the widget object of a child corresponding to the description contained in the object

Parameters:
object - description
Returns:
Widget object if corresponding bag is set; null otherwise

childIterator

public java.util.Iterator childIterator()
Returns an iterator over child widgets.

Specified by:
childIterator in interface Widget
Returns:
iterator over child widgets or null if there is no access to info about children

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface Widget

getChildFor

protected Widget getChildFor(UiObject object)
Returns the widget for a given child object

Parameters:
object - child object
Returns:
the corresponding widget or null if the object did not refer to an exisitng child of this widget

setChildren

public void setChildren(java.util.Hashtable h)
Called by the WidgetBag when the solution is finalized

Specified by:
setChildren in interface ContainerWidget
Parameters:
h - a mapping from UiObjects to child widgets

makeVisible

public void makeVisible(UiObject target)
This piece of functionality is necessary for interfaces with shortcuts -- it forces the container widget to make a particular child visible; this base implementation assumes that widgets are rendered side by side so it only makes sure that the target is a legal child.

Specified by:
makeVisible in interface ContainerWidget
Parameters:
target - the vhild object that should be made visible
Throws:
java.lang.IllegalArgumentException - if the child does not exist

toString

public java.lang.String toString()
Overrides:
toString in class AbstractWidget

disengage

public void disengage()
Description copied from interface: Widget
Used to break the connection between the widget and the underlying ui object

Specified by:
disengage in interface Widget
Overrides:
disengage in class AbstractWidget

engage

public void engage()
Description copied from interface: Widget
Used to tie the widgets with the underlying ui objects

Specified by:
engage in interface Widget
Overrides:
engage in class AbstractWidget