Package pivot.wtkx

Examples of pivot.wtkx.WTKXSerializer$Element


    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

    private Window window = null;
    private TreeView folderTreeView = 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_browser_demo.wtkx")));

        folderTreeView = (TreeView)wtkxSerializer.getObjectByName("folderTreeView");

        String pathname = System.getProperty("user.home");
        folderTreeView.setTreeData(new Folder(pathname));

        folderTreeView.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener() {
View Full Code Here

    private Frame frame2 = null;
    private Frame frame3 = null;

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

        TreeView folderTreeView = (TreeView)wtkxSerializer.getObjectByName("folderTreeView");

        String pathname = "/";
        folderTreeView.setTreeData(new Folder(pathname));

        frame1.setTitle("File Browser Test");
View Full Code Here

    private ApplicationContext.ScheduledCallback scheduledFadeCallback = null;

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

        cardPane = (CardPane)wtkxSerializer.getObjectByName("cardPane");
        loginForm = (Form)wtkxSerializer.getObjectByName("loginForm");

        loginForm.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.ENTER) {
                    login();
                }

                return false;
            }

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

        usernameTextInput = (TextInput)wtkxSerializer.getObjectByName("usernameTextInput");
        passwordTextInput = (TextInput)wtkxSerializer.getObjectByName("passwordTextInput");
        domainTextInput = (TextInput)wtkxSerializer.getObjectByName("domainTextInput");

        loginButton = (PushButton)wtkxSerializer.getObjectByName("loginButton");
        loginButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(final Button button) {
                login();
            }
        });

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

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

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

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

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        frame = (Frame)wtkxSerializer.readObject(getClass().getResource("accordion_test.wtkx"));
        frame.open(display);
    }
View Full Code Here

    private Window reflectionWindow = null;
    private Frame fadeFrame = null;

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

        reflectionWindow =
            new Window((Component)wtkxSerializer.readObject(getClass().getResource("reflection.wtkx")));
        reflectionWindow.setTitle("Reflection Window");
        reflectionWindow.getDecorators().add(new ReflectionDecorator());
        reflectionWindow.setLocation(20, 20);
        reflectionWindow.open(display);

        fadeFrame =
            new Frame((Component)wtkxSerializer.readObject(getClass().getResource("translucent.wtkx")));
        fadeFrame.setTitle("Translucent Window");

        final FadeDecorator fadeDecorator = new FadeDecorator();
        fadeFrame.getDecorators().insert(fadeDecorator, 0);
View Full Code Here

TOP

Related Classes of pivot.wtkx.WTKXSerializer$Element

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.