Package org.apache.pivot.beans

Examples of org.apache.pivot.beans.BXMLSerializer


    private Window window = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        this.window = (Window)bxmlSerializer.readObject(HelloBXML.class, "hello.bxml");
        this.window.open(display);
    }
View Full Code Here


    private PushButton openFileButton = null;


    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window) bxmlSerializer.readObject(getClass().getResource("pivot_832.bxml"));
        bxmlSerializer.bind(this, Pivot832.class);

        selectFolderButton.getButtonPressListeners().add(new ButtonPressListener() {
            @Override
            public void buttonPressed(Button button) {
                final FileBrowserSheet fileBrowserSheet = new FileBrowserSheet();
View Full Code Here

        // 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);
View Full Code Here

     */
    private Window loadWindow(String fileName, final BXMLSerializer bxmlSerializer)
        throws SerializationException, IOException {
        logObject("loadWindow from \"" + fileName + "\", with the serializer " + bxmlSerializer);

        BXMLSerializer serializer = bxmlSerializer;
        if (serializer == null) {
            serializer = new BXMLSerializer();
        }

        // return (Window)bxmlSerializer.readObject(JavascriptConsoleTest.class, fileName); // ok
        // better, to allow usage of resources (without having to call setLocation or setResources in the serializer) ...
        return (Window)serializer.readObject(JavascriptConsoleTest.class, fileName, true);
    }
View Full Code Here

     * @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) {
View Full Code Here

public class Pivot835 extends Application.Adapter
{
    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        Window window = (Window) bxmlSerializer.readObject(getClass().getResource("pivot_835.bxml"));
        window.open(display);
    }
View Full Code Here

        Prompt.prompt(about, this.window);
    }

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        this.window = (Window)bxmlSerializer.readObject(KitchenSink.class, "kitchen_sink.bxml");
        bxmlSerializer.bind(this, KitchenSink.class);

        this.infoRollup = (Rollup)bxmlSerializer.getNamespace().get("infoRollup");
        this.infoRollup.getRollupStateListeners().add(new InfoRollupStateHandler());

        this.buttonsRollup = (Rollup)bxmlSerializer.getNamespace().get("buttonsRollup");
        this.buttonsRollup.getRollupStateListeners().add(new ButtonsRollupStateHandler());

        this.listsRollup = (Rollup)bxmlSerializer.getNamespace().get("listsRollup");
        this.listsRollup.getRollupStateListeners().add(new ListsRollupStateHandler());

        this.textRollup = (Rollup)bxmlSerializer.getNamespace().get("textRollup");
        this.textRollup.getRollupStateListeners().add(new TextRollupStateHandler());

        this.calendarsRollup = (Rollup)bxmlSerializer.getNamespace().get("calendarsRollup");
        this.calendarsRollup.getRollupStateListeners().add(new CalendarsRollupStateHandler());

        this.colorChoosersRollup = (Rollup)bxmlSerializer.getNamespace().get("colorChoosersRollup");
        this.colorChoosersRollup.getRollupStateListeners().add(new ColorChoosersRollupStateHandler());

        this.navigationRollup = (Rollup)bxmlSerializer.getNamespace().get("navigationRollup");
        this.navigationRollup.getRollupStateListeners().add(new NavigationRollupStateHandler());

        this.splittersRollup = (Rollup)bxmlSerializer.getNamespace().get("splittersRollup");
        this.splittersRollup.getRollupStateListeners().add(new SplittersRollupStateHandler());

        this.menusRollup = (Rollup)bxmlSerializer.getNamespace().get("menusRollup");
        this.menusRollup.getRollupStateListeners().add(new MenusRollupStateHandler());

        this.metersRollup = (Rollup)bxmlSerializer.getNamespace().get("metersRollup");
        this.metersRollup.getRollupStateListeners().add(new MetersRollupStateHandler());

        this.spinnersRollup = (Rollup)bxmlSerializer.getNamespace().get("spinnersRollup");
        this.spinnersRollup.getRollupStateListeners().add(new SpinnersRollupStateHandler());

        this.tablesRollup = (Rollup)bxmlSerializer.getNamespace().get("tablesRollup");
        this.tablesRollup.getRollupStateListeners().add(new TablesRollupStateHandler());

        this.treesRollup = (Rollup)bxmlSerializer.getNamespace().get("treesRollup");
        this.treesRollup.getRollupStateListeners().add(new TreesRollupStateHandler());

        this.dragDropRollup = (Rollup)bxmlSerializer.getNamespace().get("dragDropRollup");
        this.dragDropRollup.getRollupStateListeners().add(new DragDropRollupStateHandler());

        this.alertsRollup = (Rollup)bxmlSerializer.getNamespace().get("alertsRollup");
        this.alertsRollup.getRollupStateListeners().add(new AlertsRollupStateHandler());

        this.window.open(display);

        // Start with the "Info" rollup expanded
View Full Code Here

    private Window window = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(NamespaceTest.class, "namespace_test.bxml");
        System.out.println(JSON.get(bxmlSerializer.getNamespace(), "content.text"));
        System.out.println(JSON.get(bxmlSerializer.getNamespace(), "content['text']"));
        window.open(display);
    }
View Full Code Here

        String forceFocusParameter = properties.get(FORCE_FOCUS_KEY);
        boolean forceFocus = false;
        forceFocus = Boolean.parseBoolean(forceFocusParameter);

        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(this.getClass(), "pivot_686.bxml");
        initializeFields(bxmlSerializer);
        window.open(display);

        if (forceFocus == true) {
            System.out.println("force focus on textInput now");
View Full Code Here

                    //
                    // Note that this has been moved to another issue, but the problem is due to the usage
                    // of dataRenderer tags (and then instancing ButtonDataRenderer) in the loaded bxml,
                    // so probably even this test will be updated ...
                    //
                    final GridPane grid = (GridPane) new BXMLSerializer().readObject(Pivot894.class, "btn_grid.bxml");

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Iterator<Component> iterator = cardPane.iterator();
View Full Code Here

TOP

Related Classes of org.apache.pivot.beans.BXMLSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.