edu.washington.cs.supple.render
Class AbstractWidgetWrapper

java.lang.Object
  extended byedu.washington.cs.supple.render.AbstractWidgetWrapper
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, java.beans.PropertyChangeListener, Widget, WidgetWrapper
Direct Known Subclasses:
SimpleAwtWidgetWrapper, SimpleSwingWidgetWrapper

public abstract class AbstractWidgetWrapper
extends java.lang.Object
implements WidgetWrapper, java.beans.PropertyChangeListener

Author:
kgajos

Field Summary
protected  AbstractWidget widget
           
 
Fields inherited from interface edu.washington.cs.supple.render.Widget
MAX_HINT, NO_BORDER, NO_NAME, TOP_LEVEL_WIDGET
 
Constructor Summary
AbstractWidgetWrapper(Widget widget)
           
 
Method Summary
 java.util.Iterator childIterator()
           
 java.lang.Object clone()
           
 Widget clone(WidgetBag bag)
          A convenience method -- clones the widget and sets the value of the owner widget bag (used when cloning widget bags)
 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
 boolean equals(java.lang.Object obj)
           
 WidgetBag getBag()
          Returns the widget bag containing this widget; widget bags are used in the search process as holders of the possible renderings for each UI element;
 ConcreteWidget getConcreteWidget(int hints)
          Returns the concrete component (specific to a particular platform)
 float getCost()
          Returns the cost assigned to this widget instance
 float getEffortEstimate(ActionDescription a)
           
 java.util.Vector getPath()
          Returns path (from the root) to this widget in the interface (ignoring shortcuts)
 java.awt.Dimension getSize(int hints)
           
 java.awt.Dimension getSizeCache(int hints)
           
 java.lang.String getTextLabel()
          Returns the text label assigned to this widget
 SuppleType getType()
          Returns the type of the corresponding UI object
 UiObject getUiObject()
          Returns the corresponding UI object
 WidgetDescriptor getWidgetDescriptor()
          Returns a descriptor for this widget
 WidgetProperties getWidgetProperties()
          Returns the corresponding WidgetProperties
protected abstract  WidgetWrapper getWrapper(Widget widget)
           
 boolean hasChildren()
           
 int hashCode()
           
 boolean isEngaged()
           
 boolean isEquivalent(Widget w)
          Checks if two widgets are equivalent to each other; they are equivalent if they have identical widget descriptors
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void setBag(WidgetBag bag)
          Sets the widget bag that contains this widget; widget bags are used in the search process as holders of the possible renderings for each UI element; Do not use this method!
 void setCost(float cost)
          Assigns cost to this widget instance (based on the underlying element, device and user models); called by the search routine during initial assignment of widgets to elements.
 void setEnabled(boolean e)
          This method is exposed only so that wrappers can access it; others should stay away
 void setParent(Widget parent)
          Sets the parent widget
 void setSizeCache(int hints, java.awt.Dimension dim)
           
 void setWrapper(WidgetWrapper wrapper)
           
 java.lang.String toString()
           
 UnwrappedWidget unwrapWidget()
          Returns the enclosed widget for wrappers or self for actual widgets
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.washington.cs.supple.render.Widget
getConcreteWidget
 

Field Detail

widget

protected AbstractWidget widget
Constructor Detail

AbstractWidgetWrapper

public AbstractWidgetWrapper(Widget widget)
Method Detail

getWrapper

protected abstract WidgetWrapper getWrapper(Widget widget)

getConcreteWidget

public ConcreteWidget getConcreteWidget(int hints)
Description copied from interface: Widget
Returns the concrete component (specific to a particular platform)

Specified by:
getConcreteWidget in interface Widget
Parameters:
hints - rendering hints
Returns:

clone

public java.lang.Object clone()
Specified by:
clone in interface Widget

clone

public Widget clone(WidgetBag bag)
A convenience method -- clones the widget and sets the value of the owner widget bag (used when cloning widget bags)

Specified by:
clone in interface Widget
Parameters:
bag - the new owning widget bag
Returns:
a clone of the widget

unwrapWidget

public UnwrappedWidget unwrapWidget()
Description copied from interface: Widget
Returns the enclosed widget for wrappers or self for actual widgets

Specified by:
unwrapWidget in interface Widget
Returns:
the enclosed widget

setWrapper

public void setWrapper(WidgetWrapper wrapper)
Specified by:
setWrapper in interface Widget

childIterator

public java.util.Iterator childIterator()
Specified by:
childIterator in interface Widget
Returns:

equals

public boolean equals(java.lang.Object obj)

isEquivalent

public boolean isEquivalent(Widget w)
Description copied from interface: Widget
Checks if two widgets are equivalent to each other; they are equivalent if they have identical widget descriptors

Specified by:
isEquivalent in interface Widget
Parameters:
w -
Returns:

getBag

public WidgetBag getBag()
Description copied from interface: Widget
Returns the widget bag containing this widget; widget bags are used in the search process as holders of the possible renderings for each UI element;

Specified by:
getBag in interface Widget
Returns:

getCost

public float getCost()
Description copied from interface: Widget
Returns the cost assigned to this widget instance

Specified by:
getCost in interface Widget
Returns:

getEffortEstimate

public float getEffortEstimate(ActionDescription a)
Specified by:
getEffortEstimate in interface Widget
Parameters:
a -
Returns:

getPath

public java.util.Vector getPath()
Description copied from interface: Widget
Returns path (from the root) to this widget in the interface (ignoring shortcuts)

Specified by:
getPath in interface Widget
Returns:

getTextLabel

public java.lang.String getTextLabel()
Description copied from interface: Widget
Returns the text label assigned to this widget

Specified by:
getTextLabel in interface Widget
Returns:

getType

public SuppleType getType()
Description copied from interface: Widget
Returns the type of the corresponding UI object

Specified by:
getType in interface Widget
Returns:

getUiObject

public UiObject getUiObject()
Description copied from interface: Widget
Returns the corresponding UI object

Specified by:
getUiObject in interface Widget
Returns:

getWidgetDescriptor

public WidgetDescriptor getWidgetDescriptor()
Description copied from interface: Widget
Returns a descriptor for this widget

Specified by:
getWidgetDescriptor in interface Widget
Returns:

getWidgetProperties

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

Specified by:
getWidgetProperties in interface Widget
Returns:

hasChildren

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

hashCode

public int hashCode()

setBag

public void setBag(WidgetBag bag)
Description copied from interface: Widget
Sets the widget bag that contains this widget; widget bags are used in the search process as holders of the possible renderings for each UI element; Do not use this method!

Specified by:
setBag in interface Widget
Parameters:
bag -

setCost

public void setCost(float cost)
Description copied from interface: Widget
Assigns cost to this widget instance (based on the underlying element, device and user models); called by the search routine during initial assignment of widgets to elements.

Specified by:
setCost in interface Widget
Parameters:
cost -

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

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

isEngaged

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

setEnabled

public void setEnabled(boolean e)
Description copied from interface: Widget
This method is exposed only so that wrappers can access it; others should stay away

Specified by:
setEnabled in interface Widget
Parameters:
e -

getSize

public java.awt.Dimension getSize(int hints)
Specified by:
getSize in interface Widget
Parameters:
hints -
Returns:

getSizeCache

public java.awt.Dimension getSizeCache(int hints)
Specified by:
getSizeCache in interface Widget
Parameters:
hints -
Returns:

setSizeCache

public void setSizeCache(int hints,
                         java.awt.Dimension dim)
Specified by:
setSizeCache in interface Widget
Parameters:
hints -
dim -

setParent

public void setParent(Widget parent)
Description copied from interface: Widget
Sets the parent widget

Specified by:
setParent in interface Widget
Parameters:
parent -

toString

public java.lang.String toString()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt -