Package com.ponysdk.ui.server.basic

Examples of com.ponysdk.ui.server.basic.PVerticalPanel


        examplePanel.setWidget(panel);
    }

    private PWidget getDisclosurePanelContent() {
        final PVerticalPanel verticalPanel = new PVerticalPanel();
        verticalPanel.add(new PLabel("First Name: "));
        verticalPanel.add(new PTextBox());
        verticalPanel.add(new PLabel("Last Name: "));
        verticalPanel.add(new PTextBox());
        return verticalPanel;
    }
View Full Code Here


    @Override
    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel panel = new PVerticalPanel();

        final PTextBox textBox = new PTextBox();
        final PTextBox textBoxReadOnly = new PTextBox();
        textBoxReadOnly.setText("read only");
        textBoxReadOnly.setEnabled(false);
        final PTextBox passwordTextBox = new PPasswordTextBox();
        final PTextBox passwordTextBoxReadOnly = new PPasswordTextBox();
        passwordTextBoxReadOnly.setText("xxxxxxxxxxxx");
        passwordTextBoxReadOnly.setEnabled(false);
        final PTextArea textArea = new PTextArea();

        panel.add(new PLabel("Normal text box:"));
        panel.add(textBox);
        panel.add(textBoxReadOnly);

        final PTextBox placeHolder = new PTextBox();
        panel.add(new PLabel("Place holder : "));
        panel.add(placeHolder);

        final PButton button = new PButton("Set");
        button.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                textBox.setPlaceholder(placeHolder.getText());
                textBoxReadOnly.setPlaceholder(placeHolder.getText());
            }
        });
        panel.add(button);

        final PTextBox masked = new PTextBox();
        final PTextBox maskedTextBox = new PTextBox();
        final PTextBox replacement = new PTextBox();
        final PCheckBox showMask = new PCheckBox("Show mask");
        final PButton applyMaskButton = new PButton("Apply mask");
        applyMaskButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                if (masked.getText().isEmpty()) return;

                String replaceChar = " ";
                if (!replacement.getText().isEmpty()) replaceChar = replacement.getText().substring(0, 1);
                maskedTextBox.applyMask(masked.getText(), showMask.getValue(), replaceChar);
            }
        });
        masked.setPlaceholder("({{000}}) {{000}}.{{0000}}");
        replacement.setWidth("10px");

        final PHorizontalPanel maskPanel = new PHorizontalPanel();
        maskPanel.setVerticalAlignment(PVerticalAlignment.ALIGN_MIDDLE);
        maskPanel.add(masked);
        maskPanel.add(maskedTextBox);
        maskPanel.add(replacement);
        maskPanel.add(showMask);
        maskPanel.add(applyMaskButton);

        panel.add(new PLabel("Password text box:"));
        panel.add(passwordTextBox);
        panel.add(passwordTextBoxReadOnly);
        panel.add(new PLabel("Text area:"));
        panel.add(textArea);
        panel.add(maskPanel);

        panel.add(new PLabel("AddOn test (javascript reverse)"));
        final PTextBox boxToReverse = new PTextBox();
        new ReverseTextInput(boxToReverse);
        final PTerminalScheduledCommand deffered = new PTerminalScheduledCommand() {

            @Override
            protected void run() {
                panel.add(boxToReverse);
            }
        };
        deffered.schedule(1500);

        examplePanel.setWidget(panel);
