|
From: <de...@us...> - 2003-08-22 23:17:09
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr
In directory sc8-pr-cvs1:/tmp/cvs-serv7810/tr
Modified Files:
TrExport.java TrFileFormatManager.java TrImplHelper.java
TrImplementation.java TrProjet.java
Added Files:
TrFilleVisu.java TrLoaderThread.java TrParametres.java
Log Message:
tr: ajout de l'export pour le maillage
gestion affichage maillage
commun modif mineure
--- NEW FILE: TrFilleVisu.java ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TrLoaderThread.java ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TrParametres.java ---
(This appears to be a binary file; contents omitted.)
Index: TrExport.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrExport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TrExport.java 19 Aug 2003 07:48:40 -0000 1.1
--- TrExport.java 22 Aug 2003 16:02:23 -0000 1.2
***************
*** 9,15 ****
--- 9,41 ----
package org.fudaa.fudaa.tr;
+ import java.io.File;
+ import java.lang.reflect.Method;
+
+ import javax.swing.ButtonGroup;
+ import javax.swing.JFileChooser;
+ import javax.swing.JPanel;
+ import javax.swing.JRadioButton;
+ import javax.swing.JTextField;
+
+ import com.memoire.bu.BuGridLayout;
+ import com.memoire.bu.BuRadioButton;
+ import com.memoire.bu.BuTaskOperation;
+ import com.memoire.bu.BuVerticalLayout;
+
+ import org.fudaa.dodico.commun.DodicoLib;
+ import org.fudaa.dodico.commun.ProgressionBuAdapter;
+ import org.fudaa.dodico.commun.ProgressionInterface;
+ import org.fudaa.dodico.dunes.io.DunesFileFormat;
+ import org.fudaa.dodico.h2d.H2dFileFormatMaillageVersion;
+ import org.fudaa.dodico.h2d.H2dMaillage;
import org.fudaa.dodico.h2d.H2dParametres;
+ import org.fudaa.dodico.h2d.type.H2dElementType;
+ import org.fudaa.dodico.reflux.io.CorEleBthFileFormat;
+ import org.fudaa.dodico.telemac.io.SerafinFileFormat;
+
+ import org.fudaa.ebli.dialog.EbliSimpleDialogPanel;
import org.fudaa.fudaa.commun.FudaaLib;
+ import org.fudaa.fudaa.commun.fileChooser.FudaaFileChooser;
/**
***************
*** 18,36 ****
* @version $Id$
*/
! public class TrExport {
! public static String EXPORT_PREF="EXPORT";
! H2dParametres params_;
/**
*
*/
! public TrExport(H2dParametres _p) {
! params_=_p;
}
!
!
! public void export(String _s){
! String f=_s.substring(EXPORT_PREF.length());
! if(FudaaLib.DEBUG) System.out.println("export "+f);
}
--- 44,343 ----
* @version $Id$
*/
! public abstract class TrExport {
! public static String EXPORT_PREF= "EXPORT";
! protected TrParametres params_;
! TrImplementation ui_;
/**
*
*/
! public TrExport(TrParametres _p, TrImplementation _ui) {
! params_= _p;
! ui_= _ui;
}
!
! public TrParametres getParams() {
! return params_;
! }
!
! public TrImplementation getUI() {
! return ui_;
! }
!
! public void export(String _s) {
! String f= _s.substring(EXPORT_PREF.length());
! if (FudaaLib.DEBUG)
! System.out.println("export " + f);
!
! try {
! final Method m= getClass().getMethod("export" + f, null);
! if (m != null) {
! try {
! m.invoke(TrExport.this, null);
! } catch (Exception _ex) {
! _ex.printStackTrace();
! ui_.error(
! TrLib.geti18n("Erreur interne accès methode export")
! + DodicoLib.EMPTY_STRING
! + f);
! }
! }
! } catch (NoSuchMethodException _ex) {
! if (FudaaLib.DEBUG)
! System.out.println("Export non supporté " + f);
! ui_.error(
! TrLib.geti18n("Export non supporté") + DodicoLib.EMPTY_STRING + f);
! }
!
! }
!
! public static class ExportDialog extends EbliSimpleDialogPanel {
! JTextField file_;
!
! public ExportDialog() {
! setLayout(new BuVerticalLayout(5, true, false));
! addEmptyBorder(5);
! file_= addLabelFileChooserPanel(TrLib.geti18n("Fichier"), true);
! }
!
! public File getFileExport() {
! return new File(file_.getText());
! }
!
! /**
! * Renvoie le file chooser de fudaa.
! */
! public JFileChooser createFileChooser() {
! return new FudaaFileChooser();
! }
!
! /**
! *
! */
! public boolean valide() {
! return file_.getText().length() > 0;
! }
!
! }
!
! public static class MaillageT3T6Panel extends JPanel {
!
! ButtonGroup group_;
!
! public MaillageT3T6Panel(H2dMaillage _m) {
! setLayout(new BuGridLayout(1, 5, 5));
! H2dElementType type= _m.getEltType();
! group_= new ButtonGroup();
! System.out.println(type);
! if (type == H2dElementType.T6) {
! JRadioButton b= new BuRadioButton();
! b.setText("pas de transformation");
! b.setActionCommand("TRANSFO_NOTHING");
! group_.add(b);
! add(b);
! b.setSelected(true);
! b= new BuRadioButton();
! b.setText("T6 -> T3");
! b.setActionCommand("TRANSFO_T3");
! add(b);
! group_.add(b);
! b= new BuRadioButton();
! b.setText("T6 -> 4 T3");
! b.setActionCommand("TRANSFO_4T3");
! group_.add(b);
! add(b);
! } else if (type == H2dElementType.T3) {
! JRadioButton b= new BuRadioButton();
! b.setText("pas de transformation");
! b.setActionCommand("TRANSFO_NOTHING");
! b.setSelected(true);
! group_.add(b);
! add(b);
! b= new BuRadioButton();
! b.setText("T3 -> T6");
! b.setActionCommand("TRANSFO_T6");
! group_.add(b);
! add(b);
! }
! }
!
! public String getSelectedAction() {
! return group_.getSelection().getActionCommand();
! }
!
! public static boolean needTransfo(String _s) {
! return !"TRANSFO_NOTHING".equals(_s);
! }
! };
!
! public abstract void loadMaillage(
! ProgressionInterface _inter,
! TrThreadListener _l);
!
! public void transformAndWriteMaillage(final H2dFileFormatMaillageVersion _ftMaillage) {
! H2dMaillage m= params_.getMaillage();
! if (m == null) {
! final TrThreadListener th= new TrThreadListener() {
! public void threadIsFinish() {
! transformAndWriteMaillageExe(_ftMaillage);
! }
! };
! new BuTaskOperation(ui_, TrLib.geti18n("Chargement maillage")) {
! public void act() {
! loadMaillage(new ProgressionBuAdapter(this), th);
! }
! }
! .start();
! } else
! transformAndWriteMaillageExe(_ftMaillage);
!
! }
!
! public void transformAndWriteMaillageExe(H2dFileFormatMaillageVersion _ftMaillage) {
! H2dMaillage m= params_.getMaillage();
! if (m == null)
! return;
! ExportDialog dialog= new ExportDialog();
! MaillageT3T6Panel pn= new MaillageT3T6Panel(m);
! dialog.add(pn);
! if (dialog
! .isOkResponse(
! dialog.afficheModale(
! ui_.getFrame(),
! "Export" + " " + _ftMaillage.getName()))) {
! TransformAndWriteMaillageOp op=
! new TransformAndWriteMaillageOp(_ftMaillage);
! op.setFile(dialog.getFileExport());
! op.setTransfo(pn.getSelectedAction());
! op.start();
! }
!
! }
!
! private class TransformAndWriteMaillageOp extends BuTaskOperation {
! H2dFileFormatMaillageVersion formatName_;
! String transfo_;
! File f_;
! TransformAndWriteMaillageOp(H2dFileFormatMaillageVersion _formatName) {
! super(ui_, _formatName.getName());
! formatName_= _formatName;
! }
!
! public void setTransfo(String _transfo) {
! transfo_= _transfo;
! }
!
! public void setFile(File _f) {
! f_= _f;
! }
!
! public String getFormatName() {
! return formatName_.getName();
! }
!
! public void act() {
! if (f_ == null) {
! System.out.println("fichier de dest nul");
! return;
! }
! ProgressionInterface prog= new ProgressionBuAdapter(this);
! H2dMaillage maillage= params_.getMaillage();
! if (MaillageT3T6Panel.needTransfo(transfo_)) {
!
! if ("TRANSFO_T6".equals(transfo_)) {
! ui_.getMainPanel().setMessage("Transformation maillage en T6");
! maillage= maillage.maillageT3enT6(prog, null);
! } else if ("TRANSFO_T3".equals(transfo_)) {
! ui_.getMainPanel().setMessage("Transformation maillage en T3");
! maillage= maillage.maillageT6enT3(prog, null);
! } else if ("TRANSFO_4T3".equals(transfo_)) {
! ui_.getMainPanel().setMessage("Transformation maillage en T3 (4)");
! maillage= maillage.maillageT6en4T3(prog);
! } else {
! ui_.error("Transformation inconnue");
! }
! }
! ui_.getMainPanel().setMessage("Ecriture fichier");
! ui_.getMainPanel().setMessage("");
! ui_.getMainPanel().setProgression(50);
! File[] f= formatName_.getFileFormat().getFile(f_);
! int n= f.length;
! StringBuffer b= new StringBuffer(150);
! for (int i= 0; i < n; i++) {
! if (f[i].exists()) {
! if (b.length() > 0)
! b.append(DodicoLib.LINE_SEP);
! b.append(f[i].getAbsolutePath());
! }
! }
! if (b.length() > 0) {
! if (!ui_
! .confirmation(
! TrLib.geti18n("Ecraser les fichiers"),
! TrLib.geti18n("Les fichiers suivants vont être effacés")
! + ":"
! + DodicoLib.LINE_SEP
! + b.toString()
! + DodicoLib.LINE_SEP
! + TrLib.geti18n("Voulez-vous continuer ?")))
! return;
!
! }
! boolean fatal=
! ui_.manageErrorOperationAndIsFatal(
! formatName_.writeMaillage(f_, maillage, prog));
! ui_.getMainPanel().setProgression(0);
! if (fatal) {
! ui_.error(
! TrLib.geti18n("Ecriture") + " " + formatName_.getName(),
! TrLib.geti18n("Erreur lors de l'ecriture du fichier")
! + " "
! + f_.getAbsolutePath());
! }
! }
! }
!
! public void exportMaillage(TransformAndWriteMaillageOp _maillage) {
! H2dMaillage m= params_.getMaillage();
!
! if (m == null) {
! new TrLoaderThread(getUI(), "chargement maillage") {
! public void load(ProgressionInterface _inter) {
! params_.loadGeometrie(_inter);
! }
! }
! .launchLoad();
! m= params_.getMaillage();
! if (m == null)
! return;
! }
! ExportDialog dialog= new ExportDialog();
! MaillageT3T6Panel pn= new MaillageT3T6Panel(m);
! dialog.add(pn);
! if (dialog
! .isOkResponse(
! dialog.afficheModale(
! ui_.getFrame(),
! "Export" + " " + _maillage.getFormatName()))) {
! _maillage.setTransfo(pn.getSelectedAction());
! _maillage.setFile(dialog.getFileExport());
! _maillage.start();
! }
! }
!
! public void exportCORELEBTH() {
! transformAndWriteMaillage(
! CorEleBthFileFormat.getInstance().getLastVersionImpl());
!
! }
!
! public void exportDUNES() {
! transformAndWriteMaillage(
! DunesFileFormat.getInstance().getLastVersionImpl());
! }
!
! public void exportSERAFIN() {
! transformAndWriteMaillage(
! SerafinFileFormat.getInstance().getLastVersionImpl());
}
Index: TrFileFormatManager.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrFileFormatManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TrFileFormatManager.java 19 Aug 2003 07:48:40 -0000 1.2
--- TrFileFormatManager.java 22 Aug 2003 16:02:23 -0000 1.3
***************
*** 38,42 ****
* @version $Id$
*/
! public class TrFileFormatManager{
private FileFormat[] formats_;
--- 38,42 ----
* @version $Id$
*/
! public class TrFileFormatManager {
private FileFormat[] formats_;
***************
*** 108,112 ****
* {@link org.fudaa.dodico.h2d.type.H2dFileFormatType H2dFileFormatType}.
*/
! public void buildExportMenu(BuMenu _m,TrImplementation _impl) {
List l= H2dFileFormatType.LIST;
int n= l.size();
--- 108,112 ----
* {@link org.fudaa.dodico.h2d.type.H2dFileFormatType H2dFileFormatType}.
*/
! public void buildExportMenu(BuMenu _m, TrImplementation _impl) {
List l= H2dFileFormatType.LIST;
int n= l.size();
***************
*** 116,119 ****
--- 116,120 ----
FileFormat[] fts= getFormatWithType(ft.getId());
BuMenu me= new BuMenu(ft.getNom(), ft.getNom());
+
//pour trier ( pas super intelligent ....)
TreeMap map= new TreeMap();
***************
*** 125,132 ****
me.addMenuItem(id, TrExport.EXPORT_PREF + (String)map.get(id), _impl);
}
! _m.addSubMenu(me, true);
}
}
-
}
--- 126,133 ----
me.addMenuItem(id, TrExport.EXPORT_PREF + (String)map.get(id), _impl);
}
! //TODO : a ameliorer
! _m.addSubMenu(me, ft == H2dFileFormatType.MAILLAGE);
}
}
}
Index: TrImplHelper.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrImplHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TrImplHelper.java 19 Aug 2003 07:48:40 -0000 1.4
--- TrImplHelper.java 22 Aug 2003 16:02:23 -0000 1.5
***************
*** 30,36 ****
public TrImplHelper(TrImplementation _impl) {
impl_= _impl;
! impl_.getFrame().setTitle("Superviseur " + getID());
impl_.getFrame().setIconImage(
! FudaaResource.FUDAA.getIcon("appli/" + getID()).getImage());
}
--- 30,36 ----
public TrImplHelper(TrImplementation _impl) {
impl_= _impl;
! impl_.getFrame().setTitle("Superviseur " + getSoftwareID());
impl_.getFrame().setIconImage(
! FudaaResource.FUDAA.getIcon("appli/" + getSoftwareID()).getImage());
}
***************
*** 44,51 ****
public BuIcon getIcon() {
! return FudaaResource.FUDAA.getToolIcon("appli/" + getID());
}
! public abstract String getID();
public BuMenuItem[] getMenuItemsOuvrir() {
--- 44,51 ----
public BuIcon getIcon() {
! return FudaaResource.FUDAA.getToolIcon("appli/" + getSoftwareID());
}
! public abstract String getSoftwareID();
public BuMenuItem[] getMenuItemsOuvrir() {
***************
*** 61,65 ****
TrImplementation _impl) {
if (_impl.getCurrentImplHelper() != null) {
! if (_id.equals(_impl.getCurrentImplHelper().getID())) {
return _impl.getCurrentImplHelper();
}
--- 61,65 ----
TrImplementation _impl) {
if (_impl.getCurrentImplHelper() != null) {
! if (_id.equals(_impl.getCurrentImplHelper().getSoftwareID())) {
return _impl.getCurrentImplHelper();
}
Index: TrImplementation.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrImplementation.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TrImplementation.java 19 Aug 2003 07:48:40 -0000 1.4
--- TrImplementation.java 22 Aug 2003 16:02:23 -0000 1.5
***************
*** 19,22 ****
--- 19,23 ----
import javax.swing.JMenu;
+ import javax.swing.JScrollPane;
import com.memoire.bu.BuColumn;
***************
*** 38,43 ****
--- 39,46 ----
import org.fudaa.dodico.fichiers.FileFormatSoftware;
+ import org.fudaa.dodico.telemac.io.TelemacDicoFileFormat;
import org.fudaa.ebli.calque.BArbreCalque;
+ import org.fudaa.ebli.ressource.EbliResource;
import org.fudaa.fudaa.commun.FudaaCommonImplementation;
***************
*** 109,113 ****
String id= dialc.getValue();
! if (!id.equals(getCurrentImplHelper().getID())) {
if (FudaaLib.DEBUG)
System.out.println("choix " + id);
--- 112,116 ----
String id= dialc.getValue();
! if (!id.equals(getCurrentImplHelper().getSoftwareID())) {
if (FudaaLib.DEBUG)
System.out.println("choix " + id);
***************
*** 126,130 ****
protected void ouvrirId(String _id) {
! if (_id.equals(FileFormatSoftware.TELEMAC_IS.name)) {
TrTelemacImplHelper h=
(TrTelemacImplHelper)TrImplHelper.getImplHelper(
--- 129,134 ----
protected void ouvrirId(String _id) {
! if (_id
! .equals(TelemacDicoFileFormat.DICO_PROJET_ID)) {
TrTelemacImplHelper h=
(TrTelemacImplHelper)TrImplHelper.getImplHelper(
***************
*** 134,138 ****
error("Erreur interne", "impossible de trouver l'implantation telemac");
h.ouvrirDico();
-
} else {
TrImplHelper h= TrImplHelper.getImplHelper(_id, this);
--- 138,141 ----
***************
*** 152,162 ****
}
! protected void ouvrir(File _f, String _id) {
! TrImplHelper h= TrImplHelper.getImplHelper(_id, this);
! if (h == null)
! error("Erreur interne", "impossible de trouver l'implantation");
! else
! h.ouvrir(_f);
! }
public void actionPerformed(ActionEvent _evt) {
--- 155,165 ----
}
! // protected void ouvrir(File _f, String _id) {
! // TrImplHelper h= TrImplHelper.getImplHelper(_id, this);
! // if (h == null)
! // error("Erreur interne", "impossible de trouver l'implantation");
! // else
! // h.ouvrir(_f);
! // }
public void actionPerformed(ActionEvent _evt) {
***************
*** 183,189 ****
} else if ("MODIFIER_CHAINE".equals(action)) {
changeChaineCalcul();
! } else if (action.startsWith(TrExport.EXPORT_PREF)){
projetCourant().export(action);
!
} else {
super.actionPerformed(_evt);
--- 186,192 ----
} else if ("MODIFIER_CHAINE".equals(action)) {
changeChaineCalcul();
! } else if (action.startsWith(TrExport.EXPORT_PREF)) {
projetCourant().export(action);
!
} else {
super.actionPerformed(_evt);
***************
*** 273,277 ****
setEnabledForAction("CREER", false);
setEnabledForAction("OUVRIR", true);
! setEnabledForAction("EXPORTER", true);
setEnabledForAction("QUITTER", true);
setEnabledForAction("PREFERENCE", true);
--- 276,280 ----
setEnabledForAction("CREER", false);
setEnabledForAction("OUVRIR", true);
! setEnabledForAction("EXPORTER", false);
setEnabledForAction("QUITTER", true);
setEnabledForAction("PREFERENCE", true);
***************
*** 302,305 ****
--- 305,309 ----
setEnabledForAction("ENREGISTRERCOPIE", false);
setEnabledForAction("FERMER", false);
+ setEnabledForAction("EXPORTER", false);
}
***************
*** 314,317 ****
--- 318,322 ----
setEnabledForAction("ENREGISTRERCOPIE", true);
setEnabledForAction("FERMER", true);
+ setEnabledForAction("EXPORTER", true);
}
***************
*** 444,447 ****
--- 449,469 ----
}
+ public BArbreCalque getArbreCalque() {
+ if (arbre_ != null)
+ return arbre_;
+ arbre_= new BArbreCalque();
+ arbre_.setRootVisible(false);
+ arbre_.setModel(null);
+ JScrollPane sp= new JScrollPane(arbre_);
+ sp.setSize(150, 150);
+ sp.setVisible(false);
+ getMainPanel().getRightColumn().addToggledComponent(
+ EbliResource.EBLI.getString("Calques"),
+ "CALQUE",
+ sp,
+ this);
+ return arbre_;
+ }
+
/**
*
***************
*** 456,460 ****
private void buildExporterMenu() {
fileFormatMng_.buildExportMenu(
! (BuMenu)getMainMenuBar().getMenu("EXPORTER"),this);
}
--- 478,483 ----
private void buildExporterMenu() {
fileFormatMng_.buildExportMenu(
! (BuMenu)getMainMenuBar().getMenu("EXPORTER"),
! this);
}
***************
*** 467,471 ****
System.out.println(((BuMenu)e.getSource()).getActionCommand());
BuMenu menu= (BuMenu)e.getSource();
! if(menu.getMenuComponentCount()!=0) return;
if (menu.getActionCommand().equals("EXPORTER")) {
buildExporterMenu();
--- 490,495 ----
System.out.println(((BuMenu)e.getSource()).getActionCommand());
BuMenu menu= (BuMenu)e.getSource();
! if (menu.getMenuComponentCount() != 0)
! return;
if (menu.getActionCommand().equals("EXPORTER")) {
buildExporterMenu();
Index: TrProjet.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/TrProjet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TrProjet.java 19 Aug 2003 07:48:40 -0000 1.4
--- TrProjet.java 22 Aug 2003 16:02:23 -0000 1.5
***************
*** 24,28 ****
- public String getID();
public BuInformationsDocument getInformationsDocument();
--- 24,27 ----
|