[Commits] r262 - in sandbox/opengeo/geoexplorer: lib/GeoExt/widgets lib/GeoExt/widgets/tree tests/widgets
commits at geoext.org
commits at geoext.org
Tue Mar 24 14:27:23 CET 2009
Author: ahocevar
Date: 2009-03-24 14:27:23 +0100 (Tue, 24 Mar 2009)
New Revision: 262
Removed:
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNodeUI.js
Modified:
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/MapPanel.js
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerContainer.js
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerNode.js
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js
sandbox/opengeo/geoexplorer/tests/widgets/MapPanel.html
Log:
updated to treenodes.2.patch, but only TristateCheckboxNode, LayerNode and LayerContainer (see #22)
Modified: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/MapPanel.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/MapPanel.js 2009-03-24 13:24:14 UTC (rev 261)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/MapPanel.js 2009-03-24 13:27:23 UTC (rev 262)
@@ -149,4 +149,19 @@
}
});
-Ext.reg('gx_mappanel', GeoExt.MapPanel);
+/**
+ * APIFunction GeoExt.MapPanel.guess
+ * Convenience function for guessing the map panel of an application. This can
+ * reliably be used for all applications that just have one map panel in the
+ * viewport.
+ *
+ * Returns:
+ * {<GeoExt.MapPanel>} The first map panel found by the Ext component manager.
+ */
+GeoExt.MapPanel.guess = function() {
+ return Ext.ComponentMgr.all.find(function(o) {
+ return o instanceof GeoExt.MapPanel;
+ });
+}
+
+Ext.reg('gx_mappanel', GeoExt.MapPanel);
\ No newline at end of file
Modified: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerContainer.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerContainer.js 2009-03-24 13:24:14 UTC (rev 261)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerContainer.js 2009-03-24 13:27:23 UTC (rev 262)
@@ -11,22 +11,21 @@
* will be included. The childrens' iconCls will be set to "baselayer-icon"
* for base layers, and to "layer-icon" for overlay layers.
*
- * To use this node type in JSON config, set nodeType to "gxLayerContainer".
+ * To use this node type in JSON config, set nodeType to "olLayerContainer".
*
* Inherits from:
* - <Ext.tree.TreeNode>
*/
GeoExt.tree.LayerContainer = Ext.extend(Ext.tree.TreeNode, {
+ layerStore: null,
+
/**
- * ConfigProperty: map
- * {OpenLayers.Map} or {String} - map or id of an {Ext.Component} that
- * has a map property with an {OpenLayers.Map} set. This node will
- * be connected to that map. If omitted, the node will query the
- * ComponentManager for the first component that has a map property
- * with an {OpenLayers.Map} set.
+ * ConfigProperty: defaults
+ * {Object} a configuration object passed to all nodes that this
+ * LayerContainer creates.
*/
- map: null,
+ defaults: null,
/**
* Constructor: GeoExt.tree.LayerContainer
@@ -35,10 +34,8 @@
* config - {Object}
*/
constructor: function(config) {
- this.map = config.map;
-
- this.addEvents("customizeconfig");
-
+ this.layerStore = config.layerStore;
+ this.defaults = config.defaults;
GeoExt.tree.LayerContainer.superclass.constructor.apply(this, arguments);
},
@@ -50,24 +47,23 @@
*/
render: function(bulkRender) {
if (!this.rendered) {
- var map = this.map instanceof OpenLayers.Map ? this.map :
- (typeof this.map == "string" ? Ext.getCmp(this.map).map :
- Ext.ComponentMgr.all.find(function(o) {
- return o.map instanceof OpenLayers.Map;
- }).map);
- if (map.layers) {
- var layer, node;
- for (var i = 0, len = map.layers.length; i < len; ++i) {
- layer = map.layers[i];
- this.addLayerNode(layer);
- }
+ if(!this.layerStore) {
+ this.layerStore = GeoExt.MapPanel.guess().layers;
}
- map.events.register("addlayer", this, function(e) {
- this.addLayerNode(e.layer);
+ this.layerStore.each(function(record) {
+ this.addLayerNode(record);
+ }, this)
+ this.layerStore.on({
+ "add": function(store, records, index){
+ for(var i=0; i<records.length; ++i) {
+ this.addLayerNode(records[i]);
+ }
+ },
+ "remove": function(store, record, index) {
+ this.removeLayerNode(record);
+ },
+ scope: this
});
- map.events.register("removelayer", this, function(e) {
- this.removeLayerNode(e.layer);
- });
}
GeoExt.tree.LayerContainer.superclass.render.call(this, bulkRender);
},
@@ -77,20 +73,16 @@
* Adds a child node representing a layer of the map
*
* Parameters:
- * layer - {OpenLayers.Layer} the layer to add a node for
+ * layerRecord - {Ext.data.Record} the layer record to add the layer for
*/
- addLayerNode: function(layer) {
+ addLayerNode: function(layerRecord) {
+ var layer = layerRecord.get("layer");
if (layer.displayInLayerSwitcher == true) {
-
- var config = {
- iconCls: layer.isBaseLayer ? 'baselayer-icon' : 'layer-icon',
- layer: layer
- }
-
- this.fireEvent("customizeconfig", config, layer);
-
- node = new GeoExt.tree.LayerNode(config);
-
+ var node = new GeoExt.tree.LayerNode(Ext.applyIf({
+ iconCls: layer.isBayeLayer ? 'baselayer-icon' : 'layer-icon',
+ layer: layer,
+ layerStore: this.layerStore
+ }, this.defaults));
this.appendChild(node);
}
},
@@ -100,9 +92,10 @@
* Removes a child node representing a layer of the map
*
* Parameters:
- * layer - {OpenLayers.Layer} the layer to remove the node for
+ * layerRecord - {Ext.data.Record} the layer record to remove the node for
*/
- removeLayerNode: function(layer) {
+ removeLayerNode: function(layerRecord) {
+ var layer = layerRecord.get("layer");
if (layer.displayInLayerSwitcher == true) {
var node = this.findChildBy(function(node) {
return node.layer == layer;
@@ -115,6 +108,6 @@
});
/**
- * NodeType: gxLayerContainer
+ * NodeType: gx_layercontainer
*/
-Ext.tree.TreePanel.nodeTypes.gxLayerContainer = GeoExt.tree.LayerContainer;
+Ext.tree.TreePanel.nodeTypes.gx_layercontainer = GeoExt.tree.LayerContainer;
Modified: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerNode.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerNode.js 2009-03-24 13:24:14 UTC (rev 261)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/LayerNode.js 2009-03-24 13:27:23 UTC (rev 262)
@@ -1,14 +1,93 @@
/**
* Copyright (c) 2008 The Open Planning Project
- *
- * @requires GeoExt/widgets/tree/TristateCheckboxNode.js
*/
Ext.namespace("GeoExt.tree");
/**
+ * Class: GeoExt.tree.LayerNodeUI
+ *
+ * Inherits from:
+ * - <GeoExt.tree.TristateCheckboxNodeUI>
+ */
+GeoExt.tree.LayerNodeUI = Ext.extend(GeoExt.tree.TristateCheckboxNodeUI, {
+
+ /**
+ * Property: radio
+ * {Ext.Element}
+ */
+ radio: null,
+
+ /**
+ * Constructor: GeoExt.tree.LayerNodeUI
+ *
+ * Parameters:
+ * config - {Object}
+ */
+ constructor: function(config) {
+ GeoExt.tree.LayerNodeUI.superclass.constructor.apply(this, arguments);
+ },
+
+ /**
+ * Method: render
+ *
+ * Parameters:
+ * bulkRender - {Boolean}
+ */
+ render: function(bulkRender) {
+ GeoExt.tree.LayerNodeUI.superclass.render.call(this, bulkRender);
+ var a = this.node.attributes;
+ if (a.radioGroup && !this.radio) {
+ this.radio = Ext.DomHelper.insertAfter(this.checkbox,
+ ['<input type="radio" class="x-tree-node-cb" name="',
+ a.radioGroup, '_querylayer"></input>'].join(""));
+ }
+ },
+
+ /**
+ * Method: onClick
+ *
+ * Parameters:
+ * e - {Object}
+ */
+ onClick: function(e) {
+ if (e.getTarget('input[type=radio]', 1)) {
+ this.fireEvent("querylayerchange", this.node.layer);
+ } else {
+ GeoExt.tree.LayerNodeUI.superclass.onClick.call(this, e);
+ }
+ },
+
+ /**
+ * Method: toggleCheck
+ *
+ * Parameters:
+ * value - {Boolean}
+ */
+ toggleCheck: function(value) {
+ GeoExt.tree.LayerNodeUI.superclass.toggleCheck.apply(this, arguments);
+ var node = this.node;
+ var layer = this.node.layer;
+ node.visibilityChanging = true;
+ if(layer.getVisibility() != value) {
+ layer.setVisibility(value);
+ }
+ node.visibilityChanging = false;
+ },
+
+ /**
+ * Method: destroy
+ */
+ destroy: function() {
+ GeoExt.tree.LayerNodeUI.superclass.destroy.call(this);
+ delete this.radio;
+ }
+});
+
+
+/**
* Class: GeoExt.tree.LayerNode
*
- * A subclass of {Ext.tree.AsyncTreeNode} that is connected to an
+ * A subclass of {<GeoExt.tree.TristateCheckboxNode>} that is connected to an
* {OpenLayers.Layer} by setting the node's layer property. Checking or
* unchecking the checkbox of this node will directly affect the layer and
* vice versa. The default iconCls for this node's icon is "layer-icon",
@@ -27,7 +106,7 @@
* fire the querychange event, with the layer as argument. A queryGroup
* attribute, set to the map's id, will be added to the attributes hash.
*
- * To use this node type in a JSON config, set nodeType to "gxLayer".
+ * To use this node type in a JSON config, set nodeType to "olLayer".
*
* Inherits from:
* - <GeoExt.tree.TristateCheckboxNode>
@@ -36,37 +115,42 @@
/**
* ConfigProperty: layer
- * {OpenLayers.Layer} or {String}. The layer that this layer node will
- * be bound to, or the name of the layer (has to match the layer's name
- * property). Subclasses or applications can always rely on finding an
- * {OpenLayers.Layer} object in attributes.layer.
+ * {OpenLayers.Layer|String} The layer that this layer node will
+ * be bound to, or the name of the layer (has to match the layer's
+ * name property). If a layer name is provided, <layerStore> also has
+ * to be provided.
*/
layer: null,
/**
- * ConfigProperty: map
- * {OpenLayers.Map} or {String}. Map or id of an {Ext.Component} that
- * has a map property with an {OpenLayers.Map} set. This node will
- * be connected to that map. If omitted, the node will query the
- * ComponentManager for the first component that has a map property
- * with an {OpenLayers.Map} set.
+ * ConfigProperty: layerStore
+ * {<GeoExt.data.LayerStore|"auto"} The layer store containing the layer
+ * that this node represents. If set to "auto", the node will query
+ * the ComponentManager for a <GeoExt.MapPanel>, take the first one it
+ * finds and takes its layer store. This property is only required
+ * if <layer> is provided as a string.
*/
- map: null,
+ layerStore: null,
/**
- * Property: haveLayer
- * {Boolean} will be set to true as soon as this node is connected to a
- * layer.
+ * ConfigProperty: childNodeType
+ * {Ext.tree.Node|String} node class or nodeType of childnodes for this
+ * node. A node type provided here needs to have an add method, with
+ * a scope argument. This method will be run by this node in the
+ * context of this node, to create child nodes. See
+ * {<GeoExt.tree.LayerParamsNode>} for an example implementation that
+ * adds nodes based on a layer's params object.
*/
- haveLayer: null,
+ childNodeType: null,
/**
- * Property: updating
- * {Boolean} The visibility status of the layer is being updated by itself
- * (i.e. not by clicking on this node, but by layer visibilitychanged)
+ * Property: visibilityChanging
+ * {Boolean} private property indicating layer visibility being changed
+ * by this node in order to prevent visibilitychanged events bouncing
+ * back and forth
*/
- updating: false,
-
+ visibilityChanging: false,
+
/**
* Constructor: GeoExt.tree.LayerNode
*
@@ -74,11 +158,8 @@
* config - {Object}
*/
constructor: function(config) {
- this.layer = config.layer;
- this.map = config.map;
- this.haveLayer = false;
-
config.leaf = config.leaf || !config.children;
+
config.iconCls = typeof config.iconCls == "undefined" &&
!config.children ? "layer-icon" : config.iconCls;
// checked status will be set by layer event, so setting it to false
@@ -88,6 +169,11 @@
this.defaultUI = this.defaultUI || GeoExt.tree.LayerNodeUI;
this.addEvents.apply(this, GeoExt.tree.LayerNode.EVENT_TYPES);
+ Ext.apply(this, {
+ layer: config.layer,
+ layerStore: config.layerStore,
+ childNodeType: config.childNodeType
+ });
GeoExt.tree.LayerNode.superclass.constructor.apply(this, arguments);
},
@@ -99,72 +185,129 @@
* layer {<OpenLayers.Layer>} - optional
*/
render: function(bulkRender) {
- if (!this.rendered || !this.haveLayer) {
- var map = this.map instanceof OpenLayers.Map ? this.map :
- (typeof this.map == "string" ? Ext.getCmp(this.map).map :
- Ext.ComponentMgr.all.find(function(o) {
- return o.map instanceof OpenLayers.Map;
- }).map);
- var layer = this.attributes.layer || this.layer;
- this.haveLayer = layer && typeof layer == "object";
- if(typeof layer == "string") {
- var matchingLayers = map.getLayersByName(layer);
- if(matchingLayers.length > 0) {
- layer = matchingLayers[0];
- this.haveLayer = true;
- }
+ var layer = this.layer instanceof OpenLayers.Layer && this.layer;
+ if(!layer) {
+ // guess the store if not provided
+ if(!this.layerStore || this.layerStore == "auto") {
+ this.layerStore = GeoExt.MapPanel.guess().layers;
}
+ // now we try to find the layer by its name in the layer store
+ var i = this.layerStore.findBy(function(o) {
+ return o.get("title") == this.layer;
+ }, this);
+ if(i != -1) {
+ // if we found the layer, we can assign it and everything
+ // will be fine
+ layer = this.layerStore.getAt(i).get("layer");
+ }
+ }
+ if (!this.rendered || !layer) {
var ui = this.getUI();
- if(this.haveLayer) {
- this.attributes.layer = layer;
- if(layer.queryable == true) {
- this.attributes.radioGroup = layer.map.id;
- }
+
+ if(layer) {
+ this.layer = layer;
if(!this.text) {
this.text = layer.name;
}
+
+ if(this.childNodeType) {
+ this.addChildNodes();
+ }
+
ui.show();
ui.toggleCheck(layer.getVisibility());
- layer.events.register("visibilitychanged", this, function(){
- this.updating = true;
- if(this.attributes.checked != layer.getVisibility()) {
- ui.toggleCheck(layer.getVisibility());
- }
- this.updating = false;
- });
- this.on("checkchange", function(node, checked){
- if(!this.updating) {
- if(checked && layer.isBaseLayer) {
- map.setBaseLayer(layer);
- }
- layer.setVisibility(checked);
- }
- }, this);
-
+ this.addVisibilityEventHandlers();
// set initial checked status
this.attributes.checked = layer.getVisibility();
} else {
ui.hide();
}
- map.events.register("addlayer", this, function(e) {
- if(layer == e.layer) {
- this.getUI().show();
- } else if (layer == e.layer.name) {
- // layer is a string, which means the node has not
- // yet been rendered because the layer was not found.
- // But now we have the layer and can render.
- this.render(bulkRender);
- return;
+
+ if(this.layerStore instanceof GeoExt.data.LayerStore) {
+ this.addStoreEventHandlers(layer);
+ }
+ }
+ GeoExt.tree.LayerNode.superclass.render.call(this, bulkRender);
+ },
+
+ /**
+ * Method: addVisibilityHandlers
+ * Adds handlers that sync the checkbox state with the layer's visibility
+ * state
+ */
+ addVisibilityEventHandlers: function() {
+ this.layer.events.register("visibilitychanged", this, function() {
+ if(!this.visibilityChanging &&
+ this.attributes.checked != this.layer.getVisibility()) {
+ this.getUI().toggleCheck(this.layer.getVisibility());
+ }
+ });
+ this.on({
+ "checkchange": function(node, checked) {
+ if (checked && this.layer.isBaseLayer) {
+ this.layer.map.setBaseLayer(this.layer);
}
- });
- map.events.register("removelayer", this, function(e) {
- if(layer == e.layer) {
+ this.layer.setVisibility(checked);
+ },
+ scope: this
+ });
+ },
+
+ /**
+ * Method: addStoreEventHandlers
+ * Adds handlers that make sure the node disappeares when the layer is
+ * removed from the store, and appears when it is re-added.
+ */
+ addStoreEventHandlers: function() {
+ this.layerStore.on({
+ "add": function(store, records, index) {
+ var l;
+ for(var i=0; i<records.length; ++i) {
+ l = records[i].get("layer");
+ if(this.layer == l) {
+ this.getUI().show();
+ } else if (this.layer == l.name) {
+ // layer is a string, which means the node has not yet
+ // been rendered because the layer was not found. But
+ // now we have the layer and can render.
+ this.render(bulkRender);
+ return;
+ }
+ }
+ },
+ "remove": function(store, record, index) {
+ if(this.layer == record.get("layer")) {
this.getUI().hide();
}
- });
+ },
+ scope: this
+ });
+ },
+
+ /**
+ * Method: addChildNodes
+ * If the layer's layers param is an array of layer names, a subnode for
+ * each name will be created.
+ */
+ addChildNodes: function() {
+ if(typeof this.childNodeType == "string") {
+ Ext.tree.TreePanel.nodeTypes[this.childNodeType].add(this);
+ } else if(this.childNodeType.add) {
+ this.childNodeType.add(this);
}
- GeoExt.tree.LayerNode.superclass.render.call(this, bulkRender);
- }
+ },
+
+ /**
+ * Method: updateCheckedChildNodes
+ *
+ * Parameters:
+ * node - {Ext.tree.node}
+ * checked - {Boolean}
+ */
+ updateCheckedChildNodes: function(node, checked) {
+ GeoExt.tree.LayerNode.superclass.updateCheckedChildNodes.call(this,
+ node, checked);
+ }
});
/**
@@ -179,6 +322,6 @@
GeoExt.tree.LayerNode.EVENT_TYPES = ["querylayerchange"];
/**
- * NodeType: gxLayer
+ * NodeType: gx_layer
*/
-Ext.tree.TreePanel.nodeTypes.gxLayer = GeoExt.tree.LayerNode;
\ No newline at end of file
+Ext.tree.TreePanel.nodeTypes.gx_layer = GeoExt.tree.LayerNode;
\ No newline at end of file
Modified: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js 2009-03-24 13:24:14 UTC (rev 261)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js 2009-03-24 13:27:23 UTC (rev 262)
@@ -4,6 +4,58 @@
Ext.namespace("GeoExt.tree");
/**
+ * Class: GeoExt.tree.TristateCheckboxNodeUI
+ *
+ * Inherits from:
+ * - <Ext.tree.TreeNodeUI>
+ */
+GeoExt.tree.TristateCheckboxNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
+
+ /**
+ * Constructor: GeoExt.tree.TristateCheckbosNodeUI
+ *
+ * Parameters:
+ * config - {Object}
+ */
+ constructor: function(config) {
+ GeoExt.tree.TristateCheckboxNodeUI.superclass.constructor.apply(this, arguments);
+ },
+
+ /**
+ * Method: toggleCheck
+ *
+ * Parameters:
+ * value - {Boolean} checked status
+ * thirdState - {Boolean}
+ * options - {Object} Hash of options for this method
+ *
+ * Currently supported options:
+ * silent - {Boolean} set to true if no checkchange event should be
+ * fired
+ */
+ toggleCheck: function(value, thirdState, options) {
+ options = options || {}
+ var cb = this.checkbox;
+ if(thirdState == true) {
+ if(cb) {
+ Ext.get(cb).setOpacity(0.5);
+ }
+ this.node.attributes.thirdState = true;
+ } else {
+ if(cb) {
+ Ext.get(cb).clearOpacity();
+ }
+ delete this.node.attributes.thirdState;
+ }
+
+ options.silent && this.node.suspendEvents();
+ GeoExt.tree.TristateCheckboxNodeUI.superclass.toggleCheck.call(this,
+ value);
+ options.silent && this.node.resumeEvents();
+ }
+});
+
+/**
* Class: GeoExt.tree.TristateCheckboxNode
*
* Provides a tree node that will have a third state (stored in
@@ -24,16 +76,16 @@
* To use this node type in a JSON config, set nodeType to "tristateCheckbox".
*
* Inherits from:
- * - <Ext.tree.TreeNode>
+ * - <Ext.tree.AsyncTreeNode>
*/
-GeoExt.tree.TristateCheckboxNode = Ext.extend(Ext.tree.TreeNode, {
+GeoExt.tree.TristateCheckboxNode = Ext.extend(Ext.tree.AsyncTreeNode, {
/**
* Property: checkedChildNodes
* {Object} Hash of 0.1 for thirdState nodes and 1 for fully checked
- * nodes, keyed by node ids. In combination with
- * {<checkedCount>}, this provides an
- * efficient way of keeping track of the childnodes' checked status.
+ * nodes, keyed by node ids. In combination with <checkedCount>,
+ * this provides an efficient way of keeping track of the childnodes'
+ * checked state.
*/
checkedChildNodes: null,
@@ -139,7 +191,7 @@
// event with a handler that will also trigger this event on the
// parent.
node.on("checkchange", function(node, checked) {
- if (this.childrenRendered) {
+ if(this.childrenRendered) {
this.fireEvent("childcheckchange", node, checked);
}
}, this);
@@ -185,13 +237,13 @@
* {Array(String)} - supported event types
*
* Event types supported for this class, in additon to the ones inherited
- * from {<GeoExt.tree.TristateCheckboxNode>}:
+ * from {<Ext.tree.AsyncTreeNode>}:
* - *childcheckchange* fired to notify a parent node that the status of
* its checked child nodes has changed
*/
GeoExt.tree.TristateCheckboxNode.EVENT_TYPES = ["childcheckchange"];
/**
- * NodeType: tristateCheckbox
+ * NodeType: gx_tristatecheckbox
*/
-Ext.tree.TreePanel.nodeTypes.tristateCheckbox = GeoExt.tree.TristateCheckboxNode;
+Ext.tree.TreePanel.nodeTypes.gx_tristatecheckbox = GeoExt.tree.TristateCheckboxNode;
Deleted: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNodeUI.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNodeUI.js 2009-03-24 13:24:14 UTC (rev 261)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNodeUI.js 2009-03-24 13:27:23 UTC (rev 262)
@@ -1,56 +0,0 @@
-/**
- * Copyright (c) 2008 The Open Planning Project
- */
-Ext.namespace("GeoExt.tree");
-
-/**
- * Class: GeoExt.tree.TristateCheckboxNodeUI
- *
- * Inherits from:
- * - <Ext.tree.TreeNodeUI>
- */
-GeoExt.tree.TristateCheckboxNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
-
- /**
- * Constructor: GeoExt.tree.TristateCheckbosNodeUI
- *
- * Parameters:
- * config - {Object}
- */
- constructor: function(config) {
- GeoExt.tree.TristateCheckboxNodeUI.superclass.constructor.apply(this, arguments);
- },
-
- /**
- * Method: toggleCheck
- *
- * Parameters:
- * value - {Boolean} checked status
- * thirdState - {Boolean}
- * options - {Object} Hash of options for this method
- *
- * Currently supported options:
- * silent - {Boolean} set to true if no checkchange event should be
- * fired
- */
- toggleCheck: function(value, thirdState, options) {
- var cb = this.checkbox;
- if(thirdState == true) {
- if(cb) {
- Ext.get(cb).setOpacity(0.5);
- }
- this.node.attributes.thirdState = true;
- } else {
- if(cb) {
- Ext.get(cb).clearOpacity();
- }
- delete this.node.attributes.thirdState;
- }
- if(options && options.silent == true){
- this.node.suspendEvents();
- }
- GeoExt.tree.TristateCheckboxNodeUI.superclass.toggleCheck.call(this,
- value);
- this.node.resumeEvents();
- }
-});
\ No newline at end of file
Modified: sandbox/opengeo/geoexplorer/tests/widgets/MapPanel.html
===================================================================
--- sandbox/opengeo/geoexplorer/tests/widgets/MapPanel.html 2009-03-24 13:24:14 UTC (rev 261)
+++ sandbox/opengeo/geoexplorer/tests/widgets/MapPanel.html 2009-03-24 13:27:23 UTC (rev 262)
@@ -35,15 +35,16 @@
}
function test_mappanel(t) {
- t.plan(2)
+ t.plan(3)
loadMapPanel();
t.eq(mapPanel.map.getCenter().toString(), "lon=5,lat=45", "Map center set correctly");
t.eq(mapPanel.map.getZoom(), 4, "Zoom set correctly");
+ t.eq(GeoExt.MapPanel.guess().id, mapPanel.id, "MapPanel guessed correctly");
}
</script>
<body>
<div id="mappanel"></div>
</body>
-</html>
+</html>
\ No newline at end of file
More information about the Commits
mailing list