[virtualcommons-svn] SF.net SVN: virtualcommons:[184] mentalmodels/trunk/flex/src
Status: Beta
Brought to you by:
alllee
From: <kj...@us...> - 2009-07-15 22:51:20
|
Revision: 184 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=184&view=rev Author: kjonas Date: 2009-07-15 22:51:14 +0000 (Wed, 15 Jul 2009) Log Message: ----------- Core of program now known as FisheryExperimentCore.mxml, to be less confusing. Various components that rely on the number of bays, and information about them should now store a list of the Locations and their parameters. I have yet to work on the error-checking to ensure that the number of fish is less than the maxCapacity of a bay. SocioDemographicPage.mxml now has a drop-down menu with options Freshman, Sophomore, Junior, Senior, and Graduate/Other. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/_InstructionsTest.mxml mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml Added Paths: ----------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml Removed Paths: ------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -24,11 +24,11 @@ <mx:Button id="btnPickerB" label="{btnPickerA.label}" click="popupInformationWindow(2)"/> </mx:HBox> - <mx:Button id="btnResetPopups" label="Reset Popups" click="closedFunction()"/> + <mx:Button id="btnResetPopups" label="Reset Popups" click="{closedFunction(1);closedFunction(2)}"/> </mx:VBox> <mx:VBox id="vbxContent" horizontalAlign="center" verticalAlign="middle"> - <custom:FisheryExperimentKalin id="fisheryContent" blockLoader="loadBlock"/> + <custom:FisheryExperimentCore id="fisheryContent" blockLoader="loadBlock"/> </mx:VBox> <mx:Script> @@ -87,22 +87,23 @@ cbxChanged(); } - public function popupInformationWindow(source:int):void + public function popupInformationWindow(window:int):void { var temp:DisplayObject = null; var popupNew:InformationWindowPopup = PopUpManager.createPopUp(this, InformationWindowPopup, false) as InformationWindowPopup; popupNew.closedFunction = closedFunction; + popupNew.window = window; var old:TitleWindow = null; - if(source == 1) + if(window == 1) { old = InformationWindowA; popupA = popupNew; btnPickerA.enabled = cbxPickerA.enabled = false; } - else if(source == 2) + else if(window == 2) { old = InformationWindowB; popupB = popupNew; @@ -124,10 +125,10 @@ PopUpManager.centerPopUp(popupNew); } - public function closedFunction():void + public function closedFunction(window:int):void { var temp:DisplayObject = null; - if(popupA != null) + if(popupA != null && window == 1) { while(popupA.numChildren > 0) { @@ -140,7 +141,7 @@ popupA = null; } - if(popupB != null) + if(popupB != null && window == 2) { while(popupB.numChildren > 0) { Modified: mentalmodels/trunk/flex/src/_InstructionsTest.mxml =================================================================== --- mentalmodels/trunk/flex/src/_InstructionsTest.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/_InstructionsTest.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -5,28 +5,43 @@ <mx:VBox> <mx:Button id="save" click="save_click()" label="Save"/> - <mx:Button id="load" click="bak_click()" label="Load"/> - <dayByDayDecisions:DayByDayDecisionsQuestionC id="day1"/> - <dayByDayDecisions:DayByDayDecisionsQuestionC id="day2"/> + <mx:Button id="load" click="load_click()" label="Load"/> + <strategyDesign:StrategyDesignQuestionC id="strat" locations="{locations}"/> + <dayByDayDecisions:DayByDayDecisionsQuestionC id="dayby" locations="{locations}"/> </mx:VBox> <mx:Script> <![CDATA[ public var arry:ArrayCollection = new ArrayCollection(); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + public function save_click():void { - arry = day1.save(); + } - public function bak_click():void + public function load_click():void { - day2.load(arry); + dayby.loadFromStrategy(strat.save()); } ]]> </mx:Script> + + + + + <mx:Script> <![CDATA[ import mx.controls.Alert; Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-07-15 22:51:14 UTC (rev 184) @@ -13,7 +13,6 @@ import mx.collections.ArrayCollection; import mx.containers.VBox; - import mx.controls.Label; import mx.controls.Text; @@ -26,15 +25,17 @@ public var minPagesRead:int; public var currentPageNumber:int; public var highestPageReached:int; + public var locations:ArrayCollection = null; public var currBlock:Block; - public function PageDisplay(newBlock:Block, minimumPagesRead:int=1) + public function PageDisplay(newBlock:Block, minimumPagesRead:int=1, locations:ArrayCollection=null) { currBlock = newBlock; minPagesRead = minimumPagesRead; currentPageNumber = 0; highestPageReached = currentPageNumber; + this.locations = locations; loadPages(); } @@ -74,6 +75,7 @@ if(tempQuestion is ForecastingPeople) { var fpq:ForecastingPeopleQuestionC = new ForecastingPeopleQuestionC(); + fpq.locations = locations; fpq.loadFromQuestion(ForecastingPeople(tempQuestion)); fpq.id = "q"+question; @@ -82,6 +84,7 @@ else if(tempQuestion is ForecastingFish) { var ffq:ForecastingFishQuestionC = new ForecastingFishQuestionC(); + ffq.locations = locations; ffq.loadFromQuestion(ForecastingFish(tempQuestion)); ffq.id = "q"+question; @@ -109,6 +112,7 @@ tempQuestion.type.toLowerCase() == "strategydesign") { var sdq:StrategyDesignQuestionC = new StrategyDesignQuestionC(); + sdq.locations = locations; sdq.loadFromQuestion(Question(tempQuestion)); sdq.id = "q"+question; @@ -118,6 +122,7 @@ tempQuestion.type.toLowerCase() == "daybydaydecisions") { var ddq:DayByDayDecisionsQuestionC = new DayByDayDecisionsQuestionC(); + ddq.locations = locations; ddq.loadFromQuestion(Question(tempQuestion)); ddq.id = "q"+question; Added: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml (rev 0) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -0,0 +1,399 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.*" + clipContent="false" verticalScrollPolicy="off" horizontalScrollPolicy="off" + currentState="socioDemographic" initialize="init()" + width="720" height="490"> + + <mx:RemoteObject id="moduleService" destination="moduleService" fault="moduleFaultHandler(event)" result="moduleResultHandler(event)"/> + + <mx:states> + <mx:State name="socioDemographic"> + <mx:AddChild relativeTo="{content}"> + <comp:SocioDemographicPage id="socioDemographic" + x="{(content.width-socioDemographic.width)/2}" + y="{(content.height-socioDemographic.height)/2}"/> + </mx:AddChild> + <mx:SetProperty target="{content}" name="x"/> + <mx:SetStyle target="{content}" name="horizontalCenter" value="0"/> + </mx:State> + + <mx:State name="instructionsLoad"> + <mx:AddChild relativeTo="{content}"> + <comp:InstructionPage id="instructions" initialize="gotoInstructions()" locations="{locations}"/> + </mx:AddChild> + </mx:State> + + <mx:State name="instructions" enterState="instructions.initModule(currModule)"> + <mx:RemoveChild target="{instructions}"/> + <mx:AddChild relativeTo="{content}" target="{instructions}"/> + <mx:SetProperty target="{instructions}" name="visible" value="true"/> + </mx:State> + + <mx:State name="wait"> + <mx:AddChild relativeTo="{content}"> + <mx:Label id="lblWaiting" text="Waiting for next Module from server..." fontSize="16"/> + </mx:AddChild> + </mx:State> + + <mx:State name="none"> + <mx:AddChild relativeTo="{content}"> + <mx:Label id="end" text="Thank you for playing!" fontSize="30"/> + </mx:AddChild> + <mx:SetProperty target="{btnAccept}" name="enabled" value="false"/> + <mx:SetProperty target="{btnBack}" name="enabled" value="false"/> + <mx:SetProperty target="{btnForward}" name="enabled" value="false"/> + </mx:State> + </mx:states> + + <!-- <mx:Canvas id="content" x="5" y="5" width="750" height="470"/> --> + <mx:Canvas id="content" x="0" y="0" width="720" height="475"/> + <mx:Canvas id="expiredContent" x="-1" y="-1" width="1" height="1" visible="false"/> + + <mx:Button id="btnBack" label="« Back" click="back()" left="0" bottom="0" enabled="false"/> + <mx:Button id="btnAccept" label="Accept" click="accept()" left="{(width-btnAccept.width)/2}" bottom="0"/> + <mx:Button id="btnForward" label="Forward »" click="forward()" right="0" bottom="0" enabled="false"/> + + <mx:RemoteObject id="ss" destination="studentService" fault="faultHandler(event)" result="resultHandler(event)"/> + <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> + <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> + + <mx:Script> + <![CDATA[ + import actionscript.*; + import actionscript.questions.*; + import custom.*; + import mx.controls.Label; + import mx.controls.Alert; + import mx.collections.ArrayCollection; + import flash.sampler.getInvocationCount; + import mx.rpc.events.ResultEvent; + import mx.rpc.events.FaultEvent; + import mx.messaging.messages.IMessage; + import mx.messaging.events.MessageAckEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.messaging.FlexClient; + import mx.messaging.messages.AsyncMessage; + + // + // Important Variables + // + public var currModule:Module = null; + public var currModuleNumber:int = 0; + public var currBlock:Block = null; + public var currBlockNumber:int = 0; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + + public var blockLoader:Function = null; + + public var updateObjectA:InformationWindowCreator = null; + public var updateObjectB:InformationWindowCreator = null; + + public var instructionsLoaded:Boolean = false; + + private var shared:SharedObject; + private var flushMessage:String; + [Bindable] + public var Id : uint; + + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + + [Bindable] + public var randomNumbers:String; + private function ack(event:MessageAckEvent):void + { + //chart.setVisible(true); + randomNumbers = event.message.body as String; + //Alert.show("in ack method" + randomNumbers); + } + + public function init():void + { + moduleService.setToModule(1); + } + + private function gotoInstructions():void + { + btnForward.enabled = btnBack.enabled = true; + instructionsLoaded = true; + currentState = "instructions"; + } + private function sendBlockQuestions():void + { + + } + private function getNextModule():void + { + sendBlockQuestions(); + currModule = null; + currModuleNumber++; + + moduleService.getModule(currModuleNumber); + } + private function moduleResultHandler(event:ResultEvent):void + { + /* try{ + Alert.show("module==null:"+(event.result==null)+ + "\nblock==null:"+((event.result as Module).blocks == null)+ + "\nblock.length:"+((event.result as Module).blocks.length)+ + "\nblock1.questionGroups==null:"+(((event.result as Module).blocks.getItemAt(0) as Block).questionGroups==null)+ + "\nblock1.questionGroups.length:"+(((event.result as Module).blocks.getItemAt(0) as Block).questionGroups.length) + ); + }catch(err:Error){ + + } */ + + currModule = (event.result as actionscript.Module); + + if(currModule == null) + { + currentState = "none"; + } + else if(currModule.blocks == null || currModule.blocks.length < 1 || + (currModule.blocks.getItemAt(0) as Block) == null || + (currModule.blocks.getItemAt(0) as Block).questionGroups == null || + (currModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) + { + currentState = "none"; + } + else if(!instructionsLoaded) + { + currentState = "instructionsLoad"; + } + else + { + gotoInstructions(); + } + } + private function moduleFaultHandler(event:FaultEvent):void + { + Alert.show(event.fault.message + "\n" + event.fault.getStackTrace()); + } + + public function getLocation():void + { + + } + private function locationResultHandler(event:ResultEvent):void + { + locations = new ArrayCollection(); + locations.addItem(newLocation(10, 0.50)); + locations.addItem(newLocation(20, 0.15)); + locations.addItem(newLocation(30, 0.05)); + } + private function locationFaultHandler(event:FaultEvent):void + { + + } + + private function resultHandler(event:ResultEvent):void + { + Id = event.result as uint; +// Alert.show("Student id is " + Id ); + consumer.disconnect(); + } + private function faultHandler(event:FaultEvent):void + { +// Alert.show("event fault is " + event.fault.faultDetail); + } + + + private function messageHandler(message:IMessage):void + { + randomNumbers = message.body as String; +// Alert.show( ""+randomNumbers); + } + + public function back():Boolean + { + if(content.numChildren == 0) + { return false; } + var obj:DisplayObject = content.getChildAt(0); + + if(obj is InstructionPage) + { + try + { + return (InstructionPage)(obj).back(); + } + catch(err:Error){} + } + return false; + } + + public function forward():Boolean + { + if(content.numChildren == 0) + { return false; } + var obj:DisplayObject = content.getChildAt(0); + + if(obj is InstructionPage) + { + try + { + return (InstructionPage)(obj).forward(); + } + catch(err:Error){} + } + return false; + } + + public function accept():Boolean + { + if(content.numChildren == 0) + { return false; } + + var obj:DisplayObject = content.getChildAt(0); + var returnValue:Boolean = false; + + if(obj is SocioDemographicPage) + { + var Id:uint = 0; + if( (SocioDemographicPage)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + + currentState = "wait"; + getNextModule(); + + + var info:SocioDemographicPage = SocioDemographicPage(obj); + Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); + + btnBack.enabled = btnForward.enabled = true; + + returnValue = true; + } + } + if(obj is InstructionPage) + { + try + { + if( (InstructionPage)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + currentState = "wait"; + getNextModule(); + //consumer.subscribe(); + returnValue = true; + } + else + { + var newCurrBlock:Block = (InstructionPage)(obj).block; + if(newCurrBlock != currBlock) + { + currBlock = newCurrBlock; + currBlockNumber++; + blockLoader.call(); + } + } + } + catch(err:Error){} + } + + btnBack.enabled = btnForward.enabled = (currentState == "instructions"); + + return returnValue; + } + + public function makeBlock():Block + { + var block1:Block = new Block(); + try{ + var questionGroups1:ArrayCollection = new ArrayCollection(); + var qg0:QuestionGroup = new QuestionGroup(); + var qg1:QuestionGroup = new QuestionGroup(); + var qg2:QuestionGroup = new QuestionGroup(); + var qg3:QuestionGroup = new QuestionGroup(); + var qg4:QuestionGroup = new QuestionGroup(); + var qg5:QuestionGroup = new QuestionGroup(); + var qg6:QuestionGroup = new QuestionGroup(); + qg0.questions = new ArrayCollection(); + qg1.questions = new ArrayCollection(); + qg2.questions = new ArrayCollection(); + qg3.questions = new ArrayCollection(); + qg4.questions = new ArrayCollection(); + qg5.questions = new ArrayCollection(); + qg6.questions = new ArrayCollection(); + block1.questionGroups = new ArrayCollection(); + + // create questions + var ddq1:Question = new Question(); + ddq1.question = "dayByDayDecisionsQuestion"; + ddq1.type = "dayByDayDecisions"; + + var cat1:Categorical = new Categorical(); + cat1.question = "categoricalQuestion"; + cat1.type = "categorical"; + cat1.categoricalOptions = new ArrayCollection(); + + var for1:ForecastingPeople = new ForecastingPeople(); + var for2:ForecastingFish = new ForecastingFish(); + + var psy1:Psychometric = new Psychometric(); + psy1.question = "psychometricQuestionBipolar"; + psy1.type = "psychometric"; + psy1.maxSliderValue = 10; + psy1.choices = new ArrayCollection(); + psy1.choices.addItem("Highly Agree"); + psy1.choices.addItem("Neutral"); + psy1.choices.addItem("Highly Disagree"); + + var psy2:Psychometric = new Psychometric(); + psy2.question = "psychometricQuestionUnipolar"; + psy2.type = "psychometric"; + psy2.maxSliderValue = 10; + psy2.choices = new ArrayCollection(); + psy2.choices.addItem("Strong"); + psy2.choices.addItem("Neutral"); + + var str1:Question = new Question(); + str1.question = "strategyDesignQuestion"; + str1.type = "strategyDesign"; + + var txt1:Question = new Question(); + txt1.question = "textQuestion"; + txt1.type = "text"; + + // insert questions into groups + qg0.questions.addItem(ddq1); + qg1.questions.addItem(cat1); + qg2.questions.addItem(for1); + qg3.questions.addItem(for2); + qg4.questions.addItem(psy1); + qg4.questions.addItem(psy2); + qg5.questions.addItem(str1); + qg6.questions.addItem(txt1); + + qg1.description = "testDesc"; + qg1.header = "testHead"; + + block1.questionGroups.addItem(qg0); + block1.questionGroups.addItem(qg1); + block1.questionGroups.addItem(qg2); + block1.questionGroups.addItem(qg3); + block1.questionGroups.addItem(qg4); + block1.questionGroups.addItem(qg5); + block1.questionGroups.addItem(qg6); + + + }catch(errObject:Error){ + Alert.show("block creation failure\n" + + errObject.message + "\n" + errObject.getStackTrace()); + } + return block1; + } + + ]]> + </mx:Script> + +</mx:Canvas> + Deleted: mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -1,406 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.*" - clipContent="false" verticalScrollPolicy="off" horizontalScrollPolicy="off" - currentState="socioDemographic" initialize="init()" - width="720" height="490"> - - <mx:RemoteObject id="moduleService" destination="moduleService" fault="moduleFaultHandler(event)" result="moduleResultHandler(event)"/> - - <mx:states> - <mx:State name="socioDemographic"> - <mx:AddChild relativeTo="{content}"> - <comp:SocioDemographicPage id="socioDemographic" - x="{(content.width-socioDemographic.width)/2}" - y="{(content.height-socioDemographic.height)/2}"/> - </mx:AddChild> - <mx:SetProperty target="{content}" name="x"/> - <mx:SetStyle target="{content}" name="horizontalCenter" value="0"/> - </mx:State> - - <mx:State name="instructionsLoad"> - <mx:AddChild relativeTo="{content}"> - <comp:InstructionPage id="instructions" initialize="gotoInstructions()"/> - </mx:AddChild> - </mx:State> - - <mx:State name="instructions" enterState="instructions.initModule(currModule)"> - <mx:RemoveChild target="{instructions}"/> - <mx:AddChild relativeTo="{content}" target="{instructions}"/> - <mx:SetProperty target="{instructions}" name="visible" value="true"/> - </mx:State> - - <mx:State name="wait"> - <mx:AddChild relativeTo="{content}"> - <mx:Label id="lblWaiting" text="Waiting for next Module from server..." fontSize="16"/> - </mx:AddChild> - </mx:State> - - <mx:State name="none"> - <mx:AddChild relativeTo="{content}"> - <mx:Label id="end" text="Thank you for playing!" fontSize="30"/> - </mx:AddChild> - </mx:State> - </mx:states> - - <!-- <mx:Canvas id="content" x="5" y="5" width="750" height="470"/> --> - <mx:Canvas id="content" x="0" y="0" width="720" height="475"/> - <mx:Canvas id="expiredContent" x="-1" y="-1" width="1" height="1" visible="false"/> - - <mx:Button id="btnBack" label="« Back" click="back()" left="0" bottom="0" enabled="false"/> - <mx:Button id="btnAccept" label="Accept" click="accept()" left="{(width-btnAccept.width)/2}" bottom="0"/> - <mx:Button id="btnForward" label="Forward »" click="forward()" right="0" bottom="0" enabled="false"/> - - <mx:RemoteObject id="ss" destination="studentService" fault="faultHandler(event)" result="resultHandler(event)"/> - <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> - <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> - - <mx:Script> - <![CDATA[ - import actionscript.*; - import actionscript.questions.*; - import custom.*; - import mx.controls.Label; - import mx.controls.Alert; - import mx.collections.ArrayCollection; - import flash.sampler.getInvocationCount; - import mx.rpc.events.ResultEvent; - import mx.rpc.events.FaultEvent; - import mx.messaging.messages.IMessage; - import mx.messaging.events.MessageAckEvent; - import mx.messaging.events.MessageFaultEvent; - import mx.messaging.FlexClient; - import mx.messaging.messages.AsyncMessage; - - // - // Important Variables - // - public var currModule:Module = null; - public var currBlock:Block = null; - public var currBlockNumber:int = 0; - public var blockLoader:Function = null; - - public var updateObjectA:InformationWindowCreator = null; - public var updateObjectB:InformationWindowCreator = null; - - public var instructionsLoaded:Boolean = false; - - private var shared:SharedObject; - private var flushMessage:String; - [Bindable] - public var Id : uint; - - [Bindable] - public var randomNumbers:String; - private function ack(event:MessageAckEvent):void - { - //chart.setVisible(true); - randomNumbers = event.message.body as String; - //Alert.show("in ack method" + randomNumbers); - } - - public function init():void - { - moduleService.setToModule(1); - } - - private function gotoInstructions():void - { - instructionsLoaded = true; - currentState = "instructions"; - } - private function sendBlockQuestions():void - { - if(1==1)return; - if(currBlock == null) return; - var qgroups:ArrayCollection = currBlock.questionGroups; - for(var qgroupNum:int=0; qgroupNum<qgroups.length; qgroupNum++) - { - var questions:ArrayCollection = (qgroups.getItemAt(qgroupNum) as QuestionGroup).questions; - for(var qNum:int=0; qNum<questions.length; qNum++) - { - var question:Question = questions.getItemAt(qNum) as Question; - sendQuestion(question,currBlockNumber,qgroupNum,qNum); - } - } - } - private function sendQuestion(databaseObject:Object,blockNumber:int,questionGroupNumber:int,questionNumber:int):void - { - if(databaseObject is ArrayCollection) - { - var array:ArrayCollection = databaseObject as ArrayCollection; - if(array != null && array.length > 0) - { - if(array.getItemAt(0) is StudentStrategy) - { - var sstrat:StudentStrategy = array.getItemAt(0) as StudentStrategy; - // invoke service here - } - } - } - - } - - private function getModule():Module - { - sendBlockQuestions(); - // server request here - moduleService.getNextModule(); - - currModule = null; - return currModule; // set to null for now (clear old) - } - private function moduleResultHandler(event:ResultEvent):void - { -// try{ -// Alert.show("module==null:"+(event.result==null)+ -// "\nblock==null:"+((event.result as Module).blocks == null)+ -// "\nblock.length:"+((event.result as Module).blocks.length)+ -// "\nblock1.questionGroups==null:"+(((event.result as Module).blocks.getItemAt(0) as Block).questionGroups==null)+ -// "\nblock1.questionGroups.length:"+(((event.result as Module).blocks.getItemAt(0) as Block).questionGroups.length) -// ); -// }catch(err:Error){ -// -// } - - currModule = (event.result as actionscript.Module); - - if(currModule.description == "result of setModule - ignore!") - { - return; - } - else if(currModule == null || currModule.blocks == null || currModule.blocks.length < 1 || - (currModule.blocks.getItemAt(0) as Block) == null || - (currModule.blocks.getItemAt(0) as Block).questionGroups == null || - (currModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) - { - currentState = "none"; - } - else if(!instructionsLoaded) - { - currentState = "instructionsLoad"; - } - else - { - gotoInstructions(); - } - - btnBack.enabled = btnForward.enabled = true; - } - private function moduleFaultHandler(event:FaultEvent):void - { - Alert.show(event.fault.message + "\n" + event.fault.getStackTrace()); - } - - private function resultHandler(event:ResultEvent):void - { - Id = event.result as uint; -// Alert.show("Student id is " + Id ); - consumer.disconnect(); - } - private function faultHandler(event:FaultEvent):void - { -// Alert.show("event fault is " + event.fault.faultDetail); - } - private function handleFault(event:MessageFaultEvent):void - { -// Alert.show("Message event fault is " + event.faultString); - } - - - private function messageHandler(message:IMessage):void - { - randomNumbers = message.body as String; -// Alert.show( ""+randomNumbers); - } - - public function back():Boolean - { - if(content.numChildren == 0) - { return false; } - var obj:DisplayObject = content.getChildAt(0); - - if(obj is InstructionPage) - { - try - { - return (InstructionPage)(obj).back(); - } - catch(err:Error){} - } - return false; - } - - public function forward():Boolean - { - if(content.numChildren == 0) - { return false; } - var obj:DisplayObject = content.getChildAt(0); - - if(obj is InstructionPage) - { - try - { - return (InstructionPage)(obj).forward(); - } - catch(err:Error){} - } - return false; - } - - public function accept():Boolean - { - if(content.numChildren == 0) - { return false; } - - var obj:DisplayObject = content.getChildAt(0); - var returnValue:Boolean = false; - - if(obj is SocioDemographicPage) - { - var Id:uint = 0; - if( (SocioDemographicPage)(obj).accept() ) - { - obj.visible = false; - expiredContent.addChild(obj); - - currentState = "wait"; - getModule(); - // - // END TEMPORARY CODE - // - - - var info:SocioDemographicPage = SocioDemographicPage(obj); - Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); - - btnBack.enabled = true; - btnForward.enabled = true; - - returnValue = true; - } - } - if(obj is InstructionPage) - { - try - { - if( (InstructionPage)(obj).accept() ) - { - obj.visible = false; - expiredContent.addChild(obj); - currentState = "wait"; - getModule(); - //consumer.subscribe(); - returnValue = true; - } - else - { - var newCurrBlock:Block = (InstructionPage)(obj).block; - if(newCurrBlock != currBlock) - { - currBlock = newCurrBlock; - currBlockNumber++; - blockLoader.call(); - } - } - } - catch(err:Error){} - } - - btnBack.enabled = btnForward.enabled = (currentState == "instructions"); - - return returnValue; - } - - public function makeBlock():Block - { - var block1:Block = new Block(); - try{ - var questionGroups1:ArrayCollection = new ArrayCollection(); - var qg0:QuestionGroup = new QuestionGroup(); - var qg1:QuestionGroup = new QuestionGroup(); - var qg2:QuestionGroup = new QuestionGroup(); - var qg3:QuestionGroup = new QuestionGroup(); - var qg4:QuestionGroup = new QuestionGroup(); - var qg5:QuestionGroup = new QuestionGroup(); - var qg6:QuestionGroup = new QuestionGroup(); - qg0.questions = new ArrayCollection(); - qg1.questions = new ArrayCollection(); - qg2.questions = new ArrayCollection(); - qg3.questions = new ArrayCollection(); - qg4.questions = new ArrayCollection(); - qg5.questions = new ArrayCollection(); - qg6.questions = new ArrayCollection(); - block1.questionGroups = new ArrayCollection(); - - // create questions - var ddq1:Question = new Question(); - ddq1.question = "dayByDayDecisionsQuestion"; - ddq1.type = "dayByDayDecisions"; - - var cat1:Categorical = new Categorical(); - cat1.question = "categoricalQuestion"; - cat1.type = "categorical"; - cat1.categoricalOptions = new ArrayCollection(); - - var for1:ForecastingPeople = new ForecastingPeople(); - var for2:ForecastingFish = new ForecastingFish(); - - var psy1:Psychometric = new Psychometric(); - psy1.question = "psychometricQuestionBipolar"; - psy1.type = "psychometric"; - psy1.maxSliderValue = 10; - psy1.choices = new ArrayCollection(); - psy1.choices.addItem("Highly Agree"); - psy1.choices.addItem("Neutral"); - psy1.choices.addItem("Highly Disagree"); - - var psy2:Psychometric = new Psychometric(); - psy2.question = "psychometricQuestionUnipolar"; - psy2.type = "psychometric"; - psy2.maxSliderValue = 10; - psy2.choices = new ArrayCollection(); - psy2.choices.addItem("Strong"); - psy2.choices.addItem("Neutral"); - - var str1:Question = new Question(); - str1.question = "strategyDesignQuestion"; - str1.type = "strategyDesign"; - - var txt1:Question = new Question(); - txt1.question = "textQuestion"; - txt1.type = "text"; - - // insert questions into groups - qg0.questions.addItem(ddq1); - qg1.questions.addItem(cat1); - qg2.questions.addItem(for1); - qg3.questions.addItem(for2); - qg4.questions.addItem(psy1); - qg4.questions.addItem(psy2); - qg5.questions.addItem(str1); - qg6.questions.addItem(txt1); - - qg1.description = "testDesc"; - qg1.header = "testHead"; - - block1.questionGroups.addItem(qg0); - block1.questionGroups.addItem(qg1); - block1.questionGroups.addItem(qg2); - block1.questionGroups.addItem(qg3); - block1.questionGroups.addItem(qg4); - block1.questionGroups.addItem(qg5); - block1.questionGroups.addItem(qg6); - - - }catch(errObject:Error){ - Alert.show("block creation failure\n" + - errObject.message + "\n" + errObject.getStackTrace()); - } - return block1; - } - - ]]> - </mx:Script> - -</mx:Canvas> - Modified: mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -14,10 +14,11 @@ public var closedFunction:Function = null; public var valid:Boolean = true; + public var window:int = -1; private function titleWindow_close(evt:CloseEvent):void { - closedFunction.call(); + closedFunction.call(this,window); } ]]> </mx:Script> Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -3,6 +3,7 @@ <mx:Script> <![CDATA[ + import actionscript.Location; import actionscript.QuestionGroup; import actionscript.Module; import custom.questions.forecasting.*; @@ -18,8 +19,21 @@ [Bindable] public var numPages:int = 1; [Bindable] public var currPage:int = 0; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + public var savedForecastPeople:ArrayCollection = null; + public var savedForecastFish:ArrayCollection = null; + public var savedStrategyDesign:ArrayCollection = null; + public var savedDayByDayDecisions:ArrayCollection = null; + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } public function initModule(newModule:actionscript.Module):void { @@ -53,33 +67,27 @@ if(block != null && block.questionGroups != null) { minPagesRead = block.questionGroups.length - pageDisplay = new PageDisplay(block, minPagesRead); + pageDisplay = new PageDisplay(block, minPagesRead,locations); } if(pageDisplay == null) { debug2.text += "pageDisplay is null\n"; - pageDisplay = new PageDisplay(makeBlock(),0); + pageDisplay = new PageDisplay(makeBlock(),0,locations); } // pageDisplay = new PageDisplay(block, block.questionGroups.length); - - }catch(errObject:Error){ debug2.text += "pageDisplay creation failure\n" + errObject.message +"\n"+ errObject.getStackTrace() +"\n"; - pageDisplay = new PageDisplay(makeBlock(),0); + pageDisplay = new PageDisplay(makeBlock(),0,locations); // Alert.show(debug2.text); } -// debug2.text += "setting currPage...\n"; currPage = pageDisplay.currentPageNumber; -// debug2.text += "setting numPages...\n"; numPages = pageDisplay.pages.length; -// debug2.text += "adding currentPage...\n"; content.removeAllChildren(); content.addChild(pageDisplay.currentPage); -// debug2.text += "currentPage added.\n"; } public function back():Boolean Modified: mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -21,7 +21,7 @@ } public function getSemester():String { - return txtSemester.text; + return cbxSemester.selectedItem as String; } public function accept():Boolean @@ -57,14 +57,6 @@ txtMajor.setStyle(bgcolor, white); } - if(getSemester().length == 0) - { - txtSemester.setStyle(bgcolor, red); - ready=false; - }else{ - txtSemester.setStyle(bgcolor, white); - } - enable(!ready); return ready; } @@ -74,7 +66,7 @@ boxGender.enabled = enabled; txtYear.enabled = enabled; txtMajor.enabled = enabled; - txtSemester.enabled = enabled; + cbxSemester.enabled = enabled; } public function save():ArrayCollection @@ -95,9 +87,13 @@ radioMale.selected = (gender == "M"); radioFemale.selected = (gender == "F"); } + else + { + radioMale.selected = radioFemale.selected = false; + } txtYear.text = (loadArray.getItemAt(1) as String); txtMajor.text = (loadArray.getItemAt(2) as String); - txtSemester.text = (loadArray.getItemAt(3) as String); + cbxSemester.selectedIndex = (cbxSemester.dataProvider as ArrayCollection).getItemIndex(loadArray.getItemAt(3) as String); } ]]> @@ -130,7 +126,8 @@ <mx:HBox> <mx:Label text="Semester:" fontWeight="bold" width="100" textAlign="right"/> - <mx:TextInput id="txtSemester" width="75" maxChars="6"/> + <mx:ComboBox id="cbxSemester" selectedIndex="0" dataProvider="{new ArrayCollection(['Freshman','Sophomore','Junior','Senior','Graduate/Other'])}"/> + <!--<mx:TextInput id="txtSemester" width="75" maxChars="6"/>--> </mx:HBox> </mx:VBox> Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -21,6 +21,7 @@ <mx:Script> <![CDATA[ + import actionscript.Location; import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.controls.Button; @@ -28,11 +29,20 @@ import actionscript.questions.*; import custom.questions.dayByDayDecisions.OneDay; - public var numBays:int = 3; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); [Bindable] public var deciding:int = 0; [Bindable] public var cumTotal:Number = 0; [Bindable] public var dollarPerLb:Number = 3.99; + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + public function init():void { buttons.removeAllChildren(); @@ -55,7 +65,7 @@ txtTemp.text = "Harbor"; labels.addChild(txtTemp); - for(var i:int = 0; i < numBays; i++) + for(var i:int = 0; i < locations.length; i++) { btnTemp = new Button(); btnTemp.label = "Bay" + (i+1); @@ -115,7 +125,7 @@ } var newDay:OneDay = new OneDay(); - newDay.numBays = numBays; + newDay.locations = locations; newDay.initialize(); newDay.day = dayByDayContent.numChildren + 1; newDay.dollarPerLb = dollarPerLb; @@ -138,7 +148,7 @@ var day:OneDay = dayByDayContent.getChildAt(i) as OneDay; var newDay:OneDay = new OneDay(); - newDay.numBays = numBays; + newDay.locations = locations; newDay.initialize(); newDay.day = day.day; newDay.dollarPerLb = day.day; Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -3,11 +3,12 @@ <mx:Script> <![CDATA[ + import actionscript.Location; import mx.controls.Text; import mx.controls.Label; import mx.collections.ArrayCollection; - [Bindable] public var numBays:int = 3; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); [Bindable] public var decisions:ArrayCollection; public var previousTotal:Number = 0; @@ -15,13 +16,22 @@ public var day:int = 1; public var dollarPerLb:Number = 3.99; + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + public function init():void { if(decisions == null) { drawNull(); } - else if(decisions.length < numBays+1) + else if(decisions.length < locations.length+1) { drawPartial(); } @@ -47,7 +57,7 @@ public function drawPartial():void { var temp:OneDecision; - for(var i:int = decisions.length; i < numBays+1; i++) + for(var i:int = decisions.length; i < locations.length+1; i++) { temp = new OneDecision(); temp.active = false; @@ -70,7 +80,7 @@ dayText.minWidth = 50; addChild(dayText); - for(var i:int = 0; i < numBays+1 && i < decisions.length; i++) + for(var i:int = 0; i < locations.length+1 && i < decisions.length; i++) { var temp:OneDecision = (decisions.getItemAt(i) as OneDecision); presentTotal += temp.lbsFished; @@ -100,7 +110,7 @@ } else { - for(var i:int = 0; i < locationChosen && i < numBays; i++) + for(var i:int = 0; i < locationChosen && i < locations.length; i++) { var tempInactive:OneDecision = new OneDecision(); tempInactive.active = false; Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -33,8 +33,9 @@ public var loadFish:ArrayCollection = null; public var loadPeople:ArrayCollection = null; + [Bindable] public var locations:ArrayCollection = new ArrayCollection(); - [Bindable] public var numBays:int = 3; + [Bindable] public var numBays:int = locations.length; [Bindable] public var numColumns:int = 6; public function init():void Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -26,8 +26,9 @@ import custom.questions.forecasting.ForecastComponent; public var loadPeople:ArrayCollection = null; + [Bindable] public var locations:ArrayCollection = new ArrayCollection(); - [Bindable] public var numBays:int = 3; + [Bindable] public var numBays:int = locations.length; [Bindable] public var numColumns:int = 15; public function init():void Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -5,11 +5,22 @@ <mx:Script> <![CDATA[ + import actionscript.Location; import mx.collections.ArrayCollection; import mx.controls.Label; public var valueRequired:Boolean = false; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + private function init():void { if(valueRequired) @@ -27,6 +38,8 @@ { var newRow:PlannerRow = new PlannerRow(); newRow.valueRequired = this.valueRequired; + newRow.locations = locations; + newRow.initialize(); var newNumber:Label = new Label(); newNumber.text = "" + (numbers.numChildren+1); newNumber.height = 22; Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -1,11 +1,39 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"> +<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()"> <mx:Script> <![CDATA[ + import actionscript.Location; public var valueRequired:Boolean = false; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + + public function init():void + { + locs.removeAll(); + var obj:Object = new Object(); + obj.data = "Harbor"; + obj.label = obj.data; + locs.addItem(obj); + + for(var i:int=0; i<locations.length; i++) + { + obj = new Object(); + obj.data = "Bay " + (i+1); + obj.label = obj.data; + locs.addItem(obj); + } + } + public function deleteMe():void { if(!valueRequired || parent.numChildren > 1) @@ -30,16 +58,19 @@ } public function setLocation(newValue:String):void { - if(newValue == "Harbor") location.selectedIndex = 0; - if(newValue == "Bay 1") location.selectedIndex = 1; - if(newValue == "Bay 2") location.selectedIndex = 2; - if(newValue == "Bay 3") location.selectedIndex = 3; - if(newValue == "Bay 4") location.selectedIndex = 1; - if(newValue == "Bay 5") location.selectedIndex = 2; - if(newValue == "Bay 6") location.selectedIndex = 3; - if(newValue == "Bay 7") location.selectedIndex = 1; - if(newValue == "Bay 8") location.selectedIndex = 2; - if(newValue == "Bay 9") location.selectedIndex = 3; + try{ + if(newValue.indexOf("Bay ") == 0) + { + location.selectedIndex = int(newValue.substring(4)); + } + else + { + location.selectedIndex = 0; + } + }catch(err:Error){ + location.selectedIndex = 0; + } + changedLocation(); } public function getDays():Number @@ -67,12 +98,7 @@ ]]> </mx:Script> - <mx:ArrayCollection id="locs"> - <mx:Object label="Harbor" data="Harbor"/> - <mx:Object label="Bay 1" data="Bay 1"/> - <mx:Object label="Bay 2" data="Bay 2"/> - <mx:Object label="Bay 3" data="Bay 3"/> - </mx:ArrayCollection> + <mx:ArrayCollection id="locs"/> <mx:Button id="deleteRow" label="Del" click="deleteMe()" width="60"/> Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-07-15 21:54:25 UTC (rev 183) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-07-15 22:51:14 UTC (rev 184) @@ -11,11 +11,11 @@ <mx:HBox> <mx:VBox> <mx:Label text="Not Repeated decisions (start-up)" fontSize="18"/> - <qComp:Planner id="notRepeated"/> + <qComp:Planner id="notRepeated" locations="{locations}"/> </mx:VBox> <mx:VBox> <mx:Label text="Repeated decisions (after start-up)" fontSize="18"/> - <qComp:Planner id="repeated" valueRequired="true"/> + <qComp:Planner id="repeated" valueRequired="true" locations="{locations}"/> </mx:VBox> </mx:HBox> @@ -39,6 +39,17 @@ import actionscript.questions.Question; import mx.collections.ArrayCollection; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + public function getNotRepeated():ArrayCollection { return notRepeated.save(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |