com.moneydance.awt.graph
Class JGraph

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.moneydance.awt.graph.JGraph
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
Direct Known Subclasses:
JBarGraph, JLineGraph, JPieGraph

public abstract class JGraph
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  GraphModel model
           
 
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
JGraph(GraphModel model)
          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.
static JGraph constructGraph(GraphModel model)
           
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.Dimension getPreferredSize()
           
 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)
           
protected  void removeAllBalloonHelpItems()
          Remove all balloon help items.
 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)
           
protected  void setNewModel(GraphModel model)
           
 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

model

protected GraphModel model
Constructor Detail

JGraph

public JGraph(GraphModel model)
Construct a graph with the specified initial size.

Method Detail

setNewModel

protected void setNewModel(GraphModel model)

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

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.


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 final void paint(java.awt.Graphics g)

update

public final void update(java.awt.Graphics g)

getPreferredSize

public java.awt.Dimension getPreferredSize()

constructGraph

public static JGraph constructGraph(GraphModel model)