From: <de...@us...> - 2008-10-30 17:08:15
|
Revision: 4118 http://fudaa.svn.sourceforge.net/fudaa/?rev=4118&view=rev Author: deniger Date: 2008-10-30 17:08:12 +0000 (Thu, 30 Oct 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvLineChooser.java Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java 2008-10-30 17:08:12 UTC (rev 4118) @@ -0,0 +1,116 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.fudaa.meshviewer.profile; + +import java.awt.Color; + +import org.fudaa.ebli.calque.BArbreCalqueModel; +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.fudaa.sig.FSigLineSingleModel; + +import com.vividsolutions.jts.geom.LineString; + +/** + * Une classe permettant d'afficher temporaire une ligne dans le panel + * + * @author deniger + */ +public class FSigTempLineInLayer { + + private Color colorLineTempo_ = Color.RED; + + GrBoite initZoom_; + + boolean isZoomChanged_; + + final ZEbliCalquesPanel panel_; + + ZCalqueLigneBrisee tmp_; + + public FSigTempLineInLayer(ZEbliCalquesPanel _panel) { + super(); + panel_ = _panel; + } + + protected void close() { + if (tmp_ != null) { + tmp_.detruire(); + panel_.getVueCalque().getCalque().repaint(); + panel_.getVueCalque().changeRepere(this, initZoom_); + tmp_ = null; + } + + } + + /** + * @return the colorLineTempo + */ + public Color getColorLineTempo() { + return colorLineTempo_; + } + + /** + * @return the isZoomChanged + */ + public boolean isZoomChanged() { + return isZoomChanged_; + } + + /** + * @param _colorLineTempo the colorLineTempo to set + */ + public void setColorLineTempo(Color _colorLineTempo) { + colorLineTempo_ = _colorLineTempo; + } + + /** + * @param _s la ligne a afficher temporairement. si null n'affiche rien + * @param _zoom true si on doit zoomer sur la ligne. + */ + protected void display(final LineString _s, final boolean _zoom) { + if (panel_ == null) { return; } + if (_s == null) { + if (tmp_ != null) { + tmp_.setVisible(false); + } + return; + } + final FSigLineSingleModel modele = new FSigLineSingleModel(_s); + if (tmp_ == null) { + initZoom_ = panel_.getVueCalque().getViewBoite(); + tmp_ = new ZCalqueLigneBrisee(); + tmp_.setDestructible(true); + final TraceIconModel model = new TraceIconModel(TraceIcon.PLUS_DOUBLE, 4, colorLineTempo_); + tmp_.setIconModel(0, model); + tmp_.setIconModel(1, model); + final TraceLigneModel ligne = new TraceLigneModel(TraceLigne.MIXTE, 2, colorLineTempo_); + tmp_.setLineModel(0, ligne); + tmp_.setLineModel(1, ligne); + panel_.getVueCalque().getCalque().enPremier(tmp_); + panel_.getCqInfos().enPremier(); + } + tmp_.setVisible(true); + tmp_.modele(modele); + if (_zoom) { + BArbreCalqueModel.actionCenter(tmp_, panel_); + isZoomChanged_ = true; + } + } + + public void zoomInitial(){ + panel_.getVueCalque().changeViewBoite(this, initZoom_, false); + } + + public void restaurer(){ + panel_.restaurer(); + } + +} Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvLineChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvLineChooser.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvLineChooser.java 2008-10-30 17:08:12 UTC (rev 4118) @@ -0,0 +1,174 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.fudaa.meshviewer.profile; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.beans.PropertyChangeListener; +import java.util.Observable; + +import javax.swing.ButtonGroup; +import javax.swing.JComponent; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; + +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.fudaa.meshviewer.MvResource; + +import com.memoire.bu.BuBorders; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuVerticalLayout; +import com.vividsolutions.jts.geom.LineString; + +/** + * @author deniger + */ +public class MvLineChooser extends Observable { + + public BuRadioButton btSelectedLine_; + + public BuRadioButton btSelectInTree_; + + public final ZEbliCalquesPanel calque_; + + public final LineString initSelected_; + final CalqueFindCourbeTreeModel lineTreeModel_; + + BuPanel panelTreeIsoLignes; + final FSigTempLineInLayer tmpLine_; + public JTree tree_; + + public MvLineChooser(LineString _initSelected, ZEbliCalquesPanel _calque) { + super(); + initSelected_ = _initSelected; + calque_ = _calque; + lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _calque.getDonneesCalque()); + tmpLine_ = new FSigTempLineInLayer(_calque); + } + + protected JTree buildTree() { + return CalqueFindCourbeTreeModel.createCalqueTree(lineTreeModel_, true); + } + + public void close() { + tmpLine_.close(); + } + + public String getError() { + if (tree_.isEnabled() && tree_.isSelectionEmpty()) { return EbliLib.getS("S\xE9lectionner au moins une courbe"); } + return null; + } + + /** + * @return the initSelected + */ + public LineString getInitSelected() { + return initSelected_; + } + + public LineString getSelectedLine() { + if (btSelectedLine_.isSelected()) { + return initSelected_; + // MvProfileBuilderFromTree.this.name_ = EbliLib.getS("S\xE9lection"); + } else { + return getSelectedLineInTree(tree_); + // MvProfileBuilderFromTree.this.name_ = getSelectedLineTitle(tree_); + } + } + + public String getSelectedLineName() { + if (btSelectedLine_.isSelected()) { + return EbliLib.getS("S\xE9lection"); + } else { + return getSelectedLineTitle(tree_); + } + } + + public JComponent getPanel(String title) { + if (panelTreeIsoLignes != null) return panelTreeIsoLignes; + panelTreeIsoLignes = new BuPanel(new BuVerticalLayout(3)); + tree_ = buildTree(); + panelTreeIsoLignes.add(new BuLabel(title)); + btSelectedLine_ = new BuRadioButton(MvResource.getS("Utiliser La ligne s\xE9lectionn\xE9e")); + btSelectInTree_ = new BuRadioButton(MvResource.getS("Utiliser une ligne disponible:")); + final ButtonGroup bg = new ButtonGroup(); + bg.add(btSelectedLine_); + bg.add(btSelectInTree_); + final BuScrollPane buScrollPane = new BuScrollPane(tree_); + buScrollPane.setPreferredHeight(200); + panelTreeIsoLignes.add(btSelectedLine_); + panelTreeIsoLignes.add(btSelectInTree_); + buScrollPane.setBorder(BuBorders.EMPTY2500); + panelTreeIsoLignes.add(buScrollPane); + if (initSelected_ == null) { + btSelectedLine_.setEnabled(false); + btSelectInTree_.setSelected(true); + } else { + btSelectedLine_.setSelected(true); + tree_.setEnabled(false); + this.update(initSelected_, false); + } + tree_.addTreeSelectionListener(new TreeSelectionListener() { + public void valueChanged(final TreeSelectionEvent _e) { + // updateError(pn, tree_, varTime_); + update(getSelectedLineInTree(tree_), true); + } + + }); + // le selectionneur pour le bouton + btSelectedLine_.addItemListener(new ItemListener() { + public void itemStateChanged(final ItemEvent _e) { + tree_.setEnabled(!btSelectedLine_.isSelected()); + if (btSelectedLine_.isSelected()) { + update(initSelected_, tmpLine_.isZoomChanged()); + } else if (tree_.isSelectionEmpty()) { + update(null, false); + } else { + update(getSelectedLineInTree(tree_), true); + } + // updateError(pn, tree_, varTime_); + } + + }); + return panelTreeIsoLignes; + } + + public LineString getSelectedLineInTree(final JTree _tree) { + if (_tree.isSelectionEmpty()) { return null; } + final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) _tree.getSelectionPath() + .getLastPathComponent(); + final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); + return (LineString) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); + } + + public String getSelectedLineTitle(final JTree _tree) { + if (_tree.isSelectionEmpty()) { return null; } + final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) _tree.getSelectionPath() + .getLastPathComponent(); + return node.toString(); + } + + public void update(final LineString _s, final boolean _zoom) { + tmpLine_.display(_s, _zoom); + setChanged(); + super.notifyObservers(_s); + } + + public void zoomInitial() { + tmpLine_.zoomInitial(); + } + + public void restaurer() { + tmpLine_.restaurer(); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java 2008-10-30 17:07:44 UTC (rev 4117) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java 2008-10-30 17:08:12 UTC (rev 4118) @@ -9,7 +9,6 @@ import java.awt.event.ActionEvent; -import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvResource; @@ -34,9 +33,7 @@ } protected LineString getSelectedLine() { - // pas de calque s\xE9lectionn\xE9 - if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { return null; } - return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + return panel_.getSelectedLine(); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-10-30 17:07:44 UTC (rev 4117) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-10-30 17:08:12 UTC (rev 4118) @@ -27,22 +27,14 @@ import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; import org.fudaa.dodico.ef.operation.EfLineIntersectorActivity; import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.calque.BArbreCalqueModel; -import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGGroup; -import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigne; -import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; -import org.fudaa.fudaa.sig.FSigLineSingleModel; import com.memoire.bu.BuLib; import com.vividsolutions.jts.geom.LineString; @@ -64,8 +56,8 @@ final MvProfileTarget data_; // BuDesktop dest_; public final ListModel initVar_; - GrBoite initZoom_; - boolean isZoomChanged_; + // GrBoite initZoom_; + // boolean isZoomChanged_; EfLineIntersectionsResultsMng meshesResults_; public String name_; @@ -79,7 +71,7 @@ final EfLineIntersectionsCorrectionTester tester_; - ZCalqueLigneBrisee tmp_; + // ZCalqueLigneBrisee tmp_; public final CtuluUI ui_; @@ -94,8 +86,9 @@ data_ = _data; panel_ = _panel; tester_ = _tester; + initVar_ = CtuluLibSwing.createListModel(data_.getVars()); - act_ = new EfLineIntersectorActivity(data_.getData(), data_.getInterpolator()); + act_ = new EfLineIntersectorActivity(data_.getInterpolator()); ui_ = panel_.getCtuluUI(); timeModel_ = _data.getTimeModel(); initLine_ = _selected; @@ -372,16 +365,8 @@ } - protected void close() { - if (tmp_ != null) { - tmp_.detruire(); - panel_.getVueCalque().getCalque().repaint(); - panel_.getVueCalque().changeRepere(this, initZoom_); - tmp_ = null; - } + protected void close() {} - } - protected String getHelpForVarTime() { return timeModel_ == null ? CtuluLib.getS("S\xE9lectionner les variables") : CtuluLib .getS("S\xE9lectionner les variables et les pas de temps"); @@ -413,36 +398,6 @@ protected abstract void stepOne(); - protected void update(final LineString _s, final boolean _zoom) { - if (panel_ == null) { return; } - if (_s == null) { - if (tmp_ != null) { - tmp_.setVisible(false); - } - return; - } - final FSigLineSingleModel modele = new FSigLineSingleModel(_s); - if (tmp_ == null) { - initZoom_ = panel_.getVueCalque().getViewBoite(); - tmp_ = new ZCalqueLigneBrisee(); - tmp_.setDestructible(true); - final TraceIconModel model = new TraceIconModel(TraceIcon.PLUS_DOUBLE, 4, Color.RED); - tmp_.setIconModel(0, model); - tmp_.setIconModel(1, model); - final TraceLigneModel ligne = new TraceLigneModel(TraceLigne.MIXTE, 2, Color.RED); - tmp_.setLineModel(0, ligne); - tmp_.setLineModel(1, ligne); - panel_.getVueCalque().getCalque().enPremier(tmp_); - panel_.getCqInfos().enPremier(); - } - tmp_.setVisible(true); - tmp_.modele(modele); - if (_zoom) { - BArbreCalqueModel.actionCenter(tmp_, panel_); - isZoomChanged_ = true; - } - } - public EfLineIntersectionsResultsMng getMeshResultsMng(final ProgressionInterface _prog) { if (meshesResults_ == null) { meshesResults_ = act_.computeFor(selectedLine_, _prog, true); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-10-30 17:07:44 UTC (rev 4117) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-10-30 17:08:12 UTC (rev 4118) @@ -7,17 +7,14 @@ */ package org.fudaa.fudaa.meshviewer.profile; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; +import java.util.Observable; +import java.util.Observer; -import javax.swing.ButtonGroup; +import javax.swing.JComponent; import javax.swing.JDialog; -import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; @@ -29,10 +26,7 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.dodico.ef.operation.EfLineIntersectionsCorrectionTester; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; -import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; -import org.fudaa.ebli.commun.EbliLib; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; @@ -40,63 +34,64 @@ import com.memoire.bu.BuBorders; import com.memoire.bu.BuGlassPaneStop; import com.memoire.bu.BuHorizontalLayout; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuRadioButton; -import com.memoire.bu.BuScrollPane; -import com.memoire.bu.BuVerticalLayout; import com.vividsolutions.jts.geom.LineString; public class MvProfileBuilderFromTree extends MvProfileBuilder { - public final LineString initSelected_; - final CalqueFindCourbeTreeModel lineTreeModel_; ZEbliCalquesPanel calque_; + final MvLineChooser lineChooser_; + /** * panel qui contient les calques des isolignes */ - BuPanel panelTreeIsoLignes; + JComponent panelTreeIsoLignes; /** * panel des pas de temps et variables */ MvExportChooseVarAndTime varTime_; - public MvExportChooseVarAndTime getVarTime() { - return varTime_; - } - - public BuPanel getPanelTreeIsoLignes() { - return panelTreeIsoLignes; - } - public MvProfileBuilderFromTree(final MvProfileTarget _data, final CtuluUI _ui, final LineString _selected, final ZEbliCalquesPanel _panel, final EfLineIntersectionsCorrectionTester _tester) { super(_data, _panel, _tester, _selected); - lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _panel.getDonneesCalque()); - initSelected_ = _selected; + // lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _panel.getDonneesCalque()); + // initSelected_ = _selected; calque_ = _panel; + lineChooser_ = new MvLineChooser(_selected, panel_); } - public LineString getSelectedLineInTree(final JTree _tree) { - if (_tree.isSelectionEmpty()) { return null; } - final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) _tree.getSelectionPath() - .getLastPathComponent(); - final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); - return (LineString) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); + @Override + protected void close() { + lineChooser_.close(); } - public String getSelectedLineTitle(final JTree _tree) { - if (_tree.isSelectionEmpty()) { return null; } - final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) _tree.getSelectionPath() - .getLastPathComponent(); - return node.toString(); + /** + * @return the panelTreeIsoLignes + */ + public JComponent getPanelTreeIsoLignes() { + return panelTreeIsoLignes; } - protected JTree buildTree() { - return CalqueFindCourbeTreeModel.createCalqueTree(lineTreeModel_, true); + /** + * @return + * @see org.fudaa.fudaa.meshviewer.profile.MvLineChooser#getSelectedLine() + */ + public LineString getSelectedLine() { + return lineChooser_.getSelectedLine(); } + /** + * @return + * @see org.fudaa.fudaa.meshviewer.profile.MvLineChooser#getSelectedLineName() + */ + public String getSelectedLineName() { + return lineChooser_.getSelectedLineName(); + } + + public MvExportChooseVarAndTime getVarTime() { + return varTime_; + } + protected void intersectTest(final JDialog _d, final MvExportChooseVarAndTime _var, final ProgressionInterface _prog) { final EfLineIntersectionsResultsI res = getDefaultRes((CtuluVariable) initVar_.getElementAt(0), _prog); if (res == null || res.isEmpty()) { @@ -108,51 +103,25 @@ } - public BuRadioButton btSelectedLine_; - public BuRadioButton btSelectInTree_; - public JTree tree_; + // public JTree tree_; /** * construit les panels des parametres. */ + @SuppressWarnings("serial") @Override public void stepOne() { - panelTreeIsoLignes = new BuPanel(new BuVerticalLayout(3)); - tree_ = buildTree(); - panelTreeIsoLignes.add(new BuLabel(MvResource.getS("S\xE9lectionner la ligne \xE0 utiliser pour le profil"))); - btSelectedLine_ = new BuRadioButton(MvResource.getS("Utiliser La ligne s\xE9lectionn\xE9e")); - btSelectInTree_ = new BuRadioButton(MvResource.getS("Utiliser une ligne disponible:")); - final ButtonGroup bg = new ButtonGroup(); - bg.add(btSelectedLine_); - bg.add(btSelectInTree_); - final BuScrollPane buScrollPane = new BuScrollPane(tree_); - buScrollPane.setPreferredHeight(200); - panelTreeIsoLignes.add(btSelectedLine_); - panelTreeIsoLignes.add(btSelectInTree_); - buScrollPane.setBorder(BuBorders.EMPTY2500); - panelTreeIsoLignes.add(buScrollPane); - if (initSelected_ == null) { - btSelectedLine_.setEnabled(false); - btSelectInTree_.setSelected(true); - } else { - btSelectedLine_.setSelected(true); - tree_.setEnabled(false); - this.update(initSelected_, false); - } + if (panelTreeIsoLignes != null) return; + + panelTreeIsoLignes = lineChooser_.getPanel(MvResource.getS("S\xE9lectionner la ligne \xE0 utiliser pour le profil")); varTime_ = createVarTimeChooser(getHelpForVarTime()); final CtuluDialogPanel pn = new CtuluDialogPanel() { @Override public boolean valide() { if (!CtuluLibString.isEmpty(getErrorText())) { return false; } - - if (btSelectedLine_.isSelected()) { - MvProfileBuilderFromTree.this.selectedLine_ = initSelected_; - MvProfileBuilderFromTree.this.name_ = EbliLib.getS("S\xE9lection"); - } else { - MvProfileBuilderFromTree.this.selectedLine_ = getSelectedLineInTree(tree_); - MvProfileBuilderFromTree.this.name_ = getSelectedLineTitle(tree_); - } + MvProfileBuilderFromTree.this.selectedLine_ = lineChooser_.getSelectedLine(); + MvProfileBuilderFromTree.this.name_ = lineChooser_.getSelectedLineName(); final JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, this); final CtuluTaskDelegate task = MvProfileBuilderFromTree.this.ui_.createTask(FudaaLib .getS("Construction des courbes")); @@ -172,7 +141,7 @@ final ListSelectionListener listListener = new ListSelectionListener() { public void valueChanged(final ListSelectionEvent _e) { - updateError(pn, tree_, varTime_); + updateError(pn, varTime_.computeErrorText()); } }; @@ -181,36 +150,25 @@ } varTime_.getVarSelectionModel().addListSelectionListener(listListener); - tree_.addTreeSelectionListener(new TreeSelectionListener() { - public void valueChanged(final TreeSelectionEvent _e) { - updateError(pn, tree_, varTime_); - MvProfileBuilderFromTree.this.update(getSelectedLineInTree(tree_), true); - } - - }); - // le selectionneur pour le bouton - btSelectedLine_.addItemListener(new ItemListener() { - public void itemStateChanged(final ItemEvent _e) { - tree_.setEnabled(!btSelectedLine_.isSelected()); - if (btSelectedLine_.isSelected()) { - MvProfileBuilderFromTree.this.update(initSelected_, MvProfileBuilderFromTree.this.isZoomChanged_); - } else if (tree_.isSelectionEmpty()) { - MvProfileBuilderFromTree.this.update(null, false); - } else { - MvProfileBuilderFromTree.this.update(getSelectedLineInTree(tree_), true); - } - updateError(pn, tree_, varTime_); - } - - }); pn.setLayout(new BuHorizontalLayout(5)); panelTreeIsoLignes.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape {0}:", CtuluLibString.UN))); varTime_.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape {0}:", CtuluLibString.DEUX))); pn.add(panelTreeIsoLignes); pn.add(varTime_); pn.setBorder(BuBorders.EMPTY3333); - updateError(pn, tree_, varTime_); + lineChooser_.addObserver(new Observer() { + public void update(final Observable _o, final Object _arg) { + updateError(pn, lineChooser_.getError()); + + } + }); + final String error = lineChooser_.getError(); + updateError(pn, error); + if (error == null) { + updateError(pn, varTime_.getErrorText()); + } + // -- integration du parent component dans le wizard des profils spatiaux // --// @@ -220,20 +178,11 @@ } - protected void updateError(final CtuluDialogPanel _target, final JTree _tree, final MvExportChooseVarAndTime _var) { - String err = _var.computeErrorText(); - if (_tree.isEnabled() && _tree.isSelectionEmpty()) { - final String err2 = EbliLib.getS("S\xE9lectionner au moins une courbe"); - if (err == null) { - err = err2; - } else { - err = err + CtuluLibString.LINE_SEP_SIMPLE + err2; - } - } - if (err == null) { + protected void updateError(final CtuluDialogPanel _target, final String _err) { + if (_err == null) { _target.cancelErrorText(); } else { - _target.setErrorText(err); + _target.setErrorText(_err); } } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java 2008-10-30 17:07:44 UTC (rev 4117) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java 2008-10-30 17:08:12 UTC (rev 4118) @@ -10,7 +10,7 @@ import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.dodico.ef.EfGridData; -import org.fudaa.dodico.ef.interpolation.EfInterpolator; +import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; import org.fudaa.fudaa.tr.post.TrPostSource; @@ -32,7 +32,7 @@ */ CtuluVariable[] getVars(); - EfInterpolator getInterpolator(); + EfGridDataInterpolator getInterpolator(); /** * @return les pas de temps: peut-etre null This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |