Package org.apache.pivot.beans

Examples of org.apache.pivot.beans.BXMLSerializer


                    ApplicationContext.queueCallback(new Runnable() {
                        @Override
                        public void run() {
                            Window window = null;
                            try {
                                window = (Window) new BXMLSerializer().readObject(
                                        this.getClass().getResource("splash.bxml"));
                            } catch (Exception e) {
                                throw new RuntimeException(e);
                            }
                            if (window != null) {
View Full Code Here


    public static final String WINDOW_TITLE = "JSON Viewer";

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        bxmlSerializer.getNamespace().put(APPLICATION_KEY, this);

        window = (Window)bxmlSerializer.readObject(JSONViewer.class, "json_viewer.bxml");
        bxmlSerializer.bind(this);

        Label prompt = new Label("Drag or paste JSON here");
        prompt.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
        prompt.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
        promptDecorator.setOverlay(prompt);
View Full Code Here

public class SaturationDecoratorTest extends Application.Adapter {
    private Window window = null;

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

        window.open(display);
    }
View Full Code Here

        }

        @Override
        public Vote previewExpandedChange(Rollup rollup) {
            if (this.component == null) {
                BXMLSerializer bxmlSerializer = new BXMLSerializer();
                try {
                    this.component = (Component)bxmlSerializer.readObject(KitchenSink.class, "alerts.bxml");
                } catch(IOException exception) {
                    throw new RuntimeException(exception);
                } catch(SerializationException exception) {
                    throw new RuntimeException(exception);
                }

                this.alertButton = (PushButton)bxmlSerializer.getNamespace().get("alertButton");
                this.promptButton = (PushButton)bxmlSerializer.getNamespace().get("promptButton");
                this.messageTypeGroup = (ButtonGroup)bxmlSerializer.getNamespace().get("messageTypeGroup");

                rollup.setContent(this.component);

                this.alertButton.getButtonPressListeners().add(new ButtonPressListener() {
                    @Override
                    public void buttonPressed(Button button) {
                        Button selection = AlertsRollupStateHandler.this.messageTypeGroup.getSelection();

                        Map<String, ?> userData;
                        try {
                            userData = JSONSerializer.parseMap((String)selection.getUserData().get("messageInfo"));
                        } catch (SerializationException exception) {
                            throw new RuntimeException(exception);
                        }

                        String messageType = (String)userData.get("messageType");

                        if (messageType == null) {
                            ArrayList<String> options = new ArrayList<String>();
                            options.add("OK");
                            options.add("Cancel");

                            Component body = null;
                            BXMLSerializer serializer = new BXMLSerializer();
                            try {
                                body = (Component)serializer.readObject(KitchenSink.class, "alert.bxml");
                            } catch(Exception exception) {
                                System.err.println(exception);
                            }

                            Alert alert = new Alert(MessageType.QUESTION, "Please select your favorite icon:",
                                options, body);
                            alert.setTitle("Select Icon");
                            alert.setSelectedOptionIndex(0);
                            alert.getDecorators().update(0, new ReflectionDecorator());
                            alert.open(KitchenSink.this.window);
                        } else {
                            String message = (String)userData.get("message");
                            Alert.alert(MessageType.valueOf(messageType.toUpperCase()), message, KitchenSink.this.window);
                        }
                    }
                });

                this.promptButton.getButtonPressListeners().add(new ButtonPressListener() {
                    @Override
                    public void buttonPressed(Button button) {
                        Button selection = AlertsRollupStateHandler.this.messageTypeGroup.getSelection();

                        Map<String, ?> userData;
                        try {
                            userData = JSONSerializer.parseMap((String)selection.getUserData().get("messageInfo"));
                        } catch (SerializationException exception) {
                            throw new RuntimeException(exception);
                        }

                        String messageType = (String)userData.get("messageType");

                        if (messageType == null) {
                            ArrayList<String> options = new ArrayList<String>();
                            options.add("OK");
                            options.add("Cancel");

                            Component body = null;
                            BXMLSerializer serializer = new BXMLSerializer();
                            try {
                                body = (Component)serializer.readObject(KitchenSink.class, "alert.bxml");
                            } catch(Exception exception) {
                                System.err.println(exception);
                            }

                            Prompt prompt = new Prompt(MessageType.QUESTION, "Please select your favorite icon:",
View Full Code Here

        cancelImage = Image.load(getClass().getResource("bullet_cross.png"));
    }

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        bxmlSerializer.getNamespace().put(APPLICATION_KEY, this);

        window = (Window)bxmlSerializer.readObject(SearchDemo.class, "search_demo.bxml");
        bxmlSerializer.bind(this, SearchDemo.class);

        searchButton.setButtonData(searchImage);
        window.open(display);

        termTextInput.requestFocus();
View Full Code Here

    private Window menu = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();

        System.out.println("Double Click on Table elements to open the Row Editor");

        window = (Window)bxmlSerializer.readObject(TableViewTest2.class, "table_view_test2.bxml");
        tableView = (TableView)bxmlSerializer.getNamespace().get("tableView");
        menu = (Window)bxmlSerializer.readObject(TableViewTest2.class, "context_menus.bxml");

        tableView.setMenuHandler(new ContextMenusSampleMenuHandlerAdapter());
        System.out.println("Right  Click on Table elements to display Contextual Menu: " + menu);

        TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
View Full Code Here

    public static TestDialog create() {
        System.out.println("TestDialog create()");
        TestDialog dialog = null;
        try {
            BXMLSerializer bxmlSerializer = new BXMLSerializer();
            dialog = (TestDialog) bxmlSerializer.readObject(TestDialog.class, DIALOG_MARKUP_FILE);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SerializationException e) {
            e.printStackTrace();
        }
View Full Code Here

    public MenuBars() {
        Action.getNamedActions().put("fileNew", new Action() {
            @Override
            public void perform(Component source) {
                BXMLSerializer bxmlSerializer = new BXMLSerializer();
                bxmlSerializer.getNamespace().put("menuHandler", menuHandler);

                Component tab;
                try {
                    tab = new Border((Component)bxmlSerializer.readObject(MenuBars.class, "document.bxml"));
                } catch (IOException exception) {
                    throw new RuntimeException(exception);
                } catch (SerializationException exception) {
                    throw new RuntimeException(exception);
                }
View Full Code Here

    int dialogTest = 0;

    public static LeakTestWindow create() throws IOException, SerializationException {
        System.out.println("LeakTestWindow create()");
        return (LeakTestWindow) new BXMLSerializer().readObject(LeakTestWindow.class, MARKUP_FILE);
    }
View Full Code Here

    private ListButton listButton = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        BoxPane boxPane = (BoxPane)bxmlSerializer.readObject(ColorListButtonTest.class,
            "color_list_button_test.bxml");
        listButton = (ListButton)bxmlSerializer.getNamespace().get("listButton");
        // test the getListPopup() method
        listButton.getListPopup().getDecorators().add(new ReflectionDecorator());

        frame = new Frame(boxPane);
        frame.setTitle("Color List Button Test");
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.