Debug console for GWT/GXT - gwt

I need to see component tree of the GWT application. DOM tree will be also acceptable. Unfortunatelly GWT hosted browser does not provide access for devToolbar.
The only way I found is to compile to javascript and then use regular browser. But compilation takes enormous ammount of time.
ExtJS has Debug Console, but I was not able to find something similar for GXT.
Please suggest the way you debug visual GWT applications.

Yes, I was just wanting this today FireBug + GWT. If you are adventurous you could look into builds of GWT 2.0 where Out Of Process Hosted Mode will be available letting you debug in FireFox or other browsers. Design: Out of Process Hosted Mode
The source for GWT is here http://google-web-toolkit.googlecode.com/svn/branches/
I personally haven't hit the pain threshold to build this yet because I keep hearing 2.0 is "close"

It's not a debugger in the same mould as Firebug but the GWT Log console is really, really handy for finding out what's happening within the JavaScript.
See: http://code.google.com/p/gwt-log/

Normally one would use the IDE debugger to step through GWT code. but if the problem is a CSS/styling issue (which from the sound of the question, it seems to be), then that might not really help.
i guess compiling it and using firebug is the only tried and true way for css issues.

Why is compilation into (pretty) JavaScript taking so much time? I don't think it should. Perhaps you should disable compilation for irrelevant browsers (irrelevant for debugging purposes), thereby reducing compilation time significantly.

One idea is to minimize compile time by reducing the permutations (different version for each browser) during development.
In your module.gwt.xml force an user agent, for example gecko1_8 (Firefox 2).
<!-- User Agent -->
<set-property name="user.agent" value="gecko1_8" />
If you're using i18n you can also limit the locales used during development.

Related

how to debug GWT 2.4 in sigel with eclipse?

Exists some way to do hot redeploy when developing with gwt 2.4 in eclipse so i can make some change in the view like the text of a label and then press refresh or something like that and the modification appear? that problem is because the project i'm running takes at least 50 minutes to compile and wait 50 minutes just for one text of a label for example is hard...
Well ok, you're question is somewhat vague, but here's some points that hopefuly will help:
Yep, GWT compilation is slow. If you have a big GWT project, it might take good minutes for it to compile. This is sort of a known issue. What you can do to solve this is split your project into multiple GWT libraries and just compile the library you're currently working with.
Regarding hot deploy: your gwt project has two types of code: client code and server side code. The client side code (which is translated to Javascript by the GWT compiler) is hot-deployable. If you follow the instructions here:
https://developers.google.com/web-toolkit/gettingstarted
you'll have a "magic button" that lets you hot deploy your project into any of the more popular browsers. This means that you can modify your client-side code, refresh your browser and it's updated.
For the server-side code that doesn't work. AFAIK, you need to re-compile your project for those modification to be taken into account.
Have you tried GWT Designer?
Read more : https://developers.google.com/web-toolkit/tools/gwtdesigner/

GWT: debug events capturing/bubbling

I wonder if there is a way to perform a step-by-step debugging of the compiled GWT code, in order to determine how some events are being fired.
The interest I have on this is that I'm using SmartGWT, and for some reason the click events on their components propagate to pop up windows that occupy the same position. However this only happens in Mobile Safari.
Even more interesting it only happens with smartGWT version of onClick and not with the plain GWT onClick.
Mostly a hack for now, but I suppose it'll work (you'll have to recompile your app though):
First, compile a recent GWT from trunk: https://developers.google.com/web-toolkit/makinggwtbetter#workingoncode
Then recompile your app with source maps enabled: http://code.google.com/p/google-web-toolkit/wiki/SourceMaps
Follow the steps in the comments of this wiki page to be able to use SourceMaps in Chrome, then re-deploy your app
Get Chrome on the Dev channel: http://www.chromium.org/getting-involved/dev-channel
Use http://www.iwebinspector.com/ to start Mobile Safari with remote debugging and then connect to it from your Chrome desktop: http://www.webkit.org/blog/1620/webkit-remote-debugging/
Finally, enable source maps in Chrome so you'll see your Java code in the Web Inspector!
See http://www.youtube.com/watch?v=-xJl22Kvgjg for a preview of the future of debugging with GWT, that will allow this kind of things in a much less hackish way in the near future.
I don't know if there is a nice way to debug compiled javascript GWT code, but why do you need it?
For described purpose it's better to use GWT development mode with debugging options. You can add the following parametres e-Xdebug -Xrunjdwp:transport=dt_socket,address={PORT},server=y,suspend=n to the development mode running command, it will give an opportunity to add breakpoints to the cliend side GWT/SmardGWT source code. Then for debugging you should connect to port specified in parametres from your java IDE.
Debugging GWT https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging

