edu.washington.cs.supple.wlib.html
Class HtmlListWidget

java.lang.Object
  extended byedu.washington.cs.supple.render.AbstractWidget
      extended byedu.washington.cs.supple.render.SimpleWidget
          extended byedu.washington.cs.supple.wlib.html.SimpleHtmlWidget
              extended byedu.washington.cs.supple.wlib.html.HtmlListWidget
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, HtmlWidget, java.beans.PropertyChangeListener, UnwrappedWidget, Widget

public class HtmlListWidget
extends SimpleHtmlWidget

Author:
kierah

Field Summary
protected  java.awt.Dimension biggestItem
           
protected  HtmlButtonWidget detailButton
           
protected  SuppleType elementType
           
protected  boolean exactLength
           
protected  boolean hasDetails
           
static java.lang.String LIST_SIZE_PROPERTY
           
protected  int listSize
           
protected static int MARGIN
          the pixel size of the outer margin around the widget
protected static int MARGIN_X
           
protected static int MARGIN_Y
           
protected  int selectionMode
           
protected  VectorType vtype
           
 
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
HtmlListWidget(UiObject object, int listSize)
          Does all of the common constructor work for lits
 
Method Summary
 java.awt.Dimension biggestItemSize()
           
 void disengage()
          Used to break the connection between the widget and the underlying ui object
 HtmlView doAction(java.lang.String name)
          This method is called when a user clicks an html button.
 void engage()
          Used to tie the widgets with the underlying ui objects
protected  WidgetDescriptor generateWidgetDescriptor()
          Subclasses can override this method if their widget descriptor include extra information
 float getEffortEstimate(ActionDescription a)
          This method is hear temporarily until we implement it for all simple widgets
 java.lang.String getHtmlComponent(int hints)
          Produces HTML code for that instance of the widget
 int getListSize()
          Returns the length of the list widget rendered; 0 means that the list will be as long as the number of elements in the domain of the object displayed
 float getNumRows()
           
 WidgetProperties getWidgetProperties()
          Returns the corresponding WidgetProperties
 boolean hasDetails()
           
 boolean isExactLength()
           
protected  void legalValuesChanged(java.beans.PropertyChangeEvent evt)
          reacts to the change in the list of legal values in the underlying object
static boolean rendersObject(UiObject object)
          A static method for testing the applicability of the widget given a type of the UI component to be rendered
 void setParameterValue(java.lang.String name, java.lang.String value)
          This method is called in response to a user changing widget values.
protected  java.awt.Dimension size(int hints)
          Yields the size of the widget.
 java.lang.String toString()
           
protected  void valueChanged(java.beans.PropertyChangeEvent evt)
          Subclasses should override this method if they want to update display the value of the underlying type changes
 
Methods inherited from class edu.washington.cs.supple.wlib.html.SimpleHtmlWidget
getConcreteWidget, getHtmlId, getSize
 
Methods inherited from class edu.washington.cs.supple.render.SimpleWidget
childIterator, hasChildren
 
Methods inherited from class edu.washington.cs.supple.render.AbstractWidget
anotherPropertyChanged, clone, clone, dismissCurrentView, displayDynamic, equals, executeAction, getBag, getConcreteWidget, getCost, getParent, getPath, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, indexChanged, isEngaged, isEquivalent, likelyValuesChanged, propertyChange, reportActionExecutionEvent, reportValueChangedEvent, setBag, setCost, setEnabled, setParent, setSizeCache, setValue, setWrapper, unwrapWidget
 
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
childIterator, clone, clone, getBag, getConcreteWidget, getCost, getPath, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, hasChildren, isEngaged, isEquivalent, setBag, setCost, setEnabled, setParent, setSizeCache, setWrapper, unwrapWidget
 

Field Detail

LIST_SIZE_PROPERTY

public static final java.lang.String LIST_SIZE_PROPERTY
See Also:
Constant Field Values

