Package com.ponysdk.sample.client.event

Examples of com.ponysdk.sample.client.event.DemoBusinessEvent


        stackLayoutPanel.addSelectionHandler(new PSelectionHandler<Integer>() {

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

        panel.add(stackLayoutPanel);
View Full Code Here


        suggestBox.addSelectionHandler(new PSelectionHandler<PSuggestion>() {

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

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

        final List<String> datas = new ArrayList<String>();
        for (final Pony pony : ponys.getData()) {
            datas.add(pony.getName());
        }
        suggestOracle.addAll(datas);
        suggestOracle.setDefaultSuggestions(datas.subList(0, 5));

        panel.add(suggestBox);

        panel.add(new PHTML("<br><br>"));

        panel.add(new PLabel("Manipulate the suggest box:"));
        final PListBox operation = new PListBox(true);
        operation.addItem("Select \"Friesian horse\"", 0);
        operation.addItem("Get textbox value", 1);
        operation.addItem("Enable/Disable textbox", 2);
        operation.addItem("Clear", 3);
        operation.addItem("Add items", 4);
        operation.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final Integer item = (Integer) operation.getSelectedValue();
                if (item == null) return;

                if (item.equals(0)) {
                    suggestBox.setText("Friesian horse");
                } else if (item.equals(1)) {
                    UIContext.getRootEventBus().fireEvent(new DemoBusinessEvent("Text content: " + suggestBox.getText()));
                } else if (item.equals(2)) {
                    suggestBox.getTextBox().setEnabled(!suggestBox.getTextBox().isEnabled());
                } else if (item.equals(3)) {
                    final PMultiWordSuggestOracle oracle = (PMultiWordSuggestOracle) suggestBox.getSuggestOracle();
                    oracle.clear();
View Full Code Here

        showLoadingOnRequestButton.showLoadingOnRequest(true);
        showLoadingOnRequestButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                fireEvent(new DemoBusinessEvent("Button clicked"));
                try {
                    Thread.sleep(5000);
                } catch (final InterruptedException e) {}
            }
        });

        panel.add(showLoadingOnRequestButton);

        disabledOnRequestButton = new PButton("Disabled on request");
        disabledOnRequestButton.setEnabledOnRequest(false);
        disabledOnRequestButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                fireEvent(new DemoBusinessEvent("Button clicked"));
                try {
                    Thread.sleep(5000);
                } catch (final InterruptedException e) {}
            }
        });

        panel.add(disabledOnRequestButton);

        comboOnRequestButton = new PButton("Show loading and disable on request");
        comboOnRequestButton.setEnabledOnRequest(false);
        comboOnRequestButton.showLoadingOnRequest(true);
        comboOnRequestButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                fireEvent(new DemoBusinessEvent("Button clicked"));
                try {
                    Thread.sleep(5000);
                } catch (final InterruptedException e) {}
            }
        });
View Full Code Here

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

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

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

    protected void notifyDateChange(final String source, final Date value) {
        String date = "null";
        if (value != null) {
            date = dateTimeFormatter.format(value);
        }
        fireEvent(new DemoBusinessEvent("Date change from #" + source + ", new value #" + date));
    }
View Full Code Here

TOP

Related Classes of com.ponysdk.sample.client.event.DemoBusinessEvent

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.