Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer.util.stateMachine
Class State

    java.lang.Object
      com.bbn.openmap.layer.util.stateMachine.State

All Implemented Interfaces:
  java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ComponentListener, java.awt.event.ContainerListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, MapMouseListener, java.awt.event.TextListener, java.awt.event.WindowListener

Direct Known Subclasses:
  GraphicEditState, GraphicSelectedState, GraphicSetOffsetState, GraphicUndefinedState, GraphicUnselectedState, PolyAddNodeState, PolyAddPointState, PolyDeleteNodeState

public abstract class State
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ComponentListener, java.awt.event.ContainerListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, MapMouseListener, java.awt.event.TextListener, java.awt.event.WindowListener

The state is intended to be a abstract juncture in a pattern of events. The idea is that for a given state, an event will call a unique response. This class lets you define this juncture, and can be used as a Java adapter to define only the listener responses you care about. The state, as defined in your implementation, can reset the StateMachine to it's new state after it responds to an event.

Since this state machine can be used in OpenMap, the Mouse/MouseMotion Listeners are MapMouseListeners. This is to let OpenMap know not to send the result on to other layers that like to hear about events. This State class has a setting on how you want the unused MapMouseListener functions to respond to events. The default is false, and this means that other layers will have a chance to respond to events. If you want other layer's event reception to pause a little, set the mapMouseListenerResponse to true.

Field Summary
`protected I18n` | `i18n` To read local settings

Constructor Summary
`State()`

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent e)`
`void` | `adjustmentValueChanged(java.awt.event.AdjustmentEvent e)`
`void` | `componentAdded(java.awt.event.ContainerEvent e)`
`void` | `componentHidden(java.awt.event.ComponentEvent e)`
`void` | `componentMoved(java.awt.event.ComponentEvent e)`
`void` | `componentRemoved(java.awt.event.ContainerEvent e)`
`void` | `componentResized(java.awt.event.ComponentEvent e)`
`void` | `componentShown(java.awt.event.ComponentEvent e)`
`void` | `focusGained(java.awt.event.FocusEvent e)`
`void` | `focusLost(java.awt.event.FocusEvent e)`
`boolean` | `getMapMouseListenerResponse()` Get the value of the default response to MapMouseListener methods.
`java.lang.String[]` | `getMouseModeServiceList()` Return a list of the modes that are interesting to the MapMouseListener.
`void` | `itemStateChanged(java.awt.event.ItemEvent e)`
`void` | `keyPressed(java.awt.event.KeyEvent e)`
`void` | `keyReleased(java.awt.event.KeyEvent e)`
`void` | `keyTyped(java.awt.event.KeyEvent e)`
`boolean` | `mouseClicked(java.awt.event.MouseEvent e)` Invoked when the mouse has been clicked on a component.
`boolean` | `mouseDragged(java.awt.event.MouseEvent e)` Invoked when a mouse button is pressed on a component and then dragged.
`void` | `mouseEntered(java.awt.event.MouseEvent e)` Invoked when the mouse enters a component.
`void` | `mouseExited(java.awt.event.MouseEvent e)` Invoked when the mouse exits a component.
`void` | `mouseMoved()` Handle a mouse cursor moving without the button being pressed.
`boolean` | `mouseMoved(java.awt.event.MouseEvent e)` Invoked when the mouse button has been moved on a component (with no buttons down).
`boolean` | `mousePressed(java.awt.event.MouseEvent e)` Invoked when a mouse button has been pressed on a component.
`boolean` | `mouseReleased(java.awt.event.MouseEvent e)` Invoked when a mouse button has been released on a component.
`void` | `setMapMouseListenerResponse(boolean value)` Set the MapMouseListener method default response value.
`void` | `textValueChanged(java.awt.event.TextEvent e)`
`void` | `windowActivated(java.awt.event.WindowEvent e)`
`void` | `windowClosed(java.awt.event.WindowEvent e)`
`void` | `windowClosing(java.awt.event.WindowEvent e)`
`void` | `windowDeactivated(java.awt.event.WindowEvent e)`
`void` | `windowDeiconified(java.awt.event.WindowEvent e)`
`void` | `windowIconified(java.awt.event.WindowEvent e)`
`void` | `windowOpened(java.awt.event.WindowEvent e)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### i18n

    protected I18n i18n

  To read local settings

Constructor Detail

### State

    public State()

Method Detail

### setMapMouseListenerResponse

    public void setMapMouseListenerResponse(boolean value)

  Set the MapMouseListener method default response value. If value is true, other layers on the map will not receive mouse events.

