Example #1
0
  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;
  }
Example #2
0
 /**
  * 打开数据窗口
  *
  * @param formName
  * @param params
  * @return
  */
 public static JDataWindow openForm(String formName, Hashtable params) {
   if (formName != null) {
     // 打开数据窗口
     JDataWindow form = new JDataWindow();
     form.Prepare();
     ExchangeMessage Extmsg = new ExchangeMessage("", "");
     if (params != null && params.size() > 0) {
       Message SqlValues = new Message();
       for (Iterator i = params.keySet().iterator(); i.hasNext(); ) {
         String key = (String) i.next();
         String value = (String) params.get(key);
         SqlValues.CreateItem(key, value);
       }
       Extmsg.getInputMessage().CreateItem("SqlValues", SqlValues);
     }
     form.Open(formName, Extmsg);
     form.getDataForm().PrepareUI();
     return form;
   }
   return null;
 }