Class Zone
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.map.boardPicker.board.mapgrid.Zone
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,GameComponent
,GridContainer
,MutablePropertiesContainer
,PropertyNameSource
,PropertySource
,ValidityChecker
,Translatable
public class Zone extends AbstractConfigurable implements GridContainer, MutablePropertiesContainer, PropertySource, GameComponent
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Zone.Editor
static class
Zone.LocationFormatConfig
static class
Zone.ShapeEditor
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
Nested classes/interfaces inherited from interface VASSAL.build.module.properties.MutablePropertiesContainer
MutablePropertiesContainer.Impl
-
Field Summary
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
Constructors Constructor Description Zone()
-
Method Summary
Modifier and Type Method Description void
addMutableProperty(String key, MutableProperty p)
Add a property under the given keyvoid
addTo(Buildable b)
Adds this component to its parent.boolean
contains(Point p)
void
draw(Graphics g, Rectangle bounds, Rectangle visibleRect, double scale, boolean reversed)
Class<?>[]
getAllowableConfigureComponents()
Return a list of valid sub-component Classes.String[]
getAttributeDescriptions()
Return an array of Strings describing the attributes of this object.String[]
getAttributeNames()
Lists all the buildFile (XML) attribute names for this component.Class<?>[]
getAttributeTypes()
Return the Class for the buildFile (XML) attributes of this component.String
getAttributeValueString(String key)
Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML elementVisibilityCondition
getAttributeVisibility(String name)
By default, all attributes are visibleBoard
getBoard()
Rectangle
getBounds()
protected Shape
getCachedShape(Polygon poly, int x, int y, double scale)
static String
getConfigureTypeName()
MapGrid
getGrid()
HelpFile
getHelpFile()
String
getLocalizedName()
Object
getLocalizedProperty(Object key)
Point
getLocation(String location)
Map
getMap()
String
getMutablePropertiesContainerId()
Return a unique Id for the containerMutableProperty
getMutableProperty(String name)
Find a GlobalProperty object with the given nameString
getName()
ZonedGrid
getParentGrid()
Object
getProperty(Object key)
List<String>
getPropertyNames()
Implement PropertNameSource - expose names of my ZonePropertiesCommand
getRestoreCommand()
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullprotected Shape
getScaledShape(Polygon myPolygon, double scale)
Shape
getShape()
Dimension
getSize()
boolean
isUseParentGrid()
String
localizedLocationName(Point p)
String
locationName(Point p)
void
removeFrom(Buildable b)
Remove this component from its parentvoid
removeGrid(MapGrid grid)
MutableProperty
removeMutableProperty(String key)
Remove the property with the given keyvoid
repaint()
void
setAttribute(String key, Object val)
Sets a buildFile (XML) attribute value for this component.void
setGrid(MapGrid m)
void
setHighlight(ZoneHighlight h)
void
setHighlighter(String highlightName)
void
setup(boolean gameStarting)
Notify the GameComponent that a game has started/endedPoint
snapTo(Point p)
Snap to the grid in this zone,Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, getI18nData, getI18nPrefix, getLocalizedConfigureName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface VASSAL.build.Buildable
build, getBuildElement
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
PATH
- See Also:
- Constant Field Values
-
USE_PARENT_GRID
- See Also:
- Constant Field Values
-
LOCATION_FORMAT
- See Also:
- Constant Field Values
-
GRID_LOCATION
- See Also:
- Constant Field Values
-
USE_HIGHLIGHT
- See Also:
- Constant Field Values
-
HIGHLIGHT_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_SIZE
-
locationFormat
-
format
-
myPolygon
-
grid
-
parentGrid
-
useParentGrid
protected boolean useParentGrid -
globalPropertyListener
-
propsContainer
-
repaintOnPropertyChange
-
lastBoundsX
protected int lastBoundsX -
lastBoundsY
protected int lastBoundsY -
lastScale
protected double lastScale -
lastScaledShape
-
lastTransformedShape
-
lastPolygon
-
highlighter
-
useHighlight
protected boolean useHighlight -
highlightPropertyName
-
highlightProperty
-
highlightPropertyChangeListener
-
-
Constructor Details
-
Zone
public Zone()
-
-
Method Details
-
getName
-
getLocalizedName
-
getAttributeNames
Description copied from class:AbstractBuildable
Lists all the buildFile (XML) attribute names for this component. If this component is ALSO anAbstractConfigurable
, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()
andAbstractConfigurable.getAttributeTypes()
.- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Specified by:
getAttributeNames
in classAbstractBuildable
- Returns:
- a list of all buildFile (XML) attribute names for this component
-
getAttributeDescriptions
Description copied from interface:AutoConfigurable
Return an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object.- Specified by:
getAttributeDescriptions
in interfaceAutoConfigurable
- Specified by:
getAttributeDescriptions
in classAbstractConfigurable
- Returns:
- an array of Strings describing the buildFile (XML) attributes of this component. These strings are used as prompts in the
Properties window for this object, when the component is configured in the Editor. The order of descriptions should
be the same as the order of names in
AbstractBuildable.getAttributeNames()
-
getAttributeTypes
Description copied from class:AbstractConfigurable
Return the Class for the buildFile (XML) attributes of this component. Valid classes include: String, Integer, Double, Boolean, Image, Color, and KeyStroke, along with any class for which a Configurer exists in VASSAL.configure. The class determines, among other things, which type ofAutoConfigurer
will be used to configure the attribute when the object is configured in the Editor. The order of classes should be the same as the order of names inAbstractBuildable.getAttributeNames()
- Specified by:
getAttributeTypes
in interfaceAutoConfigurable
- Specified by:
getAttributeTypes
in classAbstractConfigurable
-
addTo
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. -
repaint
public void repaint() -
removeFrom
Description copied from interface:Configurable
Remove this component from its parent- Specified by:
removeFrom
in interfaceConfigurable
-
getConfigureTypeName
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFilte describing how to use and configure this component
-
getAttributeValueString
Description copied from interface:AutoConfigurable
Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML element- Specified by:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Specified by:
getAttributeValueString
in classAbstractBuildable
- Parameters:
key
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
- Returns:
- a String representation of the attribute with the given name. When initializing a module, this String value will be passed to
AbstractBuildable.setAttribute(java.lang.String, java.lang.Object)
.
-
setAttribute
Description copied from class:AbstractBuildable
Sets a buildFile (XML) attribute value for this component. Thekey
parameter will be one of those listed inAbstractBuildable.getAttributeNames()
. If thevalue
parameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
will be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Specified by:
setAttribute
in classAbstractBuildable
- Parameters:
key
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
val
- If thevalue
parameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
can also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAttributeVisibility
Description copied from class:AbstractConfigurable
By default, all attributes are visible- Specified by:
getAttributeVisibility
in interfaceAutoConfigurable
- Overrides:
getAttributeVisibility
in classAbstractConfigurable
- Parameters:
name
- Name (key) of one of this component's attributes- Returns:
- a
VisibilityCondition
for this attribute, or null if attribute should always be visible.
-
getAllowableConfigureComponents
Description copied from interface:Configurable
Return 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 Configuration Window.- Specified by:
getAllowableConfigureComponents
in interfaceConfigurable
-
addMutableProperty
Description copied from interface:MutablePropertiesContainer
Add a property under the given key- Specified by:
addMutableProperty
in interfaceMutablePropertiesContainer
-
removeMutableProperty
Description copied from interface:MutablePropertiesContainer
Remove the property with the given key- Specified by:
removeMutableProperty
in interfaceMutablePropertiesContainer
-
getLocation
- Throws:
MapGrid.BadCoords
-
locationName
-
localizedLocationName
-
contains
- Specified by:
contains
in interfaceGridContainer
-
snapTo
Snap to the grid in this zone, -
getSize
- Specified by:
getSize
in interfaceGridContainer
-
removeGrid
- Specified by:
removeGrid
in interfaceGridContainer
-
getBoard
- Specified by:
getBoard
in interfaceGridContainer
-
getMap
-
getParentGrid
-
setGrid
- Specified by:
setGrid
in interfaceGridContainer
-
getGrid
-
isUseParentGrid
public boolean isUseParentGrid() -
getShape
-
getBounds
-
setHighlight
-
draw
-
getScaledShape
-
getCachedShape
-
getProperty
- Specified by:
getProperty
in interfacePropertySource
-
getLocalizedProperty
- Specified by:
getLocalizedProperty
in interfacePropertySource
-
getPropertyNames
Implement PropertNameSource - expose names of my ZoneProperties- Specified by:
getPropertyNames
in interfacePropertyNameSource
- Overrides:
getPropertyNames
in classAbstractBuildable
- Returns:
- Default implementation of PropertyNameSource - No properties exposed
-
getMutableProperty
Description copied from interface:MutablePropertiesContainer
Find a GlobalProperty object with the given name- Specified by:
getMutableProperty
in interfaceMutablePropertiesContainer
-
getMutablePropertiesContainerId
Description copied from interface:MutablePropertiesContainer
Return a unique Id for the container- Specified by:
getMutablePropertiesContainerId
in interfaceMutablePropertiesContainer
-
setup
public void setup(boolean gameStarting)Description copied from interface:GameComponent
Notify the GameComponent that a game has started/ended- Specified by:
setup
in interfaceGameComponent
- Parameters:
gameStarting
- if true, a game is starting. If false, then a game is ending
-
setHighlighter
-
getRestoreCommand
Description copied from interface:GameComponent
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommand
in interfaceGameComponent
-