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
 /** langRefresh */
 public void langRefresh() {
   setText(GeneralComunicator.i18nExtension("dropbox.search"));
   cancelButton.setHTML(GeneralComunicator.i18n("button.cancel"));
   importButton.setHTML(GeneralComunicator.i18nExtension("button.import"));
   typeList.clear();
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.all"), "");
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.document"), CATEGORY_DOCUMENT);
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.folder"), CATEGORY_FOLDER);
 }
Exemplo n.º 3
0
 /** disable */
 private void disable() {
   setStyleName("okm-ToolBar-button-disabled");
   setResource(OKMBundleResources.INSTANCE.fastActionDisabled());
   setTitle(GeneralComunicator.i18nExtension("macros.button.title"));
 }
Exemplo n.º 4
0
 @Override
 public void onChange(LanguageEventConstant event) {
   if (event.equals(HasLanguageEvent.LANGUAGE_CHANGED)) {
     button.setTitle(GeneralComunicator.i18nExtension("macros.button.title"));
   }
 }
Exemplo n.º 5
0
  /** SearchPopup */
  public SearchPopup() {
    super(false, true);

    setText(GeneralComunicator.i18nExtension("dropbox.search"));
    vPanel = new VerticalPanel();
    vPanel.setWidth("100%");

    table = new ColoredFlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.setCellSpacing(0);
    table.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (selectedRow >= 0) {
              table.setStyleRow(selectedRow, false);
            }
            selectedRow = table.getCellForEvent(event).getRowIndex();
            table.setStyleRow(selectedRow, true);
            importButton.setEnabled(true);
          }
        });
    table.addDoubleClickHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            if (selectedRow >= 0) {
              if (selectedRow >= 0) {
                table.setStyleRow(selectedRow, false);
              }
              executeImport();
              table.setStyleRow(selectedRow, true);
              hide();
            }
          }
        });

    scrollPanel = new ScrollPanel(table);
    scrollPanel.setPixelSize(690, 250);
    scrollPanel.setStyleName("okm-Popup-text");

    hSearchPanel = new HorizontalPanel();
    name = new TextBox();
    name.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            executeSearch();
          }
        });
    name.setWidth("540px");
    name.setStyleName("okm-Input");

    typeList = new ListBox();
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.all"), "");
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.document"), CATEGORY_DOCUMENT);
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.folder"), CATEGORY_FOLDER);
    typeList.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            executeSearch();
          }
        });
    typeList.setStyleName("okm-Input");

    hSearchPanel.add(UtilComunicator.hSpace("5"));
    hSearchPanel.add(name);
    hSearchPanel.add(UtilComunicator.hSpace("5"));
    hSearchPanel.add(typeList);

    // Buttons panel
    cancelButton =
        new Button(
            GeneralComunicator.i18n("button.cancel"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });
    cancelButton.setStyleName("okm-NoButton");
    importButton =
        new Button(
            GeneralComunicator.i18nExtension("button.import"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                executeImport();
                hide();
              }
            });
    importButton.setStyleName("okm-YesButton");

    hButtonPanel = new HorizontalPanel();
    hButtonPanel.add(cancelButton);
    hButtonPanel.add(new HTML("&nbsp;"));
    hButtonPanel.add(importButton);

    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(hSearchPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(scrollPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(hButtonPanel);
    vPanel.add(UtilComunicator.vSpace("5"));

    vPanel.setCellHorizontalAlignment(hSearchPanel, HasAlignment.ALIGN_LEFT);
    vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hButtonPanel, HasAlignment.ALIGN_CENTER);

    setWidget(vPanel);
  }