Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    LightStreamer with GWTQuery.

    I was wondering if anyone has come across and problem using light streamer in GWT when also inheriting the GWTQuery package? Simply inheriting the gwtQuery package has the end effect of causing a subscription to become null. Remove the gwtQuery inherits and the problem goes away.

    Excerpts from <project>.gwt.xml

    <add-linker name="xs" />

    <inherits name='com.google.gwt.query.Query'/>

    JS client error with gwtQuery inherited.

    Thu Feb 06 16:01:52 GMT-600 2014 com.google.gwt.logging.client.LogConfiguration SEVERE: (TypeError) stack: $dialogBoxResult@http://**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:189$on Success@http://**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:1890$o nResponseReceived@http://**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:16823$ fireOnResponseReceived@http://1**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:8575on ReadyStateChange@http://**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:8741$s etOnReadyStateChange/this$static.onreadystatechange<@http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:21062a pply@http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:6188en try0@http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:6226en try_0/<@http://1/**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:6211 fileName: http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html lineNumber: 189 columnNumber: 2: this$static.grid.subscription is null
    com.google.gwt.core.client.JavaScriptException: (TypeError) stack: $dialogBoxResult@http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:189$on Success@http://**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:1890$o nResponseReceived@http:/**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:16823$ fireOnResponseReceived@http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:8575on ReadyStateChange@http:///**/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:8741$s etOnReadyStateChange/this$static.onreadystatechange<@http:///loaddesk/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:21062a pply@http:///loaddesk/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:6188en try0@http:///loaddesk/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:6226en try_0/<@http:///loaddesk/773F7F6C1E017B4CFE8FCCE688B8F0AA.cache.html:6211 fileName: http:///loaddesk/773F7F6C1E017B4CFE8...0AA.cache.html lineNumber: 189 columnNumber: 2: this$static.grid.subscription is null
    at Unknown.$dialogBoxResult(Unknown Source)
    at Unknown.$onSuccess(Unknown Source)
    at Unknown.$onResponseReceived(Unknown Source)
    at Unknown.$fireOnResponseReceived(Unknown Source)
    at Unknown.onReadyStateChange(Unknown Source)
    at Unknown.$setOnReadyStateChange/this$static.onreadystatechange<(Unknown Source)
    at Unknown.apply(Unknown Source)
    at Unknown.entry0(Unknown Source)
    at Unknown.entry_0/<(Unknown Source)
    at Unknown.anonymous(Unknown Source)

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi flybyGWT,

    Yes, you are right, I have tried to add the gwtQuery to our GWT StockList Demo and indeed, it stopped working.
    But with a couple of tweaks it resumes to work again, in detail the steps that I followed are these:

    1. Change the style for the Lighstreamer JavaScript library in use. You can build a suitable lightstreamer.js file from the online generator.
    In that case be sure to include the LightstreamerClient, Subscription, and any other class used in your app and to flag the "Use namespaced globals" option.

    2. In the source code of the Demo, every time a object of the Lightstreamer library should be instantiated add the prefix "$wnd.Lightstreamer.". For example:



    3. Recompile the sources and run the application.

    Please get back to me for any further explaination.

  3. #3
    I have taken the steps you have outlined and I am getting the same error.

    I used the Online Generator with the LightStreamerClient, Subscription, and Use namedspaced globals options. (we are not using any other classes)

    I copied the output of the generator and replaced the lightstreamer.js file contents with the generated output.

    I changed all references to
    ->


    I cleaned all the GWT output files, recompiled, and still received the same error. I then removed the <inherits name='com.google.gwt.query.Query'/> from the xml and recompiled/ran, and started noticing the call to new $wnd.Lightstreamer.LightstreamerClient(); was returning null.

    Is there a change to the lightstreamer_globals.js that also needed to happen?

    Thanks

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi flybyGWT,

    No, no changes to the generated library, you just need be sure that the new library file is correctly pointed from html page.

  5. #5
    I apologize i am taking this over from another developer so I am not entirely which scripts are suppose to be included.

    Our html page only loads <script src="lightstreamer/lightstreamer_globals.js"></script>... Is that incorrect?

    Thanks.

  6. #6
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Only one file needs to be included and the filename where you saved the generated library should match with the <script> command in HTML page.
    So, if you have saved the lib in "lightstreamer/lightstreamer.js", you should change html page in:


  7. #7
    Thank you very much for the info. Changing to the lightstreamer.js script inclusion fix the problem with the LightStreamerClient returning null.

    However the same error as before is popping up again. This is occurring when the gwt.xml is NOT including the GWTQuery inherit.

    I have also verified that we are not port clashing... As i know that can cause the same error to be thrown.

    /88DD3B1C31918427CB9FC421FC5294D2.cache.js lineNumber: 184 columnNumber: 2: this$static.grid.subscription is null
    at Unknown.$dialogBoxResult(Unknown Source)
    at Unknown.$onSuccess(Unknown Source)
    at Unknown.$onResponseReceived(Unknown Source)
    at Unknown.$fireOnResponseReceived(Unknown Source)
    at Unknown.onReadyStateChange(Unknown Source)
    at Unknown.$setOnReadyStateChange/this$static.onreadystatechange<(Unknown Source)
    at Unknown.apply(Unknown Source)
    at Unknown.entry0(Unknown Source)
    at Unknown.entry_0/<(Unknown Source)
    at Unknown.anonymous(Unknown Source)

  8. #8
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    The "$wnd.Lightstreamer." prefix have to be added every time you instantiate the "Subscription" class (just as for any other class of the library).


  9. #9
    So in GWT we are first creating the client and storing it in a GWT JSO variable then passing the JSO subscription list to it (The JSO client) and calling subscribe.




    private JavaScriptObject client;

    ...

    this.client = this.createClient();

    ...

    client.subscribe(grid);
    ...

    private native JavaScriptObject createClient() /*-{
    var client = new $wnd.Lightstreamer.LightstreamerClient(); ;
    return client;
    }-*/;

    public void subscribe(LDFieldsSubscription sub) {
    if (this.client == null) {
    throw new IllegalStateException("LightstreamerClient failed to initialize properly");
    }
    this.subscribe(sub.getSubscription());
    }

    private native void subscribe(JavaScriptObject sub) /*-{
    this.@com.company.project.application.client.ui.Li ghtstreamerClient::client.subscribe(sub);
    }-*/;




    private native JavaScriptObject initSubscription(String[] itemList,
    String[] fieldList, String subscriptionMode) /*-{


    var that = this;
    mySub = null;


    mySub = new Subscription(subscriptionMode, itemList, fieldList);


    mySub
    .addListener({
    onItemUpdate : function(itemUpdate) {
    for (i = 0; i < fieldList.length; i++) {


    // check whether the schema value is changed. If it's not, skip it
    // unless a full data snapshot is being sent.
    if (!itemUpdate.isValueChanged(fieldList[i])
    && !itemUpdate.isSnapshot()) {
    continue;
    }


    var itemName = null;
    itemName = itemUpdate.getItemName();


    var value = null;
    value = itemUpdate.getValue(fieldList[i]);
    if (value != null) {
    that.@com.delta.acs.loaddesk.client.ui.LDFieldsSub scription:nItemUpdate(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String(itemName, fieldList[i], value);
    }
    }
    }
    });


    return mySub;
    }-*/;

  10. #10
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Please, try to replace



    with


 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 04:39 PM.