Hi,

still using Jwt with Jruby, I have some problems to access the argument
passed with a Signal1.

I define a signal with one argument [1]:
     @selection_clicked = Signal1.new(self)

and trigger it with one argument:
      @selection_clicked.trigger(
WImage.new(resource, "chart coming..."))

I then inspect the instance of the signal and I'm adding a listener:
      puts @lists.selection_clicked.inspect # prints
#<Java::EuWebtoolkitJwt::Signal1:0x69127c4d>
      @lists.selection_clicked.add_listener(self) { |resource|
display_chart(resource) }

This shows that @lists.selection_clicked is indeed an instance of Signal1.

Below is the error I get, the null pointer exception being due to the block
trying to access the argument (when the listener does not use the argument
of the signal, there's no null pointer exception).
I tried with a more Java-like approach, defining a class for the listener:

class ClickListener
  java_implements Signal1::Listener
  def trigger(a)
    puts "got argument :"
    puts a.inspect
  end
end

but the result was the same: the argument does not seem to be available.

The code works fine when using Listener1 and  passing a block without
argument, ie attaching a listener with no argument.
When triggering a Signal (with no argument), I have to modify the trigger
call to remove the argument too, so the problem occurs, at the receiver end.

Do you spot an error in my use of Jwt? I sent a mail to the Jruby list, but
got no answer (I think the structure of the jruby code is ok though). If I
use Jwt correctly I might bother them again

Thanks in advance!

Raph




:1 warning: multiple values for a block parameter (0 for 1)
16191 [qtp555989664-18] ERROR eu.webtoolkit.jwt.WebSession - error during
event handling: org.jruby.exceptions.RaiseException: Native Exception:
'class java.lang.NullPointerException'; Message: null; StackTrace:
java.lang.NullPointerException
        at
eu.webtoolkit.jwt.WContainerWidget.addWidget(WContainerWidget.java:304)

16192 [qtp555989664-18] ERROR eu.webtoolkit.jwt.WebSession - fatal error:
org.jruby.exceptions.RaiseException: Native Exception: 'class
java.lang.NullPointerException'; Message: null; StackTrace:
java.lang.NullPointerException
        at
eu.webtoolkit.jwt.WContainerWidget.addWidget(WContainerWidget.java:304)

org.jruby.exceptions.RaiseException: Native Exception: 'class
java.lang.NullPointerException'; Message: null; StackTrace:
java.lang.NullPointerException
        at
eu.webtoolkit.jwt.WContainerWidget.addWidget(WContainerWidget.java:304)

        at
eu.webtoolkit.jwt.WContainerWidget.addWidget(WContainerWidget.java:304)
Caused by: java.lang.NullPointerException
        ... 1 more




[1]
http://www.webtoolkit.eu/jwt/latest/doc/javadoc/eu/webtoolkit/jwt/Signal1.html
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to