Feature Requests item #1276126, was opened at 2005-08-29 23:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1276126&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.1
Status: Open
Priority: 5
Submitted By: Gwyn Evans (gwynevans)
Assigned to: Nobody/Anonymous (nobody)
Summary: CheckBoxMultipleChoice code submission

Initial Comment:
I think this is missing from the form components, so
I've created it by taking code from RadioChoce &
ListMultipleChoice, but would like someone else to take
a look and comment if they feels there's a better way,
e.g. would it be better to extend ListMultipleChoice.

(Probably, but I thought I'd put this up here as a
baseline.)
/Gwyn

Implementation attached.

Example use:
<html>
    <body>
        <form wicket:id="form">
            <span wicket:id="choices"></span>
            <input type=submit value="OK" />
        </form>
        <span wicket:id="feedback" />
    </body>
</html>

public class FormDemo extends WebPage {
    public FormDemo(final PageParameters parameters) {
        add(new MyForm("form"));
        add(new FeedbackPanel("feedback"));
    }

    private static class MyForm extends Form {
        public MyForm(String name) {
            super(name, new CompoundPropertyModel(new
MyModel()));
            add(new CheckBoxMultipleChoice("choices",
Arrays.asList(new String[]{"Unix", "Win95", "WinNT",
"Mac"})));
        }
        public void onSubmit() { info("Model = " +
getModelObject()); }
    }

    private static class MyModel {
        private List _choices = new ArrayList();
        public MyModel() { _choices.add("WinNT"); }
        public List getChoices() { return _choices; }
        public void setChoices(List choices) { _choices
= choices; }
        public String toString() {
            return "MyModel{" + "choices='" + _choices
+ "'" + "}";
        }
    }
}

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1276126&group_id=119783


-------------------------------------------------------
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-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to