Package net.sf.colossus.gui
Class MasterBoard
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- 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
Nested Classes Modifier and Type Class Description (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
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
about
private javax.swing.AbstractAction
aboutAction
private MasterBoard.BottomBar
bottomBar
our own little bar implementationprivate 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 javax.swing.AbstractAction
cleanDisconnectAction
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
(package private) EditLegion
editLegionOngoing
private javax.swing.JMenu
editMenu
private javax.swing.AbstractAction
enforcedDisconnectByServerAction
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 oneprivate 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 static java.lang.String
kickPhase
private javax.swing.AbstractAction
kickPhaseAction
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
(package private) EditLegion
relocateOngoing
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 shownprivate 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 javax.swing.AbstractAction
tryReconnectAction
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
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description MasterBoard(Client client, ClientGUI gui)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
activateNextLegionAndPlaceMouse(Legion nextLegion)
void
actOnEditLegionMaybe(Legion legion)
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)
private void
addPossibleRecruitChits(java.util.List<CreatureType> imageNameList, MasterHex masterHex)
void
addPossibleRecruitChits(LegionClientSide legion, java.util.Set<MasterHex> hexes)
(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.private void
alignLegions(java.util.Set<MasterHex> hexes)
(package private) void
alignLegions(MasterHex masterHex)
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 bottomBarprivate 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()
void
focusBackToMasterboard()
(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
setEditOngoing(EditLegion editLegion)
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
setReconnectedMessage()
void
setRelocateOngoing(EditLegion editLegion)
void
setReplayMode()
void
setServerClosedMessage(boolean gameOver)
void
setTempDisconnectedState(java.lang.String message)
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
viewEditLegion(LegionClientSide legion)
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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
-
-
-
-
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
-
editMenu
private javax.swing.JMenu editMenu
-
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.
-
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
-
kickPhase
private static final java.lang.String kickPhase
- 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
-
cleanDisconnectAction
private javax.swing.AbstractAction cleanDisconnectAction
-
enforcedDisconnectByServerAction
private javax.swing.AbstractAction enforcedDisconnectByServerAction
-
tryReconnectAction
private javax.swing.AbstractAction tryReconnectAction
-
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
-
kickPhaseAction
private javax.swing.AbstractAction kickPhaseAction
-
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
-
editLegionOngoing
EditLegion editLegionOngoing
-
relocateOngoing
EditLegion relocateOngoing
-
itemHandler
private java.awt.event.ItemListener itemHandler
-
-
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 forenable
- 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()
-
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.
-
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)
-
focusBackToMasterboard
public void focusBackToMasterboard()
-
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)
-
actOnEditLegionMaybe
public void actOnEditLegionMaybe(Legion legion)
-
setEditOngoing
public void setEditOngoing(EditLegion editLegion)
-
setRelocateOngoing
public void setRelocateOngoing(EditLegion editLegion)
-
viewEditLegion
public void viewEditLegion(LegionClientSide legion)
- Parameters:
legion
- the legion which shall be edited
-
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 classjavax.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 classjavax.swing.JComponent
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSize
in classjavax.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)
-
setReconnectedMessage
public void setReconnectedMessage()
-
setReplayMode
public void setReplayMode()
-
updateReplayText
public void updateReplayText(int currTurn, int maxTurn)
-
setTitleInfoText
private void setTitleInfoText(java.lang.String text)
-
setTempDisconnectedState
public void setTempDisconnectedState(java.lang.String message)
-
setGameOverState
public void setGameOverState(java.lang.String message)
-
setPhaseInfo
public void setPhaseInfo(java.lang.String message)
-
-