Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIVOT-949: merge from trunk for first part of the fix (add the fallba…
…ck, but without Java 7 specific features here) git-svn-id: https://svn.apache.org/repos/asf/pivot/branches/2.0.x@1690105 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Sandro Martini
committed
Jul 9, 2015
1 parent
49b5b01
commit dd4c90b
Showing
4 changed files
with
146 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/src/org/apache/pivot/tests/issues/pivot949/Pivot949.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.pivot.tests.issues.pivot949; | ||
|
||
import org.apache.pivot.beans.BXMLSerializer; | ||
import org.apache.pivot.collections.Map; | ||
import org.apache.pivot.wtk.Application; | ||
import org.apache.pivot.wtk.DesktopApplicationContext; | ||
import org.apache.pivot.wtk.Display; | ||
import org.apache.pivot.wtk.Window; | ||
|
||
public class Pivot949 extends Application.Adapter { | ||
|
||
private Window window = null; | ||
|
||
@Override | ||
public void startup(Display display, Map<String, String> properties) throws Exception { | ||
System.out.println("Pivot949 startup(...)"); | ||
System.out.println("\n" | ||
+ "Note that this issue is related to include scripts (with absolute path) " | ||
+ "from a bxml file.\n" | ||
+ "Here we'll test both relative and absolute scripts.\n" | ||
+ "\n"); | ||
|
||
BXMLSerializer bxmlSerializer = new BXMLSerializer(); | ||
window = (Window) bxmlSerializer.readObject(Pivot949.class, "pivot_949.bxml"); | ||
System.out.println("got window = " + window); | ||
window.open(display); | ||
} | ||
|
||
@Override | ||
public boolean shutdown(boolean b) throws Exception { | ||
if (window != null) { | ||
window.close(); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public static void main(String[] args) { | ||
DesktopApplicationContext.main(Pivot949.class, args); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to you under the Apache License, | ||
Version 2.0 (the "License"); you may not use this file except in | ||
compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<Window title="Pivot-949" maximized="true" | ||
bxml:id="window" | ||
xmlns:bxml="http://pivot.apache.org/bxml" | ||
xmlns:app="org.apache.pivot.tests.issues" | ||
xmlns:content="org.apache.pivot.wtk.content" | ||
xmlns="org.apache.pivot.wtk" | ||
> | ||
|
||
<!-- <bxml:script src="utilities_script.js"/> // ok if it's in the same package/folder --> | ||
<!-- <bxml:script src="../../utilities_script.js"/> // ok with a relative package/folder --> | ||
<bxml:script src="../../utilities_script.js"/> | ||
|
||
<bxml:script> | ||
<![CDATA[ | ||
// just as a sample, to use the JavaScript just defined in the included file ... | ||
log("inline script 1 - just loaded a script with a relative URI"); | ||
var nextURI = '/pivot_949.js'; | ||
log("inline script 1 - now try to load another script, but with an absolute URI '" | ||
+ nextURI + "' ..."); | ||
]]> | ||
</bxml:script> | ||
|
||
|
||
<!-- <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 ... --> | ||
|
||
<Label text="$foo"/> | ||
|
||
<bxml:script> | ||
<![CDATA[ | ||
// just as a sample, to use the JavaScript just defined in the included file ... | ||
log("inline script 2 - all is ok"); | ||
]]> | ||
</bxml:script> | ||
|
||
</Window> |
23 changes: 23 additions & 0 deletions
23
tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
importPackage(java.lang); // required to use System.out and System.err | ||
importPackage(org.apache.pivot.collections); // required to use Pivot class ArrayList and other collections | ||
importPackage(org.apache.pivot.util); // required to use Pivot Utility class Console | ||
importPackage(org.apache.pivot.wtk); // required to use Pivot WTK classes | ||
|
||
|
||
var foo = 'Hello from JavaScript in the JVM'; |