PDA

View Full Version : New to Ext.Direct



GregT
29 Sep 2009, 5:28 PM
1. So... Ext provides the client-side JS and define an API, then third parties provide server-side implementations such as DirectJngine? There is no Ext-supported server-side remoting product?

2. Is DirectJngine the "most obvious" one to use for Java? I assume it runs inside Tomcat and similar?

3. It looks as if a Ext.Direct method call is limited to a single return value, a-la Java, but I suppose this can be an arbitrarily complex object full of collections and so forth?

4. Still not clear (read the manual 3x and scanned this site) why I would use the Ext.Ajax class vs. the Ext.Direct ones?

Just trying to get my head around this, I hope these questions make sense, cheers.

jimmifett
29 Sep 2009, 5:48 PM
While I haven't had the chance to use with java yet, yes, you can return a complex structure so long as it is serializable to JSON.

Ext.Direct if i recall, sits on Ext.Ajax. It boils down to this:
Would yo like to go through the effort of manually instantiating and handling your Ext.Ajax calls?

or

Would you you like to make a simple native javascript method call?

example, when you are implementing the api property of a store, you can eithr have your CRUD references all point to custom written methods you have created by hand that perform ajax; or you can implement them cleanly with a directstore and implement it's CRUD api, looking kind of like this:

api: {
create: Ext.myapi.myCreate,
read: Ext.myapi.MyRead,
update: Ext.myapi.myUpdate,
destroy: Ext.myapi.myDestroy
}

and then let your json reader and json writer take care of the rest of the serialization.

pagullo
30 Sep 2009, 2:06 AM
2. Is DirectJngine the "most obvious" one to use for Java?


Hi,

Judging from the posts in this forum, it seems that all other implementations for Java are dead -but I'm DirectJNgine creator, so I *must* be very biased ;-)

As an aside, I don't think the ExtJs guys will ever create a Java implementation, because it would be competing against their own GWT based product, a no-no.



I assume it runs inside Tomcat and similar?
Yes. It runs on anything that can run a servlet, and it does not impose other library or framework (Struts, Wicket...), but can coexist with them.



3. It looks as if a Ext.Direct method call is limited to a single return value, a-la Java, but I suppose this can be an arbitrarily complex object full of collections and so forth?
Yes, you can return arbitrary objects. If you need to return two values, create a Pair class that contains the two values, and return it.

Just for reassurance: some of DirectJNgine's automated tests create *very* convoluted classes containing other classes, collections, primitive types, etc., just to make sure it all works.



4. Still not clear (read the manual 3x and scanned this site) why I would use the Ext.Ajax class vs. the Ext.Direct ones?
Use Ext.Direct for convenience. It is nice to call Java methods transparently, Ext.Direct is a higher level layer on top of Ext.Ajax that removes the need to write lots of boilerplate code.

You might want to download DirectJNgine User's Guide to take a look at how things will look like, just read the first 2/3 chapters to check whether you like it or not.

Regards

GregT
30 Sep 2009, 7:38 AM
I did read the user guide. It is excellent. Thank you for all the work you put into it! And, to both of you for such helpful replies.
Cheers from Canada.