|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.monitorenter.gui.chart.axis.AAxis.AChart2DDataAccessor
public abstract class AAxis.AChart2DDataAccessor
An internal connector class that will connect the axis to the a Chart2D.
It is aggregated to the AAxis
in order to access either y values or x values of the
Chart2D thus making the IAxis an Y Axis or X axis. This strategy reduces redundant code for
label creation. It avoids complex inheritance / interface implements for different IAxis
implementation that would be necessary for y-axis / x-axis implementations.
Field Summary | |
---|---|
protected Chart2D |
m_chart
The chart that is accessed. |
protected IRangePolicy |
m_rangePolicy
A pluggable range policy. |
Constructor Summary | |
---|---|
protected |
AAxis.AChart2DDataAccessor(Chart2D chart)
Constructor with the chart that is acessed. |
Method Summary | |
---|---|
Chart2D |
getChart()
Returns the chart that is accessed. |
abstract int |
getDimension()
Returns the constant for the dimension that is accessed on the chart. |
abstract int |
getHeight(Graphics2D g2d)
Returns the height in pixel the corresponding axis needs to paint itself. |
protected abstract double |
getMax()
Returns the maximum value from the Chart2D's axis (X or Y) this instance is standing for with respect to the installed range policy. |
abstract double |
getMaxFromAxis()
|
protected abstract double |
getMaximumPixelForLabel(Graphics g2d)
Returns the maximum pixels that will be needed to paint a label. |
protected abstract double |
getMin()
|
abstract double |
getMinFromAxis()
|
protected abstract double |
getMinimumValueDistanceForLabels(Graphics g2d)
Returns the minimum amount of increase in the value that will be needed to display all labels without overwriting each others. |
protected abstract int |
getPixelRange()
Returns the amount of pixel avalable for displaying the values on the chart in the dimension this accessor stands for. |
IRangePolicy |
getRangePolicy()
|
protected abstract double |
getValueDistanceForPixel(int pixel)
Returns the value distance on the current chart that exists for the given amount of pixel distance in the given direction of this AAxis . |
abstract int |
getWidth(Graphics2D g2d)
Returns the width in pixel the corresponding axis needs to paint itself. |
protected abstract void |
scale()
Scales all instances in the dimension represented by this
axis. |
protected abstract void |
scaleTrace(ITrace2D trace,
Range range)
Scales the given trace in the dimension represented by this axis. |
void |
setRangePolicy(IRangePolicy rangePolicy)
Sets the RangePolicy. |
abstract double |
translateMousePosition(MouseEvent mouseEvent)
Returns the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension (x,y) covered by this axis. |
abstract double |
translatePxToValue(int pixel)
Transforms the given pixel value (which has to be a awt value like MouseEvent.getX() into the chart value. |
abstract int |
translateValueToPx(double value)
Transforms the given chart data value into the corresponding awt pixel value for the chart. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Chart2D m_chart
protected IRangePolicy m_rangePolicy
Constructor Detail |
---|
protected AAxis.AChart2DDataAccessor(Chart2D chart)
chart
- the chart that is acessed.Method Detail |
---|
public final Chart2D getChart()
public abstract int getDimension()
Chart2D.X
, Chart2D.Y
or -1 if this axis is not assigned to a chart.public abstract int getHeight(Graphics2D g2d)
This includes the axis line, it's ticks and labels and it's title.
g2d
- needed for font metric information.
protected abstract double getMax()
public abstract double getMaxFromAxis()
protected abstract double getMaximumPixelForLabel(Graphics g2d)
g2d
- provides information about the graphics context to paint on (e.g. font size).
protected abstract double getMin()
public abstract double getMinFromAxis()
protected abstract double getMinimumValueDistanceForLabels(Graphics g2d)
This procedure needs the amount of pixels needed by the largest possible label and relies on
the implementation of getMaximumPixelForLabel(Graphics)
, whose result is multiplied
with the "value per pixel" quantifier.
g2d
- the current graphic context to use in case further information is required.
protected abstract int getPixelRange()
This method must not be called within the first lines of a paint cycle (neccessary underlying values then are computed new).
public final IRangePolicy getRangePolicy()
protected abstract double getValueDistanceForPixel(int pixel)
Returns the value distance on the current chart that exists for the given amount of pixel
distance in the given direction of this AAxis
.
Depending on the width of the actual Chart2D and the contained values, the relation between
displayed distances (pixel) and value distances (the values of the addes
instances changes.
ITrace2D
This method calculates depending on the actual painting area of the Chart2D, the shift in
value between two points that have a screen distance of the given pixel.
This method is not used by the chart itself but a helper for outside use.
pixel
- The desired distance between to scalepoints of the x- axis in pixel.
public abstract int getWidth(Graphics2D g2d)
This includes the axis line, it's ticks and labels and it's title.
g2d
- needed for font metric information.
protected abstract void scale()
ITrace2D
instances in the dimension represented by this
axis.
This method is not deadlock - safe and should be called by the
only!
Chart2D
protected abstract void scaleTrace(ITrace2D trace, Range range)
This method is not deadlock - safe and should be called by the
only!
Chart2D
trace
- the trace to scale.range
- the range to use as scaler.public final void setRangePolicy(IRangePolicy rangePolicy)
A new Range with minimum and maxium of the chart is set to it to ensure that after the change all traces are shown.
rangePolicy
- The rangePolicy to set.public abstract double translateMousePosition(MouseEvent mouseEvent)
Note that the mouse event has to be an event fired on this component!
mouseEvent
- a mouse event that has been fired on this component.
public abstract double translatePxToValue(int pixel)
MouseEvent.getX()
into the chart value.
Internal use only, the interface does not guarantee that the pixel corresponds to any valid awt pixel value within the chart component.
Warning: A value transformed to a pixel by translateValueToPx(double)
and then
retransformed by translatePxToValue(int)
will most often have changed, as the
transformation from value to px a) has to hit an exact int b) most often will map from a
bigger domain (value range) to a smaller one (range of chart on the screen).
pixel
- a pixel value of the chart component as used by awt.
public abstract int translateValueToPx(double value)
The inverse transformation to translatePxToValue(int)
.
value
- a chart data value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |