Example usage for com.google.gwt.user.client Window alert

List of usage examples for com.google.gwt.user.client Window alert

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window alert.

Prototype

public static void alert(String msg) 

Source Link

Usage

From source file:asquare.gwt.tests.buttonclick.client.Demo.java

License:Apache License

public void onModuleLoad() {
    Button m_button1 = new Button("Click me");
    final Button m_button2 = new Button("Target button");
    m_button1.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            m_button2.click();/*from   w w w.  ja  v a  2s.c  o m*/
        }
    });
    m_button2.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("target button click() called");
        }
    });
    RootPanel.get().add(m_button1);
    RootPanel.get().add(m_button2);
}

From source file:asquare.gwt.tk.demo.client.MiscPanel.java

License:Apache License

private Widget createSimpleHyperLinkPanel() {
    BasicPanel panel = new BasicPanel("div");
    panel.setStyleName("division");

    String content = "<H2>SimpleHyperLink</H2>"
            + "A hyperlink based on an anchor. No pesky DIV messing up your text flow. No history tokens in the location bar.";
    HTML header = new HTML(content);
    header.addStyleName("header");
    panel.add(header);/* w  w  w. j  a  v a 2  s .  c o m*/

    BasicPanel example = new BasicPanel();
    example.addStyleName("example");

    example.add(new SimpleHyperLink("SpongeBob says...", new ClickListener() {
        public void onClick(Widget sender) {
            Window.alert("I'm a goofy goober!");
        }
    }));

    panel.add(example);
    return panel;
}

From source file:asquare.gwt.tkdemo.client.demos.MiscPanel.java

License:Apache License

private Widget createSimpleHyperLinkDemo() {
    BasicPanel panel = new BasicPanel();
    panel.addStyleName("division");

    String content = "<H2>SimpleHyperLink</H2>"
            + "A hyperlink based on an anchor. No pesky DIV messing up your text flow. No history tokens in the location bar.";
    HTML header = new HTML(content);
    header.addStyleName("description");
    panel.add(header);//from www  .  j a  v  a2  s .co  m

    BasicPanel example = new BasicPanel();
    example.addStyleName("example");

    example.add(new SimpleHyperLink("SpongeBob says...", new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert("I'm a goofy goober!");
        }
    }));

    panel.add(example);
    return panel;
}

From source file:at.ait.dme.yuma.client.Application.java

License:EUPL

/**
 * load the module and initialize the application
 *//*w ww .  ja  va2  s.c o  m*/
public void onModuleLoad() {
    String imageUrl = getRequestParameterValue("objectURL");
    String htmlUrl = getRequestParameterValue("htmlURL");

    if (htmlUrl == null) {
        initApplication(imageUrl);
    } else {
        final LoadMask loadMask = new LoadMask("Loading...");
        loadMask.show();

        WebsiteCaptureServiceAsync captureService = (WebsiteCaptureServiceAsync) GWT
                .create(WebsiteCaptureService.class);
        captureService.captureSite(htmlUrl, new AsyncCallback<String>() {
            public void onFailure(Throwable caught) {
                ErrorMessages errorMessages = (ErrorMessages) GWT.create(ErrorMessages.class);
                Window.alert(errorMessages.imageNotFound());
            }

            public void onSuccess(String imageUrl) {
                loadMask.hide();
                initApplication(imageUrl);
            }
        });
    }
}

From source file:at.ait.dme.yuma.client.Application.java

License:EUPL

private void initApplication(String imageUrl) {
    showHeader();//from w w w.j  av  a  2s . c o m

    showImage(imageUrl);

    // the image has to be completely loaded before we can show the annotations
    // otherwise possible fragments can not be displayed properly
    imageComposite.addLoadHandler(new LoadHandler() {
        public void onLoad(LoadEvent events) {
            // first we authenticate the user by either using the provided
            // user name or the secure authentication token.   
            String userName = getRequestParameterValue("user");
            if (userName != null && !userName.trim().isEmpty()) {
                // TODO deactivate this if you ever go into production               
                setAuthenticatedUser(new User(userName));
                showAnnotations();
                return;
            }

            String authToken = getRequestParameterValue("authToken");
            String appSign = getRequestParameterValue("appSign");

            AuthenticationServiceAsync authService = (AuthenticationServiceAsync) GWT
                    .create(AuthenticationService.class);
            authService.authenticate(authToken, appSign, new AsyncCallback<User>() {
                public void onFailure(Throwable caught) {
                    ErrorMessages errorMessages = (ErrorMessages) GWT.create(ErrorMessages.class);
                    Window.alert(errorMessages.failedToAuthenticate());
                    // create non-privileged user to use read-only mode.
                    setAuthenticatedUser(new User());
                    showAnnotations();
                }

                public void onSuccess(User user) {
                    setAuthenticatedUser(user);
                    showAnnotations();
                }
            });
        }
    });
}

From source file:at.ait.dme.yuma.client.map.annotation.GoogleMapsComposite.java

License:EUPL

/**
 * transform a list of points from pixels to LatLng using the transformation service, in case
 * no bounding box was provided./*from   w  w w.  j a v a  2s.  com*/
 * 
 * @param xyCoord
 */