View Full Code Here

    @Override
    protected void onFirstShowPage() {

        super.onFirstShowPage();

        final PVerticalPanel panel = new PVerticalPanel();

        // Send 'info' business event
        final PHorizontalPanel infoPanel = new PHorizontalPanel();
        final PTextBox textField = new PTextBox("This is an info event");
        final PButton ok = new PButton("send [INFO]");
        ok.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final DemoBusinessEvent businessEvent = new DemoBusinessEvent(EventPageActivity.this);
                businessEvent.setBusinessMessage(textField.getText());
                fireEvent(businessEvent);
            }
        });

        infoPanel.add(textField);
        infoPanel.add(ok);

        // Send 'warn' business event
        final PHorizontalPanel warningPanel = new PHorizontalPanel();
        final PTextBox textField2 = new PTextBox("This is a warning event");
        final PButton ok2 = new PButton("send [WARN]");

        ok2.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final DemoBusinessEvent businessEvent = new DemoBusinessEvent(EventPageActivity.this);
                businessEvent.setLevel(Level.WARNING);
                businessEvent.setBusinessMessage(textField2.getText());
                fireEvent(businessEvent);
            }
        });

        warningPanel.add(textField2);
        warningPanel.add(ok2);

        // Send 'error' business level
        final PHorizontalPanel errorPanel = new PHorizontalPanel();
        final PTextBox textField3 = new PTextBox("This is an error event");
        final PButton ok3 = new PButton("send [ERROR]");

        ok3.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final DemoBusinessEvent businessEvent = new DemoBusinessEvent(EventPageActivity.this);
                businessEvent.setLevel(Level.ERROR);
                businessEvent.setBusinessMessage(textField3.getText());
                fireEvent(businessEvent);
            }
        });

        errorPanel.add(textField3);
        errorPanel.add(ok3);

        // Show 'tray' notification
        final PHorizontalPanel trayPanel = new PHorizontalPanel();
        final PTextBox textField4 = new PTextBox("This is a tray notification");
        final PButton ok4 = new PButton("show [TRAY]");

        ok4.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                PNotificationManager.notify(textField4.getText(), Notification.TRAY);
            }
        });

        trayPanel.add(textField4);
        trayPanel.add(ok4);

        // Build page

        panel.add(infoPanel);
        panel.add(warningPanel);
        panel.add(errorPanel);
        panel.add(trayPanel);

        examplePanel.setWidget(panel);
    }
View Full Code Here

            @Override
            public void onClick(final PClickEvent clickEvent) {

                final PPopupPanel popupPanel = new PPopupPanel();
                final PVerticalPanel content = new PVerticalPanel();
                final PButton closeButton = new PButton("Close");
                closeButton.addClickHandler(new PClickHandler() {

                    @Override
                    public void onClick(final PClickEvent clickEvent) {
                        popupPanel.hide();
                    }
                });
                content.add(new PLabel("A popup displayed relatively to the mouse click"));
                content.add(closeButton);
                content.setWidth("200px");
                content.setHeight("200px");
                popupPanel.setWidget(content);
                popupPanel.setPopupPosition(clickEvent.getClientX(), clickEvent.getClientY());
                popupPanel.show();
            }
        });
View Full Code Here

    @Override
    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel panel = new PVerticalPanel();

        panel.add(new PLabel("Static Tree:"));

        final PTree tree = new PTree();
        tree.setAnimationEnabled(false);
        tree.setWidth("300px");

        tree.addSelectionHandler(new PSelectionHandler<PTreeItem>() {

            @Override
            public void onSelection(final PSelectionEvent<PTreeItem> event) {
                final String msg = "Selected item : name = " + event.getSelectedItem();
                UIContext.getRootEventBus().fireEvent(new DemoBusinessEvent(msg));
            }
        });

        final PTreeItem firstItem = new PTreeItem("First item");

        final PAnchor anchor = new PAnchor("Second item");
        final PTreeItem secondItem = new PTreeItem(anchor);
        anchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                secondItem.setState(secondItem.getState() ? false : true);
            }
        });

        final PTreeItem thirdItem = new PTreeItem(new PImage("images/pony.png"));

        tree.addItem(firstItem);
        tree.addItem(secondItem);
        tree.addItem(thirdItem);

        final Query query = new Query();
        final FindPonysCommand command = new FindPonysCommand(query);
        final Result<List<Pony>> ponys = command.execute();

        for (final Pony pony : ponys.getData()) {
            firstItem.addItem(pony.getName());
            secondItem.addItem(pony.getName());
            thirdItem.addItem(pony.getName());
        }

        panel.add(tree);

        examplePanel.setWidget(panel);
    }
View Full Code Here

    @Override
    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel panel = new PVerticalPanel();
        panel.setSpacing(10);

        panel.add(new PButton("Button 1"));
        panel.add(new PButton("Button 2"));
        panel.add(new PButton("Button 3"));
        panel.add(new PButton("Button 4"));

        examplePanel.setWidget(panel);
    }
