Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20934/dico Modified Files: DicoAnalyzer.java DicoCasAbstract.java DicoCasFileFormatVersion.java DicoCasInterface.java DicoCasReader.java DicoCasWriter.java DicoDataTypeGenerate.java DicoEntiteGenerate.java DicoFactory.java DicoGenerator.java DicoParams.java DicoParamsInterface.java Log Message: Maj version 0.05 prepro Index: DicoAnalyzer.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoAnalyzer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DicoAnalyzer.java 12 Dec 2003 10:30:53 -0000 1.7 --- DicoAnalyzer.java 12 Feb 2004 15:32:43 -0000 1.8 *************** *** 57,61 **** return null; } ! DodicoAnalyze.Editor analyze_; private boolean dicoDynamique_; private File dicoFile_; --- 57,61 ---- return null; } ! DodicoAnalyze analyze_; private boolean dicoDynamique_; private File dicoFile_; *************** *** 267,271 **** String[] rTemp= DicoEntite.Vecteur.getValues(b.toString(), _sep); if (rTemp == null) { ! analyze_.addInfo( DicoResource.getS("Erreur avec la valeur par défaut") + CtuluLib.ESPACE --- 267,271 ---- String[] rTemp= DicoEntite.Vecteur.getValues(b.toString(), _sep); if (rTemp == null) { ! analyze_.getInfoCanal().addMessage( DicoResource.getS("Erreur avec la valeur par défaut") + CtuluLib.ESPACE *************** *** 276,280 **** if (r[i] == null) { r[i]= CtuluLib.EMPTY_STRING; ! analyze_.addInfo( DicoResource.getS("Erreur avec la valeur par défaut") + CtuluLib.ESPACE --- 276,280 ---- if (r[i] == null) { r[i]= CtuluLib.EMPTY_STRING; ! analyze_.getInfoCanal().addMessage( DicoResource.getS("Erreur avec la valeur par défaut") + CtuluLib.ESPACE *************** *** 345,349 **** } else { if (t > nbLanguage_) { ! analyze_.addInfo( DicoResource.getS( "Le mot-clé {0} propose trop de traduction", --- 345,349 ---- } else { if (t > nbLanguage_) { ! analyze_.getInfoCanal().addMessage( DicoResource.getS( "Le mot-clé {0} propose trop de traduction", *************** *** 422,426 **** if (type == null) { analyze_.addFatalError(DicoResource.getS("Type non reconnu"), ligne); ! analyze_.addInfo(noms[0], ligne); return; } --- 422,426 ---- if (type == null) { analyze_.addFatalError(DicoResource.getS("Type non reconnu"), ligne); ! analyze_.getInfoCanal().addMessage(noms[0], ligne); return; } *************** *** 446,450 **** DicoResource.getS("Erreur lors de l'analyse des choix"), ligne); ! analyze_.addInfo(noms[0], ligne); return; } --- 446,450 ---- DicoResource.getS("Erreur lors de l'analyse des choix"), ligne); ! analyze_.getInfoCanal().addMessage(noms[0], ligne); return; } *************** *** 459,463 **** DicoResource.getS("champ CONTROLE invalide"), ligne); ! analyze_.addInfo(noms[0], ligne); return; } --- 459,463 ---- DicoResource.getS("champ CONTROLE invalide"), ligne); ! analyze_.getInfoCanal().addMessage(noms[0], ligne); return; } *************** *** 469,473 **** } if (!b) { ! analyze_.addInfo( noms[0] + " " + DicoResource.getS("CONTROLE non supporté"), ligne); --- 469,473 ---- } if (!b) { ! analyze_.getInfoCanal().addMessage( noms[0] + " " + DicoResource.getS("CONTROLE non supporté"), ligne); *************** *** 518,522 **** keysChoice= type.getValues()[0]; if (keysChoice == null) { ! analyze_.addError("les choix sont nuls", ligne); return; } --- 518,522 ---- keysChoice= type.getValues()[0]; if (keysChoice == null) { ! analyze_.getErrorCanal().addMessage("les choix sont nuls", ligne); return; } *************** *** 533,537 **** arraytemp= findValues(kw_.getAide(), keys, mapEncours, true); if (arraytemp == null) { ! analyze_.addInfo(DicoResource.getS("Aide non trouvée"), ligne); } else { entite.setAides(arraytemp); --- 533,537 ---- arraytemp= findValues(kw_.getAide(), keys, mapEncours, true); if (arraytemp == null) { ! analyze_.getInfoCanal().addMessage(DicoResource.getS("Aide non trouvée"), ligne); } else { entite.setAides(arraytemp); *************** *** 541,545 **** if (s == null) { entite.setIndex(0); ! analyze_.addInfo( DicoResource.getS("INDEX mis à 0 pour") + CtuluLib.ESPACE --- 541,545 ---- if (s == null) { entite.setIndex(0); ! analyze_.getInfoCanal().addMessage( DicoResource.getS("INDEX mis à 0 pour") + CtuluLib.ESPACE *************** *** 552,556 **** if (s == null) { entite.setNiveau(0); ! analyze_.addInfo( DicoResource.getS("NIVEAU mis à 0 pour") + CtuluLib.ESPACE --- 552,556 ---- if (s == null) { entite.setNiveau(0); ! analyze_.getInfoCanal().addMessage( DicoResource.getS("NIVEAU mis à 0 pour") + CtuluLib.ESPACE *************** *** 583,589 **** arraytemp= findValues(kw_.getRubrique(), keys, mapEncours, false); if (arraytemp == null) { ! analyze_.addInfo(DicoResource.getS("Rubrique non trouvée"), ligne); } else { ! int l= arraytemp.length; // for (int j= 0; j < l; j++) { // arraytemp[j]= --- 583,589 ---- arraytemp= findValues(kw_.getRubrique(), keys, mapEncours, false); if (arraytemp == null) { ! analyze_.getInfoCanal().addMessage(DicoResource.getS("Rubrique non trouvée"), ligne); } else { ! //int l= arraytemp.length; // for (int j= 0; j < l; j++) { // arraytemp[j]= *************** *** 602,606 **** + DicoResource.getS("Les valeurs par défaut sont invalides"), ligne); ! analyze_.addInfo(stemp, ligne); return; } --- 602,606 ---- + DicoResource.getS("Les valeurs par défaut sont invalides"), ligne); ! analyze_.getInfoCanal().addMessage(stemp, ligne); return; } *************** *** 613,617 **** + DicoResource.getS("Les valeurs CHOIX sont invalides"), ligne); ! analyze_.addInfo(stemp, ligne); return; } --- 613,617 ---- + DicoResource.getS("Les valeurs CHOIX sont invalides"), ligne); ! analyze_.getInfoCanal().addMessage(stemp, ligne); return; } *************** *** 622,626 **** */ protected DodicoAnalyze read() { ! analyze_= new DodicoAnalyze.Editor(); ArrayList props= new ArrayList(200); HashMap nomLigne_= new HashMap(200); --- 622,626 ---- */ protected DodicoAnalyze read() { ! analyze_= new DodicoAnalyze(); ArrayList props= new ArrayList(200); HashMap nomLigne_= new HashMap(200); *************** *** 657,661 **** //lieu de aide et aide1 if (map.get(currentKey) != null) { ! analyze_.addInfo( DicoResource.getS( "Le champ {0} est présent plusieurs fois", --- 657,661 ---- //lieu de aide et aide1 if (map.get(currentKey) != null) { ! analyze_.getInfoCanal().addMessage( DicoResource.getS( "Le champ {0} est présent plusieurs fois", *************** *** 666,684 **** DicoResource.getS("Ce type d'erreur n'est pas corrigé"), reader_.getLineNumber()); ! analyze_.addInfo( (String)map.get("NOM"), reader_.getLineNumber()); ! return analyze_.toAnalyze(); } else { currentKey += "1"; } if (map.get(currentKey) != null) { ! analyze_.addError( DicoResource.getS("Ce type d'erreur n'est pas corrigé"), reader_); ! analyze_.addInfo( (String)map.get("NOM"), reader_.getLineNumber()); ! return analyze_.toAnalyze(); } } --- 666,684 ---- DicoResource.getS("Ce type d'erreur n'est pas corrigé"), reader_.getLineNumber()); ! analyze_.getInfoCanal().addMessage( (String)map.get("NOM"), reader_.getLineNumber()); ! return analyze_; } else { currentKey += "1"; } if (map.get(currentKey) != null) { ! analyze_.getErrorCanal().addMessage( DicoResource.getS("Ce type d'erreur n'est pas corrigé"), reader_); ! analyze_.getInfoCanal().addMessage( (String)map.get("NOM"), reader_.getLineNumber()); ! return analyze_; } } *************** *** 705,709 **** } } catch (FileNotFoundException e) { ! analyze_.addError( DicoResource.getS("Fichier non trouvé") + ": " --- 705,709 ---- } } catch (FileNotFoundException e) { ! analyze_.getErrorCanal().addMessage( DicoResource.getS("Fichier non trouvé") + ": " *************** *** 712,717 **** e.printStackTrace(); } catch (IOException e1) { ! DodicoAnalyze.manageException(e1, analyze_); ! return analyze_.toAnalyze(); } finally { if (reader_ != null) { --- 712,717 ---- e.printStackTrace(); } catch (IOException e1) { ! analyze_.manageException(e1); ! return analyze_; } finally { if (reader_ != null) { *************** *** 719,724 **** reader_.close(); } catch (IOException _e) { ! DodicoAnalyze.manageException(_e, analyze_); ! return analyze_.toAnalyze(); } } --- 719,724 ---- reader_.close(); } catch (IOException _e) { ! analyze_.manageException(_e); ! return analyze_; } } *************** *** 729,733 **** //Certains mots-cles dependent des autres : on gere cette dependance. computeConditionAffichage(); ! return analyze_.toAnalyze(); } public void setDicoKeyword(DicoKeyword _kw) { --- 729,733 ---- //Certains mots-cles dependent des autres : on gere cette dependance. computeConditionAffichage(); ! return analyze_; } public void setDicoKeyword(DicoKeyword _kw) { Index: DicoCasAbstract.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasAbstract.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DicoCasAbstract.java 25 Nov 2003 10:11:27 -0000 1.4 --- DicoCasAbstract.java 12 Feb 2004 15:32:43 -0000 1.5 *************** *** 8,11 **** --- 8,12 ---- */ package org.fudaa.dodico.dico; + import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; *************** *** 18,21 **** --- 19,23 ---- public class DicoCasAbstract implements DicoCasInterface { private Map list_; + private Map keyCommentaires_; private boolean printKeys_; private boolean printLongKeys_; *************** *** 26,32 **** list_= new Hashtable(100); } ! public DicoCasAbstract(Map _t) { list_= _t; } public synchronized void addKeyValue(DicoEntite _c, String _value) { if (_c == null) --- 28,49 ---- list_= new Hashtable(100); } ! public DicoCasAbstract(Map _t,Map _comment) { list_= _t; + keyCommentaires_=_comment; + } + + public void addCommentaire(DicoEntite _key, String _com) { + if (keyCommentaires_ == null) + keyCommentaires_= new HashMap(); + keyCommentaires_.put(_key, _com); + } + + public String getCommentaire(DicoEntite _e) { + if (keyCommentaires_ == null) + return null; + return (String)keyCommentaires_.get(_e); + } + public synchronized void addKeyValue(DicoEntite _c, String _value) { if (_c == null) *************** *** 116,121 **** * @see org.fudaa.dodico.telemac.io.TelemacCasInterface#getInputs() */ ! public Hashtable getInputs() { ! return new Hashtable(list_); } } --- 133,145 ---- * @see org.fudaa.dodico.telemac.io.TelemacCasInterface#getInputs() */ ! public Map getInputs() { ! return list_; } + /** + * + */ + public Map getComments() { + return keyCommentaires_; + } + } Index: DicoCasFileFormatVersion.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasFileFormatVersion.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DicoCasFileFormatVersion.java 25 Nov 2003 10:11:27 -0000 1.8 --- DicoCasFileFormatVersion.java 12 Feb 2004 15:32:43 -0000 1.9 *************** *** 30,33 **** --- 30,36 ---- return '/'; } + public String getCommentString() { + return "/"; + } public int getMaxCharPerLine() { return 72; Index: DicoCasInterface.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasInterface.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DicoCasInterface.java 25 Nov 2003 10:11:27 -0000 1.4 --- DicoCasInterface.java 12 Feb 2004 15:32:43 -0000 1.5 *************** *** 8,12 **** */ package org.fudaa.dodico.dico; ! import java.util.Hashtable; import java.util.Set; /** --- 8,12 ---- */ package org.fudaa.dodico.dico; ! import java.util.Map; import java.util.Set; /** *************** *** 24,34 **** public String getValue(DicoEntite _ent); /** * Renvoie les entites sous forme de set. */ public Set getEntiteSet(); /** ! * Renvoie les donnees TrDicoEntite->String */ ! public Hashtable getInputs(); public boolean containsEntite(DicoEntite _e); /** --- 24,43 ---- public String getValue(DicoEntite _ent); /** + * Les commentaires pour le mot-cle _e + */ + public String getCommentaire(DicoEntite _e); + /** * Renvoie les entites sous forme de set. */ public Set getEntiteSet(); /** ! * Renvoie les donnees DicoEntite->String */ ! public Map getInputs(); ! ! /** ! * Renvoie les donnees DicoEntite->String (commentaires) ! */ ! public Map getComments(); public boolean containsEntite(DicoEntite _e); /** Index: DicoCasReader.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasReader.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DicoCasReader.java 25 Nov 2003 10:11:27 -0000 1.8 --- DicoCasReader.java 12 Feb 2004 15:32:43 -0000 1.9 *************** *** 14,17 **** --- 14,20 ---- import java.io.LineNumberReader; import java.util.StringTokenizer; + + import org.fudaa.ctulu.CtuluLib; + import org.fudaa.dodico.commun.DodicoAnalyze; import org.fudaa.dodico.fichiers.FileFormatVersion; *************** *** 30,33 **** --- 33,37 ---- StringBuffer valueBuffer_; DicoEntite currentkey_; + StringBuffer commentairesEnCours_; public DicoCasReader(DicoCasFileFormatVersion _t) { ft_= _t; *************** *** 35,39 **** } public void setFile(File _f) { ! analyze_= new DodicoAnalyze.Editor(); analyze_.setRessource(_f.getAbsolutePath()); try { --- 39,43 ---- } public void setFile(File _f) { ! analyze_= new DodicoAnalyze(); analyze_.setRessource(_f.getAbsolutePath()); try { *************** *** 43,46 **** --- 47,54 ---- } } + /** + * Test rapide pour savoir si le fichier _f contient + * des donnees valides. + */ public boolean testFile(File _f) { LineNumberReader l; *************** *** 80,94 **** inter_= new DicoCasAbstract(); currentkey_= null; while ((line= in_.readLine()) != null) { ! //ligne vide ! if (line.trim().length() == 0) ! continue; ! if (quoteEnCours_) { splitLine(line, inter_); } else { //commentaire ! if (line.startsWith("/")) ! continue; ! else if (line.startsWith(ft_.getCommandStop())) { inter_.setCommandStop(true); } else if (line.startsWith(ft_.getCommandStopProgram())) { --- 88,108 ---- inter_= new DicoCasAbstract(); currentkey_= null; + commentairesEnCours_= new StringBuffer(); + //gestion des commentaires. + //pour separer les commentaires on suppose que les lignes vides + //sont des separateurs de commentaires. while ((line= in_.readLine()) != null) { ! //ligne vide on annule les commentaires ! if (line.trim().length() == 0) { ! commentairesEnCours_.setLength(0); ! } else if (quoteEnCours_) { splitLine(line, inter_); } else { //commentaire ! if (line.startsWith("/")) { ! if (commentairesEnCours_.length() > 0) ! commentairesEnCours_.append(CtuluLib.LINE_SEP); ! commentairesEnCours_.append(line.substring(1)); ! } else if (line.startsWith(ft_.getCommandStop())) { inter_.setCommandStop(true); } else if (line.startsWith(ft_.getCommandStopProgram())) { *************** *** 107,111 **** } } catch (IOException _ioe) { ! DodicoAnalyze.manageException(_ioe, analyze_); } if (currentkey_ != null) { --- 121,125 ---- } } catch (IOException _ioe) { ! analyze_.manageException(_ioe); } if (currentkey_ != null) { *************** *** 224,227 **** --- 238,246 ---- in_.getLineNumber()); } + //maj des commentaires + if (commentairesEnCours_.length() > 0) { + _m.addCommentaire(currentkey_, commentairesEnCours_.toString()); + commentairesEnCours_.setLength(0); + } currentkey_= null; } Index: DicoCasWriter.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoCasWriter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DicoCasWriter.java 12 Dec 2003 10:30:53 -0000 1.7 --- DicoCasWriter.java 12 Feb 2004 15:32:43 -0000 1.8 *************** *** 33,37 **** String enteteFormat_; String enteteRubrique_; ! char com_; /** * @param _ft --- 33,37 ---- String enteteFormat_; String enteteRubrique_; ! String com_; /** * @param _ft *************** *** 39,43 **** public DicoCasWriter(DicoCasFileFormatVersion _ft) { version_= _ft; ! com_= version_.getCommentChar(); commentSep_= com_ --- 39,43 ---- public DicoCasWriter(DicoCasFileFormatVersion _ft) { version_= _ft; ! com_= version_.getCommentString(); commentSep_= com_ *************** *** 108,112 **** progress_.setProgression(95); } catch (IOException _e) { ! DodicoAnalyze.manageException(_e, analyze_); } } --- 108,112 ---- progress_.setProgression(95); } catch (IOException _e) { ! analyze_.manageException(_e); } } *************** *** 151,158 **** ent= _ent[i]; if (!version_.getDico().isKey(ent)) { ! analyze_.addWarning( "Entité inconnue pour ce format" + " " + ent.getNom(), -1); } else { String value= inter.getValue(ent); if (ent.containsStringDataType()) { --- 151,166 ---- ent= _ent[i]; if (!version_.getDico().isKey(ent)) { ! analyze_.addWarn( "Entité inconnue pour ce format" + " " + ent.getNom(), -1); } else { + writeln(); + String com=inter.getCommentaire(ent); + if((com!=null) && (com.trim().length()>0)){ + StringTokenizer t=new StringTokenizer(com,CtuluLib.LINE_SEP); + while(t.hasMoreTokens()){ + writeln(com_+formatToMaxChar(t.nextToken(),com_)); + } + } String value= inter.getValue(ent); if (ent.containsStringDataType()) { Index: DicoDataTypeGenerate.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoDataTypeGenerate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DicoDataTypeGenerate.java 12 Dec 2003 10:30:53 -0000 1.6 --- DicoDataTypeGenerate.java 12 Feb 2004 15:32:43 -0000 1.7 *************** *** 12,15 **** --- 12,16 ---- import org.fudaa.ctulu.CtuluLib; + import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.commun.DodicoResource; import org.fudaa.dodico.dico.DicoGenerator.DicoWriter; *************** *** 304,308 **** int n= _s.length - 1; for (int i= n; i >= 0; i--) { ! _s[i]= String.valueOf(Double.parseDouble(_s[i])); } } --- 305,313 ---- int n= _s.length - 1; for (int i= n; i >= 0; i--) { ! if (type_.isValide(_s[i])) { ! _s[i]= _s[i]; ! } else ! throw new IllegalArgumentException( ! "bad default value " + type_ + DodicoLib._printObject(_s, true)); } } Index: DicoEntiteGenerate.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoEntiteGenerate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DicoEntiteGenerate.java 12 Dec 2003 10:30:53 -0000 1.6 --- DicoEntiteGenerate.java 12 Feb 2004 15:32:43 -0000 1.7 *************** *** 70,76 **** DicoEntiteGenerate[] _entites, List _m, ! DodicoAnalyze.Editor _analyze) { if ((_m != null) && (_m.size() > 0)) { ! _analyze.addError( noms_[0] + CtuluLib.ESPACE --- 70,76 ---- DicoEntiteGenerate[] _entites, List _m, ! DodicoAnalyze _analyze) { if ((_m != null) && (_m.size() > 0)) { ! _analyze.getErrorCanal().addMessage( noms_[0] + CtuluLib.ESPACE *************** *** 350,354 **** DicoEntiteGenerate[] _entites, List _m, ! DodicoAnalyze.Editor _analyze) { if ((_m == null) || (_m.size() <= 0)) return; --- 350,354 ---- DicoEntiteGenerate[] _entites, List _m, ! DodicoAnalyze _analyze) { if ((_m == null) || (_m.size() <= 0)) return; *************** *** 366,370 **** } if (rubrOuEntite == null) { ! _analyze.addWarning( noms_[0] + ": " --- 366,370 ---- } if (rubrOuEntite == null) { ! _analyze.getWarnCanal().addMessage( noms_[0] + ": " *************** *** 379,383 **** stemp= stemp.substring(stemp.indexOf(test) + test.length()); if (stemp.length() <= 0) { ! _analyze.addWarning( noms_[0] + ": " --- 379,383 ---- stemp= stemp.substring(stemp.indexOf(test) + test.length()); if (stemp.length() <= 0) { ! _analyze.getWarnCanal().addMessage( noms_[0] + ": " *************** *** 399,403 **** if ((s.startsWith("#\'")) && (s.indexOf("\' -") > 0)) { number= s.substring(s.indexOf("\' -")).trim(); ! _analyze.addError( noms_[0] + ": " --- 399,403 ---- if ((s.startsWith("#\'")) && (s.indexOf("\' -") > 0)) { number= s.substring(s.indexOf("\' -")).trim(); ! _analyze.getErrorCanal().addMessage( noms_[0] + ": " *************** *** 411,415 **** //il y erreur donc on passe else { ! _analyze.addWarning( noms_[0] + ": " --- 411,415 ---- //il y erreur donc on passe else { ! _analyze.getWarnCanal().addMessage( noms_[0] + ": " *************** *** 421,425 **** } } else { ! _analyze.addWarning( noms_[0] + ": " --- 421,425 ---- } } else { ! _analyze.getWarnCanal().addMessage( noms_[0] + ": " *************** *** 445,449 **** comportData_[index++]= c; } else ! _analyze.addWarning( noms_[0] + ": " --- 445,449 ---- comportData_[index++]= c; } else ! _analyze.getWarnCanal().addMessage( noms_[0] + ": " Index: DicoFactory.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DicoFactory.java 12 Dec 2003 10:30:53 -0000 1.5 --- DicoFactory.java 12 Feb 2004 15:32:43 -0000 1.6 *************** *** 49,69 **** } public DodicoAnalyze analyzeParametres() { ! DodicoAnalyze.Editor r= new DodicoAnalyze.Editor(); if (dico_ == null) { ! r.addError(DicoResource.getS("Fichier dico non spécifié")); } else if (!dico_.exists()) { ! r.addError(DicoResource.getS("Fichier dico non trouvé")); } if (dir_ == null) { r.addError( ! DicoResource.getS("Le répertoire de destination n'est pas spécifié")); } else { if (!dir_.isDirectory()) ! r.addError(DicoResource.getS("La cible n'est pas un répertoire")); } if (packageName_ == null) { ! r.addError(DicoResource.getS("Package de destination non spécifié")); } ! return r.containsErrors() ? r.toAnalyze() : null; } public DodicoAnalyze[] generate() { --- 49,69 ---- } public DodicoAnalyze analyzeParametres() { ! DodicoAnalyze r= new DodicoAnalyze(); if (dico_ == null) { ! r.addError(DicoResource.getS("Fichier dico non spécifié"),0); } else if (!dico_.exists()) { ! r.addError(DicoResource.getS("Fichier dico non trouvé"),0); } if (dir_ == null) { r.addError( ! DicoResource.getS("Le répertoire de destination n'est pas spécifié"),0); } else { if (!dir_.isDirectory()) ! r.addError(DicoResource.getS("La cible n'est pas un répertoire"),0); } if (packageName_ == null) { ! r.addError(DicoResource.getS("Package de destination non spécifié"),0); } ! return r.containsErrors() ? r : null; } public DodicoAnalyze[] generate() { Index: DicoGenerator.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoGenerator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DicoGenerator.java 12 Dec 2003 10:30:53 -0000 1.7 --- DicoGenerator.java 12 Feb 2004 15:32:43 -0000 1.8 *************** *** 56,60 **** protected static final String varLanguageIndexName__= "languageIndex_"; protected ProgressionInterface progress_; ! private DodicoAnalyze.Editor analyze_; public void setProgressReceiver(ProgressionInterface _progressReceiver) { progress_= _progressReceiver; --- 56,60 ---- protected static final String varLanguageIndexName__= "languageIndex_"; protected ProgressionInterface progress_; ! private DodicoAnalyze analyze_; public void setProgressReceiver(ProgressionInterface _progressReceiver) { progress_= _progressReceiver; *************** *** 276,283 **** + " (" + _s ! + ")"); return false; } - // System.out.println(m.getName()); m.invoke(this, null); return true; --- 276,282 ---- + " (" + _s ! + ")",0); return false; } m.invoke(this, null); return true; *************** *** 379,383 **** if (temp < 0) { analyze_.addError( ! DicoResource.getS("Erreur interne: index non trouvé")); } if (i != 0) { --- 378,382 ---- if (temp < 0) { analyze_.addError( ! DicoResource.getS("Erreur interne: index non trouvé"),0); } if (i != 0) { *************** *** 436,440 **** } public DodicoAnalyze write() { ! analyze_= new DodicoAnalyze.Editor(); analyze_.setDesc(DicoResource.getS("Génération fichier dico")); writeDico(); --- 435,439 ---- } public DodicoAnalyze write() { ! analyze_= new DodicoAnalyze(); analyze_.setDesc(DicoResource.getS("Génération fichier dico")); writeDico(); *************** *** 445,449 **** e.printStackTrace(); } ! return analyze_.toAnalyze(); } /** --- 444,448 ---- e.printStackTrace(); } ! return analyze_; } /** *************** *** 467,471 **** } if (duplicateNameExists()) { ! analyze_.addError(DicoResource.getS("Noms en double")); } File f= new File(dir_, getFileName() + ".java"); --- 466,470 ---- } if (duplicateNameExists()) { ! analyze_.addError(DicoResource.getS("Noms en double"),0); } File f= new File(dir_, getFileName() + ".java"); *************** *** 492,500 **** } } catch (IllegalAccessException _e) { ! DodicoAnalyze.manageException(_e, analyze_); } catch (InvocationTargetException _e) { ! DodicoAnalyze.manageException(_e, analyze_); } catch (IOException _e) { ! DodicoAnalyze.manageException(_e, analyze_); } finally { try { --- 491,499 ---- } } catch (IllegalAccessException _e) { ! analyze_.manageException(_e); } catch (InvocationTargetException _e) { ! analyze_.manageException(_e); } catch (IOException _e) { ! analyze_.manageException(_e); } finally { try { *************** *** 506,510 **** } } catch (IOException _e) { ! DodicoAnalyze.manageException(_e, analyze_); } } --- 505,509 ---- } } catch (IOException _e) { ! analyze_.manageException(_e); } } Index: DicoParams.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoParams.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** DicoParams.java 21 Jan 2004 10:59:09 -0000 1.15 --- DicoParams.java 12 Feb 2004 15:32:43 -0000 1.16 *************** *** 38,41 **** --- 38,42 ---- implements DicoEntiteComparator.ComparatorValueInterface, DicoParamsInterface { private Hashtable entitesValues_; + Hashtable entitesCommentaires_; private Set modelListener_; private Set badValues_; *************** *** 46,53 **** private boolean isModified_; private Map loadedEntiteState_; /** * */ ! public DicoParams(Map _inits, DicoCasFileFormatVersionAbstract _dico) { entitesValues_= (_inits == null ? new Hashtable() : new Hashtable(_inits)); ft_= _dico; --- 47,63 ---- private boolean isModified_; private Map loadedEntiteState_; + + public DicoParams( + DicoCasInterface _i, + DicoCasFileFormatVersionAbstract _dico) { + this(_i.getInputs(), _i.getComments(), _dico); + } /** * */ ! public DicoParams( ! Map _inits, ! Map _keysCommentaire, ! DicoCasFileFormatVersionAbstract _dico) { entitesValues_= (_inits == null ? new Hashtable() : new Hashtable(_inits)); ft_= _dico; *************** *** 57,62 **** } entitesFiles_= ft_.getDico().getFichierEntitesFor(entitesValues_); ! if(entitesFiles_==null) entitesFiles_=new HashSet(20); computeValide(); } public int getEntiteFileNb() { --- 67,75 ---- } entitesFiles_= ft_.getDico().getFichierEntitesFor(entitesValues_); ! if (entitesFiles_ == null) ! entitesFiles_= new HashSet(20); computeValide(); + if (_keysCommentaire != null) + entitesCommentaires_= new Hashtable(_keysCommentaire); } public int getEntiteFileNb() { *************** *** 64,67 **** --- 77,113 ---- } + /** + * Renvoie le commentaire pour le mot-cle e ou null si aucun commentaire. + */ + public String getComment(DicoEntite _e) { + return (entitesCommentaires_ == null) + ? null + : (String)entitesCommentaires_.get(_e); + } + + public Map getCommentMap(){ + return (entitesCommentaires_ == null) + ? null + : new Hashtable(entitesCommentaires_); + } + + /** + * Les commentaires ne sont pris en compte que si la valeur est modifiee. + */ + public void setComment(DicoEntite _e, String _s) { + if (isValueSetFor(_e)) { + if (entitesCommentaires_ == null) + entitesCommentaires_= new Hashtable(); + if ((!entitesCommentaires_.contains(_e)) + || !entitesCommentaires_.get(_e).equals(_s)) { + entitesCommentaires_.put(_e, _s); + //DEBUG to remove + System.err.println("saveCommentYes"); + isModified_= true; + fireProjectModifyStateChanged(); + } + } + } + public void setDicoEntiteMustBeEmpty(DicoEntite _e, boolean _b) { if (_b) { *************** *** 219,224 **** if (!isValueSetFor(ent)) { l.add(ent); - //DEBUG A ENLEVER - System.out.println("ent to save " + ent.getNom()); } } --- 265,268 ---- *************** *** 366,372 **** return ft_.getDico(); } ! public DicoCasInterface getDicoCasInterface() { ! return new DicoCasAbstract(getEntiteValues()); ! } public boolean contains(DicoEntite _ent) { return entitesValues_.contains(_ent); --- 410,420 ---- return ft_.getDico(); } ! // public DicoCasInterface getDicoCasInterface() { ! // return new DicoCasAbstract( ! // getEntiteValues(), ! // (entitesCommentaires_ == null ! // ? null ! // : new HashMap(entitesCommentaires_))); ! // } public boolean contains(DicoEntite _ent) { return entitesValues_.contains(_ent); *************** *** 408,412 **** */ public final String getValue(DicoEntite _ent) { ! if(_ent==null) return null; String r= (String)entitesValues_.get(_ent); if (r == null) --- 456,461 ---- */ public final String getValue(DicoEntite _ent) { ! if (_ent == null) ! return null; String r= (String)entitesValues_.get(_ent); if (r == null) *************** *** 424,428 **** */ public final boolean isValueSetFor(DicoEntite _ent) { ! return entitesValues_.containsKey(_ent); } /** --- 473,478 ---- */ public final boolean isValueSetFor(DicoEntite _ent) { ! ! return _ent == null ? false : entitesValues_.containsKey(_ent); } /** *************** *** 436,440 **** */ public final boolean removeValue(DicoEntite _ent) { ! if(_ent==null) return false; if (entitesValues_.containsKey(_ent)) { String old= getValue(_ent); --- 486,491 ---- */ public final boolean removeValue(DicoEntite _ent) { ! if (_ent == null) ! return false; if (entitesValues_.containsKey(_ent)) { String old= getValue(_ent); *************** *** 449,453 **** final DicoEntite _ent, final String _value) { ! if(_ent==null) return null; final String old= getValue(_ent); boolean b= _setValue(_ent, _value); --- 500,505 ---- final DicoEntite _ent, final String _value) { ! if (_ent == null) ! return null; final String old= getValue(_ent); boolean b= _setValue(_ent, _value); *************** *** 465,478 **** } public DodicoCommand removeValueAndGenerateCommand(final DicoEntite _ent) { ! if(_ent==null) return null; final String old= getValue(_ent); boolean b= removeValue(_ent); if (b) { return new DodicoCommand() { public void redo() { removeValue(_ent); } public void undo() { _setValue(_ent, old); } }; --- 517,545 ---- } public DodicoCommand removeValueAndGenerateCommand(final DicoEntite _ent) { ! if (_ent == null) ! return null; final String old= getValue(_ent); + final String oldCommentaire= getComment(_ent); + //il faut enlever d'abord le commentaire pour que l'evenement + //soit envoye avec le bon commentaire ! + if (entitesCommentaires_ != null) + entitesCommentaires_.remove(_ent); + final boolean com= + (oldCommentaire != null) && (oldCommentaire.trim().length() > 0); boolean b= removeValue(_ent); + if (b) { return new DodicoCommand() { public void redo() { + if (com && (entitesCommentaires_ != null)) + entitesCommentaires_.remove(_ent); removeValue(_ent); + } public void undo() { + if (com && (entitesCommentaires_ != null)) + entitesCommentaires_.put(_ent, oldCommentaire); _setValue(_ent, old); + } }; *************** *** 691,695 **** } } ! public DicoCasAbstract createCasWriterInterface(String _casFileName) { Map m= getEntiteValues(); if (casFileEntite_ != null) { --- 758,762 ---- } } ! public DicoCasInterface createCasWriterInterface(String _casFileName) { Map m= getEntiteValues(); if (casFileEntite_ != null) { *************** *** 697,702 **** m.put(casFileEntite_, _casFileName); } ! DicoCasAbstract inter= new DicoCasAbstract(m); ! return inter; } /** --- 764,772 ---- m.put(casFileEntite_, _casFileName); } ! return new DicoCasAbstract( ! m, ! (entitesCommentaires_ == null ! ? null ! : new HashMap(entitesCommentaires_))); } /** Index: DicoParamsInterface.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/dico/DicoParamsInterface.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DicoParamsInterface.java 25 Nov 2003 10:11:30 -0000 1.3 --- DicoParamsInterface.java 12 Feb 2004 15:32:43 -0000 1.4 *************** *** 51,58 **** public abstract DicoCasFileFormat getDicoFileFormat(); public abstract DicoModelAbstract getDico(); ! public abstract DicoCasInterface getDicoCasInterface(); public abstract boolean contains(DicoEntite _ent); public abstract Set getEntiteFileSetList(); public abstract boolean isValide(); /** * --- 51,59 ---- public abstract DicoCasFileFormat getDicoFileFormat(); public abstract DicoModelAbstract getDico(); ! //public abstract DicoCasInterface getDicoCasInterface(); public abstract boolean contains(DicoEntite _ent); public abstract Set getEntiteFileSetList(); public abstract boolean isValide(); + public abstract String getComment(DicoEntite _e); /** * |