Iterate over Form.class, not Component.class
You may use form.getId() to check whether this is the form you're looking
for.

On Wed, Mar 30, 2011 at 11:12 AM, nino martinez wael <
nino.martinez.w...@gmail.com> wrote:

> Hi
>
> Can't I use the equals method on forms? How do I detect if 2 forms are
> equal across requests?
>
> Below does not work .... But does iterate over the form where equals
> should match. But I can see the forms contain different model types,
> it's after a form submit...
>
>
>
>
>        public class DiscoverFeedBackPanelsVisitor<T> implements
>
>        IVisitor<Component, Void> {
>
>                private Boolean shouldAccept;
>
>                private Form<T> form;
>
>                public DiscoverFeedBackPanelsVisitor(Form<T> form) {
>                        setShouldAccept(false);
>                        setForm(form);
>                }
>
>                @Override
>                public void component(Component component, IVisit<Void>
> visit) {
>
>                        if
> (Form.class.isAssignableFrom(component.getClass())) {
>                                Form<T> possibleForm =
> Form.class.cast(component);
>                                if (possibleForm.equals(getForm())) {
>
>                                        setShouldAccept(true);
>                                        visit.stop();
>                                }
>                        }
>
>                }
>
>                public void setShouldAccept(Boolean shouldAccept) {
>                        this.shouldAccept = shouldAccept;
>                }
>
>                public Boolean getShouldAccept() {
>                        return shouldAccept;
>                }
>
>                public void setForm(Form<T> form) {
>                        this.form = form;
>                }
>
>                public Form<T> getForm() {
>                        return form;
>                }
>
>        }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to