Package VASSAL.build
Class Widget
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.Widget
- All Implemented Interfaces:
AutoConfigurable,Buildable,Configurable,PropertyNameSource,ValidityChecker,Translatable
- Direct Known Subclasses:
BoxWidget,Chart,ChartWindow,HtmlChart,ListWidget,MapWidget,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-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWidget.MyCellRendererNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
Fields Modifier and Type Field Description protected ElementbuildElementstatic StringHEIGHTstatic StringNAMEprotected Widgetparentstatic StringWIDTHFields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameFields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validatorFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY -
Constructor Summary
Constructors Modifier Constructor Description protectedWidget() -
Method Summary
Modifier and Type Method Description voidaddTo(Buildable b)Adds this component to its parent.voidbuild(Element el)For memory efficiency reasons, a Widget is initialized lazily.Class<?>[]getAllowableConfigureComponents()The allowable Configurable components of a Widget are the same as its parentElementgetBuildElement(Document doc)abstract ComponentgetComponent()Configurable[]getConfigureComponents()HelpFilegetHelpFile()WidgetgetParent()doublegetScale()booleanhasScale()protected voidrebuild()Perform the build of thisBuildablecomponent using the element stored from when the thebuild(org.w3c.dom.Element)method was invokedvoidremoveFrom(Buildable b)Remove this component from its parentMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getAttributeDescriptions, getAttributeTypes, getAttributeVisibility, getConfigureName, getConfigurer, getI18nData, getI18nPrefix, getLocalizedConfigureName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
getAllDescendantComponents, getAllDescendantComponentsOf, getAttributeNames, getAttributeValueString, getBuildables, getBuildComponents, getComponents, getComponentsOf, getPropertyNames, setAttribute, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
buildin interfaceBuildable- Overrides:
buildin classAbstractBuildable- Parameters:
el- the XML element containing the object data
-
rebuild
protected void rebuild()Perform the build of thisBuildablecomponent using the element stored from when the thebuild(org.w3c.dom.Element)method was invoked -
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Overrides:
getBuildElementin classAbstractBuildable- Returns:
- an XML element from which this component can be built
-
getAllowableConfigureComponents
The allowable Configurable components of a Widget are the same as its parent -
addTo
Description copied from interface:BuildableAdds 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
Description copied from interface:ConfigurableRemove this component from its parent -
getParent
-
getConfigureComponents
- Specified by:
getConfigureComponentsin interfaceConfigurable- Overrides:
getConfigureComponentsin 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 HelpFilte describing how to use and configure this component
-