Index: lams_central/web/lams_authoring.swf =================================================================== diff -u -rd8a2cee523843b37d53e09ade01053fac2d03ce2 -red0751bf76b6e95126836f3d8a51c7f60277a742 Binary files differ Index: lams_central/web/lams_authoring_library.swf =================================================================== diff -u -rd8a2cee523843b37d53e09ade01053fac2d03ce2 -red0751bf76b6e95126836f3d8a51c7f60277a742 Binary files differ Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/CanvasBranchView.as =================================================================== diff -u -rfc4c4a55d4ffd1fbdc9cb96b2a879c683cc9a5e8 -red0751bf76b6e95126836f3d8a51c7f60277a742 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/CanvasBranchView.as (.../CanvasBranchView.as) (revision fc4c4a55d4ffd1fbdc9cb96b2a879c683cc9a5e8) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/br/CanvasBranchView.as (.../CanvasBranchView.as) (revision ed0751bf76b6e95126836f3d8a51c7f60277a742) @@ -221,9 +221,7 @@ highlightActivity(_model); break; case 'DRAW_ALL' : - if (!MonitorModel(_model).locked){ - drawAll(event.data, _model); - } + drawAll(event.data, _model); break; case 'SET_ACTIVE': Debugger.log('setting activie :' + event.updateType + " event.data: " + event.data + " condition: " + (event.data == this),Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasBranchView'); @@ -291,6 +289,11 @@ //Dispatch load event dispatchEvent({type:'load',target:this}); } + + if(model.isDirty) + model.refreshDesign(); + + //model.releaseNextFromBranchingQueue(); } private function setupConnectorHubs() { @@ -326,6 +329,8 @@ var sequenceActs:Array = (model instanceof CanvasModel) ? _cm.getCanvas().ddm.getComplexActivityChildren(activity.activityUIID) : _mm.getMonitor().ddm.getComplexActivityChildren(activity.activityUIID); Debugger.log("Sequence Activities length: " + sequenceActs.length, Debugger.CRITICAL, "loadSequenceActivities", "CanvasBranchView"); + model.haltRefresh(true); + for(var i=0; i 0) { + _branchingQueue.shift(); + + if(_branchingQueue[0] instanceof CanvasBranchView) { + CanvasBranchView(_branchingQueue[0]).init(this, undefined); + setupBranchingObserver(CanvasBranchView(_branchingQueue[0])); + } else { + CanvasOptionalActivity(_branchingQueue[0]).init(); + } + } + } + + private function setupBranchingObserver(a:CanvasBranchView):Void { + //Add listener to view so that we know when it's loaded + a.addEventListener('load', Proxy.create(_cv, _cv.viewLoaded)); + + this.addObserver(a); + } + public function lockAllComplexActivities():Void{ Debugger.log("Locking all Complex Activities", Debugger.GEN, "lockAllComplexActivities", "CanvasModel"); var k:Array = _activitiesDisplayed.values(); @@ -115,7 +158,6 @@ } } - public function unlockAllComplexActivities():Void{ Debugger.log("Unlocking all Complex Activities", Debugger.GEN, "unlockAllComplexActivities", "CanvasModel"); var k:Array = _activitiesDisplayed.values(); @@ -153,7 +195,6 @@ _activeTool = "none"; } - /** * Resets the transition tool to its starting state, e.g. if one chas been created or the user released the mouse over an unsuitable clip * @usage @@ -171,7 +212,6 @@ } } - //////////////////////////////////////////////////////////////////////////////////////////// /////////////////////// REFRESHING DESIGNS ///////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// @@ -268,7 +308,15 @@ private function refreshDesign(){ Debugger.log('Running',Debugger.GEN,'refreshDesign','CanvasModel'); + eventArr = new Array(); + if(activeRefresh) { + _refreshQueueCount++; + return; + } + + startRefresh(); + //go through the design and see what has changed, compare DDM to canvasModel var ddmActivity_keys:Array = _cv.ddm.activities.keys(); Debugger.log('ddmActivity_keys.length:'+ddmActivity_keys.length,Debugger.GEN,'refreshDesign','CanvasModel'); @@ -306,20 +354,20 @@ if(r_activity == "NEW"){ //draw this activity //NOTE!: we are passing in a ref to the activity in the ddm so if we change any props of this, we are changing the ddm - broadcastViewUpdate("DRAW_ACTIVITY",ddm_activity); + eventArr.push(createViewUpdate("DRAW_ACTIVITY",ddm_activity)); }else if(r_activity == "NEW_SEQ_CHILD"){ - broadcastViewUpdate("DRAW_ACTIVITY_SEQ",ddm_activity); + eventArr.push(createViewUpdate("DRAW_ACTIVITY_SEQ",ddm_activity)); }else if(r_activity == "DELETE"){ //remove this activity if(cm_activity.parentUIID == null){ - broadcastViewUpdate("REMOVE_ACTIVITY", cm_activity); + eventArr.push(createViewUpdate("REMOVE_ACTIVITY", cm_activity)); } }else if(r_activity == "CHILD"){ //dont ask the view to draw the activity if it is a child act Debugger.log('Found a child activity, not drawing. activityID:'+ddm_activity.activityID+'parentID:'+ddm_activity.parentActivityID,Debugger.GEN,'refreshDesign','CanvasModel'); }else if(r_activity == "SEQ"){ - broadcastViewUpdate("ADD_SEQUENCE", ddm_activity); + eventArr.push(createViewUpdate("ADD_SEQUENCE", ddm_activity)); } } @@ -348,9 +396,9 @@ if(r_transition == "NEW"){ //NOTE!: we are passing in a ref to the tns in the ddm so if we change any props of this, we are changing the ddm - broadcastViewUpdate("DRAW_TRANSITION",ddmTransition); + eventArr.push(createViewUpdate("DRAW_TRANSITION", ddmTransition)); }else if(r_transition == "DELETE"){ - broadcastViewUpdate("REMOVE_TRANSITION",cmTransition); + eventArr.push(createViewUpdate("REMOVE_TRANSITION", cmTransition)); } } @@ -379,12 +427,62 @@ if(r_branch == "NEW"){ //NOTE!: we are passing in a ref to the tns in the ddm so if we change any props of this, we are changing the ddm - broadcastViewUpdate("DRAW_BRANCH", ddmBranch); + eventArr.push(createViewUpdate("DRAW_BRANCH", ddmBranch)); }else if(r_branch == "DELETE"){ - broadcastViewUpdate("REMOVE_BRANCH",cmBranch); + eventArr.push(createViewUpdate("REMOVE_BRANCH",cmBranch)); } } + + stopRefresh(); + + broadcastViewUpdate("DRAW_ALL", eventArr); + + if(_refreshQueueCount > 0) { + _refreshQueueCount = 0; + refreshDesign(); + } + } + + private function drawAll(){ + drawCount = 0; + + maxCount = eventArr.length; + + Debugger.log("drawing all activities: " + maxCount, Debugger.CRITICAL, "drawAll", "CanvasSuperModel"); + + drawNext(); + } + + public function drawNext():Void { + if(drawCount < maxCount) { + Debugger.log("drawing: " + eventArr[drawCount].updateType, Debugger.CRITICAL, "drawNext", "LearnerTabView"); + + broadcastViewUpdate(eventArr[drawCount].updateType, eventArr[drawCount].data); + + } else { + if(_refreshQueueCount > 0) { + _refreshQueueCount = 0; + refreshDesign(); + } + + return; + } + + drawCount++; + } + + public function createViewUpdate(updateType, data):Object { + setChanged(); + + //send an update + infoObj = {}; + infoObj.target = this; + infoObj.updateType = updateType; + infoObj.data = data; + + return infoObj; + } /** * Notify registered listeners that a data model change has happened @@ -393,10 +491,27 @@ dispatchEvent({type:'viewUpdate',target:this,updateType:_updateType,data:_data}); } + public function startRefresh():Void { + _activeRefresh = true; + _refreshQueueCount = 0; + } + + public function stopRefresh():Void { + _activeRefresh = false; + } + + public function get activeRefresh():Boolean { + return _activeRefresh; + } + public function haltRefresh(a:Boolean):Void { _doRefresh = !a; } + public function get isDirty() { + return _isDirty; + } + public function setDirty(){ _isDirty = true; @@ -755,6 +870,6 @@ public function get ddm():DesignDataModel { return _cv.ddm; - } + } } \ No newline at end of file Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasView.as =================================================================== diff -u -raf26890a57ea13484e2f9e9acba607a320fe9724 -red0751bf76b6e95126836f3d8a51c7f60277a742 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasView.as (.../CanvasView.as) (revision af26890a57ea13484e2f9e9acba607a320fe9724) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/cv/CanvasView.as (.../CanvasView.as) (revision ed0751bf76b6e95126836f3d8a51c7f60277a742) @@ -141,6 +141,9 @@ Debugger.log('setting activie :' + event.updateType + " event.data: " + event.data + " condition: " + (event.data == this),Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView'); transparentCover._visible = (event.data == this) ? false : true; break; + case 'DRAW_ALL' : + drawAll(event.data, cm); + break; default : Debugger.log('unknown update type :' + event.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.CanvasView'); } @@ -183,6 +186,14 @@ dispatchEvent({type:'load',target:this}); } + private function drawAll(objArr:Array, model:Observable){ + Debugger.log("drawing all: " + objArr.length + " model: " + model, Debugger.CRITICAL, "drawAll", "CanvasView"); + + for (var i=0; i