Class JPanelMousePlotter
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gov.nih.mipav.view.renderer.JPanelRendererBase
gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
gov.nih.mipav.view.renderer.J3D.surfaceview.plotterview.JPanelMousePlotter
- 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classChange the name of the selected item in the item list.(package private) classThread that plays.(package private) classThread that records screen capture.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanflag to indicate current mode being changed.(package private) JToggleButtonContinue play button.(package private) intindex to the item list.(package private) MouseEventVectorPlotterCurrent event vector used by the save AVI.(package private) Objectcurrent SceneState object being recorded by SaveAVI.(package private) javax.media.j3d.Transform3DCurrent transform3D object used in Save AVI.(package private) Vector<MouseEventVectorPlotter> Vector that holds mouse or change events.(package private) MouseEventVectorPlotterGlobal mouse event vector.(package private) booleanFlag to indicate first event.(package private) JButtonGo to button.(package private) booleanFlag to indicating play mouse is running or not.(package private) DefaultListModelList to record info for each mouse, change events.private floatDOCUMENT ME!(package private) intCurrent mode, init to stop.(package private) intMouse event counter.(package private) JButtonSave AVI button .(package private) SurfacePlotterReference to ViewJFrameSurfacePlotter.(package private) MouseEventVectorPlotterUsed by name change dialog to change name of the selected item.(package private) JButtonThis button add at head of the list.(package private) RenderViewBaseParent scene.static final intRecorder/Player is paused.(package private) JToggleButtonPause button.static final intRecorder/Player is playing.(package private) JToggleButtonDisplay button.(package private) JPanelMousePlotter.PlayMouseReference to PlayMouse class object.(package private) intProcess id used by the save AVI.static final intRecorder/Player is recording.(package private) JToggleButtonRecorder button.(package private) JPanelMousePlotter.RecordMouseReference to RecordMouse object class.(package private) JButtonRemove all items in the item list.(package private) JButtonRemove the selected item in the item list.(package private) javax.media.j3d.Transform3DCurrent transform3D object.private static final longUse serialVersionUID for interoperability.private booleanflag to indicate the first time mouse tranform event happpened.(package private) intSlider moves event counter.(package private) JToggleButtonNext step button.static final intRecorder/Player is stopped.(package private) JToggleButtonStop button.(package private) JToolBarTool bar of the mouse recorder.(package private) booleanDOCUMENT ME!(package private) JListView list of the mouse recorder display list.Fields inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
rayBasedRender, renderBaseFields inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
applyButton, cancelButton, cancelFlag, closeButton, helpButton, isActiveImage, mainPanel, NEW, OKButton, REPLACE, runInSeparateThread, serif12, serif12BFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
ROTATE, TRANSLATE, ZOOM -
Constructor Summary
ConstructorsConstructorDescriptionJPanelMousePlotter(RenderViewBase parent) Constructs a new mouse recorder dialog. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Performs various actions depending on which event triggered this method.private voidBuilds menu with load, save, and exit options.private JToolBarBuilds the toolbar for the mouse recorder.voiddispose()Dispose memory.protected voidfinalize()Calls dispose.DOCUMENT ME!private voidinit()Initializes GUI components.private voidload()Loads the mouse actions as an object file.voidmouseClicked(MouseEvent event) Unchanged.voidmouseDragged(MouseEvent event) If recording, adds this mouse event to the mouseEvents vector found at locationcurrent.voidmouseEntered(MouseEvent event) Unchanged.voidmouseExited(MouseEvent event) Unchanged.voidmouseMoved(MouseEvent event) Unchanged.voidmousePressed(MouseEvent event) If mode is RECORD_MODE, saves the current view and creates a new MouseEventVectorPlotter.voidmouseReleased(MouseEvent event) If recording, adds this mouse event to the mouseEvents vector found at locationcurrent.private voidplay(boolean selectedToEnd, boolean forever) If there is no other thread running, starts a new thread to play the mouse events.voidRemoves all the items on the recording list.private voidsave()Saves the mouse actions as an object file.voidsetup()Sets up variables for recorder.voidsetVisible(boolean status) Makes the dialog visible next to the parent frame.voidSets how the image plane should be displayed depending on value of slider.voidtransformChanged(int type, javax.media.j3d.Transform3D transform) Accessor that lets the dialog know that the canvas transform has changed.voidAccessor that closing the mouse recorder window frame.Methods inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
disposeLocal, getSurfaceRender, setRayBasedRender, setSurfaceRenderMethods inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
buildApplyButton, buildCancelButton, buildCloseButton, buildHelpButton, buildOKButton, buildTitledBorder, focusGained, focusLost, isCancelled, itemStateChanged, keyPressed, keyReleased, keyTyped, makeString, resizePanel, setLeftHandSystem, setVisibleStandard, setWCSystem, testParameterMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.event.FocusListener
focusGained, focusLostMethods inherited from interface java.awt.event.ItemListener
itemStateChangedMethods inherited from interface java.awt.event.KeyListener
keyPressed, keyReleased, keyTyped
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
STOP_MODE
public static final int STOP_MODERecorder/Player is stopped.- See Also:
-
RECORD_MODE
public static final int RECORD_MODERecorder/Player is recording.- See Also:
-
PAUSE_MODE
public static final int PAUSE_MODERecorder/Player is paused.- See Also:
-
PLAY_MODE
public static final int PLAY_MODERecorder/Player is playing.- See Also:
-
changedMode
boolean changedModeflag to indicate current mode being changed. -
contButton
JToggleButton contButtonContinue play button. -
current
int currentindex to the item list. -
currentEventVector
MouseEventVectorPlotter currentEventVectorCurrent event vector used by the save AVI. -
currentObject
Object currentObjectcurrent SceneState object being recorded by SaveAVI. -
currentTransform
javax.media.j3d.Transform3D currentTransformCurrent transform3D object used in Save AVI. -
events
Vector<MouseEventVectorPlotter> eventsVector that holds mouse or change events. -
eventVector
MouseEventVectorPlotter eventVectorGlobal mouse event vector. -
first
boolean firstFlag to indicate first event. -
goButton
JButton goButtonGo to button. -
isPlaying
boolean isPlayingFlag to indicating play mouse is running or not. -
listModel
DefaultListModel listModelList to record info for each mouse, change events. -
mode
int modeCurrent mode, init to stop. -
mouseCount
int mouseCountMouse event counter. -
movieButton
JButton movieButtonSave AVI button . -
myParentPlotter
SurfacePlotter myParentPlotterReference to ViewJFrameSurfacePlotter. -
nameChangeVector
MouseEventVectorPlotter nameChangeVectorUsed by name change dialog to change name of the selected item. -
newButton
JButton newButtonThis button add at head of the list. -
parentScene
RenderViewBase parentSceneParent scene. -
pauseButton
JToggleButton pauseButtonPause button. -
playButton
JToggleButton playButtonDisplay button. -
playMouse
JPanelMousePlotter.PlayMouse playMouseReference to PlayMouse class object. -
process
int processProcess id used by the save AVI. -
recordButton
JToggleButton recordButtonRecorder button. -
recorderToAVI
JPanelMousePlotter.RecordMouse recorderToAVIReference to RecordMouse object class. -
removeAllButton
JButton removeAllButtonRemove all items in the item list. -
removeButton
JButton removeButtonRemove the selected item in the item list. -
resetTransform
javax.media.j3d.Transform3D resetTransformCurrent transform3D object. -
sliderCount
int sliderCountSlider moves event counter. -
stepButton
JToggleButton stepButtonNext step button. -
stopButton
JToggleButton stopButtonStop button. -
toolBar
JToolBar toolBarTool bar of the mouse recorder. -
transformChange
boolean transformChangeDOCUMENT ME! -
viewList
JList viewListView list of the mouse recorder display list. -
mjpegQuality
private float mjpegQualityDOCUMENT ME! -
setMouseVectorFlag
private boolean setMouseVectorFlagflag to indicate the first time mouse tranform event happpened.
-
-
Constructor Details
-
JPanelMousePlotter
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
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.
- 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.
- 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:
actionPerformedin interfaceActionListener- Specified by:
actionPerformedin classJPanelRendererBase- Parameters:
event- Event that triggered this method.
-
dispose
public void dispose()Dispose memory. -
getMainPanel
DOCUMENT ME!- Specified by:
getMainPanelin classJPanelRendererBase- Returns:
- DOCUMENT ME!
-
mouseClicked
Unchanged.- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseDragged
If recording, adds this mouse event to the mouseEvents vector found at locationcurrent.- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
event- Original mouse event.
-
mouseEntered
Unchanged.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseExited
Unchanged.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseMoved
Unchanged.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
event- Original mouse event.
-
mousePressed
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:
mousePressedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseReleased
If recording, adds this mouse event to the mouseEvents vector found at locationcurrent.- Specified by:
mouseReleasedin interfaceMouseListener- 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:
setVisiblein classJPanelRendererBase- Parameters:
status- Flag indicating if the dialog should be visible.
-
stateChanged
Sets how the image plane should be displayed depending on value of slider.- Specified by:
stateChangedin interfaceChangeListener- 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:
transformChangedin interfacecom.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback- Parameters:
type- DOCUMENT ME!transform- DOCUMENT ME!
-
windowClosing
Accessor that closing the mouse recorder window frame.- Parameters:
e- DOCUMENT ME!
-
finalize
Calls dispose.- Overrides:
finalizein classJPanelRendererBase- Throws:
Throwable- DOCUMENT ME!
-
buildMenu
private void buildMenu()Builds menu with load, save, and exit options. -
buildToolBar
Builds the toolbar for the mouse recorder.- Returns:
- DOCUMENT ME!
-
init
private void init()Initializes GUI components. -
load
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- Iftrue, the mouse events are played from the selected one to the end of the list. Iffalseonly the selected one is played.forever- Iftrue, the mouse events list is played until the stop button or pause button is pressed.
-
save
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!
-