|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.approximatrix.charting.render.AbstractRenderer
com.approximatrix.charting.coordsystem.AbstractCoordSystem
public abstract class AbstractCoordSystem
Implements some common components of a Coordinate System object. Provides the render listener functionality, unit storage, decimal formats for tick marks, fonts, bounds, and margin information.
| Field Summary | |
|---|---|
protected int |
bottommargin
The bottom margin. |
(package private) java.awt.Rectangle |
bounds
The bounds within which this object should be rendered. |
protected boolean |
centerObjectLabelsBetweenTicks
Flag to center labels for object x-axis between tick marks |
protected java.text.DecimalFormat |
dfX
DecimalFormat used throught on the Xaxis of the ClassicCoordSystem |
protected java.text.DecimalFormat |
dfY
DecimalFormat used throught on the Yaxis of the ClassicCoordSystem |
protected int |
leftmargin
The left margin |
protected javax.swing.event.EventListenerList |
listener
The listener list. |
protected int |
rightmargin
The right margin. |
protected boolean |
shouldPaintAxes
If true, axes will be drawn, but nothing is drawn if false |
protected boolean |
shouldPaintGrid
If true, a grid is painted along with the tick marks. |
protected boolean |
shouldPaintLabels
If true, the labels will be painted. |
protected boolean |
shouldPaintOnlyTick
if true only the tick will be painted on the yaxis. |
protected java.awt.Font |
tickFont
The font used for labeling tick marks |
protected int |
topmargin
The top margin. |
protected java.awt.Font |
unitFont
The font used for axis units |
protected Axis |
xaxis
The xaxis. |
protected java.lang.String |
xaxis_unit
The x-axis caption string. |
protected java.awt.geom.AffineTransform |
y1transform
The multiplication matrix for the first y-axis and the x-axis. |
protected java.awt.geom.AffineTransform |
y2transform
The multiplication matrix for the second y-axis and the x-axis. |
protected Axis |
yaxis
The first y-axis. |
protected java.lang.String |
yaxis_unit
The y-axis caption string. |
protected Axis |
yaxis2
The second y-axis. |
| Fields inherited from interface com.approximatrix.charting.coordsystem.CoordSystem |
|---|
FIRST_YAXIS, SECOND_YAXIS |
| Constructor Summary | |
|---|---|
AbstractCoordSystem()
|
|
| Method Summary | |
|---|---|
void |
addRenderChangeListener(RenderChangeListener l)
Adds a RenderChangeListener. |
void |
clearRenderChangeListeners()
Clears all RenderChangeListeners from the object |
protected abstract int |
computeBottomMargin()
Computes the bottom margin. |
protected abstract int |
computeLeftMargin()
Computes the left margin. |
protected abstract int |
computeRightMargin()
Computes the right margin. |
protected abstract int |
computeTopMargin()
Computes the top margin. |
void |
fireRenderChangeEvent()
Protected function that fires a render change event, notifying any listeners that this renderable component needs to be redrawn. |
protected int |
getBottomMargin()
Returns the bottom margin. |
java.awt.Rectangle |
getBounds()
Gets the bounds for this renderer. |
java.awt.geom.AffineTransform |
getDefaultTransform(int axis)
This method computes the default transform which transforms the user space coordinates of this coordinate system to the pixel space coordinates used in the Graphics object. |
Axis |
getFirstYAxis()
Returns the first y-axis. |
java.awt.Font |
getFont()
Deprecated. Deprecated in version 1.4 - use getTickFont() |
java.awt.Rectangle |
getInnerBounds()
Returns the inner margin, ie the bounds minus the margins. |
protected int |
getLeftMargin()
Returns the left margin. |
boolean |
getPaintGrid()
Returns whether a grid is painted. |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size needed for the renderer. |
protected int |
getRightMargin()
Returns the right margin. |
Axis |
getSecondYAxis()
Returns the second y-axis. |
java.awt.Font |
getTickFont()
Returns the font used for the axis tick labels. |
protected int |
getTopMargin()
Returns the top margin. |
java.awt.geom.AffineTransform |
getTransform(int axis)
Returns the currently defined AffineTransform for any y-axis. |
java.awt.Font |
getUnitFont()
Returns the font used for the axis unit labels. |
Axis |
getXAxis()
Returns the x axis. |
java.lang.String |
getXAxisUnit()
Gets the x-axis unit string. |
java.text.DecimalFormat |
getXDecimalFormat()
Returns the DecimalFormat used on the Xaxis |
java.lang.String |
getYAxisUnit()
Gets the y-axis label. |
java.text.DecimalFormat |
getYDecimalFormat()
Returns the DecimalFormat used on the Yaxis |
boolean |
isCenterLabelsBetweenTicks()
Returns true if labels are centered between ticks. |
boolean |
isPaintAxes()
Returns whether axes will be painted. |
boolean |
isPaintGrid()
if true, a grid will be painted on the chart |
boolean |
isPaintLabels()
if true, labels will be painted for each axis |
boolean |
isPaintOnlyTick()
if true only the tick will be painted on the yaxis. |
abstract void |
paintDefault(java.awt.Graphics2D g)
This method is called by the paint method to do the actual painting. |
void |
removeRenderChangeListener(RenderChangeListener l)
Removes a RenderChangeListener. |
void |
render(java.awt.Graphics2D g)
Renders the Object in the Graphics object. |
protected void |
setBottomMargin(int margin)
|
void |
setBounds(java.awt.Rectangle bounds)
Sets the bounds the layout manager has assigned to this renderer. |
void |
setCenterLabelsBetweenTicks(boolean value)
Forces the coordinate system to place the label centered between tick marks (for bar charts for example). |
void |
setFirstYAxis(Axis a)
Sets the left y-axis and computes the matrix transformation. |
void |
setFont(java.awt.Font f)
Sets the font for the axis tick labels. |
protected void |
setLeftMargin(int margin)
Sets the left margin. |
void |
setPaintAxes(boolean axes)
Sets whether the axes will be painted. |
void |
setPaintGrid(boolean value)
Sets whether a grid is painted. |
void |
setPaintLabels(boolean label)
Sets whether labels should be painted for the axes |
protected void |
setRightMargin(int margin)
Sets the right margin. |
void |
setSecondYAxis(Axis a)
Sets the second y-axis and computes the matrix transformation. |
void |
setTickFont(java.awt.Font f)
Sets the font for the axis tick labels. |
protected void |
setTopMargin(int margin)
Sets the top margin. |
void |
setTransform(java.awt.geom.AffineTransform at,
int axis)
Sets the coordinate transformation for any y-coordinate. |
protected void |
setTransforms()
Sets axes transforms for this coordinate system |
void |
setUnitFont(java.awt.Font f)
Sets the font for the axis unit labels. |
void |
setXAxis(Axis a)
Sets the x-axis. |
void |
setXAxisUnit(java.lang.String xunit)
Sets the X axis unit to be displayed along the x axis |
void |
setXDecimalFormat(java.text.DecimalFormat df)
Returns the DecimalFormat used on the Xaxis |
void |
setYAxisUnit(java.lang.String yunit)
Sets the Y axis unit to be displayed along the y axis |
void |
setYDecimalFormat(java.text.DecimalFormat df)
Returns the DecimalFormat used on the Yaxis |
| Methods inherited from class com.approximatrix.charting.render.AbstractRenderer |
|---|
getDirectRender, isDifferentBounds, setDirectRender |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.approximatrix.charting.coordsystem.CoordSystem |
|---|
chartDataChanged, getChartDataModelConstraints, getMaximumXTicks, getMaximumYTicks, resetMaximumXTicks, resetMaximumYTicks, setMaximumXTicks, setMaximumYTicks |
| Field Detail |
|---|
protected javax.swing.event.EventListenerList listener
protected java.lang.String xaxis_unit
protected java.lang.String yaxis_unit
protected java.text.DecimalFormat dfY
protected java.text.DecimalFormat dfX
protected java.awt.Font tickFont
protected java.awt.Font unitFont
protected Axis xaxis
protected Axis yaxis
protected Axis yaxis2
protected int leftmargin
protected int topmargin
protected int rightmargin
protected int bottommargin
protected boolean shouldPaintOnlyTick
protected boolean shouldPaintLabels
protected boolean shouldPaintGrid
protected boolean shouldPaintAxes
java.awt.Rectangle bounds
protected java.awt.geom.AffineTransform y1transform
protected java.awt.geom.AffineTransform y2transform
protected boolean centerObjectLabelsBetweenTicks
| Constructor Detail |
|---|
public AbstractCoordSystem()
| Method Detail |
|---|
public java.awt.Font getFont()
CoordSystem
getFont in interface CoordSystempublic java.awt.Font getTickFont()
CoordSystem
getTickFont in interface CoordSystempublic java.awt.Font getUnitFont()
CoordSystem
getUnitFont in interface CoordSystempublic Axis getXAxis()
CoordSystem
getXAxis in interface CoordSystempublic java.lang.String getXAxisUnit()
CoordSystem
getXAxisUnit in interface CoordSystempublic java.text.DecimalFormat getXDecimalFormat()
CoordSystem
getXDecimalFormat in interface CoordSystempublic java.lang.String getYAxisUnit()
CoordSystem
getYAxisUnit in interface CoordSystempublic java.text.DecimalFormat getYDecimalFormat()
CoordSystem
getYDecimalFormat in interface CoordSystempublic abstract void paintDefault(java.awt.Graphics2D g)
AbstractRenderer
paintDefault in interface CoordSystempaintDefault in class AbstractRendererg - the Graphics2D object to paint in.public void render(java.awt.Graphics2D g)
AbstractRendererpaintDefault
is called to perform a standard painting in the Graphics object.
If the bounds and the preferred size don't match the image is
scaled afterwards.
render in interface CoordSystemrender in interface Rendererrender in class AbstractRendererg - the Graphics2D object in which to renderpublic void setFont(java.awt.Font f)
CoordSystem
setFont in interface CoordSystemf - the Font to be usedpublic void setTickFont(java.awt.Font f)
CoordSystem
setTickFont in interface CoordSystemf - the Font to be usedpublic void setUnitFont(java.awt.Font f)
CoordSystem
setUnitFont in interface CoordSystemf - the Font to be usedCoordSystem.setUnitFont(java.awt.Font)public java.awt.Rectangle getBounds()
AbstractRenderer
getBounds in interface RenderergetBounds in class AbstractRenderersetBounds has not
been called before, the bounds computed from
getPreferredSize is returned.public java.awt.Dimension getPreferredSize()
CoordSystem
getPreferredSize in interface CoordSystemgetPreferredSize in interface Rendererpublic void setBounds(java.awt.Rectangle bounds)
AbstractRenderer
setBounds in interface CoordSystemsetBounds in interface RenderersetBounds in class AbstractRendererbounds - the new bounds for the renderer.protected void setTransforms()
public boolean isPaintOnlyTick()
CoordSystem
isPaintOnlyTick in interface CoordSystempublic boolean isPaintLabels()
CoordSystem
isPaintLabels in interface CoordSystempublic boolean isPaintGrid()
CoordSystem
isPaintGrid in interface CoordSystempublic void setPaintGrid(boolean value)
CoordSystem
setPaintGrid in interface CoordSystemvalue - whether the grid should be paintedpublic boolean getPaintGrid()
CoordSystem
getPaintGrid in interface CoordSystempublic void setPaintLabels(boolean label)
CoordSystem
setPaintLabels in interface CoordSystemlabel - true to paint labels, false otherwisepublic boolean isPaintAxes()
CoordSystem
isPaintAxes in interface CoordSystempublic void setPaintAxes(boolean axes)
CoordSystem
setPaintAxes in interface CoordSystemaxes - true to paint axes, false otherwisepublic void setXAxis(Axis a)
CoordSystem
setXAxis in interface CoordSystema - the x-axispublic void setFirstYAxis(Axis a)
CoordSystem
setFirstYAxis in interface CoordSystema - the left y-axispublic Axis getFirstYAxis()
CoordSystem
getFirstYAxis in interface CoordSystempublic void setSecondYAxis(Axis a)
CoordSystem
setSecondYAxis in interface CoordSystema - the right y-axispublic Axis getSecondYAxis()
CoordSystem
getSecondYAxis in interface CoordSystempublic void setXAxisUnit(java.lang.String xunit)
setXAxisUnit in interface CoordSystemxunit - the text to displaypublic void setYAxisUnit(java.lang.String yunit)
setYAxisUnit in interface CoordSystemyunit - the text to displaypublic void setXDecimalFormat(java.text.DecimalFormat df)
CoordSystem
setXDecimalFormat in interface CoordSystemCoordSystem.setXDecimalFormat(java.text.DecimalFormat)public void setYDecimalFormat(java.text.DecimalFormat df)
CoordSystem
setYDecimalFormat in interface CoordSystemCoordSystem.setYDecimalFormat(java.text.DecimalFormat)public void fireRenderChangeEvent()
fireRenderChangeEvent in interface RendererfireRenderChangeEvent in class AbstractRendererpublic void removeRenderChangeListener(RenderChangeListener l)
removeRenderChangeListener in interface RendererremoveRenderChangeListener in class AbstractRendererl - the RenderChangeListenerpublic void addRenderChangeListener(RenderChangeListener l)
addRenderChangeListener in interface RendereraddRenderChangeListener in class AbstractRendererl - the RenderChangeListenerpublic void clearRenderChangeListeners()
clearRenderChangeListeners in interface RendererclearRenderChangeListeners in class AbstractRendererprotected int getLeftMargin()
protected int getRightMargin()
protected int getTopMargin()
protected int getBottomMargin()
protected void setLeftMargin(int margin)
margin - the new margin valueprotected void setRightMargin(int margin)
margin - the new margin valueprotected void setTopMargin(int margin)
margin - the new margin valueprotected void setBottomMargin(int margin)
protected abstract int computeLeftMargin()
margin - the new margin valueprotected abstract int computeRightMargin()
margin - the new margin valueprotected abstract int computeTopMargin()
margin - the new margin valueprotected abstract int computeBottomMargin()
margin - the new margin valuepublic java.awt.Rectangle getInnerBounds()
CoordSystem
getInnerBounds in interface CoordSystempublic java.awt.geom.AffineTransform getDefaultTransform(int axis)
CoordSystem
getDefaultTransform in interface CoordSystemaxis - defines which y-axis to use.public java.awt.geom.AffineTransform getTransform(int axis)
CoordSystem
getTransform in interface CoordSystemaxis - the y-axis to be used.
public void setTransform(java.awt.geom.AffineTransform at,
int axis)
CoordSystem
setTransform in interface CoordSystemat - the AffineTransform that transforms the coordinates into pixel
spacepublic boolean isCenterLabelsBetweenTicks()
CoordSystem
isCenterLabelsBetweenTicks in interface CoordSystempublic void setCenterLabelsBetweenTicks(boolean value)
CoordSystem
setCenterLabelsBetweenTicks in interface CoordSystemvalue - true to center, false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||