Пример #1
0
  /**
   * 参数条件树上增加节点
   *
   * @param conditionNodeObj
   */
  private TreeNode addParaTreNode(IStatisticCaliber aCal) {
    // 得到父节点
    DefaultTreeModel treeModel = (DefaultTreeModel) treWhere.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
    // 判断增加的父节点是否已存在,默认父节点不存在
    boolean sFlag = false;
    IStatisticCaliber curCal = null;
    DefaultMutableTreeNode curNode = null;
    int iChildCount = root.getChildCount();
    // 得到根节点下的子节点
    for (int i = 0; i < iChildCount; i++) {
      curNode = (DefaultMutableTreeNode) root.getChildAt(i);
      curCal = ((Caliber) curNode.getUserObject()).getACal();
      if (aCal.getSourceID().equals(curCal.getSourceID())) {
        sFlag = true;
        break;
      }
    }

    DefaultMutableTreeNode ANode = null;
    if (!sFlag) { // 父节点不存在
      // 增加父节点
      ICustomStatisticCaliber parCal = new MySummaryStatisticCaliberImpl();
      parCal.setSourceID(aCal.getSourceID());
      // 数据源名称
      String sDataSourceName = dataSourceCbx.getRefModel().getNameByValue(aCal.getSourceID());
      parCal.setValue(sDataSourceName);
      ANode = new DefaultMutableTreeNode(new Caliber(parCal));
      treeModel.insertNodeInto(ANode, root, root.getChildCount());
      curNode = (DefaultMutableTreeNode) root.getLastChild();
    }
    ANode = new DefaultMutableTreeNode(new Caliber(aCal));
    treeModel.insertNodeInto(ANode, curNode, curNode.getChildCount());
    return ANode;
  }
Пример #2
0
    public void actionPerformed(ActionEvent arg0) {
      DefaultMutableTreeNode curTreeNode =
          (DefaultMutableTreeNode) treWhere.getLastSelectedPathComponent();
      if (curTreeNode == null || !curTreeNode.isLeaf()) return;

      Caliber cal = (Caliber) curTreeNode.getUserObject();
      IStatisticCaliber myCaliber = cal.getACal();
      if (!(myCaliber instanceof ICustomStatisticCaliber)) {
        ICustomStatisticCaliber caliberTmp = new MySummaryStatisticCaliberImpl();
        caliberTmp.setAddSQL(myCaliber.getAddSQL());
        caliberTmp.setCompareType(myCaliber.getCompareType());
        caliberTmp.setJoinBefore(myCaliber.getJoinBefore());
        caliberTmp.setSourceColID(myCaliber.getSourceColID());
        caliberTmp.setSourceID(myCaliber.getSourceID());
        caliberTmp.setValue(myCaliber.getValue());
        caliberTmp.setCaliberID(DefinePub.getRandomUUID());
        cal.setACal(caliberTmp);
      }

      myCaliber = cal.getACal();
      if (((ICustomStatisticCaliber) myCaliber).getRParenthesis() != null) {
        ((ICustomStatisticCaliber) myCaliber)
            .setRParenthesis(((ICustomStatisticCaliber) cal.getACal()).getRParenthesis() + ")");
      } else {
        ((ICustomStatisticCaliber) myCaliber).setRParenthesis(")");
      }
      curTreeNode.setUserObject(cal);
      // 刷新节点中文名称
      refreshNodeChName(curTreeNode);
      // 刷新节点
      ((DefaultTreeModel) treWhere.getModel()).nodeChanged(curTreeNode);
    }
Пример #3
0
    public void actionPerformed(ActionEvent arg0) {

      DefaultMutableTreeNode curTreeNode =
          (DefaultMutableTreeNode) treWhere.getLastSelectedPathComponent();
      if (curTreeNode == null || !curTreeNode.isLeaf()) return;
      Caliber cal = (Caliber) curTreeNode.getUserObject();
      if (cal.getACal() instanceof ICustomStatisticCaliber) {
        ICustomStatisticCaliber myCal = (ICustomStatisticCaliber) cal.getACal();
        myCal.setLParenthesis("");
        myCal.setRParenthesis("");
        curTreeNode.setUserObject(cal);
        // 刷新节点中文名称
        refreshNodeChName(curTreeNode);
        // 刷新节点
        ((DefaultTreeModel) treWhere.getModel()).nodeChanged(curTreeNode);
      }
    }