Package pivot.wtkx

Examples of pivot.wtkx.WTKXSerializer


        Prompt prompt = (Prompt)component;
        prompt.getPromptListeners().add(this);

        // Load the prompt content
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content = null;

        try {
            content = (Component)wtkxSerializer.readObject(getClass().getResource("prompt_skin.wtkx"));
        } catch(Exception exception) {
            throw new RuntimeException(exception);
        }

        prompt.setContent(content);

        // Set the type image
        TerraTheme theme = (TerraTheme)Theme.getTheme();

        ImageView typeImageView = (ImageView)wtkxSerializer.getObjectByName("typeImageView");
        typeImageView.setImage(theme.getMessageIcon(prompt.getMessageType()));

        // Set the message
        Label messageLabel = (Label)wtkxSerializer.getObjectByName("messageLabel");
        String message = prompt.getMessage();
        messageLabel.setText(message);

        // Set the body
        FlowPane messageFlowPane = (FlowPane)wtkxSerializer.getObjectByName("messageFlowPane");
        Component body = prompt.getBody();
        if (body != null) {
            messageFlowPane.add(body);
        }

        // Add the option buttons
        FlowPane buttonFlowPane = (FlowPane)wtkxSerializer.getObjectByName("buttonFlowPane");

        for (int i = 0, n = prompt.getOptionCount(); i < n; i++) {
            Object option = prompt.getOption(i);

            PushButton optionButton = new PushButton(option);
View Full Code Here


            public String getDescription() {
                return "Specifies authentication credentials";
            }

            public void perform() {
                final WTKXSerializer sheetSerializer = new WTKXSerializer();
                final Sheet sheet;

                try {
                    sheet = (Sheet)sheetSerializer.readObject("pivot/tools/net/setAuthentication.wtkx");
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }

                Button okButton = (Button)sheetSerializer.getObjectByName("okButton");
                okButton.getButtonPressListeners().add(new ButtonPressListener() {
                    public void buttonPressed(Button button) {
                        sheet.close(true);
                    }
                });

                Button cancelButton = (Button)sheetSerializer.getObjectByName("cancelButton");
                cancelButton.getButtonPressListeners().add(new ButtonPressListener() {
                    public void buttonPressed(Button button) {
                        sheet.close(false);
                    }
                });

                if (credentials != null) {
                    TextInput usernameTextInput = (TextInput)sheetSerializer.getObjectByName("username");
                    TextInput passwordTextInput = (TextInput)sheetSerializer.getObjectByName("password");
                    usernameTextInput.setText(credentials.getUsername());
                    passwordTextInput.setText(credentials.getPassword());
                }

                sheet.getSheetStateListeners().add(new SheetStateListener() {
                    public Vote previewSheetClose(Sheet sheet, boolean result) {
                        return Vote.APPROVE;
                    }

                    public void sheetCloseVetoed(Sheet sheet, Vote reaso) {
                        // No-op
                    }

                    public void sheetClosed(Sheet sheet) {
                        if (sheet.getResult()) {
                            TextInput usernameTextInput = (TextInput)
                                sheetSerializer.getObjectByName("username");
                            TextInput passwordTextInput = (TextInput)
                                sheetSerializer.getObjectByName("password");

                            String username = usernameTextInput.getText();
                            String password = passwordTextInput.getText();

                            if (username.length() == 0 && password.length() == 0) {
                                credentials = null;
                            } else {
                                credentials = new Credentials(username, password);
                            }
                        }
                    }
                });

                sheet.open(window);
            }
        };

        new Action("toggleHostnameVerificationAction") {
            public String getDescription() {
                return "Toggles lenient hostname verification";
            }

            public void perform() {
                lenientHostnameVerification = !lenientHostnameVerification;
            }
        };

        new Action("setKeystoreAction") {
            private String keystorePath = null;
            private String keystorePassword = null;

            public String getDescription() {
                return "Sets a trusted keystore";
            }

            public void perform() {
                final WTKXSerializer sheetSerializer = new WTKXSerializer();
                final Sheet sheet;

                try {
                    sheet = (Sheet)sheetSerializer.readObject("pivot/tools/net/setKeystore.wtkx");
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }

                Button okButton = (Button)sheetSerializer.getObjectByName("okButton");
                okButton.getButtonPressListeners().add(new ButtonPressListener() {
                    public void buttonPressed(Button button) {
                        sheet.close(true);
                    }
                });

                Button cancelButton = (Button)sheetSerializer.getObjectByName("cancelButton");
                cancelButton.getButtonPressListeners().add(new ButtonPressListener() {
                    public void buttonPressed(Button button) {
                        sheet.close(false);
                    }
                });

                if (keystorePath != null) {
                    TextInput pathTextInput = (TextInput)sheetSerializer.getObjectByName("path");
                    pathTextInput.setText(keystorePath);
                }

                if (keystorePassword != null) {
                    TextInput passwdTextInput = (TextInput)sheetSerializer.getObjectByName("passwd");
                    passwdTextInput.setText(keystorePassword);
                }

                sheet.getSheetStateListeners().add(new SheetStateListener() {
                    public Vote previewSheetClose(Sheet sheet, boolean result) {
                        Vote vote = Vote.APPROVE;

                        if (result) {
                            TextInput pathTextInput = (TextInput)sheetSerializer.getObjectByName("path");
                            TextInput passwdTextInput = (TextInput)sheetSerializer.getObjectByName("passwd");

                            keystorePath = pathTextInput.getText();
                            keystorePassword = passwdTextInput.getText();

                            File file = new File(keystorePath);
                            if (!file.exists()
                                || !file.isFile()) {
                                vote = Vote.DENY;
                            } else if (!file.canRead()) {
                                vote = Vote.DENY;
                            }
                        }

                        return vote;
                    }

                    public void sheetCloseVetoed(Sheet sheet, Vote reaso) {
                        // No-op
                    }

                    public void sheetClosed(Sheet sheet) {
                        if (sheet.getResult()) {
                            System.setProperty("javax.net.ssl.trustStore", keystorePath);
                            System.setProperty("javax.net.ssl.keyStorePassword", keystorePassword);
                        }
                    }
                });

                sheet.open(window);
            }
        };

        // Load the main app window
        serializer = new WTKXSerializer();
        window = (Window)serializer.readObject("pivot/tools/net/application.wtkx");
        window.open(display);

        TableView tableView = (TableView)serializer.getObjectByName("log.tableView");
        tableView.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener() {
            public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
                return false;
            }

            public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
                return false;
            }

            public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
                boolean consumed = false;

                if (button == Mouse.Button.LEFT && count == 2) {
                    consumed = true;

                    if (detailsFrame == null) {
                        final WTKXSerializer frameSerializer = new WTKXSerializer();

                        try {
                            detailsFrame = (Frame)frameSerializer.readObject
                                ("pivot/tools/net/detailsFrame.wtkx");
                        } catch (Exception ex) {
                            throw new RuntimeException(ex);
                        }
                    }
View Full Code Here

    }

    String src = properties.get(SRC_ARGUMENT);
    String title = properties.get(TITLE_ARGUMENT);

    WTKXSerializer wtkxSerializer = new WTKXSerializer();

    Component content = (Component)wtkxSerializer.readObject(src);
    window = new Window(content);
    window.setTitle(title);
    window.setMaximized(true);
    window.open(display);
  }
