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 classCounterDetailViewer.CounterFormatConfigstatic classCounterDetailViewer.DisplayConfigstatic classCounterDetailViewer.EmptyFormatConfigprotected classCounterDetailViewer.FilterUtility class to select the pieces we wish to view.static classCounterDetailViewer.MinConfigstatic classCounterDetailViewer.ReportFormatConfigprotected static classCounterDetailViewer.VisitorNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
Fields 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 CounterDetailViewer() -
Method Summary
Modifier and Type Method Description voidaddTo(Buildable b)Adds this component to its parent.voiddragMouseMoved(DragSourceDragEvent e)voiddraw(Graphics g, Point pt, JComponent comp)voiddraw(Graphics g, Map map)booleandrawAboveCounters()protected voiddrawGraphics(Graphics g, Point pt, JComponent comp, List<GamePiece> pieces)protected voiddrawGraphics(Graphics g, Point pt, JComponent comp, PieceIterator pi)Deprecated, for removal: This API element is subject to removal in a future version.protected voiddrawLabel(Graphics g, Point pt, String label)Deprecated, for removal: This API element is subject to removal in a future version.protected voiddrawLabel(Graphics g, Point pt, String label, int hAlign, int vAlign)protected voiddrawText(Graphics g, Point pt, JComponent comp, List<GamePiece> pieces)protected voiddrawText(Graphics g, Point pt, JComponent comp, PieceIterator pi)Deprecated, for removal: This API element is subject to removal in a future version.protected voidfixBounds(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.StringgetAttributeValueString(String name)Called by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML elementVisibilityConditiongetAttributeVisibility(String name)By default, all attributes are visibleprotected RectanglegetBounds(GamePiece piece)ConfigurergetConfigurer()static StringgetConfigureTypeName()protected List<GamePiece>getDisplayablePieces()Build an ArrayList of pieces to be displayed in order from bottom up, based on selection criteria setup in config.HelpFilegetHelpFile()protected intgetPreferredDelay()protected doublegetZoom()protected voidhideDetails()protected booleanisTextUnderCounters()voidkeyPressed(KeyEvent e)voidkeyReleased(KeyEvent e)voidkeyTyped(KeyEvent e)voidmouseClicked(MouseEvent e)voidmouseDragged(MouseEvent e)voidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)voidremoveFrom(Buildable parent)Remove this component from its parentvoidsetAttribute(String name, Object value)Sets a buildFile (XML) attribute value for this component.protected voidshowDetails()protected voidupgrade()Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, 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
-
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: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. -
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCountersin 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:
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() -
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 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
-
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
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- a HelpFilte 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 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: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.
-
drawGraphics(Graphics, Point, JComponent, List)