com.moneydance.awt.graph
Class GraphPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.moneydance.awt.graph.GraphPanel
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public abstract class GraphPanel
extends javax.swing.JComponent
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener

Description: This is an abstract class that implements the common functionality required for all types of graphs. Specific graph types such as Bar, Line, or Pie, should subclass this class

Author:
Sean D. Reilly
See Also:
Serialized Form

Nested Class Summary
 
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
protected  java.awt.Graphics bufferG
           
protected  java.awt.Image graphImage
           
protected  java.awt.Dimension graphSize
           
protected  boolean threeD
           
 
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
GraphPanel()
          Construct a graph with the specified initial size.
 
Method Summary
protected  void addBalloonHelpArea(BalloonHelp balloonHelp)
          Adds an area where a mouse motion will bring up a balloon help object with the specified text.
 void addDataSetGraph(DataSet dataSet, java.awt.Color color)
          Add the specified data set to the graph, using the specified color to draw the data.
abstract  void drawGraph(java.awt.Graphics g, int width, int height, boolean printing)
          This method must be over-ridden by the different types of graph in order to render the given datasets onto the graphImage.
 java.awt.Color getColor(int i)
          Get the rendering color of the data set at the specified position.
 DataSet getDataSet(int i)
          Get the data set at the specified position.
 int getNumDataSets()
          Get the number of data sets.
 java.awt.Dimension getPreferredSize()
           
 boolean isThreeD()
          Ask if this graph is drawn in three dimensions or only two.
 void mouseClicked(java.awt.event.MouseEvent e)
          ignore this.
 void mouseDragged(java.awt.event.MouseEvent e)
          ignore this.
 void mouseEntered(java.awt.event.MouseEvent e)
          ignore this.
 void mouseExited(java.awt.event.MouseEvent e)
          ignore this.
 void mouseMoved(java.awt.event.MouseEvent e)
          ignore this.
 void mousePressed(java.awt.event.MouseEvent e)
          ignore this.
 void mouseReleased(java.awt.event.MouseEvent e)
          ignore this.
 void paint(java.awt.Graphics g)
          ignore this.
protected  void removeAllBalloonHelpItems()
          Remove all balloon help items.
 void removeAllDataSets()
          Removes all of the current data sets from the graph.
 void renderGraph()
          Redraw the graph onto the buffered image and update the screen.
 void setBalloonHelpEnabled(boolean value)
          Set whether or not descriptions of each data set are displayed when the mouse rolls over the display area for each data set.
 void setBounds(int x, int y, int w, int h)
           
 void setThreeD(boolean val)
          Set whether this graph is drawn in three dimensions or only two.
 void update(java.awt.Graphics g)
           
 void writeGIF(java.io.OutputStream out)
          Save this graph as a GIF image to the specified output stream
 void writeGIFWithInfo(java.io.OutputStream out)
          Save this graph as a GIF image to the specified output stream, along with a "header" that shows the legend or key.
 
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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, 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

graphImage

protected java.awt.Image graphImage

graphSize

protected java.awt.Dimension graphSize

bufferG

protected java.awt.Graphics bufferG

threeD

protected boolean threeD
Constructor Detail

GraphPanel

public GraphPanel()
Construct a graph with the specified initial size.

Method Detail

isThreeD

public boolean isThreeD()
Ask if this graph is drawn in three dimensions or only two.


writeGIF

public void writeGIF(java.io.OutputStream out)
              throws java.awt.AWTException,
                     java.io.IOException
Save this graph as a GIF image to the specified output stream

Throws:
java.awt.AWTException
java.io.IOException

writeGIFWithInfo

public void writeGIFWithInfo(java.io.OutputStream out)
                      throws java.awt.AWTException,
                             java.io.IOException
Save this graph as a GIF image to the specified output stream, along with a "header" that shows the legend or key.

Throws:
java.awt.AWTException
java.io.IOException

setThreeD

public void setThreeD(boolean val)
Set whether this graph is drawn in three dimensions or only two.


setBalloonHelpEnabled

public void setBalloonHelpEnabled(boolean value)
Set whether or not descriptions of each data set are displayed when the mouse rolls over the display area for each data set.


addDataSetGraph

public void addDataSetGraph(DataSet dataSet,
                            java.awt.Color color)
Add the specified data set to the graph, using the specified color to draw the data.


removeAllDataSets

public void removeAllDataSets()
Removes all of the current data sets from the graph.


getNumDataSets

public int getNumDataSets()
Get the number of data sets.


getDataSet

public DataSet getDataSet(int i)
Get the data set at the specified position.


getColor

public java.awt.Color getColor(int i)
Get the rendering color of the data set at the specified position.


setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)

renderGraph

public final void renderGraph()
Redraw the graph onto the buffered image and update the screen.


drawGraph

public abstract void drawGraph(java.awt.Graphics g,
                               int width,
                               int height,
                               boolean printing)
This method must be over-ridden by the different types of graph in order to render the given datasets onto the graphImage.


addBalloonHelpArea

protected void addBalloonHelpArea(BalloonHelp balloonHelp)
Adds an area where a mouse motion will bring up a balloon help object with the specified text.


removeAllBalloonHelpItems

protected void removeAllBalloonHelpItems()
Remove all balloon help items.


mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
ignore this. Required to receive mouse events.

Specified by:
mouseExited in interface java.awt.event.MouseListener

paint

public void paint(java.awt.Graphics g)
ignore this. Required to receive mouse events.


update

public void update(java.awt.Graphics g)

getPreferredSize

public java.awt.Dimension getPreferredSize()