jigcell.compare.views
Class TransformDebugger

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by jigcell.compare.ui.PanelTab
                      extended by jigcell.compare.views.TransformDebugger
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.HierarchyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.TreeSelectionListener, ITab

public class TransformDebugger
extends PanelTab
implements java.awt.event.ActionListener, java.awt.event.HierarchyListener, javax.swing.event.TreeSelectionListener

Supports debugging transform functions.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen
See Also:
Serialized Form

Nested Class Summary
protected  class TransformDebugger.AnnotationModel
          Table model for a Transform Debugger annotation table.
protected  class TransformDebugger.DebuggerThread
          Thread for executing play events.
protected  class TransformDebugger.TransformTreeRenderer
          Renderer for the cells of the transform tree.
protected  class TransformDebugger.ValueModel
          Table model for a Transform Debugger value table.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  TransformDebugger.AnnotationModel annotationModel
          Tabular display of transform annotations
protected static java.lang.String BUTTON_SHOWINPUT
          Button text to show the input description of the currently selected transform
protected static java.lang.String BUTTON_SHOWOUTPUT
          Button text to show the output description of the currently selected transform
protected  javax.swing.JLabel classLabel
          Label displaying the type of the currently selected transform
protected static java.lang.String CLIENT_COMPONENTSHOWN
          Client property for delayed initialization
static java.lang.String CONFIG_FOREGROUNDRUNNING
          Property key for the running transform foreground
static java.lang.String CONFIG_FOREGROUNDSELECTED
          Property key for the selected transform foreground
static java.lang.String CONFIG_FOREGROUNDTRACED
          Property key for the traced transform foreground
static java.lang.String CONFIG_FOREGROUNDUNSELECTED
          Property key for the unselected transform foreground
protected  javax.swing.JViewport customizer
          Panel for transform customizers
protected  TransformDebugger.DebuggerThread debugThread
          Thread for executing play events
protected  ITransform debugTransform
          Transform being debugged
protected  IDataElement debugValue
          Value being debugged
static java.awt.Color DEFAULT_FOREGROUNDRUNNING
          Default foreground color for running transforms
static java.awt.Color DEFAULT_FOREGROUNDSELECTED
          Default foreground color for selected transforms
static java.awt.Color DEFAULT_FOREGROUNDTRACED
          Default foreground color for traced transforms
static java.awt.Color DEFAULT_FOREGROUNDUNSELECTED
          Default foreground color for unselected transforms
protected static double DEFAULT_TREESPLIT
          Splitting proportion to give to the tree component
protected static long DELAY_PAUSE
          Milliseconds to pause after receiving a transform event
protected static int DISABLE
          Disable the indicated control
protected static int ENABLE
          Enable the indicated control
protected static int IGNORE
          Ignore the setting of the indicated control
protected static java.lang.String LABEL_CLASS
          Label for current transform class display
protected static java.lang.String LABEL_NAME
          Label for current transform name display
protected static java.lang.Long LONG_ZERO
          Zero
protected static java.lang.String MENUBAR_DEFAULT
          Name of default menubar
protected  MenuBuilder menuManager
          Menu manager
protected static java.lang.String NAME_CUSTOMIZERS
          Name for customizers requested by this component
protected  javax.swing.JLabel nameLabel
          Label displaying the name of the currently selected transform
protected  boolean preventSelectionUpdate
          Prevent automatic selection updating
protected  javax.swing.tree.DefaultMutableTreeNode root
          Root of the transform tree
protected  javax.swing.JSplitPane splitter
          Splitter between tree and display
protected  java.lang.Runnable stopDebuggingRunnable
          Stops debugging
protected static java.lang.String TABNAME_ANNOTATION
          Tab name for the transform annotation
protected static java.lang.String TABNAME_TRANSFORM
          Tab name for the transform editor
protected static java.lang.String TABNAME_VALUE
          Tabe name for the transform value
protected static java.lang.String TOOLBAR_DEFAULT
          Name of default toolbar
protected  java.util.Set traceSet
          Set of elements identified as connected to the transform cursor
protected  ITransformAnnotation transformAnnotation
          Annotation for the currently selected transform
protected  ITransform transformCursor
          Currently selected transform
protected  java.util.Map transformMap
          Map from transforms to tree nodes
protected  IDataElement transformValue
          Value for the currently selected transform
protected  javax.swing.JTree tree
          Transform tree model
protected  javax.swing.tree.DefaultTreeModel treeModel
          Transform tree model
protected  java.lang.Runnable updateDisplayRunnable
          Updates the display based on debug information
protected  TransformDebugger.ValueModel valueModel
          Tabular display of transform values
 
Fields inherited from class jigcell.compare.ui.PanelTab
compare, configMarkers, PATH_ABOUT, PATH_DESCRIPTION_ABOUT, tabName
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface jigcell.compare.ITab
CONFIG_TABNAME, STATE_ENDINITIALIZE, STATE_ENDUI, STATE_INITIALIZE, STATE_RUNNING, STATES
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TransformDebugger(Compare compare, java.lang.String configMarker)
          Creates a new debugger for working with transforms.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void clearSelected()
          Clears the currently selected transform.
protected  void computeTrace(ITransform transform, boolean forwards)
          Finds a trace from the specified transform.
 IConfigEditor createConfigEditor()
          Creates a configuration editor for this tab or null if this tab does not support graphical configuration.
protected  javax.swing.JMenu[] createMenus()
          A list of menus for the view.
protected  javax.swing.JButton[] createTools()
          Creates a tool list for the view.
protected  void createTransformTree(javax.swing.tree.DefaultMutableTreeNode root, IDataGeneratorList transforms)
          Computes the tree of transformations from a given root transform.
protected  void createUI()
          Creates an interface for the view.
 void flushSelected()
          Flushes the currently selected transform.
 ITransform getSelectedTransform()
          The current object selected in the tree.
 ITransform getTransformCursor()
          The current transform cursor.
 void hierarchyChanged(java.awt.event.HierarchyEvent e)
           
protected  void initialize()
          Performs any initialization work for the view.
 void pause()
          Pauses the debugging thread.
 void play(long delay)
          Starts executing transforms from the transform cursor.
 void refreshTree()
          Reconstructs the transform tree.
protected  void setCustomizerView(ITransform transform)
          Updates the customizer view for the currently selected transform.
 void setSelectedTransform(ITransform transform)
          Sets the current object selected in the tree.
 void setTransformCursor(ITransform transformCursor)
          Sets the current transform cursor.
 void showBackwards()
          Computes and displays the backwards trace set.
 void showForwards()
          Computes and displays the forwards trace set.
 void step()
          Steps the debugging thread forwards.
 void stop()
          Stops the debugging thread.
protected  void stopDebugging()
          Stops the debugger.
protected  void updateDisplay()
          Updates the display based on the current debugging state.
protected  void updateInterfaceControls(int clear, int pause, int play, int set, int show, int step, int stop)
          Updates interface controls.
protected  void updateTransformInformation()
          Updates the transform information display.
 void valueChanged(javax.swing.event.TreeSelectionEvent e)
           
 
Methods inherited from class jigcell.compare.ui.PanelTab
createAboutDialog, createAboutDialogForTab, getCompare, getConfigForView, getConfigMarkers, getHostIdentifier, getName, propertyChange, readConfiguration
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, setVisible, unregisterKeyboardAction, update
 
Methods 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods 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, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FOREGROUNDRUNNING

public static final java.awt.Color DEFAULT_FOREGROUNDRUNNING
Default foreground color for running transforms


DEFAULT_FOREGROUNDSELECTED

public static final java.awt.Color DEFAULT_FOREGROUNDSELECTED
Default foreground color for selected transforms


DEFAULT_FOREGROUNDTRACED

public static final java.awt.Color DEFAULT_FOREGROUNDTRACED
Default foreground color for traced transforms


DEFAULT_FOREGROUNDUNSELECTED

public static final java.awt.Color DEFAULT_FOREGROUNDUNSELECTED
Default foreground color for unselected transforms


CONFIG_FOREGROUNDRUNNING

public static final java.lang.String CONFIG_FOREGROUNDRUNNING
Property key for the running transform foreground

See Also:
Constant Field Values

CONFIG_FOREGROUNDSELECTED

