You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2015/07/13 15:01:02 UTC

svn commit: r1690662 - in /pivot/branches/2.0.x: core/src/org/apache/pivot/beans/BXMLSerializer.java tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml

Author: smartini
Date: Mon Jul 13 13:01:02 2015
New Revision: 1690662

URL: http://svn.apache.org/r1690662
Log:
PIVOT-949: merge from trunk for second part of the fix (enhancement, add the ability to specify a bxml file as src even from a script variable)

Modified:
    pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml

Modified: pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1690662&r1=1690661&r2=1690662&view=diff
==============================================================================
--- pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java (original)
+++ pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java Mon Jul 13 13:01:02 2015
@@ -1332,6 +1332,17 @@ public class BXMLSerializer implements S
                     src = element.properties.get(SCRIPT_SRC_ATTRIBUTE);
                 }
 
+                if (src != null && src.charAt(0) == OBJECT_REFERENCE_PREFIX) {
+                    src = src.substring(1);
+                    if (src.length() > 0) {
+                        if (!JSON.containsKey(namespace, src)) {
+                            throw new SerializationException("Value \"" + src + "\" is not defined.");
+                        }
+                        String variableValue = JSON.get(namespace, src);
+                        src = variableValue;
+                    }
+                }
+
                 if (src != null) {
                     int i = src.lastIndexOf(".");
                     if (i == -1) {

Modified: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml?rev=1690662&r1=1690661&r2=1690662&view=diff
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml (original)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml Mon Jul 13 13:01:02 2015
@@ -42,8 +42,8 @@ limitations under the License.
 
     <!-- <bxml:script src="pivot_949.js"/> // ok if it's in the same package/folder -->
     <!-- <bxml:script src="./pivot_949.js"/> // ok if it's in the same package/folder -->
-    <bxml:script src="/pivot_949.js"/>
-    <!-- <bxml:script src="$nextURI"/>  // TODO: later ... -->
+    <!-- <bxml:script src="/pivot_949.js"/>  // ok with PIVOT-949, first part of the fix -->
+    <bxml:script src="$nextURI"/>  <!-- // ok with PIVOT-949, second part of the fix -->
 
     <Label text="$foo"/>