private void transformPoints(List<XYCoordinate> xyCoords) {
    TransformationServiceAsync transformationService = (TransformationServiceAsync) GWT
            .create(TransformationService.class);

    transformationService.transformCoordinates(Application.getExternalObjectId(), Application.getImageUrl(),
            xyCoords, new AsyncCallback<List<WGS84Coordinate>>() {
                public void onFailure(Throwable caught) {
                    ErrorMessages errorMessages = (ErrorMessages) GWT.create(ErrorMessages.class);
                    Window.alert(errorMessages.transformationError());
                }

                public void onSuccess(List<WGS84Coordinate> coords) {
                    List<LatLng> latlngCoords = new ArrayList<LatLng>();
                    for (WGS84Coordinate coord : coords) {
                        latlngCoords.add(LatLng.newInstance(coord.lat, coord.lon));
                    }
                    // we need to group the coordinates by annotation and display the overlays
                    int fromIndex = 0;
                    for (ImageAnnotation annotation : coordinatesCount.keySet()) {
                        int coordsCount = coordinatesCount.get(annotation);
                        GoogleMapsComposite.this.drawOverlay(
                                new ArrayList<LatLng>(
                                        latlngCoords.subList(fromIndex, fromIndex + coordsCount - 1)),
                                annotation);
                        fromIndex += coordsCount;
                    }
                }
            });
}

From source file:at.ait.dme.yuma.suite.apps.map.client.widgets.GoogleMapsComposite.java

License:EUPL

/**
 * transform a list of points from pixels to LatLng using the transformation service, in case
 * no bounding box was provided./*from  w w  w.j  a va2  s .  c o  m*/
 * 
 * @param xyCoord
 */
private void transformPoints(List<XYCoordinate> xyCoords) {
    TransformationServiceAsync transformationService = (TransformationServiceAsync) GWT
            .create(TransformationService.class);

    transformationService.transformCoordinates(YUMACoreProperties.getObjectURI(), xyCoords,
            new AsyncCallback<List<WGS84Coordinate>>() {
                public void onFailure(Throwable caught) {
                    I18NErrorMessages errorMessages = (I18NErrorMessages) GWT.create(I18NErrorMessages.class);
                    Window.alert(errorMessages.transformationError());
                }

                public void onSuccess(List<WGS84Coordinate> coords) {
                    List<LatLng> latlngCoords = new ArrayList<LatLng>();
                    for (WGS84Coordinate coord : coords) {
                        latlngCoords.add(LatLng.newInstance(coord.lat, coord.lon));
                    }
                    // we need to group the coordinates by annotation and display the overlays
                    int fromIndex = 0;
                    for (ImageAnnotation annotation : coordinatesCount.keySet()) {
                        int coordsCount = coordinatesCount.get(annotation);
                        GoogleMapsComposite.this.drawOverlay(
                                new ArrayList<LatLng>(
                                        latlngCoords.subList(fromIndex, fromIndex + coordsCount - 1)),
                                annotation);
                        fromIndex += coordsCount;
                    }
                }
            });
}

From source file:au.com.gworks.gwt.petstore.client.AccountController.java

License:Apache License

private void createAccount() {
    GWT.log("[TRACE] AccountController.createAccount", null);
    AccountInfo info = (AccountInfo) view.getInfo();
    ControllerCall cb = new ControllerCall() {
        public void onFailure(Throwable caught) {
            Window.alert("Account exist");
        }//from w  ww . ja v a  2  s  . c  o  m

        public void onSuccess(Object result) {
            AccountInfo infoResult = (AccountInfo) result;
            if (infoResult != null) {
                GWT.log("[DEBUG] Account created and login", null);
                ((StoreCoordinator) coordinator).updateLoginStatus(true, infoResult);
                History.newItem("shopping");
            } else {
                History.newItem("welcome");
            }
        }
    };
    AccountRpcController.Util.getInstance().createAccount(info, cb);
}

From source file:au.com.gworks.gwt.petstore.client.AccountController.java

License:Apache License

private void retrieveAccount() {
    GWT.log("[TRACE] AccountController.retrieveAccount", null);
    if (accountInfo != null) {
        ControllerCall cb = new ControllerCall() {
            public void onSuccess(Object result) {
                GWT.log("[DEBUG] Account retrieved.", null);
                accountInfo = (AccountInfo) result;
                view.setInfo(accountInfo);
            }//from   w  w w.ja  v  a2 s .c o  m
        };
        GWT.log("[DEBUG] Retrieving=" + accountInfo.username, null);
        AccountRpcController.Util.getInstance().retrieveAccount(accountInfo.username, cb);
    } else {
        Window.alert("Please Sign In first.");
    }
}

From source file:au.com.gworks.gwt.petstore.client.AccountController.java

License:Apache License

private void updateAccount() {
    GWT.log("[TRACE] AccountController.updateAccount", null);
    AccountInfo info = (AccountInfo) view.getInfo();
    ControllerCall cb = new ControllerCall() {
        public void onFailure(Throwable caught) {
            Window.alert("Update failed.");
        }/*from   w ww  . j a  v a  2 s .c  o  m*/

        public void onSuccess(Object result) {
            AccountInfo infoResult = (AccountInfo) result;
            if (infoResult != null) {
                GWT.log("[DEBUG] Account updated and login.", null);
                ((StoreCoordinator) coordinator).updateLoginStatus(true, infoResult);
                History.newItem("shopping");
            } else {
                History.newItem("welcome");
            }
        }
    };
    AccountRpcController.Util.getInstance().updateAccount(info, cb);
}