public static final java.lang.String CONFIG_FOREGROUNDSELECTED
Property key for the selected transform foreground

See Also:
Constant Field Values

CONFIG_FOREGROUNDTRACED

public static final java.lang.String CONFIG_FOREGROUNDTRACED
Property key for the traced transform foreground

See Also:
Constant Field Values

CONFIG_FOREGROUNDUNSELECTED

public static final java.lang.String CONFIG_FOREGROUNDUNSELECTED
Property key for the unselected transform foreground

See Also:
Constant Field Values

DEFAULT_TREESPLIT

protected static final double DEFAULT_TREESPLIT
Splitting proportion to give to the tree component

See Also:
Constant Field Values

DISABLE

protected static final int DISABLE
Disable the indicated control

See Also:
Constant Field Values

ENABLE

protected static final int ENABLE
Enable the indicated control

See Also:
Constant Field Values

IGNORE

protected static final int IGNORE
Ignore the setting of the indicated control

See Also:
Constant Field Values

DELAY_PAUSE

protected static final long DELAY_PAUSE
Milliseconds to pause after receiving a transform event

See Also:
Constant Field Values

LONG_ZERO

protected static final java.lang.Long LONG_ZERO
Zero


BUTTON_SHOWINPUT

protected static final java.lang.String BUTTON_SHOWINPUT
Button text to show the input description of the currently selected transform

See Also:
Constant Field Values

BUTTON_SHOWOUTPUT

protected static final java.lang.String BUTTON_SHOWOUTPUT
Button text to show the output description of the currently selected transform

See Also:
Constant Field Values

CLIENT_COMPONENTSHOWN

protected static final java.lang.String CLIENT_COMPONENTSHOWN
Client property for delayed initialization

See Also:
Constant Field Values

LABEL_CLASS

protected static final java.lang.String LABEL_CLASS
Label for current transform class display

See Also:
Constant Field Values

LABEL_NAME

protected static final java.lang.String LABEL_NAME
Label for current transform name display

See Also:
Constant Field Values

MENUBAR_DEFAULT

protected static final java.lang.String MENUBAR_DEFAULT
Name of default menubar

See Also:
Constant Field Values

NAME_CUSTOMIZERS

protected static final java.lang.String NAME_CUSTOMIZERS
Name for customizers requested by this component


TABNAME_TRANSFORM

protected static final java.lang.String TABNAME_TRANSFORM
Tab name for the transform editor

See Also:
Constant Field Values

TABNAME_VALUE

protected static final java.lang.String TABNAME_VALUE
Tabe name for the transform value

See Also:
Constant Field Values

TABNAME_ANNOTATION

protected static final java.lang.String TABNAME_ANNOTATION
Tab name for the transform annotation

See Also:
Constant Field Values

TOOLBAR_DEFAULT

protected static final java.lang.String TOOLBAR_DEFAULT
Name of default toolbar

See Also:
Constant Field Values

annotationModel

protected TransformDebugger.AnnotationModel annotationModel
Tabular display of transform annotations


preventSelectionUpdate

protected boolean preventSelectionUpdate
Prevent automatic selection updating


debugThread

protected TransformDebugger.DebuggerThread debugThread
Thread for executing play events


root

protected javax.swing.tree.DefaultMutableTreeNode root
Root of the transform tree


treeModel

protected javax.swing.tree.DefaultTreeModel treeModel
Transform tree model


debugValue

protected IDataElement debugValue
Value being debugged


transformValue

protected IDataElement transformValue
Value for the currently selected transform


debugTransform

protected ITransform debugTransform
Transform being debugged


transformCursor

protected ITransform transformCursor
Currently selected transform


transformAnnotation

protected ITransformAnnotation transformAnnotation
Annotation for the currently selected transform


classLabel

protected javax.swing.JLabel classLabel
Label displaying the type of the currently selected transform


nameLabel

protected javax.swing.JLabel nameLabel
Label displaying the name of the currently selected transform


splitter

protected javax.swing.JSplitPane splitter
Splitter between tree and display


tree

protected javax.swing.JTree tree
Transform tree model


customizer

protected javax.swing.JViewport customizer
Panel for transform customizers


