示例#1
0
  public void save() {

    String frequency = month.getSelectedIndex() + "";
    String stat = statusButton.getValue() + "";
    String url = /*Window.Location.getUrl();*/ Window.Location.getHref().split("#", 2)[0];
    String day =
        DateTimeFormat.getFormat("yyyy-MM-dd").format(date.getValue())
            + " "
            + DateTimeFormat.getFormat("HH:mm:ss").format(time.getValue());
    //		Window.alert(frequency + " " + stat + " " + url + " " + day);
    mailingService.setMailing(
        stat,
        frequency,
        day,
        url,
        new AsyncCallback<Boolean>() {

          @Override
          public void onFailure(Throwable caught) {
            com.google.gwt.user.client.Window.alert("Error :" + caught.getMessage());
            save.setIcon(null);
            save.setEnabled(true);
          }

          @Override
          public void onSuccess(Boolean result) {
            com.google.gwt.user.client.Window.alert(result ? "Success!" : "Error!");
            save.setIcon(null);
            save.setEnabled(true);
          }
        });
  }