|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel avrora.gui.GraphEvents
This is a generic helper class for visual monitors. It's purpose is to help
graph events that occur in the simulator (constant this with
GraphNumbers
, which graph data values as time goes by.
For each event that occurs, a colored dot will appear. The x-axis maps
time gone by.
Events must be inserted into this class in temporal order
This class is not yet done. It needs to be more generic - right now it's hacked to specifically allow LED output to be graphed.
Nested Class Summary | |
class |
GraphEvents.MyVector
We don't want to store millions of Integer, but we still want an array that grows...so we define a MyVector class just for that |
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 |
double |
stepsize
number of pixels per x-axis value |
javax.swing.SpinnerNumberModel |
stepsizeVisual
The visual component for setting stepsize |
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 | |
GraphEvents(int pminvalue,
int pmaxvalue,
double pstepsize)
|
Method Summary | |
void |
addToVector(int vecnum,
int anAddress)
A monitor can add data using this function On next repaint, it will be added to the graph |
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
If the scroll bar was adjusted, we should repaint. |
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 |
int |
getHorzBarValue()
used by paint so it knows what value to start painting with |
javax.swing.JPanel |
getOptionsPanel()
This function creates the actual options panel that can be displayed. |
double |
getStepSize()
|
boolean |
internalUpdate()
This function is called by paint and it does what is necessary to update the privateNumbers vector |
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 |
setParentPanel(javax.swing.JPanel pparentPanel)
Used in order to size thing correctly. |
void |
setStepSize(double pstepsize)
|
void |
stateChanged(javax.swing.event.ChangeEvent e)
this function processes the monitor options and re-sets the internal variables appropiatly |
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 if the paramter is true, it will set the scroll bar to be the new max value...otherwise it just keeps value to whatver it used to be Synchronized because GUI thread and paintthread will access the horz bar |
javax.swing.JPanel |
visualSetStepSize()
This creates a visual object that the user can interact with to set step size |
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 |
public javax.swing.JScrollBar horzBar
public double stepsize
public javax.swing.SpinnerNumberModel stepsizeVisual
stepsize
Constructor Detail |
public GraphEvents(int pminvalue, int pmaxvalue, double pstepsize)
Method Detail |
public javax.swing.JPanel chalkboardAndBar()
public void updateHorzBar()
public int getHorzBarValue()
public double getStepSize()
public void setStepSize(double pstepsize)
pstepsize
- The value that step size should be set topublic javax.swing.JPanel visualSetStepSize()
public javax.swing.JPanel getOptionsPanel()
public void setParentPanel(javax.swing.JPanel pparentPanel)
public void addToVector(int vecnum, int anAddress)
vecnum
- an index that specified "which" event occuredanAddress
- the time that the event occuredpublic boolean internalUpdate()
public void paint(java.awt.Graphics g)
public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
e
- Information about what event occuredpublic void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged
in interface java.awt.event.AdjustmentListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |