[Commits] r2762 - in sandbox/gxm/geoext/gxm: build examples lib

commits at geoext.org commits at geoext.org
Wed Jul 20 16:02:47 CEST 2011


Author: marcjansen
Date: 2011-07-20 16:02:47 +0200 (Wed, 20 Jul 2011)
New Revision: 2762

Added:
   sandbox/gxm/geoext/gxm/lib/GXM.closurized.js
Modified:
   sandbox/gxm/geoext/gxm/build/Makefile
   sandbox/gxm/geoext/gxm/examples/buttons.html
   sandbox/gxm/geoext/gxm/examples/layerlist.html
   sandbox/gxm/geoext/gxm/examples/mappanel.html
   sandbox/gxm/geoext/gxm/examples/state.html
Log:
[gxm] add a target to the makefile that builds a singlefile to be used in the examples

Modified: sandbox/gxm/geoext/gxm/build/Makefile
===================================================================
--- sandbox/gxm/geoext/gxm/build/Makefile	2011-07-20 13:48:56 UTC (rev 2761)
+++ sandbox/gxm/geoext/gxm/build/Makefile	2011-07-20 14:02:47 UTC (rev 2762)
@@ -8,18 +8,19 @@
 DATE = $(shell date +'%Y-%m-%d %H:%M:%S')
 NIGHTLY = $(LIB_NAME)-$(TODAY)
 
-.PHONEY: help lib zip tgz release nightly clean
+.PHONEY: help lib zip tgz release nightly examplelib clean
 
 help: 
 	@echo
 	@echo "  Please use 'make <target>' where <target> is one or more of"
-	@echo "    clean    to clean up after building"
-	@echo "    lib      to make a standalone dir of lib resources"
-	@echo "    zip      to make a zip archive of the standalone lib"
-	@echo "    tgz      to make a gzipped tar-ball of the standalone lib"
-	@echo "    release  calls clean, lib, zip and tgz"
-	@echo "    nightly  calls release, moves the tar.gz and zip and calls clean"
-	@echo "    help     show this screen"
+	@echo "    clean      to clean up after building"
+	@echo "    lib        to make a standalone dir of lib resources"
+	@echo "    zip        to make a zip archive of the standalone lib"
+	@echo "    tgz        to make a gzipped tar-ball of the standalone lib"
+	@echo "    release    calls clean, lib, zip and tgz"
+	@echo "    nightly    calls release, moves the tar.gz and zip and calls clean"
+	@echo "    examplelib calls lib, copies the singlefile to the lib-directory and calls clean"
+	@echo "    help       show this screen"
 	@echo
 	@echo "  Example use:"
 	@echo "    make lib"
@@ -57,6 +58,10 @@
 	cp $(TGZ_NAME) ../$(LIB_NAME)-$(TODAY)
 	make clean
 
+examplelib: lib
+	cp $(LIB_NAME)/$(LIB_NAME).js ../lib/$(LIB_NAME).closurized.js
+	make clean
+
 clean:
 	-rm -rf $(LIB_NAME)
 	-rm -f $(ZIP_NAME)

Modified: sandbox/gxm/geoext/gxm/examples/buttons.html
===================================================================
--- sandbox/gxm/geoext/gxm/examples/buttons.html	2011-07-20 13:48:56 UTC (rev 2761)
+++ sandbox/gxm/geoext/gxm/examples/buttons.html	2011-07-20 14:02:47 UTC (rev 2762)
@@ -16,9 +16,13 @@
         <script type="text/javascript" src="../external/sencha-touch-1.1.0/sencha-touch.js"></script>
         <script type="text/javascript" src="../external/OpenLayers.r11966/OpenLayers.js"></script>
         
-        <!-- This file loads all relevant files -->
+        <!-- This file loads all relevant files
         <script type="text/javascript" src="../lib/GXM.loader.js"></script>
+        -->
         
+        <!-- This references a singlefile build -->
+        <script type="text/javascript" src="../lib/GXM.closurized.js"></script>
+        
         <script type="text/javascript" src="./buttons.js"></script>
     </head>
     <body>

Modified: sandbox/gxm/geoext/gxm/examples/layerlist.html
===================================================================
--- sandbox/gxm/geoext/gxm/examples/layerlist.html	2011-07-20 13:48:56 UTC (rev 2761)
+++ sandbox/gxm/geoext/gxm/examples/layerlist.html	2011-07-20 14:02:47 UTC (rev 2762)
@@ -18,9 +18,13 @@
         <script type="text/javascript" src="../external/OpenLayers.r11966/OpenLayers.js"></script>
         <script type="text/javascript" src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
         
