edu.washington.cs.supple.rep
Class StateVarImpl

java.lang.Object
  extended byedu.washington.cs.supple.rep.SuppleBeanImpl
      extended byedu.washington.cs.supple.rep.SuppleUiObjectHierarchyElementImpl
          extended byedu.washington.cs.supple.rep.UiObjectImpl
              extended byedu.washington.cs.supple.rep.StateVarImpl
All Implemented Interfaces:
java.lang.Cloneable, ConstraintManipulation, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable, StateVar, SuppleBean, SuppleUiObjectHierarchyElement, UiObject, ValueListener

public class StateVarImpl
extends UiObjectImpl
implements StateVar, java.lang.Cloneable

Represents state variable elements

Author:
kgajos
See Also:
Serialized Form

Field Summary
protected  boolean requestedActive
           
protected  ValueBinding valueBinding
           
protected  java.lang.Object valueCache
           
 
Fields inherited from class edu.washington.cs.supple.rep.UiObjectImpl
active, activeValue, constraints, currentView, hints, interfaceIdentifier, modifiable, runtime, textLabel, type, uniqueId, uniqueIdCounter
 
Fields inherited from class edu.washington.cs.supple.rep.SuppleUiObjectHierarchyElementImpl
name, parent
 
Fields inherited from class edu.washington.cs.supple.rep.SuppleBeanImpl
pcs
 
Constructor Summary
StateVarImpl(SuppleType type, java.lang.String label, boolean modifiable)
           
StateVarImpl(SuppleType type, java.lang.String label, ValueBinding valueBinding, boolean modifiable)
           
 
Method Summary
protected  void acceptBindingVisitor(UiVisitor visitor)
          Helper for accept() - allows subclasses to extend the bindings to be visited without overriding accept().
 void bindValue(ValueBinding binding)
          Rebinds this object's value
 void childChanged()
          Called by a child object if something in it or below it changes
 java.lang.Object clone()
           
 java.lang.String getIndex()
          Gets the index of this object's current value
 java.lang.String getIndex(int maxLength)
           
 java.lang.Object getValue()
          Returns locally cached value of the underlying bean
 ValueBinding getValueBinding()
          Get the value binding.
 boolean hasValue()
          Returns true if a value (other than null) has been set for this element
 void propertyChange(java.beans.PropertyChangeEvent event)
           
 void setActive(boolean a)
          Lets you manually set the active state of a UiObject.
 void setValue(java.lang.Object v)
          Sets the current value of this object
 java.lang.String toPrettyString(java.lang.String pref)
           
 java.lang.String toString()
           
protected  void updateIndex()
           
protected  void updateValue(java.lang.Object value)
          Update the local cache of bean's value and fire appropriate change event
 void valueChanged(ValueBinding binding, java.lang.Object newValue)
          Signals variable change.
protected  void verifyCurrentValue()
           
 
Methods inherited from class edu.washington.cs.supple.rep.UiObjectImpl
accept, addRenderingConstraint, addRenderingHint, bindActive, equals, getBottomUpObjects, getCommonAncestor, getInterfaceIdentifier, getPath, getRenderingConstraints, getRenderingHints, getTextLabel, getType, getUniqueId, getView, hashCode, hasTextLabel, isActive, isLeaf, isModifiable, isRuntime, setRuntime, setType, setView, updateParent
 
Methods inherited from class edu.washington.cs.supple.rep.SuppleUiObjectHierarchyElementImpl
getAncestors, getFullName, getName, getParent, getParentObject, getRootObject, isChildOf, isDescendantOf, isRoot, setName, setParent
 
Methods inherited from class edu.washington.cs.supple.rep.SuppleBeanImpl
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.washington.cs.supple.rep.UiObject
accept, equals, getInterfaceIdentifier, getTextLabel, getType, getUniqueId, getView, hashCode, hasTextLabel, isActive, isLeaf, isModifiable, isRuntime, setRuntime, setView
 
