pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Whitcomb" <Roger.Whitc...@actian.com>
Subject RE: data binding
Date Mon, 06 May 2013 23:41:55 GMT
Hi Cynthia,

So, let me see if I understand:

*         You want to be able to iterate over the user data entries that
have already been set and call "setXXX" methods in the component based
on the key names in the user data dictionary?

 

If that's what we're talking about, then I would suggest the
"BeanAdapter" class.  This provides the link I think you're talking
about between a property named "foo" and the "setFoo" and "getFoo"
methods on an object.

 

If I understand the question, then your "decodeData()" method in the
component would look something like this:

 

public void decodeData() {

                BeanAdapter adapter = new BeanAdapter(this);

                Dictionary<String, Object> dict = getUserData();

                for (String key : dict) {

                                adapter.put(key, dict.get(key));

                }

}

 

Then, of course, you would have to implement each of the "setXXX"
methods in your component so that the BeanAdapter can find them.

 

Does that help?

~Roger Whitcomb


Mime
View raw message