Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Using SmartGWT to assist in porting client-side logic to server

    Hello,

    We've been using SmartClient for a few years now. And, we have an extensive library of javascript code we've written that produces a variety of financial calculations for us. And, this library of javascript leverages the SmartClient APIs extensively (especially some of the useful APIS in the List, and Array classes). In short, these calculations are deeply intertwined with SmartClient but not directly involved with creating SmartClient widgets and page layout.

    We've been contemplating moving much of this logic to the server. But, there are significant benefits for our application to continue having this logic execute on the client. So, I'm wondering if it is possible for SmartGWT to help us. Would it be possible to port our javascript code for these financial calculations to the server-side and rewrite the code in java. But, then leverage SmartGWT to allow us the option of executing the logic in javascript client-side or in java on the server? Or possibly both depending on the use case.

    I understand this would be no small task but I'm just wondering about the feasibility of this idea at this point? Is SmartClientGWT stricly about creating SmartClient widgets and page layout? Or, can it handle javascript code generation from java for non-smartclient javascript code that only calls out to SmartClient APIs?

    #2
    You can place the shared piece of logic to be executed by the client as well as the server in a separate package and then add an entry to your module file like

    Code:
    <source path="common" />
    See :
    http://code.google.com/docreader/#p=...GuideModuleXml

    This lets the GWT compiler treat the classes under the "common" package as client side GWT classes. Note that the code under the "common" package must conform to the GWT JRE emulation API

    http://code.google.com/docreader/#p=...efJreEmulation

    So if you are able to rewrite your logic in a way that conforms to these rules you can reuse the code on client and server side.

    Comment

    Working...
    X