PageRenderTime 27ms CodeModel.GetById 21ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/ishafoundation/archives/transcript/components/studio/event/EventSelectorDialog.mxml

http://transcriptstudio4isha.googlecode.com/
Macromedia eXtensible Markup Language | 53 lines | 45 code | 8 blank | 0 comment | 0 complexity | 4a3afc1c61b686379dac8ffb5479c20d MD5 | raw file
 1<?xml version="1.0" encoding="utf-8"?>
 2<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="470" height="600" horizontalAlign="center" title="Select Event" xmlns:event="org.ishafoundation.archives.transcript.components.studio.event.*">
 3	<mx:Script>
 4	<![CDATA[
 5		import mx.managers.PopUpManager;
 6		import org.ishafoundation.archives.transcript.model.EventMetadata;
 7		import mx.events.FlexEvent;
 8		import org.ishafoundation.archives.transcript.model.ReferenceManager;
 9		import org.ishafoundation.archives.transcript.db.XQueryExecutor;
10
11		public static const EVENT_SELECTED:String = "EVENT_SELECTED";
12
13		public static function display(parent:DisplayObject, xqueryExecutor:XQueryExecutor, referenceMgr:ReferenceManager):EventSelectorDialog {
14			var result:EventSelectorDialog = new EventSelectorDialog();
15			PopUpManager.addPopUp(result, parent, true);
16			result.eventSelectorPane.createEventButton.visible = false;
17			result.eventSelectorPane.createEventButton.includeInLayout = false;
18			result.eventSelectorPane.addEventListener(FlexEvent.CREATION_COMPLETE, function(evt:FlexEvent):void {
19				result.eventSelectorPane.xqueryExecutor = xqueryExecutor;
20				result.eventSelectorPane.referenceMgr = referenceMgr;
21			}, true);
22			return result;
23		}
24	
25		public function get selectedEventMetadata():EventMetadata {
26			return eventSelectorPane.selectedEventMetadata;
27		}
28		
29		private function listDoubleClickHandler(evt:MouseEvent):void {
30			if (selectedEventMetadata == null) {
31				return;
32			}
33			okClicked();
34		}
35		
36		private function okClicked():void {
37			dispatchEvent(new Event(EVENT_SELECTED));
38			closeMe();
39		}
40		
41		private function closeMe():void {
42			PopUpManager.removePopUp(this);
43		}
44	]]>
45	</mx:Script>
46	
47	<event:EventSelectorPane id="eventSelectorPane" width="100%" height="100%" doubleClickEnabled="true" doubleClick="{listDoubleClickHandler(event)}"/>
48	<mx:HBox id="buttonBox">
49		<mx:Button label="OK" enabled="{eventSelectorPane.eventsList.selectedItem != null}" click="okClicked()" />
50		<mx:Button label="Cancel" click="closeMe()"/>
51	</mx:HBox>
52	
53</mx:TitleWindow>