Revision: 2401
          http://vexi.svn.sourceforge.net/vexi/?rev=2401&view=rev
Author:   mkpg2
Date:     2007-10-01 17:54:34 -0700 (Mon, 01 Oct 2007)

Log Message:
-----------
Development. 
  -Workflow locks holder
  -Small changes.

Modified Paths:
--------------
    trunk/widgets/org.vexi.workflow/src/vexi/workflow/holder.t
    trunk/widgets/org.vexi.workflow/src/vexi/workflow/state.t
    trunk/widgets/org.vexi.workflow/src/vexi/workflow/workflow.t
    trunk/widgets/org.vexi.workflow/src_vunit/test/workflow.t

Modified: trunk/widgets/org.vexi.workflow/src/vexi/workflow/holder.t
===================================================================
--- trunk/widgets/org.vexi.workflow/src/vexi/workflow/holder.t  2007-10-02 
00:50:23 UTC (rev 2400)
+++ trunk/widgets/org.vexi.workflow/src/vexi/workflow/holder.t  2007-10-02 
00:54:34 UTC (rev 2401)
@@ -3,11 +3,21 @@
 <vexi xmlns:ui="vexi://ui" >
    
    <ui:box>
-       thisbox.lock;
+       var locked = null;
+       thisbox.lock = function(locker){
+           if(locked and locked!=locker) throw "already locked by someone 
else";
+           locked = locker;
+       };
+       
+       thisbox.unlock = function(unlocker){
+           if(locked and locked!=unlocker) throw "not locked by unlocker";
+           locked = null;
+       };
+       
        // Position in children 
        thisbox.Children ++= function(c){
            if(c){
-               if(lock) throw "trying to change holder, whilst holder locked";
+               if(locked) throw "trying to change child, whilst holder locked";
                // FEATURE - children at higher indexes as a holder queue? 
                if(trapname!=0) throw "added child to non-0 location of holder";
                while(numchildren)thisbox[0] = null;

Modified: trunk/widgets/org.vexi.workflow/src/vexi/workflow/state.t
===================================================================
--- trunk/widgets/org.vexi.workflow/src/vexi/workflow/state.t   2007-10-02 
00:50:23 UTC (rev 2400)
+++ trunk/widgets/org.vexi.workflow/src/vexi/workflow/state.t   2007-10-02 
00:54:34 UTC (rev 2401)
@@ -12,6 +12,8 @@
    <ui:box v_state="true">
        
        thisbox.transitions = {};
+       thisbox.handler;
+       thisbox.view;
        
        // capture states
        Children ++= function(c){

Modified: trunk/widgets/org.vexi.workflow/src/vexi/workflow/workflow.t
===================================================================
--- trunk/widgets/org.vexi.workflow/src/vexi/workflow/workflow.t        
2007-10-02 00:50:23 UTC (rev 2400)
+++ trunk/widgets/org.vexi.workflow/src/vexi/workflow/workflow.t        
2007-10-02 00:54:34 UTC (rev 2401)
@@ -8,6 +8,8 @@
     };
     
    <ui:box v_workflow="true">
+       if(arguments[0]==null) throw "arguments[0] is null, should be holder";
+       
        thisbox.holder = arguments[0];
        thisbox.startstate;
        thisbox.state;
@@ -32,8 +34,10 @@
                // check, states with no handler/no view will never exit
                if(!s) active = false;
                else if(!handler and !view) throw "cannot transition to state, 
no view and no handler";
+               holder.unlock(thisbox);
                if(view) holder[0] = view(vexi.box,[thisbox,event]);
                else if(holder[0]) holder[0] = null;
+               if(s) holder.lock(thisbox);
                if(handler) handler(thisbox,event);
                
            };

Modified: trunk/widgets/org.vexi.workflow/src_vunit/test/workflow.t
===================================================================
--- trunk/widgets/org.vexi.workflow/src_vunit/test/workflow.t   2007-10-02 
00:50:23 UTC (rev 2400)
+++ trunk/widgets/org.vexi.workflow/src_vunit/test/workflow.t   2007-10-02 
00:54:34 UTC (rev 2401)
@@ -42,6 +42,30 @@
         
     };
     
+    
+    suite.testLastEvent = function(){
+        var holder = .holder(vexi.box);
+        var wf = eg(vexi.box,[holder]);
+        var rec = "";
+        var exns = [];
+        wf.states["A"].handler = 
+            function(workflow, event){
+                asyncAssert(exns,"[start]",workflow.event.name);
+                workflow.event = "toC";
+                rec += "A";
+            };
+        wf.states["C"].handler = 
+            function(workflow, event){
+                asyncAssert(exns,"toC",workflow.event.name);
+                workflow.event = "exit";
+                rec += "C";
+            };
+        asyncCheckAsserts(exns);
+        wf.startAndWait();    
+        vunit..assertEquals("AC",rec);
+        
+    };
+    
     suite.testToSelf = function(){
         var holder = .holder(vexi.box);
         var wf = eg(vexi.box,[holder]);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to