RE: Need help editing a Map plz.

2009-01-19 Thread Jeremy Thomerson
Maybe try a RepeatingView of some sort (ListView?) over new 
ArrayList(map.keySet())...


Jeremy Thomerson
http://www.wickettraining.com
-- sent from a wireless device


-Original Message-
From: Ned Collyer ned.coll...@gmail.com
Sent: Monday, January 19, 2009 6:14 PM
To: users@wicket.apache.org
Subject: Need help editing a Map plz.


Hi Guys,

I have a data construct which is as follows:

Template
  MapString, ListConstraint fieldConstraints;

The map is fieldname against a list of constraints.

Eg, I might have firstName as the field, and the following constraints
  length between 2 and 16 characters
  mandatory
  alphas only

I have editors for each of the constraints - that bit was easy.
I can also render out the field names, and the editors.

My question is, how do I bind the editors to the instances that are within
the map?
-- 
View this message in context: 
http://www.nabble.com/Need-help-editing-a-Map-plz.-tp21554555p21554555.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Need help editing a Map plz.

2009-01-19 Thread Ned Collyer

Got it licked - stuffed up the editors.  Specifically I neglected
convertInput because I happen to be an idiot.

Thanks JT - I have the keyset stuff down already ;)

I was just wondering why my constraints were instantiated, but when they
were submitted their inner detail was nulled out.  Makes sense now.


Jeremy Thomerson-5 wrote:
 
 Maybe try a RepeatingView of some sort (ListView?) over new
 ArrayList(map.keySet())...
 
 
 Jeremy Thomerson
 http://www.wickettraining.com
 -- sent from a wireless device
 

-- 
View this message in context: 
http://www.nabble.com/Need-help-editing-a-Map-plz.-tp21554555p21555867.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Need help editing a Map plz.

2009-01-19 Thread Ned Collyer

No - i officially don't know what's wrong :)

This is my snippet

-
ListString list = new
ArrayListString(model.getObject().getConstraints().keySet());
// display any existing constraints
form.add(new ListViewString(fields, list) {
protected void populateItem(ListItemString listItem) {
final Label label = new Label(label, new
ModelClass(model.getObject().getDocumentType()));
   
label.setDefaultModelObject(label.getString(listItem.getModelObject()));
listItem.add(label);
listItem.add(new ListViewConstraint(constraints, new
PropertyModelListConstraint(model, String.format(constraints[%s],
listItem.getModelObject( {
protected void populateItem(ListItemConstraint
listItem) {
   
listItem.add(getConstraintFormField(listItem.getModel()));
}
}.setReuseItems(true));
}
}.setReuseItems(true));


The only constraint form field is this
   public LengthBetweenConstraintField(String id, IModel model) {
super(id, model);
add(new TextField(minimum, new PropertyModel(model, minimum)));
add(new TextField(maximum, new PropertyModel(model, maximum)));
}


When the page is rendered - the correct values appear.  However when it's
submitted - the values for max and minimum are set to null.

HELP :)
-- 
View this message in context: 
http://www.nabble.com/Need-help-editing-a-Map-plz.-tp21554555p21556339.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Need help editing a Map plz.

2009-01-19 Thread Ned Collyer

Bleh - its one of those days.

Changed the base of the form fields from FormComponentPanel back to Panel -
and bobs ur uncle.

Sorry for the list noise (recovering from holidays still).



Ned Collyer wrote:
 
 No - i officially don't know what's wrong :)
 
 This is my snippet
 
 -
 ListString list = new
 ArrayListString(model.getObject().getConstraints().keySet());
 // display any existing constraints
 form.add(new ListViewString(fields, list) {
 protected void populateItem(ListItemString listItem) {
 final Label label = new Label(label, new
 ModelClass(model.getObject().getDocumentType()));

 label.setDefaultModelObject(label.getString(listItem.getModelObject()));
 listItem.add(label);
 listItem.add(new ListViewConstraint(constraints, new
 PropertyModelListConstraint(model, String.format(constraints[%s],
 listItem.getModelObject( {
 protected void populateItem(ListItemConstraint
 listItem) {

 listItem.add(getConstraintFormField(listItem.getModel()));
 }
 }.setReuseItems(true));
 }
 }.setReuseItems(true));
 
 
 The only constraint form field is this
public LengthBetweenConstraintField(String id, IModel model) {
 super(id, model);
 add(new TextField(minimum, new PropertyModel(model,
 minimum)));
 add(new TextField(maximum, new PropertyModel(model,
 maximum)));
 }
 
 
 When the page is rendered - the correct values appear.  However when it's
 submitted - the values for max and minimum are set to null.
 
 HELP :)
 

-- 
View this message in context: 
http://www.nabble.com/Need-help-editing-a-Map-plz.-tp21554555p21556545.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org