示例#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 String toString() {

      XMLData aData = (XMLData) calcColumnDialog.getXmlDsFieldToName().get(aCal.getSourceID());
      if (aData == null) return "";
      String fieldName = (String) aData.get(aCal.getSourceColID());
      String oper = CompareType.getComparTypeName(aCal.getCompareType());
      String join = "";
      if (!isFirstNode) {
        if (aCal.getJoinBefore() == null) {
          join = "";
        } else {
          join = frdoType.getRefModel().getNameByValue(aCal.getJoinBefore()).substring(0, 2);
        }
      }

      // String sSourceName = definePub.getDataSourceNameWithID(
      // calcColumnDialog.getQuerySource(), aCal.getSourceID());
      String result = "";
      if (!Common.isNullStr(join)) {
        result = result + join + " ";
      }

      if (aCal instanceof ICustomStatisticCaliber) {
        if (((ICustomStatisticCaliber) aCal).getLParenthesis() != null) {
          result = result + ((ICustomStatisticCaliber) aCal).getLParenthesis();
        }
      }

      if (!Common.isNullStr(fieldName)) {
        result = result + fieldName + "   ";
      }
      if (!Common.isNullStr(oper)) {
        result = result + oper + "   ";
      }
      result = result + aCal.getValue();

      if (aCal instanceof ICustomStatisticCaliber) {
        if (((ICustomStatisticCaliber) aCal).getRParenthesis() != null) {
          result = result + ((ICustomStatisticCaliber) aCal).getRParenthesis();
        }
      }

      return result;
      // join + " "
      // + sSourceName + "."
      // + fieldName + " " + oper + " " + aCal.getValue();

    }