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
 public void save() {
   try {
     if (mModel != null) {
       JXMLBaseObject cobjXmlObj = mModel.toXml();
       String dataStr = cobjXmlObj.GetRootXMLString();
       FileOutputStream FOS = new FileOutputStream(FILE_PATH);
       FOS.write(dataStr.getBytes());
       FOS.flush();
       FOS.close();
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #3
0
 /**
  * @param id
  * @return
  */
 public JCExpression getExpression(String id) {
   if (id != null) {
     return mModel.getExpression(id);
   }
   return null;
 }
Example #4
0
 /** @param name */
 public void removeExpression(String id) {
   if (id != null) {
     mModel.removeExpressioin(id);
   }
 }
Example #5
0
 /**
  * @param name
  * @param exp
  */
 public void addExpression(String name, JCExpression exp) {
   if (name != null && exp != null) {
     mModel.addExpression(name, exp);
   }
 }