1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" |
---|
3 | showCloseButton="true" |
---|
4 | close="cleanUp();" |
---|
5 | creationComplete="PopUpManager.centerPopUp(this)" |
---|
6 | title="Edit and choose a type" |
---|
7 | xmlns:editor="clarin.cmdi.componentregistry.editor.*"> |
---|
8 | |
---|
9 | <mx:Script> |
---|
10 | <![CDATA[ |
---|
11 | import clarin.cmdi.componentregistry.common.ComponentMD; |
---|
12 | import mx.collections.XMLListCollection; |
---|
13 | import mx.controls.TextInput; |
---|
14 | import mx.managers.PopUpManager; |
---|
15 | import mx.collections.ArrayCollection; |
---|
16 | |
---|
17 | //Stores the result |
---|
18 | [Bindable] |
---|
19 | public var valueSchemeInput:ValueSchemeInput; |
---|
20 | |
---|
21 | //Taken from http://www.clarin.eu/cmd/general-component-schema.xsd (allowed_attributetypes_type) |
---|
22 | [Bindable] |
---|
23 | private var simpleValueSchemeDataProvider:ArrayCollection = new ArrayCollection([{label: "boolean", data: "boolean"}, |
---|
24 | {label: "decimal", data: "decimal"}, |
---|
25 | {label: "float", data: "float"}, |
---|
26 | {label: "string", data: "string"}, |
---|
27 | {label: "anyURI", data: "anyURI"}, |
---|
28 | {label: "date", data: "date"}, |
---|
29 | {label: "gDay", data: "gDay"}, |
---|
30 | {label: "gMonth", data: "gMonth"}, |
---|
31 | {label: "gYear", data: "gYear"}, |
---|
32 | {label: "time", data: "time"},]); |
---|
33 | |
---|
34 | |
---|
35 | private function setType():void { |
---|
36 | valueSchemeInput.valueSchemeSimple = simpleValueSchemeBox.selectedItem.data; |
---|
37 | cleanUp(); |
---|
38 | } |
---|
39 | |
---|
40 | private function setPattern():void { |
---|
41 | valueSchemeInput.valueSchemePattern = patternInput.text; |
---|
42 | cleanUp(); |
---|
43 | } |
---|
44 | |
---|
45 | private function setControlledVocabulary():void { |
---|
46 | var enumeration:XMLListCollection = new XMLListCollection(); |
---|
47 | for (var i:int; i < enumerationGrid.valueSchemeEnumeration.length - 1; i++) { |
---|
48 | var item:Object = enumerationGrid.valueSchemeEnumeration.getItemAt(i); |
---|
49 | enumeration.addItem(<item {ComponentMD.APP_INFO}={item.appInfo} {ComponentMD.CONCEPTLINK}={item.conceptLink}>{item.item}</item>); |
---|
50 | } |
---|
51 | valueSchemeInput.valueSchemeEnumeration = enumeration; |
---|
52 | cleanUp(); |
---|
53 | } |
---|
54 | |
---|
55 | private function cleanUp():void { |
---|
56 | PopUpManager.removePopUp(this); |
---|
57 | } |
---|
58 | ]]> |
---|
59 | </mx:Script> |
---|
60 | |
---|
61 | |
---|
62 | <mx:Label text="Select type:"/> |
---|
63 | <mx:HBox width="100%"> |
---|
64 | <mx:ComboBox id="simpleValueSchemeBox" |
---|
65 | dataProvider="{simpleValueSchemeDataProvider}"> |
---|
66 | </mx:ComboBox> |
---|
67 | <mx:Spacer width="100%"/> |
---|
68 | <mx:Button label="Use Type" |
---|
69 | click="setType()"/> |
---|
70 | </mx:HBox> |
---|
71 | |
---|
72 | <mx:Label text="Or enter pattern:"/> |
---|
73 | <mx:HBox width="100%"> |
---|
74 | <mx:TextInput id="patternInput"> |
---|
75 | <!-- PD TODO how can I check this --> |
---|
76 | </mx:TextInput> |
---|
77 | <mx:Spacer width="100%"/> |
---|
78 | <mx:Button label="Use Pattern" |
---|
79 | click="setPattern()"/> |
---|
80 | </mx:HBox> |
---|
81 | |
---|
82 | <!-- PD TODO how should we implement open vocabularies?? --> |
---|
83 | <mx:Label text="Or create controlled vocabularies:"/> |
---|
84 | <mx:HBox width="100%"> |
---|
85 | <editor:ValueSchemeEnumerationGrid id="enumerationGrid"/> |
---|
86 | <mx:Button label="Use Controlled Vocabulary" |
---|
87 | click="setControlledVocabulary()"/> |
---|
88 | </mx:HBox> |
---|
89 | |
---|
90 | <mx:HBox width="100%"> |
---|
91 | <mx:Spacer width="100%"/> |
---|
92 | <mx:Button label="Cancel" |
---|
93 | click="cleanUp()"/> |
---|
94 | </mx:HBox> |
---|
95 | </mx:TitleWindow> |
---|