Class AbstractPhaseDisplay
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
megamek.client.ui.widget.SkinnedJPanel
megamek.client.ui.panels.phaseDisplay.AbstractPhaseDisplay
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,EventListener,Accessible,BoardViewListener,GameListener,Distractable
- Direct Known Subclasses:
ChatLounge,StatusBarPhaseDisplay
public abstract class AbstractPhaseDisplay
extends SkinnedJPanel
implements BoardViewListener, GameListener, Distractable
This is the base class for all the "displays" which take control during the local player's turn. Only one display is
shown at each time; the ChatLounge is also a display. The ChatLounge doesn't show the
BoardView but most other displays do. Typically, the display itself is
the button bar at the bottom of the GUI.
Note that a display being active does not mean that it is also the player's turn. The display should allow inspecting units and other actions even when it's another player's turn. Also, even when it's the local player's turn, a unit is not necessarily selected. The unit that is selected to act (if there is one) is not necessarily the same as the one open in the unit display.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a phase display using the standard skin settings for phase displays.protectedAbstractPhaseDisplay(IClientGUI cg, String panelSkin, String buttonSkin) Creates a phase display using the given skin settings for the button panel and the buttons. -
Method Summary
Modifier and TypeMethodDescriptionvoidSent when Hex is highlighted.voidSent when moving units is finished.voidSent when firstLOS is set.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidSent when BoardView 'cursor' is set to Hex.voidSent when user clicks, double clicks or drags hex.voidSent when Hex is selected through a call to the select method (this is not a mouse click event, although many mouse clicks lead to the hex being selected).final booleanprotected booleanisMyTurn()abstract voidready()Tells the display to finish the current player turn and send all planned actions to the server.voidSent when secondLOS is set.protected voidsendDone()Sends a Done packet to the server.final voidsetIgnoringEvents(boolean isDistracted) Specify if the listener should be distracted.voidSent when Unit is selected.Methods inherited from class megamek.client.ui.widget.SkinnedJPanel
paintComponentMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, 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, updateMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.util.Distractable
removeAllListenersMethods inherited from interface megamek.common.event.GameListener
gamePlayerStrategicAction, gamePollChange, gameScriptedEvent, gameToast, gameUnitChange
-
Field Details
-
DONE_BUTTON_WIDTH
public static final int DONE_BUTTON_WIDTH- See Also:
-
butDone
-
-
Constructor Details
-
AbstractPhaseDisplay
Creates a phase display using the standard skin settings for phase displays.- Parameters:
cg- The IClientGUI parent of this display
-
AbstractPhaseDisplay
Creates a phase display using the given skin settings for the button panel and the buttons.- Parameters:
cg- The IClientGUI parent of this display- See Also:
-
-
Method Details
-
isIgnoringEvents
public final boolean isIgnoringEvents()- Specified by:
isIgnoringEventsin interfaceDistractable- Returns:
- true if the listener is currently distracted, i.e. ignoring events.
-
setIgnoringEvents
public final void setIgnoringEvents(boolean isDistracted) Description copied from interface:DistractableSpecify if the listener should be distracted. An event that occurs while the listener is distracted is completely ignored, i.e. it is not processed, neither when it arrives nor at any later point.- Specified by:
setIgnoringEventsin interfaceDistractable- Parameters:
isDistracted- true if the listener should ignore events, false if the listener should pay attention
-
ready
public abstract void ready()Tells the display to finish the current player turn and send all planned actions to the server. Planned actions are e.g. movement, attacks or deployment. Usually, the planned actions are all actions that, together, make up a single unit's turn, e.g. all weapon attacks of one unit. -
getClientGUI
-
getButDone
-
sendDone
protected void sendDone()Sends a Done packet to the server. Shortcut for clientGUI.getClient().sendDone(true).- See Also:
-
isMyTurn
protected boolean isMyTurn()- Returns:
- True when the client determines that it is the local player's turn to act. Shortcut to clientGUI.getClient().isMyTurn().
-
hexMoused
Description copied from interface:BoardViewListenerSent when user clicks, double clicks or drags hex.- Specified by:
hexMousedin interfaceBoardViewListener- Parameters:
b- an event
-
hexSelected
Description copied from interface:BoardViewListenerSent when Hex is selected through a call to the select method (this is not a mouse click event, although many mouse clicks lead to the hex being selected).- Specified by:
hexSelectedin interfaceBoardViewListener- Parameters:
b- The select event- See Also:
-
hexCursor
Description copied from interface:BoardViewListenerSent when BoardView 'cursor' is set to Hex.- Specified by:
hexCursorin interfaceBoardViewListener- Parameters:
b- an event
-
boardHexHighlighted
Description copied from interface:BoardViewListenerSent when Hex is highlighted.- Specified by:
boardHexHighlightedin interfaceBoardViewListener- Parameters:
b- an event
-
firstLOSHex
Description copied from interface:BoardViewListenerSent when firstLOS is set.- Specified by:
firstLOSHexin interfaceBoardViewListener- Parameters:
b- an event
-
secondLOSHex
Description copied from interface:BoardViewListenerSent when secondLOS is set.- Specified by:
secondLOSHexin interfaceBoardViewListener- Parameters:
b- an event
-
finishedMovingUnits
Description copied from interface:BoardViewListenerSent when moving units is finished.- Specified by:
finishedMovingUnitsin interfaceBoardViewListener- Parameters:
b- an event
-
unitSelected
Description copied from interface:BoardViewListenerSent when Unit is selected.- Specified by:
unitSelectedin interfaceBoardViewListener- Parameters:
b- an event
-
gamePlayerConnected
- Specified by:
gamePlayerConnectedin interfaceGameListener
-
gamePlayerDisconnected
- Specified by:
gamePlayerDisconnectedin interfaceGameListener
-
gamePlayerChange
- Specified by:
gamePlayerChangein interfaceGameListener
-
gamePlayerChat
- Specified by:
gamePlayerChatin interfaceGameListener
-
gamePhaseChange
- Specified by:
gamePhaseChangein interfaceGameListener
-
gameTurnChange
- Specified by:
gameTurnChangein interfaceGameListener
-
gameReport
- Specified by:
gameReportin interfaceGameListener
-
gameEnd
- Specified by:
gameEndin interfaceGameListener
-
gameBoardNew
- Specified by:
gameBoardNewin interfaceGameListener
-
gameBoardChanged
- Specified by:
gameBoardChangedin interfaceGameListener
-
gameSettingsChange
- Specified by:
gameSettingsChangein interfaceGameListener
-
gameMapQuery
- Specified by:
gameMapQueryin interfaceGameListener
-
gameEntityNew
- Specified by:
gameEntityNewin interfaceGameListener
-
gameEntityNewOffboard
- Specified by:
gameEntityNewOffboardin interfaceGameListener
-
gameEntityRemove
- Specified by:
gameEntityRemovein interfaceGameListener
-
gameEntityChange
- Specified by:
gameEntityChangein interfaceGameListener
-
gameNewAction
- Specified by:
gameNewActionin interfaceGameListener
-
gameClientFeedbackRequest
- Specified by:
gameClientFeedbackRequestin interfaceGameListener
-
gameVictory
- Specified by:
gameVictoryin interfaceGameListener
-