GWTCanvas doesn't work in IE8 - java

We heavily use GWTCanvas in our project and it work excellent.
Except for IE8 in its standard document mode.
To solve this we have tried:
Update gwt-incubator to the latest version (2.1.0)
Patch GWTCanvas.java according to this link
But this didn't help. Has anybody make it works on IE8? Working and reliable solution/approach would be much appreciated.
UPDATE
It has been solved in this way:
patch excanvas.js and inject it into your GWT class
replace GWTCanvasImpl with your class via deffered binding in proper gwt.xml file
Hope this helps someone.

GWTCanvas uses the SVG specification to implement the vector objects on a given GWT site.
Although almost every other browser (Firefox, chrome and Opera and I am sure many others) have implemented the SVG one way or another, Ms does not support svg on a sufficient level yet.
Maybe including http://code.google.com/p/svgweb/ google javascript library implementation of SVG will solve your problems but then again it might not (have not tested it personally).
A different implementation of Vector Graphics fro GWT - gwt-graphics is another solution but again, if your vector objects are many, the emulation on IE gwt-graphics does make the applications not-responsive and just plain slow (personal experience).

Related

Best way to convert HTML page into PDF file

I am writing a new service Convert-HTML-TO-PDF. But now I am confused that what way should I prefer.
What ways I have to implement:
Use Head-less browser and capture the HTML page and convert to PDF
Use Java/Node Lib to convert. Which will create HTML relevant component in PDF file and then render?
Now, please help me to understand what will be the best way to implement a service and why!
[update]
And what will be the advantages and disadvantages of each approach
In my view, the best way forward always depends on what you already have experience with and what approach you take. There is no right or wrong here, everyone has to decide that for themselves based on their preferences.
Each approach has advantages and disadvantages. Some of them are:
Headless Browser:
Advantage:
No large Libs necessary, therefore very memory saving
Disadvantage
the desired browser must be installed on the computer/server
rendering may differ for different browsers
Library:
Advantage:
different libraries available
for the popular libs there is a good documentation and code examples
Disadvantage
When upgrading to a newer version, code usually needs to be adapted.
When upgrading to a newer version, the result may look different.
In my projects I use a headless chrome browser. For this I found an easy to use api on Github, which uses the DevTools of Chrome.
It also includes a simple example how to print a page into a PDF.
For my purposes I have customized this example and write the HTML into a temporary file and then navigate to that file.
// Navigate to HTML-File
page.navigate(htmlTempFile.getAbsolutePath());
I can't say if this is the best way, but for me this was the easiest and most understandable way

ISC_Core.js generation

I'm developing a web application with SmartGWT and I found an issue with Chrome. To solve the issue I modify part of my /war/projectName/sc/modules/ISC_Core.js. Following is the code I modify:
isc.Browser.isDOM?"
if(event.target.id.indexOf(\"Geoviewer_\") != -1){return true;}
if(returnVal==false)event.preventDefault();else if(returnVal==isc.EH.STOP_BUBBLING)event.stopPropogation();":"")+"return returnVal;"
The second line is the one I add to make the code work under specific circumstances in Chrome.
Now, unfortunately this is not a very 'clean' solution as I have to make the modification after the compilation because the file is generated after it. So my question is how can I find the piece of Java in the GWT code that is generating this Javascript so as to modify it once for ever and have the project compiling right without the necessity of further modifications?
Thanks for your help
The ISC_ Javascript files aren't being generated by GWT. SmartGWT is just a wrapper between GWT and a native Javascript library (SmartClient); it's basically the equivalent of a JNI AWT toolkit interface. If you have a repeatable bug, contact Isomorphic; they're pretty good about addressing demonstrable issues.

How do I get the rendered web page page from a URL?

I don't want just the source code. I want the rendered page. This is an important distinction that I apparently cannot make by simply searching Google.
Does anyone know how I can get the rendered page from a URL?
This needs to be done in Java, hopefully without an extra library.
Another solution would be to use HTMLUnit which is a "GUI-less browser for JAVA". It is recommended by Google to generate snapshots of ajax-based webpages to make them crawlable.
You can try using a library that wraps a web browser, for example Berkelium. If you need it in Java, a Google search produced this Java wrapper API for Berkelium (I haven't tried it personally).
sites.google has an example of its use:

Automatic sitemap generation

We have recently installed a Google Search Appliance in order to power our internal search (via the Java API), and all seems to be well, however I have a question regarding 'automatic' site-map generation that I'm hoping you guys may know the answer to.
We are aware of the GSA's ability to auto-generate site maps for each of its collections, however this process is rather manual, and considering that we have around 10 regional sites that need to be updated as often as possible, its not ideal to have to log into the admin interface on a regular basis in order to export them to the site root where search engines can find them.
Unfortunately there doesn't seem to be any API support for this, at least none that I can find, so I was wondering if anyone had any ideas for a solution/workaround or, if all else fails, the best alternative.
At present I'm thinking that if we can get the full index back from the API in the form of a list, then we can write an XML file out using that the old fashioned way using a chronjob or similar, however this seems like a bit of a clumsy solution - any better ideas.
You could try the GSA Admin Toolkit, or simply write some code yourself which just logs in on the administration page and then uses that session to invoke the sitemap export URL (which is basically what the Admin Toolkit does).

Using XMLBeans on Android

I was just wondering if anyone had any success in getting XMLBeans (or any other generator) to work on android. It would be very nice if I could use it because I have a very large schema that I would rather not write all the classes by hand.
I had asked about this on the android developers mailing list, but no one responded. This tells me that either they don't care, or no one feels like telling me its not possible.
If anyone knows of anything else like XMLBeans that works for android, please let me know. It would be very helpful.
Thanks,
Robbie
If you're looking to do class generation and DOM parsing, XMLBeans is probably pretty heavy-weight for a mobile device running android. All of the code generated by XMLBeans makes synchronized calls into an underlying data store that I've seen as a hot spot several times when profiling.
I can't suggest any alternatives, but I would be wary of using this even if you could get it to work, because of the afore mentioned performance issue.
You can use Castor . Just be sure, in Android 2.1, not to use default android SAXParser. You'll get namespace errors. You do this by defining the parser to be, for example, Xerces (and the you add the required JARS), in core.properties .
In android 2.2 it may be ok.
Note that if you create an xmlcontext for the unmarsheler with xerces, it still won't work, as the mapping itself would be parsed with android's SAX. It must be done at core (top level properties file) so that even the mapping is parsed by xerces.
finally - performance is as slow as you can expect... :(
Good luck
SM
I got JAXB working on Android.

Categories