Dynamic Bindings

2 views
Skip to first unread message

Kieran

unread,
Apr 16, 2007, 2:25:23 PM4/16/07
to wotips
A nice tip from Chuck Hill on the wo developers list:

Here is a fun alternative to declaring public instance variables to
hold binding values in a WOComponent subclass:

public NSMutableDictionary dynamicData = new NSMutableDictionary();

public Object handleQueryWithUnboundKey(String key) {
Object result = dynamicData.objectForKey(key);
// Helps to find typing errors in bindings
if (result == null) NSLog.out.appendln("no value found for key " +
key);
return result;
}

public void handleTakeValueForUnboundKey(Object value, String key) {
dynamicData.setObjectForKey(value, key);
}

Reply all
Reply to author
Forward
0 new messages