-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have the following "resource" that I use to simplify my binding code so I don't need to specify the attribute for the most common case.
public static final HashMap<Class, String> componentBindingAttributes = new HashMap<Class, String>();
static {
componentBindingAttributes.put(Listbox.class, "selectedItem"); // todo: see if this information exists in zk
componentBindingAttributes.put(Combobox.class, "selectedItem");
componentBindingAttributes.put(Checkbox.class, "checked");
componentBindingAttributes.put(Button.class, "label");
}
Then I use it like so:
String attribute = componentBindingAttributes.get(component.getClass());
if (attribute == null) attribute = "value";
binder.addBinding(component, attribute, expression);
I am wondering if I am duplicating any such feature in Zk. Is this sort of information, a "common binding attribute list" available?
Also, I noticed that when I do not specify a type converter for a list box, the proper type converter is chosen. I have a subclass of list box and I would like to "register" the proper type converter to be used with my subclass so I do not need to specify it every time. Also, the "natural" access value for label is "load" while the "natural" access value for listbox is "both". I would like to register the natural access value for my list box subclass as well.
Thanks.
/Daryl
That solves the second part for converter and access. I'm guessing since there are more than one "default-bind" for some components there probably is no default property to bind to such as "value" for datebox and "label" for button. Maybe this just the way I will be using the framework...
Thanks.
/Daryl
Asked: 2008-08-29 12:59:04 +0800
Seen: 503 times
Last updated: Sep 02 '08