edu.washington.cs.supple.render
Interface Widget

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
AwtWidget, ContainerWidget, HtmlWidget, PopupWidget, SwingWidget, UnwrappedWidget, WapWidget, WidgetWrapper
All Known Implementing Classes:
AbstractComboBoxWidget, AbstractContainerWidget, AbstractImageBasedWidget, AbstractPopupWidget, AbstractRadioButtonWidget, AbstractRadioButtonWidget, AbstractToggleWidget, AbstractWidget, AbstractWidgetWrapper, ButtonWidget, CardWidget, CheckboxWidget, ChoiceWidget, ContainerAwtWidget, ContainerHtmlWidget, ContainerSwingWidget, ContainerWapWidget, DateWidget, LabelWidget, LabelWidget, ListWidget, PopupAwtWidget, PopupSwingWidget, SimpleAwtWidgetWrapper, SimpleHtmlWidget, SimpleSwingWidget, SimpleSwingWidgetWrapper, SimpleWapWidget, TextAreaWidget, TextFieldWidget

public interface Widget
extends java.lang.Cloneable

Author:
kgajos Common interface for all widgets, regardless of platform

Field Summary
static int MAX_HINT
           
static int NO_BORDER
           
static int NO_NAME
           
static int TOP_LEVEL_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
 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)
 ConcreteWidget getConcreteWidget(java.io.Serializable renderingContext, 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
 boolean hasChildren()
           
 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 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)
           
 UnwrappedWidget unwrapWidget()
          Returns the enclosed widget for wrappers or self for actual widgets
 

Field Detail

NO_BORDER

public static final int NO_BORDER
See Also:
Constant Field Values

NO_NAME

public static final int NO_NAME
See Also:
Constant Field Values

TOP_LEVEL_WIDGET

public static final int TOP_LEVEL_WIDGET
See Also:
Constant Field Values

MAX_HINT

public static final int MAX_HINT
See Also:
Constant Field Values
Method Detail

getType

public SuppleType getType()
Returns the type of the corresponding UI object

Returns:
the type of the corresponding UI object

getUiObject

public UiObject getUiObject()
Returns the corresponding UI object

Returns:
the corresponding UI object

getConcreteWidget

public ConcreteWidget getConcreteWidget(int hints)
Returns the concrete component (specific to a particular platform)

Parameters:
hints - rendering hints
Returns:

getConcreteWidget

public ConcreteWidget getConcreteWidget(java.io.Serializable renderingContext,
                                        int hints)
Returns the concrete component (specific to a particular platform)

Parameters:
renderingContext - extra context information requried by some platforms
hints - rendering hints
Returns:

getWidgetProperties

public WidgetProperties getWidgetProperties()
Returns the corresponding WidgetProperties

Returns:
the corresponding Widget Properties

getWidgetDescriptor

public WidgetDescriptor getWidgetDescriptor()
Returns a descriptor for this widget


getBag

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

Returns:
the widget bag containing this widget

setBag

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

Parameters:
bag - the widget bag that contains this widget

getTextLabel

public java.lang.String getTextLabel()
Returns the text label assigned to this widget

Returns:
the text label assigned to this widget

getCost

public float getCost()
Returns the cost assigned to this widget instance

Returns:
the cost

setCost

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

Parameters:
cost - the new cost

getSize

public java.awt.Dimension getSize(int hints)
Parameters:
hints - extra information concerning the variant of the widget that the size is needed for; at the moment I envision that some times we will want border-less and nameless versions of the widget
Returns:
the dimensions of the rendered widget

getSizeCache

public java.awt.Dimension getSizeCache(int hints)

setSizeCache

public void setSizeCache(int hints,
                         java.awt.Dimension dim)

hasChildren

public boolean hasChildren()

childIterator

public java.util.Iterator childIterator()

setParent

public void setParent(Widget parent)
Sets the parent widget

Parameters:
parent - the parent widget

engage

public void engage()
Used to tie the widgets with the underlying ui objects


isEngaged

public boolean isEngaged()

disengage

public void disengage()
Used to break the connection between the widget and the underlying ui object


setEnabled

public void setEnabled(boolean e)
This method is exposed only so that wrappers can access it; others should stay away

Parameters:
e -

getPath

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

Returns:
the path from the root to this widget, includes the widget itself

clone

public java.lang.Object clone()

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)

Parameters:
bag - the new owning widget bag
Returns:
a clone of the widget

getEffortEstimate

public float getEffortEstimate(ActionDescription a)

unwrapWidget

public UnwrappedWidget unwrapWidget()
Returns the enclosed widget for wrappers or self for actual widgets

Returns:
the enclosed widget

setWrapper

public void setWrapper(WidgetWrapper wrapper)

isEquivalent

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

Parameters:
w -
Returns: