private void refreshModuleList(String selectedWorkspaceName) {
    if (selectedWorkspaceName == null || "".equals(selectedWorkspaceName)) {
      return;
    }

    LoadingPopup.showMessage(constants.LoadingWorkspaces());
    moduleService.listModules(
        selectedWorkspaceName,
        new GenericCallback<Module[]>() {
          public void onSuccess(Module[] packageConfigData) {
            selectedModulesListBox.clear();
            for (Module p : packageConfigData) {
              selectedModulesListBox.addItem(p.getName());
            }
            LoadingPopup.close();
          }
        });

    LoadingPopup.showMessage(constants.LoadingWorkspaces());
    moduleService.listModules(
        new GenericCallback<Module[]>() {
          public void onSuccess(Module[] packageConfigData) {
            availableModulesListBox.clear();
            for (Module p : packageConfigData) {
              boolean isSelected = false;
              for (int i = 0; i < selectedModulesListBox.getItemCount(); i++) {
                if (p.getName().equals(selectedModulesListBox.getItemText(i))) {
                  isSelected = true;
                }
              }
              if (!isSelected) {
                availableModulesListBox.addItem(p.getName());
              }
            }
            LoadingPopup.close();
          }
        });
  }
예제 #2
0
  /** This should popup a view of the chosen historical version. */
  private void showVersion(final String versionUUID) {

    LoadingPopup.showMessage(constants.LoadingVersionFromHistory());

    if (isPackage) {
      ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
      moduleService.loadModule(
          versionUUID,
          new GenericCallback<Module>() {
            public void onSuccess(Module conf) {
              Image image = new Image(images.snapshot());
              image.setAltText(ConstantsCore.INSTANCE.Snapshot());
              final FormStylePopup pop =
                  new FormStylePopup(
                      image,
                      constants.VersionNumber0Of1(conf.getVersionNumber(), conf.getName()),
                      800);

              ModuleEditorWrapper ed = new ModuleEditorWrapper(conf, clientFactory, eventBus, true);
              ed.setWidth("100%");
              ed.setHeight("100%");
              // pop.addRow( restore );
              pop.addRow(ed);
              pop.show();

              // LoadingPopup.close();
            }
          });
    } else {
      AssetServiceAsync assetService = GWT.create(AssetService.class);
      assetService.loadRuleAsset(
          versionUUID,
          new GenericCallback<Asset>() {

            public void onSuccess(final Asset asset) {
              asset.setReadonly(true);
              // asset.metaData.name = metaData.name;
              Image image = new Image(images.snapshot());
              image.setAltText(ConstantsCore.INSTANCE.Snapshot());
              final FormStylePopup pop =
                  new FormStylePopup(
                      image,
                      constants.VersionNumber0Of1(asset.getVersionNumber(), asset.getName()),
                      800);

              Button restore = new Button(constants.RestoreThisVersion());
              restore.addClickHandler(
                  new ClickHandler() {

                    public void onClick(ClickEvent event) {
                      restore(
                          (Widget) event.getSource(),
                          versionUUID,
                          new Command() {
                            public void execute() {
                              eventBus.fireEvent(
                                  new RefreshAssetEditorEvent(
                                      asset.getMetaData().getModuleName(), uuid));
                              // fire after check-in event
                              eventBus.fireEvent(new AfterAssetEditorCheckInEvent(uuid, null));
                              pop.hide();
                            }
                          });
                    }
                  });

              RuleViewerWrapper viewer =
                  new RuleViewerWrapper(clientFactory, eventBus, asset, true);
              viewer.setWidth("100%");
              viewer.setHeight("100%");

              pop.addRow(restore);
              pop.addRow(viewer);
              pop.show();
            }
          });
    }
  }