Package mekhq.gui
Class StratConPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
mekhq.gui.StratConPanel
- All Implemented Interfaces:
- ActionListener,- ImageObserver,- MenuContainer,- Serializable,- EventListener,- Accessible
This panel handles AtB-StratCon GUI interactions with a specific scenario track.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class javax.swing.JPanelJPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ContainerContainer.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFieldsFields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructorsConstructorDescriptionStratConPanel(CampaignGUI gui, JLabel infoArea) Constructs a StratConPanel instance, given a parent campaign GUI and a pointer to an info area.
- 
Method SummaryModifier and TypeMethodDescriptionvoidHandles action events triggered by various StratCon-related commands from the right-click context menu.booleanvoidEvent handler for when a mouse button is released.voidRenders the panel, hexes, forces, facilities and all that.voidselectTrack(StratConCampaignState campaignState, StratConTrackState track) Handler for when a specific track is selected - switches rendering to that track.voidsetCommitForces(boolean commitForces) voidvoidsetSelectedCoords(StratConCoords coords) Methods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponentaddAncestorListener, 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, 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.Containeradd, 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.Componentaction, 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 Details- 
HEX_X_RADIUSpublic static final int HEX_X_RADIUS- See Also:
 
- 
HEX_Y_RADIUSpublic static final int HEX_Y_RADIUS- See Also:
 
 
- 
- 
Constructor Details- 
StratConPanelConstructs a StratConPanel instance, given a parent campaign GUI and a pointer to an info area.
 
- 
- 
Method Details- 
getStratConScenarioWizard
- 
getAssignmentUI
- 
selectTrackHandler for when a specific track is selected - switches rendering to that track.
- 
paintComponentRenders the panel, hexes, forces, facilities and all that.- Overrides:
- paintComponentin class- JComponent
 
- 
mouseReleasedHandlerEvent handler for when a mouse button is released.
- 
getSelectedScenario
- 
getCurrentTrack
- 
setCurrentTrack
- 
getSelectedCoords
- 
setSelectedCoords
- 
actionPerformedHandles action events triggered by various StratCon-related commands from the right-click context menu. This method processes user interactions to update the game state, scenarios, facilities, and UI elements based on the selected command and inputs from the context menu.The supported commands and their effects are as follows: - RIGHT_CLICK_COMMAND_MANAGE_FORCES: Displays the force management UI for the selected coordinates.- If no scenario exists at the selected coordinates, the force management UI is directly displayed.
- If a scenario exists, it only displays the UI if the scenario is unresolved.
 
- RIGHT_CLICK_COMMAND_MANAGE_SCENARIO: Displays the scenario wizard with the current scenario at the selected coordinates if the scenario's state is- PRIMARY_FORCES_COMMITTED.
- RIGHT_CLICK_COMMAND_REVEAL_TRACK: Toggles the "GM revealed" state for the current track and updates the menu text to reflect the state ("Hide Track" or "Reveal Track").
- RIGHT_CLICK_COMMAND_STICKY_FORCE: Toggles the sticky force assignment for a given force ID at the selected track. When toggled:
- -- If selected, the force is added to the track as sticky.
- -- If deselected, the force is removed from the track's sticky forces.
- RIGHT_CLICK_COMMAND_REMOVE_FACILITY: Deletes the facility present at the selected coordinates.
- RIGHT_CLICK_COMMAND_CAPTURE_FACILITY: Changes the ownership of the facility at the selected coordinates to a different faction or player, as per the rules defined in- StratConRulesManager.
- RIGHT_CLICK_COMMAND_ADD_FACILITY: Adds a new facility to the selected coordinates. The facility's properties (visibility, type, etc.) are copied from the provided source facility.
- RIGHT_CLICK_COMMAND_REMOVE_SCENARIO: Deletes the currently selected scenario from the campaign.
 - Specified by:
- actionPerformedin interface- ActionListener
- Parameters:
- evt- the- ActionEventrepresenting the user's action. Contains information about the triggering source and command (e.g., which menu item was selected).- Behavior: - The method retrieves the StratConCoordscurrently selected by the user, and performs actions based on the provided command string in the event.
- The scenarios, forces, and facilities of the currentTrackare modified based on the command type, and updates are visually reflected in the UI.
- If a UI-related command is processed (e.g., displaying the scenario wizard or force assignment UI), the appropriate UI components are updated and made visible to the user.
 - General Information: If no valid - StratConCoordsare selected at the time of the event, the method will terminate with no further action. Certain commands (e.g.,- RIGHT_CLICK_COMMAND_REVEAL_TRACK,- RIGHT_CLICK_COMMAND_ADD_FACILITY) require valid coordinates or source properties to execute successfully.- If no specific actions from the above list are matched (no corresponding `case`), the method performs no effect. 
- The method retrieves the 
 
- 
getPreferredSize- Overrides:
- getPreferredSizein class- JComponent
 
- 
isCommitForcespublic boolean isCommitForces()
- 
setCommitForcespublic void setCommitForces(boolean commitForces) 
 
-