Package com.ponysdk.ui.server.basic

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


        super.onFirstShowPage();

        PScript.get().execute("window.colors = {};");

        final PFlowPanel layout = new PFlowPanel();
        layout.add(new PLabel("Pony SDK styling use Less CSS. It's really easy to customize your styling with the use of a few variable."));
        layout.add(new PLabel("Customize the sample by changing this variables :"));

        final Form form = new Form();

        final PSimplePanel headerPreview = new PSimplePanel();
        final PSimplePanel headerTextColorPreview = new PSimplePanel();
        final PSimplePanel footerPreview = new PSimplePanel();
        final PSimplePanel footerTextColorPreview = new PSimplePanel();
        final PSimplePanel highlightPreview = new PSimplePanel();

        final PSimplePanel blackPreview = new PSimplePanel();
        final PSimplePanel grayDarkerPreview = new PSimplePanel();
        final PSimplePanel grayDarkPreview = new PSimplePanel();
        final PSimplePanel grayPreview = new PSimplePanel();
        final PSimplePanel grayLightPreview = new PSimplePanel();
        final PSimplePanel grayLighterPreview = new PSimplePanel();
        final PSimplePanel whitePreview = new PSimplePanel();

        header = buildColorFormField("498BF4", headerPreview);
        headerTextColor = buildColorFormField("EDEDED", headerTextColorPreview);
        footer = buildColorFormField("498BF4", footerPreview);
        footerTextColor = buildColorFormField("EDEDED", footerTextColorPreview);
        highlight = buildColorFormField("498BF4", highlightPreview);

        black = buildColorFormField("000000", blackPreview);
        grayDarker = buildColorFormField("222222", grayDarkerPreview);
        grayDark = buildColorFormField("333333", grayDarkPreview);
        gray = buildColorFormField("555555", grayPreview);
        grayLight = buildColorFormField("999999", grayLightPreview);
        grayLighter = buildColorFormField("eeeeee", grayLighterPreview);
        white = buildColorFormField("ffffff", whitePreview);

        form.addFormField(header.formField);
        form.addFormField(headerTextColor.formField);
        form.addFormField(footer.formField);
        form.addFormField(footerTextColor.formField);
        form.addFormField(highlight.formField);

        form.addFormField(black.formField);
        form.addFormField(grayDarker.formField);
        form.addFormField(grayDark.formField);
        form.addFormField(gray.formField);
        form.addFormField(grayLight.formField);
        form.addFormField(grayLighter.formField);
        form.addFormField(white.formField);

        final PFlexTable formLayout = new PFlexTable();
        formLayout.setWidget(0, 0, new FormFieldComponent("header", header.formField));
        formLayout.setWidget(1, 0, new FormFieldComponent("headerTextColor", headerTextColor.formField));
        formLayout.setWidget(2, 0, new FormFieldComponent("footer", footer.formField));
        formLayout.setWidget(3, 0, new FormFieldComponent("footerTextColor", footerTextColor.formField));
        formLayout.setWidget(5, 0, new FormFieldComponent("highlight", highlight.formField));

        formLayout.setWidget(0, 1, headerPreview);
        formLayout.setWidget(1, 1, headerTextColorPreview);
        formLayout.setWidget(2, 1, footerPreview);
        formLayout.setWidget(3, 1, footerTextColorPreview);
        formLayout.setWidget(5, 1, highlightPreview);

        formLayout.setWidget(0, 2, new FormFieldComponent("black", black.formField));
        formLayout.setWidget(1, 2, new FormFieldComponent("grayDarker", grayDarker.formField));
        formLayout.setWidget(2, 2, new FormFieldComponent("grayDark", grayDark.formField));
        formLayout.setWidget(3, 2, new FormFieldComponent("gray", gray.formField));
        formLayout.setWidget(4, 2, new FormFieldComponent("grayLight", grayLight.formField));
        formLayout.setWidget(5, 2, new FormFieldComponent("grayLighter", grayLighter.formField));
        formLayout.setWidget(6, 2, new FormFieldComponent("white", white.formField));

        formLayout.setWidget(0, 3, blackPreview);
        formLayout.setWidget(1, 3, grayDarkerPreview);
        formLayout.setWidget(2, 3, grayDarkPreview);
        formLayout.setWidget(3, 3, grayPreview);
        formLayout.setWidget(4, 3, grayLightPreview);
        formLayout.setWidget(5, 3, grayLighterPreview);
        formLayout.setWidget(6, 3, whitePreview);

        final PButton validateButton = new PButton("Validate");
        validateButton.setStyleName("pony-PButton accent");
        validateButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final boolean isValid = form.isValid();
                if (isValid) {
                    updateClientColorAndRefreshLess();
                }
            }

        });

        layout.add(formLayout);
        layout.add(validateButton);

        final PListBox themesSelector = new PListBox();
        themesSelector.addItem(STANDARD);
        themesSelector.addItem(DARK);
        themesSelector.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final String selectedItem = themesSelector.getSelectedItem();
                setTheme(selectedItem);
            }
        });

        layout.add(new PHTML("<br><br><br>"));
        layout.add(new PLabel("You can easily compile many themes"));
        layout.add(new PLabel("Try some of it: "));
        layout.add(themesSelector);

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


    private PScrollPanel buildCenterPanel() {
        final PScrollPanel panel = new PScrollPanel();
        panel.setSizeFull();
        panel.setStyleProperty("backgroundColor", "#c17d7d");
        panel.setWidget(new PLabel(
                "This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow. This is some text to show how the contents on either side of the splitter flow."));
        return panel;
    }
View Full Code Here

    private PHorizontalPanel buildComponent(final String name, final String color) {
        final PHorizontalPanel panel = new PHorizontalPanel();
        panel.setSizeFull();
        panel.setStyleProperty("backgroundColor", color);
        final PLabel label = new PLabel("The " + name + " component");
        panel.add(label);
        panel.setCellHorizontalAlignment(label, PHorizontalAlignment.ALIGN_CENTER);
        panel.setCellVerticalAlignment(label, PVerticalAlignment.ALIGN_MIDDLE);
        return panel;
    }
View Full Code Here

    protected void addTabContent(final PTabPanel tabPanel) {
        final PSimplePanel tabContent = new PSimplePanel();

        final int tabIndex = tabCount;
        final PLabel label = new PLabel("content-" + tabIndex);
        tabContent.setWidget(label);
        tabPanel.add(tabContent, "Tab-" + tabIndex);
        tabCount++;
    }
View Full Code Here

    protected void addCustomTabContent(final PTabPanel tabPanel) {
        final PSimplePanel tabContent = new PSimplePanel();

        final int tabIndex = tabCount;
        final PLabel tabLabel = new PLabel("CustomTab-" + tabIndex);
        tabLabel.setStyleProperty("color", "blue");
        tabLabel.setStyleProperty("whiteSpace", "nowrap");
        final PLabel label = new PLabel("content-" + tabIndex);
        tabContent.setWidget(label);
        tabPanel.add(tabContent, tabLabel);
        tabCount++;
    }
View Full Code Here

        labels = new PLabel[100][10];

        for (int r = 0; r < 100; r++) {
            for (int c = 0; c < 10; c++) {
                final PLabel pLabel = new PLabel(r + "_" + c);
                labels[r][c] = pLabel;
                pLabel.setWidth("40px");
                table.setWidget(r, c, pLabel);
            }
        }

        pusher.addConnectionListener(new ConnectionListener() {
View Full Code Here

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

            final PButton addMessage = new PButton("Add message");
            addMessage.addClickHandler(new PClickHandler() {

                @Override
                public void onClick(final PClickEvent event) {
                    flow.add(new PLabel("Hello " + (count++)));
                }
            });
            final PButton clearMessage = new PButton("Clear message");
            clearMessage.addClickHandler(new PClickHandler() {
View Full Code Here

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

        label = new PLabel("0");

        final PButton scheduleRepeatingButton = new PButton("Start");
        scheduleRepeatingButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                timer.scheduleRepeating(Integer.valueOf(textBox.getText()));
            }
        });
        panel.add(new PLabel("Simple repeating timer"));
        panel.add(label);
        panel.add(textBox);
        panel.add(scheduleRepeatingButton);

        // Fixed delay
        final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy MM dd hh:mm:ss");
        final PLabel dateLabel = new PLabel(dateFormat.format(Calendar.getInstance().getTime()));
        panel.add(new PHTML("<br>"));
        panel.add(new PLabel("Fixed delay timer"));
        panel.add(dateLabel);
        final PButton fixedDelayButton = new PButton("Start");
        fixedDelayButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                PScheduler.get().scheduleFixedDelay(new RepeatingCommand() {

                    @Override
                    public boolean execute() {
                        dateLabel.setText(dateFormat.format(Calendar.getInstance().getTime()));
                        return true;
                    }
                }, 1000);
            }
        });
        panel.add(fixedDelayButton);

        // Client side only
        panel.add(new PHTML("<br>"));
        panel.add(new PLabel("Timer (terminal side)"));
        final PButton changeColorsBUtton = new PButton("Start");
        changeColorsBUtton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                final PTerminalScheduledCommand deferred1 = new PTerminalScheduledCommand() {

                    @Override
                    protected void run() {
                        changeColorsBUtton.setStyleProperty("color", "blue");
                    }
                };
                deferred1.schedule(2000);

                final PTerminalScheduledCommand deferred2 = new PTerminalScheduledCommand() {

                    @Override
                    protected void run() {
                        changeColorsBUtton.setStyleProperty("color", "orange");
                    }
                };
                deferred2.schedule(4000);

                final PTerminalScheduledCommand deferred3 = new PTerminalScheduledCommand() {

                    @Override
                    protected void run() {
                        changeColorsBUtton.setStyleProperty("color", "black");
                    }
                };
                deferred3.schedule(6000);
            }
        });
        panel.add(changeColorsBUtton);

        labelScheduler = new PLabel("0");

        panel.add(new PLabel("UI Scheduler"));
        panel.add(labelScheduler);

        examplePanel.setWidget(panel);

    }
View Full Code Here

        final PDockLayoutPanel dock = new PDockLayoutPanel(PUnit.PX);
        dock.addSouth(inputTextBox, 30);
        dock.add(scroll);

        history.add(new PLabel("> With PonySDK, you can also execute native javascript"));
        history.add(new PLabel("> Try it out.. "));

        inputTextBox.addKeyUpHandler(new PKeyUpFilterHandler(PKeyCodes.ENTER, PKeyCodes.DOWN, PKeyCodes.UP) {

            @Override
            public void onKeyUp(final PKeyUpEvent keyUpEvent) {
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.