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 classBoard.CleanupDeprecated, 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 ImageboardImageDeprecated, for removal: This API element is subject to removal in a future version.protected SourceOpboardImageOpprotected StringboardNameDeprecated, for removal: This API element is subject to removal in a future version.protected Rectangleboundariesprotected booleancacheGridprotected Colorcolorstatic StringCOLORprotected booleanfixedBoundariesprotected MapGridgridstatic StringHEIGHTstatic StringIMAGEprotected StringimageFileprotected doublemagnificationprotected Mapmapstatic StringNAMEA Board is a piece of a Map.protected Pointposprotected booleanreversedprotected booleanreversiblestatic StringREVERSIBLEprotected ScaleOpscaledImageOpstatic 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 Constructor Description Board() -
Method Summary
Modifier and Type Method Description voidaddTo(Buildable b)Adds this component to its parent.Rectanglebounds()voidcleanUp()Deprecated, for removal: This API element is subject to removal in a future version.Board images are removed automatically now, when under memory pressure.booleancontains(Point p)Boardcopy()voiddraw(Graphics g, int x, int y, double zoom, Component obs)voiddrawRegion(Graphics g, Point location, Rectangle visibleRect, double zoom, Component obs)protected voiddrawTile(Graphics g, Future<BufferedImage> fim, int tx, int ty, Component obs)StringfileName()protected voidfixBounds()Deprecated, for removal: This API element is subject to removal in a future version.Bounds are now fixed automagically byImageOps.voidfixImage()Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOps.voidfixImage(Component map)Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOps.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.StringgetAttributeValueString(String key)Called by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML elementVisibilityConditiongetAttributeVisibility(String name)By default, all attributes are visibleBoardgetBoard()static StringgetConfigureTypeName()MapGridgetGrid()HelpFilegetHelpFile()StringgetLocalizedName()doublegetMagnification()MapgetMap()StringgetName()ImagegetScaledImage(double zoom, Component obs)Deprecated, for removal: This API element is subject to removal in a future version.DimensiongetSize()PointglobalCoordinates(Point p)If this board is reversed, return the location in reversed coordinatesbooleanisLocationRestricted(Point p)booleanisReversed()PointlocalCoordinates(Point p)If this board is reversed, return the location in un-reversed coordinatesStringlocalizedLocationName(Point p)StringlocationName(Point p)PointrelativePosition()voidremoveFrom(Buildable b)Remove this component from its parentvoidremoveGrid(MapGrid grid)voidsetAttribute(String key, Object val)Sets a buildFile (XML) attribute value for this component.voidsetCacheGrid(boolean cg)voidsetGrid(MapGrid mg)voidsetLocation(int x, int y)Set the location of this boardvoidsetMagnification(double magnification)voidsetMap(Map map)voidsetReversed(boolean val)PointsnapTo(Point p)voidtranslate(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, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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: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- Specified by:
removeFromin interfaceConfigurable
-
getAttributeNames
Description copied from class:AbstractBuildableLists 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:
getAttributeNamesin interfaceAutoConfigurable- Specified by:
getAttributeNamesin classAbstractBuildable- Returns:
- a list of all buildFile (XML) attribute names for this component
-
getAttributeDescriptions
Description copied from interface:AutoConfigurableReturn 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:
getAttributeDescriptionsin interfaceAutoConfigurable- Specified by:
getAttributeDescriptionsin 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:AbstractConfigurableReturn 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 ofAutoConfigurerwill 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:
getAttributeTypesin interfaceAutoConfigurable- Specified by:
getAttributeTypesin classAbstractConfigurable
-
getAttributeVisibility
Description copied from class:AbstractConfigurableBy default, all attributes are visible- Specified by:
getAttributeVisibilityin interfaceAutoConfigurable- Overrides:
getAttributeVisibilityin classAbstractConfigurable- Parameters:
name- Name (key) of one of this component's attributes- Returns:
- a
VisibilityConditionfor this attribute, or null if attribute should always be visible.
-
getAttributeValueString
Description copied from interface:AutoConfigurableCalled by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML element- Specified by:
getAttributeValueStringin interfaceAutoConfigurable- Specified by:
getAttributeValueStringin interfaceTranslatable- Specified by:
getAttributeValueStringin 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:AbstractBuildableSets a buildFile (XML) attribute value for this component. Thekeyparameter will be one of those listed inAbstractBuildable.getAttributeNames(). If thevalueparameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluewill be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()- Specified by:
setAttributein interfaceAutoConfigurable- Specified by:
setAttributein interfaceTranslatable- Specified by:
setAttributein classAbstractBuildable- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()val- If thevalueparameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAllowableConfigureComponents
Description copied from interface:ConfigurableReturn 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:
getAllowableConfigureComponentsin 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:
setGridin interfaceGridContainer
-
removeGrid
- Specified by:
removeGridin interfaceGridContainer
-
getBoard
- Specified by:
getBoardin interfaceGridContainer
-
getSize
- Specified by:
getSizein interfaceGridContainer
-
contains
- Specified by:
containsin interfaceGridContainer
-
getGrid
-
copy
-
fixImage
Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOps. -
fixImage
Deprecated, for removal: This API element is subject to removal in a future version.Images are now fixed automagically usingImageOps. -
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 byImageOps. -
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:
getHelpFilein 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 theDataArchivecache -
getMagnification
public double getMagnification() -
setMagnification
public void setMagnification(double magnification)
-
Boardimages, which is now handled automatically by the cache.