Package VASSAL.build
Class Widget
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,PropertyNameSource
,ValidityChecker
,Translatable
,ImageSearchTarget
,SearchTarget
- Direct Known Subclasses:
BoxWidget
,Chart
,ChartWindow
,HtmlChart
,ListWidget
,MapWidget
,PanelWidget
,PieceSlot
,PieceWindow
,TabWidget
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-
Nested Class Summary
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionprotected Element
static String
static String
protected Widget
static String
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, name
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds this component to its parent.void
For memory efficiency reasons, a Widget is initialized lazily.Class<?>[]
The allowable Configurable components of a Widget determined by its parent's Child-Allowable method.getBuildElement(Document doc)
Class<?>[]
Allowable components for a CHILD of this class - default is to ask our parent for this list.abstract Component
double
getScale()
boolean
hasScale()
protected void
rebuild()
Perform the build of thisBuildable
component using the element stored from when the thebuild(org.w3c.dom.Element)
method was invokedvoid
removeFrom(Buildable b)
Remove this component from its parentMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getAttributeDescriptions, getAttributeTypes, getAttributeVisibility, getConfigureName, getConfigurer, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, getAllDescendantComponents, getAllDescendantComponentsOf, getAttributeNames, getAttributeValueString, getBuildables, getBuildComponents, getComponents, getComponentsOf, getPropertyNames, setAttribute, validate
Methods inherited from class VASSAL.search.AbstractImageFinder
addLocalImageNames, getAllImageNames, getLocalImageNames
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
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
WIDTH
- See Also:
- Constant Field Values
-
HEIGHT
- See Also:
- Constant Field Values
-
buildElement
-
parent
-
-
Constructor Details
-
Widget
protected Widget()
-
-
Method Details
-
hasScale
public boolean hasScale() -
getScale
public double getScale() -
build
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 invokingrebuild()
. Subclasses should invokerebuild()
before invokinggetComponent()
- Specified by:
build
in interfaceBuildable
- Overrides:
build
in classAbstractBuildable
- Parameters:
el
- the XML element containing the object data
-
rebuild
protected void rebuild()Perform the build of thisBuildable
component using the element stored from when the thebuild(org.w3c.dom.Element)
method was invoked -
getBuildElement
- Specified by:
getBuildElement
in interfaceBuildable
- Overrides:
getBuildElement
in classAbstractBuildable
- Parameters:
doc
- XML file- Returns:
- an XML element from which this component can be built
-
getChildAllowableConfigureComponents
Allowable components for a CHILD of this class - default is to ask our parent for this list. Top-level parents must override this with the proper child list for their trees.- Returns:
- configure components allowed for children of this class
-
getAllowableConfigureComponents
The allowable Configurable components of a Widget determined by its parent's Child-Allowable method.- Returns:
- a list of valid sub-component Classes. If a Class
appears in this list, then instances of that class may be added
to this component from the Editor's
ConfigureTree
window by right-clicking on the component and selecting the appropriate "Add" option.
-
addTo
Description copied from interface:Buildable
Adds this component to its parent. In order to make Buildable objects extensible, the child is responsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.- Parameters:
b
- parent Buildable to add this component to as a subcomponent.
-
removeFrom
Description copied from interface:Configurable
Remove this component from its parent -
getParent
-
getConfigureComponents
- Specified by:
getConfigureComponents
in interfaceConfigurable
- Overrides:
getConfigureComponents
in classAbstractConfigurable
- Returns:
- A list of all child components (i.e. subcomponents) of this component that are configurable.
-
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
- Returns:
- a HelpFile describing how to use and configure * this component
-