net.sf.colossus.gui
Class MasterBoard

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by net.sf.colossus.gui.MasterBoard
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public final class MasterBoard
extends javax.swing.JPanel

Class MasterBoard implements the GUI for a Titan masterboard.

Author:
David Ripton, Romain Dolbeau
See Also:
Serialized Form

Nested Class Summary
(package private)  class MasterBoard.BottomBar
           
private  class MasterBoard.InfoPopupHandler
           
(package private)  class MasterBoard.MasterBoardItemHandler
           
(package private)  class MasterBoard.MasterBoardMouseHandler
           
(package private)  class MasterBoard.MasterBoardMouseMotionHandler
           
(package private)  class MasterBoard.MasterBoardWindowHandler
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static java.lang.String about
           
private  javax.swing.AbstractAction aboutAction
           
private  MasterBoard.BottomBar bottomBar
          our own little bar implementation
private  java.lang.String cachedPlayerName
           
private  java.util.Map<java.lang.String,javax.swing.JCheckBoxMenuItem> checkboxes
           
private  javax.swing.AbstractAction checkConnectionAction
           
private static java.lang.String chooseScreen
           
private  javax.swing.AbstractAction chooseScreenAction
           
private static java.lang.String clearRecruitChits
           
private  javax.swing.AbstractAction clearRecruitChitsAction
           
private  Client client
           
private  javax.swing.AbstractAction closeBoardAction
           
private  java.awt.Container contentPane
           
