jsynoptic.plugins.jfreechart
Class SourceXYDataset

java.lang.Object
  extended by AbstractDataset
      extended by jsynoptic.plugins.jfreechart.SourceXYDataset
All Implemented Interfaces:
DataSourceListener, EndNotificationListener

public class SourceXYDataset
extends AbstractDataset
implements DataSourceListener, EndNotificationListener

Author:
nbrodu To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and Comments

Nested Class Summary
 class SourceXYDataset.SourceCouple
           
 
Field Summary
protected  boolean dirty
           
protected  DataInfo info
           
protected  boolean nameAccordingToYOnly
           
protected  boolean notifySourceChange
           
protected  java.util.Vector sources
           
 
Constructor Summary
SourceXYDataset()
           
SourceXYDataset(DataSourceCollection dsc)
           
 
Method Summary
 void add(DataSource x, DataSource y)
           
 void addDataSourceCollection(DataSourceCollection dsc)
           
 void addXSource(DataSource ds)
           
 void addYSource(DataSource ds)
          Adds an y source, using the last set x source X sources shall be set before y sources
 void clear()
           
 java.lang.Object clone()
           
 SourceXYDataset cloneSet()
           
 void DataSourceIndexRangeChanged(DataSource ds, long startIndex, long lastIndex)
          Called when the range of valid index changed
 void DataSourceInfoChanged(DataSource ds, DataInfo newInfo)
          Called when the information about the data source changed
 void DataSourceOrderChanged(DataSource ds, int newOrder)
          If defined, called when the order of the source changed.
 void DataSourceReplaced(DataSource oldData, DataSource newData)
          Called when a data source is replaced by another one
 void DataSourceValueChanged(DataSource ds, long minIndex, long maxIndex)
          Called when at least a value changed in the data source.
 void DataSourceValueRangeChanged(DataSource ds)
          Called when the range of possible values changed, if defined.
 int getItemCount(int series)
           
 java.lang.String getName()
           
 int getSeriesCount()
           
 java.lang.String getSeriesName(int series)
           
 java.util.Vector getSources()
          Helper function when a pair isn't fully set
 java.lang.String getXLabel(int i)
           
 DataSource getXSource(int i)
           
 java.lang.Number getXValue(int series, int item)
           
 java.lang.String getYLabel(int i)
           
 DataSource getYSource(int i)
           
 java.lang.Number getYValue(int series, int item)
           
 boolean isNameAccordingToYOnly()
           
 void notificationEnd(java.lang.Object referer)
          This callback is called after all notifications were processed.
 void removeXSource(DataSource ds)
           
 void removeXSource(int i)
           
 void removeYSource(DataSource ds)
           
 void removeYSource(int i)
           
 void setDataSourceCollection(DataSourceCollection dsc)
           
 void setDataSourceCollectionAsCouples(DataSourceCollection dsc)
           
 void setName(int series, java.lang.String name)
          Changes the name of the source entry at index i, overrides the default.
 void setName(java.lang.String name)
           
 void setNameAccordingToYOnly(boolean nameAccordingToYOnly)
           
 void setXSource(DataSource ds)
          Sets a common X source
 int setXSource(DataSource ds, int i)
          Sets an X source for the given series.
 int setYSource(DataSource ds, int i)
          Sets an Y source for the given series.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sources

protected transient java.util.Vector sources

dirty

protected transient boolean dirty

notifySourceChange

protected boolean notifySourceChange

nameAccordingToYOnly

protected boolean nameAccordingToYOnly

info

protected DataInfo info
Constructor Detail

SourceXYDataset

public SourceXYDataset()

SourceXYDataset

public SourceXYDataset(DataSourceCollection dsc)
Method Detail

isNameAccordingToYOnly

public boolean isNameAccordingToYOnly()
Returns:

setNameAccordingToYOnly

public void setNameAccordingToYOnly(boolean nameAccordingToYOnly)
Parameters:
nameAccordingToYOnly -

setDataSourceCollection

public void setDataSourceCollection(DataSourceCollection dsc)

setDataSourceCollectionAsCouples

public void setDataSourceCollectionAsCouples(DataSourceCollection dsc)

addDataSourceCollection

public void addDataSourceCollection(DataSourceCollection dsc)

setXSource

