Package com.ponysdk.ui.server.basic

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


        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
View Full Code Here


        final PFlowPanel panel = new PFlowPanel();
        panel.setStyleName("pony-LoginPage");

        // logo
        final PLabel logo = new PLabel(title);
        logo.addStyleName("pony-LoginPage-Logo");
        panel.add(logo);

        // input
        final PFlowPanel inputPanel = new PFlowPanel();
        inputPanel.add(buildLoginInput());
View Full Code Here

        setWidget(panel);
    }

    private PWidget buildLoginInput() {
        final PFlowPanel panel = new PFlowPanel();
        panel.add(new PLabel(PString.get("activity.login.login")));
        panel.add(loginTextBox);
        return panel;
    }
View Full Code Here

        return panel;
    }

    private PWidget buildPasswordInput() {
        final PFlowPanel panel = new PFlowPanel();
        panel.add(new PLabel(PString.get("activity.login.password")));
        panel.add(passwordTextBox);
        return panel;
    }
View Full Code Here

        versionInformation.setText(version);
    }

    @Override
    public void addMessage(final String message) {
        final PLabel messageLabel = new PLabel(message);
        messageLabel.ensureDebugId("login_page_message_" + messageIndex);
        messageIndex++;
        messagePanel.add(messageLabel);
    }
View Full Code Here

                    @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();
            }
        });

        addLabel("A draggable popup");
        final PButton anchor3 = addButton("Open");
        anchor3.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final PClosableDialogBox dialogBox = new PClosableDialogBox("Custom caption");
                dialogBox.setDraggable(true);
                dialogBox.setContent(new PLabel("Content of a popup"));
                dialogBox.center();
            }
        });

        addLabel("A confirm dialog listenening on the close event");
        final PButton anchor4 = addButton("Open");
        anchor4.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final POptionPane dialodBox = POptionPane.showConfirmDialog(new PActionHandler() {

                    @Override
                    public void onAction(final PDialogBox dialogBox, final String option) {
                        dialogBox.hide();
                    }
                }, "Your custom text");

                dialodBox.getDialogBox().addCloseHandler(new PCloseHandler() {

                    @Override
                    public void onClose(final PCloseEvent closeEvent) {
                        final DemoBusinessEvent event = new DemoBusinessEvent(this);
                        event.setBusinessMessage("Dialog box closed");
                        fireEvent(event);
                    }
                });
            }
        });

        addLabel("A confirm dialog listenening on the close event");
        final PButton anchor5 = addButton("Open");
        anchor5.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                POptionPane.showConfirmDialog(new PActionHandler() {

                    @Override
                    public void onAction(final PDialogBox dialogBox, final String option) {
                        dialogBox.hide();
                        final DemoBusinessEvent event = new DemoBusinessEvent(this);
                        event.setBusinessMessage("Option selected #" + option);
                        fireEvent(event);
                    }
                }, "Your custom text", "Your title", POptionType.YES_NO_CANCEL_OPTION);
            }
        });

        addLabel("PConfirmDialogBox");
        final PButton anchor6 = addButton("Open");
        anchor6.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                PConfirmDialog.show("Question ?", new PLabel("This is a confirm dialog box"));
            }
        });

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

        examplePanel.setWidget(layout);
    }

    private PLabel addLabel(final String text) {
        final PLabel label = new PLabel(text);
        layout.setWidget(row, 0, label);
        return label;
    }
View Full Code Here

    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");
View Full Code Here

        PFlexTable panel = new PFlexTable();

        panel.setStyleProperty("padding", "10px");

        panel.setWidget(0, 0, new PLabel("Name :"));
        panel.setWidget(0, 1, new PTextBox("name"));
        panel.setWidget(1, 0, new PLabel("Description :"));
        panel.setWidget(1, 1, new PTextBox("description"));

        decoratorPanel.setWidget(panel);

        examplePanel.setWidget(decoratorPanel);
