All Implemented Interfaces:
com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback, ActionListener, FocusListener, ItemListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class JPanelMousePlotter extends JPanelRendererJ3D implements MouseListener, MouseMotionListener, ChangeListener, com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
Mouse recorded dialog. Has the ability to load and save "mouse action files", which contain the information necessary to reconstruct a series of mouse actions that took place on the canvas of the Triplanar/Surface render viewer. The user can also record mouse actions, pause, stop, and play back. Play back can be done one step at a time, for the whole list, or continuously until the stop button is hit. The mouse events show up in a list. The user can also add or remove different views to this list, by pressing the "Add current" button when at a view he/she wants to save. When the "Save file" menu option is chosen, everything in the list is saved, including the different views.
Author:
Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

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

      public static final int STOP_MODE
      Recorder/Player is stopped.
      See Also:
    • RECORD_MODE

      public static final int RECORD_MODE
      Recorder/Player is recording.
      See Also:
    • PAUSE_MODE

      public static final int PAUSE_MODE
      Recorder/Player is paused.
      See Also:
    • PLAY_MODE

      public static final int PLAY_MODE
      Recorder/Player is playing.
      See Also:
    • changedMode

      boolean changedMode
      flag to indicate current mode being changed.
    • contButton

      JToggleButton contButton
      Continue play button.
    • current

      int current
      index to the item list.
    • currentEventVector

      MouseEventVectorPlotter currentEventVector
      Current event vector used by the save AVI.
    • currentObject

      Object currentObject
      current SceneState object being recorded by SaveAVI.
    • currentTransform

      javax.media.j3d.Transform3D currentTransform
      Current transform3D object used in Save AVI.
    • events

      Vector that holds mouse or change events.
    • eventVector

      Global mouse event vector.
    • first

      boolean first
      Flag to indicate first event.
    • goButton

      JButton goButton
      Go to button.
    • isPlaying

      boolean isPlaying
      Flag to indicating play mouse is running or not.
    • listModel

      DefaultListModel listModel
      List to record info for each mouse, change events.
    • mode

      int mode
      Current mode, init to stop.
    • mouseCount

      int mouseCount
      Mouse event counter.
    • movieButton

      JButton movieButton
      Save AVI button .
    • myParentPlotter

      SurfacePlotter myParentPlotter
      Reference to ViewJFrameSurfacePlotter.
    • nameChangeVector

      MouseEventVectorPlotter nameChangeVector
      Used by name change dialog to change name of the selected item.
    • newButton

      JButton newButton
      This button add at head of the list.
    • parentScene

      RenderViewBase parentScene
      Parent scene.
    • pauseButton

      JToggleButton pauseButton
      Pause button.
    • playButton

      JToggleButton playButton
      Display button.
    • playMouse

      Reference to PlayMouse class object.
    • process

      int process
      Process id used by the save AVI.
    • recordButton

      JToggleButton recordButton
      Recorder button.
    • recorderToAVI

      Reference to RecordMouse object class.
    • removeAllButton

      JButton removeAllButton
      Remove all items in the item list.
    • removeButton

      JButton removeButton
      Remove the selected item in the item list.
    • resetTransform

      javax.media.j3d.Transform3D resetTransform
      Current transform3D object.
    • sliderCount

      int sliderCount
      Slider moves event counter.
    • stepButton

      JToggleButton stepButton
      Next step button.
    • stopButton

      JToggleButton stopButton
      Stop button.
    • toolBar

      JToolBar toolBar
      Tool bar of the mouse recorder.
    • transformChange

      boolean transformChange
      DOCUMENT ME!
    • viewList

      JList viewList
      View list of the mouse recorder display list.
    • mjpegQuality

      private float mjpegQuality
      DOCUMENT ME!
    • setMouseVectorFlag

      private boolean setMouseVectorFlag
      flag to indicate the first time mouse tranform event happpened.
  • Constructor Details

    • JPanelMousePlotter

      public JPanelMousePlotter(RenderViewBase parent)
      Constructs a new mouse recorder dialog. Makes the GUI components and ties them to the parent scene.
      Parameters:
      parent - Parent scene to tie actions to.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Performs various actions depending on which event triggered this method.

      Playback toolbar buttons:

      • Record button - changes the mode to RECORD_MODE.
      • Play button - changes the mode to PLAY_MODE and calls play(boolean, boolean), which plays all the mouse events started at the selected one in a separate thread.
      • Play once button - changes the mode to PLAY_MODE and calls play(boolean, boolean), which plays one mouse event (the selected mouse event) in a separate thread.
      • Play continuously button - changes the mode to PLAY_MODE and calls play(boolean, boolean), which plays all the mouse events started at the selected one in a separate thread, until the stop button or pause button is pressed.
      • Pause button - changes the mode to PAUSE_MODE and causes the thread running in play(boolean, boolean) to sleep.
      • Stop button - changes the mode to STOP_MODE and causes play(boolean, boolean) to return.
      List buttons:
      • Add current - brings up a dialog asking the user for a name for the view, then adds it to the list and the vector.
      • Go - goes to the view associated with the name selected in the list.
      • Remove - removes the view associated with the name selected in the list. Disables playback if there are no views left in the list.
      Menu events:
      • Load mouse file - loads in an object file previously saved with the "Save mouse file" command. Displays the views in the list.
      • Save mouse file - uses the serialized writeObject method to save the vector of views/mouse events to a file.
      • Exit - disposes of this dialog.
      Specified by:
      actionPerformed in interface ActionListener
      Specified by:
      actionPerformed in class JPanelRendererBase
      Parameters:
      event - Event that triggered this method.
    • dispose

      public void dispose()
      Dispose memory.
    • getMainPanel

      public JPanel getMainPanel()
      DOCUMENT ME!
      Specified by:
      getMainPanel in class JPanelRendererBase
      Returns:
      DOCUMENT ME!
    • mouseClicked

      public void mouseClicked(MouseEvent event)
      Unchanged.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseDragged

      public void mouseDragged(MouseEvent event)
      If recording, adds this mouse event to the mouseEvents vector found at location current.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      event - Original mouse event.
    • mouseEntered

      public void mouseEntered(MouseEvent event)
      Unchanged.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseExited

      public void mouseExited(MouseEvent event)
      Unchanged.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseMoved

      public void mouseMoved(MouseEvent event)
      Unchanged.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      event - Original mouse event.
    • mousePressed

      public void mousePressed(MouseEvent event)
      If mode is RECORD_MODE, saves the current view and creates a new MouseEventVectorPlotter. That object holds the name, the view, and a vector with the subsequent mouse events. This is so the size of the list that the user sees stays small. If all mouse events were displayed in the list, the list would soon reach into the thousands. This way, the user sees only the "beginning" of the mouse event. When playback happens, all the mouse events stored in the vector within MouseEventVectorPlotter are played. For more information, see MouseEventVectorPlotter.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      If recording, adds this mouse event to the mouseEvents vector found at location current.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      event - Original mouse event.
    • removeAllItems

      public void removeAllItems()
      Removes all the items on the recording list.
    • setup

      public void setup()
      Sets up variables for recorder.
    • setVisible

      public void setVisible(boolean status)
      Makes the dialog visible next to the parent frame. If this makes it go off the screen, puts the dialog in the center of the screen.
      Overrides:
      setVisible in class JPanelRendererBase
      Parameters:
      status - Flag indicating if the dialog should be visible.
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Sets how the image plane should be displayed depending on value of slider.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - Event that triggered this function.
    • transformChanged

      public void transformChanged(int type, javax.media.j3d.Transform3D transform)
      Accessor that lets the dialog know that the canvas transform has changed.
      Specified by:
      transformChanged in interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
      Parameters:
      type - DOCUMENT ME!
      transform - DOCUMENT ME!
    • windowClosing

      public void windowClosing(WindowEvent e)
      Accessor that closing the mouse recorder window frame.
      Parameters:
      e - DOCUMENT ME!
    • finalize

      protected void finalize() throws Throwable
      Calls dispose.
      Overrides:
      finalize in class JPanelRendererBase
      Throws:
      Throwable - DOCUMENT ME!
    • buildMenu

      private void buildMenu()
      Builds menu with load, save, and exit options.
    • buildToolBar

      private JToolBar buildToolBar()
      Builds the toolbar for the mouse recorder.
      Returns:
      DOCUMENT ME!
    • init

      private void init()
      Initializes GUI components.
    • load

      private void load() throws IOException
      Loads the mouse actions as an object file. Clears out the old list and vector, brings up a dialog for the user to choose a file name and directory, then reads in each MouseEventVectorPlotter and puts it in the events vector (and puts the name in the list).
      Throws:
      IOException - DOCUMENT ME!
    • play

      private void play(boolean selectedToEnd, boolean forever)
      If there is no other thread running, starts a new thread to play the mouse events.
      Parameters:
      selectedToEnd - If true, the mouse events are played from the selected one to the end of the list. If false only the selected one is played.
      forever - If true, the mouse events list is played until the stop button or pause button is pressed.
    • save

      private void save() throws IOException
      Saves the mouse actions as an object file. Brings up a dialog for the user to choose a file name and directory, then writes out the events vector using an ObjectOutputStream.
      Throws:
      IOException - DOCUMENT ME!