megamek.client.ui.AWT
Class Ruler

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by megamek.client.ui.AWT.Ruler
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, BoardViewListener

public class Ruler
extends java.awt.Dialog
implements BoardViewListener

Title: Ruler

Description:

Version:
1.0
Author:
Ken Nguyen (kenn)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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)  java.awt.Button butClose
           
(package private)  java.awt.Button butFlip
           
static java.awt.Color color1
           
static java.awt.Color color2
           
(package private)  java.awt.GridBagLayout gridBagLayout1
           
(package private)  java.awt.TextField height1
           
(package private)  java.awt.TextField height2
           
(package private)  java.awt.Label heightLabel1
           
(package private)  java.awt.Label heightLabel2
           
(package private)  java.awt.Label jLabel1
           
(package private)  java.awt.Label jLabel2
           
(package private)  java.awt.Label jLabel3
           
(package private)  java.awt.Label jLabel4
           
(package private)  java.awt.Label jLabel5
           
(package private)  java.awt.Panel panel1
           
(package private)  java.awt.TextField tf_distance
           
(package private)  java.awt.TextField tf_end
           
(package private)  java.awt.TextField tf_los1
           
(package private)  java.awt.TextField tf_los2
           
(package private)  java.awt.TextField tf_start
           
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
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
Ruler(java.awt.Frame f, Client c, IBoardView b)
           
 
Method Summary
 void addPoint(Coords c)
           
 void boardChangedEntity(BoardViewEvent b)
           
 void boardHexHighlighted(BoardViewEvent b)
          Sent when Hex is highlighted.
 void boardNewAttack(BoardViewEvent a)
           
(package private)  LosEffects.AttackInfo buildAttackInfo(Coords c1, Coords c2, int h1, int h2)
          Ignores determining if the attack is on land or under water.
(package private)  void butClose_actionPerformed(java.awt.event.ActionEvent e)
           
(package private)  void butFlip_actionPerformed(java.awt.event.ActionEvent e)
           
(package private)  void cancel()
           
 void clear()
           
 void finishedMovingUnits(BoardViewEvent b)
          Sent when moving units is finished.
 void firstLOSHex(BoardViewEvent b)
          Sent when firstLOS is set.
 int getDistance()
           
 Coords getEnd()
           
 Coords getStart()
           
(package private)  void height1_keyReleased(java.awt.event.KeyEvent e)
           
(package private)  void height2_keyReleased(java.awt.event.KeyEvent e)
           
 void hexCursor(BoardViewEvent b)
          Sent when BoardView 'cursor' is set to Hex.
 void hexMoused(BoardViewEvent b)
          Sent when user clicks, double clicks or drags hex.
 void hexSelected(BoardViewEvent b)
          Sent when Hex is selected.
(package private)  void jbInit()
           
protected  void processWindowEvent(java.awt.event.WindowEvent e)
           
 void secondLOSHex(BoardViewEvent b, Coords c)
          Sent when secondLOS is set.
 void setDistance(int distance)
           
 void setEnd(Coords end)
           
 void setStart(Coords start)
           
 void setText()
           
 void unitSelected(BoardViewEvent b)
          Sent when Unit is selected.
 boolean valid()
           
 
Methods inherited from class java.awt.Dialog
addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, 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, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, 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, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, 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

color1

public static java.awt.Color color1

color2

public static java.awt.Color color2

panel1

java.awt.Panel panel1

gridBagLayout1

java.awt.GridBagLayout gridBagLayout1

butFlip

java.awt.Button butFlip

jLabel1

java.awt.Label jLabel1

tf_start

java.awt.TextField tf_start

jLabel2

java.awt.Label jLabel2

tf_end

java.awt.TextField tf_end

jLabel3

java.awt.Label jLabel3

tf_distance

java.awt.TextField tf_distance

jLabel4

java.awt.Label jLabel4

tf_los1

java.awt.TextField tf_los1

jLabel5

java.awt.Label jLabel5

tf_los2

java.awt.TextField tf_los2

butClose

java.awt.Button butClose

heightLabel1

java.awt.Label heightLabel1

height1

java.awt.TextField height1

heightLabel2

java.awt.Label heightLabel2

height2

java.awt.TextField height2
Constructor Detail

Ruler

public Ruler(java.awt.Frame f,
             Client c,
             IBoardView b)
Method Detail

jbInit

void jbInit()
      throws java.lang.Exception
Throws:
java.lang.Exception

processWindowEvent

protected void processWindowEvent(java.awt.event.WindowEvent e)
Overrides:
processWindowEvent in class java.awt.Window

cancel

void cancel()

getStart

public Coords getStart()

setStart

public void setStart(Coords start)

setEnd

public void setEnd(Coords end)

getEnd

public Coords getEnd()

clear

public void clear()

addPoint

public void addPoint(Coords c)

setText

public void setText()

buildAttackInfo

LosEffects.AttackInfo buildAttackInfo(Coords c1,
                                      Coords c2,
                                      int h1,
                                      int h2)
Ignores determining if the attack is on land or under water.

Parameters:
c1 -
c2 -
h1 -
h2 -
Returns:

valid

public boolean valid()

setDistance

public void setDistance(int distance)

getDistance

public int getDistance()

hexMoused

public void hexMoused(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when user clicks, double clicks or drags hex.

Specified by:
hexMoused in interface BoardViewListener
Parameters:
b - an event

hexCursor

public void hexCursor(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when BoardView 'cursor' is set to Hex.

Specified by:
hexCursor in interface BoardViewListener
Parameters:
b - an event

boardHexHighlighted

public void boardHexHighlighted(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when Hex is highlighted.

Specified by:
boardHexHighlighted in interface BoardViewListener
Parameters:
b - an event

hexSelected

public void hexSelected(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when Hex is selected.

Specified by:
hexSelected in interface BoardViewListener
Parameters:
b - an event

firstLOSHex

public void firstLOSHex(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when firstLOS is set.

Specified by:
firstLOSHex in interface BoardViewListener
Parameters:
b - an event

secondLOSHex

public void secondLOSHex(BoardViewEvent b,
                         Coords c)
Description copied from interface: BoardViewListener
Sent when secondLOS is set.

Specified by:
secondLOSHex in interface BoardViewListener
Parameters:
b - an event

butFlip_actionPerformed

void butFlip_actionPerformed(java.awt.event.ActionEvent e)

butClose_actionPerformed

void butClose_actionPerformed(java.awt.event.ActionEvent e)

height1_keyReleased

void height1_keyReleased(java.awt.event.KeyEvent e)

height2_keyReleased

void height2_keyReleased(java.awt.event.KeyEvent e)

boardChangedEntity

public void boardChangedEntity(BoardViewEvent b)

boardNewAttack

public void boardNewAttack(BoardViewEvent a)

finishedMovingUnits

public void finishedMovingUnits(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when moving units is finished.

Specified by:
finishedMovingUnits in interface BoardViewListener
Parameters:
b - an event

unitSelected

public void unitSelected(BoardViewEvent b)
Description copied from interface: BoardViewListener
Sent when Unit is selected.

Specified by:
unitSelected in interface BoardViewListener
Parameters:
b - an event