This code is from the wicket examples: I'm having a lot of trouble understanding it. How is the current selection recognized? Why does the compound property model (the Input object) not have any getters/setters?
package org.apache.wicket.examples.compref; import java.util.Arrays; import java.util.List; import org.apache.wicket.IClusterable; import org.apache.wicket.examples.WicketExamplePage; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.RadioChoice; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.model.CompoundPropertyModel; /** * Page with examples on {@link org.apache.wicket.markup.html.form.ListChoice}. * * @author Eelco Hillenius */ public class RadioChoicePage extends WicketExamplePage { /** available sites for selection. */ private static final List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby", "Java.Net" }); /** * Constructor */ public RadioChoicePage() { final Input input = new Input(); setModel(new CompoundPropertyModel(input)); // Add a FeedbackPanel for displaying our messages FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); add(feedbackPanel); // Add a form with an onSumbit implementation that sets a message Form form = new Form("form") { protected void onSubmit() { info("input: " + input); } }; add(form); // Add a radio choice component that uses Input's 'site' property to // designate the // current selection, and that uses the SITES list for the available // options. form.add(new RadioChoice("site", SITES)); } /** Simple data class that acts as a model for the input fields. */ private static class Input implements IClusterable { /** the selected site. */ public String site = (String)SITES.get(0); /** * @see java.lang.Object#toString() */ public String toString() { return "site = '" + site + "'"; } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/radio-button-example-help-tp3710953p3710953.html Sent from the Users forum 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