Exemple #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);
          }
        });
  }
Exemple #2
0
  public void load() {
    mailingService.getMailingStat(
        new AsyncCallback<String[]>() {

          @Override
          public void onSuccess(String[] result) {
            //				Window.alert(result[0] + " " + result[1] + " " + result[2]);
            statusButton.setValue(Boolean.valueOf(result[0]));
            statusButton.setText(Boolean.valueOf(result[0]) ? "On" : "Off");
            month.setValue(lFrequency.get(Integer.valueOf(result[1])));
            time.setValue(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").parse(result[2]));
            date.setValue(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").parse(result[2]));
            refresh.setIcon(null);
            refresh.setEnabled(true);
          }

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