Changeset 7959
- Timestamp:
- 09/05/08 03:05:11 (3 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Layer/Vector.js (modified) (2 diffs)
- trunk/openlayers/tests/Layer/Vector.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Layer/Vector.js
r7941 r7959 70 70 * Listeners will receive an object with a *feature* property referencing 71 71 * the modified feature. 72 * - *refresh* Triggered when something wants a strategy to ask the protocol 73 * for a new set of features. 72 74 */ 73 75 EVENT_TYPES: ["beforefeatureadded", "featureadded", "featuresadded", 74 76 "beforefeatureremoved", "featureremoved", "featuresremoved", 75 77 "beforefeatureselected", "featureselected", "featureunselected", 76 "beforefeaturemodified", "featuremodified", "afterfeaturemodified"], 78 "beforefeaturemodified", "featuremodified", "afterfeaturemodified", 79 "refresh"], 77 80 78 81 /** … … 264 267 this.drawn = null; 265 268 OpenLayers.Layer.prototype.destroy.apply(this, arguments); 269 }, 270 271 /** 272 * Method: refresh 273 * Ask the layer to request features again and redraw them. Triggers 274 * the refresh event if the layer is in range and visible. 275 * 276 * Parameters: 277 * obj - {Object} Optional object with properties for any listener of 278 * the refresh event. 279 */ 280 refresh: function(obj) { 281 if(this.inRange && this.visibility) { 282 this.events.triggerEvent("refresh", obj); 283 } 266 284 }, 267 285 trunk/openlayers/tests/Layer/Vector.html
r7941 r7959 20 20 (layer.strategies[0].layer.name == layer.strategies[1].layer.name), 21 21 "setLayer was called on strategies"); 22 } 23 24 function test_Layer_Vector_refresh(t) { 25 t.plan(1); 26 27 var obj = {"an": "object"}; 28 29 var layer = new OpenLayers.Layer.Vector(name, { 30 eventListeners: { 31 refresh: function(o) { 32 t.ok(o == obj, 33 "refresh listener called with correct arg"); 34 } 35 } 36 }); 37 38 // 0 test 39 layer.inRange = false; 40 layer.visibility = false; 41 layer.refresh(obj); 42 43 // 0 test 44 layer.inRange = true; 45 layer.visibility = false; 46 layer.refresh(obj); 47 48 // 0 test 49 layer.inRange = false; 50 layer.visibility = true; 51 layer.refresh(obj); 52 53 // 1 test 54 layer.inRange = true; 55 layer.visibility = true; 56 layer.refresh(obj); 22 57 } 23 58
