[virtualcommons-svn] SF.net SVN: virtualcommons:[207] mentalmodels/trunk/flex/src
Status: Beta
Brought to you by:
alllee
From: <kj...@us...> - 2009-07-24 23:11:33
|
Revision: 207 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=207&view=rev Author: kjonas Date: 2009-07-24 23:11:25 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Added Entities as .as classes for all known entities Removed modules from FisheryExperimentCore.mxml, now fetching block-by-block. Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as mentalmodels/trunk/flex/src/actionscript/Communication.as mentalmodels/trunk/flex/src/actionscript/Game.as mentalmodels/trunk/flex/src/actionscript/Group.as mentalmodels/trunk/flex/src/actionscript/ModuleRoundConfig.as mentalmodels/trunk/flex/src/actionscript/Persistable.as mentalmodels/trunk/flex/src/actionscript/PersistableSequence.as mentalmodels/trunk/flex/src/actionscript/Round.as mentalmodels/trunk/flex/src/actionscript/StudentRoundConfig.as mentalmodels/trunk/flex/src/actionscript/SuspendRepetition.as mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml Removed Paths: ------------- mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as Property Changed: ---------------- mentalmodels/trunk/flex/src/ Property changes on: mentalmodels/trunk/flex/src ___________________________________________________________________ Added: svn:ignore + messaging-config.xml proxy-config.xml remoting-config.xml services-config.xml Added: mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,14 @@ +package actionscript +{ + + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalOption")] + public class CategoricalOption + { + public var optionKey:String; + public var choices:ArrayCollection = new ArrayCollection(); + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Communication.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Communication.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Communication.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,13 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Communication")] + public class Communication + { + public var id:Number; + public var message:String; + public var timestamp:Timestamp; + public var student:Student; + public var round:Round; + } +} \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as 2009-07-24 21:29:16 UTC (rev 206) +++ mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as 2009-07-24 23:11:25 UTC (rev 207) @@ -1,20 +0,0 @@ -package actionscript -{ - import mx.controls.NumericStepper; - - public class CustomNumericStepper extends mx.controls.NumericStepper - { - - public function CustomNumericStepper() - { - super(); - super.stepSize = 1; - super.maximum = 3; - super.minimum = 0; - - } - - - - } -} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Game.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Game.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Game.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,21 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Game")] + public class Game + { + public var id:Number; + public var numberOfRounds:int; + public var numberOfLocations:int; + public var maxDays:int; + public var maxFishHarvest:int; + public var timestamp:Timestamp; + public var title:String; + public var description:String; + public var money:Number; + public var imageLocation:String; + public var rounds:ArrayCollection; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Group.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Group.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Group.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,11 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Group")] + public class Group + { + public var id:Number; + public var number:int; + public var game:Game; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/ModuleRoundConfig.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/ModuleRoundConfig.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/ModuleRoundConfig.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,12 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.ModuleRoundConfig")] + public class ModuleRoundConfig + { + public var id:Number; + public var sequenceNo:int; + public var module:Module; + public var round:Round; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Persistable.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Persistable.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Persistable.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,9 @@ +package actionscript +{ + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Persistable")] + public class Persistable + { + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/PersistableSequence.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PersistableSequence.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/PersistableSequence.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,10 @@ +package actionscript +{ + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.PersistableSequence")] + public class PersistableSequence + { + public var sequenceNumber:int; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Round.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Round.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Round.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,13 @@ +package actionscript +{ + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Round")] + public class Round + { + public var id:Number; + public var roundNo:int; + public var game:Game; + public var communicationFlag:Boolean; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/StudentRoundConfig.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/StudentRoundConfig.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/StudentRoundConfig.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,14 @@ +package actionscript +{ + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.StudentRoundConfig")] + public class StudentRoundConfig + { + public var id:Number; + public var student:Student; + public var roundconfig:Round; + public var currentAllocationNo:int; + public var currentDayNo:int; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/SuspendRepetition.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/SuspendRepetition.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/SuspendRepetition.as 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,14 @@ +package actionscript +{ + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.SuspendRepetition")] + public class SuspendRepetition + { + public var id:Number; + public var roundConfig:Round; + public var student:Student; + public var daysInHarbor:int; + public var fishingThreshold:Number; + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-07-24 21:29:16 UTC (rev 206) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-07-24 23:11:25 UTC (rev 207) @@ -21,7 +21,7 @@ </mx:AddChild> </mx:State> - <mx:State name="instructions" enterState="instructions.initModule(currModule)"> + <mx:State name="instructions" enterState="instructions.init(currentBlock)"> <mx:RemoveChild target="{instructions}"/> <mx:AddChild relativeTo="{content}" target="{instructions}"/> <mx:SetProperty target="{instructions}" name="visible" value="true"/> @@ -29,7 +29,7 @@ <mx:State name="wait"> <mx:AddChild relativeTo="{content}"> - <mx:Label id="lblWaiting" text="Waiting for next Module from server..." fontSize="16"/> + <mx:Label id="lblWaiting" text="Waiting for next Block from server..." fontSize="16"/> </mx:AddChild> </mx:State> @@ -64,6 +64,8 @@ <mx:method name="createStudent" result="studentResultHandler(event)"/> <mx:method name="getFirstModule" result="moduleResultHandler(event)"/> </mx:RemoteObject> + <mx:RemoteObject id="answeringService" destination="answeringService" fault="faultHandler(event)"> + </mx:RemoteObject> <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> @@ -95,10 +97,10 @@ // // Important Variables // - public var currModule:Module = null; - public var currModuleNumber:int = 0; - public var currBlock:Block = null; - public var currBlockNumber:int = 0; + public var currentModule:Module = null; + public var currentModuleNumber:int = 0; + public var currentBlock:Block = null; + public var currentBlockNumber: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; @@ -108,7 +110,7 @@ public var instructionsLoaded:Boolean = false; - [Bindable] public var studentObject:Student; + [Bindable] public var studentObject:actionscript.Student; private function newLocation(maxCapacity:Number,growth:Number):Location { @@ -136,13 +138,14 @@ { btnForward.enabled = btnBack.enabled = btnReset.enabled = true; instructionsLoaded = true; - instructions.moduleNumber = currModuleNumber; + instructions.moduleNumber = currentModuleNumber; currentState = "instructions"; } private function sendBlockQuestions():void { if(instructions == null) return; + var responseList:ArrayCollection = new ArrayCollection(); var studentResponse:StudentResponse; var pages:ArrayCollection = instructions.pageDisplay.pages; @@ -197,7 +200,8 @@ studentResponse.response += ", "; } } - // server: submit the response + + responseList.addItem(studentResponse); } studentResponse = new StudentResponse(); studentResponse.question = null; @@ -219,7 +223,8 @@ studentResponse.response += ", "; } } - // server: submit the response + + responseList.addItem(studentResponse); } studentResponse = new StudentResponse(); studentResponse.question = null; @@ -232,10 +237,12 @@ if(studentResponse.question != null) { - // server: submit the response + responseList.addItem(studentResponse); } } } + + answeringService.saveQuestion(responseList); } private function reportBlockFinished():void { @@ -246,23 +253,31 @@ private function getNextModule():void { if(instructions != null) reportBlockFinished(); - currModule = null; - currModuleNumber++; + currentModule = null; + currentModuleNumber++; - roundService.getNextModule(currModuleNumber); + roundService.getNextModule(currentModuleNumber); } + private function getNextBlock():void + { + if(instructions != null) reportBlockFinished(); + currentBlock = null; + currentBlockNumber++; + + //server request + } private function moduleResultHandler(event:ResultEvent):void { - currModule = (event.result as actionscript.Module); + currentModule = (event.result as actionscript.Module); - if(currModule == null) + if(currentModule == 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) + else if(currentModule.blocks == null || currentModule.blocks.length < 1 || + (currentModule.blocks.getItemAt(0) as Block) == null || + (currentModule.blocks.getItemAt(0) as Block).questionGroups == null || + (currentModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) { currentState = "none"; } @@ -290,7 +305,7 @@ private function studentResultHandler(event:ResultEvent):void { - studentObject = event.result as Student; + studentObject = event.result as actionscript.Student; consumer.disconnect(); } private function faultHandler(event:FaultEvent):void @@ -369,26 +384,17 @@ { try { - var instructionPageAcceptValue:int = (InstructionPage)(obj).accept(); - if( instructionPageAcceptValue == 2 ) + var instructionPageAcceptValue:Boolean = (InstructionPage)(obj).accept(); + if( (InstructionPage)(obj).accept() ) { obj.visible = false; expiredContent.addChild(obj); currentState = "wait"; //consumer.subscribe(); - getNextModule(); + getNextBlock(); //TK returnValue = true; } - else if( instructionPageAcceptValue == 1 ) - { - currBlock = (InstructionPage)(obj).block; - currBlockNumber++; - blockLoader.call(); - - reportBlockFinished(); - returnValue = true; - } } catch(err:Error) { Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-07-24 21:29:16 UTC (rev 206) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-07-24 23:11:25 UTC (rev 207) @@ -26,6 +26,7 @@ public var savedForecastFish:ArrayCollection = null; public var savedStrategyDesign:ArrayCollection = null; public var savedDayByDayDecisions:ArrayCollection = null; +// public var savedDayByDayDecisions:ArrayCollection = null; private function newLocation(maxCapacity:Number,growth:Number):Location { @@ -36,27 +37,27 @@ return newLoc; } - public function initModule(newModule:actionscript.Module):void - { - module = newModule; - blockNumber = 0; - if(module == null) - { - debug2.text += "module is null\n"; - return; - } - if(module.blocks == null) - { - debug2.text += "module.blocks is null\n"; - return; - } - if(module.blocks.length < 1) - { - debug2.text += "module.blocks.length is less than 1\n"; - return; - } - init(module.blocks.getItemAt(blockNumber) as Block); - } +// public function initModule(newModule:actionscript.Module):void +// { +// module = newModule; +// blockNumber = 0; +// if(module == null) +// { +// debug2.text += "module is null\n"; +// return; +// } +// if(module.blocks == null) +// { +// debug2.text += "module.blocks is null\n"; +// return; +// } +// if(module.blocks.length < 1) +// { +// debug2.text += "module.blocks.length is less than 1\n"; +// return; +// } +// init(module.blocks.getItemAt(blockNumber) as Block); +// } public function init(newBlock:Block):void { @@ -128,7 +129,7 @@ currPage = pageDisplay.currentPageNumber; currPageLabel.htmlText = "Module: "+moduleNumber+ - "<br>Block: "+(blockNumber+1)+" / "+module.blocks.length+ + "<br>Block: "+(blockNumber+1)+ "<br>Page: "+(currPage+1)+" / "+numPages; content.removeAllChildren(); @@ -145,47 +146,28 @@ } - public function accept():int // 0: not finished, 1: finished block, 2: finished module + public function accept():Boolean { try { if(pageDisplay.componentsNotFinished()) { - Alert.show("Go back and complete all required sections of the Block.","Cannot Advance"); - return 0; + Alert.show("You must complete all required sections of the Block.","Cannot Advance"); } else if(pageDisplay.finished()) { - //switch blocks within module - var nextBlock:int = blockNumber+1; - if(nextBlock < module.blocks.length) - { - content.removeAllChildren(); - - blockNumber = nextBlock; - init(module.blocks.getItemAt(blockNumber) as Block); - numPages = pageDisplay.pages.length; - - return 1; - } - else - { - //server stuff goes here (in FisheryExperiment,actually) - - return 2; // module finished - } + return true; } else { Alert.show("Try looking at every page.","Cannot Advance"); } - return 0; } catch(err:Error) { - Alert.show("accepterror"+err.message+err.getStackTrace()); + Alert.show(err.message+"\n"+err.getStackTrace(),"Accept Error"); } - return 0; + return false; } public function reset():void @@ -220,7 +202,7 @@ ]]> </mx:Script> - <mx:Text id="currPageLabel" htmlText="Module: {moduleNumber}<br>Block: {(blockNumber+1)} / {module.blocks.length}<br>Page: {(currPage+1)} / {numPages}"/> + <mx:Text id="currPageLabel" htmlText="Module: {moduleNumber}<br>Block: {(blockNumber+1)}<br>Page: {(currPage+1)} / {numPages}"/> <mx:VBox id="content"/> <mx:Text id="debug" text="{pageDisplay.msg}" width="300"/> Added: mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml (rev 0) +++ mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml 2009-07-24 23:11:25 UTC (rev 207) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:dbd="custom.questions.dayByDayDecisions.*"> + <dbd:DayByDayDecisionsQuestionC id="dayByDay"/> + + <mx:Script> + <![CDATA[ + import mx.collections.ArrayCollection; + + public var savedStrategy:ArrayCollection = null; + public var savedDayByDay:ArrayCollection = null; + + public function init():void + { + dayByDay.removeChild(dayByDay.buttons); +// dayByDay.removeChild(dayByDay.timer); + + if(savedStrategy != null) + { + dayByDay.loadFromStrategy(savedStrategy); + } + else if(savedDayByDay != null) + { + dayByDay.load(savedDayByDay); + } + + } + + ]]> + </mx:Script> + +</mx:VBox> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |