ChartCat 1.2

li.netcat.chart.util
Class LegendPart

java.lang.Object
  extended byli.netcat.chart.util.AbstractPart
      extended byli.netcat.chart.util.TextPart
          extended byli.netcat.chart.util.LegendPart
All Implemented Interfaces:
Part
Direct Known Subclasses:
AreaLegendPart, LineLegendPart

public abstract class LegendPart
extends TextPart

Abstract super class of a legend part. The legend consists of an arbitrary number of texts that are preceded by symbols. It has an orientation and a maximum width or height.

Author:
Arthur Marxer

Field Summary
static int HORIZONTAL
          Equal to ChartConstants.HORIZONTAL
static int VERTICAL
          Equal to ChartConstants.VERTICAL
 
Fields inherited from class li.netcat.chart.util.AbstractPart
BACKGROUND, FOREGROUND, PERSPECTIVE
 
Constructor Summary
LegendPart()
          Constructs a new instance of a legend part and initializes it to its defaults.
 
Method Summary
 GraphPart getGraphPart()
          Returns the graph part that provides the GraphLook and the LegendModel.
 float getHGap()
          Returns the horizontal gap between the columns of the legend.
protected abstract  float getItemHeight(GraphLook graphLook)
          Subclasses must implement this method to report the item height.
 float getItemTextGap()
          Returns the gap between item and text.
protected abstract  float getItemWidth(GraphLook graphLook)
          Subclasses must implement this method to report the item width.
 Layout getLayout(java.awt.Graphics g)
          Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.
 float getMaxHeight()
          Returns the maximum height of this legend.
 float getMaxWidth()
          Returns the maximum with of this legend.
 int getOrientation()
          Returns the orientation of this legend.
 float getVGap()
          Returns the vertical gap between the rows of the legend.
 boolean isMovable()
           
protected abstract  void layoutItem(java.awt.Graphics g, DefaultLayout layout, java.awt.geom.Rectangle2D.Float itemBounds, GraphLook graphLook, int rowIndex, int columnIndex)
          Subclasses must implement this method to layout an item.
 void setGraphPart(GraphPart graphPart)
          Sets the graph part to this LegendPart that provides the GraphLook and the LegendModel.
 void setHGap(float hgap)
          Sets the horizontal gap between the columns of the legend.
 void setItemTextGap(float gap)
          Sets the gap between item and text.
 void setMaxHeight(float height)
          Sets the maximum height of this legend.
 void setMaxWidth(float width)
          Sets the maximum with of this legend.
 void setOrientation(int orientation)
          Sets the orientation of this legend.
 void setVGap(float vgap)
          Sets the vertical gap between the rows of the legend.
 
Methods inherited from class li.netcat.chart.util.TextPart
getTextLook, setTextLook
 
Methods inherited from class li.netcat.chart.util.AbstractPart
getChart, getPerspective, invalidate, setChart, setPerspective
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERTICAL

public static final int VERTICAL
Equal to ChartConstants.VERTICAL

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
Equal to ChartConstants.HORIZONTAL

See Also:
Constant Field Values
Constructor Detail

LegendPart

public LegendPart()
Constructs a new instance of a legend part and initializes it to its defaults.

Method Detail

getGraphPart

public GraphPart getGraphPart()
Returns the graph part that provides the GraphLook and the LegendModel.

Returns:
The graph part, possibly null.

setGraphPart

public void setGraphPart(GraphPart graphPart)
Sets the graph part to this LegendPart that provides the GraphLook and the LegendModel.

Parameters:
graphPart - The graph part, might be null.

getItemTextGap

public float getItemTextGap()
Returns the gap between item and text.

Returns:
The gap between item and text in pixel.

setItemTextGap

public void setItemTextGap(float gap)
Sets the gap between item and text.

Parameters:
gap - The gap between item and text in pixel.

getHGap

public float getHGap()
Returns the horizontal gap between the columns of the legend.

Returns:
The horizontal gap in pixel.

setHGap

public void setHGap(float hgap)
Sets the horizontal gap between the columns of the legend.

Parameters:
hgap - The horizontal gap in pixel.

getVGap

public float getVGap()
Returns the vertical gap between the rows of the legend.

Returns:
The vertical gap in pixel.

setVGap

public void setVGap(float vgap)
Sets the vertical gap between the rows of the legend.

Parameters:
vgap - The vertical gap in pixel.

getMaxWidth

public float getMaxWidth()
Returns the maximum with of this legend. This parameter is only considered if the orientation is HORIZONTAL. If not all elements fit on one row, then, the remaining elements are placed on the next row.

Returns:
The maximum width of this legend.

setMaxWidth

public void setMaxWidth(float width)
Sets the maximum with of this legend. This parameter is only considered if the orientation is HORIZONTAL. If not all elements fit on one row, then, the remaining elements are placed on the next row.

Parameters:
width - The maximum width of this legend.

getMaxHeight

public float getMaxHeight()
Returns the maximum height of this legend. This parameter is only considered if the orientation is VERTICAL. If not all elements fit on one column, then, the remaining elements are placed on the next column.

Returns:
The maximum height of this legend.

setMaxHeight

public void setMaxHeight(float height)
Sets the maximum height of this legend. This parameter is only considered if the orientation is VERTICAL. If not all elements fit on one column, then, the remaining elements are placed on the next column.

Parameters:
height - The maximum height of this legend.

getOrientation

public int getOrientation()
Returns the orientation of this legend.

Returns:
Either HORIZONTAL or VERTICAL.

setOrientation

public void setOrientation(int orientation)
Sets the orientation of this legend.

Parameters:
orientation - Specify either HORIZONTAL or VERTICAL to layout the legend in rows or columns.

getLayout

public Layout getLayout(java.awt.Graphics g)
Description copied from interface: Part
Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.

Parameters:
g - The relevant graphics object.
Returns:
A layout that is able to report the bounds of this part and is able to paint this part. This method may also return null.

isMovable

public boolean isMovable()

getItemWidth

protected abstract float getItemWidth(GraphLook graphLook)
Subclasses must implement this method to report the item width.

Parameters:
graphLook - The current graph look.
Returns:
The width of the item.

getItemHeight

protected abstract float getItemHeight(GraphLook graphLook)
Subclasses must implement this method to report the item height.

Parameters:
graphLook - The current graph look.
Returns:
The height of the item.

layoutItem

protected abstract void layoutItem(java.awt.Graphics g,
                                   DefaultLayout layout,
                                   java.awt.geom.Rectangle2D.Float itemBounds,
                                   GraphLook graphLook,
                                   int rowIndex,
                                   int columnIndex)
Subclasses must implement this method to layout an item.

Parameters:
g - The current graphics context.
layout - The resulting layout.
itemBounds - The bounds of the current item.
rowIndex - The index of the row.
columnIndex - The index of the column.

ChartCat 1.2

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print