View Full Code Here

        background.addStyleName("background");
        final PFlowPanel headInline = new PFlowPanel();
        headInline.addStyleName("head_inline");
        final PFlowPanel icon = new PFlowPanel();
        icon.addStyleName("icon");
        final PLabel header = new PLabel(currency);
        header.addStyleName("header");
        final PAnchor close = new PAnchor();
        close.addStyleName("close");
        final PHTML buy = new PHTML("<div></div>");
        buy.addStyleName("buy");
        buy.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                PNotificationManager.showHumanizedNotification("Buy clicked!");
            }
        });

        final PLabel buyPipHead = new PLabel("buy");
        buyPipHead.addStyleName("buy_pip_head");
        final PLabel buyNum = new PLabel("1.22");
        buyNum.addStyleName("buy_num");
        final PFlowPanel buyPipNum = new PFlowPanel();
        buyPipNum.addStyleName("buy_pip_num");
        final PElement buyPipNumStrong = new PElement("strong");
        final PFlowPanel buyDirection = new PFlowPanel();
        buyDirection.addStyleName("buy_direction");
        final PHTML sell = new PHTML("<div></div>");
        sell.addStyleName("sell");
        sell.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                PNotificationManager.showHumanizedNotification("Sell clicked!");
            }
        });
        final PLabel sellPipHead = new PLabel("offer");
        sellPipHead.addStyleName("sell_pip_head");
        final PLabel sellNum = new PLabel("1.45");
        sellNum.addStyleName("sell_num");
        final PElement sellPipNumStrong = new PElement("strong");
        final PFlowPanel sellPipNum = new PFlowPanel();
        sellPipNum.addStyleName("sell_pip_num");
        final PLabel amtLabel = new PLabel("EUR");
        amtLabel.addStyleName("amtlabel");
        final PFlowPanel sellDirection = new PFlowPanel();
        sellDirection.addStyleName("sell_direction");
        final PLabel spread = new PLabel();
        spread.addStyleName("spread");
        final PTextBox textBox = new PTextBox();
        textBox.setStyleName("input");
        final PAnchor selector = new PAnchor();
        selector.addStyleName("selector");

        box.add(background);
        box.add(headInline);
        headInline.add(icon);
        headInline.add(header);
        headInline.add(close);
        box.add(buy);
        box.add(buyPipHead);
        box.add(buyNum);
        box.add(buyPipNum);
        buyPipNum.add(buyPipNumStrong);
        box.add(buyDirection);
        box.add(sell);
        box.add(sellPipHead);
        box.add(sellNum);
        box.add(sellPipNum);
        sellPipNum.add(sellPipNumStrong);
        box.add(amtLabel);
        box.add(sellDirection);
        box.add(spread);

        box.addDomHandler(new PDragStartHandler() {

            @Override
            public void onDragStart(final PDragStartEvent event) {}
        }, PDragStartEvent.TYPE);

        box.addDomHandler(new PDropHandler() {

            @Override
            public void onDrop(final PDropEvent event) {
                box.removeStyleName("dragenter");
                final PWidget source = event.getDragSource();
                if (source != null && source != box) {
                    final int dropIndex = boxContainer.getWidgetIndex(box);
                    boxContainer.remove(source);
                    boxContainer.insert(source, dropIndex);
                }
            }
        }, PDropEvent.TYPE);

        box.addDomHandler(new PDragEnterHandler() {

            @Override
            public void onDragEnter(final PDragEnterEvent event) {
                if (currentDrag == null || !currentDrag.equals(box)) {
                    box.addStyleName("dragenter");
                    if (currentDrag != null) currentDrag.removeStyleName("dragenter");
                    currentDrag = box;
                }
            }
        }, PDragEnterEvent.TYPE);

        box.addDomHandler(new PDragLeaveHandler() {

            @Override
            public void onDragLeave(final PDragLeaveEvent event) {
                if (!currentDrag.equals(box)) {
                    box.removeStyleName("dragenter");
                }
            }
        }, PDragLeaveEvent.TYPE);

        PPusher.get().addDataListener(new DataListener() {

            private int lastBuy;
            private int lastSell;

            @Override
            public void onData(final Object data) {
                if (data instanceof MarketData) {
                    final MarketData msg = (MarketData) data;
                    final int spreadValue = Math.abs(msg.sell - msg.buy);

                    if (lastBuy < msg.buy) {
                        buyDirection.removeStyleName("down");
                        buyDirection.addStyleName("up");
                    } else {
                        buyDirection.removeStyleName("up");
                        buyDirection.addStyleName("down");
                    }
                    if (lastSell < msg.sell) {
                        sellDirection.removeStyleName("down");
                        sellDirection.addStyleName("up");
                    } else {
                        sellDirection.removeStyleName("up");
                        sellDirection.addStyleName("down");
                    }

                    lastBuy = msg.buy;
                    lastSell = msg.sell;
                    buyPipNumStrong.setInnerText(lastBuy + "");
                    sellPipNumStrong.setInnerText(lastSell + "");
                    spread.setText(spreadValue + "");
                }
            }
        });

        // PPusher.get().addConnectionListener(new ConnectionListener() {
View Full Code Here

TOP

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

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.