WebObjects 5.4.2

com.webobjects.appserver
Class WOVariableAssociation

java.lang.Object
  extended by com.webobjects.appserver.WOAssociation
      extended by com.webobjects.appserver.WOVariableAssociation
All Implemented Interfaces:
Cloneable

public class WOVariableAssociation
extends WOAssociation


Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.appserver.WOAssociation
WOAssociation.Event
 
Field Summary
 
Fields inherited from class com.webobjects.appserver.WOAssociation
TakeValueForKeyPathEvent, ValueForKeyPathEvent
 
Constructor Summary
WOVariableAssociation(String variable)
           
 
Method Summary
 String bindingInComponent(WOComponent aComponent)
          Returns the binding String as seen in WebObjects Builder.
 boolean isValueConstant()
          Used to check if an association value is constant at runtime.
 boolean isValueSettable()
          Used to check if an association can assign values at runtime.
 String keyPath()
          Overridden to return "".
 void setValue(Object aValue, WOComponent aComponent)
          Sets the value for this association in the component.
 Object valueInComponent(WOComponent aComponent)
          Returns the association's value for this component.
 
Methods inherited from class com.webobjects.appserver.WOAssociation
associationWithKeyPath, associationWithValue, booleanValueInComponent, isValueConstantInComponent, isValueSettableInComponent, setDebugEnabledForBinding, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WOVariableAssociation

public WOVariableAssociation(String variable)
Method Detail

valueInComponent

public Object valueInComponent(WOComponent aComponent)
Description copied from class: WOAssociation
Returns the association's value for this component.

For example, invoking value on a WOAssociation created from this declaration,

   DOWNPAYMENT:WOString {value = downpayment};
 
returns the value of the current component's downpayment variable. Invoking value on a WOAssociation created from this declaration,

  DOWNPAYMENT:WOString {value = "$5000.00"};
 
returns the value "$5000.00" (independent of the current component).

This method raises an exception if it cannot resolve the WOAssociation's value with the current component.

This method is used to retrieve values throughout the WebObjects framework by all private subclasses of WODynamicElement.

Another way in which the WebObjects framework uses this method is to synchronize the values of nested components. When attributes in child and parent components are associated with one another and changes occur in one component, this method is invoked to migrate those changes to the other component.

Overrides:
valueInComponent in class WOAssociation
Parameters:
aComponent - component which should resolve the association
Returns:
a value based on receiver's association and the current component
See Also:
WOAssociation.setValue(Object aValue, WOComponent aComponent)

setValue

public void setValue(Object aValue,
                     WOComponent aComponent)
Description copied from class: WOAssociation
Sets the value for this association in the component. Using NSKeyValueCoding, this method finds the variable, or setter method in aComponent pointed to by the association binding name. It then sets the variable's value to aValue, or invokes the setter method with aValue as a parameter. This method throws an exception if the receiver's value is not settable. For example, invoking setValue on a WOAssociation created from this declaration,

   USER:WOTextField {value = userName};
 
sets the current component's userName variable to the value typed into the WOTextField.

This method is used to set values throughout the WebObjects framework by all private subclasses of WODynamicElement.

Another way in which the WebObjects framework uses this method is to synchronize the values of nested components. When attributes in child and parent components are associated with one another and changes occur in one component, this method is invoked to migrate those changes to the other component.

Overrides:
setValue in class WOAssociation
Parameters:
aValue - the input value
aComponent - component which should resolve the association
See Also:
WOAssociation.valueInComponent(WOComponent aComponent), WOAssociation.isValueSettable()

isValueSettable

public boolean isValueSettable()
Description copied from class: WOAssociation
Used to check if an association can assign values at runtime.

Overrides:
isValueSettable in class WOAssociation
Returns:
false if the association's value is constant, true otherwise
See Also:
WOAssociation.associationWithKeyPath(String aKeyPath), WOAssociation.isValueConstant(), WOAssociation.isValueSettableInComponent(WOComponent aComponent)

isValueConstant

public boolean isValueConstant()
Description copied from class: WOAssociation
Used to check if an association value is constant at runtime.

Overrides:
isValueConstant in class WOAssociation
Returns:
true if the WOAssociation's value is a constant, false otherwise
See Also:
WOAssociation.associationWithValue(Object aValue), WOAssociation.isValueSettable(), WOAssociation.isValueConstantInComponent(WOComponent aComponent)

bindingInComponent

public String bindingInComponent(WOComponent aComponent)
Description copied from class: WOAssociation
Returns the binding String as seen in WebObjects Builder. This abstract method is implemented by WOAssociation subclasses to return, as a String, the binding string from the declarations ('wod') file. It may be resolved by the component in which the association resides. This is used during DirectToWeb page generation.

Specified by:
bindingInComponent in class WOAssociation
Parameters:
aComponent -
Returns:
See Also:
WOAssociation.bindingInComponent(com.webobjects.appserver.WOComponent)

keyPath

public String keyPath()
Overridden to return "".

Specified by:
keyPath in class WOAssociation
Returns:
See Also:
WOAssociation.keyPath()

Last updated June 2008

Copyright © 2000-2008 Apple Inc.