GWT Modify file on server

we all agree that when we use GWT, we compile our application on the server, several javascript file are created. Normally, when deploying, we would use the obfuscated mode.
Now modifying a javascript file in obfuscated mode is almost impossible. Now what happens if we want to make some modification in our GWT application.
Do we have to go back again in Java, modify the file, compile, and then deploy again??
I'd say yes... If you use a code generator you should avoid modifying the generated code by hand.
No, no, no.
You don't "go back" to the Java code to modify it. You simply debug, test and modify the Java code. You ignore the code in the compiled javascript files except to deploy it. As far as you are concerned, GWT source code is Java code, not javascript, written within the environmental restriction of the browser.
Your question is like asking, "I have a C application that gets compiled to object code. Do I modify the object code or go back to the C code to modify it?" !!!
You simply treat the generated javascript as "native code".
No doubt you can include javascript using jsni, and so can you include assembly code when using C. So except for those assembly code you inject and similarly except the javascript code you include, you leave the "native code" alone.
When you try to modify the object code generated from C, that is called hacking. Hacking is an interesting hobby but when you wish to create an application and your main task is not "hacking", hacking would only be your extra-curricular activity not connected to your main employment or project.
Go back to the beginning: http://code.google.com/webtoolkit/overview.html
...Write AJAX applications in Java and
then compile the source to highly
optimized JavaScript that runs across
all browsers
When you're ready to deploy, GWT
compiles your Java source code into
optimized, stand-alone JavaScript
files that automatically run on all
major browsers, as well as mobile
browsers for Android and the iPhone.
While debugging: if you are running in development mode you may not even have to redeploy while in dev.
Thanks to the GWT developer plugin,
there's no compiling of code to
JavaScript to view it in the browser.
You can use the same edit-refresh-view
cycle you're used to with JavaScript...

Larg GWT Project and compile time problem

How do I do for my larg GWT project, the compile time is going large more and more.
If the best way is splitting the module to multiple modules, how can I do this.
RGDS
I don't think that splitting project to modules will help. to the contrary it even can slow compilation. Speed of compiling depends on number of permutations which GWT compiles.
What you can do:
Compile GWT project only for 1 web browser. You can define this explicitly in GWT configuration file. <set-property name="user.agent" value="ie6"/> Other options are ie6, gecko1_8, safari.
Reduce number of used languages (for
development stage). Use only 1 locale.
The GWT compiler is inherently slow. Konoplianko provided some optimizations in his answer, but this will only go so far. There are 2 more compiler options that will help. You can play around with the number of worker threads, usually going from 1 to 2 will help and sometimes 3, but depending on your system it will hurt compile time when you get above a certain point(usually 3 in my experience). Also you can use the -draftCompile option if you are using 2.1. GWT was architected with the intention that you only compile when you intend to deploy something not during development. It was intended that you use hosted mode for development because it can keep track of what has changed and only recompile what is needed instead of having to recompile everything. I am not sure if it would help but changing the output from OBF to DETAILED or vice-versa might effect compile time.
Here is two topic that I think will be helpful to you
How to get GWT to compile multiple modules and How do I speed up the gwt compiler?

drag and drop environment to start developing in gwt

is there any drag and drop environment to work with GWT widgets.
or any user friendly IDE or plugin on IDE's
i remember using some thing like MyEclips for developing Hibernate was better then working with .xml files.
The Eclipse-based WindowBuilder Pro supports GWT and is now free, courtesy of Google.
I tried GWT Designer, http://code.google.com/webtoolkit/tools/gwtdesigner/index.html, but I think for now I'll stick to code the guis myself by hand.
The main reasons are:
Sometimes, it takes a little while (longer than I can wait) to load the design mode.
Sometimes it breaks after you modify code underneath.
Sometimes, does not do what you expect it to do.
I would suggest you giving it a try and see if it works out for your needs.
In my opinion, the experience using it has been frustrating than encouraging.