예제 #1
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);
    }
예제 #2
0
    public void valueChanged(TreeSelectionEvent arg0) {

      DefaultMutableTreeNode curTreeNode =
          (DefaultMutableTreeNode) ((MyTree) arg0.getSource()).getLastSelectedPathComponent();
      if (curTreeNode == null) return;

      if (!(curTreeNode.getUserObject() instanceof Caliber)) {
        return;
      }
      Caliber cal = (Caliber) curTreeNode.getUserObject();

      // 数据源组合框
      dataSourceCbx.setValue(cal.getACal().getSourceID());

      // 根据字段列名得到字段类型
      // cbxFieldName.setSelectedIndex(-1);
      JComboBox cbxFieldNameTmp = (JComboBox) cbxFieldName.getEditor();
      int count = cbxFieldNameTmp.getItemCount();
      String value;
      for (int i = 0; i < count; i++) {
        value = ((FComboBoxItem) cbxFieldNameTmp.getItemAt(i)).getValue().toString();
        if (value.substring(0, value.indexOf(":")).equals(cal.getACal().getSourceColID())) {
          cbxFieldName.setSelectedIndex(i);
          break;
        }
      }

      // 字段名称组合框
      // cbxFieldName.setValue(cal.getACal().getSourceColID());
      // 比较类型
      cbxCompare.setValue(cal.getACal().getCompareType());

      // 根据sFieldEname返回字段类型
      String sFieldTyp = getFieldType();
      // 根据字段类型判断参数加不加引号(')
      // 条件值
      if (DefinePub.checkCharVal(sFieldTyp)) {
        String paraValue = cal.getACal().getValue();
        // 判断是不是in或not in比较符
        if (CompareType.IN_TYPE.equalsIgnoreCase(cal.getACal().getCompareType())
            || CompareType.NOTIN_TYPE.equalsIgnoreCase(cal.getACal().getCompareType())) {
          // 去掉左右括号
          paraValue = paraValue.substring(1, paraValue.length() - 1);
          // 去掉逗号旁的引号
          paraValue = paraValue.replaceAll("','", ",");
        }
        // 去掉最外层引号
        cbxWhereValue.setValue(paraValue.substring(1, paraValue.length() - 1));

      } else {
        cbxWhereValue.setValue(cal.getACal().getValue());
      }

      // 定义条件类型
      if (!Common.isNullStr(cal.getACal().getJoinBefore()))
        frdoType.setValue(cal.getACal().getJoinBefore());
    }
예제 #3
0
 /**
  * 刷新节点中文名称
  *
  * @param node
  */
 private void refreshNodeChName(TreeNode node) {
   TreeNode parNode = node.getParent();
   int index = parNode.getIndex(node);
   Caliber cal = (Caliber) ((DefaultMutableTreeNode) node).getUserObject();
   if (index == 0) {
     cal.setFirstNode(true);
   } else {
     cal.setFirstNode(false);
   }
 }
예제 #4
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);
      }
    }