Class HidePiecesButton
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
VASSAL.build.module.map.HidePiecesButton
- All Implemented Interfaces:
MouseListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,AutoConfigurable
,Buildable
,Configurable
,GameComponent
,Drawable
,Translatable
,ImageSearchTarget
,SearchTarget
public class HidePiecesButton
extends JPanel
implements MouseListener, AutoConfigurable, GameComponent, Drawable, SearchTarget, ImageSearchTarget
This removes all game pieces from the (@link Map)
therefore providing an un-cluttered view.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
protected String
static final String
protected LaunchButton
static final String
protected Map
protected ComponentI18nData
protected boolean
static final String
protected String
static final String
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child component.void
Adds all images used by this component AND any children (or inner decorators/pieces) to the collection.void
Classes extendingAbstractBuildable
should override this method in order to add the names of any image files they use to the collection.void
Add a PropertyChangeListener.void
Expects to be added to aMap
.void
Build the object from the XML representation of the Buildablevoid
boolean
Class<?>[]
String[]
Return an array of Strings describing the attributes of this object.String[]
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) Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.getBuildElement
(Document doc) The name of this Configurable Objectstatic String
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullvoid
void
void
void
void
void
void
Remove a child componentvoid
Remove this component from its parentvoid
setAttribute
(String key, Object value) Called by theBuildable.build(org.w3c.dom.Element)
method, wherevalue
is the String value read by the XML attribute.protected void
setPiecesVisible
(boolean visible) void
setup
(boolean show) Notify the GameComponent that a game has started/endedMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface VASSAL.build.Buildable
isMandatory, isMovable, isUnique
-
Field Details
-
piecesVisible
protected boolean piecesVisible -
map
-
launch
-
showingIcon
-
myI18nData
-
DEFAULT_SHOWING_ICON
- See Also:
-
DEFAULT_HIDDEN_ICON
- See Also:
-
LAUNCH_ICON
- See Also:
-
TOOLTIP
- See Also:
-
BUTTON_TEXT
- See Also:
-
HOTKEY
- See Also:
-
HIDDEN_ICON
- See Also:
-
SHOWING_ICON
- See Also:
-
-
Constructor Details
-
HidePiecesButton
public HidePiecesButton()
-
-
Method Details
-
addTo
-
setPiecesVisible
protected void setPiecesVisible(boolean visible) -
add
Description copied from interface:Buildable
Adds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)
are invoked when adding a child to a parent -
remove
Description copied from interface:Configurable
Remove a child component- Specified by:
remove
in interfaceConfigurable
-
removeFrom
Description copied from interface:Configurable
Remove this component from its parent- Specified by:
removeFrom
in interfaceConfigurable
-
setAttribute
Description copied from interface:AutoConfigurable
Called by theBuildable.build(org.w3c.dom.Element)
method, wherevalue
is the String value read by the XML attribute. Can also be called with Object value to set the attribute.- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Parameters:
key
- the name of the attribute. If the implementing class extendsAbstractConfigurable
, will be one of those listed inAbstractBuildable.getAttributeNames()
.value
- If thevalue
parameter is a String, it will be the value returned byTranslatable.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()
-
build
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Returns:
- an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element
-
getAttributeVisibility
Description copied from interface:AutoConfigurable
Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.- Specified by:
getAttributeVisibility
in interfaceAutoConfigurable
- Parameters:
name
-- Returns:
- null if the attribute controls should always be visible;
-
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
- Parameters:
key
- the name of the attribute. If the implementing class extendsAbstractConfigurable
, 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
Translatable.setAttribute(java.lang.String, java.lang.Object)
.
-
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
-
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
-
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCounters
in interfaceDrawable
-
paint
- Overrides:
paint
in classJComponent
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
getToolTipText
- Overrides:
getToolTipText
in classJComponent
-
getRestoreCommand
Description copied from interface:GameComponent
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommand
in interfaceGameComponent
-
setup
public void setup(boolean show) Description copied from interface:GameComponent
Notify the GameComponent that a game has started/ended- Specified by:
setup
in interfaceGameComponent
- Parameters:
show
- if true, a game is starting. If false, then a game is ending
-
getConfigureTypeName
-
getConfigureName
Description copied from interface:Configurable
The name of this Configurable Object- Specified by:
getConfigureName
in interfaceConfigurable
-
getConfigurer
- Specified by:
getConfigurer
in interfaceConfigurable
- Returns:
- a
Configurer
object which can be used to set the attributes of this object
-
getConfigureComponents
- Specified by:
getConfigureComponents
in interfaceConfigurable
- Returns:
- an array of Configurer objects representing the Configurable children of this Configurable object
-
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.
-
addPropertyChangeListener
Description copied from interface:Configurable
Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTY
when the value returned fromConfigurable.getConfigureName()
has changed- Specified by:
addPropertyChangeListener
in interfaceConfigurable
- Overrides:
addPropertyChangeListener
in classContainer
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFile describing how to use and configure * this component
-
getBuildElement
- Specified by:
getBuildElement
in interfaceBuildable
- Parameters:
doc
- XML file- Returns:
- an XML element from which this component can be built
-
getI18nData
- Specified by:
getI18nData
in interfaceTranslatable
-
getMenuTextList
- Specified by:
getMenuTextList
in interfaceSearchTarget
- Returns:
- a list of any Menu/Button/Tooltip Text strings referenced in the Configurable, if any (for search)
-
getNamedKeyStrokeList
- Specified by:
getNamedKeyStrokeList
in interfaceSearchTarget
- Returns:
- a list of any Named KeyStrokes referenced in the Configurable, if any (for search)
-
getExpressionList
- Specified by:
getExpressionList
in interfaceSearchTarget
- Returns:
- a list of the Configurables string/expression fields if any (for search)
-
getFormattedStringList
- Specified by:
getFormattedStringList
in interfaceSearchTarget
- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
getPropertyList
- Specified by:
getPropertyList
in interfaceSearchTarget
- Returns:
- a list of any Property Names referenced in the Configurable, if any (for search)
-
getAllImageNames
- Specified by:
getAllImageNames
in interfaceImageSearchTarget
- Returns:
- names of all images used by the component and any subcomponents
-
addImageNamesRecursively
Adds all images used by this component AND any children (or inner decorators/pieces) to the collection.- Specified by:
addImageNamesRecursively
in interfaceImageSearchTarget
- Parameters:
s
- Collection to add image names to
-
getLocalImageNames
- Specified by:
getLocalImageNames
in interfaceImageSearchTarget
- Returns:
- names of all images used by this component
-
addLocalImageNames
Classes extendingAbstractBuildable
should override this method in order to add the names of any image files they use to the collection. For "find unused images" and "search".- Specified by:
addLocalImageNames
in interfaceImageSearchTarget
- Parameters:
s
- Collection to add image names to
-