View Full Version : ExtCore features in GXT project?

14 Nov 2011, 10:57 PM
Hello everyone!
I'm interested if it is possible to include some ExtCore (lightbox,carousel) features in GXT project. I know that is not recommended to mix GXT with any other javascript libraries. so are there any ways to imitate that features? The problem is that I'm not an expert in JavaScript, so I now can't even guess the direction I should look at.

16 Feb 2012, 9:33 AM
In short, this is unsupported, and you really shouldn't do what you're proposing. Ext GWT and Ext Core are designed differently, and many of their fundamental building blocks are different and incompatible.

It's important to realise why using GWT with other plain-JavaScript libraries is not recommended. When the GWT compiler compiles your code, it also prunes fairly aggressively to remove unused code and minifies what code you do have. If you introduce plain JavaScript, you get no optimization of the external JavaScript code.

That being said, if you want to integrate with a JavaScript library, you'll want to start by taking a look at JSNI (http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html). JSNI allows your Java-based code to communicate with other JavaScript code. Just write your Java code as you would, then write native methods in ordinary JavaScript to communicate with the other library. You can probably follow the examples for Ext Core in the native methods.

It would be great, of course, to port the library to Java. However, this would probably require you to take the time to become more familiar with the library (by reading the source), so it might not be practical depending on your time constraints and appetite for reading JavaScript. On the other hand, this would give you the most maintainable, efficient code, and is really the only way to approach this problem in a reasonable way.