Examples of WTKXSerializer


Examples of org.apache.pivot.wtkx.WTKXSerializer

public class BaselineTest implements Application {
    private Frame frame = null;

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        frame = new Frame((Component)wtkxSerializer.readObject(getClass().getResource("baseline_test.wtkx")));
        frame.setTitle("Baseline Test");
        // frame.setPreferredSize(480, 360);
        frame.open(display);
    }
View Full Code Here

Examples of org.apache.pivot.wtkx.WTKXSerializer

    private Frame frame = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        frame = new Frame((Component)wtkxSerializer.readObject(getClass().getResource("color_list_button_test.wtkx")));
        frame.setTitle("Color List Button Test");
        frame.setPreferredSize(480, 360);
        frame.open(display);
    }
View Full Code Here

Examples of org.apache.pivot.wtkx.WTKXSerializer

    private TextInput textinputDateRegex = null;
    private TextInput textinputCustomBoolean = null;

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = new Window((Component)wtkxSerializer.readObject(
            getClass().getResource("textInputValidator_test.wtkx")));
        textinputFloatRange = (TextInput)wtkxSerializer.get("textinputFloatRange");
        textinputIntRange = (TextInput)wtkxSerializer.get("textinputIntRange");
        textinputDateRegex = (TextInput)wtkxSerializer.get("textinputDateRegex");
        textinputCustomBoolean = (TextInput)wtkxSerializer.get("textinputCustomBoolean");

        // standard float range model
        textinputFloatRange.setText("0.5");
        textinputFloatRange.setValidator(new FloatRangeValidator(0.3f, 2000f));

        // test the listener by updating a label
        textinputFloatRange.getTextInputListeners().add(new TextInputListener() {
            @Override
            public void maximumLengthChanged(TextInput textInput, int previousMaximumLength) {
            }

            @Override
            public void passwordChanged(TextInput textInput) {
            }

            @Override
            public void promptChanged(TextInput textInput, String previousPrompt) {
            }

            @Override
            public void textKeyChanged(TextInput textInput, String previousTextKey) {
            }

            @Override
            public void textNodeChanged(TextInput textInput, TextNode previousTextNode) {
            }

            @Override
            public void textSizeChanged(TextInput textInput, int previousTextSize) {
            }

            @Override
            public void textValidChanged(TextInput textInput) {
                invalidLabel.setText(textInput.isTextValid() ? "valid" : "invalid");
            }

            @Override
            public void textValidatorChanged(TextInput textInput, Validator validator) {
            }
        });

        invalidLabel = (Label)wtkxSerializer.get("invalidLabel");

        // standard int range model
        textinputIntRange.setText("0");
        textinputIntRange.setValidator(new IntRangeValidator(0, 100));
View Full Code Here

Examples of org.apache.pivot.wtkx.WTKXSerializer

    public static final String WINDOW_TITLE = "JSON Viewer";

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

        window = (Window)wtkxSerializer.readObject(this, "json_viewer.wtkx");
        wtkxSerializer.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

