[Commits] r1343 - in sandbox/camptocamp/geobretagne: examples lib/GeoExt/widgets/tree
commits at geoext.org
commits at geoext.org
Mon Aug 31 09:07:26 CEST 2009
Author: elemoine
Date: 2009-08-31 09:07:26 +0200 (Mon, 31 Aug 2009)
New Revision: 1343
Modified:
sandbox/camptocamp/geobretagne/examples/tree-tools.js
sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js
Log:
apply patch-139-r1342-A2.diff from #139
Modified: sandbox/camptocamp/geobretagne/examples/tree-tools.js
===================================================================
--- sandbox/camptocamp/geobretagne/examples/tree-tools.js 2009-08-27 14:26:12 UTC (rev 1342)
+++ sandbox/camptocamp/geobretagne/examples/tree-tools.js 2009-08-31 07:07:26 UTC (rev 1343)
@@ -49,10 +49,20 @@
qtip: "delete"
}, {
action: "up",
- qtip: "move up"
+ qtip: "move up",
+ hide: function() {
+ // "this" references the tree node
+ var layer = this.layer, map = layer.map;
+ return map.getLayerIndex(layer) == map.layers.length - 1;
+ }
}, {
action: "down",
- qtip: "move down"
+ qtip: "move down",
+ hide: function() {
+ // "this" references the tree node
+ var layer = this.layer, map = layer.map;
+ return map.getLayerIndex(layer) == 1;
+ }
}],
component: GeoExt.examples.tbar
});
Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js 2009-08-27 14:26:12 UTC (rev 1342)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js 2009-08-31 07:07:26 UTC (rev 1343)
@@ -80,6 +80,7 @@
html.concat(['</div>']);
Ext.DomHelper.insertFirst(this.elNode, html.join(""));
}
+ this.updateActions(actions);
var component = attr.component || this.component;
if(component) {
@@ -124,6 +125,25 @@
GeoExt.tree.LayerNodeUI.superclass.onClick.apply(this, arguments);
}
},
+
+ /** private: method[updateActions]
+ * Update the visibility of action images.
+ */
+ updateActions: function(actions) {
+ var n = this.node;
+ var actions = n.attributes.actions || this.actions;
+ Ext.each(actions, function(a, index) {
+ var el = Ext.get(n.id + '_' + a.action);
+ if(el) {
+ if(typeof a.hide == "function" && a.hide.call(n)) {
+ el.setVisibilityMode(Ext.Element.DISPLAY);
+ el.hide();
+ } else {
+ el.show();
+ }
+ }
+ });
+ },
/** private: method[toggleCheck]
* :param value: ``Boolean``
@@ -188,7 +208,7 @@
}
}
},
-
+
/** private: method[destroy]
*/
destroy: function() {
More information about the Commits
mailing list