示例#1
0
  public void buttonClick(ClickEvent event) {
    try {
      if (event.getButton().equals(saveBtn)) {
        save();
        close();
      } else if (event.getButton().equals(addBtn)) {
        LightProcessDefinition lpd = (LightProcessDefinition) processesComboBox.getValue();
        addTableRow(lpd);
        processesComboBox.removeItem(lpd);
      } else if (event.getButton().equals(deleteBtn)) {
        delete();
        close();
      } else if (event.getButton() instanceof TableLinkButton) {
        LightProcessDefinition lpd =
            (LightProcessDefinition) ((TableLinkButton) event.getButton()).getTableValue();
        table.removeItem(lpd);
        processesComboBox.addItem(lpd);
        processesComboBox.setItemCaption(
            lpd, lpd.getLabel() + " (version " + lpd.getVersion() + ")");
      } else {
        close();
      }

    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }
示例#2
0
 private void addTableRow(LightProcessDefinition pd) {
   Item woItem = table.addItem(pd);
   woItem.getItemProperty("name").setValue(pd.getLabel());
   woItem.getItemProperty("version").setValue(pd.getVersion());
   woItem.getItemProperty("deployedBy").setValue(pd.getDeployedBy());
   TableLinkButton tlb =
       new TableLinkButton(
           ProcessbaseApplication.getCurrent().getPbMessages().getString("btnRemove"),
           "icons/cancel.png",
           pd,
           this);
   woItem.getItemProperty("actions").setValue(tlb);
 }
示例#3
0
  public void refreshTable() {
    try {
      table.removeAllItems();
      Collection<LightProcessDefinition> processes =
          ProcessbaseApplication.getCurrent()
              .getBpmModule()
              .getLightProcessDefinitions(ProcessState.ENABLED);

      for (LightProcessDefinition pd : processes) {
        if (pd.getCategoryNames().contains(category.getName())) {
          addTableRow(pd);
        } else {
          Item woItem = processesComboBox.addItem(pd);
          String caption = pd.getLabel() != null ? pd.getLabel() : pd.getName();
          processesComboBox.setItemCaption(pd, caption + " (version " + pd.getVersion() + ")");
        }
      }
      table.setSortContainerPropertyId("name");
      table.setSortAscending(true);
      table.sort();
    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }
示例#4
0
 private void save() throws Exception {
   for (Object object : table.getContainerDataSource().getItemIds()) {
     LightProcessDefinition lpd = (LightProcessDefinition) object;
     Set<String> cats = lpd.getCategoryNames();
     cats.add(category.getName());
     ProcessbaseApplication.getCurrent().getBpmModule().setProcessCategories(lpd.getUUID(), cats);
   }
   for (Object object : processesComboBox.getItemIds()) {
     LightProcessDefinition lpd = (LightProcessDefinition) object;
     Set<String> cats2 = lpd.getCategoryNames();
     cats2.remove(category.getName());
     ProcessbaseApplication.getCurrent().getBpmModule().setProcessCategories(lpd.getUUID(), cats2);
   }
 }