The getInputForm() will return an instance of Form class in Wicket.
After creating the form,
-----------------------
// 3. create, setup, and add the input form
inputForm = new Form("inputForm");
inputForm.setOutputMarkupId(true);
add(inputForm);
----------------------------------
I added the following to the form:
1. a FeedbackPanel component;
2. a AjaxSubmitLink component;
3. a AjaxLink component;
4. A Button component;
5. Several Label components, some are invisible (Which are in a
WebMarkupContainer to control its visibility);
6. Several TextField components;
7. Several DropDownList components, some are invisible (Which are in a
WebMarkupContainer to control its visibility);
8. Several ListMultipleChoice components, some are invisible (Which are in a
WebMarkupContainer to control its visibility).
Thanks.
Valentine2008 wrote:
>
> Hi,
>
> I wrote the following code to print out all the children of the an input
> form.
> ---------------------------------------
> Iterator iterator = getInputForm().iterator(new Comparator() {
>
> public int compare(Object o1, Object o2)
> {
> System.out.format(":::::::::%s, %s%n", o1, o2);
>
> Component component1 = (Component) o1;
> Component component2 = (Component) o2;
> return
> component1.getId().compareTo(component2.getId());
> }
> });
>
> while(iterator.hasNext())
> {
> System.out.format("---------------Child of input form:
> id=%s%n", ((Component)iterator.next()).getId());
> }
> -----------------
>
> When running, the following error occurs:
> -------------------------------------------------------
> [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
> org.ap
> ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
> [Lorg.apache.wick
> et.Component;
> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
> [Lorg.apache
> .wicket.Component;
> at
> org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
> .........
>
> The code on line 478 of MarkupContainer.java is:
> sorted = Arrays.asList((Component[])children);
>
> Is it a bug of Wicket?
>
> Thanks,
> Valentine
>
--
View this message in context:
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]