MARGIN

protected static final int MARGIN
the pixel size of the outer margin around the widget

See Also:
Constant Field Values

MARGIN_X

protected static final int MARGIN_X
See Also:
Constant Field Values

MARGIN_Y

protected static final int MARGIN_Y
See Also:
Constant Field Values

listSize

protected int listSize

exactLength

protected boolean exactLength

hasDetails

protected boolean hasDetails

vtype

protected VectorType vtype

elementType

protected SuppleType elementType

detailButton

protected HtmlButtonWidget detailButton

biggestItem

protected java.awt.Dimension biggestItem

selectionMode

protected int selectionMode
Constructor Detail

HtmlListWidget

public HtmlListWidget(UiObject object,
                      int listSize)
Does all of the common constructor work for lits

Parameters:
object - the corresponding UiObject
listSize - the size of the displayed list element. If set to 0, the displayed list size will be the same as the size of the domain of the object. Finally, if the domain is not going to change in size (and listSize is 0), then list will be rendered without the scroll bars.
Method Detail

getListSize

public int getListSize()
Returns the length of the list widget rendered; 0 means that the list will be as long as the number of elements in the domain of the object displayed

Returns:
the length of the list widget

hasDetails

public boolean hasDetails()
Returns:
Returns the hasDetails.

isExactLength

public boolean isExactLength()
Returns:
true if the list widget is precisely the same length as the domain of the underlying object

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

generateWidgetDescriptor

protected WidgetDescriptor generateWidgetDescriptor()
Description copied from class: AbstractWidget
Subclasses can override this method if their widget descriptor include extra information

Overrides:
generateWidgetDescriptor in class AbstractWidget
Returns:
a new widget descriptor for this widge

getEffortEstimate

public float getEffortEstimate(ActionDescription a)
Description copied from class: SimpleWidget
This method is hear temporarily until we implement it for all simple widgets

Specified by:
getEffortEstimate in interface Widget
Overrides:
getEffortEstimate in class SimpleWidget

rendersObject

public static boolean rendersObject(UiObject object)
A static method for testing the applicability of the widget given a type of the UI component to be rendered

Returns:
true for instances of enumerable vector types

getHtmlComponent

public java.lang.String getHtmlComponent(int hints)
Description copied from interface: HtmlWidget
Produces HTML code for that instance of the widget

Parameters:
hints - rendering hints
Returns:
the HTML code

doAction

public HtmlView doAction(java.lang.String name)
Description copied from interface: HtmlWidget
This method is called when a user clicks an html button.

Specified by:
doAction in interface HtmlWidget
Overrides:
doAction in class SimpleHtmlWidget

setParameterValue

public void setParameterValue(java.lang.String name,
                              java.lang.String value)
Description copied from interface: HtmlWidget
This method is called in response to a user changing widget values.

Specified by:
setParameterValue in interface HtmlWidget
Overrides:
setParameterValue in class SimpleHtmlWidget

legalValuesChanged

protected void legalValuesChanged(java.beans.PropertyChangeEvent evt)
reacts to the change in the list of legal values in the underlying object

Overrides:
legalValuesChanged in class AbstractWidget
Parameters:
evt - property change event with details

valueChanged

protected void valueChanged(java.beans.PropertyChangeEvent evt)
Description copied from class: AbstractWidget
Subclasses should override this method if they want to update display the value of the underlying type changes

Overrides:
valueChanged in class AbstractWidget
Parameters:
evt - property change event with details

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

getNumRows

public float getNumRows()

size

protected java.awt.Dimension size(int hints)
Description copied from class: SimpleHtmlWidget
Yields the size of the widget. Contract stipulates that the size be recomputed, and not taken from the size cache.

Specified by:
size in class SimpleHtmlWidget
Parameters:
hints -
Returns:
freshly computed size of the widget

biggestItemSize

public java.awt.Dimension biggestItemSize()

toString

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