[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
RE: [riena-dev] TreeTableRidget - quick feedback on bind styles
 | 
Title: RE: [riena-dev] TreeTableRidget - quick feedback on bind styles
> Hi,
> quick question: which bind method do you like best, #1 or #2 ?
> #1:
>
> Object[] roots;
> String[] valueAccessors = new String[] {
>   "word", upperCase, "ACount"
> };
> String[] columnHeaders = new String[] {
>   "Word", "Uppercase", "A Count"
> };
> tree.bindToModel(roots, WordNode.class, "children", "parent",
> valueAccessors, columnHeaders);
I like #1, because it's less verbose.
There could be a #3 though:
class WordNode{
 @Value(header="Word", order=0)
 public Object getInsult(){
  //...
 }
 @Value(header="Uppercase", order=1)
 public Object getScreamedInsult(){
  //...
 }
 @Value(header="A Count", order=2)
 public Object getBadBehaviourMetrics(){
  //...
 }
 @Parent
 public MyObject getDaddy(){
  //..
 }
 @Children
 public List<MyObject> getLittleBrats(){
  //..
 }
}
//...
tree.bindToModel(roots, WordNode.class);
What I dislike about the annotation-thing is, that it would make the data object carry information about its representation, which could be very different in different contexts.
Regards,
Wanja