DESY ACOP Beans Home

com.cosylab.gui.adapters
Class AbstractConverter

java.lang.Object
  extended by com.cosylab.gui.displayers.DataSourceSupport
      extended by com.cosylab.gui.adapters.DataConsumerDispatcher
          extended by com.cosylab.gui.adapters.AbstractConverter
All Implemented Interfaces:
Converter, DataConsumer, DataSource, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SimpleArrayConverterSupport, SimpleConverterSupport

public abstract class AbstractConverter
extends DataConsumerDispatcher
implements Converter, DataConsumer

AbstractConverter is implementation of Converter interface intended for convenience when implementing new converter.

Version:
$Id: AbstractConverter.java,v 1.6 2008-04-22 12:31:02 jbobnar Exp $
Author:
Igor Kriznar
See Also:
Converter, Serialized Form

Field Summary
protected  NonblockingNumberDispatcher nonblDispatcher
          DOCUMENT ME!
 
Fields inherited from class com.cosylab.gui.adapters.DataConsumerDispatcher
name
 
Fields inherited from class com.cosylab.gui.displayers.DataSourceSupport
types
 
Constructor Summary
AbstractConverter(java.lang.Class[] types)
          Creates new converter.
 
Method Summary
 void addConsumer(DataConsumer consumer)
          In this method we investigate the following cases: if consumer is NonblockingNumberConsumer, the it comes from peer data source and wants to receive notifications from peer cosnumer about user change requests.
protected  void cacheLastCharacteristics(java.util.Map characteristics)
          If converter implementation decides to change characteristics it is very advisable to cache unmodified characteristics.
 void clear()
          Clears converter to initial state.
 java.lang.Object clone()
           
protected  void consumerAdded(DataConsumer consumer)
          This method is called when consumer has been added to this converter.
protected  java.util.Map getLastCharacteristics()
          Returnes characcteristics whic was last time used on this data converter.
protected  NonblockingNumberDispatcher getNonblDisplatecher()
          Override this method to provide own dispatcher, which forwards revers data flow (from consumer to source).
 void setCharacteristics(java.util.Map characteristics)
          This is called by peer data source.
 void updateDataState(DataState state)
          Push data state (quality) update change for dynamic value.
 
Methods inherited from class com.cosylab.gui.adapters.DataConsumerDispatcher
getDataConsumer, getDefaultDataConsumer, getName, getSupportedCharacteristics, getSupportedConsumerTypes
 
Methods inherited from class com.cosylab.gui.displayers.DataSourceSupport
extractSupportedCharacteristics, getAcceptableConsumerTypes, getConsumers, removeAllConsumers, removeConsumer
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cosylab.gui.displayers.DataSource
getAcceptableConsumerTypes, getConsumers, removeAllConsumers, removeConsumer
 
Methods inherited from interface com.cosylab.gui.displayers.DataConsumer
getDataConsumer, getDefaultDataConsumer, getName, getSupportedCharacteristics, getSupportedConsumerTypes
 

Field Detail

nonblDispatcher

protected transient NonblockingNumberDispatcher nonblDispatcher
DOCUMENT ME!

Constructor Detail

AbstractConverter

public AbstractConverter(java.lang.Class[] types)
Creates new converter.

Method Detail

setCharacteristics

public void setCharacteristics(java.util.Map characteristics)
This is called by peer data source. Call is delegated to contained consumers. In the process it is modified with transformation function.

Specified by:
setCharacteristics in interface DataConsumer
Overrides:
setCharacteristics in class DataConsumerDispatcher
Parameters:
characteristics - the Map with attri
See Also:
DataConsumer.setCharacteristics(java.util.Map)

getNonblDisplatecher

protected NonblockingNumberDispatcher getNonblDisplatecher()
Override this method to provide own dispatcher, which forwards revers data flow (from consumer to source).

Returns:
nonblocking reverse dispatcher

addConsumer

public void addConsumer(DataConsumer consumer)
                 throws java.beans.PropertyVetoException
In this method we investigate the following cases:

Specified by:
addConsumer in interface DataSource
Overrides:
addConsumer in class DataSourceSupport
Parameters:
consumer - the data consumer to be regitered at this data source
Throws:
java.beans.PropertyVetoException
See Also:
DataSource.addConsumer(com.cosylab.gui.displayers.DataConsumer)

consumerAdded

protected void consumerAdded(DataConsumer consumer)
This method is called when consumer has been added to this converter. You may override this method to implement own handling of added consumer.

Parameters:
consumer - the consumer which was added

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
Overrides:
updateDataState in class DataConsumerDispatcher
Parameters:
state - new data state(quality) descriptor

cacheLastCharacteristics

protected void cacheLastCharacteristics(java.util.Map characteristics)
If converter implementation decides to change characteristics it is very advisable to cache unmodified characteristics. This chached characteristics are used to initialized new consumers. They can be also used by implementation to reinitialize consumers if transformation function has changed.

If implementation does not change characteristic, than this method doesen't have to be used.

Parameters:
characteristics - the unmodified characcteristics before transformation

getLastCharacteristics

protected java.util.Map getLastCharacteristics()
Returnes characcteristics whic was last time used on this data converter. Use cacheLastCharacteristics(Map) to store them.

Returns:
last used characcteristics from internal chache
See Also:
cacheLastCharacteristics(Map)

clear

public void clear()
Clears converter to initial state.

Overrides:
clear in class DataSourceSupport

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Converter
Overrides:
clone in class DataSourceSupport
Throws:
java.lang.CloneNotSupportedException


Copyright © 2010. All Rights Reserved.