Class Widget
- All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, PropertyNameSource, ComponentDescription, ValidityChecker, Translatable, Auditable, 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(Element) operation will add the corresponding
AWT component of the child to the component of the parent-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Elementprotected Stringstatic final Stringstatic final Stringstatic final Stringprotected Widgetstatic final StringFields inherited from class AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameModifier and TypeFieldDescriptionprotected PropertyChangeSupportprotected Configurerprotected Stringprotected ComponentI18nDataprotected StringFields inherited from class AbstractBuildable
buildComponents, validatorFields inherited from interface Configurable
NAME_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds this component to its parent.voidFor 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 ComponentdoublegetScale()booleanbooleanhasScale()protected voidrebuild()Perform the build of thisBuildablecomponent using the element stored from when the thebuild(Element)method was invokedvoidRemove this component from its parentMethods inherited from class AbstractConfigurable
add, addPropertyChangeListener, getAttributeDescriptions, getAttributeTypes, getAttributeVisibility, getConfigureName, getConfigurer, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameModifier and TypeMethodDescriptionvoidSet the owning translatable of this componentvoidAdd a PropertyChangeListener.abstract String[]Return an array of Strings describing the attributes of this object.abstract Class<?>[]Return the Class for the attributes of this object.getAttributeVisibility(String name) By default, all attributes are visibleConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.protected StringReturns the name of the configurable type for display purposes.voidRemove a Buildable object from this objectvoidprotected voidSets all attributes untranslatable.protected voidsetAttributeTranslatable(String attr, boolean b) Over-ride the default attribute translatability.voidSets the name and fires a PropertyChangeEventMethods inherited from class AbstractBuildable
addImageNamesRecursively, buildString, getAllDescendantComponentsOf, getAncestor, getAttributeNames, getAttributeValueString, getBuildables, getBuildComponents, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, setAttribute, validateModifier and TypeMethodDescriptionvoidAdds all images used by this component AND any subcomponents to the collection<T> List<T> getAllDescendantComponentsOf(Class<T> target) Recursively descend the build tree and return aListof all components that are instances of the given classabstract String[]Lists all the buildFile (XML) attribute names for this component.abstract StringDeprecated, for removal: This API element is subject to removal in a future version.<T> Enumeration<T> getComponents(Class<T> target) Deprecated, for removal: This API element is subject to removal in a future version.UseAbstractBuildable.getComponentsOf(Class)instead.<T> List<T> getComponentsOf(Class<T> target) Override this method to provide a list of properties to be exposed for use by expressions in the module.voidsetAncestor(Buildable ancestor) abstract voidsetAttribute(String key, Object value) Sets a buildFile (XML) attribute value for this component.voidvalidate(Buildable target, ValidationReport report) Methods inherited from class AbstractImageFinder
addLocalImageNames, getAllImageNames, getLocalImageNamesModifier and TypeMethodDescriptionvoidClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Auditable
getComponentName, getComponentTypeNameMethods inherited from interface AutoConfigurable
getAttributeNames, getAttributeValueString, setAttributeModifier and TypeMethodDescriptionString[]Called by theBuildable.getBuildElement(Document)method to write the attributes into an XML elementvoidsetAttribute(String key, Object value) Called by theBuildable.build(Element)method, wherevalueis the String value read by the XML attribute.Methods inherited from interface Buildable
isMandatory, isMovable, isUniqueModifier and TypeMethodDescriptiondefault booleanIs this component a reqired component within its parent?default booleanIs this component allowed to be moved around the Configure Tree?default booleanisUnique()Does this component need to be unique within it's parent?
-
Field Details
-
DESCRIPTION
- See Also:
-
NAME
- See Also:
-
WIDTH
- See Also:
-
HEIGHT
- See Also:
-
buildElement
-
parent
-
description
-
-
Constructor Details
-
Widget
protected Widget()
-
-
Method Details
-
hasScale
public boolean hasScale() -
hasScalablePieces
public boolean hasScalablePieces()- Returns:
- false if we're a child of a ChartWindow, meaning there won't be pieces to scale
-
getScale
public double getScale() -
getDescription
- Specified by:
getDescriptionin interfaceComponentDescription- Returns:
- Description to be displayed next to component type/name in the main Editor window. Or null or "" to not display anything.
-
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(Element)method was invoked -
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Overrides:
getBuildElementin 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.- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable- 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
ConfigureTreewindow by right-clicking on the component and selecting the appropriate "Add" option.
-
addTo
Description copied from interface:BuildableAdds 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. -
removeFrom
Description copied from interface:ConfigurableRemove this component from its parent- Specified by:
removeFromin interfaceConfigurable
-
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(Element)method
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- a HelpFile describing how to use and configure * this component
-
AbstractBuildable.getBuildables()instead.