Package gov.nih.mipav.view.renderer
Class MouseEventVector
- java.lang.Object
-
- gov.nih.mipav.view.renderer.MouseEventVector
-
- All Implemented Interfaces:
java.io.Serializable
public class MouseEventVector extends java.lang.Object implements java.io.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description boolean
first
First time accessed.int
mode
Current mode.java.util.Vector
mouseEvents
Vector to record mouse events.java.lang.String
name
Name of the events.private static long
serialVersionUID
Use serialVersionUID for interoperability.java.lang.Object
state
State being recorded.java.util.Vector
stateVector
Vector to record state changes.double[]
view
Parent frame transform3D view.
-
Constructor Summary
Constructors Constructor Description MouseEventVector(java.lang.String name, double[] view, boolean first, java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Object event)
Adds a new mouse event to the end of the mouseEvents vector.void
add(java.lang.Object event, java.lang.Object state)
Adds a new mouse event to the end of the mouseEvents vector.int
getMode()
Returns the mouse pointer mode at the beginning of events.java.util.Vector
getMouseEvents()
Returns the mouse events vector.java.lang.String
getName()
Returns the current vector title name.java.lang.Object
getState()
Returns the state at the beginning of events.java.util.Vector
getStateVector()
Returns the state vector.double[]
getView()
Returns the view stored in this structure.boolean
isFirst()
Returns flag indicating if this is the first mouse event vector in a series.private void
readObject(java.io.ObjectInputStream stream)
Called by some native invokeMethod.void
setMode(int _mode)
Set the mode at the beginning of the vector array.void
setName(java.lang.String _name)
Set the current vector title name.void
setState(java.lang.Object _state)
Set the state at the beginning of vector array.void
setView(double[] _view)
Set the current vector view - transform3D object.private void
writeObject(java.io.ObjectOutputStream stream)
Called by some native invokeMethod.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
first
public boolean first
First time accessed.
-
mode
public int mode
Current mode.
-
mouseEvents
public java.util.Vector mouseEvents
Vector to record mouse events.
-
name
public java.lang.String name
Name of the events.
-
state
public java.lang.Object state
State being recorded.
-
stateVector
public java.util.Vector stateVector
Vector to record state changes.
-
view
public double[] view
Parent frame transform3D view.
-
-
Constructor Detail
-
MouseEventVector
public MouseEventVector(java.lang.String name, double[] view, boolean first, java.lang.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 usetrue
otherwise, usefalse
.state
- The state being recorded.mode
- Current mode.
-
-
Method Detail
-
add
public void add(java.lang.Object event)
Adds a new mouse event to the end of the mouseEvents vector.- Parameters:
event
- Event to add.
-
add
public void add(java.lang.Object event, java.lang.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 java.util.Vector getMouseEvents()
Returns the mouse events vector.- Returns:
- Vector containing all the mouse events that happened after (and including) the mousePressed event.
-
getName
public java.lang.String getName()
Returns the current vector title name.- Returns:
- name The name.
-
getState
public java.lang.Object getState()
Returns the state at the beginning of events.- Returns:
- state The state.
-
getStateVector
public java.util.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, otherwisefalse
.
-
setMode
public void setMode(int _mode)
Set the mode at the beginning of the vector array.- Parameters:
_mode
- The mode
-
setName
public void setName(java.lang.String _name)
Set the current vector title name.- Parameters:
_name
- The name.
-
setState
public void setState(java.lang.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(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.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:
java.io.IOException
- DOCUMENT ME!java.lang.ClassNotFoundException
- DOCUMENT ME!
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.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:
java.io.IOException
- DOCUMENT ME!
-
-