avrora.gui
Class GraphNumbers

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byavrora.gui.GraphNumbers
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.AdjustmentListener, javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GraphNumbers
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener, java.awt.event.AdjustmentListener

The class assists visual monitors with graphing time-series data values. It visually displays them using a line graph

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 javax.swing.JScrollBar horzBar
          This is the bar that determines what part of the graph is displayed
 int maxvalue
          The max value of the y-axis
 javax.swing.SpinnerNumberModel maxvalueVisual
          The visual wdiget that sets the max value for the y-axis
protected static int MIN__VALUE__TICK
           
 javax.swing.SpinnerNumberModel stepsizeVisual
          The visual widget that sets the step size
protected static int VALUE_SCALE_WIDTH
           
 
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
GraphNumbers(javax.swing.JPanel parent)
          Called by a visual action that wants this class to help with displaying time series data
 
Method Summary
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          This function handles a user change to the scroll bar
 javax.swing.JPanel chalkboardAndBar()
          Returns a panel which can be displayed that contains the graph numbers panel and a horz scrollbar at the bottom that makes changes viewing area easy
 javax.swing.JPanel getOptionsPanel()
          This function returns a panel that has all the visual options aligned in a column
 javax.swing.JPanel getZoomLevelOption()
          This is called to get the visual widget that the user can set step size with.
 boolean internalUpdate()
          This function is called by paint and it does what is necessary to update the privateNumbers vector returns true if it actually got some numbers, otherwise returns false It might also be called by paint thread
 void paint(java.awt.Graphics g)
          This actually paints the graph...note that it repaints the whole graph everytime its called (to improve performance, we could make use of an update function) The code here is actually faily ugly but eh..
 void recordNumber(int number)
          This function is called by fire methods inside a monitor.
 void stateChanged(javax.swing.event.ChangeEvent e)
          this function processes the monitor options and resets the internal variables appropriately
 void updateHorzBar()
          This function updates the scroll bar as new numbers are added to the vector or if we decided to jump to a certian value Synchronized because GUI thread and paintthread will access the horz bar
 javax.swing.JPanel visualSetMaxValue()
          This is called to get the visual widget that the user can set y-axis max value with.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

horzBar

public javax.swing.JScrollBar horzBar
This is the bar that determines what part of the graph is displayed


stepsizeVisual

public javax.swing.SpinnerNumberModel stepsizeVisual
The visual widget that sets the step size


maxvalue

public int maxvalue
The max value of the y-axis


maxvalueVisual

public javax.swing.SpinnerNumberModel maxvalueVisual
The visual wdiget that sets the max value for the y-axis


VALUE_SCALE_WIDTH

protected static final int VALUE_SCALE_WIDTH
See Also:
Constant Field Values

MIN__VALUE__TICK

protected static final int MIN__VALUE__TICK
See Also:
Constant Field Values
Constructor Detail

GraphNumbers

public GraphNumbers(javax.swing.JPanel parent)
Called by a visual action that wants this class to help with displaying time series data

Method Detail

chalkboardAndBar

public javax.swing.JPanel chalkboardAndBar()
Returns a panel which can be displayed that contains the graph numbers panel and a horz scrollbar at the bottom that makes changes viewing area easy

Returns:
Basically, what you want to display to the screen

updateHorzBar

public void updateHorzBar()
This function updates the scroll bar as new numbers are added to the vector or if we decided to jump to a certian value Synchronized because GUI thread and paintthread will access the horz bar


getZoomLevelOption

public javax.swing.JPanel getZoomLevelOption()
This is called to get the visual widget that the user can set step size with.

Returns:
A panel containing a spinner that controls stepsize value

visualSetMaxValue

public javax.swing.JPanel visualSetMaxValue()
This is called to get the visual widget that the user can set y-axis max value with.

Returns:
A panel containing a spinner that controls maxvalue value

getOptionsPanel

public javax.swing.JPanel getOptionsPanel()
This function returns a panel that has all the visual options aligned in a column

Returns:
a panel that can be directly displayed to the screen

recordNumber

public void recordNumber(int number)
This function is called by fire methods inside a monitor. It physically adds data values that will be displayed upon next update/repaint

Parameters:
number - the value for the time series data in question

internalUpdate

public boolean internalUpdate()
This function is called by paint and it does what is necessary to update the privateNumbers vector returns true if it actually got some numbers, otherwise returns false It might also be called by paint thread


paint

public void paint(java.awt.Graphics g)
This actually paints the graph...note that it repaints the whole graph everytime its called (to improve performance, we could make use of an update function) The code here is actually faily ugly but eh..

Parameters:
g - The graphic that represents the panel to be painted

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
this function processes the monitor options and resets the internal variables appropriately

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - Info about the event that happened

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
This function handles a user change to the scroll bar

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener
Parameters:
e - Info about the event that happened