Examples of org.apache.pivot.wtkx.WTKXSerializer

        private TreeView checkTreeView = null;

        @Override
        public Vote previewExpandedChange(Rollup rollup) {
            if (component == null) {
                WTKXSerializer wtkxSerializer = new WTKXSerializer();
                try {
                    component = (Component)wtkxSerializer.readObject(this, "trees.wtkx");
                } catch(IOException exception) {
                    throw new RuntimeException(exception);
                } catch(SerializationException exception) {
                    throw new RuntimeException(exception);
                }

                editableTreeView = (TreeView)wtkxSerializer.get("editableTreeView");
                checkTreeView = (TreeView)wtkxSerializer.get("checkTreeView");

                rollup.setContent(component);

                TreeBranch treeData = (TreeBranch)editableTreeView.getTreeData();
                treeData.setComparator(new TreeNodeComparator());
View Full Code Here

Examples of org.apache.pivot.wtkx.WTKXSerializer

        private ImageView imageView3 = null;

        @Override
        public Vote previewExpandedChange(Rollup rollup) {
            if (component == null) {
                WTKXSerializer wtkxSerializer = new WTKXSerializer();
                try {
                    component = (Component)wtkxSerializer.readObject(this, "dragdrop.wtkx");
                } catch(IOException exception) {
                    throw new RuntimeException(exception);
                } catch(SerializationException exception) {
                    throw new RuntimeException(exception);
                }

                imageView1 = (ImageView)wtkxSerializer.get("imageView1");
                imageView2 = (ImageView)wtkxSerializer.get("imageView2");
                imageView3 = (ImageView)wtkxSerializer.get("imageView3");

                rollup.setContent(component);

                DragSource imageDragSource = new DragSource() {
                    private Image image = null;
View Full Code Here

Examples of org.apache.pivot.wtkx.WTKXSerializer

        private ButtonGroup messageTypeGroup = null;

        @Override
        public Vote previewExpandedChange(Rollup rollup) {
            if (component == null) {
                WTKXSerializer wtkxSerializer = new WTKXSerializer();
                try {
                    component = (Component)wtkxSerializer.readObject(this, "alerts.wtkx");
                } catch(IOException exception) {
                    throw new RuntimeException(exception);
                } catch(SerializationException exception) {
                    throw new RuntimeException(exception);
                }

                alertButton = (PushButton)wtkxSerializer.get("alertButton");
                promptButton = (PushButton)wtkxSerializer.get("promptButton");
                messageTypeGroup = (ButtonGroup)wtkxSerializer.get("messageTypeGroup");

                rollup.setContent(component);

                alertButton.getButtonPressListeners().add(new ButtonPressListener() {
                    @Override
                    public void buttonPressed(Button button) {
                        Button selection = 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;
                            WTKXSerializer wtkxSerializer = new WTKXSerializer();
                            try {
                                body = (Component)wtkxSerializer.readObject(this, "alert.wtkx");
                            } 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.setSelectedOption(0);
                            alert.getDecorators().update(0, new ReflectionDecorator());
                            alert.open(window);
                        } else {
                            String message = (String)userData.get("message");
                            Alert.alert(MessageType.valueOf(messageType.toUpperCase()), message, window);
                        }
                    }
                });

                promptButton.getButtonPressListeners().add(new ButtonPressListener() {
                    @Override
                    public void buttonPressed(Button button) {
                        Button selection = 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;
                            WTKXSerializer wtkxSerializer = new WTKXSerializer();
                            try {
                                body = (Component)wtkxSerializer.readObject(this, "alert.wtkx");
                            } catch(Exception exception) {
                                System.err.println(exception);
                            }

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

Examples of org.apache.pivot.wtkx.WTKXSerializer

            Locale.setDefault(new Locale(language));
        }

        // Load and bind to the WTKX source
        Resources resources = new Resources(getClass().getName(), "UTF-8");
        WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
        window = (Window)wtkxSerializer.readObject(this, "stocktracker.wtkx");
        wtkxSerializer.bind(this, StockTracker.class);

        // Wire up event handlers
        stocksTableView.getTableViewRowListeners().add(new TableViewRowListener.Adapter() {
            @Override
            public void rowsSorted(TableView tableView) {
View Full Code Here

Examples of org.apache.pivot.wtkx.WTKXSerializer

        DesktopApplicationContext.main(KitchenSink.class, args);
    }

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

        buttonsRollup = (Rollup)wtkxSerializer.get("buttonsRollup");
        buttonsRollup.getRollupStateListeners().add(new ButtonsRollupStateHandler());

        listsRollup = (Rollup)wtkxSerializer.get("listsRollup");
        listsRollup.getRollupStateListeners().add(new ListsRollupStateHandler());

        textRollup = (Rollup)wtkxSerializer.get("textRollup");
        textRollup.getRollupStateListeners().add(new TextRollupStateHandler());

        calendarsRollup = (Rollup)wtkxSerializer.get("calendarsRollup");
        calendarsRollup.getRollupStateListeners().add(new CalendarsRollupStateHandler());

        colorChoosersRollup = (Rollup)wtkxSerializer.get("colorChoosersRollup");
        colorChoosersRollup.getRollupStateListeners().add(new ColorChoosersRollupStateHandler());

        navigationRollup = (Rollup)wtkxSerializer.get("navigationRollup");
        navigationRollup.getRollupStateListeners().add(new NavigationRollupStateHandler());

        splittersRollup = (Rollup)wtkxSerializer.get("splittersRollup");
        splittersRollup.getRollupStateListeners().add(new SplittersRollupStateHandler());

        menusRollup = (Rollup)wtkxSerializer.get("menusRollup");
        menusRollup.getRollupStateListeners().add(new MenusRollupStateHandler());

        metersRollup = (Rollup)wtkxSerializer.get("metersRollup");
        metersRollup.getRollupStateListeners().add(new MetersRollupStateHandler());

        spinnersRollup = (Rollup)wtkxSerializer.get("spinnersRollup");
        spinnersRollup.getRollupStateListeners().add(new SpinnersRollupStateHandler());

        tablesRollup = (Rollup)wtkxSerializer.get("tablesRollup");
        tablesRollup.getRollupStateListeners().add(new TablesRollupStateHandler());

        treesRollup = (Rollup)wtkxSerializer.get("treesRollup");
        treesRollup.getRollupStateListeners().add(new TreesRollupStateHandler());

        dragDropRollup = (Rollup)wtkxSerializer.get("dragDropRollup");
        dragDropRollup.getRollupStateListeners().add(new DragDropRollupStateHandler());

        alertsRollup = (Rollup)wtkxSerializer.get("alertsRollup");
        alertsRollup.getRollupStateListeners().add(new AlertsRollupStateHandler());

        window.open(display);

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

Examples of org.apache.pivot.wtkx.WTKXSerializer

        private Component component = null;

        @Override
        public Vote previewExpandedChange(Rollup rollup) {
            if (component == null) {
                WTKXSerializer wtkxSerializer = new WTKXSerializer();
                try {
                    component = (Component)wtkxSerializer.readObject(this, "buttons.wtkx");
                } catch(IOException exception) {
                    throw new RuntimeException(exception);
                } catch(SerializationException exception) {
                    throw new RuntimeException(exception);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.