static class AddressConverter implements IConverter {
public Object convert(Object value, Class c) {
Address address = new Address() ;
//value is from TextField.getInput() ;
address.setStreeAddress((String) value) ;
return address;
}
public void setLocale(Locale locale) {}
public Locale getLocale() {
return Locale.getDefault();
}
}
public class ClientForm extends Form {
public ClientForm() {
add(new TextField("address") {
public IConverter getConverter() {
return new AddressConverter();
}
});
}
}
On 9/13/05, Troy MacNeil <[EMAIL PROTECTED]> wrote:
This isn't the brightest question I've ever asked, I feel I'm missing
very obvious. But I don't see an answer in the examples/wiki so here
goes...
I'm wondering how to handle. So for instance if I have a Client object
which has one or more Address objects as members, how can I create a new
client using a single form?
I've looked at the cdapp example where Categories are linked to Albums,
what I want is similar except I'd like to create Categories on the fly
if necessary rather than select from a pre-instantiated list.
<form wicket:id="form" action="">Name:
<input type="text" wicket:id="firstName"><br/>
Street Address:
<input type="text" wicket:id="address.streetAddress"><br/>
<input type="submit" value="Add Client"/>
</form>
@Entity
public class Client implements Comparable<Client> {
protected Long Id;
protected String Name;
protected Address address;
/*typical getters/setters below */
}
@Entity
public class Address implements Comparable<Address> {
protected Long Id;
protected String streetAddress;
/*typical getters/setters below */
}
Any help or pointers in the right direction greatly appreciated...
Thanks,
Troy
Alluvion Development
http://alluvioncorp.com
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen
