Package VASSAL.build.module.map
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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classprotected classUtility class to select the pieces we wish to view.static classstatic classstatic classprotected static classNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringprotected Colorstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Colorprotected intprotected intprotected intprotected Rectanglestatic final Stringstatic final Stringstatic final Stringprotected booleanprotected booleanprotected booleanstatic final Stringprotected booleanstatic final Stringprotected FormattedStringprotected MouseEventprotected intstatic final Stringprotected Timerprotected Stringstatic final Stringstatic final Stringprotected booleanprotected String[]protected Stringstatic final Stringstatic final Stringprotected booleanprotected booleanstatic final Stringprotected FormattedStringstatic final Stringprotected booleanstatic final Stringstatic final Stringprotected intstatic final Stringprotected Colorstatic final Stringprotected Fontstatic final Stringprotected intstatic final Stringprotected booleanprotected doubleprotected KeyStrokestatic final Stringstatic final Stringstatic final Stringprotected Rectanglestatic final Stringstatic final Stringprotected Mapstatic final Stringprotected intprotected booleanstatic final Stringstatic final Stringprotected booleanstatic final Stringstatic final Stringprotected PropertyExpressionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected booleanprotected static intDeprecated, for removal: This API element is subject to removal in a future version.protected booleanprotected booleanprotected booleanprotected booleanprotected intprotected booleanprotected booleanprotected Stringprotected intprotected booleanprotected FormattedStringprotected intprotected doubleprotected booleanprotected booleanstatic final Stringprotected booleanstatic final Stringstatic final Stringprotected booleanprotected booleanstatic final Stringstatic final Stringprotected FormattedStringprotected booleanstatic final Stringstatic final Stringprotected booleanstatic final Stringprotected Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected intprotected intprotected intprotected JComponentthe JComponent which is repainted when the detail viewer changesstatic final Stringprotected doubleFields 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 TypeMethodDescriptionvoidIn case our labels refer to any image filesvoidAdds this component to its parent.protected voidCompatibility.voidvoiddraw(Graphics g, Point pt, JComponent comp) voidbooleanprotected voiddrawGraphics(Graphics g, Point pt, JComponent comp, List<GamePiece> pieces) protected voidprotected voiddrawLabel(Graphics g, Point pt, String label, int hAlign, int vAlign, int objectWidth, int minWidth, int extraBorder, boolean skipBox) protected voiddrawLabel(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 voidLabel 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 voidprotected voidSet 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 RectangleConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.static StringBuild an ArrayList of pieces to be displayed in order from bottom up, based on selection criteria setup in config.getMap()protected intprotected doublegetZoom()protected voidstatic booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanprotected booleanvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidremoveFrom(Buildable parent) Remove this component from its parentvoidsetAttribute(String name, Object value) Sets a buildFile (XML) attribute value for this component.protected voidprotected voidupgrade()Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, 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
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: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. -
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCountersin interfaceDrawable
-
draw
-
drawGraphics
-
fixBounds
-
fixBounds
Set the bounds field large enough to accommodate the given set of pieces -
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
Build an ArrayList of pieces to be displayed in order from bottom up, based on selection criteria setup in config. -
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
getPreferredDelay
protected int getPreferredDelay() -
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
dragMouseMoved
- Specified by:
dragMouseMovedin interfaceDragSourceMotionListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin 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:
getConfigurerin interfaceConfigurable- Overrides:
getConfigurerin classAbstractConfigurable- Returns:
- Configurer for this component
-
upgrade
protected void upgrade() -
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()
-
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()
-
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.
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- a HelpFile describing how to use and configure * this component
-
removeFrom
Description copied from interface:ConfigurableRemove this component from its parent- Specified by:
removeFromin interfaceConfigurable
-
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:
name- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()value- 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()
-
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:
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:AbstractConfigurableConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.- Specified by:
getConfigureNamein interfaceConfigurable- Overrides:
getConfigureNamein 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: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.
-
getExpressionList
- Specified by:
getExpressionListin interfaceSearchTarget- Overrides:
getExpressionListin classAbstractConfigurable- Returns:
- a list of the Configurables string/expression fields if any (for search)
-
getFormattedStringList
- Specified by:
getFormattedStringListin interfaceSearchTarget- Overrides:
getFormattedStringListin classAbstractConfigurable- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
getNamedKeyStrokeList
- Specified by:
getNamedKeyStrokeListin interfaceSearchTarget- Overrides:
getNamedKeyStrokeListin 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:
addLocalImageNamesin interfaceImageSearchTarget- Overrides:
addLocalImageNamesin classAbstractImageFinder- Parameters:
s- Collection to add image names to
-