On 4/24/07, Francois Armand <[EMAIL PROTECTED]> wrote:i only have time to
help you with one, so here goes

(I think that the printing of an entry would work on the same model,
say :
* given an entry {
  print the dn ;
  for each attribute {
    select a formatting method;
    for each value {
      print the value formatted according to the selected method;
    }
  }
}
)


first you only need a top level detachable model

class DetachableEntryModel extends LoadableDetachableModel {
 private final String dn;
 private final SpringEntryDao dao;

 public DetacahbleEntryModel(Entry e, SpringEntryDao dao) {
     super(e);
     this.dn=e.getDn();
     this.dao=dao;
  }

  Object load() {
       return dao.get(dn);
   }
}


class PrintPanel extends Panel {
   public PrintPanel(String id, IModel<Entry> entry) {
       // given an entry
       super(id, new CompoundPropertyModel(entry));

       //   print the dn ;
       add(new Label("dn"));
       add(new PropertyListView("attributes") {
          populateItem(ListItem item) {
             //  for each attribute {
             Attribute a=item.getModelObject();
             // select a formatting method;
             final AttributeFormatter f=....;

              item.add(new Label("name"));
              item.add(new ListView("values") {
                 populateItem(ListItem item) {
                     Object value=item.getModelObject();
                     String str=f.format(value);
                     add(new Label("value", str));
                  }
              });
          });
        }
     }
}


<wicket:panel>
dn: <span wicket:id="dn"><br/>
<table>
<tr wicket:id="attributes">
<td><span wicket:id="name"></span></td>
<td><ul><li wicket:id="values"><span
wicket:id="value"></span></li></ul></td>
</tr>
</table>

</wicket:panel>


-igor
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to