You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vitaly Tsaplin <vi...@gmail.com> on 2010/11/18 14:32:29 UTC
Link with the 'wantOnSelectionChangedNotifications()' behavior
Hi everyone,
I am curious why the Link class does not implement something like
what 'wantOnSelectionChangedNotifications()' mechanism does for
CheckBox, DropDownChoice, etc.?
I have implemented FormLink and I use it as a subclass for
everything that has to extend Link since it can fall back gracefully
to a simple link behaviour. Maybe it would be reasonable to make the
wicket Link capable of doing this?
public abstract class FormLink<T> extends Link<T> {
private static final long serialVersionUID = 1L;
public FormLink(String id, IModel<T> model) {
super(id, model);
}
public FormLink(String id) {
super(id);
}
@Override
protected CharSequence getURL() {
CharSequence url = urlFor(ILinkListener.INTERFACE);
Form<?> form = findParent(Form.class);
if (form != null) {
RequestContext rc = RequestContext.get();
if (rc.isPortletRequest()) {
url = ((PortletRequestContext) rc).getLastEncodedPath();
}
return "javascript:" + form.getJsForInterfaceUrl(url);
}
return url;
}
}
Best regards,
Vitaly
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org