Class CounterDetailViewer
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.map.CounterDetailViewer
- All Implemented Interfaces:
DragSourceMotionListener
,KeyListener
,MouseListener
,MouseMotionListener
,EventListener
,AutoConfigurable
,Buildable
,Configurable
,Drawable
,PropertyNameSource
,ValidityChecker
,Translatable
,Auditable
,ImageSearchTarget
,SearchTarget
- Direct Known Subclasses:
GlobalMap.CounterViewer
public class CounterDetailViewer
extends AbstractConfigurable
implements Drawable, DragSourceMotionListener, MouseMotionListener, MouseListener, KeyListener
This is a
Drawable
class that draws the counters horizontally when
the mouse is held over a stack with the control key down.
d/b/a Mouseover Stack Viewer- Version:
- 1.0
- Author:
- David Sullivan
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
protected class
Utility class to select the pieces we wish to view.static class
static class
static class
protected static class
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
protected Color
static final String
static final String
static final String
static final String
protected Color
protected int
protected int
protected int
protected Rectangle
static final String
static final String
static final String
protected boolean
protected boolean
protected boolean
static final String
protected boolean
static final String
protected FormattedString
protected MouseEvent
protected int
static final String
protected Timer
protected String
static final String
static final String
protected boolean
protected String[]
protected String
static final String
static final String
protected boolean
protected boolean
static final String
protected FormattedString
static final String
protected boolean
static final String
static final String
protected int
static final String
protected Color
static final String
protected Font
static final String
protected int
static final String
protected boolean
protected double
protected KeyStroke
static final String
static final String
static final String
protected Rectangle
static final String
static final String
protected Map
static final String
protected int
protected boolean
static final String
static final String
protected boolean
static final String
static final String
protected PropertyExpression
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected boolean
protected static int
Deprecated, for removal: This API element is subject to removal in a future version.protected boolean
protected boolean
protected boolean
protected boolean
protected int
protected boolean
protected boolean
protected String
protected int
protected boolean
protected FormattedString
protected int
protected double
protected boolean
protected boolean
static final String
protected boolean
static final String
static final String
protected boolean
protected boolean
static final String
static final String
protected FormattedString
protected boolean
static final String
static final String
protected boolean
static final String
protected String
static final String
static final String
static final String
static final String
protected int
protected int
protected int
protected JComponent
the JComponent which is repainted when the detail viewer changesstatic final String
protected double
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
In case our labels refer to any image filesvoid
Adds this component to its parent.protected void
Compatibility.void
void
draw
(Graphics g, Point pt, JComponent comp) void
boolean
protected void
drawGraphics
(Graphics g, Point pt, JComponent comp, List<GamePiece> pieces) protected void
protected void
drawLabel
(Graphics g, Point pt, String label, int hAlign, int vAlign, int objectWidth, int minWidth, int extraBorder, boolean skipBox) protected void
drawLabel
(Graphics g, Point pt, String label, int hAlign, int vAlign, int objectWidth, int minWidth, int extraBorder, boolean skipBox, int extraTop, int extraBottom) Next, we go to this intermediate method, which deals with a couple of things (like deciding whether we're drawing in HTML mode or not) and then calls the LabelUtils to do the Hard Work.protected void
Label with the location If the counter viewer is being displayed, then place the location name just above the left hand end of the counters.protected void
protected void
Set the bounds field large enough to accommodate the given set of piecesClass<?>[]
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 visibleprotected Rectangle
ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager
.static String
Build an ArrayList of pieces to be displayed in order from bottom up, based on selection criteria setup in config.getMap()
protected int
protected double
getZoom()
protected void
static boolean
Deprecated, for removal: This API element is subject to removal in a future version.boolean
protected boolean
void
void
void
void
void
void
void
void
void
void
void
removeFrom
(Buildable parent) Remove this component from its parentvoid
setAttribute
(String name, Object value) Sets a buildFile (XML) attribute value for this component.protected void
protected void
upgrade()
Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, 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
build, getBuildElement, isMandatory, isMovable, isUnique
-
Field Details
-
LATEST_VERSION
- See Also:
-
USE_KEYBOARD
- See Also:
-
PREFERRED_DELAY
- See Also:
-
DELAY
- See Also:
-
DRAW_PIECES
- See Also:
-
GRAPH_SINGLE_DEPRECATED
- See Also:
-
MINIMUM_DISPLAYABLE
- See Also:
-
HOTKEY
- See Also:
-
DESCRIPTION
- See Also:
-
CENTER_TEXT
- See Also:
-
CENTER_ALL
- See Also:
-
COMBINE_COUNTER_SUMMARY
- See Also:
-
ONLY_SHOW_FIRST_SUMMARY
- See Also:
-
VERTICAL_OFFSET
- See Also:
-
VERTICAL_TOP_TEXT
- See Also:
-
VERTICAL_BOTTOM_TEXT
- See Also:
-
STRETCH_WIDTH_SUMMARY
- See Also:
-
STRETCH_WIDTH_PIECES
- See Also:
-
SHOW_TEXT
- See Also:
-
ENABLE_HTML
- See Also:
-
SHOW_TEXT_SINGLE_DEPRECATED
- See Also:
-
ZOOM_LEVEL
- See Also:
-
CENTER_PIECES_VERTICALLY
- See Also:
-
DRAW_PIECES_AT_ZOOM
- See Also:
-
BORDER_WIDTH
- See Also:
-
SHOW_ONLY_TOP_OF_STACK
- See Also:
-
BORDER_THICKNESS
- See Also:
-
BORDER_INNER_THICKNESS
- See Also:
-
SHOW_NOSTACK
- See Also:
-
SHOW_MOVE_SELECTED
- See Also:
-
SHOW_NON_MOVABLE
- See Also:
-
SHOW_DECK
- See Also:
-
SHOW_DECK_DEPTH
- See Also:
-
SHOW_DECK_MASKED
- See Also:
-
SHOW_OVERLAP
- See Also:
-
UNROTATE_PIECES
- See Also:
-
DISPLAY
- See Also:
-
LAYER_LIST
- See Also:
-
SUMMARY_REPORT_FORMAT
- See Also:
-
COUNTER_REPORT_FORMAT
- See Also:
-
EMPTY_HEX_REPORT_FORMAT
- See Also:
-
VERSION
- See Also:
-
FG_COLOR
- See Also:
-
BG_COLOR
- See Also:
-
BORDER_COLOR
- See Also:
-
FONT_SIZE
- See Also:
-
EXTRA_TEXT_PADDING
- See Also:
-
PROPERTY_FILTER
- See Also:
-
STOP_AFTER_SHOWING
- See Also:
-
SHOW_TERRAIN_BENEATH
- See Also:
-
SHOW_TERRAIN_SNAPPY
- See Also:
-
SHOW_TERRAIN_WIDTH
- See Also:
-
SHOW_TERRAIN_HEIGHT
- See Also:
-
SHOW_TERRAIN_ZOOM
- See Also:
-
SHOW_TERRAIN_TEXT
- See Also:
-
NEVER
- See Also:
-
IF_ONE
- See Also:
-
ALWAYS
- See Also:
-
TOP_LAYER
- See Also:
-
ALL_LAYERS
- See Also:
-
INC_LAYERS
- See Also:
-
EXC_LAYERS
- See Also:
-
FILTER
- See Also:
-
SUM
- See Also:
-
hotkey
-
map
-
delay
protected int delay -
delayTimer
-
graphicsVisible
protected boolean graphicsVisible -
textVisible
protected boolean textVisible -
currentMousePosition
-
desc
-
minimumDisplayablePieces
protected int minimumDisplayablePieces -
drawPieces
protected boolean drawPieces -
centerPiecesVertically
protected boolean centerPiecesVertically -
drawSingleDeprecated
protected boolean drawSingleDeprecated -
showText
protected boolean showText -
showTextSingleDeprecated
protected boolean showTextSingleDeprecated -
enableHTML
protected boolean enableHTML -
centerAll
protected boolean centerAll -
centerText
protected boolean centerText -
combineCounterSummary
protected boolean combineCounterSummary -
onlyShowFirstSummary
protected boolean onlyShowFirstSummary -
verticalOffset
protected int verticalOffset -
verticalTopText
protected int verticalTopText -
verticalBottomText
protected int verticalBottomText -
stretchWidthSummary
protected boolean stretchWidthSummary -
stretchWidthPieces
protected boolean stretchWidthPieces -
unrotatePieces
protected boolean unrotatePieces -
showDeck
protected boolean showDeck -
stopAfterShowing
protected boolean stopAfterShowing -
showTerrainBeneath
-
showTerrainWidth
protected int showTerrainWidth -
showTerrainHeight
protected int showTerrainHeight -
showTerrainZoom
protected double showTerrainZoom -
showTerrainSnappy
protected boolean showTerrainSnappy -
showDeckDepth
Deprecated, for removal: This API element is subject to removal in a future version. -
showNumberFromDeck
protected int showNumberFromDeck -
showDeckMasked
protected boolean showDeckMasked -
showOverlap
protected boolean showOverlap -
zoomLevel
protected double zoomLevel -
graphicsZoomLevel
protected double graphicsZoomLevel -
borderWidth
protected int borderWidth -
borderThickness
protected int borderThickness -
borderInnerThickness
protected int borderInnerThickness -
extraTextPadding
protected int extraTextPadding -
showOnlyTopOfStack
protected boolean showOnlyTopOfStack -
showNoStack
protected boolean showNoStack -
showMoveSelected
protected boolean showMoveSelected -
showNonMovable
protected boolean showNonMovable -
displayWhat
-
displayLayers
-
summaryReportFormat
-
counterReportFormat
-
emptyHexReportFormat
-
showTerrainText
-
version
-
fgColor
-
bgColor
-
borderColor
-
fontSize
protected int fontSize -
font
-
propertyFilter
-
bounds
-
lastPieceBounds
-
mouseInView
protected boolean mouseInView -
displayablePieces
-
displayableTerrain
protected boolean displayableTerrain -
view
the JComponent which is repainted when the detail viewer changes
-
-
Constructor Details
-
CounterDetailViewer
public CounterDetailViewer()
-
-
Method Details
-
isDrawingMouseOver
Deprecated, for removal: This API element is subject to removal in a future version. -
isStopAfterShowing
public boolean isStopAfterShowing() -
getMap
- Returns:
- This CounterDetailViewer's parent map
-
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. -
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCounters
in interfaceDrawable
-
draw
-
drawGraphics
-
fixBounds
-
fixBounds
-
getBounds
-
isTextUnderCounters
protected boolean isTextUnderCounters() -
drawText
Label with the location If the counter viewer is being displayed, then place the location name just above the left hand end of the counters. If no counter viewer (i.e. single piece or expanded stack), then place the location name above the centre of the first piece in the stack.- Parameters:
g
- - graphics elementpt
- - UNUSED IN THESE LATTER DAYScomp
- - UNUSED IN THESE LATTER DAYSpieces
- - UNUSED IN THESE LATTER DAYS
-
drawLabel
-
drawLabel
-
drawLabel
protected void drawLabel(Graphics g, Point pt, String label, int hAlign, int vAlign, int objectWidth, int minWidth, int extraBorder, boolean skipBox, int extraTop, int extraBottom) Next, we go to this intermediate method, which deals with a couple of things (like deciding whether we're drawing in HTML mode or not) and then calls the LabelUtils to do the Hard Work.- Parameters:
g
- our graphics objectpt
- Point for drawing label, based on hAlign/Valign. (but if objectWidth > 0 then the "x" part identifies the left part of our master object)label
- Text we shall drawhAlign
- Horizontal alignment (left, right, center)vAlign
- Vertical alignment (top, bottom, center)objectWidth
- 0 for default, or optional width of master object we are to draw text label withinminWidth
- 0 for default, or minimum width of text labelextraBorder
- 0 for default, or number of extra pixels of border (expands size of label drawn)skipBox
- If true, ONLY draws the text, with no box or background (for filling in existing combine-o-rama boxes)
-
showDetails
protected void showDetails() -
getZoom
protected double getZoom() -
getDisplayablePieces
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
getPreferredDelay
protected int getPreferredDelay() -
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
dragMouseMoved
- Specified by:
dragMouseMoved
in interfaceDragSourceMotionListener
-
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
-
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
-
hideDetails
protected void hideDetails() -
checkUpgrade
protected void checkUpgrade()Compatibility. If this component has not yet been saved by this version of vassal, convert the old-style options to new and update the version. -
getConfigurer
Description copied from class:AbstractConfigurable
- Specified by:
getConfigurer
in interfaceConfigurable
- Overrides:
getConfigurer
in classAbstractConfigurable
- Returns:
- Configurer for this component
-
upgrade
protected void upgrade() -
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 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()
-
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.
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFile describing how to use and configure * this component
-
removeFrom
Description copied from interface:Configurable
Remove this component from its parent- Specified by:
removeFrom
in interfaceConfigurable
-
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:
name
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
value
- 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()
-
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:
name
- 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.
-
getConfigureName
Description copied from class:AbstractConfigurable
ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager
.- Specified by:
getConfigureName
in interfaceConfigurable
- Overrides:
getConfigureName
in classAbstractConfigurable
- Returns:
- The language-independent name of this component used for programmatic identification (including within Modules by e.g. Traits and module components)
-
getConfigureTypeName
-
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.
-
getExpressionList
- Specified by:
getExpressionList
in interfaceSearchTarget
- Overrides:
getExpressionList
in classAbstractConfigurable
- Returns:
- a list of the Configurables string/expression fields if any (for search)
-
getFormattedStringList
- Specified by:
getFormattedStringList
in interfaceSearchTarget
- Overrides:
getFormattedStringList
in classAbstractConfigurable
- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
getNamedKeyStrokeList
- Specified by:
getNamedKeyStrokeList
in interfaceSearchTarget
- Overrides:
getNamedKeyStrokeList
in classAbstractConfigurable
- Returns:
- a list of any Named KeyStrokes referenced in the Configurable, if any (for search)
-
addLocalImageNames
In case our labels refer to any image files- Specified by:
addLocalImageNames
in interfaceImageSearchTarget
- Overrides:
addLocalImageNames
in classAbstractImageFinder
- Parameters:
s
- Collection to add image names to
-