Venice 0.7beta

org.mov.chart
Class BasicChartUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.mov.chart.BasicChartUI
All Implemented Interfaces:
java.awt.image.ImageObserver

public class BasicChartUI
extends javax.swing.plaf.ComponentUI
implements java.awt.image.ImageObserver

Chart Implementation.


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BasicChartUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
 double getDifference(Chart chart, Coordinate c, Coordinate start, Coordinate end)
           
 double getDifference(Chart chart, java.lang.Integer x, java.lang.Integer y, Coordinate start, Coordinate end)
           
 java.awt.Color getGraphColour(Graph graph, Chart chart)
          Return the colour we will draw the given graph.
 java.awt.image.BufferedImage getImage()
           
protected  int getLevelAtPoint(int yCoordinate)
          Return which graph level contains the given y coordinate.
static int getMinimumHeight(Chart chart)
          Return the minimum height needed by this component.
static int getMinimumWidth(Chart chart)
          Return the minimum width needed by this component.
 Coordinate getMoved(Chart chart, java.lang.Integer x, java.lang.Integer y, Coordinate start, Coordinate end)
           
 java.lang.String getToolTipText(Chart chart, int xCoordinate, int yCoordinate)
          Return the tool tip text for the given x, y coordinates.
 java.lang.Comparable getXAtPoint(Chart chart, int xCoordinate)
          Return the X value at the given x coordinate.
 java.lang.Double getYAtPoint(Chart chart, int yCoordinate)
          Return the Y value at the given x coordinate.
 boolean imageUpdate(java.awt.Image image, int infofloags, int x, int y, int width, int height)
           
 boolean intersect(Chart chart, Coordinate c1, Coordinate c2, int delta)
           
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paint the component.
 void resetBuffer()
          Reset the double buffer and force the chart to redraw.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, uninstallUI, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicChartUI

public BasicChartUI()
Method Detail

getMinimumWidth

public static int getMinimumWidth(Chart chart)
Return the minimum width needed by this component.

Parameters:
chart - the chart component

getMinimumHeight

public static int getMinimumHeight(Chart chart)
Return the minimum height needed by this component.

Parameters:
chart - the chart component

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

getXAtPoint

public java.lang.Comparable getXAtPoint(Chart chart,
                                        int xCoordinate)
Return the X value at the given x coordinate.

Parameters:
chart - the chart component
xCoordinate - an x coordinate on the screen
Returns:
the X value at the x coordinate

getYAtPoint

public java.lang.Double getYAtPoint(Chart chart,
                                    int yCoordinate)
Return the Y value at the given x coordinate.

Parameters:
chart - the chart component
yCoordinate - an y coordinate on the screen
Returns:
the Y value at the y coordinate

getLevelAtPoint

protected int getLevelAtPoint(int yCoordinate)
Return which graph level contains the given y coordinate.

Parameters:
yCoordinate - the y coordinate to query
Returns:
the level which contains the y coordinate or 0 if none do

getToolTipText

public java.lang.String getToolTipText(Chart chart,
                                       int xCoordinate,
                                       int yCoordinate)
Return the tool tip text for the given x, y coordinates.

Parameters:
chart - the chart component
xCoordinate - the x coordinate
yCoordinate - the y coordinate

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paint the component.

Overrides:
paint in class javax.swing.plaf.ComponentUI
Parameters:
g - the graphics to paint to
c - the chart component

getImage

public java.awt.image.BufferedImage getImage()

getDifference

public double getDifference(Chart chart,
                            java.lang.Integer x,
                            java.lang.Integer y,
                            Coordinate start,
                            Coordinate end)

getDifference

public double getDifference(Chart chart,
                            Coordinate c,
                            Coordinate start,
                            Coordinate end)

getMoved

public Coordinate getMoved(Chart chart,
                           java.lang.Integer x,
                           java.lang.Integer y,
                           Coordinate start,
                           Coordinate end)

intersect

public boolean intersect(Chart chart,
                         Coordinate c1,
                         Coordinate c2,
                         int delta)

resetBuffer

public void resetBuffer()
Reset the double buffer and force the chart to redraw.


imageUpdate

public boolean imageUpdate(java.awt.Image image,
                           int infofloags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

getGraphColour

public java.awt.Color getGraphColour(Graph graph,
                                     Chart chart)
Return the colour we will draw the given graph. Note that the graph may choose to override this colour.

Parameters:
graph - the graph to query
chart - the chart component
Returns:
the colour the graph might be

Venice 0.7beta