Exemple #1
0
  /** 打开查询结果 */
  public static String[] openQuery(Hashtable params) {

    JParamObject PO = new JParamObject();

    for (Enumeration e = params.keys(); e.hasMoreElements(); ) {
      String key = (String) e.nextElement();
      String val = (String) params.get(key);
      PO.SetValueByParamName(key, val);
    }
    String[] queryResult = new String[2];
    JResponseObject RO =
        (JResponseObject)
            JActiveDComDM.AbstractDataActiveFramework.InvokeObjectMethod(
                "DataReport", "OpenQuery", PO, "");
    String XMLStr = (String) RO.ResponseObject;
    if (RO != null && RO.ResponseObject != null) {
      XMLStr = (String) RO.ResponseObject;
      JXMLBaseObject XMLObj = new JXMLBaseObject(XMLStr);
      Element queryElmt = XMLObj.GetElementByName("Query");
      // 格式
      queryResult[0] = queryElmt.getAttributeValue("QueryFormat");
      // 数据
      queryResult[0] = queryElmt.getAttributeValue("QueryData");
    }
    return queryResult;
  }
  // ------------------------------------------------------------------------------------------------
  // 描述:
  // 设计: Skyline(2001.12.29)
  // 实现: Skyline
  // 修改:
  // ------------------------------------------------------------------------------------------------
  public void InitObject(Element PublicElement, Element PrivateElement, String OpFrom) {
    /*
        List nodelist;Element RFElement=null;Element node;int i=0;String Name="FunctionManager";
        if ( PublicElement == null ) System.out.println("PublicElement=null");
        if ( PrivateElement == null ) System.out.println("PrivateElement=null");
        RFElement = JActiveDComDM.XMLRegistry.GetElementByName(PublicElement,Name);
        if ( RFElement == null ) return;
        InitFunctionConfigXML(RFElement.getAttribute("functionconfig").getValue());
        JFunctionStub FS;
        nodelist = JActiveDComDM.XMLRegistry.BeginEnumerate(RFElement);
        while ( nodelist != null ) {
          node = JActiveDComDM.XMLRegistry.Enumerate(nodelist,i);
          if ( node == null ) break;
    //      if ( node.getNodeType() == node.ELEMENT_NODE ) {
            RFElement     = (Element)node;
            FS            = new JFunctionStub();
            FS.FunctionID = RFElement.getAttribute("id").getValue().toUpperCase();
            FS.ClassName  = RFElement.getAttribute("class").getValue();
            FunctionList.add(FS);
    //      }
          i++;
        }
        JActiveDComDM.XMLRegistry.EndEnumerate();
     */
    Element RFElement = null;
    Element node;
    int i = 0;
    String Name = "FunctionManager";
    if (PublicElement == null) System.out.println("PublicElement=null");
    if (PrivateElement == null) System.out.println("PrivateElement=null");
    RFElement = JActiveDComDM.XMLRegistry.GetElementByName(PublicElement, Name);
    if (RFElement == null) return;
    InitFunctionConfigXML(RFElement.getAttribute("functionconfig").getValue());

    java.util.List nodelist = PackageStub.getContentVector("fmisReportFunction");
    JFunctionStub FS;
    StubObject so = null;
    for (i = 0; i < nodelist.size(); i++) {
      so = (StubObject) nodelist.get(i);
      FS = new JFunctionStub();
      FS.FunctionID = so.getString("id", "");
      ;
      FS.ClassName = so.getString(OpFrom, "");
      ;
      FunctionList.add(FS);
    }
  }
  public boolean load() {
    try {
      if (new File(FILE_PATH).exists()) {
        FileInputStream FIS = new FileInputStream(FILE_PATH);
        JXMLBaseObject cobjXmlObj = new JXMLBaseObject();
        cobjXmlObj.InitXMLStream(FIS);
        FIS.close();

        Vector exps = new Vector();
        Element rootElmt = cobjXmlObj.GetElementByName(JCStoreTableModel.ROOT_NAME);
        for (Iterator i = rootElmt.getChildren().iterator(); i.hasNext(); ) {
          Element crtElmt = (Element) i.next();
          JCExpression exp = new JCExpression();
          exp.mId = crtElmt.getAttributeValue("id", "");
          exp.mName = crtElmt.getAttributeValue("name", "");
          exp.mShowValue = crtElmt.getAttributeValue("show", "");
          exp.mStoreValue = crtElmt.getAttributeValue("store", "");
          exps.add(exp);
        }
        if (mModel != null) {
          mModel.setExpression(exps);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }