コード例 #1
0
  // ------------------------------------------------------------------------------------------------
  // 描述:
  // 设计: Skyline(2001.12.29)
  // 实现: Skyline
  // 修改:
  // ------------------------------------------------------------------------------------------------
  public JFunctionStub getFunctionByID(String ID, Object OwnerObject) {
    IFunction IF = null;
    JFunctionStub FS = null;
    String FT;
    try {
      for (int i = 0; i < FunctionList.size(); i++) {
        FS = (JFunctionStub) FunctionList.get(i);
        //        System.out.println(FS.FunctionID);
        FT = FS.FunctionID + "_";
        if (FS.FunctionID.equals(ID) || FT.equals(ID)) {
          if (FS.Function == null) {
            FS.FunctionClass = Class.forName(FS.ClassName);
            FS.Function = (IFunction) FS.FunctionClass.newInstance();
            FS.Function.InitFunction(FS);
          }
          /* else { // modify by liukun 找到了就直接返回吧 20100715
            return FS;
          }
          */
          //
          if (OwnerObject != null && OwnerObject instanceof Hashtable) {
            Hashtable OTable = (Hashtable) OwnerObject;
            JFunctionStub fs = (JFunctionStub) OTable.get(ID);
            if (fs == null) {
              fs = new JFunctionStub();
              fs.ClassName = FS.ClassName;
              fs.FunctionClass = FS.FunctionClass;
              fs.FunctionID = FS.FunctionID;
              OTable.put(ID, fs);
            }
            if (fs.Function == null) {
              fs.FunctionClass = Class.forName(FS.ClassName);
              fs.Function = (IFunction) FS.FunctionClass.newInstance();
              fs.Function.InitFunction(FS);
            }
            FS = fs;
          } else {
            /**
             * 如果不在用户列表中则需要重新初始化函数 不能直接用系统缓存因为系统缓存只在登录时初始 这样对于像BB类函数,缓冲坐标的行为就可能会出错(中间修改过行列) modified
             * by hufeng 2007.11.20
             */
            FS.Function = (IFunction) FS.FunctionClass.newInstance();
            FS.Function.InitFunction(FS);
          }

          return FS;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
コード例 #2
0
  // ------------------------------------------------------------------------------------------------
  // 描述:
  // 设计: 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);
    }
  }
コード例 #3
0
 /**
  * 初始化外部函数
  *
  * @param funcList ArrayList
  */
 public void InitExtendFunction(ArrayList funcList) {
   if (mExtFuncList != null && mExtFuncList.size() != 0) {
     return;
   }
   if (funcList == null || funcList.size() == 0) {
     return;
   }
   mExtFuncList = funcList;
   // 初始化函数
   JExtFuncStub extStub = null;
   JFunctionStub funcStub = null;
   for (int i = 0; i < funcList.size(); i++) {
     extStub = (JExtFuncStub) funcList.get(i);
     funcStub = new JFunctionStub();
     funcStub.setFunctionID(extStub.getFunc());
     funcStub.setClassName(extStub.getFuncClass());
     FunctionList.add(funcStub);
   }
 }