Class Board
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.map.boardPicker.Board
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,GridContainer
,PropertyNameSource
,ValidityChecker
,Translatable
public class Board extends AbstractConfigurable implements GridContainer
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Board.Cleanup
Deprecated, for removal: This API element is subject to removal in a future version.Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Fields Modifier and Type Field Description protected Image
boardImage
Deprecated, for removal: This API element is subject to removal in a future version.protected SourceOp
boardImageOp
protected String
boardName
Deprecated, for removal: This API element is subject to removal in a future version.protected Rectangle
boundaries
protected boolean
cacheGrid
protected Color
color
static String
COLOR
protected boolean
fixedBoundaries
protected MapGrid
grid
static String
HEIGHT
static String
IMAGE
protected String
imageFile
protected double
magnification
protected Map
map
static String
NAME
A Board is a piece of a Map.protected Point
pos
protected boolean
reversed
protected boolean
reversible
static String
REVERSIBLE
protected ScaleOp
scaledImageOp
static String
WIDTH
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 Board()
-
Method Summary
Modifier and Type Method Description void
addTo(Buildable b)
Adds this component to its parent.Rectangle
bounds()
void
cleanUp()
Deprecated, for removal: This API element is subject to removal in a future version.Board images are removed automatically now, when under memory pressure.boolean
contains(Point p)
Board
copy()
void
draw(Graphics g, int x, int y, double zoom, Component obs)
void
drawRegion(Graphics g, Point location, Rectangle visibleRect, double zoom, Component obs)
protected void
drawTile(Graphics g, Future<BufferedImage> fim, int tx, int ty, Component obs)
String
fileName()
protected void
fixBounds()
Deprecated, for removal: This API element is subject to removal in a future version.Bounds are now fixed automagically byImageOp
s.void
fixImage()
Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOp
s.void
fixImage(Component map)
Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOp
s.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()
static String
getConfigureTypeName()
MapGrid
getGrid()
HelpFile
getHelpFile()
String
getLocalizedName()
double
getMagnification()
Map
getMap()
String
getName()
Image
getScaledImage(double zoom, Component obs)
Deprecated, for removal: This API element is subject to removal in a future version.Dimension
getSize()
Point
globalCoordinates(Point p)
If this board is reversed, return the location in reversed coordinatesboolean
isLocationRestricted(Point p)
boolean
isReversed()
Point
localCoordinates(Point p)
If this board is reversed, return the location in un-reversed coordinatesString
localizedLocationName(Point p)
String
locationName(Point p)
Point
relativePosition()
void
removeFrom(Buildable b)
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
setGrid(MapGrid mg)
void
setLocation(int x, int y)
Set the location of this boardvoid
setMagnification(double magnification)
void
setMap(Map map)
void
setReversed(boolean val)
Point
snapTo(Point p)
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, getI18nData, getI18nPrefix, getLocalizedConfigureName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, 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
A Board is a piece of a Map. A Map can cantain a set of boards layed out in a rectangular grid.- See Also:
- Constant Field Values
-
IMAGE
- See Also:
- Constant Field Values
-
WIDTH
- See Also:
- Constant Field Values
-
HEIGHT
- See Also:
- Constant Field Values
-
COLOR
- See Also:
- Constant Field Values
-
REVERSIBLE
- See Also:
- Constant Field Values
-
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 -
boardName
Deprecated, for removal: This API element is subject to removal in a future version. -
boardImage
Deprecated, for removal: This API element is subject to removal in a future version. -
boardImageOp
-
scaledImageOp
-
-
Constructor Details
-
Board
public Board()
-
-
Method Details
-
getMap
- Returns:
- this
Board
'sMap
. Until a game is started that is using this board, the map will be null.
-
setCacheGrid
public void setCacheGrid(boolean cg) -
setMap
-
getLocalizedName
-
getName
-
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. -
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 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
-
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 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()
-
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
-
draw
-
drawTile
-
drawRegion
-
getScaledImage
@Deprecated(since="2020-08-06", forRemoval=true) public Image getScaledImage(double zoom, Component obs)Deprecated, for removal: This API element is subject to removal in a future version. -
setReversed
public void setReversed(boolean val) -
isReversed
public boolean isReversed() -
localCoordinates
If this board is reversed, return the location in un-reversed coordinates -
globalCoordinates
If this board is reversed, return the location in reversed coordinates -
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
-
fixImage
Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOp
s. -
fixImage
Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOp
s. -
locationName
-
localizedLocationName
-
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
-
fixBounds
Deprecated, for removal: This API element is subject to removal in a future version.Bounds are now fixed automagically byImageOp
s. -
translate
public void translate(int x, int y)Translate the location of the board by the given number of pixels- See Also:
bounds()
-
setLocation
public void setLocation(int x, int y)Set the location of this board- See Also:
bounds()
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFilte describing how to use and configure this component
-
cleanUp
Deprecated, for removal: This API element is subject to removal in a future version.Board images are removed automatically now, when under memory pressure.Removes board images from theDataArchive
cache -
getMagnification
public double getMagnification() -
setMagnification
public void setMagnification(double magnification)
-
Board
images, which is now handled automatically by the cache.