Class MouseEventVector

java.lang.Object
gov.nih.mipav.view.renderer.MouseEventVector
All Implemented Interfaces:
Serializable

public class MouseEventVector extends Object implements Serializable
This class holds the necessary information for each "mouse event" that shows up in the list. In reality, the "mouse event" listed is a vector of mouse events that begins with a mousePressed and ends with a mouseReleased. In between are mouseDragged events. In this way all events that happen on the canvas are accounted for. If we were to put every event that actually happened in the list, the list would soon contain hundreds of elements. The mouseEvents vector can be empty, as is the case when a view is saved. Then just the name and the view are saved; the vector holding mouseEvents remains empty.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    First time accessed.
    int
    Current mode.
    Vector to record mouse events.
    Name of the events.
    private static final long
    Use serialVersionUID for interoperability.
    State being recorded.
    Vector to record state changes.
    double[]
    Parent frame transform3D view.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MouseEventVector(String name, double[] view, boolean first, Object state, int mode)
    Creates a new structure to hold necessary information, with the name in the list and the beginning view saved.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Object event)
    Adds a new mouse event to the end of the mouseEvents vector.
    void
    add(Object event, Object state)
    Adds a new mouse event to the end of the mouseEvents vector.
    int
    Returns the mouse pointer mode at the beginning of events.
    Returns the mouse events vector.
    Returns the current vector title name.
    Returns the state at the beginning of events.
    Returns the state vector.
    double[]
    Returns the view stored in this structure.
    boolean
    Returns flag indicating if this is the first mouse event vector in a series.
    private void
    Called by some native invokeMethod.
    void
    setMode(int _mode)
    Set the mode at the beginning of the vector array.
    void
    setName(String _name)
    Set the current vector title name.
    void
    setState(Object _state)
    Set the state at the beginning of vector array.
    void
    setView(double[] _view)
    Set the current vector view - transform3D object.
    private void
    Called by some native invokeMethod.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • first

      public boolean first
      First time accessed.
    • mode

      public int mode
      Current mode.
    • mouseEvents

      public Vector mouseEvents
      Vector to record mouse events.
    • name

      public String name
      Name of the events.
    • state

      public Object state
      State being recorded.
    • stateVector

      public Vector stateVector
      Vector to record state changes.
    • view

      public double[] view
      Parent frame transform3D view.
  • Constructor Details

    • MouseEventVector

      public MouseEventVector(String name, double[] view, boolean first, Object state, int mode)
      Creates a new structure to hold necessary information, with the name in the list and the beginning view saved. The Vector containing the rest of the mouseEvents is also created but begins empty. Elements are added with the add method, below.
      Parameters:
      name - Name of this view or mouse event.
      view - Transform representing the view.
      first - If this is the first-time accessed use true otherwise, use false.
      state - The state being recorded.
      mode - Current mode.
  • Method Details

    • add

      public void add(Object event)
      Adds a new mouse event to the end of the mouseEvents vector.
      Parameters:
      event - Event to add.
    • add

      public void add(Object event, Object state)
      Adds a new mouse event to the end of the mouseEvents vector.
      Parameters:
      event - Event to add.
      state - State to add
    • getMode

      public int getMode()
      Returns the mouse pointer mode at the beginning of events.
      Returns:
      mode The mode.
    • getMouseEvents

      public Vector getMouseEvents()
      Returns the mouse events vector.
      Returns:
      Vector containing all the mouse events that happened after (and including) the mousePressed event.
    • getName

      public String getName()
      Returns the current vector title name.
      Returns:
      name The name.
    • getState

      public Object getState()
      Returns the state at the beginning of events.
      Returns:
      state The state.
    • getStateVector

      public Vector getStateVector()
      Returns the state vector.
      Returns:
      Vector containing all the states parallel to mouse events.
    • getView

      public double[] getView()
      Returns the view stored in this structure.
      Returns:
      The transform representing the view.
    • isFirst

      public boolean isFirst()
      Returns flag indicating if this is the first mouse event vector in a series.
      Returns:
      true if the first mouse event vector, otherwise false.
    • setMode

      public void setMode(int _mode)
      Set the mode at the beginning of the vector array.
      Parameters:
      _mode - The mode
    • setName

      public void setName(String _name)
      Set the current vector title name.
      Parameters:
      _name - The name.
    • setState

      public void setState(Object _state)
      Set the state at the beginning of vector array.
      Parameters:
      _state - The state.
    • setView

      public void setView(double[] _view)
      Set the current vector view - transform3D object.
      Parameters:
      _view - The present view transform.
    • readObject

      private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
      Called by some native invokeMethod. Provides a way to read this class out as a object stream. First, the size of the vector is read, then each mouseEvent into the vector, then the name, then the view. The view is read in as a String because it is not serializable. The read method corresponds to the write method, below.
      Parameters:
      stream - Object stream to read from.
      Throws:
      IOException - DOCUMENT ME!
      ClassNotFoundException - DOCUMENT ME!
    • writeObject

      private void writeObject(ObjectOutputStream stream) throws IOException
      Called by some native invokeMethod. Provides a way to write this class out as a object stream. First, the size of the vector is written, then each mouseEvent in the vector, then the name, then the view. The view is written out as a String because it is not serializable. The write method corresponds to the read method, above.
      Parameters:
      stream - Object stream to write to.
      Throws:
      IOException - DOCUMENT ME!