|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ITrace2D
An interface used by Chart2D
. ITrace2D contains the values to display, the color
for displaying and a suitable label. It may be seen as a trace of the Chart2D
that
displays it.
Implementations may be optimized for different use- cases:
RingBuffers for fast changing data to keep the amount of tracepoints and consumption of memory
constant, internal Lists for allowing the sorting the internal TracePoint2D
-
instances or Arrays for unordered Data (in the order of adding) for fast performance. Even an
ITrace2D
constructed by a "function- Object" may be thinkable.
There are various constraints for Traces:
- ordered by x-values
- ordered by the order
of addPoint
- invocation (control form outside)
- unique, single x- values
- limitation of tracepoints
- time- critical (fast- changing tracepoints)
Therefore there are various ITrace2D
- implementations. Read their description to
find the one you need. Some may not have been written yet.
Comparable
should be implemented by using the internal property zIndex (see
getZIndex()
, setZIndex(Integer)
).
PropertyChangeEvent
may be fired to
PropertyChangeListener
instances that register themselves with
addPropertyChangeListener(String, PropertyChangeListener)
. getPropertyName() |
getSource() |
getOldValue() |
getNewValue() |
---|---|---|---|
|
that changed |
, the old value |
, the new value |
|
that changed |
, the old value |
, the new value |
|
that changed |
, the old value |
, the new value |
|
that changed |
, the old value |
, the new value |
|
that changed |
, the old value |
, the new value |
|
that changed |
, the instance that was
removed |
null , indication that an instance was removed |
|
that changed |
null , indication that a value was added |
, the new instance that was
added, identifying that an instance was removed |
|
that changed |
, the old state. |
, the new state. |
|
that changed |
null , indicating that a painter was added. |
, the new painter. |
|
that changed |
, the old painter. |
null , indicating that a painter was removed. |
|
that changed |
, the old stroke. |
, the new stroke. |
|
that changed |
, the new color. |
, the new color. |
|
that changed |
null , indicating that an error bar policy was added. |
, the new error bar
policy. |
|
that changed |
, the old error bar
policy. |
null , indicating that an error bar policy was removed. |
|
that notifies the change of the configured error bar policy. |
null | , the instance with the
configuration change. |
|
that notifies the change of the contained trace point. |
null because it would be too much overhead to store the old point in a
additional instance as the original is modified in
. |
the point whose location was modified. |
Field Summary | |
---|---|
static String |
PROPERTY_COLOR
The property key defining the color property. |
static String |
PROPERTY_ERRORBARPOLICY
The property key defining a change of instances
contained. |
static String |
PROPERTY_ERRORBARPOLICY_CONFIGURATION
The property key defining a change of the configuration of a contained . |
static String |
PROPERTY_MAX_X
The property key defining the maxX property. |
static String |
PROPERTY_MAX_Y
The property key defining the maxY property. |
static String |
PROPERTY_MIN_X
The property key defining the minX property. |
static String |
PROPERTY_MIN_Y
The property key defining the minY property. |
static String |
PROPERTY_NAME
The property key defining the name property. |
static String |
PROPERTY_PAINTERS
The property key defining a change in the set of
instances. |
static String |
PROPERTY_PHYSICALUNITS
The property key defining the physicalUnits property. |
static String |
PROPERTY_POINT_CHANGED
The property key defining any change of a localtion of a contained . |
static String |
PROPERTY_STROKE
The property key defining the stroke property. |
static String |
PROPERTY_TRACEPOINT
The property key defining a change in the collection of
instances within this trace. |
static String |
PROPERTY_VISIBLE
The property key defining the visible property. |
static String |
PROPERTY_ZINDEX
The property key defining the zIndex property. |
static int |
Z_INDEX_MIN
The minimum value for property zIndex: 0. |
static int |
ZINDEX_MAX
The maximum value for property zIndex: 100. |
Method Summary | |
---|---|
void |
addComputingTrace(ITrace2D trace)
Adds a trace that "should" compute values from the points added via . |
boolean |
addErrorBarPolicy(IErrorBarPolicy errorBarPolicy)
Adds the given error bar policy to the internal set of error bar policies. |
boolean |
addPoint(double x,
double y)
Adds a tracepoint to the internal data. |
boolean |
addPoint(TracePoint2D p)
Adds the given TracePoint2D to the internal data. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Registers a property change listener that will be informed about changes of the property identified by the given propertyName . |
boolean |
addTracePainter(ITracePainter painter)
Adds the given trace painter to the internal set of trace painters. |
boolean |
containsTracePainter(ITracePainter painter)
Returns true if the given painter is contained in this compound painter. |
void |
firePointChanged(TracePoint2D changed,
int state)
Method to trigger by ,
or
. |
Color |
getColor()
Because the color is data common to a trace of a Chart2D it is stored here. |
Set |
getErrorBarPolicies()
Returns the Set< that will be used to render
error bars for this trace. |
boolean |
getHasErrorBars()
Returns true if this trace has error bars configured. |
String |
getLabel()
Callback method for the Chart2D that returns a String describing
the label of the ITrace2D that will be displayed below the drawing area of the
Chart2D . |
int |
getMaxSize()
Returns the maximum amount of TracePoint2D instances that may be added. |
double |
getMaxX()
Returns the maximum value to be displayed on the x- axis of the Chart2D . |
double |
getMaxY()
Returns the maximum value to be displayed on the y- axis of the Chart2D. |
double |
getMinX()
Returns the minimum value to be displayed on the x- axis of the Chart2D. |
double |
getMinY()
Returns the minimum value to be displayed on the y- axis of the Chart2D. |
String |
getName()
Returns the name of this trace. |
String |
getPhysicalUnits()
Returns the concatenation [x: " . |
String |
getPhysicalUnitsX()
Returns the physical unit string value for the x dimension. |
String |
getPhysicalUnitsY()
Returns the physical unit string value for the y dimension. |
PropertyChangeListener[] |
getPropertyChangeListeners(String property)
Returns all property change listeners for the given property. |
Chart2D |
getRenderer()
|
int |
getSize()
Returns the amount of TracePoint2D instances currently contained. |
Stroke |
getStroke()
Returns the Stroke that is used to render this instance. |
Set |
getTracePainters()
Returns the Set< that will be used to paint this
trace. |
Integer |
getZIndex()
The z-index defines the order in which this instance will be painted. |
boolean |
isEmpty()
Returns false if internal instances are contained or true
if not. |
boolean |
isVisible()
Returns true if this instance should be rendered. |
Iterator |
iterator()
Returns an Iterator over the internal
instances. |
void |
removeAllPoints()
Removes all internal TracePoint2D . |
boolean |
removeComputingTrace(ITrace2D trace)
Remove a trace that "should" compute values from the points added via . |
boolean |
removeErrorBarPolicy(IErrorBarPolicy errorBarPolicy)
Removes the given error bar policy from the internal set of error bar policies. |
boolean |
removePoint(TracePoint2D point)
Removes the given point from this trace. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Deregisters a property change listener that has been registerd for listening on all properties. |
void |
removePropertyChangeListener(String property,
PropertyChangeListener listener)
Removes a property change listener for listening on the given property. |
boolean |
removeTracePainter(ITracePainter painter)
Removes the given trace painter, if it's class is contained and if more painters are remaining. |
void |
setColor(Color color)
Set a java.awt.Color for this trace. |
Set |
setErrorBarPolicy(IErrorBarPolicy errorBarPolicy)
Replaces all internal error bar policies by the new one. |
void |
setName(String name)
Assingns a specific name to the ITrace2D which will be displayed by the
Chart2D . |
void |
setPhysicalUnits(String xunit,
String yunit)
Assings a specific String representing the physical unit to the
ITrace2D (e.g. |
void |
setRenderer(Chart2D renderer)
This is a callback from Chart2D.addTrace(ITrace2D) and must not be invoked from
elswhere (needed for synchronization). |
void |
setStroke(Stroke stroke)
Allows to specify the rendering of the ITrace2D. |
Set |
setTracePainter(ITracePainter painter)
Replaces all internal trace painters by the new one. |
void |
setVisible(boolean visible)
Set the visibility. |
void |
setZIndex(Integer zIndex)
Sets the internal z-index property. |
boolean |
showsErrorBars()
Tests whether error bars are painted by this trace. |
boolean |
showsNegativeXErrorBars()
Tests whether error bars in negative x direction are painted by this trace. |
boolean |
showsNegativeYErrorBars()
Tests whether error bars in negative y direction are painted by this trace. |
boolean |
showsPositiveXErrorBars()
Tests whether error bars in positive x direction are painted by this trace. |
boolean |
showsPositiveYErrorBars()
Tests whether error bars in positive y direction are painted by this trace. |
Methods inherited from interface info.monitorenter.util.collections.IComparableProperty |
---|
getComparableProperty, setComparableProperty |
Methods inherited from interface java.beans.PropertyChangeListener |
---|
propertyChange |
Field Detail |
---|
static final String PROPERTY_COLOR
color
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_ERRORBARPOLICY
IErrorBarPolicy
instances
contained.
This is fired from
,
addErrorBarPolicy(IErrorBarPolicy)
and
removeErrorBarPolicy(IErrorBarPolicy)
.
setErrorBarPolicy(IErrorBarPolicy)
Use in combination with addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_ERRORBARPOLICY_CONFIGURATION
IErrorBarPolicy
.
This is fired whenever an IErrorBarPolicy
notifies this instance of a
configuration change via an event for
.
IErrorBarPolicy.PROPERTY_CONFIGURATION
Use in combination with addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_MAX_X
maxX
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_MAX_Y
maxY
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_MIN_X
minX
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_MIN_Y
minY
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_NAME
name
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_PAINTERS
ITracePainter
instances. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_PHYSICALUNITS
physicalUnits
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_POINT_CHANGED
TracePoint2D
.
Use in combination with addPropertyChangeListener(String, PropertyChangeListener)
.
Property change event with this property will be fired if method
or
Point2D.setLocation(java.awt.geom.Point2D)
of any contained point is
invoked.
TracePoint2D.setLocation(double, double)
static final String PROPERTY_STROKE
stroke
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_TRACEPOINT
TracePoint2D
instances within this trace. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_VISIBLE
visible
property. Use in combination with
addPropertyChangeListener(String, PropertyChangeListener)
.
static final String PROPERTY_ZINDEX
zIndex
property.
Use in combination with addPropertyChangeListener(String, PropertyChangeListener)
.
static final int Z_INDEX_MIN
getZIndex()
,
setZIndex(Integer)
,
Constant Field Valuesstatic final int ZINDEX_MAX
the descriptive name for this trace.
getZIndex()
,
setZIndex(Integer)
,
Constant Field ValuesMethod Detail |
---|
void addComputingTrace(ITrace2D trace)
addPoint(TracePoint2D)
.
The given trace will be informed in case an add operation on this trace succeeds via
.
addPoint(TracePoint2D)
trace
- the trace that will calculate it's points from the added points of this trace.boolean addErrorBarPolicy(IErrorBarPolicy errorBarPolicy)
It will be the last error bar policy to render (most forward on screen).
errorBarPolicy
- the error bar policy to add for rendering this trace's error bars.
boolean addPoint(double x, double y)
x
- the x-value of the point to add.y
- the y-value of the point to add.
addPoint(TracePoint2D p)
boolean addPoint(TracePoint2D p)
TracePoint2D
to the internal data.
Try to pass instances of TracePoint2D
to this instance instead of invoking
to increase performace. Else the given point
has to be copied into such an instance from the other method and delegated to this method.
addPoint(double, double)
Implementations decide wether the point will be accepted or not. So they have to update the
internal properties minX
, maxX
,maxY
and
minY
and also care about firing property change events for those properties by
method
.
PropertyChangeSupport.firePropertyChange(java.beans.PropertyChangeEvent)
p
- the point to add.
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
.
propertyName
- the name of the property the listener is interested inlistener
- a listener that will only be informed if the property identified by the argument
propertyName
changesboolean addTracePainter(ITracePainter painter)
It will be the last painter to paint (most forward).
painter
- the painter to add for rendering this trace.
boolean containsTracePainter(ITracePainter painter)
painter
- the painter to check wether it is contained.
void firePointChanged(TracePoint2D changed, int state)
TracePoint2D.setLocation(double, double)
,
addPoint(TracePoint2D)
or
removePoint(TracePoint2D)
.
Bound checks are performed and property change events for the properties
, PROPERTY_MAX_X
,
PROPERTY_MIN_X
and PROPERTY_MAX_Y
are fired if the add bounds have changed due to the modification of the point.
PROPERTY_MIN_Y
changed
- the point that has been changed which may be a newly added point (from
addPoint(TracePoint2D)
, a removed one or a modified one.state
- one of {TracePoint2D.STATE_ADDED
, TracePoint2D.STATE_CHANGED
,
TracePoint2D.STATE_REMOVED
}
to inform about the type of change.Color getColor()
Chart2D
it is stored here.
On the other hand only the corresponding Chart2D
may detect the same color
chosen for different IChart2D
instances to be displayed. Therefore it is allowed
to return null. This is a message to the Chart2D
to leave it the choice of the
color. Then the Chart2D
will chose a color not owned by another
ITrace2D
instance managed and assign it to the null- returning instance.
The Chart2D
will often call this method. So try to cache the value in
implementation and only check on modifications of TracePoint
instances or on
add
- invocations for changes.
Chart2D
.Set getErrorBarPolicies()
Set<IErrorBarPolicy
>
that will be used to render
error bars for this trace.
Set<IErrorBarPolicy
>
that will be used to render
error bars for this trace.boolean getHasErrorBars()
If this returns false, no error bars will be painted for this trace.
String getLabel()
Chart2D
that returns a String
describing
the label of the ITrace2D
that will be displayed below the drawing area of the
Chart2D
.
This method should be implemented and finalized ASAP in the inheritance tree and rely on the
property name
and physicalUnits
.
int getMaxSize()
Returns the maximum amount of TracePoint2D
instances that may be added. For
implementations that limit the maximum amount this is a reasonable amount. Non-limiting
implementations should return Integer.MAX_VALUE
. This allows to detect the
unlimitedness. Of course no implementation could store that amount of points.
TracePoint2D
instances that may be added.double getMaxX()
Chart2D
.
Implementations should be synchronized for multithreaded use. No exception is thrown. In case
of empty data (no tracepoints) 0 should be returned, to let the Chart2D know.
The Chart2D
will often call this method. So try to cache the value in
implementation and only check on modifications of TracePoint
instances or on
add
- invocations for changes.
double getMaxY()
double getMinX()
Implementations should be synchronized for multithreaded use. No exception is thrown. In case of empty data (no tracepoints) 0 should be returned. (watch division with zero).
The Chart2D
will often call this method. So try to cache the value in
implementation and only check on modifications of TracePoint
instances or on
add
- invocations for changes.
double getMinY()
Implementations should be synchronized for multithreaded use. No exception is thrown. In case of empty data (no tracepoints) 0 should be returned. (watch division with zero).
The Chart2D
will often call this method. So try to cache the value in
implementation and only check on modifications of TracePoint
instances or on
add
- invocations for changes.
String getName()
setName(String s)
String getPhysicalUnits()
[x: "getPhysicalUnitsX()
", y: "getPhysicalUnitsY()
"]
.
[x: "getPhysicalUnitsX()
", y: "getPhysicalUnitsY()
"]
.setPhysicalUnits(String x,String y)
String getPhysicalUnitsX()
setPhysicalUnits(String x,String y)
String getPhysicalUnitsY()
setPhysicalUnits(String x,String y)
PropertyChangeListener[] getPropertyChangeListeners(String property)
property
- one of the constants with the PROPERTY_
prefix defined in this class
or subclasses.
Chart2D getRenderer()
int getSize()
TracePoint2D
instances currently contained.
TracePoint2D
instances currently contained.Stroke getStroke()
setStroke(Stroke)
Set getTracePainters()
Set<ITracePainter
>
that will be used to paint this
trace.
Set<ITracePainter
>
that will be used to paint this
trace.Integer getZIndex()
A lower value will bring it more "to the front".
boolean isEmpty()
TracePoint2D
instances are contained or true
if not.
TracePoint2D
instances are
contained or true if not.boolean isVisible()
Iterator iterator()
Iterator
over the internal TracePoint2D
instances.
Implementations should be synchronized. This method is meant to allow modifications of the
intenal TracePoint2D
instances, so the original points should be returned.
There is no guarantee that changes made to the contained tracepoints will be reflected in the
display immediately. The order the iterator returns the TracePoint2D
instances
decides how the Chart2D
will paint the trace.
Iterator
over the internal TracePoint2D
instances.void removeAllPoints()
TracePoint2D
.isEmpty()
will return true
afterwards.
boolean removeComputingTrace(ITrace2D trace)
addPoint(TracePoint2D)
.
trace
- the trace that will calculate it's points from the added points of this trace.
Object.equals(Object)
).boolean removeErrorBarPolicy(IErrorBarPolicy errorBarPolicy)
errorBarPolicy
- the error bar policy to remove.
boolean removePoint(TracePoint2D point)
point
- the point to remove.
void removePropertyChangeListener(PropertyChangeListener listener)
listener
- a listener that will only be informed if the property identified by the argument
propertyName
changesvoid removePropertyChangeListener(String property, PropertyChangeListener listener)
property
- one of the constants with teh PROPERTY_
prefix defined in this class
or subclasses.listener
- the listener for this property change.boolean removeTracePainter(ITracePainter painter)
painter
- the trace painter to remove.
void setColor(Color color)
java.awt.Color
for this trace.
color
- the Color to set.Set setErrorBarPolicy(IErrorBarPolicy errorBarPolicy)
errorBarPolicy
- the new sole painter to use.
Set<IErrorBarPolicy
>
that was used before.void setName(String name)
ITrace2D
which will be displayed by the
Chart2D
.
name
- the name for this trace.void setPhysicalUnits(String xunit, String yunit)
ITrace2D
(e.g.
Volt, Ohm, lux, ...) which will be displayed by the Chart2D
xunit
- the physical unit for the x axis.yunit
- the physical unit for the y axis.void setRenderer(Chart2D renderer)
Chart2D.addTrace(ITrace2D)
and must not be invoked from
elswhere (needed for synchronization).
Not the best design to put this to an interface, but Char2D should handle this interface only.
renderer
- The renderer to set.void setStroke(Stroke stroke)
Graphics2D
by the rendering Chart2D
when painting this instance.
stroke
- the stroke to use for painting this trace.Set setTracePainter(ITracePainter painter)
painter
- the new sole painter to use.
Set<ITracePainter
>
that was used before.void setVisible(boolean visible)
visible
- true if this trace should be painted, false else.void setZIndex(Integer zIndex)
Chart2D
are painted.
The lower the given value is the more this trace will be brought to front.
The value must not be lower than Z_INDEX_MIN
(0) and higher than ZINDEX_MAX
(100).
This might not be tested for increased performance but ignoring these bounds may result in wrong ordering of display.
zIndex
- the z index of this trace - the lower the value the more in front the trace will
appear amongst other traces in the same chart.getZIndex()
boolean showsErrorBars()
Returns true if
IErrorBarPolicy
instances. IErrorBarPainter
instance.
boolean showsNegativeXErrorBars()
Returns true if
IErrorBarPolicy
instance that
IErrorBarPolicy.isShowNegativeXErrors()
. IErrorBarPainter
instance.
boolean showsNegativeYErrorBars()
Returns true if
IErrorBarPolicy
instance that
IErrorBarPolicy.isShowNegativeYErrors()
. IErrorBarPainter
instance.
boolean showsPositiveXErrorBars()
Returns true if
IErrorBarPolicy
instance that
IErrorBarPolicy.isShowPositiveXErrors()
. IErrorBarPainter
instance.
boolean showsPositiveYErrorBars()
Returns true if
IErrorBarPolicy
instance that
IErrorBarPolicy.isShowPositiveYErrors()
. IErrorBarPainter
instance.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |