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
FieldsModifier and TypeFieldDescriptionprotected SourceOpprotected Rectangleprotected booleanprotected Colorstatic final Stringprotected booleanprotected MapGridstatic final Stringstatic final Stringprotected Stringprotected doubleprotected Mapstatic final StringA Board is a piece of a Map.protected Pointprotected booleanprotected booleanstatic final Stringprotected ScaleOpstatic final StringFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.voidAdds this component to its parent.bounds()voidBuild 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 attributebooleancopy()voidvoiddrawRegion(Graphics g, Point location, Rectangle visibleRect, double zoom, Component obs) voiddrawRegion2D(Graphics g, Point2D location, Rectangle visibleRect, double zoom, Component obs) protected voiddrawTile(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 StringgetGrid()doublegetMap()getName()getSize()If this board is reversed, return the location in reversed coordinatesbooleanbooleanIf this board is reversed, return the location in un-reversed coordinatesvoidRemove this component from its parentvoidremoveGrid(MapGrid grid) voidsetAttribute(String key, Object val) Sets a buildFile (XML) attribute value for this component.voidsetCacheGrid(boolean cg) voidvoidsetLocation(int x, int y) Set the location of this boardvoidsetMagnification(double magnification) voidvoidsetReversed(boolean val) 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, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validateMethods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface VASSAL.script.expression.Auditable
getComponentName, getComponentTypeNameMethods 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
- 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
-
build
Description copied from class:AbstractBuildableBuild 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:
buildin interfaceBuildable- Overrides:
buildin classAbstractBuildable- Parameters:
e- the XML element containing the object data
-
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
-
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 interface:AutoConfigurableReturn the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, File, Color, and KeyStroke- Specified by:
getAttributeTypesin interfaceAutoConfigurable- Specified by:
getAttributeTypesin 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
AutoConfigurerwill 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: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 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: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
- 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.
-
draw
-
drawTile
-
drawRegion
-
drawRegion2D
-
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
-
locationName
-
localizedLocationName
-
snapTo
- See Also:
-
snapTo
- See Also:
-
snapTo
- See Also:
-
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:
getHelpFilein 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:AbstractImageFinderClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.- Specified by:
addLocalImageNamesin interfaceImageSearchTarget- Overrides:
addLocalImageNamesin classAbstractImageFinder- Parameters:
s- Collection to add image names to
-