|
From: <de...@us...> - 2003-12-19 12:10:59
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac
In directory sc8-pr-cvs1:/tmp/cvs-serv28766/tr/telemac
Modified Files:
TrTelemac2dParametres.java TrTelemacCommunParametres.java
TrTelemacCommunProjectListener.java TrTelemacCommunProjet.java
Added Files:
TrTelemacDurationEditor.java
Log Message:
General update for prepro
--- NEW FILE: TrTelemacDurationEditor.java ---
(This appears to be a binary file; contents omitted.)
Index: TrTelemac2dParametres.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemac2dParametres.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TrTelemac2dParametres.java 12 Dec 2003 11:29:42 -0000 1.5
--- TrTelemac2dParametres.java 19 Dec 2003 12:10:55 -0000 1.6
***************
*** 8,12 ****
--- 8,16 ----
*/
package org.fudaa.fudaa.tr.telemac;
+ import gnu.trove.TDoubleArrayList;
+ import gnu.trove.TDoubleHashSet;
+
import java.io.File;
+ import java.util.Arrays;
import java.util.Map;
***************
*** 22,26 ****
--- 26,32 ----
import org.fudaa.dodico.telemac.io.TelemacLiquideInterface;
+ import org.fudaa.fudaa.commun.FudaaLib;
import org.fudaa.fudaa.tr.TrImplementation;
+ import org.fudaa.fudaa.tr.TrResource;
/**
* @author deniger
***************
*** 28,31 ****
--- 34,38 ----
*/
public class TrTelemac2dParametres extends TrTelemacCommunParametres {
+
TrTelemac2dParametres(
TrImplementation _ui,
***************
*** 40,49 ****
protected void loadAllAction(ProgressionInterface _prg) {
super.loadAllAction(_prg);
! if(isBoundaryConditionLoaded())
! loadConditionsLimiteLiquide(_prg);
}
!
!
! public H2dEvolutionManager getEvolMng(){
return getTelemacParametres().getEvolMng();
}
--- 47,55 ----
protected void loadAllAction(ProgressionInterface _prg) {
super.loadAllAction(_prg);
! if (isBoundaryConditionLoaded())
! loadConditionsLimiteLiquide(_prg);
}
!
! public H2dEvolutionManager getEvolMng() {
return getTelemacParametres().getEvolMng();
}
***************
*** 52,62 ****
}
public boolean isAllLoaded() {
! boolean b=super.isAllLoaded();
! if(!b) return false;
return isLiquidTransientConditionPresent();
}
!
private boolean loadConditionsLimiteLiquide(ProgressionInterface _prg) {
! if(isLiquidTransientConditionPresent()) return false;
DicoEntite entFile= getTelemacFileFormatVersion().getCLLiquideEntiteFile();
if ((entFile == null) || (!isValueSetFor(entFile)))
--- 58,70 ----
}
public boolean isAllLoaded() {
! boolean b= super.isAllLoaded();
! if (!b)
! return false;
return isLiquidTransientConditionPresent();
}
!
private boolean loadConditionsLimiteLiquide(ProgressionInterface _prg) {
! if (isLiquidTransientConditionPresent())
! return false;
DicoEntite entFile= getTelemacFileFormatVersion().getCLLiquideEntiteFile();
if ((entFile == null) || (!isValueSetFor(entFile)))
***************
*** 73,89 ****
getTelemacParametres().setEvolution(
inter.getEvolutionsFrontieresLiquides());
! dicoParams_.setLoaded(entFile, f, false);
return true;
}
!
/**
* @return true if the file can be saved.
*/
! protected boolean saveClLiquidFile(ProgressionInterface _prog, File _f){
! H2dEvolutionFrontiereLiquide[] liqs=getTelemacParametres().getTelemacCLManager().getLiquideEvolution();
! if(liqs==null) return false;
! TelemacLiquideAbstract inter=new TelemacLiquideAbstract();
inter.setEvolutionsFrontieresLiquides(liqs);
! FileOperationSynthese op=TelemacLiquideFileFormat.getInstance().getLastVersionImpl().writeClLiquid(_f, inter, _prog);
return !getUI().manageAnalyzeAndIsFatal(op.getAnalyze().toAnalyze());
}
--- 81,163 ----
getTelemacParametres().setEvolution(
inter.getEvolutionsFrontieresLiquides());
! boolean modified=getEvolMng().isUsedCurveNotEnoughWidth(
! 0,
! (double)getTelemacParametres().getComputationDuration());
! dicoParams_.setLoaded(
! entFile,
! f,modified
! );
! if(modified){
! getImpl().message(entFile.getNom(), TrResource.getS("Certaines courbes temporelles ne sont pas assez étendues dans le temps( cela sera automatiquement corrigé)"));
! }
return true;
}
!
/**
* @return true if the file can be saved.
*/
! protected boolean saveClLiquidFile(ProgressionInterface _prog, File _f) {
! if (FudaaLib.INFO) {
! FudaaLib.info("save Liquid file in " + _f);
! }
! H2dEvolutionFrontiereLiquide[] liqs=
! getTelemacParametres().getTelemacCLManager().getLiquideEvolution();
! if ((liqs == null) || (liqs.length == 0))
! return false;
! H2dEvolutionFrontiereLiquide first= liqs[0];
! TDoubleHashSet hashSet= new TDoubleHashSet(first.getPasTempNb());
! boolean mustResize= false;
! for (int i= liqs.length - 1; i > 0; i--) {
! mustResize
! |= !(first.getEvol().isEvolutionWithSameX(liqs[i].getEvol(), hashSet));
! }
! double[] newTimes= null;
! long max= getTelemacParametres().getComputationDuration();
! if (mustResize) {
! FudaaLib.info("LIQUID CURVES ARE NOT BASED ON SAME TIMES STEP");
! newTimes= hashSet.toArray();
! Arrays.sort(newTimes);
! mustResize= false;
! if (newTimes[0] != 0) {
! mustResize= true;
! hashSet.add(0d);
! }
! if (((long) (newTimes[newTimes.length - 1])) < max) {
! mustResize= true;
! hashSet.add((double)max);
! }
! if (mustResize) {
! newTimes= hashSet.toArray();
! Arrays.sort(newTimes);
! }
! } else {
! if ((first.getEvol().getQuickPasDeTemps(0) != 0)
! || (first.getEvol().getQuickPasDeTemps(first.getPasTempNb() - 1) < max)) {
! FudaaLib.info("LIQUID CURVES ARE NOT WIDTH ENOUGH");
! TDoubleArrayList l= new TDoubleArrayList(first.getEvol().getArrayX());
! if (first.getEvol().getQuickPasDeTemps(0) != 0) {
! l.insert(0, 0);
! }
! if (first.getEvol().getQuickPasDeTemps(first.getPasTempNb() - 1) < max)
! l.add((double)max);
! newTimes= l.toNativeArray();
! }
! }
! if (newTimes != null) {
! for (int i= liqs.length - 1; i >= 0; i--) {
! liqs[i].setEvolution(
! liqs[i].getEvol().createH2dEvolutionFromInterpolation(newTimes));
! }
! }
! TelemacLiquideAbstract inter= new TelemacLiquideAbstract();
inter.setEvolutionsFrontieresLiquides(liqs);
! FileOperationSynthese op=
! TelemacLiquideFileFormat
! .getInstance()
! .getLastVersionImpl()
! .writeClLiquid(
! _f,
! inter,
! _prog);
return !getUI().manageAnalyzeAndIsFatal(op.getAnalyze().toAnalyze());
}
***************
*** 95,101 ****
File _f,
ProgressionInterface _interface) {
! if (_entFile == getDicoFileFormatVersion().getCLLiquideEntiteFile()) {
! return saveClLiquidFile(_interface, _f);
! }
return super.saveDicoEntiteFileAction(_entFile, _f, _interface);
}
--- 169,175 ----
File _f,
ProgressionInterface _interface) {
! if (_entFile == getDicoFileFormatVersion().getCLLiquideEntiteFile()) {
! return saveClLiquidFile(_interface, _f);
! }
return super.saveDicoEntiteFileAction(_entFile, _f, _interface);
}
Index: TrTelemacCommunParametres.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacCommunParametres.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TrTelemacCommunParametres.java 12 Dec 2003 11:29:42 -0000 1.6
--- TrTelemacCommunParametres.java 19 Dec 2003 12:10:56 -0000 1.7
***************
*** 64,68 ****
}
! public boolean isTransientAvailable(){
return params_.isTransientAvailable();
}
--- 64,68 ----
}
! public boolean canImportEvolution(){
return params_.isTransientAvailable();
}
***************
*** 72,75 ****
--- 72,77 ----
}
+
+
public FudaaCommonImplementation getImpl() {
return (FudaaCommonImplementation)getUI();
***************
*** 315,318 ****
--- 317,321 ----
return infoSenderDelegate_;
}
+
Index: TrTelemacCommunProjectListener.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacCommunProjectListener.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TrTelemacCommunProjectListener.java 12 Dec 2003 11:29:42 -0000 1.6
--- TrTelemacCommunProjectListener.java 19 Dec 2003 12:10:56 -0000 1.7
***************
*** 20,23 ****
--- 20,24 ----
import org.fudaa.dodico.h2d.type.H2dVariableType;
+ import org.fudaa.fudaa.commun.FudaaLib;
import org.fudaa.fudaa.tr.TrProjectDispatcherListener;
import org.fudaa.fudaa.tr.TrResource;
***************
*** 36,39 ****
--- 37,60 ----
proj_= _params;
}
+
+ private void updateLiqCurve(DicoEntite _e) {
+ if (proj_.isTransientAvailable()) {
+ if ((_e == proj_.getTelemacFileFormatVersion().getDureeDuCalcul())
+ || (_e == proj_.getTelemacFileFormatVersion().getNbPasTemps())
+ || (_e == proj_.getTelemacFileFormatVersion().getPasTemps())) {
+ H2dEvolutionManager mng= proj_.getEvolMng();
+ if ((mng != null) || (!mng.isNoCurveUsed())) {
+ long time=
+ proj_
+ .getTrTelemacParams()
+ .getTelemacParametres()
+ .getComputationDuration();
+ if (mng.isUsedCurveNotEnoughWidth(0, time))
+ modifyLiquidFile();
+ FudaaLib.info("LIQUID CURVES NO WIDTH ENOUGH");
+ }
+ }
+ }
+ }
/**
*
***************
*** 44,47 ****
--- 65,70 ----
String _oldValue) {
super.dicoParamsEntiteRemoved(_cas, _ent, _oldValue);
+ updateLiqCurve(_ent);
+ updateFrame();
if (_ent.isFileType()) {
TrTelemacCommunParametres p= proj_.getTrTelemacParams();
***************
*** 155,157 ****
--- 178,225 ----
}
}
+ /**
+ *
+ */
+ public void dicoParamsEntiteAdded(DicoParams _cas, DicoEntite _ent) {
+ super.dicoParamsEntiteAdded(_cas, _ent);
+ updateLiqCurve(_ent);
+ updateFrame();
+ }
+
+ /**
+ *
+ */
+ public void dicoParamsEntiteUpdated(
+ DicoParams _cas,
+ DicoEntite _ent,
+ String _oldValue) {
+ super.dicoParamsEntiteUpdated(_cas, _ent, _oldValue);
+ updateLiqCurve(_ent);
+ updateFrame();
+ }
+
+
+
+ /**
+ *
+ */
+ public void dicoParamsProjectModifyStateChanged(DicoParams _cas) {
+ super.dicoParamsProjectModifyStateChanged(_cas);
+ updateFrame();
+ }
+
+ private void updateFrame(){
+ changedMainFrameState(proj_.isModified(), proj_.getImpl().getFrame());
+ }
+
+ /**
+ *
+ */
+ public void dicoParamsStateLoadedEntiteChanged(
+ DicoParams _cas,
+ DicoEntite _ent) {
+ super.dicoParamsStateLoadedEntiteChanged(_cas, _ent);
+ updateFrame();
+ }
+
}
Index: TrTelemacCommunProjet.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacCommunProjet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TrTelemacCommunProjet.java 12 Dec 2003 11:29:42 -0000 1.6
--- TrTelemacCommunProjet.java 19 Dec 2003 12:10:56 -0000 1.7
***************
*** 8,33 ****
--- 8,45 ----
*/
package org.fudaa.fudaa.tr.telemac;
+ import java.awt.Component;
import java.awt.event.ActionEvent;
+ import java.awt.event.ActionListener;
import javax.swing.Action;
+ import javax.swing.BorderFactory;
+ import javax.swing.JPanel;
import javax.swing.SwingUtilities;
+ import com.memoire.bu.BuButton;
import com.memoire.bu.BuCommonImplementation;
import com.memoire.bu.BuDynamicMenu;
+ import com.memoire.bu.BuGridLayout;
import com.memoire.bu.BuMenu;
import com.memoire.bu.BuResource;
import com.memoire.bu.BuTaskOperation;
+ import com.memoire.bu.BuToolButton;
+ import org.fudaa.dodico.commun.DodicoCmdMngListener;
+ import org.fudaa.dodico.commun.DodicoCommandComposite;
import org.fudaa.dodico.dico.DicoEntite;
import org.fudaa.dodico.fichiers.FileFormatSoftware;
import org.fudaa.dodico.h2d.H2dEvolutionManager;
import org.fudaa.dodico.h2d.H2dResource;
+ import org.fudaa.dodico.h2d.telemac.H2dTelemacDicoFileFormatVersion;
import org.fudaa.ebli.calque.action.EbliActionInterface;
import org.fudaa.ebli.calque.action.EbliComponentFactory;
import org.fudaa.ebli.calque.action.EbliSimpleAction;
+ import org.fudaa.ebli.dialog.EbliSimpleDialogPanel;
import org.fudaa.ebli.ressource.EbliResource;
import org.fudaa.fudaa.commun.FudaaCommonImplementation;
+ import org.fudaa.fudaa.dico.FDicoFilleProjet;
import org.fudaa.fudaa.dico.FDicoProjet;
import org.fudaa.fudaa.ressource.FudaaResource;
***************
*** 44,48 ****
* @version $Id$
*/
! public class TrTelemacCommunProjet extends FDicoProjet implements TrProjet {
//TrTelemacCommunParametres params_;
TrTelemacFilleVisu visu_;
--- 56,62 ----
* @version $Id$
*/
! public class TrTelemacCommunProjet
! extends FDicoProjet
! implements TrProjet, ActionListener {
//TrTelemacCommunParametres params_;
TrTelemacFilleVisu visu_;
***************
*** 68,72 ****
public boolean isTransientAvailable() {
! return getTrTelemacParams().isTransientAvailable();
}
--- 82,86 ----
public boolean isTransientAvailable() {
! return getTrTelemacParams().canImportEvolution();
}
***************
*** 81,84 ****
--- 95,132 ----
}
+ /**
+ * Composant qui sera ajoute au panel entite.
+ */
+ private Component buildLeftUpComponent() {
+ JPanel r= new JPanel();
+ r.setBorder(BorderFactory.createEtchedBorder());
+ r.setLayout(new BuGridLayout(3, 2, 2));
+ BuToolButton b;
+ if (getTelemacFileFormatVersion().getTitreEntite() != null) {
+ b= new BuToolButton(TrResource.TR.getToolIcon("modify-title"));
+ b.setToolTipText(TrResource.getS("Modifier le titre du projet"));
+ b.setActionCommand("MODIFY_TITLE");
+ b.addActionListener(this);
+ r.add(b);
+ }
+ if ((getTelemacFileFormatVersion().getPasTemps() != null)
+ && (getTelemacFileFormatVersion().getNbPasTemps() != null)) {
+ b= new BuToolButton(TrResource.TR.getToolIcon("time"));
+ b.setToolTipText(TrResource.getS("Définir la durée de la simultation"));
+ b.setActionCommand("SIMULATION_DURATION");
+ b.addActionListener(this);
+ r.add(b);
+ }
+
+ return r;
+
+ }
+
+ protected void buildEntiteFille() {
+ if (entiteFille_ != null)
+ return;
+ entiteFille_= new FDicoFilleProjet(this, getImpl(), buildLeftUpComponent());
+ }
+
public void active(TrImplementation _impl) {
boolean change= false;
***************
*** 149,164 ****
if ((getImpl() == null)
|| (!isTransientAvailable())
! || (getEvolMng()== null))
return;
if (this.courbeFille_ == null) {
courbeFille_=
new TrGrapheFille(getImpl(), getInformationsDocument(), getEvolMng());
TrLib.initFrameDimensionWithPref(
! courbeFille_,
"curve",
getImpl().getMainPanel().getDesktop().getSize());
! courbeFille_.setPreferredSize(courbeFille_.getPreferredSize());
! System.out.println(courbeFille_.getPreferredSize());
! getImpl().addInternalFrame(courbeFille_);
} else if (courbeFille_.isClosed())
getImpl().addInternalFrame(courbeFille_);
--- 197,211 ----
if ((getImpl() == null)
|| (!isTransientAvailable())
! || (getEvolMng() == null))
return;
if (this.courbeFille_ == null) {
courbeFille_=
new TrGrapheFille(getImpl(), getInformationsDocument(), getEvolMng());
+ getImpl().addInternalFrame(courbeFille_);
TrLib.initFrameDimensionWithPref(
! courbeFille_,
"curve",
getImpl().getMainPanel().getDesktop().getSize());
!
} else if (courbeFille_.isClosed())
getImpl().addInternalFrame(courbeFille_);
***************
*** 176,180 ****
if (impl instanceof TrImplementation)
visu_.refreshArbreCalque(((TrImplementation)impl).getArbreCalque());
- visu_.pack();
TrLib.initFrameDimensionWithPref(
visu_,
--- 223,226 ----
***************
*** 194,198 ****
new BuTaskOperation(null, TrResource.getS("Chargement fichiers")) {
public void act() {
! TrImplementation impl=(TrImplementation)getImpl();
impl.setGlassPaneStop();
getTrTelemacParams().loadAll(getUI().createProgressionInterface(this));
--- 240,244 ----
new BuTaskOperation(null, TrResource.getS("Chargement fichiers")) {
public void act() {
! TrImplementation impl= (TrImplementation)getImpl();
impl.setGlassPaneStop();
getTrTelemacParams().loadAll(getUI().createProgressionInterface(this));
***************
*** 294,298 ****
}
! if (courbeAction_ == null) {
courbeAction_=
new EbliSimpleAction(
--- 340,344 ----
}
! if ((courbeAction_ == null) && (getTrParams().canImportEvolution())) {
courbeAction_=
new EbliSimpleAction(
***************
*** 337,342 ****
add(projectAction_.buildMenuItem(EbliComponentFactory.INSTANCE));
add(visuAction_.buildMenuItem(EbliComponentFactory.INSTANCE));
! add(courbeAction_.buildMenuItem(EbliComponentFactory.INSTANCE));
!
}
--- 383,388 ----
add(projectAction_.buildMenuItem(EbliComponentFactory.INSTANCE));
add(visuAction_.buildMenuItem(EbliComponentFactory.INSTANCE));
! if (getTrParams().canImportEvolution())
! add(courbeAction_.buildMenuItem(EbliComponentFactory.INSTANCE));
}
***************
*** 346,357 ****
*/
public EbliActionInterface[] getSpecificActions() {
! EbliActionInterface[] r= new EbliActionInterface[5];
! r[0]= getCalculActions().getCalcul();
! r[1]= getDiffAction();
buildFilleActions();
! r[2]= loadAction_;
! r[3]= visuAction_;
! r[4]= courbeAction_;
return r;
}
}
--- 392,458 ----
*/
public EbliActionInterface[] getSpecificActions() {
! EbliActionInterface[] r=
! new EbliActionInterface[getTrParams().canImportEvolution() ? 5 : 4];
! int i= 0;
! r[i++]= getCalculActions().getCalcul();
! r[i++]= getDiffAction();
buildFilleActions();
! r[i++]= loadAction_;
! r[i++]= visuAction_;
! if (getTrParams().canImportEvolution())
! r[i++]= courbeAction_;
return r;
}
+
+ public H2dTelemacDicoFileFormatVersion getTelemacFileFormatVersion() {
+ return getTrTelemacParams().getTelemacParametres().getTelemacVersion();
+ }
+ /**
+ *
+ */
+ public void actionPerformed(ActionEvent e) {
+ String c= e.getActionCommand();
+ if (c.equals("MODIFY_TITLE")) {
+ if (entiteFille_.getSelectedComponent() == entiteFille_.getEntitePanel())
+ super.changeTitleProjet(entiteFille_.getActiveCmdMng());
+ } else if (c.equals("SIMULATION_DURATION")) {
+ if (entiteFille_.getSelectedComponent() != entiteFille_.getEntitePanel())
+ return;
+ TrTelemacDurationEditor editor=
+ new TrTelemacDurationEditor(
+ getTrTelemacParams().getTelemacParametres());
+ if (EbliSimpleDialogPanel
+ .isOkResponse(editor.afficheModale(getImpl().getFrame()))) {
+ DodicoCommandComposite cmd= new DodicoCommandComposite();
+ if (editor.isDuration()) {
+ cmd.addCmd(
+ getDicoParams().setValueAndGenerateCommand(
+ getTelemacFileFormatVersion().getDureeDuCalcul(),
+ editor.getDurationString()));
+ cmd.addCmd(
+ getDicoParams().setValueAndGenerateCommand(
+ getTelemacFileFormatVersion().getPasTemps(),
+ editor.getTimeStep()));
+ cmd.addCmd(
+ getDicoParams().removeValueAndGenerateCommand(
+ getTelemacFileFormatVersion().getNbPasTemps()));
+ } else {
+ cmd.addCmd(
+ getDicoParams().setValueAndGenerateCommand(
+ getTelemacFileFormatVersion().getNbPasTemps(),
+ editor.getNbTimeStep()));
+ cmd.addCmd(
+ getDicoParams().setValueAndGenerateCommand(
+ getTelemacFileFormatVersion().getPasTemps(),
+ editor.getTimeStep()));
+ cmd.addCmd(
+ getDicoParams().removeValueAndGenerateCommand(
+ getTelemacFileFormatVersion().getDureeDuCalcul()));
+ }
+ if (!cmd.isEmpty())
+ entiteFille_.getActiveCmdMng().addCmd(cmd);
+ }
+ }
+ }
+
}
|