private  boolean defenderFleePhase
          In that time while we got tellEngagement but nothing else (bottom bar just tells engaged, but no other visible notice of what's going on), we might be waiting for the opponent to think about whether to flee or not.
private static java.lang.String doneWithPhase
           
private  javax.swing.AbstractAction doneWithPhaseAction
           
private  MasterHex engagingPendingHex
          engage() has been sent to server but answer (tellEngagement()) not received yet; mostly we have this, to be able to react properly when user clicks on an engagement while there is still the server response missing for the last one
private static java.lang.String forcedDoneWithPhase
           
private  javax.swing.AbstractAction forcedDoneWithPhaseAction
           
private  boolean gameOverStateReached
           
private  ClientGUI gui
           
private  GUIMasterHex[][] guiHexArray
           
private  MasterBoard.InfoPopupHandler iph
           
private  java.awt.event.ItemListener itemHandler
           
private  java.awt.Point lastPoint
          Last point clicked is needed for popup menus.
private  javax.swing.JPanel[] legionFlyouts
           
private  java.util.LinkedHashMap<Legion,Marker> legionToMarkerMap
          List of markers which are currently on the board, for painting in z-order => the end of the list is on top.
private  javax.swing.AbstractAction loadGameAction
           
private static java.util.logging.Logger LOGGER
           
private  KFrame masterFrame
           
private  MasterBoard.MasterBoardWindowHandler mbwh
           
private  javax.swing.AbstractAction newGameAction
           
private static java.lang.String nextLegion
           
private  javax.swing.AbstractAction nextLegionAction
           
private  java.awt.Image offScreenBuffer
           
private  boolean overlayChanged
           
private  javax.swing.JMenu phaseMenu
           
private  boolean playerLabelDone
           
private  javax.swing.JPopupMenu popupMenu
           
private  javax.swing.JPopupMenu popupMenuWithLegions
           
private  java.util.Map<MasterHex,java.util.List<Chit>> possibleRecruitChits
           
private static java.lang.String preferences
           
private  javax.swing.AbstractAction preferencesAction
           
private  javax.swing.AbstractAction quitGameAction
           
private  java.util.Map<Legion,Chit> recruitedChits
           
private  boolean saveDuringEngagementDialogMessageShown
          Show the message that "saving during engagement/battle will store the last commit point" only once each game - flag that it has been shown
private  javax.swing.AbstractAction saveGameAction
           
private static java.lang.String saveGameAs
           
private  javax.swing.AbstractAction saveGameAsAction
           
private  SaveWindow saveWindow
           
private  javax.swing.JScrollPane scrollPane
          The scrollbarspanel, needed to correct lastPoint.
private  ShowHelpDoc showHelpDoc
           
private  ShowReadme showReadme
           
private static java.lang.String skipLegion
           
private  javax.swing.AbstractAction skipLegionAction
           
private static java.lang.String takeMulligan
           
private  javax.swing.AbstractAction takeMulliganAction
           
private static java.lang.String undoAll
           
private  javax.swing.AbstractAction undoAllAction
           
private static java.lang.String undoLast
           
private  javax.swing.AbstractAction undoLastAction
           
private static java.lang.String viewBattleMap
           
private  javax.swing.AbstractAction viewBattleMapAction
           
private static java.lang.String viewFullRecruitTree
           
private  javax.swing.AbstractAction viewFullRecruitTreeAction
           
private static java.lang.String viewHelpDoc
           
private  javax.swing.AbstractAction viewHelpDocAction
           
private static java.lang.String viewHexRecruitTree
           
private  javax.swing.AbstractAction viewHexRecruitTreeAction
           
private static java.lang.String viewLegions
           
private  javax.swing.AbstractAction viewLegionsAction
           
private static java.lang.String viewReadme
           
private  javax.swing.AbstractAction viewReadmeAction
           
private static java.lang.String viewWebClient
           
private  javax.swing.AbstractAction viewWebClientAction
           
private static java.lang.String viewWelcome
           
private  javax.swing.AbstractAction viewWelcomeAction
           
private static java.lang.String withdrawFromGame
           
private  javax.swing.AbstractAction withdrawFromGameAction
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MasterBoard(Client client, ClientGUI gui)
           
 
Method Summary
private  void activateNextLegionAndPlaceMouse(Legion nextLegion)
           
private  void actOnHex(MasterHex hex)
           
private  void actOnLegion(LegionClientSide legion, MasterHex hex)
           
(package private)  void actOnMisclick()
           
private  javax.swing.JCheckBoxMenuItem addCheckBox(javax.swing.JMenu menu, java.lang.String name, int mnemonic)
           
 void addPossibleRecruitChits(LegionClientSide legion, java.util.Set<MasterHex> hexes)
           
private  void addPossibleRecruitChits(java.util.List<CreatureType> imageNameList, MasterHex masterHex)
           
(package private)  void addRecruitedChit(Legion legion)
           
(package private)  void adjustCheckboxIfNeeded(java.lang.String name, boolean enable)
          Find the checkbox for the given (boolean) option name; set it to the new given value (only if different that previous value).
(package private)  void alignAllLegions()
          This is incredibly inefficient.
(package private)  void alignLegions(MasterHex masterHex)
           
private  void alignLegions(java.util.Set<MasterHex> hexes)
           
private  void attemptEngage(MasterHex hex)
           
private  void cleanCBListeners()
           
private  void cleanGUIHexes()
           
(package private)  void cleanRecruitedChit(LegionClientSide legion)
           
 void clearDefenderFlee()
          We got showConcede or showNegotiate messages, i.e.
 void clearEngagingPending()
          tellEngagement calls this, now "engaging" is not pending, instead there is a real engagement to be resolved.
 void clearPossibleRecruitChits()
           
 void clearRecruitedChits()
           
private  Constants.ConfirmVals confirmDialog(java.lang.String text, int count)
           
(package private)  void deiconify()
           
 void disableDoneAction(java.lang.String reason)
          Disable the Done action, and update the reason text in bottomBar
private  void disableDoneActionActivePlayerDoes(java.lang.String doesWhat)
          Clear bottomBar phase text and call disableDoneAction, as reason the standard text "<active player> doesWhat"
 void dispose()
           
private  void doneWithPhase()
          Finishes the current phase.
 void doQuitGameAction()
           
 void enableDoneAction()
           
 void enableSaveActions()
           
(package private)  void fullRepaint()
           
(package private)  KFrame getFrame()
           
(package private)  GUIMasterHex getGUIHexByMasterHex(MasterHex masterHex)
          Do a brute-force search through the hex array, looking for a match.
private  GUIMasterHex getHexContainingPoint(java.awt.Point point)
          Return the MasterHex that contains the given point, or null if none does.
private  java.lang.String getLogDirectory()
           
private  Marker getMarkerAtPoint(java.awt.Point point)
          Return the topmost Marker that contains the given point, or null if none does.
private  MasterBoard getMasterBoard()
          TODO this should probably be stored as member, possibly instead of the client class.
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
(package private)  void highlightEngagements()
           
private  void highlightMoves(LegionClientSide legion)
          Select hexes where this legion can move.
(package private)  void highlightPossibleRecruitLegionHexes()
          Highlight all hexes with legions that (still) can do recruiting
(package private)  void highlightTallLegions()
           
(package private)  void highlightUnmovedLegions()
           
private static boolean isPopupButton(java.awt.event.MouseEvent e)
          Return true if the MouseEvent e came from button 2 or 3.
private  void jumpToNextUnhandledLegion()
          user pressed "N".
private  void makeDoneCloseWindow()
           
 void markLegionSkip()
           
(package private)  void maybeRequestFocusAndToFront()
          If and only if stealFocus option is enabled, this does both requestFocus and getFrame().toFront().
(package private)  void myTurnStartsActions()
           
(package private)  void pack()
           
 void paintComponent(java.awt.Graphics g)
           
private  void paintHexes(java.awt.Graphics g)
           
private  void paintHighlights(java.awt.Graphics2D g)
           
private  void paintMarkers(java.awt.Graphics g)
          Paint markers in z-order.
private  void paintMovementDie(java.awt.Graphics g)
           
private  void paintPossibleRecruitChits(java.awt.Graphics g)
           
private  void paintRecruitedChits(java.awt.Graphics g)
           
 void recreateMarkers()
          Create new markers in response to a rescale.
(package private)  void removeMarkerForLegion(Legion legion)
           
(package private)  void repaintAfterOverlayChanged()
           
(package private)  void rescale()
           
private  boolean saveDuringEngagementDialog()
          Inform the user that saving during an engagement will save the last commit point, so loading it will re-set game to just before the engagement was started.
(package private)  void selectHex(MasterHex modelHex)
           
private  void selectHexes(java.util.Set<MasterHex> hexes)
           
private  void selectHexes(java.util.Set<MasterHex> hexes, java.awt.Color color)
           
 void setBoardActive(boolean val)
           
 void setGameOverState(java.lang.String message)
           
(package private)  void setMarkerForLegion(Legion legion, Marker marker)
           
 void setMovementPhase()
           
(package private)  void setPendingText(java.lang.String text)
           
 void setPhaseInfo(java.lang.String message)
           
 void setReplayMode()
           
 void setServerClosedMessage(boolean gameOver)
           
private  void setTitleInfoText(java.lang.String text)
           
private  void setupActions()
           
private  void setupAsInactivePlayer(java.lang.String text)
          Do the setup needed for an inactive player: set the actions which are allowed only for active player to inactive, and update the bottomBar info why "Done" is disabled accordingly
(package private)  void setupFightMenu()
           
private  void setupGUIHexes()
           
private  void setupIcon()
           
(package private)  void setupMoveMenu()
           
(package private)  void setupMusterMenu()
           
private  void setupPhasePreparations(java.lang.String titleText)
           
(package private)  void setupPlayerLabel()
          Show which player owns this board.
private  void setupPopupMenus()
           
(package private)  void setupSplitMenu()
           
(package private)  void setupTitleForMovementRoll(int roll)
           
private  void setupTopMenu()
           
 void showBattleMap(GUIMasterHex hex)
           
(package private)  void unselectAllHexes()
           
(package private)  void updateComponentTreeUI()
           
 void updateEngagementsLeftText()
           
 void updateLegionsLeftToMoveText(boolean have_roll)
           
 void updateLegionsLeftToMusterText()
           
 void updateReplayText(int currTurn, int maxTurn)
           
 void viewLegions(java.awt.Point point)
           
 
Methods 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, 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
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

offScreenBuffer

private java.awt.Image offScreenBuffer

overlayChanged

private boolean overlayChanged

guiHexArray

private GUIMasterHex[][] guiHexArray

client

private Client client

gui

private final ClientGUI gui

masterFrame

private KFrame masterFrame

showReadme

private ShowReadme showReadme

showHelpDoc

private ShowHelpDoc showHelpDoc

phaseMenu

private javax.swing.JMenu phaseMenu

popupMenu

private javax.swing.JPopupMenu popupMenu

popupMenuWithLegions

private javax.swing.JPopupMenu popupMenuWithLegions

checkboxes

private java.util.Map<java.lang.String,javax.swing.JCheckBoxMenuItem> checkboxes

legionFlyouts

private javax.swing.JPanel[] legionFlyouts

mbwh

private final MasterBoard.MasterBoardWindowHandler mbwh

iph

private MasterBoard.InfoPopupHandler iph

lastPoint

private java.awt.Point lastPoint
Last point clicked is needed for popup menus.


engagingPendingHex

private MasterHex engagingPendingHex
engage() has been sent to server but answer (tellEngagement()) not received yet; mostly we have this, to be able to react properly when user clicks on an engagement while there is still the server response missing for the last one


defenderFleePhase

private boolean defenderFleePhase
In that time while we got tellEngagement but nothing else (bottom bar just tells engaged, but no other visible notice of what's going on), we might be waiting for the opponent to think about whether to flee or not. So if user is impatient and clicks a hex with any (same, or other) engagement, inform him we are already engaged right now and probably opponent is currently thinking about whether to flee or not. Once we receive showConcede or showNegotiate messages, this time window is over, after that we don't say this about the "perhaps opponent is currently thinking whether to flee" any more.


saveDuringEngagementDialogMessageShown

private boolean saveDuringEngagementDialogMessageShown
Show the message that "saving during engagement/battle will store the last commit point" only once each game - flag that it has been shown


legionToMarkerMap

private final java.util.LinkedHashMap<Legion,Marker> legionToMarkerMap
List of markers which are currently on the board, for painting in z-order => the end of the list is on top. Now synchronized access to prevent NPEs when EDT wants to paint a marker and asks for the legion for it, and legion has just been removed. I don't use a synchronizedList, because then I get into trouble in the recreateMarkers method.


recruitedChits

private final java.util.Map<Legion,Chit> recruitedChits

possibleRecruitChits

private final java.util.Map<MasterHex,java.util.List<Chit>> possibleRecruitChits

scrollPane

private javax.swing.JScrollPane scrollPane
The scrollbarspanel, needed to correct lastPoint.


contentPane

private final java.awt.Container contentPane

bottomBar

private MasterBoard.BottomBar bottomBar
our own little bar implementation


gameOverStateReached

private boolean gameOverStateReached

saveGameAs

private static final java.lang.String saveGameAs
See Also:
Constant Field Values

clearRecruitChits

private static final java.lang.String clearRecruitChits
See Also:
Constant Field Values

skipLegion

private static final java.lang.String skipLegion
See Also:
Constant Field Values

nextLegion

private static final java.lang.String nextLegion
See Also:
Constant Field Values

undoLast

private static final java.lang.String undoLast
See Also:
Constant Field Values

undoAll

private static final java.lang.String undoAll
See Also:
Constant Field Values

doneWithPhase

private static final java.lang.String doneWithPhase
See Also:
Constant Field Values

forcedDoneWithPhase

private static final java.lang.String forcedDoneWithPhase
See Also:
Constant Field Values

takeMulligan

private static final java.lang.String takeMulligan
See Also:
Constant Field Values

withdrawFromGame

private static final java.lang.String withdrawFromGame
See Also:
Constant Field Values

viewWebClient

private static final java.lang.String viewWebClient
See Also:
Constant Field Values

viewFullRecruitTree

private static final java.lang.String viewFullRecruitTree
See Also:
Constant Field Values

viewHexRecruitTree

private static final java.lang.String viewHexRecruitTree
See Also:
Constant Field Values

viewBattleMap

private static final java.lang.String viewBattleMap
See Also:
Constant Field Values

viewLegions

private static final java.lang.String viewLegions
See Also:
Constant Field Values

chooseScreen

private static final java.lang.String chooseScreen
See Also:
Constant Field Values

preferences

private static final java.lang.String preferences
See Also:
Constant Field Values

about

private static final java.lang.String about
See Also:
Constant Field Values

viewReadme

private static final java.lang.String viewReadme
See Also:
Constant Field Values

viewHelpDoc

private static final java.lang.String viewHelpDoc
See Also:
Constant Field Values

viewWelcome

private static final java.lang.String viewWelcome
See Also:
Constant Field Values

newGameAction

private javax.swing.AbstractAction newGameAction

loadGameAction

private javax.swing.AbstractAction loadGameAction

saveGameAction

private javax.swing.AbstractAction saveGameAction

saveGameAsAction

private javax.swing.AbstractAction saveGameAsAction

closeBoardAction

private javax.swing.AbstractAction closeBoardAction

quitGameAction

private javax.swing.AbstractAction quitGameAction

checkConnectionAction

private javax.swing.AbstractAction checkConnectionAction

clearRecruitChitsAction

private javax.swing.AbstractAction clearRecruitChitsAction

skipLegionAction

private javax.swing.AbstractAction skipLegionAction

nextLegionAction

private javax.swing.AbstractAction nextLegionAction

undoLastAction

private javax.swing.AbstractAction undoLastAction

undoAllAction

private javax.swing.AbstractAction undoAllAction

doneWithPhaseAction

private javax.swing.AbstractAction doneWithPhaseAction

forcedDoneWithPhaseAction

private javax.swing.AbstractAction forcedDoneWithPhaseAction

takeMulliganAction

private javax.swing.AbstractAction takeMulliganAction

withdrawFromGameAction

private javax.swing.AbstractAction withdrawFromGameAction

viewWebClientAction

private javax.swing.AbstractAction viewWebClientAction

viewFullRecruitTreeAction

private javax.swing.AbstractAction viewFullRecruitTreeAction

viewHexRecruitTreeAction

private javax.swing.AbstractAction viewHexRecruitTreeAction

viewBattleMapAction

private javax.swing.AbstractAction viewBattleMapAction

viewLegionsAction

private javax.swing.AbstractAction viewLegionsAction

chooseScreenAction

private javax.swing.AbstractAction chooseScreenAction

preferencesAction

private javax.swing.AbstractAction preferencesAction

aboutAction

private javax.swing.AbstractAction aboutAction

viewReadmeAction

private javax.swing.AbstractAction viewReadmeAction

viewHelpDocAction

private javax.swing.AbstractAction viewHelpDocAction

viewWelcomeAction

private javax.swing.AbstractAction viewWelcomeAction

playerLabelDone

private boolean playerLabelDone

saveWindow

private SaveWindow saveWindow

cachedPlayerName

private java.lang.String cachedPlayerName

itemHandler

private java.awt.event.ItemListener itemHandler
Constructor Detail

MasterBoard

public MasterBoard(Client client,
                   ClientGUI gui)
Method Detail

setBoardActive

public void setBoardActive(boolean val)

enableSaveActions

public void enableSaveActions()

saveDuringEngagementDialog

private boolean saveDuringEngagementDialog()
Inform the user that saving during an engagement will save the last commit point, so loading it will re-set game to just before the engagement was started. Only if user closes the dialog, no save will be done.

Returns:
True if saving shall be done anyway

confirmDialog

private Constants.ConfirmVals confirmDialog(java.lang.String text,
                                            int count)

setupActions

private void setupActions()

getLogDirectory

private java.lang.String getLogDirectory()

doQuitGameAction

public void doQuitGameAction()

showBattleMap

public void showBattleMap(GUIMasterHex hex)

setupPopupMenus

private void setupPopupMenus()

viewLegions

public void viewLegions(java.awt.Point point)

addCheckBox

private javax.swing.JCheckBoxMenuItem addCheckBox(javax.swing.JMenu menu,
                                                  java.lang.String name,
                                                  int mnemonic)

cleanCBListeners

private void cleanCBListeners()

setupTopMenu

private void setupTopMenu()

adjustCheckboxIfNeeded

void adjustCheckboxIfNeeded(java.lang.String name,
                            boolean enable)
Find the checkbox for the given (boolean) option name; set it to the new given value (only if different that previous value).

Parameters:
name - The option name to adjust the checkbox for
enable - The should-be state of the checkbox

setupPlayerLabel

void setupPlayerLabel()
Show which player owns this board.


setupGUIHexes

private void setupGUIHexes()

getMasterBoard

private MasterBoard getMasterBoard()
TODO this should probably be stored as member, possibly instead of the client class.


cleanGUIHexes

private void cleanGUIHexes()

doneWithPhase

private void doneWithPhase()
Finishes the current phase. Depending on the current phase this method dispatches to the different done methods.

See Also:
Client.doneWithSplits(), Client.doneWithMoves(), Client.doneWithEngagements()(), Client.doneWithRecruits()()

setupPhasePreparations

private void setupPhasePreparations(java.lang.String titleText)

setupAsInactivePlayer

private void setupAsInactivePlayer(java.lang.String text)
Do the setup needed for an inactive player: set the actions which are allowed only for active player to inactive, and update the bottomBar info why "Done" is disabled accordingly

Parameters:
text - What the active player is doing right now

setupSplitMenu

void setupSplitMenu()

setupMoveMenu

void setupMoveMenu()

setMovementPhase

public void setMovementPhase()

setupTitleForMovementRoll

void setupTitleForMovementRoll(int roll)

setupFightMenu

void setupFightMenu()

updateEngagementsLeftText

public void updateEngagementsLeftText()

setupMusterMenu

void setupMusterMenu()

highlightPossibleRecruitLegionHexes

void highlightPossibleRecruitLegionHexes()
Highlight all hexes with legions that (still) can do recruiting


getFrame

KFrame getFrame()

alignAllLegions

void alignAllLegions()
This is incredibly inefficient.


alignLegions

void alignLegions(MasterHex masterHex)

alignLegions

private void alignLegions(java.util.Set<MasterHex> hexes)

highlightTallLegions

void highlightTallLegions()

highlightUnmovedLegions

void highlightUnmovedLegions()

setPendingText

void setPendingText(java.lang.String text)

highlightMoves

private void highlightMoves(LegionClientSide legion)
Select hexes where this legion can move.


highlightEngagements

void highlightEngagements()

setupIcon

private void setupIcon()

getGUIHexByMasterHex

GUIMasterHex getGUIHexByMasterHex(MasterHex masterHex)
Do a brute-force search through the hex array, looking for a match. Return the hex, or null if none is found.


getHexContainingPoint

private GUIMasterHex getHexContainingPoint(java.awt.Point point)
Return the MasterHex that contains the given point, or null if none does.


setMarkerForLegion

void setMarkerForLegion(Legion legion,
                        Marker marker)

removeMarkerForLegion

void removeMarkerForLegion(Legion legion)

recreateMarkers

public void recreateMarkers()
Create new markers in response to a rescale.


getMarkerAtPoint

private Marker getMarkerAtPoint(java.awt.Point point)
Return the topmost Marker that contains the given point, or null if none does.


unselectAllHexes

void unselectAllHexes()

selectHex

void selectHex(MasterHex modelHex)

selectHexes

private void selectHexes(java.util.Set<MasterHex> hexes)

selectHexes

private void selectHexes(java.util.Set<MasterHex> hexes,
                         java.awt.Color color)

actOnMisclick

void actOnMisclick()

isPopupButton

private static boolean isPopupButton(java.awt.event.MouseEvent e)
Return true if the MouseEvent e came from button 2 or 3. In theory, isPopupTrigger() is the right way to check for this. In practice, the poor design choice of only having isPopupTrigger() fire on mouse release on Windows makes it useless here.


actOnLegion

private void actOnLegion(LegionClientSide legion,
                         MasterHex hex)

actOnHex

private void actOnHex(MasterHex hex)

clearEngagingPending

public void clearEngagingPending()
tellEngagement calls this, now "engaging" is not pending, instead there is a real engagement to be resolved.


clearDefenderFlee

public void clearDefenderFlee()
We got showConcede or showNegotiate messages, i.e. the phase in which defender might flee is over, thus the message dialog should not tell that any more. This client here should now have some dialog or even the actual battle map anyway.


attemptEngage

private void attemptEngage(MasterHex hex)

repaintAfterOverlayChanged

void repaintAfterOverlayChanged()

paintComponent

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

paintHexes

private void paintHexes(java.awt.Graphics g)

paintHighlights

private void paintHighlights(java.awt.Graphics2D g)

paintMarkers

private void paintMarkers(java.awt.Graphics g)
Paint markers in z-order.


paintRecruitedChits

private void paintRecruitedChits(java.awt.Graphics g)

addPossibleRecruitChits

public void addPossibleRecruitChits(LegionClientSide legion,
                                    java.util.Set<MasterHex> hexes)

addRecruitedChit

void addRecruitedChit(Legion legion)

cleanRecruitedChit

void cleanRecruitedChit(LegionClientSide legion)

addPossibleRecruitChits

private void addPossibleRecruitChits(java.util.List<CreatureType> imageNameList,
                                     MasterHex masterHex)

clearRecruitedChits

public void clearRecruitedChits()

clearPossibleRecruitChits

public void clearPossibleRecruitChits()

paintPossibleRecruitChits

private void paintPossibleRecruitChits(java.awt.Graphics g)

paintMovementDie

private void paintMovementDie(java.awt.Graphics g)

markLegionSkip

public void markLegionSkip()

jumpToNextUnhandledLegion

private void jumpToNextUnhandledLegion()
user pressed "N". Find the next legion that "deserves" handling, activate (as if user had clicked it), and position the mouse cursor over it.


activateNextLegionAndPlaceMouse

private void activateNextLegionAndPlaceMouse(Legion nextLegion)
Parameters:
nextLegion -

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

rescale

void rescale()

deiconify

void deiconify()

dispose

public void dispose()

pack

void pack()

updateComponentTreeUI

void updateComponentTreeUI()

fullRepaint

void fullRepaint()

maybeRequestFocusAndToFront

void maybeRequestFocusAndToFront()
If and only if stealFocus option is enabled, this does both requestFocus and getFrame().toFront().


myTurnStartsActions

void myTurnStartsActions()

updateLegionsLeftToMusterText

public void updateLegionsLeftToMusterText()

updateLegionsLeftToMoveText

public void updateLegionsLeftToMoveText(boolean have_roll)

enableDoneAction

public void enableDoneAction()

disableDoneAction

public void disableDoneAction(java.lang.String reason)
Disable the Done action, and update the reason text in bottomBar

Parameters:
reason - Information why one is not ready to be Done

disableDoneActionActivePlayerDoes

private void disableDoneActionActivePlayerDoes(java.lang.String doesWhat)
Clear bottomBar phase text and call disableDoneAction, as reason the standard text "<active player> doesWhat"

Parameters:
doesWhat - Information what the active player currently does

makeDoneCloseWindow

private void makeDoneCloseWindow()

setServerClosedMessage

public void setServerClosedMessage(boolean gameOver)

setReplayMode

public void setReplayMode()

updateReplayText

public void updateReplayText(int currTurn,
                             int maxTurn)

setTitleInfoText

private void setTitleInfoText(java.lang.String text)

setGameOverState

public void setGameOverState(java.lang.String message)

setPhaseInfo

public void setPhaseInfo(java.lang.String message)