### getMapMouseListenerResponse

    public boolean getMapMouseListenerResponse()

  Get the value of the default response to MapMouseListener methods.

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`

### adjustmentValueChanged

    public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)

  Specified by:
    `adjustmentValueChanged` in interface `java.awt.event.AdjustmentListener`

### componentResized

    public void componentResized(java.awt.event.ComponentEvent e)

  Specified by:
    `componentResized` in interface `java.awt.event.ComponentListener`

### componentMoved

    public void componentMoved(java.awt.event.ComponentEvent e)

  Specified by:
    `componentMoved` in interface `java.awt.event.ComponentListener`

### componentShown

    public void componentShown(java.awt.event.ComponentEvent e)

  Specified by:
    `componentShown` in interface `java.awt.event.ComponentListener`

### componentHidden

    public void componentHidden(java.awt.event.ComponentEvent e)

  Specified by:
    `componentHidden` in interface `java.awt.event.ComponentListener`

### componentAdded

    public void componentAdded(java.awt.event.ContainerEvent e)

  Specified by:
    `componentAdded` in interface `java.awt.event.ContainerListener`

### componentRemoved

    public void componentRemoved(java.awt.event.ContainerEvent e)

  Specified by:
    `componentRemoved` in interface `java.awt.event.ContainerListener`

### focusGained

    public void focusGained(java.awt.event.FocusEvent e)

  Specified by:
    `focusGained` in interface `java.awt.event.FocusListener`

### focusLost

    public void focusLost(java.awt.event.FocusEvent e)

  Specified by:
    `focusLost` in interface `java.awt.event.FocusListener`

### itemStateChanged

    public void itemStateChanged(java.awt.event.ItemEvent e)

  Specified by:
    `itemStateChanged` in interface `java.awt.event.ItemListener`

### keyTyped

    public void keyTyped(java.awt.event.KeyEvent e)

  Specified by:
    `keyTyped` in interface `java.awt.event.KeyListener`

### keyPressed

    public void keyPressed(java.awt.event.KeyEvent e)

  Specified by:
    `keyPressed` in interface `java.awt.event.KeyListener`

### keyReleased

    public void keyReleased(java.awt.event.KeyEvent e)

  Specified by:
    `keyReleased` in interface `java.awt.event.KeyListener`

### getMouseModeServiceList

    public java.lang.String[] getMouseModeServiceList()

  Description copied from interface: `MapMouseListener`
  Return a list of the modes that are interesting to the MapMouseListener. The source MouseEvents will only get sent to the MapMouseListener if the mode is set to one that the listener is interested in. Layers interested in receiving events should register for receiving events in "select" mode: `

       return new String[] { SelectMouseMode.modeID };

  `

  ``
  Specified by:
    `getMouseModeServiceList` in interface `MapMouseListener`
  Returns:
    String[] of modeID's
  See Also:
    `NavMouseMode.modeID`, `SelectMouseMode.modeID`, `NullMouseMode.modeID`

### mousePressed

    public boolean mousePressed(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when a mouse button has been pressed on a component.

  Specified by:
    `mousePressed` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseReleased

    public boolean mouseReleased(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when a mouse button has been released on a component.

  Specified by:
    `mouseReleased` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseClicked

    public boolean mouseClicked(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse has been clicked on a component. The listener will receive this event if it successfully processed `mousePressed()`, or if no other listener processes the event. If the listener successfully processes `mouseClicked()`, then it will receive the next `mouseClicked()` notifications that have a click count greater than one.

  NOTE: We have noticed that this method can sometimes be erroneously invoked. It seems to occur when a light-weight AWT component (like an internal window or menu) closes (removes itself from the window hierarchy). A specific OpenMap example is when you make a menu selection when the MenuItem you select is above the MapBean canvas. After making the selection, the mouseClicked() gets invoked on the MouseDelegator, which passes it to the appropriate listeners depending on the MouseMode. The best way to avoid this problem is to not implement anything crucial in this method. Use a combination of `mousePressed()` and `mouseReleased()` instead.

  Specified by:
    `mouseClicked` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse enters a component.

  Specified by:
    `mouseEntered` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse exits a component.

  Specified by:
    `mouseExited` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent

### mouseDragged

    public boolean mouseDragged(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when a mouse button is pressed on a component and then dragged. The listener will receive these events if it successfully processes mousePressed(), or if no other listener processes the event.

  Specified by:
    `mouseDragged` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseMoved

    public boolean mouseMoved(java.awt.event.MouseEvent e)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse button has been moved on a component (with no buttons down).

  Specified by:
    `mouseMoved` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseMoved

    public void mouseMoved()

  Description copied from interface: `MapMouseListener`
  Handle a mouse cursor moving without the button being pressed. This event is intended to tell the listener that there was a mouse movement, but that the event was consumed by another layer. This will allow a mouse listener to clean up actions that might have happened because of another motion event response.

  Specified by:
    `mouseMoved` in interface `MapMouseListener`

### textValueChanged

    public void textValueChanged(java.awt.event.TextEvent e)

  Specified by:
    `textValueChanged` in interface `java.awt.event.TextListener`

### windowOpened

    public void windowOpened(java.awt.event.WindowEvent e)

  Specified by:
    `windowOpened` in interface `java.awt.event.WindowListener`

### windowClosing

    public void windowClosing(java.awt.event.WindowEvent e)

  Specified by:
    `windowClosing` in interface `java.awt.event.WindowListener`

### windowClosed

    public void windowClosed(java.awt.event.WindowEvent e)

  Specified by:
    `windowClosed` in interface `java.awt.event.WindowListener`

### windowIconified

    public void windowIconified(java.awt.event.WindowEvent e)

  Specified by:
    `windowIconified` in interface `java.awt.event.WindowListener`

### windowDeiconified

    public void windowDeiconified(java.awt.event.WindowEvent e)

  Specified by:
    `windowDeiconified` in interface `java.awt.event.WindowListener`

### windowActivated

    public void windowActivated(java.awt.event.WindowEvent e)

  Specified by:
    `windowActivated` in interface `java.awt.event.WindowListener`

### windowDeactivated

    public void windowDeactivated(java.awt.event.WindowEvent e)

  Specified by:
    `windowDeactivated` in interface `java.awt.event.WindowListener`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details