GContextFileManagement

De GENIUS
Aller à la navigation Aller à la recherche

GENIUS proposes classes to simplify the search of files into directories: GFileFilter and GContextFileManagement class

String prefix  = "TEST_"; 
String suffix  = ".xml";
String comment = "Test Files";
GFileFilter filter = new GFileFilter(prefix ,suffix ,comment);

String initDir = "."; 
String xmlName = "Test"; 
GContextFileManagement gfm = new GContextFileManagement(initDir, xmlName , filter);



public void after(GEvent e) throws GFileManipulatorException {

  // "obj" is the object to load or save ...
  if ( e.contains(butLoad) ) { gfm.selectLoadFile(obj, false); }
  if ( e.contains(butSave) ) { gfm.selectSaveFile(obj, true); }
   
}

Note that flags set at the end of the selectLoadFile() and selectSaveFile() methods follow the same principle as described in the GReadWrite interface and data files management topic for the GFileManipulation.readConfig() and GFileManipulation.readConfig() methods.

GContextFileManagement.jpg

Return to the introduction ↑ Go to the next page →