Пример #1
0
  @Override
  public List<TreeNodeAction> getTreeNodeActions(JTree tree) {
    final List<TreeNodeAction> result =
        new LinkedList<TreeNodeAction>(super.getTreeNodeActions(tree));
    result.add(TreeNodeAction.newSeparatorAction());
    if (((RuleNode) getUserObject()).getRuleVo() != null) {
      result.add(new ShowDetailsAction(tree));
    }

    RuleNode ruleNode = (RuleNode) this.getTreeNode();
    if (!ruleNode.isTimeLimitRule) {
      RuleAndRuleUsageEntity ruleUsage = (getTreeNode()).getRuleEntity();
      if (ruleUsage.getEventName() != null && ruleUsage.getRuleVo() != null) {
        result.add(new RemoveUsageAction(tree));
      }
    }
    return result;
  }
Пример #2
0
    /**
     * show the details
     *
     * @param tree
     * @param loexplorernode
     */
    private void cmdRemoveUsage(JTree tree, final RuleExplorerNode explorerNode) {
      final RuleAndRuleUsageEntity ruleUsage =
          ((RuleNode) explorerNode.getTreeNode()).getRuleEntity();
      if (ruleUsage != null) {
        try {
          String sMessage =
              getSpringLocaleDelegate()
                      .getMessage(
                          "RuleExplorerNode.2", "Soll die Verwendung wirklich gel\u00f6scht werden")
                  + "?";
          final int btn =
              JOptionPane.showConfirmDialog(
                  tree,
                  sMessage,
                  getSpringLocaleDelegate()
                      .getMessage("RuleExplorerNode.4", "Verwendung l\u00f6schen"),
                  JOptionPane.YES_NO_OPTION);

          if (btn == JOptionPane.YES_OPTION) {
            RuleDelegate.getInstance()
                .removeRuleUsage(
                    ruleUsage.getEventName(),
                    ruleUsage.getEntity(),
                    ruleUsage.getProcessId(),
                    ruleUsage.getStatusId(),
                    ruleUsage.getRuleVo().getId());
            ((ExplorerNode<?>) RuleExplorerNode.this.getParent()).refresh(tree);
          }
        } catch (CommonBusinessException ex) {
          Errors.getInstance().showExceptionDialog(tree, ex);
        }
      }
    }