6beaa3d478e4f8296b8d7e0bd38ecc6ea11984f9
[potlatch2.git] / net / systemeD / potlatch2 / mapfeatures / editors / ChoiceEditorFactory.as
1 package net.systemeD.potlatch2.mapfeatures.editors {
2
3     import net.systemeD.halcyon.connection.*;
4     import net.systemeD.potlatch2.mapfeatures.*;
5     import net.systemeD.potlatch2.utils.CachedDataLoader;
6     import flash.display.*;
7
8         public class ChoiceEditorFactory extends SingleTagEditorFactory {
9             public var choices:Array;
10         
11         public function ChoiceEditorFactory(inputXML:XML) {
12             super(inputXML,"horizontal");
13             
14             choices = [];
15             for each( var choiceXML:XML in inputXML.choice ) {
16                 var choice:Choice = new Choice();
17                 choice.value = String(choiceXML.@value);
18                 choice.description = String(choiceXML.@description);
19                 choice.label = String(choiceXML.@text);
20                 choice.icon = choiceXML.hasOwnProperty("@icon") ? 
21                     CachedDataLoader.loadData(String(choiceXML.@icon), choice.imageLoaded) : null;
22                 choice.match = String(choiceXML.@match);
23                 choices.push(choice);
24             }
25         }
26         
27         override protected function createSingleTagEditor():SingleTagEditor {
28             return new ChoiceEditor();
29         }
30     }
31
32 }
33
34