Class Board
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.map.boardPicker.Board
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,GridContainer
,PropertyNameSource
,ValidityChecker
,Translatable
,Auditable
,ImageSearchTarget
,SearchTarget
-
Nested Class Summary
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionprotected SourceOp
protected Rectangle
protected boolean
protected Color
static final String
protected boolean
protected MapGrid
static final String
static final String
protected String
protected double
protected Map
static final String
A Board is a piece of a Map.protected Point
protected boolean
protected boolean
static final String
protected ScaleOp
static final 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
Classes extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.void
Adds this component to its parent.bounds()
void
Build this component by getting all XML attributes of the XML element and callingAbstractBuildable.setAttribute(java.lang.String, java.lang.Object)
with the String value of the attributeboolean
copy()
void
void
drawRegion
(Graphics g, Point location, Rectangle visibleRect, double zoom, Component obs) void
drawRegion2D
(Graphics g, Point2D location, Rectangle visibleRect, double zoom, Component obs) protected void
drawTile
(Graphics g, Future<BufferedImage> fim, int tx, int ty, Component obs) fileName()
Class<?>[]
String[]
Return an array of Strings describing the attributes of this object.String[]
Lists all the buildFile (XML) attribute names for this component.Class<?>[]
Return the Class for the attributes of this object.Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML elementgetAttributeVisibility
(String name) By default, all attributes are visiblegetBoard()
static String
getGrid()
double
getMap()
getName()
getSize()
If this board is reversed, return the location in reversed coordinatesboolean
boolean
If this board is reversed, return the location in un-reversed coordinatesvoid
Remove this component from its parentvoid
removeGrid
(MapGrid grid) void
setAttribute
(String key, Object val) Sets a buildFile (XML) attribute value for this component.void
setCacheGrid
(boolean cg) void
void
setLocation
(int x, int y) Set the location of this boardvoid
setMagnification
(double magnification) void
void
setReversed
(boolean val) void
translate
(int x, int y) Translate the location of the board by the given number of pixelsMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validate
Methods inherited from class VASSAL.search.AbstractImageFinder
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.script.expression.Auditable
getComponentName, getComponentTypeName
Methods inherited from interface VASSAL.build.Buildable
getBuildElement, isMandatory, isMovable, isUnique
-
Field Details
-
NAME
A Board is a piece of a Map. A Map can cantain a set of boards layed out in a rectangular grid.- See Also:
-
IMAGE
- See Also:
-
WIDTH
- See Also:
-
HEIGHT
- See Also:
-
COLOR
- See Also:
-
REVERSIBLE
- See Also:
-
pos
-
boundaries
-
imageFile
-
reversible
protected boolean reversible -
reversed
protected boolean reversed -
fixedBoundaries
protected boolean fixedBoundaries -
color
-
grid
-
map
-
magnification
protected double magnification -
cacheGrid
protected boolean cacheGrid -
boardImageOp
-
scaledImageOp
-
-
Constructor Details
-
Board
public Board()
-
-
Method Details
-
getMap
-
setCacheGrid
public void setCacheGrid(boolean cg) -
setMap
-
getLocalizedName
-
getName
-
build
Description copied from class:AbstractBuildable
Build this component by getting all XML attributes of the XML element and callingAbstractBuildable.setAttribute(java.lang.String, java.lang.Object)
with the String value of the attribute- Specified by:
build
in interfaceBuildable
- Overrides:
build
in classAbstractBuildable
- Parameters:
e
- the XML element containing the object data
-
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. -
removeFrom
Description copied from interface:Configurable
Remove this component from its parent- Specified by:
removeFrom
in interfaceConfigurable
-
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()
-
getConfigureTypeName
-
getAttributeTypes
Description copied from interface:AutoConfigurable
Return the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, File, Color, and KeyStroke- Specified by:
getAttributeTypes
in interfaceAutoConfigurable
- Specified by:
getAttributeTypes
in classAbstractConfigurable
- Returns:
- 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 of
AutoConfigurer
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()
-
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.
-
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 XML buildFile attribute with the given name. When initializing a module,
this String value will loaded from the XML and passed to
AbstractBuildable.setAttribute(java.lang.String, java.lang.Object)
. It is also frequently used for checking the current value of an attribute.
-
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()
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponents
in 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
ConfigureTree
window by right-clicking on the component and selecting the appropriate "Add" option.
-
draw
-
drawTile
-
drawRegion
-
drawRegion2D
-
setReversed
public void setReversed(boolean val) -
isReversed
public boolean isReversed() -
localCoordinates
-
globalCoordinates
-
setGrid
- Specified by:
setGrid
in interfaceGridContainer
-
removeGrid
- Specified by:
removeGrid
in interfaceGridContainer
-
getBoard
- Specified by:
getBoard
in interfaceGridContainer
-
getSize
- Specified by:
getSize
in interfaceGridContainer
-
contains
- Specified by:
contains
in interfaceGridContainer
-
getGrid
-
copy
-
locationName
-
localizedLocationName
-
snapTo
-
snapTo
-
snapTo
-
isLocationRestricted
- Returns:
- true if the given point may not be a local location. I.e., if this grid will attempt to snap it to the nearest grid location.
-
fileName
-
relativePosition
- Returns:
- Position of this board relative to the other boards (0,0) is the upper left, (0,1) is to the right, etc.
-
bounds
- Returns:
- The (read-only) boundaries of this Board within the overall Map
-
translate
public void translate(int x, int y) Translate the location of the board by the given number of pixels- See Also:
-
setLocation
public void setLocation(int x, int y) Set the location of this board- See Also:
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFile describing how to use and configure * this component
-
getMagnification
public double getMagnification() -
setMagnification
public void setMagnification(double magnification) -
addLocalImageNames
Description copied from class:AbstractImageFinder
Classes extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.- Specified by:
addLocalImageNames
in interfaceImageSearchTarget
- Overrides:
addLocalImageNames
in classAbstractImageFinder
- Parameters:
s
- Collection to add image names to
-