Exemplo n.º 1
0
  /**
   * FastAction
   *
   * @param uuidList
   */
  public Macros(List<String> uuidList) {
    if (isRegistered(uuidList)) {
      singleton = this;
      status = new Status();
      status.setStyleName("okm-StatusPopup");
      button =
          new ToolBarButton(
              new Image(OKMBundleResources.INSTANCE.fastActionDisabled()),
              GeneralComunicator.i18nExtension("macros.button.title"),
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  if (enabled) {
                    status.setExecuteAction();
                    macrosService.executeAction(
                        selectedAction,
                        getPath(),
                        new AsyncCallback<Object>() {
                          @Override
                          public void onSuccess(Object result) {
                            switch (selectedPanel) {
                              case TAB_DOCUMENT:
                              case TAB_MAIL:
                                GeneralComunicator.refreshUI();
                                break;
                              case TAB_FOLDER:
                                // Calculating new folder path
                                String fldPath = getPath();
                                fldPath = fldPath.substring(0, fldPath.lastIndexOf("/"));
                                GeneralComunicator.openAllFolderPath(fldPath, null);
                                break;
                            }
                            status.unsetExecuteAction();
                          }

                          @Override
                          public void onFailure(Throwable caught) {
                            status.unsetExecuteAction();
                            GeneralComunicator.showError("executeAction", caught);
                          }
                        });
                  }
                }
              });
      macrosService.getActions(
          new AsyncCallback<List<GWTMacros>>() {
            @Override
            public void onSuccess(List<GWTMacros> result) {
              actions = result;
            }

            @Override
            public void onFailure(Throwable caught) {
              GeneralComunicator.showError("getActions", caught);
            }
          });
    }
  }
Exemplo n.º 2
0
 /** disable */
 private void disable() {
   setStyleName("okm-ToolBar-button-disabled");
   setResource(OKMBundleResources.INSTANCE.fastActionDisabled());
   setTitle(GeneralComunicator.i18nExtension("macros.button.title"));
 }