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

java.lang.Object
  extended byedu.washington.cs.supple.render.AbstractWidget
      extended byedu.washington.cs.supple.render.AbstractContainerWidget
          extended byedu.washington.cs.supple.wlib.html.ContainerHtmlWidget
All Implemented Interfaces:
java.lang.Cloneable, ContainerWidget, java.util.EventListener, HtmlWidget, java.beans.PropertyChangeListener, UnwrappedWidget, Widget
Direct Known Subclasses:
BalancedTwoColumnContainerWidget, HorizontalContainerWidget, TabContainerWidget, VerticalContainerWidget

public abstract class ContainerHtmlWidget
extends AbstractContainerWidget
implements HtmlWidget

Author:
kgajos

Field Summary
static int LEFT
           
static java.lang.String LISTING_WIDGET_PROPERTY
           
protected  HtmlWidget listingWidget
           
protected  int listPlacement
           
protected static int MARGIN
          the pixel size of the margin around the widget
static int TOP
           
 
Fields inherited from class edu.washington.cs.supple.render.AbstractContainerWidget
children, 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
ContainerHtmlWidget(UiObject object)
           
ContainerHtmlWidget(UiObject object, HtmlWidget lWidget, int placement)
           
 
Method Summary
protected  java.awt.Dimension addActionButtonSize(java.awt.Dimension cdim)
          Given the size for the container object, it adds the size for the action button; this method should be overriden by children that change the implementation of makeActionButton
 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
 ConcreteWidget getConcreteWidget(java.io.Serializable renderingContext, int hints)
          Returns the concrete component (specific to a particular platform)
protected  java.awt.Dimension getContainerSize(int hints)
          Unless a child overrides getSize, it should override this method
 float getEffortEstimate(ActionDescription a)
           
 java.lang.String getHtmlComponent(int hints)
          Produces HTML code for that instance of the widget
 java.lang.String getHtmlId()
          Get the unique id used to identify this widget within an HTML document.
 HtmlWidget getListingWidget()
           
 java.awt.Dimension getSize(int hints)
           
 WidgetProperties getWidgetProperties()
          Returns the corresponding WidgetProperties
 boolean hasListingWidget()
           
protected abstract  java.lang.String makeHtmlContainer(int hints)
          Children have to implement this method -- just make the container and do not worry about border or label
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 setListingWidget(HtmlWidget listingWidget, int placement)
           
 void setParameterValue(java.lang.String name, java.lang.String value)
          This method is called in response to a user changing widget values.
 java.lang.String toString()
           
protected  java.lang.String wrapListContainer(java.lang.String contents)
           
 
Methods inherited from class edu.washington.cs.supple.render.AbstractContainerWidget
childIterator, getChild, getChildFor, getMaxChildSize, getMaxChildSize, getMinChildSize, getSumChildSize, getSumChildSize, hasChildren, makeVisible, setChildren
 
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, legalValuesChanged, likelyValuesChanged, propertyChange, 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
childIterator, clone, clone, getBag, getConcreteWidget, getCost, getPath, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, hasChildren, isEngaged, isEquivalent, setBag, setCost, setEnabled, setParent, setSizeCache, setWrapper, unwrapWidget
 

Field Detail

listingWidget

protected HtmlWidget listingWidget

listPlacement

protected int listPlacement

LEFT

public static final int LEFT
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

LISTING_WIDGET_PROPERTY

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

MARGIN

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

See Also:
Constant Field Values
Constructor Detail

ContainerHtmlWidget

public ContainerHtmlWidget(UiObject object)
Parameters:
object -

ContainerHtmlWidget

public ContainerHtmlWidget(UiObject object,
                           HtmlWidget lWidget,
                           int placement)
Method Detail

getHtmlId

public java.lang.String getHtmlId()
Description copied from interface: HtmlWidget
Get the unique id used to identify this widget within an HTML document.

Specified by:
getHtmlId in interface HtmlWidget

getConcreteWidget

public ConcreteWidget getConcreteWidget(java.io.Serializable renderingContext,
                                        int hints)
Description copied from interface: Widget
Returns the concrete component (specific to a particular platform)

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

getWidgetProperties

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

Specified by:
getWidgetProperties in interface Widget
Overrides:
getWidgetProperties in class AbstractContainerWidget
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

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 all coumpound objects (including actions provided they have at least two arguments); false otherwise

getSize

public java.awt.Dimension getSize(int hints)
Specified by:
getSize in interface Widget
Overrides:
getSize in class AbstractWidget

getHtmlComponent

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

Specified by:
getHtmlComponent in interface HtmlWidget
Parameters:
hints - rendering hints
Returns:
the HTML code

makeHtmlContainer

protected abstract java.lang.String makeHtmlContainer(int hints)
Children have to implement this method -- just make the container and do not worry about border or label

Parameters:
hints - rendering hints (just FYI)
Returns:
the HTML code for the container

getContainerSize

protected java.awt.Dimension getContainerSize(int hints)
Unless a child overrides getSize, it should override this method

Parameters:
hints - rendering hints
Returns:
the size of the container object

addActionButtonSize

protected java.awt.Dimension addActionButtonSize(java.awt.Dimension cdim)
Given the size for the container object, it adds the size for the action button; this method should be overriden by children that change the implementation of makeActionButton

Parameters:
cdim - the dimensions of the container
Returns:
the dimension of the container and the action button

wrapListContainer

protected java.lang.String wrapListContainer(java.lang.String contents)

hasListingWidget

public boolean hasListingWidget()
Returns:
true if this container has a listing built in

getListingWidget

public HtmlWidget getListingWidget()
Returns:
the listing Widget.

setListingWidget

public void setListingWidget(HtmlWidget listingWidget,
                             int placement)
Parameters:
listingWidget - The listingWidget to set.

getEffortEstimate

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

doAction

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

Specified by:
doAction in interface HtmlWidget
Returns:
returns the new view associated with the given action, or null (if no view was created)
Throws:
java.lang.IllegalArgumentException

setParameterValue

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

Specified by:
setParameterValue in interface HtmlWidget
Parameters:
name - Name of the parameter
value - the value passed back
Throws:
java.lang.IllegalArgumentException - thrown if the value could not be accepted for some reason

toString

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

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 AbstractContainerWidget

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 AbstractContainerWidget