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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to