-        <!-- This file loads all relevant files -->
+        <!-- This file loads all relevant files
         <script type="text/javascript" src="../lib/GXM.loader.js"></script>
+        -->
         
+        <!-- This references a singlefile build -->
+        <script type="text/javascript" src="../lib/GXM.closurized.js"></script>
+        
         <script type="text/javascript" src="./layerlist.js"></script>
     </head>
     <body>

Modified: sandbox/gxm/geoext/gxm/examples/mappanel.html
===================================================================
--- sandbox/gxm/geoext/gxm/examples/mappanel.html	2011-07-20 13:48:56 UTC (rev 2761)
+++ sandbox/gxm/geoext/gxm/examples/mappanel.html	2011-07-20 14:02:47 UTC (rev 2762)
@@ -16,9 +16,13 @@
         <script type="text/javascript" src="../external/sencha-touch-1.1.0/sencha-touch.js"></script>
         <script type="text/javascript" src="../external/OpenLayers.r11966/OpenLayers.js"></script>
         
-        <!-- This file loads all relevant files -->
+        <!-- This file loads all relevant files
         <script type="text/javascript" src="../lib/GXM.loader.js"></script>
+        -->
         
+        <!-- This references a singlefile build -->
+        <script type="text/javascript" src="../lib/GXM.closurized.js"></script>
+        
         <script type="text/javascript" src="./mappanel.js"></script>
     </head>
     <body>

Modified: sandbox/gxm/geoext/gxm/examples/state.html
===================================================================
--- sandbox/gxm/geoext/gxm/examples/state.html	2011-07-20 13:48:56 UTC (rev 2761)
+++ sandbox/gxm/geoext/gxm/examples/state.html	2011-07-20 14:02:47 UTC (rev 2762)
@@ -16,9 +16,13 @@
         <script type="text/javascript" src="../external/sencha-touch-1.1.0/sencha-touch.js"></script>
         <script type="text/javascript" src="../external/OpenLayers.r11966/OpenLayers.js"></script>
         
-        <!-- This file loads all relevant files -->
+        <!-- This file loads all relevant files
         <script type="text/javascript" src="../lib/GXM.loader.js"></script>
+        -->
         
+        <!-- This references a singlefile build -->
+        <script type="text/javascript" src="../lib/GXM.closurized.js"></script>
+        
         <script type="text/javascript" src="./state.js"></script>
     </head>
     <body>

Added: sandbox/gxm/geoext/gxm/lib/GXM.closurized.js
===================================================================
--- sandbox/gxm/geoext/gxm/lib/GXM.closurized.js	                        (rev 0)
+++ sandbox/gxm/geoext/gxm/lib/GXM.closurized.js	2011-07-20 14:02:47 UTC (rev 2762)
@@ -0,0 +1,22 @@
+/**
+ * GXM - GeoExt Mobile
+ */
+Ext.ns("GXM");GXM.singleFile=!0;Ext.ns("GXM");
+(function(){var a=Ext.isObject(GXM)&&GXM.singleFile;window.GXM=Ext.apply(GXM||{},{version:"1.0.0"});var b=a?"GXM.js":"lib/GXM.loader.js";if(!a){var c=[],d=function(){for(var a="",c=document.documentElement.getElementsByTagName("script"),d=0,h=c.length;d<h;d++){var e=c[d].getAttribute("src");if(e){var g=e.lastIndexOf(b),f=e.lastIndexOf("?");if(f<0)f=e.length;if(g>-1&&g+b.length==f){a=e.slice(0,f-b.length);break}}}return a}()+"lib/GXM/";Ext.each(["widgets/MapPanel.js","widgets/Button.js","widgets/SegmentedButton.js",
+"data/model/Layer.js","data/LayerReader.js","data/LayerStore.js","widgets/LayerList.js"],function(a){c.push("<script type='text/javascript' src='"+d+a+"'><\/script>")});document.write(c.join(""))}})();Ext.ns("GXM");
+GXM.Button=Ext.extend(Ext.Button,{exclusiveGroup:null,map:null,mappanel:null,uScope:null,uHandler:null,control:null,initComponent:function(){GXM.Button.superclass.initComponent.call(this);GXM.Button.manager.register(this);if(!this.map&&this.mapPanel&&this.mapPanel.map)this.map=this.mapPanel.map;else if(!this.map&&this.control&&this.control.map)this.map=this.control.map;this.uScope=this.scope;this.uHandler=this.handler;this.scope=this;this.handler=this.pHandler;this.control&&this.map&&!this.control.map&&
+(this.map.addControl(this.control),this.pressed&&this.control.map&&this.control.activate(),this.control.events.on({activate:this.onCtrlActivate,deactivate:this.onCtrlDeactivate,scope:this}))},pHandler:function(){var a=this.control;a&&a.type===OpenLayers.Control.TYPE_BUTTON?a.trigger():a.active?a.deactivate():a.activate();if(this.uHandler){var b=Ext.toArray(arguments);b.push(a.active);this.uHandler.apply(this.uScope,b)}},getExclusiveGroupMembers:function(){var a=[],b=this.exclusiveGroup;b&&GXM.Button.manager.each(function(c,
+d){d.exclusiveGroup===b&&a.push(d)});return a},onCtrlActivate:function(){var a=this.getExclusiveGroupMembers(),b=this.id;this._isDeactivating=!0;Ext.each(a,function(a){if(b!==a.id&&(a.control.deactivate(),a.pressed))a.pressed=!1,a.removeCls(a.pressedCls)});this._isDeactivating=!1;this.getEl().hasCls(this.pressedCls)||this.addCls(this.pressedCls)},onCtrlDeactivate:function(){this._isDeactivating||this.removeCls(this.pressedCls)}});Ext.reg("gxm_button",GXM.Button);GXM.Button.manager=new Ext.AbstractManager;
+Ext.ns("GXM");GXM.SegmentedButton=Ext.extend(Ext.SegmentedButton,{initComponent:function(){if(this.exclusiveGroup)this.allowMultiple=!1;var a;if(!this.allowMultiple){if(!this.exclusiveGroup)this.exclusiveGroup=Ext.id(null,"gxm-gen-exclusive-group");a=this.exclusiveGroup}this.defaults=Ext.applyIf(this.defaults||{},{map:this.map,xtype:"gxm_button",exclusiveGroup:a});if(this.items&&this.items.length===1)this.allowDepress=!0;GXM.SegmentedButton.superclass.initComponent.call(this)}});
+Ext.reg("gxm_segmentedbutton",GXM.SegmentedButton);Ext.regModel("gxm_Layer",{fields:[{name:"name"},{name:"layer"}]});Ext.ns("GXM.data");GXM.data.LayerReader=Ext.extend(Ext.data.JsonReader,{root:"",readRecords:function(a){a=GXM.data.LayerReader.superclass.readRecords.call(this,a);Ext.each(a.records,function(a){if(Ext.isDefined(a.data)&&Ext.isDefined(a.data.layer))a.data.layer=a.raw});return a}});Ext.reg("gxm_layerreader",GXM.data.LayerReader);Ext.ns("GXM.data");
+GXM.data.LayerStore=Ext.extend(Ext.data.Store,{constructor:function(a){a=a||{};a.model=a.model||"gxm_Layer";a.proxy=a.proxy||{type:"memory",reader:new GXM.data.LayerReader({})};return GXM.data.LayerStore.superclass.constructor.call(this,a)}});Ext.reg("gxm_layerstore",GXM.data.LayerStore);Ext.ns("GXM");
+GXM.MapPanel=Ext.extend(Ext.Component,{map:null,center:null,bounds:null,fullscreen:!0,getDefaultControls:function(){return[new OpenLayers.Control.TouchNavigation,new OpenLayers.Control.Attribution]},initComponent:function(){if(!(this.map instanceof OpenLayers.Map)){this.controls=this.defaultControls;var a=Ext.applyIf(this.map||{},{allOverlays:!0,controls:this.getDefaultControls()});this.map=new OpenLayers.Map(a)}if(this.layers){if(this.layers instanceof OpenLayers.Layer)this.layers=[this.layers];
+this.map.addLayers(this.layers)}this.layers=new GXM.data.LayerStore({data:this.map.layers});if(this.controls){if(this.controls instanceof OpenLayers.Control)this.controls=[this.controls];this.map.addControls(this.controls)}if(Ext.isString(this.center))this.center=OpenLayers.LonLat.fromString(this.center);else if(Ext.isArray(this.center))this.center=new OpenLayers.LonLat(this.center[0],this.center[1]);if(Ext.isString(this.extent))this.extent=OpenLayers.Bounds.fromString(this.extent);else if(Ext.isArray(this.extent))this.extent=
+OpenLayers.Bounds.fromArray(this.extent);GXM.MapPanel.superclass.initComponent.call(this);this.addEvents("aftermapmove","afterlayervisibilitychange","afterlayeropacitychange","afterlayerorderchange","afterlayernamechange","afterlayeradd","afterlayerremove");this.map.events.on({moveend:this.onMoveend,changelayer:this.onChangelayer,addlayer:this.onAddlayer,removelayer:this.onRemovelayer,scope:this})},onMoveend:function(){this.fireEvent("aftermapmove")},onChangelayer:function(a){a.property&&(a.property===
+"visibility"?this.fireEvent("afterlayervisibilitychange"):a.property==="order"?this.fireEvent("afterlayerorderchange"):a.property==="name"?this.fireEvent("afterlayernamechange"):a.property==="opacity"&&this.fireEvent("afterlayeropacitychange"))},onAddlayer:function(){this.layers=new GXM.data.LayerStore({data:this.map.layers});this.fireEvent("afterlayeradd")},onRemovelayer:function(){this.layers=new GXM.data.LayerStore({data:this.map.layers});this.fireEvent("afterlayerremove")},afterRender:function(){GXM.MapPanel.superclass.afterRender.apply(this,
+arguments);this.ownerCt?(this.ownerCt.on("move",this.updateMapSize,this),this.ownerCt.on({afterlayout:{fn:this.renderMap,scope:this,single:!0}})):this.renderMap()},renderMap:function(){var a=this.map;this.el&&this.el.dom&&this.el.dom.firstChild&&Ext.fly(this.el.dom.firstChild).remove();a.render(this.el.dom);a.getCenter()||(this.center||this.zoom?a.setCenter(this.center,this.zoom):this.extent instanceof OpenLayers.Bounds?a.zoomToExtent(this.extent,!0):a.zoomToMaxExtent())},updateMapSize:function(){this.map&&
+this.map.updateSize()},beforeDestroy:function(){this.ownerCt&&this.ownerCt.un("move",this.updateMapSize,this);this.map&&this.map.events&&this.map.events.un({moveend:this.onMoveend,changelayer:this.onChangelayer,addlayer:this.onAddlayer,removelayer:this.onRemovelayer,scope:this});(!this.initialConfig.map||!(this.initialConfig.map instanceof OpenLayers.Map))&&this.map&&this.map.destroy&&this.map.destroy();delete this.map;GXM.MapPanel.superclass.beforeDestroy.apply(this,arguments)}});
+GXM.MapPanel.guess=function(){var a;Ext.ComponentMgr.all.each(function(b,c){if(c instanceof GXM.MapPanel)return a=c,!1});return a};Ext.reg("gxm_mappanel",GXM.MapPanel);
+GXM.LayerList=Ext.extend(Ext.List,{layers:null,mapPanel:null,map:null,onItemTap:function(a,b){var c=this.getStore().getAt(b).get("layer");c.isBaseLayer?this.map.setBaseLayer(c):c.setVisibility(!c.getVisibility());this.refresh();GXM.LayerList.superclass.onItemTap.call(this,arguments)},initComponent:function(){this.mapPanel&&this.mapPanel instanceof GXM.MapPanel?(this.map=this.mapPanel.map,this.store=this.mapPanel.layers):this.store=this.layers||this.store;this.itemTpl=new Ext.XTemplate('<tpl if="this.isVisible(layer)">',
+'<span class="gxm-visible-layer-indicator"></span>',"</tpl>",'<tpl if="!this.isVisible(layer)">','<span class="gxm-invisible-layer-indicator"></span>',"</tpl>",'<span class="gxm-layer-item">{name}</span>',{isVisible:function(a){var b=!1;return b=a.isBaseLayer&&a.map.baseLayer===a?!0:!!a.getVisibility()}});if(this.map)this.map.events.on({changelayer:this.onChangeLayer,scope:this});GXM.LayerList.superclass.initComponent.call(this)},onChangeLayer:function(){this.refresh()}});
+Ext.reg("gxm_layerlist",GXM.LayerList);



More information about the Commits mailing list