示例#1
0
  private static void init() {
    showProfileSearches();

    searchInfos = RootPanel.get("profileSearches_searchInfos");
    clearSearches = RootPanel.get("profileSearches_clearSearches");
    clearSearches.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "wait");

            if (clearSearches.getElement().getClassName().contains("disabled")) {
              return;
            }
            userService.clearSavedSearches(
                GWTClient.getCurrentUser().getId(),
                new AsyncCallback<Void>() {
                  @Override
                  public void onFailure(Throwable caught) {
                    DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "default");
                    Window.alert("There was an error while clearing your cart.");
                  }

                  @Override
                  public void onSuccess(Void result) {
                    DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "default");
                    refreshSearches();
                  }
                });
          }
        },
        ClickEvent.getType());
    setSearchInfos();
  }
示例#2
0
 public void onModuleLoad() {
   RootPanel root = RootPanel.get();
   root.add(view);
   root.addDomHandler(view, KeyDownEvent.getType());
   controller.initAndStartWith(clock);
   view.initAndRender();
 }