Re: JsInterop and Sencha Ext js framework

184 views
Skip to first unread message

ateletin

unread,
Mar 16, 2016, 2:04:15 PM3/16/16
to google-we...@googlegroups.com
What I want to do is to wrap the javascript to java objects using jsinterop.
I would have dig deeper through documentation, but I didn't find anything
related to this subject..



--
View this message in context: http://google-web-toolkit.2317884.n4.nabble.com/JsInterop-and-Sencha-Ext-js-framework-tp15385p15394.html
Sent from the Google Web Toolkit mailing list archive at Nabble.com.

Kirill Prazdnikov

unread,
Mar 16, 2016, 4:45:56 PM3/16/16
to GWT Users, alin.t...@bearingpoint.com

Alain Ekambi

unread,
Mar 16, 2016, 5:56:35 PM3/16/16
to google-we...@googlegroups.com
Why reinvent the wheel. ? 

We have an Ext JS wrapper already.
And a JsInterop Version is coming soon.


Here is source.




On 16 March 2016 at 21:45, Kirill Prazdnikov <pki...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--

Alain Ekambi

Co-Founder

Ahomé Innovation Technologies

http://www.ahome-it.com/

ateletin

unread,
Mar 17, 2016, 3:33:06 AM3/17/16
to google-we...@googlegroups.com
Well, first of all, the documentation from Google site doesn't cover special
cases like when the javascript is written with a framework. I understood it
and I manage to make it work for simple javascript, but not for sencha ext
javascript.

Secondly, I have to use jsinterop because this is the direction that my
company want to take. I can't use Sencha Ext Java API, I have to make it
work with jsinterop..

Any other suggestions?

Thank you.



--
View this message in context: http://google-web-toolkit.2317884.n4.nabble.com/JsInterop-and-Sencha-Ext-js-framework-tp15385p15401.html

Alain Ekambi

unread,
Mar 17, 2016, 4:36:05 AM3/17/16
to google-we...@googlegroups.com
Yeah JS Intero documentation is nt that great at the moment. We are jsut doing  a lot of try and fail at the moment.


"Secondly, I have to use jsinterop because this is the direction that my
company want to take. I can't use Sencha Ext Java API, I have to make it
work with jsinterop.."

I dont understand that part. JS Interop to me is just an implementation details. The public API of our library will not change.
So you wont need to change  anything once the JS Interop base version is out. Why go the trouble to wrap the  entire Ext JS and Sencha Touch library from ground (And trust me they areee huuuuge libraries)
when it s already done and used in production by bunch of companies ? 





--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

ateletin

unread,
Mar 17, 2016, 4:44:47 AM3/17/16
to google-we...@googlegroups.com
Maybe I wasn't clear enough. What I want to do is to wrap the following
javascript into a java object like.

Ext.define('com.acme.client.Person', {
firstName : 'Kimi',
lastName : 'Raikkonen',

fullName : function() {
return firstName + " " + lastName;
}
});

into

package com.acme.client;
@JsType(isNative = true)
public class Person {
public String firstName;
public String lastName;

public native String fullName();
}

So by calling java fullName() to return the result of javascript fullName(),
or when I call java firstName to return "Kimi".
Can ExtJs Wrapper API help me with this? If so, can you give me a direction?
And yes, we don't plan to wrap the ExtJs library.




--
View this message in context: http://google-web-toolkit.2317884.n4.nabble.com/JsInterop-and-Sencha-Ext-js-framework-tp15385p15403.html

Alain Ekambi

unread,
Mar 17, 2016, 5:02:04 AM3/17/16
to google-we...@googlegroups.com
ah I see. 
You have an exsiting Ext JS app and you want to wrap it with JS Interop.
Honestly I dont know how to do it with JS Interop. Ext.define is one of the things  we did not bother deal with.

We just recreated the same object using pure java


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Brandon Donnelson

