VASSAL.build.module.map
Class BoardPicker
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Dialog
|
+--javax.swing.JDialog
|
+--VASSAL.build.module.map.BoardPicker
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.event.ActionListener, Buildable, CommandEncoder, Configurable, java.util.EventListener, GameComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, ValidityChecker, javax.swing.WindowConstants
- public class BoardPicker
- extends javax.swing.JDialog
- implements java.awt.event.ActionListener, GameComponent, Configurable, CommandEncoder, ValidityChecker
This class is responsible for maintaining the Boards on a
Map. As a CommandEncoder, it recognizes Commands that specify the set of boards to be used on a map. As a
GameComponent it reacts to the start of a game by prompting
the player to select boards if none have been specified
- See Also:
- Serialized Form
| Inner classes inherited from class javax.swing.JDialog |
javax.swing.JDialog.AccessibleJDialog |
| Inner classes inherited from class java.awt.Dialog |
java.awt.Dialog.AccessibleAWTDialog |
| Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Fields inherited from class javax.swing.JDialog |
accessibleContext, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Methods inherited from class javax.swing.JDialog |
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setLocationRelativeTo, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.awt.Dialog |
addNotify, dispose, getTitle, hide, isModal, isResizable, setModal, setResizable, setTitle, show |
| Methods inherited from class java.awt.Window |
addWindowListener, applyResourceBundle, applyResourceBundle, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, postEvent, processEvent, removeWindowListener, setCursor, toBack, toFront |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ID
public static final java.lang.String ID
possibleBoards
protected java.util.Vector possibleBoards
currentBoards
protected java.util.Vector currentBoards
status
protected javax.swing.JTextField status
cancelButton
protected javax.swing.JButton cancelButton
map
protected Map map
slotPanel
protected javax.swing.JPanel slotPanel
version
protected java.lang.String version
nx
protected int nx
ny
protected int ny
controls
protected javax.swing.JToolBar controls
addRowButton
protected javax.swing.JButton addRowButton
addColumnButton
protected javax.swing.JButton addColumnButton
allowMultiple
protected boolean allowMultiple
maxColumns
protected int maxColumns
title
protected java.lang.String title
addRowButtonText
protected java.lang.String addRowButtonText
addColumnButtonText
protected java.lang.String addColumnButtonText
boardPrompt
protected java.lang.String boardPrompt
defaultSetup
protected java.lang.String defaultSetup
multipleButtons
protected java.util.Vector multipleButtons
SCALE
public static final java.lang.String SCALE
SLOT_HEIGHT
public static final java.lang.String SLOT_HEIGHT
SLOT_WIDTH
public static final java.lang.String SLOT_WIDTH
SETUP
public static final java.lang.String SETUP
DIALOG_TITLE
public static final java.lang.String DIALOG_TITLE
ADD_ROW_BUTTON_TEXT
public static final java.lang.String ADD_ROW_BUTTON_TEXT
ADD_COLUMN_BUTTON_TEXT
public static final java.lang.String ADD_COLUMN_BUTTON_TEXT
BOARD_PROMPT
public static final java.lang.String BOARD_PROMPT
MAX_COLUMNS
public static final java.lang.String MAX_COLUMNS
BoardPicker
public BoardPicker()
initComponents
protected void initComponents()
getDefaultSlotSize
public java.awt.Dimension getDefaultSlotSize()
getSlotScale
public double getSlotScale()
- Returns:
- the zoom factory at which to display boards when selecting them
warn
public void warn(java.lang.String s)
addTo
public void addTo(Buildable b)
- 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.
- Specified by:
addTo in interface Buildable
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
validate
public void validate(Buildable target,
ValidationReport report)
- Specified by:
validate in interface ValidityChecker
add
public void add(Buildable b)
- Add a board to the list of those available for the user to choose from
- Specified by:
add in interface Buildable
remove
public void remove(Buildable b)
- Remove a board from the list of those available for the user to choose from
- Specified by:
remove in interface Configurable
removeFrom
public void removeFrom(Buildable parent)
- Description copied from interface:
Configurable
- Remove this component from its parent
- Specified by:
removeFrom in interface Configurable
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
getBoardDelimiter
public java.lang.String getBoardDelimiter()
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
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 java.awt.Component
setBoards
public void setBoards(java.util.Enumeration bdEnum)
pack
public void pack()
- Overrides:
pack in class java.awt.Window
selectBoards
protected void selectBoards()
getCurrentBoards
public java.util.Enumeration getCurrentBoards()
- Returns:
- an Enumeration of boards that have been selected either by
the user via the dialog or from reading a savefile
getAllowableBoardNames
public java.lang.String[] getAllowableBoardNames()
- Returns:
- an array of the names of all boards from which the user
may choose
getBoard
public Board getBoard(java.lang.String boardName)
- Returns:
- a Board with the given name. Duplicate boards with the same
name are clones.
setup
public void setup(boolean show)
- When starting a game, check to see if any boards have been
specified (via an encoded
Command. If not, show a
dialog to prompt the user for boards. When ending a game,
clear the selected boards
- 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
getRestoreCommand
public Command getRestoreCommand()
- The restore command of a BoardPicker, when executed, sets the
boards of its
Map to getCurrentBoards()
- Specified by:
getRestoreCommand in interface GameComponent
addButton
protected javax.swing.JButton addButton(java.lang.String s)
addButton
protected javax.swing.JButton addButton(java.lang.String s,
int index)
addRow
protected void addRow()
addColumn
protected void addColumn()
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed in interface java.awt.event.ActionListener
pickBoards
public java.util.Vector pickBoards()
reset
public void reset()
getRowCount
public int getRowCount()
getColumnCount
public int getColumnCount()
getNeighbor
public BoardSlot getNeighbor(BoardSlot slot,
int dx,
int dy)
getSlot
public BoardSlot getSlot(int i)
repaintAll
public void repaintAll()
removeAllBoards
protected void removeAllBoards()
isAllowMultiple
public boolean isAllowMultiple()
- Returns:
- true if multiple boards per map window are allowed
setAllowMultiple
public void setAllowMultiple(boolean val)
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
decode
public Command decode(java.lang.String command)
- Description copied from interface:
CommandEncoder
- Translate a String into a
Command
- Specified by:
decode in interface CommandEncoder
encode
public java.lang.String encode(Command c)
- Description copied from interface:
CommandEncoder
- Translate a
Command into a String
- Specified by:
encode in interface CommandEncoder