Skip to content

Commit

Permalink
PIVOT-949: merge from trunk for second part of the fix (enhancement, …
Browse files Browse the repository at this point in the history
…add the ability to specify a bxml file as src even from a script variable)

git-svn-id: https://svn.apache.org/repos/asf/pivot/branches/2.0.x@1690662 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Sandro Martini committed Jul 13, 2015
1 parent dd4c90b commit af5f597
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions core/src/org/apache/pivot/beans/BXMLSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,17 @@ private void processEndElement() throws SerializationException {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

Expand Down

0 comments on commit af5f597

Please sign in to comment.