use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class GridPaneTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(GridPaneTest.class, "gridpane_test.bxml");
window.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class HyperlinkButtonTest2 method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer serializer = new BXMLSerializer();
frame = (Frame) serializer.readObject(new ByteArrayInputStream(bxmlFile.getBytes()));
frame.open(display);
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class JavascriptConsoleTest method loadWindowFromURL.
/**
* Load (and returns) a Window, given its URL and serializer to use <p> Note
* that if public this method could be called even from JS in a bxml file
* (but a reference to the current application has to be put in serializer
* namespace). <p> Note that all Exceptions are catched inside this method,
* to not expose them to JS code.
*
* @param urlString the URL of the bxml file to load, as a String
* @param bxmlSerializer the serializer to use, or if null a new one will be created
* @return the Window instance
*/
public Window loadWindowFromURL(String urlString, final BXMLSerializer bxmlSerializer) {
logObject("loadWindow from \"" + urlString + "\", with the serializer " + bxmlSerializer);
BXMLSerializer serializer = bxmlSerializer;
if (serializer == null) {
serializer = new BXMLSerializer();
}
Window loadedWindow = null;
try {
URL url = new URL(urlString);
// force the location, so it will be possible to decode resources
// like labels ...
serializer.setLocation(url);
loadedWindow = (Window) serializer.readObject(url);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (SerializationException e) {
e.printStackTrace();
}
return loadedWindow;
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class JavascriptConsoleTest method startup.
@Override
public void startup(Display displayArgument, Map<String, String> properties) throws Exception {
logObject("startup: start");
this.display = displayArgument;
// get the locale from startup properties, or use the default
String language = properties.get(LANGUAGE_KEY);
locale = (language == null) ? Locale.getDefault() : new Locale(language);
logObject("running with the locale " + locale);
BXMLSerializer bxmlSerializer = new BXMLSerializer();
// add a reference to the application itself in bxml namespace, to be
// used by JS inside bxml files
bxmlSerializer.getNamespace().put("application", this);
logObject("put a reference to application in serializer namespace");
bxmlSerializer.getNamespace().put("mainClassName", MAIN_CLASS_NAME);
logObject("put a reference to main class name in serializer namespace \"" + MAIN_CLASS_NAME + "\"");
window = loadWindow("javascript_console_test.bxml", bxmlSerializer);
initializeFields(bxmlSerializer);
window.open(display);
logObject("startup: end");
}
use of org.apache.pivot.beans.BXMLSerializer in project pivot by apache.
the class Pivot949 method startup.
@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);
}
Aggregations