Methods inherited from interface edu.washington.cs.supple.rep.SuppleUiObjectHierarchyElement
getAncestors, getFullName, getName, getParent, getParentObject, getRootObject, isChildOf, isDescendantOf, isRoot, setName, setParent
 
Methods inherited from interface edu.washington.cs.supple.rep.SuppleBean
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface edu.washington.cs.supple.rep.ConstraintManipulation
addRenderingConstraint, addRenderingHint, getRenderingConstraints, getRenderingHints
 

Field Detail

valueCache

protected java.lang.Object valueCache

valueBinding

protected transient ValueBinding valueBinding

requestedActive

protected boolean requestedActive
Constructor Detail

StateVarImpl

public StateVarImpl(SuppleType type,
                    java.lang.String label,
                    boolean modifiable)
Parameters:
type -
label -
modifiable -

StateVarImpl

public StateVarImpl(SuppleType type,
                    java.lang.String label,
                    ValueBinding valueBinding,
                    boolean modifiable)
Parameters:
type -
label -
modifiable -
Method Detail

toString

public java.lang.String toString()
Specified by:
toString in interface UiObject
Overrides:
toString in class UiObjectImpl

toPrettyString

public java.lang.String toPrettyString(java.lang.String pref)
Specified by:
toPrettyString in interface UiObject
Overrides:
toPrettyString in class UiObjectImpl

clone

public java.lang.Object clone()
Overrides:
clone in class UiObjectImpl

bindValue

public void bindValue(ValueBinding binding)
Description copied from interface: StateVar
Rebinds this object's value

Specified by:
bindValue in interface StateVar
Parameters:
binding -

getValueBinding

public ValueBinding getValueBinding()
Description copied from interface: StateVar
Get the value binding.

Specified by:
getValueBinding in interface StateVar

setActive

public void setActive(boolean a)
Description copied from interface: UiObject
Lets you manually set the active state of a UiObject. If the UiObject is bound to a value it may be switched back.

Specified by:
setActive in interface UiObject
Overrides:
setActive in class UiObjectImpl
Parameters:
a - new value

updateValue

protected void updateValue(java.lang.Object value)
Update the local cache of bean's value and fire appropriate change event

Parameters:
value - the new value of the bean

getValue

public java.lang.Object getValue()
Description copied from interface: StateVar
Returns locally cached value of the underlying bean

Specified by:
getValue in interface StateVar
Returns:
value of the underlying bean

hasValue

public boolean hasValue()
Description copied from interface: StateVar
Returns true if a value (other than null) has been set for this element

Specified by:
hasValue in interface StateVar
Returns:
true if a value has been set for this element

setValue

public void setValue(java.lang.Object v)
Description copied from interface: StateVar
Sets the current value of this object

Specified by:
setValue in interface StateVar
Parameters:
v - new value

verifyCurrentValue

protected void verifyCurrentValue()

updateIndex

protected void updateIndex()

getIndex

public java.lang.String getIndex()
Description copied from interface: StateVar
Gets the index of this object's current value

Specified by:
getIndex in interface StateVar
Returns:

getIndex

public java.lang.String getIndex(int maxLength)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class UiObjectImpl

childChanged

public void childChanged()
Description copied from interface: UiObject
Called by a child object if something in it or below it changes

Specified by:
childChanged in interface UiObject
Overrides:
childChanged in class UiObjectImpl

valueChanged

public void valueChanged(ValueBinding binding,
                         java.lang.Object newValue)
Description copied from interface: ValueListener
Signals variable change.

Specified by:
valueChanged in interface ValueListener
Overrides:
valueChanged in class UiObjectImpl

acceptBindingVisitor

protected void acceptBindingVisitor(UiVisitor visitor)
Description copied from class: UiObjectImpl
Helper for accept() - allows subclasses to extend the bindings to be visited without overriding accept().

Overrides:
acceptBindingVisitor in class UiObjectImpl