Rather than using Bean model objects, my data model is built on Key-Value pairs in a HashMap container.
Does anyone have an example of the GXT’s Grid ValueProvider and PropertyAccess that will work with a underlying Map?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It doesn’t have one built in, but it is easy to build your own. Check out this blog post for a similar way of thinking, especially the ValueProvider section: http://www.sencha.com/blog/building-gxt-charts
The purpose of a
ValueProvideris to be a simple reflection-like mechanism to read and write values in some object. The purpose ofPropertyAccess<T>then is to autogenerate some of these value/modelkey/label provider instances based on getters and setters as are found on Java Beans, a very common use case. It doesn’t have much more complexity than that, it is just a way to simply ask the compiler to do some very easy boilerplate code for you.As that blog post shows, you can very easily build a ValueProvider just by implementing the interface. Here’s a quick example of how you could make one that reads a
Map<String, Object>. When you create each instance, you tell it which key are you working off of, and the type of data it should find when it reads out that value:You then build one of these for each key you want to read out, and can pass it along to
ColumnConfiginstances or whatever else might be expecting them.The main point though is that
ValueProvideris just an interface, and can be implemented any way you like.