more turn restriction stuff, and checkboxes, and a bunch of little fixes
[potlatch2.git] / net / systemeD / potlatch2 / mapfeatures / EditorFactory.as
1 package net.systemeD.potlatch2.mapfeatures {
2
3     import net.systemeD.halcyon.connection.*;
4     import net.systemeD.potlatch2.mapfeatures.editors.*;
5     import flash.display.*;
6
7
8         public class EditorFactory {
9             private static const PRIORITY_HIGHEST:uint = 10;
10             private static const PRIORITY_HIGH:uint = 8;
11             private static const PRIORITY_NORMAL:uint = 5;
12             private static const PRIORITY_LOW:uint = 2;
13             private static const PRIORITY_LOWEST:uint = 0;
14         
15         public static function createFactory(inputType:String, inputXML:XML):EditorFactory {
16             switch ( inputType ) {
17             
18             case "freetext": return new FreeTextEditorFactory(inputXML);
19             case "checkbox": return new CheckboxEditorFactory(inputXML);
20             case "choice": return new ChoiceEditorFactory(inputXML);
21             case "speed": return new SpeedEditorFactory(inputXML);
22             case "route": return new RouteEditorFactory(inputXML);
23             case "turn": return new TurnRestrictionEditorFactory(inputXML);
24             
25             }
26             
27             return null;
28         }
29
30         public static function getPriority(priority:String):uint {
31             switch ( priority ) {
32             case "highest": return PRIORITY_HIGHEST;
33             case "high": return PRIORITY_HIGHEST;
34             case "normal": return PRIORITY_NORMAL;
35             case "low": return PRIORITY_LOW;
36             case "lowest": return PRIORITY_LOWEST;
37             default: return PRIORITY_NORMAL;
38             }
39         }
40         
41         public var presence:Presence = Presence.getPresence("onTagMatch");
42         public var sortOrder:uint = PRIORITY_NORMAL;
43         public var category:String = "Standard";
44         
45         private var _name:String;
46         private var _description:String;
47         
48         public function EditorFactory(inputXML:XML) {
49             _name = String(inputXML.@name);
50             _description = String(inputXML.@description);
51             category = String(inputXML.@category);
52         }
53         
54         public function areTagsMatching(entity:Entity):Boolean {
55             return true;
56         }
57
58         public function createEditorInstance(entity:Entity):DisplayObject {
59             return null;
60         }
61         
62         public function get name():String {
63             return _name;
64         }
65
66         public function get description():String {
67             return _description;
68         }
69
70     }
71
72 }
73
74