Ok, I stripped down everything to a very basic setup that should work according 
to Martins
suggestions and the wicket documentation. Any ideas why 
canCallListenerInterface is never called
here?

J.

import java.lang.reflect.Method;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;


public class SandboxPage extends WebPage {

  public SandboxPage() {
    WebMarkupContainer container = new WebMarkupContainer("container") {
      @Override
      public boolean isEnabled() {
        return false;
      }
    };
    AjaxLink<Void> link = new AjaxLink<Void>("link") {
      @Override
      protected boolean isLinkEnabled() {
        System.out.println(".... le");
        return true;
      }

      @Override
      public boolean canCallListenerInterface(Method method) {
        System.out.println(".... cc");
        return true;
      }

      @Override
      public boolean isEnabled() {
        System.out.println(".... ie");
        return true;
      }

      @Override
      public void onClick(AjaxRequestTarget target) {
        System.out.println("clicked...");
      }
    };

    container.add(link);
    this.add(container);
  }
}

<?xml version="1.0" encoding="utf-8"?>
<html>
    <div wicket:id="container">
      <div wicket:id="link">Click me!</div>
    </div>
</html>


On 09.05.2012 14:29, Jürgen Lind wrote:
Hi Martin,

thanks for the hint, unfortunatly, it does not work :-( I've been looking 
through the relevant
code and the approach seems right, however at some point, the returned values 
seem to be ignored
and the link is still disabled (i.e. the onclick-handler is not rendered)... I 
will have to
investigate further...

J.

On 09.05.2012 13:05, Martin Grigorov wrote:
Hi,

I think it is possible to do that for links.
You'll need to override
org.apache.wicket.markup.html.link.AbstractLink#isLinkEnabled() and
org.apache.wicket.Component#canCallListenerInterface(Method)

The first is needed to not render the link as disabled. The second is
needed to be able to actually execute the links logic.

The second method is added in 1.5.x.

On Wed, May 9, 2012 at 1:47 PM, Jürgen Lind<juergen.l...@iteratec.de> wrote:
Hi Martin,

that was my initial approach. However, I would like the collapsible panels
to keep their
state between form submits, therefore I would need some sort of Javascript
state management
or I would simply use ajax links for that purpose. Which is what I would
prefer... A later
post already mentioned that this wont be too easy, so maybe I will have to
go back to JS...

J.


On 09.05.2012 11:16, Martin Grigorov wrote:

Hi,

Why don't use plain Javascript for this. It will be faster because it
wont make roundtrip to the server and wont be disabled as a Wicket
component ?

On Wed, May 9, 2012 at 12:06 PM, Jürgen Lind<juergen.l...@iteratec.de>
wrote:

Hi,

I have a little problem in my application and maybe someone has an idea
how
to solve it:
I have a complex form that is structured using a custom collapsible
AJAX-panel to show/hide
certain parts of the form. Now, if a user does not have the write
permission
for the form, the
form is disabled and therefore all input elements as well (which is
good).
However, for
obvious reaons, I would like the collapsible panels to remain enabled.
How
could I achieve
this? I have already tried to have the ajax-link for the panel to always
return true from
isEnabled, but that seems to be overriden by the parent component. Any
ideas
where to look?

Cheers,

Jürgen


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to