org.simbrain.gauge.graphics
Class GaugePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by edu.umd.cs.piccolo.PCanvas
                  extended by org.simbrain.gauge.graphics.GaugePanel
All Implemented Interfaces:
PComponent, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener

public class GaugePanel
extends PCanvas
implements ActionListener

GaugePanel is the main panel in which data are displayed. Menu and toolbar handling code are also provided here.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 Color backgroundColor
          Color of background.
 Color defaultColor
          Color of all other points.
 Color hotColor
          Color of hot point.
protected  JButton iterateBtn
          Iterate once.
 ArrayList nodeList
          List of nodes.
 
Fields inherited from class edu.umd.cs.piccolo.PCanvas
CURRENT_ZCANVAS, INTERATING_CHANGED_NOTIFICATION
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GaugePanel()
          Instance of gauge panel.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void centerCamera()
          Scale the data so that it fits on the screen Assumes 2-d data.
 void colorPoints()
          Color every seventh point a different color; allows tracking of order.
 int getBackgroundColor()
           
 JPanel getBottomPanel()
           
 File getCurrentFile()
           
 int getDefaultColor()
           
 Gauge getGauge()
           
 int getHotColor()
           
 int getHotPoint()
           
 int getNumIterationsBetweenUpdate()
           
 JCheckBox getOnOffBox()
           
 double getPointSize()
           
 Settings getSettings()
           
 JToolBar getTheToolBar()
           
 void handlePreferenceDialogs()
          Open preference dialog based on which projector is currently selected.
 void init()
          Gauge initilization.
 void initCastor()
          Initializes the castor.
 boolean isAutoZoom()
          You can turn autozoom off if you want to zoom in on data.
 boolean isColorMode()
           
 boolean isShowError()
           
 boolean isShowStatus()
           
 boolean isUpdateCompleted()
          Used by the thread to be sure an iteration is complete before it iterates again.
 void iterate()
          Forward command to gauge; iterate the gauge one time.
 void repaint()
          Repaints the gauge to reflect changed data or new settings.
 void resetGauge()
          Reset the gauge, removing all PNodes and references to datapoints.
 void setAutoZoom(boolean b)
           
 void setBackgroundColor(int rgb)
           
 void setColor(Color c)
          Color all datapoints a specified color.
 void setCurrentFile(File currentFile)
           
 void setDefaultColor(int rgb)
           
 void setGauge(Gauge gauge)
           
 void setHotColor(int rgb)
           
 void setHotPoint(int i)
          Set a unique datapoint to "hot" mode, which just means it is shown in a different color, to indicate (e.g.) that it is the current point in a set of points.
 void setNumIterationsBetweenUpdate(int i)
           
 void setPointSize(double d)
           
 void setProjector(String projector)
           
 void setShowError(boolean b)
           
 void setShowStatus(boolean b)
           
 void setUpdateCompleted(boolean b)
          Used by the thread to be sure an iteration is complete before it iterates again.
 void showGeneralDialog()
          Show genneral prefs dialog.
 void showGraphicsDialog()
          Show graphics dialog.
 void startThread()
          Starts the current thread.
 void stopThread()
          Stops the current thread.
 void update()
          Update node list, labels, etc.
 void updateColors(boolean b)
           
 void updateProjectionMenu()
          Manually set the currently selected projection algorithm.
 
Methods inherited from class edu.umd.cs.piccolo.PCanvas
addInputEventListener, createTimer, getAnimating, getCamera, getInteracting, getLayer, getPanEventHandler, getRoot, getZoomEventHandler, installInputSources, paintComponent, paintImmediately, popCursor, pushCursor, removeInputEventListener, repaint, sendInputEventToInputManager, setAnimatingRenderQuality, setBounds, setCamera, setDefaultRenderQuality, setInteracting, setInteractingRenderQuality, setPanEventHandler, setZoomEventHandler
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, getName, 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, resize, resize, 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

iterateBtn

protected JButton iterateBtn
Iterate once.


nodeList

public ArrayList nodeList
List of nodes.


hotColor

public Color hotColor
Color of hot point.


defaultColor

public Color defaultColor
Color of all other points.


backgroundColor

public Color backgroundColor
Color of background.

Constructor Detail

GaugePanel

public GaugePanel()
Instance of gauge panel.

Method Detail

initCastor

public void initCastor()
Initializes the castor.


init

public void init()
Gauge initilization.


handlePreferenceDialogs

public void handlePreferenceDialogs()
Open preference dialog based on which projector is currently selected.


showGraphicsDialog

public void showGraphicsDialog()
Show graphics dialog.


showGeneralDialog

