VASSAL.build.module.map
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:
javax.accessibility.Accessible, AutoConfigurable, Buildable, Configurable, Drawable, java.util.EventListener, GameComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class HidePiecesButton
extends javax.swing.JPanel
implements java.awt.event.MouseListener, AutoConfigurable, GameComponent, Drawable

This removes all game pieces from the (@link Map) therefore providing an un-cluttered view.

See Also:
Serialized Form

Inner Class Summary
static class HidePiecesButton.HiddenIconConfig
           
static class HidePiecesButton.ShowingIconConfig
           
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Inner classes inherited from class VASSAL.build.AutoConfigurable
AutoConfigurable.Util
 
Field Summary
static java.lang.String DEFAULT_HIDDEN_ICON
           
static java.lang.String DEFAULT_SHOWING_ICON
           
static java.lang.String HIDDEN_ICON
           
static java.lang.String SHOWING_ICON
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
HidePiecesButton()
           
 
Method Summary
 void add(Buildable b)
          Adds a child component.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a PropertyChangeListener.
 void addTo(Buildable b)
          Expects to be added to a Map.
 void build(org.w3c.dom.Element e)
          Build the object
 void draw(java.awt.Graphics g, Map m)
           
 java.lang.Class[] getAllowableConfigureComponents()
          Return a list of valid sub-component Classes.
 java.lang.String[] getAttributeDescriptions()
          Return an array of Strings describing the attributes of this object.
 java.lang.String[] getAttributeNames()
           
 java.lang.Class[] getAttributeTypes()
          Return the Class for the attributes of this object.
 java.lang.String getAttributeValueString(java.lang.String key)
          Called by the getBuildElement(org.w3c.dom.Document) method to write the attributes into an XML element
 VisibilityCondition getAttributeVisibility(java.lang.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.
 org.w3c.dom.Element getBuildElement(org.w3c.dom.Document doc)
           
 Configurable[] getConfigureComponents()
           
 java.lang.String getConfigureName()
          The name of this Configurable Object
 Configurer getConfigurer()
          Return a Configurer object which can be used to set the attributes of this object
static java.lang.String getConfigureTypeName()
           
 HelpFile getHelpFile()
           
 Command getRestoreCommand()
          When saving a game, each GameComponent should return a Command that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null
 java.lang.String getToolTipText(java.awt.event.MouseEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics g)
           
 void remove(Buildable b)
          Remove a child component
 void removeFrom(Buildable b)
          Remove this component from its parent
 void setAttribute(java.lang.String key, java.lang.Object value)
          Called by the build(org.w3c.dom.Element) method, where value 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/ended
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SHOWING_ICON

public static final java.lang.String DEFAULT_SHOWING_ICON

DEFAULT_HIDDEN_ICON

public static final java.lang.String DEFAULT_HIDDEN_ICON

HIDDEN_ICON

public static final java.lang.String HIDDEN_ICON

SHOWING_ICON

public static final java.lang.String SHOWING_ICON
Constructor Detail

HidePiecesButton

public HidePiecesButton()
Method Detail

addTo

public void addTo(Buildable b)
Expects to be added to a Map. Adds itself as a GameComponent and a Drawable component
Specified by:
addTo in interface Buildable

setPiecesVisible

protected void setPiecesVisible(boolean visible)

add

public void add(Buildable b)
Description copied from interface: Buildable
Adds a child component. Both this method and Buildable.addTo(VASSAL.build.Buildable) are invoked when adding a child to a parent
Specified by:
add in interface Buildable

remove

public void remove(Buildable b)
Description copied from interface: Configurable
Remove a child component
Specified by:
remove in interface Configurable

removeFrom

public void removeFrom(Buildable b)
Description copied from interface: Configurable
Remove this component from its parent
Specified by:
removeFrom in interface Configurable

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Description copied from interface: AutoConfigurable
Called by the Buildable.build(org.w3c.dom.Element) method, where value is the String value read by the XML attribute. Can also be called with Object value to set the attribute.
Specified by:
setAttribute in interface AutoConfigurable

build

public void build(org.w3c.dom.Element e)
Description copied from interface: Buildable
Build the object
Specified by:
build in interface Buildable
Following copied from interface: VASSAL.build.Buildable
Parameters:
e - the XML element containing the object data

getAttributeNames

public java.lang.String[] getAttributeNames()
Specified by:
getAttributeNames in interface AutoConfigurable
Following copied from interface: VASSAL.build.AutoConfigurable
Returns:
an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element

getAttributeVisibility

public VisibilityCondition getAttributeVisibility(java.lang.String name)
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 interface AutoConfigurable
Following copied from interface: VASSAL.build.AutoConfigurable
Parameters:
name -  
Returns:
null if the attribute controls should always be visible;

getAttributeValueString

public java.lang.String getAttributeValueString(java.lang.String key)
Description copied from interface: AutoConfigurable
Called by the Buildable.getBuildElement(org.w3c.dom.Document) method to write the attributes into an XML element
Specified by:
getAttributeValueString in interface AutoConfigurable

getAttributeDescriptions

public java.lang.String[] 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 interface AutoConfigurable

getAttributeTypes

public java.lang.Class[] 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 interface AutoConfigurable

draw

public void draw(java.awt.Graphics g,
                 Map m)
Specified by:
draw in interface Drawable

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
Overrides:
getToolTipText in class javax.swing.JComponent

getRestoreCommand

public Command getRestoreCommand()
Description copied from interface: GameComponent
When saving a game, each GameComponent should return a Command 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 interface GameComponent

setup

public void setup(boolean show)
Description copied from interface: GameComponent
Notify the GameComponent that a game has started/ended
Specified by:
setup in interface GameComponent
Following copied from interface: VASSAL.build.module.GameComponent
Parameters:
gameStarting - if true, a game is starting. If false, then a game is ending

getConfigureTypeName

public static java.lang.String getConfigureTypeName()

getConfigureName

public java.lang.String getConfigureName()
Description copied from interface: Configurable
The name of this Configurable Object
Specified by:
getConfigureName in interface Configurable

getConfigurer

public Configurer getConfigurer()
Description copied from interface: Configurable
Return a Configurer object which can be used to set the attributes of this object
Specified by:
getConfigurer in interface Configurable

getConfigureComponents

public Configurable[] getConfigureComponents()
Specified by:
getConfigureComponents in interface Configurable
Following copied from interface: VASSAL.build.Configurable
Returns:
an array of Configurer objects representing the Configurable children of this Configurable object

getAllowableConfigureComponents

public java.lang.Class[] 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 interface Configurable

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: Configurable
Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property name Configurable.NAME_PROPERTY when the value returned from Configurable.getConfigureName() has changed
Specified by:
addPropertyChangeListener in interface Configurable
Overrides:
addPropertyChangeListener in class javax.swing.JComponent

getHelpFile

public HelpFile getHelpFile()
Specified by:
getHelpFile in interface Configurable
Following copied from interface: VASSAL.build.Configurable
Returns:
a HelpFilte describing how to use and configure this component

getBuildElement

public org.w3c.dom.Element getBuildElement(org.w3c.dom.Document doc)
Specified by:
getBuildElement in interface Buildable
Following copied from interface: VASSAL.build.Buildable
Returns:
an XML element from which this component can be built