All pastes #923768 Raw Edit

Unnamed

public text v1 · immutable
#923768 ·published 2008-02-29 21:07 UTC
rendered paste body
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" currentState="mode1">

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.events.ListEvent;
            import mx.effects.Dissolve;
                  
            [Bindable]
            private var patients:ArrayCollection = new ArrayCollection([
              {OR:"X", Time:"10:34 AM", Patient:"Anthony", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"John", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Larry", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Moe", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Bob", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Mary", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Katie", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Fonze", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Frank", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"},
              {OR:"X", Time:"10:34 AM", Patient:"Susan", PTRM:"1024", Surgeon:"Bob", Attending:"John", ANESType:"??"}
            ]);
            
	        private var ticker:Timer;
	        private var currentTime:Date;
	        
	        public function setup():void {
		        ticker = new Timer(1000); 
		        ticker.addEventListener(TimerEvent.TIMER, onTick);
		        ticker.start();
		    }
		    
		    public function onTick(event:TimerEvent):void 
		    {
		        currentTime = new Date();	        
		        this.clock.text = "Time: " + timeFormatter.format(currentTime);
		        this.date.text = dateFormatter.format(currentTime);
		    }
		    
		    private function rowClick(event:ListEvent):void
		    {
		    	//Alert.show("I believe you wanted information about " + patients[event.rowIndex.toString()].Patient);
		    	this.currentState = 'mode2';
		    }
		    
		    private function mainPage(event:MouseEvent):void
		    {
		    	this.currentState = 'mode1';
		    }
        ]]>
    </mx:Script>
    
    <mx:states>
    	<mx:State name="mode1">
	    	<mx:AddChild relativeTo="{mainBox}" position="firstChild">
			    <mx:Panel title="Operating Room Schedule" id="mode1cont" height="100%" width="100%" paddingTop="5" paddingBottom="5" paddingLeft="5" paddingRight="5">
			    	<mx:Container x="0" y="100">
				    	<mx:Label text="Lawrence Memorial Hospital" /> 
				    	<mx:Label id="clock"/>
				    	<mx:Label id="date"/>    		
			    	</mx:Container>
			        <mx:DataGrid width="100%" height="90%" id="mode1" y="50" dataProvider="{patients}" fontSize="15" initialize="setup()" itemClick="rowClick(event)">
			        	<mx:columns>
			            	<mx:DataGridColumn width="15" resizable="false" sortable="false" dataField="OR"/>
			            	<mx:DataGridColumn width="35" resizable="false" sortable="false" dataField="Time"/>
			            	<mx:DataGridColumn width="75" resizable="false" sortable="false" dataField="Patient"/>
			           		<mx:DataGridColumn width="30" resizable="false" sortable="false" dataField="PTRM" headerText="PT. RM."/>                	
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Surgeon"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Attending"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="ANESType" headerText="ANES Type"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Procedure"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Remarks"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Anesthetist"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="R.N."/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Scrub"/>
			            	<mx:DataGridColumn width="50" resizable="false" sortable="false" dataField="Circ."/>
			        	</mx:columns>               
			       </mx:DataGrid>
			    </mx:Panel>    	
		    </mx:AddChild>	
    	</mx:State>
        <mx:State name="mode2">
	        <mx:AddChild relativeTo="{mainBox}" position="firstChild">
			    <mx:Panel title="Patient Breakdown" id="mode2cont" height="100%" width="100%" paddingTop="5" paddingBottom="5" paddingLeft="5" paddingRight="5">
			        <mx:Label text="Dr. Arvin Agah" x="100" y="5"/>
			        <mx:Image source="agah_color.jpg" width="77" height="101" x="5" y="5"/>
			        <mx:Label text="Go Back" mouseDown="mainPage(event)" y="200" x="5" />
			    </mx:Panel>      
		    </mx:AddChild>      
        </mx:State>
    </mx:states>
    <mx:transitions>
        <mx:Transition toState="mode2">
            <mx:Parallel target="{mode1cont}">
               <mx:Dissolve alphaTo="0" duration="2000"/>
            </mx:Parallel>          
        </mx:Transition>
    </mx:transitions>
    
	<mx:DateFormatter id="dateFormatter" formatString="EEEE, MMM. D, YYYY"/>
	<mx:DateFormatter id="timeFormatter" formatString="L:NN:SS A"/>
	<mx:Box id="mainBox" width="100%" height="100%">
	</mx:Box>

</mx:Application>