From: <had...@us...> - 2008-08-25 18:11:36
|
Revision: 3833 http://fudaa.svn.sourceforge.net/fudaa/?rev=3833&view=rev Author: hadouxad Date: 2008-08-25 18:11:33 +0000 (Mon, 25 Aug 2008) Log Message: ----------- - gestion de plusieurs trpostsource dans trpostprojet - interface graphique de gestion des projets - Action d ajout de source - Action d'enlevement de source - gestion d un activator sepecial multi-source: ie qui gere tous les sources au sein du meme projet trpost Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEdgeFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -23,21 +23,22 @@ import javax.swing.border.Border; import javax.swing.event.ListSelectionListener; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ebli.trace.BPlageInterface; +import org.fudaa.ebli.trace.TraceIcon; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuPanel; import com.memoire.bu.BuVerticalLayout; -import org.fudaa.ctulu.CtuluLibString; - -import org.fudaa.ebli.trace.BPlageInterface; -import org.fudaa.ebli.trace.TraceIcon; - /** - * Une palette de couleurs associ\xE9es \xE0 des plages de valeurs. Les valeurs hors plages sont consid\xE9r\xE9es comme "autres". + * Une palette de couleurs associ\xE9es \xE0 des plages de valeurs. Les valeurs hors + * plages sont consid\xE9r\xE9es comme "autres". * - * @version $Id: BPalettePlageLegende.java,v 1.23 2007-05-04 13:49:42 deniger Exp $ - * @author Bertrand Marchand + * @version $Id: BPalettePlageLegende.java,v 1.23 2007-05-04 13:49:42 deniger + * Exp $ + * @author Bertrand Marchand TODO refaire en widget */ public class BPalettePlageLegende extends JPanel implements BPalettePlageListener { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -76,13 +76,13 @@ revalidate(); } - @Override - protected Rectangle calculateClientArea() { - Rectangle res = intern.getPreferredBounds(); - // TODO Auto-generated method stub - return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) - + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); - } + // @Override + // protected Rectangle calculateClientArea() { + // // Rectangle res = intern.getPreferredBounds(); + // // // TODO Auto-generated method stub + // // return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) + // // + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); + // } protected void paintWidget() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -17,7 +17,7 @@ */ public class EbliWidgetCalqueLegende extends EbliWidget { - BCalqueLegendePanel calqueLegende_; + public BCalqueLegendePanel calqueLegende_; ComponentWidget intern_; public EbliWidgetCalqueLegende(EbliScene scene, BCalqueLegendePanel _calqueLegende) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -25,6 +25,7 @@ import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; @@ -37,10 +38,7 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; -import com.memoire.bu.BuBorders; -import com.memoire.bu.BuButton; import com.memoire.bu.BuPanel; -import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; /** @@ -86,7 +84,7 @@ WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); - _vue.addCqLegende(new EbliWidgetCalqueLegende(_scene)); + _vue.addCqLegende(new BCalqueLegende()); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -17,17 +17,13 @@ import javax.swing.BorderFactory; import javax.swing.JComponent; -import com.memoire.bu.*; -import com.memoire.vfs.VfsFile; - import org.fudaa.ctulu.BuNetworkPreferencesPanel; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluFavoriteFiles; - import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.exec.FudaaExec; +import org.fudaa.fudaa.commun.impl.FudaaLookPreferencesPanel; import org.fudaa.fudaa.commun.impl.FudaaStartupExitPreferencesPanel; -import org.fudaa.fudaa.commun.impl.FudaaLookPreferencesPanel; import org.fudaa.fudaa.tr.common.TrApplicationManager; import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrExplorer; @@ -41,6 +37,19 @@ import org.fudaa.fudaa.tr.telemac.TrTelemacExecPreferencesPanel; import org.fudaa.fudaa.tr.telemac.TrTelemacImplHelper; +import com.memoire.bu.BuBrowserPreferencesPanel; +import com.memoire.bu.BuDynamicMenu; +import com.memoire.bu.BuIcon; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuLanguagePreferencesPanel; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuSeparator; +import com.memoire.bu.BuToolButton; +import com.memoire.bu.BuUserPreferencesPanel; +import com.memoire.vfs.VfsFile; + /** * @author Fred Deniger * @version $Id: TrSupervisorImplementation.java,v 1.38 2008-01-15 11:38:49 bmarchan Exp $ Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,74 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.Iterator; + +import org.fudaa.ebli.commun.EbliActionSimple; + +import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + +public class TrPostActionChangeSrc extends EbliActionSimple { + /** + * projet en cours contenant les multi projets. + */ + TrPostProjet projet_; + + /** + * Activator multi source permettant de gerer une nouvelle source pour + * trpostProjet + */ + TrPostMultiSourceActivator multiProjectActivator_; + + public TrPostActionChangeSrc(TrPostProjet _projet) { + super("Changer de donn\xE9es", BuResource.BU.getIcon("crystal_valider"), "Changer de donn\xE9es"); + projet_ = _projet; + + // -- creation de l activator multi-source avec le projet param --// + this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); + } + + public void actionPerformed(ActionEvent e) { + + + // -- recuperation de la source a supprimer --// + + // -- cas rien de selectionnee --// + if (projet_.filleProjetctManager_.listProjets_.getSelectedIndex() == -1) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Il faut selectionner le fichier dans la liste avant de cliquer.").activate(); + } else { + + // -- recupeation de la source a enlever --// + TrPostSource src = (TrPostSource) projet_.filleProjetctManager_.listProjets_.getSelectedValue(); + + // -- demande confirmationa l user --// + int confirmation = new BuDialogConfirmation(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "\xCAtes-vous sur de vouloir changer les donn\xE9es par celles \n du fichier " + src.getTitle() + " ?") + .activate(); + + if (confirmation == 0) { + if (projet_.changeSource(src)) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Les donn\xE9es ont \xE9t\xE9 correctement charg\xE9es.").activate(); + } else { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Les donn\xE9es n'ont pas \xE9t\xE9 correctement charg\xE9es.").activate(); + } + + testAfficheMesSimu(); + } + } + + } + + public void testAfficheMesSimu() { + int i = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + FuLog.warning("simul " + (i++) + ": " + src.getTitle()); + } + } +} Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,87 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.io.File; +import java.util.Iterator; + +import org.fudaa.ebli.commun.EbliActionSimple; + +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuFileChooser; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + + +/** + * Gere l'action d'ouvrir un nouveau source et de l integrer au projet + * + * @author Adrien Hadoux + * + */ + +public class TrPostActionOpenSrc extends EbliActionSimple { + + /** + * projet en cours contenant les multi projets. + */ + TrPostProjet projet_; + + + /** + * Activator multi source permettant de gerer une nouvelle source pour + * trpostProjet + */ + TrPostMultiSourceActivator multiProjectActivator_; + + public TrPostActionOpenSrc(TrPostProjet _projet) { + super("Ajouter projet", BuResource.BU.getIcon("crystal_ouvrirprojet"), "Ajouter projet"); + projet_ = _projet; + + // -- creation de l activator multi-source avec le projet param --// + this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); + } + + public void actionPerformed(ActionEvent e) { + + BuFileChooser chooser = new BuFileChooser(/* System.getProperty("user.dir") */); + + int rep = chooser.showOpenDialog(projet_.impl_.getParentComponent()); + + if (rep == BuFileChooser.APPROVE_OPTION) { + + // --chargement du fichier source correspondant et ajout dans le projet + // --// + File fichierAbsolu = chooser.getSelectedFile(); + + // -- verification que le fichier n est pas deja ouvert --// + if (projet_.isSourceExist(fichierAbsolu.getAbsolutePath())) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.").activate(); + + return; + } + + + // -- tentative de chargement du source dans le multi-projet --// + multiProjectActivator_.active(fichierAbsolu, projet_.impl_); + + + testAfficheMesSimu(); + + + + + } + + } + + public void testAfficheMesSimu() { + int i = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + FuLog.warning("simul " + (i++) + ": " + src.getTitle()); + } + } + + +} Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,85 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.Iterator; + +import org.fudaa.ebli.commun.EbliActionSimple; + +import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + +/** + * Action de suppression d un source du multi-projet. + * + * @author Adrien Hadoux + * + */ + +public class TrPostActionRemoveSrc extends EbliActionSimple { + /** + * projet en cours contenant les multi projets. + */ + TrPostProjet projet_; + + + /** + * Activator multi source permettant de gerer une nouvelle source pour + * trpostProjet + */ + TrPostMultiSourceActivator multiProjectActivator_; + + public TrPostActionRemoveSrc(TrPostProjet _projet) { + super("Enlever projet", BuResource.BU.getIcon("crystal_enlever"), "Enlever projet"); + projet_ = _projet; + + // -- creation de l activator multi-source avec le projet param --// + this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); + } + + public void actionPerformed(ActionEvent e) { + + + //-- recuperation de la source a supprimer --// + + // -- cas rien de selectionnee --// + if (projet_.filleProjetctManager_.listProjets_.getSelectedIndex() == -1) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Il faut selectionner le fichier \xE0 retirer de la liste avant de cliquer.").activate(); + } else { + + // -- recupeation de la source a enlever --// + TrPostSource src = (TrPostSource) projet_.filleProjetctManager_.listProjets_.getSelectedValue(); + + + // -- demande confirmationa l user --// + int confirmation = new BuDialogConfirmation( + projet_.impl_.getApp(), + projet_.impl_.getInformationsSoftware(), + "\xCAtes-vous sur de vouloir enlever \n le fichier " + src.getTitle() + "\n du projet?") + .activate(); + + if (confirmation == 0) { + if (projet_.removeSource(src)) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier a \xE9t\xE9 correctement enlev\xE9 du projet").activate(); + } else { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier n'a pas \xE9t\xE9t correctement enlev\xE9 du projet.").activate(); + } + + testAfficheMesSimu(); + } + } + + } + + public void testAfficheMesSimu() { + int i = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + FuLog.warning("simul " + (i++) + ": " + src.getTitle()); + } + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -3,6 +3,8 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -13,7 +15,6 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTree; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluUndoRedoInterface; @@ -41,6 +42,7 @@ import org.netbeans.api.visual.model.ObjectSceneListener; import org.netbeans.api.visual.model.ObjectState; +import com.memoire.bu.BuButton; import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuMenuBar; @@ -93,6 +95,8 @@ * bouton qui permet de masquer/afficher le tree */ JButton toggleTree_; + + TrPostProjet projet_; /** * Constructeur de la fenetre. @@ -100,6 +104,8 @@ public TrPostLayoutFille(TrPostProjet _projet) { super(); setTitle(TrResource.getS("vue 2D")); + + projet_ = _projet; // creation de la scene EBLI controller_ = new TrPostLayoutPanelController(new TrPostScene(), _projet); setContentPane(controller_.getPanel()); @@ -174,6 +180,23 @@ pane.add(panelTreeModifiable_); right.add(conteneurTree_, BorderLayout.CENTER); + + // -- ajout du bouton qui permet de g\xE9rer tous les resultats + BuButton boutonGestionMultiSrc = new BuButton("Gestion des projets"); + + boutonGestionMultiSrc.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // -- affichage de la fenetre de gestion multi projet --// + if (!projet_.filleProjetctManager_.isVisible()) + projet_.impl_.addInternalFrame(projet_.filleProjetctManager_); + + projet_.filleProjetctManager_.setSize(500, 250); + + } + + }); + over.add(boutonGestionMultiSrc, BorderLayout.SOUTH); // --verification qu il n existe pas de composant sur la scene auquel cas, // selection automatique pour modification --// Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -39,7 +39,6 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -430,7 +429,7 @@ "WIDGETRECALQUE") { public void actionPerformed(ActionEvent _evt) { - TrPostVisuPanel pnVisu =new TrPostVisuPanel(projet_.getImpl(),projet_,new EbliWidgetCalqueLegende(getScene())); + TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, null); addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); } }); Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,755 @@ +/* + * @creation 24 mars 2004 + * @modification $Date: 2007-06-20 12:23:39 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ + package org.fudaa.fudaa.tr.post; + + import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JFrame; +import javax.swing.JTextField; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.CtuluUIAbstract; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormat; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.ef.EfGridSource; +import org.fudaa.dodico.ef.EfLib; +import org.fudaa.dodico.ef.FileFormatGridVersion; +import org.fudaa.dodico.fichiers.FileFormatSoftware; +import org.fudaa.dodico.h2d.rubar.H2dRubarGridAreteSource; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.reflux.io.CorEleBthFileFormat; +import org.fudaa.dodico.reflux.io.INPFileFormat; +import org.fudaa.dodico.reflux.io.RefluxRefondeSolutionFileFormat; +import org.fudaa.dodico.reflux.io.RefluxRefondeSolutionNewReader; +import org.fudaa.dodico.reflux.io.RefluxRefondeSolutionSequentielResult; +import org.fudaa.dodico.reflux.io.RefluxSolutionSequentielReader; +import org.fudaa.dodico.refonde.io.RefondeINPResult; +import org.fudaa.dodico.refonde.io.RefondeQuickINPReader; +import org.fudaa.dodico.rubar.io.RubarDATFileFormat; +import org.fudaa.dodico.telemac.io.SerafinFileFormat; +import org.fudaa.dodico.telemac.io.SerafinInterface; +import org.fudaa.dodico.telemac.io.TelemacVariableMapper; +import org.fudaa.ebli.commun.BJava3DVersionTest; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.meshviewer.MvResource; +import org.fudaa.fudaa.tr.common.Tr3DFactory; +import org.fudaa.fudaa.tr.common.TrFileFormatManager; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabelMultiLine; +import com.memoire.bu.BuLib; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; + +/** + * + * refonte de TrPostSourceActivator poru gerer plusieurs source au sein du meme + * post. La difference avec le sourceActivator c'est qu'ici on ajoute toutes les + * sources a un meme TrPostProjet afin de gere le multi source au sein du + * trpojet. TODO mettre la construction des sources dans le + * TrPostSourceActivator TODO renommmer cette classe en TrPostProjetActivator + * + * @author Adrien Hadoux + */ +public final class TrPostMultiSourceActivator { + + public TrPostProjet projetCourant_; + + + + public TrPostMultiSourceActivator(TrPostProjet _projet) { + super(); + projetCourant_ = _projet; + + } + + /** + * @param _s la source + * @param _impl l'impl parente + */ + protected static void afficheFrame(final TrPostProjet _p, final TrPostCommonImplementation _impl) { + BuLib.invokeNow(new Runnable() { + + public void run() { + _impl.setProjet(_p); + } + }); + + } + + /** + * @param _f le fichier a ouvrir + * @param _impl l'impl parent + */ + public void activeSerafin(final File _f, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + activeSerafinAction(_f, _impl, _impl.createProgressionInterface(this)); + if (projetCourant_ == null) { + return; + } + if (SerafinFileFormat.is3DGrid(projetCourant_.getSource().getGrid())) { + BuLib.invokeLater(new Runnable() { + + public void run() { + affiche3D(projetCourant_, _impl); + } + + }); + } else { + afficheFrame(projetCourant_, _impl); + } + } + }.start(); + } + + protected static void affiche3D(final TrPostProjet _p, final TrPostCommonImplementation _impl) { + if (!BJava3DVersionTest.isJava3DFound()) { + _impl + .error( + "3D", + TrResource + .getS("Le fichier de r\xE9sultats corresond \xE0 un calcul 3D\n. Or, Java3D n'est pas install\xE9 sur votre poste.\nVous ne pouvez pas visualiser ce fichier de r\xE9sultats.\nVoir le menu 'Aide>Tester Java3D' pour installer Java 3D")); + return; + } + if (_impl.question("3D", TrResource + .getS("Le fichier de r\xE9sultats corresond \xE0 un calcul 3D.\nVoulez-vous ouvrir la vue 3D?"))) { + final JFrame f = new JFrame(); + f.setIconImage(EbliResource.EBLI.getImage("3d")); + Tr3DFactory.afficheFrame(f, _p.getSource(), _p.getSource().getInterpolator().getVect(), _impl, null, null); + } + + } + + public void activeGrid(final File _f, final FileFormatGridVersion _fmt, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + activeGridAction(_f, _fmt, _impl, _impl.createProgressionInterface(this)); + if (projetCourant_ != null) { + afficheFrame(projetCourant_, _impl); + } + } + }.start(); + } + + /** + * Ouvre le fichier en fonction de l'extension. + * + * @param _f le fichier correct + * @param _impl l'impl parent + */ + public void active(final File _f, final TrPostCommonImplementation _impl) { + if (_f == null) { + return; + } + final TrFileFormatManager mng = TrFileFormatManager.INSTANCE; + final String name = _f.getName(); + if (isReflux(name)) { + activeINP(_f, _impl); + return; + } + if (mng.isRubarTPSFile(name)) { + activeRubar(_f, _impl); + return; + } + // mettre serafin en dernier car le test est tres large .... + if (SerafinFileFormat.getInstance().createFileFilter().accept(_f)) { + activeSerafin(_f, _impl); + return; + } + final FileFormat ft = FileFormat.findFileFormat(TrFileFormatManager.getAllGridFormat(), _f); + if (ft == null) { + final String id = _impl.getLauncher().getCurrentPrefHydId(); + if (FileFormatSoftware.REFLUX_IS.name.equals(id)) { + activeINP(_f, _impl); + } else if (FileFormatSoftware.TELEMAC_IS.name.equals(id)) { + activeSerafin(_f, _impl); + } else if (FileFormatSoftware.RUBAR_IS.name.equals(id)) { + activeRubar(_f, _impl); + } + } else { + activeGrid(_f, (FileFormatGridVersion) ft, _impl); + } + } + + private static boolean isReflux(final String _name) { + return INPFileFormat.getInstance().isAccepted(_name) + || RefluxRefondeSolutionFileFormat.getInstance().isAccepted(_name); + } + + public static TrPostSource activeSourceAction(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _prog) { + return activeSourceAction(_f, _impl, _impl.getLauncher().getCurrentPrefHydId(), _prog, null); + } + + public static TrPostSource activeSourceAction(final File _f, final CtuluUI _impl, final String _id, + final ProgressionInterface _prog, final Map _otherData) { + if (_f == null) { + return null; + } + final TrFileFormatManager mng = TrFileFormatManager.INSTANCE; + final String name = _f.getName(); + if (isReflux(name)) { + return activeINPSource(_f, _impl, _prog); + } else if (mng.isRubarTPSFile(name)) { + final TrPostSourceRubar rubar = activeRubarSrcAction(_f, _impl, _prog); + if (rubar == null) { + return null; + } + final TrPostRubarLoader loader = new TrPostRubarLoader(rubar, _f, true); + loader.active(_impl, _prog); + return rubar; + + } + // mettre serafin en dernier car le test est tres large .... + else if (SerafinFileFormat.getInstance().createFileFilter().accept(_f)) { + return activeSerafinSourceAction(_f, _impl, _prog, _otherData); + } + final FileFormat ft = FileFormat.findFileFormat(TrFileFormatManager.getAllGridFormat(), _f); + if (ft != null) { + return activeGridSource(_f, (FileFormatGridVersion) ft, _impl, _prog); + } + final String id = _id; + if (FileFormatSoftware.REFLUX_IS.name.equals(id) || RefluxRefondeSolutionFileFormat.getInstance().isAccepted(_f)) { + return activeINPSource(_f, _impl, _prog); + } else if (FileFormatSoftware.TELEMAC_IS.name.equals(id)) { + return activeSerafinSourceAction(_f, _impl, _prog, _otherData); + } else if (FileFormatSoftware.RUBAR_IS.name.equals(id)) { + final TrPostSourceRubar rubar = activeRubarSrcAction(_f, _impl, _prog); + if (rubar != null) { + final TrPostRubarLoader loader = new TrPostRubarLoader(rubar, _f, true); + loader.active(_impl, _prog); + return rubar; + } + } + return null; + } + + /** + * Ouvir une boite de dialogue pour determiner le fichier inp et le fichier sov. + * + * @param _f le fichier xinp,sov ou inp + * @param _impl l'impl parent + */ + public void activeINP(final File _f, final TrPostCommonImplementation _impl) { + if (RefluxRefondeSolutionSequentielResult.isRefonde(_f)) { + final File inp = getInpFileForRefonde(_f, _impl); + if (inp != null) { + activeINP(inp, _f, _impl); + } + return; + } + final INPChooseFile pn = new INPChooseFile(_f); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_impl.getFrame()))) { + activeINP(pn.getInp(), pn.getsov(), _impl); + } + } + + /** + * @param _f le fichier tps + * @param _impl l'impl parente + */ + public void activeRubar(final File _f, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + final ProgressionInterface prog = _impl.createProgressionInterface(this); + activeRubarAction(_f, _impl, prog); + final TrPostProjetRubar rubar = new TrPostProjetRubar(projetCourant_); + if (rubar == null) { + return; + } + final TrPostRubarLoader loader = new TrPostRubarLoader(rubar, _f, true); + loader.active(_impl, prog); + afficheFrame(rubar, _impl); + + } + }.start(); + } + + /** + * @param _f le fichier inp + * @param _sov le fichier sov + * @param _impl l'impl parente + */ + public void activeINP(final File _f, final File _sov, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + activeINPAction(_f, _sov, _impl, _impl.createProgressionInterface(this)); + if (projetCourant_ != null) { + afficheFrame(projetCourant_, _impl); + } + } + }.start(); + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public void activeSerafinAction(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _inter) { + final TrPostSource r = activeSerafinSourceAction(_f, _impl, _inter, null); + if (r == null) { + return; + } + + + // ajout de la source au postProjet + this.projetCourant_.ajouterSource(r); + + /* + * final boolean isDataModified = + * projetCourant_.openSrcDataAndIsModified(_impl, _inter); + * r.buildDefaultVarUpdateLists(); if (isDataModified) { + * this.projetCourant_.setProjectModified(); } + */ + return; + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public static TrPostSource activeSerafinSourceAction(final File _f, final CtuluUI _impl, + final ProgressionInterface _inter, final Map _otherData) { + final CtuluIOOperationSynthese s = SerafinFileFormat.getInstance().read(_f, _inter); + if (isFatalError(_impl, s)) { + return null; + } + final SerafinInterface ser = (SerafinInterface) s.getSource(); + if (_otherData != null) { + _otherData.put("IPOBO", ser.getIpoboInitial()); + } + if (_otherData != null) { + _otherData.put("IPARAMS", ser.getIparam()); + } + final EfGridInterface g = ser.getGrid(); + // 3D + if (!SerafinFileFormat.is3DGrid(g)) { + s.getAnalyze().clear(); + g.computeBord(/* ser.getPtsFrontiere(), */_inter, s.getAnalyze()); + g.createIndexRegular(_inter); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(s.getAnalyze()); + } + } + final double[] timeStep = new double[ser.getTimeStepNb()]; + for (int i = timeStep.length - 1; i >= 0; i--) { + timeStep[i] = ser.getTimeStep(i); + } + final Map shortNameVar = new HashMap(); + final H2dVariableType[] variable = new H2dVariableType[ser.getValueNb()]; + final TelemacVariableMapper mapper = new TelemacVariableMapper(); + for (int i = variable.length - 1; i >= 0; i--) { + variable[i] = mapper.getUsedKnownVar(ser.getValueId(i)); + if (variable[i] == null) { + variable[i] = H2dVariableType.createTempVar(ser.getValueId(i), shortNameVar); + } + } + TrPostSourceAbstract r = new TrPostSourceSerafin(_f, ser.getTitre(), g, timeStep, variable, ser.getReadingInfo(), + _impl); + if (SerafinFileFormat.is3DGrid(g)) { + r = TrPostSourceTelemac3D.build((TrPostSourceSerafin) r, timeStep, ser, shortNameVar, _inter, _impl); + } + r.initShortNameMap(shortNameVar); + return r; + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public void activeRubarAction(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _inter) { + final TrPostSourceRubar src = activeRubarSrcAction(_f, _impl, _inter); + if (src == null) { + return; + } + + this.projetCourant_.ajouterSource(src); + + return; + } + + public static void loadData(final CtuluUI _impl, final ProgressionInterface _inter, final TrPostProjet _proj) { + if (_proj != null && _proj.openSrcDataAndIsModified(_impl, _inter)) { + _proj.setProjectModified(); + } + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public static TrPostSourceRubar activeRubarSrcAction(final File _f, final CtuluUI _impl, + final ProgressionInterface _inter) { + // on recherche le fichier contenant le maillage + final File dir = _f.getParentFile(); + final String name = CtuluLibFile.getSansExtension(_f.getName()); + final File maillage = RubarDATFileFormat.getInstance().getFileFor(dir, name); + CtuluIOOperationSynthese s; + H2dRubarGridAreteSource grid; + // fichier DAT existe + if (maillage.exists()) { + s = RubarDATFileFormat.getInstance().readGrid(maillage, _inter); + if (isFatalError(_impl, s)) { + return null; + } + grid = (H2dRubarGridAreteSource) s.getSource(); + } else { + _impl.error(TrResource.getS("Le fichier {0} est requis", maillage.getName())); + return null; + + } + if (grid == null) { + return null; + } + grid.getGrid().computeBord(_inter, s.getAnalyze()); + grid.getGrid().createIndexRegular(_inter); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(s.getAnalyze()); + } + return new TrPostSourceRubar(_f, name, grid, _impl); + } + + /** + * @param _gridFile le fichier inp ou ximp + * @param _sovFile le fichier contenant les solutions + * @param _impl l'impl parent + * @param _inter la barre de progression + * @return le source + */ + public void activeINPAction(final File _gridFile, final File _sovFile, final CtuluUI _impl, + final ProgressionInterface _inter) { + + final TrPostSourceReflux retour = (TrPostSourceReflux) activeINPSource(_gridFile, _sovFile, _impl, _inter); + if (retour == null) { + return; + } + retour.buildDefaultVarUpdateLists(); + + projetCourant_.ajouterSource(retour); + + loadData(_impl, _inter, projetCourant_); + return; + } + + public void activeGridAction(final File _f, final FileFormatGridVersion _ftGrid, + final TrPostCommonImplementation _impl, final ProgressionInterface _inter) { + + final TrPostSource retour = activeGridSource(_f, _ftGrid, _impl, _inter); + if (retour == null) { + return; + } + + this.projetCourant_.ajouterSource(retour); + + loadData(_impl, _inter, projetCourant_); + return; + } + + public static TrPostSource activeINPSource(final File _f, final CtuluUI _impl, final ProgressionInterface _inter) { + if (RefluxRefondeSolutionSequentielResult.isRefonde(_f)) { + final File inp = getInpFileForRefonde(_f, _impl); + if (inp == null) { + return null; + } + return activeINPSource(inp, _f, _impl, _inter); + } + final INPChooseFile pn = new INPChooseFile(_f); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_impl.getParentComponent()))) { + return activeINPSource(pn.getInp(), pn.getsov(), _impl, _inter); + } + return null; + } + + private static File getInpFileForRefonde(final File _f, final CtuluUI _impl) { + final File inp = CtuluLibFile.changeExtension(_f, "inp"); + if (!CtuluLibFile.exists(inp)) { + _impl.error("Refonde:\n" + TrResource.getS("Le fichier inp est requis pour la lecture des r\xE9sultats.") + + CtuluLibString.LINE_SEP + + TrResource.getS("Vous pouvez le cr\xE9er en utilisant les foncitons d'exportation de Fudaa-Refonde")); + return null; + } + return inp; + } + + public static TrPostSource activeGridSource(final File _f, final FileFormatGridVersion _fmt, final CtuluUI _impl, + final ProgressionInterface _prog) { + final CtuluIOOperationSynthese op = _fmt.readGrid(_f, _prog); + if (isFatalError(_impl, op)) { + return null; + } + final String[] ext = _fmt.getFileFormat().getExtensions(); + File f = _f; + // pour les formats \xE0 fichier multiple, on prend la premiere extension (cor,ele,bth au hasard). + if (ext.length > 1 && !CtuluLibFile.getExtension(f.getName()).toLowerCase().equals(ext[0].toLowerCase())) { + f = CtuluLibFile.changeExtension(f, ext[0]); + } + + final EfGridInterface grid = ((EfGridSource) op.getSource()).getGrid(); + op.getAnalyze().clear(); + grid.computeBord(_prog, op.getAnalyze()); + grid.createIndexRegular(_prog); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(op.getAnalyze()); + } + final EfData[][] data = new EfData[1][1]; + data[0][0] = EfLib.getBathy(grid); + return new TrPostSourceDefault(f, f.getName(), grid, new double[] { 0 }, + new H2dVariableType[] { H2dVariableType.BATHYMETRIE }, data, _impl); + + } + + public static boolean fileExists(final CtuluUI _ui, final File _f) { + if (_f == null || !_f.exists()) { + if (_ui != null) { + _ui.error(CtuluUIAbstract.getDefaultErrorTitle(), getNotFoundErr(_f), false); + } + return false; + } + return true; + } + + public static String getNotFoundErr(final File _f) { + return CtuluLib.getS("Le fichier {0} n'existe pas", _f == null ? "?" : _f.getAbsolutePath()); + } + + /** + * @param _inpOrxinp le fichier inp ou ximp + * @param _sovFile le fichier contenant les solutions + * @param _impl l'impl parent + * @param _inter la barre de progression + * @return le source + */ + public static TrPostSource activeINPSource(final File _inpOrxinp, final File _sovFile, final CtuluUI _impl, + final ProgressionInterface _inter) { + if (_impl == null) { + FuLog.warning("_impl is null"); + } + if (_inter != null) { + _inter.setDesc(MvResource.getS("Lecture maillage")); + } + final File inpFile = _inpOrxinp; + if (!fileExists(_impl, inpFile)) { + return null; + } + EfGridInterface g = null; + FileFormatGridVersion ft = null; + boolean isSeiche = false; + H2dVariableType refondeFirstVar = H2dVariableType.PHASE; + CtuluIOOperationSynthese s = null; + // le cas refonde + if (RefluxRefondeSolutionSequentielResult.isRefonde(_sovFile)) { + s = new RefondeQuickINPReader().read(_inpOrxinp, _inter); + if (isFatalError(_impl, s)) { + return null; + } + final RefondeINPResult res = (RefondeINPResult) s.getSource(); + g = res.getGrid(); + isSeiche = res.isModuleSeiche(); + refondeFirstVar = res.getVariableForFirstCol(); + } else { + if (INPFileFormat.getInstance().createFileFilter().accept(_inpOrxinp)) { + ft = INPFileFormat.getInstance().getLastINPVersionImpl(); + // final INPFileFormat.INPVersion v = (INPFileFormat.INPVersion) + // INPFileFormat.getInstance().getLastVersionImpl(); + } else if (CorEleBthFileFormat.getInstance().createFileFilter().accept(_inpOrxinp)) { + ft = CorEleBthFileFormat.getInstance(); + } else { + ft = (FileFormatGridVersion) FileFormat.findFileFormat(TrFileFormatManager.getAllGridFormat(), _inpOrxinp); + } + s = ft.readGrid(inpFile, _inter); + if (isFatalError(_impl, s)) { + return null; + } + s.getAnalyze().clear(); + g = ((EfGridSource) s.getSource()).getGrid(); + + } + g.computeBord(_inter, s.getAnalyze()); + g.createIndexRegular(_inter); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(s.getAnalyze()); + } + final File sovFile = _sovFile; + if (!fileExists(_impl, sovFile)) { + return null; + } + if (_inter != null) { + _inter.setDesc(TrResource.getS("Lecture solutions")); + _inter.setProgression(0); + } + final RefluxRefondeSolutionNewReader r = new RefluxRefondeSolutionNewReader(RefluxRefondeSolutionFileFormat + .getInstance()); + r.setFile(sovFile); + s = r.read(); + if (isFatalError(_impl, s)) { + return null; + } + final RefluxRefondeSolutionSequentielResult sol = (RefluxRefondeSolutionSequentielResult) s.getSource(); + // pour le cas refonde + if (sol.isRefonde()) { + sol.setRefondeSeiche(isSeiche, refondeFirstVar); + } + if (sol.getNbPoint() == 0) { + if (_impl != null) { + _impl.error(TrResource.getS("Le fichier {0} est corrompu", sovFile != null ? sovFile.getAbsolutePath() : "?")); + } + return null; + } + if (sol.getNbPoint() != g.getPtsNb()) { + if (_impl != null) { + _impl.error(TrResource.getS("Le fichier de maillage ne correspond pas au fichier des solutions s\xE9lectionn\xE9")); + } + if (Fu.DEBUG) { + FuLog.debug("FTR: nb point maillage: " + g.getPtsNb() + " sol=" + sol.getNbPoint()); + } + return null; + } + final double[] timeStep = new double[sol.getTimeStepNb()]; + for (int i = timeStep.length - 1; i >= 0; i--) { + timeStep[i] = sol.getTimeStep(i); + } + + // final boolean isSot = RefluxRefondeSolutionFileFormat.isSot(sovFile); + // support temperature + final H2dVariableType[] variable = sol.getVars(); + final int[] placement = sol.getPosition(); + final TrPostSourceReflux res = new TrPostSourceReflux(sovFile, sovFile.getAbsolutePath(), g, timeStep, variable, + placement, new RefluxSolutionSequentielReader(sol, sovFile), _impl); + // findGravitation(inp, res); + return res; + } + + private static boolean isFatalError(final CtuluUI _impl, final CtuluIOOperationSynthese _s) { + if (_s == null) { + return false; + } + if (_impl == null) { + if (_s.containsFatalError()) { + _s.printAnalyze(); + return true; + } + return false; + } + return _impl.manageErrorOperationAndIsFatal(_s); + } + + private static class INPChooseFile extends CtuluDialogPanel { + + private JTextField inpField_; + + private JTextField sovField_; + + private File inp_; + + private File sov_; + + /** + * @param _inpOrSov le fichier inp ou sov + */ + public INPChooseFile(final File _inpOrSov) { + final String fic = CtuluLibFile.getSansExtension(_inpOrSov.getName()); + File inp = new File(_inpOrSov.getParentFile(), CtuluLibFile.getFileName(fic, INPFileFormat.getINPExtension())); + if (!inp.exists()) { + final File cor = CtuluLibFile.changeExtension(_inpOrSov, CorEleBthFileFormat.getInstance().getExtensions()[0]); + if (cor.exists()) { + inp = cor; + } + + } + + final File sov = RefluxRefondeSolutionFileFormat.getInstance().isAccepted(_inpOrSov) ? _inpOrSov : new File( + _inpOrSov.getParentFile(), CtuluLibFile.getFileName(fic, RefluxRefondeSolutionFileFormat.getInstance() + .getExtensions()[0])); + init(inp, sov); + } + + /** + * @param _inp le chemin du fichier inp + * @param _sov le chemin du fichier sov + */ + public INPChooseFile(final File _inp, final File _sov) { + init(_inp, _sov); + } + + private void init(final File _inp, final File _sov) { + addEmptyBorder(10); + final String s = TrResource.getS("Fichier") + CtuluLibString.ESPACE; + setLayout(new BuGridLayout(2, 10, 10, true, false)); + addLabel(CtuluLibString.EMPTY_STRING); + add(new BuLabelMultiLine(TrResource.getS("Choisir le fichier sov et le fichier de maillage correspondant"))); + inpField_ = addLabelFileChooserPanel(MvResource.getS("Fichier de maillage"), _inp, false, false); + sovField_ = addLabelFileChooserPanel(s + RefluxRefondeSolutionFileFormat.getInstance().getExtensions()[0], _sov, + false, false); + } + + /** + * @return le fichier inp choisi + */ + public File getInp() { + return inp_; + } + + /** + * @return le fichier sov + */ + public File getsov() { + return sov_; + } + + public boolean valide() { + inp_ = new File(inpField_.getText()); + sov_ = new File(sovField_.getText()); + if (!inp_.exists() || !sov_.exists()) { + final StringBuffer b = new StringBuffer(); + if (!inp_.exists()) { + b.append(getNotFoundErr(inp_)); + } + if (!sov_.exists()) { + if (b.length() > 0) { + b.append(CtuluLibString.LINE_SEP); + } + b.append(getNotFoundErr(sov_)); + } + setErrorText(b.toString()); + return false; + } + return true; + + } + } + + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -15,7 +15,8 @@ import java.beans.PropertyVetoException; import java.io.File; import java.io.IOException; -import java.util.Map; +import java.util.HashSet; +import java.util.Iterator; import java.util.Observable; import java.util.Observer; import java.util.Set; @@ -67,7 +68,6 @@ import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; @@ -95,6 +95,7 @@ import com.db4o.ext.Db4oException; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuButton; +import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuGlassPaneStop; import com.memoire.bu.BuHorizontalLayout; import com.memoire.bu.BuIcon; @@ -274,6 +275,12 @@ transient TrPostLayoutFille filleLayout_ = new TrPostLayoutFille(this); transient BuInternalFrame frVariables_; + + /** + * internalframe qui gere les multiProjets + */ + public TrPostProjetsManagerFille filleProjetctManager_; + int idx_; @@ -283,8 +290,16 @@ ModifyObserver modifyState_ = new ModifyObserver(); + /** + * Donnees courantes du trpost. + */ transient TrPostSource src_; + /** + * liste des sources pour le multiProjet. + */ + transient Set<TrPostSource> listeSrc_ = new HashSet<TrPostSource>(); + transient TimeContentUpdater timeUpdater_; /** @@ -293,17 +308,162 @@ public TrPostProjet(final TrPostSource _src) { src_ = _src; src_.addVariableListener(new VariableListener()); + + // -- ajout de la source de base dans la liste de sources --// + ajouterSource(_src); + + + // -- creation de la frame de gestion multi projet --// + filleProjetctManager_ = new TrPostProjetsManagerFille(this); + } - + + public TrPostProjet(final TrPostSource _src, final TrPostCommonImplementation _impl) { this(_src); impl_ = _impl; + + } + + /** + * Permet d ajouter une source dans le projet afin de gerer le multi source. + * + * @param _src + */ + public void ajouterSource(TrPostSource _src) { + if (!isSourceExist(_src.getFile().getAbsolutePath())) { + listeSrc_.add(_src); + // -- mise a jour de la jlist graphique --// + if (filleProjetctManager_ != null && filleProjetctManager_.modelList_ != null) + filleProjetctManager_.modelList_.addElement(_src); + + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), + "Le fichier.").activate(); + + } + + } + + /** + * retourne la source dans la liste des sources correspondant au fichier. + * retourne null sinon. + * + * @param _file + * : path absolu du fichier + * @return + */ + public TrPostSource findSource(String _file) { + + for (Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + if (src.getFile().getAbsolutePath().equals(_file)) + return src; + } + + return null; + } + + + + /** + * indique si il existe une source portant le nom du fichier en param. + * + * @param _file + * : path absolu du fichier + * @return + */ + public boolean isSourceExist(String _file) { + if (findSource(_file) == null) + return false; + return true; + } + + +// public boolean changeSource(String _file) { + // + // TrPostSource newSrcCourante = findSource(_file); + // if (newSrcCourante == null) + // return false; + // else { + // src_ = newSrcCourante; + // return true; + // } + // + // } + + /** + * methode qui change la source courante et retourne true si la source existe + * bien, false sinon + * + * @param _file + * : path absolu du fichier + * @return + */ + public boolean changeSource(TrPostSource _src) { + + src_ = _src; + + return true; + } + + // public boolean removeSource(String _file) { + // for (Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { + // + // TrPostSource src = it.next(); + // if (src.getFile().getAbsolutePath().equals(_file)) { + // it.remove(); + // return true; + // } + // + // } + // return false; + // + // } + + /** + * Methode de suppression de la source + * + * @param src + * : TrPostSource, retourne true si la suppression a bien ete + * effectuee. + */ + public boolean removeSource(TrPostSource src){ + if (isSourceExist(src.getFile().getAbsolutePath())) { + listeSrc_.remove(src); + // -- mise a jour de la jlist graphique --// + if (filleProjetctManager_ != null && filleProjetctManager_.modelList_ != null) + filleProjetctManager_.modelList_.removeElement(src); + + return true; + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), + "Impossible de supprimer ce fichier de la liste.") + .activate(); + + return false; + } + } + /** + * Methode qui affiche la frame de gestion des multi projets. + */ + public void showProjectFrame() { + + if (filleProjetctManager_ == null) + filleProjetctManager_ = new TrPostProjetsManagerFille(this); + + filleProjetctManager_.setVisible(true); + } + + private void showError(final CtuluUI _ui, final File _dbFile, final String _err) { String mess = TrResource.getS("Les sauvegardes ne seront pas effectu\xE9es") + CtuluLibString.LINE_SEP @@ -645,7 +805,7 @@ } protected TrPostVisuPanel buildVisuPanel() { - return new TrPostVisuPanel(impl_, this,new EbliWidgetCalqueLegende(filleLayout_.getScene())); + return new TrPostVisuPanel(impl_, this, new BCalqueLegende()); } /** @@ -684,7 +844,7 @@ // // filleLayout_.getScene().refresh(); // filleLayout_.getScene_().refresh(); - + // TODO modifier final BuMenuBar menubar = impl_.getMainMenuBar(); final BuMenu menu = new BuMenu(TrResource.getS("Post"), "POST"); menu.setIcon(null); @@ -708,6 +868,8 @@ TrResource.getS("Les fichiers de r\xE9sultats seront relus")); menu.addMenuItem(TrResource.getS("Rafra\xEEchir automatiquement"), "MAJ_DATA_ALWAYS", ic, TrPostProjet.this) .setToolTipText(TrResource.getS("Les fichiers sont surveill\xE9s p\xE9riodiquement")); + menu.addSeparator(); + menu.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this); } @@ -770,6 +932,8 @@ TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); } else if ("VARIABLES".equals(com)) { activeVarFrame(); + } else if ("EXPORTDATA".equals(com)) { + TrPostVisuPanel.startExport(getImpl(), getSource(), null); } else if ("COMPARE".equals(com)) { compareWith(); } else if ("PROJECT".equals(com)) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -12,17 +12,15 @@ import javax.swing.SwingUtilities; -import com.memoire.bu.BuCheckBoxMenuItem; -import com.memoire.bu.BuMenu; - import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.dodico.h2d.resource.H2dResource; import org.fudaa.ebli.calque.BCalqueLegende; - import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuCheckBoxMenuItem; +import com.memoire.bu.BuMenu; + /** * @author Fred Deniger * @version $Id: TrPostProjetRubar.java,v 1.14 2007-02-07 09:56:17 deniger Exp $ @@ -58,7 +56,32 @@ super(_s); } + /** + * Constructeur ajout\xE9 pour construire un postProjetRubar identique au + * postProjet initial et ajouter un source pour gerer la multi simu. + * + * @param projet + */ + public TrPostProjetRubar(final TrPostProjet projet) { + super(projet.src_); + + // -- recuperation de la liste des src --// + this.listeSrc_ = projet.listeSrc_; + + // -- recuperation des autres infos --// + this.filleLayout_ = projet.filleLayout_; + this.frVariables_ = projet.frVariables_; + this.idx_ = projet.idx_; + this.idxFilleG_ = projet.idxFilleG_; + this.impl_ = projet.impl_; + this.modifyState_ = projet.modifyState_; + this.timeUpdater_ = projet.timeUpdater_; + + } + + + /** * @return true si le fond est variable */ public final boolean isFondVariable() { Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,183 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JScrollPane; +import javax.swing.ListCellRenderer; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.fudaa.fudaa.tr.common.TrResource; +import org.jdesktop.swingx.JXList; + +import ... [truncated message content] |