Package com.vaadin.ui

Examples of com.vaadin.ui.JavaScriptFunction


                @Override
                public void greet(String message) {
                    Notification.show(getState().getPrefix() + message);
                }
            });
            addFunction("greetToServer", new JavaScriptFunction() {
                @Override
                public void call(JsonArray arguments) {
                    Notification.show(getState().getPrefix()
                            + arguments.getString(0));
                }
View Full Code Here


    @Override
    protected void setup(VaadinRequest request) {
        addComponent(log);
        final JavaScript js = JavaScript.getCurrent();
        js.addFunction("testing.doTest", new JavaScriptFunction() {
            @Override
            public void call(JsonArray arguments) {
                log.log("Got " + arguments.length() + " arguments");
                log.log("Argument 1 as a number: " + (int) arguments.getNumber(0));
                log.log("Argument 2 as a string: " + arguments.getString(1));
View Full Code Here

public class JSAPIUI extends UI {
    @Override
    public void init(VaadinRequest request) {

        JavaScript.getCurrent().addFunction("com.example.api.notify",
                new JavaScriptFunction() {
                    @Override
                    public void call(JsonArray arguments) {
                        try {
                            String caption = arguments.getString(0);
                            if (arguments.length() == 1) {
View Full Code Here

            public void onPlotClick(int seriesIndex, int dataIndex) {
                Notification.show("Clicked on [" + seriesIndex + ", "
                        + dataIndex + "]");
            }
        });
        addFunction("onPlotClick", new JavaScriptFunction() {
            @Override
            public void call(JsonArray arguments) {
                int seriesIndex = (int) arguments.getNumber(0);
                int dataIndex = (int) arguments.getNumber(1);
                Notification.show("Clicked on [" + seriesIndex + ", "
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        String methodImplementation = findMethodImplementation();
        getPage().getJavaScript().addFunction("logToServer",
                new JavaScriptFunction() {
                    @Override
                    public void call(JsonArray arguments) {
                        String message = arguments.getString(0);
                        log(message);
                    }
View Full Code Here

                @Override
                public void sendRpc(String message) {
                    log.log("Got RPC message: " + message);
                }
            });
            addFunction("messageToServer", new JavaScriptFunction() {
                @Override
                public void call(JsonArray arguments) {
                    log.log("Got callback message: " + arguments.getString(0));
                }
            });

            addFunction("reportParentIds", new JavaScriptFunction() {
                @Override
                public void call(JsonArray arguments) {
                    JsonArray parentIds = arguments.getArray(0);
                    if (!parentIds.getString(0).equals(getConnectorId())) {
                        log.log("Connector ids doesn't match");
View Full Code Here

    private void ensureRpc() {
        if (javascriptCallbackRpc == null) {
            javascriptCallbackRpc = new JavaScriptCallbackRpc() {
                @Override
                public void call(String name, JsonArray arguments) {
                    JavaScriptFunction callback = callbacks.get(name);
                    try {
                        callback.call(arguments);
                    } catch (JsonException e) {
                        throw new IllegalArgumentException(e);
                    }
                }
            };
View Full Code Here

                    "Internal error finding methods in AbstractField");
        }
    }

  public UMEditorField() {
    addFunction("onValueChange", new JavaScriptFunction() {

      @Override
      public void call(JSONArray arguments) throws JSONException {
        setValue(arguments.getString(0));
      }
View Full Code Here

    private void ensureRpc() {
        if (javascriptCallbackRpc == null) {
            javascriptCallbackRpc = new JavaScriptCallbackRpc() {
                @Override
                public void call(String name, JSONArray arguments) {
                    JavaScriptFunction callback = callbacks.get(name);
                    try {
                        callback.call(arguments);
                    } catch (JSONException e) {
                        throw new IllegalArgumentException(e);
                    }
                }
            };
View Full Code Here

TOP

Related Classes of com.vaadin.ui.JavaScriptFunction

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.