megamek.client.ui.AWT
Class BoardEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by megamek.client.ui.AWT.BoardEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.TextListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, IMapSettingsObserver

public class BoardEditor
extends java.awt.Container
implements java.awt.event.ItemListener, java.awt.event.ActionListener, java.awt.event.TextListener, IMapSettingsObserver

The BoardEditor class is a

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  IBoard board
           
(package private)  BoardView1 bv
           
(package private)  IHex curHex
          The current working hex.
(package private)  java.awt.Frame frame
           
(package private)  Coords lastClicked
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BoardEditor()
          Creates and lays out a new Board Editor frame.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
           
 void addToHex(Coords c)
          Apply the current Hex to the Board at the specified location.
 void boardLoad()
          Selects and loads a file into the BoardEditor.
 void boardNew()
           
 void boardNewXX()
          Initialize a new data set in the current board.
 void boardSave()
          Checks to see if there is already a path and name stored; if not, calls "save as"; otherwise, saves the board to the specified file.
 void boardSaveAs()
          Opens a file dialog box to select a file to save as; saves the board to the file.
 void boardSaveAsImage()
          Opens a file dialog box to select a file to save as; saves the board to the file as an image.
 void boardSaveImage()
          Saves the board in PNG image format.
 java.awt.Frame getFrame()
           
 void itemStateChanged(java.awt.event.ItemEvent ie)
           
 void paintHex(Coords c)
          Apply the current Hex to the Board at the specified location.
 void refreshTerrainList()
          Refreshes the terrain list to match the current hex
 void resurfaceHex(Coords c)
          Apply the current Hex to the Board at the specified location.
 void setCurrentHex(IHex hex)
          Sets the current hex
 void setMapVisible(boolean visible)
          Sets if the map is visible or not.
 void textValueChanged(java.awt.event.TextEvent te)
           
 void toggleMap()
          Toggles the minimap window Also, toggles the minimap enabled setting
 void updateMapSettings(MapSettings newSettings)
          Updates the map settings.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

frame

final java.awt.Frame frame

board

IBoard board

bv

BoardView1 bv

curHex

IHex curHex
The current working hex.


lastClicked

Coords lastClicked
Constructor Detail

BoardEditor

public BoardEditor()
Creates and lays out a new Board Editor frame.

Method Detail

paintHex

public void paintHex(Coords c)
Apply the current Hex to the Board at the specified location.

Parameters:
c - the location.

resurfaceHex

public void resurfaceHex(Coords c)
Apply the current Hex to the Board at the specified location.

Parameters:
c - the location in , Coords .

addToHex

public void addToHex(Coords c)
Apply the current Hex to the Board at the specified location.

Parameters:
c - the location in , Coords .

setCurrentHex

public void setCurrentHex(IHex hex)
Sets the current hex

Parameters:
hex - hex to set.

refreshTerrainList

public void refreshTerrainList()
Refreshes the terrain list to match the current hex


boardNewXX

public void boardNewXX()
Initialize a new data set in the current board. If hexes are loaded, brings up a dialog box requesting width and height and default hex. If height and width are valid, creates new board data and fills it with the selected hex.


boardNew

public void boardNew()

updateMapSettings

public void updateMapSettings(MapSettings newSettings)
Updates the map settings.

Specified by:
updateMapSettings in interface IMapSettingsObserver
Parameters:
newSettings - the new settings.

boardLoad

public void boardLoad()
Selects and loads a file into the BoardEditor. Called when the user selects load file.


boardSave

public void boardSave()
Checks to see if there is already a path and name stored; if not, calls "save as"; otherwise, saves the board to the specified file.


boardSaveImage

public void boardSaveImage()
Saves the board in PNG image format.


boardSaveAs

public void boardSaveAs()
Opens a file dialog box to select a file to save as; saves the board to the file.


boardSaveAsImage

public void boardSaveAsImage()
Opens a file dialog box to select a file to save as; saves the board to the file as an image. Useful for printing boards.


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent ie)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
ie - the ItemEvent
See Also:
ItemListener

textValueChanged

public void textValueChanged(java.awt.event.TextEvent te)
Specified by:
textValueChanged in interface java.awt.event.TextListener
Parameters:
te - the TextEvent
See Also:
TextListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getFrame

public java.awt.Frame getFrame()
Returns:
the frame this is displayed in

toggleMap

public void toggleMap()
Toggles the minimap window Also, toggles the minimap enabled setting


setMapVisible

public void setMapVisible(boolean visible)
Sets if the map is visible or not.

Parameters:
visible - true if the map should be visible, false if not.