Author: jbeard
Date: Mon Jun 28 21:27:20 2010
New Revision: 958748

URL: http://svn.apache.org/viewvc?rev=958748&view=rev
Log:
Added svg text to be used as indicators of state for individual object.

Modified:
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xml

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml?rev=958748&r1=958747&r2=958748&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xhtml
 Mon Jun 28 21:27:20 2010
@@ -96,6 +96,8 @@ own state.
                                        
elementButton.addEventListener("click",function(e){
 
                                                //do DOM stuff- create new blue 
circle
+                                               var newGNode = 
document.createElementNS(SVG_NS,"g"); 
+                                               var newTextNode = 
document.createElementNS(SVG_NS,"text"); 
                                                var newNode = 
document.createElementNS(SVG_NS,"circle"); 
                                                
newNode.setAttributeNS(null,"cx",50);
                                                
newNode.setAttributeNS(null,"cy",50);
@@ -103,20 +105,23 @@ own state.
                                                
newNode.setAttributeNS(null,"fill",get_random_color());
                                                
newNode.setAttributeNS(null,"stroke","black");
 
+                                               newGNode.appendChild(newNode);
+                                               
newGNode.appendChild(newTextNode);
+
                                                var compiledStatechartInstance 
= new compiledStatechartConstructor(); 
 
                                                //initialize
                                                
compiledStatechartInstance.initialize();
                                                
                                                //pass in reference to rect
-                                               
compiledStatechartInstance.init({rawNode:newNode}); 
+                                               
compiledStatechartInstance.init({rawNode:newGNode,textNode:newTextNode}); 
 
                                                //hook up DOM events
                                                
["mousedown","mouseup","mousemove"].forEach(function(eventName){
-                                                       
newNode.addEventListener(eventName,compiledStatechartInstance[eventName],false);
+                                                       
newGNode.addEventListener(eventName,compiledStatechartInstance[eventName],false);
                                                });
 
-                                               svgCanvas.appendChild(newNode);
+                                               svgCanvas.appendChild(newGNode);
                                        },false);
                                }
                        );

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xml?rev=958748&r1=958747&r2=958748&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xml
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/demo/drag-and-drop/drag-and-drop2.xml
 Mon Jun 28 21:27:20 2010
@@ -30,11 +30,14 @@
                <data id="eventStamp"/>
                <data id="tDelta"/>
                <data id="rawNode"/>
+               <data id="textNode"/>
        </datamodel>
 
        <state id="initial_default">
                <transition event="init" target="idle">
                        <assign location="rawNode" expr="_event.data.rawNode"/>
+                       <assign location="textNode" 
expr="_event.data.textNode"/>
+                       <assign location="textNode.textContent" expr="'idle'"/> 
                </transition>
        </state>
 
@@ -42,11 +45,14 @@
                <transition event="mousedown" target="dragging">
                        <assign location="firstEvent" expr="_event.data"/>
                        <assign location="eventStamp" expr="_event.data"/>
+                       <assign location="textNode.textContent" 
expr="'dragging'"/>     
                </transition>
        </state>
 
        <state id="dragging">
-               <transition event="mouseup" target="idle"/>
+               <transition event="mouseup" target="idle">
+                       <assign location="textNode.textContent" expr="'idle'"/> 
+               </transition>
 
                <transition event="mousemove" target="dragging">
                        <assign location="tDelta" 
expr="computeTDelta(eventStamp,_event.data)"/>


Reply via email to