GWT: finding the Java Source from the HTML - java

I just started working on a huge gwt project and asked myself if there is a smart way to find the gwt java classes while researching the HTML with firebug (or simular).
For example, I've a table somewhere on a html page and need to find the gwt class which generated this table.
I'm using gwt 2.4.0, eclipse 3.7, mostly firefox with firebug and the gwt-development-plugin.

You want to use the debugId:
http://ars-codia.raphaelbauer.com/2011/02/when-gwts-debug-ids-come-in-handy.html
You'll need to enable the debug module for that: http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/debug/client/package-summary.html

The only way I can think of is finding the table's ID (if it was set) or other attribute and searching through your Java code to see where it was set.
GWT generated code is highly obfuscated, and the variable names are changed to something smaller to save space - so there's no "easy" way to discover the original code from the JS.

You can also set the "Output style" of your compiled JavaSript to detailed, then it keeps the varible and class names of your Java project.
However this will make your JS files 100 times bigger and it never helped me debug an application. I actually found all my errors using the debug mode in eclipse! Code which didn't work correct in compiled mode also didn't work in the emulated debug version (when debugging, they are simulation the JavaSript functions with Java over the browser plugin).

Related

Cannot find a script or an extension object associated with namespace 'org.dita.dost.util.StringUtils'

I'm trying to debug an XSL transform using Visual Studio, but it keeps barfing on the clause:
xmlns:java="org.dita.dost.util.StringUtils"
This particular item is in the Dita OT library, which I have downloaded. I cannot find a way to "install" it or make it available to Visual Studio to let the XSLT go through.
-- Edit --
Of course it wasn't the mxlns line that was barfing, it was the first time it was used:
Running through another XSLT gives a similar error. In both cases it looks like Java can't find the namespace/class/JAR file. I have very little experience with setting up Java (read "very little" as "none"). Is there something I need to do to make the JAR file visible to Java?

SecureSocial Plugin for Play: Messages (i18n)

I have created a subpackage of views in order to customize the default look of securesocial's templates. (I have used https://github.com/ngarera/securesocial-custom-views-sample as an example and basically copied the relevant files)
There are two i18n-files (messages.en, messages.de) in my /conf folder.
Viewing the main page confirms that the messages.en is correctly used.
However, when calling /login (and therefore displaying the custom template), no messages-key is correctly looked up - instead only the key itself (e.g. "auth.login") is displayed, when really it should show "Login".
I have seen a similar request at Stackoverflow (How to change text in SecureSocial) where it was stated to remove the .en file extension. Doing that will show the correct Message...but creating one messages file is not really the point of internationalization...
I have confirmed that my browser sends the correct language (http://www.mybrowserinfo.com/detail.asp?bhcp=1) so messages.de should work...(which it does when I open a self-made controller - only the custom-securesocial-view is not working...)
Does anybody have similar problems?
And why does the localization work for securesocial's messages?
Regards,
David
PS: using Play 2.1.3, Java
There were some issues in the SecureSocial code that prevented i18n from working properly.
This has been fixed and is currently available in the master-SNAPSHOT version because a stable version with those changes has not been released yet.

Debugging using Java source code

Is there a way to include whole Java source code into an eclipse project so the program is easier to debbug (e.g. by inserting println in methods you otherwise couldn't insert anything)?
I have a bug in my code. But to better understand why the bug in my code appears, I'd like to see what intermediate results in some system method (on which use the bug occurs) are.
For example, I'd like to know what JViewPort.scrollRectToVisible() exactly does and how my input behaves in it by printing out some intermediate results that occur in the method itself.
EDIT:
Instead of using JRE System Library X, I want to add the source code from JDK as if I had written the code myself. I want to be able to edit any System class just as I am able to edit any class I created myself. I want editable .java files, not packed .jars...
You would need to add the 3rd-party library to your Eclipse workspace as an project. (How you would do that depends on the code you are dealing with.) Once you have done that, you can hack your copy of the library to add trace prints etcetera.
A better alternative is to simply attach the source code for the 3rd-party library so that the debugger can show you source as you step through the code, set breakpoints,. Then use "advanced breakpoint" techniques instead of trace prints; e.g. http://www.vogella.com/articles/EclipseDebugging/article.html#advanced
You cannot change the library code, but you can view it by using de-compiler. The max you can do is this. Now if you change any code in the libraries which you reached via the de-compiler, you would find an error stating "the integrity of the .jar package has changed which is not allowed"
Eclipse have built-in support for what you wanna do.
All you have to do is set breakpoint and execute application in debugging mode.
You can use these icons in Eclipse debugging perspective.
Follow along Eclipse Debugging Tutorial for details.

Website development and testing in Eclipse and Tomcat: javascript is cached

I'm developing a web application with jsp pages in Eclipse 3.7.2 and testing it with Tomcat v6.0.
I've almost the perfect environment as all changes to my jsp or java code are immediately available in the browser within Eclipse, so I can directly test any change.
But... I also use jQuery, who isn't ;-), and changes in my javascript files are not immediately active. Looks like they are cached or copied once and don't get replaced. Even after rebuilding or restarting the tomcat, the old files keep being used.
Any ideas on how to solve this?
Thanks a lot,
Frank
If you are using firebug in your browser, you can switch off the caching by default without adding code to your page:
click the arrow on the right side of the Networking button and select the disable browser cache option.
The files are probably cached by the browser.
ctrl-F5 might help but if you can configure the server to set no cache for js and css that should also help.
Another solution is to load all such files through a loader,
/load.<site extension, ex php>?file=myscript.js
And have that "proxy" set no cache.
We use that along with e-tag to be able to use build number as e-tag, vith every build a new version is forced to clients but then cached until next build.

rich:effect not working when a rich:panelMenu element is used elsewhere in the page

We have a Seam application that uses rich:effects in several places. They all worked fine until we decided to replace our old school menus with rich:panelMenu components.
At that point all the effects stopped working. It's clear that the inclusion of the rich:panelMenu items is the culprit, as the effects come back to life if we remove the menus from the header file (included in the main template, above the place where the body is inserted).
We're using Seam 2.2.0 GA with richfaces 3.3.2.SR1 and both rich:effect and rich:panelMenu seem to come from the same library. In both cases, the relevant javascript files seem to be included in the same order (judging by the script tags at the top of the page), and the only notable difference seems to be some additional local javascript segments the menu tags introduce.
The javascript error I get is this:
Effect[A.type] is not a constructor
Thanks in advance for any suggestions/pointers.
Are there other RichFaces componentes in that page? When you insert rich:panelMenu, it will trigger to load jQuery/Prototype over that page. Are you using another version of jQuery/Prototype for your old school menus?
Check which jQuery version are you using. Open Firefug console (Firebug is an extension to Firefox) and write this (with and without rich:panelMenu):
jQuery().jquery
Another option: maybe your JavaScript's menu is overriding some JavaScript from jQuery/Prototype (used by rich:panelMenu).

Categories