From: Edwin C. <com...@gm...> - 2009-03-30 10:57:06
|
Hi all, I have made some changes to core utility classes in GWT-OL that may be perceived as invasive and I changed XxxParams in the layer subpackage to XxxOptions. To my mind this will make GWT-OL more powerful and more consistent. First a list of changes and below some explanation: JSObject - added getters/setters for properties JSObjectHelper - implements getters/setters for JSObject ElementHelper - stripped of methods that do stuff on JSObject instead of Elements (a child of JSObject) Options - reduced to a JSObjectWrapper, wrapping an empty javascript object OptionsImp, OptionsBase, OptionsBaseImpl - deleted as they are no longer relevant XxxParams (in Layer package) - renamed to XxxOptions For refactoring code based on GWT-OL before these changes mean: -change imports of XxxParams to XxxOptions (the objects did not change otherwise) -any code that uses setAttribute methods exposed by Options should change to setAttribute(...) to getJSObject().setProperty(...) Please let me know if other code broke for you. This could be if anyone was using methods in ElementHelper that were not used in the API at all (mainly for doing stuff with Arrays, for which JSObjectArray and children seem more appropriate). The methods for working with JSObject were previously in ElementHelper and to my mind they did not belong there. An Element is a very specific kind of Javascript object that represents a DOM element. There is a lot of functionality for working with the DOM in GWT, especially if we upgrade to GWT 1.5. In GWT 1.4 there's already com.google.gwt.user.client.DOM, com.google.gwt.user.client.Element and in GWT 1.5 almost all the functions that can be called on Element in javascript can be called on it directly from GWT (if not all). Somehow, GWT 1.5 added all kinds of methods for direct manipulation of Element objects, but not for direct manipulation of JavaScriptObject objects. This is why JSObject now has methods to do this. The benefit is that all objects in GWT-OL are, or should be JSObjectWrapper objects and therefore have a public getJSObject method, to get at the underlying javascript object. This way the GWT-OL API can stay clean, but it is still possible to get at the bare javascript objects if users want to do this and get and set properties on the underlying javascript objects. This is desirable given the nature of GWT wrapper libraries. The rationale for renaming XxxParams to XxxOptions is to make clear that they are Options objects (Params is not object in GWT-OL), and to be more consistent with terminology used in OpenLayers documentation, see this link: http://docs.openlayers.org/library/syntax.html Greetings, Edwin |