I have a page which have several panels of the same type which
contains forms, all those forms have the same id.. Currently I am
considering grabbing the modelobject on the form and equaling those,
this of course means if I have multiple forms editing the same object
on the same page with feedbackpanels those would show each others
messages.. In my case I do not have that. But I thought somehow the
equals method on forms where safe to use across requests...
About iterating over forms, I am doing so :) visitParents does not
allow other types than components AFAIK...
DiscoverFormsVisitorT discoverFeedBackPanelsVisitor = new
DiscoverFormsVisitorT(
getForm());
message.getReporter().visitParents(Form.class,
discoverFeedBackPanelsVisitor);
return discoverFeedBackPanelsVisitor.getShouldAccept();
2011/3/30 Martin Grigorov mgrigo...@apache.org:
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 DiscoverFeedBackPanelsVisitorT implements
IVisitorComponent, Void {
private Boolean shouldAccept;
private FormT form;
public DiscoverFeedBackPanelsVisitor(FormT form) {
setShouldAccept(false);
setForm(form);
}
@Override
public void component(Component component, IVisitVoid
visit) {
if
(Form.class.isAssignableFrom(component.getClass())) {
FormT 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(FormT form) {
this.form = form;
}
public FormT 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/
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org