edu.washington.cs.supple.wlib.awt
Class ContainerAwtWidget

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

public abstract class ContainerAwtWidget
extends AbstractContainerWidget
implements AwtWidget

Author:
Jing Jing Long

Field Summary
static int LEFT
           
static java.lang.String LIST_PLACEMENT_PROPERTY
           
static java.lang.String LISTING_WIDGET_PROPERTY
           
protected  AwtWidget listingWidget
           
protected  int listPlacement
           
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
ContainerAwtWidget(UiObject object)
           
ContainerAwtWidget(UiObject object, AwtWidget lWidget, int placement)
           
ContainerAwtWidget(UiObject object, WidgetDescriptor wd, WidgetFactory f)
           
 
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
protected  boolean addChildren(java.awt.Container container, int hints)
          A convenience method that will add all the children widgets to the specified container.
 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  WidgetDescriptor generateWidgetDescriptor()
          Subclasses can override this method if their widget descriptor include extra information
 java.awt.Component getAwtComponent(int hints)
          For regular container types, it returns the result of calling makeAwtContainer.
protected  java.awt.Component getComponentForChild(UiObject object, int hints)
          Returns the Awt component of a child corresponding to object description and rendered according to the hings
 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
 AwtWidget getListingWidget()
           
 java.awt.Dimension getSize(int hints)
           
 WidgetProperties getWidgetProperties()
          Returns the corresponding WidgetProperties
 boolean hasListingWidget()
          Lets you easily check if this container widget has a listing built in
protected  java.awt.Button makeActionButton(java.lang.String label, java.awt.event.ActionListener listener)
          A convenience method for creating buttons
protected  java.awt.Component makeActionButtons()
          Creates a panel with appropriate action buttons
protected  java.awt.Container makeAwtContainer(int hints)
          To be overriden by children (unless they override getAwtComponent)
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(AwtWidget listingWidget, int placement)
           
 java.lang.String toString()
           
 
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, getEffortEstimate, getPath, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, hasChildren, isEngaged, isEquivalent, setBag, setCost, setEnabled, setParent, setSizeCache, setWrapper, unwrapWidget
 

Field Detail

listingWidget

protected AwtWidget 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

LIST_PLACEMENT_PROPERTY

public static final java.lang.String LIST_PLACEMENT_PROPERTY
See Also:
Constant Field Values
Constructor Detail

ContainerAwtWidget

public ContainerAwtWidget(UiObject object)
Parameters:
object -

ContainerAwtWidget

public ContainerAwtWidget(UiObject object,
                          AwtWidget lWidget,
                          int placement)

ContainerAwtWidget

public ContainerAwtWidget(UiObject object,
                          WidgetDescriptor wd,
                          WidgetFactory f)
                   throws java.lang.Exception
Method Detail

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

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

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

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

getAwtComponent

public java.awt.Component getAwtComponent(int hints)
For regular container types, it returns the result of calling makeAwtContainer. for action parameters type, it creates a larger panel with an action button

Specified by:
getAwtComponent in interface AwtWidget
Parameters:
hints - specifies the variant of the widget to be rendered
Returns:
a renderable component

makeAwtContainer

protected java.awt.Container makeAwtContainer(int hints)
To be overriden by children (unless they override getAwtComponent)

Parameters:
hints - rendering hints
Returns:
the container with all elements listed in the type

makeActionButtons

protected java.awt.Component makeActionButtons()
Creates a panel with appropriate action buttons

Returns:
the panel with action buttons

makeActionButton

protected java.awt.Button makeActionButton(java.lang.String label,
                                           java.awt.event.ActionListener listener)
A convenience method for creating buttons

Parameters:
label - text label to be put on the button
listener - action listener to be added to the button
Returns:
A rendering for an action button

getComponentForChild

protected java.awt.Component getComponentForChild(UiObject object,
                                                  int hints)
Returns the Awt component of a child corresponding to object description and rendered according to the hings

Parameters:
object - description
hints - rendering hints
Returns:
Awt component of the maching child if set; null otherwise

addChildren

protected boolean addChildren(java.awt.Container container,
                              int hints)
A convenience method that will add all the children widgets to the specified container.

Parameters:
container - The container to hold the children
hints - rendering hints
Returns:
true if all children were added, false if there were problems

hasListingWidget

public boolean hasListingWidget()
Lets you easily check if this container widget has a listing built in

Returns:

getListingWidget

public AwtWidget getListingWidget()
Returns:
Returns the listingWidget.

setListingWidget

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

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