[Commits] r970 - in sandbox/opengeo/geoexplorer: examples lib/GeoExt/widgets lib/GeoExt/widgets/tips lib/GeoExt/widgets/tree tests/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Wed Jun 3 00:00:28 CEST 2009
Author: tschaub
Date: 2009-06-03 00:00:28 +0200 (Wed, 03 Jun 2009)
New Revision: 970
Removed:
sandbox/opengeo/geoexplorer/examples/RowExpander.js
sandbox/opengeo/geoexplorer/examples/scaleslider.html
sandbox/opengeo/geoexplorer/examples/scaleslider.js
sandbox/opengeo/geoexplorer/examples/treenodes.html
sandbox/opengeo/geoexplorer/examples/treenodes.js
sandbox/opengeo/geoexplorer/examples/wms-capabilities2.html
sandbox/opengeo/geoexplorer/examples/wms-capabilities2.js
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/ScaleSlider.js
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/legend/
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tips/ScaleSliderTip.js
sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js
Modified:
sandbox/opengeo/geoexplorer/tests/lib/GeoExt/data/LayerReader.html
Log:
Correcting more merge artifacts.
Deleted: sandbox/opengeo/geoexplorer/examples/RowExpander.js
===================================================================
--- sandbox/opengeo/geoexplorer/examples/RowExpander.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/RowExpander.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,136 +0,0 @@
-/*
- * Ext JS Library 2.2.1
- * Copyright(c) 2006-2009, Ext JS, LLC.
- * licensing at extjs.com
- *
- * http://extjs.com/license
- */
-
-Ext.grid.RowExpander = function(config){
- Ext.apply(this, config);
-
- this.addEvents({
- beforeexpand : true,
- expand: true,
- beforecollapse: true,
- collapse: true
- });
-
- Ext.grid.RowExpander.superclass.constructor.call(this);
-
- if(this.tpl){
- if(typeof this.tpl == 'string'){
- this.tpl = new Ext.Template(this.tpl);
- }
- this.tpl.compile();
- }
-
- this.state = {};
- this.bodyContent = {};
-};
-
-Ext.extend(Ext.grid.RowExpander, Ext.util.Observable, {
- header: "",
- width: 20,
- sortable: false,
- fixed:true,
- menuDisabled:true,
- dataIndex: '',
- id: 'expander',
- lazyRender : true,
- enableCaching: true,
-
- getRowClass : function(record, rowIndex, p, ds){
- p.cols = p.cols-1;
- var content = this.bodyContent[record.id];
- if(!content && !this.lazyRender){
- content = this.getBodyContent(record, rowIndex);
- }
- if(content){
- p.body = content;
- }
- return this.state[record.id] ? 'x-grid3-row-expanded' : 'x-grid3-row-collapsed';
- },
-
- init : function(grid){
- this.grid = grid;
-
- var view = grid.getView();
- view.getRowClass = this.getRowClass.createDelegate(this);
-
- view.enableRowBody = true;
-
- grid.on('render', function(){
- view.mainBody.on('mousedown', this.onMouseDown, this);
- }, this);
- },
-
- getBodyContent : function(record, index){
- if(!this.enableCaching){
- return this.tpl.apply(record.data);
- }
- var content = this.bodyContent[record.id];
- if(!content){
- content = this.tpl.apply(record.data);
- this.bodyContent[record.id] = content;
- }
- return content;
- },
-
- onMouseDown : function(e, t){
- if(t.className == 'x-grid3-row-expander'){
- e.stopEvent();
- var row = e.getTarget('.x-grid3-row');
- this.toggleRow(row);
- }
- },
-
- renderer : function(v, p, record){
- p.cellAttr = 'rowspan="2"';
- return '<div class="x-grid3-row-expander"> </div>';
- },
-
- beforeExpand : function(record, body, rowIndex){
- if(this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false){
- if(this.tpl && this.lazyRender){
- body.innerHTML = this.getBodyContent(record, rowIndex);
- }
- return true;
- }else{
- return false;
- }
- },
-
- toggleRow : function(row){
- if(typeof row == 'number'){
- row = this.grid.view.getRow(row);
- }
- this[Ext.fly(row).hasClass('x-grid3-row-collapsed') ? 'expandRow' : 'collapseRow'](row);
- },
-
- expandRow : function(row){
- if(typeof row == 'number'){
- row = this.grid.view.getRow(row);
- }
- var record = this.grid.store.getAt(row.rowIndex);
- var body = Ext.DomQuery.selectNode('tr:nth(2) div.x-grid3-row-body', row);
- if(this.beforeExpand(record, body, row.rowIndex)){
- this.state[record.id] = true;
- Ext.fly(row).replaceClass('x-grid3-row-collapsed', 'x-grid3-row-expanded');
- this.fireEvent('expand', this, record, body, row.rowIndex);
- }
- },
-
- collapseRow : function(row){
- if(typeof row == 'number'){
- row = this.grid.view.getRow(row);
- }
- var record = this.grid.store.getAt(row.rowIndex);
- var body = Ext.fly(row).child('tr:nth(1) div.x-grid3-row-body', true);
- if(this.fireEvent('beforecollapse', this, record, body, row.rowIndex) !== false){
- this.state[record.id] = false;
- Ext.fly(row).replaceClass('x-grid3-row-expanded', 'x-grid3-row-collapsed');
- this.fireEvent('collapse', this, record, body, row.rowIndex);
- }
- }
-});
Deleted: sandbox/opengeo/geoexplorer/examples/scaleslider.html
===================================================================
--- sandbox/opengeo/geoexplorer/examples/scaleslider.html 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/scaleslider.html 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,20 +0,0 @@
-<html>
- <head>
- <link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css"></link>
- <link rel="stylesheet" type="text/css" href="../../ext/examples/shared/examples.css"></link>
- <script type="text/javascript" src="../../openlayers/lib/OpenLayers.js"></script>
- <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script>
- <script type="text/javascript" src="../../ext/ext-all.js"></script>
- <script type="text/javascript" src="../lib/GeoExt.js"></script>
- <script type="text/javascript" src="scaleslider.js"></script>
- </head>
- <body>
- <h1>GeoExt.ScaleSlider</h1>
- <p>The ScaleSlider is a replacement for the ZoomPanel, using an Ext.Slider.
- It is also possible to add a special tooltip plugin, ScaleSliderTip, which
- will show the zoom level, scale and resolution while dragging the slider
- (the content is configurable).<p>
- <p>The js is not minified so it is readable. See <a href="scaleslider.js">scaleslider.js</a>.</p>
- <div id="map-container"></div>
- </body>
-</html>
Deleted: sandbox/opengeo/geoexplorer/examples/scaleslider.js
===================================================================
--- sandbox/opengeo/geoexplorer/examples/scaleslider.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/scaleslider.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,40 +0,0 @@
-var panel, slider;
-
-Ext.onReady(function() {
-
- // create a map panel with an embedded slider
- panel = new GeoExt.MapPanel({
- title: "Map",
- renderTo: "map-container",
- height: 300,
- width: 400,
- map: {
- controls: [new OpenLayers.Control.Navigation()]
- },
- layers: [new OpenLayers.Layer.WMS(
- "bluemarble",
- "http://sigma.openplans.org/geoserver/wms?",
- {layers: 'bluemarble'}
- )],
- extent: "-5,35,15,55",
- items: [{
- xtype: "gx_scaleslider",
- vertical: true,
- height: 100,
- x: 10,
- y: 20,
- plugins: new GeoExt.ScaleSliderTip()
- }]
- });
-
- // create a separate slider bound to the map but displayed elsewhere
- slider = new GeoExt.ScaleSlider({
- map: panel.map,
- width: 200,
- plugins: new GeoExt.ScaleSliderTip({
- template: "<div>Zoom Level: {zoom}</div>"
- }),
- renderTo: document.body
- });
-
-});
Deleted: sandbox/opengeo/geoexplorer/examples/treenodes.html
===================================================================
--- sandbox/opengeo/geoexplorer/examples/treenodes.html 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/treenodes.html 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,29 +0,0 @@
-<html>
- <head>
- <script type="text/javascript" src="../../openlayers/lib/OpenLayers.js"></script>
- <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script>
- <script type="text/javascript" src="../../ext/ext-all-debug.js"></script>
- <script type="text/javascript" src="../lib/GeoExt.js"></script>
-
- <link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css"></link>
- <link rel="stylesheet" type="text/css" href="../../ext/examples/shared/examples.css"></link>
-
- <script type="text/javascript" src="RowExpander.js"></script>
- <script type="text/javascript" src="treenodes.js"></script>
-
- </head>
- <body>
- <h1>Layer Tree Example</h1>
- <p>This is example that shows how create a TreePanel with layers
- from a map.</p>
-
- <p>Note that the js is not minified so it is readable.
- See <a href="treenodes.js">treenodes.js</a>.</p>
-
- <div style="position: relative;">
- <div id="capgrid"></div>
- <div id="tree"></div>
- <div id="mappanel"></div>
- </div>
- </body>
-</html>
Deleted: sandbox/opengeo/geoexplorer/examples/treenodes.js
===================================================================
--- sandbox/opengeo/geoexplorer/examples/treenodes.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/treenodes.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,85 +0,0 @@
-var store, tree, panel;
-Ext.onReady(function() {
-
- // create a new WMS capabilities store
- store = new GeoExt.data.WMSCapabilitiesStore({
- url: "data/wmscap.xml"
- });
- // load the store with records derived from the doc at the above url
- store.load();
-
- var xg = Ext.grid;
-
- // row expander
- var expander = new xg.RowExpander({
- tpl : new Ext.Template(
- '<p><b>Abstract:</b> {abstract}</p><br>',
- '<p><b>Available formats:</b> {formats}</p>'
- )
- });
-
- // create a grid to display records from the store
- var grid = new Ext.grid.GridPanel({
- title: "WMS Capabilities",
- store: store,
- cm: new xg.ColumnModel([
- expander,
- {header: "Name", dataIndex: "name", sortable: true},
- {id: "title", header: "Title", dataIndex: "title", sortable: true}
- ]),
- sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
- autoExpandColumn: "title",
- renderTo: "capgrid",
- plugins: expander,
- height: 300,
- width: 350,
- floating: true,
- x: 10,
- y: 0,
- bbar: ["->", {
- text: "Add Layer",
- handler: function() {
- var record = grid.getSelectionModel().getSelected();
- if(record) {
- record = record.copy();
- record.get("layer").mergeNewParams({
- format: "image/png",
- transparent: "true"
- });
- panel.layers.add(record);
- panel.map.zoomToExtent(
- OpenLayers.Bounds.fromArray(record.get("llbbox"))
- );
- }
- }
- }]
- });
-
- // create a map panel
- panel = new GeoExt.MapPanel({
- renderTo: "mappanel",
- width: 350,
- height: 300,
- floating: true,
- x: 570,
- y: 0
- });
-
- tree = new Ext.tree.TreePanel({
- renderTo: "tree",
- root: new GeoExt.tree.LayerContainer({
- text: 'Map Layers',
- layerStore: panel.layers,
- leaf: false,
- expanded: true
- }),
- enableDD: true,
- width: 170,
- height: 300,
- floating: true,
- x: 380,
- y: 0
- });
-
-
-});
Deleted: sandbox/opengeo/geoexplorer/examples/wms-capabilities2.html
===================================================================
--- sandbox/opengeo/geoexplorer/examples/wms-capabilities2.html 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/wms-capabilities2.html 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,30 +0,0 @@
-<html>
- <head>
- <script type="text/javascript" src="../../openlayers/lib/OpenLayers.js"></script>
- <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script>
- <script type="text/javascript" src="../../ext/ext-all-debug.js"></script>
- <script type="text/javascript" src="../lib/GeoExt.js"></script>
-
- <link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css"></link>
- <link rel="stylesheet" type="text/css" href="../../ext/examples/shared/examples.css"></link>
-
- <script type="text/javascript" src="RowExpander.js"></script>
- <script type="text/javascript" src="wms-capabilities2.js"></script>
-
- </head>
- <body>
- <h1>WMS Capabilities Grid Example</h1>
- <p>This example shows how to load a grid with data from a WMS
- capabilities document. The grid has a row expander plugin that allows
- you to expand rows to see additional layer metadata. A button on the
- bottom toolbar lets you add layers from the grid to the map.</p>
-
- <p>Note that the js is not minified so it is readable.
- See <a href="wms-capabilities2.js">wms-capabilities2.js</a>.</p>
-
- <div style="position: relative;">
- <div id="capgrid"></div>
- <div id="mappanel"></div>
- </div>
- </body>
-</html>
Deleted: sandbox/opengeo/geoexplorer/examples/wms-capabilities2.js
===================================================================
--- sandbox/opengeo/geoexplorer/examples/wms-capabilities2.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/examples/wms-capabilities2.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,69 +0,0 @@
-var store, panel;
-Ext.onReady(function() {
-
- // create a new WMS capabilities store
- store = new GeoExt.data.WMSCapabilitiesStore({
- url: "data/wmscap.xml"
- });
- // load the store with records derived from the doc at the above url
- store.load();
-
- var xg = Ext.grid;
-
- // row expander
- var expander = new xg.RowExpander({
- tpl : new Ext.Template(
- '<p><b>Abstract:</b> {abstract}</p><br>',
- '<p><b>Available formats:</b> {formats}</p>'
- )
- });
-
- // create a grid to display records from the store
- var grid = new Ext.grid.GridPanel({
- title: "WMS Capabilities",
- store: store,
- cm: new xg.ColumnModel([
- expander,
- {header: "Name", dataIndex: "name", sortable: true},
- {id: "title", header: "Title", dataIndex: "title", sortable: true}
- ]),
- sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
- autoExpandColumn: "title",
- renderTo: "capgrid",
- plugins: expander,
- height: 300,
- width: 350,
- floating: true,
- x: 10,
- y: 0,
- bbar: ["->", {
- text: "Add Layer",
- handler: function() {
- var record = grid.getSelectionModel().getSelected();
- if(record) {
- record = record.copy();
- record.get("layer").mergeNewParams({
- format: "image/png",
- transparent: "true"
- });
- panel.layers.add(record);
- panel.map.zoomToExtent(
- OpenLayers.Bounds.fromArray(record.get("llbbox"))
- );
- }
- }
- }]
- });
-
- // create a map panel
- panel = new GeoExt.MapPanel({
- renderTo: "mappanel",
- width: 350,
- height: 300,
- floating: true,
- x: 400,
- y: 0
- });
-
-
-});
Deleted: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/ScaleSlider.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/ScaleSlider.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/ScaleSlider.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,210 +0,0 @@
-/**
- * Copyright (c) 2008 The Open Planning Project
- */
-
-Ext.namespace("GeoExt");
-
-/**
- * Class: GeoExt.ScaleSlider
- */
-GeoExt.ScaleSlider = Ext.extend(Ext.Slider, {
-
- /**
- * Property: map
- * {OpenLayers.Map} The map that this slider is connected to
- */
- map: null,
-
- // private overrides
- minValue: Number.MIN_VALUE,
- maxValue: Number.MAX_VALUE,
-
- /**
- * Property: baseCls
- */
- baseCls: "gx-scaleslider",
-
- /**
- * Property: updating
- * {Boolean} The slider position is being updated by itself (based on
- * map zoomend).
- */
- updating: false,
-
- // private override
- initComponent: function() {
- GeoExt.ScaleSlider.superclass.initComponent.call(this);
-
- if(this.map) {
- this.bind(this.map);
- }
- this.on({
- "changecomplete": this.changeHandler,
- "beforedestroy": this.unbind,
- scope: this
- });
-
- },
-
- /**
- * Override onRender to set base css class.
- */
- onRender: function() {
- GeoExt.ScaleSlider.superclass.onRender.apply(this, arguments);
- this.el.addClass(this.baseCls);
- },
-
- /**
- * Override afterRender because the render event is fired too early
- * to call update.
- */
- afterRender : function(){
- Ext.Slider.superclass.afterRender.apply(this, arguments);
- this.update();
- },
-
- /**
- * Method: addToMap
- * Called by a MapPanel if this component is one of the items in the panel.
- */
- addToMap: function(panel) {
- this.on({
- render: function() {
- var el = this.getEl();
- el.setStyle({
- position: "absolute",
- zIndex: panel.map.Z_INDEX_BASE.Control
- });
- el.on({
- mousedown: this.stopMouseEvents,
- click: this.stopMouseEvents
- });
- },
- scope: this
- });
- this.bind(panel.map);
- },
-
- /**
- * Method: stopMouseEvents
- */
- stopMouseEvents: function(e) {
- e.stopEvent();
- },
-
- /**
- * Method: removeFromMap
- * Called by a MapPanel if this component is one of the items in the panel.
- */
- removeFromMap: function(panel) {
- var el = this.getEl();
- el.un("mousedown", this.stopMouseEvents);
- el.un("click", this.stopMouseEvents);
- this.unbind();
- },
-
- /**
- * Method: bind
- *
- * Parameters:
- * map - {OpenLayers.Map}
- */
- bind: function(map) {
- this.map = map;
- this.map.events.on({
- zoomend: this.update,
- changebaselayer: this.initZoomValues,
- scope: this
- });
- if(this.map.baseLayer) {
- this.initZoomValues();
- }
- },
-
- /**
- * Method: unbind
- */
- unbind: function() {
- if(this.map) {
- this.map.events.un({
- zoomend: this.update,
- changebaselayer: this.initZoomValues,
- scope: this
- });
- }
- },
-
- /**
- * Method: initZoomValues
- * Set the min/max values for the slider if not set in the config.
- */
- initZoomValues: function() {
- var layer = this.map.baseLayer;
- if(this.initialConfig.minValue === undefined) {
- this.minValue = layer.minZoomLevel || 1;
- }
- if(this.initialConfig.maxValue === undefined) {
- this.maxValue = layer.maxZoomLevel || layer.numZoomLevels - 1;
- }
- },
-
- /**
- * Method: getZoom
- * Get the zoom level for the associated map based on the slider value.
- *
- * Returns:
- * {Number} The map zoom level.
- */
- getZoom: function() {
- return this.getValue();
- },
-
- /**
- * Method: getScale
- * Get the scale denominator for the associated map based on the slider value.
- *
- * Returns:
- * {Number} The map scale denominator.
- */
- getScale: function() {
- return OpenLayers.Util.getScaleFromResolution(
- this.map.getResolutionForZoom(this.getValue()),
- this.map.getUnits()
- );
- },
-
- /**
- * Method: getResolution
- * Get the resolution for the associated map based on the slider value.
- *
- * Returns:
- * {Number} The map resolution.
- */
- getResolution: function() {
- return this.map.getResolutionForZoom(this.getValue());
- },
-
- /**
- * Method: changeHandler
- * Registered as a listener for slider changecomplete. Zooms the map.
- */
- changeHandler: function() {
- if(this.map && !this.updating) {
- this.map.zoomTo(this.getValue());
- }
- },
-
- /**
- * Method: update
- * Registered as a listener for map zoomend. Updates the value of the slider.
- */
- update: function() {
- if(this.rendered && this.map) {
- this.updating = true;
- this.setValue(this.map.getZoom());
- this.updating = false;
- }
- }
-
-});
-Ext.reg('gx_scaleslider', GeoExt.ScaleSlider);
Deleted: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tips/ScaleSliderTip.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tips/ScaleSliderTip.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tips/ScaleSliderTip.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,57 +0,0 @@
-/**
- * Copyright (c) 2008 The Open Planning Project
- */
-
-/**
- * @include GeoExt/widgets/tips/SliderTip.js
- */
-
-Ext.namespace("GeoExt");
-
-/**
- * Class: GeoExt.ScaleSliderTip
- * A slider to control and show the current scale of a map.
- */
-GeoExt.ScaleSliderTip = Ext.extend(GeoExt.SliderTip, {
-
- /**
- * Property: template
- * {String} Template for the tip. Can be customized using the following
- * keywords in curly braces:
- * - *zoom* the zoom level
- * - *resolution* the resolution
- * - *scale* the scale denominator
- */
- template: '<div>Zoom Level: {zoom}</div>' +
- '<div>Resolution: {resolution}</div>' +
- '<div>Scale: 1 : {scale}</div>',
-
- /**
- * Property: compiledTemplate
- * {Ext.Template} The template compiled from the <template> string on init.
- */
- compiledTemplate: null,
-
- /**
- * Method: init
- */
- init: function(slider) {
- this.compiledTemplate = new Ext.Template(this.template);
- GeoExt.ScaleSliderTip.superclass.init.call(this, slider);
- },
-
- /**
- * Method: getText
- *
- * Parameters:
- * slider - {Ext.Slider} the slider this tip is attached to.
- */
- getText : function(slider) {
- var data = {
- zoom: slider.getZoom(),
- resolution: slider.getResolution(),
- scale: Math.round(slider.getScale())
- };
- return this.compiledTemplate.apply(data);
- }
-});
Deleted: sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/tree/TristateCheckboxNode.js 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,245 +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) {
- 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
- * attributes.thirdState) to have a proper semi-checked state for
- * nodes with only *some* children checked. attributes.thirdState will be
- * undefined if the node is checked or unchecked, and true if the node is
- * semi-checked.
- *
- * This node has also a childcheckchange event that will be triggered with a
- * child node and it's checked state to notify listeners when a the checked
- * state of a child's node has changed.
- *
- * Applications using this class should not rely on the checkchange event to
- * determine the checked state of non-leaf nodes. Instead, applications should
- * also listen to the childcheckchange event and read out attributes.checked
- * and attributes.thirdState to get the node's checked state.
- *
- * To use this node type in a JSON config, set nodeType to "tristateCheckbox".
- *
- * Inherits from:
- * - <Ext.tree.AsyncTreeNode>
- */
-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 state.
- */
- checkedChildNodes: null,
-
- /**
- * Property: checkedCount
- * {Number} A cache for the sum of checkedChildNodes' values.
- */
- checkedCount: null,
-
- /**
- * Constructor: GeoExt.tree.TristateCheckboxNode
- *
- * Parameters:
- * config - {Object}
- */
- constructor: function(config) {
- this.checkedChildNodes = {};
- this.checkedCount = 0;
-
- this.defaultUI = this.defaultUI || GeoExt.tree.TristateCheckboxNodeUI;
- this.addEvents(
- /**
- * Event: childcheckchange
- * Fired to notify a parent node that the status of its checked
- * child nodes has changed.
- */
- "childcheckchange"
- );
-
- GeoExt.tree.TristateCheckboxNode.superclass.constructor.apply(this, arguments);
-
- this.on("childcheckchange", this.updateCheckedChildNodes, this);
- },
-
- /**
- * Method: render
- *
- * Parameters:
- * bulkRender - {Boolean}
- */
- render: function(bulkRender) {
- var rendered = this.rendered;
- var checked = this.attributes.checked;
- this.attributes.checked =
- typeof this.attributes.checked == "undefined" ? false :
- this.attributes.checked;
- GeoExt.tree.TristateCheckboxNode.superclass.render.call(this, bulkRender);
- var ui = this.getUI();
- if(!rendered) {
- if(typeof checked == "undefined" && this.parentNode.ui.checkbox) {
- ui.toggleCheck(this.parentNode.ui.checkbox.checked);
- }
- this.parentNode.on("checkchange", function(node, checked) {
- ui.toggleCheck(checked);
- }, this);
- }
- },
-
- /**
- * Method: updateCheckedChildNodes
- * Updates the status cache of checked child nodes.
- *
- * Parameters:
- * node - {Ext.tree.Node} child node that has changed
- * checked - {Boolean} new checked status of the changed child node
- */
- updateCheckedChildNodes: function(node, checked) {
- if(checked) {
- this.addChecked(node, node.attributes.thirdState);
- } else {
- this.removeChecked(node);
- }
-
- var childrenChecked, childrenThirdState;
- if(this.checkedCount.toFixed() == this.childNodes.length) {
- childrenChecked = true;
- childrenThirdState = false;
- } else if(this.checkedCount.toFixed(1) == 0) {
- childrenChecked = false;
- childrenThirdState = false;
- } else {
- childrenChecked = true;
- childrenThirdState = true;
- }
- // do a special silent toggleCheck to avoid checkchange events being
- // triggered
- this.getUI().toggleCheck(childrenChecked, childrenThirdState,
- {silent: true});
- if(this.parentNode) {
- this.parentNode.fireEvent("childcheckchange", this,
- childrenChecked);
- }
- },
-
- /**
- * Method: appendChild
- *
- * Parameters:
- * node - {Ext.tree.Node}
- */
- appendChild: function(node) {
- GeoExt.tree.TristateCheckboxNode.superclass.appendChild.call(this, node);
- if(this.attributes.checked || node.attributes.checked) {
- this.addChecked(node);
- }
- // We do not want this event handler to trigger checkchange events on
- // parent nodes, because this would cause bouncing between this
- // handler and the handler for (un-)checking children on a parent's
- // checkchange event. So we introduce a special childcheckchange
- // event with a handler that will also trigger this event on the
- // parent.
- node.on("checkchange", function(node, checked) {
- if(this.childrenRendered) {
- this.fireEvent("childcheckchange", node, checked);
- }
- }, this);
- },
-
- /**
- * Method: addChecked
- * Adds a child node to the checkedChildNodes hash. Adds 1 for fully
- * checked nodes, 0.1 for third state checked nodes.
- *
- * Parameters:
- * node - {Ext.tree.Node}
- * thirdState - {Boolean}
- */
- addChecked: function(node, thirdState) {
- // subtract current value (if any). This is needed to change from a
- // tristate to a fully checked state and vice versa.
- this.checkedCount -= (this.checkedChildNodes[node.id] || 0);
-
- var add = thirdState ? 0.1 : 1;
- this.checkedChildNodes[node.id] = add;
- this.checkedCount += add;
- },
-
- /**
- * Method: removeChecked
- * Removes a child node from the checkedChildNodes hash.
- *
- * Parameters:
- * node - {Ext.tree.Node}
- */
- removeChecked: function(node) {
- var remove = this.checkedChildNodes[node.id]
- if(remove) {
- delete this.checkedChildNodes[node.id];
- this.checkedCount -= remove;
- }
- }
-});
-
-/**
- * NodeType: gx_tristatecheckbox
- */
-Ext.tree.TreePanel.nodeTypes.gx_tristatecheckbox = GeoExt.tree.TristateCheckboxNode;
Modified: sandbox/opengeo/geoexplorer/tests/lib/GeoExt/data/LayerReader.html
===================================================================
--- sandbox/opengeo/geoexplorer/tests/lib/GeoExt/data/LayerReader.html 2009-06-02 21:56:07 UTC (rev 969)
+++ sandbox/opengeo/geoexplorer/tests/lib/GeoExt/data/LayerReader.html 2009-06-02 22:00:28 UTC (rev 970)
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html debug="true">
<head>
+ <script type="text/javascript" src="../../../../../openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="../../../../../ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../../../../ext/ext-all-debug.js"></script>
- <script type="text/javascript" src="../../../../../openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="../../../../lib/GeoExt.js"></script>
<script type="text/javascript">
More information about the Commits
mailing list