transformMap

protected java.util.Map transformMap
Map from transforms to tree nodes


menuManager

protected MenuBuilder menuManager
Menu manager


stopDebuggingRunnable

protected final java.lang.Runnable stopDebuggingRunnable
Stops debugging


updateDisplayRunnable

protected final java.lang.Runnable updateDisplayRunnable
Updates the display based on debug information


traceSet

protected java.util.Set traceSet
Set of elements identified as connected to the transform cursor


valueModel

protected TransformDebugger.ValueModel valueModel
Tabular display of transform values

Constructor Detail

TransformDebugger

public TransformDebugger(Compare compare,
                         java.lang.String configMarker)
Creates a new debugger for working with transforms.

Parameters:
compare - Comparator backend to interface with
configMarker - Marker for retrieving configuration information from Comparator backend
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

clearSelected

public void clearSelected()
Clears the currently selected transform.


createConfigEditor

public IConfigEditor createConfigEditor()
Creates a configuration editor for this tab or null if this tab does not support graphical configuration.

Specified by:
createConfigEditor in interface ITab
Overrides:
createConfigEditor in class PanelTab

flushSelected

public void flushSelected()
Flushes the currently selected transform.


getSelectedTransform

public ITransform getSelectedTransform()
The current object selected in the tree.


getTransformCursor

public ITransform getTransformCursor()
The current transform cursor.


hierarchyChanged

public void hierarchyChanged(java.awt.event.HierarchyEvent e)
Specified by:
hierarchyChanged in interface java.awt.event.HierarchyListener

pause

public void pause()
Pauses the debugging thread.


play

public void play(long delay)
Starts executing transforms from the transform cursor.

Parameters:
delay - Play step delay

refreshTree

public void refreshTree()
Reconstructs the transform tree.


setSelectedTransform

public void setSelectedTransform(ITransform transform)
Sets the current object selected in the tree.

Parameters:
transform - Transform

setTransformCursor

public void setTransformCursor(ITransform transformCursor)
Sets the current transform cursor.

Parameters:
transformCursor - Selected transform

showBackwards

public void showBackwards()
Computes and displays the backwards trace set.


showForwards

public void showForwards()
Computes and displays the forwards trace set.


step

public void step()
Steps the debugging thread forwards.


stop

public void stop()
Stops the debugging thread.


valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent e)
Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener

computeTrace

protected void computeTrace(ITransform transform,
                            boolean forwards)
Finds a trace from the specified transform.

Parameters:
transform - Transform
forwards - Whether to trace forwards

createMenus

protected javax.swing.JMenu[] createMenus()
A list of menus for the view.

Overrides:
createMenus in class PanelTab

createTools

protected javax.swing.JButton[] createTools()
Creates a tool list for the view.

Overrides:
createTools in class PanelTab

createTransformTree

protected void createTransformTree(javax.swing.tree.DefaultMutableTreeNode root,
                                   IDataGeneratorList transforms)
Computes the tree of transformations from a given root transform.

Parameters:
root - Tree root to attach to
transforms - Child transforms of root

createUI

protected void createUI()
Creates an interface for the view.

Overrides:
createUI in class PanelTab

initialize

protected void initialize()
Performs any initialization work for the view.

Overrides:
initialize in class PanelTab

setCustomizerView

protected void setCustomizerView(ITransform transform)
Updates the customizer view for the currently selected transform.

Parameters:
transform - Transform

stopDebugging

protected void stopDebugging()
Stops the debugger. This method should only be called on the event thread.


updateDisplay

protected void updateDisplay()
Updates the display based on the current debugging state. This method should only be called on the event thread.


updateInterfaceControls

protected void updateInterfaceControls(int clear,
                                       int pause,
                                       int play,
                                       int set,
                                       int show,
                                       int step,
                                       int stop)
Updates interface controls.

Parameters:
clear - Whether to enable clear controls
pause - Whether to enable pause controls
play - Whether to enable play controls
set - Whether to enable set cursor controls
show - Whether to enable show tree controls
step - Whether to enable play step controls
stop - Whether to enable stop controls

updateTransformInformation

protected void updateTransformInformation()
Updates the transform information display.