Package org.metaworks

Examples of org.metaworks.GridApplication


      }
    );
   
    settingsTable.getFieldDescriptor("property").setUpdatable(false);
   
    final GridApplication app = new GridApplication(settingsTable){
      public void onClose(){
        Instance[] recs = getInstances();
        Properties settings = new Properties();

        for(int i=0; i<recs.length; i++){
          String k = (String)recs[i].getFieldValue("property");
          String v = (String)recs[i].getFieldValue("value");
         
          if(k==null) continue;
          if(v==null) v="";
          settings.setProperty(k, v);         
          System.setProperty(k, v);
        }
       
        try{
          settings.list(System.out);
          /*PrintStream out = new PrintStream(new FileOutputStream(GlobalContext.SETTING_FILE));
          settings.list(out);*/
         
          settings.store(new FileOutputStream(GlobalContext.SETTING_FILE), null);
        }catch(Exception e){
          e.printStackTrace();
        }   
      }
    };
    app.runDialog(this);
   
    try{
      Properties settings = loadProperties();     
     
      new File(GlobalContext.SETTING_FILE).mkdirs();
     
      settings.store(new FileOutputStream(GlobalContext.SETTING_FILE), null);
     
      for(Enumeration enumeration = settings.keys(); enumeration.hasMoreElements(); ){
        String k = (String)enumeration.nextElement();
        Instance rec = settingsTable.createInstance();
        rec.setFieldValue("property", k);
        rec.setFieldValue("value", settings.get(k));
        app.addInstance(rec);       
      }
    }catch(Exception e){
      e.printStackTrace();
    }   
  }
View Full Code Here

TOP

Related Classes of org.metaworks.GridApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.