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 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
ConstructorsConstructorDescriptionStratConPanel(CampaignGUI gui, JLabel infoArea) Constructs a StratConPanel instance, given a parent campaign GUI and a pointer to an info area. -
Method Summary
Modifier and TypeMethodDescriptionvoidHandles action events triggered by StratCon commands from the right-click context menu, dispatching on the event's action command.voidLeaves paint mode, restoring normal selection and panning.getTerrainImage(String terrainType) booleanNamed for the terrain brush rather thanisPainting, which would sit confusingly beside the package-privateJComponent.isPaintingthis panel inherits but cannot override - a reader inside the painting code would have no way to tell the two apart.voidEvent handler for when a mouse button is released.voidopenDeploymentWizard(StratConCampaignState campaignState, StratConScenario scenario) Opens the redesigned deployment wizard for the currently selected hex, on the page appropriate to the scenario's state: the Primary page for a bare hex or an unresolved scenario (deploying primary forces), or the Reinforce page for a scenario whose primary forces are already committed (managing reinforcements, auxiliaries, and utility).voidGM tool: opens the terrain palette, putting the map into paint mode until the palette is closed.voidRenders the panel, hexes, forces, facilities and all that.voidGM tool: clears the current sector and regenerates its terrain (and cities/roads), then repaints.voidGM tool: un-reveals every hex in the current sector so scouting can be re-tested, then repaints.voidGM tool: prompts for new sector dimensions and applies them, growing or shrinking at the right and bottom edges.voidScouts (permanently reveals) every hex in the currently selected sector, then repaints.voidselectTrack(StratConCampaignState campaignState, StratConTrackState track) Handler for when a specific track is selected - switches rendering to that track.voidvoidsetPaintBrushRadius(int radius) Sets the brush radius in hexes: 0 paints a single hex, 1 paints it and its neighbors, and so on.voidsetPaintTerrain(String terrain) Sets the terrain the brush lays down.voidsetSelectedCoords(StratConCoords coords) voidToggles the current sector's "GM revealed" state, which shows or hides otherwise-hidden objects (cloaked scenarios, invisible facilities, and unscouted hexes).Methods 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, 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, transferFocusUpCycle
-
Field Details
-
HEX_X_RADIUS
public static final int HEX_X_RADIUS- See Also:
-
HEX_Y_RADIUS
public static final int HEX_Y_RADIUS- See Also:
-
-
Constructor Details
-
StratConPanel
Constructs a StratConPanel instance, given a parent campaign GUI and a pointer to an info area.
-
-
Method Details
-
selectTrack
Handler for when a specific track is selected - switches rendering to that track. -
scoutCurrentSector
public void scoutCurrentSector()Scouts (permanently reveals) every hex in the currently selected sector, then repaints. Unlike the GM sector reveal, this marks the hexes as revealed, so their contents stay visible afterward - and, as with real scouting, every point of interest found is revealed and its type's reveal hook fires. -
regenerateCurrentSector
public void regenerateCurrentSector()GM tool: clears the current sector and regenerates its terrain (and cities/roads), then repaints. Scenarios, facilities, and assigned forces are left in place. -
openTerrainPaintDialog
public void openTerrainPaintDialog()GM tool: opens the terrain palette, putting the map into paint mode until the palette is closed. -
resizeSector
public void resizeSector()GM tool: prompts for new sector dimensions and applies them, growing or shrinking at the right and bottom edges. Warns first when the new size would displace anything. -
setPaintTerrain
Sets the terrain the brush lays down. Called by the terrain palette. -
setPaintBrushRadius
public void setPaintBrushRadius(int radius) Sets the brush radius in hexes: 0 paints a single hex, 1 paints it and its neighbors, and so on. -
isPaintingTerrain
public boolean isPaintingTerrain()Named for the terrain brush rather thanisPainting, which would sit confusingly beside the package-privateJComponent.isPaintingthis panel inherits but cannot override - a reader inside the painting code would have no way to tell the two apart.- Returns:
truewhile the terrain palette is open and clicks paint rather than select.
-
exitPaintMode
public void exitPaintMode()Leaves paint mode, restoring normal selection and panning. Called when the terrain palette closes. -
getTerrainImage
- Returns:
- the map sprite for a terrain type, for the terrain palette to render alongside the name.
-
resetSectorFog
public void resetSectorFog()GM tool: un-reveals every hex in the current sector so scouting can be re-tested, then repaints. Open water is re-revealed, since it never holds fog of war. Points of interest are hidden again too, so they can be found afresh. -
toggleHiddenObjects
public void toggleHiddenObjects()Toggles the current sector's "GM revealed" state, which shows or hides otherwise-hidden objects (cloaked scenarios, invisible facilities, and unscouted hexes). Formerly the "Reveal/Hide Sector" right-click item. -
paintComponent
Renders the panel, hexes, forces, facilities and all that.- Overrides:
paintComponentin classJComponent
-
mouseReleasedHandler
Event handler for when a mouse button is released. -
getSelectedScenario
-
getCurrentTrack
-
setCurrentTrack
-
getSelectedCoords
-
setSelectedCoords
-
openDeploymentWizard
public void openDeploymentWizard(StratConCampaignState campaignState, @Nullable StratConScenario scenario) Opens the redesigned deployment wizard for the currently selected hex, on the page appropriate to the scenario's state: the Primary page for a bare hex or an unresolved scenario (deploying primary forces), or the Reinforce page for a scenario whose primary forces are already committed (managing reinforcements, auxiliaries, and utility). Official challenges restrict the primary pick to a single force.A single wizard instance is reused, so repeatedly choosing "Manage Deployment" re-shows and re-populates the same window instead of stacking new ones.
- Parameters:
campaignState- the current StratCon campaign statescenario- the scenario on the selected hex, ornullif there is none- Since:
- 0.51.01
-
actionPerformed
Handles action events triggered by StratCon commands from the right-click context menu, dispatching on the event's action command. Each command reads the currently selectedStratConCoordsand updates thecurrentTrack's scenarios, forces, facilities, or cities accordingly, then repaints. If no hex is selected, or the command matches no case, the method does nothing.The supported commands are:
MANAGE_FORCES/MANAGE_SCENARIO- open the deployment wizard viaopenDeploymentWizard(mekhq.campaign.digitalGM.stratCon.StratConCampaignState, mekhq.campaign.digitalGM.stratCon.StratConScenario), on the Primary page (bare hex or unresolved scenario) or the Reinforce page (committed scenario) as appropriate.STICKY_FORCE- toggles whether a force remains deployed on the track.REMOVE_FACILITY/CAPTURE_FACILITY/ADD_FACILITY- GM facility edits. Adding or removing a facility recomputes roads; capturing deliberately does not.ADD_CITY/REMOVE_CITY- GM city edits, each recomputing roads.ADD_POINT_OF_INTEREST/REMOVE_POINT_OF_INTEREST/TOGGLE_POINT_OF_INTEREST_REVEALED/SET_POINT_OF_INTEREST_OWNER/RESOLVE_POINT_OF_INTEREST- GM point of interest edits. Points of interest do not affect roads, so none of these recomputes them.REMOVE_SCENARIO- removes the selected scenario from the campaign.RESET_DEPLOYMENT- resets the selected scenario.
- Specified by:
actionPerformedin interfaceActionListener- Parameters:
evt- the triggering action event; its action command selects the branch and its source carries any per-item data (e.g. the sticky force ID or the facility to add)
-
getPreferredSize
- Overrides:
getPreferredSizein classJComponent
-