at.tuwien.ifs.somtoolbox.apps.viewer
Class PieChartPNode

java.lang.Object
  extended by edu.umd.cs.piccolo.PNode
      extended by at.tuwien.ifs.somtoolbox.apps.viewer.PieChartPNode
All Implemented Interfaces:
Printable, Serializable, Cloneable

public class PieChartPNode
extends edu.umd.cs.piccolo.PNode

Wrapper for displaying a pie chart within the Piccolo zooming interface framework.

Version:
$Id: PieChartPNode.java 3939 2010-11-17 16:06:14Z frank $
Author:
Michael Dittenbach
See Also:
Serialized Form

Nested Class Summary
private  class PieChartPNode.CountLabeler
           
private  class PieChartPNode.PercentageLabeler
           
static class PieChartPNode.PieChartLabelMode
           
 
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.PNode.PSceneGraphDelegate
 
Field Summary
private  Rectangle2D border
           
private  PieChartPNode.CountLabeler countLabeler
           
private  double height
           
private  int itemCount
           
private  PieChartPNode.PercentageLabeler percentageLabeler
           
private  org.jfree.chart.plot.PiePlot plot
           
private static long serialVersionUID
           
private  int[] values
           
private  double width
           
private  double X
           
private  double Y
           
 
Fields inherited from class edu.umd.cs.piccolo.PNode
PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATE
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PieChartPNode(double x, double y, double w, double h, int[] values, int itemCount)
          Creates a PieChartPNode at the given coordinates with the given values.
 
Method Summary
static org.jfree.chart.plot.PiePlot createPiechartPlot(int[] values)
          Creates a piechart from the given count values
static void drawPlot(Graphics2D g2d, int[] values, Color[] colors, double x, double y, double width, double height)
          Draw pie-charts on the given Graphics2D object, with the provided values and colours, and unit width.
 Color getLegendColor(int index)
          Returns the colour used in the diagram at the specified index.
 Color[] getLegendColors()
          Returns the colors used in the diagram.
 org.jfree.util.PaintList getPaintList()
           
 int[] getValues()
           
protected  void paint(edu.umd.cs.piccolo.util.PPaintContext paintContext)
           
 boolean setBounds(double x, double y, double width, double height)
           
 void setColor(int index, Color color)
           
 void setColors(Color[] colors)
           
 void setShowLegend(PieChartPNode.PieChartLabelMode mode)
           
 
Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, addAttribute, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientProperty, getClientPropertyKeysEnumeration, getClientPropertyKeysIterator, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, intersects, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paintAfterChildren, paramString, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, toImage, toString, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

values

private int[] values

itemCount

private int itemCount

plot

private org.jfree.chart.plot.PiePlot plot

border

private Rectangle2D border

X

private double X

Y

private double Y

width

private double width

height

private double height

countLabeler

private final PieChartPNode.CountLabeler countLabeler

percentageLabeler

private final PieChartPNode.PercentageLabeler percentageLabeler
Constructor Detail

PieChartPNode

public PieChartPNode(double x,
                     double y,
                     double w,
                     double h,
                     int[] values,
                     int itemCount)
Creates a PieChartPNode at the given coordinates with the given values.

Parameters:
x - X coordinate of the chart.
y - Y coordinate of the chart.
values - Array of double containing the values.
Method Detail

createPiechartPlot

public static org.jfree.chart.plot.PiePlot createPiechartPlot(int[] values)
Creates a piechart from the given count values


drawPlot

public static void drawPlot(Graphics2D g2d,
                            int[] values,
                            Color[] colors,
                            double x,
                            double y,
                            double width,
                            double height)
Draw pie-charts on the given Graphics2D object, with the provided values and colours, and unit width. Used when exporting pie charts as stand-alone image, or for superimposing them on an exported visualisation.


setBounds

public boolean setBounds(double x,
                         double y,
                         double width,
                         double height)
Overrides:
setBounds in class edu.umd.cs.piccolo.PNode

paint

protected void paint(edu.umd.cs.piccolo.util.PPaintContext paintContext)
Overrides:
paint in class edu.umd.cs.piccolo.PNode

getLegendColors

public Color[] getLegendColors()
Returns the colors used in the diagram. Can be used for a legend displayed in a different Swing element.

Returns:
Array of Color.

getPaintList

public org.jfree.util.PaintList getPaintList()

getLegendColor

public Color getLegendColor(int index)
Returns the colour used in the diagram at the specified index.


setColor

public void setColor(int index,
                     Color color)

setColors

public void setColors(Color[] colors)

getValues

public int[] getValues()

setShowLegend

public void setShowLegend(PieChartPNode.PieChartLabelMode mode)