unread,
Mar 17, 2016, 9:50:27 AM3/17/16
to GWT Users, alin.t...@bearingpoint.com
ateletin, I've been working using jsinterop with extjs 6+, if you have some questions ping me and I can help with that. There are two ways to configure it, first is using ext.define. The other is using the ext class and instantiate it with a config object. Ext.define is far more documented than instantiating the classes, so it's easier. I've got a generator for generating all the class types, but it's not finished yet. 

Thanks,
Brandon

Alain Ekambi

unread,
Mar 17, 2016, 10:10:34 AM3/17/16
to google-we...@googlegroups.com

Which brings me back to the question of why not help improving ext4j instead of having tons of micro solutions ?

--

Brandon Donnelson

unread,
Mar 17, 2016, 10:19:23 AM3/17/16
to google-we...@googlegroups.com
Good question. I've wrapped an api or two and I've found it's alot of work. Since then, wrapping using JSNI feels painful. So I've been working on a generator to build the jsinterop for the extjs api with the flip of a switch. Besides that, the extjs team is cruising on the future iterations and I wanted something to keep up with what they put out. 

You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/4tyws5bK11s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.

ateletin

unread,
Mar 17, 2016, 10:34:41 AM3/17/16
to google-we...@googlegroups.com
My company owns a product that is written with GWT and wants to integrate in
it another external app which is written with ExtJs4.2.1 and we need a
wrapper in order to be able to extend or change the behavior of external app
based on our needs.




--
View this message in context: http://google-web-toolkit.2317884.n4.nabble.com/JsInterop-and-Sencha-Ext-js-framework-tp15385p15410.html

Thomas Broyer

unread,
Mar 17, 2016, 11:17:42 AM3/17/16
to GWT Users
Because Brandon works for Sencha? :-P
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsub...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.

Alain Ekambi

unread,
Mar 17, 2016, 2:49:30 PM3/17/16
to google-we...@googlegroups.com
Ext4j/Touch4j already has the ability to extends/wrap existing existing Ext JS /Sencha Touch apps with ease.


"My company owns a product that is written with GWT and wants to integrate in
it another external app which is written with ExtJs4.2.1 and we need a
wrapper in order to be able to extend or change the behavior of external app
based on our needs."
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.

ateletin

unread,
Mar 21, 2016, 4:08:46 AM3/21/16
to google-we...@googlegroups.com
I just want to let you know that my "Person" example which is written using
ExtJs works ok with JsInterop.
It seems that the problem was the ExtJs library that I used.. something was
broken in it. I've changed the library and now I get the expected results.

Thank you all for your time.



--
View this message in context: http://google-web-toolkit.2317884.n4.nabble.com/JsInterop-and-Sencha-Ext-js-framework-tp15385p15429.html

Brandon Donnelson

unread,
Mar 21, 2016, 12:25:34 PM3/21/16
to GWT Users, alin.t...@bearingpoint.com
Thomas has a point. I am biased, because work for Sencha. :)

This is my opinion. ExtJs has some nice Api docs, but they're written in javascript of course. And when using a external javascript library, I think hugging it as closely as possible helps tremendously. And the first reason I mean when I say, "hug it closely as possible" means the docs will easily guide the way. The second reason is, javascript has dynamic types and this both affects the return and function parameters. I'm all about getting the job done in the shortest path with iterative development in mind. I think this may be true for me on most libraries. I've found after building the Google maps api wrapper in JSNI, that it added a complexity and labor of maintenance that I would have rather concentrated on developing business logic to get the job done. That said, there are many ways to do things and this is just one of them. 

I found it quite simple to through together the object literals which leads to the creation of the javascript objects in the ExtJs world. I didn't follow the Java format in creation on this example in the gist. I kept it simple using Object for the types. Once i figured out Object literal creation, in the case ExtJs wants object literals instead of an Object, it was a snap to throw together a wrapper of just what I needed. 

https://gist.github.com/branflake2267/5ea05b1cf0c956953026 - Example of generically wrapping some javascript. 

Anyway, I'm digging JsInterops flexibility in writing Javascript. 
Reply all
Reply to author
Forward
0 new messages