From: Edwin C. <com...@gm...> - 2010-02-17 13:08:26
|
Hi Andrew, The Util class does indeed contain some handy functions that would be nice to wrap. The Util class should never be instantiated and should only have static methods in my opinion so both a Util and UtilImpl are not strictly necessary, but having both may give more flexibility and clarity than only a Util with static JSNI methods in it. If we mirror OL then Util is in the org.gwtopenmaps.client.openlayers.* namespace and not in org.gwtopenmaps.client.openlayers.util.* Example of usage: Util.extend(x:JSObjectWrapper, y:JSObjectWrapper) in Util: public static JSObjectWrapper extend(JSObjectWrapper destination, JSObjectWrapper source){ JSObject obj = UtilImpl.extend(destination.getJSObject(), source.getJSObject()); return destination.setJSObject(obj); } In UtilImpl public static JSObject extend(JSObject destination, JSObject source)/*-{ return $wnd.OpenLayers.Util.extend(destination, source); }-*/; The example you give is immediately an example for which plain JSNI seems the most appropriate, because you need to create a function that can be pretty broad. You could off course do sth similar as in setFormatOutput of MousePositionOptions, but plain JSNI is more straightfoward: public static void onImageLoadErrorDisplayNone()/*-{ $wnd.Openlayers.Util.onImageLoadError = function() {this.style.display ="none";} }-*/; Such a function could off course be added as a convenience to GWT-OL on the Util object. Greetings, Edwin On 17 February 2010 07:18, Andrew Hughes <ahh...@gm...> wrote: > Hi Guys, > There is a (handy) OpenLayer's class that doesn't appear to be wrapped > 'OpenLayers/Util.js': http://trac.openlayers.org/browser/tags/openlayers/release-2.8/lib/OpenLayers/Util.js > I'd like to wrapping this with: org.gwtopenmaps.openlayers.client.Util.java > and org.gwtopenmaps.openlayers.client.UtilImp.java > There's a slight naming overlap with > the org.gwtopenmaps.openlayers.client.util package. But is a minor issue. > Anyone like to chip in on this one? Trac ticket e.t.c. I need this so I can > fix those annoying pink tiles for missing map images. > Like this.. OpenLayers.Util.onImageLoadError = function() { > this.style.display="none";} > This appears to be a singleton (same for us) and I'm not sure if this should > 'extends OpenLayersObjectWrapper'. Some advice would be great. > Cheers :) > --AH > ------------------------------------------------------------------------------ > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > _______________________________________________ > Gwt-openlayers-users mailing list > Gwt...@li... > https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users > > |