Ejemplo n.º 1
0
  private String decorateStatus(String name, ConfigStatus status, String message, boolean bling) {
    String s = "<div class='config-title'>" + name + "</div>";

    String check = "";
    if (bling) {
      check = " check";
    }

    switch (status) {
      case VALID:
        s +=
            "<div title='Valid' class='config-status"
                + check
                + "'>"
                + new Image(Icons.INSTANCE.accept()).toString()
                + "</div>";
        if (null != message) {
          s += "<div class='x-form-item config-message green'>" + message + "</div>";
        }
        break;
      case ERROR:
        s +=
            "<div title='Failed' class='config-status"
                + check
                + "'>"
                + new Image(Icons.INSTANCE.exclamation()).toString()
                + "</div>";
        if (null != message) {
          s += "<div class='x-form-item config-message red'>" + message + "</div>";
        }
        break;
      case CHECKING:
        s +=
            "<div title='Checking' class='config-status check'>"
                + new Image(Icons.INSTANCE.lightning()).toString()
                + "</div>";
        break;
      case EDITING:
        s +=
            "<div title='Editing' class='config-status check'>"
                + new Image(Icons.INSTANCE.pencil()).toString()
                + "</div>";
        break;
      default:
        break;
    }

    return s;
  }
Ejemplo n.º 2
0
  private Button getExportButton() {
    Button exportButton = new Button(I18nUtils.getMessages().config_button_export());
    exportButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.page_save()));
    exportButton.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          @Override
          public void handleEvent(BaseEvent be) {
            String url = GWT.getModuleBaseURL() + "exportconfig";
            Window.open(url, "_self", "");
          }
        });
    return exportButton;
  }
Ejemplo n.º 3
0
  private Button getDownloadLogButton() {
    Button downloadButton = new Button(I18nUtils.getMessages().config_button_downloadLog());
    downloadButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.download()));
    downloadButton.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          @Override
          public void handleEvent(BaseEvent be) {
            String url = GWT.getModuleBaseURL() + "downloadlog";
            Window.open(url, "_self", "");
          }
        });

    return downloadButton;
  }
Ejemplo n.º 4
0
  @Override
  public ToolBar initToolBar() {
    SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus());

    final Button importUser = new Button();

    importUser.setText(I18nUtils.getMessages().user_button_importUsers());
    importUser.setTitle(I18nUtils.getMessages().user_button_importUsers_tip());
    importUser.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.user()));
    importUser.enable();
    importUser.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            initUserImportView();
          }
        });
    toolbar.add(importUser);

    return toolbar;
  }
  @Override
  public ToolBar initToolBar() {
    SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus(), getSubModule().hasEditRight());
    final Button bmToolbarButton =
        new Button(
            I18nUtils.getMessages().project_button_BranchManagment(),
            AbstractImagePrototype.create(Icons.INSTANCE.branches()));
    AdaptId.adapt(bmToolbarButton, IdElementsAdmResource.INSTANCE.idBranchManagementButton());
    bmToolbarButton.disable();
    bmToolbarButton.setTitle(I18nUtils.getMessages().project_button_BranchManagment());
    bmToolbarButton.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            ModelData selected = getSelectedItem();
            if (selected != null && bmToolbarButton.isEnabled()) {
              Object obj = selected.get(ProjectBeanDesc.id.getName());
              int projectId = 0;
              if (obj != null) {
                projectId = (Integer) obj;
              }
              String name = selected.get(ProjectBeanDesc.label.getName());
              String warning = selected.get(ProjectBeanDesc.warning.getName());
              if (warning == null) {
                Window window = new BranchManagmentWindow(projectId, name);
                window.show();
              } else {
                String messageTitle = "<font size='3'>" + "Can't manage branches:" + "<font/><br>";
                String messageDetail =
                    "<I><font size='2' style='color:red'>" + warning + "<font/><I/>";
                String message = messageTitle + messageDetail;
                MessageBox.alert("Warning", message, null);
              }
            }
          }
        });

    if (!getSubModule().hasEditRight()) {
      GXTUtils.hideComponents(bmToolbarButton);
    }

    getEventBus()
        .addHandler(
            SubModuleEvent.getType(),
            new SubModuleHandler() {

              public void onEvent(SubModuleEvent event) {
                if (event.getEventType() == EventType.OnGridSelect
                    && getSubModule().hasEditRight()) {
                  bmToolbarButton.enable();
                } else if (event.getEventType() == EventType.OnGridUnselect
                    || event.getEventType() == EventType.OnClickCancel) {
                  bmToolbarButton.disable();
                }
              }
            });

    toolbar.add(bmToolbarButton);
    return toolbar;
  }