Package VASSAL.build.module.map
Class CounterDetailViewer
java.lang.Object
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
- 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.- Version:
- 1.0
- Author:
- David Sullivan
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CounterDetailViewer.CounterFormatConfig
static class
CounterDetailViewer.DisplayConfig
static class
CounterDetailViewer.EmptyFormatConfig
protected class
CounterDetailViewer.Filter
Utility class to select the pieces we wish to view.static class
CounterDetailViewer.MinConfig
static class
CounterDetailViewer.ReportFormatConfig
protected static class
CounterDetailViewer.Visitor
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
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 CounterDetailViewer()
-
Method Summary
Modifier and Type Method Description void
addTo(Buildable b)
Adds this component to its parent.void
dragMouseMoved(DragSourceDragEvent e)
void
draw(Graphics g, Point pt, JComponent comp)
void
draw(Graphics g, Map map)
boolean
drawAboveCounters()
protected void
drawGraphics(Graphics g, Point pt, JComponent comp, List<GamePiece> pieces)
protected void
drawGraphics(Graphics g, Point pt, JComponent comp, PieceIterator pi)
Deprecated, for removal: This API element is subject to removal in a future version.protected void
drawLabel(Graphics g, Point pt, String label)
Deprecated, for removal: This API element is subject to removal in a future version.protected void
drawLabel(Graphics g, Point pt, String label, int hAlign, int vAlign)
protected void
drawText(Graphics g, Point pt, JComponent comp, List<GamePiece> pieces)
protected void
drawText(Graphics g, Point pt, JComponent comp, PieceIterator pi)
Deprecated, for removal: This API element is subject to removal in a future version.protected void
fixBounds(List<GamePiece> pieces)
Set the bounds field large enough to accommodate the given set of piecesClass<?>[]
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 name)
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 visibleprotected Rectangle
getBounds(GamePiece piece)
Configurer
getConfigurer()
static String
getConfigureTypeName()
protected List<GamePiece>
getDisplayablePieces()
Build an ArrayList of pieces to be displayed in order from bottom up, based on selection criteria setup in config.HelpFile
getHelpFile()
protected int
getPreferredDelay()
protected double
getZoom()
protected void
hideDetails()
protected boolean
isTextUnderCounters()
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
void
mouseClicked(MouseEvent e)
void
mouseDragged(MouseEvent e)
void
mouseEntered(MouseEvent e)
void
mouseExited(MouseEvent e)
void
mouseMoved(MouseEvent e)
void
mousePressed(MouseEvent e)
void
mouseReleased(MouseEvent e)
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
showDetails()
protected void
upgrade()
Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, 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
-
LATEST_VERSION
- See Also:
- Constant Field Values
-
USE_KEYBOARD
- See Also:
- Constant Field Values
-
PREFERRED_DELAY
- See Also:
- Constant Field Values
-
DELAY
- See Also:
- Constant Field Values
-
ALWAYS_SHOW_LOC
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
DRAW_PIECES
- See Also:
- Constant Field Values
-
GRAPH_SINGLE_DEPRECATED
- See Also:
- Constant Field Values
-
MINIMUM_DISPLAYABLE
- See Also:
- Constant Field Values
-
HOTKEY
- See Also:
- Constant Field Values
-
SHOW_TEXT
- See Also:
- Constant Field Values
-
SHOW_TEXT_SINGLE_DEPRECATED
- See Also:
- Constant Field Values
-
ZOOM_LEVEL
- See Also:
- Constant Field Values
-
DRAW_PIECES_AT_ZOOM
- See Also:
- Constant Field Values
-
BORDER_WIDTH
- See Also:
- Constant Field Values
-
SHOW_NOSTACK
- See Also:
- Constant Field Values
-
SHOW_MOVE_SELECTED
- See Also:
- Constant Field Values
-
SHOW_NON_MOVABLE
- See Also:
- Constant Field Values
-
SHOW_DECK
- See Also:
- Constant Field Values
-
SHOW_OVERLAP
- See Also:
- Constant Field Values
-
UNROTATE_PIECES
- See Also:
- Constant Field Values
-
DISPLAY
- See Also:
- Constant Field Values
-
LAYER_LIST
- See Also:
- Constant Field Values
-
SUMMARY_REPORT_FORMAT
- See Also:
- Constant Field Values
-
COUNTER_REPORT_FORMAT
- See Also:
- Constant Field Values
-
EMPTY_HEX_REPORT_FORMAT
- See Also:
- Constant Field Values
-
VERSION
- See Also:
- Constant Field Values
-
FG_COLOR
- See Also:
- Constant Field Values
-
BG_COLOR
- See Also:
- Constant Field Values
-
FONT_SIZE
- See Also:
- Constant Field Values
-
PROPERTY_FILTER
- See Also:
- Constant Field Values
-
TOP_LAYER
- See Also:
- Constant Field Values
-
ALL_LAYERS
- See Also:
- Constant Field Values
-
INC_LAYERS
- See Also:
- Constant Field Values
-
EXC_LAYERS
- See Also:
- Constant Field Values
-
FILTER
- See Also:
- Constant Field Values
-
SUM
- See Also:
- Constant Field Values
-
hotkey
-
map
-
delay
protected int delay -
delayTimer
-
graphicsVisible
protected boolean graphicsVisible -
textVisible
protected boolean textVisible -
currentMousePosition
-
minimumDisplayablePieces
protected int minimumDisplayablePieces -
alwaysShowLoc
Deprecated, for removal: This API element is subject to removal in a future version. -
drawPieces
protected boolean drawPieces -
drawSingleDeprecated
protected boolean drawSingleDeprecated -
showText
protected boolean showText -
showTextSingleDeprecated
protected boolean showTextSingleDeprecated -
unrotatePieces
protected boolean unrotatePieces -
showDeck
protected boolean showDeck -
showOverlap
protected boolean showOverlap -
zoomLevel
protected double zoomLevel -
graphicsZoomLevel
protected double graphicsZoomLevel -
borderWidth
protected int borderWidth -
showNoStack
protected boolean showNoStack -
showMoveSelected
protected boolean showMoveSelected -
showNonMovable
protected boolean showNonMovable -
displayWhat
-
displayLayers
-
summaryReportFormat
-
counterReportFormat
-
emptyHexReportFormat
-
version
-
fgColor
-
bgColor
-
fontSize
protected int fontSize -
font
-
propertyFilter
-
bounds
-
mouseInView
protected boolean mouseInView -
displayablePieces
-
view
the JComponent which is repainted when the detail viewer changes
-
-
Constructor Details
-
CounterDetailViewer
public CounterDetailViewer()
-
-
Method Details
-
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. -
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCounters
in interfaceDrawable
-
draw
-
drawGraphics
@Deprecated(since="2020-08-06", forRemoval=true) protected void drawGraphics(Graphics g, Point pt, JComponent comp, PieceIterator pi)Deprecated, for removal: This API element is subject to removal in a future version. -
drawGraphics
-
fixBounds
Set the bounds field large enough to accommodate the given set of pieces -
getBounds
-
isTextUnderCounters
protected boolean isTextUnderCounters() -
drawText
@Deprecated(since="2020-08-06", forRemoval=true) protected void drawText(Graphics g, Point pt, JComponent comp, PieceIterator pi)Deprecated, for removal: This API element is subject to removal in a future version. -
drawText
-
drawLabel
@Deprecated(since="2020-08-06", forRemoval=true) protected void drawLabel(Graphics g, Point pt, String label)Deprecated, for removal: This API element is subject to removal in a future version. -
drawLabel
-
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:
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() -
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 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
-
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
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFilte 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 attribute with the given name. When initializing a module, this String value will be passed to
AbstractBuildable.setAttribute(java.lang.String, java.lang.Object)
.
-
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.
-
drawGraphics(Graphics, Point, JComponent, List)