DESY ACOP Beans Home

de.desy.acop.displayers.chart
Class AcopChartConsumer

java.lang.Object
  extended by de.desy.acop.displayers.chart.AcopChartConsumer
All Implemented Interfaces:
DataConsumer, DoubleSeqConsumer
Direct Known Subclasses:
AcopTrendChartConsumer

public class AcopChartConsumer
extends java.lang.Object
implements DoubleSeqConsumer

AcopChartConsumer is the common consumer used by the AcopChart and AcopChartReorg. Each consumer can present one graph in the chart and can be added or removed from the chart in runtime. This consumer works with AcopGraphParameters which specifiy all the properties required to customize a particular graph.

Author:
ikriznar
See Also:
AcopChart, AcopChartReorg

Field Summary
protected  AcopChartReorg acopChartReorg
           
protected  int arraySize
           
protected  java.awt.Color color
           
protected  java.lang.Object disable
           
protected  int dispalyMode
           
protected  AcopGraphParameters displayerParameters
           
protected  int displayHandle
           
protected  long lastTimestamp
           
protected  int maxNumber
           
protected  java.lang.String name
           
static java.lang.String[] SUPPORTED_CHARACTERISTICS
           
static java.lang.Class[] SUPPORTED_CONSUMER_TYPES
           
protected  int textHandle
           
protected  int width
           
protected  double[] xData
           
protected  java.lang.String[] xLabels
           
protected  double[] yData
           
 
Constructor Summary
AcopChartConsumer(AcopChartReorg acopChartReorg, java.lang.String name)
          Constructs new AcopChartConsumer.
 
Method Summary
protected  void applyParameters()
           
 void destroy()
          Removes the graph that this consumer shows from the chart.
 double[][] dumpData()
          Returns all data from chart.
 AcopChartReorg getAcopChart()
          Returns the parent chart component.
 int getArraySize()
          Returns the array size of the consumer.
 java.awt.Color getColor()
          Returns the color of this graph.
 DataConsumer getDataConsumer(java.lang.Class type)
           Returns data consumer for requested data consumer type.
 DataConsumer getDefaultDataConsumer()
          Returns the implementation of default consumer type supported by this data consumer.
 AcopGraphParameters getDisplayerParameters()
          Returns the AcopGraphParameters associated with this consumer.
 AcopDisplayMode getDisplayMode()
          Returns the display mode of this graph.
 long getLastTimestamp()
          Returns the last timestamp when value was updated.
 java.lang.String getName()
          Returns name of this data consumer.
 double getPreferredXMax()
          Returns the preferred maximum of the horizontal axis.
 double getPreferredXMin()
          Returns the preferred minimum of the horizontal axis.
 double getPreferredYMax()
          Returns the preferred maximum of the vertical axis.
 double getPreferredYMin()
          Returns the preferred minimum of the vertical axis.
 java.lang.String[] getSupportedCharacteristics()
          Resturns array with names of supported characteristics.
 java.lang.Class<DataConsumer>[] getSupportedConsumerTypes()
          Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.
 double[] getXData()
          Returns the x data
 java.lang.String[] getXLabels()
          Returns the horizotanl axis labels.
 double[] getYData()
          Returns the y data.
 boolean isChubbyLines()
          Returns true if this graph is drawn with a thicker line.
 boolean isDataDrawn()
          Returns true if data is plotted on the chart.
 boolean isTrendChart()
          Returns true if this graph is a trend.
 void refreshPlot()
          Refreshes all drawn points.
 void reinitializePlot()
          Redraws all graphs.
 void setCharacteristics(java.util.Map characteristics)
          Sets new dynamic value characteristics to this data consumer.
 void setChubbyLines(boolean chubbyLines)
          If true this graph is drawn with a thicker line.
 void setColor(java.awt.Color color)
          Sets the color for this graph.
 void setDisplayerParameters(AcopGraphParameters displayerParameters)
          Associates AcopGraphParameters with this consumer.
 void setDisplayMode(AcopDisplayMode displayMode)
          Sets the display mode for this graph.
 void setPreferredYMax(double preferredYMax)
          Sets the preferred maximum of the vertical axis.
 void setPreferredYMin(double preferredYMin)
          Sets the preferred minimum of the vertical axis.
 void setTrendChart(boolean isTrendChart)
          Sets the trend chart mode for this graph.
 void setXLabels(java.lang.String[] labels)
          Sets the labels for the horizontal axis.
protected  void updateChart()
           
 void updateDataState(DataState state)
          Push data state (quality) update change for dynamic value.
 void updateValue(long timestamp, double[] value)
          Notifys this consumer about new dynamic value update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_CONSUMER_TYPES

public static final java.lang.Class[] SUPPORTED_CONSUMER_TYPES

SUPPORTED_CHARACTERISTICS

public static final java.lang.String[] SUPPORTED_CHARACTERISTICS

name

protected java.lang.String name

acopChartReorg

protected AcopChartReorg acopChartReorg

xData

protected double[] xData

yData

protected double[] yData

displayHandle

protected int displayHandle

textHandle

protected int textHandle

lastTimestamp

protected long lastTimestamp

color

protected java.awt.Color color

width

protected int width

dispalyMode

protected int dispalyMode

xLabels

protected java.lang.String[] xLabels

disable

protected java.lang.Object disable

arraySize

protected int arraySize

maxNumber

protected int maxNumber

displayerParameters

protected AcopGraphParameters displayerParameters
Constructor Detail

AcopChartConsumer

public AcopChartConsumer(AcopChartReorg acopChartReorg,
                         java.lang.String name)
Constructs new AcopChartConsumer.

Parameters:
acopChartReorg - parent chart
name - the name of the consumer
Method Detail

getDataConsumer

public DataConsumer getDataConsumer(java.lang.Class type)
Description copied from interface: DataConsumer

Returns data consumer for requested data consumer type. If this data consumer does not support required data consumer, null is returned.

If this data cosnumer does not support specific data consumer type, then it means, that it is not desirable to cast data of that type to any by this consumer supported data consumer types.

Specified by:
getDataConsumer in interface DataConsumer
Parameters:
type - Class of specific data consumer (e.g. DoubleConsumer)
Returns:
implementation of required data consumer or null if not supported

getDefaultDataConsumer

public DataConsumer getDefaultDataConsumer()
Description copied from interface: DataConsumer
Returns the implementation of default consumer type supported by this data consumer.

Specified by:
getDefaultDataConsumer in interface DataConsumer
Returns:
the implementation of default consumer type supported by this data consumer

updateDataState

public void updateDataState(DataState state)
Description copied from interface: DataConsumer
Push data state (quality) update change for dynamic value. Usually called by data source.

Specified by:
updateDataState in interface DataConsumer
Parameters:
state - new data state(quality) descriptor

setCharacteristics

public void setCharacteristics(java.util.Map characteristics)
Description copied from interface: DataConsumer
Sets new dynamic value characteristics to this data consumer. This is usually called only at initializaation, before first data state or value is updated. Usually carries characteristics such as value minimum or maximum. Name and meaning of atributes is defined with contract betwean data consumer and source implementation.

Specified by:
setCharacteristics in interface DataConsumer
Parameters:
characteristics - the Map with attri

getName

public java.lang.String getName()
Description copied from interface: DataConsumer
Returns name of this data consumer.

Specified by:
getName in interface DataConsumer
Returns:
the name of this data consumer

getSupportedCharacteristics

public java.lang.String[] getSupportedCharacteristics()
Description copied from interface: DataConsumer
Resturns array with names of supported characteristics. Data source can use this method to optimize setting characteristics to this data consumer. If arrray of length 0 is return, then consumer does not need or support any characteristic. If null is returned, than consumer expect all existing characteristics from data source.

Specified by:
getSupportedCharacteristics in interface DataConsumer
Returns:
array with names of supported characteristics

getSupportedConsumerTypes

public java.lang.Class<DataConsumer>[] getSupportedConsumerTypes()
Description copied from interface: DataConsumer
Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.

Specified by:
getSupportedConsumerTypes in interface DataConsumer
Returns:
array of supported data consumer types

updateChart

protected void updateChart()

refreshPlot

public void refreshPlot()
Refreshes all drawn points.

See Also:
Acop.refreshScreen(Object, int, int, int, Object)

reinitializePlot

public void reinitializePlot()
Redraws all graphs.


dumpData

public double[][] dumpData()
Returns all data from chart. First index is 0 for X data array and 1 for Y data array.

Returns:
all dat a from chart in X and Y array

destroy

public void destroy()
Removes the graph that this consumer shows from the chart.


updateValue

public void updateValue(long timestamp,
                        double[] value)
                 throws CommonException
Description copied from interface: DoubleSeqConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface DoubleSeqConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException

getXData

public double[] getXData()
Returns the x data

Returns:
x values of the data

getYData

public double[] getYData()
Returns the y data.

Returns:
y values of the data

getAcopChart

public AcopChartReorg getAcopChart()
Returns the parent chart component.

Returns:
the acop chart

getLastTimestamp

public long getLastTimestamp()
Returns the last timestamp when value was updated.

Returns:
last timestamp

getColor

public java.awt.Color getColor()
Returns the color of this graph.

Returns:
the color of the graph

setColor

public void setColor(java.awt.Color color)
Sets the color for this graph. Can only be set before first draw.

Parameters:
color - the color of the graph

getXLabels

public java.lang.String[] getXLabels()
Returns the horizotanl axis labels. Can only be set before the first draw.

Returns:
the horizontal axis labels

setXLabels

public void setXLabels(java.lang.String[] labels)
Sets the labels for the horizontal axis. Can only be set before the first draw.

Parameters:
labels - new horizontal axis labels

getArraySize

public int getArraySize()
Returns the array size of the consumer.

Returns:
the arraySize

getPreferredYMax

public double getPreferredYMax()
Returns the preferred maximum of the vertical axis.

Returns:
the preferred maximum of y axis

setPreferredYMax

public void setPreferredYMax(double preferredYMax)
Sets the preferred maximum of the vertical axis.

Parameters:
preferredYMax - new maximum for the vertical axis.

getPreferredYMin

public double getPreferredYMin()
Returns the preferred minimum of the vertical axis.

Returns:
the preferred minimum of y axis

getPreferredXMin

public double getPreferredXMin()
Returns the preferred minimum of the horizontal axis.

Returns:
preferred minimum of the x axis

getPreferredXMax

public double getPreferredXMax()
Returns the preferred maximum of the horizontal axis.

Returns:
horizontal maximum

setPreferredYMin

public void setPreferredYMin(double preferredYMin)
Sets the preferred minimum of the vertical axis.

Parameters:
preferredYMin - new preferred minimum

applyParameters

protected void applyParameters()

getDisplayerParameters

public AcopGraphParameters getDisplayerParameters()
Returns the AcopGraphParameters associated with this consumer.

Returns:
the acop graph parameters

setDisplayerParameters

public void setDisplayerParameters(AcopGraphParameters displayerParameters)
Associates AcopGraphParameters with this consumer.

Parameters:
displayerParameters -

isDataDrawn

public boolean isDataDrawn()
Returns true if data is plotted on the chart.

Returns:
true data is plotted.

isTrendChart

public boolean isTrendChart()
Returns true if this graph is a trend.

Returns:
true if this is a trend

setTrendChart

public void setTrendChart(boolean isTrendChart)
Sets the trend chart mode for this graph. Can only be set before the first draw.

Parameters:
isTrendChart -

isChubbyLines

public boolean isChubbyLines()
Returns true if this graph is drawn with a thicker line.

Returns:
the chubbyLines

setChubbyLines

public void setChubbyLines(boolean chubbyLines)
If true this graph is drawn with a thicker line.

Parameters:
chubbyLines - the chubbyLines to set

getDisplayMode

public AcopDisplayMode getDisplayMode()
Returns the display mode of this graph.

Returns:
the displayMode

setDisplayMode

public void setDisplayMode(AcopDisplayMode displayMode)
Sets the display mode for this graph.

Parameters:
displayMode - new display mode


Copyright © 2010. All Rights Reserved.