VASSAL.build
Class Widget

java.lang.Object
  |
  +--VASSAL.build.AbstractBuildable
        |
        +--VASSAL.build.AbstractConfigurable
              |
              +--VASSAL.build.Widget
All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable
Direct Known Subclasses:
BoxWidget, Chart, ChartWindow, HtmlChart, ListWidget, PanelWidget, PieceSlot, PieceWindow, TabWidget

public abstract class Widget
extends AbstractConfigurable

A general-purpose configurable GUI container Widgets are Configurable objects that represent AWT components. Adding a Widget to another Widget during a Buildable.build(org.w3c.dom.Element) operation will add the corresponding AWT component of the child to the component of the parent


Inner Class Summary
static class Widget.MyCellRenderer
           
 
Inner classes inherited from class VASSAL.build.AutoConfigurable
AutoConfigurable.Util
 
Field Summary
protected  org.w3c.dom.Element buildElement
           
static java.lang.String HEIGHT
           
static java.lang.String NAME
           
protected  Widget parent
           
static java.lang.String WIDTH
           
 
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, name
 
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents
 
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
 
Constructor Summary
protected Widget()
           
 
Method Summary
 void addTo(Buildable b)
          Adds this component to its parent.
 void build(org.w3c.dom.Element el)
          For memory efficiency reasons, a Widget is initialized lazily.
 java.lang.Class[] getAllowableConfigureComponents()
          The allowable Configurable components of a Widget are the same as its parent
 org.w3c.dom.Element getBuildElement(org.w3c.dom.Document doc)
           
abstract  java.awt.Component getComponent()
           
 Configurable[] getConfigureComponents()
           
 HelpFile getHelpFile()
           
 Widget getParent()
           
protected  void rebuild()
          Perform the build of this Buildable component using the element stored from when the the build(org.w3c.dom.Element) method was invoked
 void removeFrom(Buildable b)
          Remove this component from its parent
 
Methods inherited from class VASSAL.build.AbstractConfigurable
addPropertyChangeListener, getAttributeDescriptions, getAttributeTypes, getAttributeVisibility, getConfigureName, getConfigurer, remove, setConfigureName
 
Methods inherited from class VASSAL.build.AbstractBuildable
add, getAttributeNames, getAttributeValueString, getBuildComponents, getComponents, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface VASSAL.build.AutoConfigurable
getAttributeNames, getAttributeValueString, setAttribute
 
Methods inherited from interface VASSAL.build.Buildable
add
 

Field Detail

NAME

public static final java.lang.String NAME

WIDTH

public static final java.lang.String WIDTH

HEIGHT

public static final java.lang.String HEIGHT

buildElement

protected org.w3c.dom.Element buildElement

parent

protected Widget parent
Constructor Detail

Widget

protected Widget()
Method Detail

build

public void build(org.w3c.dom.Element el)
For memory efficiency reasons, a Widget is initialized lazily. This method only stores the element from which the build the Widget. The Widget is built from the stored element by invoking rebuild(). Subclasses should invoke rebuild() before invoking getComponent()
Overrides:
build in class AbstractBuildable
Following copied from interface: VASSAL.build.Buildable
Parameters:
e - the XML element containing the object data

rebuild

protected void rebuild()
Perform the build of this Buildable component using the element stored from when the the build(org.w3c.dom.Element) method was invoked

getBuildElement

public org.w3c.dom.Element getBuildElement(org.w3c.dom.Document doc)
Overrides:
getBuildElement in class AbstractBuildable
Following copied from interface: VASSAL.build.Buildable
Returns:
an XML element from which this component can be built

getAllowableConfigureComponents

public java.lang.Class[] getAllowableConfigureComponents()
The allowable Configurable components of a Widget are the same as its parent

addTo

public void addTo(Buildable b)
Description copied from interface: Buildable
Adds this component to its parent. In order to make Buildable objects extensible, the child is reponsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.

removeFrom

public void removeFrom(Buildable b)
Description copied from interface: Configurable
Remove this component from its parent

getParent

public Widget getParent()

getConfigureComponents

public Configurable[] getConfigureComponents()
Overrides:
getConfigureComponents in class AbstractConfigurable
Following copied from interface: VASSAL.build.Configurable
Returns:
an array of Configurer objects representing the Configurable children of this Configurable object

getComponent

public abstract java.awt.Component getComponent()
Returns:
the Component for this widget. For efficiency, the Component may be initialized lazily instead of being created in the Buildable.build(org.w3c.dom.Element) method

getHelpFile

public HelpFile getHelpFile()
Following copied from interface: VASSAL.build.Configurable
Returns:
a HelpFilte describing how to use and configure this component