GContextFileManagement : Différence entre versions

De Wiki
Aller à : navigation, rechercher
(Page créée avec « TBW ... Return to the introduction ↑ Go to the next page → »)
 
Ligne 1 : Ligne 1 :
TBW ...
+
<font color=#556B2F>'''GENIUS'''</font> proposes classes to simplify the search of files into directories: [{{PathCurrentJavaDoc}}/fr/cnes/genius/utils/GFileFilter.html GFileFilter] and [{{PathCurrentJavaDoc}}/fr/cnes/genius/utils/GContextFileManagement.html GContextFileManagement] class
 +
 
 +
<syntaxhighlight lang="java">
 +
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); }
 +
 
 +
}
 +
</syntaxhighlight>
 +
 
 +
Note that flags set at the end of the <font color=#4169E1>selectLoadFile()</font> and <font color=#4169E1>selectSaveFile()</font> methods follow the same principle as described in the [[GReadWrite_interface|GReadWrite interface and data files management]] topic for the <font color=#4169E1>GFileManipulation.readConfig()</font> and <font color=#4169E1>GFileManipulation.readConfig()</font> methods.
 +
 
 +
[[File:GContextFileManagement.jpg]]
  
 
[[WELCOME_TO_THE_GENIUS_WIKI|Return to the introduction ↑]]  
 
[[WELCOME_TO_THE_GENIUS_WIKI|Return to the introduction ↑]]  
 
[[How_to_build_a_standard_application|Go to the next page →]]
 
[[How_to_build_a_standard_application|Go to the next page →]]

Version du 5 mai 2017 à 13:59

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 →