twaver.alarm
Class PropertyPropagator<T extends Data>

java.lang.Object
  extended by twaver.alarm.PropertyPropagator<T>
Type Parameters:
T -
Direct Known Subclasses:
AlarmStatePropagator

public class PropertyPropagator<T extends Data>
extends java.lang.Object

属性传播器,twaver内部使用


Field Summary
protected  boolean isPropagating
           
 
Constructor Summary
PropertyPropagator(DataBox<T> dataBox, java.lang.String propertyName)
           
PropertyPropagator(DataBox<T> dataBox, java.lang.String propertyName, java.lang.String propertyType)
          Constructor.
 
Method Summary
 DataBox<T> getDataBox()
          Get the connected data box.
 java.lang.String getPropertyName()
          Get the property name that only this property changes the propagator will be triggered.
 java.lang.String getPropertyType()
          Get the property type that only properties with this type changes the propagator will be triggered.
 boolean isEnable()
          Get current enable status of this propagator.
protected  void onDataPropertyChangeEvent(PropertyChangeEvent e)
          元素属性变化事件,回调此函数
protected  void propagate(Data data)
          Propagate property change to the specified data.
protected  void propagateToParent(Data child, Data parent)
          Called when need to propagate property change to specified data's parent.
protected  void propagateToTop(Data data)
          Propagate property change to the specified data's next level data.
 void setEnable(boolean enable)
          Enable or disable this propagator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isPropagating

protected boolean isPropagating
Constructor Detail

PropertyPropagator

public PropertyPropagator(DataBox<T> dataBox,
                          java.lang.String propertyName)

PropertyPropagator

public PropertyPropagator(DataBox<T> dataBox,
                          java.lang.String propertyName,
                          java.lang.String propertyType)
Constructor.

Parameters:
dataBox - this instanceof the data box this propagator work for. Data contains in this data box has property value changes, this propagator will be triggered.
propertyName - the property name that should be propagated.
propertyType - the property type that should be propagated.
Method Detail

getDataBox

public DataBox<T> getDataBox()
Get the connected data box.

Returns:
the connected data box of this property propagator.

getPropertyType

public java.lang.String getPropertyType()
Get the property type that only properties with this type changes the propagator will be triggered.

Returns:
the property type condition.

getPropertyName

public java.lang.String getPropertyName()
Get the property name that only this property changes the propagator will be triggered.

Returns:
the property name condition.

setEnable

public void setEnable(boolean enable)
Enable or disable this propagator. Disabled propagator will stop work.

Parameters:
enable - the new enable status value. True to enable this propagator to work, false stop it.

isEnable

public boolean isEnable()
Get current enable status of this propagator.

Returns:
true means this propagator instanceof enabled and working, false means disabled and stop work.

onDataPropertyChangeEvent

protected void onDataPropertyChangeEvent(PropertyChangeEvent e)
元素属性变化事件,回调此函数

Parameters:
e -

propagate

protected void propagate(Data data)
Propagate property change to the specified data.

Parameters:
data - the target propagate data.

propagateToTop

protected void propagateToTop(Data data)
Propagate property change to the specified data's next level data. In this default implementation, the "next level data" means the parent data. You can overwrite this method to do your customized property propagation.

Parameters:
data - the data need to propagate.

propagateToParent

protected void propagateToParent(Data child,
                                 Data parent)
Called when need to propagate property change to specified data's parent.

Parameters:
child - child data, the change source.
parent - parent data, the propagation target.