syn3d.data
Class SceneGraphData

java.lang.Object
  extended by syn3d.data.SceneGraphData
All Implemented Interfaces:
java.io.Serializable, DataSourceListener, EndNotificationListener
Direct Known Subclasses:
SceneGraphDoubleData, SceneGraphFloatData

public abstract class SceneGraphData
extends java.lang.Object
implements DataSourceListener, EndNotificationListener, java.io.Serializable

Class description ...

Author:
Claude CAZENAVE
See Also:
Serialized Form

Nested Class Summary
protected static class SceneGraphData.SourceHolder
           
 
Field Summary
protected  EndNotificationListener delegateListener
           
protected  boolean editable
           
protected  SceneGraphData.SourceHolder[] sources
           
 
Constructor Summary
SceneGraphData()
          Create a SceneGraphData linked with a SceneGraphObject
 
Method Summary
abstract  void apply()
          Apply data to the node
 java.lang.Object clone()
           
 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.
 void dispose()
          Cleanup anything that could possibly help the garbage collector.
 DataSource getDataSource(int index)
          Get data source
 EndNotificationListener getDelegateListener()
           
abstract  void init()
          Initialize data with the node current values
 boolean isEditable()
           
 int length()
          Get number of fields for this data
 void notificationEnd(java.lang.Object referer)
          This callback is called after all notifications were processed.
 void removeSceneGraphData()
           
 void setDataSource(int index, DataSource d)
          Set data source
 void setDelegateListener(EndNotificationListener delegateListener)
          Setting a delegate end notification listener is quite important to avoid duplicate events.
 void setEditable(boolean flag)
           
 void updateFrom(SceneGraphData dataCopy)
          Inverse operation from clone() Update this data from the content of another one
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sources

protected transient SceneGraphData.SourceHolder[] sources

delegateListener

protected transient EndNotificationListener delegateListener
See Also:
setDelegateListener

editable

protected boolean editable
Constructor Detail

SceneGraphData

public SceneGraphData()
Create a SceneGraphData linked with a SceneGraphObject

Method Detail

isEditable

public boolean isEditable()

setEditable

public void setEditable(boolean flag)

getDelegateListener

public EndNotificationListener getDelegateListener()
Returns:
Returns the delegateListener.

setDelegateListener

public void setDelegateListener(EndNotificationListener delegateListener)
Setting a delegate end notification listener is quite important to avoid duplicate events. If the same object listens to multiple SceneGraphData, it will be notified only once. The data themselves are of course listeners for the data source they manage. They are also the default end notificationlistener when there is no delegation

Parameters:
delegateListener - The delegateListener to set.

removeSceneGraphData

public void removeSceneGraphData()

length

public int length()
Get number of fields for this data


getDataSource

public DataSource getDataSource(int index)
Get data source

Parameters:
index - = field number 0..length-1

setDataSource

public void setDataSource(int index,
                          DataSource d)
Set data source

Parameters:
index - = field number 0..length-1
d - new value for the DataSource

init

public abstract void init()
Initialize data with the node current values


apply

public abstract void apply()
Apply data to the node


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

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

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

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

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

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

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
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

updateFrom

public void updateFrom(SceneGraphData dataCopy)
Inverse operation from clone() Update this data from the content of another one


dispose

public void dispose()
Cleanup anything that could possibly help the garbage collector. Ref counted listeners may be a good start...