View Full Code Here

    @Override
    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel layout = new PVerticalPanel();

        final FormView formView = new DefaultFormView();
        final FormConfiguration formConfiguration = new FormConfiguration();
        formConfiguration.setName("Form");
        final FormActivity formActivity = new FormActivity(formConfiguration, formView);

        final FormField field1 = new FormField("field1");
        formActivity.addFormField(field1);
        field1.addValidator(new NotEmptyFieldValidator());
        field1.addValidator(new DoubleFieldValidator());

        final FormFieldRenderer field2Renderer = new TextBoxFormFieldRenderer("field2");
        final FormField field2 = new FormField(field2Renderer);
        formActivity.addFormField(field2);

        final ListBoxFormFieldRenderer field3Renderer = new ListBoxFormFieldRenderer("field3");
        field3Renderer.addItem("Choice 1", 1);
        field3Renderer.addItem("Choice 2", 2);
        field3Renderer.addItem("Choice 3", 3);
        field3Renderer.addItem("Choice 4", 4);
        final FormField field3 = new FormField(field3Renderer);
        formActivity.addFormField(field3);

        final FormFieldRenderer field4Renderer = new DateBoxFormFieldRenderer("field4");
        final FormField field4 = new FormField(field4Renderer);
        formActivity.addFormField(field4);

        final FormFieldRenderer field5Renderer = new TextAreaFormFieldRenderer("field5");
        final FormField field5 = new FormField(field5Renderer);
        formActivity.addFormField(field5);

        final TwinListBoxFormFieldRenderer<String> field6Renderer = new TwinListBoxFormFieldRenderer<String>("field6");
        final FormField field6 = new FormField(field6Renderer);
        formActivity.addFormField(field6);

        field6Renderer.addItem("Choice 1");
        field6Renderer.addItem("Choice 2");
        field6Renderer.addItem("Choice 3");
        field6Renderer.addItem("Choice 4");
        field6Renderer.addItem("Choice 5");
        field6Renderer.addItem("Choice 6");
        field6Renderer.setSelectedItem("Choice 2");
        field6Renderer.setSelectedItem("Choice 3");

        final PSimplePanel formLayout = new PSimplePanel();
        layout.add(formLayout);
        formActivity.start(formLayout);

        final PButton validateButton = new PButton("Validate");
        validateButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final boolean isValid = formActivity.isValid();
                PNotificationManager.showTrayNotification("The form is valid? " + (isValid ? "YES" : "NO"));
            }
        });
        layout.add(validateButton);

        final PButton resetButton = new PButton("Reset");
        resetButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                formActivity.reset();
            }
        });
        layout.add(resetButton);

        examplePanel.setWidget(layout);
    }
View Full Code Here

    @Override
    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel verticalPanel = new PVerticalPanel();
        verticalPanel.setSpacing(10);

        // Open popup with custom URL
        final PFlexTable table = new PFlexTable();
        table.setWidget(0, 0, new PLabel("URL"));
        table.setWidget(0, 1, urlTextBox = new PTextBox("https://github.com/PonySDK/PonySDK"));
        table.setWidget(1, 0, new PLabel("Name"));
        table.setWidget(1, 1, nameTextBox = new PTextBox("PonySDK"));
        table.setWidget(2, 0, new PLabel("Features"));
        table.setWidget(2, 1, featuresTextBox = new PTextBox("width=1280,height=800,resizable,status=1"));

        final PButton open = new PButton("Open new window");
        open.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                final String url = urlTextBox.getText();
                final String name = nameTextBox.getText();
                final String features = featuresTextBox.getText();
                final PWindow w = new PWindow(url, name, features);
                w.open();
            }
        });

        // Open popup that communicate with server
        final PFlexTable table2 = new PFlexTable();
        table2.setWidget(0, 0, new PLabel("Name"));
        table2.setWidget(0, 1, popNameTextBox = new PTextBox("Popup"));
        table2.setWidget(1, 0, new PLabel("Features"));
        table2.setWidget(1, 1, popFeaturesTextBox = new PTextBox("width=500,height=300,resizable"));

        final PButton open2 = new PButton("Open new window");
        open2.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                final String disc = windows.size() == 0 ? "" : Integer.toString(windows.size());
                final String name = popNameTextBox.getText();
                final String features = popFeaturesTextBox.getText();
                final MyWindow window = new MyWindow(name + disc, features);
                window.open();
                window.addCloseHandler(WindowPageActivity.this);
                windows.add(window);
            }
        });

        final PButton postHello = new PButton("Post message");
        postHello.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                for (final PWindow window : windows) {
                    window.acquire();
                    try {
                        PNotificationManager.showHumanizedNotification("Hello from opener");
                        window.flush();
                    } finally {
                        window.release();
                    }
                }
            }
        });

        final PButton closeAllWindow = new PButton("Close all windows");
        closeAllWindow.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                for (final PWindow window : windows) {
                    window.close();
                }
            }
        });

        verticalPanel.add(new PHTML("<b>Simple popup</b>"));
        verticalPanel.add(table);
        verticalPanel.add(open);

        verticalPanel.add(new PHTML("<br><br><b>Communicating popup</b>"));
        verticalPanel.add(table2);
        verticalPanel.add(open2);
        verticalPanel.add(postHello);
        verticalPanel.add(closeAllWindow);

        examplePanel.setWidget(verticalPanel);
    }
View Full Code Here

    private void addCategory(final Node categoryNode) {

        if (categoryNode.level == 1) {
            // Main category
            final PVerticalPanel categoryPanel = new PVerticalPanel();
            categoryPanel.setHeight("1px");
            categoryPanel.setWidth("100%");
            categoryPanel.ensureDebugId("category_" + categoryNode.name);

            categoryNode.ui = categoryPanel;
            layoutPanel.add(categoryPanel, categoryNode.name, true, headerWidth);
            categoriesByNode.put(categoryNode, categoryPanel);

        } else {

            // Sub category
            final Node parentCategory = categoryNode.parent;
            final PComplexPanel categoryPanel = categoriesByNode.get(parentCategory);
            if (categoryPanel == null) throw new IllegalArgumentException("Category '" + categoryNode.name + "' not assigned to a parent category");

            final PAnchor category = new PAnchor(categoryNode.name);
            applyPadding(categoryNode, category);
            applyExpandableStyle(categoryNode, category);
            category.addClickHandler(new PClickHandler() {

                @Override
                public void onClick(final PClickEvent clickEvent) {
                    if (categoryNode.open) {
                        collapseNode(categoryNode);
                        applyExpandableStyle(categoryNode, category);
                    } else {
                        expandNode(categoryNode);
                        applyExpandableStyle(categoryNode, category);
                    }
                }
            });

            if (!parentCategory.open) category.setVisible(false);

            categoryPanel.add(category);

            categoryNode.ui = category;
            categoriesByNode.put(categoryNode, categoryPanel);
        }
    }
View Full Code Here

    @Override
    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel panel = new PVerticalPanel();
        panel.setSpacing(10);

        panel.add(new PLabel("Choose a section:"));

        final PAnchor checkBoxAnchor = new PAnchor("CheckBox");
        checkBoxAnchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                goTo(new PagePlace("CheckBox"));
            }
        });
        panel.add(checkBoxAnchor);

        final PAnchor radioButtonAnchor = new PAnchor("RadioButton");
        radioButtonAnchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                goTo(new PagePlace("Radio Button"));
            }
        });
        panel.add(radioButtonAnchor);

        final PAnchor basicButtonAnchor = new PAnchor("BasicButton");
        basicButtonAnchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                goTo(new PagePlace("Basic Button"));
            }
        });
        panel.add(basicButtonAnchor);

        final PAnchor customButtonAnchor = new PAnchor("CustomButton");
        customButtonAnchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                goTo(new PagePlace("Custom Button"));
            }
        });
        panel.add(customButtonAnchor);

        final PAnchor fileUpload = new PAnchor("FileUpload");
        fileUpload.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                goTo(new PagePlace("File Upload"));
            }
        });
        panel.add(fileUpload);

        examplePanel.setWidget(panel);
    }
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.basic.PVerticalPanel

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.