Revision: 4560
          http://sourceforge.net/p/vexi/code/4560
Author:   mkpg2
Date:     2013-10-02 21:47:04 +0000 (Wed, 02 Oct 2013)
Log Message:
-----------
Feature.  <lang:apply property="...">...</lang:apply>
- setting the property means the instantiated object is added as a property not 
a child.
- can post-apply to an existing child property using this mechanism
- It is intended that in vexi4 the equivalent functionality will be achieved via
  <+...>...</+...>
 

Modified Paths:
--------------
    branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VML.java
    
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VMLBuilder.java
    
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/TestTemplate.java
    trunk/_ebuild/seed/version
    trunk/org.vexi-build.shared/meta/module.revisions
    trunk/org.vexi-build.shrink/build.xml

Added Paths:
-----------
    
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_child.t
    
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_prop.t

Removed Paths:
-------------
    branches/vexi3/org.vexi-core.main/src/main/java/gnu/gcj/
    
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply.t

Modified: branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VML.java
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VML.java      
2013-09-20 16:16:22 UTC (rev 4559)
+++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VML.java      
2013-10-02 21:47:04 UTC (rev 4560)
@@ -121,7 +121,7 @@
             Object script = null;              ///< the script on this node
 
             List children = null;              ///< during XML parsing, this 
holds the list of currently-parsed children; null otherwise
-            Map subtemplates = null;          ///< sub templates to be 
assigned to properties, not applied on creation
+            Map childProps = null;             ///< apply+property + sub 
templates to be assigned to properties
             Object preapply = null;            ///< Pre-applied template 
(~linked list) in root node only (unless lang:apply)
             Object principal = null;           ///< Template to be applied
             
@@ -150,9 +150,9 @@
                                children.add(template);
                        }
                        
-                       void addSubTemplate(String property, Template template) 
{
-                               if(subtemplates==null) subtemplates = new 
LinkedHashMap(); 
-                               subtemplates.put(JSU.S(property), template);
+                       void addChildProp(String property, SubTemplate 
template) {
+                               if(childProps==null) childProps = new 
LinkedHashMap(); 
+                               childProps.put(JSU.S(property), template);
                        }
                        
             // Methods to apply templates 
////////////////////////////////////////////////////////
@@ -231,13 +231,22 @@
                         Main.SCHEDULER.putAndTriggerTraps(this_, ind, 
kidHolder[0]);
                     }
                     
