kill stupid tab bug
[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 "slider": return new SliderEditorFactory(inputXML);
22             case "number": return new NumberEditorFactory(inputXML);
23             case "speed": return new SpeedEditorFactory(inputXML);
24             case "route": return new RouteEditorFactory(inputXML);
25             case "turn": return new TurnRestrictionEditorFactory(inputXML);
26             
27             }
28             
29             return null;
30         }
31
32         public static function getPriority(priority:String):uint {
33             switch ( priority ) {
34             case "highest": return PRIORITY_HIGHEST;
35             case "high": return PRIORITY_HIGHEST;
36             case "normal": return PRIORITY_NORMAL;
37             case "low": return PRIORITY_LOW;
38             case "lowest": return PRIORITY_LOWEST;
39             default: return PRIORITY_NORMAL;
40             }
41         }
42         
43         public var presence:Presence = Presence.getPresence("onTagMatch");
44         public var sortOrder:uint = PRIORITY_NORMAL;
45         public var category:String = "Standard";
46         
47         private var _name:String;
48         private var _description:String;
49         
50         public function EditorFactory(inputXML:XML) {
51             _name = String(inputXML.@name);
52             _description = String(inputXML.@description);
53             category = String(inputXML.@category);
54         }
55         
56         public function areTagsMatching(entity:Entity):Boolean {
57             return true;
58         }
59
60         public function createEditorInstance(entity:Entity):DisplayObject {
61             return null;
62         }
63         
64         public function get name():String {
65             return _name;
66         }
67
68         public function get description():String {
69             return _description;
70         }
71
72     }
73
74 }
75
76