From: <had...@us...> - 2009-01-29 18:53:33
|
Revision: 4425 http://fudaa.svn.sourceforge.net/fudaa/?rev=4425&view=rev Author: hadouxad Date: 2009-01-29 18:53:28 +0000 (Thu, 29 Jan 2009) Log Message: ----------- plein d'am?\195?\169liorations/corrections lot 3 + stabilisation appli Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.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/TrPostProjetsManagerFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostSourcePersist.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -47,6 +47,7 @@ { private boolean left_; + public BuMenu() { this("Menu","MENU",true,0); } Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -13,23 +13,57 @@ import java.awt.Graphics; import java.awt.Point; +import java.awt.event.ActionListener; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; import javax.swing.Action; import javax.swing.Icon; import javax.swing.JMenuItem; +import org.fudaa.ctulu.CtuluLibGenerator; + /** * Like JMenuItem but with better management of icons. */ public class BuMenuItem extends JMenuItem { + + + private String id_; + + public BuMenuItem() { this("",(BuIcon)null); } + public BuMenuItem(BuMenuItem clone) + { + if(clone.getIcon()!=null) + this.setIcon(clone.getIcon()); + if(clone.getText()!=null) + this.setText(clone.getText()); + if(clone.getActionCommand()!=null) + this.setActionCommand(clone.getActionCommand()); + + if(clone.getActionListeners()!=null) + for(int i=0;i<clone.getActionListeners().length;i++) + this.addActionListener(clone.getActionListeners()[i]); + if(clone.getAccelerator()!=null) + this.setAccelerator(clone.getAccelerator()); + + if(clone.id_!=null) + this.id_=clone.id_; + else { + String gene= CtuluLibGenerator.getInstance().deliverUniqueStringId(); + this.id_=gene; + clone.id_=gene; + } + } + public BuMenuItem(BuIcon _icon) { this("",_icon); @@ -95,7 +129,48 @@ super.paint(_g); } - public Point getToolTipLocation(MouseEvent _evt) + +public boolean equals(Object obj) { + if(obj instanceof BuMenuItem){} + else return false; + if(obj==this) + return true; + + + BuMenuItem clone=(BuMenuItem)obj; + if(clone.id_==null || this.id_==null) + return false; + if(!clone.id_.equals(this.id_)) + return false; +// +// if(clone.getText()!=null && this.getText()!=null ) +// if(! this.getText().equals(clone.getText())) +// return false; +// +// if(clone.getActionCommand()!=null && this.getActionCommand()!=null ) +// if(!clone.getActionCommand().equals(this.getActionCommand())) +// return false; +// List<ActionListener> liste=new ArrayList<ActionListener>(); +// if(clone.getActionListeners()!=null) +// for(int i=0;i<clone.getActionListeners().length;i++) +// liste.add(clone.getActionListeners()[i]); +// if(clone.getActionListeners()!=null){ +// for(int i=0;i<this.getActionListeners().length;i++) +// if(!liste.contains(this.getActionListeners()[i])) +// return false; +// +// }else if (liste.size()>0) +// return false; +// + + + + + + return true; +} + +public Point getToolTipLocation(MouseEvent _evt) { Point r=super.getToolTipLocation(_evt); if(r==null) r=new Point(getWidth(),0); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -28,6 +28,7 @@ private static final long serialVersionUID = -2080709568281587469L; private List<String> listeKey_; + private List<String> listeValue_; private final List<String> colonnes_; /** * Les infos de la table. @@ -46,6 +47,11 @@ infos_=map; comparator_=comparator; colonnes_=colonnes; + + listeValue_=new ArrayList<String>(); + for(String key:liste) + listeValue_.add(map.get(key)); + } @@ -83,11 +89,17 @@ if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ //-- ajout --// - if(column==1) - infos_.put("Note "+(infos_.keySet().size()+1),(String)value); - else + if(column==1){ + String newKey="Note "+(infos_.keySet().size()+1); + infos_.put(newKey,(String)value); + listeKey_.add(newKey); + listeValue_.add((String)value); + } + else{ infos_.put((String)value,""); - + listeKey_.add((String)value); + listeValue_.add(""); + } fireTableDataChanged(); }else{ @@ -96,8 +108,10 @@ String res=infos_.get(getKey(row)); infos_.remove(getKey(row)); infos_.put((String)value, res); + listeKey_.set(row, (String)value); }else{ infos_.put(getKey(row),(String)value); + listeValue_.set(row,(String)value); } fireTableDataChanged(); } @@ -114,17 +128,17 @@ public void fireTableDataChanged() { //-- on modif le tableau --// - listeKey_=new ArrayList<String>(infos_.keySet()); - //-- on ordonne la liste - if(comparator_==null) - Collections.sort(listeKey_); - else - Collections.sort(listeKey_,comparator_); +// listeKey_=new ArrayList<String>(infos_.keySet()); +// //-- on ordonne la liste +// if(comparator_==null) +// Collections.sort(listeKey_); +// else +// Collections.sort(listeKey_,comparator_); super.fireTableDataChanged(); } public String getValue(int row){ - return infos_.get(getKey(row)); + return listeValue_.get(row); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -58,6 +58,13 @@ public static final Font DEFAULT_FONT = new Font("SansSerif", Font.PLAIN, 10); + + /** + * Liste qui contient les parametres d'origines des titres, + * doit etre relanc\xE9 dans le cas ou l'on ajoute de nouveau une legende. + */ + HashMap<EGCourbe,String> listeTitlesOrigins_=new HashMap<EGCourbe,String>(); + private static void zoomIn(final EGAxe _axe, final double _sCenter, final double _zoomFactor) { final double newEcart = _axe.getEcart() * _zoomFactor / 2; final double newMax = _sCenter + newEcart; @@ -104,6 +111,8 @@ cmd_ = new CtuluCommandManager(); repereController_ = new RepereMouseKeyController(this); setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); + + initTitlesOrigins(); } private void ajusteXAxe() { @@ -857,6 +866,22 @@ zoom(true); } + + + + public void initTitlesOrigins( ){ + EGCourbe[] listeCourbes=getModel().getCourbes(); + for(int i=0;i<listeCourbes.length;i++) + listeTitlesOrigins_.put(listeCourbes[i], listeCourbes[i].getTitle()); + + } + public void reinitTitlesOrigins( ){ + EGCourbe[] listeCourbes=getModel().getCourbes(); + for(int i=0;i<listeCourbes.length;i++) + if(listeTitlesOrigins_.get(listeCourbes[i])!=null) + listeCourbes[i].setTitle(listeTitlesOrigins_.get(listeCourbes[i])); + + } public EGGraphe duplicate() { EGGrapheDuplicator duplicator = new EGGrapheDuplicator(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -381,7 +381,8 @@ * Reinitialise les titres des courbes avec les donn\xE9es initiales. */ private void reinitPlages() { - + graphe_.reinitTitlesOrigins(); + list_.revalidate(); } /** Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -82,11 +82,7 @@ EbliActionEditorOneClick<BuPanel> editorAction_; - /** - * Liste qui contient les parametres d'origines des titres, - * doit etre relanc\xE9 dans le cas ou l'on ajoute de nouveau une legende. - */ - HashMap<EGCourbe,String> listeTitlesOrigins_=new HashMap<EGCourbe,String>(); + public EbliWidgetControllerGraphe(final EbliWidgetGraphe widget_, final EbliNodeDefault nodeLegende) { super(widget_); @@ -100,7 +96,7 @@ setProportional(true); - initTitlesOrigins(widgetGraphe_.panelGraphe_.getGraphe().getModel()); + @@ -332,25 +328,9 @@ }); } - /** - * Initialise les titres d origines du graphe. - * @param model - */ - public void initTitlesOrigins(EGGrapheModel model){ - EGCourbe[] listeCourbes=model.getCourbes(); - for(int i=0;i<listeCourbes.length;i++) - listeTitlesOrigins_.put(listeCourbes[i], listeCourbes[i].getTitle()); - - } - public void reinitTitlesOrigins(EGGrapheModel model){ - EGCourbe[] listeCourbes=model.getCourbes(); - for(int i=0;i<listeCourbes.length;i++) - if(listeTitlesOrigins_.get(listeCourbes[i])!=null) - listeCourbes[i].setTitle(listeTitlesOrigins_.get(listeCourbes[i])); - - } + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { @@ -368,7 +348,7 @@ widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); } - // -- non de la legende --// + // -- nom de la legende --// widgetGraphe_.getNodeLegende().setTitle("L\xE9gende " + (indiceLegende++)); final EbliWidgetCreatorLegende creator = new EbliWidgetCreatorLegende(((EbliWidgetGraphe) widget_).getGraphe(), @@ -384,7 +364,7 @@ //-- reinitialisation des titres de la legendes --// - reinitTitlesOrigins(widgetGraphe_.panelGraphe_.getGraphe().getModel()); + widgetGraphe_.panelGraphe_.getGraphe().reinitTitlesOrigins(); } else if (widgetGraphe_.getNodeLegende().hasWidget()) { // -- cas ou la legende est masquee --// widgetGraphe_.getNodeLegende().getWidget().setVisible(true); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -2,6 +2,8 @@ import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -13,6 +15,8 @@ import javax.swing.AbstractAction; import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.ButtonGroup; import javax.swing.DefaultListModel; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -31,6 +35,7 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.fileformat.FileFormat; import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; @@ -50,17 +55,27 @@ import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.tr.common.TrResource; +import org.jdesktop.swingx.UIAction; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuBorders; import com.memoire.bu.BuButton; import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuList; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuRadioButton; import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; +import com.memoire.bu.BuToggleButton; import com.memoire.bu.BuValueValidator; import com.memoire.bu.BuWizardDialog; import com.memoire.bu.BuWizardTask; +import com.memoire.fu.FuComparator; /** * Wizard qui se charge d'importer des courbes au format scope dans le post. @@ -85,71 +100,80 @@ File fileChoosen_=null; protected ScopeStructure data_; EGGraphe result_; - + //choix du fichier JPanel panelFichier_; BuTextField filePath_; - + //choix parametres s t ou gene JPanel panelParametres_; - + //choix donnees S et T BuTextField plageDeb_=new BuTextField(5); BuTextField plageFin_=new BuTextField(5); double xMin; - double xMax; + double xMax; JList listVariablesST_; - - + + public static class ImportAction extends EbliActionSimple { - final FudaaCommonImplementation ui_; - FudaaCourbeImporter.Target target_; - public ImportAction(final FudaaCommonImplementation _ui,FudaaCourbeImporter.Target target) { - super(BuResource.BU.getString("Importer au format scope"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); - ui_ = _ui; - target_=target; - } - public void actionPerformed(final ActionEvent _e) { - FudaaCourbeWizardImportScope wizard=new FudaaCourbeWizardImportScope(ui_,target_); - BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); - // --affichage du wizard --// - DialogWizard.setSize(600, 500); - DialogWizard.setLocationRelativeTo(ui_.getFrame()); - DialogWizard.setVisible(true); - } + final FudaaCommonImplementation ui_; + FudaaCourbeImporter.Target target_; + public ImportAction(final FudaaCommonImplementation _ui,FudaaCourbeImporter.Target target) { + super(BuResource.BU.getString("Importer au format scope"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); + ui_ = _ui; + target_=target; + } + public void actionPerformed(final ActionEvent _e) { + FudaaCourbeWizardImportScope wizard=new FudaaCourbeWizardImportScope(ui_,target_); + BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); + // --affichage du wizard --// + DialogWizard.setSize(600, 500); + DialogWizard.setLocationRelativeTo(ui_.getFrame()); + DialogWizard.setVisible(true); + } } - + /** * Boolean qui implique si on rejoue et dans ce cas si on ecrase les datas. */ boolean replayData_=false; - + public FudaaCourbeWizardImportScope(FudaaCommonImplementation impl,FudaaCourbeImporter.Target target) { this(impl,target,false,null); - - + + } - + public FudaaCourbeWizardImportScope(FudaaCommonImplementation impl,FudaaCourbeImporter.Target target,boolean replayData,File fileToReload) { super(); target_=target; impl_=impl; replayData_=replayData; fileChoosen_=fileToReload; - + //-- on avance \xE0 l'\xE9tape 2 directement --// if(replayData_ && fileChoosen_!=null){ panelFichier_=buildFilePanel(); this.filePath_.setText(""+fileChoosen_.getAbsolutePath()); typeFormat_=devineTypeWithExtension(fileChoosen_.getName()); - computeData(impl.getMainProgression()); - current_=1; + if(typeFormat_==-1) + typeFormat_=selectType("Choix du format", impl.getFrame()); + try{ + computeData(impl.getMainProgression()); + current_=1; + }catch(Exception e){ + impl_.error("Impossible de charger le fichier avec l'algorithme "+getType(typeFormat_)+".\n Le format n'est pas compatible. Veuillez essayer avec une autre extension."); + } + + + } - + } - + public int devineTypeWithExtension(String name){ - + for(int i=0;i<ScopeSFileFormat.getInstance().getExtensions().length;i++) if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i]) || name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) return 0; @@ -157,39 +181,39 @@ if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) return 1; for(int i=0;i<ScopeGENEFileFormat.getInstance().getExtensions().length;i++){ - String ext=ScopeGENEFileFormat.getInstance().getExtensions()[i]; + String ext=ScopeGENEFileFormat.getInstance().getExtensions()[i]; if(name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i].toLowerCase())) return 2; } - return -1; - - + return -1; + + } - - + + @Override public JComponent getStepComponent() { - switch (current_) { - case 0: { + switch (current_) { + case 0: { - if(panelFichier_==null) - panelFichier_=buildFilePanel(); - return panelFichier_; - } - case 1: { - - if(data_==null){ - return new JLabel(TrResource.getS("Erreur. Veuillez choisir un fichier valide")); - } - -// if(panelParametres_==null) -// panelParametres_=buildPanelParametresImportation(); - return buildPanelParametresImportation(); - } - - } + if(panelFichier_==null) + panelFichier_=buildFilePanel(); + return panelFichier_; + } + case 1: { - return null; + if(data_==null){ + return new JLabel(TrResource.getS("Erreur. Veuillez choisir un fichier valide")); + } + + // if(panelParametres_==null) + // panelParametres_=buildPanelParametresImportation(); + return buildPanelParametresImportation(); + } + + } + + return null; } @Override @@ -201,47 +225,54 @@ public String getStepText() { String r = null; - switch (current_) { - case 0: - - break; - case 1: - - break; - - } - return r; + switch (current_) { + case 0: + + break; + case 1: + + break; + + } + return r; } ScopeStructure.SorT dataST(){ return (ScopeStructure.SorT)data_; } - + ScopeStructure.Gene dataG(){ return (ScopeStructure.Gene)data_; } - + @Override public String getStepTitle() { - String r = null; + String r = null; - switch (current_) { - case 0: - r = TrResource.getS("Choisir le fichier"); - break; - case 1: - r = TrResource.getS("Param\xE8tres de cr\xE9ation"); - break; - - } - return r; + switch (current_) { + case 0: + r = TrResource.getS("Choisir le fichier"); + break; + case 1: + r = TrResource.getS("Param\xE8tres de cr\xE9ation"); + break; + + } + return r; } + BuRadioButton typeScopeS=new BuRadioButton("Scop S"); + BuRadioButton typeScopeT=new BuRadioButton("Scop T"); + BuRadioButton typeScopeGENE=new BuRadioButton("Scop GENE"); + int typeRadioChoisi_=-1; /** * construit le panel de selection du fichier * @return */ JPanel buildFilePanel(){ + + BuPanel conteneur=new BuPanel(new BorderLayout()); + final JLabel labelAlerte=new JLabel(""); JPanel content=new JPanel(new FlowLayout(FlowLayout.CENTER)); content.add(new JLabel(TrResource.getS("Choisir le fichier:"))); filePath_=new BuTextField(20); @@ -250,78 +281,184 @@ BuButton parcourir =new BuButton(TrResource.getS("Parcourir...")); parcourir.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { - final FileFormat[] ft = getFileFormatForImport(); - Arrays.sort(ft); - final BuFileFilter[] filters = FileFormat.createFilters(ft); - final CtuluFileChooser fileChooser = FudaaGuiLib.getFileChooser(BuResource.BU.getString("Importer"), filters, - null); - fileChooser.setAcceptAllFileFilterUsed(false); - for (int i = filters.length - 1; i >= 0; i--) { - if (ft[i].getID() == EvolutionFileFormat.getInstance().getID()) { - fileChooser.setFileFilter(filters[i]); - break; - } - } - final File initFile = FudaaGuiLib.chooseFile(CtuluLibSwing.getFrameAncestor(impl_.getParentComponent()), true,fileChooser); - if (initFile == null) { - return; - } - filePath_.setText(initFile.getAbsolutePath()); - - final FileFilter filter = fileChooser.getFileFilter(); - final int i = CtuluLibArray.getIndex(filter, filters); - if (i < 0) { - return; - } - typeFormat_=i; - fileChoosen_=initFile; - importData(); - - - + final FileFormat[] ft = getFileFormatForImport(); + Arrays.sort(ft); + final BuFileFilter[] filters = FileFormat.createFilters(ft); + final CtuluFileChooser fileChooser = FudaaGuiLib.getFileChooser(BuResource.BU.getString("Importer"), filters, + null); + fileChooser.setAcceptAllFileFilterUsed(true); + for (int i = filters.length - 1; i >= 0; i--) { + if (ft[i].getID() == EvolutionFileFormat.getInstance().getID()) { + fileChooser.setFileFilter(filters[i]); + break; + } + } + final File initFile = FudaaGuiLib.chooseFile(CtuluLibSwing.getFrameAncestor(impl_.getParentComponent()), true,fileChooser); + if (initFile == null) { + return; + } + filePath_.setText(initFile.getAbsolutePath()); + + final FileFilter filter = fileChooser.getFileFilter(); + final int i = CtuluLibArray.getIndex(filter, filters); + // if (i < 0) { + // return; + // } + typeFormat_=i; + + //-- si -1, c'est qu'on a choisi le filtre all, il faut alors le determiner --// + typeFormat_=devineTypeWithExtension(initFile.getName()); + + //-- si le format vaut toujours -1, il faut pr\xE9ciser avec le bouton radio --// + if(typeFormat_==-1){ + + if(typeRadioChoisi_>-1){ + if(impl_.question("format non reconnu", "Le format n'est pas reconnu, le fichier sera charg\xE9 avec l'algorithme "+getType(typeRadioChoisi_)+".\n continuer ?")) + typeFormat_=typeRadioChoisi_; + else + typeFormat_=selectType("Selection du type de format",impl_.getFrame()); + + } + else{ + labelAlerte.setText(FudaaResource.FUDAA.getString("Attention, format non reconnu, pr\xE9cisez \xE0 l'aide des boutons radio")); + typeFormat_=selectType("Selection du type de format",impl_.getFrame()); + } + } + //-- on met a jour el bon bouton radio --// + switch(typeFormat_){ + case 0:typeScopeS.setSelected(true);break; + case 1:typeScopeT.setSelected(true);break; + case 2:typeScopeGENE.setSelected(true);break; + + + } + + fileChoosen_=initFile; + try{ + importData(); + }catch(Exception e){ + impl_.error("Impossible de charger le fichier avec l'algorithme "+getType(typeFormat_)+".\n Le format n'est pas compatible. Veuillez essayer avec une autre extension."); + } + + } - + }); content.add(parcourir); - return content; + + conteneur.add(content,BorderLayout.NORTH); + + //Box boutonsPanel=Box.createVerticalBox(); + BuPanel boutonsPanel=new BuPanel(new GridLayout(10,1)); + int hgap=150,vgap=20; + BuPanel boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(labelAlerte); + boutonsPanel.add(boutons); + boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(typeScopeS); + boutonsPanel.add(boutons); + boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(typeScopeT); + boutonsPanel.add(boutons); + boutons=new BuPanel(new FlowLayout(FlowLayout.LEFT,hgap,vgap)); + boutons.add(typeScopeGENE); + boutonsPanel.add(boutons); + //boutonsPanel.add(Box.createVerticalGlue()); + + boutonsPanel.setPreferredSize(new Dimension(300,200)); + + + + typeScopeS.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + typeRadioChoisi_=0; + labelAlerte.setText("Scope S choisi"); + // if(fileChoosen_!=null) + // importData(); + }}); + typeScopeT.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + typeRadioChoisi_=1; + labelAlerte.setText("Scope T choisi"); + // if(fileChoosen_!=null) + // importData(); + }}); + typeScopeGENE.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + typeRadioChoisi_=2; + labelAlerte.setText("Scope GENE choisi"); + // if(fileChoosen_!=null) + // importData(); + }}); + ButtonGroup group=new ButtonGroup(); + group.add(typeScopeS); + group.add(typeScopeT); + group.add(typeScopeGENE); + + conteneur.add(boutonsPanel,BorderLayout.CENTER); + + return conteneur; + } + + public String getType(int i){ + switch(i){ + case 0:return "Scope S"; + case 1:return "Scope T"; + case 2:return "Scope GENE"; + default: return ""; + } + } + public static int selectType(final String _title, final Component _parent) { + + final Object[] _init=new String[]{"Scope S","Scope T","ScopeGENE"}; + final BuList l = CtuluLibSwing.createBuList(_init); + final CtuluDialogPanel pn = new CtuluDialogPanel(false); + pn.setLayout(new BuBorderLayout()); + pn.setBorder(BuBorders.EMPTY3333); + pn.add(new BuLabel(CtuluLib.getS("S\xE9lectionner le fichier r\xE9sultat")), BuBorderLayout.NORTH); + pn.add(new BuScrollPane(l)); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_parent, _title))) { return l.getSelectedIndex(); } + return -1; + } + /** * Retourne les formats de fichiers disponibles * @return */ public static FileFormat[] getFileFormatForImport() { - final ArrayList<FileFormatUnique> r = new ArrayList<FileFormatUnique>(10); - r.add(ScopeSFileFormat.getInstance()); - r.add(ScopeTFileFormat.getInstance()); - r.add(ScopeGENEFileFormat.getInstance()); - final FileFormat[] rf = new FileFormat[r.size()]; - r.toArray(rf); - return rf; - } - - + final ArrayList<FileFormatUnique> r = new ArrayList<FileFormatUnique>(10); + r.add(ScopeSFileFormat.getInstance()); + r.add(ScopeTFileFormat.getInstance()); + r.add(ScopeGENEFileFormat.getInstance()); + final FileFormat[] rf = new FileFormat[r.size()]; + r.toArray(rf); + return rf; + } + + /** * Methode iumportante d'importation des datas en fonction du fichier choisi et du type. * Remplit la structure scope */ private void importData(){ - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { - public void act() { - - computeData(getMainStateReceiver()); - - - }}.start(); - + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { + public void act() { + + computeData(getMainStateReceiver()); + + + }}.start(); + } - + /** * Methode qui realise le calcul de la structure. * @param prog */ private void computeData(ProgressionInterface prog){ - + switch(typeFormat_){ case 0: //cas s @@ -337,55 +474,55 @@ break; } } - + private ScopeStructure.SorT lectureScopeS(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeSFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); - return struct; - } + final CtuluIOOperationSynthese op = ScopeSFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); + final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); + return struct; + } private ScopeStructure.SorT lectureScopeT(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeTFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); - return struct; - } + final CtuluIOOperationSynthese op = ScopeTFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); + final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); + return struct; + } private ScopeStructure.Gene lectureScopeGENE(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.Gene struct = (ScopeStructure.Gene) op.getSource(); - return struct; - } - - + final CtuluIOOperationSynthese op = ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); + final ScopeStructure.Gene struct = (ScopeStructure.Gene) op.getSource(); + return struct; + } + + /** * Construit le panel de choix des donn\xE9es a importer pour les formats s et t * @return */ JPanel buildPanelScopeSorT(){ JPanel content=new JPanel(new BorderLayout()); - + String[] listeVar=new String[dataST().getNbVariables()-1]; - + //on ne prends pas les x for(int i=1;i<dataST().getNbVariables();i++) listeVar[i-1]=dataST().getVariable(i); - + listVariablesST_=new JList(listeVar); listVariablesST_.setSelectedIndex(0); content.add(listVariablesST_,BorderLayout.CENTER); listVariablesST_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - + plageDeb_.setCharValidator(BuCharValidator.FLOAT); plageDeb_.setStringValidator(BuStringValidator.FLOAT); plageDeb_.setValueValidator(BuValueValidator.FLOAT); plageFin_.setCharValidator(BuCharValidator.FLOAT); plageFin_.setStringValidator(BuStringValidator.FLOAT); plageFin_.setValueValidator(BuValueValidator.FLOAT); - + //-- on init les plages --// xMin=dataST().getXMin(); plageDeb_.setText(""+xMin); xMax=dataST().getXMax(); plageFin_.setText(""+xMax); - + JPanel plages=new JPanel(new FlowLayout(FlowLayout.CENTER)); plages.add(new JLabel(TrResource.getS("Choisir la plage des abscisses"))); plages.add(plageDeb_); @@ -393,12 +530,12 @@ plages.add(plageFin_); plages.add(new JLabel("(Min: "+xMin+", Max: "+xMax+")")); content.add(plages,BorderLayout.SOUTH); - + return content; } - - - + + + JComboBox comBoChoixTypeGraphe_=new JComboBox(new String[]{TrResource.getS("Profil Spatial"),TrResource.getS("Evolution temporelle"),TrResource.getS("Corr\xE9lation")}); JList listSeparator_,listSeparatorDebPlage_,listSeparatorFinPlage_, listSeparatorCorrel1_,listSeparatorCorrel2_; JList listVariablesGENE_,listVariablesGENE2_,listVariablesGENECorrlX_,listVariablesGENECorrlY_; @@ -426,30 +563,30 @@ // TODO Auto-generated method stub return "("+nomVar+"/"+nomSeparator+")"; } - + public EvolutionReguliere transform(boolean _time){ - double[] tabX = new double[listX.size()]; - double[] tabY = new double[listY.size()]; - for (int j = 0; j < listX.size(); j++) { - tabX[j] = listX.get(j); - tabY[j] = listY.get(j); - } + double[] tabX = new double[listX.size()]; + double[] tabY = new double[listY.size()]; + for (int j = 0; j < listX.size(); j++) { + tabX[j] = listX.get(j); + tabY[j] = listY.get(j); + } EvolutionReguliere evol=new EvolutionReguliere(tabX, tabY,_time); evol.setNom(nomVar+" "+nomSeparator); evol.isScope_=true; - //-- ajout des infos specifiques --// - Map infos= evol.infos_; - infos.put("Type", "Profil spatial scopGene"); - infos.put("Fichier scopGENE", fileChoosen_.getName()); - infos.put(ScopeStructure.NOM_FICHIER, fileChoosen_.getAbsolutePath()); - infos.put("Variable", nomVar.replace(" ", "")); - infos.put("Plage de valeurs", nomSeparator.replace(" ", "")); - + //-- ajout des infos specifiques --// + Map infos= evol.infos_; + infos.put("Type", "Profil spatial scopGene"); + infos.put("Fichier scopGENE", fileChoosen_.getName()); + infos.put(ScopeStructure.NOM_FICHIER, fileChoosen_.getAbsolutePath()); + infos.put("Variable", nomVar.replace(" ", "")); + infos.put("Plage de valeurs", nomSeparator.replace(" ", "")); + return evol; } - + } - + /** * donne la description du fonctionnement de l'import gene specifique * @return @@ -459,13 +596,13 @@ case 0: return "<html><body>"+TrResource.getS("S\xE9lectionnez des couples variable/valeurs num\xE9riques de s\xE9parateur. <br /> Cliquez sur ajouter pour le prendre en compte. On peut ajouter plusieurs couples.<br /> Chaque couple g\xE9n\xE9rera une courbe en prenant les valeurs num\xE9riques du s\xE9parateur choisi.")+"</body></html> "; case 1: return "<html><body>"+TrResource.getS("S\xE9lectionner toutes les variables voulues ainsi q'une plage de d\xE9part et une plage de fin.<br /> Cela g\xE9n\xE9rera une courbe par variables. Chaque courbe prendra pour Y une interpolation par rapport au x choisi. <br />Il y aura donc autant de couples (x,y) que de s\xE9parateurs dans l'intervalle d\xE9but/fin choisi.")+"</body></html> "; case 2: return TrResource.getS("S\xE9lectionner une variable et une plage de valeur num\xE9rique pour repr\xE9senter les valeurs de X. Idem pour Y."); - + } return ""; - + } - - + + JCheckBox choixNuagePoints_; /** * Creation du panel scopGene pour choisir ses parametres @@ -477,7 +614,7 @@ final JPanel content=new JPanel(new BorderLayout()); content2.add(content,BorderLayout.CENTER); final JLabel description=new JLabel(getDescriptionImportGENE()); - + content.add(description,BorderLayout.NORTH); final JPanel container=new JPanel(layoutParamGene); content.add(container,BorderLayout.CENTER); @@ -486,14 +623,14 @@ String val=(String) comBoChoixTypeGraphe_.getSelectedItem(); layoutParamGene.show(container, val); //layoutParamGene.next(container); -// content.revalidate(); -// container.revalidate(); + // content.revalidate(); + // container.revalidate(); description.setText(getDescriptionImportGENE()); - + } }); - + //-- ACHTUNG!!! DANS LES SPEC ON VEUT POUVOIR SAISIR DES COUPLES SEPARATOR/VARIABLES --// //-- creation de la liste des variables --// String[] listeVar=new String[dataG().getNbVariables()-1]; @@ -502,7 +639,7 @@ listeVar[i-1]=dataG().getVariable(i); listVariablesGENE_=new JList(listeVar); listVariablesGENE_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - + //-- creation de la liste des separators --// listeVar=new String[dataG().getNbSeparator()]; //on ne prends pas les x @@ -510,63 +647,63 @@ listeVar[i]=dataG().getSeparator(i); listSeparator_=new JList(listeVar); listSeparator_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - + + //-- panel reserv\xE9 aux profils spatiaux --// - JPanel paramProfils=new JPanel(new BorderLayout()); - container.add(paramProfils, TrResource.getS("Profil Spatial")); - JPanel choixVar=new JPanel(new GridLayout(1,2)); - JScrollPane pane=new JScrollPane(listVariablesGENE_); - pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - choixVar.add(pane); - pane=new JScrollPane(listSeparator_); - pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); - - choixVar.add(pane); - paramProfils.add(choixVar,BorderLayout.NORTH); - //--panel du milieu: liste de couples VAR/SEPARATOR --// - modelCoupleSpatiauxGENE_=new DefaultListModel(); - listCoupleSpatiauxGENE_=new JList(modelCoupleSpatiauxGENE_); - pane=new JScrollPane(listCoupleSpatiauxGENE_); - pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); - paramProfils.add(pane,BorderLayout.CENTER); - //-- boutons du bas d'ajout/supression dans la liste --// - BuButton ajouter=new BuButton(FudaaResource.FUDAA.getIcon("crystal_ajouter"), TrResource.getS("Ajouter")); - ajouter.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - if(listSeparator_.getSelectedIndex()==-1) - impl_.error(TrResource.getS("Il faut choisir une valeur num\xE9rique de s\xE9parateur.")); - else if(listVariablesGENE_.getSelectedIndex()==-1) - impl_.error(TrResource.getS("Il faut choisir une variable.")); - else{ - //-- creation du couple choisi en recherchant les bonnes donn\xE9es dans la structure --// - int indiceVarChoisie=listVariablesGENE_.getSelectedIndex()+1; - String varChoisie=dataG().getVariable(indiceVarChoisie); - String separatorChoisi=dataG().getSeparator(listSeparator_.getSelectedIndex()); - CoupleVarSepartor newCouple=new CoupleVarSepartor(varChoisie,separatorChoisi,dataG().getAllX(separatorChoisi),dataG().getListValueForVariableForSeparator(separatorChoisi,indiceVarChoisie)); - modelCoupleSpatiauxGENE_.addElement(newCouple); - } + JPanel paramProfils=new JPanel(new BorderLayout()); + container.add(paramProfils, TrResource.getS("Profil Spatial")); + JPanel choixVar=new JPanel(new GridLayout(1,2)); + JScrollPane pane=new JScrollPane(listVariablesGENE_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); + choixVar.add(pane); + pane=new JScrollPane(listSeparator_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); + + choixVar.add(pane); + paramProfils.add(choixVar,BorderLayout.NORTH); + //--panel du milieu: liste de couples VAR/SEPARATOR --// + modelCoupleSpatiauxGENE_=new DefaultListModel(); + listCoupleSpatiauxGENE_=new JList(modelCoupleSpatiauxGENE_); + pane=new JScrollPane(listCoupleSpatiauxGENE_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); + paramProfils.add(pane,BorderLayout.CENTER); + //-- boutons du bas d'ajout/supression dans la liste --// + BuButton ajouter=new BuButton(FudaaResource.FUDAA.getIcon("crystal_ajouter"), TrResource.getS("Ajouter")); + ajouter.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + if(listSeparator_.getSelectedIndex()==-1) + impl_.error(TrResource.getS("Il faut choisir une valeur num\xE9rique de s\xE9parateur.")); + else if(listVariablesGENE_.getSelectedIndex()==-1) + impl_.error(TrResource.getS("Il faut choisir une variable.")); + else{ + //-- creation du couple choisi en recherchant les bonnes donn\xE9es dans la structure --// + int indiceVarChoisie=listVariablesGENE_.getSelectedIndex()+1; + String varChoisie=dataG().getVariable(indiceVarChoisie); + String separatorChoisi=dataG().getSeparator(listSeparator_.getSelectedIndex()); + CoupleVarSepartor newCouple=new CoupleVarSepartor(varChoisie,separatorChoisi,dataG().getAllX(separatorChoisi),dataG().getListValueForVariableForSeparator(separatorChoisi,indiceVarChoisie)); + modelCoupleSpatiauxGENE_.addElement(newCouple); } - - }); - BuButton supprimer=new BuButton(FudaaResource.FUDAA.getIcon("crystal_enlever"), TrResource.getS("Enlever")); - supprimer.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e) { - if(listCoupleSpatiauxGENE_.getSelectedIndex()==-1) - impl_.error(TrResource.getS("Il faut choisir une valeur du couple \xE0 supprimer")); - - else{ - modelCoupleSpatiauxGENE_.remove(listCoupleSpatiauxGENE_.getSelectedIndex()); - } + } + + }); + BuButton supprimer=new BuButton(FudaaResource.FUDAA.getIcon("crystal_enlever"), TrResource.getS("Enlever")); + supprimer.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + if(listCoupleSpatiauxGENE_.getSelectedIndex()==-1) + impl_.error(TrResource.getS("Il faut choisir une valeur du couple \xE0 supprimer")); + + else{ + modelCoupleSpatiauxGENE_.remove(listCoupleSpatiauxGENE_.getSelectedIndex()); } - - }); + } + + }); //ajout des boutons - JPanel panelActions=new JPanel(new FlowLayout()); - panelActions.add(ajouter); - panelActions.add(supprimer); - paramProfils.add(panelActions, BorderLayout.SOUTH); - + JPanel panelActions=new JPanel(new FlowLayout()); + panelActions.add(ajouter); + panelActions.add(supprimer); + paramProfils.add(panelActions, BorderLayout.SOUTH); + //-- panel reserv\xE9 aux courbes temporelles --// JPanel paramTempo=new JPanel(new BorderLayout()); container.add(paramTempo, TrResource.getS("Evolution temporelle")); @@ -584,12 +721,12 @@ listSeparatorFinPlage_=new JList(listeVar); listSeparatorFinPlage_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSeparatorFinPlage_.setSelectedIndex(listSeparatorDebPlage_.getModel().getSize()-1); - + JPanel listData=new JPanel(new GridLayout(1,2)); JPanel listData2=new JPanel(new GridLayout(2,1)); pane=new JScrollPane(listVariablesGENE2_); pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - + listData.add(pane); listData.add(listData2); pane=new JScrollPane(listSeparatorDebPlage_); @@ -599,7 +736,7 @@ pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage fin du s\xE9parateur de bloc"))); listData2.add(pane); paramTempo.add(listData,BorderLayout.CENTER); - + //textField contenant le x choisi xMax=dataG().getXMax(); xMin=dataG().getXMin(); @@ -611,15 +748,15 @@ panelInfo.add(fieldX); paramTempo.add(panelInfo,BorderLayout.SOUTH); fieldX.setText(""+((xMax+xMin)/2)); - - - + + + //-- panel reserv\xE9s au corr\xE9lations --// JPanel panelCorrelation=new JPanel(new BorderLayout()); JPanel paramCorrel=new JPanel(new GridLayout(2,2)); panelCorrelation.add(paramCorrel,BorderLayout.CENTER); container.add(panelCorrelation, TrResource.getS("Corr\xE9lation")); - + listeVar=new String[dataG().getNbVariables()-1]; for(int i=1;i<dataG().getNbVariables();i++) listeVar[i-1]=dataG().getVariable(i); @@ -627,19 +764,19 @@ listVariablesGENECorrlX_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listVariablesGENECorrlY_=new JList(listeVar); listVariablesGENECorrlY_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - + + listeVar=new String[dataG().getNbSeparator()]; for(int i=0;i<dataG().getNbSeparator();i++) listeVar[i]=dataG().getSeparator(i); listSeparatorCorrel1_=new JList(listeVar); listSeparatorCorrel1_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSeparatorCorrel1_.setSelectedIndex(0); - + listSeparatorCorrel2_=new JList(listeVar); listSeparatorCorrel2_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSeparatorCorrel2_.setSelectedIndex(0); - + pane=new JScrollPane(listVariablesGENECorrlX_); pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe X"))); paramCorrel.add(pane); @@ -652,13 +789,13 @@ pane=new JScrollPane(listSeparatorCorrel2_); pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable Y"))); paramCorrel.add(pane); - + choixNuagePoints_=new JCheckBox(EbliResource.EBLI.getString("Nuage de points")); panelCorrelation.add(choixNuagePoints_,BorderLayout.SOUTH); - + return content2; } - + JPanel buildPanelParametresImportation(){ switch(typeFormat_){ case 0: @@ -671,135 +808,135 @@ //cas scopGENE return buildPanelScopeGENE(); } - + return null; } - + public String getTaskTitle() { // TODO Auto-generated method stub return TrResource.getS("Importation depuis les formats Scop S, T et GENE"); } /** - * MEthode utilisee pour disabler ou non les boutons suivants - */ - public int getStepDisabledButtons() { - int r = super.getStepDisabledButtons(); - if (current_ == 1) { - - //cas scope s ou t - if(typeFormat_==1 || typeFormat_==0){ - if(data_==null) - r |= BuButtonPanel.TERMINER; - else - if(plageDeb_.getText().equals("") || plageFin_.getText().equals("")) - r |= BuButtonPanel.TERMINER; - else{ - //verifier que les plages ne sont pas depassees - double valDeb=Double.parseDouble(plageDeb_.getText()); - double valFin=Double.parseDouble(plageFin_.getText()); - if(valDeb<xMin || xMax<valFin) - r |= BuButtonPanel.TERMINER; - } - - }else{ - //cas scope gene - } - - } - return r; - } - - - public void doTask() { - done_ = true; - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { - public void act() { - - /** - * Cas de rejoue des donn\xE9es, on supprime le contenu du graphe - */ - if(replayData_){ - if(target_ instanceof EGGrapheTreeModel){ - java.util.List<EGCourbeChild> listecb=((EGGrapheTreeModel)target_).getAllCourbesChild(); - - ((EGGrapheTreeModel)target_).removeCurves( listecb.toArray(new EGCourbeChild[listecb.size()]), new CtuluCommandManager()); - - } - } - - - final ProgressionInterface prog = getMainStateReceiver(); - //mise a jour de la structure - impl_.setMainProgression(10); - impl_.setMainMessage(CtuluLib.getS("Structure modification")); - prog.setProgression(10); - prog.setDesc(CtuluLib.getS("Structure modification")); - if(typeFormat_<=1){ - dataST().restreindreStructure(listVariablesST_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - FudaaCourbeImporterScope.createGraphe(fileChoosen_,target_, data_, null, prog,false); - } - else{ - //-- format scopeGen, selon le type de format g\xE9n\xE9r\xE9--// - if(comBoChoixTypeGraphe_.getSelectedIndex()==0){ - //profil spatial, on recupere la liste des couples solutions - EvolutionReguliere[] tabEvol=new EvolutionReguliere[modelCoupleSpatiauxGENE_.getSize()]; - for(int i=0;i<modelCoupleSpatiauxGENE_.getSize();i++) - tabEvol[i]=((CoupleVarSepartor) modelCoupleSpatiauxGENE_.getElementAt(i)).transform(false); - - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - FudaaCourbeImporterScope.createGraphe(target_, tabEvol, null, prog,false); - }else - if(comBoChoixTypeGraphe_.getSelectedIndex()==1){ - //evol temporelle - int debSeparator=listSeparatorDebPlage_.getSelectedIndex(); - int finSeparator=listSeparatorFinPlage_.getSelectedIndex(); - int[] selectedVariables= listVariablesGENE2_.getSelectedIndices(); - double xchoosen=Double.parseDouble(fieldX.getText()); - dataG().restreindreStructure(debSeparator,finSeparator,selectedVariables,xchoosen); - - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - //on cree les evol reguliere SPECIFIQUES pour ces courbes. - FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolRegulierePourTemporelles(xchoosen,fileChoosen_), null, prog,false); - - }else{ - //correlation - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - //on cree les evol reguliere SPECIFIQUES pour ces courbes. - int varX=listVariablesGENECorrlX_.getSelectedIndex(); - int varY=listVariablesGENECorrlY_.getSelectedIndex(); - - int plageX=listSeparatorCorrel1_.getSelectedIndex(); - int plageY=listSeparatorCorrel2_.getSelectedIndex(); - - //-- recuperation du choix nuage de points ou non - boolean nuagePoints=choixNuagePoints_.isSelected(); - - FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolReguliereCorrelation(varX,varY,plageX,plageY,fileChoosen_), null, prog,nuagePoints); - - - } - - } - - //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// - createGraphImported(); - } - }.start(); - } + * MEthode utilisee pour disabler ou non les boutons suivants + */ + public int getStepDisabledButtons() { + int r = super.getStepDisabledButtons(); + if (current_ == 1) { - - /** - * Methode a surcharger. - * Appel\xE9e a la toute fin, gere le resultat - */ - public void createGraphImported(){ - //placer le graphe ou vous voulez... - } - + //cas scope s ou t + if(typeFormat_==1 || typeFormat_==0){ + if(data_==null) + r |= BuButtonPanel.TERMINER; + else + if(plageDeb_.getText().equals("") || plageFin_.getText().equals("")) + r |= BuButtonPanel.TERMINER; + else{ + //verifier que les plages ne sont pas depassees + double valDeb=Double.parseDouble(plageDeb_.getText()); + double valFin=Double.parseDouble(plageFin_.getText()); + if(valDeb<xMin || xMax<valFin) + r |= BuButtonPanel.TERMINER; + } + + }else{ + //cas scope gene + } + + } + return r; + } + + + public void doTask() { + done_ = true; + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { + public void act() { + + /** + * Cas de rejoue des donn\xE9es, on supprime le contenu du graphe + */ + if(replayData_){ + if(target_ instanceof EGGrapheTreeModel){ + java.util.List<EGCourbeChild> listecb=((EGGrapheTreeModel)target_).getAllCourbesChild(); + + ((EGGrapheTreeModel)target_).removeCurves( listecb.toArray(new EGCourbeChild[listecb.size()]), new CtuluCommandManager()); + + } + } + + + final ProgressionInterface prog = getMainStateReceiver(); + //mise a jour de la structure + impl_.setMainProgression(10); + impl_.setMainMessage(CtuluLib.getS("Structure modification")); + prog.setProgression(10); + prog.setDesc(CtuluLib.getS("Structure modification")); + if(typeFormat_<=1){ + dataST().restreindreStructure(listVariablesST_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + FudaaCourbeImporterScope.createGraphe(fileChoosen_,target_, data_, null, prog,false); + } + else{ + //-- format scopeGen, selon le type de format g\xE9n\xE9r\xE9--// + if(comBoChoixTypeGraphe_.getSelectedIndex()==0){ + //profil spatial, on recupere la liste des couples solutions + EvolutionReguliere[] tabEvol=new EvolutionReguliere[modelCoupleSpatiauxGENE_.getSize()]; + for(int i=0;i<modelCoupleSpatiauxGENE_.getSize();i++) + tabEvol[i]=((CoupleVarSepartor) modelCoupleSpatiauxGENE_.getElementAt(i)).transform(false); + + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + FudaaCourbeImporterScope.createGraphe(target_, tabEvol, null, prog,false); + }else + if(comBoChoixTypeGraphe_.getSelectedIndex()==1){ + //evol temporelle + int debSeparator=listSeparatorDebPlage_.getSelectedIndex(); + int finSeparator=listSeparatorFinPlage_.getSelectedIndex(); + int[] selectedVariables= listVariablesGENE2_.getSelectedIndices(); + double xchoosen=Double.parseDouble(fieldX.getText()); + dataG().restreindreStructure(debSeparator,finSeparator,selectedVariables,xchoosen); + + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + //on cree les evol reguliere SPECIFIQUES pour ces courbes. + FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolRegulierePourTemporelles(xchoosen,fileChoosen_), null, prog,false); + + }else{ + //correlation + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + //on cree les evol reguliere SPECIFIQUES pour ces courbes. + int varX=listVariablesGENECorrlX_.getSelectedIndex(); + int varY=listVariablesGENECorrlY_.getSelectedIndex(); + + int plageX=listSeparatorCorrel1_.getSelectedIndex(); + int plageY=listSeparatorCorrel2_.getSelectedIndex(); + + //-- recuperation du choix nuage de points ou non + boolean nuagePoints=choixNuagePoints_.isSelected(); + + FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolReguliereCorrelation(varX,varY,plageX,plageY,fileChoosen_), null, prog,nuagePoints); + + + } + + } + + //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// + createGraphImported(); + } + }.start(); + } + + + /** + * Methode a surcharger. + * Appel\xE9e a la toute fin, gere le resultat + */ + public void createGraphImported(){ + //placer le graphe ou vous voulez... + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -257,7 +257,7 @@ TrPostSource resultat = new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); resultat.buildDefaultVarUpdateLists(); - _impl.getCurrentProject().deliverSourceSuiteId(resultat); + _impl.getCurrentProject().deliverSourceId(resultat); // -- creation du source Reader --// return resultat; } @@ -304,7 +304,7 @@ if (suiteProgressive != null) { maxiStringLeo += "La suite de calcul s'arrete donc avec les fichiers " + suiteProgressive.getTitle(); suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); + projet.ajouterSource(suiteProgressive,suiteProgressive.getTitle()); } impl.error(maxiStringLeo); @@ -315,7 +315,7 @@ // -- trigger signal modif --// suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); + projet.ajouterSource(suiteProgressive,suiteProgressive.getTitle()); return suiteProgressive; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-29 09:53:07 UTC (rev 4424) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-29 18:53:28 UTC (rev 4425) @@ -183,19 +183,21 @@ final String com = _evt.getActionCommand(); if ("CREER".equals(com)) { - + if(c_!=null){ - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().saveProject(false); + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } + //-- nettoyage du projet pr\xE9c\xE9dent --// + + c_.getManager().clearProject(); } - //-- nettoyage du projet pr\xE9c\xE9dent --// - - c_.getManager().clearProject(); + else { + c_=new TrPostProjet(this); + c_.setMenuPost(); } - else - c_=new TrPostProjet(this); //-- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// c_.createNewLayoutFrame(); //-- ouverture d'un fichier r\xE9sultat --// @@ -207,17 +209,21 @@ }else if ("OUVRIR".equals(com)) { // -- ouverture d un nouveau projet --// + if(c_!=null){ + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().saveProject(false); + //-- nettoyage du projet pr\xE9c\xE9dent --// + c_.getManager().clearProject(); + }else + { + c_=new TrPostProjet(this); + c_.setMenuPost(); } - //-- nettoyage du projet pr\xE9c\xE9dent --// - c_.getManager().clearProject(); - - c_.getManager().loadProject(false, null); //new TrPostFusionProjet(c_); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java ==========================================... [truncated message content] |