-                    if(subtemplates!=null){
-                       Iterator I = subtemplates.keySet().iterator();
+                    if(childProps!=null){
+                       Iterator I = childProps.keySet().iterator();
                        while(I.hasNext()){
                                JS property = (JS)I.next();
-                               Template subTemplate = 
(Template)subtemplates.get(property);
-                               SubBlessing subBlessing = new SubBlessing(pis, 
property, subTemplate);
-                               Main.SCHEDULER.putAndTriggerTraps(this_, 
property, subBlessing);                
+                               SubTemplate subTemplate = 
(SubTemplate)childProps.get(property);
+                               JS value;
+                               if(subTemplate.apply){
+                                       JS[] kidHolder = new JS[1];
+                                       kidHolder[0] = 
Main.SCHEDULER.getAndTriggerTraps(this_,property);
+                                subTemplate.template.apply(kidHolder, null, 
idContextParent, pis.idContext);
+                                       value = kidHolder[0];
+                               }else{
+                                       value = new SubBlessing(pis, property, 
subTemplate.template);
+                                               
+                               }
+                               Main.SCHEDULER.putAndTriggerTraps(this_, 
property, value);              
                        }                       
                     }
 

Modified: 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VMLBuilder.java
===================================================================
--- 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VMLBuilder.java   
    2013-09-20 16:16:22 UTC (rev 4559)
+++ 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/core/VMLBuilder.java   
    2013-10-02 21:47:04 UTC (rev 4560)
@@ -479,16 +479,15 @@
                t = (Template)cb;
                if(oldCb instanceof SubTemplate){
                        SubTemplate oldSt = (SubTemplate)oldCb;
-                       if(oldSt.apply){
-                               assert(state==STATE_IN_APPLY_NODE);
-                               t.addChild(oldSt.template);
-                       }else{
-                               assert(state==STATE_IN_SUB_TEMPLATE_NODE);
-                               int propI = c.getAttributes().getIndex(null, 
"property");
-                               String prop = c.getAttributes().getVal(propI);
-                               if(prop==null) throw e("Sub Template node 
expects property");
-                               t.addSubTemplate(prop, oldSt.template);
-                       }
+                               int propI = c.getAttributes().getIndex(null, 
"property");
+                               String prop = c.getAttributes().getVal(propI);
+                               if(prop==null){
+                                       if(!oldSt.apply)
+                                       throw e("Sub Template node expects 
property");
+                        t.addChild(oldSt.template);                            
+                               }else{
+                                       t.addChildProp(prop, oldSt);
+                               }
                }else{
                        t.addChild((Template)oldCb);
                }

Modified: 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/TestTemplate.java
===================================================================
--- 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/TestTemplate.java
        2013-09-20 16:16:22 UTC (rev 4559)
+++ 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/TestTemplate.java
        2013-10-02 21:47:04 UTC (rev 4560)
@@ -16,8 +16,8 @@
     public static void main(String[] args) throws Throwable {
 
        CoreTestSuite cts = new CoreTestSuite(TestTemplate.class);
-//     TestCase t = cts.createTestCase(cts.getResourceDirs(), "lang_apply.t");
-       TestCase t = cts.createTestCase(cts.getResourceDirs(), 
"lang_subtemplate_ids.t");
+       TestCase t = cts.createTestCase(cts.getResourceDirs(), 
"lang_apply_prop.t");
+//     TestCase t = cts.createTestCase(cts.getResourceDirs(), 
"lang_subtemplate_ids.t");
        t.runBare();
        }
 }

Deleted: 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply.t
===================================================================
--- 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply.t 
    2013-09-20 16:16:22 UTC (rev 4559)
+++ 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply.t 
    2013-10-02 21:47:04 UTC (rev 4560)
@@ -1,20 +0,0 @@
-<vexi xmlns:ui="vexi://ui" xmlns:lang="vexi://lang">
-
-
-    <ui:box>
-        <lang:apply>
-            <ui:box a="1"/>
-            <ui:box b="2"/>
-            <ui:box c="3">
-                thisbox.d ++= function(){   
-                    return a + b + c;
-                };
-            </ui:box>
-        </lang:apply>
-        .util..assertEquals(1,thisbox[0].a);
-        .util..assertEquals(2,thisbox[0].b);
-        .util..assertEquals(3,thisbox[0].c);
-        .util..assertEquals(6,thisbox[0].d);
-    </ui:box>
-    
-</vexi>

Copied: 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_child.t
 (from rev 4548, 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply.t)
===================================================================
--- 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_child.t
                               (rev 0)
+++ 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_child.t
       2013-10-02 21:47:04 UTC (rev 4560)
@@ -0,0 +1,20 @@
+<vexi xmlns:ui="vexi://ui" xmlns:lang="vexi://lang">
+
+
+    <ui:box>
+        <lang:apply>
+            <ui:box a="1"/>
+            <ui:box b="2"/>
+            <ui:box c="3">
+                thisbox.d ++= function(){   
+                    return a + b + c;
+                };
+            </ui:box>
+        </lang:apply>
+        .util..assertEquals(1,thisbox[0].a);
+        .util..assertEquals(2,thisbox[0].b);
+        .util..assertEquals(3,thisbox[0].c);
+        .util..assertEquals(6,thisbox[0].d);
+    </ui:box>
+    
+</vexi>

Added: 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_prop.t
===================================================================
--- 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_prop.t
                                (rev 0)
+++ 
branches/vexi3/org.vexi-core.main/src/test/java/test/core/template/lang_apply_prop.t
        2013-10-02 21:47:04 UTC (rev 4560)
@@ -0,0 +1,22 @@
+<vexi xmlns:ui="vexi://ui" xmlns:lang="vexi://lang">
+
+
+    <ui:box>
+        <lang:apply property="sub">
+            <ui:box a="1"/>
+            <ui:box b="2"/>
+        </lang:apply>
+        .util..assertEquals(1,thisbox.sub.a);
+        .util..assertEquals(2,thisbox.sub.b);
+        .util..assertEquals(null,thisbox.sub.c);
+    </ui:box>
+    <ui:box>
+        <lang:apply property="sub">
+            <ui:box a="4"/>
+            <ui:box c="3"/>
+        </lang:apply>
+        .util..assertEquals(4,thisbox.sub.a);
+        .util..assertEquals(2,thisbox.sub.b);
+        .util..assertEquals(3,thisbox.sub.c);    
+    </ui:box>
+</vexi>

Modified: trunk/_ebuild/seed/version
===================================================================
--- trunk/_ebuild/seed/version  2013-09-20 16:16:22 UTC (rev 4559)
+++ trunk/_ebuild/seed/version  2013-10-02 21:47:04 UTC (rev 4560)
@@ -1,2 +1,2 @@
 #nofetch=true
-tag=0.8.4
+tag=0.8.6

Modified: trunk/org.vexi-build.shared/meta/module.revisions
===================================================================
--- trunk/org.vexi-build.shared/meta/module.revisions   2013-09-20 16:16:22 UTC 
(rev 4559)
+++ trunk/org.vexi-build.shared/meta/module.revisions   2013-10-02 21:47:04 UTC 
(rev 4560)
@@ -1 +1 @@
-{"https:\/\/ebuild-project.org\/svn\/ebuild\/plugins":"120"}
\ No newline at end of file
+{"https:\/\/ebuild-project.org\/svn\/ebuild\/plugins":"142"}
\ No newline at end of file

Modified: trunk/org.vexi-build.shrink/build.xml
===================================================================
--- trunk/org.vexi-build.shrink/build.xml       2013-09-20 16:16:22 UTC (rev 
4559)
+++ trunk/org.vexi-build.shrink/build.xml       2013-10-02 21:47:04 UTC (rev 
4560)
@@ -1,5 +1,5 @@
 <project default="eclipse_setup">
-    <property name="project" location="."/>
+    <property name="project-dir" location="."/>
 
        <property name="ebuild.home" location="../_ebuild"/>
     <import file="${ebuild.home}/interface/workspace.ent"/>

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


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to