Adjust behaviour of numberEditor - add clear button, and explanitory text for when...
[potlatch2.git] / net / systemeD / potlatch2 / mapfeatures / editors / NumberEditorFactory.as
1 package net.systemeD.potlatch2.mapfeatures.editors {
2
3     import net.systemeD.halcyon.connection.*;
4     import net.systemeD.potlatch2.mapfeatures.*;
5     import flash.display.*;
6
7         public class NumberEditorFactory extends SingleTagEditorFactory {
8         private var _minimum:Number;
9         private var _maximum:Number;
10         private var _stepSize:Number;
11             private var _notPresentText:String;
12         private var _notValidText:String;
13
14         public function NumberEditorFactory(inputXML:XML) {
15             super(inputXML);
16             _minimum = parseFloat(inputXML.hasOwnProperty("@minimum") ? String(inputXML.@minimum) : "0");
17             _maximum = parseFloat(inputXML.hasOwnProperty("@maximum") ? String(inputXML.@maximum) : "100");
18             _stepSize = parseFloat(inputXML.hasOwnProperty("@stepSize") ? String(inputXML.@stepSize) : "1");
19             _notPresentText = inputXML.hasOwnProperty("@absenceText") ? String(inputXML.@absenceText) : "Unset";
20             _notValidText = inputXML.hasOwnProperty("@notValidText") ? String(inputXML.@notValidText) : "(existing value not recognised)";
21         }
22         
23         override protected function createSingleTagEditor():SingleTagEditor {
24             return new NumberEditor();
25         }
26         
27         public function get minimum():Number { return _minimum; }
28         public function get maximum():Number { return _maximum; }
29         public function get stepSize():Number { return _stepSize; }
30         public function get notPresentText():String { return _notPresentText; }
31         public function get notValidText():String { return _notValidText; }
32     }
33
34 }
35
36