first go at specialised tag editors
[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 "choice": return new ChoiceEditorFactory(inputXML);
20             
21             }
22             
23             return null;
24         }
25
26         public static function getPriority(priority:String):uint {
27             switch ( priority ) {
28             case "highest": return PRIORITY_HIGHEST;
29             case "high": return PRIORITY_HIGHEST;
30             case "normal": return PRIORITY_NORMAL;
31             case "low": return PRIORITY_LOW;
32             case "lowest": return PRIORITY_LOWEST;
33             default: return PRIORITY_NORMAL;
34             }
35         }
36         
37         public var presence:Presence = Presence.getPresence("onTagMatch");
38         public var sortOrder:uint = PRIORITY_NORMAL;
39         public var category:String = "Standard";
40         
41         private var _name:String;
42         private var _description:String;
43         
44         public function EditorFactory(inputXML:XML) {
45             _name = inputXML.@name;
46             _description = inputXML.@description;
47         }
48         
49         public function areTagsMatching(entity:Entity):Boolean {
50             return true;
51         }
52
53         public function createEditorInstance(entity:Entity):DisplayObject {
54             return null;
55         }
56         
57         public function get name():String {
58             return _name;
59         }
60
61         public function get description():String {
62             return _description;
63         }
64     }
65
66 }
67
68