/**
   * @param tree
   * @param clcte
   * @param clctfproviderfactory
   * @return
   * @postcondition result != null
   */
  @Override
  protected List<TreeNodeAction> _getTreeNodeActions(
      JTree tree,
      CollectableEntity clcte,
      CollectableFieldsProviderFactory clctfproviderfactory,
      Collection<CollectableEntityField> additionalFields) {
    final List<TreeNodeAction> result =
        new LinkedList<TreeNodeAction>(
            super._getTreeNodeActions(tree, clcte, clctfproviderfactory, additionalFields));
    if (!result.isEmpty()) {
      result.add(TreeNodeAction.newSeparatorAction());
    }
    final CompositeTreeNodeAction actAdd =
        this.getAddTreeNodeActions(tree, clcte, clctfproviderfactory, additionalFields);
    actAdd.setEnabled(this.getChildCount() == 0);
    result.add(actAdd);

    result.add(new RemoveNodeAction(tree));

    result.add(TreeNodeAction.newSeparatorAction());

    result.add(TreeNodeAction.newCutAction(tree));
    result.add(TreeNodeAction.newCopyAction(tree));
    result.add(TreeNodeAction.newPasteAction(tree, this));

    assert result != null;
    return result;
  }
示例#2
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;
  }