Package org.apache.pivot.wtkx

Examples of org.apache.pivot.wtkx.WTKXSerializer


        private Border colorBorder = null;

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

                numericSpinner = (Spinner)wtkxSerializer.get("numericSpinner");
                dateSpinner = (Spinner)wtkxSerializer.get("dateSpinner");

                redSlider = (Slider)wtkxSerializer.get("redSlider");
                greenSlider = (Slider)wtkxSerializer.get("greenSlider");
                blueSlider = (Slider)wtkxSerializer.get("blueSlider");
                colorBorder = (Border)wtkxSerializer.get("colorBorder");

                rollup.setContent(component);

                initializeNumericSpinner(numericSpinner);
                initializeDateSpinner(dateSpinner);
View Full Code Here


        private TableView customTableView = null;

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

                sortableTableView = (TableView)wtkxSerializer.get("sortableTableView");
                customTableView = (TableView)wtkxSerializer.get("customTableView");

                rollup.setContent(component);

                // Set table header data
                TableView.ColumnSequence columns = sortableTableView.getColumns();
View Full Code Here

        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

    @Override
    @SuppressWarnings("unchecked")
    public void initialize(Resources resources) {
        // Load the add/edit sheet
        try {
            WTKXSerializer wtkxSerializer = new WTKXSerializer(new Resources(ExpenseSheet.class.getName()));
            expenseSheet = (ExpenseSheet)wtkxSerializer.readObject(this, "expense_sheet.wtkx");
        } catch (IOException exception) {
            throw new RuntimeException(exception);
        } catch (SerializationException exception) {
            throw new RuntimeException(exception);
        }
View Full Code Here

        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

        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

        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

        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

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

                editableListView = (ListView)wtkxSerializer.get("editableListView");
                iconListView = (ListView)wtkxSerializer.get("iconListView");
                checkedListView = (ListView)wtkxSerializer.get("checkedListView");
                iconListButton = (ListButton)wtkxSerializer.get("iconListButton");

                rollup.setContent(component);

                List<ListItem> listData = (List<ListItem>)editableListView.getListData();
                listData.setComparator(new Comparator<ListItem>() {
View Full Code Here

        private Component component = null;

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

TOP

Related Classes of org.apache.pivot.wtkx.WTKXSerializer

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.