7 Aug 2013 5:20 AM #1
| |- api-v1.2
| | |- css
| | |- js
| | | |- i18n
| | |- media
| | | |- markers
| | | | |- draw
| | | | |- search
| | | |- openlayers
| | | |- popup
In earlier attempts I have managed to get the map working in the following manner:
* included the directory structure in the war directory of the project
* Created a FormPanel() (this is code prior to gxt 3.0.x) and in that panel added a HTML() containing the div-structure that the map needs (a main div with a specified id and some button-divs)
Now I want to make it a component so that it is separated from the application in a better way It will give me cleaner code and it is easier to reuse. But I do not know how to do this, so here are some questions:
* Is it for starters possible at all to accomplish this?
* Has anything similar been made before and are there examples to look at?
* What class should I override do you think?
* Can the directory structure (mapapi) be in the code (like for example the resources for the standard widgets) or must it be copied to war directory of each application that need the map?
Hope you can give some clarity on this matter. I would appreciate it alot.
12 Aug 2013 2:23 PM #2
Many of your general questions should be solved by the GWT JSNI documentation:
Yes, it should certainly be possible - the Google Maps API for GWT must do almost exactly what you are describing, as do many other GWT libraries/widgets that wrap existing JS widgets. I would probably start with Component or Widget, and call setElement with an element to use as the root, then kick off the init process in JS to populate that element.
Can the directory structure (mapapi) be in the code (like for example the resources for the standard widgets) or must it be copied to war directory of each application that need the map?
Look at another project which wraps a JS library, and how they call back and forth to make things work correctly, and read the JSNI document carefully - that should provide much of what you need to know to do this.