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.JPanelClass 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) classMasterBoard.BottomBarprivate classMasterBoard.InfoPopupHandler(package private) classMasterBoard.MasterBoardItemHandler(package private) classMasterBoard.MasterBoardMouseHandler(package private) classMasterBoard.MasterBoardMouseMotionHandler(package private) classMasterBoard.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.Stringaboutprivate javax.swing.AbstractActionaboutActionprivate MasterBoard.BottomBarbottomBarour own little bar implementationprivate java.lang.StringcachedPlayerNameprivate java.util.Map<java.lang.String,javax.swing.JCheckBoxMenuItem>checkboxesprivate javax.swing.AbstractActioncheckConnectionActionprivate static java.lang.StringchooseScreenprivate javax.swing.AbstractActionchooseScreenActionprivate javax.swing.AbstractActioncleanDisconnectActionprivate static java.lang.StringclearRecruitChitsprivate javax.swing.AbstractActionclearRecruitChitsActionprivate Clientclientprivate javax.swing.AbstractActioncloseBoardActionprivate java.awt.ContainercontentPaneprivate booleandefenderFleePhaseIn 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.StringdoneWithPhaseprivate javax.swing.AbstractActiondoneWithPhaseAction(package private) EditLegioneditLegionOngoingprivate javax.swing.JMenueditMenuprivate javax.swing.AbstractActionenforcedDisconnectByServerActionprivate MasterHexengagingPendingHexengage() 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.StringforcedDoneWithPhaseprivate javax.swing.AbstractActionforcedDoneWithPhaseActionprivate booleangameOverStateReachedprivate ClientGUIguiprivate GUIMasterHex[][]guiHexArrayprivate MasterBoard.InfoPopupHandleriphprivate java.awt.event.ItemListeneritemHandlerprivate static java.lang.StringkickPhaseprivate javax.swing.AbstractActionkickPhaseActionprivate java.awt.PointlastPointLast point clicked is needed for popup menus.private javax.swing.JPanel[]legionFlyoutsprivate java.util.LinkedHashMap<Legion,Marker>legionToMarkerMapList of markers which are currently on the board, for painting in z-order => the end of the list is on top.private javax.swing.AbstractActionloadGameActionprivate static java.util.logging.LoggerLOGGERprivate KFramemasterFrameprivate MasterBoard.MasterBoardWindowHandlermbwhprivate javax.swing.AbstractActionnewGameActionprivate static java.lang.StringnextLegionprivate javax.swing.AbstractActionnextLegionActionprivate java.awt.ImageoffScreenBufferprivate booleanoverlayChangedprivate javax.swing.JMenuphaseMenuprivate booleanplayerLabelDoneprivate javax.swing.JPopupMenupopupMenuprivate javax.swing.JPopupMenupopupMenuWithLegionsprivate java.util.Map<MasterHex,java.util.List<Chit>>possibleRecruitChitsprivate static java.lang.Stringpreferencesprivate javax.swing.AbstractActionpreferencesActionprivate javax.swing.AbstractActionquitGameActionprivate java.util.Map<Legion,Chit>recruitedChits(package private) EditLegionrelocateOngoingprivate booleansaveDuringEngagementDialogMessageShownShow 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.AbstractActionsaveGameActionprivate static java.lang.StringsaveGameAsprivate javax.swing.AbstractActionsaveGameAsActionprivate SaveWindowsaveWindowprivate javax.swing.JScrollPanescrollPaneThe scrollbarspanel, needed to correct lastPoint.private ShowHelpDocshowHelpDocprivate ShowReadmeshowReadmeprivate static java.lang.StringskipLegionprivate javax.swing.AbstractActionskipLegionActionprivate static java.lang.StringtakeMulliganprivate javax.swing.AbstractActiontakeMulliganActionprivate javax.swing.AbstractActiontryReconnectActionprivate static java.lang.StringundoAllprivate javax.swing.AbstractActionundoAllActionprivate static java.lang.StringundoLastprivate javax.swing.AbstractActionundoLastActionprivate static java.lang.StringviewBattleMapprivate javax.swing.AbstractActionviewBattleMapActionprivate static java.lang.StringviewFullRecruitTreeprivate javax.swing.AbstractActionviewFullRecruitTreeActionprivate static java.lang.StringviewHelpDocprivate javax.swing.AbstractActionviewHelpDocActionprivate static java.lang.StringviewHexRecruitTreeprivate javax.swing.AbstractActionviewHexRecruitTreeActionprivate static java.lang.StringviewLegionsprivate javax.swing.AbstractActionviewLegionsActionprivate static java.lang.StringviewReadmeprivate javax.swing.AbstractActionviewReadmeActionprivate static java.lang.StringviewWebClientprivate javax.swing.AbstractActionviewWebClientActionprivate static java.lang.StringviewWelcomeprivate javax.swing.AbstractActionviewWelcomeActionprivate static java.lang.StringwithdrawFromGameprivate javax.swing.AbstractActionwithdrawFromGameAction-
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 voidactivateNextLegionAndPlaceMouse(Legion nextLegion)voidactOnEditLegionMaybe(Legion legion)private voidactOnHex(MasterHex hex)private voidactOnLegion(LegionClientSide legion, MasterHex hex)(package private) voidactOnMisclick()private javax.swing.JCheckBoxMenuItemaddCheckBox(javax.swing.JMenu menu, java.lang.String name, int mnemonic)private voidaddPossibleRecruitChits(java.util.List<CreatureType> imageNameList, MasterHex masterHex)voidaddPossibleRecruitChits(LegionClientSide legion, java.util.Set<MasterHex> hexes)(package private) voidaddRecruitedChit(Legion legion)(package private) voidadjustCheckboxIfNeeded(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) voidalignAllLegions()This is incredibly inefficient.private voidalignLegions(java.util.Set<MasterHex> hexes)(package private) voidalignLegions(MasterHex masterHex)private voidattemptEngage(MasterHex hex)private voidcleanCBListeners()private voidcleanGUIHexes()(package private) voidcleanRecruitedChit(LegionClientSide legion)voidclearDefenderFlee()We got showConcede or showNegotiate messages, i.e.voidclearEngagingPending()tellEngagement calls this, now "engaging" is not pending, instead there is a real engagement to be resolved.voidclearPossibleRecruitChits()voidclearRecruitedChits()private Constants.ConfirmValsconfirmDialog(java.lang.String text, int count)(package private) voiddeiconify()voiddisableDoneAction(java.lang.String reason)Disable the Done action, and update the reason text in bottomBarprivate voiddisableDoneActionActivePlayerDoes(java.lang.String doesWhat)Clear bottomBar phase text and call disableDoneAction, as reason the standard text "<active player> doesWhat"voiddispose()private voiddoneWithPhase()Finishes the current phase.voiddoQuitGameAction()voidenableDoneAction()voidenableSaveActions()voidfocusBackToMasterboard()(package private) voidfullRepaint()(package private) KFramegetFrame()(package private) GUIMasterHexgetGUIHexByMasterHex(MasterHex masterHex)Do a brute-force search through the hex array, looking for a match.private GUIMasterHexgetHexContainingPoint(java.awt.Point point)Return the MasterHex that contains the given point, or null if none does.private java.lang.StringgetLogDirectory()private MarkergetMarkerAtPoint(java.awt.Point point)Return the topmost Marker that contains the given point, or null if none does.private MasterBoardgetMasterBoard()TODO this should probably be stored as member, possibly instead of the client class.java.awt.DimensiongetMinimumSize()java.awt.DimensiongetPreferredSize()(package private) voidhighlightEngagements()private voidhighlightMoves(LegionClientSide legion)Select hexes where this legion can move.(package private) voidhighlightPossibleRecruitLegionHexes()Highlight all hexes with legions that (still) can do recruiting(package private) voidhighlightTallLegions()(package private) voidhighlightUnmovedLegions()private static booleanisPopupButton(java.awt.event.MouseEvent e)Return true if the MouseEvent e came from button 2 or 3.private voidjumpToNextUnhandledLegion()user pressed "N".private voidmakeDoneCloseWindow()voidmarkLegionSkip()(package private) voidmaybeRequestFocusAndToFront()If and only if stealFocus option is enabled, this does both requestFocus and getFrame().toFront().(package private) voidmyTurnStartsActions()(package private) voidpack()voidpaintComponent(java.awt.Graphics g)private voidpaintHexes(java.awt.Graphics g)private voidpaintHighlights(java.awt.Graphics2D g)private voidpaintMarkers(java.awt.Graphics g)Paint markers in z-order.private voidpaintMovementDie(java.awt.Graphics g)private voidpaintPossibleRecruitChits(java.awt.Graphics g)private voidpaintRecruitedChits(java.awt.Graphics g)voidrecreateMarkers()Create new markers in response to a rescale.(package private) voidremoveMarkerForLegion(Legion legion)(package private) voidrepaintAfterOverlayChanged()(package private) voidrescale()private booleansaveDuringEngagementDialog()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) voidselectHex(MasterHex modelHex)private voidselectHexes(java.util.Set<MasterHex> hexes)private voidselectHexes(java.util.Set<MasterHex> hexes, java.awt.Color color)voidsetBoardActive(boolean val)voidsetEditOngoing(EditLegion editLegion)voidsetGameOverState(java.lang.String message)(package private) voidsetMarkerForLegion(Legion legion, Marker marker)voidsetMovementPhase()(package private) voidsetPendingText(java.lang.String text)voidsetPhaseInfo(java.lang.String message)voidsetReconnectedMessage()voidsetRelocateOngoing(EditLegion editLegion)voidsetReplayMode()voidsetServerClosedMessage(boolean gameOver)voidsetTempDisconnectedState(java.lang.String message)private voidsetTitleInfoText(java.lang.String text)private voidsetupActions()private voidsetupAsInactivePlayer(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) voidsetupFightMenu()private voidsetupGUIHexes()private voidsetupIcon()(package private) voidsetupMoveMenu()(package private) voidsetupMusterMenu()private voidsetupPhasePreparations(java.lang.String titleText)(package private) voidsetupPlayerLabel()Show which player owns this board.private voidsetupPopupMenus()(package private) voidsetupSplitMenu()(package private) voidsetupTitleForMovementRoll(int roll)private voidsetupTopMenu()voidshowBattleMap(GUIMasterHex hex)(package private) voidunselectAllHexes()(package private) voidupdateComponentTreeUI()voidupdateEngagementsLeftText()voidupdateLegionsLeftToMoveText(boolean have_roll)voidupdateLegionsLeftToMusterText()voidupdateReplayText(int currTurn, int maxTurn)voidviewEditLegion(LegionClientSide legion)voidviewLegions(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:
paintComponentin 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:
getMinimumSizein classjavax.swing.JComponent
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSizein 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)
-
-