public void showGeneralDialog()
Show genneral prefs dialog.


update

public void update()
Update node list, labels, etc.


repaint

public void repaint()
Repaints the gauge to reflect changed data or new settings.

Overrides:
repaint in class Component

centerCamera

public void centerCamera()
Scale the data so that it fits on the screen Assumes 2-d data.


resetGauge

public void resetGauge()
Reset the gauge, removing all PNodes and references to datapoints.


updateProjectionMenu

public void updateProjectionMenu()
Manually set the currently selected projection algorithm. Used when the projection method is changed independently of the user.


actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener
Parameters:
e - Action performed.

stopThread

public void stopThread()
Stops the current thread.


startThread

public void startThread()
Starts the current thread.


iterate

public void iterate()
Forward command to gauge; iterate the gauge one time.


colorPoints

public void colorPoints()
Color every seventh point a different color; allows tracking of order.


setColor

public void setColor(Color c)
Color all datapoints a specified color.

Parameters:
c - new color

setHotPoint

public void setHotPoint(int i)
Set a unique datapoint to "hot" mode, which just means it is shown in a different color, to indicate (e.g.) that it is the current point in a set of points.

Parameters:
i - index of datapoint to designate as "hot"

getHotPoint

public int getHotPoint()
Returns:
"current" point in use by another component.

getGauge

public Gauge getGauge()
Returns:
a reference to the gauge

setGauge

public void setGauge(Gauge gauge)
Parameters:
gauge - Current gauge.

isUpdateCompleted

public boolean isUpdateCompleted()
Used by the thread to be sure an iteration is complete before it iterates again.

Returns:
true if update is completed, false otherwise

setUpdateCompleted

public void setUpdateCompleted(boolean b)
Used by the thread to be sure an iteration is complete before it iterates again.

Parameters:
b - true if update is completed, false otherwise

isColorMode

public boolean isColorMode()
Returns:
true if the gauge is in color mode (colors the datapoints), false otehrwise

updateColors

public void updateColors(boolean b)
Parameters:
b - true if the gauge is in color mode (colors the datapoints), false otehrwise

getNumIterationsBetweenUpdate

public int getNumIterationsBetweenUpdate()
Returns:
number of iterations the projection algorithm takes between graphics updates

setNumIterationsBetweenUpdate

public void setNumIterationsBetweenUpdate(int i)
Parameters:
i - number of iterations the projection algorithm takes between graphics updates

setProjector

public void setProjector(String projector)
Parameters:
projector - Used to programatically set the projector.

isShowError

public boolean isShowError()
Returns:
true if error information should be shown, false otherwise

isShowStatus

public boolean isShowStatus()
Returns:
true if status information (dimensions and number of datapoints) should be shown, false otherwise

setShowStatus

public void setShowStatus(boolean b)
Parameters:
b - true if status information (dimensions and number of datapoints) should be shown, false otherwise

setShowError

public void setShowError(boolean b)
Parameters:
b - true if error information should be shown, false otherwise

getPointSize

public double getPointSize()
Returns:
the minimum size which all datapoints must be

setPointSize

public void setPointSize(double d)
Parameters:
d - the minimum size which all datapoints must be

isAutoZoom

public boolean isAutoZoom()
You can turn autozoom off if you want to zoom in on data.

Returns:
true if autozoom (which automatically scales the dataset to the screen) is on, false otherwise.

setAutoZoom

public void setAutoZoom(boolean b)
Parameters:
b - true if autozoom (which automatically scales the dataset to the screen) is on, false otherwise.

getOnOffBox

public JCheckBox getOnOffBox()
Returns:
gauge on/off status.

getCurrentFile

public File getCurrentFile()
Returns:
Returns the currentFile.

setCurrentFile

public void setCurrentFile(File currentFile)
Parameters:
currentFile - The currentFile to set.

getDefaultColor

public int getDefaultColor()
Returns:
Returns the defaultColor.

setDefaultColor

public void setDefaultColor(int rgb)
Parameters:
rgb - The defaultColor to set.

getHotColor

public int getHotColor()
Returns:
Returns the hotColor.

setHotColor

public void setHotColor(int rgb)
Parameters:
rgb - The hotColor to set.

setBackgroundColor

public void setBackgroundColor(int rgb)
Parameters:
rgb - The background color to set.

getBackgroundColor

public int getBackgroundColor()
Returns:
Current background color.

getSettings

public Settings getSettings()
Returns:
Current settings.

getTheToolBar

public JToolBar getTheToolBar()
Returns:
the gauge toolbar.

getBottomPanel

public JPanel getBottomPanel()
Returns:
the bottom panel.