From: <de...@us...> - 2004-03-10 09:31:26
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9469/src/org/fudaa/fudaa/commun Modified Files: FudaaCommonImplementation.java FudaaLib.java Log Message: Ajout du superviseur pour le prepro Index: FudaaCommonImplementation.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/FudaaCommonImplementation.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** FudaaCommonImplementation.java 12 Feb 2004 16:15:13 -0000 1.15 --- FudaaCommonImplementation.java 10 Mar 2004 09:13:30 -0000 1.16 *************** *** 74,83 **** */ protected BuHelpFrame aide_; ! public final static String LOCAL_MAN="file://"+System.getProperty("user.dir")+"/aide/"; public final static String REMOTE_MAN= "http://www.utc.fr/fudaa/aide/aide_html/"; /** * Return le chemin de la propriete user.dir dans le format * file://.... */ public static final String getUserDirUrl() { --- 74,92 ---- */ protected BuHelpFrame aide_; ! ! /** ! * URL pour l'aide locale. ! */ ! public final static String LOCAL_MAN=getUserDirUrl()+"/aide/"; ! /** ! * URL pour l'aide distante. ! */ public final static String REMOTE_MAN= "http://www.utc.fr/fudaa/aide/aide_html/"; + /** * Return le chemin de la propriete user.dir dans le format * file://.... + * @return le chemin de l'utilisateur sous forme d'url valide */ public static final String getUserDirUrl() { *************** *** 96,99 **** --- 105,109 ---- b.add(_m, _idx); b.computeMnemonics(); + b.revalidate(); } public int getNbMenuInMenuBar() { *************** *** 314,318 **** } /** ! * */ public boolean confirmation(String _titre, String _text) { --- 324,328 ---- } /** ! * @see org.fudaa.fudaa.commun.FudaaUI#confirmation(java.lang.String, java.lang.String) */ public boolean confirmation(String _titre, String _text) { *************** *** 320,324 **** } /** ! * */ public boolean manageErrorOperationAndIsFatal(FileOperationSynthese _opResult) { --- 330,334 ---- } /** ! * @see org.fudaa.fudaa.commun.FudaaUI#manageErrorOperationAndIsFatal(org.fudaa.dodico.fichiers.FileOperationSynthese) */ public boolean manageErrorOperationAndIsFatal(FileOperationSynthese _opResult) { Index: FudaaLib.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/FudaaLib.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** FudaaLib.java 21 Jan 2004 11:07:28 -0000 1.15 --- FudaaLib.java 10 Mar 2004 09:13:30 -0000 1.16 *************** *** 9,18 **** package org.fudaa.fudaa.commun; import java.io.File; import java.util.Vector; import javax.swing.JOptionPane; - import org.fudaa.ctulu.CtuluLib; - import com.memoire.bu.BuCommonInterface; import com.memoire.bu.BuDialogConfirmation; --- 9,18 ---- package org.fudaa.fudaa.commun; import java.io.File; + import java.net.MalformedURLException; + import java.util.List; import java.util.Vector; import javax.swing.JOptionPane; import com.memoire.bu.BuCommonInterface; import com.memoire.bu.BuDialogConfirmation; *************** *** 21,26 **** import com.memoire.bu.BuDialogWarning; import com.memoire.bu.BuIcon; - import com.memoire.fu.FuLib; import org.fudaa.fudaa.ressource.FudaaResource; /** --- 21,28 ---- import com.memoire.bu.BuDialogWarning; import com.memoire.bu.BuIcon; + import org.fudaa.ctulu.CtuluLib; + import org.fudaa.dodico.fichiers.FileFormat; + import org.fudaa.dodico.telemac.io.SerafinFileFormat; import org.fudaa.fudaa.ressource.FudaaResource; /** *************** *** 138,176 **** * Normalement pour une URL correcte, les ":" apres le C doivent etre * remplaces par "|" mais cela pose des problemes sous Windows. */ public static String pathToUrl(String _file) { ! if((!_file.startsWith("/")) && (_file.indexOf('\\')>0)){ String s1=FuLib.replace(_file, "\\", "\\\\"); ! return "file://"+FuLib.replace(s1, "/", "\\\\"); } else ! return "file://"+_file; } - - public static String urlToPath(String _url) { - if (_url.startsWith("file://")) - _url= _url.substring(7); - int premSigneSpeciale= indexOfSpecialCar(_url); - String urlFinale= ""; - if (premSigneSpeciale > 0) { - urlFinale= _url.substring(premSigneSpeciale); - _url= _url.substring(0, premSigneSpeciale); - } - _url= _url.replace('|', ':'); - if (File.separatorChar != '/') - _url= _url.replace('/', File.separatorChar); - return _url + urlFinale; - } - private static int indexOfSpecialCar(String _file) { - int premSigneSpeciale= _file.indexOf("?"); - int premDiese= _file.indexOf("#"); - if ((premDiese > 0) && (premSigneSpeciale > 0)) - premSigneSpeciale= Math.min(premDiese, premSigneSpeciale); - else if (premDiese > 0) - premSigneSpeciale= premDiese; - return premSigneSpeciale; - } /** * Transforme un tableau de chaine en une unique chaine avec des saut de --- 140,163 ---- * Normalement pour une URL correcte, les ":" apres le C doivent etre * remplaces par "|" mais cela pose des problemes sous Windows. + * @return url valide pour _file + * @param _file le chemin du fichier a transformer */ public static String pathToUrl(String _file) { ! try{ ! return new File(_file).toURL().toString(); ! } ! catch(MalformedURLException e){ ! e.printStackTrace(); ! return "file:/"+_file; ! } ! /* if((!_file.startsWith("/")) && (_file.indexOf('\\')>0)){ String s1=FuLib.replace(_file, "\\", "\\\\"); ! return "file:/"+FuLib.replace(s1, "/", "\\\\"); } else ! return "file:/"+_file;*/ } /** * Transforme un tableau de chaine en une unique chaine avec des saut de *************** *** 301,303 **** --- 288,319 ---- || (_r == JOptionPane.CLOSED_OPTION); } + + /** + * + * @param _fileName le nom de fichier + * @param _fileFormatList la liste des formats + * @return le format correspondant au nom de fichier + */ + public static FileFormat guessFormat( + String _fileName, + List _fileFormatList) { + if ((_fileName == null) || (_fileFormatList == null)) + return null; + int idx= _fileName.indexOf('.'); + if ((idx > 0) && (idx < _fileName.length())) { + String ext= _fileName.substring(idx + 1); + FileFormat temp= null; + for (int i= _fileFormatList.size() - 1; i >= 0; i--) { + temp= (FileFormat)_fileFormatList.get(i); + if (temp.isExtension(ext)) + return temp; + } + } else if ( + _fileFormatList.contains(SerafinFileFormat.getInstance()) + && (_fileName.startsWith("geo"))) { + return SerafinFileFormat.getInstance(); + } + return null; + } + } |