radtools.graphing
Class Graph

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by radtools.graphing.Graph
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

@Revision(value="$Revision: 1.1 $",
          date="$Date: 2006/12/14 16:14:55 $",
          tag="$Name:  $")
 class Graph
extends JComponent

Graph describes the graph of the points, as well as the specifics of the graph itself: all of the values of the graph are set in this class, including the titles of strings, the ranges of the axes, and the points that are plotted.

TODO: Unit tests, Code review, Javadoc review, Seal/Finalize TODO: equals, hashCode, toString

Version:
$Revision: 1.1 $
Author:
Lilia Gutnik

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
(package private)  double[] csv_x
          Arrays of data values to be graphed.
(package private)  double[] csv_y
          Arrays of data values to be graphed.
(package private)  double[] csv_z
          Arrays of data values to be graphed.
(package private)  double f
          dynamic rescaling factor for zoom in and out
(package private)  GraphicsWrapper graphicsWrapper
          Graphics component that holds the graph itself, without the buttons
(package private)  int h
          Width and height in Canvas coordinates for the graph
(package private)  String[] message
          Array of strings to be printed on the frame
(package private)  double mouseKx
          Translated coordinates of mouse position
(package private)  double mouseKy
          Translated coordinates of mouse position
(package private)  double mouseOx
          Mouse position relative to origin
(package private)  double mouseOy
          Mouse position relative to origin
(package private)  int mouseX
          Cartesian coordinates of mouse position
(package private)  int mouseY
          Cartesian coordinates of mouse position
(package private)  int nDimensions
          Number of dimensions to be graphed, determines the kind of graph to be drawn
(package private)  int nMessages
          Number of strings to be printed on the frame
(package private)  rcf.core.util.collection.Collection<Point> points
          The points to be graphed
private static long serialVersionUID
          TODO: Javadoc
(package private)  String title
          Title of the graph
(package private)  int w
          Width and height in Canvas coordinates for the graph
(package private)  double x1
          Initial boundaries of the graph itself
(package private)  double x2
          Initial boundaries of the graph itself
(package private)  String xLabel
          Label of x axis
(package private)  double y1
          Initial boundaries of the graph itself
(package private)  double y2
          Initial boundaries of the graph itself
(package private)  String yLabel
          Label of y axis
(package private)  double zoom_factor
          Constant rescaling factor
 
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
Graph(rcf.core.util.collection.Collection<Point> _points, int _nDimensions, String _title, String _xLabel, String _yLabel)
          Sets the naming accessories of the graph, including title and axes, as well as initiating the function itself
 
Method Summary
protected  void paintComponent(Graphics graphics)
          Inherited paint method that draws the graph, the axes, and the strings
 void proccessMouseClick(MouseEvent e)
          TODO: Javadoc
 void processButtonClick(String command)
          Processes the actions of a mouse click on the various buttons or within the graph
 void setBoundaries(double x_left, double x_right, double y_down, double y_up)
          Set cartesian coordinates boundaries
 
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, 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

serialVersionUID

private static final long serialVersionUID
TODO: Javadoc

See Also:
Constant Field Values

graphicsWrapper

GraphicsWrapper graphicsWrapper
Graphics component that holds the graph itself, without the buttons


x1

double x1
Initial boundaries of the graph itself


x2

double x2
Initial boundaries of the graph itself


y1

double y1
Initial boundaries of the graph itself


y2

double y2
Initial boundaries of the graph itself


f

double f
dynamic rescaling factor for zoom in and out


zoom_factor

double zoom_factor
Constant rescaling factor


csv_x

double[] csv_x
Arrays of data values to be graphed. Each additional dimension allows for another filled array


csv_y

double[] csv_y
Arrays of data values to be graphed. Each additional dimension allows for another filled array


csv_z

double[] csv_z
Arrays of data values to be graphed. Each additional dimension allows for another filled array


nMessages

int nMessages
Number of strings to be printed on the frame


message

String[] message
Array of strings to be printed on the frame


w

int w
Width and height in Canvas coordinates for the graph


h

int h
Width and height in Canvas coordinates for the graph


mouseX

int mouseX
Cartesian coordinates of mouse position


mouseY

int mouseY
Cartesian coordinates of mouse position


mouseKx

double mouseKx
Translated coordinates of mouse position


mouseKy

double mouseKy
Translated coordinates of mouse position


mouseOx

double mouseOx
Mouse position relative to origin


mouseOy

double mouseOy
Mouse position relative to origin


title

String title
Title of the graph


xLabel

String xLabel
Label of x axis


yLabel

String yLabel
Label of y axis


nDimensions

int nDimensions
Number of dimensions to be graphed, determines the kind of graph to be drawn


points

rcf.core.util.collection.Collection<Point> points
The points to be graphed

Constructor Detail

Graph

Graph(rcf.core.util.collection.Collection<Point> _points,
      int _nDimensions,
      String _title,
      String _xLabel,
      String _yLabel)
Sets the naming accessories of the graph, including title and axes, as well as initiating the function itself

Parameters:
_points - Values to be graphed
_nDimensions - Determinds the type of graph to be displayed
_title - Title of the graph
_xLabel - Label of the x axis
_yLabel - Label of the y axis
Method Detail

paintComponent

protected void paintComponent(Graphics graphics)
Inherited paint method that draws the graph, the axes, and the strings

Overrides:
paintComponent in class JComponent
Parameters:
graphics - the grpahics context that will define the graph's colors, values, and style

proccessMouseClick

public void proccessMouseClick(MouseEvent e)
TODO: Javadoc

Parameters:
e -

processButtonClick

public void processButtonClick(String command)
Processes the actions of a mouse click on the various buttons or within the graph

Parameters:
command - The string of the button that was clicked on

setBoundaries

public void setBoundaries(double x_left,
                          double x_right,
                          double y_down,
                          double y_up)
Set cartesian coordinates boundaries

Parameters:
x_left - start range of x coordinates
x_right - end range of x coordinates
y_down - start range of y coordinates
y_up - end range of y coordinates