View Full Code Here

public class DragAndDropDemo implements Application {
    private Window window = null;

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("drag_and_drop.wtkx")));

        // Text
        final Label label = (Label)wtkxSerializer.getObjectByName("label");
        label.setDragSource(new DragSource() {
            private LocalManifest content = null;

            public boolean beginDrag(Component component, int x, int y) {
                String text = label.getText();
                if (text != null) {
                    content = new LocalManifest();
                    content.putText(label.getText());
                }

                return (content != null);
            }

            public void endDrag(Component component, DropAction dropAction) {
                content = null;
            }

            public boolean isNative() {
                return true;
            }

            public LocalManifest getContent() {
                return content;
            }

            public Visual getRepresentation() {
                return null;
            }

            public Point getOffset() {
                return null;
            }

            public int getSupportedDropActions() {
                return DropAction.COPY.getMask();
            }
        });

        label.setDropTarget(new DropTarget() {
            public DropAction dragEnter(Component component, Manifest dragContent,
                int supportedDropActions, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsText()
                    && DropAction.COPY.isSelected(supportedDropActions)) {
                    dropAction = DropAction.COPY;
                }

                return dropAction;
            }

            public void dragExit(Component component) {
            }

            public DropAction dragMove(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsText() ? DropAction.COPY : null);
            }

            public DropAction userDropActionChange(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsText() ? DropAction.COPY : null);
            }

            public DropAction drop(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsText()) {
                    try {
                        label.setText(dragContent.getText());
                        dropAction = DropAction.COPY;
                    } catch(IOException exception) {
                        System.err.println(exception);
                    }
                }

                dragExit(component);

                return dropAction;
            }
        });

        PushButton copyTextButton = (PushButton)wtkxSerializer.getObjectByName("copyTextButton");
        copyTextButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                String text = label.getText();
                LocalManifest clipboardContent = new LocalManifest();
                clipboardContent.putText(text);
                Clipboard.setContent(clipboardContent);
            }
        });

        PushButton pasteTextButton = (PushButton)wtkxSerializer.getObjectByName("pasteTextButton");
        pasteTextButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                Manifest clipboardContent = Clipboard.getContent();

                if (clipboardContent != null
                    && clipboardContent.containsText()) {
                    try {
                        label.setText(clipboardContent.getText());
                    } catch(IOException exception) {
                        System.err.println(exception);
                    }
                }
            }
        });

        // Images
        final ImageView imageView = (ImageView)wtkxSerializer.getObjectByName("imageView");
        imageView.setDragSource(new DragSource() {
            private LocalManifest content = null;

            public boolean beginDrag(Component component, int x, int y) {
                Image image = imageView.getImage();

                if (image != null) {
                    content = new LocalManifest();
                    content.putImage(image);
                }

                return (content != null);
            }

            public void endDrag(Component component, DropAction dropAction) {
                content = null;
            }

            public boolean isNative() {
                return true;
            }

            public LocalManifest getContent() {
                return content;
            }

            public Visual getRepresentation() {
                return null;
            }

            public Point getOffset() {
                return null;
            }

            public int getSupportedDropActions() {
                return DropAction.COPY.getMask();
            }
        });

        imageView.setDropTarget(new DropTarget() {
            public DropAction dragEnter(Component component, Manifest dragContent,
                int supportedDropActions, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsImage()
                    && DropAction.COPY.isSelected(supportedDropActions)) {
                    dropAction = DropAction.COPY;
                }

                return dropAction;
            }

            public void dragExit(Component component) {
            }

            public DropAction dragMove(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsImage() ? DropAction.COPY : null);
            }

            public DropAction userDropActionChange(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsImage() ? DropAction.COPY : null);
            }

            public DropAction drop(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsImage()) {
                    try {
                        imageView.setImage(dragContent.getImage());
                        dropAction = DropAction.COPY;
                    } catch(IOException exception) {
                        System.err.println(exception);
                    }
                }

                dragExit(component);

                return dropAction;
            }
        });

        PushButton copyImageButton = (PushButton)wtkxSerializer.getObjectByName("copyImageButton");
        copyImageButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                Image image = imageView.getImage();
                if (image != null) {
                    LocalManifest clipboardContent = new LocalManifest();
                    clipboardContent.putImage(image);
                    Clipboard.setContent(clipboardContent);
                }
            }
        });

        PushButton pasteImageButton = (PushButton)wtkxSerializer.getObjectByName("pasteImageButton");
        pasteImageButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                Manifest clipboardContent = Clipboard.getContent();

                if (clipboardContent != null
                    && clipboardContent.containsImage()) {
                    try {
                        imageView.setImage(clipboardContent.getImage());
                    } catch(IOException exception) {
                        System.err.println(exception);
                    }
                }
            }
        });

        // Files
        final ListView listView = (ListView)wtkxSerializer.getObjectByName("listView");
        listView.setListData(new FileList());

        listView.setDragSource(new DragSource() {
            private LocalManifest content = null;

            public boolean beginDrag(Component component, int x, int y) {
                ListView listView = (ListView)component;
                FileList fileList = (FileList)listView.getListData();

                if (fileList.getLength() > 0) {
                    content = new LocalManifest();
                    content.putFileList(fileList);
                }

                return (content != null);
            }

            public void endDrag(Component component, DropAction dropAction) {
                content = null;
            }

            public boolean isNative() {
                return true;
            }

            public LocalManifest getContent() {
                return content;
            }

            public Visual getRepresentation() {
                return null;
            }

            public Point getOffset() {
                return null;
            }

            public int getSupportedDropActions() {
                return DropAction.COPY.getMask();
            }
        });

        listView.setDropTarget(new DropTarget() {
            public DropAction dragEnter(Component component, Manifest dragContent,
                int supportedDropActions, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsFileList()
                    && DropAction.COPY.isSelected(supportedDropActions)) {
                    dropAction = DropAction.COPY;
                }

                return dropAction;
            }

            public void dragExit(Component component) {
            }

            public DropAction dragMove(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsFileList() ? DropAction.COPY : null);
            }

            public DropAction userDropActionChange(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsFileList() ? DropAction.COPY : null);
            }

            public DropAction drop(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsFileList()) {
                    try {
                        listView.setListData(dragContent.getFileList());
                        dropAction = DropAction.COPY;
                    } catch(IOException exception) {
                        System.err.println(exception);
                    }
                }

                dragExit(component);

                return dropAction;
            }
        });

        PushButton copyFilesButton = (PushButton)wtkxSerializer.getObjectByName("copyFilesButton");
        copyFilesButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                // TODO
            }
        });

        PushButton pasteFilesButton = (PushButton)wtkxSerializer.getObjectByName("pasteFilesButton");
        pasteFilesButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                // TODO
            }
        });
View Full Code Here

    private Frame frame = null;

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();

        frame = new Frame((Component)wtkxSerializer.readObject(getClass().getResource("charts_test.wtkx")));
        frame.setTitle("Charts Test");

        ChartViewMouseButtonHandler chartViewMouseButtonHandler = new ChartViewMouseButtonHandler();

        PieChartView pieChartView = (PieChartView)wtkxSerializer.getObjectByName("pieCharts.pieChartView");
        pieChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        BarChartView categoryBarChartView = (BarChartView)wtkxSerializer.getObjectByName("barCharts.categoryBarChartView");
        categoryBarChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        BarChartView xyBarChartView = (BarChartView)wtkxSerializer.getObjectByName("barCharts.xyBarChartView");
        xyBarChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        LineChartView categoryLineChartView = (LineChartView)wtkxSerializer.getObjectByName("lineCharts.categoryLineChartView");
        categoryLineChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        LineChartView xyLineChartView = (LineChartView)wtkxSerializer.getObjectByName("lineCharts.xyLineChartView");
        xyLineChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        AreaChartView categoryAreaChartView = (AreaChartView)wtkxSerializer.getObjectByName("areaCharts.categoryAreaChartView");
        categoryAreaChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        AreaChartView xyAreaChartView = (AreaChartView)wtkxSerializer.getObjectByName("areaCharts.xyAreaChartView");
        xyAreaChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        HighLowChartView highLowChartView = (HighLowChartView)wtkxSerializer.getObjectByName("highLowCharts.highLowChartView");
        highLowChartView.getComponentMouseButtonListeners().add(chartViewMouseButtonHandler);

        frame.setPreferredSize(640, 480);
        frame.open(display);
    }
View Full Code Here

    private TableView fileTableView = null;
    private PushButton uploadButton = null;

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("file_drop_target_demo.wtkx")));

        fileTableView = (TableView)wtkxSerializer.getObjectByName("fileTableView");

        fileList = new FileList();
        fileTableView.setTableData(fileList);

        fileList.getListListeners().add(new ListListener<File>() {
            public void itemInserted(List<File> list, int index) {
                uploadButton.setEnabled(list.getLength() > 0);
            }

            public void itemsRemoved(List<File> list, int index, Sequence<File> files) {
                uploadButton.setEnabled(list.getLength() > 0);

                if (fileTableView.isFocused()
                    && index < list.getLength()) {
                    fileTableView.setSelectedIndex(index);
                }
            }

            public void itemUpdated(List<File> list, int index, File previousFile) {
                // No-op
            }

            public void comparatorChanged(List<File> fileList, Comparator<File> previousComparator) {
                // No-op
            }
        });

        fileTableView.getComponentKeyListeners().add(new ComponentKeyListener() {
            public boolean keyTyped(Component component, char character) {
                return false;
            }

            public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
                if (keyCode == Keyboard.KeyCode.DELETE
                    || keyCode == Keyboard.KeyCode.BACKSPACE) {
                    Sequence<Span> selectedRanges = fileTableView.getSelectedRanges();

                    for (int i = selectedRanges.getLength() - 1; i >= 0; i--) {
                        Span range = selectedRanges.get(i);
                        int index = range.getStart();
                        int count = range.getEnd() - index + 1;
                        fileList.remove(index, count);
                    }
                }

                return false;
            }

            public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
                return false;
            }
        });

        fileTableView.setDropTarget(new DropTarget() {
            public DropAction dragEnter(Component component, Manifest dragContent,
                int supportedDropActions, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsFileList()
                    && DropAction.COPY.isSelected(supportedDropActions)) {
                    dropAction = DropAction.COPY;
                }

                return dropAction;
            }

            public void dragExit(Component component) {
            }

            public DropAction dragMove(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsFileList() ? DropAction.COPY : null);
            }

            public DropAction userDropActionChange(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                return (dragContent.containsFileList() ? DropAction.COPY : null);
            }

            public DropAction drop(Component component, Manifest dragContent,
                int supportedDropActions, int x, int y, DropAction userDropAction) {
                DropAction dropAction = null;

                if (dragContent.containsFileList()) {
                    try {
                        FileList tableData = (FileList)fileTableView.getTableData();
                        FileList fileList = dragContent.getFileList();
                        for (File file : fileList) {
                            if (file instanceof Folder) {
                                tableData.add((Folder)file);
                            } else {
                                tableData.add(file);
                            }
                        }

                        dropAction = DropAction.COPY;
                    } catch(IOException exception) {
                        System.err.println(exception);
                    }
                }

                dragExit(component);

                return dropAction;
            }
        });

        uploadButton = (PushButton)wtkxSerializer.getObjectByName("uploadButton");
        uploadButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                Prompt.prompt(MessageType.INFO, "Pretending to upload...", window);
            }
        });
View Full Code Here

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

    public void startup(Display display, Dictionary<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = new Window((Component)wtkxSerializer.readObject(
            getClass().getResource("textInputValidator_test.wtkx")));
        textinputFloatRange = (TextInput)wtkxSerializer.getObjectByName("textinputFloatRange");
        textinputIntRange = (TextInput)wtkxSerializer.getObjectByName("textinputIntRange");
        textinputDateRegex = (TextInput)wtkxSerializer.getObjectByName("textinputDateRegex");
        textinputCustomBoolean = (TextInput)wtkxSerializer.getObjectByName("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() {
            public void maximumLengthChanged(TextInput textInput, int previousMaximumLength) {
            }

            public void passwordChanged(TextInput textInput) {
            }

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

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

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

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

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

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

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

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

    private Window window = null;

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("scripting_demo.wtkx")));

        String foo = (String)wtkxSerializer.getObjectByName("foo");
        System.out.println("foo = " + foo);

        window.setTitle("Scripting Demo");
        window.setMaximized(true);
        window.open(display);
View Full Code Here

        basePath = properties.get(BASE_PATH_KEY);
        if (basePath == null) {
            throw new IllegalArgumentException("basePath is required.");
        }

        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = (Window)wtkxSerializer.readObject(getClass().getResource("large_data.wtkx"));

        fileListButton = (ListButton)wtkxSerializer.getObjectByName("fileListButton");

        loadDataButton = (PushButton)wtkxSerializer.getObjectByName("loadDataButton");
        loadDataButton.getButtonPressListeners().add(new ButtonPressListener() {
          public void buttonPressed(Button button) {
            button.setEnabled(false);
            loadData();
          }
        });

        statusLabel = (Label)wtkxSerializer.getObjectByName("statusLabel");

        tableView = (TableView)wtkxSerializer.getObjectByName("tableView");

        tableViewHeader = (TableViewHeader)wtkxSerializer.getObjectByName("tableViewHeader");
        tableViewHeader.getTableViewHeaderPressListeners().add(new TableView.SortHandler() {
          @Override
          public void headerPressed(TableViewHeader tableViewHeader, int index) {
            long startTime = System.currentTimeMillis();
            super.headerPressed(tableViewHeader, index);
View Full Code Here

    private Window window = null;
    private boolean synchronizingSelection = false;

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();

        Component content =
            (Component)wtkxSerializer.readObject(getClass().getResource("fixed_column_table.wtkx"));

        // Get references to the table views and table view headers
        final TableView primaryTableView =
            (TableView)wtkxSerializer.getObjectByName("primaryTableView");
        final TableViewHeader primaryTableViewHeader =
            (TableViewHeader)wtkxSerializer.getObjectByName("primaryTableViewHeader");

        final TableView fixedTableView =
            (TableView)wtkxSerializer.getObjectByName("fixedTableView");
        final TableViewHeader fixedTableViewHeader =
            (TableViewHeader)wtkxSerializer.getObjectByName("fixedTableViewHeader");

        // Keep selection state in sync
        primaryTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener() {
            public void selectedRangeAdded(TableView tableView, int rangeStart, int rangeEnd) {
                if (!synchronizingSelection) {
View Full Code Here

TOP

Related Classes of 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.