public void setXSource(DataSource ds)
Sets a common X source


setXSource

public int setXSource(DataSource ds,
                      int i)
Sets an X source for the given series. If the series does not exists, a new one is created

Returns:
the number of the series. This is the same as the argument, except when a new series is created, where this number is the next available regardless of the argument

setYSource

public int setYSource(DataSource ds,
                      int i)
Sets an Y source for the given series. If the series does not exists, a new one is created

Returns:
the number of the series. This is the same as the argument, except when a new series is created, where this number is the next available regardless of the argument

getXSource

public DataSource getXSource(int i)

getYSource

public DataSource getYSource(int i)

addXSource

public void addXSource(DataSource ds)

removeXSource

public void removeXSource(DataSource ds)

removeXSource

public void removeXSource(int i)

addYSource

public void addYSource(DataSource ds)
Adds an y source, using the last set x source X sources shall be set before y sources


removeYSource

public void removeYSource(DataSource ds)

removeYSource

public void removeYSource(int i)

add

public void add(DataSource x,
                DataSource y)

clear

public void clear()

setName

public void setName(int series,
                    java.lang.String name)
Changes the name of the source entry at index i, overrides the default. You can revert to the default name by setting the override to null

Parameters:
series - the series for which to set a name override
name - the new name

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

getXLabel

public java.lang.String getXLabel(int i)

getYLabel

public java.lang.String getYLabel(int i)

getItemCount

public int getItemCount(int series)

getXValue

public java.lang.Number getXValue(int series,
                                  int item)

getYValue

public java.lang.Number getYValue(int series,
                                  int item)

getSources

public java.util.Vector getSources()
Helper function when a pair isn't fully set


getSeriesCount

public int getSeriesCount()

getSeriesName

public java.lang.String getSeriesName(int series)

DataSourceValueChanged

public void DataSourceValueChanged(DataSource ds,
                                   long minIndex,
                                   long maxIndex)
Description copied from interface: DataSourceListener
Called when at least a value changed in the data source. The listener shall then get the values in the given range again, if it is interested by the values in that range.

Specified by:
DataSourceValueChanged in interface DataSourceListener
Parameters:
ds - The data source that changed
minIndex - Lower bound of the range where values changed
maxIndex - Higher bound of the range where values changed

DataSourceIndexRangeChanged

public void DataSourceIndexRangeChanged(DataSource ds,
                                        long startIndex,
                                        long lastIndex)
Description copied from interface: DataSourceListener
Called when the range of valid index changed

Specified by:
DataSourceIndexRangeChanged in interface DataSourceListener
Parameters:
ds - The data source that changed
startIndex - The new start Index
lastIndex - The new last index

DataSourceInfoChanged

public void DataSourceInfoChanged(DataSource ds,
                                  DataInfo newInfo)
Description copied from interface: DataSourceListener
Called when the information about the data source changed

Specified by:
DataSourceInfoChanged in interface DataSourceListener
Parameters:
ds - The data source that changed

DataSourceValueRangeChanged

public void DataSourceValueRangeChanged(DataSource ds)
Description copied from interface: DataSourceListener
Called when the range of possible values changed, if defined.

Specified by:
DataSourceValueRangeChanged in interface DataSourceListener
Parameters:
ds - The data source that changed

DataSourceOrderChanged

public void DataSourceOrderChanged(DataSource ds,
                                   int newOrder)
Description copied from interface: DataSourceListener
If defined, called when the order of the source changed. See the sortedOrder() in the Datasource class for more information.

Specified by:
DataSourceOrderChanged in interface DataSourceListener
Parameters:
ds - The data source that changed

DataSourceReplaced

public void DataSourceReplaced(DataSource oldData,
                               DataSource newData)
Description copied from interface: DataSourceListener
Called when a data source is replaced by another one

Specified by:
DataSourceReplaced in interface DataSourceListener

notificationEnd

public void notificationEnd(java.lang.Object referer)
Description copied from interface: EndNotificationListener
This callback is called after all notifications were processed. The referer object is the one to decide what the end means. For example, it may be a single data source notifying both a range change and a value change. Or it could be a collection notifying all its sources.

Specified by:
notificationEnd in interface EndNotificationListener

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

cloneSet

public SourceXYDataset cloneSet()
Returns: