From: <de...@us...> - 2009-01-20 23:25:38
|
Revision: 4387 http://fudaa.svn.sourceforge.net/fudaa/?rev=4387&view=rev Author: deniger Date: 2009-01-20 23:25:33 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -33,6 +33,7 @@ import com.memoire.fu.Fu; import com.memoire.fu.FuLog; +import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.image.CtuluLibImage; @@ -373,6 +374,7 @@ repere.ajouteTransformation(RepereEvent.ROT_Z, _rz, false); } repereModifie(repere); + // System.err.println(getViewBoite()+" == "+_boite); } /** @@ -485,7 +487,13 @@ * final GrBoite b = new GrBoite(new GrPoint(insets.left, insets.top, 0), new GrPoint(getWidth() - insets.left - * insets.right, getHeight() - insets.top - insets.bottom, 0)).; */ - final GrBoite b = new GrBoite(new GrPoint(0, 0, 0), new GrPoint(getWidth(), getHeight(), 0)); + final GrBoite b = new GrBoite(new GrPoint(0, getHeight(), 0), new GrPoint(getWidth(),0, 0)); + if (insets_ != null) { + b.o_.x_ += insets_.left; + b.o_.y_ = b.o_.y_-(insets_.bottom+insets_.top); + b.e_.x_ =b.e_.x_- (insets_.left + insets_.right); + b.e_.y_ += insets_.top ; + } b.autoApplique(getCalque().getVersReel()); return b; } @@ -681,7 +689,8 @@ */ public void reshape(final int _x, final int _y, final int _width, final int _height) { final Rectangle r = new Rectangle(_x, _y, _width, _height); - if (!r.equals(getBounds())) { + Rectangle bounds = getBounds(); + if (!r.equals(bounds)) { super.reshape(_x, _y, _width, _height); changeMorphismes(); } @@ -737,11 +746,16 @@ } public void setUserInsets(final Insets _insets) { + if (CtuluLib.isEquals(insets_, _insets)) return; Insets old = insets_; insets_ = _insets; firePropertyChange("insets", old, insets_); } + public Insets getUserInsets() { + return (Insets) (insets_ == null ? null : insets_.clone()); + } + public void translateXLeft(final boolean _largeTranslate, final boolean _rapide) { translateX(-getTranslateStep(_largeTranslate), _rapide); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -25,12 +25,12 @@ import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliUIProperties; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.trace.TraceLigne; -import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LinearRing; @@ -46,28 +46,29 @@ boolean drawGrid_; boolean drawX_ = true; boolean drawY_ = true; - Envelope customBounds_; - boolean useCustom_; + // Envelope customBounds_; + // boolean useCustom_; int nbGraduationX_ = 10; int nbGraduationY_ = 10; final BVueCalque vue_; - public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } - public ZCalqueGrille(final BVueCalque _vue) { super(); vue_ = _vue; setDestructible(false); + setName("cqGrille"); setTitle(EbliLib.getS("Grille")); // setForeground(new Color(204, 153, 0)); setForeground(Color.BLACK); } + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } + public void changeZoom(double minx, double miny, double maxx, double maxy) { vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); } @@ -103,7 +104,7 @@ // } // return r; } - + public GrBoite getDomaineOnSelected() { return getDomaine(); } @@ -122,7 +123,7 @@ final GrBoite zv = _clipReel.intersectionXY(domaine); if (zv == null) { return; } - updateBounds(zv); + // updateBounds(zv); final GrBoite targetBoite = new GrBoite(); targetBoite.ajuste(0, 0, 0); // la boite d'affichage @@ -319,26 +320,26 @@ int minYDraw = _ordxAxe; int maxYDraw = (int) _minYForAxe; - if (useCustom_) { - tmp_.y_ = _zv.getMinY(); - if (_yValue.size() > 0) { - tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); - } - tmp_.autoApplique(_versEcran); - tmp_.y_ = Math.floor(tmp_.y_); - if (tmp_.y_ > minYDraw) { - minYDraw = (int) tmp_.y_; - } - tmp_.y_ = _zv.getMaxY(); - if (_yValue.size() > 1) { - tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); - } - tmp_.autoApplique(_versEcran); - tmp_.y_ = Math.ceil(tmp_.y_); - if (tmp_.y_ < maxYDraw) { - maxYDraw = (int) tmp_.y_; - } - } + // if (useCustom_) { + // tmp_.y_ = _zv.getMinY(); + // if (_yValue.size() > 0) { + // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.floor(tmp_.y_); + // if (tmp_.y_ > minYDraw) { + // minYDraw = (int) tmp_.y_; + // } + // tmp_.y_ = _zv.getMaxY(); + // if (_yValue.size() > 1) { + // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.ceil(tmp_.y_); + // if (tmp_.y_ < maxYDraw) { + // maxYDraw = (int) tmp_.y_; + // } + // } tl_.setCouleur(getDrawColor()); tl_.setTypeTrait(TraceLigne.LISSE); tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); @@ -351,26 +352,26 @@ int minXDraw = _absyAxe; int maxXDraw = (int) _maxXForAxe; - if (useCustom_) { - tmp_.x_ = _zv.getMinX(); - if (_xValue.size() > 0) { - tmp_.x_ = Math.min(_xValue.get(0), tmp_.x_); - } - tmp_.autoApplique(_versEcran); - tmp_.x_ = Math.floor(tmp_.x_); - if (tmp_.x_ < minXDraw) { - minXDraw = (int) tmp_.x_; - } - tmp_.x_ = _zv.getMaxX(); - if (_xValue.size() > 1) { - tmp_.x_ = Math.max(_xValue.get(_xValue.size() - 1), tmp_.x_); - } - tmp_.autoApplique(_versEcran); - tmp_.x_ = Math.ceil(tmp_.x_); - if (tmp_.x_ < maxXDraw) { - maxXDraw = (int) tmp_.x_; - } - } + // if (useCustom_) { + // tmp_.x_ = _zv.getMinX(); + // if (_xValue.size() > 0) { + // tmp_.x_ = Math.min(_xValue.get(0), tmp_.x_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.x_ = Math.floor(tmp_.x_); + // if (tmp_.x_ < minXDraw) { + // minXDraw = (int) tmp_.x_; + // } + // tmp_.x_ = _zv.getMaxX(); + // if (_xValue.size() > 1) { + // tmp_.x_ = Math.max(_xValue.get(_xValue.size() - 1), tmp_.x_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.x_ = Math.ceil(tmp_.x_); + // if (tmp_.x_ < maxXDraw) { + // maxXDraw = (int) tmp_.x_; + // } + // } tl_.setCouleur(getDrawColor()); tl_.setTypeTrait(TraceLigne.LISSE); @@ -433,14 +434,14 @@ return yMax; } - private void updateBounds(final GrBoite _zv) { - if (useCustom_ && customBounds_ != null) { - _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); - _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); - _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); - _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); - } - } + // private void updateBounds(final GrBoite _zv) { + // if (useCustom_ && customBounds_ != null) { + // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); + // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); + // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); + // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); + // } + // } // Icon /** @@ -504,6 +505,7 @@ } else { super.setVisible(_v); } + firePropertyChange("grille", true, false); } @@ -514,32 +516,32 @@ public void setDrawGrid(final boolean _drawGrid) { if (_drawGrid != drawGrid_) { drawGrid_ = _drawGrid; - repaint(); + grilleChanged(); } } - public boolean isUseCustom() { - return useCustom_; - } + // public boolean isUseCustom() { + // return useCustom_; + // } + // + // public void setUseCustom(final boolean _useCustom) { + // if (useCustom_ != _useCustom) { + // useCustom_ = _useCustom; + // repaint(); + // } + // } + // + // public Envelope getCustomBounds() { + // return customBounds_ == null ? null : new Envelope(customBounds_); + // } + // + // public void setCustomBounds(final Envelope _customBounds) { + // if (customBounds_ != _customBounds) { + // customBounds_ = _customBounds; + // repaint(); + // } + // } - public void setUseCustom(final boolean _useCustom) { - if (useCustom_ != _useCustom) { - useCustom_ = _useCustom; - repaint(); - } - } - - public Envelope getCustomBounds() { - return customBounds_ == null ? null : new Envelope(customBounds_); - } - - public void setCustomBounds(final Envelope _customBounds) { - if (customBounds_ != _customBounds) { - customBounds_ = _customBounds; - repaint(); - } - } - public boolean isDrawX() { return drawX_; } @@ -547,7 +549,7 @@ public void setDrawX(final boolean _drawX) { if (drawX_ != _drawX) { drawX_ = _drawX; - repaint(); + grilleChanged(); } } @@ -558,21 +560,59 @@ public void setDrawY(final boolean _drawY) { if (drawY_ != _drawY) { drawY_ = _drawY; - repaint(); + grilleChanged(); } } + private void grilleChanged() { + repaint(); + firePropertyChange("grille", true, false); + } + + + + @Override + public EbliUIProperties saveUIProperties() { + final EbliUIProperties res = super.saveUIProperties(); + res.put("graduation.x.nb", getNbXGraduations()); + res.put("graduation.y.nb", getNbYGraduations()); + res.put("graduation.x.visible", isDrawX()); + res.put("graduation.y.visible", isDrawY()); + res.put("grille.visible", isDrawGrid()); + return res; + } + + @Override + public void initFrom(EbliUIProperties _p) { + super.initFrom(_p); + if (_p.isDefined("graduation.x.nb")) { + setNbGraduationX(_p.getInteger("graduation.x.nb")); + } + if (_p.isDefined("graduation.y.nb")) { + setNbGraduationX(_p.getInteger("graduation.y.nb")); + } + if (_p.isDefined("graduation.y.visible")) { + setDrawY(_p.getBoolean("graduation.y.visible")); + } + if (_p.isDefined("graduation.x.visible")) { + setDrawX(_p.getBoolean("graduation.x.visible")); + } + if (_p.isDefined("grille.visible")) { + setDrawGrid(_p.getBoolean("grille.visible")); + } + } + public void setNbGraduationX(final int _nbGraduationX) { if (_nbGraduationX > 0 && nbGraduationX_ != _nbGraduationX) { nbGraduationX_ = _nbGraduationX; - repaint(); + grilleChanged(); } } public void setNbGraduationY(final int _nbGraduationY) { if (_nbGraduationY > 0 && nbGraduationY_ != _nbGraduationY) { nbGraduationY_ = _nbGraduationY; - repaint(); + grilleChanged(); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-01-20 23:25:33 UTC (rev 4387) @@ -3,6 +3,8 @@ Centrer horizontalement=Center horizontally Centrer verticalement=Center vertically Dessiner l'axe=Draw axis +Dessiner l'axe Y=Draw Y axis +Dessiner l'axe X=Draw X axis Nombre de graduation=Number of Scale marks Changer le zoom=Change zoom Appliquer le zoom=Apply zoom Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -1,17 +1,22 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.Insets; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; +import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.BVueCalque; +import org.fudaa.ebli.calque.ZCalqueGrille; import org.fudaa.ebli.calque.ZCalqueSondeInteraction; import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion; import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliUIProperties; import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.repere.RepereEvent; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; @@ -55,38 +60,64 @@ // -- on met a jour le modele de zoom pour toutes les filles en prenant le // dernier widget (= la widget temoin) - ZEbliCalquesPanel pn = listeWidgetCalque_.get(listeWidgetCalque_.size() - 1).calquePanel_; + final ZEbliCalquesPanel pn = listeWidgetCalque_.get(listeWidgetCalque_.size() - 1).calquePanel_; + // le zoom changeAllZoomFrom(pn.getVueCalque()); + // les espaces + changeAllInsetsFrom(pn.getVueCalque()); + // les grilles + registerGrilles(); + changeAllGrilleFrom(pn.getVueCalque()); for (int i = listeWidgetCalque_.size() - 1; i >= 0; i--) { - EbliWidgetVueCalque vue = listeWidgetCalque_.get(i); + final EbliWidgetVueCalque vue = listeWidgetCalque_.get(i); vue.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); + vue.calquePanel_.getVueCalque().addPropertyChangeListener("insets", this); } + getEbliScene().refresh(); - } - private final Object sync = new Object(); + // private final Object sync = new Object(); public void propertyChange(final PropertyChangeEvent _evt) { -// synchronized (sync) { - - if (!noCyclePropertieChange) return; - noCyclePropertieChange = false; - // listeWidgetCalque_.get(0).calquePanel_.getVueCalque().changeViewBoite( - // _source, _boite, _rapide) - final BVueCalque vueCalque = (BVueCalque) _evt.getSource(); - if (getVueInEdition() != vueCalque) { - noCyclePropertieChange = true; - return; - } - // RepereEvent newRepere = (RepereEvent) _evt.getNewValue(); - changeAllZoomFrom(vueCalque); + // synchronized (sync) { + final boolean isRepere = "repere".equals(_evt.getPropertyName()); + // pour eviter de boucler indefiniment + if (!noCyclePropertieChange) return; + noCyclePropertieChange = false; + final BVueCalque vueCalque = (BVueCalque) _evt.getSource(); + if (getVueInEdition() != vueCalque) { noCyclePropertieChange = true; - getEbliScene().refresh(); -// } + return; + } + // RepereEvent newRepere = (RepereEvent) _evt.getNewValue(); + if (isRepere) changeAllZoomFrom(vueCalque); + else changeAllInsetsFrom(vueCalque); + noCyclePropertieChange = true; + getEbliScene().refresh(); + // } } + private PropertyChangeListener grillePropertyChangeListener = new PropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent _evt) { + propertyChangeFromGrille(_evt); + + } + }; + + public void propertyChangeFromGrille(final PropertyChangeEvent _evt) { + // synchronized (sync) { + // pour eviter de boucler indefiniment + final BVueCalque vueCalque = getVueCalque((ZCalqueGrille) _evt.getSource()); + if (getVueInEdition() != vueCalque) { return; } + // RepereEvent newRepere = (RepereEvent) _evt.getNewValue(); + changeAllGrilleFrom(vueCalque); + getEbliScene().refresh(); + // } + } + private BVueCalque getVueInEdition() { for (final Iterator<Widget> it = getChildren().iterator(); it.hasNext();) { final EbliWidgetVueCalque widget = (EbliWidgetVueCalque) ((EbliWidget) it.next()).getIntern(); @@ -95,16 +126,69 @@ return null; } + ZCalqueGrille getGrille(final ZEbliCalquesPanel _panel) { + final BCalque calqueParNom = _panel.getCqInfos().getCalqueParNom("cqGrille"); + return (ZCalqueGrille) (calqueParNom instanceof ZCalqueGrille ? calqueParNom : null); + } + + Map<BVueCalque, ZCalqueGrille> grilles_ = new HashMap<BVueCalque, ZCalqueGrille>(); + + private BVueCalque getVueCalque(ZCalqueGrille _grille) { + for (Map.Entry<BVueCalque, ZCalqueGrille> entry : grilles_.entrySet()) { + if (entry.getValue() == _grille) { return entry.getKey(); } + + } + return null; + } + + private void registerGrilles() { + for (int i = listeWidgetCalque_.size() - 1; i >= 0; i--) { + final EbliWidgetVueCalque vue = listeWidgetCalque_.get(i); + final ZCalqueGrille grille = getGrille(vue.calquePanel_); + if (grille != null) { + grilles_.put(vue.calquePanel_.getVueCalque(), grille); + grille.addPropertyChangeListener("grille", grillePropertyChangeListener); + } + } + } + + private void changeAllGrilleFrom(final BVueCalque vueCalque) { + ZCalqueGrille grille = grilles_.get(vueCalque); + if (grille == null) return; + final EbliUIProperties ui = grille.saveUIProperties(); + for (Map.Entry<BVueCalque, ZCalqueGrille> entry : grilles_.entrySet()) { + if (entry.getKey() != vueCalque) { + entry.getValue().initFrom(ui); + } + + } + + } + private void changeAllZoomFrom(final BVueCalque vueCalque) { + final GrBoite viewBoite = vueCalque.getViewBoite(); for (final Iterator<Widget> it = getChildren().iterator(); it.hasNext();) { final EbliWidgetVueCalque widget = (EbliWidgetVueCalque) ((EbliWidget) it.next()).getIntern(); if (widget.calquePanel_.getVueCalque() != vueCalque) { - widget.setZoom(vueCalque.getViewBoite()); + widget.setZoom(viewBoite); } } } + private void changeAllInsetsFrom(final BVueCalque vueCalque) { + final Insets init = vueCalque.getUserInsets(); + for (final Iterator<Widget> it = getChildren().iterator(); it.hasNext();) { + final EbliWidgetVueCalque widget = (EbliWidgetVueCalque) ((EbliWidget) it.next()).getIntern(); + if (widget.calquePanel_.getVueCalque() != vueCalque) { + widget.calquePanel_.getVueCalque().setUserInsets(init); + widget.clearCacheImage(); + + } + + } + } + /** * Surcharge de la methode de ebli, utilisse pour virer les property change listener */ @@ -113,8 +197,13 @@ EbliWidgetVueCalque widgetCalque; if (child instanceof EbliWidgetVueCalque) widgetCalque = (EbliWidgetVueCalque) child; else widgetCalque = (EbliWidgetVueCalque) ((EbliWidget) child.getChildren().get(0)).getIntern(); - widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("repere", this); - + BVueCalque vueCalque = widgetCalque.calquePanel_.getVueCalque(); + vueCalque.getAbstractCalque().removePropertyChangeListener("repere", this); + vueCalque.getAbstractCalque().removePropertyChangeListener("insets", this); + ZCalqueGrille remove = grilles_.remove(vueCalque); + if (remove != null) { + remove.removePropertyChangeListener("grille", grillePropertyChangeListener); + } } ZCalqueSondeSynchroniserFusion managerSondesFusion_; @@ -159,18 +248,20 @@ managerSondesFusion_.removeAllListenningSonde(); } + @Override public boolean hasSattelite() { return true; } + @Override public List<EbliWidget> getSattelite() { - List<EbliWidget> liste = new ArrayList<EbliWidget>(); + final List<EbliWidget> liste = new ArrayList<EbliWidget>(); for (int i = listeWidgetCalque_.size() - 1; i >= 0; i--) { - EbliWidgetVueCalque vue = listeWidgetCalque_.get(i); + final EbliWidgetVueCalque vue = listeWidgetCalque_.get(i); if (vue.hasSattelite()) liste.addAll(vue.getSattelite()); } return liste; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -3,6 +3,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.Insets; import java.awt.Rectangle; import java.awt.Window; import java.awt.image.BufferedImage; @@ -103,6 +104,8 @@ final Widget widget, final BuPanel editor, final boolean commit) { editingStop(); setZoom(calquePanel_.getVueCalque().getViewBoite()); + //le zoom n'a pas chang\xE9. +// zoomChanged_=false; getEbliScene().refresh(); } @@ -121,6 +124,8 @@ } private void initSize(final Rectangle rec) { + calquePanel_.setSize(rec.width, rec.height); + calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); final BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); calquePanel_.getVueCalque().setSize(rec.width, rec.height); // calquePanel_.setPreferredSize(new Dimension(rec.width, rec.height)); @@ -139,6 +144,7 @@ } boolean zoomChanged_ = true; + @Override protected void paintWidget() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -15,6 +15,7 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsBuilder; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -40,6 +41,8 @@ updateRes(); } + + public void replayData(EGGrapheTreeModel _model, Map _infos, CtuluUI _impl) {} public int getActiveTimeIdx() { return 0; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -95,12 +95,6 @@ return r; } - private void addXYLAbels(final BuPanel pnXY) { - pnXY.add(new BuLabel("")); - pnXY.add(new BuLabel("X")); - pnXY.add(new BuLabel("Y")); - } - @Override public JComponent buildContentPane() { final BuPanel content = new BuPanel(new BuVerticalLayout(2)); @@ -110,9 +104,12 @@ return content; } - private void buildDrawAxes(final BuPanel _pn) { - _pn.add(new BuLabel(EbliLib.getS("Dessiner l'axe"))); - final BuCheckBox cbX = new BuCheckBox(); + private BuPanel createAxis() { + final BuPanel pnXY = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); + pnXY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axes"))); + pnXY.add(new BuLabel("")); + pnXY.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe X")); cbX.setSelected(target_.isDrawX()); cbX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -120,23 +117,10 @@ } }); - _pn.add(cbX); - final BuCheckBox cbY = new BuCheckBox(); - cbY.setSelected(target_.isDrawY()); - cbY.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setDrawY(cbY.isSelected()); - } - - }); - _pn.add(cbY); - } - - private void buildGraduation(final BuPanel _pn) { + pnXY.add(cbX); final BuTextField btGraduationX = BuTextField.createIntegerField(); - _pn.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); btGraduationX.setValue(new Integer(target_.getNbXGraduations())); - _pn.add(btGraduationX); + pnXY.add(btGraduationX); btGraduationX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -150,9 +134,20 @@ } }); + + final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe Y")); + cbY.setSelected(target_.isDrawY()); + cbY.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + target_.setDrawY(cbY.isSelected()); + } + + }); + pnXY.add(cbY); + final BuTextField btGraduationY = BuTextField.createIntegerField(); btGraduationY.setValue(new Integer(target_.getNbYGraduations())); - _pn.add(btGraduationY); + pnXY.add(btGraduationY); btGraduationY.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -166,14 +161,6 @@ } }); - } - - private BuPanel createAxis() { - final BuPanel pnXY = new BuPanel(new BuGridLayout(3, 3, 3, false, false, false, false, false)); - pnXY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axes"))); - addXYLAbels(pnXY); - buildDrawAxes(pnXY); - buildGraduation(pnXY); return pnXY; } @@ -235,12 +222,14 @@ private BuPanel createZoom() { final BuPanel select = new BuPanel(new BuGridLayout(3, 3, 3, false, false, false, false, false)); - addXYLAbels(select); + select.add(new BuLabel(EbliLib.getS(""))); select.add(new BuLabel(EbliLib.getS("Min"))); - final BuTextField tfMinX = addDoubleText(select); - final BuTextField tfMinY = addDoubleText(select); select.add(new BuLabel(EbliLib.getS("Max"))); + select.add(new BuLabel(EbliLib.getS("X"))); + final BuTextField tfMinX = addDoubleText(select); final BuTextField tfMaxX = addDoubleText(select); + select.add(new BuLabel(EbliLib.getS("Y"))); + final BuTextField tfMinY = addDoubleText(select); final BuTextField tfMaxY = addDoubleText(select); final BuPanel zoom = new BuPanel(new BuVerticalLayout(3, false, false)); zoom.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Changer le zoom"))); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-20 19:35:40 UTC (rev 4386) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-20 23:25:33 UTC (rev 4387) @@ -7,44 +7,29 @@ */ package org.fudaa.fudaa.tr.post; -import java.awt.Dimension; -import java.awt.Rectangle; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; -import javax.swing.JScrollPane; - import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.CtuluUI; -import org.fudaa.ctulu.collection.CtuluArrayDouble; -import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.calque.BArbreCalque; -import org.fudaa.ebli.calque.BCalque; -import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.visuallibrary.EbliWidget; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeTime; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeModel; import org.fudaa.fudaa.tr.common.TrResource; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuBorders; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuScrollPane; import com.memoire.fu.FuLog; import com.vividsolutions.jts.geom.Coordinate; @@ -104,13 +89,15 @@ @Override protected void updateY() { createY(); - for (int i = 0; i < y_.length; i++) { - final EfData data = source_.getData(var_, i); + //pour chaque pas de temps + for (int tIdx = 0; tIdx < y_.length; tIdx++) { + //on recupere la valeur + final EfData data = source_.getData(var_, tIdx); if (data == null) { FuLog.warning("TRP: data is null for " + var_); - }else - super.y_[i] = ptIdx_.getInterpolateValue(getVar(), data, i, source_); + //on interpole + super.y_[tIdx] = ptIdx_.getInterpolateValue(var_, data, tIdx, source_); } } @@ -208,7 +195,7 @@ // if (data == null) { // FuLog.warning("TRP: data is null for " + var_); try { - super.y_[i] = source_.getData(var_, i, ptIdx_); + y_[i] = source_.getData(var_, i, ptIdx_); } catch (final IOException e) { FuLog.error(e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-19 19:40:46
|
Revision: 4383 http://fudaa.svn.sourceforge.net/fudaa/?rev=4383&view=rev Author: hadouxad Date: 2009-01-19 19:40:40 +0000 (Mon, 19 Jan 2009) Log Message: ----------- am?\195?\169liorations lot 3, am?\195?\169liorations Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.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/FudaaCourbeDefautModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -764,4 +764,27 @@ return pn_; } +public List<EbliActionInterface> getSelectedNavigationAndStandardActionGroup() { + final List<EbliActionInterface> actions = new ArrayList<EbliActionInterface>(); + if(this.selectedActionGroup_==null) + buildButtonGroupSelection(); + if(this.navigationActionGroup_==null) + buildButtonGroupNavigation(); + if(this.standardActionGroup_==null) + buildButtonGroupStandard(); + + actions.addAll(Arrays.asList(selectedActionGroup_)); + actions.add(null); + actions.addAll(Arrays.asList(navigationActionGroup_)); + actions.add(null); + if (!CtuluLibArray.isEmpty(standardActionGroup_)) { + actions.addAll(Arrays.asList(standardActionGroup_)); + } + + + return actions; } + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -112,6 +112,22 @@ public void modifieExtremite(Point newPoint, int position){ if(position>ExtremiteDroite || points_==null)return; + //-- cas particulier si on deplace la queue --// + if(position==ExtremiteQueue && points_[position]!=null && points_[ExtremiteGauche]!=null && points_[ExtremiteDroite]!=null && points_[position]!=points_[ExtremiteQueue]){ + //-- on deplace les arcs selon la meme translation + int translationX=points_[ExtremiteQueue].x-newPoint.x; + int translationY=points_[ExtremiteQueue].y-newPoint.y; + + //-- on applique la translation aux arretes --// + points_[ExtremiteGauche].x+=translationX; + points_[ExtremiteGauche].y+=translationY; + points_[ExtremiteDroite].x+=translationX; + points_[ExtremiteDroite].y+=translationY; + + + } + + points_[position]=newPoint; repaint(); } @@ -188,8 +204,8 @@ } //-- on trace le segment tete/gauche --// - if(getExtremiteTete()!=null && getExtremiteGauche()!=null){ - traceligne.dessineTrait(g2d, getExtremiteTete().x, getExtremiteTete().y, getExtremiteGauche().x,getExtremiteGauche().y); + if(getExtremiteQueue()!=null && getExtremiteGauche()!=null){ + traceligne.dessineTrait(g2d, getExtremiteQueue().x, getExtremiteQueue().y, getExtremiteGauche().x,getExtremiteGauche().y); }else{ // pas de segment complet, on trace juste les points existants if(getExtremiteGauche()!=null) @@ -197,8 +213,8 @@ } //-- on trace le segment tete/droite --// - if(getExtremiteTete()!=null && getExtremiteDroite()!=null){ - traceligne.dessineTrait(g2d, getExtremiteTete().x, getExtremiteTete().y, getExtremiteDroite().x,getExtremiteDroite().y); + if(getExtremiteQueue()!=null && getExtremiteDroite()!=null){ + traceligne.dessineTrait(g2d, getExtremiteQueue().x, getExtremiteQueue().y, getExtremiteDroite().x,getExtremiteDroite().y); }else{ // pas de segment complet, on trace juste les points existants if(getExtremiteDroite()!=null) @@ -231,6 +247,21 @@ _g.setColor(Color.GREEN); _g.fillRect(positionDeplacement_.x-3,positionDeplacement_.y-3,6,6); + //-- on dessine la droite qui va etre deplac\xE9e + int positionDroite=-1; + if(positionPointToMove_==ExtremiteTete) + positionDroite=ExtremiteQueue; + if(positionPointToMove_==ExtremiteQueue) + positionDroite=ExtremiteTete; + if(positionPointToMove_==ExtremiteDroite) + positionDroite=ExtremiteQueue; + if(positionPointToMove_==ExtremiteGauche) + positionDroite=ExtremiteQueue; + + + _g.drawLine(points_[positionDroite].x, points_[positionDroite].y, positionDeplacement_.x, positionDeplacement_.y); + + } @@ -446,8 +477,8 @@ model_=new TraceLigneModel(); modifieExtremite(new Point((int)(getWidth()-model_.getEpaisseur()),(int)(getHeight()/2.0-model_.getEpaisseur()/2.0)), ExtremiteTete); modifieExtremite(new Point((int)(0+model_.getEpaisseur()),(int)(getHeight()/2.0-model_.getEpaisseur()/2.0)), ExtremiteQueue); - modifieExtremite(new Point((int)(2.0/3.0*getWidth()),(int)(model_.getEpaisseur())), ExtremiteDroite); - modifieExtremite(new Point((int)(2.0/3.0*getWidth()),(int)(getHeight()-model_.getEpaisseur())), ExtremiteGauche); + modifieExtremite(new Point((int)(1.0/3.0*getWidth()),(int)(model_.getEpaisseur())), ExtremiteDroite); + modifieExtremite(new Point((int)(1.0/3.0*getWidth()),(int)(getHeight()-model_.getEpaisseur())), ExtremiteGauche); repaint(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionAfficheOrigineCourbe.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -20,7 +20,7 @@ /** * Action utilis\xE9e uniquement pour les courbes unitaires (accessible via clic droit sur la courbe). - * @author genesis + * @author Adrien Hadoux * */ public static class CourbeOnly extends EGActionAfficheOrigineCourbe{ Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -0,0 +1,73 @@ +package org.fudaa.ebli.courbe; + +import java.awt.event.ActionEvent; +import java.util.HashMap; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; + +/** + * Classe qui permet de rejouer els actions pour une courbe s\xE9lectionn\xE9e. + * Cette action est automatiquement ajout\xE9e dans le EGspecificAction qui liste les actions des courbes (asscessible via clic droit). + * Permet de rejouer les donn\xE9es des courbes. + * Il suffit de surcharger la methode replayData() de EGModel dans le model de courbe d\xE9sir\xE9. + * @author Adrien Hadoux + * + */ +public class EGActionReplayDataCourbe extends EbliActionSimple{ + + /** + * Action utilis\xE9e uniquement pour les courbes unitaires (accessible via clic droit sur la courbe). + * @author Adrien Hadoux + * + */ + public static class CourbeOnly extends EGActionReplayDataCourbe{ + EGModel model_; + EGGrapheTreeModel treemodel_; + public CourbeOnly(EGGrapheTreeModel treemodel,EGModel model,CtuluUI _impl){ + super(); + model_=model; + impl_=_impl; + treemodel_=treemodel; + } + public void actionPerformed(ActionEvent _e) { + if(model_!=null) + model_.replayData( treemodel_,new HashMap(),impl_); + } + } + + EGFillePanel panelGraphe_; + CtuluUI impl_; + EGGrapheTreeModel treemodel_; + public EGActionReplayDataCourbe(EGFillePanel _panel,CtuluUI _impl) { + this(); + panelGraphe_=_panel; + impl_=_impl; + treemodel_=(EGGrapheTreeModel)_panel.getModel(); + } + public EGActionReplayDataCourbe() { + super(EbliResource.EBLI.getString("Rejouer"),EbliResource.EBLI.getIcon("restore"), "REPLAYDATA"); + } + @Override + public void actionPerformed(ActionEvent _e) { + + if(panelGraphe_.getGraphe().getSelectedComponent()==null || !(panelGraphe_.getGraphe().getSelectedComponent() instanceof EGCourbe)){ + impl_.error(EbliResource.EBLI.getString("Aucune courbe s\xE9lectionn\xE9e"),EbliResource.EBLI.getString("Aucune courbe s\xE9lectionn\xE9e"),true); + return; + }else if(panelGraphe_.getGraphe().getSelectedComponent().getModel()==null || !(panelGraphe_.getGraphe().getSelectedComponent().getModel() instanceof EGModel)){ + impl_.error(EbliResource.EBLI.getString("Aucune courbe s\xE9lectionn\xE9e"),EbliResource.EBLI.getString("Aucune courbe s\xE9lectionn\xE9e"),true); + return; + } + + //-- on recupere la courbe selectionnee dans le graphe --// + + EGModel modelSelectionne=panelGraphe_.getGraphe().getSelectedComponent().getModel(); + + modelSelectionne.replayData(treemodel_,new HashMap(),impl_); + + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -16,6 +16,7 @@ import org.fudaa.ctulu.CtuluUI; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; + /** * @author Fred Deniger * @version $Id: EGCourbeModelDefault.java,v 1.17 2007-05-22 14:19:04 deniger Exp $ @@ -232,6 +233,12 @@ public void setPersistSpecificDatas(Object _data, Map _infos) {} + +public void replayData(EGGrapheTreeModel model,Map infos, CtuluUI impl) { + // TODO Auto-generated method stub + +} + //@Override //public String getUnite() { // // TODO Auto-generated method stub Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -13,6 +13,7 @@ import javax.swing.JComboBox; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUI; import org.fudaa.ebli.commun.EbliActionInterface; import java.util.List; @@ -186,7 +187,7 @@ * Par exemple dans tr, le TrPostCourbeTreeModel retourne des actions d'ajout de variables pour les \xE9volutions temporelles. * @return */ - public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target); + public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui); } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -29,6 +29,7 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluUI; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliLib; @@ -811,7 +812,7 @@ } -public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target) { +public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { // TODO Auto-generated method stub return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -32,6 +32,7 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; import org.fudaa.ctulu.gui.CtuluTreeComboboxRenderer; import org.fudaa.ebli.commun.EbliActionInterface; @@ -1133,7 +1134,7 @@ } -public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target) { +public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { // TODO Auto-generated method stub return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -200,7 +200,17 @@ */ void viewGenerationSource(Map infos, CtuluUI impl); + + /** + * Methode qui une fois appel\xE9e se charge de creer un module ou interface qui permet de rejouer les donn\xE9es de la courbe. + * @param infos + * @param CtuluUI: l'implementation dans laquelle afficher les informations + */ + void replayData(EGGrapheTreeModel model, Map infos, CtuluUI impl); + + + /** * retourner les infos persistantes de la courbe du mod\xE8le. */ Object getPersistSpecificDatas(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -137,8 +137,12 @@ //-- action origine de la courbe. --// menu_.add(new EGActionAfficheOrigineCourbe.CourbeOnly(courbe.getModel(),ui_)); - if(target_.getModel().getSpecificsActionsCurvesOnly(target_)!=null) - for(EbliActionInterface action:target_.getModel().getSpecificsActionsCurvesOnly(target_)) + //-- action replay data --// + // menu_.add(new EGActionReplayDataCourbe.CourbeOnly(courbe.getModel(),ui_)); + + + if(target_.getModel().getSpecificsActionsCurvesOnly(target_,ui_)!=null) + for(EbliActionInterface action:target_.getModel().getSpecificsActionsCurvesOnly(target_,ui_)) menu_.add(action); } 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-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -29,6 +29,7 @@ import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.courbe.EGActionAfficheOrigineCourbe; +import org.fudaa.ebli.courbe.EGActionReplayDataCourbe; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; @@ -515,6 +516,8 @@ BuPanel panelBoutons=new BuPanel(new FlowLayout(FlowLayout.LEFT)); EGActionAfficheOrigineCourbe origine=new EGActionAfficheOrigineCourbe(getGraphePanel(),getWidget().getEbliScene().getCtuluUi()); panelBoutons.add(origine.buildButton(EbliComponentFactory.INSTANCE)); + EGActionReplayDataCourbe replayData=new EGActionReplayDataCourbe(getGraphePanel(),getWidget().getEbliScene().getCtuluUi()); + panelBoutons.add(replayData.buildButton(EbliComponentFactory.INSTANCE)); BuPanel miseEnPage=new BuPanel(new BorderLayout()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -15,6 +15,7 @@ import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluUI; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.fudaa.commun.FudaaLib; @@ -180,4 +181,8 @@ public void viewGenerationSource(Map infos, CtuluUI impl){ } + public void replayData(EGGrapheTreeModel model,Map infos, CtuluUI impl) { + // TODO Auto-generated method stub + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -14,6 +14,7 @@ import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -223,4 +224,8 @@ public void viewGenerationSource(Map infos, CtuluUI impl){ } + public void replayData(EGGrapheTreeModel model,Map infos, CtuluUI impl) { + // TODO Auto-generated method stub + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -42,6 +42,8 @@ import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.courbe.EGActionReplayDataCourbe; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGCourbeChild; @@ -58,6 +60,7 @@ import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; import org.fudaa.fudaa.tr.post.ScopCourbeTreeModel; + import org.fudaa.fudaa.tr.post.TrPostCourbeModel; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; @@ -820,5 +823,20 @@ //-- remplissage du model avec les datas--// dataPersistante.fillModelWithData(this,Params); } + + + /** + * Les actions des courbes specifiques: l'ajout de variable. + */ + public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { + List<EbliActionInterface> listeActions=new ArrayList<EbliActionInterface>(); + + + //-- action replay data --// + listeActions.add(new EGActionReplayDataCourbe.CourbeOnly(this,this.getSelectedComponent().getModel(),ui)); + return listeActions; + + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -5,12 +5,16 @@ import java.util.List; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.courbe.EGActionReplayDataCourbe; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheDuplicator; import org.fudaa.ebli.courbe.EGGrapheModel; import org.fudaa.ebli.courbe.EGGroup; @@ -137,5 +141,18 @@ public String getSelectedSpecificCourbeInfos(){ return null; } + + /** + * Les actions des courbes specifiques: l'ajout de variable. + */ + public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { + List<EbliActionInterface> listeActions=new ArrayList<EbliActionInterface>(); + + + //-- action replay data --// + listeActions.add(new EGActionReplayDataCourbe.CourbeOnly(this,this.getSelectedComponent().getModel(),ui)); + return listeActions; + + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -36,6 +36,7 @@ import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.visuallibrary.EbliWidget; + import org.fudaa.fudaa.commun.courbe.FudaaCourbeTime; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeModel; import org.fudaa.fudaa.tr.common.TrResource; @@ -446,6 +447,8 @@ */ public abstract boolean replayData(TrPostSource src,H2dVariableType var,EGGroup groupe,Map infos); + + public void setPersistSpecificDatas(Object data, Map infos) { if(data ==null || !(data instanceof ArrayList))return; @@ -534,4 +537,17 @@ TrReplayCurvesData.getInstance().constructEvolTemporelleOrigine(this, implementation); } + + public void replayData(org.fudaa.ebli.courbe.EGGrapheTreeModel model,Map infos, CtuluUI impl) { + if(!(impl instanceof TrPostCommonImplementation)){ + impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); + return; + } + TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; + + //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// + TrReplayCurvesData.getInstance().constructEvolTemporelleReplayData((TrPostCourbeTreeModel)model, this, implementation); + + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -25,6 +25,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; import org.fudaa.ctulu.gis.GISPrecision; @@ -32,6 +33,7 @@ import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.courbe.EGActionReplayDataCourbe; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; @@ -1071,12 +1073,13 @@ /** * Les actions des courbes specifiques: l'ajout de variable. */ - public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target) { + public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { List<EbliActionInterface> listeActions=new ArrayList<EbliActionInterface>(); //-- action d'ajout des variables --// listeActions.add(new TrPostCourbeAddVariableAction(projet_.impl_, _target)); - + //-- action replay data --// + listeActions.add(new EGActionReplayDataCourbe.CourbeOnly(this,this.getSelectedComponent().getModel(),ui)); return listeActions; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -1,35 +1,74 @@ package org.fudaa.fudaa.tr.post; +import java.awt.BorderLayout; +import java.awt.Checkbox; import java.awt.Color; +import java.awt.Component; import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridLayout; import java.awt.Rectangle; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import java.util.Vector; +import javax.swing.AbstractButton; import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.JToolBar; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; +import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.gis.GISZoneCollectionPoint; import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.calque.BCalquePaletteInfo; +import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.ZCalquePoint; +import org.fudaa.ebli.calque.ZCalqueSondeInteraction; +import org.fudaa.ebli.calque.action.CalqueActionSonde; +import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; import org.fudaa.ebli.calque.edition.ZModelePointEditable; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliActionPaletteAbstract; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.controle.BSelecteurListComboBox; import org.fudaa.ebli.courbe.EGModel; +import org.fudaa.ebli.palette.BPaletteInfo; import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.fudaa.meshviewer.profile.MVProfileCourbeModel; import org.fudaa.fudaa.sig.layer.FSigEditor; +import org.fudaa.fudaa.sig.layer.FSigLayerGroup; import org.fudaa.fudaa.sig.layer.FSigLayerPointEditable; import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.data.TrGisProjectEditor; +import org.openide.util.actions.Presenter.Toolbar; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuBorders; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuList; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuToolBar; +import com.memoire.fu.FuComparator; +import com.sun.corba.se.impl.ior.NewObjectKeyTemplateBase; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.LineString; @@ -56,6 +95,8 @@ private TrPostSource srcMemoire_; + private Checkbox ecraser_=new Checkbox("Ecraser la courbe cible",true); + public static TrReplayCurvesData getInstance(){ if(instance_==null) @@ -71,7 +112,7 @@ * @param src * @return */ - private TrPostVisuPanel createVue2d(TrPostCommonImplementation implementation,TrPostSource src){ + private TrPostVisuPanel constructVue2d(TrPostCommonImplementation implementation,TrPostSource src){ //-- petite optimisation --// if(srcMemoire_!=null && memoire_!=null && srcMemoire_==src) return memoire_; @@ -79,7 +120,7 @@ BCalqueLegende legende=new BCalqueLegende(); TrPostVisuPanel vue2d=new TrPostVisuPanel(implementation,implementation.c_,legende,src); vue2d.removeCalqueLegend(); - + vue2d.restaurer(); Rectangle rec=new Rectangle(300,300); vue2d.setPreferredSize(new Dimension(300,300)); @@ -94,28 +135,140 @@ return vue2d; } + BSelecteurListComboBox comboVar_=null; + + + + public JToolBar constructToolBarVue2d(TrPostVisuPanel vue2d){ + JToolBar toolbarCalque = new BuToolBar(); + AbstractButton boutonSelection=null; + //final EbliActionInterface[] actions =vue2d.getController().getSelectedNavigationAndStandardActionGroup(); + final List actions = vue2d.getController().getSelectedNavigationAndStandardActionGroup(); + int i=0; + for (final Iterator iterator = actions.iterator(); iterator.hasNext();) { + // for (int i=0;i<actions.length;i++) { + final EbliActionInterface object = (EbliActionInterface) iterator.next();//actions[i]; + if (object == null) { + toolbarCalque.addSeparator(); + } else { + + if(i==0){ + boutonSelection=object.buildToolButton(EbliComponentFactory.INSTANCE); + toolbarCalque.add(boutonSelection); + }else + toolbarCalque.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + i++; + } + + //-- ajout de l'action sonde --// + final ZCalqueSondeInteraction sonde = vue2d.getController().addCalqueSondeInteraction(); + toolbarCalque.add(new CalqueActionSonde(sonde, vue2d.getArbreCalqueModel())); + + //-- activer par d\xE9faut l'action selection de points --// + if(boutonSelection!=null) + boutonSelection.doClick(); + + + + //-- ajout des variables + pas de temps --// + if(comboVar_!=null) + vue2d.getArbreCalqueModel().getTreeSelectionModel().removeTreeSelectionListener(comboVar_); + comboVar_ = new BSelecteurListComboBox(); + vue2d.getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(comboVar_); + comboVar_.setPalettePanelTarget(vue2d.getArbreCalqueModel().getSelectedCalque()); + comboVar_.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,100),comboVar_.getPreferredSize().height)); + comboVar_.getCb().setMaximumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,100),comboVar_.getPreferredSize().height)); + comboVar_.getCb().setMinimumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,100),comboVar_.getPreferredSize().height)); + toolbarCalque.add(comboVar_); + + //-- construction de la liste des pas de temps --// + final EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(vue2d.getArbreCalqueModel() + .getTreeSelectionModel(), true); + // pour activer l'action + chooserT.setSelected(true); + final BSelecteurListComboBox combo = (BSelecteurListComboBox) chooserT.buildContentPane(); + chooserT.updateBeforeShow(); + combo.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,100),comboVar_.getPreferredSize().height)); + combo.getCb().setMaximumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,100),comboVar_.getPreferredSize().height)); + combo.getCb().setMinimumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,100),comboVar_.getPreferredSize().height)); + + toolbarCalque.add(combo); + + return toolbarCalque; + + } + /** * Cree la dialog qui affiche tout le contenu d'origine du graphe. * @param vue2d * @param implementation * @param modele */ - private void createDialogOrigine(TrPostVisuPanel vue2d, TrPostCommonImplementation implementation, EGModel modele,JComponent composantAdditionnel){ - //final JScrollPane arbreVue2d = new JScrollPane(new BArbreCalque(vue2d.getArbreCalqueModel())); + private CtuluDialogPanel constructDialog(TrPostVisuPanel vue2d, TrPostCommonImplementation implementation, EGModel modele,JComponent composantAdditionnel,boolean modeEdition,String title){ implementation.createTask(TrResource.getS("Origine ")+" "+modele.getTitle()); 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(vue2d,BuBorderLayout.CENTER); + + + if(composantAdditionnel!=null) pn.add(composantAdditionnel,BuBorderLayout.EAST); - //pn.add(arbreVue2d,BuBorderLayout.EAST); - pn.add(vue2d.getLabelSuiviSouris(),BuBorderLayout.SOUTH); - pn.afficheModale(implementation.getParentComponent(), TrResource.getS("Origine ")+" "+modele.getTitle()); + JPanel panelSouth=new JPanel(new FlowLayout(FlowLayout.LEFT)); + panelSouth.add(vue2d.getLabelSuiviSouris()); - implementation.clearMainProgression(); + JPanel panelTotalSouth=new JPanel(new GridLayout(2,1)); + + if(title!=null){ + panelTotalSouth.add(new JLabel(title)); + }else + panelTotalSouth.add(new JLabel("")); + + panelTotalSouth.add(panelSouth); + + pn.add(panelTotalSouth,BuBorderLayout.SOUTH); + + if(modeEdition){ + + //-- ajout de la toolbar --// + pn.add(constructToolBarVue2d(vue2d),BorderLayout.NORTH); + + //-- ajout de la palette d'infos --// + final Collection<EbliActionPaletteAbstract> acts =vue2d.getController().getTabPaletteAction(); + BPaletteInfo comp=null; + for (final EbliActionPaletteAbstract pals : acts) { + final JComponent component = pals.buildContentPane(); + if (component instanceof BCalquePaletteInfo) { + comp=(BPaletteInfo) component; + comp.setAvailable(true); + comp.updateState(); + pals.setEnabled(true); + pals.updateBeforeShow(); + // comp.setMaximumSize(new Dimension(180,300)); + // comp.setPreferredSize(new Dimension(180,300)); + pn.add(comp,BuBorderLayout.EAST); + + } + } + panelSouth.add(this.ecraser_); + //final JScrollPane arbreVue2d = new JScrollPane(new BArbreCalque(vue2d.getArbreCalqueModel())); + //arbreVue2d.setPreferredSize(new Dimension(200,300)); + //arbreVue2d.setMaximumSize(new Dimension(200,300)); + //pn.add(arbreVue2d,BuBorderLayout.WEST); + + + + } + + + + return pn; + + } /** @@ -125,7 +278,7 @@ public void constructEvolTemporelleOrigine(TrPostCourbeModel modele,TrPostCommonImplementation implementation){ //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrPostVisuPanel vue2d=createVue2d(implementation,modele.source_); + TrPostVisuPanel vue2d=constructVue2d(implementation,modele.source_); //-- on affiche sur la vue 2d les points initialement choisis --// GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); @@ -135,29 +288,29 @@ //point reel int indiceNoeud=((Integer) point).intValue(); // recherche du point cot\xE9 grille - coordonneesPoint=modele.source_.getGrid().getCoor(indiceNoeud); - + coordonneesPoint=modele.source_.getGrid().getCoor(indiceNoeud); + }else{ TrPostInterpolatePoint pt=(TrPostInterpolatePoint) point; coordonneesPoint=new Coordinate(pt.x_,pt.y_,0); } //-- ajout des coordonnees --// collectionPoint.add(coordonneesPoint.x, coordonneesPoint.y,0); - - + + ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); //-- creation du calque -// FSigEditor editeur=new FSigEditor(vue2d,vue2d.getCmdMng()); -// FSigLayerPointEditable layer=new FSigLayerPointEditable(modelePointEdit,editeur); -// editeur.getFrame().setVisible(true); - - -// FSigLayerPointEditable layer2=new FSigLayerPointEditable(); -// layer2.addAtome((int)coordonneesPoint.x, (int)coordonneesPoint.y, vue2d.getCmdMng(), implementation); -// layer2.setVisible(true); -// vue2d.addCalque(layer2, true); - + // FSigEditor editeur=new FSigEditor(vue2d,vue2d.getCmdMng()); + // FSigLayerPointEditable layer=new FSigLayerPointEditable(modelePointEdit,editeur); + // editeur.getFrame().setVisible(true); + + + // FSigLayerPointEditable layer2=new FSigLayerPointEditable(); + // layer2.addAtome((int)coordonneesPoint.x, (int)coordonneesPoint.y, vue2d.getCmdMng(), implementation); + // layer2.setVisible(true); + // vue2d.addCalque(layer2, true); + ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); //calqueZ.setVisible(true); //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); @@ -165,12 +318,16 @@ vue2d.addCalque(calqueZ, true); calqueZ.setVisible(true); //-- on affiche le contenu dans une dialog--// - createDialogOrigine(vue2d, implementation, modele,null); + constructDialog(vue2d, implementation, modele,null,false,TrResource.getS("Origine ")+" "+modele.getTitle()+". Le point est encadr\xE9 en bleu").afficheModale(implementation.getParentComponent(), TrResource.getS("Origine ")+" "+modele.getTitle());; } - + /** + * Affiche une dialog avec une vue 2d qui affiche l'ensemble des points de la polyligne utilis\xE9e pour la construction du graphe. + * @param modele + * @param implementation + */ public void constructProfilSpatialOrigine(MVProfileCourbeModel modele,TrPostCommonImplementation implementation){ if(modele.getData() instanceof TrPostSource){} @@ -182,9 +339,9 @@ implementation.error(TrResource.getS("Erreur"), TrResource.getS("Impossible de r\xE9cup\xE9rer la polyligne"), true); return; } - + //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrPostVisuPanel vue2d=createVue2d(implementation,(TrPostSource)modele.getData()); + TrPostVisuPanel vue2d=constructVue2d(implementation,(TrPostSource)modele.getData()); //-- on affiche sur la vue 2d les points initialement choisis --// GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); @@ -195,11 +352,11 @@ collectionPoint.add(listePoints.getCoordinateN(i).x,listePoints.getCoordinateN(i).y,0); dataP[i][0]=listePoints.getCoordinateN(i).x; dataP[i][1]=listePoints.getCoordinateN(i).y; - + } ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); - + ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); //calqueZ.setVisible(true); //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); @@ -221,13 +378,164 @@ JScrollPane pane=new JScrollPane(tableauVal); //pane.setMaximumSize(new Dimension(200,300)); pane.setPreferredSize(new Dimension(200,300)); + + constructDialog(vue2d, implementation, modele,pane,false,TrResource.getS("Origine ")+" "+modele.getTitle()+". Les points de la polyligne sont encadr\xE9s en bleu").afficheModale(implementation.getParentComponent(), TrResource.getS("Origine ")+" "+modele.getTitle());; + + } + + + + /** + * Constructeur d'une dialog qui affiche la vue 2d avec le point initial qui a servi a la creation du modele. + * Ajoute \xE9galement la liste des variables \xE0 choisir. Il est possible dans la vue de s\xE9lectionner un autre point ou plusieurs. + * LA validation de la frame permettra de r\xE9cup\xE9rer les nouveaux point ainsi que les variables qui seront utilis\xE9es pour refaire le calcul. + * @param modele + */ + public void constructEvolTemporelleReplayData(TrPostCourbeTreeModel treeModel,TrPostCourbeModel modele,TrPostCommonImplementation implementation){ + + //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// + TrPostVisuPanel vue2d=constructVue2d(implementation,modele.source_); + + //-- on affiche sur la vue 2d les points initialement choisis --// + GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); + Object point=modele.getSelectionPoint(); + Coordinate coordonneesPoint=null; + if(point instanceof Integer){ + //point reel + int indiceNoeud=((Integer) point).intValue(); + // recherche du point cot\xE9 grille + coordonneesPoint=modele.source_.getGrid().getCoor(indiceNoeud); + + }else{ + TrPostInterpolatePoint pt=(TrPostInterpolatePoint) point; + coordonneesPoint=new Coordinate(pt.x_,pt.y_,0); + } + //-- ajout des coordonnees --// + collectionPoint.add(coordonneesPoint.x, coordonneesPoint.y,0); + + + ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); + + //-- creation du calque + FSigLayerPointEditable layer2=new FSigLayerPointEditable(modelePointEdit,vue2d.getGisEditor()); + layer2.setVisible(true); + layer2.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,5,Color.RED)); + layer2.setEnabled(true); + + + //groupeCalque.addPointLayerAct("Origine", new GISZoneCollectionPoint()); + BCalque resultatsCalque=vue2d.getCalqueActif(); + vue2d.addCalque(layer2, true); + vue2d.setCalqueActif(resultatsCalque); + //vue2d.addCalque(layer2, true); + + // ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); + // //calqueZ.setVisible(true); + // //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); + // calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); + // vue2d.addCalque(calqueZ, true); + // calqueZ.setVisible(true); + + //-- creation du panel de choix des variables a selectionner --// + + //-- on affiche le contenu dans une dialog--// + //final Set var = new HashSet(Arrays.asList(modele.source_.getAllVariablesNonVec())); + //final H2dVariableType[] vars = (H2dVariableType[]) var.toArray(new H2dVariableType[var.size()]); + String title=TrResource.getS("Choisir le point et la variable qui seront utilis\xE9s pour refaire le calcul(interpolation possible). Le point rouge d\xE9signe le point d'origine."); - createDialogOrigine(vue2d, implementation, modele,pane); + CtuluDialogPanel dialog=constructDialog(vue2d, implementation, modele,/*constructSelectorVariable(vars)*/null,true,title); + + //-- on restaure la vue --// + vue2d.setSize(300, 300); + vue2d.restaurer(); + + //-- on affiche tant que l'utilisateur valide des r\xE9sultats faux --// + while(CtuluDialogPanel.isOkResponse(dialog.afficheModale(implementation.getParentComponent(), TrResource.getS("Rejouer ")+" "+modele.getTitle())) && !replayEvolutionFor(vue2d,treeModel,modele,implementation)){ + + } + + } - + /** + * Methode qui v\xE9rifie et remplit les bons parametres d'entree avec les nouveaut\xE9s + */ + public boolean replayEvolutionFor(TrPostVisuPanel vue2d,TrPostCourbeTreeModel tree,TrPostCourbeModel modele,TrPostCommonImplementation implementation){ + H2dVariableType newVariable=null; + int newPointReel=-1; + TrPostInterpolatePoint newPointInterpole=null; + if (vue2d.isSelectionOkForEvolution()) { + final ZCalqueAffichageDonnees calque = (ZCalqueAffichageDonnees) vue2d.getCalqueActif(); + final int[] idx = calque.getLayerSelection().getSelectedIndex(); + H2dVariableType selectedVar = null; + if (calque instanceof TrIsoLayer) { + selectedVar = ((TrIsoLayer) calque).getIsoModel().getVariableSelected(); + } else if (calque instanceof TrPostFlecheLayer) { + selectedVar = ((TrPostFlecheLayer) calque).getSelectedVar(); + } + //-- cas point reel + newVariable=selectedVar; + newPointReel=idx[0]; + //-- on rejoue les donn\xE9es avec les nouvelles valeurs --// + if(this.ecraser_.getState()){ + implementation.message("La courbe actuelle de mod\xE8le: variable:"+modele.getVar()+", point N\xB0 "+modele.getSelectionPoint()+" va \xEAtre recalcul\xE9e pour les donn\xE9es suivantes:\n" + +"Variable: "+newVariable.getName()+", point N\xB0 "+newPointReel); + + modele.var_=newVariable; + //modele. + + }else{ + implementation.message("Une nouvelle courbe \xE9volution temporelle va \xEAtre calcul\xE9e pour la variable: "+newVariable.getName()+", et le point N\xB0 "+newPointReel+"La courbe actuelle ne sera pas \xE9cras\xE9e.\n"); + Set varToadd=new HashSet<H2dVariableType>(); + varToadd.add(newVariable); + int[] listeInt=new int[1]; + listeInt[0]=newPointReel; + tree.addPoints(modele.source_,listeInt, vue2d.getCmdMng(), implementation.getMainProgression(),varToadd ); + } + + return true; + + } else if (vue2d.isSelectionOkForEvolutionSonde()) { + //-- cas point interpol\xE9 --// + newVariable=vue2d.getSelectedVarInCalqueActif(); + newPointInterpole=vue2d.getInterpolePointForEvol(); + + //-- on rejoue les donn\xE9es avec les nouvelles valeurs --// + implementation.message("La courbe actuelle de mod\xE8le: variable:"+modele.getVar()+", point N\xB0 "+modele.getSelectionPoint()+" va \xEAtre recalcul\xE9e pour les donn\xE9es suivantes:\n" + +"Variable: "+newVariable.getName()+", point interpol\xE9 ("+newPointInterpole.x_+";"+newPointInterpole.y_+")"); + return true; + } else { + JOptionPane.showMessageDialog(null, "Erreur il faut choisir un seul point afin de recalculer les donn\xE9es de la courbe","erreur",JOptionPane.ERROR_MESSAGE); + return false; + + + } + } + + + /** + * Construit le selecteur de variable en utilisant un BuList. + * Pour r\xE9cup\xE9rer les variables, il suffit de faire l.getSelectedValues(); + * @param listeVar + * @param _title + * @param _parent + * @return + */ + public static JComponent constructSelectorVariable(final Object[] listeVar) { + Arrays.sort(listeVar, FuComparator.STRING_COMPARATOR); + final BuList l = CtuluLibSwing.createBuList(listeVar); + final BuPanel pn = new BuPanel(); + pn.setLayout(new BuBorderLayout()); + pn.setBorder(BuBorders.EMPTY3333); + pn.add(new BuLabel(CtuluLib.getS("S\xE9lectionner les variables \xE0 ajouter")), BuBorderLayout.NORTH); + pn.add(new BuScrollPane(l)); + // if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_parent, _title))) { return l.getSelectedValues(); } + return pn; + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -18,9 +18,11 @@ import org.fudaa.dodico.h2d.telemac.H2dTelemacBoundaryCondition; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.courbe.EGCourbeModelDefault; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; + /** * @author Fred Deniger * @version $Id: TrTelemacBoundaryCourbeModel.java,v 1.20 2007-05-22 14:20:38 deniger Exp $ @@ -257,4 +259,8 @@ public void viewGenerationSource(Map infos, CtuluUI impl){ } + public void replayData(EGGrapheTreeModel model,Map infos, CtuluUI impl) { + // TODO Auto-generated method stub + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2009-01-19 17:45:43 UTC (rev 4382) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2009-01-19 19:40:40 UTC (rev 4383) @@ -20,6 +20,7 @@ import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; + /** * @author Fred Deniger * @version $Id: TrTelemacWeirCourbeModel.java,v 1.14 2007-05-22 14:20:38 deniger Exp $ @@ -179,4 +180,8 @@ public void viewGenerationSource(Map infos, CtuluUI impl){ } + public void replayData(org.fudaa.ebli.courbe.EGGrapheTreeModel model,Map infos, CtuluUI impl) { + // TODO Auto-generated method stub + + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-22 22:22:01
|
Revision: 4394 http://fudaa.svn.sourceforge.net/fudaa/?rev=4394&view=rev Author: hadouxad Date: 2009-01-22 21:40:12 +0000 (Thu, 22 Jan 2009) Log Message: ----------- LOT 3: 3 fois plus fort!! Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/mesure/EvolutionReguliere.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.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/commun/courbe/ScopeCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/mesure/EvolutionReguliere.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/mesure/EvolutionReguliere.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/mesure/EvolutionReguliere.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -38,6 +38,11 @@ private boolean nuagePoints_=false; /** + * Indique si il faut transformer l'\xE9volution r\xE9guli\xE8re au format scope. + */ + public boolean isScope_=false; + + /** * Infos supplementaires ajoutees aux courbes afin de transferer des infos specifiques. */ public Map infos_=new HashMap(); Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -199,7 +199,7 @@ evolReg[i] = new EvolutionReguliere(tabX, tabY, false); evolReg[i].setNom("courbe de " + nomVar.replace(" ", "")); - + evolReg[i].isScope_=true; //-- ajout des infos specifiques --// Map infos= evolReg[i].infos_; infos.put("Type", "Profil scop"); @@ -535,7 +535,7 @@ evolReg[i] = new EvolutionReguliere(tabX, tabY, false); evolReg[i].setNom("courbe de " + nomVar.replace(" ", "")); evolReg[i].setUnite(nomVar); - + evolReg[i].isScope_=true; //-- ajout des infos specifiques --// // Map infos= evolReg[i].infos_; // infos.put("Type", "Profil spatial scopGene"); @@ -635,8 +635,8 @@ evolReg[i] = new EvolutionReguliere(tabX, tabY, false); evolReg[i].setNom(nomVar.replace(" ", "")+" sur ["+getSeparator(0).replace(" ", "")+";"+getSeparator(getNbSeparator()-1).replace(" ", "")+"] pour X choisi="+xVoulu); evolReg[i].setUnite(nomVar); + evolReg[i].isScope_=true; - //-- ajout des infos specifiques --// Map infos= evolReg[i].infos_; infos.put("Type", "Profil temporel scopGene"); @@ -674,7 +674,7 @@ evolReg[0] = new EvolutionReguliere(tabX, tabY, false); evolReg[0].setNom("Correlation:(X="+getVariable(varX+1).replace(" ", "")+"//Y="+getVariable(varY+1).replace(" ", "")+")"); evolReg[0].setUnite(getVariable(varX+1)); - + evolReg[0].isScope_=true; //-- ajout des infos specifiques --// Map infos= evolReg[0].infos_; infos.put("Type", "Correlation scopGene"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -1,21 +1,29 @@ package org.fudaa.ebli.calque; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.ImageIcon; +import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import org.fudaa.ctulu.gui.CtuluLibSwing; @@ -30,6 +38,7 @@ import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import com.memoire.bu.BuComboBox; import com.memoire.fu.FuLog; /** @@ -77,7 +86,9 @@ // getController().getPaletteInfo().getTableModel()); //-- init des datas --// - listInfoData_.add(new DataSonde()); + DataSonde data=new DataSonde(); + si.fillWithInfo(data); + listInfoData_.add(data); // -- enregistrement aupres de la sonde du manager comme listener --// si.addZCalqueSondeListener(this); @@ -99,8 +110,8 @@ */ public void notifySondeMoved(ZCalqueSondeInteraction _activator, GrPoint _e) { - if (structureModel_ == null) - structureModel_ = constructStructureModel(); +// if (structureModel_ == null) +// structureModel_ = constructStructureModel(); for (int i=0;i<listeSondeInteractions_.size();i++) { @@ -115,8 +126,9 @@ // -- on replace la sonde des autres calques --// ZCalqueSondeInterface objet = sondeInteraction.getTarget(); objet.setSondeEnable(true); + objet.changeSonde(pt); - + //--remplissage des infos specifiques a la sonde --// ZCalquePoint isoLayer = listeWidgetCalque_.get(i).getCalqueController().getVisuPanel().getIsoLayer(); isoLayer.fillWithInterpolateInfo(listInfoData_.get(i)); @@ -126,13 +138,36 @@ } } + + fillAllVariables(); + buildDialog(); - // structureModel_ = constructStructureModel(); - // treeTableNodes_.setTreeTableModel(structureModel_); - // treeTableNodes_.expandAll(); + structureModel_ = constructStructureModel(); + treeTableNodes_.setTreeTableModel(structureModel_); + treeTableNodes_.expandAll(); structureModel_.reload(); } + +BuComboBox comboChoixVar_=new BuComboBox(); +ArrayList<String> listeVar_=new ArrayList<String>(); +final static String ALLVAR=EbliResource.EBLI.getString("tout"); +/** + * Remplit la combo avec toutes les variables. + */ +private void fillAllVariables(){ + HashSet<String> listeVar=new HashSet<String>(); + for(DataSonde sonde:listInfoData_) + for(String key:sonde.mapValueSonde.keySet()) + if(!key.equals("X") && !key.equals("Y") && !key.equals("El\xE9ment englobant") ) + listeVar.add(key); + listeVar_=new ArrayList<String>(); + listeVar_.add(ALLVAR); + listeVar_.addAll(listeVar); + +} + + JDialog dialog_; public void buildDialog() { if (dialog_ != null) { @@ -164,10 +199,28 @@ dialog_.setTitle(getTitle()); JPanel container=new JPanel(new BorderLayout()); container.add(buildComponent(), BorderLayout.CENTER); - container - .add(new JLabel("<html> <body><b><center>" + getTitle() + "</center></b> </body></html>"), - BorderLayout.NORTH); - dialog_.setContentPane(container); + + comboChoixVar_=new BuComboBox(listeVar_.toArray(new String[listeVar_.size()])); + comboChoixVar_.setMinimumSize(new Dimension(150,(int) comboChoixVar_.getSize().getHeight())); + comboChoixVar_.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + filtreVariables(); + + } + + }); + JPanel panelRadio=new JPanel(); + panelRadio.add(new JLabel("Variable:")); + panelRadio.add(comboChoixVar_); + + container.add(panelRadio,BorderLayout.NORTH); + + JPanel content=new JPanel(new BorderLayout()); + content.add(container,BorderLayout.CENTER); + //content.add(new JLabel("<html> <body><b><center>" + getTitle() + "</center></b> </body></html>"),BorderLayout.NORTH); + dialog_.setContentPane(content); dialog_.setSize(400, 250); dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(ui.getParentComponent())); dialog_.setVisible(true); @@ -244,13 +297,13 @@ listOrdonneetitres_.add("X"); listOrdonneetitres_.add("Y"); listOrdonneetitres_.add("El\xE9ment englobant"); - listOrdonneetitres_.add("Bathym\xE9trie"); - listOrdonneetitres_.add("Cote eau"); - listOrdonneetitres_.add("Hauteur d'eau"); - listOrdonneetitres_.add("Nombre de Froude"); - listOrdonneetitres_.add("Vitesse"); - listOrdonneetitres_.add("Vitesse u"); - listOrdonneetitres_.add("Vitesse v"); +// listOrdonneetitres_.add("Bathym\xE9trie"); +// listOrdonneetitres_.add("Cote eau"); +// listOrdonneetitres_.add("Hauteur d'eau"); +// listOrdonneetitres_.add("Nombre de Froude"); +// listOrdonneetitres_.add("Vitesse"); +// listOrdonneetitres_.add("Vitesse u"); +// listOrdonneetitres_.add("Vitesse v"); for (String key : listOrdonneetitres_) { mapValueSonde.put(key, valueEmpty); @@ -268,8 +321,8 @@ public void put(String _key, String _value) { mapValueSonde.put(_key, _value); - if (!listOrdonneetitres_.contains(_key)) - listOrdonneetitres_.add(_key); +// if (!listOrdonneetitres_.contains(_key)) +// listOrdonneetitres_.add(_key); } public void setTitle(String _title) { @@ -373,31 +426,47 @@ } + + /** + * Remplit les infos de la structure avec les infos des sondes. + * @param indice + * @param treenode + * @param data_ + */ public void fillWithInfos(int indice, DefaultMutableTreeTableNode treenode, DataSonde data_) { - - // on enleve les children - // Enumeration<? extends MutableTreeTableNode> children = - // treenode.children(); - // ArrayList<MutableTreeTableNode> listChildren = new - // ArrayList<MutableTreeTableNode>(); - // while (children.hasMoreElements()) { - // MutableTreeTableNode node = children.nextElement(); - // listChildren.add(node); - // - // } - // for (MutableTreeTableNode node : listChildren) { - // node.removeFromParent(); - // } - // -- on ajoute les nouveaux - for (Iterator<String> it = data_.listOrdonneetitres_.iterator(); it.hasNext();) { + treenode.add(new DefaultMutableTreeTableNode(new SondeCouple("X", indice))); + treenode.add(new DefaultMutableTreeTableNode(new SondeCouple("Y", indice))); + treenode.add(new DefaultMutableTreeTableNode(new SondeCouple("El\xE9ment englobant", indice))); + + if(comboChoixVar_!=null && comboChoixVar_.getSelectedIndex()==0){ + for (Iterator<String> it = data_.mapValueSonde.keySet().iterator(); it.hasNext();) { String key = it.next(); - Object value = data_.mapValueSonde.get(key); - DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode( - new SondeCouple(key, indice)); + // Object value = data_.mapValueSonde.get(key); + if(!key.equals("X") && !key.equals("Y") && !key.equals("El\xE9ment englobant") ){ + DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(new SondeCouple(key, indice)); treenode.add(node); + } } + }else{ + //-- ajout juste du noeud correspondant au sorter --// + String value=(String) comboChoixVar_.getSelectedItem(); + treenode.add(new DefaultMutableTreeTableNode(new SondeCouple(value, indice))); + } + } + + /** + * Est appel\xE9 lors d'un choix de la combo. + * Affiche uniquement les variables voulues. + * C'est dans la methode fillWithInfos que l'on va prendre en compte le filtre de la variable. + */ + public void filtreVariables(){ + structureModel_ = constructStructureModel(); + treeTableNodes_.setTreeTableModel(structureModel_); + treeTableNodes_.expandAll(); + structureModel_.reload(); + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -9,6 +9,7 @@ import java.awt.Cursor; import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -209,7 +210,7 @@ } }; restore.putValue(Action.SHORT_DESCRIPTION, EbliResource.EBLI.getString("Restaurer la vue globale")); - restore.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('r')); + restore.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('V',InputEvent.CTRL_DOWN_MASK)); restore.putValue(EbliActionInterface.SECOND_KEYSTROKE, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); int i = 0; navigationActionGroup_[i++] = restore; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -320,6 +320,18 @@ } + public List<EGCourbeChild> getAllCourbesChild() { + final List r = new ArrayList(); + final int nb = components_.size(); + for (int i = 0; i < nb; i++) { + getGroup(i).fillWithCurves(r); + } + + return r; + + } + + public int getIconHeight() { return 24; } @@ -882,6 +894,10 @@ public EGCourbe[] getCourbes() { return getGrapheTreeNode().getCourbes(); } + + public List<EGCourbeChild> getAllCourbesChild() { + return getGrapheTreeNode().getAllCourbesChild(); + } public EGObject getEGObject(final int _i) { return (EGObject) root.getChildAt(_i); 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-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -24,6 +24,7 @@ import javax.swing.ListSelectionModel; import javax.swing.filechooser.FileFilter; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluIOOperationSynthese; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; @@ -40,7 +41,9 @@ import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.dodico.telemac.io.ScopeTFileFormat; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; @@ -58,6 +61,7 @@ import com.memoire.bu.BuValueValidator; import com.memoire.bu.BuWizardDialog; import com.memoire.bu.BuWizardTask; +import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List; /** * Wizard qui se charge d'importer des courbes au format scope dans le post. @@ -116,14 +120,54 @@ } } + /** + * 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; + } + } + 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; + for(int i=0;i<ScopeTFileFormat.getInstance().getExtensions().length;i++) + 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]; + if(name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i].toLowerCase())) + return 2; + } + return -1; + + + } + @Override public JComponent getStepComponent() { switch (current_) { @@ -265,8 +309,20 @@ private void importData(){ new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { public void act() { - final ProgressionInterface prog = getMainStateReceiver(); - + + computeData(getMainStateReceiver()); + + + }}.start(); + + } + + /** + * Methode qui realise le calcul de la structure. + * @param prog + */ + private void computeData(ProgressionInterface prog){ + switch(typeFormat_){ case 0: //cas s @@ -281,9 +337,6 @@ data_=lectureScopeGENE(fileChoosen_,prog); break; } - - }}.start(); - } private ScopeStructure.SorT lectureScopeS(final File _f,ProgressionInterface prog) { @@ -384,7 +437,7 @@ } 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"); @@ -663,6 +716,20 @@ 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); @@ -682,7 +749,7 @@ 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); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -12,7 +12,11 @@ import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.ScopCourbeTreeModel; +import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; +import org.fudaa.fudaa.tr.post.TrPostCourbeTreeModel; import org.fudaa.fudaa.tr.post.TrPostSource; +import org.fudaa.fudaa.tr.post.TrReplayCurvesData; import com.vividsolutions.jts.geom.LineString; @@ -106,4 +110,19 @@ impl.message("Origine de la courbe scop", "Impossible de trouver", false); } } + + + public void replayData(org.fudaa.ebli.courbe.EGGrapheTreeModel model,Map infos, CtuluUI impl) { + if(!(impl instanceof TrPostCommonImplementation)){ + impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); + return; + } + TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; + + //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// + TrReplayCurvesData.getInstance().getScopGeneReplayData(model, this, implementation); + + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -432,9 +432,12 @@ return; } TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; - + if(!(this.getData() instanceof TrPostSource)){ + implementation.error("Impossible de r\xE9cup\xE9rer le fichier r\xE9sulat depuis ce type de profil spatial."); + return; + } //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().getProfilSpatialReplayData((MvProfileTreeModel)model, this, implementation); + TrReplayCurvesData.getInstance().getProfilSpatialReplayData((TrPostSource) this.getData(),(MvProfileTreeModel)model, this, implementation); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -55,6 +56,7 @@ import org.fudaa.ebli.courbe.EGGrapheModel; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.courbe.EGObject; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; @@ -804,7 +806,15 @@ final EGGroup gr = getGroup(H2dVariableType.SANS, true); final List<EGCourbeChild> childs = new ArrayList<EGCourbeChild>(_crb.length); for (int i = 0; i < _crb.length; i++) { - final EGCourbeChild child = new EGCourbeChild(gr, new FudaaCourbeModel(new EvolutionReguliere(_crb[i]))); + + EGModel modelCourbe=null; + if((_crb[i] instanceof EvolutionReguliere) && ((EvolutionReguliere)_crb[i]).isScope_){ + modelCourbe=new ScopeCourbeModel((EvolutionReguliere) _crb[i]); + }else + modelCourbe=new FudaaCourbeModel(new EvolutionReguliere(_crb[i])); + + final EGCourbeChild child = new EGCourbeChild(gr, modelCourbe); + //-- on met a jour si la courbe est un nuage de points ou non --// child.setNuagePoints_(_crb[i].isNuagePoints()); @@ -824,7 +834,7 @@ public void finalizePersistance(){ //-- recupere les groupes de la persistance qui doivent etre supprim\xE9 car ne sont pas des liens directs avec les variables H2dVariableType du projet--// - ArrayList<EGGroup> listeGroupeAsupprimer=new ArrayList<EGGroup>(); + Set<EGGroup> listeGroupeAsupprimer=new HashSet<EGGroup>(); for(int i=0;i<this.getNbEGObject();i++){ @@ -847,13 +857,18 @@ listeCourbeToAdd.add(courbe); + //-- ajout du groupe dans la liste a supprimer --// + listeGroupeAsupprimer.add(groupe); - }else{ + }else if(courbe.getModel()!=null && (courbe.getModel() instanceof ScopeCourbeModel)){ //-- on cree le groupe sans car la courbe n'est pas profil spatioal, elel peut etre socpgen--// nvGroupe=getGroup(H2dVariableType.SANS,true); //nvGroupe.addEGComponent(courbe); //listeVar.put(groupe, MvProfileFillePanel.createGroupFor(H2dVariableType.SANS)); listeCourbeToAdd.add(courbe); + + //-- ajout du groupe dans la liste a supprimer --// + listeGroupeAsupprimer.add(groupe); } } @@ -864,8 +879,7 @@ if(nvGroupe!=null) nvGroupe.addEGComponent(listeCourbeToAdd); - //-- ajout du groupe dans la liste a supprimer --// - listeGroupeAsupprimer.add(groupe); + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -105,11 +105,28 @@ } + public void finalizePersistance(){ + for(int i=0;i<this.getNbEGObject();i++){ + + if(this.getEGObject(i) instanceof EGGroup){ + + EGGroup groupe=(EGGroup) this.getEGObject(i); + for(int k=0;k<groupe.getChildCount();k++){ + if(groupe.getCourbeAt(k)!=null){ + EGCourbeChild courbe=groupe.getCourbeAt(k); + if(courbe.getModel()!=null && (courbe.getModel() instanceof ScopeCourbeModel)){ + + varGroup_.put(H2dVariableType.SANS, groupe); + } + } + } + } + } + } + // public EGCourbe[] getCourbes() { -// // List<EGCourbe> liste=new ArrayList<EGCourbe>(); -// // for(int i=0;i<this.getNbEGObject();i++){ // if(this.getEGObject(i) instanceof EGCourbe){ // liste.add((EGCourbe) this.getEGObject(i)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -534,7 +534,7 @@ TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().getEvolTemporelleReplayData((TrPostCourbeTreeModel)model, this, implementation); + TrReplayCurvesData.getInstance().getEvolTemporelleReplayData(this.source_,(TrPostCourbeTreeModel)model, this, implementation); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -836,7 +836,14 @@ final EGGroup gr = getGroupFor(H2dVariableType.SANS); final List<EGCourbeChild> childs = new ArrayList<EGCourbeChild>(_crb.length); for (int i = 0; i < _crb.length; i++) { - final EGCourbeChild child = new EGCourbeChild(gr, new FudaaCourbeModel(new EvolutionReguliere(_crb[i]))); + + EGModel modelCourbe=null; + if((_crb[i] instanceof EvolutionReguliere) && ((EvolutionReguliere)_crb[i]).isScope_){ + modelCourbe=new ScopeCourbeModel((EvolutionReguliere) _crb[i]); + }else + modelCourbe=new FudaaCourbeModel(new EvolutionReguliere(_crb[i])); + + final EGCourbeChild child = new EGCourbeChild(gr, modelCourbe); childs.add(child); //-- on met a jour si la courbe est un nuage de points ou non --// @@ -1140,6 +1147,8 @@ if(courbe.getModel()!=null && (courbe.getModel() instanceof TrPostCourbeModel)){ TrPostCourbeModel model=(TrPostCourbeModel) courbe.getModel(); varGroup_.put(model.var_, groupe); + }else if(courbe.getModel()!=null ){ + varGroup_.put(H2dVariableType.SANS, groupe); } } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -44,6 +44,7 @@ import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.fudaa.meshviewer.MvSelectionNodeOrEltData; @@ -80,7 +81,7 @@ boolean rubar_; protected EvolutionAction(final boolean _rubar) { - super(TrResource.getS("Afficher les \xE9volutions"), null, "DISPLAY_EVOLS"); + super(TrResource.getS("Afficher les \xE9volutions"), EbliResource.EBLI.getIcon("curves"), "DISPLAY_EVOLS"); rubar_ = _rubar; if (rubar_) { setDefaultToolTip(TrResource.getS("Affiche les \xE9volutions temporelles sur l'\xE9l\xE9ment s\xE9lectionn\xE9")); @@ -174,7 +175,7 @@ final boolean _simplified, final BCalqueLegende _leg, final TrPostSource _src) { super(new TrPostActionController(_impl), _impl); - // -- mise a jour de l indice de ls source courante --// + // -- mise a jour de l indice de la source courante --// source_ = _src; projet_ = _controller; info_ = new TrPostInfoDelegate(source_, getEbliFormatter()); @@ -470,7 +471,7 @@ // _l.add(new MvProfileAction(getProjet(), getImpl(), this)); _l.add(new TrPostProfileAction(this)); - + _l.add(new EvolutionAction(getSource().isRubar())); _l.add(new TrPostVolumeAction(source_, this)); createAnimAction(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -4,10 +4,16 @@ import java.awt.Checkbox; import java.awt.Color; import java.awt.Component; +import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; +import java.awt.Frame; import java.awt.GridLayout; import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; +import java.io.File; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collection; @@ -17,7 +23,9 @@ import java.util.Set; import java.util.Vector; +import javax.swing.AbstractAction; import javax.swing.AbstractButton; +import javax.swing.Action; import javax.swing.ButtonGroup; import javax.swing.JComponent; import javax.swing.JLabel; @@ -43,34 +51,44 @@ import org.fudaa.ebli.calque.ZCalqueSondeInteraction; import org.fudaa.ebli.calque.action.CalqueActionSonde; import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; +import org.fudaa.ebli.calque.edition.BPaletteEdition; +import org.fudaa.ebli.calque.edition.ZCalqueLigneBriseeEditable; +import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; import org.fudaa.ebli.calque.edition.ZModelePointEditable; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.controle.BSelecteurListComboBox; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo; import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; +import org.fudaa.fudaa.commun.courbe.ScopeCourbeModel; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter.Target; import org.fudaa.fudaa.meshviewer.profile.MVProfileCourbeModel; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.sig.layer.FSigEditor; import org.fudaa.fudaa.sig.layer.FSigLayerGroup; +import org.fudaa.fudaa.sig.layer.FSigLayerLineEditable; import org.fudaa.fudaa.sig.layer.FSigLayerPointEditable; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.data.TrGisProjectEditor; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardImportScope; import org.openide.util.actions.Presenter.Toolbar; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuBorders; +import com.memoire.bu.BuButton; import com.memoire.bu.BuLabel; import com.memoire.bu.BuList; import com.memoire.bu.BuPanel; import com.memoire.bu.BuRadioButton; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuToolBar; +import com.memoire.bu.BuWizardDialog; import com.memoire.fu.FuComparator; import com.sun.corba.se.impl.ior.NewObjectKeyTemplateBase; import com.vividsolutions.jts.geom.Coordinate; @@ -92,6 +110,9 @@ */ private static TrReplayCurvesData instance_; + + private BuButton rejouerSrc_=null; + /** * Vue 2d gardee en memoire si on fait plusieurs appels cons\xE9cutifs \xE0 des courbes qui ont le meme fichier source. */ @@ -239,9 +260,10 @@ pn.add(composantAdditionnel,BuBorderLayout.EAST); JPanel panelSouth=new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel panelSouth2=new JPanel(new FlowLayout(FlowLayout.LEFT)); panelSouth.add(vue2d.getLabelSuiviSouris()); - JPanel panelTotalSouth=new JPanel(new GridLayout(2,1)); + JPanel panelTotalSouth=new JPanel(new GridLayout(3,1)); if(title!=null){ panelTotalSouth.add(new JLabel(title)); @@ -249,7 +271,7 @@ panelTotalSouth.add(new JLabel("")); panelTotalSouth.add(panelSouth); - + panelTotalSouth.add(panelSouth2); pn.add(panelTotalSouth,BuBorderLayout.SOUTH); @@ -261,6 +283,8 @@ //-- ajout de la palette d'infos --// final Collection<EbliActionPaletteAbstract> acts =vue2d.getController().getTabPaletteAction(); BPaletteInfo comp=null; + vue2d.getController().buildActions(); + JPanel compEast=new JPanel(new BorderLayout()); for (final EbliActionPaletteAbstract pals : acts) { final JComponent component = pals.buildContentPane(); if (component instanceof BCalquePaletteInfo) { @@ -271,19 +295,26 @@ pals.updateBeforeShow(); // comp.setMaximumSize(new Dimension(180,300)); // comp.setPreferredSize(new Dimension(180,300)); - pn.add(comp,BuBorderLayout.EAST); - + compEast.add(comp,BuBorderLayout.CENTER); + + }else if((modele instanceof MVProfileCourbeModel) && (component instanceof BPaletteEdition)){ + compEast.add(comp,BuBorderLayout.SOUTH); } } + pn.add(compEast,BuBorderLayout.EAST); panelSouth.add(this.ecraser_); panelSouth.add(this.ajouter_); //final JScrollPane arbreVue2d = new JScrollPane(new BArbreCalque(vue2d.getArbreCalqueModel())); //arbreVue2d.setPreferredSize(new Dimension(200,300)); //arbreVue2d.setMaximumSize(new Dimension(200,300)); //pn.add(arbreVue2d,BuBorderLayout.WEST); + if(this.rejouerSrc_!=null){ + + panelSouth2.add(new JLabel("Relancer pour un autre fichier r\xE9sultat")); + panelSouth2.add(rejouerSrc_); + } - } @@ -330,7 +361,7 @@ //calqueZ.setVisible(true); //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); if(isInterpolated) - calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CROIX,3,Color.blue)); + calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.PLUS,4,Color.blue)); else calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); vue2d.addCalque(calqueZ, true); @@ -352,7 +383,7 @@ * @param modele * @param implementation */ - public void getProfilSpatialOrigine(MVProfileCourbeModel modele,TrPostCommonImplementation implementation){ + public void getProfilSpatialOrigine( MVProfileCourbeModel modele, TrPostCommonImplementation implementation){ if(modele.getData() instanceof TrPostSource){} else{ @@ -404,6 +435,9 @@ //pane.setMaximumSize(new Dimension(200,300)); pane.setPreferredSize(new Dimension(200,300)); + + + CtuluDialogPanel panel=constructDialog(vue2d, implementation, modele,pane,false,"<html><body>"+TrResource.getS("Origine ")+" "+modele.getTitle()+".<br />Les points de la polyligne sont encadr\xE9s en bleu </body></html>"); //-- on positionne la bonne variable et le bon pas de temps --// comboVar_.getCb().setSelectedItem(modele.getVariable()); @@ -411,19 +445,19 @@ } - + CtuluDialogPanel dialog_=null; /** * Constructeur d'une dialog qui affiche la vue 2d avec le point initial qui a servi a la creation du modele. * Ajoute \xE9galement la liste des variables \xE0 choisir. Il est possible dans la vue de s\xE9lectionner un autre point ou plusieurs. * LA validation de la frame permettra de r\xE9cup\xE9rer les nouveaux point ainsi que les variables qui seront utilis\xE9es pour refaire le calcul. * @param modele */ - public void getEvolTemporelleReplayData(TrPostCourbeTreeModel treeModel,TrPostCourbeModel modele,TrPostCommonImplementation implementation){ + public void getEvolTemporelleReplayData(TrPostSource srcChoisie,final TrPostCourbeTreeModel treeModel,final TrPostCourbeModel modele,final TrPostCommonImplementation implementation){ boolean isInterpolated=(modele instanceof TrPostCourbeModel.Interpolated); //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrPostVisuPanel vue2d=constructVue2d(implementation,modele.source_); + TrPostVisuPanel vue2d=constructVue2d(implementation,srcChoisie); //-- on affiche sur la vue 2d les points initialement choisis --// GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); @@ -433,7 +467,7 @@ //point reel int indiceNoeud=((Integer) point).intValue(); // recherche du point cot\xE9 grille - coordonneesPoint=modele.source_.getGrid().getCoor(indiceNoeud); + coordonneesPoint=srcChoisie.getGrid().getCoor(indiceNoeud); }else{ TrPostInterpolatePoint pt=(TrPostInterpolatePoint) point; @@ -449,7 +483,7 @@ FSigLayerPointEditable layer2=new FSigLayerPointEditable(modelePointEdit,vue2d.getGisEditor()); layer2.setVisible(true); if(isInterpolated) - layer2.setIconModel(0, new TraceIconModel(TraceIcon.CROIX,5,Color.RED)); + layer2.setIconModel(0, new TraceIconModel(TraceIcon.PLUS,4,Color.RED)); else layer2.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,5,Color.RED)); layer2.setEnabled(true); @@ -461,22 +495,41 @@ vue2d.setCalqueActif(resultatsCalque); //vue2d.addCalque(layer2, true); - // ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); - // //calqueZ.setVisible(true); - // //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); - // calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); - // vue2d.addCalque(calqueZ, true); - // calqueZ.setVisible(true); + //-- creation du panel de choix des variables a selectionner --// - + rejouerSrc_=new BuButton(); + rejouerSrc_.setAction(new AbstractAction("Fichier r\xE9sultat"){ + public void actionPerformed(ActionEvent e) { + final String[] values = implementation.getCurrentProject().formattageDonnees(false); + final int selectedSource = selectSource(values, (String) getValue(Action.NAME), implementation.getFrame()); + if(selectedSource !=-1){ + //-- on choisie le nouveau source --// + TrPostSource newSrc= implementation.getCurrentProject().getSource(selectedSource); + + //-- on ferme l'interface courante --// + + if(dialog_!=null ) + + dialog_.cancel(); + //-- on rappelle l'interface --// + getEvolTemporelleReplayData(newSrc, treeModel, modele, implementation); + + } + else return; + + } + + }); + + //-- on affiche le contenu dans une dialog--// //final Set var = new HashSet(Arrays.asList(modele.source_.getAllVariablesNonVec())); //final H2dVariableType[] vars = (H2dVariableType[]) var.toArray(new H2dVariableType[var.size()]); String title=TrResource.getS("<html><body>Choisir le point et la variable qui seront utilis\xE9s pour refaire le calcul(interpolation possible).<br /> Le point rouge d\xE9signe le point d'origine.</body></html>"); - CtuluDialogPanel dialog=constructDialog(vue2d, implementation, modele,/*constructSelectorVariable(vars)*/null,true,title); - dialog.setPreferredSize(new Dimension(600,400)); + dialog_=constructDialog(vue2d, implementation, modele,/*constructSelectorVariable(vars)*/null,true,title); + dialog_.setPreferredSize(new Dimension(600,400)); //-- on restaure la vue --// vue2d.setSize(300, 300); @@ -486,19 +539,64 @@ comboVar_.getCb().setSelectedItem(modele.var_); + //-- on cr\xE9e le bouton de rejoue de donn\xE9es pour un autre fichier r\xE9sultat --// + + //-- on affiche tant que l'utilisateur valide des r\xE9sultats faux --// - while(CtuluDialogPanel.isOkResponse(dialog.afficheModale(implementation.getParentComponent(), TrResource.getS("Rejouer ")+" "+modele.getTitle())) && !replayEvolutionFor(vue2d,treeModel,modele,implementation)){ + while(CtuluDialogPanel.isOkResponse(dialog_.afficheModale(implementation.getParentComponent(), TrResource.getS("Rejouer ")+" "+modele.getTitle())) && !replayEvolutionFor(srcChoisie,vue2d,treeModel,modele,implementation)){ } } + /** + * Constructeur d'une dialog qui affiche la vue 2d avec le point initial qui a servi a la creation du modele. + * Ajoute \xE9galement la liste des variables \xE0 choisir. Il est possible dans la vue de s\xE9lectionner un autre point ou plusieurs. + * LA validation de la frame permettra de r\xE9cup\xE9rer les nouveaux point ainsi que les variables qui seront utilis\xE9es pour refaire le calcul. + * @param modele + * + * WARNING: le treemodele pour un courbe scopegene peut etre a la fois: + * - un ScopGeneTeeModel + * - un trpostcourbeTreeModel (ajout de courbe scop dans une evol temporelle) + * - un MvTreeModel (ajout idem) + * Il faut donc traiter avec un EgGrapheTreeModel g\xE9n\xE9rique pour eviter les problemes de cast. + */ + public void getScopGeneReplayData(EGGrapheTreeModel treeModel,ScopeCourbeModel modele,TrPostCommonImplementation implementation){ + + + File fichierScop=modele.getFichierGenerateur(); + if(fichierScop==null || !fichierScop.canRead()){ + if(fichierScop!=null) + implementation.error("Impossible de r\xE9cup\xE9rer le fichier scop au cehmin suivant: \n "+fichierScop.getAbsolutePath()); + else + implementation.error("Impossible de r\xE9cup\xE9rer le fichier scop"); + + return; + } + + //-- pr\xE9chargement de l'interface avec les infos du fichier --// + + + + final TrPostWizardImportScope wizard = new TrPostWizardImportScope(implementation.getCurrentProject(), (Target) treeModel,true,fichierScop); + final BuWizardDialog DialogWizard = new BuWizardDialog(implementation.getFrame(), wizard); + // --affichage du wizard --// + DialogWizard.setSize(600, 600); + DialogWizard.setLocationRelativeTo(implementation.getFrame()); + DialogWizard.setVisible(true); + + + } + + + + /** * Methode qui v\xE9rifie les saisies sur la vue 2d et r\xE9alise les cr\xE9ations/ecrasements avec les nouveaut\xE9s * des profils temporels. */ - public boolean replayEvolutionFor(TrPostVisuPanel vue2d,TrPostCourbeTreeModel tree,TrPostCourbeModel modele,TrPostCommonImplementation implementation){ + public boolean replayEvolutionFor(TrPostSource srcChoisie,TrPostVisuPanel vue2d,TrPostCourbeTreeModel tree,TrPostCourbeModel modele,TrPostCommonImplementation implementation){ H2dVariableType newVariable=null; int newPointReel=-1; TrPostInterpolatePoint newPointInterpole=null; @@ -533,7 +631,7 @@ //-- on rejoue les donn\xE9es avec ou sans ecrasement --// - tree.replayPoints(modele,modele.source_,newPointReel, vue2d.getCmdMng(), implementation.getMainProgression(),newVariable ,this.ecraser_.isSelected()); + tree.replayPoints(modele,srcChoisie,newPointReel, vue2d.getCmdMng(), implementation.getMainProgression(),newVariable ,this.ecraser_.isSelected()); return true; @@ -550,7 +648,7 @@ implementation.message("Une nouvelle courbe \xE9volution temporelle va \xEAtre calcul\xE9e pour la variable: "+newVariable.getName()+", point interpol\xE9 ("+newPointInterpole.x_+";"+newPointInterpole.y_+")\n"+ "La courbe actuelle ne sera pas supprim\xE9e."); //-- on rejoue les donn\xE9es avec ou sans ecrasement --// - tree.replayPoints(modele,modele.source_,newPointInterpole, vue2d.getCmdMng(), implementation.getMainProgression(),newVariable ,this.ecraser_.isSelected()); + tree.replayPoints(modele,srcChoisie,newPointInterpole, vue2d.getCmdMng(), implementation.getMainProgression(),newVariable ,this.ecraser_.isSelected()); return true; @@ -569,13 +667,10 @@ * LA validation de la frame permettra de r\xE9cup\xE9rer les nouveaux point ainsi que les variables qui seront utilis\xE9es pour refaire le calcul. * @param modele */ - public void getProfilSpatialReplayData( MvProfileTreeModel treeModel,MVProfileCourbeModel modele,TrPostCommonImplementation implementation){ - if(!(modele.getData() instanceof TrPostSource)){ - implementation.error("Impossible de r\xE9cup\xE9rer le fichier r\xE9sulat depuis ce type de profil spatial."); - return; - } + public void getProfilSpatialReplayData( TrPostSource srcChoisie,final MvProfileTreeModel treeModel,final MVProfileCourbeModel modele,final TrPostCommonImplementation implementation){ + //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrPostVisuPanel vue2d=constructVue2d(implementation,(TrPostSource) modele.getData()); + TrPostVisuPanel vue2d=constructVue2d(implementation,srcChoisie); //-- on affiche sur la vue 2d les points initialement choisis --// GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); @@ -605,19 +700,51 @@ //-- creation du panel de choix des variables a selectionner --// String title=TrResource.getS("<html><body>Choisir les points, la variable et le pas de temps qui seront utilis\xE9s pour refaire le calcul(polyligne possible).<br /> Les points rouge d\xE9signent l'origine.</body></html>"); - CtuluDialogPanel dialog=constructDialog(vue2d, implementation, modele,/*constructSelectorVariable(vars)*/null,true,title); - dialog.setPreferredSize(new Dimension(600,400)); + //-- creation du panel de choix des variables a selectionner --// + rejouerSrc_=new BuButton(); + rejouerSrc_.setAction(new AbstractAction("Fichier r\xE9sultat"){ + public void actionPerformed(ActionEvent e) { + final String[] values = implementation.getCurrentProject().formattageDonnees(false); + final int selectedSource = selectSource(values, (String) getValue(Action.NAME), implementation.getFrame()); + if(selectedSource !=-1){ + //-- on choisie le nouveau source --// + TrPostSource newSrc= implementation.getCurrentProject().getSource(selectedSource); + + //-- on ferme l'interface courante --// + if(dialog_!=null ) + dialog_.cancel(); + + //-- on rappelle l'interface --// + getProfilSpatialReplayData(newSrc, treeModel, modele, implementation); + + } + else return; + + } + + }); + + dialog_=constructDialog(vue2d, implementation, modele,/*constructSelectorVariable(vars)*/null,true,title); + dialog_.setPreferredSize(new Dimension(600,400)); + //-- on restaure la vue --// vue2d.setSize(300, 300); vue2d.restaurer(); + + + //-- on positionne la bonne variable et le bon pas de temps --// comboVar_.getCb().setSelectedItem(modele.getVariable()); - + //-- ajout du calque ligne bris\xE9e pour r\xE9aliser une polyligne --// + //final FSigLayerLineEditable cq4 = new FSigLayerLineEditable(new ZModeleLigneBriseeEditable(), vue2d.getGisEditor()); + // cq4.setTitle("toto"); + //vue2d.addCalque(cq4, true); + //-- on affiche tant que l'utilisateur valide des r\xE9sultats faux --// - while(CtuluDialogPanel.isOkResponse(dialog.afficheModale(implementation.getParentComponent(), TrResource.getS("Rejouer ")+" "+modele.getTitle())) && !replayProfilSpatialFor(vue2d,treeModel,modele,implementation)){ + while(CtuluDialogPanel.isOkResponse(dialog_.afficheModale(implementation.getParentComponent(), TrResource.getS("Rejouer ")+" "+modele.getTitle())) && !replayProfilSpatialFor(srcChoisie,vue2d,treeModel,modele,implementation)){ } @@ -630,7 +757,7 @@ * Methode qui v\xE9rifie les saisies sur la vue 2d et r\xE9alise les cr\xE9ations/ecrasements avec les nouveaut\xE9s * des profils temporels. */ - public boolean replayProfilSpatialFor(TrPostVisuPanel vue2d,MvProfileTreeModel tree,MVProfileCourbeModel modele,TrPostCommonImplementation implementation){ + public boolean replayProfilSpatialFor( TrPostSource srcChoisie,TrPostVisuPanel vue2d,MvProfileTreeModel tree,MVProfileCourbeModel modele,TrPostCommonImplementation implementation){ H2dVariableType newVariable=null; int newTimeStep_=-1; int[] newPoints=null; @@ -655,15 +782,15 @@ String title=" [P1("+format(modele.getBuilder().getInitLine_().getCoordinateN(0).x,2)+";"+format(modele.getBuilder().getInitLine_().getCoordinateN(0).y,2)+")"+";"+ "P"+modele.getBuilder().getInitLine_().getNumPoints()+"("+format(modele.getBuilder().getInitLine_().getCoordinateN(modele.getBuilder().getInitLine_().getNumPoints()-1).x,2)+";"+format(modele.getBuilder().getInitLine_().getCoordinateN(modele.getBuilder().getInitLine_().getNumPoints()-1).y,2)+")]"; - String title2=" [P1("+format(((TrPostSource)modele.getData()).getGrid().getPtX(idx[0]),2)+";"+format(((TrPostSource)modele.getData()).getGrid().getPtX(idx[0]),2)+")"+";"+ - "P"+modele.getBuilder().getInitLine_().getNumPoints()+"("+format(((TrPostSource)modele.getData()).getGrid().getPtX(idx[idx.length-1]),2)+";"+format(((TrPostSource)modele.getData()).getGrid().getPtX(idx[idx.length-1]),2)+")]"; + String title2=" [P1("+format(srcChoisie.getGrid().getPtX(idx[0]),2)+";"+format(srcChoisie.getGrid().getPtX(idx[0]),2)+")"+";"+ + "P"+modele.getBuilder().getInitLine_().getNumPoints()+"("+format(srcChoisie.getGrid().getPtX(idx[idx.length-1]),2)+";"+format(srcChoisie.getGrid().getPtX(idx[idx.length-1]),2)+")]"; //-- on rejoue les donn\xE9es avec les nouvelles valeurs --// if(this.ecraser_.isSelected()){ - implementation.message("La courbe actuelle de mod\xE8le: variable:"+modele.getVariable()+", de pas de temps "+((TrPostSource)modele.getData()).getTimeStep(modele.getActiveTimeIdx())+" et de polyligne d'extr\xE9mit\xE9s "+title+"\n" + + implementation.message("La courbe actuelle de mod\xE8le: variable:"+modele.getVariable()+", de pas de temps "+srcChoisie.getTimeStep(modele.getActiveTimeIdx())+" et de polyligne d'extr\xE9mit\xE9s "+title+"\n" + " va \xEAtre recalcul\xE9e pour les donn\xE9es suivantes:\n" - +"Variable: "+newVariable.getName()+", de pas de temps "+((TrPostSource)modele.getData()).getTimeStep(vue2d.getSelectedTimeInCalqueActif())+" et de polyligne d'extr\xE9mit\xE9s "+title2); + +"Variable: "+newVariable.getName()+", de pas de temps "+srcChoisie.getTimeStep(vue2d.getSelectedTimeInCalqueActif())+" et de polyligne d'extr\xE9mit\xE9s "+title2); } else{ @@ -671,7 +798,7 @@ } //-- on rejoue les donn\xE9es avec ou sans ecrasement --// - tree.replayPoints(implementation,vue2d,modele,(TrPostSource)modele.getData(),newPoints, vue2d.getCmdMng(), implementation.getMainProgression(),newVariable ,newTimeStep_,this.ecraser_.isSelected()); + tree.replayPoints(implementation,vue2d,modele,srcChoisie,newPoints, vue2d.getCmdMng(), implementation.getMainProgression(),newVariable ,newTimeStep_,this.ecraser_.isSelected()); return true; @@ -683,10 +810,27 @@ } } + /** + * Genere une interface qui liste les fichiers disponibles et retourne l'entier correspondant au choix de l'utilisateur. + * Cet entier correspond a l'indice du fichier dans l'arrayliste des src du trpostprojet. + * @param _init + * @param _title + * @param _parent + * @return + */ + public static int selectSource(final Object[] _init, final String _title, final Component _parent) { + Arrays.sort(_init, FuComparator.STRING_COMPARATOR); + 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; + } - - public String format(double value,int nbChiffresSignificatifs){ String forme="#."; for(int i=0;i<nbChiffresSignificatifs;i++) Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardImportScope.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardImportScope.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -1,6 +1,7 @@ package org.fudaa.fudaa.tr.post.dialogSpec; import java.awt.event.ActionEvent; +import java.io.File; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; @@ -33,6 +34,13 @@ target_ = target; } + public ImportAction(final TrPostProjet projet, final FudaaCourbeImporter.Target target,boolean replayData) { + super(BuResource.BU.getString("Importer dans le graphe"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); + ui_ = projet.impl_; + projet_ = projet; + target_ = target; + } + @Override public void actionPerformed(final ActionEvent _e) { final TrPostWizardImportScope wizard = new TrPostWizardImportScope(projet_, target_); @@ -44,6 +52,12 @@ } } + public TrPostWizardImportScope(final TrPostProjet projet_, final FudaaCourbeImporter.Target target,boolean replayData,File fileToReload) { + super(projet_.impl_, target,replayData,fileToReload); + this.projet_ = projet_; + } + + public TrPostWizardImportScope(final TrPostProjet projet_, final FudaaCourbeImporter.Target target) { super(projet_.impl_, target); this.projet_ = projet_; Modified: 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/TrPostPersistenceManager.java 2009-01-22 15:22:26 UTC (rev 4393) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-22 21:40:12 UTC (rev 4394) @@ -161,7 +161,27 @@ fileChooser.setDialogTitle(EbliResource.EBLI.getString("S\xE9lectionnez l'emplacement de votre projet")); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - fileChooser.addChoosableFileFilter(new TrPostFileFilter.DirectoryPOSTFilter()); + fileChooser.addChoosableFileFilter(new TrPostFileFilter.DirectoryPOSTFilter()); + + //-- par defaut on choisis le nom du fichier resultat + .POST --// + File fileDefaut=null; + boolean constrcutFileDefaut=false; + if(trprojet_.listeSrc_!=null && trprojet_.listeSrc_.size()>=1){ + String indice=""; + int i=1; + do{ + String path=fileChooser.getCurrentDirectory().getAbsolutePath()+File.separator+trprojet_.getSource(0).getFile().getName()+indice+EXTENSION; + fileDefaut=new File(path); + indice="_"+(i++); + }while(fileDefaut.exists()); + + + if(! fileDefaut.exists()){ + constrcutFileDefaut= fileDefaut.mkdir(); + } + fileChooser.setSelectedFile(fileDefaut); + + } if (projet_ != null){ // initialiser le saveas dans le meme rep // fileChooser.setSelectedFile(projet_); } @@ -169,6 +189,11 @@ if (reponse == JFileChooser.APPROVE_OPTION) { final File conteneurProjet = fileChooser.getSelectedFile(); + //-- si le fichier choisit en d\xE9finitif est diff\xE9rent du fichier d\xE9faut et qu'il a \xE9t\xE9t cr\xE9r pour rien, on le supprime --// + if(constrcutFileDefaut && fileDefaut!=null && !fileDefaut.getAbsolutePath().equals(conteneurProjet.getAbsolutePath())){ + fileDefaut.delete(); + ... [truncated message content] |
From: <had...@us...> - 2009-01-23 18:57:28
|
Revision: 4397 http://fudaa.svn.sourceforge.net/fudaa/?rev=4397&view=rev Author: hadouxad Date: 2009-01-23 18:57:21 +0000 (Fri, 23 Jan 2009) Log Message: ----------- Lot 3 Prepro: Memoires des vues 2d Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.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/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.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/dialogSpec/TrPostTrajectoireTaskModel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersist.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -7,6 +7,7 @@ */ package org.fudaa.ebli.calque; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -21,6 +22,9 @@ import java.awt.image.BufferedImage; import java.awt.print.PageFormat; import java.awt.print.Printable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.swing.Action; @@ -32,11 +36,14 @@ import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; import javax.swing.JTabbedPane; +import javax.swing.JTable; import javax.swing.ListCellRenderer; import javax.swing.SwingUtilities; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; +import javax.swing.table.DefaultTableModel; import javax.swing.tree.TreeModel; import org.fudaa.ctulu.CtuluLibString; @@ -66,6 +73,7 @@ import com.memoire.bu.BuMenu; import com.memoire.bu.BuPanel; import com.memoire.bu.BuPopupMenu; +import com.memoire.bu.BuTable; /** * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, @@ -278,6 +286,17 @@ this.gcDonnees_ = gcDonnees_; } + /** + * contient des informations de cr\xE9ation du vue2d. + */ + public final static String NOM_FIC=EbliResource.EBLI.getString("Fichier res"); + public final static String PATH_FIC=EbliResource.EBLI.getString("Chemin"); + public final static String TITRE_FIC=EbliResource.EBLI.getString("Titre"); + public final static String MAILLAGE_FIC=EbliResource.EBLI.getString("Maillage utilis\xE9"); + public final static String DIFF_FIC=EbliResource.EBLI.getString("Diff\xE9rentiel fichiers"); + + public Map<String,String> infosCreation_=new HashMap<String,String>(); + protected BuMenu contextTools_; protected BuLabel mode_; @@ -1003,5 +1022,108 @@ } + /** + * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. + * Retourne un panel vide si aucune infos n'est disponible. + * @return + */ + public BuPanel buildInfosCreationComposant(){ + + + if(infosCreation_==null || infosCreation_.keySet()==null ||infosCreation_.keySet().size()==0) + return new BuPanel(); + + String[] names=new String[]{"Nom","Valeur"};//infosCreation_.keySet().toArray(new String[infosCreation_.keySet().size()]); + String[][] data=new String[infosCreation_.keySet().size()][2]; + int i=0; + for(String key:infosCreation_.keySet()){ + data[i][0]=key; + data[i][1]=infosCreation_.get(key); + i++; + } + + DefaultTableModel modelInfos=new DefaultTableModel(data,names){ + @Override + public int getRowCount() { + // TODO Auto-generated method stub + return infosCreation_.keySet().size()+1; + } + + @Override + public Object getValueAt(int row, int column) { + + if(row==getRowCount()-1){ + if(column==0) + return EbliResource.EBLI.getString("Editable"); + else + return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); + }else + if(column==0) + return getKey(row); + else + return getValue(row); + + } + + @Override + public void setValueAt(Object value, int row, int column) { + + if(value==null)return; + + if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ + //-- ajout --// + if(column==1) + infosCreation_.put("Note "+(infosCreation_.keySet().size()+1),(String)value); + else + infosCreation_.put((String)value,""); + + fireTableDataChanged(); + + }else{ + //-- modification --// + if(column==0){ + String res=infosCreation_.get(getKey(row)); + infosCreation_.remove(getKey(row)); + infosCreation_.put((String)value, res); + }else{ + infosCreation_.put(getKey(row),(String)value); + } + fireTableDataChanged(); + } + } + public String getKey(int row){ + int i=0; + if(row>=infosCreation_.keySet().size()) + return ""; + for(String key:infosCreation_.keySet()){ + if(i==row) + return key; + i++; + + } + return ""; + } + + public String getValue(int row){ + return infosCreation_.get(getKey(row)); + } + + @Override + public boolean isCellEditable(int row, int column) { + return true; + } + + }; + BuTable table=new BuTable(modelInfos); + + table.getColumnModel().getColumn(0).setPreferredWidth(20); + BuPanel conteneur=new BuPanel(new BorderLayout()); + conteneur.add(new JScrollPane(table),BorderLayout.CENTER); + + conteneur.add(new JLabel("<html><body><b>"+EbliResource.EBLI.getString("Infos cr\xE9ations")+"</b></body></html>",JLabel.CENTER),BorderLayout.NORTH); + return conteneur; + } + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; @@ -20,6 +21,8 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; import javax.swing.JToolBar; import org.fudaa.ctulu.CtuluCommandContainer; @@ -461,10 +464,24 @@ pals.updateBeforeShow(); tb.addTab(pals.getTitle(), pals.getIcon(), component); } + + + //-- split avec infos + arbre des calques --// + final JSplitPane splitInfosArbre = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + + final BuPanel scrollInfos = getVisuPanel().buildInfosCreationComposant(); + scrollInfos.setMinimumSize(new Dimension((int) scrollInfos.getSize().getWidth(),100)); + + splitInfosArbre.setTopComponent(scrollInfos); + splitInfosArbre.setBottomComponent(scrollPane); + splitInfosArbre.setDividerLocation(0.3D); + + final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(tb); - splitPane.setBottomComponent(scrollPane); + splitPane.setBottomComponent(splitInfosArbre); splitPane.setDividerLocation(0.3D); + panelTreeCalque_ = splitPane; } else { panelTreeCalque_ = scrollPane; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -13,13 +13,11 @@ import javax.swing.JDesktopPane; import javax.swing.JMenu; import javax.swing.JPanel; -import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.gui.CtuluButtonForPopup; import org.fudaa.ctulu.gui.CtuluSelectorPopupButton; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -35,7 +33,6 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetArrowEditor; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.actions.CommandUndoRedoCreation; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; @@ -43,7 +40,6 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; - import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; @@ -61,7 +57,6 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorDblFleche; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFlecheSimple; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorLine; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; import org.fudaa.fudaa.tr.common.TrResource; @@ -70,7 +65,6 @@ import org.fudaa.fudaa.tr.post.actions.TrPostActionDuplicate; import org.fudaa.fudaa.tr.post.actions.TrPostActionDuplicateLayout; import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCreateScope; -import org.jdesktop.swingx.ScrollPaneSelector; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuDesktop; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -52,6 +52,7 @@ import org.fudaa.dodico.ef.EfLib; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; @@ -851,6 +852,11 @@ final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl_, this, projection.getNbFleche() == 0, new BCalqueLegende(), projection); + //-- ajout des infos de cr\xE9ation --// + pnVisu.infosCreation_.put(ZEbliCalquesPanel.NOM_FIC, projection.getFile().getName()); + pnVisu.infosCreation_.put(ZEbliCalquesPanel.PATH_FIC, projection.getFile().getAbsolutePath()); + pnVisu.infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC, projection.getTitle()); + // creation de l internalframe qui contient le panel de visu // final TrPostFille compFille = new TrPostFille(pnVisu); // creation de la scene layout identique a au dessus @@ -1142,6 +1148,11 @@ final TrPostSource source = listeSrc_.get(0); final TrPostVisuPanel pnVisu = source.buildVisuPanel(TrPostProjet.this, legendeCalque); + //-- ajout des infos de cr\xE9ation --// + pnVisu.infosCreation_.put(ZEbliCalquesPanel.NOM_FIC, source.getFile().getName()); + pnVisu.infosCreation_.put(ZEbliCalquesPanel.PATH_FIC, source.getFile().getAbsolutePath()); + pnVisu.infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC, source.getTitle()); + // -- ajout du visuPanel au layout --// final Point location = pnVisu.getLocation(); location.x += 10; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -8,7 +8,9 @@ package org.fudaa.fudaa.tr.post; import java.awt.Point; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.swing.ListModel; @@ -17,6 +19,7 @@ import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.fudaa.fdico.FDicoLib; import org.fudaa.fudaa.meshviewer.MvResource; @@ -165,6 +168,8 @@ public void run() { final boolean isOnImpGrid = pn.isCompareOnImportedGrid(); + Map<String,String> infosCreation_=new HashMap<String,String>(); + final TrPostSourceComparator comparaison = createSrcComparator(src, proj, pn.isGridEquals(), isOnImpGrid, pn .isCompareOnImportedTime(), impl, prog); comparaison.setInv(pn.isInv()); @@ -173,8 +178,32 @@ comparaisonZfn = createSrcComparator(srcZfn, toProjectZfn, pn.isGridEquals(), isOnImpGrid, pn .isCompareOnImportedTime(), impl, prog); comparaisonZfn.setInv(pn.isInv()); + + + } - + + if(pn.isInv() ) + infosCreation_.put(ZEbliCalquesPanel.DIFF_FIC, src.getFile().getName()+"-"+proj.getFile().getName()); + else + infosCreation_.put(ZEbliCalquesPanel.DIFF_FIC, proj.getFile().getName()+"-"+src.getFile().getName()); + + + //-- ajout des infos de cr\xE9ation --// + infosCreation_.put(ZEbliCalquesPanel.NOM_FIC+" 1", src.getFile().getName()); + infosCreation_.put(ZEbliCalquesPanel.PATH_FIC+" 1", src.getFile().getAbsolutePath()); + infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC+" 1", src.getTitle()); + infosCreation_.put(ZEbliCalquesPanel.NOM_FIC+" 2", proj.getFile().getName()); + infosCreation_.put(ZEbliCalquesPanel.PATH_FIC+" 2", proj.getFile().getAbsolutePath()); + infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC+" 2", proj.getTitle()); + if(isOnImpGrid) + infosCreation_.put(ZEbliCalquesPanel.MAILLAGE_FIC, proj.getFile().getName()); + else + infosCreation_.put(ZEbliCalquesPanel.MAILLAGE_FIC, src.getFile().getName()); + + + + // final TrPostProjet trPostProjet = new TrPostProjet(comparaison, impl); // -- creation de la legende --// @@ -183,7 +212,7 @@ final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl, projet, comparaison.getFlecheListModel().getSize() == 0, legendeCalque, comparaison); - + pnVisu.infosCreation_=infosCreation_; // final TrPostFille compFille = new TrPostFille(pnVisu); // compFille.addInternalFrameListener(new InternalFrameAdapter() { // public void internalFrameClosed(InternalFrameEvent _e) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -110,6 +110,15 @@ FSigLayerGroup traj_; + + TrPostTrajectoireLineLayer calqueAecraser_=null; + + + public TrPostTrajectoireComputeAndDisplayActivity(final TrPostVisuPanel calque,TrPostTrajectoireLineLayer c) { + this(calque); + calqueAecraser_=c; + } + public TrPostTrajectoireComputeAndDisplayActivity(final TrPostVisuPanel calque) { this.pn_ = calque; } @@ -125,7 +134,7 @@ * @param _prog l'interface de progression, peut etre null * @return */ - public String computeLigneCourant(final EfTrajectoireParameters _data, final CtuluAnalyze _analyse, + public String computeLigneCourant(TrPostVisuPanel vue2d,final EfTrajectoireParameters _data, final CtuluAnalyze _analyse, final ProgressionInterface _prog) { stop_ = false; // on recupere les lignes de courant @@ -149,13 +158,23 @@ lb.setAttributes(attDansOrdreIns.toArray(new GISAttributeInterface[attDansOrdreIns.size()]), null); lb.addAll(model, null, false); + String titreCalque=""; + if(calqueAecraser_==null){ CtuluDialogPanel pn = new CtuluDialogPanel(false); pn.setLayout(new BuGridLayout(2)); pn.addLabel(TrLib.getString("Indiquer le nom du calque \xE0 cr\xE9er")); JTextField tf = pn.addStringText(); tf.setColumns(10); pn.afficheModale(CtuluLibSwing.getActiveWindow(), getCalqueName(_data.isTrajectoire()), CtuluDialog.OK_OPTION); - final ZCalqueLigneBrisee la = createLayer(_data, dest, lb, tf.getText(), findAttributeForVariable(varAtttributes, + titreCalque=tf.getText(); + }else{ + titreCalque=calqueAecraser_.getTitle(); + //-- on detruit le calque apres rejoue de donn\xE9es --// + calqueAecraser_.setDestructible(true); + this.pn_.detruireCalque(calqueAecraser_); + + } + final ZCalqueLigneBrisee la = createLayer(vue2d,_data, dest, lb, titreCalque, findAttributeForVariable(varAtttributes, MARK)); dest.enPremier(la); return TrResource.TR.getString("Calque {0} cr\xE9\xE9", la.getTitle()); @@ -170,9 +189,9 @@ return null; } - private ZCalqueLigneBrisee createLayer(final EfTrajectoireParameters _data, final FSigLayerGroup dest, + private ZCalqueLigneBrisee createLayer(TrPostVisuPanel vue2d,final EfTrajectoireParameters _data, final FSigLayerGroup dest, final GISZoneCollectionLigneBrisee lb, String _title, GISAttributeInterface _mark) { - final ZCalqueLigneBrisee la = new TrPostTrajectoireLineLayer(new ZModeleLigneBriseeDefault(lb), _mark); + final ZCalqueLigneBrisee la = new TrPostTrajectoireLineLayer(vue2d,_data, new ZModeleLigneBriseeDefault(lb), _mark); la.setName(BGroupeCalque.findUniqueChildName(dest, getCalqueId(_data.isTrajectoire()))); la.setTitle(CtuluLibString.isEmpty(_title) ? createNewCalqueName(_data.isTrajectoire()) : _title); la Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -5,6 +5,7 @@ package org.fudaa.fudaa.tr.post; import java.awt.Graphics2D; +import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -12,6 +13,8 @@ import javax.swing.DefaultListModel; import javax.swing.DefaultListSelectionModel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; @@ -23,8 +26,10 @@ import org.fudaa.ctulu.gis.GISAttributeModelBooleanInterface; import org.fudaa.ctulu.gis.GISAttributeModelDoubleInterface; import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.dodico.ef.operation.EfTrajectoireParameters; import org.fudaa.ebli.calque.BCalquePersistenceInterface; import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliUIProperties; import org.fudaa.ebli.controle.BSelecteurListTarget; import org.fudaa.ebli.geometrie.GrBoite; @@ -32,12 +37,15 @@ import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.palette.BPalettePlage; import org.fudaa.ebli.palette.PaletteManager; +import org.fudaa.ebli.ressource.EbliResource; 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.impl.FudaaPanelTask; import org.fudaa.fudaa.sig.layer.FSigLayerLine; import org.fudaa.fudaa.tr.common.TrLib; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostTrajectoireTaskModel; /** * Le layer charge d'afficher les donn\xE9es d'une trajectoire @@ -55,8 +63,19 @@ Map<String, BPalettePlage> namePalette_; - public TrPostTrajectoireLineLayer(ZModeleLigneBrisee _modele, GISAttributeInterface _markAttr) { + TrPostVisuPanel vue2d_; + + /** + * Structures qui contient toutes les donn\xE9es importantes de construction de la trajectoire. + * A serialiser pour pouvoir rejouer les donnees. + */ + EfTrajectoireParameters dataMemory_; + + public TrPostTrajectoireLineLayer(TrPostVisuPanel vue2d,EfTrajectoireParameters _data,ZModeleLigneBrisee _modele, GISAttributeInterface _markAttr) { super(_modele); + + vue2d_=vue2d; + dataMemory_=_data; if (_markAttr == null) { markAttr_ = findMarkAttribute(_modele); } else markAttr_ = _markAttr; @@ -351,5 +370,33 @@ fireSelectionEvent(); repaint(); } + + + + + /** + * Surcharge des menus specifics, + * ajout d'un menu de rejoue de donn\xE9es pour les trajectoires/lignes de courant. + */ + protected void buildSpecificMenuItemsForAction(final List _l) { + super.buildSpecificMenuItemsForAction(_l); + + //-- ajour de l'action de rejouer les donn\xE9es --// + EbliActionSimple replayData=new EbliActionSimple("Rejouer les donn\xE9es",EbliResource.EBLI.getIcon("restore"), "REPLAYDATA"){ + public void actionPerformed(final ActionEvent _e) { + + new FudaaPanelTask(vue2d_.getCtuluUI(), new TrPostTrajectoireTaskModel(vue2d_,dataMemory_,TrPostTrajectoireLineLayer.this)).afficheDialog(); + } + }; + JMenuItem menuReplayTrajectoires=new JMenuItem(replayData); + + _l.add(menuReplayTrajectoires); + + } + + } + + + Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersist.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersist.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -0,0 +1,149 @@ +package org.fudaa.fudaa.tr.post; + +import java.util.Set; + +import org.fudaa.ebli.geometrie.GrPoint; + +import com.vividsolutions.jts.geom.Coordinate; + + + +/** + * Classe persistante du calque des trajectoires et lignes de courant. + * Est capable de stocker toutes les informations qui ont permis de g\xE9n\xE9rer les trajectoires/lignes de courant et de les rejouer. + * @author Adrien Hadoux + * + */ +public class TrPostTrajectoireLineLayerPersist { + + /** + * booleen: + * true: trajectoire + * false:lignes de courant + */ + boolean isTrajectoire=false; + + /** + * point extr\xE9mit\xE9 du segment qui a servi pour le lach\xE9 de particules. + */ + Coordinate point1=null; + /** + * point extr\xE9mit\xE9 du segment qui a servi pour le lach\xE9 de particules. + */ + Coordinate point2=null; + + /** + * Duree du calcul + */ + double dureeCalcul; + + /** + * la finesse du calcul + */ + double finesse; + + /** + * Nb de d\xE9coupages du segment, ie nb de particules. + */ + int nbCesures; + + /** + * liste des variables pour lesquelles on voulait le calcul. + */ + Set<String> listeVariablesId=null; + + /** + * Type de marqueur utilis\xE9: + * 0:Aucun + * 1:A pas de temps constant + * 2: a distance constante + */ + int typeMarqueur; + + /** + * valeur delta des marqueurs si typeMarqueur!=0 + */ + double delta; + + public TrPostTrajectoireLineLayerPersist(){ + + } + + + public boolean isTrajectoire() { + return isTrajectoire; + } + + public void setTrajectoire(boolean isTrajectoire) { + this.isTrajectoire = isTrajectoire; + } + + public Coordinate getPoint1() { + return point1; + } + + public void setPoint1(Coordinate point1) { + this.point1 = point1; + } + + public Coordinate getPoint2() { + return point2; + } + + public void setPoint2(Coordinate point2) { + this.point2 = point2; + } + + public int getNbCesures() { + return nbCesures; + } + + public void setNbCesures(int nbCesures) { + this.nbCesures = nbCesures; + } + + public Set<String> getListeVariablesId() { + return listeVariablesId; + } + + public void setListeVariablesId(Set<String> listeVariablesId) { + this.listeVariablesId = listeVariablesId; + } + + public int getTypeMarqueur() { + return typeMarqueur; + } + + public void setTypeMarqueur(int typeMarqueur) { + this.typeMarqueur = typeMarqueur; + } + + public double getDelta() { + return delta; + } + + public void setDelta(double delta) { + this.delta = delta; + } + + + public double getFinesse() { + return finesse; + } + + + public void setFinesse(double finesse) { + this.finesse = finesse; + } + + + public double getDureeCalcul() { + return dureeCalcul; + } + + + public void setDureeCalcul(double dureeCalcul) { + this.dureeCalcul = dureeCalcul; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersistence.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersistence.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersistence.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -19,7 +19,7 @@ @Override protected BCalque addInParent(FSigLayerGroup _gr, BCalqueSaverInterface _cqName, GISZoneCollection _collection) { - TrPostTrajectoireLineLayer layer = new TrPostTrajectoireLineLayer(new ZModeleLigneBriseeDefault( + TrPostTrajectoireLineLayer layer = new TrPostTrajectoireLineLayer(null,null,new ZModeleLigneBriseeDefault( (GISZoneCollectionLigneBrisee) _collection), null); _gr.enDernier(layer); return layer; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -8,6 +8,8 @@ package org.fudaa.fudaa.tr.post; import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -145,6 +147,9 @@ MvExportFactory.startExport(fac, _impl, _selection); } + + + ActionAnimationTreeSelection anim_; TrPostInfoDelegate info_; @@ -331,6 +336,10 @@ //-- creation des actions specifiques au calque --// duplic.getController().buildActions(); + //-- duplic des infos de construction --// + duplic.infosCreation_=new HashMap<String, String>(infosCreation_); + + return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -6,6 +6,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,6 +42,8 @@ String idSource; GrBoite zoom_; + public Map<String,String> infos_=new HashMap<String,String>(); + TrPostVisuPanelPersistManager() { } @@ -55,6 +58,7 @@ simplified = panel.simplifiedInit; idSource = panel.getSource().getId(); zoom_ = panel.getVueCalque().getViewBoite(); + infos_=panel.infosCreation_; // //-- etape 2: on sauvegarde les donnees --// FudaaSaveZipWriter writer = null; try { @@ -109,7 +113,10 @@ TrPostVisuPanel newPanel = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, src); + //-- on remplit les infos --// + newPanel.infosCreation_=infos_; + //-- on verifie si il faut charger les donnees zippees ou laisser tout se recalculer --// final List<String> listeReloadSource=(List<String>) parameters.get("RELOAD"); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -39,6 +39,7 @@ import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.gis.GISZoneCollectionPoint; +import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.dodico.h2d.type.H2dVariableType; @@ -246,9 +247,9 @@ * @param implementation * @param modele */ - private CtuluDialogPanel constructDialog(TrPostVisuPanel vue2d, TrPostCommonImplementation implementation, EGModel modele,JComponent composantAdditionnel,boolean modeEdition,String title){ + private TrReplayDialog constructDialog(TrPostVisuPanel vue2d, TrPostCommonImplementation implementation, EGModel modele,JComponent composantAdditionnel,boolean modeEdition,String title){ implementation.createTask(TrResource.getS("Origine ")+" "+modele.getTitle()); - final CtuluDialogPanel pn = new CtuluDialogPanel(false); + final TrReplayDialog pn = new TrReplayDialog(false); pn.setLayout(new BuBorderLayout()); pn.setBorder(BuBorders.EMPTY3333); //pn.add(new BuLabel(CtuluLib.getS("S\xE9lectionner le fichier r\xE9sultat")), BuBorderLayout.NORTH); @@ -445,7 +446,32 @@ } - CtuluDialogPanel dialog_=null; + class TrReplayDialog extends CtuluDialogPanel{ + CtuluDialog dialog_; + + TrReplayDialog(boolean b){ + super(b); + } + + public int afficheModale(final Component _parent, final String _t, final int _option) { + dialog_= createDialog(_parent); + dialog_.setInitParent(_parent); + dialog_.setOption(_option); + if (_t != null) { + dialog_.setTitle(_t); + } + return dialog_.afficheDialogModal(); + } + + @Override + public void cancel() { + dialog_.dispose(); + } + + + } + + TrReplayDialog dialog_=null; /** * Constructeur d'une dialog qui affiche la vue 2d avec le point initial qui a servi a la creation du modele. * Ajoute \xE9galement la liste des variables \xE0 choisir. Il est possible dans la vue de s\xE9lectionner un autre point ou plusieurs. @@ -510,8 +536,7 @@ //-- on ferme l'interface courante --// if(dialog_!=null ) - - dialog_.cancel(); + dialog_.cancel(); //-- on rappelle l'interface --// getEvolTemporelleReplayData(newSrc, treeModel, modele, implementation); Modified: 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/actions/TrPostActionChooseAndCreateCalque.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -2,6 +2,7 @@ import java.awt.event.ActionEvent; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; @@ -56,6 +57,13 @@ .getPreferredSize(), pnVisu, legendeCalque); // -- ajout de l INFO de la source utilis\xE9e --// node.getWidget().getController().setDescription("Source: " + projet_.formatInfoSource(srcChoisie)); + + //-- ajout des infos de cr\xE9ation --// + pnVisu.infosCreation_.put(ZEbliCalquesPanel.NOM_FIC, srcChoisie.getFile().getName()); + pnVisu.infosCreation_.put(ZEbliCalquesPanel.PATH_FIC, srcChoisie.getFile().getAbsolutePath()); + pnVisu.infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC, srcChoisie.getTitle()); + + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java 2009-01-23 16:12:37 UTC (rev 4396) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java 2009-01-23 18:57:21 UTC (rev 4397) @@ -6,8 +6,10 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; import javax.swing.BorderFactory; import javax.swing.JButton; @@ -43,6 +45,9 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostFlecheContent; import org.fudaa.fudaa.tr.post.TrPostSource; +import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayer; +import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayerPersist; +import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayerPersistence; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; import org.fudaa.fudaa.tr.post.TrPostTrajectoireComputeAndDisplayActivity; @@ -56,454 +61,557 @@ public class TrPostTrajectoireTaskModel implements FudaaPanelTaskModel { - /** - * - */ - private static final double MAXDIST = 1E-3; + /** + * + */ + private static final double MAXDIST = 1E-3; - TrPostTrajectoireComputeAndDisplayActivity algoCalcul_; + TrPostTrajectoireComputeAndDisplayActivity algoCalcul_; - /** - * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque - */ + /** + * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque + */ - // ArrayList<TrPostSource> source_; - TrPostVisuPanel calque_; + // ArrayList<TrPostSource> source_; + TrPostVisuPanel calque_; - // choix mode - JComboBox choixMode_ = new JComboBox(new String[] { TrLib.getString("Lignes de courant"), - TrLib.getString("Trajectoires") }); + // choix mode + JComboBox choixMode_ = new JComboBox(new String[] { TrLib.getString("Lignes de courant"), + TrLib.getString("Trajectoires") }); - JComponent duree_; + JComponent duree_; - JComponent finesse_; + JComponent finesse_; - final MvLineChooser lineChooser_; - JComboBox cbFirstTime_; - JList listVar_; - ListModel modelPdt_; + final MvLineChooser lineChooser_; + JComboBox cbFirstTime_; + JList listVar_; + ListModel modelPdt_; - // donnees graphiques - // JDialog dialog_; + // donnees graphiques + // JDialog dialog_; - DefaultTableModel modelResult_; + DefaultTableModel modelResult_; - // results - // JPanel panelResults_; - /** - * Creation du panel graphique. - * - * @return - */ - // JPanel panelSegment_; - // finesse et duree et point - // private JPanel panelSeuil_; - // variables et pdt - // private JPanel panelVariables_; - TrPostSource source_; - CtuluValueEditorDouble doubleEditor_ = new CtuluValueEditorDouble(false); - CtuluValueEditorDouble doubleMarkEditor_ = new CtuluValueEditorDouble(false); - CtuluValueEditorInteger integerEditor_ = new CtuluValueEditorInteger(false); - JComboBox cbVitesse_; - JComponent nbPoints_; + // results + // JPanel panelResults_; + /** + * Creation du panel graphique. + * + * @return + */ + // JPanel panelSegment_; + // finesse et duree et point + // private JPanel panelSeuil_; + // variables et pdt + // private JPanel panelVariables_; + TrPostSource source_; + CtuluValueEditorDouble doubleEditor_ = new CtuluValueEditorDouble(false); + CtuluValueEditorDouble doubleMarkEditor_ = new CtuluValueEditorDouble(false); + CtuluValueEditorInteger integerEditor_ = new CtuluValueEditorInteger(false); + JComboBox cbVitesse_; + JComponent nbPoints_; - // choix segment - JComponent x_; - JComponent x2_; - JComponent y_; - JComponent y2_; - CtuluValueTimeEditor dureeEditor_; + // choix segment + JComponent x_; + JComponent x2_; + JComponent y_; + JComponent y2_; + CtuluValueTimeEditor dureeEditor_; - /** - * Constructeur reserv\xE9 au calques - * - * @param _builderParams - * @param _calque - * @param _modelGraphe - * @param _panelVariables - * @param _source - */ - public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque) { - calque_ = calque; - source_ = calque.getSource(); - int nbTimeStep = source_.getNbTimeStep(); - if (nbTimeStep < 2) choixMode_.setEnabled(false); - doubleEditor_.setFormatter(CtuluNumberFormatDefault.buildNoneFormatter(3, true)); - x_ = doubleEditor_.createEditorComponent(); - x2_ = doubleEditor_.createEditorComponent(); - y_ = doubleEditor_.createEditorComponent(); - y2_ = doubleEditor_.createEditorComponent(); + /** + * Constructeur reserv\xE9 au calques + * + * @param _builderParams + * @param _calque + * @param _modelGraphe + * @param _panelVariables + * @param _source + */ + public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque) { + calque_ = calque; + source_ = calque.getSource(); + int nbTimeStep = source_.getNbTimeStep(); + if (nbTimeStep < 2) choixMode_.setEnabled(false); + doubleEditor_.setFormatter(CtuluNumberFormatDefault.buildNoneFormatter(3, true)); + x_ = doubleEditor_.createEditorComponent(); + x2_ = doubleEditor_.createEditorComponent(); + y_ = doubleEditor_.createEditorComponent(); + y2_ = doubleEditor_.createEditorComponent(); - dureeEditor_ = new CtuluValueTimeEditor(); - dureeEditor_.setFmt(source_.getTimeFormatter()); - duree_ = dureeEditor_.createEditorComponent(); - double defaut = 60; - if (nbTimeStep > 2) { - defaut = (source_.getTimeStep(nbTimeStep - 1) - source_.getTimeStep(0)) / 2; - } - dureeEditor_.setValue(defaut, duree_); - integerEditor_.setVal(BuValueValidator.MIN(1)); - integerEditor_.setEditable(true); - nbPoints_ = integerEditor_.createEditorComponent(); - finesse_ = integerEditor_.createEditorComponent(); - integerEditor_.setValue(Integer.valueOf(1), nbPoints_); - integerEditor_.setValue(Integer.valueOf(1), finesse_); - lineChooser_ = new MvLineChooser(calque.getSelectedLine(), calque); - // modelVariables_ = source_.getNewVarListModel();//doit contenir les vecteurs - modelPdt_ = source_.getNewTimeListModel(); + dureeEditor_ = new CtuluValueTimeEditor(); + dureeEditor_.setFmt(source_.getTimeFormatter()); + duree_ = dureeEditor_.createEditorComponent(); + double defaut = 60; + if (nbTimeStep > 2) { + defaut = (source_.getTimeStep(nbTimeStep - 1) - source_.getTimeStep(0)) / 2; + } + dureeEditor_.setValue(defaut, duree_); + integerEditor_.setVal(BuValueValidator.MIN(1)); + integerEditor_.setEditable(true); + nbPoints_ = integerEditor_.createEditorComponent(); + finesse_ = integerEditor_.createEditorComponent(); + integerEditor_.setValue(Integer.valueOf(1), nbPoints_); + integerEditor_.setValue(Integer.valueOf(1), finesse_); + lineChooser_ = new MvLineChooser(calque.getSelectedLine(), calque); + // modelVariables_ = source_.getNewVarListModel();//doit contenir les vecteurs + modelPdt_ = source_.getNewTimeListModel(); - // -- construction de la dialog --// - } + // -- construction de la dialog --// + } - private List<Coordinate> getPoints() { - Coordinate c = getFirsCoordinate(); - Coordinate cEnd = getEndCoordinate(); - int nbLigne = (Integer) integerEditor_.getValue(nbPoints_); - List<Coordinate> res = new ArrayList<Coordinate>(nbLigne); - if (c.distance(cEnd) < MAXDIST) { - res.add(c); - return res; - } - if (nbLigne == 1) { - c.x = (c.x + cEnd.x) / 2D; - c.y = (c.y + cEnd.y) / 2D; - res.add(c); - return res; - } - int nbIteration = nbLigne - 1; - double deltaX = (cEnd.x - c.x) / nbIteration; - double deltaY = (cEnd.y - c.y) / nbIteration; - res.add(c); - for (int i = 1; i < nbIteration; i++) { - Coordinate ci = new Coordinate(c.x + i * deltaX, c.y + i * deltaY); - res.add(ci); - } - res.add(cEnd); - return res; - } + /** + * reference du layer a ecraser dans le cas ou l'on rejoue les donn\xE9es. + * Null si utilisation classique. + */ + TrPostTrajectoireLineLayer layerAEcraser_=null; + /** + * Constructeur appel\xE9 pour rejouer les donn\xE9es. + * Passe en parametre la structure efTrajectoire qui contient toutes les infos de pr\xE9 remplissage + * @param calque + * @param dataReplay qui contient toutes les infos de pr\xE9 remplissage + * @param calqueAEcraser calque a ecraser en recopiant le r\xE9sultat par dessus + */ + public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque,EfTrajectoireParameters dataReplay,TrPostTrajectoireLineLayer calqueAEcraser){ + this(calque); - private Coordinate getEndCoordinate() { - return new Coordinate(getDoubleValue(x2_), getDoubleValue(y2_)); - } + //-- on pr\xE9remplit les donn\xE9es avec les infos du dataReplay --// + layerAEcraser_=calqueAEcraser; - private Coordinate getFirsCoordinate() { - return new Coordinate(getDoubleValue(x_), getDoubleValue(y_)); - } + //-- on reinitialise les infos avec les donn\xE9es des trajectoires/lignes de courant. --// + //-- on initialise les params graphiques --// + getPanel(); + + //-- selection du vecteur vitesse --// + for(int k=0;k<cbVitesse_.getItemCount();k++) + if( ((TrPostFlecheContent) cbVitesse_.getItemAt(k)).getVx()== dataReplay.vx) + if( ((TrPostFlecheContent) cbVitesse_.getSelectedItem()).getVy()== dataReplay.vy) + cbVitesse_.setSelectedIndex(k); - public void actTask(final ProgressionInterface _prog, final CtuluAnalyze _analyze, final String[] _messages) { - // on recupere les points - List<Coordinate> points = getPoints(); - int idxRemove = 0; - // on enleve les points en dehors - for (Iterator<Coordinate> it = points.iterator(); it.hasNext();) { - Coordinate c = it.next(); - int idx = EfIndexHelper.getElementEnglobant(source_.getGrid(), c.x, c.y, _prog); - if (idx < 0) { - idxRemove++; - it.remove(); - } - } - // si pas de point pas de calcul - if (points.size() == 0) { - _analyze.addFatalError(TrResource.getS("Aucun point de d\xE9part n'appartient au maillage")); - return; - } - if (idxRemove > 0) { - String txt = null; - if (idxRemove == 1) { - txt = TrResource.getS("1 point de d\xE9part a \xE9t\xE9 ignor\xE9 car il en dehors du maillage"); - } else { - txt = TrResource.getS("{0} points de d\xE9part ont \xE9t\xE9 ignor\xE9s car ils en dehors du maillage", CtuluLibString - .getString(idxRemove)); - } - _messages[0] = txt; - } + //-- duree itegration --// + dureeEditor_.setValue( dataReplay.dureeIntegration_, duree_); - // creation de l algo - algoCalcul_ = new TrPostTrajectoireComputeAndDisplayActivity(calque_); + //-- finesse --// + integerEditor_.setValue( dataReplay.finesse_, finesse_); - final TrPostFlecheContent flecheContent = getSelectedVariable(); - final EfTrajectoireParameters data = new EfTrajectoireParameters(); - data.vx = flecheContent.getVx(); - data.vy = flecheContent.getVy(); - data.dureeIntegration_ = getDuree(); - data.finesse_ = (Integer) integerEditor_.getValue(finesse_); - data.firstTimeStepIdx_ = getSelectedTimeStep(); - data.firstTimeStep_ = source_.getTimeStep(data.firstTimeStepIdx_); - data.isLigneDeCourant = isLigneCourant(); - if (!listVar_.isSelectionEmpty()) { - Object[] selectedValues = listVar_.getSelectedValues(); - data.varsASuivre_ = new ArrayList<CtuluVariable>(selectedValues.length); - for (int i = 0; i < selectedValues.length; i++) { - data.varsASuivre_.add((CtuluVariable) selectedValues[i]); - } - } + //-- pas de temps initial --// + cbFirstTime_.setSelectedIndex(dataReplay.firstTimeStepIdx_); - data.points_ = points; - if (isMarqueurAvailable()) { - data.marqueur_ = new EfTrajectoireParametersMarqueur(); - data.marqueur_.timeStep_ = isMarqueurTimeStep(); - data.marqueur_.deltaMax_ = (Double) doubleMarkEditor_.getValue(markValue_); + //-- type traj ou ligne de courant --// + if(dataReplay.isLigneDeCourant) + choixMode_.setSelectedIndex(0); + else + choixMode_.setSelectedIndex(1); + + //-- choix des variables --// + if (dataReplay.varsASuivre_.size()>1) { - } - _messages[0] = algoCalcul_.computeLigneCourant(data, _analyze, _prog); + int[] indicesToselect=new int[dataReplay.varsASuivre_.size()]; + for(int i=0;i<dataReplay.varsASuivre_.size();i++){ + + for(int k=0;k<listVar_.getModel().getSize();k++){ + if(((CtuluVariable)listVar_.getModel().getElementAt(k))==dataReplay.varsASuivre_.get(i)) + indicesToselect[i]=k; + } + } + listVar_.setSelectedIndices(indicesToselect); + } + + //-- premier point --// + doubleEditor_.setValue(dataReplay.points_.get(0).x, x_); + doubleEditor_.setValue(dataReplay.points_.get(0).y, y_); - // -- mise a jour du tableau de res --// - // modelResult_.fireTableDataChanged(); + //-- dernier point --// + doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size()-1).x, x2_); + doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size()-1).y, y2_); + + //-- marqueurs --// + if(dataReplay.marqueur_ !=null){ + if(dataReplay.marqueur_.timeStep_) + cbMarks_.setSelectedIndex(1); + else + cbMarks_.setSelectedIndex(2); + + doubleMarkEditor_.setValue(dataReplay.marqueur_.deltaMax_, markValue_); + }else + cbMarks_.setSelectedIndex(0); + + } - } + private List<Coordinate> getPoints() { + Coordinate c = getFirsCoordinate(); + Coordinate cEnd = getEndCoordinate(); + int nbLigne = (Integer) integerEditor_.getValue(nbPoints_); + List<Coordinate> res = new ArrayList<Coordinate>(nbLigne); + if (c.distance(cEnd) < MAXDIST) { + res.add(c); + return res; + } + if (nbLigne == 1) { + c.x = (c.x + cEnd.x) / 2D; + c.y = (c.y + cEnd.y) / 2D; + res.add(c); + return res; + } + int nbIteration = nbLigne - 1; + double deltaX = (cEnd.x - c.x) / nbIteration; + double deltaY = (cEnd.y - c.y) / nbIteration; + res.add(c); + for (int i = 1; i < nbIteration; i++) { + Coordinate ci = new Coordinate(c.x + i * deltaX, c.y + i * deltaY); + res.add(ci); + } + res.add(cEnd); + return res; - JPanel content_; - JComponent markValue_; - JComboBox cbMarks_ = new JComboBox(new String[] { TrLib.getString("Aucun"), - TrLib.getString("A pas de temps constant"), TrLib.getString("A distance constante") }); + } - public boolean isMarqueurAvailable() { - return cbMarks_.getSelectedIndex() != 0; - } + private Coordinate getEndCoordinate() { + return new Coordinate(getDoubleValue(x2_), getDoubleValue(y2_)); + } - public boolean isMarqueurTimeStep() { - return cbMarks_.getSelectedIndex() == 1; - } + private Coordinate getFirsCoordinate() { + return new Coordinate(getDoubleValue(x_), getDoubleValue(y_)); + } - private JPanel buildMarqueur() { - doubleMarkEditor_.setVal(BuValueValidator.MIN(1E-4)); - final JPanel conteneur = new JPanel(new BuGridLayout(2, 3, 3)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Marqueurs"))); - conteneur.add(new JLabel(TrLib.getString("Type"))); - conteneur.add(cbMarks_); - conteneur.add(new JLabel(TrLib.getString("Delta (valeur absolue)"))); - markValue_ = doubleMarkEditor_.createEditorComponent(); - conteneur.add(markValue_); - markValue_.setEnabled(false); - cbMarks_.addItemListener(new ItemListener() { + public void actTask(final ProgressionInterface _prog, final CtuluAnalyze _analyze, final String[] _messages) { + // on recupere les points + List<Coordinate> points = getPoints(); + int idxRemove = 0; + // on enleve les points en dehors + for (Iterator<Coordinate> it = points.iterator(); it.hasNext();) { + Coordinate c = it.next(); + int idx = EfIndexHelper.getElementEnglobant(source_.getGrid(), c.x, c.y, _prog); + if (idx < 0) { + idxRemove++; + it.remove(); + } + } + // si pas de point pas de calcul + if (points.size() == 0) { + _analyze.addFatalError(TrResource.getS("Aucun point de d\xE9part n'appartient au maillage")); + return; + } + if (idxRemove > 0) { + String txt = null; + if (idxRemove == 1) { + txt = TrResource.getS("1 point de d\xE9part a \xE9t\xE9 ignor\xE9 car il en dehors du maillage"); + } else { + txt = TrResource.getS("{0} points de d\xE9part ont \xE9t\xE9 ignor\xE9s car ils en dehors du maillage", CtuluLibString + .getString(idxRemove)); + } + _messages[0] = txt; + } - public void itemStateChanged(ItemEvent _e) { - markValue_.setEnabled(isMarqueurAvailable()); - } - }); + //-- creation de la donn\xE9e persistante qui a permi de creer les infos --// + // TrPostTrajectoireLineLayerPersist persist=new TrPostTrajectoireLineLayerPersist(); + // persist.setPoint1(getFirsCoordinate()); + // persist.setPoint2(getEndCoordinate()); + // persist.setTrajectoire(isTrajectoire()); + // persist.setFinesse((Integer) integerEditor_.getValue(finesse_)); + // persist.setDureeCalcul(getDuree()); + // persist.setNbCesures((Integer)integerEditor_.getValue(nbPoints_)); + Object[] selectedValues = listVar_.getSelectedValues(); + // HashSet<String> listeVar= new HashSet<String>(); + // for(int i=0;i<selectedValues.length;i++) + // listeVar.add(((CtuluVariable)selectedValues[i]).getID()); + // persist.setListeVariablesId(listeVar); + // if(isMarqueurTimeStep()) + // persist.setTypeMarqueur(1); + // else if(isMarqueurAvailable()) + // persist.setTypeMarqueur(2); + // else + // persist.setTypeMarqueur(0); + // + // creation de l algo + if(layerAEcraser_!=null) + algoCalcul_ = new TrPostTrajectoireComputeAndDisplayActivity(calque_,layerAEcraser_); + else + algoCalcul_ = new TrPostTrajectoireComputeAndDisplayActivity(calque_); - return conteneur; - } + final TrPostFlecheContent flecheContent = getSelectedVariable(); + final EfTrajectoireParameters data = new EfTrajectoireParameters(); + data.vx = flecheContent.getVx(); + data.vy = flecheContent.getVy(); + data.dureeIntegration_ = getDuree(); + data.finesse_ = (Integer) integerEditor_.getValue(finesse_); + data.firstTimeStepIdx_ = getSelectedTimeStep(); + data.firstTimeStep_ = source_.getTimeStep(data.firstTimeStepIdx_); + data.isLigneDeCourant = isLigneCourant(); + if (!listVar_.isSelectionEmpty()) { - public boolean isSegmentValid() { - final boolean segValid = !doubleEditor_.isEmpty(x_) && !doubleEditor_.isEmpty(x2_) && !doubleEditor_.isEmpty(y2_) - && !doubleEditor_.isEmpty(y_); - return segValid && integerEditor_.getValue(nbPoints_) != null; - } + data.varsASuivre_ = new ArrayList<CtuluVariable>(selectedValues.length); + for (int i = 0; i < selectedValues.length; i++) { + data.varsASuivre_.add((CtuluVariable) selectedValues[i]); + } + } - public double getDoubleValue(final JComponent c) { - return ((Double) doubleEditor_.getValue(c)).doubleValue(); - } + data.points_ = points; + if (isMarqueurAvailable()) { + data.marqueur_ = new EfTrajectoireParametersMarqueur(); + data.marqueur_.timeStep_ = isMarqueurTimeStep(); + data.marqueur_.deltaMax_ = (Double) doubleMarkEditor_.getValue(markValue_); - protected void updateView(final boolean _zoom) { - if (isSegmentValid()) { - lineChooser_.update(GISGeometryFactory.INSTANCE.createSegment(getDoubleValue(x_), getDoubleValue(y_), - getDoubleValue(x2_), getDoubleValue(y2_)), _zoom); - } - } + } + _messages[0] = algoCalcul_.computeLigneCourant(calque_,data, _analyze, _prog); - private JPanel buildSegments() { + // -- mise a jour du tableau de res --// + // modelResult_.fireTableDataChanged(); - final JPanel conteneur = new JPanel(new BuGridLayout(3, 5, 5, false, false, false, false, false)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du segment"))); - conteneur.add(new JLabel("")); - conteneur.add(new JLabel("x:")); - conteneur.add(new JLabel("y:")); - conteneur.add(new JLabel("Point 1:")); - conteneur.add(x_); - conteneur.add(y_); - conteneur.add(new JLabel("Point 2:")); - conteneur.add(x2_); - conteneur.add(y2_); - conteneur.add(new JLabel("Nombre de trajectoire/lignes de courant:")); - conteneur.add(nbPoints_); - final LineString initSelected = lineChooser_.getInitSelected(); - if (initSelected != null) { - final int nbCoordinate = initSelected.getNumPoints(); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getX(0), x_); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getY(0), y_); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getX(nbCoordinate - 1), x2_); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getY(nbCoordinate - 1), y2_); - updateView(false); - } - JPanel mainSegment = new JPanel(new BuVerticalLayout(5, false, true)); - mainSegment.add(conteneur); - JPanel pn = new JPanel(new BuGridLayout(3, 2, 0)); - JButton bt = new JButton(TrLib.getString("zoomer sur le segment")); - bt.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - updateView(true); + } - } - }); - pn.add(bt); - bt = new JButton(TrLib.getString("Zoom initial")); - bt.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - lineChooser_.zoomInitial(); + JPanel content_; + JComponent markValue_; + JComboBox cbMarks_ = new JComboBox(new String[] { TrLib.getString("Aucun"), + TrLib.getString("A pas de temps constant"), TrLib.getString("A distance constante") }); - } - }); - pn.add(bt); - bt = new JButton(EbliLib.getS("Restaurer")); - bt.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - lineChooser_.restaurer(); + public boolean isMarqueurAvailable() { + return cbMarks_.getSelectedIndex() != 0; + } - } - }); - pn.add(bt); - mainSegment.add(pn); - return mainSegment; - } + public boolean isMarqueurTimeStep() { + return cbMarks_.getSelectedIndex() == 1; + } - private JPanel buildVariables() { - final JPanel conteneur = new JPanel(new BorderLayout()); - listVar_ = new JList(source_.getNewVarListModel()); - listVar_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - conteneur.add(new JScrollPane(listVar_)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables"))); - return conteneur; - } + private JPanel buildMarqueur() { + doubleMarkEditor_.setVal(BuValueValidator.MIN(1E-4)); + final JPanel conteneur = new JPanel(new BuGridLayout(2, 3, 3)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Marqueurs"))); + conteneur.add(new JLabel(TrLib.getString("Type"))); + conteneur.add(cbMarks_); + conteneur.add(new JLabel(TrLib.getString("Delta (valeur absolue)"))); + markValue_ = doubleMarkEditor_.createEditorComponent(); + conteneur.add(markValue_); + markValue_.setEnabled(false); + cbMarks_.addItemListener(new ItemListener() { - public void decoreBtApply(final JButton _bt) { - _bt.setText(TrLib.getString("Calculer")); - } + public void itemStateChanged(ItemEvent _e) { + markValue_.setEnabled(isMarqueurAvailable()); - public int getNbMessageMax() { - return 1; - } + } + }); - public JComponent getPanel() { - if (content_ != null) return content_; - content_ = new BuPanel(new BuVerticalLayout(5)); - content_.add(buildMainProperties()); + return conteneur; + } - // -- panel des segements --// - content_.add(buildSegments()); - // -- panel des variables --// - content_.add(buildVariables()); - content_.add(buildMarqueur()); - return content_; - } + public boolean isSegmentValid() { + final boolean segValid = !doubleEditor_.isEmpty(x_) && !doubleEditor_.isEmpty(x2_) && !doubleEditor_.isEmpty(y2_) + && !doubleEditor_.isEmpty(y_); + return segValid && integerEditor_.getValue(nbPoints_) != null; + } - private JPanel buildMainProperties() { - JPanel pn = new JPanel(new BuGridLayout(2, 5, 5)); - pn.add(new JLabel(TrResource.getS("Mode"))); - pn.add(choixMode_); - pn.add(new JLabel(TrResource.getS("Vecteur"))); - ListModel flecheListModel = source_.getNewFlecheListModel(); - CtuluComboBoxModelAdapter cb = new CtuluComboBoxModelAdapter(flecheListModel); - cbVitesse_ = new BuComboBox(cb); - cb.setSelectedItem(flecheListModel.getElementAt(0)); - // on s\xE9lectionne la vitesse par defaut - if (flecheListModel.getSize() > 1) { - for (int i = flecheListModel.getSize() - 1; i >= 0; i--) { - TrPostFlecheContent flecheContent = (TrPostFlecheContent) flecheListModel.getElementAt(i); - if (flecheContent.getVar() == H2dVariableType.VITESSE) { - cb.setSelectedItem(flecheListModel.getElementAt(i)); - break; - } - } - } - pn.add(cbVitesse_); - pn.add(new JLabel(TrResource.getS("Pas de temps intial"))); - cbFirstTime_ = new BuComboBox(new CtuluComboBoxModelAdapter(source_.getNewTimeListModel())); - cbFirstTime_.setSelectedIndex(0); - pn.add(cbFirstTime_); - pn.add(new JLabel(TrResource.getS("Dur\xE9e d'int\xE9gration:"))); - pn.add(duree_); - pn.add(new JLabel(TrResource.getS("Finesse:"))); - ... [truncated message content] |
From: <de...@us...> - 2009-01-25 22:20:26
|
Revision: 4401 http://fudaa.svn.sourceforge.net/fudaa/?rev=4401&view=rev Author: deniger Date: 2009-01-25 22:20:21 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsBuilder.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/reflux/io/RefluxSolutionSequentielReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 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/MvProfileBuilderFromTree.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspector.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderSerafin.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/TrPostProjetChooser.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/TrPostRubarLoader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceOneTimeStep.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceProjected.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceRubarZFN.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.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/data/TrPostDataCreationPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataInfoDoc.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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigTempLineInLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderInterface.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderSerafin.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsBuilder.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsBuilder.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -71,7 +71,7 @@ return res_; } -public LineString getInitLine_() { +public LineString getInitLine() { return initLine_; } } Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/reflux/io/RefluxSolutionSequentielReader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/reflux/io/RefluxSolutionSequentielReader.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/reflux/io/RefluxSolutionSequentielReader.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -217,4 +217,11 @@ ch_.close(); } } + + /** + * @return the nbPoint + */ + public int getNbPoint() { + return nbPoint_; + } } \ No newline at end of file Deleted: 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 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -1,116 +0,0 @@ -/** - * 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(); - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -7,14 +7,12 @@ */ package org.fudaa.fudaa.meshviewer.profile; +import gnu.trove.TDoubleArrayList; + import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.swing.JComboBox; - -import gnu.trove.TDoubleArrayList; - import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; @@ -26,14 +24,15 @@ import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.calque.BCalqueLegende; -import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.commun.EbliFormatter; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; -import org.fudaa.fudaa.tr.post.TrPostCourbeTreeModel; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; +import org.fudaa.fudaa.tr.post.TrPostSourceAbstract; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; import org.fudaa.fudaa.tr.post.TrReplayCurvesData; import org.fudaa.fudaa.tr.post.actions.TrPostProfileAction; @@ -46,401 +45,390 @@ */ public class MVProfileCourbeModel implements MvProfileCourbeModelInterface { - private int time_; - EfGridData data_; - EfLineIntersectionsResultsI res_; - EfLineIntersectionsResultsBuilder builder_; - String title_; + private int time_; + EfGridData data_; + EfLineIntersectionsResultsI res_; + EfLineIntersectionsResultsBuilder builder_; + String title_; - CtuluVariable variable_; + CtuluVariable variable_; - TDoubleArrayList y_; + TDoubleArrayList y_; - double yMax_; + double yMax_; - double yMin_; + double yMin_; - private MVProfileCourbeModel(final CtuluVariable _variable, final EfGridData _data, - final EfLineIntersectionsResultsI _res, final int _timeStep, final double[] _y, - final EfLineIntersectionsResultsBuilder _builder) { - super(); - variable_ = _variable; - data_ = _data; - res_ = _res; - title_ = _variable.toString(); - time_ = _timeStep; - builder_ = _builder; - y_ = new TDoubleArrayList(_y); - } + private MVProfileCourbeModel(final CtuluVariable _variable, final EfGridData _data, + final EfLineIntersectionsResultsI _res, final int _timeStep, final double[] _y, + final EfLineIntersectionsResultsBuilder _builder) { + super(); + variable_ = _variable; + data_ = _data; + res_ = _res; + title_ = _variable.toString(); + time_ = _timeStep; + builder_ = _builder; + y_ = new TDoubleArrayList(_y); + } - public MVProfileCourbeModel(final CtuluVariable _variable, final EfGridData _data, final int _timeStep, - final EfLineIntersectionsResultsBuilder _builder, final ProgressionInterface _prog) { - super(); - variable_ = _variable; - data_ = _data; - title_ = _variable.toString(); - time_ = _timeStep; - builder_ = _builder; - if (builder_ != null) res_ = builder_.createResults(_timeStep, _prog); - y_ = new TDoubleArrayList(res_.getNbIntersect()); - computeY(_prog); - } + public MVProfileCourbeModel(final CtuluVariable _variable, final EfGridData _data, final int _timeStep, + final EfLineIntersectionsResultsBuilder _builder, final ProgressionInterface _prog) { + super(); + variable_ = _variable; + data_ = _data; + title_ = _variable.toString(); + time_ = _timeStep; + builder_ = _builder; + if (builder_ != null) res_ = builder_.createResults(_timeStep, _prog); + y_ = new TDoubleArrayList(res_.getNbIntersect()); + computeY(_prog); + } - /** - * ACHTUNG: Constructeur uniquement utilis\xE9 pour la persistance des donn\xE9es. - */ - public MVProfileCourbeModel(){ - super(); - } + /** + * ACHTUNG: Constructeur uniquement utilis\xE9 pour la persistance des donn\xE9es. + */ + public MVProfileCourbeModel() { + super(); + } - public boolean addValue(final double _x, final double _y, final CtuluCommandContainer _cmd) { - return false; - } + public boolean addValue(final double _x, final double _y, final CtuluCommandContainer _cmd) { + return false; + } - public boolean addValue(final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { - return false; - } + public boolean addValue(final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { + return false; + } - /** - * Recalcule les y en fonction des informations fournises. - * @param _prog - */ - public final void computeY(final ProgressionInterface _prog) { - final CtuluRange range = new CtuluRange(); - res_ = builder_.createResults(time_, _prog); + /** + * Recalcule les y en fonction des informations fournises. + * + * @param _prog + */ + public final void computeY(final ProgressionInterface _prog) { + final CtuluRange range = new CtuluRange(); + res_ = builder_.createResults(time_, _prog); - if(y_==null) - y_=new TDoubleArrayList(); + if (y_ == null) y_ = new TDoubleArrayList(); - y_.ensureCapacity(res_.getNbIntersect()); - y_.resetQuick(); - for (int i = 0; i < res_.getNbIntersect(); i++) { - double val = 0; - if (res_.getIntersect(i).isRealIntersection()) { - val = res_.getIntersect(i).getValue(variable_, time_); - range.expandTo(val); - } - y_.add(val); - } - if (range.isNill()) { - yMax_ = 0; - yMin_ = 0; - } else { - yMax_ = range.getMax(); - yMin_ = range.getMin(); - } - } + y_.ensureCapacity(res_.getNbIntersect()); + y_.resetQuick(); + for (int i = 0; i < res_.getNbIntersect(); i++) { + double val = 0; + if (res_.getIntersect(i).isRealIntersection()) { + val = res_.getIntersect(i).getValue(variable_, time_); + range.expandTo(val); + } + y_.add(val); + } + if (range.isNill()) { + yMax_ = 0; + yMin_ = 0; + } else { + yMax_ = range.getMax(); + yMin_ = range.getMin(); + } + } - public boolean deplace(final int[] _selectIdx, final double _deltaX, final double _deltaY, - final CtuluCommandContainer _cmd) { - return false; - } + public boolean deplace(final int[] _selectIdx, final double _deltaX, final double _deltaY, + final CtuluCommandContainer _cmd) { + return false; + } - public MVProfileCourbeModel duplicate() { - final MVProfileCourbeModel res = new MVProfileCourbeModel(variable_, data_, res_, time_, y_.toNativeArray(), - builder_); - res.yMax_ = yMax_; - res.yMin_ = yMin_; - return res; - } + public MVProfileCourbeModel duplicate() { + final MVProfileCourbeModel res = new MVProfileCourbeModel(variable_, data_, res_, time_, y_.toNativeArray(), + builder_); + res.yMax_ = yMax_; + res.yMin_ = yMin_; + return res; + } - public void fillWithInfo(InfoData _table, CtuluListSelectionInterface _selectedPt) { - if(EbliWidget.AMELIO_LOT_VISIBLE){ - String pdt="N\xB0"+this.time_; - if(this.data_ instanceof TrPostSource){ - TrPostSource src=(TrPostSource)this.data_; - _table.put(TrResource.getS("Type"),"Profil spatial"); - _table.put(TrResource.getS("Fichier r\xE9sultat"),src.getFile().getName()); - _table.put(TrResource.getS("Chemin complet"),src.getFile().getAbsolutePath()); - _table.put(TrResource.getS("Titre Fichier r\xE9sultat"),src.getTitle()); - if(this.time_!=-1 && this.time_<src.getNbTimeStep()) - pdt+=": "+src.getTimeStep(this.time_); - } - if(this.variable_!=null) - _table.put(TrResource.getS("Variable"),this.variable_.getName()+" en "+this.variable_.getCommonUnit()); - _table.put(TrResource.getS("Pas de temps "),pdt); - - LineString polyligne=builder_.getInitLine_(); - if(polyligne!=null){ - _table.put(TrResource.getS("Polyligne, nb pts"),""+polyligne.getNumPoints()); - _table.put(TrResource.getS("Point d\xE9but"),"("+polyligne.getCoordinateN(0).x+";"+polyligne.getCoordinateN(0).y+")"); - _table.put(TrResource.getS("Point fin"),"("+polyligne.getCoordinateN(polyligne.getNumPoints()-1).x+";"+polyligne.getCoordinateN(polyligne.getNumPoints()-1).y+")"); - - } + EbliFormatter formater = new EbliFormatter(); + public void fillWithInfo(InfoData _table, CtuluListSelectionInterface _selectedPt) { + if (EbliWidget.AMELIO_LOT_VISIBLE) { + String pdt = "N\xB0" + this.time_; + if (this.data_ instanceof TrPostSource) { + _table.put(TrResource.getS("Type"), "Profil spatial"); + TrPostSource src = (TrPostSource) this.data_; + TrPostSourceAbstract.fillWithSourceInfo(_table, src); + if (this.time_ != -1 && this.time_ < src.getNbTimeStep()) pdt += ": " + + src.getTime().getTimeListModel().getElementAt(this.time_); + } + if (this.variable_ != null) _table.put(MvResource.getS("Variable"), this.variable_.getName() + " en " + + this.variable_.getCommonUnit()); + _table.put(MvResource.getS("Pas de temps"), pdt); - } - } + LineString polyligne = builder_.getInitLine(); + if (polyligne != null) { + _table.put(MvResource.getS("Polyligne, nb pts"), Integer.toString(polyligne.getNumPoints())); + _table.put(MvResource.getS("Point d\xE9but"), "(" + formater.getFormatter().format(polyligne.getCoordinateN(0).x) + + ";" + formater.getFormatter().format(polyligne.getCoordinateN(0).y) + ")"); + _table.put(MvResource.getS("Point fin"), "(" + + formater.getFormatter().format(polyligne.getCoordinateN(polyligne.getNumPoints() - 1).x) + ";" + + formater.getFormatter().format(polyligne.getCoordinateN(polyligne.getNumPoints() - 1).y) + ")"); - public int getActiveTimeIdx() { - return 0; - } + } - public int getNbValues() { - return res_.getNbIntersect(); - } + } + } - public EfLineIntersectionsResultsI getRes() { - return res_; - } + public int getActiveTimeIdx() { + return 0; + } - public int getTime() { - return time_; - } + public int getNbValues() { + return res_.getNbIntersect(); + } - public String getTitle() { - return title_; - } + public EfLineIntersectionsResultsI getRes() { + return res_; + } - public CtuluVariable getVariable() { - return variable_; - } + public int getTime() { + return time_; + } - public double getX(final int _idx) { - return res_.getDistFromDeb(_idx); - } + public String getTitle() { + return title_; + } - public double getXMax() { - return res_.getDistFromDeb(getNbValues() - 1); - } + public CtuluVariable getVariable() { + return variable_; + } - public double getXMin() { - return 0; - } + public double getX(final int _idx) { + return res_.getDistFromDeb(_idx); + } - public double getY(final int _idx) { - return y_.getQuick(_idx); - } + public double getXMax() { + return res_.getDistFromDeb(getNbValues() - 1); + } - public double getYMax() { - return yMax_; - } + public double getXMin() { + return 0; + } - public double getYMin() { - return yMin_; - } + public double getY(final int _idx) { + return y_.getQuick(_idx); + } - public boolean isActiveTimeEnable() { - return false; - } + public double getYMax() { + return yMax_; + } - public boolean isDuplicatable() { - return true; - } + public double getYMin() { + return yMin_; + } - public boolean isModifiable() { - return false; - } + public boolean isActiveTimeEnable() { + return false; + } - public boolean isPointDrawn(final int _i) { - return res_.getIntersect(_i).isRealIntersection(); - } + public boolean isDuplicatable() { + return true; + } - public boolean isRemovable_=false; - public boolean isRemovable() { - return isRemovable_; - } + public boolean isModifiable() { + return false; + } - public boolean isSegmentDrawn(final int _i) { - return res_.isSegmentIn(_i); - } + public boolean isPointDrawn(final int _i) { + return res_.getIntersect(_i).isRealIntersection(); + } - public boolean isTitleModifiable() { - return true; - } + public boolean isRemovable_ = false; - public boolean isVisibleLong() { - return false; - } + public boolean isRemovable() { + return isRemovable_; + } - public boolean isXModifiable() { - return false; - } + public boolean isSegmentDrawn(final int _i) { + return res_.isSegmentIn(_i); + } - public boolean removeValue(final int _i, final CtuluCommandContainer _cmd) { - return false; - } + public boolean isTitleModifiable() { + return true; + } - public boolean removeValue(final int[] _i, final CtuluCommandContainer _cmd) { - return false; - } + public boolean isVisibleLong() { + return false; + } - public void reupdateY() { - computeY(null); + public boolean isXModifiable() { + return false; + } - } + public boolean removeValue(final int _i, final CtuluCommandContainer _cmd) { + return false; + } - public void setRes(final EfLineIntersectionsResultsBuilder _builder, final ProgressionInterface _prog) { - builder_ = _builder; - computeY(_prog); - } + public boolean removeValue(final int[] _i, final CtuluCommandContainer _cmd) { + return false; + } - public void setTime(final int _time) { - if (time_ != _time && _time >= 0) { - time_ = _time; - computeY(null); - } - } + public void reupdateY() { + computeY(null); - public boolean setTitle(final String _newName) { - title_ = _newName; - return true; - } + } - public boolean setValue(final int _i, final double _x, final double _y, final CtuluCommandContainer _cmd) { - return false; - } + public void setRes(final EfLineIntersectionsResultsBuilder _builder, final ProgressionInterface _prog) { + builder_ = _builder; + computeY(_prog); + } - public boolean setValues(final int[] _idx, final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { - return false; - } + public void setTime(final int _time) { + if (time_ != _time && _time >= 0) { + time_ = _time; + computeY(null); + } + } - public void setVariable(final CtuluVariable _variable, final boolean _contentChanged) { - variable_ = _variable; - if (_contentChanged && data_.isDefined(_variable)) { - computeY(null); - } - } + public boolean setTitle(final String _newName) { + title_ = _newName; + return true; + } + public boolean setValue(final int _i, final double _x, final double _y, final CtuluCommandContainer _cmd) { + return false; + } + public boolean setValues(final int[] _idx, final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { + return false; + } + public void setVariable(final CtuluVariable _variable, final boolean _contentChanged) { + variable_ = _variable; + if (_contentChanged && data_.isDefined(_variable)) { + computeY(null); + } + } + public Object getPersistSpecificDatas() { + // -- retourne le quatuor point, pdt,variable et fichier source + ArrayList<Object> listeData = new ArrayList<Object>(); + // listeData.add(this.); - public Object getPersistSpecificDatas() { - //-- retourne le quatuor point, pdt,variable et fichier source - ArrayList<Object> listeData=new ArrayList<Object>(); - //listeData.add(this.); + // -- ajout du pas de temps --// + listeData.add(new Integer(time_)); - //-- ajout du pas de temps --// - listeData.add(new Integer(time_)); + // -- ajout de la variable --// + listeData.add(this.variable_.getID()); - //-- ajout de la variable --// - listeData.add(this.variable_.getID()); + // -- ajout de la polyligne --// + listeData.add(builder_.getInitLine()); - //-- ajout de la polyligne --// - listeData.add(builder_.getInitLine_()); + // -- ajout des datas --// + if (data_ instanceof TrPostSource) { + listeData.add(((TrPostSource) data_).getId()); + } - //-- ajout des datas --// - if(data_ instanceof TrPostSource){ - listeData.add(((TrPostSource)data_).getId()); - } + return listeData; + } + public void setPersistSpecificDatas(Object data, Map infos) { - return listeData; - } + if (data == null || !(data instanceof ArrayList)) return; + ArrayList<Object> liste = (ArrayList<Object>) data; + TrPostProjet projet = (TrPostProjet) infos.get("TrPostProjet"); + TrPostSource src = null; + // -- etape 1: le pas de temps --// + this.time_ = (Integer) liste.get(0); - public void setPersistSpecificDatas(Object data, Map infos) { + // -- etape 2 la variable --// + String idVar = (String) liste.get(1); + H2dVariableType var = null;// (H2dVariableType) liste.get(1); - if(data ==null || !(data instanceof ArrayList))return; - ArrayList<Object> liste=(ArrayList<Object>)data; + // -- etape 3: la polyligne --// + LineString polyligne = (LineString) liste.get(2); - TrPostProjet projet = (TrPostProjet) infos.get("TrPostProjet"); - TrPostSource src = null; - //-- etape 1: le pas de temps --// - this.time_=(Integer) liste.get(0); + // -- etape 4: recherche du source qui contient le path donn\xE9 --// + if (projet != null && liste.size() >= 4) { + String idSource = (String) liste.get(3); + src = projet.findSourceById(idSource); + if (src != null) this.data_ = src; + else { + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la frame graphe ne trouve pas le fichier r\xE9sultat qui correspond \xE0 l'ID " + idVar); + return; + } + } else { + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la frame graphe ne trouve pas le fichier r\xE9sultat qui correspond \xE0 l'ID " + idVar); + return; + } + // -- recherche dans les sources de la variable par id --// + for (int i = 0; i < src.getAvailableVar().length; i++) + if (src.getAvailableVar()[i].getID().equals(idVar)) var = src.getAvailableVar()[i]; - //-- etape 2 la variable --// - String idVar=(String)liste.get(1); - H2dVariableType var=null;//(H2dVariableType) liste.get(1); + if (var != null) this.variable_ = var; + else { + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la frame graphe ne trouve pas la variable qui correspond \xE0 l'ID " + idVar); + return; + } + // -- on rejoue les donn\xE9es: --// + // -- creation du resultBuilder: --// + TrPostVisuPanel panelUtilise = new TrPostVisuPanel(projet.impl_, projet, new BCalqueLegende(), src); + MvProfileTarget target = new TrPostProfileAction.ProfileAdapter(src, projet); + MvProfileBuilder builder = new MvProfileBuilderFromLine(target, projet.impl_, polyligne, panelUtilise, + new MvProfileCoteTester()); + // -- intersectionResultI --// + this.res_ = builder.getDefaultRes(this.variable_, projet.impl_.getMainProgression()); + // -- EfLineIntersectionsResultsBuilder --// + this.builder_ = new EfLineIntersectionsResultsBuilder(polyligne, this.res_, new MvProfileCoteTester()); + // -- rejouer les donn\xE9es --// + this.computeY(projet.impl_.getMainProgression()); + } - //-- etape 3: la polyligne --// - LineString polyligne=(LineString) liste.get(2); + public void viewGenerationSource(Map infos, CtuluUI impl) { - // -- etape 4: recherche du source qui contient le path donn\xE9 --// - if (projet != null && liste.size()>=4){ - String idSource=(String) liste.get(3); - src = projet.findSourceById(idSource); - if(src!=null) - this.data_=src; - else{ - ((List<String>) infos.get("errorMsg")) - .add("Erreur, la frame graphe ne trouve pas le fichier r\xE9sultat qui correspond \xE0 l'ID " + idVar); - return; - } - } - else{ - ((List<String>) infos.get("errorMsg")) - .add("Erreur, la frame graphe ne trouve pas le fichier r\xE9sultat qui correspond \xE0 l'ID " + idVar); - return; - } - //-- recherche dans les sources de la variable par id --// - for(int i=0;i<src.getAvailableVar().length;i++) - if(src.getAvailableVar()[i].getID().equals(idVar)) - var=src.getAvailableVar()[i]; + if (!(impl instanceof TrPostCommonImplementation)) { + impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); + return; + } + TrPostCommonImplementation implementation = (TrPostCommonImplementation) impl; - if(var!=null) - this.variable_=var; - else{ - ((List<String>) infos.get("errorMsg")) - .add("Erreur, la frame graphe ne trouve pas la variable qui correspond \xE0 l'ID " + idVar); - return; - } + // -- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// + TrReplayCurvesData.getInstance().getProfilSpatialOrigine(this, implementation); - //-- on rejoue les donn\xE9es: --// - //-- creation du resultBuilder: --// - TrPostVisuPanel panelUtilise=new TrPostVisuPanel(projet.impl_,projet,new BCalqueLegende(),src); - MvProfileTarget target=new TrPostProfileAction.ProfileAdapter(src,projet); - MvProfileBuilder builder=new MvProfileBuilderFromLine(target,projet.impl_,polyligne,panelUtilise,new MvProfileCoteTester()); + } - //-- intersectionResultI --// - this.res_=builder.getDefaultRes(this.variable_, projet.impl_.getMainProgression()); + public EfGridData getData() { + return data_; + } - //-- EfLineIntersectionsResultsBuilder --// - this.builder_=new EfLineIntersectionsResultsBuilder(polyligne,this.res_,new MvProfileCoteTester()); + public void setData(EfGridData _data) { + this.data_ = _data; + } - //-- rejouer les donn\xE9es --// - this.computeY(projet.impl_.getMainProgression()); - } - public void viewGenerationSource(Map infos, CtuluUI impl){ + public EfLineIntersectionsResultsBuilder getBuilder() { + return builder_; + } - if(!(impl instanceof TrPostCommonImplementation)){ - impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); - return; - } - TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; + public void setBuilder(EfLineIntersectionsResultsBuilder _builder) { + this.builder_ = _builder; + } - //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().getProfilSpatialOrigine(this, implementation); - - } + public void replayData(org.fudaa.ebli.courbe.EGGrapheTreeModel model, Map infos, CtuluUI impl) { + if (!(impl instanceof TrPostCommonImplementation)) { + impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); + return; + } + TrPostCommonImplementation implementation = (TrPostCommonImplementation) impl; + if (!(this.getData() instanceof TrPostSource)) { + implementation.error("Impossible de r\xE9cup\xE9rer le fichier r\xE9sulat depuis ce type de profil spatial."); + return; + } + // -- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// + TrReplayCurvesData.getInstance().getProfilSpatialReplayData((TrPostSource) this.getData(), + (MvProfileTreeModel) model, this, implementation); - public EfGridData getData() { - return data_; - } + } - public void setData(EfGridData _data) { - this.data_ = _data; - } - - public EfLineIntersectionsResultsBuilder getBuilder() { - return builder_; - } - - public void setBuilder(EfLineIntersectionsResultsBuilder _builder) { - this.builder_ = _builder; - } - - - public void replayData(org.fudaa.ebli.courbe.EGGrapheTreeModel model,Map infos, CtuluUI impl) { - if(!(impl instanceof TrPostCommonImplementation)){ - impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); - return; - } - TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; - if(!(this.getData() instanceof TrPostSource)){ - implementation.error("Impossible de r\xE9cup\xE9rer le fichier r\xE9sulat depuis ce type de profil spatial."); - return; - } - //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().getProfilSpatialReplayData((TrPostSource) this.getData(),(MvProfileTreeModel)model, this, implementation); - - - } - - } Modified: 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 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvLineChooser.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -20,6 +20,7 @@ import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.fudaa.meshviewer.MvResource; +import org.fudaa.fudaa.sig.layer.FSigTempLineInLayer; import com.memoire.bu.BuBorders; import com.memoire.bu.BuLabel; 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 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -30,7 +30,6 @@ import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; -import org.fudaa.fudaa.tr.post.TrPostSource; import com.memoire.bu.BuBorders; import com.memoire.bu.BuGlassPaneStop; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -132,7 +132,7 @@ resNode_ = _resNode; builderNode_ = _builderNode; if(builderNode_!=null ) - initLineNode=builderNode_.getInitLine_(); + initLineNode=builderNode_.getInitLine(); } @@ -146,7 +146,7 @@ resMesh_ = _resMeshes; builderMesh_ = _builderMeshes; if(builderMesh_!=null ) - initLineMesh=builderMesh_.getInitLine_(); + initLineMesh=builderMesh_.getInitLine(); } Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigTempLineInLayer.java (from rev 4358, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/FSigTempLineInLayer.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigTempLineInLayer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigTempLineInLayer.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -0,0 +1,116 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.fudaa.sig.layer; + +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; + } + + public 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. + */ + public 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(); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -401,8 +401,7 @@ public void fillWithInfo(InfoData _table, CtuluListSelectionInterface _selectedPt) { if(EbliWidget.AMELIO_LOT_VISIBLE){ _table.put(TrResource.getS("Type"),"Evolution temporelle"); - _table.put(TrResource.getS("Fichier r\xE9sultat"),this.source_.getFile().getName()); - _table.put(TrResource.getS("Chemin complet"),this.source_.getFile().getAbsolutePath()); + TrPostSourceAbstract.fillWithSourceInfo(_table, source_); _table.put(TrResource.getS("Titre Fichier r\xE9sultat"),this.source_.getTitle()); _table.put(TrResource.getS("Infos Point initial"),this.getInfosPoint()); _table.put(TrResource.getS("Variable"),this.getVar().getName()+" en "+this.getVar().getCommonUnitString()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspector.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspector.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspector.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -23,6 +23,8 @@ import com.memoire.fu.FuLog; /** + * TODO a revoir entierement + * * @author fred deniger * @version $Id: TrPostInspector.java,v 1.10 2007-06-05 09:01:14 deniger Exp $ */ @@ -46,7 +48,7 @@ stop(); return; } - src_.setInspected(true); + // src_.setInspected(true); } if (reader_ != null) { @@ -224,12 +226,13 @@ if (timer_ == null) { timer_ = new Timer(); } - if (reader_ == null) { - reader_ = proj_.createWatcher(src_); - } + // TODO a revoir +// if (reader_ == null) { +// reader_ = proj_.createWatcher(src_); +// } if (reader_ == null) { return; } if (proj_ != null && src_ != null) { - src_.setInspected(true); + // src_.setInspected(true); } reader_.setProgression(panel_); @@ -241,7 +244,7 @@ reader_.close(); reader_ = null; if (proj_ != null && src_ != null) { - src_.setInspected(false); + // src_.setInspected(false); } BuLib.invokeLater(new Runnable() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderReflux.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderReflux.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderReflux.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -53,7 +53,7 @@ public TrPostInspectorReaderReflux(final TrPostProjet _prj, final TrPostSource _src) { super(); - file_ = _src.getFile(); + file_ = _src.getFiles().iterator().next(); prj_ = _prj; src_ = _src; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderRubar.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderRubar.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderRubar.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -76,7 +76,7 @@ if (fmt != null) { // les formats qui seront a recharger final Set<FileFormat> fmtToLoad = new HashSet<FileFormat>(fmt.length); - final String name = CtuluLibFile.getSansExtension(loader_.getSrc().getFile().getName()); + final String name = CtuluLibFile.getSansExtension(loader_.getSrc().getMainFile().getName()); for (int i = fmt.length - 1; i >= 0; i--) { final int idx = FileFormat.findFileFormat(loader_.availFmt_, fmt[i]); if (idx < 0) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderSerafin.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderSerafin.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostInspectorReaderSerafin.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -69,7 +69,7 @@ super(); prj_ = _prj; src_ = _src; - serafin_ = _src.getFile(); + serafin_ = _src.getFiles().iterator().next(); tmpDir_ = null; casFile_ = null; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -14,9 +14,8 @@ import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Observable; @@ -62,7 +61,6 @@ import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetControllerGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGrapheController; import org.fudaa.fudaa.commun.courbe.FudaaGrapheTimeAnimatedVisuPanel; import org.fudaa.fudaa.fdico.FDicoLib; import org.fudaa.fudaa.meshviewer.MvResource; @@ -74,7 +72,6 @@ import org.fudaa.fudaa.tr.post.data.TrPostDataListener; import org.fudaa.fudaa.tr.post.persist.TrPostPersistenceManager; import org.fudaa.fudaa.tr.post.save.TrPostProjetSaver; -import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuBorderLayout; @@ -104,9 +101,6 @@ */ public class TrPostProjet implements ActionListener { - - - /** * Manager de sauvegarder/charghement des donn\xE9es */ @@ -391,7 +385,7 @@ */ public void ajouterSource(final TrPostSource _src) { _src.addVariableListener(new VariableListener()); - if (_src.getFile() == null || !isSourceLoaded(_src.getFile().getAbsolutePath())) { + if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { listeSrc_.add(_src); _src.buildDefaultVarUpdateLists(); @@ -406,6 +400,10 @@ } } + + public TrPostSource findSource(final String _file) { + return findSource(new File(_file)); + } /** * retourne la source dans la liste des sources correspondant au fichier. retourne null sinon. @@ -413,16 +411,35 @@ * @param _file : path absolu du fichier * @return */ - public TrPostSource findSource(final String _file) { + public TrPostSource findSource(final File _file) { for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { final TrPostSource src = it.next(); - if (src.getFile().getAbsolutePath().equals(_file)) return src; + if (src.isOpened(_file)) return src; } return null; } + public TrPostSource findSource(final Collection<File> _file) { + + for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { + final TrPostSource src = it.next(); + if (isOpenedIn(_file, src)) return src; + } + return null; + } + + private boolean isOpenedIn(Collection<File> files, TrPostSource _in) { + if (_in == null) return false; + for (File file : files) { + if (_in.isOpened(file)) return true; + + } + return false; + + } + /** * Retourne la source asscoi\xE9 a l id. * @@ -439,17 +456,26 @@ return null; } + public boolean isSourceLoaded(final String _file) { + return isSourceLoaded(new File(_file)); + } + /** * indique si il existe une source portant le nom du fichier en param. * * @param _file : path absolu du fichier * @return */ - public boolean isSourceLoaded(final String _file) { + public boolean isSourceLoaded(final File _file) { if (findSource(_file) == null) return false; return true; } + public boolean isOneSourceLoaded(final Collection<File> _files) { + if (findSource(_files) == null) return false; + return true; + } + // /** // * methode qui change la source courante et retourne true si la source existe bien, false sinon // * @@ -470,7 +496,7 @@ */ public boolean removeSource(final TrPostSource src, final int n) { - if (isSourceLoaded(src.getFile().getAbsolutePath())) { + if (isOneSourceLoaded(src.getFiles())) { listeSrc_.remove(src); // --recuperation du menu simul --// @@ -517,7 +543,8 @@ */ public String formatInfoSource(final TrPostSource _src) { // --ajout dans la liste des titres --// - return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(_src.getFile()); + Collection<File> files = _src.getFiles(); + return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(files.iterator().next()); } public String formatFichier(final File file) { @@ -557,8 +584,8 @@ */ public void construitMenuPostSpecifiqueSource(final TrPostSource _src) { - final BuMenu menuSimul = new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFile()), "SIMULATION" - + (listeSrc_.size())); + final BuMenu menuSimul = new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), + "SIMULATION" + (listeSrc_.size())); // -- ajout du menu au menu post --// getMenuPost().add(menuSimul); @@ -587,24 +614,24 @@ listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Projeter..."), "PROJECT", ic, TrPostProjet.this)); listSousMenus.get(listSousMenus.size() - 1).setToolTipText( TrResource.getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); - if (_src != null && _src.isInspectable()) { - menuSimul.addSeparator(); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Rafra\xEEchir les r\xE9sultats"), "MAJ_DATA", ic, - TrPostProjet.this)); - listSousMenus.get(listSousMenus.size() - 1).setToolTipText( - TrResource.getS("Les fichiers de r\xE9sultats seront relus")); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Rafra\xEEchir automatiquement"), "MAJ_DATA_ALWAYS", ic, - TrPostProjet.this)); - listSousMenus.get(listSousMenus.size() - 1).setToolTipText( - TrResource.getS("Les fichiers sont surveill\xE9s p\xE9riodiquement")); - menuSimul.addSeparator(); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this)); - _src.addSpecificItemInMainMenu(menuSimul, getImpl()); + // if (_src != null ) { + menuSimul.addSeparator(); + // listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Rafra\xEEchir les r\xE9sultats"), "MAJ_DATA", ic, + // TrPostProjet.this)); + // listSousMenus.get(listSousMenus.size() - 1).setToolTipText( + // TrResource.getS("Les fichiers de r\xE9sultats seront relus")); + // listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Rafra\xEEchir automatiquement"), "MAJ_DATA_ALWAYS", ic, + // TrPostProjet.this)); + // listSousMenus.get(listSousMenus.size() - 1).setToolTipText( + // TrResource.getS("Les fichiers sont surveill\xE9s p\xE9riodiquement")); + // menuSimul.addSeparator(); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this)); + _src.addSpecificItemInMainMenu(menuSimul, getImpl()); - // -- ajout de la sous liste de menus pour la garder en memoire --// - getlisteSousMenuProjets_().add(listSousMenus); + // -- ajout de la sous liste de menus pour la garder en memoire --// + getlisteSousMenuProjets_().add(listSousMenus); - } + // } } /** @@ -674,23 +701,28 @@ } }); getMenuPost().addMenuItem(TrResource.getS(("Fusionner avec un autre projet POST")), "FUSIONPOST", - CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { + CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - - final int reponse = JOptionPane.showConfirmDialog(getImpl().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) { - getManager().saveProject(false); - } - - getManager().loadProject(false, null); - //-- on reinitialise le nom path du projet a null pour qu'il soit redemand\xE9 lors de la nouvelle sauvegarde --// - getManager().setProjet_(null); + public void actionPerformed(final ActionEvent _e) { - } - }); + final int reponse = JOptionPane + .showConfirmDialog( + getImpl().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) { + getManager().saveProject(false); + } + getManager().loadProject(false, null); + // -- on reinitialise le nom path du projet a null pour qu'il soit redemand\xE9 lors de la nouvelle sauvegarde + // --// + getManager().setProjet_(null); + + } + }); + getMenuPost().addSeparator(TrResource.getS("Gestion")); // -- ajout de l action de gestion des simus dans post --// final BuMenuItem item = new BuMenuItem(TrResource.getS("Gestion Multi-Fichiers r\xE9sultats")); @@ -808,9 +840,9 @@ } - TrPostInspectorReader createWatcher(final TrPostSource _src) { - return _src.createWatcher(this, true); - } + // TrPostInspectorReader createWatcher(final TrPostSource _src) { + // return _src.createWatcher(this, true); + // } boolean openSrcDataAndIsModified(final CtuluUI _ui, final ProgressionInterface _prog) { return new TrPostProjetSaver(this).openSrcDataAndIsModified(_ui, _prog); @@ -852,11 +884,11 @@ final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl_, this, projection.getNbFleche() == 0, new BCalqueLegende(), projection); - //-- ajout des infos de cr\xE9ation --// - pnVisu.infosCreation_.put(ZEbliCalquesPanel.NOM_FIC, projection.getFile().getName()); - pnVisu.infosCreation_.put(ZEbliCalquesPanel.PATH_FIC, projection.getFile().getAbsolutePath()); + // -- ajout des infos de cr\xE9ation --// + // TODO centralise tout cela \xFC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + TrPostSourceAbstract.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, pnVisu.infosCreation_, projection); pnVisu.infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC, projection.getTitle()); - + // creation de l internalframe qui contient le panel de visu // final TrPostFille compFille = new TrPostFille(pnVisu); // creation de la scene layout identique a au dessus @@ -962,19 +994,17 @@ _pn.getGraphe().restore(); if (_desc != null) nodeG.getWidget().getController().setDescription(_desc); currentLayoutFilleOrFirst.getScene().setSelectedObjects(Collections.emptySet()); - - //-- ajout syst\xE9matique de la legende associee --// - EbliWidgetControllerGraphe controller=(EbliWidgetControllerGraphe)nodeG.getWidget().getIntern().getController(); + + // -- ajout syst\xE9matique de la legende associee --// + EbliWidgetControllerGraphe controller = (EbliWidgetControllerGraphe) nodeG.getWidget().getIntern() + .getController(); controller.ajoutLegende(); } }); - //getImpl().getCurrentLayoutFilleOrFirst().getScene().refresh(); - - - - + // getImpl().getCurrentLayoutFilleOrFirst().getScene().refresh(); + } protected void buildTimeUpdater() { @@ -1071,16 +1101,16 @@ // else if ("IMPORTER_RESULTS".equals(commandeBrute) && item == _event.getSource()) { // importerVars(); // } - else if ("MAJ_DATA_ALWAYS".equals(commandeBrute) && item == _event.getSource()) { - if (source.isInspected()) { return; } - new TrPostInspector(this, source).start(); - } else if ("MAJ_DATA".equals(commandeBrute) && item == _event.getSource()) { - final TrPostInspectorReader watcher = source.createWatcher(this, false); - if (watcher != null) { - watcher.read(); - watcher.close(); - } - } + // else if ("MAJ_DATA_ALWAYS".equals(commandeBrute) && item == _event.getSource()) { + // if (source.isInspected()) { return; } + // new TrPostInspector(this, source).start(); + // } else if ("MAJ_DATA".equals(commandeBrute) && item == _event.getSource()) { + // final TrPostInspectorReader watcher = source.createWatcher(this, false); + // if (watcher != null) { + // watcher.read(); + // watcher.close(); + // } + // } } } @@ -1148,16 +1178,17 @@ final TrPostSource source = listeSrc_.get(0); final TrPostVisuPanel pnVisu = source.buildVisuPanel(TrPostProjet.this, legendeCalque); - //-- ajout des infos de cr\xE9ation --// - pnVisu.infosCreation_.put(ZEbliCalquesPanel.NOM_FIC, source.getFile().getName()); - pnVisu.infosCreation_.put(ZEbliCalquesPanel.PATH_FIC, source.getFile().getAbsolutePath()); - pnVisu.infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC, source.getTitle()); - + // -- ajout des infos de cr\xE9ation --// + // TODO Adrien centralise tout cela !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // c'est la source qui doit donner ces info: modifier TrPostSource ! + TrPostSourceAbstract.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, pnVisu.infosCreation_, source); + // -- ajout du visuPanel au layout --// final Point location = pnVisu.getLocation(); location.x += 10; location.y += 10; - filleLayout.addCalque("Calque "+(filleLayout.getScene().getAllVue2d().size()+1), location, pnVisu.getPreferredSize(), pnVisu, legendeCalque); + filleLayout.addCalque("Calque " + (filleLayout.getScene().getAllVue2d().size() + 1), location, pnVisu + .getPreferredSize(), pnVisu, legendeCalque); // -- decoration de la fille layout --// filleLayout.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); @@ -1315,16 +1346,18 @@ * @return */ public String deliverSourceId(TrPostSource src) { + String idString = src.getFiles().iterator().next().getName(); if (src.getId() == null) { - String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(src.getFile().getName()); + + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); src.setId(uniqueId); } else { // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// - String nameFormate = FuLib.clean(src.getFile().getName()); + String nameFormate = FuLib.clean(idString); String id = src.getId(); if (!id.startsWith(nameFormate)) { - String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(src.getFile().getName()); + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); src.setId(uniqueId); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java 2009-01-24 22:16:05 UTC (rev 4400) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java 2009-01-25 22:20:21 UTC (rev 4401) @@ -73,7 +73,7... [truncated message content] |
From: <had...@us...> - 2009-01-26 18:36:04
|
Revision: 4402 http://fudaa.svn.sourceforge.net/fudaa/?rev=4402&view=rev Author: hadouxad Date: 2009-01-26 18:35:58 +0000 (Mon, 26 Jan 2009) Log Message: ----------- fonction suite de calcul 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/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt 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/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderInterface.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderSerafin.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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/ branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/org.eclipse.mylyn.bugzilla.core/ 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/TrPostSourceReaderComposite.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-25 22:20:21 UTC (rev 4401) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenu.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -23,6 +23,7 @@ import java.util.Hashtable; import java.util.Vector; +import javax.swing.Action; import javax.swing.Icon; import javax.swing.JMenu; import javax.swing.JMenuItem; @@ -41,112 +42,112 @@ * File, Edition, Windows and Help. */ public class BuMenu - extends JMenu - implements BuMenuInterface //ActionListener +extends JMenu +implements BuMenuInterface //ActionListener { - private boolean left_; + private boolean left_; - public BuMenu() - { this("Menu","MENU",true,0); } + public BuMenu() + { this("Menu","MENU",true,0); } - public BuMenu(String _label, String _cmd) - { this(_label,_cmd,null,false,0); } + public BuMenu(String _label, String _cmd) + { this(_label,_cmd,null,false,0); } - public BuMenu(String _label, String _cmd, Icon _icon) - { this(_label,_cmd,_icon,false,0); } + public BuMenu(String _label, String _cmd, Icon _icon) + { this(_label,_cmd,_icon,false,0); } - public BuMenu(String _label, String _cmd, boolean _tearoff) - { this(_label,_cmd,null,_tearoff,0); } + public BuMenu(String _label, String _cmd, boolean _tearoff) + { this(_label,_cmd,null,_tearoff,0); } - public BuMenu(String _label, String _cmd, boolean _tearoff, int _key) - { this(_label,_cmd,null,_tearoff,0); } + public BuMenu(String _label, String _cmd, boolean _tearoff, int _key) + { this(_label,_cmd,null,_tearoff,0); } - public BuMenu(String _label, String _cmd, Icon _icon, - boolean _tearoff, int _key) - { - super(null,_tearoff); + public BuMenu(String _label, String _cmd, Icon _icon, + boolean _tearoff, int _key) + { + super(null,_tearoff); - setName("mn"+_cmd); - setActionCommand(_cmd); - setHorizontalTextPosition(SwingConstants.RIGHT); - Icon icon=_icon; - if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); - if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; + setName("mn"+_cmd); + setActionCommand(_cmd); + setHorizontalTextPosition(SwingConstants.RIGHT); + Icon icon=_icon; + if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); + if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; - if(icon instanceof BuIcon) setIcon((BuIcon)icon); - else setIcon(icon); + if(icon instanceof BuIcon) setIcon((BuIcon)icon); + else setIcon(icon); - setText((_label==null) ?"":_label); + setText((_label==null) ?"":_label); - // TMP - // getPopupMenu().setLightWeightPopupEnabled(false); - } + // TMP + // getPopupMenu().setLightWeightPopupEnabled(false); + } - public boolean isLeft() - { - return left_; - } + public boolean isLeft() + { + return left_; + } - public void setLeft(boolean _left) - { - left_=_left; - } + public void setLeft(boolean _left) + { + left_=_left; + } - /*GCJ-BEGIN*/ - private boolean isLeft(Component _m, Point _p) - { - if(_p.x<0 ) return true; - if(_m==null) return false; + /*GCJ-BEGIN*/ + private boolean isLeft(Component _m, Point _p) + { + if(_p.x<0 ) return true; + if(_m==null) return false; - Component p=_m; + Component p=_m; - while(!(p instanceof BuMenu)) - { - p=(p instanceof JPopupMenu) - ? ((JPopupMenu)p).getInvoker() - : p.getParent(); - if(p==null) return false; - } + while(!(p instanceof BuMenu)) + { + p=(p instanceof JPopupMenu) + ? ((JPopupMenu)p).getInvoker() + : p.getParent(); + if(p==null) return false; + } - Point q=((BuMenu)p).getPopupMenuOrigin(); - p=p.getParent(); - return isLeft(p,q); - } + Point q=((BuMenu)p).getPopupMenuOrigin(); + p=p.getParent(); + return isLeft(p,q); + } - protected Point getPopupMenuOrigin() - { - Point r=super.getPopupMenuOrigin(); - //System.err.println("BMN: getPopupMenuOrigin "+r) + protected Point getPopupMenuOrigin() + { + Point r=super.getPopupMenuOrigin(); + //System.err.println("BMN: getPopupMenuOrigin "+r) - JPopupMenu pm=getPopupMenu(); - pm.putClientProperty("SLAF_LEFT_POPUPMENU",Boolean.FALSE); + JPopupMenu pm=getPopupMenu(); + pm.putClientProperty("SLAF_LEFT_POPUPMENU",Boolean.FALSE); - if(isLeft()||isLeft(getParent(),r)) - { - Container pt=getParent(); - if(pt instanceof JPopupMenu) - { - // Dimension dp=pt.getSize(); - r=new Point(pt.getX()-pm.getPreferredSize().width - -UIManager.getInt("Menu.submenuPopupOffsetX"),r.y); - pm.putClientProperty("SLAF_LEFT_POPUPMENU",Boolean.TRUE); - } - } + if(isLeft()||isLeft(getParent(),r)) + { + Container pt=getParent(); + if(pt instanceof JPopupMenu) + { + // Dimension dp=pt.getSize(); + r=new Point(pt.getX()-pm.getPreferredSize().width + -UIManager.getInt("Menu.submenuPopupOffsetX"),r.y); + pm.putClientProperty("SLAF_LEFT_POPUPMENU",Boolean.TRUE); + } + } - return r; - } - /*GCJ-END*/ + return r; + } + /*GCJ-END*/ - /* + /* public void setMenuLocation(int _x,int _y) { System.err.println("BMN: setMenuLocation "+_x+","+_y); super.setMenuLocation(_x,_y); } - */ + */ - // Essai - /* + // Essai + /* protected WinListener createWinListener(JPopupMenu p) { System.err.println("%%% BuPM: create win listener"); @@ -168,307 +169,314 @@ return super.createWinListener(p); } - */ + */ - // Icon + // Icon - public Icon getIcon() - { - if(BuPreferences.BU.getBooleanProperty("icons.menu",true)|| - (super.getText()==null)) - return super.getIcon(); - return null; - } + public Icon getIcon() + { + if(BuPreferences.BU.getBooleanProperty("icons.menu",true)|| + (super.getText()==null)) + return super.getIcon(); + return null; + } - public void setIcon(BuIcon _icon) - { - BuLib.setIcon(this,_icon); - } + public void setIcon(BuIcon _icon) + { + BuLib.setIcon(this,_icon); + } - // Translation + // Translation - protected String _(String _s) - { - return BuResource.BU.getString(_s); - } + protected String _(String _s) + { + return BuResource.BU.getString(_s); + } - protected static final String __(String _s) - { - return BuResource.BU.getString(_s); - } + protected static final String __(String _s) + { + return BuResource.BU.getString(_s); + } - // Anti-aliasing + // Anti-aliasing - public void paint(Graphics _g) - { - BuLib.setAntialiasing(this,_g); - super.paint(_g); - } + public void paint(Graphics _g) + { + BuLib.setAntialiasing(this,_g); + super.paint(_g); + } - // Mnemonics + // Mnemonics - public void computeMnemonics() - { - Component[] c=getPopupMenu().getComponents(); - Hashtable t=new Hashtable(); + public void computeMnemonics() + { + Component[] c=getPopupMenu().getComponents(); + Hashtable t=new Hashtable(); - //MenuElement[] c=getSubElements(); - //try { c=getMenuComponents(); } - //catch(Exception ex) { } // swing 1.03 + //MenuElement[] c=getSubElements(); + //try { c=getMenuComponents(); } + //catch(Exception ex) { } // swing 1.03 - { - int mn=getMnemonic(); - if(mn>0) t.put(FuFactoryInteger.get(mn),this); - } + { + int mn=getMnemonic(); + if(mn>0) t.put(FuFactoryInteger.get(mn),this); + } - for(int i=0; i<c.length; i++) - { - if(c[i] instanceof JMenuItem) - { - JMenuItem mi=(JMenuItem)c[i]; - int mn=mi.getMnemonic(); - if(mn<=0) + for(int i=0; i<c.length; i++) + { + if(c[i] instanceof JMenuItem) + { + JMenuItem mi=(JMenuItem)c[i]; + int mn=mi.getMnemonic(); + if(mn<=0) + { + String tx=BuLib.candidateMnemonics(mi.getText()); + if(tx!=null) + for(int j=0;j<tx.length();j++) + { + mn=tx.charAt(j); + if(t.get(FuFactoryInteger.get(mn))==null) + { + t.put(FuFactoryInteger.get(mn),mi); + mi.setMnemonic(mn); + break; + } + } + } + if(mi instanceof BuMenu) + ((BuMenu)mi).computeMnemonics(); + } + } + } + + // Separator + + public BuSeparator addSeparator(String _text) { - String tx=BuLib.candidateMnemonics(mi.getText()); - if(tx!=null) - for(int j=0;j<tx.length();j++) - { - mn=tx.charAt(j); - if(t.get(FuFactoryInteger.get(mn))==null) - { - t.put(FuFactoryInteger.get(mn),mi); - mi.setMnemonic(mn); - break; - } - } + BuSeparator r=new BuSeparator(_text); + this.add(r); + return r; } - if(mi instanceof BuMenu) - ((BuMenu)mi).computeMnemonics(); - } - } - } - // Separator + public void removeDummySeparators() + { + removeDummySeparators(getPopupMenu()); + } - public BuSeparator addSeparator(String _text) - { - BuSeparator r=new BuSeparator(_text); - this.add(r); - return r; - } + private static void removeDummySeparators(JPopupMenu _menu) + { + if(_menu==null) return; - public void removeDummySeparators() - { - removeDummySeparators(getPopupMenu()); - } + //synchronized(_menu) + { + Component[] c=_menu.getComponents(); + //MenuElement[] c=_menu.getSubElements(); + if(c==null) return; - private static void removeDummySeparators(JPopupMenu _menu) - { - if(_menu==null) return; + int l=c.length; + if(l==0) return; - //synchronized(_menu) - { - Component[] c=_menu.getComponents(); - //MenuElement[] c=_menu.getSubElements(); - if(c==null) return; + boolean was =true; + Component first=null; + for(int i=l-1;i>=0;i--) + { + if(c[i] instanceof JSeparator) + { + if(was) + { + _menu.remove(c[i]); + } + else + { + first=c[i]; + was=true; + } + } + else + { + was=false; + first=c[i]; + if(first instanceof JMenu) + removeDummySeparators(((JMenu)first).getPopupMenu()); + } + } - int l=c.length; - if(l==0) return; + if(first instanceof JSeparator) + _menu.remove(first); + } + } - boolean was =true; - Component first=null; - for(int i=l-1;i>=0;i--) - { - if(c[i] instanceof JSeparator) - { - if(was) - { - _menu.remove(c[i]); - } - else - { - first=c[i]; - was=true; - } - } - else + // SubMenu + + public void addSubMenu(JMenu _m, boolean _enabled) { - was=false; - first=c[i]; - if(first instanceof JMenu) - removeDummySeparators(((JMenu)first).getPopupMenu()); + _m.setEnabled(_enabled); + _m.addActionListener(this); + this.add(_m); } - } - if(first instanceof JSeparator) - _menu.remove(first); - } - } + // Menu Item - // SubMenu + public BuMenuItem addMenuItem(String _s, String _cmd) + { + return addMenuItem(_s,_cmd,true); + } - public void addSubMenu(JMenu _m, boolean _enabled) - { - _m.setEnabled(_enabled); - _m.addActionListener(this); - this.add(_m); - } + /** + * Retourne l'index de l'item de commande donn\xE9e. + * @param _cmd Le nom de la commande. + * @return L'index, ou -1 si non trouv\xE9. + */ + public int indexOf(String _cmd) { + return indexOf(this,_cmd); + } - // Menu Item + private int indexOf(BuMenu _menu, String _cmd) { + if (_cmd==null) return -1; - public BuMenuItem addMenuItem(String _s, String _cmd) - { - return addMenuItem(_s,_cmd,true); - } - - /** - * Retourne l'index de l'item de commande donn\xE9e. - * @param _cmd Le nom de la commande. - * @return L'index, ou -1 si non trouv\xE9. - */ - public int indexOf(String _cmd) { - return indexOf(this,_cmd); - } + for (int i=0; i<_menu.getItemCount(); i++) { + if (!(_menu.getItem(i) instanceof JMenuItem)) continue; + if (_cmd.equals(_menu.getItem(i).getActionCommand())) return i; + } + return -1; + } - private int indexOf(BuMenu _menu, String _cmd) { - if (_cmd==null) return -1; + public BuMenuItem addMenuItem(String _s, String _cmd, + ActionListener _al) + { + return addMenuItem(_s,_cmd,null,true,0,_al); + } + public BuMenuItem addMenuItem(String _s, String _cmd,boolean _enable, + ActionListener _al) + { + return addMenuItem(_s,_cmd,null,_enable,0,_al); + } - for (int i=0; i<_menu.getItemCount(); i++) { - if (!(_menu.getItem(i) instanceof JMenuItem)) continue; - if (_cmd.equals(_menu.getItem(i).getActionCommand())) return i; - } - return -1; - } + public BuMenuItem addMenuItem(String _s, String _cmd, + boolean _enabled) + { + return addMenuItem(_s,_cmd,null,_enabled,0,this); + } - public BuMenuItem addMenuItem(String _s, String _cmd, - ActionListener _al) - { - return addMenuItem(_s,_cmd,null,true,0,_al); - } - public BuMenuItem addMenuItem(String _s, String _cmd,boolean _enable, - ActionListener _al) - { - return addMenuItem(_s,_cmd,null,_enable,0,_al); - } + public BuMenuItem addMenuItem(String _s, String _cmd, + boolean _enabled, int _key) + { + return addMenuItem(_s,_cmd,null,_enabled,_key,this); + } - public BuMenuItem addMenuItem(String _s, String _cmd, - boolean _enabled) - { - return addMenuItem(_s,_cmd,null,_enabled,0,this); - } + public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, + boolean _enabled) + { + return addMenuItem(_s,_cmd,_icon,_enabled,0,this); + } + public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, + ActionListener _al) + { + return addMenuItem(_s,_cmd,_icon,true,0,_al); + } - public BuMenuItem addMenuItem(String _s, String _cmd, - boolean _enabled, int _key) - { - return addMenuItem(_s,_cmd,null,_enabled,_key,this); - } + public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, + boolean _enabled, int _key) + { + return addMenuItem(_s,_cmd,_icon,_enabled,_key,this); + } - public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, - boolean _enabled) - { - return addMenuItem(_s,_cmd,_icon,_enabled,0,this); - } - public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, - ActionListener _al) - { - return addMenuItem(_s,_cmd,_icon,true,0,_al); - } + public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, + boolean _enabled, int _key, ActionListener _al) + { + Icon icon=_icon; + if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); + if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; + if(icon==null) icon=BuResource.BU.getMenuIcon("aucun"); - public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, - boolean _enabled, int _key) - { - return addMenuItem(_s,_cmd,_icon,_enabled,_key,this); - } + BuMenuItem r=new BuMenuItem(); + r.setText(_s); + r.setName("mi"+_cmd); + r.setActionCommand(_cmd); + if(icon instanceof BuIcon) r.setIcon((BuIcon)icon); + else r.setIcon(icon); + r.setHorizontalTextPosition(SwingConstants.RIGHT); + r.addActionListener(_al); + r.setEnabled(_enabled); + if(_key!=0) + { + if((_key>=KeyEvent.VK_F1)&&(_key<=KeyEvent.VK_F12)) + r.setAccelerator(KeyStroke.getKeyStroke(_key,InputEvent.ALT_MASK)); + else + r.setAccelerator(KeyStroke.getKeyStroke(_key,InputEvent.CTRL_MASK)); + } + this.add(r); + return r; + } - public BuMenuItem addMenuItem(String _s, String _cmd, Icon _icon, - boolean _enabled, int _key, ActionListener _al) - { - Icon icon=_icon; - if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); - if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; - if(icon==null) icon=BuResource.BU.getMenuIcon("aucun"); + public BuMenuItem addMenuItem(Action a) + { + BuMenuItem r=new BuMenuItem(a); + this.add(r); + return r; + } - BuMenuItem r=new BuMenuItem(); - r.setText(_s); - r.setName("mi"+_cmd); - r.setActionCommand(_cmd); - if(icon instanceof BuIcon) r.setIcon((BuIcon)icon); - else r.setIcon(icon); - r.setHorizontalTextPosition(SwingConstants.RIGHT); - r.addActionListener(_al); - r.setEnabled(_enabled); - if(_key!=0) - { - if((_key>=KeyEvent.VK_F1)&&(_key<=KeyEvent.VK_F12)) - r.setAccelerator(KeyStroke.getKeyStroke(_key,InputEvent.ALT_MASK)); - else - r.setAccelerator(KeyStroke.getKeyStroke(_key,InputEvent.CTRL_MASK)); - } - this.add(r); - return r; - } + // CheckBoxMenuItem - // CheckBoxMenuItem + public BuCheckBoxMenuItem addCheckBox + (String _s, String _cmd, boolean _enabled, boolean _checked) + { + return addCheckBox(_s,_cmd,null,_enabled,_checked); + } - public BuCheckBoxMenuItem addCheckBox - (String _s, String _cmd, boolean _enabled, boolean _checked) - { - return addCheckBox(_s,_cmd,null,_enabled,_checked); - } + public BuCheckBoxMenuItem addCheckBox + (String _s, String _cmd, Icon _icon, boolean _enabled, boolean _checked) + { + Icon icon=_icon; + if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); + if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; + if(icon==null) icon=BuResource.BU.getMenuIcon("aucun"); - public BuCheckBoxMenuItem addCheckBox - (String _s, String _cmd, Icon _icon, boolean _enabled, boolean _checked) - { - Icon icon=_icon; - if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); - if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; - if(icon==null) icon=BuResource.BU.getMenuIcon("aucun"); + BuCheckBoxMenuItem r=new BuCheckBoxMenuItem(); + r.setText(_s); + r.setName("cbmi"+_cmd); + r.setActionCommand(_cmd); + if(icon instanceof BuIcon) r.setIcon((BuIcon)icon); + else r.setIcon(icon); + r.setHorizontalTextPosition(SwingConstants.RIGHT); + r.addActionListener(this); + r.setEnabled(_enabled); + r.setSelected(_checked); + this.add(r); + return r; + } - BuCheckBoxMenuItem r=new BuCheckBoxMenuItem(); - r.setText(_s); - r.setName("cbmi"+_cmd); - r.setActionCommand(_cmd); - if(icon instanceof BuIcon) r.setIcon((BuIcon)icon); - else r.setIcon(icon); - r.setHorizontalTextPosition(SwingConstants.RIGHT); - r.addActionListener(this); - r.setEnabled(_enabled); - r.setSelected(_checked); - this.add(r); - return r; - } + // RadioButtonMenuItem - // RadioButtonMenuItem + public BuRadioButtonMenuItem addRadioButton + (String _s, String _cmd, boolean _enabled, boolean _checked) + { + return addRadioButton(_s,_cmd,null,_enabled,_checked); + } - public BuRadioButtonMenuItem addRadioButton - (String _s, String _cmd, boolean _enabled, boolean _checked) - { - return addRadioButton(_s,_cmd,null,_enabled,_checked); - } + public BuRadioButtonMenuItem addRadioButton + (String _s, String _cmd, Icon _icon, boolean _enabled, boolean _checked) + { + Icon icon=_icon; + if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); + if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; + if(icon==null) icon=BuResource.BU.getMenuIcon("aucun"); - public BuRadioButtonMenuItem addRadioButton - (String _s, String _cmd, Icon _icon, boolean _enabled, boolean _checked) - { - Icon icon=_icon; - if(icon==null) icon=BuResource.BU.loadMenuCommandIcon(_cmd); - if((icon instanceof BuIcon)&&((BuIcon)icon).isDefault()) icon=null; - if(icon==null) icon=BuResource.BU.getMenuIcon("aucun"); + BuRadioButtonMenuItem r=new BuRadioButtonMenuItem(); + r.setText(_s); + r.setName("rbmi"+_cmd); + r.setActionCommand(_cmd); + if(icon instanceof BuIcon) r.setIcon((BuIcon)icon); + else r.setIcon(icon); + r.setHorizontalTextPosition(SwingConstants.RIGHT); + r.addActionListener(this); + r.setEnabled(_enabled); + r.setSelected(_checked); + this.add(r); + return r; + } - BuRadioButtonMenuItem r=new BuRadioButtonMenuItem(); - r.setText(_s); - r.setName("rbmi"+_cmd); - r.setActionCommand(_cmd); - if(icon instanceof BuIcon) r.setIcon((BuIcon)icon); - else r.setIcon(icon); - r.setHorizontalTextPosition(SwingConstants.RIGHT); - r.addActionListener(this); - r.setEnabled(_enabled); - r.setSelected(_checked); - this.add(r); - return r; - } - - /* + /* public void removeMenuItem(String _cmd) { MenuElement[] cm=getSubElements(); @@ -485,298 +493,298 @@ } } } - */ + */ - // Menus standards + // Menus standards - public static BuMenu buildImportMenu() - { - BuMenu r=new BuMenu(__("Importer"),"IMPORTER"); - return r; - } + public static BuMenu buildImportMenu() + { + BuMenu r=new BuMenu(__("Importer"),"IMPORTER"); + return r; + } - public static BuMenu buildExportMenu() - { - BuMenu r=new BuMenu(__("Exporter"),"EXPORTER"); - return r; - } + public static BuMenu buildExportMenu() + { + BuMenu r=new BuMenu(__("Exporter"),"EXPORTER"); + return r; + } - public static BuMenu buildFileMenu() - { - BuMenu r=new BuMenu(__("Fichier"),"MENU_FICHIER"); - r.addMenuItem(__("Cr\xE9er") ,"CREER" ,false,KeyEvent.VK_N); - r.addMenuItem(__("Ouvrir...") ,"OUVRIR" ,false,KeyEvent.VK_O); + public static BuMenu buildFileMenu() + { + BuMenu r=new BuMenu(__("Fichier"),"MENU_FICHIER"); + r.addMenuItem(__("Cr\xE9er") ,"CREER" ,false,KeyEvent.VK_N); + r.addMenuItem(__("Ouvrir...") ,"OUVRIR" ,false,KeyEvent.VK_O); - r.addSubMenu(new BuMenuRecentFiles(),true); - r.addMenuItem(__("Propri\xE9t\xE9s...") ,"PROPRIETE" ,false); - //r.addSeparator(); + r.addSubMenu(new BuMenuRecentFiles(),true); + r.addMenuItem(__("Propri\xE9t\xE9s...") ,"PROPRIETE" ,false); + //r.addSeparator(); - r.addMenuItem(__("Enregistrer") ,"ENREGISTRER" ,false,KeyEvent.VK_S); - r.addMenuItem(__("Enregistrer sous..."),"ENREGISTRERSOUS" ,false) - .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); - r.addMenuItem(__("Fermer") ,"FERMER" ,false,KeyEvent.VK_W); - r.addSeparator(); + r.addMenuItem(__("Enregistrer") ,"ENREGISTRER" ,false,KeyEvent.VK_S); + r.addMenuItem(__("Enregistrer sous..."),"ENREGISTRERSOUS" ,false) + .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); + r.addMenuItem(__("Fermer") ,"FERMER" ,false,KeyEvent.VK_W); + r.addSeparator(); - r.addSubMenu(buildImportMenu(),false); - r.addSubMenu(buildExportMenu(),false); - r.addSeparator(); + r.addSubMenu(buildImportMenu(),false); + r.addSubMenu(buildExportMenu(),false); + r.addSeparator(); - r.addMenuItem(__("Imprimer...") ,"IMPRIMER" ,false,KeyEvent.VK_P); - r.addMenuItem(__("Pr\xE9visualiser") ,"PREVISUALISER" ,false); - r.addMenuItem(__("Mise en page...") ,"MISEENPAGE" ,false); - r.addSeparator(); + r.addMenuItem(__("Imprimer...") ,"IMPRIMER" ,false,KeyEvent.VK_P); + r.addMenuItem(__("Pr\xE9visualiser") ,"PREVISUALISER" ,false); + r.addMenuItem(__("Mise en page...") ,"MISEENPAGE" ,false); + r.addSeparator(); - r.addMenuItem(__("Quitter...") ,"QUITTER" ,false,KeyEvent.VK_Q); + r.addMenuItem(__("Quitter...") ,"QUITTER" ,false,KeyEvent.VK_Q); - return r; - } + return r; + } - public static BuMenu buildEditionMenu() - { - BuMenu r=new BuMenu(__("Edition"),"MENU_EDITION"); - r.addMenuItem(__("D\xE9faire") ,"DEFAIRE" ,false,KeyEvent.VK_Z); - r.addMenuItem(__("Refaire") ,"REFAIRE" ,false) - .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); - // normalement Ctrl-Y - r.addSeparator(); + public static BuMenu buildEditionMenu() + { + BuMenu r=new BuMenu(__("Edition"),"MENU_EDITION"); + r.addMenuItem(__("D\xE9faire") ,"DEFAIRE" ,false,KeyEvent.VK_Z); + r.addMenuItem(__("Refaire") ,"REFAIRE" ,false) + .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); + // normalement Ctrl-Y + r.addSeparator(); - r.addMenuItem(__("Copier") ,"COPIER" ,false,KeyEvent.VK_C); - r.addMenuItem(__("Couper") ,"COUPER" ,false,KeyEvent.VK_X); - r.addMenuItem(__("Coller") ,"COLLER" ,false,KeyEvent.VK_V); - r.addMenuItem(__("Dupliquer") ,"DUPLIQUER" ,false) - .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); - r.addSeparator(); - r.addMenuItem(__("Tout s\xE9lectionner") ,"TOUTSELECTIONNER" ,false,KeyEvent.VK_A); - r.addMenuItem(__("Rechercher...") ,"RECHERCHER" ,false,KeyEvent.VK_F); - r.addMenuItem(__("Remplacer...") ,"REMPLACER" ,false,KeyEvent.VK_R); - r.addSeparator(); - r.addMenuItem(__("Pr\xE9f\xE9rences") ,"PREFERENCE" ,false,KeyEvent.VK_F2); - return r; - } + r.addMenuItem(__("Copier") ,"COPIER" ,false,KeyEvent.VK_C); + r.addMenuItem(__("Couper") ,"COUPER" ,false,KeyEvent.VK_X); + r.addMenuItem(__("Coller") ,"COLLER" ,false,KeyEvent.VK_V); + r.addMenuItem(__("Dupliquer") ,"DUPLIQUER" ,false) + .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); + r.addSeparator(); + r.addMenuItem(__("Tout s\xE9lectionner") ,"TOUTSELECTIONNER" ,false,KeyEvent.VK_A); + r.addMenuItem(__("Rechercher...") ,"RECHERCHER" ,false,KeyEvent.VK_F); + r.addMenuItem(__("Remplacer...") ,"REMPLACER" ,false,KeyEvent.VK_R); + r.addSeparator(); + r.addMenuItem(__("Pr\xE9f\xE9rences") ,"PREFERENCE" ,false,KeyEvent.VK_F2); + return r; + } - public static BuMenu buildMetalThemeMenu() - { - BuMenu r=new BuMenu(__("Th\xE8mes pour Metal"),"THEME_METAL"); + public static BuMenu buildMetalThemeMenu() + { + BuMenu r=new BuMenu(__("Th\xE8mes pour Metal"),"THEME_METAL"); - BuMetalCustomTheme[] themes=BuMetalCustomTheme.getList(); - for(int i=0;i<themes.length;i++) - { - if(themes[i]==null) - r.addSeparator(); - else - { - JMenuItem mi; - mi=r.addMenuItem(__(themes[i].getName()),"THEME_METAL("+i+")",null,true); - mi.setIcon(themes[i].getIcon()); - } - } + BuMetalCustomTheme[] themes=BuMetalCustomTheme.getList(); + for(int i=0;i<themes.length;i++) + { + if(themes[i]==null) + r.addSeparator(); + else + { + JMenuItem mi; + mi=r.addMenuItem(__(themes[i].getName()),"THEME_METAL("+i+")",null,true); + mi.setIcon(themes[i].getIcon()); + } + } - return r; - } + return r; + } - public static BuMenu buildSlafThemeMenu() - { - BuMenu r=new BuMenu(__("Th\xE8mes pour Slaf"),"THEME_SLAF"); + public static BuMenu buildSlafThemeMenu() + { + BuMenu r=new BuMenu(__("Th\xE8mes pour Slaf"),"THEME_SLAF"); - BuSlafCustomTheme[] themes=BuSlafCustomTheme.getList(); - for(int i=0;i<themes.length;i++) - { - if(themes[i]==null) - r.addSeparator(); - else - { - JMenuItem mi; - mi=r.addMenuItem(__(themes[i].getName()),"THEME_SLAF("+i+")",null,true); - mi.setIcon(themes[i].getIcon()); - } - } + BuSlafCustomTheme[] themes=BuSlafCustomTheme.getList(); + for(int i=0;i<themes.length;i++) + { + if(themes[i]==null) + r.addSeparator(); + else + { + JMenuItem mi; + mi=r.addMenuItem(__(themes[i].getName()),"THEME_SLAF("+i+")",null,true); + mi.setIcon(themes[i].getIcon()); + } + } - return r; - } + return r; + } - public static BuMenu buildLookAndFeelMenu() - { - BuMenu r=new BuMenu(__("Aspects"),"ASPECT"); + public static BuMenu buildLookAndFeelMenu() + { + BuMenu r=new BuMenu(__("Aspects"),"ASPECT"); - r.addSubMenu(buildMetalThemeMenu(),FuLib.classExists("javax.swing.plaf.metal.MetalLookAndFeel")); + r.addSubMenu(buildMetalThemeMenu(),FuLib.classExists("javax.swing.plaf.metal.MetalLookAndFeel")); - //if(!BuLib.isSwing10()) - r.addSubMenu(buildSlafThemeMenu(),FuLib.classExists("com.memoire.slaf.SlafLookAndFeel")); + //if(!BuLib.isSwing10()) + r.addSubMenu(buildSlafThemeMenu(),FuLib.classExists("com.memoire.slaf.SlafLookAndFeel")); - r.addSeparator(); + r.addSeparator(); - //if(!BuLib.isSwing10()) - r.addMenuItem("Amiga" ,"ASPECT_AMIGA" ,FuLib.classExists("swing.addon.plaf.threeD.ThreeDLookAndFeel")); + //if(!BuLib.isSwing10()) + r.addMenuItem("Amiga" ,"ASPECT_AMIGA" ,FuLib.classExists("swing.addon.plaf.threeD.ThreeDLookAndFeel")); - //if(FuLib.jdk()>1.3) - //{ - r.addMenuItem("FHLaf" ,"ASPECT_FHLAF" ,FuLib.classExists("com.shfarr.ui.plaf.fh.FhLookAndFeel")); - r.addMenuItem("Gtk" ,"ASPECT_GTK" ,FuLib.classExists("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")); - r.addMenuItem("Kunststoff" ,"ASPECT_KUNSTSTOFF" ,FuLib.classExists("com.incors.plaf.kunststoff.KunststoffLookAndFeel")); - r.addMenuItem("Liquid" ,"ASPECT_LIQUID" ,FuLib.classExists("com.birosoft.liquid.LiquidLookAndFeel")); - //} + //if(FuLib.jdk()>1.3) + //{ + r.addMenuItem("FHLaf" ,"ASPECT_FHLAF" ,FuLib.classExists("com.shfarr.ui.plaf.fh.FhLookAndFeel")); + r.addMenuItem("Gtk" ,"ASPECT_GTK" ,FuLib.classExists("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")); + r.addMenuItem("Kunststoff" ,"ASPECT_KUNSTSTOFF" ,FuLib.classExists("com.incors.plaf.kunststoff.KunststoffLookAndFeel")); + r.addMenuItem("Liquid" ,"ASPECT_LIQUID" ,FuLib.classExists("com.birosoft.liquid.LiquidLookAndFeel")); + //} - // r.addMenuItem("Basic" ,"ASPECT_BASIC" ,FuLib.classExists("BuBasicLookAndFeel")); - r.addMenuItem("Mac" ,"ASPECT_MAC" ,FuLib.classExists("com.sun.java.swing.plaf.mac.MacLookAndFeel")); - r.addMenuItem("Metal" ,"ASPECT_METAL" ,FuLib.classExists("javax.swing.plaf.metal.MetalLookAndFeel")); + // r.addMenuItem("Basic" ,"ASPECT_BASIC" ,FuLib.classExists("BuBasicLookAndFeel")); + r.addMenuItem("Mac" ,"ASPECT_MAC" ,FuLib.classExists("com.sun.java.swing.plaf.mac.MacLookAndFeel")); + r.addMenuItem("Metal" ,"ASPECT_METAL" ,FuLib.classExists("javax.swing.plaf.metal.MetalLookAndFeel")); - // if(FuLib.jdk()>1.3) - r.addMenuItem("Metouia" ,"ASPECT_METOUIA" ,FuLib.classExists("net.sourceforge.mlf.metouia.MetouiaLookAndFeel")); + // if(FuLib.jdk()>1.3) + r.addMenuItem("Metouia" ,"ASPECT_METOUIA" ,FuLib.classExists("net.sourceforge.mlf.metouia.MetouiaLookAndFeel")); - r.addMenuItem("Motif" ,"ASPECT_MOTIF" ,FuLib.classExists("com.sun.java.swing.plaf.motif.MotifLookAndFeel")); - // r.addMenuItem("Multi" ,"ASPECT_MULTI" ,FuLib.classExists("javax.swing.plaf.multi.MultiLookAndFeel")); - r.addMenuItem("Next" ,"ASPECT_NEXT" ,FuLib.classExists("nextlf.plaf.NextLookAndFeel")); - r.addMenuItem("Organic" ,"ASPECT_ORGANIC" ,FuLib.classExists("javax.swing.plaf.organic.OrganicLookAndFeel")); + r.addMenuItem("Motif" ,"ASPECT_MOTIF" ,FuLib.classExists("com.sun.java.swing.plaf.motif.MotifLookAndFeel")); + // r.addMenuItem("Multi" ,"ASPECT_MULTI" ,FuLib.classExists("javax.swing.plaf.multi.MultiLookAndFeel")); + r.addMenuItem("Next" ,"ASPECT_NEXT" ,FuLib.classExists("nextlf.plaf.NextLookAndFeel")); + r.addMenuItem("Organic" ,"ASPECT_ORGANIC" ,FuLib.classExists("javax.swing.plaf.organic.OrganicLookAndFeel")); - // if(FuLib.jdk()>1.3) - // { - r.addMenuItem("Oyoaha" ,"ASPECT_OYOAHA" ,FuLib.classExists("com.oyoaha.swing.plaf.oyoaha.OyoahaLookAndFeel")); - r.addMenuItem("Plastic" ,"ASPECT_PLASTIC" ,FuLib.classExists("com.jgoodies.looks.plastic.PlasticLookAndFeel")); - r.addMenuItem("Plastic 3D" ,"ASPECT_PLASTIC3D" ,FuLib.classExists("com.jgoodies.looks.plastic.Plastic3DLookAndFeel")); - r.addMenuItem("Plastic XP" ,"ASPECT_PLASTICXP" ,FuLib.classExists("com.jgoodies.looks.plastic.PlasticXPLookAndFeel")); - r.addMenuItem("SkinLF" ,"ASPECT_SKINLF" ,FuLib.classExists("com.l2fprod.gui.plaf.skin.SkinLookAndFeel")); - // } + // if(FuLib.jdk()>1.3) + // { + r.addMenuItem("Oyoaha" ,"ASPECT_OYOAHA" ,FuLib.classExists("com.oyoaha.swing.plaf.oyoaha.OyoahaLookAndFeel")); + r.addMenuItem("Plastic" ,"ASPECT_PLASTIC" ,FuLib.classExists("com.jgoodies.looks.plastic.PlasticLookAndFeel")); + r.addMenuItem("Plastic 3D" ,"ASPECT_PLASTIC3D" ,FuLib.classExists("com.jgoodies.looks.plastic.Plastic3DLookAndFeel")); + r.addMenuItem("Plastic XP" ,"ASPECT_PLASTICXP" ,FuLib.classExists("com.jgoodies.looks.plastic.PlasticXPLookAndFeel")); + r.addMenuItem("SkinLF" ,"ASPECT_SKINLF" ,FuLib.classExists("com.l2fprod.gui.plaf.skin.SkinLookAndFeel")); + // } - // if(!BuLib.isSwing10()) - r.addMenuItem("Slaf" ,"ASPECT_SLAF" ,FuLib.classExists("com.memoire.slaf.SlafLookAndFeel")); + // if(!BuLib.isSwing10()) + r.addMenuItem("Slaf" ,"ASPECT_SLAF" ,FuLib.classExists("com.memoire.slaf.SlafLookAndFeel")); - if(FuLib.jdk()>1.4) - r.addMenuItem("Synthetica" ,"ASPECT_SYNTHETICA" ,FuLib.classExists("de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel")); + if(FuLib.jdk()>1.4) + r.addMenuItem("Synthetica" ,"ASPECT_SYNTHETICA" ,FuLib.classExists("de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel")); - r.addMenuItem("Tonic" ,"ASPECT_TONIC" ,FuLib.classExists("com.digitprop.tonic.TonicLookAndFeel")); - r.addMenuItem("Windows" ,"ASPECT_WINDOWS" ,FuLib.classExists("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")); + r.addMenuItem("Tonic" ,"ASPECT_TONIC" ,FuLib.classExists("com.digitprop.tonic.TonicLookAndFeel")); + r.addMenuItem("Windows" ,"ASPECT_WINDOWS" ,FuLib.classExists("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")); - return r; - } + return r; + } - public static BuMenu buildWindowMenu() - { - BuMenu r=new BuMenu(__("Fen\xEAtres"),"MENU_FENETRES"); + public static BuMenu buildWindowMenu() + { + BuMenu r=new BuMenu(__("Fen\xEAtres"),"MENU_FENETRES"); -/* if(!FuLib.isJDistroRunning()) + /* if(!FuLib.isJDistroRunning()) r.addSubMenu(buildLookAndFeelMenu(),true);*/ - r.addSubMenu(new BuMenuInternalFrames(),true); + r.addSubMenu(new BuMenuInternalFrames(),true); - BuMenu sm; + BuMenu sm; - if(BuPreferences.BU.getBooleanProperty("menu.short",false)) - { - sm=new BuMenu(__("Organisation"),"CASCADE_ORGANISATION"); - r.addSubMenu(sm,true); - } - else - { - sm=r; - r.addSeparator(__("Organisation")); - } - sm.addMenuItem (__("Plein \xE9cran") ,"PLEINECRAN" ,true); - sm.addMenuItem (__("Cascade") ,"CASCADE" ,true); - sm.addMenuItem (__("Mosaique") ,"MOSAIQUE" ,true); - sm.addMenuItem (__("Ranger les ic\xF4nes") ,"RANGERICONES" ,true); - sm.addMenuItem (__("Ranger les palettes") ,"RANGERPALETTES" ,true); - sm.addMenuItem (__("Echanger les colonnes"),"ECHANGER_COLONNES" ,true); + if(BuPreferences.BU.getBooleanProperty("menu.short",false)) + { + sm=new BuMenu(__("Organisation"),"CASCADE_ORGANISATION"); + r.addSubMenu(sm,true); + } + else + { + sm=r; + r.addSeparator(__("Organisation")); + } + sm.addMenuItem (__("Plein \xE9cran") ,"PLEINECRAN" ,true); + sm.addMenuItem (__("Cascade") ,"CASCADE" ,true); + sm.addMenuItem (__("Mosaique") ,"MOSAIQUE" ,true); + sm.addMenuItem (__("Ranger les ic\xF4nes") ,"RANGERICONES" ,true); + sm.addMenuItem (__("Ranger les palettes") ,"RANGERPALETTES" ,true); + sm.addMenuItem (__("Echanger les colonnes"),"ECHANGER_COLONNES" ,true); - if(BuPreferences.BU.getBooleanProperty("menu.short",false)) - { - sm=new BuMenu(__("El\xE9ments"),"VISIBLE_ELEMENTS"); - r.addSubMenu(sm,true); - } - else - { - sm=r; - r.addSeparator(__("El\xE9ments")); - } - sm.addCheckBox - (__("Outils sp\xE9cifiques"),"VISIBLE_SPECIFICBAR",true ,true ); - sm.addCheckBox - (__("Colonne gauche") ,"VISIBLE_LEFTCOLUMN" ,true ,true ) - .setAccelerator - (KeyStroke.getKeyStroke(KeyEvent.VK_F11,InputEvent.ALT_MASK)); - sm.addCheckBox - (__("Colonne droite") ,"VISIBLE_RIGHTCOLUMN",true ,true ) - .setAccelerator - (KeyStroke.getKeyStroke(KeyEvent.VK_F12,InputEvent.ALT_MASK)); - sm.addCheckBox - (__("Barre d'\xE9tat") ,"VISIBLE_STATUSBAR" ,true ,true ); + if(BuPreferences.BU.getBooleanProperty("menu.short",false)) + { + sm=new BuMenu(__("El\xE9ments"),"VISIBLE_ELEMENTS"); + r.addSubMenu(sm,true); + } + else + { + sm=r; + r.addSeparator(__("El\xE9ments")); + } + sm.addCheckBox + (__("Outils sp\xE9cifiques"),"VISIBLE_SPECIFICBAR",true ,true ); + sm.addCheckBox + (__("Colonne gauche") ,"VISIBLE_LEFTCOLUMN" ,true ,true ) + .setAccelerator + (KeyStroke.getKeyStroke(KeyEvent.VK_F11,InputEvent.ALT_MASK)); + sm.addCheckBox + (__("Colonne droite") ,"VISIBLE_RIGHTCOLUMN",true ,true ) + .setAccelerator + (KeyStroke.getKeyStroke(KeyEvent.VK_F12,InputEvent.ALT_MASK)); + sm.addCheckBox + (__("Barre d'\xE9tat") ,"VISIBLE_STATUSBAR" ,true ,true ); - return r; - } + return r; + } - public static BuMenu buildHelpMenu() - { - BuMenu r=new BuMenu(__("Aide"),"MENU_AIDE"); + public static BuMenu buildHelpMenu() + { + BuMenu r=new BuMenu(__("Aide"),"MENU_AIDE"); - r.addCheckBox - (__("Assistant") ,"ASSISTANT" ,true ,true ); + r.addCheckBox + (__("Assistant") ,"ASSISTANT" ,true ,true ); - BuMenu sm; + BuMenu sm; - if(BuPreferences.BU.getBooleanProperty("menu.short",false)) - { - sm=new BuMenu(__("Documentation"),"AIDE_DOCUMENTATION"); - r.addSubMenu(sm,true); - } - else - { - sm=r; - r.addSeparator(__("Documentation") ); - } - sm.addMenuItem (__("Page principale") ,"AIDE_INDEX" ,true ,KeyEvent.VK_F1); - sm.addMenuItem (__("Pointeur") ,"POINTEURAIDE" ,true ) - .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1,InputEvent.SHIFT_MASK)); - sm.addMenuItem (__("Index alphab\xE9tique") ,"INDEX_ALPHA" ,true ); - sm.addMenuItem (__("Index th\xE9matique") ,"INDEX_THEMA" ,true ); + if(BuPreferences.BU.getBooleanProperty("menu.short",false)) + { + sm=new BuMenu(__("Documentation"),"AIDE_DOCUMENTATION"); + r.addSubMenu(sm,true); + } + else + { + sm=r; + r.addSeparator(__("Documentation") ); + } + sm.addMenuItem (__("Page principale") ,"AIDE_INDEX" ,true ,KeyEvent.VK_F1); + sm.addMenuItem (__("Pointeur") ,"POINTEURAIDE" ,true ) + .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1,InputEvent.SHIFT_MASK)); + sm.addMenuItem (__("Index alphab\xE9tique") ,"INDEX_ALPHA" ,true ); + sm.addMenuItem (__("Index th\xE9matique") ,"INDEX_THEMA" ,true ); - if(BuPreferences.BU.getBooleanProperty("menu.short",false)) - { - sm=new BuMenu(__("Informations"),"TEXTE_INFORMATIONS"); - r.addSubMenu(sm,true); - } - else - { - sm=r; - r.addSeparator(__("Informations") ); - } - sm.addMenuItem (__("Astuces...") ,"ASTUCE" ,true ); - sm.addMenuItem (__("A propos de...") ,"APROPOSDE" ,true ); - sm.addMenuItem (__("Licence...") ,"TEXTE_LICENCE" ,true ); + if(BuPreferences.BU.getBooleanProperty("menu.short",false)) + { + sm=new BuMenu(__("Informations"),"TEXTE_INFORMATIONS"); + r.addSubMenu(sm,true); + } + else + { + sm=r; + r.addSeparator(__("Informations") ); + } + sm.addMenuItem (__("Astuces...") ,"ASTUCE" ,true ); + sm.addMenuItem (__("A propos de...") ,"APROPOSDE" ,true ); + sm.addMenuItem (__("Licence...") ,"TEXTE_LICENCE" ,true ); - if(BuPreferences.BU.getBooleanProperty("menu.short",false)) - { - sm=new BuMenu(__("Internet"),"WWW_INTERNET"); - r.addSubMenu(sm,true); - } - else - { - sm=r; - r.addSeparator(__("Internet") ); - } - sm.addMenuItem (__("Site WWW") ,"WWW_ACCUEIL" ,true ); - // sm.addMenuItem (__("Site FTP"),"FTP_ACCUEIL",true ); - sm.addMenuItem (__("Mise \xE0 jour") ,"MAJ" ,false); - // sm.addMenuItem (__("Bogue...") ,"WWW_BOGUE" ,false); - // sm.addMenuItem (__("Achat...") ,"WWW_ACHAT" ,false); + if(BuPreferences.BU.getBooleanProperty("menu.short",false)) + { + sm=new BuMenu(__("Internet"),"WWW_INTERNET"); + r.addSubMenu(sm,true); + } + else + { + sm=r; + r.addSeparator(__("Internet") ); + } + sm.addMenuItem (__("Site WWW") ,"WWW_ACCUEIL" ,true ); + // sm.addMenuItem (__("Site FTP"),"FTP_ACCUEIL",true ); + sm.addMenuItem (__("Mise \xE0 jour") ,"MAJ" ,false); + // sm.addMenuItem (__("Bogue...") ,"WWW_BOGUE" ,false); + // sm.addMenuItem (__("Achat...") ,"WWW_ACHAT" ,false); - return r; - } + return r; + } - // Action + // Action - private Vector actionListeners_=new Vector(); + private Vector actionListeners_=new Vector(); - public void addActionListener(ActionListener _l) - { actionListeners_.addElement(_l); } + public void addActionListener(ActionListener _l) + { actionListeners_.addElement(_l); } - public void removeActionListener(ActionListener _l) - { actionListeners_.removeElement(_l); } + public void removeActionListener(ActionListener _l) + { actionListeners_.removeElement(_l); } - public void actionPerformed(ActionEvent _evt) - { - // JComponent source=(JComponent)_evt.getSource(); - // System.err.println(""+getClass()+": "+source); + public void actionPerformed(ActionEvent _evt) + { + // JComponent source=(JComponent)_evt.getSource(); + // System.err.println(""+getClass()+": "+source); - for(Enumeration e=actionListeners_.elements(); e.hasMoreElements(); ) - ((ActionListener)e.nextElement()).actionPerformed(_evt); - } + for(Enumeration e=actionListeners_.elements(); e.hasMoreElements(); ) + ((ActionListener)e.nextElement()).actionPerformed(_evt); + } } 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-25 22:20:21 UTC (rev 4401) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMenuItem.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -15,6 +15,7 @@ import java.awt.Point; import java.awt.event.MouseEvent; +import javax.swing.Action; import javax.swing.Icon; import javax.swing.JMenuItem; @@ -65,6 +66,12 @@ setText(_label==null?"":_label); } + public BuMenuItem(Action a) + { + + setAction(a); + } + // Icon public Icon getIcon() Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt =================================================================== (Binary files differ) Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -0,0 +1,304 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import javax.swing.Icon; + +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluVariable; +import org.fudaa.ctulu.collection.CtuluArrayDouble; +import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; +import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrPostSourceReaderComposite.CoupleTimeStepData; + + + + +/** + * Builder qui construit les suites de calcul. + * @author Adrien Hadoux + * + */ +public class TrPostBuilderSuiteCalcul { + + + /** + * Action qui r\xE9alise la suite de calcul. + * @author Adrien Hadoux + * + */ + public static class ActionBuildSuite extends EbliActionSimple{ + + + TrPostSource src_; + TrPostCommonImplementation impl_; + public ActionBuildSuite(TrPostSource src,String _name, Icon _ic, String _ac,TrPostCommonImplementation impl) { + super(_name, _ic, _ac); + // TODO Auto-generated constructor stub + src_= src; + src_=src; + impl_=impl; + } + + + public void actionPerformed(ActionEvent _e) { + + + //-- test de comptabilit\xE9 de fichier source --// + if(!isCompatibleSuiteCalcul(src_)){ + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } + + //-- on lance la dialog de choix des fichiers sources --// + final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); + if (srcChoisie == null) { + impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } + + if(!isCompatibleSuiteCalcul(srcChoisie)){ + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } + + + List<String> error=new ArrayList<String>(); + + //-- creation de la suite de calcul --// + TrPostSource suiteCalcul=createSuiteCalcul((TrPostSourceFromReader)src_, impl_, (TrPostSourceFromReader)srcChoisie, error); + + if(suiteCalcul==null){ + //-- il se passe des choses \xE9tranges.... --// + String maxiStringLeo=""; + for(String err:error) + maxiStringLeo+=err+"\n"; + + impl_.error(maxiStringLeo); + return; + } + + + //-- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// + + impl_.c_.ajouterSource(suiteCalcul); + + + //-- on cree la vue 2d correspondante --// + + TrPostProjet projet=impl_.getCurrentProject(); + TrPostLayoutPanelController controller=impl_.getCurrentLayoutFille().controller_; + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), null); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); + final EbliNode node = controller.addCalque(TrResource.getS("Calque") + + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu, legendeCalque); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getWidget().getController().setDescription("Source: " + projet.formatInfoSource(srcChoisie)); + + // -- ajout des infos de cr\xE9ation --// + + TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_,(TrPostSourceReaderComposite)((TrPostSourceFromReader)suiteCalcul).getReader()); + + + + + } + + + } + + + /** + * R\xE9cup\xE9rer l'interface \xE0 partir du fichier + * @param _f + * @param _impl + * @return + */ + public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl){ + TrPostSource src= TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); + if(src!=null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader)src); + return null; + + } + + public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, TrPostSourceFromReader _reader,List<String> error){ + //-- lecture de l'interface \xE0 ajouter --// + TrPostSourceFromReader srcToConcat=createSourceFromeFile(_f, _impl); + return createSuiteCalcul(_reader, _impl, srcToConcat, error); + } + + + /** + * Algorithme de construction d'une suite de calcul. + * @param srcToConcat + * @param _impl + * @param _reader + * @param error + * @return + */ + public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, TrPostSourceFromReader _reader,List<String> error){ + TrPostSource suiteCalcul=null; + if(srcToConcat==null){ + error.add(TrResource.getS("Le fichier n'est pas valide.")); + return null; + } + + + + if(_reader.isRubar() || srcToConcat.isRubar()){ + error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); + return null; + } + + //-- comparaison des grilles --// + EfGridInterface grille=srcToConcat.getGrid(); + if(!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(),0.01)){ + error.add(TrResource.getS("Les grilles ne sont pas identiques")); + return null; + } + + //-- comparaison des pas de temps d\xE9but et finaux --// + double[] time1=TrPostSourceFromReader.getTimes(_reader.getReader()); + double[] time2=TrPostSourceFromReader.getTimes(srcToConcat.getReader()); + + if(time1[time1.length-1]!=time2[0] && time2[time2.length-1]!=time1[0]){ + error.add(TrResource.getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); + return null; + } + + + //-- recuperation des pas de temps et des variables --// + // double[] timeTotal= new double[time1.length+time2.length-1]; + // if(time1[0]>time2[0]){ + // //-- on permute pour garder l'ordre --// + // double[] temp=time1; + // time1=time2; + // time2=temp; + // } + // for(int i=0;i<time1.length;i++) + // timeTotal[i]=time1[i]; + // for(int i=0;i<time2.length-1;i++) + // timeTotal[time1.length+i]=time2[i+1]; + + HashSet<H2dVariableType> listeVar=new HashSet<H2dVariableType>(); + H2dVariableType[] var=null; + for(int i=0;i<_reader.getAvailableVar().length;i++) + listeVar.add(_reader.getVariable(i)); + for(int i=0;i<srcToConcat.getAvailableVar().length;i++) + listeVar.add(srcToConcat.getVariable(i)); + var=new H2dVariableType[listeVar.size()]; + int k=0; + for(H2dVariableType v:listeVar) + var[k++]=v; + + + var=srcToConcat.variable_; + + //-- initialisation de la liste de source --// + List<TrPostSourceReaderInterface> listeSourceInterface_=new ArrayList<TrPostSourceReaderInterface>(); + + //-- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// + TrPostSourceReaderInterface interface1=_reader.reader_; + TrPostSourceReaderInterface interface2=srcToConcat.reader_; + + + //-- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// + if(interface1 instanceof TrPostSourceReaderComposite) + listeSourceInterface_.addAll(((TrPostSourceReaderComposite)interface1).listeSourceInterface_); + else + listeSourceInterface_.add(interface1); + + if(interface2 instanceof TrPostSourceReaderComposite) + listeSourceInterface_.addAll(((TrPostSourceReaderComposite)interface2).listeSourceInterface_); + else + listeSourceInterface_.add(interface2); + + //-- ajout de tous les fichiers dans la collection --// + final Collection<File> file_=new HashSet<File>(interface1.getFiles());; + file_.addAll(interface2.getFiles()); + + + //-- on trie les listes dans l'ordre des timestep --// + Collections.sort(listeSourceInterface_,new ComparateurTrPostSourceReaderInterface()); + + //- ajout des correspondances timestep/source avec nouveau timestep --// + Map<Integer, CoupleTimeStepData> mapTimeStep_=new HashMap<Integer, CoupleTimeStepData>(); + ArrayList<Double> times=new ArrayList<Double>(); + int cpt=0; + for(TrPostSourceReaderInterface data:listeSourceInterface_){ + for(int i=0;i<data.getNbTimeStep();i++){ + + //-- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// + if(!times.contains(data.getTimeStep(i))){ + mapTimeStep_.put(cpt,new CoupleTimeStepData(data,i)); + times.add(data.getTimeStep(i)); + cpt++; + } + } + } + + double[] timeTotal=new double[times.size()]; + for(int i=0;i<times.size();i++) + timeTotal[i]=times.get(i); + + //-- creation de la suite de calcul + TrPostSourceReaderComposite suite=null; + + suite=new TrPostSourceReaderComposite(timeTotal,var,mapTimeStep_,listeSourceInterface_,file_); + + //-- creation du source Reader --// + suiteCalcul=new TrPostSourceFromReader(suite,TrResource.getS("Suite de calcul"),grille,_impl); + + return suiteCalcul; + } + + + /** + * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. + * @param src + * @return + */ + public static boolean isCompatibleSuiteCalcul(TrPostSource src){ + + if(src!=null && src instanceof TrPostSourceFromReader) + return true; + return false; + } + + public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface>{ + + @Override + public int compare(TrPostSourceReaderInterface o1, + TrPostSourceReaderInterface o2) { + + //-- on compare selon la valeur des timesteps -- + if(o1.getTimeStep(0)>o2.getTimeStep(0)) + return 1; + + if(o1.getTimeStep(0)<o2.getTimeStep(0)) + return -1; + + + return 0; + } + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-25 22:20:21 UTC (rev 4401) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -432,11 +432,12 @@ private boolean isOpenedIn(Collection<File> files, TrPostSource _in) { if (_in == null) return false; + boolean sourceGetAllFiles=true; for (File file : files) { - if (_in.isOpened(file)) return true; + if (!_in.isOpened(file)) sourceGetAllFiles=false;; } - return false; + return sourceGetAllFiles; } @@ -608,6 +609,9 @@ ic, TrPostProjet.this)); menuSimul.addSeparator(); + + + listSousMenus.add(menuSimul.addMenuItem(new TrPostBuilderSuiteCalcul.ActionBuildSuite(_src,TrResource.getS("Suite de calcul"),EbliResource.EBLI.getIcon(""),"SUITECALCUL",impl_))); listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Comparer..."), "COMPARE", ic, TrPostProjet.this)); listSousMenus.get(listSousMenus.size() - 1).setToolTipText( TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-25 22:20:21 UTC (rev 4401) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -303,7 +303,6 @@ final TrPostDataCreated _newData, final CtuluCommandContainer _cmd); - /** * @param _analyze permet d'initialise la base temporaire. Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-25 22:20:21 UTC (rev 4401) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -1455,4 +1455,19 @@ idx++; } } + + public static void fillWithSourceInfo(String _pref,Map _table, TrPostSourceReaderInterface src) { + + Collection<File> files = src.getFiles(); + int idx = 1; + String pref=_pref==null?CtuluLibString.EMPTY_STRING:_pref; + for (File file : files) { + String suffixe = files.size() > 1 ? CtuluLibString.getEspaceString(idx) : CtuluLibString.EMPTY_STRING; + _table.put(pref+TrResource.getS("Fichier r\xE9sultat") + suffixe, file.getName()); + _table.put(pref+TrResource.getS("Chemin complet") + suffixe, file.getAbsolutePath()); + // _table.put(pref+TrResource.getS("Titre Fichier r\xE9sultat") + suffixe, s); + idx++; + } + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceBuilder.java 2009-01-25 22:20:21 UTC (rev 4401) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceBuilder.java 2009-01-26 18:35:58 UTC (rev 4402) @@ -93,6 +93,24 @@ return activeSourceAction(_f, _impl, _impl.getLauncher().getCurrentPrefHydId(), _prog, null); } + + /** + * M\xE9thode qui active la sourceReaderInterface. + * @param _f + * @param _impl + * @param _prog + * @return + */ + public static TrPostSourceReaderInterface activeSourceReaderInterface(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _prog) { + TrPostSource src=activeSourceAction(_f, _impl, _prog); + + if(src!=null && src instanceof TrPostSourceFromReader){ + return ((TrPostSourceFromReader)src).getReader(); + }else return null; + + } + public static TrPostSource activeSourceAction(final File _f, final CtuluUI _impl, final String _id, final ProgressionInterface _prog, final Map _... [truncated message content] |
From: <had...@us...> - 2009-01-27 17:13:02
|
Revision: 4412 http://fudaa.svn.sourceforge.net/fudaa/?rev=4412&view=rev Author: hadouxad Date: 2009-01-27 17:12:46 +0000 (Tue, 27 Jan 2009) Log Message: ----------- - Refonte totale de l'affichage des multi-fichiers: passage en swingx table-tree + design patter observer/observable -> permet d'afficher la liste des fichier r?\195?\169sultat pour un source donn?\195?\169 (m?\195?\169ga utile pour composite) -> plus jolie -> modif des suppressions: on force l'utilisateur a choisir un r?\195?\169pertoire(noeud non feuille=trpostSource) et non un fichier(feuille= File ) - Refactorisation id: IL FAUT LE METTRE DANS LES READER ET PAS LES SOURCES!!! -> les id sont stock?\195?\169s dans les reader et les TrPostSourceFromReader vont piocher dedans (surcharge de m?\195?\169thode) -> permet pour la persistance des donn?\195?\169es de g?\195?\169rer facilement les id des fichiers du composite: ils sont dans les readers. - PERSISTANCE DES SUITES DE CALCUL -> En attendant les retours de Didier, c'est positionn?\195?\169 dans le fichier SETUP, dans la balise SUITECALCUL:$ -> principe: - liste des id des fichiers r?\195?\169sultats qui sont utilis?\195?\169s - L'ID de la suite (MEGA IMPORTANT: est utilis?\195?\169 pour rep?\195?\169rer les ebliwidgetVueCalque qui utilise notre amie la suite de calcul) - ALGORITHME utilis?\195?\169: - RECHARGE 2 par 2 les fichiers pour faire une suites - Comme cela si a un moment il y a un probl?\195?\168me (fichier foireux) cela retourne la suite de calcul partielle MAIS VALIDE ! - Trie du tableau d affichage d infos de la vue 2d - Ajout des bonnes infos pour les cr?\195?\169ation de calques - Possibilit?\195?\169 de g?\195?\169rer le fichier virtuel composite comme un src normal: -> changement du nom en suite de calcul dans les onglets -> on peut ajouter une vue2d avec la fonction classique - MODIF de l'algorithme des suite de calculs: Intersection de pas de variable et non plus union au terme ensembliste. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.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/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/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderFromFileAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderInterface.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderSerafin.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/actions/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionRemoveSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedExpr.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -23,6 +23,8 @@ import java.awt.print.PageFormat; import java.awt.print.Printable; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -58,6 +60,7 @@ import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.commun.EbliFormatterInterface; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliModelInfos; import org.fudaa.ebli.find.EbliFindDialog; import org.fudaa.ebli.find.EbliFindable; import org.fudaa.ebli.find.EbliFindableItem; @@ -1032,91 +1035,15 @@ if(infosCreation_==null || infosCreation_.keySet()==null ||infosCreation_.keySet().size()==0) return new BuPanel(); - - String[] names=new String[]{"Nom","Valeur"};//infosCreation_.keySet().toArray(new String[infosCreation_.keySet().size()]); - String[][] data=new String[infosCreation_.keySet().size()][2]; - int i=0; - for(String key:infosCreation_.keySet()){ - data[i][0]=key; - data[i][1]=infosCreation_.get(key); - i++; - } + List<String> liste=new ArrayList<String>(infosCreation_.keySet()); + Collections.sort(liste); + List<String> col=new ArrayList<String>(); + col.add(EbliResource.EBLI.getString("Nom")); + col.add(EbliResource.EBLI.getString("Valeur")); + + EbliModelInfos modelInfos=new EbliModelInfos(liste,infosCreation_,col); + BuTable table=new BuTable(modelInfos); - DefaultTableModel modelInfos=new DefaultTableModel(data,names){ - - @Override - public int getRowCount() { - // TODO Auto-generated method stub - return infosCreation_.keySet().size()+1; - } - - @Override - public Object getValueAt(int row, int column) { - - if(row==getRowCount()-1){ - if(column==0) - return EbliResource.EBLI.getString("Editable"); - else - return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); - }else - if(column==0) - return getKey(row); - else - return getValue(row); - - } - - @Override - public void setValueAt(Object value, int row, int column) { - - if(value==null)return; - - if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ - //-- ajout --// - if(column==1) - infosCreation_.put("Note "+(infosCreation_.keySet().size()+1),(String)value); - else - infosCreation_.put((String)value,""); - - fireTableDataChanged(); - - }else{ - //-- modification --// - if(column==0){ - String res=infosCreation_.get(getKey(row)); - infosCreation_.remove(getKey(row)); - infosCreation_.put((String)value, res); - }else{ - infosCreation_.put(getKey(row),(String)value); - } - fireTableDataChanged(); - } - } - public String getKey(int row){ - int i=0; - if(row>=infosCreation_.keySet().size()) - return ""; - for(String key:infosCreation_.keySet()){ - if(i==row) - return key; - i++; - - } - return ""; - } - - public String getValue(int row){ - return infosCreation_.get(getKey(row)); - } - - @Override - public boolean isCellEditable(int row, int column) { - return true; - } - - }; - BuTable table=new BuTable(modelInfos); - table.getColumnModel().getColumn(0).setPreferredWidth(20); BuPanel conteneur=new BuPanel(new BorderLayout()); conteneur.add(new JScrollPane(table),BorderLayout.CENTER); @@ -1125,5 +1052,6 @@ return conteneur; } + } \ No newline at end of file Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -0,0 +1,159 @@ +package org.fudaa.ebli.commun; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import javax.swing.event.TableModelListener; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; + +import org.fudaa.ebli.ressource.EbliResource; + + +/** + * Modele de tableau qui utilise une map <str, str>. + * Affiche des couple clef/valeurs de la map tri\xE9es. + * Utilis\xE9 en particulier pour les infos de creation des extends zeblicalquePanel. + * Prend en charge l'\xE9dition dans la map. + * Organise les infos par ordre lexicographique. + * Pour changer le trie a sa guise, faire son comparator et le placer dans le bon constructeur. + * @author Adrien Hadoux + * + */ +public class EbliModelInfos extends AbstractTableModel{ + + private static final long serialVersionUID = -2080709568281587469L; + private List<String> listeKey_; + private final List<String> colonnes_; + /** + * Les infos de la table. + */ + private Map<String,String> infos_; + private final Comparator<String> comparator_; + + public EbliModelInfos(List<String> liste,Map<String,String> map,List<String> colonnes){ + + this(liste,map,colonnes,null); + } + + public EbliModelInfos(List<String> liste,Map<String,String> map,List<String> colonnes,Comparator<String> comparator){ + super(); + listeKey_=liste; + infos_=map; + comparator_=comparator; + colonnes_=colonnes; + } + + + @Override + public String getColumnName(int column) { + // TODO Auto-generated method stub + return colonnes_.get(column); + } + + public int getRowCount() { + // TODO Auto-generated method stub + return infos_.keySet().size()+1; + } + + public Object getValueAt(int row, int column) { + + if(row==getRowCount()-1){ + if(column==0) + return EbliResource.EBLI.getString("Editable"); + else + return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); + }else + + if(column==0) + return getKey(row); + else + return getValue(row); + + } + + + public void setValueAt(Object value, int row, int column) { + + if(value==null)return; + + 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 + infos_.put((String)value,""); + + fireTableDataChanged(); + + }else{ + //-- modification --// + if(column==0){ + String res=infos_.get(getKey(row)); + infos_.remove(getKey(row)); + infos_.put((String)value, res); + }else{ + infos_.put(getKey(row),(String)value); + } + fireTableDataChanged(); + } + } + public String getKey(int row){ + + if(row>=infos_.keySet().size()) + return ""; + return listeKey_.get(row); + } + + + + 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_); + super.fireTableDataChanged(); + } + + public String getValue(int row){ + return infos_.get(getKey(row)); + } + + @Override + public boolean isCellEditable(int row, int column) { + return true; + } + + @Override + public void addTableModelListener(TableModelListener l) { + // TODO Auto-generated method stub + + } + + @Override + public Class<?> getColumnClass(int columnIndex) { + // TODO Auto-generated method stub + return String.class; + } + + @Override + public int getColumnCount() { + // TODO Auto-generated method stub + return colonnes_.size(); + } + + @Override + public void removeTableModelListener(TableModelListener l) { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file 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-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -10,6 +10,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -30,246 +31,319 @@ */ public class TrPostBuilderSuiteCalcul { - /** - * Action qui r\xE9alise la suite de calcul. - * - * @author Adrien Hadoux - */ - public static class ActionBuildSuite extends EbliActionSimple { + /** + * Action qui r\xE9alise la suite de calcul. + * + * @author Adrien Hadoux + */ + public static class ActionBuildSuite extends EbliActionSimple { - TrPostSource src_; - TrPostCommonImplementation impl_; + TrPostSource src_; + TrPostCommonImplementation impl_; - public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { - super(_name, _ic, _ac); - // TODO Auto-generated constructor stub - src_ = src; - src_ = src; - impl_ = impl; - } + public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { + super(_name, _ic, _ac); + // TODO Auto-generated constructor stub + src_ = src; + src_ = src; + impl_ = impl; + } - public void actionPerformed(ActionEvent _e) { + public void actionPerformed(ActionEvent _e) { - // -- test de comptabilit\xE9 de fichier source --// - if (!isCompatibleSuiteCalcul(src_)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + // -- test de comptabilit\xE9 de fichier source --// + if (!isCompatibleSuiteCalcul(src_)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - // -- on lance la dialog de choix des fichiers sources --// - final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); - if (srcChoisie == null) { - impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); - return; - } + // -- on lance la dialog de choix des fichiers sources --// + final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); + if (srcChoisie == null) { + impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } - if (!isCompatibleSuiteCalcul(srcChoisie)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - List<String> error = new ArrayList<String>(); + List<String> error = new ArrayList<String>(); - // -- creation de la suite de calcul --// - TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, - (TrPostSourceFromReader) srcChoisie, error); + // -- creation de la suite de calcul --// + TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, + (TrPostSourceFromReader) srcChoisie, error); - if (suiteCalcul == null) { - // -- il se passe des choses \xE9tranges.... --// - String maxiStringLeo = ""; - for (String err : error) - maxiStringLeo += err + "\n"; + if (suiteCalcul == null) { + // -- il se passe des choses \xE9tranges.... --// + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; - impl_.error(maxiStringLeo); - return; - } + impl_.error(maxiStringLeo); + return; + } - // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// + // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// - impl_.c_.ajouterSource(suiteCalcul); + impl_.c_.ajouterSource(suiteCalcul,suiteCalcul.getTitle()); - // -- on cree la vue 2d correspondante --// + // -- on cree la vue 2d correspondante --// - TrPostProjet projet = impl_.getCurrentProject(); - TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; - final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), - null); - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); - final EbliNode node = controller.addCalque(TrResource.getS("Calque") - + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), - pnVisu, legendeCalque); - // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription("Source: " + projet.formatInfoSource(srcChoisie)); + TrPostProjet projet = impl_.getCurrentProject(); + TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), + null); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); + final EbliNode node = controller.addCalque(TrResource.getS("Calque") + + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu, legendeCalque); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getWidget().getController().setDescription(suiteCalcul.getTitle()); - // -- ajout des infos de cr\xE9ation --// + // -- ajout des infos de cr\xE9ation --// - TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, - (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); + TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, + (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); - } + } - } + } - /** - * R\xE9cup\xE9rer l'interface \xE0 partir du fichier - * - * @param _f - * @param _impl - * @return - */ - public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { - TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); - if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); - return null; + /** + * R\xE9cup\xE9rer l'interface \xE0 partir du fichier + * + * @param _f + * @param _impl + * @return + */ + public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { + TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); + if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); + return null; - } + } - public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - // -- lecture de l'interface \xE0 ajouter --// - TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); - return createSuiteCalcul(_reader, _impl, srcToConcat, error); - } + public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + // -- lecture de l'interface \xE0 ajouter --// + TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); + return createSuiteCalcul(_reader, _impl, srcToConcat, error); + } - /** - * Algorithme de construction d'une suite de calcul. - * - * @param srcToConcat - * @param _impl - * @param _reader - * @param error - * @return - */ - public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - TrPostSource suiteCalcul = null; - if (srcToConcat == null) { - error.add(TrResource.getS("Le fichier n'est pas valide.")); - return null; - } + /** + * Algorithme de construction d'une suite de calcul. + * + * @param srcToConcat + * @param _impl + * @param _reader + * @param error + * @return + */ + public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + TrPostSourceReaderComposite suite = null; + if (srcToConcat == null) { + error.add(TrResource.getS("Le fichier n'est pas valide.")); + return null; + } - if (_reader.isRubar() || srcToConcat.isRubar()) { - error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); - return null; - } + if (_reader.isRubar() || srcToConcat.isRubar()) { + error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); + return null; + } - // -- comparaison des grilles --// - EfGridInterface grille = srcToConcat.getGrid(); - if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { - error.add(TrResource.getS("Les grilles ne sont pas identiques")); - return null; - } + // -- comparaison des grilles --// + EfGridInterface grille = srcToConcat.getGrid(); + if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { + error.add(TrResource.getS("Les grilles ne sont pas identiques")); + return null; + } - // -- comparaison des pas de temps d\xE9but et finaux --// - double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); - double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); + // -- comparaison des pas de temps d\xE9but et finaux --// + double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); + double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); - if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { - error.add(TrResource - .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); - return null; - } + if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { + error.add(TrResource + .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); + return null; + } - // -- recuperation des pas de temps et des variables --// - // double[] timeTotal= new double[time1.length+time2.length-1]; - // if(time1[0]>time2[0]){ - // //-- on permute pour garder l'ordre --// - // double[] temp=time1; - // time1=time2; - // time2=temp; - // } - // for(int i=0;i<time1.length;i++) - // timeTotal[i]=time1[i]; - // for(int i=0;i<time2.length-1;i++) - // timeTotal[time1.length+i]=time2[i+1]; + // -- recuperation des pas de temps et des variables --// + // double[] timeTotal= new double[time1.length+time2.length-1]; + // if(time1[0]>time2[0]){ + // //-- on permute pour garder l'ordre --// + // double[] temp=time1; + // time1=time2; + // time2=temp; + // } + // for(int i=0;i<time1.length;i++) + // timeTotal[i]=time1[i]; + // for(int i=0;i<time2.length-1;i++) + // timeTotal[time1.length+i]=time2[i+1]; - HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); - H2dVariableType[] var = null; - for (int i = 0; i < _reader.getAvailableVar().length; i++) - listeVar.add(_reader.getVariable(i)); - for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) - listeVar.add(srcToConcat.getVariable(i)); - var = new H2dVariableType[listeVar.size()]; - int k = 0; - for (H2dVariableType v : listeVar) - var[k++] = v; + HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); + H2dVariableType[] var = null; +// for (int i = 0; i < _reader.getAvailableVar().length; i++) +// listeVar.add(_reader.getVariable(i)); +// for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) +// listeVar.add(srcToConcat.getVariable(i)); + + + //-- intersection des variables des 2 fichiers --// + for (int i = 0; i < _reader.getAvailableVar().length; i++){ + boolean trouve=false; + for (int j = 0; !trouve && j < srcToConcat.getAvailableVar().length; j++) + if(srcToConcat.getVariable(j).equals(_reader.getVariable(i)) || srcToConcat.getVariable(j).getID().equals(_reader.getVariable(i).getID()) ) { + trouve=true; + listeVar.add(_reader.getVariable(i)); + } + } + + var = new H2dVariableType[listeVar.size()]; + int k = 0; + for (H2dVariableType v : listeVar) + var[k++] = v; - // var=srcToConcat.variable_; + // var=srcToConcat.variable_; - // -- initialisation de la liste de source --// - List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); + // -- initialisation de la liste de source --// + List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); - // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// - TrPostSourceReaderInterface interface1 = _reader.reader_; - TrPostSourceReaderInterface interface2 = srcToConcat.reader_; + // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// + TrPostSourceReaderInterface interface1 = _reader.reader_; + TrPostSourceReaderInterface interface2 = srcToConcat.reader_; - // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// - if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); - else listeSourceInterface_.add(interface1); + // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// + if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); + else listeSourceInterface_.add(interface1); - if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); - else listeSourceInterface_.add(interface2); + if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); + else listeSourceInterface_.add(interface2); - // -- ajout de tous les fichiers dans la collection --// - final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; - file_.addAll(interface2.getFiles()); + // -- ajout de tous les fichiers dans la collection --// + final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; + file_.addAll(interface2.getFiles()); - // -- on trie les listes dans l'ordre des timestep --// - Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); + // -- on trie les listes dans l'ordre des timestep --// + Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); - // - ajout des correspondances timestep/source avec nouveau timestep --// - Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); - // TODO utilise TDoubleArrayList - TDoubleArrayList times = new TDoubleArrayList(); - // int cpt = 0; - for (TrPostSourceReaderInterface data : listeSourceInterface_) { - for (int i = 0; i < data.getNbTimeStep(); i++) { - // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi - // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// - if (!times.contains(data.getTimeStep(i))) { - // le cpt vaut la taille des times - mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); - times.add(data.getTimeStep(i)); - // cpt++; - } - } - } + // - ajout des correspondances timestep/source avec nouveau timestep --// + Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); + // TODO utilise TDoubleArrayList + TDoubleArrayList times = new TDoubleArrayList(); + // int cpt = 0; + for (TrPostSourceReaderInterface data : listeSourceInterface_) { + for (int i = 0; i < data.getNbTimeStep(); i++) { + // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi + // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// + if (!times.contains(data.getTimeStep(i))) { + // le cpt vaut la taille des times + mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); + times.add(data.getTimeStep(i)); + // cpt++; + } + } + } - double[] timeTotal = times.toNativeArray(); - // -- creation de la suite de calcul - TrPostSourceReaderComposite suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, - listeSourceInterface_, file_); + double[] timeTotal = times.toNativeArray(); + // -- creation de la suite de calcul + suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, + listeSourceInterface_, file_); + + TrPostSource resultat=new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); + _impl.getCurrentProject().deliverSourceSuiteId(resultat); + // -- creation du source Reader --// + return resultat; + } - // -- creation du source Reader --// - return new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); - } - /** - * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. - * - * @param src - * @return - */ - public static boolean isCompatibleSuiteCalcul(TrPostSource src) { + /** + * Methode qui se charge de construire la suite de calcul a partir de la liste des id des fichiers. + * + * @param listeIdSrc + * @param projet + * @return + */ + public static TrPostSource createSuiteCalculFromPersistance(List<String> listeIdSrc,TrPostProjet projet,String idSrc){ + TrPostCommonImplementation impl=projet.getImpl(); + //- on met proprement en forme les donn\xE9es --// + List<TrPostSourceFromReader> listeReader=new ArrayList<TrPostSourceFromReader>(); + for(String id:listeIdSrc){ - if (src != null && src instanceof TrPostSourceFromReader) return true; - return false; - } + final TrPostSource srcChoisie = projet.findSourceById(id); + if (srcChoisie == null) { + impl.error(TrResource.getS(TrResource.getS("Le fichier r\xE9sultat d'id "+id+" est introuvable.\n Suite de calcul interrompue"))); + return null; + } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl.error(TrResource.getS("Le fichier d'id "+id+" n'est pas valide pour la suite de calcul.")); + return null; + } + listeReader.add((TrPostSourceFromReader) srcChoisie) ; + } - public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { + //-- on demarre la suite de calcul --// + Iterator<TrPostSourceFromReader> it=listeReader.iterator(); + TrPostSourceFromReader suiteProgressive=it.next(); - public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + List<String> error=new ArrayList<String>(); + while(it.hasNext()){ + //-- on calcule la suite progressive que l'on stocke dans la suite progressive --// + TrPostSourceFromReader suite =(TrPostSourceFromReader) TrPostBuilderSuiteCalcul.createSuiteCalcul(suiteProgressive, impl, it.next(), error); + if(suite==null){ + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; + if(suiteProgressive!=null){ + maxiStringLeo+="La suite de calcul s'arrete donc avec les fichiers "+suiteProgressive.getTitle(); + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + } + + impl.error(maxiStringLeo); + return suiteProgressive; + }else + suiteProgressive=suite; - // -- on compare selon la valeur des timesteps -- - if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; + } - if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; - return 0; - } + //-- trigger signal modif --// + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + return suiteProgressive; + } - } + /** + * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. + * + * @param src + * @return + */ + public static boolean isCompatibleSuiteCalcul(TrPostSource src) { + + if (src != null && src instanceof TrPostSourceFromReader) return true; + return false; + } + + public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { + + public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + + // -- on compare selon la valeur des timesteps -- + if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; + + if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; + + return 0; + } + + } + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -0,0 +1,165 @@ +/* + * Bnp Paribas Services + * + * $Id$ + */ +package org.fudaa.fudaa.tr.post; + +import java.util.Set; + +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedExpr; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedSaver; +import org.fudaa.fudaa.tr.post.data.TrPostDataVecteur; +import org.nfunk.jep.Variable; + +/** + * @author denf01a + * @creation 27 janv. 2009 + * @version + * + */ +public class TrPostFlecheContentExpr implements TrPostFlecheContent { + + H2dVariableType varName_; + + TrPostDataCreatedExpr vx_; + TrPostDataCreatedExpr vy_; + + private TrPostDataVecteur lastValue_; + boolean isElementData_; + + private int lastTime_; + + protected TrPostFlecheContentExpr(boolean _isElementData, H2dVariableType varName_, TrPostDataCreatedExpr vx_, + TrPostDataCreatedExpr vy_) { + super(); + this.varName_ = varName_; + this.vx_ = vx_; + this.vy_ = vy_; + isElementData_ = _isElementData; + } + + /** + * + */ + public TrPostFlecheContent changeVar(H2dVariableType _name) { + return new TrPostFlecheContentExpr(isElementData_, _name, vx_, vy_); + } + + public void clearCache() { + vx_.clearCache(); + vy_.clearCache(); + } + + public TrPostDataCreatedSaver createSaver() { + return null; + } + + public TrPostFlecheContent duplicate(TrPostSource _src) { + return new TrPostFlecheContentExpr(isElementData_, varName_, vx_.createCopy(_src), vy_.createCopy(_src)); + } + + public TrPostFlecheContent duplicate(TrPostSource _src, H2dVariableType name) { + return new TrPostFlecheContentExpr(isElementData_, name, vx_.createCopy(_src), vy_.createCopy(_src)); + } + + public void fillWhithAllUsedVar(Set _res) { + vx_.fillWhithAllUsedVar(_res); + vy_.fillWhithAllUsedVar(_res); + } + + /** + * + */ + public EfData getDataFor(int time) { + return getValues(time); + } + + public String getDescription() { + return varName_.getName(); + } + + /** + * + */ + public double getValue(int time, int object) { + return Math.hypot(vx_.getValue(time, object), vy_.getValue(time, object)); + } + + /** + * + */ + public TrPostDataVecteur getValues(int _tIdx) { + if (_tIdx != lastTime_) { + lastTime_ = _tIdx; + lastValue_ = new TrPostDataVecteur(vx_.getDataFor(_tIdx), vy_.getDataFor(_tIdx), isElementData_); + } + return lastValue_; + } + + /** + * + */ + public H2dVariableType getVar() { + return varName_; + } + + /** + * + */ + public H2dVariableType getVx() { + return null; + } + + /** + * + */ + public String getVxDesc() { + return getDescription() + " X"; + } + + /** + * + */ + public H2dVariableType getVy() { + return null; + } + + /** + * + */ + public String getVyDesc() { + return getDescription() + " Y"; + } + + /** + * + */ + public boolean isEditable() { + return true; + } + + /** + * + */ + public boolean isExpr() { + return true; + } + + /** + * + */ + public TrPostFlecheContent isFleche() { + return this; + } + + /** + * + */ + public boolean updateConstantVar(Variable _var) { + return vx_.updateConstantVar(_var) | vy_.updateConstantVar(_var); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -385,21 +385,28 @@ * @param _src */ public void ajouterSource(final TrPostSource _src) { - _src.addVariableListener(new VariableListener()); - if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { - listeSrc_.add(_src); - _src.buildDefaultVarUpdateLists(); + ajouterSource(_src,null); - // -- ajout du menu correspondant uniquement a partir de la 2eme --// - // if (listeSrc_.size()>1 || (menuPost_!=null &&)) - construitMenuPostSpecifiqueSource(_src); + } + + public void ajouterSource(final TrPostSource _src,String title) { + _src.addVariableListener(new VariableListener()); + if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { + listeSrc_.add(_src); + _src.buildDefaultVarUpdateLists(); - } else { - // -- messqge d erreur: le fichier est deja ouvert --// - new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + // -- ajout du menu correspondant uniquement a partir de la 2eme --// + // if (listeSrc_.size()>1 || (menuPost_!=null &&)) + construitMenuPostSpecifiqueSource(_src,title); - } + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + } + // -- notify aux observers --// + this.notifyObservers(); + } public TrPostSource findSource(final String _file) { @@ -457,6 +464,32 @@ return null; } + + /** + * Retourne toutes les sources qui ne sont pas des composites + * @return + */ + public List<TrPostSource> getAllClassicalSource(){ + List<TrPostSource> res=new ArrayList<TrPostSource>(); + for(TrPostSource src:listeSrc_){ + if(!isAsuiteCalcul(src)) + res.add(src); + } + return res; + } + /** + * Retourne toutes les sources qui sont des composites + * @return + */ + public List<TrPostSourceFromReader> getAllCCompositeSource(){ + List<TrPostSourceFromReader> res=new ArrayList<TrPostSourceFromReader>(); + for(TrPostSource src:listeSrc_){ + if(isAsuiteCalcul(src)) + res.add((TrPostSourceFromReader)src); + } + return res; + } + public boolean isSourceLoaded(final String _file) { return isSourceLoaded(new File(_file)); @@ -546,9 +579,29 @@ public String formatInfoSource(final TrPostSource _src) { // --ajout dans la liste des titres --// Collection<File> files = _src.getFiles(); + if(!isAsuiteCalcul(_src)) return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(files.iterator().next()); + else{ + +// String listeFiles=""; +// for(File f:files) +// listeFiles+="| "+f.getName(); + return _src.getTitle() ;//+ listeFiles; + } } + + public boolean isAsuiteCalcul(final TrPostSource _src){ + if(_src instanceof TrPostSourceFromReader){ + TrPostSourceFromReader s=(TrPostSourceFromReader) _src; + if(s.getReader() instanceof TrPostSourceReaderComposite) + return true; + + } + + return false; + } + public String formatFichier(final File file) { if (file == null) return ""; final String nomFichier = file.getAbsolutePath(); @@ -584,11 +637,15 @@ * * @param _src */ - public void construitMenuPostSpecifiqueSource(final TrPostSource _src) { + public void construitMenuPostSpecifiqueSource(final TrPostSource _src,String title) { - final BuMenu menuSimul = new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), + BuMenu menuSimul =null; + if(title==null) + menuSimul=new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), "SIMULATION" + (listeSrc_.size())); - + else + menuSimul=new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), + "SIMULATION" + (listeSrc_.size())); // -- ajout du menu au menu post --// getMenuPost().add(menuSimul); @@ -1374,7 +1431,28 @@ return src.getId(); } + + public String deliverSourceSuiteId(TrPostSource src) { + String idString = src.getTitle(); + if (src.getId() == null) { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } else { + + // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// + String nameFormate = FuLib.clean(idString); + String id = src.getId(); + if (!id.startsWith(nameFormate)) { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } + + } + return src.getId(); + + } + /** * genere uniquement l id. * Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -2,11 +2,14 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; +import java.io.File; import java.util.Date; import java.util.Observable; import java.util.Observer; import javax.swing.BorderFactory; +import javax.swing.JComboBox; +import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; @@ -14,11 +17,18 @@ import javax.swing.event.TableModelListener; import javax.swing.table.AbstractTableModel; +import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion.SondeCouple; +import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion.TreeTableModelGraphe; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.actions.TrPostActionOpenSrc; import org.fudaa.fudaa.tr.post.actions.TrPostActionRemoveSrc; import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.JXTree; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import com.memoire.bu.BuButton; import com.memoire.bu.BuInternalFrame; @@ -37,109 +47,16 @@ /** * projet contenant la liste des sources. */ - TrPostProjet projet_; + final TrPostProjet projet_; /** * La liste des projet afffichage graphique. */ - public JXTable listProjets_; + public JXTreeTable listProjets_; - /** - * Classe Model de la jlist - */ - class ModelTableProjets extends AbstractTableModel { + + TreeTableModelGraphe modelList_; - TrPostProjet p; - // FIXME traduire les lignes - String[] titres_ = { "N\xB0", "Nom", "Fichier", "Date de derni\xE8re modification" }; - - public ModelTableProjets(final TrPostProjet _p) { - p = _p; - - } - - @Override - public void addTableModelListener(final TableModelListener l) {} - - @Override - public Class<?> getColumnClass(final int columnIndex) { - - switch (columnIndex) { - case 0: - return Integer.class; - case 1: - return String.class; - case 2: - return String.class; - case 3: - return Date.class; - // case 4: - // return Boolean.class; - // case 5: - // return Boolean.class; - } - return null; - } - - public int getColumnCount() { - return titres_.length; - } - - @Override - public String getColumnName(final int columnIndex) { - return titres_[columnIndex]; - } - - public int getRowCount() { - return p.listeSrc_.size(); - } - - public Object getValueAt(final int rowIndex, final int columnIndex) { - - if (columnIndex >= getColumnCount()) return null; - final TrPostSource src = p.listeSrc_.get(rowIndex); - - switch (columnIndex) { - case 0: - return rowIndex + 1; - case 1: - return p.formatName(src.getTitle()); - case 2: - return src.getFiles().iterator().next().getAbsolutePath(); - case 3: - return new Date(src.getFiles().iterator().next().lastModified()); - // case 4: - // return src.isInspectable(); - // case 5: - // return src.isRubar(); - } - return null; - } - - /** - * Format le nom du fichier - * - * @param file - * @return - */ - - @Override - public boolean isCellEditable(final int rowIndex, final int columnIndex) { - return false; - } - - @Override - public void removeTableModelListener(final TableModelListener l) {} - - @Override - public void setValueAt(final Object value, final int rowIndex, final int columnIndex) {} - - // TODO utiliser CtuluCellTextRenderer - - } - - ModelTableProjets modelList_; - BuButton boutonAjoutSrc_ = new BuButton("Ajouter un projet", BuResource.BU.getIcon("crystal_ouvrirprojet")); BuButton boutonEnleveSrc_ = new BuButton("Enlever un projet", BuResource.BU.getIcon("crystal_enlever")); // BuButton boutonChangeSrc_ = new BuButton("Changer de donn\xE9es", BuResource.BU.getIcon("crystal_valider")); @@ -156,15 +73,15 @@ projet_.getObservable().addObserver(this); // --creation de la liste graphique des projets --// - modelList_ = new ModelTableProjets(projet_); + modelList_ = constructStructureModel() ;//new TreeTableModelGraphe(); - listProjets_ = new JXTable(modelList_); + listProjets_ = new JXTreeTable(modelList_); // listProjets_.setCellRenderer(modelList_); // -- mise en forme des colonnes --// - listProjets_.getColumnModel().getColumn(0).setPreferredWidth(5); - listProjets_.getColumnModel().getColumn(1).setPreferredWidth(250); - listProjets_.getColumnModel().getColumn(2).setPreferredWidth(100); +// listProjets_.getColumnModel().getColumn(0).setPreferredWidth(5); +// listProjets_.getColumnModel().getColumn(1).setPreferredWidth(250); +// listProjets_.getColumnModel().getColumn(2).setPreferredWidth(100); listProjets_.setBorder(BorderFactory.createEtchedBorder()); @@ -173,7 +90,7 @@ // -- oblige la selection unique pour ne pas ajouter qu un seul projet a la // fois--// - listProjets_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + // listProjets_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // -- selectionne par default le src courant --// // listProjets_.setSelectedValue(projet_.src_, true); @@ -230,19 +147,132 @@ public void valueChanged(final ListSelectionEvent e) { - // -- recuperation de l element selectionn\xE9 --// - // FuLog.warning("l'objet selectionne est: " + - // listProjets_.getSelectedValue()); + } + /** + * Construit le model du tableau. + * @return + */ + public TreeTableModelGraphe constructStructureModel() { + DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Gestion multi-fichiers"); + + for (int i = 0; i <projet_.listeSrc_.size(); i++) { + TrPostSource src= projet_.listeSrc_.get(i); + + + DefaultMutableTreeTableNode nodeCalque = new DefaultMutableTreeTableNode(src); + root.add(nodeCalque); + + //- ajout des fichiers associ\xE9s --// + for(File f:src.getFiles()) + nodeCalque.add(new DefaultMutableTreeTableNode(f)); + } + TreeTableModelGraphe model = new TreeTableModelGraphe(projet_); + model.setRoot(root); + + return model; + } + + + public class TreeTableModelGraphe extends DefaultTreeTableModel { + String[] titre_; + TrPostProjet projet; + + + + public Class<?> getColumnClass(final int columnIndex) { + + switch (columnIndex) { + case 0: + return Integer.class; + case 1: + return String.class; + } + return null; + } + + // -- data correspondant au x donn\xE9 --// + double[] dataY_ = new double[0]; + + public TreeTableModelGraphe(TrPostProjet p) { + String[] val = {"Fichiers", "Date modification" }; + titre_ = val; + projet=p; + } + + public int getColumnCount() { + + return titre_.length; + } + + @Override + public boolean isCellEditable(Object _node, int _column) { + return false; + } + + public String getColumnName(int _columnIndex) { + return titre_[_columnIndex]; + } + + public int getRowCount() { + return projet.listeSrc_.size(); + + } + + public Object getValueAt(Object node, int column) { + Object res = new DefaultMutableTreeTableNode("n/a"); + if (node instanceof DefaultMutableTreeTableNode) { + DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node; + if (defNode.getUserObject() instanceof TrPostSource) { + TrPostSource src=(TrPostSource)defNode.getUserObject(); + String label=(getRoot().getIndex(defNode)+1)+". "+ projet_.formatName(src.getTitle()); + if (column == 0) + return label; + else + return ""; + } else if (defNode.getUserObject() instanceof File) { + File fichier = (File) defNode.getUserObject(); + + if (column == 0) + return fichier.getAbsolutePath(); + else if (column == 1) + return new Date(fichier.lastModified()); + else + return ""; + } + else + return ""; + } + return res; + } + + public DefaultMutableTreeTableNode getTreeNode(int i) { + return (DefaultMutableTreeTableNode) getRoot().getChildAt(i); + + } + + public void reload() { + + this.modelSupport.fireTreeStructureChanged(listProjets_.getPathForRow(0)); + + } + + + } + public void update(final Observable o, final Object arg) { // mise a jour de la liste - modelList_.fireTableStructureChanged(); - + if(listProjets_==null)return; + listProjets_.setTreeTableModel(constructStructureModel()); + listProjets_.expandAll(); +// if(listProjets_.getModel() instanceof TreeTableModelGraphe) +// ((TreeTableModelGraphe)listProjets_.getModel()).reload(); // selection par defaut de la premiere simul listProjets_.clearSelection(); + this.revalidate(); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -332,4 +332,8 @@ * @param _d */ void setDefaultPaletteMinPalette(H2dVariableType[] _v, boolean[] _actived, double[] _d); + + + public void fillWithSourceCreationInfo(String _pref, Map _table) ; + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -218,7 +218,7 @@ TrPostTimeModel time_; - private final String title_; + protected final String title_; protected ObjectContainer tmpContainer_; @@ -950,7 +950,7 @@ return time_.getTimeStep(_i); } - public final String getTitle() { + public String getTitle() { return title_; } @@ -1398,13 +1398,13 @@ // return CtuluLibGenerator.getInstance().deliverUniqueStringId(); // } - public final String getId() { + public String getId() { // if(id_==null) // id_=generateId(); return id_; } - public final void setId(String id) { + public void setId(String id) { id_ = id; } @@ -1448,5 +1448,10 @@ idx++; } } + + public void fillWithSourceCreationInfo(String _pref, Map _table){ + TrPostSourceAbstractFromIdx.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, _table, this); + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java 2009-01-27 16:38:58 UTC (rev 4411) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -7,7 +7,9 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.Map; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluUI; import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfGridInterface; @@ -20,71 +22,92 @@ */ public class TrPostSourceFromReader extends TrPostSourceAbstract{ - TrPostSourceReaderInterface reader_; + TrPostSourceReaderInterface reader_; - /** - * @param _file - * @param _titre - * @param _g - * @param _time - * @param _v - * @param _impl - */ - public TrPostSourceFromReader(TrPostSourceReaderInterface _reader, String _titre, EfGridInterface _g, CtuluUI _impl) { - super(_titre, _g, getTimes(_reader), - _reader.getInitVar().toArray(new H2dVariableType[_reader.getInitVar().size()]), _impl); - reader_=_reader; - } + /** + * @param _file + * @param _titre + * @param _g + * @param _time + * @param _v + * @param _impl + */ + public TrPostSourceFromReader(TrPostSourceReaderInterface _reader, String _titre, EfGridInterface _g, CtuluUI _impl) { + super(_titre, _g, getTimes(_reader), + _reader.getInitVar().toArray(new H2dVariableType[_reader.getInitVar().size()]), _impl); + reader_=_reader; + } - public static double[] getTimes(TrPostSourceReaderInterface _init) { - if (_init == null || _init.getNbTimeStep() == 0) return FuEmptyArrays.DOUBLE0; - double[] res = new double[_init.getNbTimeStep()]; - for (int i = 0; i < res.length; i++) { - res[i] = _init.getTimeStep(i); - } - return res; + public static double[] getTimes(TrPostSourceReaderInterface _init) { + if (_init == null || _init.getNbTimeStep() == 0) return FuEmptyArrays.DOUBLE0; + double[] res = new double[_init.getNbTimeStep()]; + for (int i = 0; i < res.length; i++) { + res[i] = _init.getTimeStep(i); + } + return res; - } - - @Override - public final void close() { - super.close(); - reader_.close(); - } - - + } - public Collection<File> getFiles() { - return reader_.getFiles(); - } + @Override + public final void close() { + super.close(); + reader_.close(); + } - /** - * @return the reader - */ - public TrPostSourceReaderInterface getReader() { - return reader_; - } - /** - * @param _reader the reader to set - */ - public void setReader(TrPostSourceReaderInterface _reader) { - reader_ = _reader; - } - @Override - public EfData getInitData(H2dVariableType _varIdx, int _timeIdx) { - return reader_.getInitData(_varIdx, _timeIdx); - } + public final String getTitle() { + if(reader_.getTitle()!=null) + return reader_.getTitle(); + return title_; + } - @Override - public double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException { - return reader_.getInitData(_varIdx, _timeIdx, _ptIdx); - } + public Collection<File> getFiles() { + return reader_.getFiles(); + } + /** + * @return the reader + */ + public TrPostSourceReaderInterface getReader() { + return reader_; + } - public boolean isRubar() { - return false; - } + /** + * @param _reader the reader to set + */ + public void setReader(TrPostSourceReaderInterface _reader) { + reader_ = _reader; + } + @Override + public EfData getInitData(H2dVariableType _varIdx, int _timeIdx) { + return reader_.getInitData(_varIdx, _timeIdx); + } + + @Override + public double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException { + return reader_.getInitData(_varIdx, _timeIdx, _ptIdx); + } + + + public boolean isRubar() { + return false; + } + + public void fillWithSourceCreationInfo(String _pref, Map _table){ + + if(this.getReader() instanceof TrPostSourceReaderComposite) + ((TrPostSourceReaderComposite)getReader()).fillInfosWithComposite( _table, (TrPostSourceReaderComposite)getReader()); + } + + + public String getId() { + return reader_.getId(); + } + + public void setId(String id) { + reader_.SetId(id); + } + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourcePersistComposite.java 2009-01-27 17:12:46 UTC (rev 4412) @@ -0,0 +1,52 @@ +package org.fudaa.fudaa.tr.post; + +import java.util.ArrayList; +import java.util.List; + +/** + * Persistance du TrPostSourceReader composite utilis\xE9 pour les sauvegardes suites de calcul. + * Contient plusieurs ids vers les TrPostSourceReaderInterface correspondants. + * + * @author Adrien Hadoux + */ +public class TrPostSourcePersistComposite { + + /** + * Liste des id des fichiers qui composent la suite. + */ + public List<String> listeIdFicResu; + + public String Id; + + /** + * Utiliser par la serialization. + */ + TrPostSourcePersistComposite(){ + listeIdFicResu=new ArrayList<String>(); + } + + /** + * Constructeur qui se charge de remplir les donn\x... [truncated message content] |
From: <de...@us...> - 2009-01-27 20:57:19
|
Revision: 4415 http://fudaa.svn.sourceforge.net/fudaa/?rev=4415&view=rev Author: deniger Date: 2009-01-27 20:57:12 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.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/TrPostSourceReaderComposite.java 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-27 18:04:48 UTC (rev 4414) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-01-27 20:57:12 UTC (rev 4415) @@ -134,25 +134,18 @@ @Override public void addTableModelListener(TableModelListener l) { - // TODO Auto-generated method stub - } @Override public Class<?> getColumnClass(int columnIndex) { - // TODO Auto-generated method stub return String.class; } - @Override public int getColumnCount() { - // TODO Auto-generated method stub return colonnes_.size(); } - @Override public void removeTableModelListener(TableModelListener l) { - // TODO Auto-generated method stub } 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-27 18:04:48 UTC (rev 4414) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-27 20:57:12 UTC (rev 4415) @@ -31,319 +31,318 @@ */ public class TrPostBuilderSuiteCalcul { - /** - * Action qui r\xE9alise la suite de calcul. - * - * @author Adrien Hadoux - */ - public static class ActionBuildSuite extends EbliActionSimple { + /** + * Action qui r\xE9alise la suite de calcul. + * + * @author Adrien Hadoux + */ + public static class ActionBuildSuite extends EbliActionSimple { - TrPostSource src_; - TrPostCommonImplementation impl_; + TrPostSource src_; + TrPostCommonImplementation impl_; - public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { - super(_name, _ic, _ac); - // TODO Auto-generated constructor stub - src_ = src; - src_ = src; - impl_ = impl; - } + public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { + super(_name, _ic, _ac); + // TODO Auto-generated constructor stub + src_ = src; + src_ = src; + impl_ = impl; + } - public void actionPerformed(ActionEvent _e) { + public void actionPerformed(ActionEvent _e) { - // -- test de comptabilit\xE9 de fichier source --// - if (!isCompatibleSuiteCalcul(src_)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + // -- test de comptabilit\xE9 de fichier source --// + if (!isCompatibleSuiteCalcul(src_)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - // -- on lance la dialog de choix des fichiers sources --// - final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); - if (srcChoisie == null) { - impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); - return; - } + // -- on lance la dialog de choix des fichiers sources --// + final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); + if (srcChoisie == null) { + impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } - if (!isCompatibleSuiteCalcul(srcChoisie)) { - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - List<String> error = new ArrayList<String>(); + List<String> error = new ArrayList<String>(); - // -- creation de la suite de calcul --// - TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, - (TrPostSourceFromReader) srcChoisie, error); + // -- creation de la suite de calcul --// + TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, + (TrPostSourceFromReader) srcChoisie, error); - if (suiteCalcul == null) { - // -- il se passe des choses \xE9tranges.... --// - String maxiStringLeo = ""; - for (String err : error) - maxiStringLeo += err + "\n"; + if (suiteCalcul == null) { + // -- il se passe des choses \xE9tranges.... --// + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; - impl_.error(maxiStringLeo); - return; - } + impl_.error(maxiStringLeo); + return; + } - // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// + // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// - impl_.c_.ajouterSource(suiteCalcul,suiteCalcul.getTitle()); + impl_.c_.ajouterSource(suiteCalcul, suiteCalcul.getTitle()); - // -- on cree la vue 2d correspondante --// + // -- on cree la vue 2d correspondante --// - TrPostProjet projet = impl_.getCurrentProject(); - TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; - final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), - null); - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); - final EbliNode node = controller.addCalque(TrResource.getS("Calque") - + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), - pnVisu, legendeCalque); - // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription(suiteCalcul.getTitle()); + TrPostProjet projet = impl_.getCurrentProject(); + TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), + null); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); + final EbliNode node = controller.addCalque(TrResource.getS("Calque") + + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu, legendeCalque); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getWidget().getController().setDescription(suiteCalcul.getTitle()); - // -- ajout des infos de cr\xE9ation --// + // -- ajout des infos de cr\xE9ation --// - TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, - (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); + TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, + (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); - } + } - } + } - /** - * R\xE9cup\xE9rer l'interface \xE0 partir du fichier - * - * @param _f - * @param _impl - * @return - */ - public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { - TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); - if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); - return null; + /** + * R\xE9cup\xE9rer l'interface \xE0 partir du fichier + * + * @param _f + * @param _impl + * @return + */ + public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { + TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); + if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); + return null; - } + } - public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - // -- lecture de l'interface \xE0 ajouter --// - TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); - return createSuiteCalcul(_reader, _impl, srcToConcat, error); - } + public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + // -- lecture de l'interface \xE0 ajouter --// + TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); + return createSuiteCalcul(_reader, _impl, srcToConcat, error); + } - /** - * Algorithme de construction d'une suite de calcul. - * - * @param srcToConcat - * @param _impl - * @param _reader - * @param error - * @return - */ - public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, - TrPostSourceFromReader _reader, List<String> error) { - TrPostSourceReaderComposite suite = null; - if (srcToConcat == null) { - error.add(TrResource.getS("Le fichier n'est pas valide.")); - return null; - } + /** + * Algorithme de construction d'une suite de calcul. + * + * @param srcToConcat + * @param _impl + * @param _reader + * @param error + * @return + */ + public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { - if (_reader.isRubar() || srcToConcat.isRubar()) { - error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); - return null; - } + if (srcToConcat == null) { + error.add(TrResource.getS("Le fichier n'est pas valide.")); + return null; + } - // -- comparaison des grilles --// - EfGridInterface grille = srcToConcat.getGrid(); - if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { - error.add(TrResource.getS("Les grilles ne sont pas identiques")); - return null; - } + if (_reader.isRubar() || srcToConcat.isRubar()) { + error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); + return null; + } - // -- comparaison des pas de temps d\xE9but et finaux --// - double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); - double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); + // -- comparaison des grilles --// + EfGridInterface grille = srcToConcat.getGrid(); + if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { + error.add(TrResource.getS("Les grilles ne sont pas identiques")); + return null; + } - if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { - error.add(TrResource - .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); - return null; - } + // -- comparaison des pas de temps d\xE9but et finaux --// + double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); + double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); - // -- recuperation des pas de temps et des variables --// - // double[] timeTotal= new double[time1.length+time2.length-1]; - // if(time1[0]>time2[0]){ - // //-- on permute pour garder l'ordre --// - // double[] temp=time1; - // time1=time2; - // time2=temp; - // } - // for(int i=0;i<time1.length;i++) - // timeTotal[i]=time1[i]; - // for(int i=0;i<time2.length-1;i++) - // timeTotal[time1.length+i]=time2[i+1]; + if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { + error.add(TrResource + .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); + return null; + } - HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); - H2dVariableType[] var = null; -// for (int i = 0; i < _reader.getAvailableVar().length; i++) -// listeVar.add(_reader.getVariable(i)); -// for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) -// listeVar.add(srcToConcat.getVariable(i)); - - - //-- intersection des variables des 2 fichiers --// - for (int i = 0; i < _reader.getAvailableVar().length; i++){ - boolean trouve=false; - for (int j = 0; !trouve && j < srcToConcat.getAvailableVar().length; j++) - if(srcToConcat.getVariable(j).equals(_reader.getVariable(i)) || srcToConcat.getVariable(j).getID().equals(_reader.getVariable(i).getID()) ) { - trouve=true; - listeVar.add(_reader.getVariable(i)); - } - } - - var = new H2dVariableType[listeVar.size()]; - int k = 0; - for (H2dVariableType v : listeVar) - var[k++] = v; + // -- recuperation des pas de temps et des variables --// + // double[] timeTotal= new double[time1.length+time2.length-1]; + // if(time1[0]>time2[0]){ + // //-- on permute pour garder l'ordre --// + // double[] temp=time1; + // time1=time2; + // time2=temp; + // } + // for(int i=0;i<time1.length;i++) + // timeTotal[i]=time1[i]; + // for(int i=0;i<time2.length-1;i++) + // timeTotal[time1.length+i]=time2[i+1]; - // var=srcToConcat.variable_; + HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); + H2dVariableType[] var = null; + // for (int i = 0; i < _reader.getAvailableVar().length; i++) + // listeVar.add(_reader.getVariable(i)); + // for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) + // listeVar.add(srcToConcat.getVariable(i)); - // -- initialisation de la liste de source --// - List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); + // -- intersection des variables des 2 fichiers --// + for (int i = 0; i < _reader.getAvailableVar().length; i++) { + boolean trouve = false; + for (int j = 0; !trouve && j < srcToConcat.getAvailableVar().length; j++) + if (srcToConcat.getVariable(j).equals(_reader.getVariable(i)) + || srcToConcat.getVariable(j).getID().equals(_reader.getVariable(i).getID())) { + trouve = true; + listeVar.add(_reader.getVariable(i)); + } + } - // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// - TrPostSourceReaderInterface interface1 = _reader.reader_; - TrPostSourceReaderInterface interface2 = srcToConcat.reader_; + var = new H2dVariableType[listeVar.size()]; + int k = 0; + for (H2dVariableType v : listeVar) + var[k++] = v; - // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// - if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); - else listeSourceInterface_.add(interface1); + // var=srcToConcat.variable_; - if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ - .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); - else listeSourceInterface_.add(interface2); + // -- initialisation de la liste de source --// + List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); - // -- ajout de tous les fichiers dans la collection --// - final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; - file_.addAll(interface2.getFiles()); + // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// + TrPostSourceReaderInterface interface1 = _reader.reader_; + TrPostSourceReaderInterface interface2 = srcToConcat.reader_; - // -- on trie les listes dans l'ordre des timestep --// - Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); + // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// + if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); + else listeSourceInterface_.add(interface1); - // - ajout des correspondances timestep/source avec nouveau timestep --// - Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); - // TODO utilise TDoubleArrayList - TDoubleArrayList times = new TDoubleArrayList(); - // int cpt = 0; - for (TrPostSourceReaderInterface data : listeSourceInterface_) { - for (int i = 0; i < data.getNbTimeStep(); i++) { - // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi - // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// - if (!times.contains(data.getTimeStep(i))) { - // le cpt vaut la taille des times - mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); - times.add(data.getTimeStep(i)); - // cpt++; - } - } - } + if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); + else listeSourceInterface_.add(interface2); - double[] timeTotal = times.toNativeArray(); - // -- creation de la suite de calcul - suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, - listeSourceInterface_, file_); - - TrPostSource resultat=new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); - _impl.getCurrentProject().deliverSourceSuiteId(resultat); - // -- creation du source Reader --// - return resultat; - } + // -- ajout de tous les fichiers dans la collection --// + final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; + file_.addAll(interface2.getFiles()); + // -- on trie les listes dans l'ordre des timestep --// + Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); - /** - * Methode qui se charge de construire la suite de calcul a partir de la liste des id des fichiers. - * - * @param listeIdSrc - * @param projet - * @return - */ - public static TrPostSource createSuiteCalculFromPersistance(List<String> listeIdSrc,TrPostProjet projet,String idSrc){ - TrPostCommonImplementation impl=projet.getImpl(); - //- on met proprement en forme les donn\xE9es --// - List<TrPostSourceFromReader> listeReader=new ArrayList<TrPostSourceFromReader>(); - for(String id:listeIdSrc){ + // - ajout des correspondances timestep/source avec nouveau timestep --// + Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); + // TODO utilise TDoubleArrayList + TDoubleArrayList times = new TDoubleArrayList(); + // int cpt = 0; + for (TrPostSourceReaderInterface data : listeSourceInterface_) { + for (int i = 0; i < data.getNbTimeStep(); i++) { + // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi + // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// + if (!times.contains(data.getTimeStep(i))) { + // le cpt vaut la taille des times + mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); + times.add(data.getTimeStep(i)); + // cpt++; + } + } + } - final TrPostSource srcChoisie = projet.findSourceById(id); - if (srcChoisie == null) { - impl.error(TrResource.getS(TrResource.getS("Le fichier r\xE9sultat d'id "+id+" est introuvable.\n Suite de calcul interrompue"))); - return null; - } - if (!isCompatibleSuiteCalcul(srcChoisie)) { - impl.error(TrResource.getS("Le fichier d'id "+id+" n'est pas valide pour la suite de calcul.")); - return null; - } - listeReader.add((TrPostSourceFromReader) srcChoisie) ; - } + double[] timeTotal = times.toNativeArray(); + // -- creation de la suite de calcul + TrPostSourceReaderComposite suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, + listeSourceInterface_, file_); - //-- on demarre la suite de calcul --// - Iterator<TrPostSourceFromReader> it=listeReader.iterator(); - TrPostSourceFromReader suiteProgressive=it.next(); + TrPostSource resultat = new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); + resultat.buildDefaultVarUpdateLists(); + _impl.getCurrentProject().deliverSourceSuiteId(resultat); + // -- creation du source Reader --// + return resultat; + } - List<String> error=new ArrayList<String>(); - while(it.hasNext()){ - //-- on calcule la suite progressive que l'on stocke dans la suite progressive --// - TrPostSourceFromReader suite =(TrPostSourceFromReader) TrPostBuilderSuiteCalcul.createSuiteCalcul(suiteProgressive, impl, it.next(), error); - if(suite==null){ - String maxiStringLeo = ""; - for (String err : error) - maxiStringLeo += err + "\n"; - if(suiteProgressive!=null){ - maxiStringLeo+="La suite de calcul s'arrete donc avec les fichiers "+suiteProgressive.getTitle(); - suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); - } - - impl.error(maxiStringLeo); - return suiteProgressive; - }else - suiteProgressive=suite; + /** + * Methode qui se charge de construire la suite de calcul a partir de la liste des id des fichiers. + * + * @param listeIdSrc + * @param projet + * @return + */ + public static TrPostSource createSuiteCalculFromPersistance(List<String> listeIdSrc, TrPostProjet projet, String idSrc) { + TrPostCommonImplementation impl = projet.getImpl(); + // - on met proprement en forme les donn\xE9es --// + List<TrPostSourceFromReader> listeReader = new ArrayList<TrPostSourceFromReader>(); + for (String id : listeIdSrc) { - } + final TrPostSource srcChoisie = projet.findSourceById(id); + if (srcChoisie == null) { + impl.error(TrResource.getS(TrResource.getS("Le fichier r\xE9sultat d'id " + id + + " est introuvable.\n Suite de calcul interrompue"))); + return null; + } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl.error(TrResource.getS("Le fichier d'id " + id + " n'est pas valide pour la suite de calcul.")); + return null; + } + listeReader.add((TrPostSourceFromReader) srcChoisie); + } + // -- on demarre la suite de calcul --// + Iterator<TrPostSourceFromReader> it = listeReader.iterator(); + TrPostSourceFromReader suiteProgressive = it.next(); - //-- trigger signal modif --// - suiteProgressive.setId(idSrc); - projet.ajouterSource(suiteProgressive); - return suiteProgressive; - } + List<String> error = new ArrayList<String>(); + while (it.hasNext()) { + // -- on calcule la suite progressive que l'on stocke dans la suite progressive --// + TrPostSourceFromReader suite = (TrPostSourceFromReader) TrPostBuilderSuiteCalcul.createSuiteCalcul( + suiteProgressive, impl, it.next(), error); + if (suite == null) { + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; + if (suiteProgressive != null) { + maxiStringLeo += "La suite de calcul s'arrete donc avec les fichiers " + suiteProgressive.getTitle(); + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + } + impl.error(maxiStringLeo); + return suiteProgressive; + } else suiteProgressive = suite; - /** - * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. - * - * @param src - * @return - */ - public static boolean isCompatibleSuiteCalcul(TrPostSource src) { + } - if (src != null && src instanceof TrPostSourceFromReader) return true; - return false; - } + // -- trigger signal modif --// + suiteProgressive.setId(idSrc); + projet.ajouterSource(suiteProgressive); + return suiteProgressive; + } - public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { + /** + * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. + * + * @param src + * @return + */ + public static boolean isCompatibleSuiteCalcul(TrPostSource src) { - public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + if (src != null && src instanceof TrPostSourceFromReader) return true; + return false; + } - // -- on compare selon la valeur des timesteps -- - if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; + public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { - if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; + public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { - return 0; - } + // -- on compare selon la valeur des timesteps -- + if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; - } + if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; + return 0; + } + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java 2009-01-27 18:04:48 UTC (rev 4414) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java 2009-01-27 20:57:12 UTC (rev 4415) @@ -54,7 +54,6 @@ listeSourceInterface_ = listeSourceInterface; mapTimeStep_ = mapTimeStep; - } public List<TrPostSourceReaderInterface> getListeSourceInterface() { @@ -85,7 +84,6 @@ return data.data_.getInitData(_varIdx, data.timeStep_, _ptIdx); } - /** * Remplissage des informations avec l'ensemble des fichiers qui composent la suite de calcul. * @@ -110,32 +108,28 @@ } - - + public String getTitle() { -public String getTitle() { - - String title=TrResource.getS("Suite de calcul"); - title+=":"; - for(File f:file_) - title+=" "+f.getName(); - - - return title; -} + String title = TrResource.getS("Suite de calcul"); + title += ":"; + for (File f : file_) + title += " " + f.getName(); -/** - * Cas particulier: il gere lui meme ses propres ids. - */ -String id_; -public void SetId(String id) { - id_=id; -} + return title; + } -@Override -public String getId() { - // TODO Auto-generated method stub - return id_; -} + /** + * Cas particulier: il gere lui meme ses propres ids. + */ + String id_; + public void SetId(String id) { + id_ = id; + } + + public String getId() { + // TODO Auto-generated method stub + return id_; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-01-28 22:44:35
|
Revision: 4423 http://fudaa.svn.sourceforge.net/fudaa/?rev=4423&view=rev Author: deniger Date: 2009-01-28 22:44:24 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 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/tr/common/tr_en.fr_txt 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/TrPostFlecheContentDefaut.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.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/TrPostRubarEnvFlecheContent.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataVecteur.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluCellTextRenderer.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -24,6 +24,7 @@ * @author fred deniger * @version $Id: CtuluCellTextRenderer.java,v 1.14 2007-04-30 14:21:16 deniger Exp $ */ +@SuppressWarnings("serial") public class CtuluCellTextRenderer extends JLabel implements CtuluCellRenderer, TreeCellRenderer { private CtuluCellDecorator decorator_; 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-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -4,33 +4,23 @@ import java.awt.Color; import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.GridLayout; -import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.image.BufferedImage; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JColorChooser; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; -import javax.swing.ListCellRenderer; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; @@ -39,25 +29,19 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import jxl.Image; - -import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluNumberFormatDefault; import org.fudaa.ctulu.CtuluNumberFormatI; import org.fudaa.ctulu.CtuluRange; +import org.fudaa.ctulu.gui.CtuluCellTextRenderer; import org.fudaa.ctulu.gui.CtuluDecimalFormatEditPanel; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluPopupMenu; -import org.fudaa.ebli.calque.CalqueGISTreeModel.CellRenderer; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurePalette; -import org.fudaa.ebli.palette.BPalettePlageLegende; import org.fudaa.ebli.palette.BPalettePlageTarget; import org.fudaa.ebli.palette.BPlageAbstract; import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigne; import com.memoire.bu.BuBorderLayout; @@ -68,7 +52,6 @@ import com.memoire.bu.BuEmptyList; import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuLabel; -import com.memoire.bu.BuLib; import com.memoire.bu.BuMenuItem; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; @@ -77,354 +60,372 @@ import com.memoire.bu.BuToolButton; import com.memoire.bu.BuVerticalLayout; - /** - * Palette de l\xE9gende des graphes. - * Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes + * Palette de l\xE9gende des graphes. Utilis\xE9e pour \xE9diter les l\xE9gendes des graphes + * * @author Adrien Hadoux - * */ -public class EGPaletteLegendeGraphe extends BuPanel implements ActionListener,ListSelectionListener,BuBorders{ +public class EGPaletteLegendeGraphe extends BuPanel implements ActionListener, ListSelectionListener, BuBorders { - /** - * Graphe associ\xE9 a la palette - */ - EGGraphe graphe_; + /** + * Graphe associ\xE9 a la palette + */ + EGGraphe graphe_; - //Map<BuTextField,EGCourbe > mapTitles_; + // Map<BuTextField,EGCourbe > mapTitles_; - /** - * Bouton qui applique les changements - */ - JButton btApply_; + /** + * Bouton qui applique les changements + */ + JButton btApply_; - BuToolButton btAssombrir_; + BuToolButton btAssombrir_; - JButton btColor_; + JButton btColor_; - BuToolButton btEcl_; + BuToolButton btEcl_; - BuButton btFormat_; + BuButton btFormat_; - JButton btRefresh_; + JButton btRefresh_; - BuCheckBox cbChangedLeg_; + BuCheckBox cbChangedLeg_; - CtuluRange dataBoite_; + CtuluRange dataBoite_; - TraceIcon ic_; + TraceIcon ic_; - boolean isAdjusting_; + boolean isAdjusting_; - BuMenuItem itemRemove_; + BuMenuItem itemRemove_; - BuMenuItem itemSplit_; + BuMenuItem itemSplit_; - JLabel lbGrapheTitle_; + JLabel lbGrapheTitle_; + /** + * Format des nombres des l\xE9gendes + */ + CtuluNumberFormatI format_ = CtuluNumberFormatDefault.DEFAULT_FMT; - /** - * Format des nombres des l\xE9gendes - */ - CtuluNumberFormatI format_ =CtuluNumberFormatDefault.DEFAULT_FMT; + /** + * S\xE9parateur entre les formats + */ + String separatorFormat_ = "-"; - /** - * S\xE9parateur entre les formats - */ - String separatorFormat_="-"; + /** + * La liste des cournes + */ + JList list_; - /** - * La liste des cournes - */ - JList list_; + CtuluPopupMenu menu_; - CtuluPopupMenu menu_; + /** + * Panel des donn\xE9es qui se met a jour automatiquement lors du clic dans la liste des courbes. + */ + JPanel panelData_; + BPlageAbstract plageEnCours_; - /** - * Panel des donn\xE9es qui se met a jour automatiquement lors du clic dans la liste des courbes. - */ - JPanel panelData_; + List plages_; - BPlageAbstract plageEnCours_; + /** + * LE scroll de la liste des courbe + */ + BuScrollPane sp_; - List plages_; + BPalettePlageTarget target_; - /** - * LE scroll de la liste des courbe - */ - BuScrollPane sp_; + JTextField tfPlageLeg_; + /** + * Textfield du contenu du titre de la courbe + */ + JTextField tfTitleCourbeTop_; - BPalettePlageTarget target_; + // BuTextField txtTitleCourbe_=new BuTextField(10); - JTextField tfPlageLeg_; - /** - * Textfield du contenu du titre de la courbe - */ - JTextField tfTitleCourbeTop_; + private class PlageTableModel implements ListModel { + EGCourbe[] liste_; + public PlageTableModel(EGCourbe[] list) { + super(); + liste_ = list; + } - //BuTextField txtTitleCourbe_=new BuTextField(10); + public void addListDataListener(ListDataListener l) {} + public Object getElementAt(int index) { + return liste_[index]; + } + public int getSize() { + return liste_.length; + } + public void removeListDataListener(ListDataListener l) {} + } + /** + * Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9 + * + * @author Adrien Hadoux + */ + @SuppressWarnings("serial") + private static class LegendeRenderer extends CtuluCellTextRenderer { // ne pas refaire le travail !!!!!!! - private class PlageTableModel implements ListModel{ - EGCourbe[] liste_; - public PlageTableModel(EGCourbe[] list){ - super(); - liste_=list; - } + private final CellRendererIcon icon_ = new CellRendererIcon(); - public void addListDataListener(ListDataListener l) { - } + public LegendeRenderer() {} - public Object getElementAt(int index) { - return liste_[index]; - } + @Override + protected void setValue(Object _value) { + EGCourbe cb = (EGCourbe) _value; + icon_.setCourbe(cb); + setIcon(icon_); + setText(cb.getTitle()); + setOpaque(true); + } - public int getSize() { - return liste_.length; - } + // public Component getListCellRendererComponent(JList _list, Object _value, int _index, boolean _isSelected, + // boolean _cellHasFocus) { + // super.getListCellRendererComponent(_list, _value, _index, _isSelected, _cellHasFocus); + // EGCourbe cb = (EGCourbe) _value; + // // // pas optimise: a chaque fois que le renderer tu cree une image + // // BufferedImage image = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB); + // // Graphics2D g = image.createGraphics(); + // // final Rectangle rec = new Rectangle(20, 20); + // // // g.translate(rec.x, rec.y); + // // // la ligne + // // g.setColor(Color.white); + // // g.fillRect(0, 0, 20, 20); + // // final TraceLigne l = new TraceLigne(cb.getLigneModel()); + // // l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); + // // // l'icone + // // final TraceIconModel icm = new TraceIconModel(cb.getIconModel()); + // // icm.setTaille(Math.min(rec.width / 3, rec.height / 3));// a voir + // // final TraceIcon ic = new TraceIcon(icm); + // // ic.paintIconCentre(g, rec.width / 2, rec.height / 2); + // // // g.translate(-rec.x, -rec.y); + // // image.flush(); + // icon_.setCourbe(cb); + // setIcon(icon_); + // setText(cb.getTitle()); + // setOpaque(true); + // // // resultat.setIconTextGap(12); + // // if (isSelected) { + // // resultat.setBackground(HIGHLIGHT_COLOR); + // // resultat.setForeground(Color.white); + // // } + // + // return this; + // } + } - public void removeListDataListener(ListDataListener l) { - } - } + /** + * Un icone + * + * @author deniger + */ + private static class CellRendererIcon implements Icon { + TraceLigne traceLigne_ = new TraceLigne(); + TraceIcon traceIcon_ = new TraceIcon(); - /** - * Renderer qui affiche la courbe sous forme de sa courbe miniature et son libell\xE9 \xE0 cot\xE9 - * @author Adrien Hadoux - * - */ - private class LegendeRenderer implements ListCellRenderer{ + protected void setCourbe(EGCourbe _c) { + traceLigne_.getModel().updateData(_c.getLigneModel()); + traceIcon_.getModel().updateData(_c.getIconModel()); + traceIcon_.setTaille(getIconHeight() / 4);// a voir + } - private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); - public LegendeRenderer(){ + public int getIconHeight() { + return 20; + } - } + public int getIconWidth() { + return 30; + } - @Override - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - EGCourbe cb=(EGCourbe) value; - JLabel resultat=new JLabel(); + public void paintIcon(Component _c, Graphics _g, int _x, int _y) { + Graphics2D g = (Graphics2D) _g; + g.setColor(Color.white); + g.fillRect(_x, _y, _x + getIconWidth(), _y + getIconHeight()); + int middleH = _y + getIconHeight() / 2; + traceLigne_.dessineTrait(g, _x, middleH, _x + getIconWidth(), middleH); + traceIcon_.paintIconCentre(g, _x + getIconWidth() / 2, middleH); - BufferedImage image=new BufferedImage(20,20,BufferedImage.TYPE_INT_RGB); - Graphics2D g = image.createGraphics(); - final Rectangle rec = new Rectangle(20,20); - //g.translate(rec.x, rec.y); - // la ligne - g.setColor(Color.white); - g.fillRect(0, 0, 20, 20); - final TraceLigne l = new TraceLigne(cb.getLigneModel()); - l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); - // l'icone - final TraceIconModel icm = new TraceIconModel(cb.getIconModel()); - icm.setTaille(Math.min(rec.width / 3, rec.height/3));// a voir - final TraceIcon ic = new TraceIcon(icm); - ic.paintIconCentre(g, rec.width / 2, rec.height / 2); - //g.translate(-rec.x, -rec.y); + } - resultat.setIcon(new ImageIcon(image)); - resultat.setText(cb.getTitle()); - resultat.setOpaque(true); - //resultat.setIconTextGap(12); - if (isSelected) { - resultat.setBackground(HIGHLIGHT_COLOR); - resultat.setForeground(Color.white); - } - - return resultat; - } + } - } + PlageTableModel model_; - PlageTableModel model_; + public EGPaletteLegendeGraphe(EGGraphe graphe) { + graphe_ = graphe; + // mapTitles_=new HashMap<BuTextField, EGCourbe>(); + // -- construction du panel des l\xE9gendes --// + buildContent(); + } - public EGPaletteLegendeGraphe(EGGraphe graphe){ - graphe_=graphe; - //mapTitles_=new HashMap<BuTextField, EGCourbe>(); - //-- construction du panel des l\xE9gendes --// - buildContent(); - } + private EGCourbe getSelectedCourbe() { + int select = this.list_.getSelectedIndex(); + if (select == -1) return null; + EGCourbe courbe = graphe_.getModel().getCourbes()[select]; + return courbe; + } + BConfigurePalette paletteConf_ = new BConfigurePalette(true); - private EGCourbe getSelectedCourbe(){ - int select=this.list_.getSelectedIndex(); - if(select==-1) - return null; - EGCourbe courbe=graphe_.getModel().getCourbes()[select]; - return courbe; - } + /** + * Met a jour le panneau des donn\xE9es. + */ + private void updatePanelData() { + // -- on r\xE9cup\xE8re la courbe selectionnee --// + EGCourbe courbe = getSelectedCourbe(); + if (courbe != null) paletteConf_.setPalettePanelTarget(courbe); + } - - BConfigurePalette paletteConf_=new BConfigurePalette(true); - /** - * Met a jour le panneau des donn\xE9es. - */ - private void updatePanelData() { - //-- on r\xE9cup\xE8re la courbe selectionnee --// - EGCourbe courbe=getSelectedCourbe(); - if(courbe!=null) - paletteConf_.setPalettePanelTarget(courbe); - } + private void buildContent() { + final EGCourbe[] cs = graphe_.getModel().getCourbes(); - private void buildContent(){ + final BuBorderLayout lay = new BuBorderLayout(2, 2); + setLayout(lay); - final EGCourbe[] cs = graphe_.getModel().getCourbes(); + // -- liste des courbes --// + list_ = new BuEmptyList(); + model_ = new PlageTableModel(cs); + list_.setModel(model_); + list_.setCellRenderer(new LegendeRenderer()); + list_.getSelectionModel().addListSelectionListener(this); + list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - final BuBorderLayout lay = new BuBorderLayout(2, 2); - setLayout(lay); - - //-- liste des courbes --// - list_ = new BuEmptyList(); - model_ = new PlageTableModel(cs); - list_.setModel(model_); - list_.setCellRenderer(new LegendeRenderer()); - list_.getSelectionModel().addListSelectionListener(this); - list_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + // list_.setFocusable(false); + sp_ = new BuScrollPane(list_); + sp_.setPreferredSize(new Dimension(150, 100)); + sp_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes"))); + add(sp_, BuBorderLayout.NORTH); - //list_.setFocusable(false); - sp_ = new BuScrollPane(list_); - sp_.setPreferredSize(new Dimension(150,100)); - sp_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes"))); - add(sp_, BuBorderLayout.NORTH); + final BuPanel pnColor = new BuPanel(); + pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); - final BuPanel pnColor = new BuPanel(); - pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); + // -- update le panel des donn\xE9es + updatePanelData(); - //-- update le panel des donn\xE9es - updatePanelData(); - - - //paletteConf_.setPreferredSize(new Dimension(300,300)); - paletteConf_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage"))); + // paletteConf_.setPreferredSize(new Dimension(300,300)); + paletteConf_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage"))); - JScrollPane peast=new JScrollPane(paletteConf_); - peast.setPreferredSize(new Dimension(150,200)); - - add(peast, BorderLayout.CENTER); - btApply_ = new BuButton(BuResource.BU.getIcon("appliquer")); - btApply_.setText(BuResource.BU.getString("Appliquer")); - btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications")); - btApply_.addActionListener(this); - btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir")); - btRefresh_.setText(EbliLib.getS("initialiser")); - btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs")); - btRefresh_.addActionListener(this); - btRefresh_.setEnabled(true); -// btFormat_ = new BuButton(); -// btFormat_.setText(EbliLib.getS("Format des labels")); -// btFormat_.setToolTipText(EbliLib.getS("Permet de modifier le formattage des nombres et le s\xE9parateur de valeurs")); -// btFormat_.addActionListener(this); -// btFormat_.setEnabled(false); - final BuPanel btpn = new BuPanel(); - btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT)); + JScrollPane peast = new JScrollPane(paletteConf_); + peast.setPreferredSize(new Dimension(150, 200)); - //btpn.add(btFormat_); - btpn.add(btRefresh_); - //btpn.add(btApply_); - add(btpn, BuBorderLayout.SOUTH); + add(peast, BorderLayout.CENTER); + btApply_ = new BuButton(BuResource.BU.getIcon("appliquer")); + btApply_.setText(BuResource.BU.getString("Appliquer")); + btApply_.setToolTipText(EbliLib.getS("Appliquer les modifications")); + btApply_.addActionListener(this); + btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir")); + btRefresh_.setText(EbliLib.getS("initialiser")); + btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs")); + btRefresh_.addActionListener(this); + btRefresh_.setEnabled(true); + // btFormat_ = new BuButton(); + // btFormat_.setText(EbliLib.getS("Format des labels")); + // btFormat_.setToolTipText(EbliLib.getS("Permet de modifier le formattage des nombres et le s\xE9parateur de valeurs")); + // btFormat_.addActionListener(this); + // btFormat_.setEnabled(false); + final BuPanel btpn = new BuPanel(); + btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT)); - this.setPreferredSize(new Dimension(300,300)); - this.setMinimumSize(new Dimension(300,300)); + // btpn.add(btFormat_); + btpn.add(btRefresh_); + // btpn.add(btApply_); + add(btpn, BuBorderLayout.SOUTH); - this.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Edition de la l\xE9gende des courbes"))); - //-- initialise au premier courbe --// - list_.setSelectedIndex(0); - } + this.setPreferredSize(new Dimension(300, 300)); + this.setMinimumSize(new Dimension(300, 300)); + this.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Edition de la l\xE9gende des courbes"))); + // -- initialise au premier courbe --// + list_.setSelectedIndex(0); + } + public void actionPerformed(ActionEvent _e) { - public void actionPerformed(ActionEvent _e) { - - EGCourbe courbe=getSelectedCourbe(); - if(courbe==null)return; + EGCourbe courbe = getSelectedCourbe(); + if (courbe == null) return; - final Object s = _e.getSource(); - if ((s == btColor_) ) { - final Color n = JColorChooser.showDialog(this, EbliResource.EBLI.getString("Couleur"), ic_.getCouleur()); - if ((n != null) && (n != ic_.getCouleur())) { - // setModified(); - ic_.setCouleur(n); - if(courbe!=null) - courbe.setAspectContour(n); - } - } else if (s == btApply_) { - actionApply(); - } else if (s == btRefresh_) { - reinitPlages(); - } else if (btFormat_ == _e.getSource()) { - actionFormat(); - } + final Object s = _e.getSource(); + if ((s == btColor_)) { + final Color n = JColorChooser.showDialog(this, EbliResource.EBLI.getString("Couleur"), ic_.getCouleur()); + if ((n != null) && (n != ic_.getCouleur())) { + // setModified(); + ic_.setCouleur(n); + if (courbe != null) courbe.setAspectContour(n); + } + } else if (s == btApply_) { + actionApply(); + } else if (s == btRefresh_) { + reinitPlages(); + } else if (btFormat_ == _e.getSource()) { + actionFormat(); + } - - } + } + /** + * Appelee lorsqu'on appuie sur le bouton appliquer + */ + private void actionApply() { - /** - * Appelee lorsqu'on appuie sur le bouton appliquer - */ - private void actionApply() { + } - } + /** + * Reinitialise les titres des courbes avec les donn\xE9es initiales. + */ + private void reinitPlages() { - /** - * Reinitialise les titres des courbes avec les donn\xE9es initiales. - */ - private void reinitPlages() { + } - } + /** + * Methode qui ajuste toutes les l\xE9gendes en fonction du format choisi et du separator. + */ + protected void ajusteAllLegendes() { - /** - * Methode qui ajuste toutes les l\xE9gendes en fonction du format choisi et du separator. - */ - protected void ajusteAllLegendes() { + } - } + public void valueChanged(ListSelectionEvent e) { + updatePanelData(); + } + private void actionFormat() { + CtuluNumberFormatI ctuluNumberFormatI = format_; + /* + * CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; } + */ + final CtuluDecimalFormatEditPanel fmtSelect = new CtuluDecimalFormatEditPanel(ctuluNumberFormatI); + fmtSelect.setErrorTextUnable(); + final CtuluDialogPanel pn = new CtuluDialogPanel() { + public boolean valide() { + return fmtSelect.valide(); + } + }; + pn.setLayout(new BuVerticalLayout(4)); + final JPanel pnSep = new BuPanel(new BuGridLayout(2, 2, 2)); + pnSep.add(new BuLabel(EbliLib.getS("S\xE9parateur"))); + final BuTextField tf = new BuTextField(); + tf.setText(separatorFormat_); + pnSep.add(tf); + pn.add(pnSep); - public void valueChanged(ListSelectionEvent e) { + if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) { + fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal"))); + pn.add(fmtSelect); + } + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(this, EbliLib.getS("Format")))) { + format_ = fmtSelect.getCurrentFmt(); + separatorFormat_ = tf.getText(); + ajusteAllLegendes(); - updatePanelData(); - } + } + } - - - private void actionFormat() { - CtuluNumberFormatI ctuluNumberFormatI =format_; - /* - * CtuluNumberFormatI fmt = getDefaultFormat(); if (fmt == null) { fmt = CtuluLib.DEFAULT_NUMBER_FORMAT; } - */ - final CtuluDecimalFormatEditPanel fmtSelect = new CtuluDecimalFormatEditPanel(ctuluNumberFormatI); - fmtSelect.setErrorTextUnable(); - final CtuluDialogPanel pn = new CtuluDialogPanel() { - public boolean valide() { - return fmtSelect.valide(); - } - }; - pn.setLayout(new BuVerticalLayout(4)); - final JPanel pnSep = new BuPanel(new BuGridLayout(2, 2, 2)); - pnSep.add(new BuLabel(EbliLib.getS("S\xE9parateur"))); - final BuTextField tf = new BuTextField(); - tf.setText(separatorFormat_); - pnSep.add(tf); - pn.add(pnSep); - - if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) { - fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal"))); - pn.add(fmtSelect); - } - if (CtuluDialogPanel.isOkResponse(pn.afficheModale(this, EbliLib.getS("Format")))) { - format_= fmtSelect.getCurrentFmt(); - separatorFormat_= tf.getText(); - ajusteAllLegendes(); - - } - } - - } 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 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -13,7 +13,6 @@ import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.layer.MvVisuPanel; -import org.fudaa.fudaa.tr.post.TrPostSource; import com.vividsolutions.jts.geom.LineString; 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 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -112,7 +112,7 @@ * @param _prog * @param _selected */ - public void actBuildGroup( final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { + public void actBuildGroup(final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { int[] time = _selected.getSelectedTimeStepIdx(); final CtuluVariable[] vs = _selected.getSelectedVar(); @@ -218,15 +218,17 @@ _prog), _prog); EGCourbeChild child; if (isTime) { - String title=var.toString() + CtuluLibString.ESPACE ; - if(var.getCommonUnit()!=null) - title+="("+var.getCommonUnit()+")"+ CtuluLibString.ESPACE ; - title+=timeModel_.getElementAt(time[t]); - //-- on ajoute les extremites du segment choisi --// - title+=", P1("+format(this.selectedLine_.getCoordinateN(0).x,2)+";"+format(this.selectedLine_.getCoordinateN(0).y,2)+")"+sep+"P"+this.selectedLine_.getNumPoints()+"("+format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints()-1).x,2)+";"+format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints()-1).y,2)+")"; - - - model.setTitle(title); + String title = var.toString() + CtuluLibString.ESPACE; + if (var.getCommonUnit() != null) title += "(" + var.getCommonUnit() + ")" + CtuluLibString.ESPACE; + title += timeModel_.getElementAt(time[t]); + // -- on ajoute les extremites du segment choisi --// + title += ", P1(" + format(this.selectedLine_.getCoordinateN(0).x, 2) + ";" + + format(this.selectedLine_.getCoordinateN(0).y, 2) + ")" + sep + "P" + + this.selectedLine_.getNumPoints() + "(" + + format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints() - 1).x, 2) + ";" + + format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints() - 1).y, 2) + ")"; + + model.setTitle(title); child = new MvProfileCourbeTime(gri, model, timeModel_); } else { child = new MvProfileCourbe(gri, model); @@ -244,15 +246,14 @@ } - - public String format(double value,int nbChiffresSignificatifs){ - String forme="#."; - for(int i=0;i<nbChiffresSignificatifs;i++) - forme+="0"; - DecimalFormat df = new DecimalFormat(forme); - return df.format(value); + public String format(double value, int nbChiffresSignificatifs) { + String forme = "#."; + for (int i = 0; i < nbChiffresSignificatifs; i++) + forme += "0"; + DecimalFormat df = new DecimalFormat(forme); + return df.format(value); } - + /** * Methode qui permet d ajouter une courbe spatiale poru un grapeh deja existant. * @@ -385,7 +386,7 @@ } - protected void close() {} + public void close() {} protected String getHelpForVarTime() { return timeModel_ == null ? CtuluLib.getS("S\xE9lectionner les variables") : CtuluLib 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 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -41,9 +41,6 @@ final MvLineChooser lineChooser_; - - - /** * panel qui contient les calques des isolignes */ @@ -61,11 +58,11 @@ // initSelected_ = _selected; calque_ = _panel; lineChooser_ = new MvLineChooser(_selected, panel_); - + } @Override - protected void close() { + public void close() { lineChooser_.close(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt =================================================================== (Binary files differ) 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-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -208,7 +208,6 @@ if ("OUVRIR".equals(com)) { // -- ouverture d un nouveau projet --// - 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) { Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -0,0 +1,38 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.fudaa.tr.post; + +import java.util.Map; + +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreated; +import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedSaver; + +/** + * Classe de sauvegarde pour les fleches + * + * @author deniger + */ +public class TrPostFlecheContentDefaultSaver implements TrPostDataCreatedSaver { + + String vx_; + String vy_; + String name_; + + public TrPostFlecheContentDefaultSaver(TrPostFlecheContentDefaut _defaut) { + name_ = _defaut.getVar().getShortName(); + vx_ = _defaut.getVx().getShortName(); + vy_ = _defaut.getVy().getShortName(); + } + + public TrPostDataCreated restore(TrPostSource _src, CtuluUI _ui, Map _shortName) { + H2dVariableType var = (H2dVariableType) _shortName.get(name_); + H2dVariableType varX = (H2dVariableType) _shortName.get(vx_); + H2dVariableType varY = (H2dVariableType) _shortName.get(vy_); + if (var != null && varX != null && varY != null) { return new TrPostFlecheContentDefaut(_src, var, varX, varY); } + return null; + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaut.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -18,9 +18,8 @@ import com.memoire.fu.FuLog; -class TrPostFlecheContentDefaut implements TrPostFlecheContent { +public class TrPostFlecheContentDefaut implements TrPostFlecheContent { - private final boolean isElementData_; int lastTime_ = -1; final H2dVariableType name_; final TrPostSource src_; @@ -31,23 +30,35 @@ final H2dVariableType varVy_; + final boolean useSaver_; + /** * @param _name le nom de la variable * @param _idxX la valeur pour x * @param _idxY la valeur pour y - * @param _isElement true si valeur sur les elements */ public TrPostFlecheContentDefaut(final TrPostSource _src, final H2dVariableType _name, final H2dVariableType _idxX, - final H2dVariableType _idxY, final boolean _isElement) { + final H2dVariableType _idxY) { + this(_src, _name, _idxX, _idxY, false); + } + + /** + * @param _name le nom de la variable + * @param _idxX la valeur pour x + * @param _idxY la valeur pour y + * @param _useSaver true si ce vecteur doit fournir une classe de sauvegarde cf {@link #createSaver()} + */ + public TrPostFlecheContentDefaut(final TrPostSource _src, final H2dVariableType _name, final H2dVariableType _idxX, + final H2dVariableType _idxY, boolean _useSaver) { src_ = _src; name_ = _name; varVx_ = _idxX; varVy_ = _idxY; - isElementData_ = _isElement; + useSaver_ = _useSaver; } public TrPostFlecheContent changeVar(final H2dVariableType _newName) { - return new TrPostFlecheContentDefaut(src_, _newName, varVx_, varVy_, isElementData_); + return new TrPostFlecheContentDefaut(src_, _newName, varVx_, varVy_, useSaver_); } public void clearCache() { @@ -55,15 +66,16 @@ } public TrPostDataCreatedSaver createSaver() { - return null; + + return useSaver_ ? new TrPostFlecheContentDefaultSaver(this) : null; } public TrPostFlecheContent duplicate(final TrPostSource _src) { - return new TrPostFlecheContentDefaut(_src, name_, varVx_, varVy_, isElementData_); + return new TrPostFlecheContentDefaut(_src, name_, varVx_, varVy_, useSaver_); } public TrPostFlecheContent duplicate(final TrPostSource _src, final H2dVariableType _newName) { - return new TrPostFlecheContentDefaut(_src, _newName, varVx_, varVy_, isElementData_); + return new TrPostFlecheContentDefaut(_src, _newName, varVx_, varVy_, useSaver_); } public void fillWhithAllUsedVar(final Set _res) { @@ -85,7 +97,7 @@ try { final double vx = src_.getData(varVx_, _idxTime, _idxObject); final double vy = src_.getData(varVy_, _idxTime, _idxObject); - return Math.hypot(vx,vy); + return Math.hypot(vx, vy); } catch (final IOException _e) { FuLog.warning(_e); } @@ -95,7 +107,7 @@ public TrPostDataVecteur getValues(final int _tIdx) { if (_tIdx != lastTime_) { lastTime_ = _tIdx; - val_ = new TrPostDataVecteur(src_.getData(varVx_, lastTime_), src_.getData(varVy_, lastTime_), isElementData_); + val_ = new TrPostDataVecteur(src_.getData(varVx_, lastTime_), src_.getData(varVy_, lastTime_)); } return val_; @@ -122,7 +134,7 @@ } public boolean isEditable() { - return false; + return useSaver_; } public TrPostFlecheContent isFleche() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentExpr.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -94,7 +94,7 @@ public TrPostDataVecteur getValues(int _tIdx) { if (_tIdx != lastTime_) { lastTime_ = _tIdx; - lastValue_ = new TrPostDataVecteur(vx_.getDataFor(_tIdx), vy_.getDataFor(_tIdx), isElementData_); + lastValue_ = new TrPostDataVecteur(vx_.getDataFor(_tIdx), vy_.getDataFor(_tIdx)); } return lastValue_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -47,6 +47,7 @@ import org.fudaa.ctulu.gui.CtuluCellBooleanRenderer; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.EfLib; @@ -275,30 +276,6 @@ // liste des noeuuds coupes Set<EbliNode> nodesCutted = null; - // /** - // *ajout une fillelayout a la liste des frame layout - // * - // * @param _fille - // */ - // public void addFillesLayout(TrPostLayoutFille _fille) { - // listeFillesLayout.add(_fille); - // } - - // /** - // * retourne la frame layout en cours d utilisation par le user. sinon retourne la premiere fille. IMPORTANT: il faut - // * passer par cette methode pour etre root\xE9 vers la bonne scene en cours de manip. - // * - // * @return - // */ - // public TrPostLayoutFille getSelectedFilleLayout() { - // for (Iterator<TrPostLayoutFille> it = listeFillesLayout.iterator(); it.hasNext();) { - // TrPostLayoutFille fille = it.next(); - // if (fille.isSelected()) return fille; - // } - // // sinon retourne la premier frame - // return listeFillesLayout.get(0); - // } - /** * internalframe qui gere les multiProjets */ @@ -385,28 +362,28 @@ * @param _src */ public void ajouterSource(final TrPostSource _src) { - ajouterSource(_src,null); + ajouterSource(_src, null); } - - public void ajouterSource(final TrPostSource _src,String title) { - _src.addVariableListener(new VariableListener()); - if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { - listeSrc_.add(_src); - _src.buildDefaultVarUpdateLists(); - // -- ajout du menu correspondant uniquement a partir de la 2eme --// - // if (listeSrc_.size()>1 || (menuPost_!=null &&)) - construitMenuPostSpecifiqueSource(_src,title); + public void ajouterSource(final TrPostSource _src, String title) { + _src.addVariableListener(new VariableListener()); + if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { + listeSrc_.add(_src); + _src.buildDefaultVarUpdateLists(); - } else { - // -- messqge d erreur: le fichier est deja ouvert --// - new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + // -- ajout du menu correspondant uniquement a partir de la 2eme --// + // if (listeSrc_.size()>1 || (menuPost_!=null &&)) + construitMenuPostSpecifiqueSource(_src, title); - } - // -- notify aux observers --// - this.notifyObservers(); - + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + + } + // -- notify aux observers --// + this.notifyObservers(); + } public TrPostSource findSource(final String _file) { @@ -464,32 +441,32 @@ return null; } - + /** * Retourne toutes les sources qui ne sont pas des composites + * * @return */ - public List<TrPostSource> getAllClassicalSource(){ - List<TrPostSource> res=new ArrayList<TrPostSource>(); - for(TrPostSource src:listeSrc_){ - if(!isAsuiteCalcul(src)) - res.add(src); - } - return res; + public List<TrPostSource> getAllClassicalSource() { + List<TrPostSource> res = new ArrayList<TrPostSource>(); + for (TrPostSource src : listeSrc_) { + if (!isAsuiteCalcul(src)) res.add(src); + } + return res; } + /** - * Retourne toutes les sources qui sont des composites + * Retourne toutes les sources qui sont des composites + * * @return */ - public List<TrPostSourceFromReader> getAllCCompositeSource(){ - List<TrPostSourceFromReader> res=new ArrayList<TrPostSourceFromReader>(); - for(TrPostSource src:listeSrc_){ - if(isAsuiteCalcul(src)) - res.add((TrPostSourceFromReader)src); - } - return res; + public List<TrPostSourceFromReader> getAllCCompositeSource() { + List<TrPostSourceFromReader> res = new ArrayList<TrPostSourceFromReader>(); + for (TrPostSource src : listeSrc_) { + if (isAsuiteCalcul(src)) res.add((TrPostSourceFromReader) src); + } + return res; } - public boolean isSourceLoaded(final String _file) { return isSourceLoaded(new File(_file)); @@ -579,29 +556,27 @@ public String formatInfoSource(final TrPostSource _src) { // --ajout dans la liste des titres --// Collection<File> files = _src.getFiles(); - if(!isAsuiteCalcul(_src)) - return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(files.iterator().next()); - else{ - -// String listeFiles=""; -// for(File f:files) -// listeFiles+="| "+f.getName(); - return _src.getTitle() ;//+ listeFiles; + if (!isAsuiteCalcul(_src)) return formatName(_src.getTitle()) + " | Fichier: " + + formatFichier(files.iterator().next()); + else { + + // String listeFiles=""; + // for(File f:files) + // listeFiles+="| "+f.getName(); + return _src.getTitle();// + listeFiles; } } - - public boolean isAsuiteCalcul(final TrPostSource _src){ - if(_src instanceof TrPostSourceFromReader){ - TrPostSourceFromReader s=(TrPostSourceFromReader) _src; - if(s.getReader() instanceof TrPostSourceReaderComposite) - return true; - - } - - return false; + public boolean isAsuiteCalcul(final TrPostSource _src) { + if (_src instanceof TrPostSourceFromReader) { + TrPostSourceFromReader s = (TrPostSourceFromReader) _src; + if (s.getReader() instanceof TrPostSourceReaderComposite) return true; + + } + + return false; } - + public String formatFichier(final File file) { if (file == null) return ""; final String nomFichier = file.getAbsolutePath(); @@ -637,15 +612,12 @@ * * @param _src */ - public void construitMenuPostSpecifiqueSource(final TrPostSource _src,String title) { + public void construitMenuPostSpecifiqueSource(final TrPostSource _src, String title) { - BuMenu menuSimul =null; - if(title==null) - menuSimul=new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFiles().iterator().next()), - "SIMULATION" + (listeSrc_.size())); - else - menuSimul=new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), - "SIMULATION" + (listeSrc_.size())); + BuMenu menuSimul = null; + if (title == null) menuSimul = new BuMenu((listeSrc_.size()) + ". " + + formatFichier(_src.getFiles().iterator().next()), "SIMULATION" + (listeSrc_.size())); + else menuSimul = new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), "SIMULATION" + (listeSrc_.size())); // -- ajout du menu au menu post --// getMenuPost().add(menuSimul); @@ -696,37 +668,6 @@ // } } - /** - * Construit le menu Layout. Cette methode doit etre appelee une seule fois - */ - // public void setMenuLayout() { - // //filleLayout_.controller_.construitMenuMultiScenes(impl_.getMainMenuBar()); - // final BuMenuBar menubar = impl_.getMainMenuBar(); - // // -- creation du menu principal des scenes a cote de post --// - // - // menuLayout_.addMenuItem(TrResource.getS(("Ajouter une nouvelle fen\xEAtre")), - // "AJOUTFRAME", CtuluResource.CTULU - // .getIcon("crystal_ajouter"), getSelectedFilleLayout().controller_); - // /* - // * - // * menu.addMenuItem(TrResource.getS(("Ajouter un layout dans la vue")), - // * "AJOUTLAYOUT", CtuluResource.CTULU .getIcon("crystal_ajouter"), - // * filleLayout_.controller_); - // * menu.addMenuItem(TrResource.getS(("Retirer un layout de la vue")), - // * "RETIRELAYOUT", CtuluResource.CTULU .getIcon("crystal_enlever"), - // * filleLayout_.controller_); menu.addSeparator("Layouts"); - // * menu.addSubMenu(filleLayout_.controller_.menuScenes_, true); - // */ - // // ajout a cote de menu post - // // menuLayout_.addSeparator(TrResource.getS("Liste des fen\xEAtres")); - // // menuLayout_.addMenuItem(TrResource.getS(("Layout ")) + - // // listeFillesLayout.size(), "FILLELAYOUT" - // // + (listeFillesLayout.size() - 1), null, this); - // // - // - // menubar.add(menuLayout_, 2); - // - // } public BuMenu getMenuPost() { if (menuPost_ == null) menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); return menuPost_; @@ -766,21 +707,19 @@ CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { public void actionPerformed(final ActionEvent _e) { - - final int reponse = JOptionPane - .showConfirmDialog( - getImpl().getParentComponent(), + boolean ok = CtuluLibDialog + .showConfirmation( + getImpl().getFrame(), + TrResource.getS("Fusionner avec un autre projet POST"), 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) { - getManager().saveProject(false); - } - + .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?"), + TrResource.getS("Sauvegarder et continuer"), TrResource.getS("Annuler")); + if (!ok) return; + getManager().saveProject(false); getManager().loadProject(false, null); // -- on reinitialise le nom path du projet a null pour qu'il soit redemand\xE9 lors de la nouvelle sauvegarde // --// - getManager().setProjet_(null); + getManager().setProjet(null); } }); @@ -794,11 +733,11 @@ // -- affichage de la fenetre de gestion multi projet --// if (!filleProjetctManager_.isVisible()) { - filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, - filleProjetctManager_.getSize().height / 2); +// filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, +// filleProjetctManager_.getSize().height / 2); impl_.addInternalFrame(filleProjetctManager_); - } + } else filleProjetctManager_.moveToFront(); } @@ -1431,27 +1370,27 @@ return src.getId(); } - + public String deliverSourceSuiteId(TrPostSource src) { - String idString = src.getTitle(); - if (src.getId() == null) { + String idString = src.getTitle(); + if (src.getId() == null) { - String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); - src.setId(uniqueId); - } else { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } else { - // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// - String nameFormate = FuLib.clean(idString); - String id = src.getId(); - if (!id.startsWith(nameFormate)) { - String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); - src.setId(uniqueId); - } + // -- on teste si l'id de base est 'parlant' => contient le nom du ficheir --// + String nameFormate = FuLib.clean(idString); + String id = src.getId(); + if (!id.startsWith(nameFormate)) { + String uniqueId = CtuluLibGenerator.getInstance().deliverUniqueStringId(idString); + src.setId(uniqueId); + } - } - return src.getId(); + } + return src.getId(); - } + } /** * genere uniquement l id. Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEnvFlecheContent.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -90,7 +90,7 @@ public TrPostDataVecteur getValues(final int _tIdx) { if (val_ == null) { - val_ = new TrPostDataVecteur(src_.getEnveloppData(varVx_), src_.getEnveloppData(varVy_), true); + val_ = new TrPostDataVecteur(src_.getEnveloppData(varVx_), src_.getEnveloppData(varVy_)); } return val_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLoader.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -334,7 +334,7 @@ varEnveloppData.put(H2dVariableType.VITESSE_U, qx); final EfDataElement qy = new EfDataElement(qvMax); varEnveloppData.put(H2dVariableType.VITESSE_V, qy); - varEnveloppData.put(H2dVariableType.VITESSE, new TrPostDataVecteur(qx, qy, true)); + varEnveloppData.put(H2dVariableType.VITESSE, new TrPostDataVecteur(qx, qy)); src_.setEnvResultats(varEnveloppData); src_.setEnvTime(envReader.getTfinal()); checkEnvTime(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -513,7 +513,7 @@ */ public final TrPostFlecheContent createSimpleVecteurContent(final H2dVariableType _name, final H2dVariableType _idxX, final H2dVariableType _idxY, final boolean _isElt) { - return new TrPostFlecheContentDefaut(this, _name, _idxX, _idxY, _isElt); + return new TrPostFlecheContentDefaut(this, _name, _idxX, _idxY); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -225,7 +225,7 @@ final H2dVariableType vy = variable[idxY * nbplan + k]; final H2dVariableTypeCreated var2d = H2dVariableType.createTempVar(nameBase + " 2D " + fmt.format(k + 1), _shortName); - fleches.add(new TrPostFlecheContentDefaut(source, var2d, vx, vy, false)); + fleches.add(new TrPostFlecheContentDefaut(source, var2d, vx, vy)); var2d.setUnit(H2dVariableType.VITESSE.getCommonUnitString()); } final int idxW = H2DLib.getIdxVarWithName(vars, nameBase + endz); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreationPanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -186,6 +186,9 @@ @Override protected void addBtAdd(final BuPanel _pn) { super.addBtAdd(_pn); + _pn.add(buildButton(BuResource.BU.getIcon("ajouter"), TrResource.getS("Ajouter un vecteur"), "ADD_FLECHE", + TrResource.getS("Ajouter un vecteur d\xE9fini par 2 variables d\xE9j\xE0 d\xE9finies"), + 0)); _pn.add(buildButton(BuResource.BU.getIcon("ajouter"), TrResource .getS("Ajouter une variable d\xE9finie par un pas de temps"), "ADD_TIME", TrResource .getS("Ajouter une nouvelle variable d\xE9finie par un pas de temps et une variable d\xE9j\xE0 d\xE9finie"), 0)); @@ -199,11 +202,11 @@ public void actionPerformed(final ActionEvent _evt) { if ("ADD_TIME".equals(_evt.getActionCommand())) { ((TrPostDataUserVarModel) getTableModel()).actionAddCst(); - } - if ("ADD_STATS".equals(_evt.getActionCommand())) { + } else if ("ADD_STATS".equals(_evt.getActionCommand())) { ((TrPostDataUserVarModel) getTableModel()).actionAddStatistic(); - } - super.actionPerformed(_evt); + } else if ("ADD_FLECHE".equals(_evt.getActionCommand())) { + ((TrPostDataUserVarModel) getTableModel()).actionAddFleche(); + } else super.actionPerformed(_evt); } }; tb_ = edi.getTable(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCommonPanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -37,6 +37,7 @@ * @author Fred Deniger * @version $Id: TrPostDataEditCommonPanel.java,v 1.4 2006-12-20 16:13:19 deniger Exp $ */ +@SuppressWarnings("serial") public abstract class TrPostDataEditCommonPanel extends CtuluDialogPanel { class NameDocumentListener implements DocumentListener { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditCstPanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -21,6 +21,7 @@ * @author Fred Deniger * @version $Id: TrPostDataEditCstPanel.java,v 1.4 2007-01-17 10:44:30 deniger Exp $ */ +@SuppressWarnings("serial") public class TrPostDataEditCstPanel extends TrPostDataEditCommonPanel { final BuComboBox cbTime_; Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataEditFlechePanel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -0,0 +1,71 @@ +/* + * @creation 9 ao\xFBt 2005 + * @modification $Date: 2007-01-17 10:44:30 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.tr.post.data; + +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.h2d.type.H2dVariableTypeCreated; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrPostFlecheContentDefaut; +import org.fudaa.fudaa.tr.post.TrPostSource; + +import com.memoire.bu.BuComboBox; + +/** + * Permet l'edition des variables creees par l'utilisateur. + * + * @author Fred Deniger + * @version $Id: TrPostDataEditCstPanel.java,v 1.4 2007-01-17 10:44:30 deniger Exp $ + */ +@SuppressWarnings("serial") +public class TrPostDataEditFlechePanel extends TrPostDataEditCommonPanel { + + final BuComboBox cbVarX_; + final BuComboBox cbVarY_; + + H2dVariableType initVarX_; + H2dVariableType initVarY_; + + TrPostFlecheContentDefaut initFleche_; + + /** + * @param _src la source + * @param _var la variable a modifier: si null, phase de creation. + */ + public TrPostDataEditFlechePanel(final TrPostSource _src, final H2dVariableTypeCreated _var) { + super(_src, _var); + initFleche_ = _var == null ? null : (TrPostFlecheContentDefaut) _src.getUserCreatedVar(_var); + cbVarX_ = new BuComboBox(super.varToAdd_.toArray()); + cbVarY_ = new BuComboBox(super.varToAdd_.toArray()); + if (initFleche_ != null) { + initVarX_ = initFleche_.getVx(); + initVarY_ = initFleche_.getVy(); + cbVarX_.setSelectedItem(initVarX_); + cbVarY_.setSelectedItem(initVarY_); + } + addLabel(TrResource.getS("Composante selon X")); + add(cbVarX_); + addLabel(TrResource.getS("Composante selon Y")); + add(cbVarY_); + + } + + @Override + public TrPostDataCreated createData() { + return new TrPostFlecheContentDefaut(src_, getNewVar(), (H2dVariableType) cbVarX_.getSelectedItem(), + (H2dVariableType) cbVarY_.getSelectedItem(), true); + } + + /** + * @return true si des modifications ont ete faites. + */ + @Override + public boolean isModified() { + if (var_ == null || initVarX_ == null || initVarY_ == null) { return true; } + return super.isVarModified() || cbVarX_.getSelectedItem() != initVarX_ || cbVarY_.getSelectedItem() != initVarY_; + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java 2009-01-28 19:17:26 UTC (rev 4422) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataUserVarModel.java 2009-01-28 22:44:24 UTC (rev 4423) @@ -20,6 +20,7 @@ import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.h... [truncated message content] |
From: <de...@us...> - 2009-01-29 22:45:03
|
Revision: 4426 http://fudaa.svn.sourceforge.net/fudaa/?rev=4426&view=rev Author: deniger Date: 2009-01-29 22:44:57 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuSplashScreen.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -17,6 +17,8 @@ import java.lang.reflect.InvocationTargetException; import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.JWindow; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; @@ -38,8 +40,8 @@ /* * class XMultiLabel extends BuLabelMultiLine { protected void paintComponent(Graphics _g) { Color - * old=getForeground(); setForeground(Color.white); for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { - * _g.translate(i,j); super.paintComponent(_g); _g.translate(-i,-j); } setForeground(old); super.paintComponent(_g); } } + * old=getForeground(); setForeground(Color.white); for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { _g.translate(i,j); + * super.paintComponent(_g); _g.translate(-i,-j); } setForeground(old); super.paintComponent(_g); } } */ private ClassLoader loader_; @@ -50,7 +52,7 @@ protected JComponent content_; - protected BuPanel panel_; + protected JPanel panel_; protected BuPanel left_; protected BuProgressBar progression_; protected BuLabel load_; @@ -86,7 +88,7 @@ } public void build() { - panel_ = new BuPanel(); + panel_ = new JPanel(); panel_.setLayout(new BuBorderLayout()); BuPicture ml_logo = null; @@ -225,94 +227,83 @@ run(); } - public void run() - { - long avant,apres,diff; - avant=System.currentTimeMillis(); + public void run() { + long avant, apres, diff; + avant = System.currentTimeMillis(); // BuUpdateGUI.repaintNow(content_);//this); - int i,j,p,pp,m,l; - String ps=null; + int i, j, p, pp, m, l; + String ps = null; /* * String paquet=base_; i=paquet.lastIndexOf('.'); if(i>=0) paquet=paquet.substring(0,i+1); else paquet=""; */ // System.err.println("PAQUET="+paquet); + pp = -1; - pp=-1; + l = 0; + for (i = 0; i < classes_.length; i++) + l += classes_[i].length; - l=0; - for(i=0; i<classes_.length;i++) - l+=classes_[i].length; - - m=0; - for(i=0; i<classes_.length;i++) - for(j=0; j<classes_[i].length;j++) - { - String n=classes_[i][j]; - // int k=n.lastIndexOf('.'); - // setText(k>=0 ? n.substring(k+1) : n); - String t=n; - int k=t.indexOf('$'); - if(k>=0) t=t.substring(0,k); - k=t.lastIndexOf('.'); - if(k>=0) t=t.substring(0,k); - k=t.lastIndexOf('.'); - if(k>=0) t=t.substring(k+1); - if(!t.equals(ps)) - { + m = 0; + for (i = 0; i < classes_.length; i++) + for (j = 0; j < classes_[i].length; j++) { + String n = classes_[i][j]; + // int k=n.lastIndexOf('.'); + // setText(k>=0 ? n.substring(k+1) : n); + String t = n; + int k = t.indexOf('$'); + if (k >= 0) t = t.substring(0, k); + k = t.lastIndexOf('.'); + if (k >= 0) t = t.substring(0, k); + k = t.lastIndexOf('.'); + if (k >= 0) t = t.substring(k + 1); + if (!t.equals(ps)) { setText(t); - ps=t; + ps = t; } - // if(k<0) n=paquet+n; - try - { - if(loader_==null) - Class.forName(n); - else loader_.loadClass(n); // Class.forName(n,false,loader_); + // if(k<0) n=paquet+n; + try { + if (loader_ == null) Class.forName(n); + else loader_.loadClass(n); // Class.forName(n,false,loader_); - // Class c=Class.forName(n); - // FuClassLoaderDedicated.putGlobal(c); - } - catch(Exception ex) - { - /* System.err.println("Error loading class "+n); */ - break; - } - - Thread.yield(); - /* - * try { Thread.sleep(5); } catch(Exception ex) { } - */ + // Class c=Class.forName(n); + // FuClassLoaderDedicated.putGlobal(c); + } catch (Exception ex) { + /* System.err.println("Error loading class "+n); */ + break; + } - m++; - p=100*m/l; - if(p!=pp) - { - setProgression(p); - pp=p; - } + Thread.yield(); + /* + * try { Thread.sleep(5); } catch(Exception ex) { } + */ + + m++; + p = 100 * m / l; + if (p != pp) { + setProgression(p); + pp = p; + } } setText(""); setProgression(100); - apres=System.currentTimeMillis(); - if(apres<avant+delai_) - { - delai_=avant+delai_-apres; - avant=apres; - do - { - try { Thread.sleep(50); } - catch(Exception ex) { } + apres = System.currentTimeMillis(); + if (apres < avant + delai_) { + delai_ = avant + delai_ - apres; + avant = apres; + do { + try { + Thread.sleep(50); + } catch (Exception ex) {} - diff=System.currentTimeMillis()-avant; - p=(int)(diff*100/delai_); - setProgression(p); - } - while(delai_>diff); + diff = System.currentTimeMillis() - avant; + p = (int) (diff * 100 / delai_); + setProgression(p); + } while (delai_ > diff); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -23,7 +23,6 @@ import java.awt.print.PageFormat; import java.awt.print.Printable; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -40,15 +39,14 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; -import javax.swing.JTable; import javax.swing.ListCellRenderer; import javax.swing.SwingUtilities; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; -import javax.swing.table.DefaultTableModel; import javax.swing.tree.TreeModel; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluSelectionInterface; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; @@ -80,15 +78,16 @@ /** * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, - * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. - * Par defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou + * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. Par + * defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou * modifies avec les methodes remove * * @version $Id: ZEbliCalquesPanel.java,v 1.55.4.4 2008-05-13 12:10:36 bmarchan Exp $ * @author Guillaume Desnoix , Axel von Arnim, Fred deniger */ public class ZEbliCalquesPanel extends BuPanel implements EbliFilleCalquesInterface, BCalqueContextuelListener, - CtuluImageProducer, BCalqueSaverTargetInterface, EbliFindable, ActionListener, ZSelectionListener { + CtuluImageProducer, BCalqueSaverTargetInterface, EbliFindable, ActionListener, ZSelectionListener, + CtuluSelectionInterface { protected class AnimAdapter extends EbliAnimationSourceAbstract { @@ -257,6 +256,7 @@ /** * Rempli le menu avec les actions de la scene + * * @param _m le menu a remplir */ protected void fillMenuWithSceneActions(final JMenu _m) { @@ -271,7 +271,7 @@ * @param _m le menu a remplir */ protected void fillMenuWithSceneActions(final JPopupMenu _m) { - if (scene_!= null && scene_.getActions() != null) { + if (scene_ != null && scene_.getActions() != null) { EbliComponentFactory.INSTANCE.addActionsToMenu(scene_.getActions(), _m); } } @@ -292,14 +292,14 @@ /** * contient des informations de cr\xE9ation du vue2d. */ - public final static String NOM_FIC=EbliResource.EBLI.getString("Fichier res"); - public final static String PATH_FIC=EbliResource.EBLI.getString("Chemin"); - public final static String TITRE_FIC=EbliResource.EBLI.getString("Titre"); - public final static String MAILLAGE_FIC=EbliResource.EBLI.getString("Maillage utilis\xE9"); - public final static String DIFF_FIC=EbliResource.EBLI.getString("Diff\xE9rentiel fichiers"); - - public Map<String,String> infosCreation_=new HashMap<String,String>(); - + public final static String NOM_FIC = EbliResource.EBLI.getString("Fichier res"); + public final static String PATH_FIC = EbliResource.EBLI.getString("Chemin"); + public final static String TITRE_FIC = EbliResource.EBLI.getString("Titre"); + public final static String MAILLAGE_FIC = EbliResource.EBLI.getString("Maillage utilis\xE9"); + public final static String DIFF_FIC = EbliResource.EBLI.getString("Diff\xE9rentiel fichiers"); + + public Map<String, String> infosCreation_ = new HashMap<String, String>(); + protected BuMenu contextTools_; protected BuLabel mode_; @@ -340,6 +340,7 @@ /** * Construction des calques par defaut. + * * @param _gcInit le calque de base * @param _controller * @param _addSouth Ajout ou non des services d'info en bas de fenetre (position, mode, etc.). @@ -354,22 +355,21 @@ gc.setName("cqRACINE"); gc.setTitle(EbliResource.EBLI.getString("Calque racine")); gc.setDestructible(false); - + gcDonnees_ = new BGroupeCalque() { - + // B.M. Pour eviter le plantage, une boite est retourn\xE9e si rien n'est affich\xE9 ou boite non conforme. public GrBoite getDomaine() { - GrBoite bt=super.getDomaine(); - - if (bt==null) { - bt=new GrBoite(new GrPoint(0,0,0),new GrPoint(100,100,0)); + GrBoite bt = super.getDomaine(); + + if (bt == null) { + bt = new GrBoite(new GrPoint(0, 0, 0), new GrPoint(100, 100, 0)); + } else if (bt.getDeltaX() == 0 || bt.getDeltaY() == 0) { + bt.o_.x_ -= 10; + bt.o_.y_ -= 10; + bt.e_.x_ += 10; + bt.e_.y_ += 10; } - else if (bt.getDeltaX()==0 || bt.getDeltaY()==0) { - bt.o_.x_-=10; - bt.o_.y_-=10; - bt.e_.x_+=10; - bt.e_.y_+=10; - } return bt; } }; @@ -425,8 +425,8 @@ if (_controller == null) { throw new IllegalArgumentException(); } controller_ = _controller; controller_.setView(this); - - scene_=new ZScene(gcDonnees_,controller_.getCqSelectionI()); + + scene_ = new ZScene(gcDonnees_, controller_.getCqSelectionI()); scene_.setRestrictedToCalqueActif(true); scene_.addSelectionListener(this); modelArbre_.addTreeModelListener(scene_); @@ -482,16 +482,16 @@ public final void inverseSelection() { getScene().inverseSelection(); -// if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { -// ((ZCalqueAffichageDonneesInterface) getCalqueActif()).inverseSelection(); -// } + // if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { + // ((ZCalqueAffichageDonneesInterface) getCalqueActif()).inverseSelection(); + // } } public final void clearSelection() { getScene().clearSelection(); -// if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { -// ((ZCalqueAffichageDonneesInterface) getCalqueActif()).clearSelection(); -// } + // if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { + // ((ZCalqueAffichageDonneesInterface) getCalqueActif()).clearSelection(); + // } } public final ZEbliCalquePanelController getController() { @@ -526,15 +526,11 @@ final String act = _e.getActionCommand(); if ("SELECTFROMPOLY".equals(act)) { findPolys(); - } /*else if ("CLEARSELECTION".equals(act)) { - clearSelection(); - } else if ("INVERSESELECTION".equals(act)) { - inverseSelection(); - } else if ("TOUTSELECTIONNER".equals(act)) { - select(); - } else if ("RECHERCHER".equals(act)) { - find(); - }*/ + } /* + * else if ("CLEARSELECTION".equals(act)) { clearSelection(); } else if ("INVERSESELECTION".equals(act)) { + * inverseSelection(); } else if ("TOUTSELECTIONNER".equals(act)) { select(); } else if ("RECHERCHER".equals(act)) + * { find(); } + */ } @@ -593,11 +589,12 @@ public BCalque getCalqueActif() { return controller_.getCalqueActif(); } - + /** * Revoie la scene. */ - private ZScene scene_=null; + private ZScene scene_ = null; + public ZScene getScene() { return scene_; } @@ -829,9 +826,9 @@ public void select() { getScene().selectAll(); -// if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { -// ((ZCalqueAffichageDonneesInterface) getCalqueActif()).selectAll(); -// } + // if (getCalqueActif() instanceof ZCalqueAffichageDonneesInterface) { + // ((ZCalqueAffichageDonneesInterface) getCalqueActif()).selectAll(); + // } } public ListCellRenderer getComboRender() { @@ -921,10 +918,9 @@ } /** - * Ajoute les calques d'informations. - * Les calques contenus dans ce groupe de calques ne sont pas visibles dans l'arbre des calques. - * Les objets de ces calques ne sont pas s\xE9lectionnables, mais visibles dans la fenetre de vue - * des calques. + * Ajoute les calques d'informations. Les calques contenus dans ce groupe de calques ne sont pas visibles dans l'arbre + * des calques. Les objets de ces calques ne sont pas s\xE9lectionnables, mais visibles dans la fenetre de vue des + * calques. * * @param _g le maillage associe */ @@ -1001,14 +997,13 @@ .getMenuIcon("draw-polygon"), this); return selection; } - - /* + + /* * @see org.fudaa.ebli.calque.ZSelectionListener#selectionChanged(org.fudaa.ebli.calque.ZSelectionEvent) */ public void selectionChanged(ZSelectionEvent _evt) { modelArbre_.fireObservableChanged(); } - public ZEbliCalquesPanel duplicate(Map options) { /* @@ -1024,34 +1019,31 @@ return null; } - /** - * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. - * Retourne un panel vide si aucune infos n'est disponible. + * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. Retourne un panel vide si aucune + * infos n'est disponible. + * * @return */ - public BuPanel buildInfosCreationComposant(){ - - - if(infosCreation_==null || infosCreation_.keySet()==null ||infosCreation_.keySet().size()==0) - return new BuPanel(); - List<String> liste=new ArrayList<String>(infosCreation_.keySet()); - Collections.sort(liste); - List<String> col=new ArrayList<String>(); - col.add(EbliResource.EBLI.getString("Nom")); - col.add(EbliResource.EBLI.getString("Valeur")); - - EbliModelInfos modelInfos=new EbliModelInfos(liste,infosCreation_,col); - BuTable table=new BuTable(modelInfos); - - table.getColumnModel().getColumn(0).setPreferredWidth(20); - BuPanel conteneur=new BuPanel(new BorderLayout()); - conteneur.add(new JScrollPane(table),BorderLayout.CENTER); - - conteneur.add(new JLabel("<html><body><b>"+EbliResource.EBLI.getString("Infos cr\xE9ations")+"</b></body></html>",JLabel.CENTER),BorderLayout.NORTH); - return conteneur; + public BuPanel buildInfosCreationComposant() { + + if (infosCreation_ == null || infosCreation_.keySet() == null || infosCreation_.keySet().size() == 0) return new BuPanel(); + List<String> liste = new ArrayList<String>(infosCreation_.keySet()); + Collections.sort(liste); + List<String> col = new ArrayList<String>(); + col.add(EbliResource.EBLI.getString("Nom")); + col.add(EbliResource.EBLI.getString("Valeur")); + + EbliModelInfos modelInfos = new EbliModelInfos(liste, infosCreation_, col); + BuTable table = new BuTable(modelInfos); + + table.getColumnModel().getColumn(0).setPreferredWidth(20); + BuPanel conteneur = new BuPanel(new BorderLayout()); + conteneur.add(new JScrollPane(table), BorderLayout.CENTER); + + conteneur.add(new JLabel("<html><body><b>" + EbliResource.EBLI.getString("Infos cr\xE9ations") + "</b></body></html>", + JLabel.CENTER), BorderLayout.NORTH); + return conteneur; } - - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -13,6 +13,8 @@ import java.util.Map; import java.util.Set; +import javax.swing.JComponent; + import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibGenerator; import org.fudaa.ctulu.CtuluUI; @@ -60,7 +62,7 @@ Set<?> objects2 = getSelectedObjects(); if (objects2 != null) { for (Iterator iterator = objects2.iterator(); iterator.hasNext();) { - Object object = (Object) iterator.next(); + Object object = iterator.next(); stopEditing(findWidget(object)); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -26,7 +26,7 @@ final private WidgetAction alignWithResizeAction; - // final private WidgetAction alignWithResizeActionProportionnal; + // final private WidgetAction alignWithResizeActionProportionnal; Set<EbliWidgetEditModeListener> listeners_ = new HashSet<EbliWidgetEditModeListener>(); BuMenuBar menuCalque_ = null; @@ -57,15 +57,13 @@ // scene_.getInteractionLayer(), ActionFactory // .createDefaultAlignWithMoveDecorator(), false); - alignWithResizeAction = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_ - .getVisu(), scene_ - .getInteractionLayer(), - ActionFactory.createDefaultAlignWithMoveDecorator(), false); - + alignWithResizeAction = EbliWidgetActionFactory.createAlignWithProportionnalResizeAction(scene_.getVisu(), scene_ + .getInteractionLayer(), ActionFactory.createDefaultAlignWithMoveDecorator(), false); + rectangularSelection_ = ActionFactory.createRectangularSelectAction(scene_, scene_.getInteractionLayer()); // -- ajoute l'action du zoom ( ctrl + clic) - //suppression pour eviter les bugs sioux -// scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); + // suppression pour eviter les bugs sioux + // scene_.getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); scene_.getActions().addAction(rectangularSelection_); // -- ajouter le menu popup de base @@ -73,9 +71,9 @@ } -// public WidgetAction getAlignWithResizeActionProportionnal() { -// return alignWithResizeActionProportionnal; -// } + // public WidgetAction getAlignWithResizeActionProportionnal() { + // return alignWithResizeActionProportionnal; + // } public boolean isEditable() { return false; @@ -85,15 +83,15 @@ listeners_.add(_l); } - public void fireEditStart(final Widget w) { + public void fireEditStart(final Widget _w, JComponent _editor) { for (final EbliWidgetEditModeListener l : listeners_) { - l.editStart(w); + l.editStart(_w, _editor); } } - public void fireEditStop(final Widget w) { + public void fireEditStop(final Widget w, JComponent editor) { for (final EbliWidgetEditModeListener l : listeners_) { - l.editStop(w); + l.editStop(w, editor); } } @@ -171,10 +169,10 @@ return alignWithResizeAction; } -// public WidgetAction getProportionnalResizeAction() { -// return alignWithResizeActionProportionnal; -// } - + // public WidgetAction getProportionnalResizeAction() { + // return alignWithResizeActionProportionnal; + // } + public BuToolBar getToolbarComponent() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -9,6 +9,8 @@ import java.util.List; import java.util.Map; +import javax.swing.JComponent; + import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibString; @@ -35,9 +37,8 @@ */ public class EbliWidget extends Widget implements BSelecteurTargetInterface, EbliWidgetInterface<EbliWidgetController> { - - public final static boolean AMELIO_LOT_VISIBLE=true; - + public final static boolean AMELIO_LOT_VISIBLE = true; + public final static String COLORCONTOUR = "ColorContour"; public final static String COLORFOND = "colorFond"; @@ -52,7 +53,7 @@ public final static String ROTATION = "rotation"; public final static String TRANSPARENCE = "Transpa"; - + protected EbliWidgetController controller_; /** * L'identifiant unique du widget @@ -97,10 +98,10 @@ // -- ajout de l angle de rotation par default PI --// propGraphique.put(ROTATION, Math.PI); - - //-- ajout de la trnaparence a false --// - propGraphique.put( EbliWidget.TRANSPARENCE,false); - + + // -- ajout de la trnaparence a false --// + propGraphique.put(EbliWidget.TRANSPARENCE, false); + } /** @@ -121,18 +122,15 @@ } - - - public boolean getTransparent() { - return (Boolean) propGraphique.get(TRANSPARENCE); -} + return (Boolean) propGraphique.get(TRANSPARENCE); + } -public void setTransparent(boolean transparent) { - propGraphique.put(TRANSPARENCE, new Boolean(transparent)); -} + public void setTransparent(boolean transparent) { + propGraphique.put(TRANSPARENCE, new Boolean(transparent)); + } -public boolean canColorBackground() { + public boolean canColorBackground() { return true && !getTransparent(); } @@ -209,15 +207,15 @@ return mapDupliquee; } - protected void editingStart() { + protected void editingStart(JComponent _editor) { isInEditMode_ = true; - getEbliScene().getController().fireEditStart(this); + getEbliScene().getController().fireEditStart(this, _editor); } - protected void editingStop() { + protected void editingStop(JComponent _editor) { isInEditMode_ = false; - getEbliScene().getController().fireEditStop(this); + getEbliScene().getController().fireEditStop(this, _editor); } /** @@ -445,8 +443,8 @@ if (parent != null) { // System.err.println("parent not null"+ toString()); setBorder(lookFeel.getBorderInGroup(_newState)); - parent.setBorder(lookFeel.getBorder(_newState, parent.getController().canResize_, - parent.getController().isProportional())); + parent.setBorder(lookFeel.getBorder(_newState, parent.getController().canResize_, parent.getController() + .isProportional())); } else { setBorder(lookFeel.getBorder(_newState, getController().canResize_, getController().isProportional())); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -99,12 +99,12 @@ Widget widget, EbliEditorArrow editor, boolean commit) { imageFleche = null; repaint(); - editingStop(); + editingStop(editor); } public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, EbliEditorArrow editor) { - editingStart(); + editingStart(editor); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -4,6 +4,8 @@ */ package org.fudaa.ebli.visuallibrary; +import javax.swing.JComponent; + import org.netbeans.api.visual.widget.Widget; /** @@ -13,8 +15,8 @@ */ public interface EbliWidgetEditModeListener { - void editStart(Widget w); + void editStart(Widget w, JComponent _editor); - void editStop(Widget w); + void editStop(Widget w, JComponent _editor); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -50,16 +50,16 @@ final EbliWidgetControllerTextEditor controller = new EbliWidgetControllerTextEditor(this); controller.setEditable(true); setController(controller); - + } -// @Override -//public boolean canColorBackground() { -// // TODO Auto-generated method stub -// return false; -//} + // @Override + // public boolean canColorBackground() { + // // TODO Auto-generated method stub + // return false; + // } -public boolean canRotate() { + public boolean canRotate() { return false; } @@ -183,7 +183,7 @@ // intern_.revalidate(); this.repaint(); getEbliScene().refresh(); - editingStop(); + editingStop(_editor); } @@ -194,7 +194,7 @@ // editorPane_.setDocumentText(contenuHTML_.getText()); // -- on masque l affichage du widgetcomponent --// setHtml(CtuluLibString.EMPTY_STRING); - editingStart(); + editingStart(_editor); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -45,11 +45,11 @@ // Font oldFont_; boolean mustUpdateFont_ = false; - + public EbliWidgetCalqueLegende(final EbliScene _scene, final boolean _controller/* , BArbreCalqueModel model */, final BCalqueLegendePanel _legendePanel) { super(_scene, _controller); - + setCheckClipping(true); // oldFont_ = getFormeFont(); // -- la legende est un listener des modifs de son calque --// @@ -127,16 +127,14 @@ return null; } - - public void notifyClosing(final EditorController _controller, final Widget _widget, final JComponent _editor, final boolean _commit) { - editingStop(); + editingStop(_editor); } public void notifyOpened(final EditorController _controller, final Widget _widget, final JComponent _editor) { - editingStart(); + editingStart(_editor); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -3,7 +3,6 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.Insets; import java.awt.Rectangle; import java.awt.Window; import java.awt.image.BufferedImage; @@ -102,10 +101,10 @@ */ public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final boolean commit) { - editingStop(); + editingStop(editor); setZoom(calquePanel_.getVueCalque().getViewBoite()); - //le zoom n'a pas chang\xE9. -// zoomChanged_=false; + // le zoom n'a pas chang\xE9. + // zoomChanged_=false; getEbliScene().refresh(); } @@ -144,7 +143,6 @@ } boolean zoomChanged_ = true; - @Override protected void paintWidget() { @@ -208,7 +206,7 @@ public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor) { - editingStart(); + editingStart(editor); // calquePanel_.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); } @@ -298,8 +296,8 @@ if (CtuluLib.isEquals(_zoom, zoom_)) return; clearCacheImage(); this.zoom_ = _zoom; - zoomChanged_=true; -// repaint(); + zoomChanged_ = true; + // repaint(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -187,7 +187,7 @@ public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final boolean commit) { - editingStop(); + editingStop(editor); } @@ -253,7 +253,7 @@ public void notifyOpened(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor) { - editingStart(); + editingStart(editor); } public void axeAspectChanged(final EGAxe _c) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/Fudaa.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -33,7 +33,7 @@ private final FudaaCommandLineParser flags_ = new FudaaCommandLineParser(); private FudaaSplashScreen splash_; private File toOpen_; - private boolean splashTextVisible_=true; + private boolean splashTextVisible_ = true; public boolean isDoNotUseFudaaTee() { return doNotUseFudaaTee_; @@ -47,9 +47,10 @@ return applyLanguage_; } - public void setSplashTextVisible(boolean b){ - splashTextVisible_=b; + public void setSplashTextVisible(boolean b) { + splashTextVisible_ = b; } + public void setApplyLanguage(final boolean _applyLanguage) { applyLanguage_ = _applyLanguage; } @@ -154,7 +155,7 @@ // il est inutile de charger des classes. Cela encombre la memoire pour rien if (!flags_.noSplash_ && FudaaStartupExitPreferencesPanel.isSplashActivated()) { splash_ = new FudaaSplashScreen(_soft, 2000, new String[0][0]); - splash_.setVisible(splashTextVisible_); + splash_.setVisible(splashTextVisible_); splash_.start(); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaSplashScreen.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -7,54 +7,51 @@ * @mail de...@fu... */ package org.fudaa.fudaa.commun.impl; -import java.awt.Color; + import java.awt.Component; -import java.awt.Container; import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.SwingConstants; +import org.fudaa.fudaa.ressource.FudaaResource; + import com.memoire.bu.BuInformationsSoftware; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; import com.memoire.bu.BuPicture; import com.memoire.bu.BuSplashScreen; -import org.fudaa.fudaa.ressource.FudaaResource; /** - * @version $Revision: 1.2 $ $Date: 2008-02-29 16:47:10 $ by $Author: opasteur $ - * @author Guillaume Desnoix + * @version $Revision: 1.2 $ $Date: 2008-02-29 16:47:10 $ by $Author: opasteur $ + * @author Guillaume Desnoix */ +@SuppressWarnings("serial") public class FudaaSplashScreen extends BuSplashScreen { - boolean visibleText_ = true; - public FudaaSplashScreen( - final BuInformationsSoftware _info, - final long _delai, - final String[][] _classes) { + + public FudaaSplashScreen(final BuInformationsSoftware _info, final long _delai, final String[][] _classes) { super(_info, _delai, _classes); } + public final void build() { super.build(); name_.setVerticalAlignment(SwingConstants.BOTTOM); - //setForeground(Color.WHITE); + // setForeground(Color.WHITE); name_.setText("Fudaa-" + name_.getText()); - if(!visibleText_) setLabelVisibleFalse(panel_); left_.add(new BuPicture(FudaaResource.FUDAA.getIcon("fudaa-logo"))); } - - public void setVisibleText(boolean b){ - visibleText_ = b; + + public void setTextUnvisible(boolean b) { + setLabelVisibleFalse(panel_); } - - private void setLabelVisibleFalse(BuPanel panel){ - Component[] comps = panel.getComponents(); - for (int i = 0; i < comps.length; i++) { - if (comps[i] instanceof JLabel) ((JLabel)comps[i]).setText(" "); - else if (comps[i] instanceof BuPanel){ - setLabelVisibleFalse((BuPanel)comps[i]); - } - } + + private void setLabelVisibleFalse(JPanel panel) { + Component[] comps = panel.getComponents(); + for (int i = 0; i < comps.length; i++) { + if (comps[i] instanceof JLabel) ((JLabel) comps[i]).setText(" "); + else if (comps[i] instanceof JPanel) { + setLabelVisibleFalse((JPanel) comps[i]); + } + } } - + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -131,8 +131,8 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.92-MAQUETTE-V7"; - infoSoft.date = "2008-12-13"; + infoSoft.version = "0.92-MAQUETTE-V8"; + infoSoft.date = "2009-01-29"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2007"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; @@ -148,7 +148,7 @@ } else { infoSoft.man = manUrl.toString() + '/'; } - infoSoft.authors = new String[] { "Nicolas Clavreul", "Fr\xE9d\xE9ric Deniger" }; + infoSoft.authors = new String[] { "Nicolas Clavreul", "Fr\xE9d\xE9ric Deniger", "Adrien Hadoux" }; infoSoft.contributors = new String[] { "Equipes Dodico, Ebli et Fudaa" }; infoSoft.documentors = new String[] { "" }; infoSoft.testers = new String[] { "Fr\xE9d\xE9ric Deniger, Patrick Gomi, Vanessya Laborie", "Andr\xE9 Paquier", Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContentDefaultSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -28,8 +28,8 @@ vy_ = _defaut.getVy().getShortName(); } - public TrPostDataCreated restore(TrPostSource _src, CtuluUI _ui, Map _shortName) { - H2dVariableType var = (H2dVariableType) _shortName.get(name_); + public TrPostDataCreated restore(H2dVariableType _newVar, TrPostSource _src, CtuluUI _ui, Map _shortName) { + H2dVariableType var = _newVar; H2dVariableType varX = (H2dVariableType) _shortName.get(vx_); H2dVariableType varY = (H2dVariableType) _shortName.get(vy_); if (var != null && varX != null && varY != null) { return new TrPostFlecheContentDefaut(_src, var, varX, varY); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -22,6 +22,7 @@ import javax.swing.JToolBar; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluSelectionInterface; import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ctulu.image.CtuluImageProducer; @@ -76,7 +77,8 @@ * @author Adrien Hadoux */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface, BuCutCopyPasteInterface, EbliWidgetEditModeListener, CtuluImageProducer, EbliPageable { + BuUndoRedoInterface, BuCutCopyPasteInterface, CtuluSelectionInterface, EbliWidgetEditModeListener, + CtuluImageProducer, EbliPageable { /** * @@ -89,7 +91,7 @@ // final private EbliScene scene_; public TrPostLayoutPanelController controller_; - final JComponent defaultSouth_ = new JLabel("Details:"); + final JComponent defaultSouth_ = new JLabel(TrResource.getS("Details:")); private EbliPageableDelegate delegueImpression_; @@ -164,45 +166,43 @@ panelSouthSuiviSouris_ = new JLabel(); this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH); - // oldSize_=getSize(); - // -- ajout du controller en cas de resize --// - // this.addComponentListener(new ComponentListener(){ - // - // @Override - // public void componentHidden(ComponentEvent e) { - // // TODO Auto-generated method stub - // - // } - // - // @Override - // public void componentMoved(ComponentEvent e) { - // // TODO Auto-generated method stub - // - // } - // - // @Override - // public void componentResized(ComponentEvent e) { - // // TODO Auto-generated method stub - // // Dimension size=getSize(); - // // System.out.println("Size nouvelle:"+size); - // // if(size!=oldSize_ ){ - // // controller_.getSceneCourante().resizeInnerWidget(size,oldSize_); - // // - // // //-- stockage de la taille comme ancienne size --// - // // oldSize_=size; - // // } - // } - // - // @Override - // public void componentShown(ComponentEvent e) { - // // TODO Auto-generated method stub - // - // } - // - // }); + } + public void find() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).find(); + } + } + public void replace() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).replace(); + } + + } + + public void select() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).select(); + } + + } + + public void inverseSelection() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).inverseSelection(); + } + + } + + public void clearSelection() { + if (editorEnCours_ instanceof CtuluSelectionInterface) { + ((CtuluSelectionInterface) editorEnCours_).clearSelection(); + } + + } + /** * @param _title * @param _preferredLocation @@ -328,19 +328,20 @@ // TODO trop dangereux... // listeActions.add(new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque)); - // if (!(_graphe.getGraphe().getModel() instanceof MvProfileTreeModel)) listeActions -// .add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); - - //-- action ajout de variable --// -// if (_graphe.getGraphe().getModel() instanceof TrPostCourbeTreeModel){ -// ((EbliWidgetControllerGraphe)_controller).tree_.getActions().getMenu().add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); -// -// } + // if (!(_graphe.getGraphe().getModel() instanceof MvProfileTreeModel)) listeActions + // .add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); + + // -- action ajout de variable --// + // if (_graphe.getGraphe().getModel() instanceof TrPostCourbeTreeModel){ + // ((EbliWidgetControllerGraphe)_controller).tree_.getActions().getMenu().add(new + // TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); + // + // } if (_graphe.getGraphe().getModel() instanceof MvProfileTreeModel) { listeActions .add(new TrPostActionBilan(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_.getImpl())); -// listeActions.add(new TrPostActionCubature(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_ -// .getImpl())); + // listeActions.add(new TrPostActionCubature(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_ + // .getImpl())); } // -- ajout de l'importation dans les courbes de l'action --// @@ -473,9 +474,12 @@ throw new IllegalAccessError("not supported"); } - public void editStart(final Widget _w) { + JComponent editorEnCours_; + + public void editStart(final Widget _w, JComponent _editor) { + editorEnCours_ = _editor; final EbliNode node = (EbliNode) controller_.getSceneCourante().findObject(_w); - if (node == null || !node.hasWidget() || node.getWidget().getController() == null) editStop(null); + if (node == null || !node.hasWidget() || node.getWidget().getController() == null) editStop(null, null); if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { // -- etape 1: ajout du tree dans fudaaImplementation --// @@ -505,19 +509,18 @@ setTitle(previousTitleFrame); } - //-- cas des fleches + // -- cas des fleches else if (node.getCreator() instanceof EbliWidgetCreatorArrowEditor) { - FuLog.debug("arrow editor"); - - // -- etape 1: on fout eventuellement le tree des layouts --// - changeTree(getScene()); - // -- etape 2: rechargement de la toolbar specifique dans this --// - changeToolbar(node.getWidget().getController()); - setTitle(previousTitleFrame); + FuLog.debug("arrow editor"); - } - - + // -- etape 1: on fout eventuellement le tree des layouts --// + changeTree(getScene()); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbar(node.getWidget().getController()); + setTitle(previousTitleFrame); + + } + else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTree(getScene()); @@ -528,7 +531,8 @@ } - public void editStop(final Widget _w) { + public void editStop(final Widget _w, JComponent _editor) { + editorEnCours_ = null; changeTree(getScene()); changeToolbarScene(); setTitle(previousTitleFrame); Modified: 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/TrPostUserVariableSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -103,7 +103,7 @@ final Map shortName = getShortNameVariable(_src); final TrPostDataCreated[] newData = new TrPostDataCreated[saver_.length]; for (int i = 0; i < saver_.length; i++) { - newData[i] = saver_[i].restore(_src, _ui, shortName); + newData[i] = saver_[i].restore(varCreatedSimple_[i], _src, _ui, shortName); } _src.addUserVar(varCreatedSimple_, newData, null); } @@ -198,7 +198,7 @@ final TrPostDataCreated created = (TrPostDataCreated) e.getValue(); final H2dVariableType var = (H2dVariableTypeCreated) e.getKey(); // pas de sauvegarde possible ou non basee sur une expression - if (created!=null && !created.isExpr() && created.createSaver() == null) { + if (created != null && !created.isExpr() && created.createSaver() == null) { varToRemove.add(var); varToRemove.addAll(TrPostDataCreatedExpr.getAllVarDependingOn(var, _src)); } @@ -212,12 +212,10 @@ for (final Iterator it = map.entrySet().iterator(); it.hasNext();) { final Map.Entry e = (Map.Entry) it.next(); final TrPostDataCreated data = ((TrPostDataCreated) e.getValue()); - if (data!=null &&data.isExpr()) { - if (data!=null) - exprVar.put(e.getKey(), data); + if (data != null && data.isExpr()) { + if (data != null) exprVar.put(e.getKey(), data); } else { - if (data!=null) - otherVar.put(e.getKey(), data); + if (data != null) otherVar.put(e.getKey(), data); } } @@ -231,7 +229,7 @@ } save.varCreatedSimple_ = new H2dVariableTypeCreated[otherVar.size()]; save.saver_ = new TrPostDataCreatedSaver[otherVar.size()]; - idx = 0; + idx = 0; for (final Iterator it = otherVar.entrySet().iterator(); it.hasNext();) { final Map.Entry e = (Map.Entry) it.next(); save.varCreatedSimple_[idx] = (H2dVariableTypeCreated) e.getKey(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTime.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -27,8 +27,8 @@ private final int timeIdx_; - public static TrPostDataCreatedCstTime createFrom(final TrPostSource _src, - final TrPostDataCreatedCstTimeSaver _saver, final Map _shortName) { + public static TrPostDataCreatedCstTime createFrom(H2dVariableType _newVar, + final TrPostSource _src, final TrPostDataCreatedCstTimeSaver _saver, final Map _shortName) { if (_src == null || _saver == null || _shortName == null) { return null; } final H2dVariableType var = (H2dVariableType) _shortName.get(_saver.shortName_); if (var == null) { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedCstTimeSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -10,6 +10,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.fudaa.tr.post.TrPostSource; /** @@ -31,8 +32,8 @@ tidx_ = _data.getTimeIdx(); } - public TrPostDataCreated restore(final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { - return TrPostDataCreatedCstTime.createFrom(_src, this, _shortName); + public TrPostDataCreated restore(H2dVariableType _newVar, final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { + return TrPostDataCreatedCstTime.createFrom(_newVar, _src, this, _shortName); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -10,6 +10,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.fudaa.tr.post.TrPostSource; /** @@ -18,6 +19,6 @@ */ public interface TrPostDataCreatedSaver { - TrPostDataCreated restore(TrPostSource _src, CtuluUI _ui, Map _shortName); + TrPostDataCreated restore(H2dVariableType _newVar, TrPostSource _src, CtuluUI _ui, Map _shortName); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -11,6 +11,7 @@ import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.fudaa.tr.post.TrPostSource; /** @@ -19,7 +20,7 @@ */ public class TrPostDataCreatedStatisticSaver implements TrPostDataCreatedSaver { - public TrPostDataCreated restore(final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { + public TrPostDataCreated restore(H2dVariableType _newVar, final TrPostSource _src, final CtuluUI _ui, final Map _shortName) { return TrPostDataCreatedStatistic.createFrom(this, _src, _shortName, _ui); } Modified: 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/TrPostPersistenceManager.java 2009-01-29 18:53:28 UTC (rev 4425) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-01-29 22:44:57 UTC (rev 4426) @@ -3,7 +3,6 @@ import java.awt.Dimension; import java.awt.Point; import java.io.File; -import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -43,12 +42,10 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; import org.fudaa.fudaa.tr.post.TrPostLayoutFille; -import org.fudaa.fudaa.tr.post.TrPostMultiSourceActivator; import org.fudaa.fudaa.tr.post.TrPostMultiSourceActivator2; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; import org.fudaa.fudaa.tr.post.TrPostSourceAbstract; -import org.fudaa.fudaa.tr.post.TrPostSourceAbstractFromIdx; import org.fudaa.fudaa.tr.post.TrPostSourceFromReader; import org.fudaa.fudaa.tr.post.TrPostSourcePersistComposite; import org.fudaa.fudaa.tr.post.TrPostTimeModelSaver; @@ -161,30 +158,38 @@ final CtuluFileChooser fileChooser = new CtuluFileChooser(true); fileChooser.setDialogTitle(EbliResource.EBLI.getString("S\xE9lectionnez l'emplacement de votre projet")); fileChooser.setAcceptAllFileFilterUsed(false); - fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); +// fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.addChoosableFileFilter(new TrPostFileFilter.DirectoryPOSTFilter()); // -- par defaut on choisis le nom du fichier resultat + .POST --// - File fileDefaut = null; - boolean constrcutFileDefaut = false; + + // boolean constrcutFileDefaut = false; if (trprojet_.listeSrc_ != null && trprojet_.listeSrc_.size() >= 1) { String indice = ""; - int i = 1; - do { - // TODO Adrien complique - // String path = fileChooser.getCurrentDirectory().getAbsolutePath() + File.separator - // + ; - // fileDefaut = new File(path); - fileDefaut = new File(fileChooser.getCurrentDirectory(), trprojet_.getSource(0).getFiles().iterator().next() - .getName() - + indice + EXTENSION); - indice = "_" + (i++); - } while (fileDefaut.exists()); + File fileDefaut = new File(fileChooser.getCurrentDirectory(), trprojet_.getSource(0).getFiles().iterator() + .next().getName() + + EXTENSION); + if (fileDefaut.exists()) { + int i = 1; + do { + // TODO Adrien complique + // String path = fileChooser.getCurrentDirectory().getAbsolutePath() + File.separator + // + ; + // fileDefaut = new File(path); + fileDefaut = new File(fileChooser.getCurrentDirectory(), trprojet_.getSource(0).getFiles().iterator() + .next().getName() + + indice + EXTENSION); + indice = "_" + (i++); + } while (fileDefaut.exists() && i < 20);// Garde fou + } + // FRED faux cree le repertoire alors que l'utilisateur ne l'a pas choisit !!!!! + // if (!fileDefaut.exists()) { + // constrcutFileDefaut = fileDefaut.mkdir(); + // } if (!fileDefaut.exists()) { - constrcutFileDefaut = fileDefaut.mkdir(); + fileChooser.setSelectedFile(fileDefaut); } - fileChooser.setSelectedFile(fileDefaut); } if (projet_ != null) { // initialiser le saveas dans le meme rep @@ -196,18 +201,19 @@ // -- si le fichier choisit en d\xE9finitif est diff\xE9rent du fichier d\xE9faut et qu'il a \xE9t\xE9t cr\xE9r pour rien, on le // supprime --// - if (constrcutFileDefaut && fileDefaut != null - && !fileDefaut.getAbsolutePath().equals(conteneurProjet.getAbsolutePath())) { - fileDefaut.delete(); + // FRED ben pourquoi l'avoir cree alors !!!!! + // if (constrcutFileDefaut && fileDefaut != null + // && !fileDefaut.getAbsolutePath().equals(conteneurProjet.getAbsolutePath())) { + // fileDefaut.delete(); + // } + + // -- test si le fichier choisit par l'utilisateur existe djea, si oui. demander confirmation d'ecrasement --// + if (conteneurProjet.exists()) { + //Fred il faut traduire + boolean resp = trprojet_.impl_.question("Fichier " + conteneurProjet.getName() + " existant", "Le fichier " + + conteneurProjet.getName() + " existe d\xE9j\xE0.\n Voulez-vous l'\xE9craser ?"); + if (!resp) return false; } - - //-- test si le fichier choisit par l'utilisateur existe djea, si oui. demander confirmation d'ecrasement --// - if(conteneurProjet.exists()){ - boolean resp=trprojet_.impl_.question("Fichier "+conteneurProjet.getName()+" existant", "Le fichier "+conteneurProjet.getName()+" existe d\xE9j\xE0.\n Voulez-vous l'\xE9craser ?"); - if(!resp) - return false; - } - if (projet_ == null || !projet_.equals(conteneurProjet)) projet_ = new File(GetExtensionName(conteneurProjet .getAbsolutePath())); @@ -226,9 +232,9 @@ } else { // -- on supprime le fichier defaut construit pour rien si il a \xE9t\xE9 construit --// - if (constrcutFileDefaut) { - fileDefaut.delete(); - } + // if (constrcutFileDefaut) { + // fileDefaut.delete(); + // } return false; } @@ -599,10 +605,10 @@ trprojet_.deliverSourceId(src); listeCouplesIdSources.add(new TrPostSourcePersist(src, projet_)); // -- sauveagrde de la variable correspondante --// - - final TrPostUserVariableSaver var = TrPostUserVariableSaver.saveIn((TrPostSourceAbstract) src, null); - listeVar.add(var); - + + final TrPostUserVariableSaver var = TrPostUserVariableSaver.saveIn((TrPostSourceAbstract) src, null); + listeVar.add(var); + listePdt.add(new TrPostTimeModelSaver(src)); } ... [truncated message content] |
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] |
From: <had...@us...> - 2009-01-30 18:55:36
|
Revision: 4431 http://fudaa.svn.sourceforge.net/fudaa/?rev=4431&view=rev Author: hadouxad Date: 2009-01-30 18:55:31 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Liste des am?\195?\169liorations: - Superposition: modification de la pile des frames: actions accessibles via clic droit sur les frame: monter, descendre, en premier, en dernier (comme pour les graphes et vues 2d) - Correction bugs rejoue des donn?\195?\169es pour les trajectoires/lignes de courant - Action origine de la courbe: un Bouton offre la possibilit?\195?\169 de cr?\195?\169er la frame de la vue de la fen?\195?\170tre et de l'ins?\195?\169rer automatiquement dans le layout. Cette action permet de visualiser la frame avec l'origine de la cr?\195?\169ation de la courbe pour plus de visibilit?\195?\169 par l'utilisateur : un calque est automatiquement g?\195?\169n?\195?\169r?\195?\169 avec les informations g?\195?\169om?\195?\169triques qui porte le nom de la courbe. -Assistant cr?\195?\169ation graphe: cr?\195?\169er automatiquement une trace dans la vue 2d: propose par d?\195?\169faut un flag qui g?\195?\169n?\195?\168re automatiquement le calque avec les donn?\195?\169es d'origine du graphe dans la vue 2d, permet de conserver une trace. Propose de saisir un titre pr?\195?\169 remplit. - Ajout du panel rechercher directement a cote de l'interface de modif pour l'action rejouer les donn?\195?\169es Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfTrajectoireParameters.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfTrajectoireParameters.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfTrajectoireParameters.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfTrajectoireParameters.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -22,7 +22,15 @@ * Les points de depart des trajectoires/ligne de courants */ public List<Coordinate> points_; + + /** + * Le segment initial + */ + public List<Coordinate> segment_; + + public int nbPointsInitiaux_; + /** * La dur\xE9e de l'int\xE9gration */ public double dureeIntegration_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -425,5 +425,101 @@ // refresh(); } + + /** + * Place la widget en fin de liste: + * le premier plan:la fin de la liste children + * l'arriere plan: le debut de la liste children + * @param widget + */ + public void getActPrem(EbliWidget widget){ + Widget layer=visu_; + EbliWidget parent=widget.getParentBordure(); + //-- cas particulier pour les groupes--// + if(parent.getParentWidget() instanceof EbliWidgetGroup) + layer=parent.getParentWidget(); + List<Widget> children = layer.getChildren(); + layer.removeChild(parent); + layer.addChild(children.size(), parent); + widget.revalidate (); + this.refresh(); + //-- notify le modele: redessine toi ! --// + treeModel_.nodeMoved(parent); + } + + /** + * Augmente la position de la widget d'un cran: + * le premier plan:la fin de la liste children + * l'arriere plan: le debut de la liste children + * @param widget + */ +public void getActUp(EbliWidget widget){ + + Widget layer=visu_; + EbliWidget parent=widget.getParentBordure(); + //-- cas particulier pour les groupes--// + if(parent.getParentWidget() instanceof EbliWidgetGroup) + layer=parent.getParentWidget(); + List<Widget> children = layer.getChildren(); + + + int i =children.indexOf (parent); + if (i < 0 || i==children.size()-1) + return; + layer.removeChild(parent); + layer.addChild(i+1, parent); + widget.revalidate (); + this.refresh(); + //-- notify le modele: redessine toi ! --// + treeModel_.nodeMoved(parent); + } +/** + * Diminue la position de la widget d'un cran: + * le premier plan:la fin de la liste children + * l'arriere plan: le debut de la liste children + * @param widget + */ +public void getActDown(EbliWidget widget){ + Widget layer=visu_; + EbliWidget parent=widget.getParentBordure(); + //-- cas particulier pour les groupes--// + if(parent.getParentWidget() instanceof EbliWidgetGroup) + layer=parent.getParentWidget(); + List<Widget> children = layer.getChildren(); + + int i =children.indexOf (parent); + if (i <= 0 ) + return; + layer.removeChild(parent); + layer.addChild(i-1, parent); + widget.revalidate (); + this.refresh(); + //-- notify le modele: redessine toi ! --// + treeModel_.nodeMoved(parent); + } + +/** + * Place la widget en debut de liste: + * le premier plan:la fin de la liste children + * l'arriere plan: le debut de la liste children + * @param widget + */ +public void getActLast(EbliWidget widget){ + Widget layer=visu_; + EbliWidget parent=widget.getParentBordure(); + //-- cas particulier pour les groupes--// + if(parent.getParentWidget() instanceof EbliWidgetGroup) + layer=parent.getParentWidget(); + + + layer.removeChild(parent); + layer.addChild(0, parent); + widget.revalidate (); + this.refresh(); + //-- notify le modele: redessine toi ! --// + treeModel_.nodeMoved(parent); } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -561,4 +561,19 @@ public void setUseBorder(final boolean _useBorder) { useBorder_ = _useBorder; } + + + public final void bringToPosition (int position) { + if (getParentWidget() == null) + return; + List<Widget> children = getParentWidget().getChildren(); + int i = children.indexOf (this); + if (i < 0) + return; + children.remove (i); + children.add (position, this); + revalidate (); + getParentWidget().revalidate (); + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -293,9 +293,12 @@ */ public void constructPopupMenuBase(final JPopupMenu _popup) { + // -- reference vers le gestionnaire de commandeundo/redo --// final CtuluCommandContainer cmd_ = getWidget().getEbliScene().getCmdMng(); + constructMenuDeplacerDansArbre(_popup); + final JMenuItem menuItem3 = _popup.add(EbliResource.EBLI.getString("Informations")); menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); menuItem3.addActionListener(new ActionListener() { @@ -319,6 +322,35 @@ } + + public void constructMenuDeplacerDansArbre(JPopupMenu menu){ + + EbliActionSimple action=null; + + menu.add( new EbliActionSimple(EbliResource.EBLI.getString("En premier"),EbliResource.EBLI.getIcon("enpremier"),"ENPREMIER"){ + public void actionPerformed(final ActionEvent _e) { + widget_.getEbliScene().getActPrem(widget_) ; + } + }); + menu.add( new EbliActionSimple(EbliResource.EBLI.getString("Monter"),EbliResource.EBLI.getIcon("monter"),"MONTER"){ + public void actionPerformed(final ActionEvent _e) { + widget_.getEbliScene().getActUp(widget_) ; + } + }); + menu.add( new EbliActionSimple(EbliResource.EBLI.getString("Descendre"),EbliResource.EBLI.getIcon("descendre"),"DESCENTRE"){ + public void actionPerformed(final ActionEvent _e) { + widget_.getEbliScene().getActDown(widget_) ; + } + }); + menu.add( new EbliActionSimple(EbliResource.EBLI.getString("En dernier"),EbliResource.EBLI.getIcon("endernier"),"ENPREMIER"){ + public void actionPerformed(final ActionEvent _e) { + widget_.getEbliScene().getActLast(widget_) ; + } + }); + + + } + /** * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il n a aucun effet. * Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -188,7 +188,7 @@ public void notifyClosing(final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, final Widget widget, final BuPanel editor, final boolean commit) { editingStop(editor); - + getEbliScene().refresh(); } // TODO a changer pour ne recreer tout plein de listener a chaque fois Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -91,7 +91,9 @@ public void nodeAdded(final EbliNode _node) { refresh(); } - + public void nodeMoved(final EbliWidget widget) { + refresh(); + } public void nodeRemoved(final EbliNode _node) { final MutableTreeTableNode aSuppr = findTreeTableNode(_node); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2009-01-30 17:09:25 UTC (rev 4430) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2009-01-30 18:55:31 UTC (rev 4431) @@ -32,6 +32,13 @@ addChilds((ObjectScene) w.getScene(), w, _root, null); } + /** + * Ajoute les childs depuis la liste de la scene + * @param _sc + * @param w + * @param parent + * @param parentNode + */ static void addChilds(final ObjectScene _sc, final Widget w, final EbliWidgetTreeTableNode parent, final EbliNode parentNode) { List<Widget> children = w.getChildren(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-02 19:34:03
|
Revision: 4436 http://fudaa.svn.sourceforge.net/fudaa/?rev=4436&view=rev Author: hadouxad Date: 2009-02-02 19:33:52 +0000 (Mon, 02 Feb 2009) Log Message: ----------- GRILLES ET SOUS GRILLES !!! Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 16:00:39 UTC (rev 4435) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 19:33:52 UTC (rev 4436) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +import org.apache.tools.ant.filters.TailFilter; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; @@ -41,579 +42,974 @@ * @author Guillaume Desnoix */ public class ZCalqueGrille extends ZCalqueAffichageDonnees { - // Proprietes - // private GrBoite boite_; - boolean drawGrid_; - boolean drawX_ = true; - boolean drawY_ = true; - // Envelope customBounds_; - // boolean useCustom_; + // Proprietes + // private GrBoite boite_; + boolean drawGrid_; + boolean drawX_ = true; + boolean drawY_ = true; + // Envelope customBounds_; + // boolean useCustom_; - int nbGraduationX_ = 10; - int nbGraduationY_ = 10; + int nbGraduationX_ = 10; + int nbGraduationY_ = 10; - final BVueCalque vue_; + //-- sous graduations --// + int nbSousGraduationX_ = 2; + //-- sous graduations --// + int nbSousGraduationY_ = 2; - public ZCalqueGrille(final BVueCalque _vue) { - super(); - vue_ = _vue; - setDestructible(false); - setName("cqGrille"); - setTitle(EbliLib.getS("Grille")); - // setForeground(new Color(204, 153, 0)); - setForeground(Color.BLACK); - } + final BVueCalque vue_; - public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } - public void changeZoom(double minx, double miny, double maxx, double maxy) { - vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); - } + /** + * Indique la facon de calculer les graduations. + * pour l'axe des x. + */ + boolean modeAutomatiqueX_=false; + /** + * Indique la facon de calculer les graduations. + * pour l'axe des y. + */ + boolean modeAutomatiqueY_=false; - public int getNbXGraduations() { - return nbGraduationX_; - } - public int getNbYGraduations() { - return nbGraduationY_; - } - /** - * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. - */ - // public GrBoite getBoite() { - // return boite_; - // } - public GrBoite getDomaine() { - return null; - // GrBoite r = null; - // if (isVisible()) { - // GrBoite d = null; - // d = super.getDomaine(); - // r = getBoite(); - // if (d != null) { - // if (r == null) { - // r = d; - // } else { - // r = r.union(d); - // } - // } - // } - // return r; - } - public GrBoite getDomaineOnSelected() { - return getDomaine(); - } + /** + * Indique si on utilise par taille de pas ou par nombre de graduations + */ + boolean modeLongueurPasX_=false; + boolean modeLongueurPasY_=false; - public boolean isCouleurModifiable() { - return true; - } + /** + * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. + */ + int valeurPasX_; + int valeurPasY_; - public int getTiretLength() { - return 3; - } + boolean drawSousGrilleX_ = false; + boolean drawSousGrilleY_ = false; - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - GrBoite domaine = vue_.getAbstractCalque().getDomaine(); - final GrBoite zv = _clipReel.intersectionXY(domaine); + boolean modeLongueurPasSousGradX_=false; + boolean modeLongueurPasSousGradY_=false; - if (zv == null) { return; } - // updateBounds(zv); - final GrBoite targetBoite = new GrBoite(); - targetBoite.ajuste(0, 0, 0); - // la boite d'affichage + int valeurPasSousGradX_; + int valeurPasSousGradY_; - if (!_versEcran.isSame(getVersEcran())) { return; } - targetBoite.ajuste(getWidth(), getHeight(), 0); - final Color old = _g.getColor(); - final Font oldFont = _g.getFont(); - // la fonte - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final TDoubleArrayList xValue = new TDoubleArrayList(20); - final TIntArrayList xStrWidth = new TIntArrayList(20); - final List xString = new ArrayList(20); - final NumberIterator it = new NumberIterator(); - final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; + private Color couleurSousGraduation_=Color.blue; - if (isXPainted) { - computeXValues(zv, _g, xValue, xStrWidth, xString, it); - } - double yMax = 0; - final TDoubleArrayList yValue = new TDoubleArrayList(20); - final TIntArrayList yStrWidth = new TIntArrayList(20); - final List yString = new ArrayList(20); - final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; - if (isYPainted) { - yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); - } + public ZCalqueGrille(final BVueCalque _vue) { + super(); + vue_ = _vue; + setDestructible(false); + setName("cqGrille"); + setTitle(EbliLib.getS("Grille")); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); + } - // boolean rapide = isRapide(); - final GrMorphisme versEcran = _versEcran; - final int tiret = getTiretLength(); - final int marge = 1; - int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); - final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; - int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); - vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } - final GrBoite ecranBoite = domaine.applique(_versEcran); - if (ecranBoite.getMinX() - 5 > absyAxe) { - absyAxe = (int) (ecranBoite.getMinX() - 5); - } - if (ecranBoite.getMaxY() + 5 < ordxAxe) { - ordxAxe = (int) (ecranBoite.getMaxY() + 5); - } - if (isXPainted) { - fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); + public void changeZoom(double minx, double miny, double maxx, double maxy) { + vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); + } - } + public int getNbXGraduations() { + return nbGraduationX_; + } - // l'axe des x - final double maxXForAxe = ecranBoite.getMaxX() - marge; + public int getNbYGraduations() { + return nbGraduationY_; + } - // l'axe des y - final double minYForAxe = ecranBoite.getMinY() + marge; - // les graduation en x + public int getNbXSousGraduations() { + return nbSousGraduationX_; + } - final int ascent = fm == null ? 0 : fm.getAscent(); - final int ordXString = ordxAxe + tiret + ascent; - if (isXPainted) { - drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); - drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, - ordXString); - } + public int getNbYSousGraduations() { + return nbSousGraduationY_; + } - // y + public void setSousGraduationColor(Color c){ + if(couleurSousGraduation_!=c){ + couleurSousGraduation_=c; + grilleChanged(); + } - if (isYPainted) { - fillYZone(_g, targetBoite, absyAxe, ecranBoite); - drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); - drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); - } - _g.setColor(old); - _g.setFont(oldFont); - } + } - void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite) { - if (_ecranBoite.getMaxX() > _ordxAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); - } - } + /** + * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. + */ + // public GrBoite getBoite() { + // return boite_; + // } + public GrBoite getDomaine() { + return null; + // GrBoite r = null; + // if (isVisible()) { + // GrBoite d = null; + // d = super.getDomaine(); + // r = getBoite(); + // if (d != null) { + // if (r == null) { + // r = d; + // } else { + // r = r.union(d); + // } + // } + // } + // return r; + } - private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { - if (_ecranBoite.getMinX() < _absyAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); - } - } + public GrBoite getDomaineOnSelected() { + return getDomaine(); + } - protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, - final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _maxXForAxe) { - final int nb = _yString.size(); - final int tiret = getTiretLength(); - final Font font = getFont(); - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final int ascent = fm == null ? 0 : fm.getAscent(); - int idxStr = -1; - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - for (int i = 0; i < nb; i++) { - tmp_.y_ = _yValue.getQuick(i); - tmp_.autoApplique(_versEcran); - if (tmp_.y_ > _ordxAxe) { - continue; - } - if (tmp_.y_ < _ecranBoite.getMinY()) { - break; - } - // le tiret - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.setCouleur(fg); - final int w = _yStrWidth.getQuick(i); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); - if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { - _g.setColor(fg); - _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); - idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); - } - if (drawGrid_ && w > 0) { - tl_.setTypeTrait(TraceLigne.TIRETE); - tl_.setCouleur(subColor); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); - } - } - } + public boolean isCouleurModifiable() { + return true; + } - private Color getSubColor() { - Color subColor = attenueCouleur(getForeground()); - if (isAttenue()) { - subColor = attenueCouleur(subColor); - } - return subColor; - } + public int getTiretLength() { + return 3; + } - private Color getDrawColor() { - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - return fg; - } + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + GrBoite domaine = vue_.getAbstractCalque().getDomaine(); + final GrBoite zv = _clipReel.intersectionXY(domaine); - final GrPoint tmp_ = new GrPoint(); + if (zv == null) { return; } + // updateBounds(zv); + final GrBoite targetBoite = new GrBoite(); + targetBoite.ajuste(0, 0, 0); + // la boite d'affichage - private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { - final int nb = _xString.size(); - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - int idxStr = -1; - final GrMorphisme versEcran = getVersEcran(); - final int tiret = getTiretLength(); - final TraceLigne gtl = new TraceLigne(); - for (int i = 0; i < nb; i++) { - tmp_.x_ = _xValue.getQuick(i); - tmp_.autoApplique(versEcran); - if (tmp_.x_ < _absyAxe) { - continue; - } - if (tmp_.x_ > _ecranBoite.getMaxX()) { - break; - } - // le tiret - gtl.setTypeTrait(TraceLigne.LISSE); - gtl.setCouleur(fg); - final int w = _xStrWidth.getQuick(i); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); - if (w > 0) { - final int start = (int) (tmp_.x_ - w / 2D); - if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { - _g.setColor(fg); - _g.drawString((String) _xString.get(i), start, _ordXString); - idxStr = start + w; - } - } - if (drawGrid_ && w > 0) { - gtl.setTypeTrait(TraceLigne.TIRETE); - gtl.setCouleur(subColor); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); - } - } - } + if (!_versEcran.isSame(getVersEcran())) { return; } + targetBoite.ajuste(getWidth(), getHeight(), 0); + final Color old = _g.getColor(); + final Font oldFont = _g.getFont(); + // la fonte + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final TDoubleArrayList xValue = new TDoubleArrayList(20); + final TIntArrayList xStrWidth = new TIntArrayList(20); + final List xString = new ArrayList(20); + final NumberIterator it = new NumberIterator(); + final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; - private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, - final double _minYForAxe) { - int minYDraw = _ordxAxe; - int maxYDraw = (int) _minYForAxe; + if (isXPainted) { + computeXValues(zv, _g, xValue, xStrWidth, xString, it); + } + double yMax = 0; + final TDoubleArrayList yValue = new TDoubleArrayList(20); + final TIntArrayList yStrWidth = new TIntArrayList(20); + final List yString = new ArrayList(20); + final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; + if (isYPainted) { + yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); + } - // if (useCustom_) { - // tmp_.y_ = _zv.getMinY(); - // if (_yValue.size() > 0) { - // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.floor(tmp_.y_); - // if (tmp_.y_ > minYDraw) { - // minYDraw = (int) tmp_.y_; - // } - // tmp_.y_ = _zv.getMaxY(); - // if (_yValue.size() > 1) { - // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.ceil(tmp_.y_); - // if (tmp_.y_ < maxYDraw) { - // maxYDraw = (int) tmp_.y_; - // } - // } - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); - } + // boolean rapide = isRapide(); + final GrMorphisme versEcran = _versEcran; + final int tiret = getTiretLength(); + final int marge = 1; + int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); + final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; + int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); + vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); - final TraceLigne tl_ = new TraceLigne(); + final GrBoite ecranBoite = domaine.applique(_versEcran); + if (ecranBoite.getMinX() - 5 > absyAxe) { + absyAxe = (int) (ecranBoite.getMinX() - 5); + } + if (ecranBoite.getMaxY() + 5 < ordxAxe) { + ordxAxe = (int) (ecranBoite.getMaxY() + 5); + } + if (isXPainted) { + fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); - private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { - int minXDraw = _absyAxe; - int maxXDraw = (int) _maxXForAxe; + } - // if (useCustom_) { - // tmp_.x_ = _zv.getMinX(); - // if (_xValue.size() > 0) { - // tmp_.x_ = Math.min(_xValue.get(0), tmp_.x_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.x_ = Math.floor(tmp_.x_); - // if (tmp_.x_ < minXDraw) { - // minXDraw = (int) tmp_.x_; - // } - // tmp_.x_ = _zv.getMaxX(); - // if (_xValue.size() > 1) { - // tmp_.x_ = Math.max(_xValue.get(_xValue.size() - 1), tmp_.x_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.x_ = Math.ceil(tmp_.x_); - // if (tmp_.x_ < maxXDraw) { - // maxXDraw = (int) tmp_.x_; - // } - // } + // l'axe des x + final double maxXForAxe = ecranBoite.getMaxX() - marge; - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); - } + // l'axe des y + final double minYForAxe = ecranBoite.getMinY() + marge; + // les graduation en x - private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); - while (_it.hasNext()) { - final double x = _it.currentValue(); - _xValue.add(x); + final int ascent = fm == null ? 0 : fm.getAscent(); + final int ordXString = ordxAxe + tiret + ascent; + if (isXPainted) { + drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); + drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, + ordXString); + } - if (font == null || !_it.isMajorTick()) { - _xStrWidth.add(0); - _xString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = _it.currentLabel(); - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); - } - _it.next(); - } - } + // y - private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, - final TIntArrayList _yStrWidth, final List _yString) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - double yMax = 0; - NumberIterator it; - it = new NumberIterator(); - it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); - while (it.hasNext()) { + if (isYPainted) { + fillYZone(_g, targetBoite, absyAxe, ecranBoite); + drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); + drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); + } + _g.setColor(old); + _g.setFont(oldFont); + } - final double x = it.currentValue(); - _yValue.add(x); - if (font == null || !it.isMajorTick()) { - _yStrWidth.add(0); - _yString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = it.currentLabel(); - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - _yStrWidth.add((int) stringWidth); - _yString.add(currentLabel); - } - it.next(); - } - return yMax; - } + void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite) { + if (_ecranBoite.getMaxX() > _ordxAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); + } + } - // private void updateBounds(final GrBoite _zv) { - // if (useCustom_ && customBounds_ != null) { - // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); - // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); - // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); - // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); - // } - // } + private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { + if (_ecranBoite.getMinX() < _absyAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); + } + } - // Icon - /** - * Dessin de l'icone. - * - * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il - * est ignore ici. - * @param _g le graphics sur lequel dessiner l'icone - * @param _x lieu cible de l'icone (x) - * @param _y lieu cible de l'icone (y) - */ - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - super.paintIcon(_c, _g, _x, _y); - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - _g.setColor(fg); - final int w = getIconWidth(); - final int h = getIconHeight(); - for (int i = 6; i < w - 2; i += 8) { - _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); - } - for (int j = 6; j < h - 2; j += 8) { - _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); - } - } + protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, + final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _maxXForAxe) { + final int nb = _yString.size(); + final int tiret = getTiretLength(); + final Font font = getFont(); + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final int ascent = fm == null ? 0 : fm.getAscent(); + int idxStr = -1; + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + GrPoint tmpSousGrille_=new GrPoint(); + double longueurMoyenne=0; + for (int i = 0; i < nb; i++) { + tmp_.y_ = _yValue.getQuick(i); + tmp_.autoApplique(_versEcran); + if (tmp_.y_ > _ordxAxe) { + continue; + } + if (tmp_.y_ < _ecranBoite.getMinY()) { + break; + } + // le tiret + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.setCouleur(fg); + final int w = _yStrWidth.getQuick(i); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); + if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { + _g.setColor(fg); + _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); + idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); + } + + + //-- on trace ou non les sous graduations --// + if((w > 0 || i==nb-2) && drawSousGrilleY_ && i>0 && i<nb-1){ + int valNextPotable=-1; + for(int j=i+1;valNextPotable==-1 &&j<_yStrWidth.size();j++) + if(_yStrWidth.getQuick(j)>0) + valNextPotable=j; + + if(i==nb-2){ + //-- la fin il faut creer le nouveau + valNextPotable=nb-1; + _yValue.set(valNextPotable,_yValue.get(i)+longueurMoyenne); + } + + if(valNextPotable!=-1){ - public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) {} + tmpSousGrille_.y_=_yValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(_versEcran); + double distanceEntre2Trait=Math.abs(tmpSousGrille_.y_-tmp_.y_); + int nbSousGrilles=0; + int taillePasSousgrille=0; + if(!this.modeLongueurPasSousGradY_){ + //-- on trace des nombre de cesure --// + nbSousGrilles=this.getNbYSousGraduations(); + if(nbSousGrilles!=0) + taillePasSousgrille=(int) ((distanceEntre2Trait)/nbSousGrilles); + }else{ + //-- on trace des pas par longueur --// + double ratio=(_yValue.getQuick(valNextPotable)-_yValue.getQuick(i)); + if(ratio!=0) + ratio=this.valeurPasSousGradY_/ratio; - public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { - return null; - } + taillePasSousgrille=(int) (ratio*distanceEntre2Trait); + if(taillePasSousgrille!=0) + nbSousGrilles=(int) (distanceEntre2Trait/taillePasSousgrille); + } + //-- si on a des bons pas et nb de grilles --// + if(nbSousGrilles>0 && taillePasSousgrille>0 && taillePasSousgrille<distanceEntre2Trait){ - public CtuluListSelection selection(final LinearRing _poly, final int _mode) { - return null; - } + for(int k=0;k<nbSousGrilles+1;k++){ + //-- on trace un trait de couleur de subgrid --// + tl_.setTypeTrait(TraceLigne.POINTILLE); + tl_.setEpaisseur((float) 0.1); + tl_.setCouleur(this.couleurSousGraduation_); + double longueur=((k)*taillePasSousgrille); + tmpSousGrille_.autoApplique(_versEcran); + tl_.dessineTrait(_g,_absyAxe, tmp_.y_+longueur,_maxXForAxe,tmp_.y_+ longueur); + } + longueurMoyenne=(int) (_yValue.getQuick(valNextPotable)-_yValue.getQuick(i)); + } - public LineString getSelectedLine() { - return null; - } + } + } + + + if (drawGrid_ && w > 0) { + tl_.setTypeTrait(TraceLigne.TIRETE); + tl_.setEpaisseur(1); + tl_.setCouleur(subColor); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); + } + } + } - /** - * Affectation de la propriete <I>boite</I>. - */ - // public void setBoite(final GrBoite _v) { - // if (boite_ != _v) { - // final GrBoite vp = boite_; - // boite_ = _v; - // firePropertyChange("boite", vp, _v); - // } - // } - public void setVisible(final boolean _v) { - // if (_v && boite_ == null) { - // boite_ = vue_.getAbstractCalque().getDomaine(); - // } - if (!_v) { - vue_.setUserInsets(null); - super.setVisible(false); - } else { - super.setVisible(_v); - } - firePropertyChange("grille", true, false); + private Color getSubColor() { + Color subColor = attenueCouleur(getForeground()); + if (isAttenue()) { + subColor = attenueCouleur(subColor); + } + return subColor; + } - } + private Color getDrawColor() { + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + return fg; + } - public boolean isDrawGrid() { - return drawGrid_; - } + final GrPoint tmp_ = new GrPoint(); - public void setDrawGrid(final boolean _drawGrid) { - if (_drawGrid != drawGrid_) { - drawGrid_ = _drawGrid; - grilleChanged(); - } - } + private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { + final int nb = _xString.size(); + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + int idxStr = -1; + final GrMorphisme versEcran = getVersEcran(); + final int tiret = getTiretLength(); + final TraceLigne gtl = new TraceLigne(); + GrPoint tmpSousGrille_=new GrPoint(); + + double longueurMoyenne=0; + + for (int i = 0; i < nb; i++) { + tmp_.x_ = _xValue.getQuick(i); + tmp_.autoApplique(versEcran); + if (tmp_.x_ < _absyAxe) { + continue; + } + if (tmp_.x_ > _ecranBoite.getMaxX()) { + break; + } + // le tiret + gtl.setTypeTrait(TraceLigne.LISSE); + gtl.setCouleur(fg); + final int w = _xStrWidth.getQuick(i); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); + if (w > 0) { + final int start = (int) (tmp_.x_ - w / 2D); + if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { + _g.setColor(fg); + _g.drawString((String) _xString.get(i), start, _ordXString); + idxStr = start + w; + } + } - // public boolean isUseCustom() { - // return useCustom_; - // } - // - // public void setUseCustom(final boolean _useCustom) { - // if (useCustom_ != _useCustom) { - // useCustom_ = _useCustom; - // repaint(); - // } - // } - // - // public Envelope getCustomBounds() { - // return customBounds_ == null ? null : new Envelope(customBounds_); - // } - // - // public void setCustomBounds(final Envelope _customBounds) { - // if (customBounds_ != _customBounds) { - // customBounds_ = _customBounds; - // repaint(); - // } - // } - public boolean isDrawX() { - return drawX_; - } - public void setDrawX(final boolean _drawX) { - if (drawX_ != _drawX) { - drawX_ = _drawX; - grilleChanged(); - } - } + //-- on trace ou non les sous graduations --// + if((w > 0 || i==nb-2) && drawSousGrilleX_ && i<nb-1){ + int valNextPotable=-1; + for(int j=i+1;valNextPotable==-1 &&j<_xStrWidth.size();j++) + if(_xStrWidth.getQuick(j)>0) + valNextPotable=j; + if(i==nb-2){ + //-- la fin il faut creer le nouveau + valNextPotable=nb-1; + _xValue.set(valNextPotable,_xValue.get(i)+longueurMoyenne); + } + if(valNextPotable!=-1 ){ + + tmpSousGrille_.x_=_xValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(versEcran); + double distanceEntre2Trait=Math.abs(tmpSousGrille_.x_-tmp_.x_); + int nbSousGrilles=0; + int taillePasSousgrille=0; + if(!this.modeLongueurPasSousGradX_){ + //-- on trace des nombre de cesure --// + nbSousGrilles=this.getNbXSousGraduations(); + if(nbSousGrilles!=0) + taillePasSousgrille=(int) ((distanceEntre2Trait)/nbSousGrilles); + }else{ + //-- on trace des pas par longueur --// + double ratio=(_xValue.getQuick(valNextPotable)-_xValue.getQuick(i)); + if(ratio!=0) + ratio=this.valeurPasSousGradX_/ratio; - public boolean isDrawY() { - return drawY_; - } + taillePasSousgrille=(int) (ratio*distanceEntre2Trait); + if(taillePasSousgrille!=0) + nbSousGrilles=(int) (distanceEntre2Trait/taillePasSousgrille); + } + //-- si on a des bons pas et nb de grilles --// + if(nbSousGrilles>0 && taillePasSousgrille>0 && taillePasSousgrille<distanceEntre2Trait){ - public void setDrawY(final boolean _drawY) { - if (drawY_ != _drawY) { - drawY_ = _drawY; - grilleChanged(); - } - } + for(int k=0;k<nbSousGrilles+1;k++){ + //-- on trace un trait de couleur de subgrid --// + gtl.setTypeTrait(TraceLigne.POINTILLE); + gtl.setEpaisseur((float) 0.1); + gtl.setCouleur(this.couleurSousGraduation_); + double longueur=((k)*taillePasSousgrille); + tmpSousGrille_.autoApplique(versEcran); + gtl.dessineTrait(_g, tmp_.x_+longueur, _ordxAxe,tmp_.x_+ longueur, _minYForAxe); + } + + longueurMoyenne=(int) (_xValue.getQuick(valNextPotable)-_xValue.getQuick(i)); + } - private void grilleChanged() { - repaint(); - firePropertyChange("grille", true, false); - } - - + } + } + if (drawGrid_ && w > 0) { + gtl.setTypeTrait(TraceLigne.TIRETE); + gtl.setCouleur(subColor); + gtl.setEpaisseur((float) 1); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); + } - @Override - public EbliUIProperties saveUIProperties() { - final EbliUIProperties res = super.saveUIProperties(); - res.put("graduation.x.nb", getNbXGraduations()); - res.put("graduation.y.nb", getNbYGraduations()); - res.put("graduation.x.visible", isDrawX()); - res.put("graduation.y.visible", isDrawY()); - res.put("grille.visible", isDrawGrid()); - return res; - } + } + } - @Override - public void initFrom(EbliUIProperties _p) { - super.initFrom(_p); - if (_p.isDefined("graduation.x.nb")) { - setNbGraduationX(_p.getInteger("graduation.x.nb")); - } - if (_p.isDefined("graduation.y.nb")) { - setNbGraduationX(_p.getInteger("graduation.y.nb")); - } - if (_p.isDefined("graduation.y.visible")) { - setDrawY(_p.getBoolean("graduation.y.visible")); - } - if (_p.isDefined("graduation.x.visible")) { - setDrawX(_p.getBoolean("graduation.x.visible")); - } - if (_p.isDefined("grille.visible")) { - setDrawGrid(_p.getBoolean("grille.visible")); - } - } + private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, + final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, + final double _minYForAxe) { + int minYDraw = _ordxAxe; + int maxYDraw = (int) _minYForAxe; - public void setNbGraduationX(final int _nbGraduationX) { - if (_nbGraduationX > 0 && nbGraduationX_ != _nbGraduationX) { - nbGraduationX_ = _nbGraduationX; - grilleChanged(); - } - } + // if (useCustom_) { + // tmp_.y_ = _zv.getMinY(); + // if (_yValue.size() > 0) { + // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.floor(tmp_.y_); + // if (tmp_.y_ > minYDraw) { + // minYDraw = (int) tmp_.y_; + // } + // tmp_.y_ = _zv.getMaxY(); + // if (_yValue.size() > 1) { + // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.ceil(tmp_.y_); + // if (tmp_.y_ < maxYDraw) { + // maxYDraw = (int) tmp_.y_; + // } + // } + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); + } - public void setNbGraduationY(final int _nbGraduationY) { - if (_nbGraduationY > 0 && nbGraduationY_ != _nbGraduationY) { - nbGraduationY_ = _nbGraduationY; - grilleChanged(); - } - } + final TraceLigne tl_ = new TraceLigne(); + private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, + final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { + int minXDraw = _absyAxe; + int maxXDraw = (int) _maxXForAxe; + + // if (useCustom_) { + // tmp_.x_ = _zv.getMinX(); + // if (_xValue.size() > 0) { + // tmp_.x_ = Math.min(_xValue.get(0), tmp_.x_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.x_ = Math.floor(tmp_.x_); + // if (tmp_.x_ < minXDraw) { + // minXDraw = (int) tmp_.x_; + // } + // tmp_.x_ = _zv.getMaxX(); + // if (_xValue.size() > 1) { + // tmp_.x_ = Math.max(_xValue.get(_xValue.size() - 1), tmp_.x_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.x_ = Math.ceil(tmp_.x_); + // if (tmp_.x_ < maxXDraw) { + // maxXDraw = (int) tmp_.x_; + // } + // } + + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); + } + + private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + + //-- mode manuel --// + if(!modeAutomatiqueX_){ + if(modeLongueurPasX_) + fillGraduationsWithPas(_g,this.valeurPasX_, _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); + else + fillGraduations(_g,getNbXGraduations(), _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); + return; + } + + _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); + + //_it= + while (_it.hasNext()) { + final double x = _it.currentValue(); + _xValue.add(x); + + if (font == null || !_it.isMajorTick()) { + _xStrWidth.add(0); + _xString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = _it.currentLabel(); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + } + _it.next(); + } + } + + + public boolean isModeAutomatiqueX() { + return modeAutomatiqueX_; + } + + public void setModeAutomatiqueX(boolean modeAutomatiqueX) { + this.modeAutomatiqueX_ = modeAutomatiqueX; + } + + public boolean isModeAutomatiqueY() { + return modeAutomatiqueY_; + } + + public void setModeAutomatiqueY(boolean modeAutomatiqueY) { + this.modeAutomatiqueY_ = modeAutomatiqueY; + } + + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran + * que ce soit pour le mode par taille de pas ou par nb de cesures. + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduations(Graphics2D _g,int nbGraduations,double min,double max,final TDoubleArrayList _xValue,final TIntArrayList _xStrWidth,final List _xString,FontMetrics fm ){ + + //-- distance tot a couvrir --// + final double distance=max-min; + final int taillePas=(int) (distance/nbGraduations); + double yMax=0; + + for(int i=0;i<nbGraduations+1;i++){ + int cesure=(int) (min+(taillePas*(i))); + _xValue.add(cesure); + final String currentLabel =""+cesure; + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + if(i==nbGraduations) + if(cesure<max) + nbGraduations++; + } + return yMax; + + + } + + + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran + * que ce soit pour le mode par taille de pas ou par nb de cesures. + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduationsWithPas(Graphics2D _g,int pas,double min,double max,final TDoubleArrayList _xValue,final TIntArrayList _xStrWidth,final List _xString,FontMetrics fm ){ + + //-- distance tot a couvrir --// + final double distance=max-min; + final int taillePas= pas; + if(pas==0) + return 0; + int nbGraduations=(int) (distance/taillePas); + double yMax=0; + + for(int i=0;i<nbGraduations+1;i++){ + int cesure=(int) (min+(taillePas*(i))); + _xValue.add(cesure); + final String currentLabel =""+cesure; + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + + if(i==nbGraduations){ + if(cesure<max) + nbGraduations++; + } + + } + return yMax; + + + } + + private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, + final TIntArrayList _yStrWidth, final List _yString) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + double yMax = 0; + NumberIterator it; + + + + //-- mode manuel --// + if(!modeAutomatiqueY_){ + if(modeLongueurPasY_) + yMax=fillGraduationsWithPas(_g,this.valeurPasY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); + else + yMax=fillGraduations(_g,nbGraduationY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); + return yMax; + } + + it = new NumberIterator(); + it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); + while (it.hasNext()) { + + final double x = it.currentValue(); + _yValue.add(x); + if (font == null || !it.isMajorTick()) { + _yStrWidth.add(0); + _yString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = it.currentLabel(); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + _yStrWidth.add((int) stringWidth); + _yString.add(currentLabel); + } + it.next(); + } + return yMax; + } + + // private void updateBounds(final GrBoite _zv) { + // if (useCustom_ && customBounds_ != null) { + // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); + // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); + // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); + // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); + // } + // } + + // Icon + /** + * Dessin de l'icone. + * + * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il + * est ignore ici. + * @param _g le graphics sur lequel dessiner l'icone + * @param _x lieu cible de l'icone (x) + * @param _y lieu cible de l'icone (y) + */ + public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { + super.paintIcon(_c, _g, _x, _y); + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + _g.setColor(fg); + final int w = getIconWidth(); + final int h = getIconHeight(); + for (int i = 6; i < w - 2; i += 8) { + _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); + } + for (int j = 6; j < h - 2; j += 8) { + _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); + } + } + + public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, + final GrBoite _clipReel) {} + + public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { + return null; + } + + public CtuluListSelection selection(final LinearRing _poly, final int _mode) { + return null; + } + + public LineString getSelectedLine() { + return null; + } + + /** + * Affectation de la propriete <I>boite</I>. + */ + // public void setBoite(final GrBoite _v) { + // if (boite_ != _v) { + // final GrBoite vp = boite_; + // boite_ = _v; + // firePropertyChange("boite", vp, _v); + // } + // } + public void setVisible(final boolean _v) { + // if (_v && boite_ == null) { + // boite_ = vue_.getAbstractCalque().getDomaine(); + // } + if (!_v) { + vue_.setUserInsets(null); + super.setVisible(false); + } else { + super.setVisible(_v); + } + firePropertyChange("grille", true, false); + + } + + public boolean isDrawGrid() { + return drawGrid_; + } + + public void setDrawGrid(final boolean _drawGrid) { + if (_drawGrid != drawGrid_) { + drawGrid_ = _drawGrid; + grilleChanged(); + } + } + + // public boolean isUseCustom() { + // return useCustom_; + // } + // + // public void setUseCustom(final boolean _useCustom) { + // if (useCustom_ != _useCustom) { + // useCustom_ = _useCustom; + // repaint(); + // } + // } + // + // public Envelope getCustomBounds() { + // return customBounds_ == null ? null : new Envelope(customBounds_); + // } + // + // public void setCustomBounds(final Envelope _customBounds) { + // if (customBounds_ != _customBounds) { + // customBounds_ = _customBounds; + // repaint(); + // } + // } + + public boolean isDrawX() { + return drawX_; + } + + public void setDrawX(final boolean _drawX) { + if (drawX_ != _drawX) { + drawX_ = _drawX; + grilleChanged(); + } + } + + public boolean isDrawY() { + return drawY_; + } + + public void setDrawY(final boolean _drawY) { + if (drawY_ != _drawY) { + drawY_ = _drawY; + grilleChanged(); + } + } + + public void setDrawSousGrilleY(final boolean _drawY) { + if (drawSousGrilleY_ != _drawY) { + drawSousGrilleY_ = _drawY; + grilleChanged(); + } + } + public void setDrawSousGrilleX(final boolean _drawX) { + if (drawSousGrilleX_ != _drawX) { + drawSousGrilleX_ = _drawX; + grilleChanged(); + } + } + private void grilleChanged() { + repaint(); + firePropertyChange("grille", true, false); + } + + + + @Override + public EbliUIProperties saveUIProperties() { + final EbliUIProperties res = super.saveUIProperties(); + res.put("graduation.x.nb", getNbXGraduations()); + res.put("graduation.y.nb", getNbYGraduations()); + res.put("graduation.x.visible", isDrawX()); + res.put("graduation.y.visible", isDrawY()); + res.put("grille.visible", isDrawGrid()); + return res; + } + + @Override + public void initFrom(EbliUIProperties _p) { + super.initFrom(_p); + if (_p.isDefined("graduation.x.nb")) { + setNbGraduationX(_p.getInteger("graduation.x.nb")); + } + if (_p.isDefined("graduation.y.nb")) { + setNbGraduationX(_p.getInteger("graduation.y.nb")); + } + if (_p.isDefined("graduation.y.visible")) { + setDrawY(_p.getBoolean("graduation.y.visible")); + } + if (_p.isDefined("graduation.x.visible")) { + setDrawX(_p.getBoolean("graduation.x.visible")); + } + if (_p.isDefined("grille.visible")) { + setDrawGrid(_p.getBoolean("grille.visible")); + } + } + + public void setNbGraduationX(final int _nbGraduationX) { + if (_nbGraduationX > 0 /*&& nbGraduationX_ != _nbGraduationX*/) { + nbGraduationX_ = _nbGraduationX; + modeLongueurPasX_=false; + grilleChanged(); + } + } + + + public void setLenghtStepsX(final int _lenghtSteps){ + GrBoite boite= vue_.getViewBoite(); + if(_lenghtSteps==0) + return; + double max=boite.getMaxX(); + int nbGraduationsX=(int) (max/_lenghtSteps); + if(nbGraduationsX+1>0 /*&& nbGraduationsX+1!=nbGraduationX_*/){ + nbGraduationX_=nbGraduationsX; + valeurPasX_=_lenghtSteps; + modeLongueurPasX_=true; + grilleChanged(); + } + + } + + public void setLenghtStepsY(final int _lenghtSteps){ + GrBoite boite= vue_.getViewBoite(); + if(_lenghtSteps==0) + return; + int nbGraduationsY=(int) (boite.getMaxY()/_lenghtSteps); + if(nbGraduationsY>0 /*&& nbGraduationsY!=nbGraduationY_*/){ + nbGraduationY_ = nbGraduationsY; + valeurPasY_=_lenghtSteps; + modeLongueurPasY_=true; + grilleChanged(); + } + + } + + + public void setNbGraduationY(final int _nbGraduationY) { + if (_nbGraduationY > 0 /*&& nbGraduationY_ != _nbGraduationY*/) { + nbGraduationY_ = _nbGraduationY; + modeLongueurPasY_=false; + grilleChanged(); + } + } + + + + public void setLenghtStepsSousGradX(final int _lenghtSteps){ + GrBoite boite= vue_.getViewBoite(); + if(_lenghtSteps==0) + return; + int nbSousGraduationsX=(int) (boite.getMaxY()/_lenghtSteps); + if(nbSousGraduationsX>0 ){ + nbSousGraduationX_ = nbSousGraduationsX; + valeurPasSousGradX_=_lenghtSteps; + modeLongueurPasSousGradX_=true; + grilleChanged(); + } + + } + + + public void setNbGraduationSousGradX(final int _nbGraduation) { + if (_nbGraduation > 0 ) { + nbSousGraduationX_ = _nbGraduation; + modeLongueurPasSousGradX_=false; + grilleChanged(); + } + } + + + public void setLenghtStepsSousGradY(final int _lenghtSteps){ + GrBoite boite= vue_.getViewBoite(); + if(_lenghtSteps==0) + return; + int nbSousGraduationsY=(int) (boite.getMaxY()/_lenghtSteps); + if(nbSousGraduationsY>0 ){ + nbSousGraduationY_ = nbSousGraduationsY; + valeurPasSousGradY_=_lenghtSteps; + modeLongueurPasSousGradY_=true; + grilleChanged(); + } + + } + + + public void setNbGraduationSousGradY(final int _nbGraduation) { + if (_nbGraduation > 0 ) { + nbSousGraduationY_ = _nbGraduation; + modeLongueurPasSousGradY_=false; + grilleChanged(); + } + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-02 16:00:39 UTC (rev 4435) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-02 19:33:52 UTC (rev 4436) @@ -634,4 +634,11 @@ Redimensionner proportionnellement la taille de la frame=Proportional resizing of the frame Conserver le ratio hauteur/largeur=Preserve width/height ratio Ne pas conserver le ratio hauteur/largeur=Do not preserve width/height ratio -Dupliquer la sc\xE8ne= Duplicate the scene \ No newline at end of file +Dupliquer la sc\xE8ne= Duplicate the scene +Taille des pas= Step's lenght +Manuel: Nb graduations=Manual: nb of graduations +Manuel: taille des pas=Manual: Step's lenght +Automatique=Automatic +Grille auto activ\xE9e=Automatic Grid activated +Couleur Grille=Grid's Color +Couleur Sous Grille=SubGrid's color Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-02 16:00:39 UTC (rev 4435) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-02 19:33:52 UTC (rev 4436) @@ -1,13 +1,17 @@ package org.fudaa.fudaa.sig.layer; +import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Color; import java.awt.Container; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JColorChooser; import javax.swing.JComponent; import javax.swing.JDialog; +import javax.swing.JLabel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -21,9 +25,12 @@ import org.fudaa.ebli.trace.TraceIconButton; import org.fudaa.ebli.volume.controles.BControleVisible; +import sun.security.krb5.internal.PAEncTSEnc; + import com.memoire.bu.BuButton; import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuComboBox; import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuLabel; import com.memoire.bu.BuPanel; @@ -38,252 +45,585 @@ */ public final class FSigGrillePalette extends EbliActionPaletteAbstract { - final ZCalqueGrille target_; + final ZCalqueGrille target_; - // /** - // * @author fred deniger - // * @version $Id: FSigGrillePalette.java,v 1.2 2007-04-16 16:35:35 deniger Exp $ - // */ - // final class BoundsActionListener implements ActionListener { - // public void actionPerformed(final ActionEvent _e) { - // Envelope env = target_.getCustomBounds(); - // if (env == null) { - // env = new Envelope(); - // final GrBoite boite = target_.getDomaine(); - // if (boite != null) { - // env.expandToInclude(boite.getMinX(), boite.getMinY()); - // env.expandToInclude(boite.getMaxX(), boite.getMaxY()); - // } - // } - // final CtuluDialogPanel pnBounds = new CtuluDialogPanel(); - // pnBounds.setLayout(new BuGridLayout(2, 2, 2)); - // final BuTextField tfMinX = pnBounds.addLabelDoubleText("Min X"); - // tfMinX.setValue(CtuluLib.getDouble(env.getMinX())); - // final BuTextField tfMaxX = pnBounds.addLabelDoubleText("Max X"); - // tfMaxX.setValue(CtuluLib.getDouble(env.getMaxX())); - // final BuTextField tfMinY = pnBounds.addLabelDoubleText("Min Y"); - // tfMinY.setValue(CtuluLib.getDouble(env.getMinY())); - // final BuTextField tfMaxY = pnBounds.addLabelDoubleText("Max Y"); - // tfMaxY.setValue(CtuluLib.getDouble(env.getMaxY())); - // if (pnBounds.afficheModaleOk(CtuluLibSwing.getFrameAncestorHelper(target_))) { - // target_.setCustomBounds(new Envelope(((Double) tfMinX.getValue()).doubleValue(), ((Double) tfMaxX.getValue()) - // .doubleValue(), ((Double) tfMinY.getValue()).doubleValue(), ((Double) tfMaxY.getValue()).doubleValue())); - // } - // - // } - // } + // /** + // * @author fred deniger + // * @version $Id: FSigGrillePalette.java,v 1.2 2007-04-16 16:35:35 deniger Exp $ + // */ + // final class BoundsActionListener implements ActionListener { + // public void actionPerformed(final ActionEvent _e) { + // Envelope env = target_.getCustomBounds(); + // if (env == null) { + // env = new Envelope(); + // final GrBoite boite = target_.getDomaine(); + // if (boite != null) { + // env.expandToInclude(boite.getMinX(), boite.getMinY()); + // env.expandToInclude(boite.getMaxX(), boite.getMaxY()); + // } + // } + // final CtuluDialogPanel pnBounds = new CtuluDialogPanel(); + // pnBounds.setLayout(new BuGridLayout(2, 2, 2)); + // final BuTextField tfMinX = pnBounds.addLabelDoubleText("Min X"); + // tfMinX.setValue(CtuluLib.getDouble(env.getMinX())); + // final BuTextField tfMaxX = pnBounds.addLabelDoubleText("Max X"); + // tfMaxX.setValue(CtuluLib.getDouble(env.getMaxX())); + // final BuTextField tfMinY = pnBounds.addLabelDoubleText("Min Y"); + // tfMinY.setValue(CtuluLib.getDouble(env.getMinY())); + // final BuTextField tfMaxY = pnBounds.addLabelDoubleText("Max Y"); + // tfMaxY.setValue(CtuluLib.getDouble(env.getMaxY())); + // if (pnBounds.afficheModaleOk(CtuluLibSwing.getFrameAncestorHelper(target_))) { + // target_.setCustomBounds(new Envelope(((Double) tfMinX.getValue()).doubleValue(), ((Double) tfMaxX.getValue()) + // .doubleValue(), ((Double) tfMinY.getValue()).doubleValue(), ((Double) tfMaxY.getValue()).doubleValue())); + // } + // + // } + // } - ZEbliCalquesPanel panel_; + ZEbliCalquesPanel panel_; - /** - * @param _name - * @param _icon - * @param _name2 - */ - FSigGrillePalette(final ZCalqueGrille _target, final ZEbliCalquesPanel _panel) { - super(EbliResource.EBLI.getString("Rep\xE8re"), EbliResource.EBLI.getIcon("repere"), "CHANGE_REFERENCE"); - target_ = _target; - panel_ = _panel; - } + /** + * @param _name + * @param _icon + * @param _name2 + */ + FSigGrillePalette(final ZCalqueGrille _target, final ZEbliCalquesPanel _panel) { + super(EbliResource.EBLI.getString("Rep\xE8re"), EbliResource.EBLI.getIcon("repere"), "CHANGE_REFERENCE"); + target_ = _target; + panel_ = _panel; + } - protected BuTextField addDoubleText(final Container _c) { - final BuTextField r = new BuTextField(10); - r.setCharValidator(BuCharValidator.DOUBLE); - r.setStringValidator(BuStringValidator.DOUBLE); - r.setValueValidator(BuValueValidator.DOUBLE); - _c.add(r); - return r; - } + protected BuTextField addDoubleText(final Container _c) { + final BuTextField r = new BuTextField(10); + r.setCharValidator(BuCharValidator.DOUBLE); + r.setStringValidator(BuStringValidator.DOUBLE); + r.setValueValidator(BuValueValidator.DOUBLE); + _c.add(r); + return r; + } - @Override - public JComponent buildContentPane() { - final BuPanel content = new BuPanel(new BuVerticalLayout(2)); - content.add(createMainProperties()); - content.add(createAxis()); - content.add(createZoom()); - return content; - } + @Override + public JComponent buildContentPane() { + final BuPanel content = new BuPanel(new BuVerticalLayout(2)); + content.add(createMainProperties()); + content.add(createAxis()); + content.add(createZoom()); + return content; + } - private BuPanel createAxis() { - final BuPanel pnXY = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnXY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axes"))); - pnXY.add(new BuLabel("")); - pnXY.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); - final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe X")); - cbX.setSelected(target_.isDrawX()); - cbX.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setDrawX(cbX.isSelected()); - } - }); - pnXY.add(cbX); - final BuTextField btGraduationX = BuTextField.createIntegerField(); - btGraduationX.setValue(new Integer(target_.getNbXGraduations())); - pnXY.add(btGraduationX); - btGraduationX.addActionListener(new ActionListener() { + private static String MANUEL1="MANUEL1"; + private static String MANUEL2="MANUEL2"; + private static String AUTO="AUTO"; + /** + * Indique la facon de calculer les graduations. + * pour l'axe des x. + */ + boolean modeAutomatiqueX_=true; + /** + * Indique la facon de calculer les graduations. + * pour l'axe des y. + */ + boolean modeAutomatiqueY_=true; + - public void actionPerformed(final ActionEvent _e) { - final int newVal = ((Integer) btGraduationX.getValue()).intValue(); - if (newVal < 0 || newVal > 5000) { - btGraduationX.setValue(new Integer(target_.getNbXGraduations())); - } else { - target_.setNbGraduationX(newVal); - } + + private BuPanel createAxis() { + BuPanel panelX=new BuPanel(new BorderLayout()); + panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axes X"))); + final BuComboBox combo=new BuComboBox(new String[]{EbliLib.getS("Manuel: Nb graduations"),EbliLib.getS("Manuel: longueur des pas"),EbliLib.getS("Automatique: Nb graduations"),EbliLib.getS("Automatique: longueur des pas")}); + final CardLayout layoutCardX=new CardLayout(); + panelX.add(combo,BorderLayout.NORTH); + final BuPanel panelCardX=new BuPanel(layoutCardX); + //panelCardX.setLayout(layoutCardX); + panelX.add(combo,BorderLayout.NORTH); + panelX.add(panelCardX,BorderLayout.CENTER); + combo.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + modeAutomatiqueX_=false; + if(combo.getSelectedIndex()==0) + layoutCardX.show(panelCardX, MANUEL1); + else + if(combo.getSelectedIndex()==1) + layoutCardX.show(panelCardX,MANUEL2); + else + if(combo.getSelectedIndex()==2){ + layoutCardX.show(panelCardX, MANUEL1); + modeAutomatiqueX_=true; + } + else + if(combo.getSelectedIndex()==3){ + layoutCardX.show(panelCardX, MANUEL2); + modeAutomatiqueX_=true; + } + } - } + }); - }); - - final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe Y")); - cbY.setSelected(target_.isDrawY()); - cbY.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setDrawY(cbY.isSelected()); - } - }); - pnXY.add(cbY); + final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe X")); + cbX.setSelected(target_.isDrawX()); + cbX.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setDrawX(cbX.isSelected()); + } - final BuTextField btGraduationY = BuTextField.createIntegerField(); - btGraduationY.setValue(new Integer(target_.getNbYGraduations())); - pnXY.add(btGraduationY); - btGraduationY.addActionListener(new ActionListener() { + }); + panelX.add(cbX,BorderLayout.SOUTH); - public void actionPerformed(final ActionEvent _e) { - final int newVal = ((Integer) btGraduationY.getValue()).intValue(); - if (newVal < 0 || newVal > 5000) { - btGraduationY.setValue(new Integer(target_.getNbYGraduations())); - } else { - target_.setNbGraduationY(newVal); - } + //-- panel x manuel 1: choix par nb de cesures --// + final BuPanel pnXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); + pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + final BuTextField btGraduationX = BuTextField.createIntegerField(); + btGraduationX.setColumns(20); + btGraduationX.setValue(new Integer(target_.getNbXGraduations())); + pnXmanu1.add(btGraduationX); + btGraduationX.addActionListener(new ActionListener() { - } + public void actionPerformed(final ActionEvent _e) { + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if (newVal < 0 || newVal > 5000) { + btGraduationX.setValue(new Integer(target_.getNbXGraduations())); + } else { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); + } - }); - return pnXY; - } + } - private BuPanel createMainProperties() { - final BuPanel pn = new BuPanel(); - pn.setBorder(CtuluLibSwing.createTitle... [truncated message content] |
From: <de...@us...> - 2009-02-02 22:46:08
|
Revision: 4437 http://fudaa.svn.sourceforge.net/fudaa/?rev=4437&view=rev Author: deniger Date: 2009-02-02 22:46:04 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/PaletteSelecteurCouleurPlage.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.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/MvProfileBuilderFromLine.java 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/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSig.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigAttibuteTypeManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigAttributeEditorPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigAttributeTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigExportImportAttributesMapper.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigFilterZone.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigFilterZoneActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigGeomDataClosedLayerFilter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigGeomSrcData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigGeomSrcDataUtils.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLayerGroupSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLayerLineAddedSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLayerPointAddedSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLib.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLineSingleModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLoaderPreviewer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigProjectPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigProjetDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigResource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVarAttrMapperTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVarPolygoneModifierActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVariableModifResult.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVariableModifResultSub.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVisuPanelDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigFilleDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigImageImportAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerExporter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerFilter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerGroup.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerLineEditable.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerPointEditable.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerGroupPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerLinePersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerMultiPointPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerPointPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSIgImageWizartStepCalageUI.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigDataModelSinusxAdapter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigDataModelStoreAdapter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoadResult.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderCsv.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderGIS.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderGrid.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderI.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderInp.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderReflucadSEM.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRefluxRefondeResult.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarCox.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarInx.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarSem.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarSt.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderSinusX.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalage.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalageLogic.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepImage.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardTask.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigVariableInterpolator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardDefaultPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileMng.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardImport.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardImportHelper.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardImportStepDestination.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardVariableModifier.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLib.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.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/TrPostCourbeBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModelPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFusionProjet.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/TrPostMultiSourceActivator2.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/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 19:33:52 UTC (rev 4436) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 22:46:04 UTC (rev 4437) @@ -42,974 +42,922 @@ * @author Guillaume Desnoix */ public class ZCalqueGrille extends ZCalqueAffichageDonnees { - // Proprietes - // private GrBoite boite_; - boolean drawGrid_; - boolean drawX_ = true; - boolean drawY_ = true; - // Envelope customBounds_; - // boolean useCustom_; + // Proprietes + // private GrBoite boite_; + boolean drawGrid_; + boolean drawX_ = true; + boolean drawY_ = true; + // Envelope customBounds_; + // boolean useCustom_; - int nbGraduationX_ = 10; - int nbGraduationY_ = 10; + int nbGraduationX_ = 10; + int nbGraduationY_ = 10; - //-- sous graduations --// - int nbSousGraduationX_ = 2; - //-- sous graduations --// - int nbSousGraduationY_ = 2; + // -- sous graduations --// + int nbSousGraduationX_ = 2; + // -- sous graduations --// + int nbSousGraduationY_ = 2; - final BVueCalque vue_; + final BVueCalque vue_; + /** + * Indique la facon de calculer les graduations. pour l'axe des x. + */ + boolean modeAutomatiqueX_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des y. + */ + boolean modeAutomatiqueY_ = false; - /** - * Indique la facon de calculer les graduations. - * pour l'axe des x. - */ - boolean modeAutomatiqueX_=false; - /** - * Indique la facon de calculer les graduations. - * pour l'axe des y. - */ - boolean modeAutomatiqueY_=false; + /** + * Indique si on utilise par taille de pas ou par nombre de graduations + */ + boolean modeLongueurPasX_ = false; + boolean modeLongueurPasY_ = false; + /** + * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. + */ + int valeurPasX_; + int valeurPasY_; + boolean drawSousGrilleX_ = false; + boolean drawSousGrilleY_ = false; + boolean modeLongueurPasSousGradX_ = false; + boolean modeLongueurPasSousGradY_ = false; - /** - * Indique si on utilise par taille de pas ou par nombre de graduations - */ - boolean modeLongueurPasX_=false; - boolean modeLongueurPasY_=false; + int valeurPasSousGradX_; + int valeurPasSousGradY_; - /** - * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. - */ - int valeurPasX_; - int valeurPasY_; + private Color couleurSousGraduation_ = Color.blue; - boolean drawSousGrilleX_ = false; - boolean drawSousGrilleY_ = false; + public ZCalqueGrille(final BVueCalque _vue) { + super(); + vue_ = _vue; + setDestructible(false); + setName("cqGrille"); + setTitle(EbliLib.getS("Grille")); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); + } - boolean modeLongueurPasSousGradX_=false; - boolean modeLongueurPasSousGradY_=false; + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } - int valeurPasSousGradX_; - int valeurPasSousGradY_; + public void changeZoom(double minx, double miny, double maxx, double maxy) { + vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); + } - private Color couleurSousGraduation_=Color.blue; + public int getNbXGraduations() { + return nbGraduationX_; + } - public ZCalqueGrille(final BVueCalque _vue) { - super(); - vue_ = _vue; - setDestructible(false); - setName("cqGrille"); - setTitle(EbliLib.getS("Grille")); - // setForeground(new Color(204, 153, 0)); - setForeground(Color.BLACK); - } + public int getNbYGraduations() { + return nbGraduationY_; + } - public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } + public int getNbXSousGraduations() { + return nbSousGraduationX_; + } - public void changeZoom(double minx, double miny, double maxx, double maxy) { - vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); - } + public int getNbYSousGraduations() { + return nbSousGraduationY_; + } - public int getNbXGraduations() { - return nbGraduationX_; - } + public void setSousGraduationColor(Color c) { + if (couleurSousGraduation_ != c) { + couleurSousGraduation_ = c; + grilleChanged(); + } - public int getNbYGraduations() { - return nbGraduationY_; - } + } - public int getNbXSousGraduations() { - return nbSousGraduationX_; - } + /** + * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. + */ + // public GrBoite getBoite() { + // return boite_; + // } + public GrBoite getDomaine() { + return null; + // GrBoite r = null; + // if (isVisible()) { + // GrBoite d = null; + // d = super.getDomaine(); + // r = getBoite(); + // if (d != null) { + // if (r == null) { + // r = d; + // } else { + // r = r.union(d); + // } + // } + // } + // return r; + } - public int getNbYSousGraduations() { - return nbSousGraduationY_; - } + public GrBoite getDomaineOnSelected() { + return getDomaine(); + } - public void setSousGraduationColor(Color c){ - if(couleurSousGraduation_!=c){ - couleurSousGraduation_=c; - grilleChanged(); - } + public boolean isCouleurModifiable() { + return true; + } - } + public int getTiretLength() { + return 3; + } - /** - * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. - */ - // public GrBoite getBoite() { - // return boite_; - // } - public GrBoite getDomaine() { - return null; - // GrBoite r = null; - // if (isVisible()) { - // GrBoite d = null; - // d = super.getDomaine(); - // r = getBoite(); - // if (d != null) { - // if (r == null) { - // r = d; - // } else { - // r = r.union(d); - // } - // } - // } - // return r; - } + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + GrBoite domaine = vue_.getAbstractCalque().getDomaine(); + final GrBoite zv = _clipReel.intersectionXY(domaine); - public GrBoite getDomaineOnSelected() { - return getDomaine(); - } + if (zv == null) { return; } + // updateBounds(zv); + final GrBoite targetBoite = new GrBoite(); + targetBoite.ajuste(0, 0, 0); + // la boite d'affichage - public boolean isCouleurModifiable() { - return true; - } + if (!_versEcran.isSame(getVersEcran())) { return; } + targetBoite.ajuste(getWidth(), getHeight(), 0); + final Color old = _g.getColor(); + final Font oldFont = _g.getFont(); + // la fonte + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final TDoubleArrayList xValue = new TDoubleArrayList(20); + final TIntArrayList xStrWidth = new TIntArrayList(20); + final List xString = new ArrayList(20); + final NumberIterator it = new NumberIterator(); + final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; - public int getTiretLength() { - return 3; - } + if (isXPainted) { + computeXValues(zv, _g, xValue, xStrWidth, xString, it); + } + double yMax = 0; + final TDoubleArrayList yValue = new TDoubleArrayList(20); + final TIntArrayList yStrWidth = new TIntArrayList(20); + final List yString = new ArrayList(20); + final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; + if (isYPainted) { + yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); + } - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - GrBoite domaine = vue_.getAbstractCalque().getDomaine(); - final GrBoite zv = _clipReel.intersectionXY(domaine); + // boolean rapide = isRapide(); + final GrMorphisme versEcran = _versEcran; + final int tiret = getTiretLength(); + final int marge = 1; + int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); + final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; + int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); + vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); - if (zv == null) { return; } - // updateBounds(zv); - final GrBoite targetBoite = new GrBoite(); - targetBoite.ajuste(0, 0, 0); - // la boite d'affichage + final GrBoite ecranBoite = domaine.applique(_versEcran); + if (ecranBoite.getMinX() - 5 > absyAxe) { + absyAxe = (int) (ecranBoite.getMinX() - 5); + } + if (ecranBoite.getMaxY() + 5 < ordxAxe) { + ordxAxe = (int) (ecranBoite.getMaxY() + 5); + } + if (isXPainted) { + fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); - if (!_versEcran.isSame(getVersEcran())) { return; } - targetBoite.ajuste(getWidth(), getHeight(), 0); - final Color old = _g.getColor(); - final Font oldFont = _g.getFont(); - // la fonte - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final TDoubleArrayList xValue = new TDoubleArrayList(20); - final TIntArrayList xStrWidth = new TIntArrayList(20); - final List xString = new ArrayList(20); - final NumberIterator it = new NumberIterator(); - final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; + } - if (isXPainted) { - computeXValues(zv, _g, xValue, xStrWidth, xString, it); - } - double yMax = 0; - final TDoubleArrayList yValue = new TDoubleArrayList(20); - final TIntArrayList yStrWidth = new TIntArrayList(20); - final List yString = new ArrayList(20); - final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; - if (isYPainted) { - yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); - } + // l'axe des x + final double maxXForAxe = ecranBoite.getMaxX() - marge; - // boolean rapide = isRapide(); - final GrMorphisme versEcran = _versEcran; - final int tiret = getTiretLength(); - final int marge = 1; - int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); - final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; - int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); - vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); + // l'axe des y + final double minYForAxe = ecranBoite.getMinY() + marge; + // les graduation en x - final GrBoite ecranBoite = domaine.applique(_versEcran); - if (ecranBoite.getMinX() - 5 > absyAxe) { - absyAxe = (int) (ecranBoite.getMinX() - 5); - } - if (ecranBoite.getMaxY() + 5 < ordxAxe) { - ordxAxe = (int) (ecranBoite.getMaxY() + 5); - } - if (isXPainted) { - fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); + final int ascent = fm == null ? 0 : fm.getAscent(); + final int ordXString = ordxAxe + tiret + ascent; + if (isXPainted) { + drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); + drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, + ordXString); + } - } + // y - // l'axe des x - final double maxXForAxe = ecranBoite.getMaxX() - marge; + if (isYPainted) { + fillYZone(_g, targetBoite, absyAxe, ecranBoite); + drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); + drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); + } + _g.setColor(old); + _g.setFont(oldFont); + } - // l'axe des y - final double minYForAxe = ecranBoite.getMinY() + marge; - // les graduation en x + void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite) { + if (_ecranBoite.getMaxX() > _ordxAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); + } + } - final int ascent = fm == null ? 0 : fm.getAscent(); - final int ordXString = ordxAxe + tiret + ascent; - if (isXPainted) { - drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); - drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, - ordXString); - } + private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { + if (_ecranBoite.getMinX() < _absyAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); + } + } - // y + protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, + final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _maxXForAxe) { + final int nb = _yString.size(); + final int tiret = getTiretLength(); + final Font font = getFont(); + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final int ascent = fm == null ? 0 : fm.getAscent(); + int idxStr = -1; + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + GrPoint tmpSousGrille_ = new GrPoint(); + double longueurMoyenne = 0; + for (int i = 0; i < nb; i++) { + tmp_.y_ = _yValue.getQuick(i); + tmp_.autoApplique(_versEcran); + if (tmp_.y_ > _ordxAxe) { + continue; + } + if (tmp_.y_ < _ecranBoite.getMinY()) { + break; + } + // le tiret + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.setCouleur(fg); + final int w = _yStrWidth.getQuick(i); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); + if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { + _g.setColor(fg); + _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); + idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); + } - if (isYPainted) { - fillYZone(_g, targetBoite, absyAxe, ecranBoite); - drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); - drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); - } - _g.setColor(old); - _g.setFont(oldFont); - } + // -- on trace ou non les sous graduations --// + if ((w > 0 || i == nb - 2) && drawSousGrilleY_ && i > 0 && i < nb - 1) { + int valNextPotable = -1; + for (int j = i + 1; valNextPotable == -1 && j < _yStrWidth.size(); j++) + if (_yStrWidth.getQuick(j) > 0) valNextPotable = j; - void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite) { - if (_ecranBoite.getMaxX() > _ordxAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); - } - } + if (i == nb - 2) { + // -- la fin il faut creer le nouveau + valNextPotable = nb - 1; + _yValue.set(valNextPotable, _yValue.get(i) + longueurMoyenne); + } - private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { - if (_ecranBoite.getMinX() < _absyAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); - } - } + if (valNextPotable != -1) { - protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, - final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _maxXForAxe) { - final int nb = _yString.size(); - final int tiret = getTiretLength(); - final Font font = getFont(); - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final int ascent = fm == null ? 0 : fm.getAscent(); - int idxStr = -1; - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - GrPoint tmpSousGrille_=new GrPoint(); - double longueurMoyenne=0; - for (int i = 0; i < nb; i++) { - tmp_.y_ = _yValue.getQuick(i); - tmp_.autoApplique(_versEcran); - if (tmp_.y_ > _ordxAxe) { - continue; - } - if (tmp_.y_ < _ecranBoite.getMinY()) { - break; - } - // le tiret - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.setCouleur(fg); - final int w = _yStrWidth.getQuick(i); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); - if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { - _g.setColor(fg); - _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); - idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); - } - - - //-- on trace ou non les sous graduations --// - if((w > 0 || i==nb-2) && drawSousGrilleY_ && i>0 && i<nb-1){ - int valNextPotable=-1; - for(int j=i+1;valNextPotable==-1 &&j<_yStrWidth.size();j++) - if(_yStrWidth.getQuick(j)>0) - valNextPotable=j; - - if(i==nb-2){ - //-- la fin il faut creer le nouveau - valNextPotable=nb-1; - _yValue.set(valNextPotable,_yValue.get(i)+longueurMoyenne); - } - - if(valNextPotable!=-1){ + tmpSousGrille_.y_ = _yValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(_versEcran); + double distanceEntre2Trait = Math.abs(tmpSousGrille_.y_ - tmp_.y_); + int nbSousGrilles = 0; + int taillePasSousgrille = 0; + if (!this.modeLongueurPasSousGradY_) { + // -- on trace des nombre de cesure --// + nbSousGrilles = this.getNbYSousGraduations(); + if (nbSousGrilles != 0) taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); + } else { + // -- on trace des pas par longueur --// + double ratio = (_yValue.getQuick(valNextPotable) - _yValue.getQuick(i)); + if (ratio != 0) ratio = this.valeurPasSousGradY_ / ratio; - tmpSousGrille_.y_=_yValue.getQuick(valNextPotable); - tmpSousGrille_.autoApplique(_versEcran); - double distanceEntre2Trait=Math.abs(tmpSousGrille_.y_-tmp_.y_); - int nbSousGrilles=0; - int taillePasSousgrille=0; - if(!this.modeLongueurPasSousGradY_){ - //-- on trace des nombre de cesure --// - nbSousGrilles=this.getNbYSousGraduations(); - if(nbSousGrilles!=0) - taillePasSousgrille=(int) ((distanceEntre2Trait)/nbSousGrilles); - }else{ - //-- on trace des pas par longueur --// - double ratio=(_yValue.getQuick(valNextPotable)-_yValue.getQuick(i)); - if(ratio!=0) - ratio=this.valeurPasSousGradY_/ratio; + taillePasSousgrille = (int) (ratio * distanceEntre2Trait); + if (taillePasSousgrille != 0) nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); + } + // -- si on a des bons pas et nb de grilles --// + if (nbSousGrilles > 0 && taillePasSousgrille > 0 && taillePasSousgrille < distanceEntre2Trait) { - taillePasSousgrille=(int) (ratio*distanceEntre2Trait); - if(taillePasSousgrille!=0) - nbSousGrilles=(int) (distanceEntre2Trait/taillePasSousgrille); - } - //-- si on a des bons pas et nb de grilles --// - if(nbSousGrilles>0 && taillePasSousgrille>0 && taillePasSousgrille<distanceEntre2Trait){ + for (int k = 0; k < nbSousGrilles + 1; k++) { + // -- on trace un trait de couleur de subgrid --// + tl_.setTypeTrait(TraceLigne.POINTILLE); + tl_.setEpaisseur((float) 0.1); + tl_.setCouleur(this.couleurSousGraduation_); + double longueur = ((k) * taillePasSousgrille); + tmpSousGrille_.autoApplique(_versEcran); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_ + longueur, _maxXForAxe, tmp_.y_ + longueur); + } + longueurMoyenne = (int) (_yValue.getQuick(valNextPotable) - _yValue.getQuick(i)); + } - for(int k=0;k<nbSousGrilles+1;k++){ - //-- on trace un trait de couleur de subgrid --// - tl_.setTypeTrait(TraceLigne.POINTILLE); - tl_.setEpaisseur((float) 0.1); - tl_.setCouleur(this.couleurSousGraduation_); - double longueur=((k)*taillePasSousgrille); - tmpSousGrille_.autoApplique(_versEcran); - tl_.dessineTrait(_g,_absyAxe, tmp_.y_+longueur,_maxXForAxe,tmp_.y_+ longueur); - } - longueurMoyenne=(int) (_yValue.getQuick(valNextPotable)-_yValue.getQuick(i)); - } + } + } - } - } - - - if (drawGrid_ && w > 0) { - tl_.setTypeTrait(TraceLigne.TIRETE); - tl_.setEpaisseur(1); - tl_.setCouleur(subColor); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); - } - } - } + if (drawGrid_ && w > 0) { + tl_.setTypeTrait(TraceLigne.TIRETE); + tl_.setEpaisseur(1); + tl_.setCouleur(subColor); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); + } + } + } - private Color getSubColor() { - Color subColor = attenueCouleur(getForeground()); - if (isAttenue()) { - subColor = attenueCouleur(subColor); - } - return subColor; - } + private Color getSubColor() { + Color subColor = attenueCouleur(getForeground()); + if (isAttenue()) { + subColor = attenueCouleur(subColor); + } + return subColor; + } - private Color getDrawColor() { - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - return fg; - } + private Color getDrawColor() { + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + return fg; + } - final GrPoint tmp_ = new GrPoint(); + final GrPoint tmp_ = new GrPoint(); - private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { - final int nb = _xString.size(); - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - int idxStr = -1; - final GrMorphisme versEcran = getVersEcran(); - final int tiret = getTiretLength(); - final TraceLigne gtl = new TraceLigne(); - GrPoint tmpSousGrille_=new GrPoint(); - - double longueurMoyenne=0; - - for (int i = 0; i < nb; i++) { - tmp_.x_ = _xValue.getQuick(i); - tmp_.autoApplique(versEcran); - if (tmp_.x_ < _absyAxe) { - continue; - } - if (tmp_.x_ > _ecranBoite.getMaxX()) { - break; - } - // le tiret - gtl.setTypeTrait(TraceLigne.LISSE); - gtl.setCouleur(fg); - final int w = _xStrWidth.getQuick(i); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); - if (w > 0) { - final int start = (int) (tmp_.x_ - w / 2D); - if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { - _g.setColor(fg); - _g.drawString((String) _xString.get(i), start, _ordXString); - idxStr = start + w; - } - } + private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { + final int nb = _xString.size(); + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + int idxStr = -1; + final GrMorphisme versEcran = getVersEcran(); + final int tiret = getTiretLength(); + final TraceLigne gtl = new TraceLigne(); + GrPoint tmpSousGrille_ = new GrPoint(); + double longueurMoyenne = 0; + for (int i = 0; i < nb; i++) { + tmp_.x_ = _xValue.getQuick(i); + tmp_.autoApplique(versEcran); + if (tmp_.x_ < _absyAxe) { + continue; + } + if (tmp_.x_ > _ecranBoite.getMaxX()) { + break; + } + // le tiret + gtl.setTypeTrait(TraceLigne.LISSE); + gtl.setCouleur(fg); + final int w = _xStrWidth.getQuick(i); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); + if (w > 0) { + final int start = (int) (tmp_.x_ - w / 2D); + if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { + _g.setColor(fg); + _g.drawString((String) _xString.get(i), start, _ordXString); + idxStr = start + w; + } + } - //-- on trace ou non les sous graduations --// - if((w > 0 || i==nb-2) && drawSousGrilleX_ && i<nb-1){ - int valNextPotable=-1; - for(int j=i+1;valNextPotable==-1 &&j<_xStrWidth.size();j++) - if(_xStrWidth.getQuick(j)>0) - valNextPotable=j; - if(i==nb-2){ - //-- la fin il faut creer le nouveau - valNextPotable=nb-1; - _xValue.set(valNextPotable,_xValue.get(i)+longueurMoyenne); - } - if(valNextPotable!=-1 ){ - - tmpSousGrille_.x_=_xValue.getQuick(valNextPotable); - tmpSousGrille_.autoApplique(versEcran); - double distanceEntre2Trait=Math.abs(tmpSousGrille_.x_-tmp_.x_); - int nbSousGrilles=0; - int taillePasSousgrille=0; - if(!this.modeLongueurPasSousGradX_){ - //-- on trace des nombre de cesure --// - nbSousGrilles=this.getNbXSousGraduations(); - if(nbSousGrilles!=0) - taillePasSousgrille=(int) ((distanceEntre2Trait)/nbSousGrilles); - }else{ - //-- on trace des pas par longueur --// - double ratio=(_xValue.getQuick(valNextPotable)-_xValue.getQuick(i)); - if(ratio!=0) - ratio=this.valeurPasSousGradX_/ratio; + // -- on trace ou non les sous graduations --// + if ((w > 0 || i == nb - 2) && drawSousGrilleX_ && i < nb - 1) { + int valNextPotable = -1; + for (int j = i + 1; valNextPotable == -1 && j < _xStrWidth.size(); j++) + if (_xStrWidth.getQuick(j) > 0) valNextPotable = j; + if (i == nb - 2) { + // -- la fin il faut creer le nouveau + valNextPotable = nb - 1; + _xValue.set(valNextPotable, _xValue.get(i) + longueurMoyenne); + } + if (valNextPotable != -1) { - taillePasSousgrille=(int) (ratio*distanceEntre2Trait); - if(taillePasSousgrille!=0) - nbSousGrilles=(int) (distanceEntre2Trait/taillePasSousgrille); - } - //-- si on a des bons pas et nb de grilles --// - if(nbSousGrilles>0 && taillePasSousgrille>0 && taillePasSousgrille<distanceEntre2Trait){ + tmpSousGrille_.x_ = _xValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(versEcran); + double distanceEntre2Trait = Math.abs(tmpSousGrille_.x_ - tmp_.x_); + int nbSousGrilles = 0; + int taillePasSousgrille = 0; + if (!this.modeLongueurPasSousGradX_) { + // -- on trace des nombre de cesure --// + nbSousGrilles = this.getNbXSousGraduations(); + if (nbSousGrilles != 0) taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); + } else { + // -- on trace des pas par longueur --// + double ratio = (_xValue.getQuick(valNextPotable) - _xValue.getQuick(i)); + if (ratio != 0) ratio = this.valeurPasSousGradX_ / ratio; - for(int k=0;k<nbSousGrilles+1;k++){ - //-- on trace un trait de couleur de subgrid --// - gtl.setTypeTrait(TraceLigne.POINTILLE); - gtl.setEpaisseur((float) 0.1); - gtl.setCouleur(this.couleurSousGraduation_); - double longueur=((k)*taillePasSousgrille); - tmpSousGrille_.autoApplique(versEcran); - gtl.dessineTrait(_g, tmp_.x_+longueur, _ordxAxe,tmp_.x_+ longueur, _minYForAxe); - } - - longueurMoyenne=(int) (_xValue.getQuick(valNextPotable)-_xValue.getQuick(i)); - } + taillePasSousgrille = (int) (ratio * distanceEntre2Trait); + if (taillePasSousgrille != 0) nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); + } + // -- si on a des bons pas et nb de grilles --// + if (nbSousGrilles > 0 && taillePasSousgrille > 0 && taillePasSousgrille < distanceEntre2Trait) { - } - } - if (drawGrid_ && w > 0) { - gtl.setTypeTrait(TraceLigne.TIRETE); - gtl.setCouleur(subColor); - gtl.setEpaisseur((float) 1); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); - } + for (int k = 0; k < nbSousGrilles + 1; k++) { + // -- on trace un trait de couleur de subgrid --// + gtl.setTypeTrait(TraceLigne.POINTILLE); + gtl.setEpaisseur((float) 0.1); + gtl.setCouleur(this.couleurSousGraduation_); + double longueur = ((k) * taillePasSousgrille); + tmpSousGrille_.autoApplique(versEcran); + gtl.dessineTrait(_g, tmp_.x_ + longueur, _ordxAxe, tmp_.x_ + longueur, _minYForAxe); + } - } - } + longueurMoyenne = (int) (_xValue.getQuick(valNextPotable) - _xValue.getQuick(i)); + } - private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, - final double _minYForAxe) { - int minYDraw = _ordxAxe; - int maxYDraw = (int) _minYForAxe; + } + } + if (drawGrid_ && w > 0) { + gtl.setTypeTrait(TraceLigne.TIRETE); + gtl.setCouleur(subColor); + gtl.setEpaisseur((float) 1); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); + } - // if (useCustom_) { - // tmp_.y_ = _zv.getMinY(); - // if (_yValue.size() > 0) { - // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.floor(tmp_.y_); - // if (tmp_.y_ > minYDraw) { - // minYDraw = (int) tmp_.y_; - // } - // tmp_.y_ = _zv.getMaxY(); - // if (_yValue.size() > 1) { - // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.ceil(tmp_.y_); - // if (tmp_.y_ < maxYDraw) { - // maxYDraw = (int) tmp_.y_; - // } - // } - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); - } + } + } - final TraceLigne tl_ = new TraceLigne(); + private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, + final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, + final double _minYForAxe) { + int minYDraw = _ordxAxe; + int maxYDraw = (int) _minYForAxe; - private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { - int minXDraw = _absyAxe; - int maxXDraw = (int) _maxXForAxe; + // if (useCustom_) { + // tmp_.y_ = _zv.getMinY(); + // if (_yValue.size() > 0) { + // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.floor(tmp_.y_); + // if (tmp_.y_ > minYDraw) { + // minYDraw = (int) tmp_.y_; + // } + // tmp_.y_ = _zv.getMaxY(); + // if (_yValue.size() > 1) { + // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.ceil(tmp_.y_); + // if (tmp_.y_ < maxYDraw) { + // maxYDraw = (int) tmp_.y_; + // } + // } + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); + } - // if (useCustom_) { - // tmp_.x_ = _zv.getMinX(); - // if (_xValue.size() > 0) { - // tmp_.x_ = Math.min(_xValue.get(0), tmp_.x_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.x_ = Math.floor(tmp_.x_); - // if (tmp_.x_ < minXDraw) { - // minXDraw = (int) tmp_.x_; - // } - // tmp_.x_ = _zv.getMaxX(); - // if (_xValue.size() > 1) { - // tmp_.x_ = Math.max(_xValue.get(_xValue.size() - 1), tmp_.x_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.x_ = Math.ceil(tmp_.x_); - // if (tmp_.x_ < maxXDraw) { - // maxXDraw = (int) tmp_.x_; - // } - // } + final TraceLigne tl_ = new TraceLigne(); - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); - } + private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, + final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { + int minXDraw = _absyAxe; + int maxXDraw = (int) _maxXForAxe; - private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); + } - //-- mode manuel --// - if(!modeAutomatiqueX_){ - if(modeLongueurPasX_) - fillGraduationsWithPas(_g,this.valeurPasX_, _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); - else - fillGraduations(_g,getNbXGraduations(), _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); - return; - } + private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); + // -- mode manuel --// + if (!modeAutomatiqueX_) { + if (modeLongueurPasX_) fillGraduationsWithPas(_g, this.valeurPasX_, _zv.getMinX(), _zv.getMaxX(), _xValue, + _xStrWidth, _xString, fm); + else fillGraduations(_g, getNbXGraduations(), _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); + return; + } - //_it= - while (_it.hasNext()) { - final double x = _it.currentValue(); - _xValue.add(x); + _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); - if (font == null || !_it.isMajorTick()) { - _xStrWidth.add(0); - _xString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = _it.currentLabel(); - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); - } - _it.next(); - } - } + // _it= + while (_it.hasNext()) { + final double x = _it.currentValue(); + _xValue.add(x); + if (font == null || !_it.isMajorTick()) { + _xStrWidth.add(0); + _xString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = _it.currentLabel(); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + } + _it.next(); + } + } - public boolean isModeAutomatiqueX() { - return modeAutomatiqueX_; - } + public boolean isModeAutomatiqueX() { + return modeAutomatiqueX_; + } - public void setModeAutomatiqueX(boolean modeAutomatiqueX) { - this.modeAutomatiqueX_ = modeAutomatiqueX; - } + public void setModeAutomatiqueX(boolean modeAutomatiqueX) { + this.modeAutomatiqueX_ = modeAutomatiqueX; + } - public boolean isModeAutomatiqueY() { - return modeAutomatiqueY_; - } + public boolean isModeAutomatiqueY() { + return modeAutomatiqueY_; + } - public void setModeAutomatiqueY(boolean modeAutomatiqueY) { - this.modeAutomatiqueY_ = modeAutomatiqueY; - } + public void setModeAutomatiqueY(boolean modeAutomatiqueY) { + this.modeAutomatiqueY_ = modeAutomatiqueY; + } - /** - * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran - * que ce soit pour le mode par taille de pas ou par nb de cesures. - * @param nbGraduations - * @param min - * @param max - * @param _xValue - * @param _xStrWidth - * @param _xString - */ - private double fillGraduations(Graphics2D _g,int nbGraduations,double min,double max,final TDoubleArrayList _xValue,final TIntArrayList _xStrWidth,final List _xString,FontMetrics fm ){ + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran que ce soit pour le mode par taille + * de pas ou par nb de cesures. + * + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduations(Graphics2D _g, int nbGraduations, double min, double max, + final TDoubleArrayList _xValue, final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - //-- distance tot a couvrir --// - final double distance=max-min; - final int taillePas=(int) (distance/nbGraduations); - double yMax=0; + // -- distance tot a couvrir --// + final double distance = max - min;// e + final int taillePas = Math.max(1, (int) (distance / nbGraduations));// FREd ne fonctionne pas toujours si on a des + // valeurs <1 - for(int i=0;i<nbGraduations+1;i++){ - int cesure=(int) (min+(taillePas*(i))); - _xValue.add(cesure); - final String currentLabel =""+cesure; - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); + double yMax = 0; + // boucle infinie ! - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - if(i==nbGraduations) - if(cesure<max) - nbGraduations++; - } - return yMax; + for (int i = 0; i < nbGraduations + 1; i++) { + int cesure = (int) (min + (taillePas * (i))); + _xValue.add(cesure); + final String currentLabel = Integer.toString(cesure); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + // boucle infinie ! + if (i == nbGraduations) if (cesure < max) nbGraduations++; + // Fred truc tempo pour eviter les crashs + if (i > 100) break; + } + return yMax; - } + } + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran que ce soit pour le mode par taille + * de pas ou par nb de cesures. + * + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduationsWithPas(Graphics2D _g, int pas, double min, double max, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - /** - * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran - * que ce soit pour le mode par taille de pas ou par nb de cesures. - * @param nbGraduations - * @param min - * @param max - * @param _xValue - * @param _xStrWidth - * @param _xString - */ - private double fillGraduationsWithPas(Graphics2D _g,int pas,double min,double max,final TDoubleArrayList _xValue,final TIntArrayList _xStrWidth,final List _xString,FontMetrics fm ){ + // -- distance tot a couvrir --// + final double distance = max - min; + final int taillePas = pas; + if (pas == 0) return 0; + int nbGraduations = (int) (distance / taillePas); + double yMax = 0; - //-- distance tot a couvrir --// - final double distance=max-min; - final int taillePas= pas; - if(pas==0) - return 0; - int nbGraduations=(int) (distance/taillePas); - double yMax=0; + for (int i = 0; i < nbGraduations + 1; i++) { + int cesure = (int) (min + (taillePas * (i))); + _xValue.add(cesure); + final String currentLabel = Integer.toString(cesure); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); - for(int i=0;i<nbGraduations+1;i++){ - int cesure=(int) (min+(taillePas*(i))); - _xValue.add(cesure); - final String currentLabel =""+cesure; - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - - if(i==nbGraduations){ - if(cesure<max) - nbGraduations++; - } + if (i == nbGraduations) { + if (cesure < max) nbGraduations++;// ATTENTION boucle infinie ! + } + if (i > 100) break;// a enlever bugfix temporaire. - } - return yMax; + } + return yMax; + } - } + private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, + final TIntArrayList _yStrWidth, final List _yString) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + double yMax = 0; + NumberIterator it; - private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, - final TIntArrayList _yStrWidth, final List _yString) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - double yMax = 0; - NumberIterator it; + // -- mode manuel --// + if (!modeAutomatiqueY_) { + if (modeLongueurPasY_) yMax = fillGraduationsWithPas(_g, this.valeurPasY_, _zv.getMinY(), _zv.getMaxY(), _yValue, + _yStrWidth, _yString, fm); + else yMax = fillGraduations(_g, nbGraduationY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); + return yMax; + } + it = new NumberIterator(); + it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); + while (it.hasNext()) { + final double x = it.currentValue(); + _yValue.add(x); + if (font == null || !it.isMajorTick()) { + _yStrWidth.add(0); + _yString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = it.currentLabel(); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + _yStrWidth.add((int) stringWidth); + _yString.add(currentLabel); + } + it.next(); + } + return yMax; + } - //-- mode manuel --// - if(!modeAutomatiqueY_){ - if(modeLongueurPasY_) - yMax=fillGraduationsWithPas(_g,this.valeurPasY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); - else - yMax=fillGraduations(_g,nbGraduationY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); - return yMax; - } + // private void updateBounds(final GrBoite _zv) { + // if (useCustom_ && customBounds_ != null) { + // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); + // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); + // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); + // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); + // } + // } - it = new NumberIterator(); - it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); - while (it.hasNext()) { + // Icon + /** + * Dessin de l'icone. + * + * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il + * est ignore ici. + * @param _g le graphics sur lequel dessiner l'icone + * @param _x lieu cible de l'icone (x) + * @param _y lieu cible de l'icone (y) + */ + public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { + super.paintIcon(_c, _g, _x, _y); + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + _g.setColor(fg); + final int w = getIconWidth(); + final int h = getIconHeight(); + for (int i = 6; i < w - 2; i += 8) { + _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); + } + for (int j = 6; j < h - 2; j += 8) { + _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); + } + } - final double x = it.currentValue(); - _yValue.add(x); - if (font == null || !it.isMajorTick()) { - _yStrWidth.add(0); - _yString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = it.currentLabel(); - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - _yStrWidth.add((int) stringWidth); - _yString.add(currentLabel); - } - it.next(); - } - return yMax; - } + public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, + final GrBoite _clipReel) {} - // private void updateBounds(final GrBoite _zv) { - // if (useCustom_ && customBounds_ != null) { - // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); - // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); - // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); - // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); - // } - // } + public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { + return null; + } - // Icon - /** - * Dessin de l'icone. - * - * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il - * est ignore ici. - * @param _g le graphics sur lequel dessiner l'icone - * @param _x lieu cible de l'icone (x) - * @param _y lieu cible de l'icone (y) - */ - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - super.paintIcon(_c, _g, _x, _y); - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - _g.setColor(fg); - final int w = getIconWidth(); - final int h = getIconHeight(); - for (int i = 6; i < w - 2; i += 8) { - _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); - } - for (int j = 6; j < h - 2; j += 8) { - _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); - } - } + public CtuluListSelection selection(final LinearRing _poly, final int _mode) { + return null; + } - public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) {} + public LineString getSelectedLine() { + return null; + } - public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { - return null; - } + /** + * Affectation de la propriete <I>boite</I>. + */ + // public void setBoite(final GrBoite _v) { + // if (boite_ != _v) { + // final GrBoite vp = boite_; + // boite_ = _v; + // firePropertyChange("boite", vp, _v); + // } + // } + public void setVisible(final boolean _v) { + // if (_v && boite_ == null) { + // boite_ = vue_.getAbstractCalque().getDomaine(); + // } + if (!_v) { + vue_.setUserInsets(null); + super.setVisible(false); + } else { + super.setVisible(_v); + } + firePropertyChange("grille", true, false); - public CtuluListSelection selection(final LinearRing _poly, final int _mode) { - return null; - } + } - public LineString getSelectedLine() { - return null; - } + public boolean isDrawGrid() { + return drawGrid_; + } - /** - * Affectation de la propriete <I>boite</I>. - */ - // public void setBoite(final GrBoite _v) { - // if (boite_ != _v) { - // final GrBoite vp = boite_; - // boite_ = _v; - // firePropertyChange("boite", vp, _v); - // } - // } - public void setVisible(final boolean _v) { - // if (_v && boite_ == null) { - // boite_ = vue_.getAbstractCalque().getDomaine(); - // } - if (!_v) { - vue_.setUserInsets(null); - super.setVisible(false); - } else { - super.setVisible(_v); - } - firePropertyChange("grille", true, false); + public void setDrawGrid(final boolean _drawGrid) { + if (_drawGrid != drawGrid_) { + drawGrid_ = _drawGrid; + grilleChanged(); + } + } - } + // public boolean isUseCustom() { + // return useCustom_; + // } + // + // public void setUseCustom(final boolean _useCustom) { + // if (useCustom_ != _useCustom) { + // useCustom_ = _useCustom; + // repaint(); + // } + // } + // + // public Envelope getCustomBounds() { + // return customBounds_ == null ? null : new Envelope(customBounds_); + // } + // + // public void setCustomBounds(final Envelope _customBounds) { + // if (customBounds_ != _customBounds) { + // customBounds_ = _customBounds; + // repaint(); + // } + // } - public boolean isDrawGrid() { - return drawGrid_; - } + public boolean isDrawX() { + return drawX_; + } - public void setDrawGrid(final boolean _drawGrid) { - if (_drawGrid != drawGrid_) { - drawGrid_ = _drawGrid; - grilleChange... [truncated message content] |
From: <had...@us...> - 2009-02-03 19:44:55
|
Revision: 4438 http://fudaa.svn.sourceforge.net/fudaa/?rev=4438&view=rev Author: hadouxad Date: 2009-02-03 19:44:50 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Creation rapide de profil spatial sans devoir passer par la cr?\195?\169ation d'un calque de donn?\195?\169es g?\195?\169om?\195?\169triques: - on utilise l'outil sonde depuis le menu ?\195?\169dition d'une vue 2d - on clic en maintenant shift pour cr?\195?\169er plusieurs sondes (les sondes se relient entre elles par des trait) - on clique sur le bouton de cr?\195?\169ation de profil spatial: l'assistant reconnait qu'il y a une ligne bris?\195?\169e de cr?\195?\169e et propose par d?\195?\169faut d'utiliser cette ligne, on peut donc rapidement passer aux ?\195?\169tapes suivantes (choix des pas de temps, variables,...) - Ce principe est ?\195?\169galement disponible pour rejouer les donn?\195?\169es des profils spatiaux - Concernant l'utilisation classique de la sonde : rien ne change: seule la premi?\195?\168re sonde construite affiche ses propres informations AMELIORATION Grilles et sous grilles pour les zeblicalquepanel Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInterface.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/find/CalqueFindActionAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 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/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostProfileAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/org.eclipse.core.resources/ branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/org.eclipse.core.resources/.root/ branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISZoneCollectionPoint.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -203,6 +203,9 @@ return add(_x, _y, _z, null, null); } + + + public final boolean addAll(final GISPoint[] _data, final List _list, final CtuluCommandContainer _c) { if (!isGeomModifiable_) { return false; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -18,6 +18,8 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; +import java.text.DecimalFormat; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; @@ -54,9 +56,9 @@ int nbGraduationY_ = 10; // -- sous graduations --// - int nbSousGraduationX_ = 2; + int nbSousGraduationX_ = 3; // -- sous graduations --// - int nbSousGraduationY_ = 2; + int nbSousGraduationY_ = 3; final BVueCalque vue_; @@ -78,8 +80,8 @@ /** * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. */ - int valeurPasX_; - int valeurPasY_; + double valeurPasX_; + double valeurPasY_; boolean drawSousGrilleX_ = false; boolean drawSousGrilleY_ = false; @@ -87,8 +89,8 @@ boolean modeLongueurPasSousGradX_ = false; boolean modeLongueurPasSousGradY_ = false; - int valeurPasSousGradX_; - int valeurPasSousGradY_; + double valeurPasSousGradX_; + double valeurPasSousGradY_; private Color couleurSousGraduation_ = Color.blue; @@ -622,23 +624,28 @@ * @param _xStrWidth * @param _xString */ - private double fillGraduationsWithPas(Graphics2D _g, int pas, double min, double max, final TDoubleArrayList _xValue, + private double fillGraduationsWithPas(Graphics2D _g, double pas, double min, double max, final TDoubleArrayList _xValue, final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - + DecimalFormat df = new DecimalFormat("#.0"); // -- distance tot a couvrir --// final double distance = max - min; - final int taillePas = pas; + final double taillePas = pas; if (pas == 0) return 0; int nbGraduations = (int) (distance / taillePas); double yMax = 0; for (int i = 0; i < nbGraduations + 1; i++) { - int cesure = (int) (min + (taillePas * (i))); + double cesure = (min + (taillePas * (i))); _xValue.add(cesure); - final String currentLabel = Integer.toString(cesure); + String currentLabel; + + currentLabel = df.format(cesure); _xStrWidth.add(fm.stringWidth(currentLabel)); + String chiffreApresVirgule=currentLabel.substring(currentLabel.lastIndexOf(",")+1); + if( chiffreApresVirgule.equals("0")) + currentLabel=""+(int)cesure; _xString.add(currentLabel); - + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); if (stringWidth > yMax) { yMax = stringWidth; @@ -883,7 +890,7 @@ } } - public void setLenghtStepsX(final int _lenghtSteps) { + public void setLenghtStepsX(final double _lenghtSteps) { GrBoite boite = vue_.getViewBoite(); if (_lenghtSteps == 0) return; double max = boite.getMaxX(); @@ -897,7 +904,7 @@ } - public void setLenghtStepsY(final int _lenghtSteps) { + public void setLenghtStepsY(final double _lenghtSteps) { GrBoite boite = vue_.getViewBoite(); if (_lenghtSteps == 0) return; int nbGraduationsY = (int) (boite.getMaxY() / _lenghtSteps); @@ -918,7 +925,7 @@ } } - public void setLenghtStepsSousGradX(final int _lenghtSteps) { + public void setLenghtStepsSousGradX(final double _lenghtSteps) { GrBoite boite = vue_.getViewBoite(); if (_lenghtSteps == 0) return; int nbSousGraduationsX = (int) (boite.getMaxY() / _lenghtSteps); @@ -932,14 +939,14 @@ } public void setNbGraduationSousGradX(final int _nbGraduation) { - if (_nbGraduation > 0) { - nbSousGraduationX_ = _nbGraduation; + if (_nbGraduation+1 > 0) { + nbSousGraduationX_ = _nbGraduation+1; modeLongueurPasSousGradX_ = false; grilleChanged(); } } - public void setLenghtStepsSousGradY(final int _lenghtSteps) { + public void setLenghtStepsSousGradY(final double _lenghtSteps) { GrBoite boite = vue_.getViewBoite(); if (_lenghtSteps == 0) return; int nbSousGraduationsY = (int) (boite.getMaxY() / _lenghtSteps); @@ -953,11 +960,51 @@ } public void setNbGraduationSousGradY(final int _nbGraduation) { - if (_nbGraduation > 0) { - nbSousGraduationY_ = _nbGraduation; + if (_nbGraduation+1 > 0) { + nbSousGraduationY_ = _nbGraduation+1; modeLongueurPasSousGradY_ = false; grilleChanged(); } } +public boolean isModeLongueurPasX_() { + return modeLongueurPasX_; } + +public void setModeLongueurPasX_(boolean modeLongueurPasX_) { + this.modeLongueurPasX_ = modeLongueurPasX_; +} + +public double getValeurPasX_() { + return valeurPasX_; +} + +public void setValeurPasX_(int valeurPasX_) { + this.valeurPasX_ = valeurPasX_; +} + +public double getValeurPasY_() { + return valeurPasY_; +} + +public void setValeurPasY_(int valeurPasY_) { + this.valeurPasY_ = valeurPasY_; +} + +public double getValeurPasSousGradX_() { + return valeurPasSousGradX_; +} + +public void setValeurPasSousGradX_(int valeurPasSousGradX_) { + this.valeurPasSousGradX_ = valeurPasSousGradX_; +} + +public double getValeurPasSousGradY_() { + return valeurPasSousGradY_; +} + +public void setValeurPasSousGradY_(int valeurPasSousGradY_) { + this.valeurPasSousGradY_ = valeurPasSousGradY_; +} + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -64,8 +64,10 @@ final GrPoint pt=new GrPoint(_e.getX(),_e.getY(),0); // final GrPoint clone = new GrPoint(pt); pt.autoApplique(((BCalque)target_).getVersReel()); - target_.changeSonde(pt); + + target_.changeSonde(pt,_e.isShiftDown()); + // -- notify aux sondeListener --// notifySondeListener(pt); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInterface.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInterface.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInterface.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -7,6 +7,8 @@ */ package org.fudaa.ebli.calque; +import java.util.List; + import org.fudaa.ebli.geometrie.GrPoint; @@ -48,7 +50,7 @@ * @param _reel coordonn\xE9es r\xE9elles * @return true si trouv\xE9 */ - boolean changeSonde(GrPoint _reel); + boolean changeSonde(GrPoint _reel,boolean ajoute); /** @@ -57,5 +59,11 @@ */ boolean isPointSondable(GrPoint _reel); + /** + * Retourne la liste des sondes qui forment une ligne brisee. + * @return + */ + public List<GrPoint> getLigneBriseeFromSondes(); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -123,7 +123,7 @@ ZCalqueSondeInterface objet = sondeInteraction.getTarget(); objet.setSondeEnable(true); - objet.changeSonde(pt); + objet.changeSonde(pt,false); //--remplissage des infos specifiques a la sonde --// ZCalquePoint isoLayer = listeWidgetCalque_.get(i).getCalqueController().getVisuPanel().getIsoLayer(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -27,7 +27,7 @@ super(EbliLib.getS("Interpolation"), EbliResource.EBLI.getToolIcon("pointeur"), "SONDE", _cq); _m.addTreeSelectionListener(this); - super.setDefaultToolTip(EbliLib.getS("Interpoler les valeurs en un point")); + super.setDefaultToolTip(EbliLib.getS("<html><body>Interpoler les valeurs en un point<br /><b>On peut construire une ligne bris\xE9e en cr\xE9ant plusieurs sondes en maintenant shift. </b></body></html>")); updateForLayer(_m.getSelectedCalque()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/find/CalqueFindActionAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/find/CalqueFindActionAbstract.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/find/CalqueFindActionAbstract.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -172,7 +172,7 @@ target.setSondeEnable(true); s.setTarget(target); - r = target.changeSonde(new GrPoint(x, y, 0)); + r = target.changeSonde(new GrPoint(x, y, 0),true); if (r) { visu.setInfoPaletteActive(); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -10,6 +10,7 @@ import java.awt.event.ActionEvent; import java.util.Collection; +import java.util.List; import javax.swing.JCheckBoxMenuItem; import javax.swing.JColorChooser; @@ -21,6 +22,7 @@ import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gis.GISPolygone; +import org.fudaa.ctulu.gis.GISZoneCollectionPoint; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.dodico.ef.EfFrontierInterface; @@ -28,8 +30,10 @@ import org.fudaa.dodico.ef.EfGridVolumeInterface; import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; +import org.fudaa.ebli.calque.ZCalqueSondeInterface; import org.fudaa.ebli.calque.edition.ZCalqueEditionGroup; import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; +import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvLayerGrid; import org.fudaa.fudaa.meshviewer.MvResource; @@ -51,6 +55,9 @@ import com.memoire.bu.BuDynamicMenu; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPopupMenu; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.CoordinateSequences; +import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; /** @@ -450,11 +457,54 @@ * @return la ligne selectionnee dans le calque selectionne ou null si aucune */ public LineString getSelectedLine() { + LineString selection=null; // pas de calque s\xE9lectionn\xE9 - if (!(getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { return null; } - return ((ZCalqueAffichageDonneesInterface) getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + if ((getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { + //-- on essaie de recuperer la ligne selectionnee:--// + selection=((ZCalqueAffichageDonneesInterface) getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + } + //-- si il n'y a pas de ligne selectionne dans une donne geometrique, alors on tente de renvoyer la ligne formee des sondes --// + if(selection==null) + selection=getSelectedLineFromSonde(); + + return selection; } + public boolean isSelectionOkForEvolutionSonde() { + return (getCalqueActif() instanceof ZCalqueSondeInterface) + && ((ZCalqueSondeInterface) getCalqueActif()).isSondeActive(); + } + + /** + * Retourne la ligne brisee formee par les sondes. + * On peut creer plusieurs sondes en maintenant shift appuy\xE9. + * @return + */ + public List<GrPoint> getLigneBriseeFormSonde() { + if (isSelectionOkForEvolutionSonde()) { + final ZCalqueSondeInterface s = (ZCalqueSondeInterface) getCalqueActif(); + if(s !=null && s.getLigneBriseeFromSondes()!=null && s.getLigneBriseeFromSondes().size()>1) + return s.getLigneBriseeFromSondes(); + } + return null; + } + + /** + * Retourne la ligne cr\xE9e a partir des objets sondes (en maintenant le crtl+shift) + * @return + */ + public LineString getSelectedLineFromSonde() { + List<GrPoint> listeSondes=getLigneBriseeFormSonde(); + if(listeSondes==null) return null; + GISZoneCollectionPoint listePoints=new GISZoneCollectionPoint(); + for(GrPoint point:listeSondes) + listePoints.add(point.x_,point.y_,point.z_); + LineString newLine=new LineString(listePoints,new GeometryFactory()); + + return newLine; + } + + public void setActive(final boolean _b) {} /** 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 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileAction.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -34,11 +34,18 @@ } protected LineString getSelectedLine() { - return panel_.getSelectedLine(); + //-- on tente de recuperer la ligne issue d'une creation geometrique --// + LineString ligneSelectionnee=panel_.getSelectedLine(); + //-- on essaie avec une ligne brisee formee par les sondes --// + if(ligneSelectionnee==null) + ligneSelectionnee=panel_.getSelectedLineFromSonde(); + return ligneSelectionnee; } @Override public void actionPerformed(final ActionEvent _e) { + + new MvProfileBuilderFromTree(src_, ui_, getSelectedLine(), panel_, new MvProfileCoteTester()).start(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -55,6 +55,7 @@ import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.courbe.EGObject; +import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; @@ -207,20 +208,12 @@ * @param newVariable * @param ecraser */ - public void replayPoints(TrPostCommonImplementation impl,TrPostVisuPanel vue2d,MVProfileCourbeModel _model,final TrPostSource _src, final int[] _idxToAdd, final CtuluCommandContainer _cmd, + public void replayPoints(TrPostCommonImplementation impl,TrPostVisuPanel vue2d,MVProfileCourbeModel _model,final TrPostSource _src, final GISZoneCollectionPoint points, final CtuluCommandContainer _cmd, final ProgressionInterface _prog, H2dVariableType newVariable,int newTimeStep, boolean ecraser) { - + LineString polyligne=new LineString(points,new GeometryFactory()); //-- ajout de la variable --// final MvProfileCourbeGroup groupVar = getGroup(newVariable, true); - - //-- creation de la polyligne --// - GISZoneCollectionPoint points=new GISZoneCollectionPoint(); - for(int i=0;i<_idxToAdd.length;i++) - points.add(_src.getGrid().getPtX(_idxToAdd[i]),_src.getGrid().getPtY(_idxToAdd[i]),0); - LineString polyligne=new LineString(points,new GeometryFactory()); - - //-- on cree la nouvelle courbe pour la variable correspondante --// MvProfileTarget target=new TrPostProfileAction.ProfileAdapter(_src,impl.getCurrentProject()); MvProfileBuilder builder=new MvProfileBuilderFromLine(target,impl,polyligne,vue2d,new MvProfileCoteTester()); @@ -252,8 +245,29 @@ fireStructureChanged(); + } + + + + public void replayPoints(TrPostCommonImplementation impl,TrPostVisuPanel vue2d,MVProfileCourbeModel _model,final TrPostSource _src, final int[] _idxToAdd, final CtuluCommandContainer _cmd, + final ProgressionInterface _prog, H2dVariableType newVariable,int newTimeStep, boolean ecraser) { + //-- creation de la polyligne --// + GISZoneCollectionPoint points=new GISZoneCollectionPoint(); + for(int i=0;i<_idxToAdd.length;i++) + points.add(_src.getGrid().getPtX(_idxToAdd[i]),_src.getGrid().getPtY(_idxToAdd[i]),0); + replayPoints(impl, vue2d, _model, _src, points, _cmd, _prog, newVariable, newTimeStep, ecraser); } + + public void replayPoints(TrPostCommonImplementation impl,TrPostVisuPanel vue2d,MVProfileCourbeModel _model,final TrPostSource _src, final List<GrPoint> _idxToAdd, final CtuluCommandContainer _cmd, + final ProgressionInterface _prog, H2dVariableType newVariable,int newTimeStep, boolean ecraser) { + //-- creation de la polyligne --// + GISZoneCollectionPoint points=new GISZoneCollectionPoint(); + for(GrPoint point:_idxToAdd) + points.add(point.x_,point.y_,point.z_); + + replayPoints(impl, vue2d, _model, _src, points, _cmd, _prog, newVariable, newTimeStep, ecraser); + } /** * Methode qui supprime la courbe pour son modele du profil spatial. Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -4,6 +4,7 @@ import java.awt.CardLayout; import java.awt.Color; import java.awt.Container; +import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -87,33 +88,24 @@ boolean modeAutomatiqueY_ = true; private BuPanel createAxis() { - BuPanel panelX = new BuPanel(new BorderLayout()); - panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axes X"))); + final BuPanel panelX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + final BuPanel panelY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + final BuPanel panelSousGrilleeX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + final BuPanel panelSousGrilleeY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + final BuCheckBox cbsousGrilleX = new BuCheckBox(EbliLib.getS("Dessiner les sous graduations X")); + final BuCheckBox cbsousGrilleY = new BuCheckBox(EbliLib.getS("Dessiner les sous graduations Y")); + + panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Graduations X"))); final BuComboBox combo = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nb graduations"), EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nb graduations"), EbliLib.getS("Automatique: longueur des pas") }); final CardLayout layoutCardX = new CardLayout(); - panelX.add(combo, BorderLayout.NORTH); + final BuPanel panelCardX = new BuPanel(layoutCardX); // panelCardX.setLayout(layoutCardX); - panelX.add(combo, BorderLayout.NORTH); - panelX.add(panelCardX, BorderLayout.CENTER); - combo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - modeAutomatiqueX_ = false; - if (combo.getSelectedIndex() == 0) layoutCardX.show(panelCardX, MANUEL1); - else if (combo.getSelectedIndex() == 1) layoutCardX.show(panelCardX, MANUEL2); - else if (combo.getSelectedIndex() == 2) { - layoutCardX.show(panelCardX, MANUEL1); - modeAutomatiqueX_ = true; - } else if (combo.getSelectedIndex() == 3) { - layoutCardX.show(panelCardX, MANUEL2); - modeAutomatiqueX_ = true; - } - } + + - }); - final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe X")); cbX.setSelected(target_.isDrawX()); cbX.addActionListener(new ActionListener() { @@ -123,13 +115,18 @@ } }); - panelX.add(cbX, BorderLayout.SOUTH); - + + BuPanel paneCombo1=new BuPanel(); + paneCombo1.add(combo); + panelX.add(cbX/*, BorderLayout.SOUTH*/); + panelX.add(paneCombo1/*, BorderLayout.NORTH*/); + panelX.add(panelCardX/*, BorderLayout.CENTER*/); + // -- panel x manuel 1: choix par nb de cesures --// final BuPanel pnXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduations"))); + // pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduations"))); final BuTextField btGraduationX = BuTextField.createIntegerField(); - btGraduationX.setColumns(20); + btGraduationX.setColumns(5); btGraduationX.setValue(new Integer(target_.getNbXGraduations())); pnXmanu1.add(btGraduationX); btGraduationX.addActionListener(new ActionListener() { @@ -150,15 +147,15 @@ // -- panel x manuel 2: choix par longueur des pas --// final BuPanel pnXmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); - final BuTextField btGraduationX2 = BuTextField.createIntegerField(); - btGraduationX2.setColumns(20); - btGraduationX2.setValue(new Integer(target_.getNbXGraduations())); + // pnXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + final BuTextField btGraduationX2 = BuTextField.createDoubleField(); + btGraduationX2.setColumns(5); + // btGraduationX2.setValue(new Integer(target_.get)); pnXmanu2.add(btGraduationX2); btGraduationX2.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { - final int newVal = ((Integer) btGraduationX2.getValue()).intValue(); + final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); if (newVal > 0) { target_.setModeAutomatiqueX(modeAutomatiqueX_); target_.setLenghtStepsX(newVal); @@ -173,33 +170,74 @@ // --on affiche le manuel 1 par defaut --// layoutCardX.show(panelCardX, "MANUEL1"); + + combo.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + modeAutomatiqueX_ = false; + if (combo.getSelectedIndex() == 0){ + layoutCardX.show(panelCardX, MANUEL1); + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); + } + } + else if (combo.getSelectedIndex() == 1){ + layoutCardX.show(panelCardX, MANUEL2); + if(btGraduationX2.getValue()!=null){ + final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsX(newVal); + } + } + } + else if (combo.getSelectedIndex() == 2) { + layoutCardX.show(panelCardX, MANUEL1); + modeAutomatiqueX_ = true; + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); + } + } else if (combo.getSelectedIndex() == 3) { + layoutCardX.show(panelCardX, MANUEL2); + modeAutomatiqueX_ = true; + if(btGraduationX2.getValue()!=null){ + final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsX(newVal); + }} + } + + if(combo.getSelectedIndex()>=2){ + cbsousGrilleX.setSelected(false); + cbsousGrilleX.setEnabled(false); + target_.setDrawSousGrilleX(false); + }else{ + cbsousGrilleX.setEnabled(true); + } + + + + } + + }); + + // -- Panel y --// - BuPanel panelY = new BuPanel(new BorderLayout()); - panelY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axes Y"))); + + panelY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Graduations Y"))); final BuComboBox comboY = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nb graduations"), EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nb graduations"), EbliLib.getS("Automatique: longueur des pas") }); final CardLayout layoutCardY = new CardLayout(); - panelY.add(comboY, BorderLayout.NORTH); + final BuPanel panelCardY = new BuPanel(layoutCardY); // panelCardY.setLayout(layoutCardY); - panelY.add(comboY, BorderLayout.NORTH); - panelY.add(panelCardY, BorderLayout.CENTER); - comboY.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - modeAutomatiqueY_ = false; - if (comboY.getSelectedIndex() == 0) layoutCardY.show(panelCardY, MANUEL1); - else if (comboY.getSelectedIndex() == 1) layoutCardY.show(panelCardY, MANUEL2); - else if (comboY.getSelectedIndex() == 2) { - layoutCardY.show(panelCardY, MANUEL1); - modeAutomatiqueY_ = true; - } else if (comboY.getSelectedIndex() == 3) { - layoutCardY.show(panelCardY, MANUEL2); - modeAutomatiqueY_ = true; - } - } - - }); + + final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe Y")); cbY.setSelected(target_.isDrawY()); cbY.addActionListener(new ActionListener() { @@ -209,14 +247,18 @@ } }); + BuPanel combo3=new BuPanel(); + combo3.add(comboY); + panelY.add(cbY /*,BorderLayout.SOUTH*/); + panelY.add(combo3/*, BorderLayout.NORTH*/); + panelY.add(panelCardY/*, BorderLayout.CENTER*/); + - panelY.add(cbY, BorderLayout.SOUTH); - // -- panel y manuel 1: choix par nb de cesures --// final BuPanel pnYmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationY = BuTextField.createIntegerField(); - btGraduationY.setColumns(20); + btGraduationY.setColumns(5); btGraduationY.setValue(new Integer(target_.getNbYGraduations())); pnYmanu1.add(btGraduationY); btGraduationY.addActionListener(new ActionListener() { @@ -237,15 +279,15 @@ // -- panel y manuel 2: choix par longueur des pas --// final BuPanel pnYmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); - final BuTextField btGraduationY2 = BuTextField.createIntegerField(); - btGraduationY2.setColumns(20); - btGraduationY2.setValue(new Integer(target_.getNbXGraduations())); + // pnYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + final BuTextField btGraduationY2 = BuTextField.createDoubleField(); + btGraduationY2.setColumns(5); + // btGraduationY2.setValue(new Integer(target_.getNbXGraduations())); pnYmanu2.add(btGraduationY2); btGraduationY2.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { - final int newVal = ((Integer) btGraduationY2.getValue()).intValue(); + final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); if (newVal > 0) { target_.setModeAutomatiqueY(modeAutomatiqueY_); target_.setLenghtStepsY(newVal); @@ -259,40 +301,91 @@ // --on affiche le manuel 1 par defaut --// layoutCardY.show(panelCardY, "MANUEL1"); + + comboY.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + modeAutomatiqueY_ = false; + if (comboY.getSelectedIndex() == 0){ + layoutCardY.show(panelCardY, MANUEL1); + final int newVal = ((Integer) btGraduationY.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationY(newVal); + } + } + else if (comboY.getSelectedIndex() == 1){ + layoutCardY.show(panelCardY, MANUEL2); + if(btGraduationY2.getValue()!=null){ + final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsY(newVal); + }} + } + else if (comboY.getSelectedIndex() == 2) { + layoutCardY.show(panelCardY, MANUEL1); + modeAutomatiqueY_ = true; + final int newVal = ((Integer) btGraduationY.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationY(newVal); + } + } else if (comboY.getSelectedIndex() == 3) { + layoutCardY.show(panelCardY, MANUEL2); + modeAutomatiqueY_ = true; + if(btGraduationY2.getValue()!=null){ + final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsY(newVal); + }} + } + + if(comboY.getSelectedIndex()>=2){ + cbsousGrilleY.setSelected(false); + cbsousGrilleY.setEnabled(false); + target_.setDrawSousGrilleY(false); + }else{ + cbsousGrilleY.setEnabled(true); + } + + } + + }); + + + + + // -- panel des sous grilles --// // --sous grille x --// - BuPanel panelSousGrilleeX = new BuPanel(new BorderLayout()); + + final BuComboBox comboSousGrilleX = new BuComboBox(new String[] { EbliLib.getS("Nb graduations"), EbliLib.getS("Longueur des pas") }); + + final CardLayout layoutCardSousGrilleX = new CardLayout(); - panelSousGrilleeX.add(comboSousGrilleX, BorderLayout.NORTH); final BuPanel panelCardSouGrilleX = new BuPanel(layoutCardSousGrilleX); - // panelCardSouGrilleX.setLayout(layoutCardSousGrilleX); - panelSousGrilleeX.add(comboSousGrilleX, BorderLayout.NORTH); - panelSousGrilleeX.add(panelCardSouGrilleX, BorderLayout.CENTER); - comboSousGrilleX.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (comboSousGrilleX.getSelectedIndex() == 0) layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); - else if (comboSousGrilleX.getSelectedIndex() == 1) layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); - } - }); - final BuCheckBox cbsousGrilleX = new BuCheckBox(EbliLib.getS("Dessiner les sous grilles X")); + + cbsousGrilleX.setSelected(target_.isDrawY()); - cbsousGrilleX.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setModeAutomatiqueY(modeAutomatiqueX_); - target_.setDrawSousGrilleX(cbsousGrilleX.isSelected()); - } - }); - panelSousGrilleeX.add(cbsousGrilleX, BorderLayout.SOUTH); + + + BuPanel combo2=new BuPanel(); + combo2.add(comboSousGrilleX); + panelSousGrilleeX.add(cbsousGrilleX/*, BorderLayout.SOUTH*/); + panelSousGrilleeX.add(combo2/*, BorderLayout.NORTH*/); + panelSousGrilleeX.add(panelCardSouGrilleX/*, BorderLayout.CENTER*/); + cbsousGrilleX.setSelected(false); // -- panel sous grille x manuel 1: choix par nb de cesures --// final BuPanel pnsousXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnsousXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + //pnsousXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationSousX = BuTextField.createIntegerField(); - btGraduationSousX.setColumns(20); - btGraduationSousX.setValue(new Integer(target_.getNbXSousGraduations())); + btGraduationSousX.setColumns(5); + btGraduationSousX.setValue(new Integer(target_.getNbXSousGraduations()-1)); pnsousXmanu1.add(btGraduationSousX); btGraduationSousX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -308,14 +401,14 @@ panelCardSouGrilleX.add(pnsousXmanu1, MANUEL1); // -- panel sous grille x manuel 2: choix par longueur des pas --// final BuPanel pnSousXmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnSousXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); - final BuTextField btGraduationSousX2 = BuTextField.createIntegerField(); - btGraduationSousX2.setColumns(20); + // pnSousXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + final BuTextField btGraduationSousX2 = BuTextField.createDoubleField(); + btGraduationSousX2.setColumns(5); // btGraduationSousX2.setValue(new Integer(target_.getNbXGraduations())); pnSousXmanu2.add(btGraduationSousX2); btGraduationSousX2.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { - final int newVal = ((Integer) btGraduationSousX2.getValue()).intValue(); + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); if (newVal > 0) { target_.setModeAutomatiqueX(modeAutomatiqueX_); target_.setLenghtStepsSousGradX(newVal); @@ -324,38 +417,79 @@ }); panelCardSouGrilleX.add(pnSousXmanu2, MANUEL2); + cbsousGrilleX.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + if (comboSousGrilleX.getSelectedIndex() == 0){ + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); + final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationSousGradX(newVal); + } + } + else if (comboSousGrilleX.getSelectedIndex() == 1){ + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); + if(btGraduationSousX2.getValue()!=null){ + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsSousGradX(newVal); + }} + } + + + target_.setDrawSousGrilleX(cbsousGrilleX.isSelected()); + } + }); + comboSousGrilleX.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (comboSousGrilleX.getSelectedIndex() == 0){ + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); + final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationSousGradX(newVal); + } + } + else if (comboSousGrilleX.getSelectedIndex() == 1){ + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); + if(btGraduationSousX2.getValue()!=null){ + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsSousGradX(newVal); + }} + } + } + }); + + // --sous grille y --// - BuPanel panelSousGrilleeY = new BuPanel(new BorderLayout()); + final BuComboBox comboSousGrilleY = new BuComboBox(new String[] { EbliLib.getS("Nb graduations"), EbliLib.getS("Longueur des pas") }); final CardLayout layoutCardSousGrilleY = new CardLayout(); - panelSousGrilleeY.add(comboSousGrilleY, BorderLayout.NORTH); + final BuPanel panelCardSouGrilleY = new BuPanel(layoutCardSousGrilleY); // panelCardSouGrilleY.setLayout(layoutCardSousGrilleY); - panelSousGrilleeY.add(comboSousGrilleY, BorderLayout.NORTH); - panelSousGrilleeY.add(panelCardSouGrilleY, BorderLayout.CENTER); - comboSousGrilleY.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (comboSousGrilleY.getSelectedIndex() == 0) layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); - else if (comboSousGrilleY.getSelectedIndex() == 1) layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); - } - }); - final BuCheckBox cbsousGrilleY = new BuCheckBox(EbliLib.getS("Dessiner les sous grilles Y")); + + cbsousGrilleY.setSelected(target_.isDrawY()); - cbsousGrilleY.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setDrawSousGrilleY(cbsousGrilleY.isSelected()); - } - }); - panelSousGrilleeY.add(cbsousGrilleY, BorderLayout.SOUTH); + + BuPanel combo4=new BuPanel(); + combo4.add(comboSousGrilleY); + panelSousGrilleeY.add(cbsousGrilleY/*, BorderLayout.SOUTH*/); + panelSousGrilleeY.add(combo4/*, BorderLayout.NORTH*/); + panelSousGrilleeY.add(panelCardSouGrilleY/*, BorderLayout.CENTER*/); + cbsousGrilleY.setSelected(false); // -- panel sous grille x manuel 1: choix par nb de cesures --// final BuPanel pnsousYmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnsousYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnsousYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationSousY = BuTextField.createIntegerField(); - btGraduationSousY.setColumns(20); - btGraduationSousY.setValue(new Integer(target_.getNbYSousGraduations())); + btGraduationSousY.setColumns(5); + btGraduationSousY.setValue(new Integer(target_.getNbYSousGraduations()-1)); pnsousYmanu1.add(btGraduationSousY); btGraduationSousY.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -371,14 +505,14 @@ panelCardSouGrilleY.add(pnsousYmanu1, MANUEL1); // -- panel sous grille x manuel 2: choix par longueur des pas --// final BuPanel pnSousYmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - pnSousYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); - final BuTextField btGraduationSousY2 = BuTextField.createIntegerField(); - btGraduationSousY2.setColumns(20); + //pnSousYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + final BuTextField btGraduationSousY2 = BuTextField.createDoubleField(); + btGraduationSousY2.setColumns(5); // btGraduationSousY2.setValue(new Integer(target_.getNbYGraduations())); pnSousYmanu2.add(btGraduationSousY2); btGraduationSousY2.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { - final int newVal = ((Integer) btGraduationSousY2.getValue()).intValue(); + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); if (newVal > 0) { target_.setModeAutomatiqueY(modeAutomatiqueY_); target_.setLenghtStepsSousGradY(newVal); @@ -387,17 +521,64 @@ }); panelCardSouGrilleY.add(pnSousYmanu2, MANUEL2); + cbsousGrilleY.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + if (comboSousGrilleY.getSelectedIndex() == 0){ + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); + final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationSousGradY(newVal); + } + } + else if (comboSousGrilleY.getSelectedIndex() == 1){ + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); + if(btGraduationSousY2.getValue()!=null){ + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsSousGradY(newVal); + }} + } + + target_.setDrawSousGrilleY(cbsousGrilleY.isSelected()); + } + }); + comboSousGrilleY.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (comboSousGrilleY.getSelectedIndex() == 0){ + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); + final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationSousGradY(newVal); + } + } + else if (comboSousGrilleY.getSelectedIndex() == 1){ + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); + if(btGraduationSousY2.getValue()!=null){ + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); + if(newVal>0){ + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsSousGradY(newVal); + }} + } + } + }); + + // -- init des panels grilles --// BuPanel pnGrille = new BuPanel(new GridLayout(2, 1)); pnGrille.add(panelX); - pnGrille.add(panelY); + pnGrille.add(panelSousGrilleeX ); // -- init panel sous grilles --// BuPanel pnSousGrille = new BuPanel(new GridLayout(2, 1)); - pnSousGrille.add(panelSousGrilleeX); + pnSousGrille.add(panelY); pnSousGrille.add(panelSousGrilleeY); - panelSousGrilleeX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous grilles X"))); - panelSousGrilleeY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous grilles Y"))); + panelSousGrilleeX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous graduations X"))); + panelSousGrilleeY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous graduations Y"))); // -- init au modes par defaut --// combo.setSelectedIndex(0); @@ -410,6 +591,8 @@ return pnXY; } + + private BuPanel createMainProperties() { final BuPanel pn = new BuPanel(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -264,7 +264,7 @@ TraceIcon sondeIcone_; - GrPoint sondePt_; + List<GrPoint> sondePt_; int sondeSelectedElement_ = -1; @@ -287,6 +287,7 @@ i = 0; } setV(i); + sondePt_=new ArrayList<GrPoint>(); } void initPaletteMap() { @@ -334,13 +335,24 @@ protected final void paintSonde(final Graphics2D _g2d, final GrMorphisme _versEcran) { if (sondeSelectedElement_ >= 0) { - final GrPoint p = sondePt_.applique(_versEcran); + GrPoint oldPoint=null; + for(GrPoint point:sondePt_) { + + final GrPoint p = point.applique(_versEcran); if (sondeIcone_ == null) { sondeIcone_ = getSondeIcone(); } // _g2d.setXORMode(Color.WHITE); sondeIcone_.paintIconCentre(this, _g2d, p.x_, p.y_); + + //-- on trace la ligne entre les sondes --// + if(oldPoint!=null){ + _g2d.drawLine((int)oldPoint.x_,(int) oldPoint.y_, (int) p.x_,(int) p.y_); + + } + oldPoint=p ; } + } } protected void timeStepFormatChanged() { @@ -389,13 +401,22 @@ protected void updateSavedPalBeforeSet(final BPalettePlage _p) {} - public final boolean changeSonde(final GrPoint _ptReel) { + public final boolean changeSonde(final GrPoint _ptReel, final boolean _add) { if (!isSondeEnable()) { return false; } if (sondePt_ == null) { - sondePt_ = new GrPoint(); + //sondePt_ = new GrPoint(); + sondePt_=new ArrayList<GrPoint>(); } - sondePt_.initialiseAvec(_ptReel); - final int i = sondeSelection(sondePt_, getIsoModelAbstract()); + + GrPoint point=new GrPoint(); + + point.initialiseAvec(_ptReel); + + if(!_add) + sondePt_.clear(); + sondePt_.add(point); + + final int i = sondeSelection(point, getIsoModelAbstract()); final boolean oldIsDraw = sondeSelectedElement_ >= 0; sondeSelectedElement_ = i; if (sondeSelectedElement_ >= 0) { @@ -500,7 +521,7 @@ @Override public void fillWithInterpolateInfo(final InfoData _m) { - getIsoModelAbstract().fillInterpolateInfo(_m, sondeSelectedElement_, sondePt_.x_, sondePt_.y_, getTitle()); + getIsoModelAbstract().fillInterpolateInfo(_m, sondeSelectedElement_, sondePt_.get(0).x_, sondePt_.get(0).y_, getTitle()); } @Override @@ -591,11 +612,11 @@ } public final double getSondeX() { - return sondePt_ == null ? 0 : sondePt_.x_; + return sondePt_ == null ? 0 : sondePt_.get(0).x_; } public final double getSondeY() { - return sondePt_ == null ? 0 : sondePt_.y_; + return sondePt_ == null ? 0 : sondePt_.get(0).y_; } public final JComponent getTargetComponent() { @@ -974,5 +995,10 @@ repaint(); } } + + public List<GrPoint> getLigneBriseeFromSondes(){ + return this.sondePt_; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheLayer.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheLayer.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -10,6 +10,7 @@ import java.awt.Component; import java.awt.Graphics2D; import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -77,7 +78,7 @@ TraceIcon sondeIcone_; - GrPoint sondePt_; + List<GrPoint> sondePt_; JMenuItem[] spec_; @@ -91,6 +92,7 @@ super(new TrPostFlecheModel(_s)); initModel_ = (TrPostFlecheModel) super.modele_; setTitle(TrResource.getS("Vecteurs")); + sondePt_=new ArrayList<GrPoint>(); } public H2dVariableType getSelectedVar() { @@ -161,13 +163,17 @@ protected void paintSonde(final Graphics2D _g2d, final GrMorphisme _versEcran) { if (sondeSelectedElement_ >= 0) { - final GrPoint p = sondePt_.applique(_versEcran); + + for(GrPoint point:sondePt_) { + + final GrPoint p = point.applique(_versEcran); if (sondeIcone_ == null) { sondeIcone_ = TrIsoLayerDefault.getSondeIcone(); } // _g2d.setXORMode(Color.WHITE); sondeIcone_.paintIconCentre(this, _g2d, p.x_, p.y_); } + } } @Override @@ -239,13 +245,22 @@ } } - public boolean changeSonde(final GrPoint _pt) { + public boolean changeSonde(final GrPoint _pt, final boolean add) { if (!isSondeEnable()) { return false; } if (sondePt_ == null) { - sondePt_ = new GrPoint(); + sondePt_=new ArrayList<GrPoint>(); + //sondePt_ = new GrPoint(); } - sondePt_.initialiseAvec(_pt); - final int i = TrIsoLayerDefault.sondeSelection(sondePt_, initModel_); + GrPoint point=new GrPoint(); + + point.initialiseAvec(_pt); + + if(!add) + sondePt_.clear(); + sondePt_.add(point); + + + final int i = TrIsoLayerDefault.sondeSelection(point, initModel_); final boolean oldIsDraw = sondeSelectedElement_ >= 0; sondeSelectedElement_ = i; if (sondeSelectedElement_ >= 0) { @@ -331,7 +346,7 @@ @Override public void fillWithInfo(final InfoData _m) { if (isSondeActive()) { - initModel_.fillInterpolateInfo(_m, sondeSelectedElement_, sondePt_.x_, sondePt_.y_, getTitle()); + initModel_.fillInterpolateInfo(_m, sondeSelectedElement_, sondePt_.get(0).x_, sondePt_.get(0).y_, getTitle()); } else if (!isGrilleActivated()) { initModel_.fillWithInfo(_m, this); @@ -394,11 +409,11 @@ } public double getSondeX() { - return sondePt_ == null ? 0 : sondePt_.x_; + return sondePt_ == null ? 0 : sondePt_.get(0).x_; } public double getSondeY() { - return sondePt_ == null ? 0 : sondePt_.y_; + return sondePt_ == null ? 0 : sondePt_.get(0).y_; } @Override @@ -588,5 +603,9 @@ changeVarStep(); } } + + public List<GrPoint> getLigneBriseeFromSondes(){ + return this.sondePt_; + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -44,6 +44,7 @@ import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; @@ -385,6 +386,8 @@ return null; } + + /* * protected void anim(){ if (anim_ == null) anim_ = new EbliAnimation(this); anim_.go(); } */ @@ -512,10 +515,7 @@ return d != null && !d.isSelectionEmpty(); } - public boolean isSelectionOkForEvolutionSonde() { - return (getCalqueActif() instanceof ZCalqueSondeInterface) - && ((ZCalqueSondeInterface) getCalqueActif()).isSondeActive(); - } + public void startExport(final CtuluUI _impl) { TrPostVisuPanel.startExport(_impl, source_, super.getCurrentSelection()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-02-02 22:46:04 UTC (rev 4437) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-02-03 19:44:50 UTC (rev 4438) @@ -31,6 +31,7 @@ import javax.swing.table.DefaultTableModel; import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ctulu.gis.GISZoneCollectionPoint; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; @@ -40,11 +41,13 @@ import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.BCalquePaletteInfo; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZCalquePoint; import org.fudaa.ebli.calque.ZCalqueSondeInteraction; import org.fudaa.ebli.calque.action.CalqueActionSonde; import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; import org.fudaa.ebli.calque.edition.BPaletteEdition; +import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeDefault; import org.fudaa.ebli.calque.edition.ZModelePointEditable; import org.fudaa.ebli.commun.EbliActionAbstract; import org.fudaa.ebli.commun.EbliActionInterface; @@ -56,6 +59,7 @@ import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.find.EbliFindDialog; import org.fudaa.ebli.find.EbliFindableItem; +import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.palette.BPaletteInfo; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.trace.TraceIcon; @@ -81,6 +85,7 @@ import com.memoire.bu.BuWizardDialog; import com.memoire.fu.FuComparator; import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; @@ -436,10 +441,19 @@ dataP[i][1]=listePoints.getCoordinateN(i).y; } - ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); + //ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); BCalque memoire=vue2d.getCalqueActif(); - ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); + //ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); + + + GISZoneCollectionLigneBrisee ligneBrisee=new GISZoneCollectionLigneBrisee(); + ligneBrisee.addCoordinateSequence(collectionPoint, null,null); + ZModeleLigneBriseeDefault modeleDefault=new ZModeleLigneBriseeDefault(ligneBrisee); + ZCalqueLigneBrisee calqueZ=new ZCalqueLigneBrisee(modeleDefault); + + + //calqueZ.setVisible(true); //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); @@ -740,10 +754,15 @@ } - ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); + //ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); //-- creation du calque - FSigLayerPointEditable layer2=new FSigLayerPointEditable(modelePointEdit,vue2d.getGisEditor()); + //FSigLayerPointEditable layer2=new FSigLayerPointEditable(modelePointEdit,vue2d.getGisEditor()); + GISZoneCollectionLigneBrisee ligneBrisee=new GISZoneCollectionLigneBrisee(); + ligneBrisee.addCoordinateSequence(collectionPoint, null,null); + ZModeleLigneBriseeDefault modeleDefault=new ZModeleLigneBriseeDefault(ligneBrisee); + ZCalqueLigneBrisee layer2=new ZCalqueLigneBrisee(modeleDefault); + layer2.setVisible(true); layer2.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,4,Color.RED)); layer2.setEnabled(true); @@ -754,7 +773,7 @@ vue2d.setCalqueActif(resultatsCalque); //-- creation du panel de choix des variables a selectionner --// - String title=TrResource.getS("<html><... [truncated message content] |
From: <de...@us...> - 2009-02-08 21:14:50
|
Revision: 4446 http://fudaa.svn.sourceforge.net/fudaa/?rev=4446&view=rev Author: deniger Date: 2009-02-08 21:14:45 +0000 (Sun, 08 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibArray.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.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/TrPostSourceComparator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDeleteSelected.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionGroup.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibArray.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibArray.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibArray.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -48,7 +48,7 @@ */ @SuppressWarnings("unchecked") public static boolean isEmpty(final Collection _array) { - return _array == null || _array.size() == 0; + return _array == null || _array.isEmpty(); } /** Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZScene.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZScene.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -769,7 +769,7 @@ * @see javax.swing.event.TreeModelListener#treeNodesInserted(javax.swing.event.TreeModelEvent) */ public void treeNodesInserted(TreeModelEvent e) { - FuLog.warning("ZScene.treeNodesInserted"); + FuLog.trace("ZScene.treeNodesInserted"); refreshRequested(); } @@ -777,7 +777,7 @@ * @see javax.swing.event.TreeModelListener#treeNodesRemoved(javax.swing.event.TreeModelEvent) */ public void treeNodesRemoved(TreeModelEvent e) { - FuLog.warning("ZScene.treeNodesRemoved"); + FuLog.trace("ZScene.treeNodesRemoved"); refreshRequested(); } @@ -785,7 +785,7 @@ * @see javax.swing.event.TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent) */ public void treeStructureChanged(TreeModelEvent e) { - FuLog.warning("ZScene.treeStructureChanged"); + FuLog.trace("ZScene.treeStructureChanged"); refreshRequested(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -429,7 +429,7 @@ if(!ajout()){ positionPointToMove_=determinePointAmodifier(new Point(e.getX(),e.getY())); marqueurDeplacement_=true; - System.out.println("Souris pressed: positionToMove:"+positionPointToMove_); +// System.out.println("Souris pressed: positionToMove:"+positionPointToMove_); repaint(); } else @@ -443,7 +443,7 @@ if(!ajout() && positionPointToMove_!=-1){ modifieExtremite(new Point(e.getX(),e.getY()), positionPointToMove_); positionPointToMove_=-1; - System.out.println("Souris released: positionToMove:"+positionPointToMove_); +// System.out.println("Souris released: positionToMove:"+positionPointToMove_); marqueurDeplacement_=false; positionDeplacement_=null; repaint(); @@ -460,7 +460,7 @@ } public void mouseMoved(MouseEvent e) { - System.out.println("Souris MOVED: "+positionPointToMove_); +// System.out.println("Souris MOVED: "+positionPointToMove_); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-08 21:14:45 UTC (rev 4446) @@ -337,6 +337,7 @@ Ajouter un sommet \xE0 une polyligne=Add a vertex to a polyline Groupe=Group Supprimer un point=Delete a point +Supprimer les objets s\xE9lectionn\xE9s=Delete selected objects Epaisseur du trait=Line weight Style du trait=Line style Vecteurs=Vectors Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -10,9 +10,7 @@ import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.commun.EbliEditorArrow; -import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.InplaceEditorProvider; -import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; import com.memoire.fu.FuLog; @@ -49,12 +47,13 @@ final Rectangle rec = getClientArea(); final Graphics2D g = getGraphics(); // g.translate(rec.x, rec.y); + // FRED comprend rien: pourquoi creer une image interm\xE9diaire ? if (rec.width > 0 && rec.height > 0) { // mode edition // if (imageFleche == null || imageFleche.getWidth() != (rec.width-1) || imageFleche.getHeight() != // (rec.height-1)) { - FuLog.debug("EWI: recreate image"); + // FuLog.debug("EWI: recreate image"); final Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); editor_.model_ = getTraceLigneModel(); @@ -81,14 +80,12 @@ public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, EbliEditorArrow editor) { - // TODO Auto-generated method stub return null; } public Rectangle getInitialEditorComponentBounds( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, EbliEditorArrow editor, Rectangle viewBounds) { - // TODO Auto-generated method stub final Rectangle rec = convertLocalToScene(getClientArea()); rec.width -= 1; rec.height -= 1; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -147,7 +147,7 @@ if(oldTraceligne_.getEpaisseur()!=l.getEpaisseur()){ //-- on ajoute le delta d'epaisseur --// float delta=l.getEpaisseur()-oldTraceligne_.getEpaisseur(); - System.out.println("\n***Delta: "+delta); +// System.out.println("\n***Delta: "+delta); Rectangle sizeWidget=this.getPreferredBounds(); //-- on rajoute le double de delta pour l'\xE9paisseur des 2 cot\xE9s --// sizeWidget.height+=2*delta; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -12,7 +12,7 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetGroupAction; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionGroup; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetUngroupAction; import org.netbeans.api.visual.widget.Widget; @@ -64,7 +64,7 @@ } // -- on rejoue un groupement des node a grouper --// - final EbliNode nodeGroup = new EbliWidgetGroupAction(sceneDestination).groupWidgets(nodeToGroup); + final EbliNode nodeGroup = new EbliWidgetActionGroup(sceneDestination).groupWidgets(nodeToGroup); // listeNodeUndo.add(nodeGroup); // -- undo global --// @@ -77,7 +77,7 @@ public void redo() { new CommandeDuplicate(nodeToGroup, widget_.getEbliScene()).redo(); - new EbliWidgetGroupAction(sceneDestination).groupWidgets(nodeToGroup); + new EbliWidgetActionGroup(sceneDestination).groupWidgets(nodeToGroup); } }); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDeleteSelected.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDeleteSelected.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDeleteSelected.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -0,0 +1,55 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.swing.KeyStroke; + +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * @author deniger + */ +@SuppressWarnings("serial") +public class EbliWidgetActionDeleteSelected extends EbliWidgetActionSimple { + + public EbliWidgetActionDeleteSelected(final EbliScene _scene) { + super(_scene, EbliLib.getS("Supprimer"), CtuluResource.CTULU.getIcon("crystal_non"), "DELETE_SELECTED"); + setKey(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); + setDefaultToolTip(EbliLib.getS("Supprimer les objets s\xE9lectionn\xE9s")); + } + + @Override + public void actionPerformed(final ActionEvent _e) { + final Set selectedObjects = new HashSet(scene_.getSelectedObjects()); + if (CtuluLibArray.isEmpty(selectedObjects)) return; + final List<EbliNode> nodes = new ArrayList<EbliNode>(selectedObjects.size()); + final List<Point> points = new ArrayList<Point>(selectedObjects.size()); + for (final Object obj : selectedObjects) { + final EbliWidget ew = (EbliWidget) scene_.findWidget(obj); + final EbliNode node = (EbliNode) obj; + nodes.add(node); + points.add(ew.getLocation()); + scene_.removeNode(node); + } + scene_.refresh(); + scene_.getCmdMng().addCmd(new CommandSupprimer(nodes, scene_, points)); + scene_.setSelectedObjects(Collections.EMPTY_SET); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -19,13 +18,10 @@ */ public class EbliWidgetActionForeGround extends EbliWidgetActionSimple { - CtuluCommandContainer cmd_; - public EbliWidgetActionForeGround(final EbliScene _scene) { super(_scene, EbliResource.EBLI.getString("Avant plan"), CtuluResource.CTULU.getIcon("crystal_disposerdevant"), "FOREGROUND"); - cmd_ = _scene.getCmdMng(); putValue(NAME, "Avant plan"); } @@ -46,19 +42,7 @@ final EbliNode currentNode = it.next(); if (currentNode != null && currentNode.isMovable()) { - // -- ajout au premier plan du node --// - // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); - -// currentNode.getWidget().bringToFront(); -// -// listeWidget.add(currentNode.getWidget()); -// -// // -- rafraichissement de la scene --// -// scene_.refresh(); -// -// scene_.getTreeModel().nodeMoved( currentNode.getWidget()); - - scene_.bringToLast(currentNode.getWidget()); + scene_.bringToLast(currentNode.getWidget()); } } Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionGroup.java (from rev 4358, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionGroup.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionGroup.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -0,0 +1,188 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.geom.Rectangle2D; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetControllerForGroup; +import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.creator.EbliWidgetGroupCreator; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.ebli.visuallibrary.layout.GroupLayout; +import org.netbeans.api.visual.widget.Widget; + +import com.memoire.bu.BuInsets; + +/** + * @author deniger + */ +@SuppressWarnings("serial") +public class EbliWidgetActionGroup extends EbliWidgetActionSimple { + + public EbliWidgetActionGroup(final EbliScene _scene) { + super(_scene, EbliLib.getS("Grouper"), EbliResource.EBLI.getToolIcon("formatgroup_16.png"), "GROUP_WIDGETS"); + } + + @Override + @SuppressWarnings("unchecked") + public void actionPerformed(final ActionEvent e) { + Set selectedObjects = new HashSet(scene_.getSelectedObjects()); + if (!selectedObjects.isEmpty()) { + + //--Gestion du cas si le graphe a une legende, on veut pouvoir grouper automatiquement sa legende dans le groupe --// + selectedObjects = addLegendeAuto(selectedObjects); + + + performGroup(selectedObjects); + } + + } + + /** + * Ajoute automatiquement les legendes dans la liste a grouper. + * + * @param selectedObjects + * @return + */ + private Set addLegendeAuto(final Set selectedObjects) { + Set<EbliNode> newList = new HashSet<EbliNode>(selectedObjects); + + // -- check automatiquement les l\xE9gendes si il doit en ajouter --// + for (Object objet : selectedObjects) { + if (objet instanceof EbliNode) { + EbliNode nodeCurrent = (EbliNode) objet; + + // instance de graphe + if (nodeCurrent.getWidget().getIntern() instanceof EbliWidgetGraphe) { + // -- candidat --// + EbliNode nodeLegende = ((EbliWidgetGraphe) nodeCurrent.getWidget().getIntern()).getNodeLegende(); + if (nodeLegende != null) + newList.add(nodeLegende);// hashset donc ajoute que si la ref n + // existe pas deja + } else if (nodeCurrent.getWidget().getIntern() instanceof EbliWidgetVueCalque) { + // -- candidat --// + EbliNode nodeLegende = ((EbliWidgetControllerCalque) nodeCurrent.getWidget().getIntern().getController()) + .getNodeLegende(); + if (nodeLegende != null) + newList.add(nodeLegende);// hashset donc ajoute que si la ref n + // existe pas deja + } + + } + } + + + return newList; + } + + /** + * Methode qui realise le groupage des ebliNodes. + * + * @param _selectedObjects + * @return + */ + public EbliNode performGroup(final Set _selectedObjects) { + final EbliNode n = groupWidgets(_selectedObjects); + getScene().getCmdMng().addCmd(new CtuluCommand() { + + public void undo() { + EbliWidgetUngroupAction.degroupObjects(getScene(), n); + + } + + public void redo() { + groupWidgets(_selectedObjects); + } + }); + return n; + } + + public EbliNode groupWidgets(final Collection _selectedObjects) { + final EbliWidgetGroup parent = new EbliWidgetGroup(scene_); + // parent.setController(new EbliWidgetControllerMenuOnly(parent)); + parent.setLayout(new GroupLayout()); + final Point min = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); + final Point max = new Point(-Integer.MAX_VALUE, -Integer.MAX_VALUE); + for (final Object object : _selectedObjects) { + final Widget findWidget = scene_.findWidget(object); + // Rectangle rec = findWidget.getBounds(); + final Rectangle rec = findWidget.convertLocalToScene(findWidget.getBounds()); + min.x = Math.min(min.x, rec.x); + min.y = Math.min(min.y, rec.y); + max.x = Math.max(max.x, rec.x + rec.width); + max.y = Math.max(max.y, rec.y + rec.height); + } + final int w = max.x - min.x; + final int h = max.y - min.y; + final Insets b = BuInsets.INSETS0000;// parent.getBorder().getInsets(); + + // System.err.println(b); + final Rectangle bounds = new Rectangle(-b.left, -b.top, w + b.left + b.right, h + b.top + b.bottom); + parent.setPreferredBounds(bounds); + parent.setPreferredLocation(new Point(min.x - bounds.x - b.left, min.y - bounds.y - b.top)); + parent.setPreferredSize(new Dimension(w + b.left + b.right, h + b.top + b.bottom)); + + for (final Object object : _selectedObjects) { + final Widget findWidget = scene_.findWidget(object); + final Rectangle widgetBounds = findWidget.getBounds(); + final Rectangle rec = findWidget.convertLocalToScene(widgetBounds); + final EbliWidget ew = (EbliWidget) findWidget; + ew.getController().removeActionResize(); + // scene_.removeNode((EbliNode) object); + + + findWidget.removeFromParent(); + final int dx = rec.x - min.x; + final int dy = rec.y - min.y; + + final Point pt = new Point(dx - widgetBounds.x, dy - widgetBounds.y); + findWidget.setPreferredLocation(pt); + parent.addChild(findWidget); + final float rMinX = ((float) dx) / w; + final float rMinY = ((float) dy) / h; + final float rMaxX = ((float) (w - widgetBounds.width - dx)) / w; + final float rMaxY = ((float) (h - widgetBounds.height - dy)) / h; + parent.setChildConstraint(findWidget, new Rectangle2D.Float(rMinX, rMinY, rMaxX, rMaxY)); + + + + + } + //-- sauvegarde des proportions pour le ungroup --// + parent.setProportions(); + + final EbliWidgetGroupCreator creator = new EbliWidgetGroupCreator(); + + parent.setGroup(true); + creator.setW(parent); + + final EbliNodeDefault node = new EbliNodeDefault(); + node.setPreferedLocation(min); + node.setTitle(EbliLib.getS("Groupe")); + node.setCreator(creator); + parent.setController(new EbliWidgetControllerForGroup(parent)); + scene_.addNode(node); + scene_.setSelectedObjects(new HashSet(Arrays.asList(node))); + return node; + } +} \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetGroupAction.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -1,187 +0,0 @@ -/** - * Licence GPL - * Copyright Genesis - */ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Dimension; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.geom.Rectangle2D; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetControllerForGroup; -import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; -import org.fudaa.ebli.visuallibrary.creator.EbliWidgetGroupCreator; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; -import org.fudaa.ebli.visuallibrary.layout.GroupLayout; -import org.netbeans.api.visual.widget.Widget; - -import com.memoire.bu.BuInsets; - -/** - * @author deniger - */ -public class EbliWidgetGroupAction extends EbliWidgetActionSimple { - - public EbliWidgetGroupAction(final EbliScene _scene) { - super(_scene, EbliLib.getS("Grouper"), EbliResource.EBLI.getToolIcon("formatgroup_16.png"), "GROUP_WIDGETS"); - } - - @Override - @SuppressWarnings("unchecked") - public void actionPerformed(final ActionEvent e) { - Set selectedObjects = new HashSet(scene_.getSelectedObjects()); - if (!selectedObjects.isEmpty()) { - - //--Gestion du cas si le graphe a une legende, on veut pouvoir grouper automatiquement sa legende dans le groupe --// - selectedObjects = addLegendeAuto(selectedObjects); - - - performGroup(selectedObjects); - } - - } - - /** - * Ajoute automatiquement les legendes dans la liste a grouper. - * - * @param selectedObjects - * @return - */ - private Set addLegendeAuto(final Set selectedObjects) { - Set<EbliNode> newList = new HashSet<EbliNode>(selectedObjects); - - // -- check automatiquement les l\xE9gendes si il doit en ajouter --// - for (Object objet : selectedObjects) { - if (objet instanceof EbliNode) { - EbliNode nodeCurrent = (EbliNode) objet; - - // instance de graphe - if (nodeCurrent.getWidget().getIntern() instanceof EbliWidgetGraphe) { - // -- candidat --// - EbliNode nodeLegende = ((EbliWidgetGraphe) nodeCurrent.getWidget().getIntern()).getNodeLegende(); - if (nodeLegende != null) - newList.add(nodeLegende);// hashset donc ajoute que si la ref n - // existe pas deja - } else if (nodeCurrent.getWidget().getIntern() instanceof EbliWidgetVueCalque) { - // -- candidat --// - EbliNode nodeLegende = ((EbliWidgetControllerCalque) nodeCurrent.getWidget().getIntern().getController()) - .getNodeLegende(); - if (nodeLegende != null) - newList.add(nodeLegende);// hashset donc ajoute que si la ref n - // existe pas deja - } - - } - } - - - return newList; - } - - /** - * Methode qui realise le groupage des ebliNodes. - * - * @param _selectedObjects - * @return - */ - public EbliNode performGroup(final Set _selectedObjects) { - final EbliNode n = groupWidgets(_selectedObjects); - getScene().getCmdMng().addCmd(new CtuluCommand() { - - public void undo() { - EbliWidgetUngroupAction.degroupObjects(getScene(), n); - - } - - public void redo() { - groupWidgets(_selectedObjects); - } - }); - return n; - } - - public EbliNode groupWidgets(final Collection _selectedObjects) { - final EbliWidgetGroup parent = new EbliWidgetGroup(scene_); - // parent.setController(new EbliWidgetControllerMenuOnly(parent)); - parent.setLayout(new GroupLayout()); - final Point min = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); - final Point max = new Point(-Integer.MAX_VALUE, -Integer.MAX_VALUE); - for (final Object object : _selectedObjects) { - final Widget findWidget = scene_.findWidget(object); - // Rectangle rec = findWidget.getBounds(); - final Rectangle rec = findWidget.convertLocalToScene(findWidget.getBounds()); - min.x = Math.min(min.x, rec.x); - min.y = Math.min(min.y, rec.y); - max.x = Math.max(max.x, rec.x + rec.width); - max.y = Math.max(max.y, rec.y + rec.height); - } - final int w = max.x - min.x; - final int h = max.y - min.y; - final Insets b = BuInsets.INSETS0000;// parent.getBorder().getInsets(); - - // System.err.println(b); - final Rectangle bounds = new Rectangle(-b.left, -b.top, w + b.left + b.right, h + b.top + b.bottom); - parent.setPreferredBounds(bounds); - parent.setPreferredLocation(new Point(min.x - bounds.x - b.left, min.y - bounds.y - b.top)); - parent.setPreferredSize(new Dimension(w + b.left + b.right, h + b.top + b.bottom)); - - for (final Object object : _selectedObjects) { - final Widget findWidget = scene_.findWidget(object); - final Rectangle widgetBounds = findWidget.getBounds(); - final Rectangle rec = findWidget.convertLocalToScene(widgetBounds); - final EbliWidget ew = (EbliWidget) findWidget; - ew.getController().removeActionResize(); - // scene_.removeNode((EbliNode) object); - - - findWidget.removeFromParent(); - final int dx = rec.x - min.x; - final int dy = rec.y - min.y; - - final Point pt = new Point(dx - widgetBounds.x, dy - widgetBounds.y); - findWidget.setPreferredLocation(pt); - parent.addChild(findWidget); - final float rMinX = ((float) dx) / w; - final float rMinY = ((float) dy) / h; - final float rMaxX = ((float) (w - widgetBounds.width - dx)) / w; - final float rMaxY = ((float) (h - widgetBounds.height - dy)) / h; - parent.setChildConstraint(findWidget, new Rectangle2D.Float(rMinX, rMinY, rMaxX, rMaxY)); - - - - - } - //-- sauvegarde des proportions pour le ungroup --// - parent.setProportions(); - - final EbliWidgetGroupCreator creator = new EbliWidgetGroupCreator(); - - parent.setGroup(true); - creator.setW(parent); - - final EbliNodeDefault node = new EbliNodeDefault(); - node.setPreferedLocation(min); - node.setTitle(EbliLib.getS("Groupe")); - node.setCreator(creator); - parent.setController(new EbliWidgetControllerForGroup(parent)); - scene_.addNode(node); - scene_.setSelectedObjects(new HashSet(Arrays.asList(node))); - return node; - } -} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -39,13 +39,14 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDeleteSelected; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionGroup; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetGroupAction; import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimAdapter; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; @@ -364,7 +365,7 @@ * @param node */ public Widget addNode(final EbliNode node) { - Widget addNode = getSceneCourante().addNode(node); + final Widget addNode = getSceneCourante().addNode(node); // -- rafraichissement de la scene pour eviter les plantages --// getSceneCourante().refresh(); @@ -525,60 +526,51 @@ } } - // ajout de la combo de choix des layout - // res.add(comboMultiScenes_); - // JButton addScene = new - // JButton(CtuluResource.CTULU.getIcon("crystal_ajouter")); - // addScene.setActionCommand("AJOUTLAYOUT"); - // addScene.addActionListener(this); - // res.add(addScene); return res.toArray(new JComponent[res.size()]); } public List<EbliActionAbstract> getActions() { if (actions_ == null) { final List<EbliActionAbstract> init = new ArrayList<EbliActionAbstract>(20); - init.add(new EbliWidgetActionAlign.Left(getSceneCourante())); - init.add(new EbliWidgetActionAlign.Right(getSceneCourante())); - init.add(new EbliWidgetActionAlign.Middle(getSceneCourante())); - init.add(new EbliWidgetActionAlign.Center(getSceneCourante())); - init.add(new EbliWidgetActionAlign.Top(getSceneCourante())); - init.add(new EbliWidgetActionAlign.Bottom(getSceneCourante())); + final TrPostScene sceneCourante = getSceneCourante(); + init.add(new EbliWidgetActionAlign.Left(sceneCourante)); + init.add(new EbliWidgetActionAlign.Right(sceneCourante)); + init.add(new EbliWidgetActionAlign.Middle(sceneCourante)); + init.add(new EbliWidgetActionAlign.Center(sceneCourante)); + init.add(new EbliWidgetActionAlign.Top(sceneCourante)); + init.add(new EbliWidgetActionAlign.Bottom(sceneCourante)); init.add(null); - init.add(new EbliWidgetActionForeGround(getSceneCourante())); - init.add(new EbliWidgetActionBackGround(getSceneCourante())); + init.add(new EbliWidgetActionForeGround(sceneCourante)); + init.add(new EbliWidgetActionBackGround(sceneCourante)); init.add(null); // -- actions de retaillage min et max --// // init.add(new EbliWidgetActionRetaillageHorizontal(getScene(), // EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MIN)); - init.add(new EbliWidgetActionRetaillageHorizontal(getSceneCourante(), + init.add(new EbliWidgetActionRetaillageHorizontal(sceneCourante, EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MAX)); - init.add(new EbliWidgetActionRetaillageVertical(getSceneCourante(), - EbliWidgetActionRetaillageVertical.RETAIILLAGE_MAX)); + init + .add(new EbliWidgetActionRetaillageVertical(sceneCourante, EbliWidgetActionRetaillageVertical.RETAIILLAGE_MAX)); init.add(null); // -- blocage des widgets --// - // init.add(new - // EbliWidgetActionBloqueOuDebloqueWidget.Bloque(getSceneCourante())); - // init.add(new - // EbliWidgetActionBloqueOuDebloqueWidget.DeBloque(getSceneCourante())); + init.add(new EbliWidgetActionGroup(sceneCourante)); init.add(null); - init.add(new EbliWidgetGroupAction(getSceneCourante())); + init.add(new EbliWidgetActionDeleteSelected(sceneCourante)); init.add(null); // -- action de duplication --// // init.add(new EbliWidgetActionDuplicate(getSceneCourante())); - init.add(new TrPostActionDuplicate(getSceneCourante(), projet_)); - init.add(new TrPostActionDuplicateLayout(getSceneCourante(), projet_)); - init.add(new TrPostActionChangeSceneForWidget(getSceneCourante(), projet_)); + init.add(new TrPostActionDuplicate(sceneCourante, projet_)); + init.add(new TrPostActionDuplicateLayout(sceneCourante, projet_)); + init.add(new TrPostActionChangeSceneForWidget(sceneCourante, projet_)); init.add(null); // -- Action sur le format --// // init.add(new EbliWidgetActionColorForeground(getSceneCourante())); - init.add(new EbliWidgetActionColorBackground.ForScene(getSceneCourante())); + init.add(new EbliWidgetActionColorBackground.ForScene(sceneCourante)); // -- action de configuration des composants graphiques--// - init.add(new EbliWidgetActionConfigure(getSceneCourante())); + init.add(new EbliWidgetActionConfigure(sceneCourante)); init.add(null); // -- objets graphiques de base --// @@ -586,22 +578,23 @@ // -- ajout d'une action specifique de recreation du calque en cas de // suppression, on choisit la source a prendre en compte --// init.add(null); - init.add(new EbliActionSimple(EbliResource.EBLI.getString("Gestion Multi-Sources"), EbliResource.EBLI.getToolIcon("tableau"), - "MULTI SOURCES") { - public void actionPerformed(final ActionEvent _evt) { - // -- affichage de la fenetre de gestion multi projet --// - if (!projet_.filleProjetctManager_.isVisible()) { -// filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, -// filleProjetctManager_.getSize().height / 2); + init.add(new EbliActionSimple(EbliResource.EBLI.getString("Gestion Multi-Sources"), EbliResource.EBLI + .getToolIcon("tableau"), "MULTI SOURCES") { + @Override + public void actionPerformed(final ActionEvent _evt) { + // -- affichage de la fenetre de gestion multi projet --// + if (!projet_.filleProjetctManager_.isVisible()) { + // filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, + // filleProjetctManager_.getSize().height / 2); - projet_.impl_.addInternalFrame(projet_.filleProjetctManager_); - } else projet_.filleProjetctManager_.moveToFront(); - } - }); - + projet_.impl_.addInternalFrame(projet_.filleProjetctManager_); + } else projet_.filleProjetctManager_.moveToFront(); + } + }); + init.add(new TrPostActionChooseAndCreateCalque(projet_, this)); init.add(null); - init.add(new EbliWidgetAnimAdapter(getSceneCourante()).createAction()); + init.add(new EbliWidgetAnimAdapter(sceneCourante).createAction()); init.add(null); init.add(new TrPostWizardCreateScope.ImportAction(projet_)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -125,12 +125,8 @@ // srcVar.add(common[i]); finalVar.add(TrPostSourceComparatorBuilder.createDeltaVar(common[i], false)); } - variable_ = (H2dVariableType[]) finalVar.toArray(new H2dVariableType[finalVar.size()]); + setInitVar((H2dVariableType[]) finalVar.toArray(new H2dVariableType[finalVar.size()])); srcVariable_ = common; - initVarIdx_ = new TObjectIntHashMap(variable_.length); - for (int i = variable_.length - 1; i >= 0; i--) { - initVarIdx_.put(variable_[i], i); - } fireVariableAdd(false); fireVarListModelChanged(); } @@ -169,11 +165,10 @@ return inv_ ? -res : res; } - public void fillInfosCreationWith(Map<String,String> _infosCreation){ - + public void fillInfosCreationWith(Map<String, String> _infosCreation) { + } - - + public boolean isRubar() { return ref_.isRubar(); } Modified: 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/TrPostPersistenceManager.java 2009-02-06 13:30:12 UTC (rev 4445) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-02-08 21:14:45 UTC (rev 4446) @@ -32,7 +32,7 @@ import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetGroup; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetGroupAction; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionGroup; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; import org.fudaa.ebli.visuallibrary.persist.EbliSceneSerializeXml; import org.fudaa.ebli.visuallibrary.persist.EbliWidgetGroupSerializeXml; @@ -1406,7 +1406,7 @@ // -- on met a jour le ebliNode avec les infos du groupe sauv\xE9 --// final EbliWidgetGroupSerializeXml infoGroup = listeGroupes.get(idGroup); - if (!infoGroup.isFusion()) nodeGroup = new EbliWidgetGroupAction(scenToUpdate).performGroup(listeToGroup); + if (!infoGroup.isFusion()) nodeGroup = new EbliWidgetActionGroup(scenToUpdate).performGroup(listeToGroup); else nodeGroup = new TrPostActionFusionCalques(scenToUpdate, trprojet_).performGroupFusion(listeToGroup); if (infoGroup != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-02-08 22:18:46
|
Revision: 4447 http://fudaa.svn.sourceforge.net/fudaa/?rev=4447&view=rev Author: deniger Date: 2009-02-08 22:18:41 +0000 (Sun, 08 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluListModelEmpty.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRatio.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorArrowEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorClassLoader.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorFlecheSimple.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorFlecheSimple.java 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/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheCellRenderer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheTreeCellRenderer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/persist/EbliSceneSerializeXml.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluListModelEmpty.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluListModelEmpty.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluListModelEmpty.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -9,12 +9,14 @@ import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; /** * @author Fred Deniger * @version $Id: CtuluListModelEmpty.java,v 1.2 2007-05-04 13:43:23 deniger Exp $ */ -public final class CtuluListModelEmpty implements ComboBoxModel { +public final class CtuluListModelEmpty implements ComboBoxModel,TableModel { public final static CtuluListModelEmpty EMPTY = new CtuluListModelEmpty(); @@ -24,10 +26,28 @@ public void addListDataListener(final ListDataListener _l) {} + public void addTableModelListener(TableModelListener _l) {} + + public Class<?> getColumnClass(int _columnIndex) { + return null; + } + + public int getColumnCount() { + return 0; + } + + public String getColumnName(int _columnIndex) { + return null; + } + public Object getElementAt(final int _index) { return null; } + public int getRowCount() { + return 0; + } + public Object getSelectedItem() { return null; } @@ -36,7 +56,19 @@ return 0; } + public Object getValueAt(int _rowIndex, int _columnIndex) { + return null; + } + + public boolean isCellEditable(int _rowIndex, int _columnIndex) { + return false; + } + public void removeListDataListener(final ListDataListener _l) {} + public void removeTableModelListener(TableModelListener _l) {} + public void setSelectedItem(final Object _anItem) {} + + public void setValueAt(Object _value, int _rowIndex, int _columnIndex) {} } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -36,10 +36,13 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JMenu; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; +import javax.swing.JTable; import javax.swing.ListCellRenderer; +import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; @@ -48,7 +51,11 @@ import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluSelectionInterface; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluListModelEmpty; +import org.fudaa.ctulu.gui.CtuluTable; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; import org.fudaa.ctulu.gui.CtuluTreeComboboxRenderer; import org.fudaa.ctulu.image.CtuluImageProducer; @@ -69,12 +76,13 @@ import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuDynamicMenu; +import com.memoire.bu.BuInsets; import com.memoire.bu.BuLabel; import com.memoire.bu.BuLib; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPanel; import com.memoire.bu.BuPopupMenu; -import com.memoire.bu.BuTable; +import com.memoire.bu.BuToolButton; /** * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, @@ -141,6 +149,7 @@ cq_ = _cq; } + @Override protected void build() { removeAll(); final EbliActionInterface[] ac = cq_.getActions(); @@ -149,6 +158,7 @@ } } + @Override protected boolean isActive() { return true; } @@ -178,6 +188,7 @@ cqDonnees_ = _cqDonnees; } + @Override protected void build() { if (getMenuComponentCount() == 0) { fillWithAllLayersAction(this); @@ -196,6 +207,7 @@ return m; } + @Override protected boolean isActive() { return true; } @@ -284,7 +296,7 @@ return gcDonnees_; } - public void setGcDonnees_(BGroupeCalque gcDonnees_) { + public void setGcDonnees_(final BGroupeCalque gcDonnees_) { this.gcDonnees_ = gcDonnees_; } @@ -359,6 +371,7 @@ gcDonnees_ = new BGroupeCalque() { // B.M. Pour eviter le plantage, une boite est retourn\xE9e si rien n'est affich\xE9 ou boite non conforme. + @Override public GrBoite getDomaine() { GrBoite bt = super.getDomaine(); @@ -786,6 +799,7 @@ public ComboBoxModel getItemModel() { return new CtuluTreeComboboxModel(getArbreCalqueModel()) { + @Override public boolean isSelectable(final Object _o) { return EbliFindDialog.isCalqueFindable(_o); } @@ -834,6 +848,7 @@ public ListCellRenderer getComboRender() { return new CtuluTreeComboboxRenderer(getArbreCalqueModel(), new BArbreCalque.ArbreCellLabel()) { + @Override public void update(final JList _l, final JComponent _comp, final boolean _isSelected, final Object _value) { final JLabel lb = (JLabel) _comp; _comp.setToolTipText(lb.getText()); @@ -1001,11 +1016,11 @@ /* * @see org.fudaa.ebli.calque.ZSelectionListener#selectionChanged(org.fudaa.ebli.calque.ZSelectionEvent) */ - public void selectionChanged(ZSelectionEvent _evt) { + public void selectionChanged(final ZSelectionEvent _evt) { modelArbre_.fireObservableChanged(); } - public ZEbliCalquesPanel duplicate(Map options) { + public ZEbliCalquesPanel duplicate(final Map options) { /* * ZEbliCalquesPanel duplic = new ZEbliCalquesPanel(new CtuluUIDefault()); * @@ -1028,22 +1043,47 @@ public BuPanel buildInfosCreationComposant() { if (infosCreation_ == null || infosCreation_.keySet() == null || infosCreation_.keySet().size() == 0) return new BuPanel(); - List<String> liste = new ArrayList<String>(infosCreation_.keySet()); - Collections.sort(liste); - List<String> col = new ArrayList<String>(); - col.add(EbliResource.EBLI.getString("Nom")); - col.add(EbliResource.EBLI.getString("Valeur")); - EbliModelInfos modelInfos = new EbliModelInfos(liste, infosCreation_, col); - BuTable table = new BuTable(modelInfos); + final JTable table = createTable(); - table.getColumnModel().getColumn(0).setPreferredWidth(20); - BuPanel conteneur = new BuPanel(new BorderLayout()); + final BuPanel conteneur = new BuPanel(new BorderLayout()); conteneur.add(new JScrollPane(table), BorderLayout.CENTER); - conteneur.add(new JLabel("<html><body><b>" + EbliResource.EBLI.getString("Infos cr\xE9ations") + "</b></body></html>", - JLabel.CENTER), BorderLayout.NORTH); + final BuToolButton bt = new BuToolButton(EbliResource.EBLI.getToolIcon("haut-droit.gif")); + bt.addActionListener(new ActionListener() { + + public void actionPerformed(final ActionEvent _e) { + final CtuluDialogPanel pn = new CtuluDialogPanel(); + pn.setLayout(new BuBorderLayout()); + final JTable newtable = new CtuluTable(table.getModel()); + newtable.getColumnModel().getColumn(0).setPreferredWidth(20); + pn.add(new JScrollPane(newtable), BorderLayout.CENTER); + pn.afficheModale(table, CtuluDialog.OK_OPTION); + newtable.setModel(CtuluListModelEmpty.EMPTY); + } + }); + JPanel top = new BuPanel(new BuBorderLayout()); + + top.add(new JLabel("<html><body><b>" + EbliResource.EBLI.getString("Infos cr\xE9ations") + "</b></body></html>", + SwingConstants.CENTER), BorderLayout.CENTER); + top.add(bt, BuBorderLayout.EAST); + bt.setBorder(null); + bt.setMargin(BuInsets.INSETS0000); + conteneur.add(top, BuBorderLayout.NORTH); return conteneur; } + private JTable createTable() { + final List<String> liste = new ArrayList<String>(infosCreation_.keySet()); + Collections.sort(liste); + final List<String> col = new ArrayList<String>(); + col.add(EbliResource.EBLI.getString("Nom")); + col.add(EbliResource.EBLI.getString("Valeur")); + + final EbliModelInfos modelInfos = new EbliModelInfos(liste, infosCreation_, col); + final JTable table = new CtuluTable(modelInfos); + table.getColumnModel().getColumn(0).setPreferredWidth(20); + return table; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliEditorArrow.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -5,14 +5,12 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Image; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.image.BufferedImage; -import java.awt.image.ImageProducer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -28,8 +26,6 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; - - import com.memoire.bu.BuPanel; @@ -43,6 +39,7 @@ * @author Adrien Hadoux * */ +@SuppressWarnings("serial") public class EbliEditorArrow extends BuPanel implements CtuluImageProducer, MouseListener, MouseMotionListener { public final static int ExtremiteTete=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-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -1,166 +1,144 @@ package org.fudaa.ebli.commun; import java.util.ArrayList; -import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; import javax.swing.event.TableModelListener; import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.ressource.EbliResource; - /** - * Modele de tableau qui utilise une map <str, str>. - * Affiche des couple clef/valeurs de la map tri\xE9es. - * Utilis\xE9 en particulier pour les infos de creation des extends zeblicalquePanel. - * Prend en charge l'\xE9dition dans la map. - * Organise les infos par ordre lexicographique. - * Pour changer le trie a sa guise, faire son comparator et le placer dans le bon constructeur. + * Modele de tableau qui utilise une map <str, str>. Affiche des couple clef/valeurs de la map tri\xE9es. Utilis\xE9 en + * particulier pour les infos de creation des extends zeblicalquePanel. Prend en charge l'\xE9dition dans la map. Organise + * les infos par ordre lexicographique. Pour changer le trie a sa guise, faire son comparator et le placer dans le bon + * constructeur. + * * @author Adrien Hadoux - * */ -public class EbliModelInfos extends AbstractTableModel{ +public class EbliModelInfos extends AbstractTableModel { - private static final long serialVersionUID = -2080709568281587469L; - private List<String> listeKey_; - private List<String> listeValue_; - private final List<String> colonnes_; - /** - * Les infos de la table. - */ - private Map<String,String> infos_; - private final Comparator<String> comparator_; + private static final long serialVersionUID = -2080709568281587469L; + private List<String> listeKey_; + private List<String> listeValue_; + private final List<String> colonnes_; + /** + * Les infos de la table. + */ + private Map<String, String> infos_; + private final Comparator<String> comparator_; - public EbliModelInfos(List<String> liste,Map<String,String> map,List<String> colonnes){ - - this(liste,map,colonnes,null); - } + public EbliModelInfos(List<String> liste, Map<String, String> map, List<String> colonnes) { - public EbliModelInfos(List<String> liste,Map<String,String> map,List<String> colonnes,Comparator<String> comparator){ - super(); - listeKey_=liste; - infos_=map; - comparator_=comparator; - colonnes_=colonnes; - - listeValue_=new ArrayList<String>(); - for(String key:liste) - listeValue_.add(map.get(key)); - - } + this(liste, map, colonnes, null); + } + public EbliModelInfos(List<String> liste, Map<String, String> map, List<String> colonnes, + Comparator<String> comparator) { + super(); + listeKey_ = liste; + infos_ = map; + comparator_ = comparator; + colonnes_ = colonnes; - @Override - public String getColumnName(int column) { - // TODO Auto-generated method stub - return colonnes_.get(column); - } + listeValue_ = new ArrayList<String>(); + for (String key : liste) + listeValue_.add(map.get(key)); - public int getRowCount() { - // TODO Auto-generated method stub - return infos_.keySet().size()+1; - } + } - public Object getValueAt(int row, int column) { + @Override + public String getColumnName(int column) { + return colonnes_.get(column); + } - if(row==getRowCount()-1){ - if(column==0) - return EbliResource.EBLI.getString("Editable"); - else - return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); - }else + public int getRowCount() { + return infos_.keySet().size() + 1; + } - if(column==0) - return getKey(row); - else - return getValue(row); + public Object getValueAt(int row, int column) { - } + if (row == getRowCount() - 1) { + if (column == 0) return EbliResource.EBLI.getString("Editable"); + else return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); + } else + if (column == 0) return getKey(row); + else return getValue(row); - public void setValueAt(Object value, int row, int column) { + } - if(value==null)return; + public void setValueAt(Object value, int row, int column) { - if(row==getRowCount()-1 && !((String)value).equals(EbliResource.EBLI.getString("Editable"))){ - //-- ajout --// - 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(); + if (value == null) return; - }else{ - //-- modification --// - if(column==0){ - 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(); - } - } - public String getKey(int row){ + if (row == getRowCount() - 1 && !((String) value).equals(EbliResource.EBLI.getString("Editable"))) { + // -- ajout --// + 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(); - if(row>=infos_.keySet().size()) - return ""; - return listeKey_.get(row); - } + } else { + // -- modification --// + if (column == 0) { + 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(); + } + } + public String getKey(int row) { + if (row < 0 || row >= infos_.size()) return ""; + return listeKey_.get(row); + } - public void fireTableDataChanged() { + 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_); - super.fireTableDataChanged(); - } + super.fireTableDataChanged(); + } - public String getValue(int row){ - return listeValue_.get(row); - } + public String getValue(int row) { + if (row < 0 || row > listeValue_.size() - 1) return CtuluLibString.EMPTY_STRING; + return listeValue_.get(row); + } - @Override - public boolean isCellEditable(int row, int column) { - return true; - } + @Override + public boolean isCellEditable(int row, int column) { + return true; + } - @Override - public void addTableModelListener(TableModelListener l) { - } + @Override + public void addTableModelListener(TableModelListener l) {} - @Override - public Class<?> getColumnClass(int columnIndex) { - return String.class; - } + @Override + public Class<?> getColumnClass(int columnIndex) { + return String.class; + } - public int getColumnCount() { - return colonnes_.size(); - } + public int getColumnCount() { + return colonnes_.size(); + } - public void removeTableModelListener(TableModelListener l) { - - } + public void removeTableModelListener(TableModelListener l) { + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -7,14 +7,11 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import javax.swing.JComponent; - import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibGenerator; @@ -31,8 +28,6 @@ import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; -import sun.misc.Cleaner; - /** * classe de gestion de la scene principale * Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetArrowEditor.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -13,8 +13,6 @@ import org.netbeans.api.visual.action.InplaceEditorProvider; import org.netbeans.api.visual.widget.Widget; -import com.memoire.fu.FuLog; - /** * Classe editeur de Fleche * Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -146,8 +146,8 @@ final Rectangle bounds = getClientArea(); final AffineTransform previousTransform = graphics.getTransform(); graphics.translate(bounds.x, bounds.y); - final double zoomFactor = getScene().getZoomFactor(); - graphics.scale(1 / zoomFactor, 1 / zoomFactor); + final double factor = getScene().getZoomFactor(); + graphics.scale(1 / factor, 1 / factor); component.print(graphics); graphics.setTransform(previousTransform); if (isDoubleBuffered) ((JComponent) component).setDoubleBuffered(isDoubleBuffered); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -325,7 +325,7 @@ public void constructMenuDeplacerDansArbre(JPopupMenu menu){ - EbliActionSimple action=null; +// EbliActionSimple action=null; menu.add( new EbliActionSimple(EbliResource.EBLI.getString("En premier"),EbliResource.EBLI.getIcon("enpremier"),"ENPREMIER"){ public void actionPerformed(final ActionEvent _e) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerFlecheEditor.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -9,14 +9,12 @@ import javax.swing.JToolBar; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; import org.fudaa.ebli.commun.EbliEditorArrow; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import org.netbeans.api.visual.action.InplaceEditorProvider; import com.memoire.bu.BuMenuBar; -import com.memoire.bu.BuPanel; /** * Controller de l'editeur de fleches. Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -4,7 +4,6 @@ */ package org.fudaa.ebli.visuallibrary; -import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -44,30 +44,30 @@ * Modification ici: pour activer l editor, il suffit d appuyer une seule fois sur l editeur */ @Override - public State mouseClicked(final Widget widget, final WidgetMouseEvent event) { + public State mouseClicked(final Widget _widget, final WidgetMouseEvent _event) { - if (event.getButton() == MouseEvent.BUTTON1 /* && event.getClickCount() == 2 */) { - final Point p = event.getPoint(); - if (widget.getClientArea().contains(p)) if (openEditor(widget)) return State.createLocked(widget, this); + if (_event.getButton() == MouseEvent.BUTTON1 /* && event.getClickCount() == 2 */) { + final Point p = _event.getPoint(); + if (_widget.getClientArea().contains(p)) if (openEditor(_widget)) return State.createLocked(_widget, this); } return State.REJECTED; } @Override - public State mousePressed(final Widget widget, final WidgetMouseEvent event) { + public State mousePressed(final Widget _widget, final WidgetMouseEvent _event) { if (editor != null) closeEditor(true); return State.REJECTED; } @Override - public State mouseReleased(final Widget widget, final WidgetAction.WidgetMouseEvent event) { + public State mouseReleased(final Widget _widget, final WidgetAction.WidgetMouseEvent _event) { if (editor != null) closeEditor(true); return State.REJECTED; } @Override - public State keyPressed(final Widget widget, final WidgetKeyEvent event) { - if (event.getKeyChar() == KeyEvent.VK_ENTER) if (openEditor(widget)) return State.createLocked(widget, this); + public State keyPressed(final Widget _widget, final WidgetKeyEvent _event) { + if (_event.getKeyChar() == KeyEvent.VK_ENTER) if (openEditor(_widget)) return State.createLocked(_widget, this); return State.REJECTED; } @@ -75,34 +75,34 @@ return editor != null; } - public final boolean openEditor(final Widget widget) { + public final boolean openEditor(final Widget _widget) { if (editor != null) return false; - final Scene scene = widget.getScene(); + final Scene scene = _widget.getScene(); final JComponent component = scene.getView(); if (component == null) return false; - editor = provider.createEditorComponent(this, widget); + editor = provider.createEditorComponent(this, _widget); if (editor == null) return false; - this.widget = widget; + this.widget = _widget; component.add(editor); - provider.notifyOpened(this, widget, editor); + provider.notifyOpened(this, _widget, editor); - Rectangle rectangle = widget.getScene().convertSceneToView(widget.convertLocalToScene(widget.getBounds())); + Rectangle sceneRect = _widget.getScene().convertSceneToView(_widget.convertLocalToScene(_widget.getBounds())); - final Point center = GeomUtil.center(rectangle); + final Point center = GeomUtil.center(sceneRect); final Dimension size = editor.getMinimumSize(); - if (rectangle.width > size.width) size.width = rectangle.width; - if (rectangle.height > size.height) size.height = rectangle.height; + if (sceneRect.width > size.width) size.width = sceneRect.width; + if (sceneRect.height > size.height) size.height = sceneRect.height; final int x = center.x - size.width / 2; final int y = center.y - size.height / 2; - rectangle = new Rectangle(x, y, size.width, size.height); - updateRectangleToFitToView(rectangle); + sceneRect = new Rectangle(x, y, size.width, size.height); + updateRectangleToFitToView(sceneRect); - final Rectangle r = provider.getInitialEditorComponentBounds(this, widget, editor, rectangle); - this.rectangle = r != null ? r : rectangle; + final Rectangle r = provider.getInitialEditorComponentBounds(this, _widget, editor, sceneRect); + this.rectangle = r != null ? r : sceneRect; editor.setBounds(x, y, size.width, size.height); notifyEditorComponentBoundsChanged(); @@ -111,12 +111,13 @@ return true; } - private void updateRectangleToFitToView(final Rectangle rectangle) { + private void updateRectangleToFitToView(final Rectangle _rectangle) { final JComponent component = widget.getScene().getView(); - if (rectangle.x + rectangle.width > component.getWidth()) rectangle.x = component.getWidth() - rectangle.width; - if (rectangle.y + rectangle.height > component.getHeight()) rectangle.y = component.getHeight() - rectangle.height; - if (rectangle.x < 0) rectangle.x = 0; - if (rectangle.y < 0) rectangle.y = 0; + if (_rectangle.x + _rectangle.width > component.getWidth()) _rectangle.x = component.getWidth() - _rectangle.width; + if (_rectangle.y + _rectangle.height > component.getHeight()) _rectangle.y = component.getHeight() + - _rectangle.height; + if (_rectangle.x < 0) _rectangle.x = 0; + if (_rectangle.y < 0) _rectangle.y = 0; } public final void closeEditor(final boolean commit) { @@ -139,7 +140,7 @@ EnumSet<InplaceEditorProvider.ExpansionDirection> directions = provider .getExpansionDirections(this, widget, editor); if (directions == null) directions = EnumSet.noneOf(InplaceEditorProvider.ExpansionDirection.class); - final Rectangle rectangle = this.rectangle; + // final Rectangle rectangle = this.rectangle; final Dimension size = editor.getPreferredSize(); final Dimension minimumSize = editor.getMinimumSize(); if (minimumSize != null) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -23,6 +23,7 @@ * *@author Adrien Hadoux */ +@SuppressWarnings("serial") public abstract class EbliWidgetActionAlign extends EbliWidgetActionSimple { public static class Bottom extends EbliWidgetActionAlign { @@ -107,7 +108,6 @@ } - @SuppressWarnings("serial") public static class Left extends EbliWidgetActionAlign { public Left(final EbliScene _scene) { @@ -188,7 +188,6 @@ } - @SuppressWarnings("serial") public static class Right extends EbliWidgetActionAlign { public Right(final EbliScene _scene) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -19,13 +18,13 @@ */ public class EbliWidgetActionBackGround extends EbliWidgetActionSimple { - CtuluCommandContainer cmd_; +// CtuluCommandContainer cmd_; public EbliWidgetActionBackGround(final EbliScene _scene) { super(_scene, EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_disposerderriere"), "BACKGROUND"); - cmd_ = _scene.getCmdMng(); +// cmd_ = _scene.getCmdMng(); putValue(NAME, "Arri\xE8re plan"); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -4,7 +4,6 @@ import javax.swing.Icon; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; @@ -19,7 +18,7 @@ private static final long serialVersionUID = 1L; - final CtuluCommandContainer cmd_; +// final CtuluCommandContainer cmd_; boolean bloque_ = true; EbliWidget widget_; @@ -28,7 +27,7 @@ super(_widget.getEbliScene(), name, ic, id); widget_ = _widget; - cmd_ = _widget.getEbliScene().getCmdMng(); +// cmd_ = _widget.getEbliScene().getCmdMng(); bloque_ = bloque; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -23,6 +23,7 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public abstract class EbliWidgetActionColorBackground extends EbliWidgetActionSimple { public static class ForWidget extends EbliWidgetActionColorBackground { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -10,7 +10,6 @@ import javax.swing.JColorChooser; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -21,15 +20,16 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public class EbliWidgetActionColorForeground extends EbliWidgetActionSimple { - CtuluCommandContainer cmd_; +// CtuluCommandContainer cmd_; public EbliWidgetActionColorForeground(final EbliScene _scene) { super(_scene, EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("palettecouleur"), "CONTOUR"); - cmd_ = _scene.getCmdMng(); +// cmd_ = _scene.getCmdMng(); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -22,6 +22,7 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public class EbliWidgetActionConfigure extends EbliWidgetActionSimple { public EbliWidgetActionConfigure(final EbliScene _scene) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -30,14 +29,14 @@ private static final long serialVersionUID = 1L; - final CtuluCommandContainer cmd_; +// final CtuluCommandContainer cmd_; public EbliWidgetActionDuplicate(final EbliScene _scene) { super(_scene, EbliResource.EBLI.getString("dupliquer les objets s\xE9lectionn\xE9s"), CtuluResource.CTULU .getIcon("crystal_copier"), "DUPLICATE"); putValue(NAME, EbliResource.EBLI.getString("Duplication des \xE9lements s\xE9lectionn\xE9s")); - cmd_ = _scene.getCmdMng(); +// cmd_ = _scene.getCmdMng(); } @@ -74,8 +73,8 @@ final EbliNode currentNode = it.next(); // -- duplication du node --// - - EbliNode node = currentNode.getWidget().getController().duplication(listeNodeUndo, sceneDestination_); + currentNode.getWidget().getController().duplication(listeNodeUndo, sceneDestination_); +// EbliNode node = Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicateLayout.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -6,7 +6,6 @@ import java.util.Iterator; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -21,6 +20,7 @@ * @author Adrien Hadoux * */ +@SuppressWarnings("serial") public class EbliWidgetActionDuplicateLayout extends EbliWidgetActionSimple { /** @@ -32,16 +32,15 @@ */ EbliScene sceneDestination_ = null; - private static final long serialVersionUID = 1L; - final CtuluCommandContainer cmd_; +// final CtuluCommandContainer cmd_; public EbliWidgetActionDuplicateLayout(final EbliScene _scene) { super(_scene, EbliResource.EBLI.getString("Dupliquer le layout"), CtuluResource.CTULU .getIcon("crystal_cascade.png"), "DUPLICATE"); putValue(NAME, EbliResource.EBLI.getString("Dupliquer le layout")); - cmd_ = _scene.getCmdMng(); +// cmd_ = _scene.getCmdMng(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -21,6 +21,7 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public class EbliWidgetActionImageChooser extends EbliWidgetActionSimple { public EbliWidgetActionImageChooser(final EbliScene _widget) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRatio.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRatio.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRatio.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -5,23 +5,21 @@ import javax.swing.Icon; import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; -import org.fudaa.ebli.visuallibrary.EbliWidgetController; /** * Action qui resize les widgets proportionnellement * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public class EbliWidgetActionRatio extends EbliWidgetActionSimple { - private static final long serialVersionUID = 1L; +// private static final long serialVersionUID = 1L; - final CtuluCommandContainer cmd_; +// final CtuluCommandContainer cmd_; final boolean resizeProportionnel_; EbliWidget widget_; @@ -30,11 +28,10 @@ super(_widget.getEbliScene(), name, ic, id); widget_ = _widget; - cmd_ = _widget.getEbliScene().getCmdMng(); +// cmd_ = _widget.getEbliScene().getCmdMng(); resizeProportionnel_ = proportionnel; } - @SuppressWarnings("serial") public static class Proportional extends EbliWidgetActionRatio { public Proportional(final EbliWidget _widget) { @@ -46,7 +43,6 @@ } - @SuppressWarnings("serial") public static class Classical extends EbliWidgetActionRatio { public Classical(final EbliWidget _widget) { @@ -61,17 +57,17 @@ @Override public void actionPerformed(final ActionEvent e) { - EbliWidgetController controll; +// EbliWidgetController controll; +// +// if (widget_ instanceof EbliWidgetBordureSingle) { +// +// controll = ((EbliWidgetBordureSingle) widget_).getBordureController(); +// } else if (widget_.getParentWidget() instanceof EbliWidgetBordureSingle) { +// controll = ((EbliWidgetBordureSingle) widget_.getParentWidget()).getBordureController(); +// } else controll = widget_.getController(); - if (widget_ instanceof EbliWidgetBordureSingle) { +// final EbliWidgetController controller = controll; - controll = ((EbliWidgetBordureSingle) widget_).getBordureController(); - } else if (widget_.getParentWidget() instanceof EbliWidgetBordureSingle) { - controll = ((EbliWidgetBordureSingle) widget_.getParentWidget()).getBordureController(); - } else controll = widget_.getController(); - - final EbliWidgetController controller = controll; - if (resizeProportionnel_) { // controller.switchToResizeProportionnal(); widget_.getController().boutonProportion.setAction(new EbliWidgetActionRatio.Classical(widget_)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -9,7 +9,6 @@ import java.util.List; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -28,7 +27,7 @@ public int typeRetaillage_; - CtuluCommandContainer cmd_; +// CtuluCommandContainer cmd_; public EbliWidgetActionRetaillageHorizontal(final EbliScene _scene, final int _typeRetaillage) { super(_scene, EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), @@ -37,7 +36,7 @@ // -- type retailage --// typeRetaillage_ = _typeRetaillage; - cmd_ = _scene.getCmdMng(); +// cmd_ = _scene.getCmdMng(); if (_typeRetaillage == RETAIILLAGE_MAX) { putValue(NAME, "Resize Horizontal Max"); setIcon(EbliResource.EBLI.getToolIcon("aowidest")); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -9,7 +9,6 @@ import java.util.List; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -28,7 +27,7 @@ public int typeRetaillage_; - CtuluCommandContainer cmd_; +// CtuluCommandContainer cmd_; public EbliWidgetActionRetaillageVertical(final EbliScene _scene, final int _typeRetaillage) { super(_scene, EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), @@ -37,7 +36,7 @@ // -- type retailage --// typeRetaillage_ = _typeRetaillage; - cmd_ = _scene.getCmdMng(); +// cmd_ = _scene.getCmdMng(); if (_typeRetaillage == RETAIILLAGE_MAX) { putValue(NAME, EbliResource.EBLI.getString("Resize Vertical Max")); setIcon(EbliResource.EBLI.getToolIcon("aotallest")); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -17,6 +17,7 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public class EbliWidgetActiontextEditor extends EbliWidgetActionSimple { public EbliWidgetActiontextEditor(final EbliScene _widget) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -107,6 +107,7 @@ return act_; } + @SuppressWarnings("serial") private static class AnimTreeCellRenderer extends DefaultTreeCellRenderer { @Override Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -13,8 +13,6 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.calque.BCalqueLegendePanel; -import org.fudaa.ebli.courbe.EGFillePanel; -import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.palette.PaletteSelecteurCouleurPlage; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2009-02-08 21:14:45 UTC (rev 4446) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2009-02-08 22:18:41 UTC (rev 4447) @@ -1,6 +1,5 @@ package org.fudaa.ebli.visuallibrary.calque; -import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; @@ -21,8 +20,6 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.JTable; import javax.swing.JToolBar; import org.fudaa.ctulu.CtuluCommandContainer; @@ -52,7 +49,6 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRatio; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuMenuBar; @@ -96,7 +92,6 @@ widgetParent_ = _parent; addActionSpecifiques(); setProportional(true); - } @@ -174,32 +169,32 @@ @Override public EbliNode duplication(final ArrayList<EbliNode> listeNodeUndo, final EbliScene sceneDestination) { + if (sceneDestination == null) return null; // -- recuperation du node a dupliquer --// final EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); // duplication du node en question final EbliNode duplique = n.duplicate(null); + if (duplique == null) return null; - duplique.setTitle(EbliLib.getS("Calque")+" "+(sceneDestination.getAllVue2d().size()+1)); - + duplique.setTitle(EbliLib.getS("Calque") + " " + (sceneDestination.getAllVue2d().size() + 1)); + // -- redimensionnement du duplicata --// ((EbliWidgetCreatorVueCalque) duplique.getCreator()).initSize(getVisuPanel().getVueCalque().getCalque().getSize()); // -- ajout dans la scene --// - if (duplique != null && sceneDestination != null) { - sceneDestination.addNode(duplique); + sceneDestination.addNode(duplique); - // -- duplication des map de property graphique de la widget --// - duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); - // -- duplication de la taille --// - duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); + // -- duplication des map de property graphique de la widget --// + duplique.getWidget().setPropGraphique(n.getWidget().duplicateGraphicalProperties()); + // -- duplication de la taille --// + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); - sceneDestination.refresh(); - postActionDuplication(n, duplique, listeNodeUndo); - } + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + sceneDestination.refresh(); + postActionDuplication(n, duplique, listeNodeUndo); return duplique; } @@ -223,8 +218,7 @@ if (calqueActif != null && calqueActif instanceof BCalqueAffichage) { if (this.legendeWidget_.get(calqueActif) == null) { // legendeWidget_ = (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend(); - legendeWidget_.put(calqueActif, - (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend()); + legendeWidget_.put(calqueActif, (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend()); final CalqueLegendeWidgetAdapter legendeAdapter = this.legendeWidget_.get(calqueActif); @@ -464,24 +458,22 @@ pals.updateBeforeShow(); tb.addTab(pals.getTitle(), pals.getIcon(), component); } - - - //-- split avec infos + arbre des calques --// + + // -- split avec infos + arbre des calques --// final JSplitPane splitInfosArbre = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - + final BuPanel scrollInfos = getVisuPanel().buildInfosCreationComposant(); - scrollInfos.setMinimumSize(new Dimension((int) scrollInfos.getSize().getWidth(),100)); - + scrollInfos.setMinimumSize(new Dimension((int) scrollInfos.getSize().getWidth(), 100)); + splitInfosArbre.setTopComponent(scrollInfos); splitInfosArbre.setBottomComponent(scrollPane); splitInfosArbre.setDividerLocation(0.3D); - - + final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(tb); splitPane.setBottomComponent(splitInfosArbre); splitPane.setDividerLocation(0.3D); - + panelTreeCalque_ = splitPane; } else { panelTreeCalque_ = scrollPane; @@ -531,16 +523,21 @@ // ajout combobox toolbarCalque_.add(comboVar_); - - comboVar_.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - comboVar_.getCb().setMaximumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - comboVar_.getCb().setMinimumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - comboVar_.getCb().setSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - comboVar_.getCb().setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - + + comboVar_.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_ + .getPreferredSize().height)); + comboVar_.getCb().setMaximumSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + comboVar_.getCb().setMinimumSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + comboVar_.getCb().setSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + comboVar_.getCb().setPreferredSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + comboVar_.revalidate(); toolbarCalque_.revalidate(); - + // -- ajout des combo des pas de temps --// final EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(getVisuPanel().getArbreCalqueModel() .getTreeSelectionModel(), true); @@ -548,14 +545,19 @@ chooserT.setSelected(true); final BSelecteurListComboBox combo = (BSelecteurListComboBox) chooserT.buildContentPane(); chooserT.updateBeforeShow(); - + // ajout combobox toolbarCalque_.add(combo); - combo.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - combo.getCb().setMaximumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - combo.getCb().setMinimumSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - combo.getCb().setSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); - combo.getCb().setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width,200),comboVar_.getPreferredSize().height)); + combo.setPreferredSize(new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_ + .getPreferredSize().height)); + combo.getCb().setMaximumSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + combo.getCb().setMinimumSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + combo.getCb().setSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); + combo.getCb().setPreferredSize( + new Dimension(Math.max(comboVar_.getPreferredSize().width, 200), comboVar_.getPreferredSize().height)); combo.revalidate(); toolbarCalque_.revalidate(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branc... [truncated message content] |
From: <had...@us...> - 2009-02-10 17:30:20
|
Revision: 4453 http://fudaa.svn.sourceforge.net/fudaa/?rev=4453&view=rev Author: hadouxad Date: 2009-02-10 17:30:15 +0000 (Tue, 10 Feb 2009) Log Message: ----------- lot 4 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuVfsOperations.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluHtmlEditorPanel.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeGENEFileFormat.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeKeyWord.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeTFileFormat.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/commun/exec/FudaaEditorInterne.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/ressource/fudaa_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileRenderer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrResource.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/dialogSpec/TrPostWizardCreateScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFormat.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuVfsOperations.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuVfsOperations.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuVfsOperations.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -18,6 +18,8 @@ import javax.swing.JOptionPane; +import org.fudaa.ctulu.CtuluRemoveContentDirectory; + import com.memoire.fu.FuComparator; import com.memoire.fu.FuLog; import com.memoire.vfs.VfsFile; @@ -275,7 +277,20 @@ boolean failed=false; if(TRACE&&FuLog.isTrace()) FuLog.trace("BVO: delete "+src); - try { failed=!src.delete(); } + try { + if(src.isDirectory()){ + try{ + CtuluRemoveContentDirectory.contentDirectoryRemover(src); + failed=!src.delete(); + //failed=false; + }catch(Exception e){ + failed=true; + } + } + else + failed=!src.delete(); + + } catch(Exception ex) { failed=true; } if(failed) { Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluRemoveContentDirectory.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -71,8 +71,10 @@ File[] listing2 = ToDel.listFiles(); - if(listing2==null || listing2.length==0) + if(listing2==null || listing2.length==0){ + ToDel.delete(); return; + } for (int i= 0;i<listing2.length; i++) { // ...verifie si c'est un fichier if (listing2[i].isFile()) { Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluHtmlEditorPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluHtmlEditorPanel.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluHtmlEditorPanel.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -103,7 +103,7 @@ pn.add(ctuluHtmlEditorPanel.getToolBar(true), BuBorderLayout.NORTH); ctuluHtmlEditorPanel.setFrame(f); f.setJMenuBar(ctuluHtmlEditorPanel.getMenuBar()); - + f.setContentPane(pn); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeGENEFileFormat.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeGENEFileFormat.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeGENEFileFormat.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -12,6 +12,9 @@ import org.fudaa.dodico.fichiers.FileFormatSoftware; import org.fudaa.dodico.mesure.EvolutionFileFormatVersion; + +import com.memoire.bu.BuIcon; + /** * Manager de fichiers au format scope. Utilis\xE9 pour la cr\xE9ation des graphes. au * format SCOPGENE @@ -32,7 +35,7 @@ private ScopeGENEFileFormat() { super(1); - extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_MIXTE }; + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_MIXTE,ScopeKeyWord.TYPE_COURBE_MIXTE2,ScopeKeyWord.TYPE_COURBE_MIXTE3,ScopeKeyWord.TYPE_COURBE_MIXTE4,ScopeKeyWord.TYPE_COURBE_MIXTE5 }; id_ = "SCOPE"; nom_ = "Scope"; description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); @@ -55,4 +58,7 @@ return super.read(_f, _prog); } + + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeKeyWord.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeKeyWord.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeKeyWord.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -11,9 +11,26 @@ private final String version_ = "1.0"; private final String blocCommentaireSorT_ = "'"; private final String blocCommentaireGene_ = "/"; + public final static String TYPE_COURBE_TEMPORELLE = "ScopS"; + public final static String TYPE_COURBE_TEMPORELLE2 = "scops"; + public final static String TYPE_COURBE_TEMPORELLE3 = "SCOPS"; + public final static String TYPE_COURBE_TEMPORELLE4 = "SCOPES"; + public final static String TYPE_COURBE_TEMPORELLE5 = "scopes"; + public final static String TYPE_COURBE_SPATIALE = "ScopT"; + public final static String TYPE_COURBE_SPATIALE2 = "scopt"; + public final static String TYPE_COURBE_SPATIALE3 = "scopet"; + public final static String TYPE_COURBE_SPATIALE4 = "SCOPT"; + public final static String TYPE_COURBE_SPATIALE5 = "SCOPET"; + public final static String TYPE_COURBE_MIXTE = "SCOPGENE"; + public final static String TYPE_COURBE_MIXTE2 = "scopgene"; + public final static String TYPE_COURBE_MIXTE3= "scopegene"; + public final static String TYPE_COURBE_MIXTE4 = "SCOPEGENE"; + public final static String TYPE_COURBE_MIXTE5= "ScopGEn"; + + public final static String SYMBOL_VALUE_UNDEFINED = "*"; public final static long VALUE_UNDEFINED = 9999999; Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -32,7 +32,7 @@ private ScopeSFileFormat() { super(1); - extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_TEMPORELLE }; + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_TEMPORELLE,ScopeKeyWord.TYPE_COURBE_TEMPORELLE2,ScopeKeyWord.TYPE_COURBE_TEMPORELLE3,ScopeKeyWord.TYPE_COURBE_TEMPORELLE4,ScopeKeyWord.TYPE_COURBE_TEMPORELLE5}; id_ = "SCOPE"; nom_ = "Scope"; description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeTFileFormat.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeTFileFormat.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeTFileFormat.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -32,7 +32,7 @@ private ScopeTFileFormat() { super(1); - extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_SPATIALE }; + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_SPATIALE,ScopeKeyWord.TYPE_COURBE_SPATIALE2,ScopeKeyWord.TYPE_COURBE_SPATIALE3,ScopeKeyWord.TYPE_COURBE_SPATIALE4,ScopeKeyWord.TYPE_COURBE_SPATIALE5 }; id_ = "SCOPE"; nom_ = "Scope"; description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); 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-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -153,10 +153,10 @@ fileChoosen_=fileToReload; //-- on avance \xE0 l'\xE9tape 2 directement --// - if(replayData_ && fileChoosen_!=null){ + if(replayData_ || fileChoosen_!=null){ panelFichier_=buildFilePanel(); this.filePath_.setText(""+fileChoosen_.getAbsolutePath()); - typeFormat_=devineTypeWithExtension(fileChoosen_.getName()); + typeFormat_=devineTypeWithExtension(fileChoosen_); if(typeFormat_==-1) typeFormat_=selectType("Choix du format", impl.getFrame()); try{ @@ -172,19 +172,26 @@ } - 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; - for(int i=0;i<ScopeTFileFormat.getInstance().getExtensions().length;i++) - if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) + public int devineTypeWithExtension(File _file){ + BuFileFilter filterScopeS=ScopeSFileFormat.getInstance().createFileFilter(); + BuFileFilter filterScopeT=ScopeTFileFormat.getInstance().createFileFilter(); + BuFileFilter filterScopeGENE=ScopeGENEFileFormat.getInstance().createFileFilter(); + +// for(int i=0;i<ScopeSFileFormat.getInstance().getExtensions().length;i++) +// if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i]) || name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) + + if(filterScopeS.accept(_file)) + return 0; +// for(int i=0;i<ScopeTFileFormat.getInstance().getExtensions().length;i++) +// if(name.contains(ScopeSFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeSFileFormat.getInstance().getExtensions()[i].toLowerCase())) + if(filterScopeT.accept(_file)) return 1; - for(int i=0;i<ScopeGENEFileFormat.getInstance().getExtensions().length;i++){ - String ext=ScopeGENEFileFormat.getInstance().getExtensions()[i]; - if(name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i].toLowerCase())) - return 2; - } +// for(int i=0;i<ScopeGENEFileFormat.getInstance().getExtensions().length;i++){ +// String ext=ScopeGENEFileFormat.getInstance().getExtensions()[i]; +// if(name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i])|| name.contains(ScopeGENEFileFormat.getInstance().getExtensions()[i].toLowerCase())) + if(filterScopeGENE.accept(_file)) + return 2; + return -1; @@ -307,7 +314,7 @@ typeFormat_=i; //-- si -1, c'est qu'on a choisi le filtre all, il faut alors le determiner --// - typeFormat_=devineTypeWithExtension(initFile.getName()); + typeFormat_=devineTypeWithExtension(initFile); //-- si le format vaut toujours -1, il faut pr\xE9ciser avec le bouton radio --// if(typeFormat_==-1){ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaEditorInterne.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaEditorInterne.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaEditorInterne.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -7,17 +7,36 @@ */ package org.fudaa.fudaa.commun.exec; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; +import javax.swing.AbstractButton; +import javax.swing.Action; +import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JScrollPane; +import javax.swing.KeyStroke; import com.memoire.bu.BuEditorPane; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuToolBar; import com.memoire.fu.FuLog; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.ressource.FudaaResource; /** * @author deniger * @version $Id: FudaaEditorInterne.java,v 1.13 2006-09-19 15:01:53 deniger Exp $ @@ -59,8 +78,53 @@ edit.setText(r); final JFrame f = new JFrame(_f.getAbsolutePath()); f.getContentPane().add("Center", new JScrollPane(edit)); + + BuToolBar toolbar=new BuToolBar(); + + EbliActionSimple actionSave=new EbliActionSimple(FudaaResource.FUDAA.getString("Enregistrer"),EbliResource.EBLI.getIcon("enregistrer"),"SAUVERTEXT"){ + public void actionPerformed(ActionEvent _e) { + String text=edit.getText(); + + FileOutputStream out = null; + try { + out = new FileOutputStream(_f); + out.write(text.getBytes()); + } + catch (final IOException _io) { + FuLog.warning(_io); + return; + } + finally { + try { + if (out != null) { + out.close(); + + JOptionPane.showMessageDialog(null, FudaaResource.FUDAA.getString("Modifications correctements enregistr\xE9es")); + } + } + catch (final IOException _io) { + FuLog.warning("can close io for " + _f.getAbsolutePath()); + } + } + } + }; + //actionSave.setKey(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_DOWN_MASK)); + AbstractButton bouton=actionSave.buildToolButton(EbliComponentFactory.INSTANCE); + bouton.setMnemonic(KeyEvent.VK_S); + + JMenu menu=new JMenu(FudaaResource.FUDAA.getString("Fichier")); + JMenuItem item=(JMenuItem) actionSave.buildMenuItem(EbliComponentFactory.INSTANCE); + item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_DOWN_MASK)); + menu.add(item); + JMenuBar barre=new JMenuBar(); + barre.add(menu); + f.setJMenuBar(barre); + toolbar.add(bouton); + toolbar.setFloatable(false); + // f.getContentPane().add("North",toolbar); f.setSize(400, 300); f.show(); + } public String getCmd(){ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/ressource/fudaa_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/ressource/fudaa_en.fr_txt 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/ressource/fudaa_en.fr_txt 2009-02-10 17:30:15 UTC (rev 4453) @@ -323,4 +323,5 @@ R\xE9sultats de la derni\xE8re op\xE9ration=Results of the last task Des variables d\xE9pendantes seront \xE9galement supprim\xE9es. Voulez-vous continuer ?=Some dependant variables will be also deleted. Do you want to continue ? Sauvegarde des donn\xE9es=Data saving -Sauvegarde donn\xE9es compl\xE9mentaires=Visualisation data saving \ No newline at end of file +Sauvegarde donn\xE9es compl\xE9mentaires=Visualisation data saving +Modifications correctements enregistr\xE9es=Modifications saved with sucess Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -10,6 +10,7 @@ import ghm.followgui.FollowApp; import java.awt.Component; +import java.awt.EventQueue; import java.awt.Frame; import java.awt.Window; import java.awt.event.WindowAdapter; @@ -31,11 +32,15 @@ import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.fichiers.FileFormatSoftware; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter.Target; import org.fudaa.fudaa.commun.impl.Fudaa; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.save.FudaaSaveLib; import org.fudaa.fudaa.ressource.FudaaResource; +import org.fudaa.fudaa.tr.common.TrApplicationManager; import org.fudaa.fudaa.tr.common.TrBugCommentGenerator; import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrFileFormatManager; @@ -44,6 +49,9 @@ import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrPreferences; import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.ScopCourbeTreeModel; +import org.fudaa.fudaa.tr.post.TrPostProjet; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardImportScope; import org.fudaa.fudaa.tr.reflux.TrRefluxImplHelper; import org.fudaa.fudaa.tr.rubar.TrRubarImplHelper; import org.fudaa.fudaa.tr.telemac.TrTelemacImplHelper; @@ -56,6 +64,7 @@ import com.memoire.bu.BuPreferences; import com.memoire.bu.BuRegistry; import com.memoire.bu.BuResource; +import com.memoire.bu.BuWizardDialog; import com.memoire.fu.Fu; import com.memoire.fu.FuLib; import com.memoire.fu.FuLog; @@ -409,6 +418,13 @@ * Methode appelee pour generer le trpost avec le ficheir de layout ouvert. */ public TrPostImplementation openLayoutPost(final File _f) { + + //-- version scop ou non --// + if(TrApplicationManager.isScopFormat(_f)){ + return openScopPost(_f); + + } + final TrPostImplementation alreadyOpened = findPostWithOpenedFile(_f); if (alreadyOpened != null) { alreadyOpened.setMainErrorAndClear(TrLib.getMessageAlreadyOpen(_f)); @@ -437,7 +453,43 @@ return post; } + + /** + * Methode appelee pour generer le trpost avec le fichier scop choisi (S, T ou GENE) + */ + public TrPostImplementation openScopPost(final File _f) { + final TrPostImplementation alreadyOpened = findPostWithOpenedFile(_f); + if (alreadyOpened != null) { + alreadyOpened.setMainErrorAndClear(TrLib.getMessageAlreadyOpen(_f)); + alreadyOpened.getFrame().setVisible(true); + alreadyOpened.getFrame().setState(Frame.NORMAL); + alreadyOpened.getFrame().requestFocus(); + // pour Rubar + // alreadyOpened.getCurrentProject().activate(_f); + return alreadyOpened; + } + + final TrPostImplementation post = (TrPostImplementation) launch(null, TrLauncherDefault.this, + new TrPostImplementation()); + BuLib.invokeLater(new Runnable() { + + public void run() { + if (_f != null) { + + post.cmdOuvrirScopFile(_f); + + + } + } + + }); + + return post; + + } + + public TrPostImplementation openPost(final File _f) { final TrPostImplementation alreadyOpened = findPostWithOpenedFile(_f); if (alreadyOpened != null) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -24,6 +24,9 @@ import org.fudaa.dodico.reflux.io.INPFileFormat; import org.fudaa.dodico.rubar.io.RubarPARFileFormat; import org.fudaa.dodico.telemac.TelemacDicoFileFormat; +import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; +import org.fudaa.dodico.telemac.io.ScopeSFileFormat; +import org.fudaa.dodico.telemac.io.ScopeTFileFormat; import org.fudaa.dodico.telemac.io.SerafinFileFilter; import org.fudaa.dodico.telemac.io.SerafinFileFormat; import org.fudaa.fudaa.commun.FudaaLib; @@ -560,6 +563,22 @@ } return null; } + + + protected String ouvrirScop(final VfsFile _f, final AbstractButton _lb) { + // --si le format est du type *.POST + if (isScopFormat(_f)) { + final String res = TrResource.getPostName(); + if (_lb == null) { + launcher_.openLayoutPost(_f); + } else { + _lb.setIcon(TrResource.getScopIcon()); + } + return res; + } + return null; + } + protected String ouvrirPost(final VfsFile _f, final AbstractButton _lb) { if (isPostFormat(_f)) { @@ -581,6 +600,10 @@ String res = ouvrirEditor(_f, _lb); if (res != null) { return res; } + + //-- tentative ouverture fichier scop --// + res=ouvrirScop(_f, _lb); + if (res != null) { return res; } // -- tentative ouverture fichier type layout --// res = ouvrirPostLayout(_f, _lb); if (res != null) { return res; } @@ -864,7 +887,31 @@ public boolean isPostLayoutFormat(final File _file) { return TrPostFileFormat.getInstance().createFileFilter().accept(_file); } - + +/** + * Test si le format est scope. + * @param _file + * @return + */ + public static boolean isScopFormat(final File _file) { + boolean ok=false; + BuFileFilter scopeSFilter=ScopeSFileFormat.getInstance().createFileFilter(); + BuFileFilter scopeTFilter=ScopeTFileFormat.getInstance().createFileFilter(); + BuFileFilter scopeGENEFilter=ScopeGENEFileFormat.getInstance().createFileFilter(); + + ok=scopeSFilter.accept(_file); + if(ok) + return ok; + ok=scopeTFilter.accept(_file); + if(ok) + return ok; + ok=scopeGENEFilter.accept(_file); + + return ok; + + + } + /** * @param _file le fichier a tester * @return true si supporte par l'editeur Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -17,12 +17,16 @@ import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.fileformat.FileFormat; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.FudaaUI; +import org.fudaa.fudaa.commun.exec.FudaaEditor; import org.fudaa.fudaa.commun.exec.FudaaExec; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaExplorer; import org.fudaa.fudaa.tr.post.persist.TrPostFileFilter; +import org.fudaa.fudaa.tr.post.persist.TrPostFileFormat; import com.memoire.bu.BuActionEnabler; import com.memoire.bu.BuFileFilter; @@ -40,390 +44,420 @@ */ public class TrExplorer extends FudaaExplorer { - /** - * Classe permettant d'executer une commande dans un repertoire. - * - * @author Fred Deniger - * @version $Id: TrExplorer.java,v 1.23 2007-04-30 14:22:42 deniger Exp $ - */ - public class ExplorerMenuItem extends BuMenuItem { + /** + * Classe permettant d'executer une commande dans un repertoire. + * + * @author Fred Deniger + * @version $Id: TrExplorer.java,v 1.23 2007-04-30 14:22:42 deniger Exp $ + */ + public class ExplorerMenuItem extends BuMenuItem { - boolean dir_; + boolean dir_; - FudaaExec exec_; + FudaaExec exec_; - public ExplorerMenuItem(final FudaaExec _exe, final boolean _dir) { - exec_ = _exe; - dir_ = _dir; - setAction(exec_.getAction()); - } + public ExplorerMenuItem(final FudaaExec _exe, final boolean _dir) { + exec_ = _exe; + dir_ = _dir; + setAction(exec_.getAction()); + } - @Override - protected void fireActionPerformed(final ActionEvent _event) { - if (dir_) { - File dir = TrExplorer.this.getSelectedDirectory(); - if (dir == null) { - dir = getCurrentDirectory(); - } - if (dir == null) { - ui_.error(CtuluLib.getS("S\xE9lectionner au moins un dossier")); - return; - } - exec_.execInDir(dir, ui_, getRefreshRunnable()); - } else { - File f = getSelectedFile(); - // on prend le repertoire parent - if (f == null) { - f = getCurrentDirectory(); - } - if (f == null) { - ui_.error(CtuluLib.getS("S\xE9lectionner au moins un fichier")); - return; - } - exec_.execOnFile(f, ui_, getRefreshRunnable()); - } - } + @Override + protected void fireActionPerformed(final ActionEvent _event) { + if (dir_) { + File dir = TrExplorer.this.getSelectedDirectory(); + if (dir == null) { + dir = getCurrentDirectory(); + } + if (dir == null) { + ui_.error(CtuluLib.getS("S\xE9lectionner au moins un dossier")); + return; + } + exec_.execInDir(dir, ui_, getRefreshRunnable()); + } else { + File f = getSelectedFile(); + // on prend le repertoire parent + if (f == null) { + f = getCurrentDirectory(); + } + if (f == null) { + ui_.error(CtuluLib.getS("S\xE9lectionner au moins un fichier")); + return; + } + exec_.execOnFile(f, ui_, getRefreshRunnable()); + } + } - public final FudaaExec getExec() { - return exec_; - } - } + public final FudaaExec getExec() { + return exec_; + } + } - /** - * @return le dernier rep selon la pref "trexplorer.last.dir" - */ - public static String getLastDir() { - return TrPreferences.TR.getStringProperty("superviseur.last.dir", FuLib.getUserHome()); - } + /** + * @return le dernier rep selon la pref "trexplorer.last.dir" + */ + public static String getLastDir() { + return TrPreferences.TR.getStringProperty("superviseur.last.dir", FuLib.getUserHome()); + } - protected TrApplicationManager appli_; - protected FudaaUI ui_; + protected TrApplicationManager appli_; + protected FudaaUI ui_; - /** - * @param _impl l'impl parente - * @param _appli le manager d'appli - */ - public TrExplorer(final FudaaCommonImplementation _impl, final TrApplicationManager _appli) { - this(_impl, _appli, VfsFile.createFile(getLastDir())); - } + /** + * @param _impl l'impl parente + * @param _appli le manager d'appli + */ + public TrExplorer(final FudaaCommonImplementation _impl, final TrApplicationManager _appli) { + this(_impl, _appli, VfsFile.createFile(getLastDir())); + } - /** - * @param _impl l'impl parente - * @param _appli le manager d'appli - * @param _path le chemin initial - */ - public TrExplorer(final FudaaCommonImplementation _impl, final TrApplicationManager _appli, final VfsFile _path) { - super(_impl, true, _path); + /** + * @param _impl l'impl parente + * @param _appli le manager d'appli + * @param _path le chemin initial + */ + public TrExplorer(final FudaaCommonImplementation _impl, final TrApplicationManager _appli, final VfsFile _path) { + super(_impl, true, _path); - ui_ = _impl; - // miAntBuild_ = null; - // miCvsAdd_ = null; - // miCvsCommit_ = null; - // miCvsUpdate_ = null; - // miMake_ = null; - setAppliManager(_appli); - createFilters(); - viewer_.setFileRenderer(new TrFileRenderer(_appli, ui_)); - } + ui_ = _impl; + // miAntBuild_ = null; + // miCvsAdd_ = null; + // miCvsCommit_ = null; + // miCvsUpdate_ = null; + // miMake_ = null; + setAppliManager(_appli); + createFilters(); + viewer_.setFileRenderer(new TrFileRenderer(_appli, ui_)); + } - private void buildMenuForDir() { - pmDirs_.removeAll(); - appli_.buildCmdForMenuDir(pmDirs_, this); - pmDirs_.addSeparator(); - pmDirs_.addMenuItem(FudaaLib.getS("Ajouter aux favoris"), "ADD_FAVORITES", getNoneIcon(), true); - pmDirs_.addSeparator(); - pmDirs_.addMenuItem(BuResource.BU.getString("Cr\xE9er un r\xE9pertoire..."), "CREER_REPERTOIRE", BuResource.BU - .getIcon("creer"), true); - pmDirs_.addMenuItem(BuResource.BU.getString("Renommer..."), "RENOMMER_REPERTOIRE", BuResource.BU - .getIcon("renommer"), true); - pmDirs_.addMenuItem(BuResource.BU.getString("D\xE9truire..."), "DETRUIRE_REPERTOIRE", BuResource.BU - .getIcon("detruire"), true); - } + private void buildMenuForDir() { + pmDirs_.removeAll(); + appli_.buildCmdForMenuDir(pmDirs_, this); + pmDirs_.addSeparator(); + pmDirs_.addMenuItem(FudaaLib.getS("Ajouter aux favoris"), "ADD_FAVORITES", getNoneIcon(), true); + pmDirs_.addSeparator(); + pmDirs_.addMenuItem(BuResource.BU.getString("Cr\xE9er un r\xE9pertoire..."), "CREER_REPERTOIRE", BuResource.BU + .getIcon("creer"), true); + pmDirs_.addMenuItem(BuResource.BU.getString("Renommer..."), "RENOMMER_REPERTOIRE", BuResource.BU + .getIcon("renommer"), true); + pmDirs_.addMenuItem(BuResource.BU.getString("D\xE9truire..."), "DETRUIRE_REPERTOIRE", BuResource.BU + .getIcon("detruire"), true); + } - /** - * @return - */ - private BuIcon getNoneIcon() { - return BuResource.BU.getIcon("aucun"); - } + /** + * @return + */ + private BuIcon getNoneIcon() { + return BuResource.BU.getIcon("aucun"); + } - private void buildMenuForFiles() { - pmFiles_.removeAll(); - miOuvrirFichier_ = pmFiles_.addMenuItem(BuResource.BU.getString("Ouvrir"), "OUVRIR_FICHIER", true); - appli_.buildCmdForMenuFile(pmFiles_, this); - pmFiles_.addSeparator(); - pmFiles_.addMenuItem(BuResource.BU.getString("Tout s\xE9lectionner"), "TOUTSELECTIONNER", true); - pmFiles_.addSeparator(); - pmFiles_.addMenuItem(BuResource.BU.getString("Renommer..."), "RENOMMER_FICHIER", true); - pmFiles_.addMenuItem(BuResource.BU.getString("D\xE9truire..."), "DETRUIRE_FICHIER", true); - } + private void buildMenuForFiles() { + pmFiles_.removeAll(); + miOuvrirFichier_ = pmFiles_.addMenuItem(BuResource.BU.getString("Ouvrir"), "OUVRIR_FICHIER", true); + appli_.buildCmdForMenuFile(pmFiles_, this); + pmFiles_.addSeparator(); + pmFiles_.addMenuItem(BuResource.BU.getString("Tout s\xE9lectionner"), "TOUTSELECTIONNER", true); + pmFiles_.addSeparator(); + pmFiles_.addMenuItem(BuResource.BU.getString("Renommer..."), "RENOMMER_FICHIER", true); + pmFiles_.addMenuItem(BuResource.BU.getString("D\xE9truire..."), "DETRUIRE_FICHIER", true); + } - private void createFilters() { - final Object o = filters_.getSelectedItem(); - final FileFormat[] fts = TrFileFormatManager.getFormatToFilter(appli_.getSoftId()); - final int nb = fts.length; - for (int i = 0; i < nb; i++) { - addFilter(appli_.getFileFilterFor(fts[i])); - } - final BuFileFilter txt = appli_.getTxtFileFilter(); - addFilter(txt); - filters_.setSelectedItem(o); - } + private void createFilters() { + final Object o = filters_.getSelectedItem(); + final FileFormat[] fts = TrFileFormatManager.getFormatToFilter(appli_.getSoftId()); + final int nb = fts.length; + for (int i = 0; i < nb; i++) { + addFilter(appli_.getFileFilterFor(fts[i])); + } + final BuFileFilter txt = appli_.getTxtFileFilter(); + addFilter(txt); + filters_.setSelectedItem(o); + } - /** - * @param _mng le nouveau gestion des appli. - */ - private void setAppliManager(final TrApplicationManager _mng) { - appli_ = _mng; - buildMenuForDir(); - buildMenuForFiles(); - } + /** + * @param _mng le nouveau gestion des appli. + */ + private void setAppliManager(final TrApplicationManager _mng) { + appli_ = _mng; + buildMenuForDir(); + buildMenuForFiles(); + } - @Override - protected void fireFileAction(final String _action) { - if ("OUVRIR".equals(_action)) { - appli_.ouvrir(getSelectedFile()); - } - } + @Override + protected void fireFileAction(final String _action) { + if ("OUVRIR".equals(_action)) { + appli_.ouvrir(getSelectedFile()); + } + } - @Override - protected void updateMenuCurrent() { + @Override + protected void updateMenuCurrent() { - } + } - /** - * Pour etre accessible depuis inner classes. - */ - @Override - protected void updateMenuDirs() { - super.updateMenuDirs(); - } + /** + * Pour etre accessible depuis inner classes. + */ + @Override + protected void updateMenuDirs() { + super.updateMenuDirs(); + } - @Override - protected void updateMenuFiles() { - final int l = files_.getSelectedValues().length; - BuActionEnabler.setEnabledForAction(pmFiles_, "OUVRIR_FICHIER", l == 1); - BuActionEnabler.setEnabledForAction(pmFiles_, "DETRUIRE_FICHIER", l >= 1); - BuActionEnabler.setEnabledForAction(pmFiles_, "RENOMMER_FICHIER", l == 1); - pmFiles_.computeMnemonics(); - appli_.updateOuvrirMenu(miOuvrirFichier_, l, getSelectedFile()); - appli_.updateMenuFiles(l, getSelectedFile()); - } - /** - * Methode appelee lors d'un changement des applications utilisee. - */ - public void applicationPreferencesChanged() { - buildMenuForDir(); - buildMenuForFiles(); - } + BuMenuItem itemEditSetupLayout_=null; - public BuMenuItem createDirAction(final FudaaExec _ex) { - return new ExplorerMenuItem(_ex, true); - } + @Override + protected void updateMenuFiles() { + final int l = files_.getSelectedValues().length; + BuActionEnabler.setEnabledForAction(pmFiles_, "OUVRIR_FICHIER", l == 1); + BuActionEnabler.setEnabledForAction(pmFiles_, "DETRUIRE_FICHIER", l >= 1); + BuActionEnabler.setEnabledForAction(pmFiles_, "RENOMMER_FICHIER", l == 1); + pmFiles_.computeMnemonics(); + appli_.updateOuvrirMenu(miOuvrirFichier_, l, getSelectedFile()); - public ExplorerMenuItem createFileAction(final FudaaExec _ex) { - return new ExplorerMenuItem(_ex, false); - } + + //-- on degage l'editeur de texte specifique setup post si existe --// + if(itemEditSetupLayout_!=null && pmFiles_.getComponentIndex(itemEditSetupLayout_)!=-1) + pmFiles_.remove(itemEditSetupLayout_); + + //-- on v\xE9rifie qu'il s'agit d'un fichier de type POST, si oui on ajoute --// + final File selection=getSelectedFile(); + if(TrPostFileFilter.acceptDirectoryPOST(selection)){ + EbliActionSimple action=new EbliActionSimple(TrResource.getS("Editer le fichier Setup"),EbliResource.EBLI.getIcon("text"),"EDITSETUP"){ + public void actionPerformed(ActionEvent event){ + //-- recuperation du fichier setup --// + File setup=TrPostFileFormat.getInstance().getSetupFromMainDirectory(selection); + if(setup!=null) + FudaaEditor.getInstance().edit(setup); + + + } + }; + //-- on ajoute l'editeur du fichier setup en deuxieme position --// + itemEditSetupLayout_=new BuMenuItem(action); + pmFiles_.add(itemEditSetupLayout_, 1); + } + - /** - * @return le gestion de l'application - */ - public final TrApplicationManager getAppliManager() { - return appli_; - } + - Runnable refresh_; + appli_.updateMenuFiles(l, getSelectedFile()); +} - public Runnable getRefreshRunnable() { - if (refresh_ == null) { - refresh_ = new Runnable() { +/** + * Methode appelee lors d'un changement des applications utilisee. + */ +public void applicationPreferencesChanged() { + buildMenuForDir(); + buildMenuForFiles(); +} - public void run() { - refresh(); - } +public BuMenuItem createDirAction(final FudaaExec _ex) { + return new ExplorerMenuItem(_ex, true); +} - }; - } - return refresh_; - } +public ExplorerMenuItem createFileAction(final FudaaExec _ex) { + return new ExplorerMenuItem(_ex, false); +} - /** - * Sauvegarde le dernier rep. - */ - public void saveLastDir() { - if (getCurrentDirectory() != null && getCurrentDirectory().getAbsolutePath() != null) { - TrPreferences.TR.putStringProperty("superviseur.last.dir", getCurrentDirectory().getAbsolutePath()); - } - } - - - /** - * Surcharge du filtrage des fichiers et repertoires de l'explorer. - * Dans le cas du tr, cela affiche els repertoire .POST propre au post traitement dasn la vue des fichiers. - * @author Adrien Hadoux - */ - protected void updateLists0(final VfsFile _dir, BuFileFilter _filter, final Cursor _cursor, final VfsFile _sel, - final boolean _showing) { - if (EventQueue.isDispatchThread()) throw new RuntimeException("In swing thread. " + "Use updateLists() instead"); +/** + * @return le gestion de l'application + */ +public final TrApplicationManager getAppliManager() { + return appli_; +} - // long before=System.currentTimeMillis(); - // FuLog.debug("BEX: showing="+_showing); +Runnable refresh_; - if (!updating_) throw new RuntimeException("updating_ should be true"); +public Runnable getRefreshRunnable() { + if (refresh_ == null) { + refresh_ = new Runnable() { - last_ = _dir; - setProgression(10); + public void run() { + refresh(); + } - // Cursor old_cursor=null; - Runnable runnable = null; + }; + } + return refresh_; +} - runnable = new Runnable() { - public void run() { - if (!WAIT_CURSOR.equals(_cursor)) setCursor(WAIT_CURSOR); +/** + * Sauvegarde le dernier rep. + */ +public void saveLastDir() { + if (getCurrentDirectory() != null && getCurrentDirectory().getAbsolutePath() != null) { + TrPreferences.TR.putStringProperty("superviseur.last.dir", getCurrentDirectory().getAbsolutePath()); + } +} - current_.setText(FuLib.reducedPath(_dir.getAbsolutePath())); - current_.setToolTipText(_dir.getAbsolutePath()); - current_.revalidate(); - updateMenuCurrent(); - } - }; - if (_showing) SwingUtilities.invokeLater(runnable); - else - runnable.run(); +/** + * Surcharge du filtrage des fichiers et repertoires de l'explorer. + * Dans le cas du tr, cela affiche els repertoire .POST propre au post traitement dasn la vue des fichiers. + * @author Adrien Hadoux + */ +protected void updateLists0(final VfsFile _dir, BuFileFilter _filter, final Cursor _cursor, final VfsFile _sel, + final boolean _showing) { + if (EventQueue.isDispatchThread()) throw new RuntimeException("In swing thread. " + "Use updateLists() instead"); - // FuLog.debug("read "+(System.currentTimeMillis()-before)); - timestamp_ = _dir.lastModified();// System.currentTimeMillis(); + // long before=System.currentTimeMillis(); + // FuLog.debug("BEX: showing="+_showing); - String[] els = _dir.list(); - liststamp_ = liststamp(els); - // FuLog.debug("update liststamp="+liststamp_+" for "+_dir); - if (els == null) els = STRING0; - // FuLog.debug("%%% DIR="+_dir+" ["+els.length+"]"); + if (!updating_) throw new RuntimeException("updating_ should be true"); - setProgression(20); + last_ = _dir; + setProgression(10); - int l = els.length; + // Cursor old_cursor=null; + Runnable runnable = null; - final VfsFile[] dirs = new VfsFile[l + 1]; - final VfsFile[] files = new VfsFile[l]; - int nb_dirs = 0; - int nb_files = 0; + runnable = new Runnable() { + public void run() { + if (!WAIT_CURSOR.equals(_cursor)) setCursor(WAIT_CURSOR); - VfsFile pf = _dir.getParentVfsFile(); - // FuLog.debug("%%% PF="+pf); - if (pf instanceof VfsFileFile) { - String p = pf.getAbsolutePath(); - pf = new Root(p, p, ".."); - } + current_.setText(FuLib.reducedPath(_dir.getAbsolutePath())); + current_.setToolTipText(_dir.getAbsolutePath()); + current_.revalidate(); + updateMenuCurrent(); + } + }; - if (pf != null) { - pf.setViewName(".."); - dirs[0] = pf; - nb_dirs++; - } + if (_showing) SwingUtilities.invokeLater(runnable); + else + runnable.run(); - setProgression(30); + // FuLog.debug("read "+(System.currentTimeMillis()-before)); + timestamp_ = _dir.lastModified();// System.currentTimeMillis(); - // cleanFilters(); - // addFilter(filter); - // filters_.setSelectedItem(filter); + String[] els = _dir.list(); + liststamp_ = liststamp(els); + // FuLog.debug("update liststamp="+liststamp_+" for "+_dir); + if (els == null) els = STRING0; + // FuLog.debug("%%% DIR="+_dir+" ["+els.length+"]"); - for (int i = 0; i < l; i++) { - if (els[i].startsWith(".")) continue; - if (els[i].endsWith("~")) continue; - if ("CVS".equals(els[i])) continue; + setProgression(20); - VfsFile f = _dir.createChild(els[i]); + int l = els.length; - - - if (f == null) {} + final VfsFile[] dirs = new VfsFile[l + 1]; + final VfsFile[] files = new VfsFile[l]; + int nb_dirs = 0; + int nb_files = 0; - //--cas particulier: si le fichier est un repertoire .POST - //-- on place les repertoire .POST avec les fichiers --// - else - if(TrPostFileFilter.acceptDirectoryPOST(f)){ - - files[nb_files] = f; - nb_files++; - } - - - else if (f.isDirectory()) { - dirs[nb_dirs] = f; - nb_dirs++; - } else if (f.isFile()) { - // if(viewer_!=null) - // { - // String n=f.getName(); - // int p=n.lastIndexOf('.'); - // if(p>0) - // { - // String e=n.substring(p+1).toLowerCase(); - // addFilter(new BuFileFilter(e,_("Fichiers")+ - // " "+e.toUpperCase()),true); - // } - // } + VfsFile pf = _dir.getParentVfsFile(); + // FuLog.debug("%%% PF="+pf); + if (pf instanceof VfsFileFile) { + String p = pf.getAbsolutePath(); + pf = new Root(p, p, ".."); + } - if ((_filter == null) || _filter.accept(f)) { - files[nb_files] = f; - nb_files++; - } - } else { - // FuLog.debug("BEX: ignore entry "+f); - } - } + if (pf != null) { + pf.setViewName(".."); + dirs[0] = pf; + nb_dirs++; + } - // FuLog.debug("sort "+(System.currentTimeMillis()-before)); - els = null; - setProgression(40); - FuSort.sort(dirs, 0, nb_dirs); - setProgression(50); - FuSort.sort(files, 0, nb_files, getSorter()); + setProgression(30); - final int fnb_dirs = nb_dirs; - final int fnb_files = nb_files; + // cleanFilters(); + // addFilter(filter); + // filters_.setSelectedItem(filter); - - - - - if (_sel != null) _sel.build(); + for (int i = 0; i < l; i++) { + if (els[i].startsWith(".")) continue; + if (els[i].endsWith("~")) continue; + if ("CVS".equals(els[i])) continue; - runnable = new Runnable() { - public void run() { - // FuLog.debug("model"); - // dirs_.setEnabled(true); - dirs_.setEmptyText("No directory"); - dirs_.setModel(new Model(dirs, fnb_dirs)); - dirs_.revalidate(); - setProgression(60); + VfsFile f = _dir.createChild(els[i]); - // files_.setEnabled(true); - files_.setEmptyText("No file"); - files_.setModel(new Model(files, fnb_files)); - files_.revalidate(); - setProgression(70); - setProgression(80); - // FuLog.debug("end"); - repaint(); - if ((_sel != null) && !_sel.isDirectory()) files_.setSelectedValue(_sel, true); - if (!WAIT_CURSOR.equals(_cursor)) setCursor(_cursor); + if (f == null) {} - setProgression(100); - updating_ = false; - } - }; + //--cas particulier: si le fichier est un repertoire .POST + //-- on place les repertoire .POST avec les fichiers --// + else + if(TrPostFileFilter.acceptDirectoryPOST(f)){ - if (_showing) SwingUtilities.invokeLater(runnable); - else - runnable.run(); - // FuLog.debug("end "+(System.currentTimeMillis()-before)); - } + files[nb_files] = f; + nb_files++; + } - + + else if (f.isDirectory()) { + dirs[nb_dirs] = f; + nb_dirs++; + } else if (f.isFile()) { + // if(viewer_!=null) + // { + // String n=f.getName(); + // int p=n.lastIndexOf('.'); + // if(p>0) + // { + // String e=n.substring(p+1).toLowerCase(); + // addFilter(new BuFileFilter(e,_("Fichiers")+ + // " "+e.toUpperCase()),true); + // } + // } + + if ((_filter == null) || _filter.accept(f)) { + files[nb_files] = f; + nb_files++; + } + } else { + // FuLog.debug("BEX: ignore entry "+f); + } + } + + // FuLog.debug("sort "+(System.currentTimeMillis()-before)); + els = null; + setProgression(40); + FuSort.sort(dirs, 0, nb_dirs); + setProgression(50); + FuSort.sort(files, 0, nb_files, getSorter()); + + final int fnb_dirs = nb_dirs; + final int fnb_files = nb_files; + + + + + + if (_sel != null) _sel.build(); + + runnable = new Runnable() { + public void run() { + // FuLog.debug("model"); + // dirs_.setEnabled(true); + dirs_.setEmptyText("No directory"); + dirs_.setModel(new Model(dirs, fnb_dirs)); + dirs_.revalidate(); + setProgression(60); + + // files_.setEnabled(true); + files_.setEmptyText("No file"); + files_.setModel(new Model(files, fnb_files)); + files_.revalidate(); + setProgression(70); + + setProgression(80); + // FuLog.debug("end"); + repaint(); + + if ((_sel != null) && !_sel.isDirectory()) files_.setSelectedValue(_sel, true); + if (!WAIT_CURSOR.equals(_cursor)) setCursor(_cursor); + + setProgression(100); + updating_ = false; + } + }; + + if (_showing) SwingUtilities.invokeLater(runnable); + else + runnable.run(); + // FuLog.debug("end "+(System.currentTimeMillis()-before)); +} + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileRenderer.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileRenderer.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -112,9 +112,12 @@ if (mng_.isPostFormat(_file)) { return TrResource.getPostIcon(); } if (mng_.isPostLayoutFormat(_file)) { return TrResource.getPostLayoutIcon(); } if (mng_.getTxtFileFilter().accept(_file)) { return BuResource.BU.getToolIcon("texte"); } + if(TrApplicationManager.isScopFormat(_file)){ return TrResource.getScopIcon(); } }else - if(TrPostFileFilter.acceptDirectoryPOST(_file)) - { return TrResource.getPostLayoutIcon(); } + if(TrPostFileFilter.acceptDirectoryPOST(_file)){ + return TrResource.getPostLayoutIcon(); + } + return super.getIcon(_file); } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrResource.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrResource.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrResource.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -8,6 +8,7 @@ */ package org.fudaa.fudaa.tr.common; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.fdico.FDicoResource; import org.fudaa.fudaa.ressource.FudaaResource; @@ -62,6 +63,10 @@ return TrResource.TR.getIcon("crystal16_browser.png"); } + public static BuIcon getScopIcon() { + return EbliResource.EBLI.getIcon("curves"); + } + public static String getPostName() { return TrResource.getS("Post"); } 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-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -21,13 +21,19 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.fudaa.tr.common.TrApplicationManager; import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.actions.TrPostActionChooseAndCreateCalque; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCreateScope; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardImportScope; import com.memoire.bu.BuLib; import com.memoire.bu.BuMenu; +import com.memoire.bu.BuWizardDialog; /** * @author Fred Deniger @@ -40,6 +46,9 @@ public final TrPostProjet getCurrentProject() { return c_; } + public final void setCurrentProject(TrPostProjet _c) { + c_=_c; + } /** * @return toutes les fenetres de PostLayout @@ -294,6 +303,7 @@ * @param _f */ public void cmdOuvrirLayoutFile(final File _f) { + if (c_ == null) { // setProjet(new TrPostProjet(TrPostCommonImplementation.this)); c_ = new TrPostProjet(TrPostCommonImplementation.this); @@ -311,12 +321,91 @@ } BuLib.invokeLater(new Runnable() { public void run() { + c_.getManager().loadProject(true, _f); } }); } + +public void cmdOuvrirScopFile(final File _f) { + + if (c_ == null) { + // setProjet(new TrPostProjet(TrPostCommonImplementation.this)); + c_ = new TrPostProjet(TrPostCommonImplementation.this); + c_.active(TrPostCommonImplementation.this); + BuLib.invokeNowOrLater(new Runnable() { + public void run() { + setEnabledForAction("ENREGISTRER", true); + setEnabledForAction("ENREGISTRERSOUS", true); + setEnabledForAction("IMPORTER", true); + setEnabledForAction(getImportResultsAct(), true); + setEnabledForAction("IMPORT_PROJECT", true); + setEnabledForAction("RECHERCHER", true); + } + }); + } + BuLib.invokeLater(new Runnable() { + public void run() { + + if(TrPostCommonImplementation.this.getCurrentProject()==null) + TrPostCommonImplementation.this.setCurrentProject(new TrPostProjet(TrPostCommonImplementation.this)); + + // -- creation de la trpostlayoutFille --// + final TrPostLayoutFille postFrame = new TrPostLayoutFille(getCurrentProject()); + // -- sauvegarde du persitant --// + TrPostCommonImplementation.this.addInternalFrame(postFrame); + + + //-- creation du wizard scop --// + ScopCourbeTreeModel modelGraphe=new ScopCourbeTreeModel(); + final TrPostWizardCreateScope wizard = new TrPostWizardCreateScope(TrPostCommonImplementation.this.getCurrentProject(),modelGraphe ,_f); + final BuWizardDialog DialogWizard = new BuWizardDialog(TrPostCommonImplementation.this.getFrame(), wizard); + // --affichage du wizard --// + DialogWizard.setSize(600, 600); + DialogWizard.setLocationRelativeTo(TrPostCommonImplementation.this.getFrame()); + DialogWizard.setVisible(true); + + //-- TODO: ajout d'une frame ??? --// + +// final EGGraphe graphe = new EGGraphe(modelGraphe); +// TrPostCommonImplementation.this.getCurrentProject().addGrapheNodeInCurrentScene(new EGFillePanel(graphe), _f.getName()); + } + }); + + } + + +// /** +// * Methode appelee pour creer un projet .SCOP +// * +// * @param _f +// */ +// public void cmdOuvrirScopFile(final File _f) { +// if (c_ == null) { +// // setProjet(new TrTrPostCommonImplementation.thisProjet(TrTrPostCommonImplementation.thisCommonImplementation.this)); +// c_ = new TrPostProjet(TrPostCommonImplementation.this); +// c_.active(TrPostCommonImplementation.this); +// BuLib.invokeNowOrLater(new Runnable() { +// public void run() { +// setEnabledForAction("ENREGISTRER", true); +// setEnabledForAction("ENREGISTRERSOUS", true); +// setEnabledForAction("IMPORTER", true); +// setEnabledForAction(getImportResultsAct(), true); +// setEnabledForAction("IMPORT_PROJECT", true); +// setEnabledForAction("RECHERCHER", true); +// } +// }); +// } +// BuLib.invokeLater(new Runnable() { +// public void run() { +// c_.getManager().loadProject(true, _f); +// } +// }); +// +// } + @Override public void cmdOuvrirFile(final File _f) { final TrPostCommonImplementation alreadyOpen = getLauncher().findPostWithOpenedFile(_f); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCreateScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCreateScope.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCreateScope.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -1,6 +1,7 @@ package org.fudaa.fudaa.tr.post.dialogSpec; import java.awt.event.ActionEvent; +import java.io.File; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGFillePanel; @@ -56,6 +57,15 @@ super(projet_, target); modelTarget_ = target; } + + /** + *Constructeur utilis\xE9 pour le pr\xE9chargement avec un fichier d\xE9ja connu + */ + public TrPostWizardCreateScope(final TrPostProjet projet_, final TrPostCourbeTreeModel target,File fileTocharge) { + super(projet_, target,false,fileTocharge); + modelTarget_ = target; + } + /** * Creation du graphe widget Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -84,6 +84,9 @@ * @author Adrien Hadoux */ public static boolean acceptDirectoryPOST(final File _f){ + + if(_f==null) + return false; if(!_f.isDirectory() || !_f.getName().contains("."+DEFAULT_EXTENSION)) return false; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFormat.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFormat.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFormat.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -71,4 +71,25 @@ public FileWriteOperationAbstract createWriter() { return null; } + + + public File getSetupFromMainDirectory(File mainDir){ + + if(mainDir!=null && mainDir.isDirectory() && mainDir.exists()){ + + if(TrPostFileFilter.acceptDirectoryPOST(mainDir)){ + + String path=mainDir.getAbsolutePath(); + path+=File.separator+TrPostPersistenceManager.setupProject; + File setup=new File(path); + + if(setup!=null && setup.exists() && setup.isFile()) + return setup; + } + + } + return null; + + } + } Modified: 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/TrPostPersistenceManager.java 2009-02-10 16:55:27 UTC (rev 4452) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2009-02-10 17:30:15 UTC (rev 4453) @@ -880,6 +880,7 @@ if (fileVar.isDirectory()) { CtuluRemoveContentDirectory.contentDirectoryRemover(fileVar); + } else fileVar.mkdir(); } catch (final Exception e) { // pas grave on continue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-12 20:39:51
|
Revision: 4460 http://fudaa.svn.sourceforge.net/fudaa/?rev=4460&view=rev Author: hadouxad Date: 2009-02-12 20:39:45 +0000 (Thu, 12 Feb 2009) Log Message: ----------- blindage lot 3 debut lot 4 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -4,6 +4,7 @@ import java.awt.Font; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; /** @@ -21,7 +22,33 @@ TraceLigne grille; boolean isIteratorUptodate; Color lineColor; - + + /** + * Booleen qui indique si l'on trace ou non la graduation + */ + boolean traceGrille_=false; + + /** + * Booleen qui indique si l'on trcae + */ + boolean traceSousGrille_=false; + + TraceLigneModel traceGraduations_=null; + TraceLigneModel traceSousGraduations_=null; + /** + * Mode nb graduations + */ + int nbPas_; + + /** + * Mode on donne la longueur des pas + */ + double longueurPas_; + /** + * le mode de graduation + */ + int modeGraduations_; + public EGAxeHorizontalPersist(EGAxeHorizontal axeX) { // TODO Auto-generated constructor stub fillInfoWith(axeX); @@ -38,6 +65,15 @@ this.isIteratorUptodate = axeX.isIteratorUptodate_; this.lineColor = axeX.lineColor_; + //-- persistance grilles et sous grilles --// + traceGrille_=axeX.traceGrille_; + traceSousGrille_=axeX.traceSousGrille_; + traceGraduations_=axeX.traceGraduations_; + traceSousGraduations_=axeX.traceSousGraduations_; + nbPas_=axeX.nbPas_; + longueurPas_=axeX.longueurPas_; + modeGraduations_=axeX.modeGraduations_; + } public EGAxeHorizontal generateAxe(){ @@ -51,6 +87,15 @@ axeX.grille_ = this.grille; axeX.isIteratorUptodate_ = this.isIteratorUptodate; axeX.lineColor_ = this.lineColor; + + //-- persistance grilles et sous grilles --// + axeX.traceGrille_=traceGrille_; + axeX.traceSousGrille_=traceSousGrille_; + axeX.traceGraduations_=traceGraduations_; + axeX.traceSousGraduations_=traceSousGraduations_; + axeX.nbPas_=nbPas_; + axeX.longueurPas_=longueurPas_; + axeX.modeGraduations_=modeGraduations_; return axeX; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -78,7 +78,11 @@ private CtuluValueEditorI editorV_; private JComponent tfHorMax_; private JComponent tfHorMin_; + private BuTextField tfHorPas_; + + + private JComponent tfVertMax_; private JComponent tfVertMin_; private BuTextField tfVertPas_; @@ -202,26 +206,58 @@ public void actionPerformed(ActionEvent e) { modeGraduationY_=combo.getSelectedIndex(); graphe_.axeUpdated(); + + EGAxe axeChoisi=null; + if(graphe_.getSelectedComponent()!=null) + axeChoisi=graphe_.getSelectedComponent().getAxeY(); + if(axeChoisi==null && axes_!=null && axes_.length>0) + axeChoisi=axes_[0]; + if(axeChoisi!=null) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + tfVertPas_.setText(""+axeChoisi.nbPas_); + else + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + tfVertPas_.setText(""+axeChoisi.longueurPas_); + } }); + + EGAxe axeChoisi=null; + if(graphe_.getSelectedComponent()!=null) + axeChoisi=graphe_.getSelectedComponent().getAxeY(); + if(axeChoisi==null && axes_!=null && axes_.length>0) + axeChoisi=axes_[0]; + + if(axeChoisi!=null) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + tfVertPas_.setText(""+axeChoisi.nbPas_); + else + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + tfVertPas_.setText(""+axeChoisi.longueurPas_); + + //-- affichage ou non des checkbox --// - - boxAfficheGraduationsY_.setSelected(false); + if(axeChoisi!=null) + boxAfficheGraduationsY_.setSelected(axeChoisi.traceGrille_); boxAfficheGraduationsY_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { apply(); } }); - boxAfficheSousGraduationsY_.setSelected(false); + if(axeChoisi!=null) + boxAfficheSousGraduationsY_.setSelected(axeChoisi.traceSousGrille_); boxAfficheSousGraduationsY_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { apply(); } }); + if(axeChoisi!=null) + modelGraduationsY_ = new BSelecteurLineModel(GRILLE_AXE_Y,axeChoisi.traceGraduations_); + else modelGraduationsY_ = new BSelecteurLineModel(GRILLE_AXE_Y); modelGraduationsY_.setSelecteurTarget(this); pnAxeV_.add(boxAfficheGraduationsY_); @@ -229,7 +265,11 @@ pnAxeV_.add(modelGraduationsY_.buildPanel()); //-- sous graduations --// - modelSousGraduationsY_ = new BSelecteurLineModel(SOUS_GRILLE_AXE_Y); + if(axeChoisi!=null) + modelSousGraduationsY_ = new BSelecteurLineModel(SOUS_GRILLE_AXE_Y,axeChoisi.traceSousGraduations_); + else + modelSousGraduationsY_ = new BSelecteurLineModel(SOUS_GRILLE_AXE_Y); + modelSousGraduationsY_.setSelecteurTarget(this); pnAxeV_.add(boxAfficheSousGraduationsY_); pnAxeV_.add(modelSousGraduationsY_.buildPanel()); @@ -293,6 +333,10 @@ public static String SOUS_GRILLE_AXE_X="SOUS_GRILLE_AXE_X"; public static String SOUS_GRILLE_AXE_Y="SOUS_GRILLE_AXE_Y"; + + BuComboBox comboHorizontal_=null; + BuComboBox comboVertical_=null; + private void buildHPanel(final boolean _removeAll) { final String minTxt = EbliLib.getS("Min:"); @@ -319,8 +363,17 @@ tfHorPas_.setColumns(10); tfHorPas_.setToolTipText(tooltipPas); tfHorPas_.addKeyListener(this); + + if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + tfHorPas_.setText(""+axeH_.nbPas_); + else + if(axeH_.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + tfHorPas_.setText(""+axeH_.longueurPas_); } + + + tfHorMax_.addKeyListener(this); tfHorMin_.addKeyListener(this); @@ -337,32 +390,40 @@ // pas //-- selection du type de graduations - final BuComboBox combo = new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), + if(comboHorizontal_==null){ + comboHorizontal_= new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), EbliLib.getS("Manuel: longueur des pas"),*/ EbliLib.getS(/*"Automatique:*/" Nb graduations"), EbliLib.getS(/*"Automatique:*/" Longueur des pas") }); lb = new BuLabel(typePasTxt); //pnAxeH_.add(lb); - pnAxeH_.add(combo); - - //-- listener de la combo --// - combo.addActionListener(new ActionListener() { + //-- listener de la combo --// + comboHorizontal_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - modeGraduationX_=combo.getSelectedIndex(); + modeGraduationX_=comboHorizontal_.getSelectedIndex(); + + if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS) + tfHorPas_.setText(""+axeH_.nbPas_); + else + if(modeGraduationX_==EGAxe.AUTO_LONGUEURPAS) + tfHorPas_.setText(""+axeH_.longueurPas_); + graphe_.axeUpdated(); } }); - + } + + pnAxeH_.add(comboHorizontal_); //-- affichage ou non des checkbox --// - boxAfficheGraduationsX_.setSelected(false); + boxAfficheGraduationsX_.setSelected(axeH_.traceGrille_); boxAfficheGraduationsX_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { apply(); } }); - boxAfficheSousGraduationsX_.setSelected(false); + boxAfficheSousGraduationsX_.setSelected(axeH_.traceSousGrille_); boxAfficheSousGraduationsX_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { @@ -760,12 +821,21 @@ return axeH_.traceGraduations_; if(_key.equals(SOUS_GRILLE_AXE_X)) return axeH_.traceSousGraduations_; - if(axes_==null || axes_.length==0) + + + EGAxe axeChoisi=null; + if(graphe_.getSelectedComponent()!=null) + axeChoisi=graphe_.getSelectedComponent().getAxeY(); + if(axeChoisi==null && axes_!=null && axes_.length>0) + axeChoisi=axes_[0]; + + if(axeChoisi==null) + //if(axes_==null || axes_.length==0) return null; if(_key.equals(GRILLE_AXE_Y)) - return axes_[0].traceGraduations_; + return axeChoisi.traceGraduations_; if(_key.equals(SOUS_GRILLE_AXE_Y)) - return axes_[0].traceSousGraduations_; + return axeChoisi.traceSousGraduations_; return null; @@ -783,7 +853,7 @@ ok=true; } if(ok) - apply(); + graphe_.axeUpdated(); if(axes_==null || axes_.length==0) return false; @@ -798,7 +868,7 @@ ok=true; } if(ok) - apply(); + graphe_.axeUpdated(); return false; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -4,6 +4,7 @@ import java.awt.Font; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; /** @@ -25,7 +26,31 @@ boolean isIteratorUptodate; Color lineColor; - + /** + * Booleen qui indique si l'on trace ou non la graduation + */ + boolean traceGrille_=false; + + /** + * Booleen qui indique si l'on trcae + */ + boolean traceSousGrille_=false; + + TraceLigneModel traceGraduations_=null; + TraceLigneModel traceSousGraduations_=null; + /** + * Mode nb graduations + */ + int nbPas_; + + /** + * Mode on donne la longueur des pas + */ + double longueurPas_; + /** + * le mode de graduation + */ + int modeGraduations_; public EGAxeVerticalPersist(EGAxeVertical axeY) { // TODO Auto-generated constructor stub @@ -45,6 +70,15 @@ this.grille = axeY.grille_; this.isIteratorUptodate = axeY.isIteratorUptodate_; this.lineColor = axeY.lineColor_; + + //-- persistance grilles et sous grilles --// + traceGrille_=axeY.traceGrille_; + traceSousGrille_=axeY.traceSousGrille_; + traceGraduations_=axeY.traceGraduations_; + traceSousGraduations_=axeY.traceSousGraduations_; + nbPas_=axeY.nbPas_; + longueurPas_=axeY.longueurPas_; + modeGraduations_=axeY.modeGraduations_; } @@ -63,6 +97,16 @@ axeY.grille_ = this.grille; axeY.isIteratorUptodate_ = this.isIteratorUptodate; axeY.lineColor_ = this.lineColor; + + //-- persistance grilles et sous grilles --// + axeY.traceGrille_=traceGrille_; + axeY.traceSousGrille_=traceSousGrille_; + axeY.traceGraduations_=traceGraduations_; + axeY.traceSousGraduations_=traceSousGraduations_; + axeY.nbPas_=nbPas_; + axeY.longueurPas_=longueurPas_; + axeY.modeGraduations_=modeGraduations_; + return axeY; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -111,7 +111,7 @@ //-- donnees specifiques --// infos.put("GROUPE", groupe); - + infos.put("DEFAULTY", ordonnees); model.setPersistSpecificDatas(dataSpecifiques, infos); EGCourbeChild courbe=null; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -286,7 +286,15 @@ //-- on finalise les actions d'un graphe --// + try{ model.finalizePersistance(); + }catch(Exception e){ + ((List<String>) parameters.get("errorMsg")) + .add("Erreur, la tentative de finalisation des donn\xE9es du graphe a \xE9chou\xE9 "); + ((List<String>) parameters.get("errorMsg")) + .add("Cette erreur est peut \xEAtre due \xE0 une incompatibilit\xE9 des variables pour un rejoue de donn\xE9es."); + + } //-- Etape finale: creation du graphe --// graphe=new EGGraphe(model); graphe.transformer_.setXAxe(axeX); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -370,8 +370,9 @@ LineString polyligne = (LineString) liste.get(2); // -- etape 4: recherche du source qui contient le path donn\xE9 --// + String idSource =null; if (projet != null && liste.size() >= 4) { - String idSource = (String) liste.get(3); + idSource = (String) liste.get(3); src = projet.findSourceById(idSource); if (src != null) this.data_ = src; else { @@ -409,7 +410,64 @@ this.builder_ = new EfLineIntersectionsResultsBuilder(polyligne, this.res_, new MvProfileCoteTester()); // -- rejouer les donn\xE9es --// - this.computeY(projet.impl_.getMainProgression()); + final List<String> listeReloadSource=(List<String>) infos.get("RELOAD"); + + if(listeReloadSource!=null && projet!=null && src!=null && idSource!=null &&listeReloadSource.contains(idSource)){ + + try{ + this.computeY(projet.impl_.getMainProgression()); + }catch(Exception e){ + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la tentative de rejouer les donn\xE9es pour le graphe profil spatial "+getTitle()+" a \xE9chou\xE9 avec le fichier d'id " + idVar); + ((List<String>) infos.get("errorMsg")) + .add("Par cons\xE9quent les anciens y seront recharg\xE9s (ceux stock\xE9s dans le fichier xml)"); + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = new TDoubleArrayList(classicalValues); + + if(y_==null || y_.size()==0) + return; + + double min=y_.get(0); + double max=y_.get(0); + + for(int k=1;k<y_.size();k++){ + if(min>y_.get(k)) + min=y_.get(k); + if(max<y_.get(k)) + max=y_.get(k); + + } + yMax_=max; + yMin_=min; + } + + }else{ + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = new TDoubleArrayList(classicalValues); + + if(y_==null || y_.size()==0) + return; + + double min=y_.get(0); + double max=y_.get(0); + + for(int k=1;k<y_.size();k++){ + if(min>y_.get(k)) + min=y_.get(k); + if(max<y_.get(k)) + max=y_.get(k); + + } + yMax_=max; + yMin_=min; + + } } public void viewGenerationSource(Map infos, CtuluUI impl) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -860,7 +860,12 @@ //-- recherche ou creation du bon groupe correspondant--// nvGroupe=getGroup(model.variable_,true); //nvGroupe.addEGComponent(courbe); - + + //-- on recopie l'axe Y pour ses propri\xE9t\xE9s (grilles marqueurs...)--// + if(nvGroupe!=null) + nvGroupe.setAxeY(groupe.getAxeY()); + + listeCourbeToAdd.add(courbe); //-- ajout du groupe dans la liste a supprimer --// @@ -869,6 +874,12 @@ }else if(courbe.getModel()!=null && (courbe.getModel() instanceof ScopeCourbeModel)){ //-- on cree le groupe sans car la courbe n'est pas profil spatioal, elel peut etre socpgen--// nvGroupe=getGroup(H2dVariableType.SANS,true); + + //-- on recopie l'axe Y pour ses propri\xE9t\xE9s (grilles marqueurs...)--// + if(nvGroupe!=null) + nvGroupe.setAxeY(groupe.getAxeY()); + + //nvGroupe.addEGComponent(courbe); //listeVar.put(groupe, MvProfileFillePanel.createGroupFor(H2dVariableType.SANS)); listeCourbeToAdd.add(courbe); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -420,10 +420,10 @@ public TrPostImplementation openLayoutPost(final File _f) { //-- version scop ou non --// - if(TrApplicationManager.isScopFormat(_f)){ - return openScopPost(_f); - - } +// if(TrApplicationManager.isScopFormat(_f)){ +// return openScopPost(_f); +// +// } final TrPostImplementation alreadyOpened = findPostWithOpenedFile(_f); if (alreadyOpened != null) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -8,6 +8,7 @@ */ package org.fudaa.fudaa.tr.common; +import java.awt.event.ActionEvent; import java.io.File; import java.util.HashMap; import java.util.Map; @@ -29,6 +30,8 @@ import org.fudaa.dodico.telemac.io.ScopeTFileFormat; import org.fudaa.dodico.telemac.io.SerafinFileFilter; import org.fudaa.dodico.telemac.io.SerafinFileFormat; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.FudaaUI; import org.fudaa.fudaa.commun.exec.FudaaAppliManagerImpl; @@ -375,7 +378,9 @@ launcher_ = _launcher; } - private static BuMenu buildMenuOuvrirAvec(final TrExplorer _explorer) { + BuMenuItem itemOpenScop_=null; + + private BuMenu buildMenuOuvrirAvec(final TrExplorer _explorer) { return new BuDynamicMenu(TrResource.getS("Ouvrir avec..."), "LAUNCH", BuResource.BU.getIcon("aucun")) { @Override @@ -392,6 +397,10 @@ for (int i = 0; i < nb; i++) { add(_explorer.createFileAction(_explorer.getAppliManager().getExec(i))); } + + //-- ajout du format scop --// + add(addScopExe(_explorer),0); + } } @@ -403,6 +412,26 @@ }; } + /** + * Action qui ajoute une action pour executer un fichier en mode scop. + * Tres utile car les ficheirs scop disposent souvant d'extensions non reconnues. + * @param _explorer + * @return + */ + private BuMenuItem addScopExe(final TrExplorer _explorer){ + //-- on ajoute l'option ouvrir avec le format scop --// + + EbliActionSimple action=new EbliActionSimple(TrResource.getS("Format SCOP"),EbliResource.EBLI.getIcon("curves"),"OPENSCOP"){ + public void actionPerformed(ActionEvent event){ + + ouvrirScopSansVerif(_explorer.getSelectedFile(),null); + } + }; + return new BuMenuItem(action); + + + } + protected void buildCmdForMenuFileOpenWith(final BuMenu _m, final TrExplorer _explor) { /* * _m.add(_explor.createFileAction(getTextExec())); _m.add(_explor.createFileAction(getConsoleExec())); @@ -568,17 +597,26 @@ protected String ouvrirScop(final VfsFile _f, final AbstractButton _lb) { // --si le format est du type *.POST if (isScopFormat(_f)) { - final String res = TrResource.getPostName(); + return ouvrirScopSansVerif(_f, _lb); + } + return null; + } + /** + * Ouvre un fichier de type scop sans verifier son extension. + * Necessaire pour l'execution de l'option ouvrir avec format scop car la plupart des fichiers scop ont des extensions exotiques, donc non reconnues... + * @param _f + * @param _lb + * @return + */ + protected String ouvrirScopSansVerif(final VfsFile _f, final AbstractButton _lb) { + final String res = TrResource.getPostName(); if (_lb == null) { - launcher_.openLayoutPost(_f); + launcher_.openScopPost(_f); } else { _lb.setIcon(TrResource.getScopIcon()); } return res; - } - return null; - } - + } protected String ouvrirPost(final VfsFile _f, final AbstractButton _lb) { if (isPostFormat(_f)) { @@ -600,13 +638,14 @@ String res = ouvrirEditor(_f, _lb); if (res != null) { return res; } + // -- tentative ouverture fichier type layout --// + res = ouvrirPostLayout(_f, _lb); + if (res != null) { return res; } //-- tentative ouverture fichier scop --// res=ouvrirScop(_f, _lb); if (res != null) { return res; } - // -- tentative ouverture fichier type layout --// - res = ouvrirPostLayout(_f, _lb); - if (res != null) { return res; } + res = ouvrirMesh(_f, _lb); if (res != null) { return res; } @@ -656,6 +695,10 @@ */ public void buildCmdForMenuFile(final JPopupMenu _m, final TrExplorer _explor) { openWith_ = buildMenuOuvrirAvec(_explor); + + + + _m.add(openWith_); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -205,7 +205,7 @@ BuMenuItem itemEditSetupLayout_=null; - + @Override protected void updateMenuFiles() { final int l = files_.getSelectedValues().length; @@ -219,9 +219,11 @@ //-- on degage l'editeur de texte specifique setup post si existe --// if(itemEditSetupLayout_!=null && pmFiles_.getComponentIndex(itemEditSetupLayout_)!=-1) pmFiles_.remove(itemEditSetupLayout_); - +// if(itemOpenScop_!=null && pmFiles_.getComponentIndex(itemOpenScop_)!=-1) +// pmFiles_.remove(itemOpenScop_); + //-- on v\xE9rifie qu'il s'agit d'un fichier de type POST, si oui on ajoute --// - final File selection=getSelectedFile(); + final VfsFile selection=getSelectedFile(); if(TrPostFileFilter.acceptDirectoryPOST(selection)){ EbliActionSimple action=new EbliActionSimple(TrResource.getS("Editer le fichier Setup"),EbliResource.EBLI.getIcon("text"),"EDITSETUP"){ public void actionPerformed(ActionEvent event){ @@ -236,6 +238,21 @@ //-- on ajoute l'editeur du fichier setup en deuxieme position --// itemEditSetupLayout_=new BuMenuItem(action); pmFiles_.add(itemEditSetupLayout_, 1); + }else{ +// +// //-- on ajoute l'option ouvrir avec le format scop --// +// if(!appli_.isGridFormat(selection) || !(appli_.isNotSerafinResFile(selection))){ +// EbliActionSimple action=new EbliActionSimple(TrResource.getS("Ouvrir au format SCOP"),EbliResource.EBLI.getIcon("curves"),"OPENSCOP"){ +// public void actionPerformed(ActionEvent event){ +// appli_.ouvrirScop(selection,null); +// +// +// } +// }; +// itemOpenScop_=new BuMenuItem(action); +// pmFiles_.add(itemOpenScop_,1); + // } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -52,6 +52,8 @@ */ TrPostImplementation openLayoutPost(File _f); + TrPostImplementation openScopPost(File _f); + /** * @param _f le fichier a ouvrir dans la fenetre de visu de maillage. */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.tr.post; +import gnu.trove.TDoubleArrayList; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -482,12 +484,34 @@ setSelectionPoint(point); //-- FAUT il rejouer les donnees?? --// - //final List<String> listeReloadSource=(List<String>) infos.get("RELOAD"); + final List<String> listeReloadSource=(List<String>) infos.get("RELOAD"); - //if(listeReloadSource!=null && projet!=null && this.source_!=null && listeReloadSource.contains(idSource)){ + if(listeReloadSource!=null && projet!=null && this.source_!=null && listeReloadSource.contains(idSource)){ //-- on rejoue les donn\xE9es : methode specialisee replayData--// - this.updateY(); - //} + try{ + this.updateY(); + }catch(Exception e){ + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la tentative de rejouer les donn\xE9es pour le graphe \xE9colution temporel "+getTitle()+" a \xE9chou\xE9 avec le fichier d'id " + idVar); + ((List<String>) infos.get("errorMsg")) + .add("Par cons\xE9quent les anciens y seront recharg\xE9s (ceux stock\xE9s dans le fichier xml)"); + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = classicalValues; + } + + + }else{ + + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = classicalValues; + } + // if(listeReloadSource!=null && projet!=null && this.source_!=null && listeReloadSource.contains(idSource)){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-02-12 22:54:15
|
Revision: 4461 http://fudaa.svn.sourceforge.net/fudaa/?rev=4461&view=rev Author: deniger Date: 2009-02-12 22:54:12 +0000 (Thu, 12 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/Thumbs.db branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt 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/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -487,13 +487,17 @@ * final GrBoite b = new GrBoite(new GrPoint(insets.left, insets.top, 0), new GrPoint(getWidth() - insets.left - * insets.right, getHeight() - insets.top - insets.bottom, 0)).; */ - final GrBoite b = new GrBoite(new GrPoint(0, getHeight(), 0), new GrPoint(getWidth(),0, 0)); + double minX = 0; + double minY = 0; + double maxX = getWidth(); + double maxY = getHeight(); if (insets_ != null) { - b.o_.x_ += insets_.left; - b.o_.y_ = b.o_.y_-(insets_.bottom+insets_.top); - b.e_.x_ =b.e_.x_- (insets_.left + insets_.right); - b.e_.y_ += insets_.top ; + minX = insets_.left; + minY = insets_.top; + maxX = maxX - insets_.right; + maxY = maxY - insets_.bottom; } + final GrBoite b = new GrBoite(new GrPoint(minX, minY, 0), new GrPoint(maxX, maxY, 0)); b.autoApplique(getCalque().getVersReel()); return b; } 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-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -1,7 +1,6 @@ package org.fudaa.ebli.commun; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.Map; @@ -29,19 +28,14 @@ * Les infos de la table. */ private Map<String, String> infos_; - private final Comparator<String> comparator_; +// private final Comparator<String> comparator_; public EbliModelInfos(List<String> liste, Map<String, String> map, List<String> colonnes) { - this(liste, map, colonnes, null); - } - - public EbliModelInfos(List<String> liste, Map<String, String> map, List<String> colonnes, - Comparator<String> comparator) { super(); listeKey_ = liste; infos_ = map; - comparator_ = comparator; +// comparator_ = comparator; colonnes_ = colonnes; listeValue_ = new ArrayList<String>(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/Thumbs.db =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-12 22:54:12 UTC (rev 4461) @@ -636,10 +636,17 @@ Conserver le ratio hauteur/largeur=Preserve width/height ratio Ne pas conserver le ratio hauteur/largeur=Do not preserve width/height ratio Dupliquer la sc\xE8ne= Duplicate the scene -Taille des pas= Step's lenght -Manuel: Nb graduations=Manual: nb of graduations -Manuel: taille des pas=Manual: Step's lenght +Nombre de graduations=Number of graduations +Longueur des pas=Step length +Manuel\: longueur des pas=Manual\: Step's length +Manuel\: Nombre de graduations=Manual\: Number of graduations +Automatique\: longueur des pas=Automatic\: Step's length +Automatique\: Nombre de graduations=Automatic\: Number of graduations Automatique=Automatic Grille auto activ\xE9e=Automatic Grid activated Couleur Grille=Grid's Color Couleur Sous Grille=SubGrid's color +Dessiner l'axe=Draw Axis +Dessiner les sous-graduations=Draw minor graduations +Grille\: trac\xE9 des lignes principales=Grid\:main lines +Grille\: lignes des sous graduations=Grid\:minor lines \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -26,6 +26,7 @@ String name_; Dimension ifDim_; BCalqueSaverInterface props_; + BCalqueSaverInterface cqInfosProps_; String selectedLayer_; double ptMinX_; double ptMinY_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -28,8 +28,8 @@ import com.memoire.fu.FuLog; /** - * Une classe pour la persistence d'une fenetre de visualisation 2D, qui contient des - * calques 2D. Les informations de la fenetre sont sauv\xE9es sur fichier projet .fzip. + * Une classe pour la persistence d'une fenetre de visualisation 2D, qui contient des calques 2D. Les informations de la + * fenetre sont sauv\xE9es sur fichier projet .fzip. * * @author fred deniger * @version $Id: FudaaFilleVisuPersistence.java,v 1.9.4.2 2008-04-01 07:20:52 bmarchan Exp $ @@ -90,7 +90,6 @@ // // } // } - public void saveIn(final CtuluArkSaver _writer, final ProgressionInterface _prog) { try { final BGroupeCalque donneesCalque = visu_.getDonneesCalque(); @@ -98,6 +97,7 @@ final BCalquePersistenceGroupe persistenceMng = donneesCalque.getGroupePersistenceMng(); persistenceMng.setTop(true); commitData(_writer.getDb(), persistenceMng.saveIn(donneesCalque, _writer, rep_ + '/', rep_), _prog); + } catch (final IOException _evt) { FuLog.error(_evt); @@ -112,6 +112,7 @@ private void commitData(final ObjectContainer _db, final BCalqueSaverInterface _data, final ProgressionInterface _prog) { final FilleVisuSaver saveData = setData(_db); saveData.props_ = _data; + saveData.cqInfosProps_ = visu_.getCqInfos().getGroupePersistenceMng().save(visu_.getCqInfos(), _prog); _db.set(saveData); _db.commit(); } @@ -136,7 +137,8 @@ saveData.ptMaxY_ = b.e_.y_; saveData.ptMinX_ = b.o_.x_; saveData.ptMinY_ = b.o_.y_; - saveData.legendUI_ = visu_.getCqLegend().saveUIProperties(); + + // saveData.legendUI_ = visu_.getCqLegend().saveUIProperties(); final BCalque selectedLayers = visu_.getCalqueActif(); if (selectedLayers != null) { saveData.selectedLayer_ = selectedLayers.getName(); @@ -146,6 +148,7 @@ /** * Restaure la fenetre de visu 2D : Les calques et les propri\xE9t\xE9s de la fenetre. + * * @param _impl L'implementation * @param _loader Le zip loader * @param _prog La progression de tache @@ -195,6 +198,7 @@ /** * Restaure les propri\xE9t\xE9s de la fenetre (hors calques de donn\xE9es). + * * @param _saveData Les propri\xE9t\xE9s de la fenetre de visu. * @param _impl L'implementation * @param _parent Le calque racine des calques de donn\xE9es. @@ -229,6 +233,10 @@ if (_saveData.legendUI_ != null && visu_.getCqLegend() != null) { visu_.getCqLegend().initFrom(_saveData.legendUI_); } + if (_saveData.cqInfosProps_ != null && visu_.getCqInfos() != null) { + visu_.getCqInfos().getGroupePersistenceMng().restore(_saveData.cqInfosProps_, visu_, + (BCalque) visu_.getCqInfos().getParent(), null); + } } }; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -1,16 +1,12 @@ package org.fudaa.fudaa.sig.layer; -import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Color; import java.awt.Container; -import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; -import javax.swing.JColorChooser; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; @@ -24,7 +20,6 @@ import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.trace.TraceIconButton; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.volume.controles.BControleVisible; @@ -70,7 +65,6 @@ return r; } - public JComponent buildContentPane() { final BuPanel content = new BuPanel(new BuVerticalLayout(2)); content.add(createMainProperties()); @@ -79,11 +73,11 @@ return content; } - public static String GRILLE_AXE_X="GRILLE_AXE_X"; - public static String GRILLE_AXE_Y="GRILLE_AXE_Y"; - public static String SOUS_GRILLE_AXE_X="SOUS_GRILLE_AXE_X"; - public static String SOUS_GRILLE_AXE_Y="SOUS_GRILLE_AXE_Y"; - + public static String GRILLE_AXE_X = "GRILLE_AXE_X"; + public static String GRILLE_AXE_Y = "GRILLE_AXE_Y"; + public static String SOUS_GRILLE_AXE_X = "SOUS_GRILLE_AXE_X"; + public static String SOUS_GRILLE_AXE_Y = "SOUS_GRILLE_AXE_Y"; + private static String MANUEL1 = "MANUEL1"; private static String MANUEL2 = "MANUEL2"; private static String AUTO = "AUTO"; @@ -97,25 +91,22 @@ boolean modeAutomatiqueY_ = true; private BuPanel createAxis() { - final BuPanel panelX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuPanel panelY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuPanel panelSousGrilleeX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuPanel panelSousGrilleeY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuCheckBox cbsousGrilleX = new BuCheckBox(EbliLib.getS("Dessiner les sous graduations X")); - final BuCheckBox cbsousGrilleY = new BuCheckBox(EbliLib.getS("Dessiner les sous graduations Y")); - - panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Graduations X"))); - final BuComboBox combo = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nb graduations"), - EbliLib.getS("Automatique: longueur des pas") }); + final BuPanel panelX = new BuPanel(new BuGridLayout(3, 5, 5, true, false, true, true, true)); + final BuPanel panelY = new BuPanel(new BuGridLayout(3, 5, 5, true, false, true, true, true)); + String text = EbliLib.getS("Dessiner les sous-graduations"); + // final BuPanel panelSousGrilleeX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + // final BuPanel panelSousGrilleeY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + final BuCheckBox cbsousGrilleX = new BuCheckBox(text); + final BuCheckBox cbsousGrilleY = new BuCheckBox(text); + + panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axe X"))); + final BuComboBox combo = createAxeComboBox(); final CardLayout layoutCardX = new CardLayout(); - + final BuPanel panelCardX = new BuPanel(layoutCardX); // panelCardX.setLayout(layoutCardX); - - - final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe X")); + final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe")); cbX.setSelected(target_.isDrawX()); cbX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -124,16 +115,14 @@ } }); - - BuPanel paneCombo1=new BuPanel(); - paneCombo1.add(combo); - panelX.add(cbX/*, BorderLayout.SOUTH*/); - panelX.add(paneCombo1/*, BorderLayout.NORTH*/); - panelX.add(panelCardX/*, BorderLayout.CENTER*/); - + + panelX.add(cbX/* , BorderLayout.SOUTH */); + panelX.add(combo/* , BorderLayout.NORTH */); + panelX.add(panelCardX/* , BorderLayout.CENTER */); + // -- panel x manuel 1: choix par nb de cesures --// final BuPanel pnXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduations"))); + // pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduations"))); final BuTextField btGraduationX = BuTextField.createIntegerField(); btGraduationX.setColumns(5); btGraduationX.setValue(new Integer(target_.getNbXGraduations())); @@ -156,10 +145,10 @@ // -- panel x manuel 2: choix par longueur des pas --// final BuPanel pnXmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationX2 = BuTextField.createDoubleField(); btGraduationX2.setColumns(5); - // btGraduationX2.setValue(new Integer(target_.get)); + // btGraduationX2.setValue(new Integer(target_.get)); pnXmanu2.add(btGraduationX2); btGraduationX2.addActionListener(new ActionListener() { @@ -179,75 +168,67 @@ // --on affiche le manuel 1 par defaut --// layoutCardX.show(panelCardX, "MANUEL1"); - combo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - modeAutomatiqueX_ = false; - if (combo.getSelectedIndex() == 0){ - layoutCardX.show(panelCardX, MANUEL1); - final int newVal = ((Integer) btGraduationX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationX(newVal); - } + public void actionPerformed(ActionEvent e) { + modeAutomatiqueX_ = false; + if (combo.getSelectedIndex() == 0) { + layoutCardX.show(panelCardX, MANUEL1); + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); } - else if (combo.getSelectedIndex() == 1){ - layoutCardX.show(panelCardX, MANUEL2); - if(btGraduationX2.getValue()!=null){ - final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsX(newVal); - } - } - } - else if (combo.getSelectedIndex() == 2) { - layoutCardX.show(panelCardX, MANUEL1); - modeAutomatiqueX_ = true; - final int newVal = ((Integer) btGraduationX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationX(newVal); + } else if (combo.getSelectedIndex() == 1) { + layoutCardX.show(panelCardX, MANUEL2); + if (btGraduationX2.getValue() != null) { + final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsX(newVal); } - } else if (combo.getSelectedIndex() == 3) { - layoutCardX.show(panelCardX, MANUEL2); - modeAutomatiqueX_ = true; - if(btGraduationX2.getValue()!=null){ + } + } else if (combo.getSelectedIndex() == 2) { + layoutCardX.show(panelCardX, MANUEL1); + modeAutomatiqueX_ = true; + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); + } + } else if (combo.getSelectedIndex() == 3) { + layoutCardX.show(panelCardX, MANUEL2); + modeAutomatiqueX_ = true; + if (btGraduationX2.getValue() != null) { final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsX(newVal); - }} + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsX(newVal); + } } - - if(combo.getSelectedIndex()>=2){ - cbsousGrilleX.setSelected(false); - cbsousGrilleX.setEnabled(false); - target_.setDrawSousGrilleX(false); - }else{ - cbsousGrilleX.setEnabled(true); - } - - - } - }); - - + if (combo.getSelectedIndex() >= 2) { + cbsousGrilleX.setSelected(false); + cbsousGrilleX.setEnabled(false); + target_.setDrawSousGrilleX(false); + } else { + cbsousGrilleX.setEnabled(true); + } + + } + + }); + // -- Panel y --// - - panelY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Graduations Y"))); - final BuComboBox comboY = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nb graduations"), - EbliLib.getS("Automatique: longueur des pas") }); + + panelY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axe Y"))); + final BuComboBox comboY = createAxeComboBox(); final CardLayout layoutCardY = new CardLayout(); - + final BuPanel panelCardY = new BuPanel(layoutCardY); // panelCardY.setLayout(layoutCardY); - - - final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe Y")); + + final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe")); cbY.setSelected(target_.isDrawY()); cbY.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -256,16 +237,15 @@ } }); - BuPanel combo3=new BuPanel(); - combo3.add(comboY); - panelY.add(cbY /*,BorderLayout.SOUTH*/); - panelY.add(combo3/*, BorderLayout.NORTH*/); - panelY.add(panelCardY/*, BorderLayout.CENTER*/); - + // BuPanel combo3 = new BuPanel(); + // combo3.add(comboY); + panelY.add(cbY /* ,BorderLayout.SOUTH */); + panelY.add(comboY/* , BorderLayout.NORTH */); + panelY.add(panelCardY/* , BorderLayout.CENTER */); // -- panel y manuel 1: choix par nb de cesures --// final BuPanel pnYmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationY = BuTextField.createIntegerField(); btGraduationY.setColumns(5); btGraduationY.setValue(new Integer(target_.getNbYGraduations())); @@ -288,10 +268,10 @@ // -- panel y manuel 2: choix par longueur des pas --// final BuPanel pnYmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationY2 = BuTextField.createDoubleField(); btGraduationY2.setColumns(5); - // btGraduationY2.setValue(new Integer(target_.getNbXGraduations())); + // btGraduationY2.setValue(new Integer(target_.getNbXGraduations())); pnYmanu2.add(btGraduationY2); btGraduationY2.addActionListener(new ActionListener() { @@ -310,91 +290,79 @@ // --on affiche le manuel 1 par defaut --// layoutCardY.show(panelCardY, "MANUEL1"); - comboY.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - modeAutomatiqueY_ = false; - if (comboY.getSelectedIndex() == 0){ - layoutCardY.show(panelCardY, MANUEL1); - final int newVal = ((Integer) btGraduationY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationY(newVal); - } + public void actionPerformed(ActionEvent e) { + modeAutomatiqueY_ = false; + if (comboY.getSelectedIndex() == 0) { + layoutCardY.show(panelCardY, MANUEL1); + final int newVal = ((Integer) btGraduationY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationY(newVal); } - else if (comboY.getSelectedIndex() == 1){ - layoutCardY.show(panelCardY, MANUEL2); - if(btGraduationY2.getValue()!=null){ - final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsY(newVal); - }} - } - else if (comboY.getSelectedIndex() == 2) { - layoutCardY.show(panelCardY, MANUEL1); - modeAutomatiqueY_ = true; - final int newVal = ((Integer) btGraduationY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationY(newVal); - } - } else if (comboY.getSelectedIndex() == 3) { - layoutCardY.show(panelCardY, MANUEL2); - modeAutomatiqueY_ = true; - if(btGraduationY2.getValue()!=null){ + } else if (comboY.getSelectedIndex() == 1) { + layoutCardY.show(panelCardY, MANUEL2); + if (btGraduationY2.getValue() != null) { final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsY(newVal); - }} + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsY(newVal); + } } - - if(comboY.getSelectedIndex()>=2){ - cbsousGrilleY.setSelected(false); - cbsousGrilleY.setEnabled(false); - target_.setDrawSousGrilleY(false); - }else{ - cbsousGrilleY.setEnabled(true); + } else if (comboY.getSelectedIndex() == 2) { + layoutCardY.show(panelCardY, MANUEL1); + modeAutomatiqueY_ = true; + final int newVal = ((Integer) btGraduationY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationY(newVal); + } + } else if (comboY.getSelectedIndex() == 3) { + layoutCardY.show(panelCardY, MANUEL2); + modeAutomatiqueY_ = true; + if (btGraduationY2.getValue() != null) { + final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsY(newVal); } - + } } - }); - - - - - + if (comboY.getSelectedIndex() >= 2) { + cbsousGrilleY.setSelected(false); + cbsousGrilleY.setEnabled(false); + target_.setDrawSousGrilleY(false); + } else { + cbsousGrilleY.setEnabled(true); + } + + } + + }); // -- panel des sous grilles --// // --sous grille x --// - - - final BuComboBox comboSousGrilleX = new BuComboBox(new String[] { EbliLib.getS("Nb graduations"), + + final BuComboBox comboSousGrilleX = new BuComboBox(new String[] { EbliLib.getS("Nombre de graduations"), EbliLib.getS("Longueur des pas") }); - - + final CardLayout layoutCardSousGrilleX = new CardLayout(); final BuPanel panelCardSouGrilleX = new BuPanel(layoutCardSousGrilleX); - - + cbsousGrilleX.setSelected(target_.isDrawY()); - - - BuPanel combo2=new BuPanel(); - combo2.add(comboSousGrilleX); - panelSousGrilleeX.add(cbsousGrilleX/*, BorderLayout.SOUTH*/); - panelSousGrilleeX.add(combo2/*, BorderLayout.NORTH*/); - panelSousGrilleeX.add(panelCardSouGrilleX/*, BorderLayout.CENTER*/); - + + panelX.add(cbsousGrilleX/* , BorderLayout.SOUTH */); + panelX.add(comboSousGrilleX); + panelX.add(panelCardSouGrilleX/* , BorderLayout.CENTER */); + cbsousGrilleX.setSelected(false); // -- panel sous grille x manuel 1: choix par nb de cesures --// final BuPanel pnsousXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - //pnsousXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnsousXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationSousX = BuTextField.createIntegerField(); btGraduationSousX.setColumns(5); - btGraduationSousX.setValue(new Integer(target_.getNbXSousGraduations()-1)); + btGraduationSousX.setValue(new Integer(target_.getNbXSousGraduations() - 1)); pnsousXmanu1.add(btGraduationSousX); btGraduationSousX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -410,7 +378,7 @@ panelCardSouGrilleX.add(pnsousXmanu1, MANUEL1); // -- panel sous grille x manuel 2: choix par longueur des pas --// final BuPanel pnSousXmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnSousXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnSousXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationSousX2 = BuTextField.createDoubleField(); btGraduationSousX2.setColumns(5); // btGraduationSousX2.setValue(new Integer(target_.getNbXGraduations())); @@ -427,78 +395,73 @@ panelCardSouGrilleX.add(pnSousXmanu2, MANUEL2); cbsousGrilleX.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setModeAutomatiqueX(modeAutomatiqueX_); - if (comboSousGrilleX.getSelectedIndex() == 0){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); - final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationSousGradX(newVal); - } + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + if (comboSousGrilleX.getSelectedIndex() == 0) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); + final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationSousGradX(newVal); + } + } else if (comboSousGrilleX.getSelectedIndex() == 1) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); + if (btGraduationSousX2.getValue() != null) { + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsSousGradX(newVal); } - else if (comboSousGrilleX.getSelectedIndex() == 1){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); - if(btGraduationSousX2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsSousGradX(newVal); - }} - } - - - target_.setDrawSousGrilleX(cbsousGrilleX.isSelected()); + } } - }); + + target_.setDrawSousGrilleX(cbsousGrilleX.isSelected()); + } + }); comboSousGrilleX.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (comboSousGrilleX.getSelectedIndex() == 0){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); - final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationSousGradX(newVal); - } + public void actionPerformed(ActionEvent e) { + if (comboSousGrilleX.getSelectedIndex() == 0) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); + final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationSousGradX(newVal); } - else if (comboSousGrilleX.getSelectedIndex() == 1){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); - if(btGraduationSousX2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsSousGradX(newVal); - }} + } else if (comboSousGrilleX.getSelectedIndex() == 1) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); + if (btGraduationSousX2.getValue() != null) { + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsSousGradX(newVal); + } } } - }); - - + } + }); + // --sous grille y --// - - final BuComboBox comboSousGrilleY = new BuComboBox(new String[] { EbliLib.getS("Nb graduations"), + + final BuComboBox comboSousGrilleY = new BuComboBox(new String[] { EbliLib.getS("Nombre de graduations"), EbliLib.getS("Longueur des pas") }); final CardLayout layoutCardSousGrilleY = new CardLayout(); - + final BuPanel panelCardSouGrilleY = new BuPanel(layoutCardSousGrilleY); // panelCardSouGrilleY.setLayout(layoutCardSousGrilleY); - - + cbsousGrilleY.setSelected(target_.isDrawY()); - - BuPanel combo4=new BuPanel(); - combo4.add(comboSousGrilleY); - panelSousGrilleeY.add(cbsousGrilleY/*, BorderLayout.SOUTH*/); - panelSousGrilleeY.add(combo4/*, BorderLayout.NORTH*/); - panelSousGrilleeY.add(panelCardSouGrilleY/*, BorderLayout.CENTER*/); - + + panelY.add(cbsousGrilleY/* , BorderLayout.SOUTH */); + panelY.add(comboSousGrilleY/* , BorderLayout.NORTH */); + panelY.add(panelCardSouGrilleY/* , BorderLayout.CENTER */); + cbsousGrilleY.setSelected(false); // -- panel sous grille x manuel 1: choix par nb de cesures --// final BuPanel pnsousYmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnsousYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnsousYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationSousY = BuTextField.createIntegerField(); btGraduationSousY.setColumns(5); - btGraduationSousY.setValue(new Integer(target_.getNbYSousGraduations()-1)); + btGraduationSousY.setValue(new Integer(target_.getNbYSousGraduations() - 1)); pnsousYmanu1.add(btGraduationSousY); btGraduationSousY.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -514,7 +477,7 @@ panelCardSouGrilleY.add(pnsousYmanu1, MANUEL1); // -- panel sous grille x manuel 2: choix par longueur des pas --// final BuPanel pnSousYmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - //pnSousYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnSousYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationSousY2 = BuTextField.createDoubleField(); btGraduationSousY2.setColumns(5); // btGraduationSousY2.setValue(new Integer(target_.getNbYGraduations())); @@ -531,78 +494,69 @@ panelCardSouGrilleY.add(pnSousYmanu2, MANUEL2); cbsousGrilleY.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setModeAutomatiqueY(modeAutomatiqueY_); - if (comboSousGrilleY.getSelectedIndex() == 0){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); - final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationSousGradY(newVal); - } + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + if (comboSousGrilleY.getSelectedIndex() == 0) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); + final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationSousGradY(newVal); } - else if (comboSousGrilleY.getSelectedIndex() == 1){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); - if(btGraduationSousY2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsSousGradY(newVal); - }} + } else if (comboSousGrilleY.getSelectedIndex() == 1) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); + if (btGraduationSousY2.getValue() != null) { + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsSousGradY(newVal); + } } - - target_.setDrawSousGrilleY(cbsousGrilleY.isSelected()); } - }); + + target_.setDrawSousGrilleY(cbsousGrilleY.isSelected()); + } + }); comboSousGrilleY.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (comboSousGrilleY.getSelectedIndex() == 0){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); - final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationSousGradY(newVal); - } + public void actionPerformed(ActionEvent e) { + if (comboSousGrilleY.getSelectedIndex() == 0) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); + final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationSousGradY(newVal); } - else if (comboSousGrilleY.getSelectedIndex() == 1){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); - if(btGraduationSousY2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsSousGradY(newVal); - }} + } else if (comboSousGrilleY.getSelectedIndex() == 1) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); + if (btGraduationSousY2.getValue() != null) { + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsSousGradY(newVal); + } } } - }); - - - // -- init des panels grilles --// - BuPanel pnGrille = new BuPanel(new GridLayout(2, 1)); - pnGrille.add(panelX); - pnGrille.add(panelSousGrilleeX ); + } + }); - // -- init panel sous grilles --// - BuPanel pnSousGrille = new BuPanel(new GridLayout(2, 1)); - pnSousGrille.add(panelY); - pnSousGrille.add(panelSousGrilleeY); - panelSousGrilleeX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous graduations X"))); - panelSousGrilleeY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous graduations Y"))); - // -- init au modes par defaut --// combo.setSelectedIndex(0); comboY.setSelectedIndex(0); // -- creation du panel contenant x et y --// BuPanel pnXY = new BuPanel(new GridLayout(2, 1)); - pnXY.add(pnGrille); - pnXY.add(pnSousGrille); + pnXY.add(panelX); + pnXY.add(panelY); return pnXY; } - - + private BuComboBox createAxeComboBox() { + return new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"), + EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"), + EbliLib.getS("Automatique: longueur des pas") }); + } + private BuPanel createMainProperties() { final BuPanel pn = new BuPanel(); pn.setBorder(CtuluLibSwing.createTitleBorder(super.getTitle())); @@ -621,42 +575,17 @@ }); pn.add(cb); - pn.add(new BuLabel(EbliLib.getS("Forme Grille"))); -// final TraceIconButton btColor = new TraceIconButton(); -// btColor.setForeground(target_.getForeground()); -// btColor.addActionListener(new ActionListener() { -// -// public void actionPerformed(final ActionEvent _e) { -// final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Grille"), target_.getForeground()); -// if (c != null) { -// target_.setForeground(c); -// btColor.setForeground(c); -// } -// } -// }); -// pn.add(btColor); - BSelecteurLineModel modelGraduations = new BSelecteurLineModel(GRILLE_AXE_X,this.target_.getTraceGraduations_()); - modelGraduations.setSelecteurTarget(this); - pn.add(modelGraduations.buildPanel()); - - pn.add(new BuLabel(EbliLib.getS("Forme Sous Grille"))); -// final TraceIconButton btColor2 = new TraceIconButton(); -// btColor2.setForeground(target_.getForeground()); -// btColor2.addActionListener(new ActionListener() { -// -// public void actionPerformed(final ActionEvent _e) { -// final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Sous Grille"), target_.getForeground()); -// if (c != null) { -// target_.setSousGraduationColor(c); -// btColor2.setForeground(c); -// } -// } -// }); -// pn.add(btColor2); - BSelecteurLineModel modelSousGraduations = new BSelecteurLineModel(SOUS_GRILLE_AXE_X,this.target_.getTraceSousGraduations_()); - modelSousGraduations.setSelecteurTarget(this); - pn.add(modelSousGraduations.buildPanel()); - + pn.add(new BuLabel(EbliLib.getS("Grille: trac\xE9 des lignes principales"))); + BSelecteurLineModel modelGraduations = new BSelecteurLineModel(GRILLE_AXE_X, this.target_.getTraceGraduations_()); + modelGraduations.setSelecteurTarget(this); + pn.add(modelGraduations.buildPanel()); + + pn.add(new BuLabel(EbliLib.getS("Grille: lignes des sous graduations"))); + BSelecteurLineModel modelSousGraduations = new BSelecteurLineModel(SOUS_GRILLE_AXE_X, this.target_ + .getTraceSousGraduations_()); + modelSousGraduations.setSelecteurTarget(this); + pn.add(modelSousGraduations.buildPanel()); + pn.add(new BuLabel(EbliLib.getS("Fonte"))); final BuButton btFont = new BuButton("1234.567"); pn.add(btFont); @@ -724,50 +653,42 @@ return zoom; } + public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { + // TODO Auto-generated method stub -public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { - // TODO Auto-generated method stub - -} + } + public Object getMin(String _key) { + // TODO Auto-generated method stub + return null; + } -public Object getMin(String _key) { - // TODO Auto-generated method stub - return null; -} + public Object getMoy(String _key) { + // TODO Auto-generated method stub + return null; + } + public Object getProperty(String _key) { + if (_key.equals(GRILLE_AXE_X)) return target_.getTraceGraduations_(); + if (_key.equals(SOUS_GRILLE_AXE_X)) return target_.getTraceSousGraduations_(); + return null; + } -public Object getMoy(String _key) { - // TODO Auto-generated method stub - return null; -} + public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { + // TODO Auto-generated method stub + } -public Object getProperty(String _key) { - if(_key.equals(GRILLE_AXE_X)) - return target_.getTraceGraduations_(); - if(_key.equals(SOUS_GRILLE_AXE_X)) - return target_.getTraceSousGraduations_(); - return null; -} - - -public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { - // TODO Auto-generated method stub - -} - - -public boolean setProperty(String _key, Object prop) { - boolean ok=false; - if(_key.equals(GRILLE_AXE_X)){ - target_.modifieTraceGraduations((TraceLigneModel) prop); - ok=true; - } - if(_key.equals(SOUS_GRILLE_AXE_X)){ - target_.modifieSousGraduations((TraceLigneModel) prop); - ok=true; - } - return ok; -} + public boolean setProperty(String _key, Object prop) { + boolean ok = false; + if (_key.equals(GRILLE_AXE_X)) { + target_.modifieTraceGraduations((TraceLigneModel) prop); + ok = true; + } + if (_key.equals(SOUS_GRILLE_AXE_X)) { + target_.modifieSousGraduations((TraceLigneModel) prop); + ok = true; + } + return ok; + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -140,8 +140,8 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.93-MAQUETTE-V8"; - infoSoft.date = "2009-02-02"; + infoSoft.version = "0.94-MAQUETTE-V9"; + infoSoft.date = "2009-02-12"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2007"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt =================================================================== (Binary files differ) 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-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -41,380 +41,375 @@ */ public abstract class TrPostCommonImplementation extends TrCommonImplementation { - TrPostProjet c_; + TrPostProjet c_; - public final TrPostProjet getCurrentProject() { - return c_; - } - public final void setCurrentProject(TrPostProjet _c) { - c_=_c; - } + public final TrPostProjet getCurrentProject() { + return c_; + } - /** - * @return toutes les fenetres de PostLayout - */ - public List<TrPostLayoutFille> getAllLayoutFille() { - final JInternalFrame[] allInternalFrames = getAllInternalFrames(); - if (allInternalFrames == null) return Collections.emptyList(); - final List<TrPostLayoutFille> res = new ArrayList<TrPostLayoutFille>(allInternalFrames.length); - for (int i = 0; i < allInternalFrames.length; i++) { - final JInternalFrame internalFrame = allInternalFrames[i]; - if (internalFrame instanceof TrPostLayoutFille) { - res.add((TrPostLayoutFille) internalFrame); - } - } - return res; - } + public final void setCurrentProject(TrPostProjet _c) { + c_ = _c; + } + /** + * @return toutes les fenetres de PostLayout + */ + public List<TrPostLayoutFille> getAllLayoutFille() { + final JInternalFrame[] allInternalFrames = getAllInternalFrames(); + if (allInternalFrames == null) return Collections.emptyList(); + final List<TrPostLayoutFille> res = new ArrayList<TrPostLayoutFille>(allInternalFrames.length); + for (int i = 0; i < allInternalFrames.length; i++) { + final JInternalFrame internalFrame = allInternalFrames[i]; + if (internalFrame instanceof TrPostLayoutFille) { + res.add((TrPostLayoutFille) internalFrame); + } + } + return res; + } - public void elimineDoublonNomsLayout(){ - List<TrPostLayoutFille> liste=getAllLayoutFille(); + public void elimineDoublonNomsLayout() { + List<TrPostLayoutFille> liste = getAllLayoutFille(); - for(int i=0;i<liste.size();i++){ - int cpt=1; - for(int j=i; j<liste.size();j++){ - if(liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)){ + for (int i = 0; i < liste.size(); i++) { + int cpt = 1; + for (int j = i; j < liste.size(); j++) { + if (liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)) { - liste.get(j).previousTitleFrame+="_"+(cpt++); - } - } + liste.get(j).previousTitleFrame += "_" + (cpt++); + } + } - } + } - } + } - /** - * @return la fenetre layout active. - */ - public TrPostLayoutFille getCurrentLayoutFille() { - final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); - if( currentInternalFrame instanceof TrPostLayoutFille) - return (TrPostLayoutFille) currentInternalFrame; - else{ - //-- on recherche la premiere file layout qu'on a et on l'envoie --// - //-- ACHTUNG: CAS A TRAITER:EXEMPLE SI ON EST DANS LA FRAME GESTION MULTI SOURCE; ON EST PAS DANS LA CURRENT LAYOUT MAIS ON S EN FOUT--// - return getAllLayoutFille().get(0); - } - } + /** + * @return la fenetre layout active. + */ + public TrPostLayoutFille getCurrentLayoutFille() { + final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); + if (currentInternalFrame instanceof TrPostLayoutFille) return (TrPostLayoutFille) currentInternalFrame; + else { + // -- on recherche la premiere file layout qu'on a et on l'envoie --// + // -- ACHTUNG: CAS A TRAITER:EXEMPLE SI ON EST DANS LA FRAME GESTION MULTI SOURCE; ON EST PAS DANS LA CURRENT + // LAYOUT MAIS ON S EN FOUT--// + return getAllLayoutFille().get(0); + } + } - /** - * @return la fenetre layout active ou la premiere des LayoutFille de cette application - */ - public TrPostLayoutFille getCurrentLayoutFilleOrFirst() { - TrPostLayoutFille current = getCurrentLayoutFille(); - if (current == null) { - final List<TrPostLayoutFille> allLayoutFille = getAllLayoutFille(); - if (!allLayoutFille.isEmpty()) current = allLayoutFille.get(0); - } - return current; - } + /** + * @return la fenetre layout active ou la premiere des LayoutFille de cette application + */ + public TrPostLayoutFille getCurrentLayoutFilleOrFirst() { + TrPostLayoutFille current = getCurrentLayoutFille(); + if (current == null) { + final List<TrPostLayoutFille> allLayoutFille = getAllLayoutFille(); + if (!allLayoutFille.isEmpty()) current = allLayoutFille.get(0); + } + return current; + } - @Override - public void init() { - super.init(); - final BuMenu menu = (BuMenu) getMainMenuBar().getMenu("IMPORTER"); - menu.addMenuItem(TrResource.getS("Autres r\xE9sultats"), getImportResultsAct()); - } + @Override + public void init() { + super.init(); + final BuMenu menu = (BuMenu) getMainMenuBar().getMenu("IMPORTER"); + menu.addMenuItem(TrResource.getS("Autres r\xE9sultats"), getImportResultsAct()); + } - String getImportResultsAct() { - return "IMPORT_RESULTS"; - } + String getImportResultsAct() { + return "IMPORT_RESULTS"; + } - @Override - public void close() { - if (c_ != null) { - c_.close(); - } - removeInternalFrames(getAllInternalFrames()); - } + @Override + public void close() { + if (c_ != null) { + c_.close(); + } + removeInternalFrames(getAllInternalFrames()); + } - public void setProjet(final TrPostProjet _c) { - if (c_ == _c) { return; } - new CtuluTaskOperationGUI(null, CtuluLibString.EMPTY_STRING) { + public void setProjet(final TrPostProjet _c) { + if (c_ == _c) { return; } + new CtuluTaskOperationGUI(null, CtuluLibString.EMPTY_STRING) { - @Override - public void act() { - saveAndCloseProjet(createProgressionInterface(this)); - c_ = _c; - if (c_ != null) { - c_.active(TrPostCommonImplementation.this); - BuLib.invokeNowOrLater(new Runnable() { - public void run() { - setEnabledForAction("CREER", true); - setEnabledForAction("ENREGISTRER", true); - setEnabledForAction("ENREGISTRERSOUS", true); - setEnabledForAction("IMPORTER", true); - setEnabledForAction("RECHERCHER", true); - setEnabledForAction(getImportResultsAct(), true); - setEnabledForAction("IMPORT_PROJECT", true); - } - }); - } - } - }.start(); + @Override + public void act() { + saveAndCloseProjet(createProgressionInterface(this)); + c_ = _c; + if (c_ != null) { + c_.active(TrPostCommonImplementation.this); + BuLib.invokeNowOrLater(new Runnable() { + public void run() { + setEnabledForAction("CREER", true); + setEnabledForAction("ENREGISTRER", true); + setEnabledForAction("ENREGISTRERSOUS", true); + setEnabledForAction("IMPORTER", true); + setEnabledForAction("RECHERCHER", true); + setEnabledForAction(getImportResultsAct(), true); + setEnabledForAction("IMPORT_PROJECT", true); + } + }); + } + } + }.start(); - } + } - public boolean saveAndCloseProjet(final ProgressionInterface _interface) { - if (c_ != null) { + public boolean saveAndCloseProjet(final ProgressionInterface _interface) { + if (c_ != null) { - // -- enregistrement sauce widget --// - final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); - if (i == JOptionPane.CANCEL_OPTION) { - return false; - } - if (i != JOptionPane.NO_OPTION) { - c_.getManager().saveProject(false); - //c_.save(this, _interface); - } + // -- enregistrement sauce widget --// + if (c_.isModified()) { + final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); + if (i == JOptionPane.CANCEL_OPTION) { return false; } + if (i != JOptionPane.NO_OPTION) { + c_.getManager().saveProject(false); + // c_.save(this, _interface); + } + } + c_.close(); + c_ = null; + SwingUtilities.invokeLater(new Runnable() { - c_.close(); - c_ = null; - SwingUtilities.invokeLater(new Runnable() { + public void run() { + setEnabledForAction("CREER", true); + setEnabledForAction("ENREGISTRER", false); + setEnabledForAction("IMPORTER", false); + setEnabledForAction(getImportResultsAct(), false); + setEnabledForAction("IMPORT_PROJECT", false); + } + }); + } - public void run() { - setEnabledForAction("CREER", true); - setEnabledForAction("ENREGISTRER", false); - setEnabledForAction("IMPORTER", false); - setEnabledForAction(getImportResultsAct(), false); - setEnabledForAction("IMPORT_PROJECT", false); - } - }); - } + return true; + } + @Override + public boolean confirmExit() { + final boolean b = super.confirmExit(); + if (b && c_ != null && !saveAndCloseProjet(null)) { return false; } + return b; + } + @Override + public void actionPerformed(final ActionEvent _evt) { + final String com = _evt.getActionCommand(); - return true; - } + if ("CREER".equals(com)) { - @Override - public boolean confirmExit() { - final boolean b = super.confirmExit(); - if (b && c_ != null && !saveAndCloseProjet(null)) { return false; } - return b; - } + 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); + } + // -- nettoyage du projet pr\xE9c\xE9dent --// - @Override - public void actionPerformed(final ActionEvent _evt) { - final String com = _evt.getActionCommand(); + c_.getManager().clearProject(); + } else { + c_ = new TrPostProjet(this); + c_.setMenuPost(); + } + // -- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// + c_.createNewLayoutFrame(); + // -- ouverture d'un fichier r\xE9sultat --// + TrPostActionChooseAndCreateCalque chooserSource = new TrPostActionChooseAndCreateCalque(c_, c_.getImpl() + .getCurrentLayoutFille().controller_); + chooserSource.actionPerformed(null); - if ("CREER".equals(com)) { + } 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); + } - 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); - } - //-- nettoyage du projet pr\xE9c\xE9dent --// + // -- nettoyage du projet pr\xE9c\xE9dent --// + c_.getManager().clearProject(); + } else { + c_ = new TrPostProjet(this); + c_.setMenuPost(); + } - c_.getManager().clearProject(); - } - else { - c_=new TrPostProjet(this); - c_.setMenuPost(); - } - //-- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// - c_.createNewLayoutFrame(); - //-- ouverture d'un fichier r\xE9sultat --// - TrPostActionChooseAndCreateCalque chooserSource= new TrPostActionChooseAndCreateCalque(c_,c_.getImpl().getCurrentLayoutFille().controller_); - chooserSource.actionPerformed(null); + c_.getManager().loadProject(false, null); + // new TrPostFusionProjet(c_); + } else + if ("FERMER".equals(com)) { + new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { - }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); - } + @Override + public void act() { + saveAndCloseProjet(createProgressionInterface(this)); + } + }.start(); + } else if ("ENREGISTRER".equals(com) && c_ != null) { + new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement")) { - //-- nettoyage du projet pr\xE9c\xE9dent --// - c_.getManager().clearProject(); - }else - { - c_=new TrPostProjet(this); - c_.setMenuPost(); - } + @Override + public void act() { + // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); - c_.getManager().loadProject(false, null); - //new TrPostFusionProjet(c_); + // -- enregistrement sauce widget --// + c_.getManager().saveProject(false); - } else + } + }.start(); + } else if ("ENREGISTRERSOUS".equals(com) && c_ != null) { + new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement Sous")) { - if ("FERMER".equals(com)) { - new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { + @Override + public void act() { + // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); - @Override - public void act() { - saveAndCloseProjet(createProgressionInterface(this)); - } - }.start(); - } else if ("ENREGISTRER".equals(com) && c_ != null) { - new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement")) { + // -- enregistrement sauce widget --// + c_.getManager().savePr... [truncated message content] |
From: <had...@us...> - 2009-02-13 19:16:23
|
Revision: 4471 http://fudaa.svn.sourceforge.net/fudaa/?rev=4471&view=rev Author: hadouxad Date: 2009-02-13 19:16:17 +0000 (Fri, 13 Feb 2009) Log Message: ----------- * Ajout des librairies pdf et ps pour les export (ps foireux....) * modification g?\195?\169n?\195?\169rales pour inclure ces formats dans tous les exports * ajout des formats a2,a3 et a4 ainsi que la possibilit?\195?\169 de choisir portrait ou landscape * calcul des pixels du format en fonction de la r?\195?\169solution ?\195?\169cran * pour la rotation :concat?\195?\169nation de 2 transformation affines * cr?\195?\169ation de m?\195?\169thode pour construire rapidement un rapport pdf * avancement sur les fl?\195?\168ches connectors. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-02-13 19:15:30 UTC (rev 4470) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-02-13 19:16:17 UTC (rev 4471) @@ -1073,7 +1073,7 @@ return conteneur; } - private JTable createTable() { + public JTable createTable() { final List<String> liste = new ArrayList<String>(infosCreation_.keySet()); Collections.sort(liste); final List<String> col = new ArrayList<String>(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-02-13 19:15:30 UTC (rev 4470) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-02-13 19:16:17 UTC (rev 4471) @@ -67,6 +67,7 @@ import org.fudaa.fudaa.tr.post.actions.TrPostActionDuplicate; import org.fudaa.fudaa.tr.post.actions.TrPostActionDuplicateLayout; import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCreateScope; +import org.fudaa.fudaa.tr.post.rapport.TrPostRapportLayout; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuDesktop; @@ -332,8 +333,8 @@ nodeFleche.setTitle("Fleche simple"); // nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFlecheSimple())); - nodeFleche.setCreator(new EbliWidgetCreatorArrowEditor(new EbliEditorArrow())); - // nodeFleche.setCreator(new EbliWidgetCreatorConnectionWidget()); + // nodeFleche.setCreator(new EbliWidgetCreatorArrowEditor(new EbliEditorArrow())); + nodeFleche.setCreator(new EbliWidgetCreatorConnectionWidget()); nodeFleche.setPreferedSize(new Dimension(200, 150)); @@ -601,7 +602,7 @@ init.add(null); init.add(new TrPostWizardCreateScope.ImportAction(projet_)); - + //init.add((new TrPostRapportLayout(getSceneCourante())).getAction()); actions_ = Collections.unmodifiableList(init); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java 2009-02-13 19:16:17 UTC (rev 4471) @@ -0,0 +1,120 @@ +package org.fudaa.fudaa.tr.post.rapport; + +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.util.HashMap; + +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.image.CtuluPdfPsExport; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.fudaa.tr.common.TrLib; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrPostScene; +import org.netbeans.api.visual.widget.Widget; + +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfWriter; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuIcon; + +/** + * Genere un rapport a partir du layout. + * le rapport est en pdf + * @author Adrien Hadoux + * + */ +public class TrPostRapportLayout { + + TrPostScene scene_=null; + EbliActionSimple actionGenerate_; + public TrPostRapportLayout(TrPostScene scene){ + scene_=scene; + actionGenerate_=new EbliActionSimple(TrResource.getS("Rapport"),EbliResource.EBLI.getIcon("text"),"RAPPORTPDF"){ + public void actionPerformed(ActionEvent e){ + + JFileChooser chooser=new JFileChooser(); + int reponse=chooser.showOpenDialog(null); + if(reponse!= JFileChooser.APPROVE_OPTION) + return; + + File f=chooser.getSelectedFile(); + writeDoc(f); + } + }; + + } + + public EbliActionSimple getAction(){ + return actionGenerate_; + } + + + + void writeDoc(File file){ + Document document = new Document(); + + //-- ajout des infos relatives au document --// + document.addTitle(CtuluResource.CTULU.getString("Exportation PDF")); + document.addAuthor("FUDAA generating document"); + + try { + PdfWriter writer =PdfWriter.getInstance(document, new FileOutputStream(file)); + document.open(); + + int w=scene_.getView().getSize().width; + int h=scene_.getView().getSize().height; + CtuluPdfPsExport.addImageToPdf(scene_.produceImage(w,h, new HashMap()), writer, w, h); + + for(Widget widget:scene_.getChildren()){ + if(widget instanceof EbliWidget){ + EbliWidget wid=(EbliWidget)widget; + + if(wid.getIntern() instanceof EbliWidgetVueCalque){ + EbliWidgetVueCalque vue=(EbliWidgetVueCalque)wid.getIntern(); + CtuluPdfPsExport.addImageToPdf(vue.getCalquePanel().produceImage(new HashMap()), writer, vue.getCalquePanel().getSize().width,vue.getCalquePanel().getSize().height); + + CtuluPdfPsExport.addJTableToPdf(vue.getCalquePanel().createTable() , writer); + + }else + if(wid.getIntern() instanceof EbliWidgetGraphe){ + EbliWidgetGraphe vue=(EbliWidgetGraphe)wid.getIntern(); + CtuluPdfPsExport.addImageToPdf(vue.getGraphe().produceImage(new HashMap()), writer, vue.getGraphe().getSize().width,vue.getGraphe().getSize().height); + + //CtuluPdfPsExport.addJTableToPdf(vue.getGraphe().get , writer); + + } + + + } + } + + + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-02-15 23:05:14
|
Revision: 4472 http://fudaa.svn.sourceforge.net/fudaa/?rev=4472&view=rev Author: deniger Date: 2009-02-15 23:05:09 +0000 (Sun, 15 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -43,11 +43,13 @@ import java.util.Locale; import java.util.TimeZone; +import org.fudaa.ctulu.CtuluLib; + /** * It\xE9rateur balayant les barres et \xE9tiquettes de graduation d'un axe du temps. Cet it\xE9rateur retourne les positions des * graduations \xE0 partir de la date la plus ancienne jusqu'\xE0 la date la plus r\xE9cente. Il choisit les intervalles de * graduation en supposant qu'on utilise un calendrier gr\xE9gorien. - * + * * @version $Id: DateIterator.java,v 1.1 2007-01-17 10:45:26 deniger Exp $ * @author Martin Desruisseaux */ @@ -83,8 +85,8 @@ /** * Liste des intervales souhait\xE9s pour la graduation. Les \xE9l\xE9ments de cette table doivent obligatoirement appara\xEEtre * en ordre croissant. Voici un exemple d'interpr\xE9tation: la pr\xE9sence de <code>5*MIN</code> suivit de - * <code>10*MIN</code> implique que si le pas estim\xE9 se trouve entre 5 et 10 minutes, ce sera le pas de 10 minutes - * qui sera s\xE9lectionn\xE9. + * <code>10*MIN</code> implique que si le pas estim\xE9 se trouve entre 5 et 10 minutes, ce sera le pas de 10 minutes qui + * sera s\xE9lectionn\xE9. */ private static final long[] INTERVAL = { SEC, 2 * SEC, 5 * SEC, 10 * SEC, 15 * SEC, 20 * SEC, 30 * SEC, MIN, 2 * MIN, 5 * MIN, 10 * MIN, 15 * MIN, 20 * MIN, 30 * MIN, HRE, 2 * HRE, 3 * HRE, 4 * HRE, 6 * HRE, 8 * HRE, 12 * HRE, DAY, @@ -97,9 +99,16 @@ * puis traduira cet intervalle en champ du calendrier gr\xE9gorien en lisant les \xE9l\xE9ments correspondants de ce tableau * {@link #ROLL}. */ - private static final byte[] ROLL = { 1, (byte) Calendar.SECOND, 25, (byte) Calendar.MILLISECOND, // x10 + private static final byte[] ROLL = { + 1, + (byte) Calendar.SECOND, + 25, + (byte) Calendar.MILLISECOND, // x10 // millis - 2, (byte) Calendar.SECOND, 50, (byte) Calendar.MILLISECOND, // x10 millis + 2, + (byte) Calendar.SECOND, + 50, + (byte) Calendar.MILLISECOND, // x10 millis 5, (byte) Calendar.SECOND, 1, (byte) Calendar.SECOND, 10, (byte) Calendar.SECOND, 2, (byte) Calendar.SECOND, 15, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 20, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 30, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 1, (byte) Calendar.MINUTE, 10, (byte) Calendar.SECOND, 2, @@ -122,8 +131,8 @@ (byte) Calendar.YEAR, 1, (byte) Calendar.YEAR, 5, (byte) Calendar.YEAR, 1, (byte) Calendar.YEAR }; /** - * Nombre de colonne dans le tableau {@link ROLL}. Le tableau {@link ROLL}doit \xEAtre interpr\xE9t\xE9 comme une matrice de - * 4 colonnes et d'un nombre ind\xE9termin\xE9 de lignes. + * Nombre de colonne dans le tableau {@link ROLL}. Le tableau {@link ROLL}doit \xEAtre interpr\xE9t\xE9 comme une matrice de 4 + * colonnes et d'un nombre ind\xE9termin\xE9 de lignes. */ private static final int ROLL_WIDTH = 4; @@ -247,21 +256,21 @@ /** * Code du format utilis\xE9 pour construire le champ de date de {@link #format_}. Les codes valides sont notamment - * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le - * format ne contient pas de champ de date, seulement un champ des heures. + * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le format ne + * contient pas de champ de date, seulement un champ des heures. */ private transient int dateFormat_ = -1; /** * Code du format utilis\xE9 pour construire le champ des heures de {@link #format_}. Les codes valides sont notamment - * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le format - * ne contient pas de champ des heures, seulement un champ de date. + * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le format ne + * contient pas de champ des heures, seulement un champ de date. */ private transient int timeFormat_ = -1; /** - * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 appel\xE9e. Dans ce - * cas, il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il \xE9crit. + * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 appel\xE9e. Dans ce cas, + * il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il \xE9crit. */ private transient boolean formatValid_; @@ -284,15 +293,13 @@ /** * Construit un it\xE9rateur pour la graduation d'un axe du temps. La m\xE9thode {@link #init(double, double, int)}<u>doit * </u> \xEAtre appel\xE9e avant que l'it\xE9rateur ne soit utilisable. - * + * * @param _timezone Fuseau horaire des dates. * @param _locale Conventions \xE0 utiliser pour le formatage des dates. */ public DateIterator(final TimeZone _timezone, final Locale _locale) { // assert INTERVAL.length*ROLL_WIDTH == ROLL.length; - if (INTERVAL.length * ROLL_WIDTH != ROLL.length) { - throw new IllegalArgumentException(); - } + if (INTERVAL.length * ROLL_WIDTH != ROLL.length) { throw new IllegalArgumentException(); } calendar_ = Calendar.getInstance(_timezone, _locale); this.locale_ = _locale; } @@ -349,9 +356,20 @@ init((long) (_min * 1000), (long) (_max * 1000), _nbTick <= 2 ? 2 : (_nbTick - 1), 1); } + public void initExact(final double _min, final double _max, final int _nbTick, final int nbSousTick) { + init((long) (_min * 1000), (long) (_max * 1000), _nbTick <= 2 ? 2 : (_nbTick - 1), 1); + } + + public void initExactFromDist(double _min, double _max, double _increment, int _nbSousIteration) { + if (CtuluLib.isZero(_increment)) { + init(_min, _max, 1); + } else init(_min, _max, Math.abs(_max - _min) / Math.abs(_increment)); + + } + /** * Initialise l'it\xE9rateur. - * + * * @param _minimum Date minimale de la premi\xE8re graduation. * @param _maximum Date limite des graduations. La derni\xE8re graduation ne sera pas n\xE9cessairement \xE0 cette date. * @param _visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation. Cette longueur doit \xEAtre @@ -452,13 +470,13 @@ value_ = minimum_; date_.setTime(value_); calendar_.setTime(date_); - // Arrondie la date de d\xE9part. Note: ce calcul exige que - // tous les champs commencent \xE0 0 plut\xF4t que 1, y compris - // les mois et le jour du mois. - final int offset = calendar_.getActualMinimum(tickField_); - int toRound = calendar_.get(tickField_) - offset; - toRound = (toRound / tickAdd_) * tickAdd_; - calendar_.set(tickField_, toRound + offset); + // Arrondie la date de d\xE9part. Note: ce calcul exige que + // tous les champs commencent \xE0 0 plut\xF4t que 1, y compris + // les mois et le jour du mois. + final int offset = calendar_.getActualMinimum(tickField_); + int toRound = calendar_.get(tickField_) - offset; + toRound = (toRound / tickAdd_) * tickAdd_; + calendar_.set(tickField_, toRound + offset); truncate(calendar_, tickField_); nextTick_ = calendar_.getTime().getTime(); nextSubTick_ = nextTick_; @@ -486,22 +504,20 @@ this.isMajorTick0_ = this.isMajorTick_; // assert ; - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - } + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); } } /** * Met \xE0 0 tous les champs du calendrier inf\xE9rieur au champ <code>field</code> sp\xE9cifi\xE9. Note: si le calendrier - * sp\xE9cifi\xE9 est {@link #calendar_}, il est de la responsabilit\xE9 de l'appelant de restituer {@link #calendar_}dans - * son \xE9tat correct apr\xE8s l'appel de cette m\xE9thode. + * sp\xE9cifi\xE9 est {@link #calendar_}, il est de la responsabilit\xE9 de l'appelant de restituer {@link #calendar_}dans son + * \xE9tat correct apr\xE8s l'appel de cette m\xE9thode. */ - private static void truncate(final Calendar _calendar,final int _field) { - int field=_field; + private static void truncate(final Calendar _calendar, final int _field) { + int field = _field; for (int i = 0; i < FIELD.length; i++) { if (FIELD[i] == field) { _calendar.get(field); // Force la mise \xE0 jour des champs. - int k=i; + int k = i; while (++k < FIELD.length) { field = FIELD[k]; _calendar.set(field, _calendar.getActualMinimum(field)); @@ -521,9 +537,9 @@ /** * Indique si la graduation courante est une graduation majeure. - * - * @return <code>true</code> si la graduation courante est une graduation majeure, ou <code>false</code> si elle - * est une graduation mineure. + * + * @return <code>true</code> si la graduation courante est une graduation majeure, ou <code>false</code> si elle est + * une graduation mineure. */ public boolean isMajorTick() { return isMajorTick_; @@ -607,9 +623,7 @@ */ public void next() { // assert calendar.getTime().getTime() == nextSubTick; - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - } + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); } if (nextSubTick_ < nextTick_) { isMajorTick_ = false; value_ = nextSubTick_; @@ -617,12 +631,12 @@ * IMPORTANT: On suppose ici que 'calendar' a d\xE9j\xE0 la date 'nextSubTick'. Si ce n'\xE9tait pas le cas, il faudrait * ajouter les lignes suivantes: */ -// if (false) { -// date_.setTime(value_); -// calendar_.setTime(date_); -// // 'setTime' oblige 'calendar' \xE0 recalculer ses -// // champs, ce qui a un impact sur la performance. -// } + // if (false) { + // date_.setTime(value_); + // calendar_.setTime(date_); + // // 'setTime' oblige 'calendar' \xE0 recalculer ses + // // champs, ce qui a un impact sur la performance. + // } calendar_.add(subTickField_, subTickAdd_); nextSubTick_ = calendar_.getTime().getTime(); // 'calendar' contient maintenant la date 'nextSubTick', @@ -682,13 +696,12 @@ initFormatVar(); } - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - // assert calendar.getTime().getTime() == nextSubTick; + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); + // assert calendar.getTime().getTime() == nextSubTick; } } - private void initFormatVar(){ + private void initFormatVar() { format_ = null; formatValid_ = false; // Pour \xEAtre en accord avec la sp\xE9cification @@ -712,9 +725,8 @@ calendar_.setTimeZone(_timezone); initFormatVar(); } - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - // assert calendar.getTime().getTime() == nextSubTick; + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); + // assert calendar.getTime().getTime() == nextSubTick; } } @@ -723,9 +735,7 @@ */ private static String getFieldName(final int _field) { for (int i = 0; i < FIELD.length; i++) { - if (FIELD[i] == _field) { - return FIELD_NAME[i]; - } + if (FIELD[i] == _field) { return FIELD_NAME[i]; } } return String.valueOf(_field); } @@ -734,39 +744,38 @@ * Returns a string representation of this iterator. Used for debugging purpose only. */ public String toString() { - // Note: in this particular case, using PrintWriter with 'println' generates - // less bytecodes than chaining StringBuffer.append(...) calls. - final StringWriter buf = new StringWriter(); - final PrintWriter out = new PrintWriter(buf); - final DateFormat formatTmp = DateFormat.getDateTimeInstance(); - formatTmp.setTimeZone(calendar_.getTimeZone()); - out.print("Minimum = "); - out.println(formatTmp.format(new Date(minimum_))); - out.print("Maximum = "); - out.println(formatTmp.format(new Date(maximum_))); - out.print("Increment = "); - out.print(increment_ / (24 * 3600000f)); - out.println(" days"); - out.print("Tick inc. = "); - out.print(tickAdd_); - out.print(' '); - out.println(getFieldName(tickField_)); - out.print("SubTick inc. = "); - out.print(subTickAdd_); - out.print(' '); - out.println(getFieldName(subTickField_)); - out.print("Next tick = "); - out.println(formatTmp.format(new Date(nextTick_))); - out.print("Next subtick = "); - out.println(formatTmp.format(new Date(nextSubTick_))); - out.flush(); - return buf.toString(); + // Note: in this particular case, using PrintWriter with 'println' generates + // less bytecodes than chaining StringBuffer.append(...) calls. + final StringWriter buf = new StringWriter(); + final PrintWriter out = new PrintWriter(buf); + final DateFormat formatTmp = DateFormat.getDateTimeInstance(); + formatTmp.setTimeZone(calendar_.getTimeZone()); + out.print("Minimum = "); + out.println(formatTmp.format(new Date(minimum_))); + out.print("Maximum = "); + out.println(formatTmp.format(new Date(maximum_))); + out.print("Increment = "); + out.print(increment_ / (24 * 3600000f)); + out.println(" days"); + out.print("Tick inc. = "); + out.print(tickAdd_); + out.print(' '); + out.println(getFieldName(tickField_)); + out.print("SubTick inc. = "); + out.print(subTickAdd_); + out.print(' '); + out.println(getFieldName(subTickField_)); + out.print("Next tick = "); + out.println(formatTmp.format(new Date(nextTick_))); + out.print("Next subtick = "); + out.println(formatTmp.format(new Date(nextSubTick_))); + out.flush(); + return buf.toString(); } + public void init(double _min, double _max, double pasDeTemps) { + init(_min, _max, (int) pasDeTemps); -public void init(double _min, double _max, double pasDeTemps) { -init(_min, _max, (int)pasDeTemps); + } -} - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -40,14 +40,29 @@ import org.geotools.resources.XMath; /** - * It\xE9rateur balayant les barres et \xE9tiquettes de graduation d'un axe. Cet it\xE9rateur retourne les - * positions des graduations \xE0 partir de la valeur minimale jusqu'\xE0 la valeur maximale. + * It\xE9rateur balayant les barres et \xE9tiquettes de graduation d'un axe. Cet it\xE9rateur retourne les positions des + * graduations \xE0 partir de la valeur minimale jusqu'\xE0 la valeur maximale. + * * @version $Id: NumberIterator.java,v 1.1 2007-01-17 10:45:26 deniger Exp $ * @author Martin Desruisseaux */ public class NumberIterator implements TickIterator { /** + * @return the maxFractionDigits + */ + public int getMaxFractionDigits() { + return maxFractionDigits; + } + + /** + * @param _maxFractionDigits the maxFractionDigits to set + */ + public void setMaxFractionDigits(int _maxFractionDigits) { + maxFractionDigits = _maxFractionDigits; + } + + /** * Petite quantit\xE9 utilis\xE9e pour \xE9viter les erreurs d'arrondissements dans les comparaisons. */ private static final double EPS = 1E-10; @@ -57,9 +72,8 @@ private static final int MAX_ITERATION = 200; /** - * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 - * appel\xE9e. Dans ce cas, il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il - * \xE9crit. + * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 appel\xE9e. Dans ce cas, + * il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il \xE9crit. */ private transient boolean formatValid_; @@ -71,8 +85,8 @@ int iterationDone_; /** - * Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. - * Cette valeur est fix\xE9e par {@link #init}. + * Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. Cette valeur est + * fix\xE9e par {@link #init}. */ private double maximum_; @@ -82,66 +96,65 @@ private double minimum_; /** - * Nombre de sous-divisions dans une graduation principale. Cette valeur est fix\xE9e par - * {@link #init}. + * Nombre de sous-divisions dans une graduation principale. Cette valeur est fix\xE9e par {@link #init}. */ private int subTickCount_; /** - * Index de la graduation secondaire en cours de tra\xE7age. Cette valeur va de 0 inclusivement - * jusqu'\xE0 {@link #subTickCount_}exclusivement. Elle sera modifi\xE9e \xE0 chaque appel \xE0 {@link #next}. + * Index de la graduation secondaire en cours de tra\xE7age. Cette valeur va de 0 inclusivement jusqu'\xE0 + * {@link #subTickCount_}exclusivement. Elle sera modifi\xE9e \xE0 chaque appel \xE0 {@link #next}. */ private int subTickIndex_; /** - * Index de la premi\xE8re sous-graduation dans la premi\xE8re graduation principale. Cette valeur est - * fix\xE9e par {@link #init}. + * Index de la premi\xE8re sous-graduation dans la premi\xE8re graduation principale. Cette valeur est fix\xE9e par + * {@link #init}. */ private int subTickStart_; /** - * Index de la graduation principale en cours de tra\xE7age. Cette valeur commence \xE0 0 et sera - * modifi\xE9e \xE0 chaque appel \xE0 {@link #next}. + * Index de la graduation principale en cours de tra\xE7age. Cette valeur commence \xE0 0 et sera modifi\xE9e \xE0 chaque appel \xE0 + * {@link #next}. */ private int tickIndex_; /** - * Valeur de la graduation principale ou secondaire actuelle. Cette valeur sera modifi\xE9e \xE0 chaque - * appel \xE0 {@link #next}. + * Valeur de la graduation principale ou secondaire actuelle. Cette valeur sera modifi\xE9e \xE0 chaque appel \xE0 + * {@link #next}. */ private double value_; /** - * Longueur de l'axe (en points). Cette information est conserv\xE9e afin d'\xE9viter de refaire toute - * la proc\xE9dure {@link #init}si les param\xE8tres n'ont pas chang\xE9s. + * Longueur de l'axe (en points). Cette information est conserv\xE9e afin d'\xE9viter de refaire toute la proc\xE9dure + * {@link #init}si les param\xE8tres n'ont pas chang\xE9s. */ private float visualLength_; /** - * Espace \xE0 laisser (en points) entre les graduations principales. Cette information est conserv\xE9e - * afin d'\xE9viter de refaire toute la proc\xE9dure {@link #init}si les param\xE8tres n'ont pas chang\xE9s. + * Espace \xE0 laisser (en points) entre les graduations principales. Cette information est conserv\xE9e afin d'\xE9viter de + * refaire toute la proc\xE9dure {@link #init}si les param\xE8tres n'ont pas chang\xE9s. */ private float visualTickSpacing_; /** - * Format \xE0 utiliser pour \xE9crire les \xE9tiquettes de graduation. Ce format ne sera construit que la - * premi\xE8re fois o\xF9 {@link #currentLabel}sera appel\xE9e. + * Format \xE0 utiliser pour \xE9crire les \xE9tiquettes de graduation. Ce format ne sera construit que la premi\xE8re fois o\xF9 + * {@link #currentLabel}sera appel\xE9e. */ protected transient NumberFormat format_; NumberFormat subFormat_; /** - * Construit un it\xE9rateur par d\xE9faut. La m\xE9thode {@link #init(double, double, float, float)}<u>doit </u> \xEAtre appel\xE9e avant que - * cet it\xE9rateur ne soit utilisable. + * Construit un it\xE9rateur par d\xE9faut. La m\xE9thode {@link #init(double, double, float, float)}<u>doit </u> \xEAtre appel\xE9e + * avant que cet it\xE9rateur ne soit utilisable. */ public NumberIterator() { - //this.locale = locale; + // this.locale = locale; } public NumberIterator(final NumberIterator _it) { initFrom(_it); - //this.locale = locale; + // this.locale = locale; } protected final void initFrom(final NumberIterator _it) { @@ -163,24 +176,23 @@ } } - protected void buildSubFormat(){ + protected void buildSubFormat() { if (format_ == null) { subFormat_ = null; - } - else if (subFormat_ == null) { + } else if (subFormat_ == null) { subFormat_ = (NumberFormat) format_.clone(); updateSubFormat(); } } - private void updateSubFormat(){ + private void updateSubFormat() { if (subFormat_ != null && format_ != null) { subFormat_.setMaximumFractionDigits(format_.getMaximumFractionDigits() + 1); subFormat_.setMinimumFractionDigits(format_.getMinimumFractionDigits()); } } - protected void buildFormat(final boolean _sci){ + protected void buildFormat(final boolean _sci) { if (format_ == null) { final DecimalFormat decFormat = _sci ? new DecimalFormat("0.###E0") : new DecimalFormat(); @@ -194,18 +206,18 @@ /** * Initialise l'it\xE9rateur. + * * @param _minimum Valeur minimale de la premi\xE8re graduation. - * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement - * cette valeur. - * @param _visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation. Cette - * longueur doit \xEAtre exprim\xE9e en pixels ou en points. - * @param _visualTickSpacing Espace \xE0 laisser visuellement entre deux marques de graduation. Cet - * espace doit \xEAtre exprim\xE9 en pixels ou en points (1/72 de pouce). + * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. + * @param _visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation. Cette longueur doit \xEAtre + * exprim\xE9e en pixels ou en points. + * @param _visualTickSpacing Espace \xE0 laisser visuellement entre deux marques de graduation. Cet espace doit \xEAtre + * exprim\xE9 en pixels ou en points (1/72 de pouce). */ - protected void init(final double _minimum,final double _maximum,final float _visualLength, - final float _visualTickSpacing){ + protected void init(final double _minimum, final double _maximum, final float _visualLength, + final float _visualTickSpacing) { if (_minimum == this.minimum_ && _maximum == this.maximum_ && _visualLength == this.visualLength_ - && _visualTickSpacing == this.visualTickSpacing_) { + && _visualTickSpacing == this.visualTickSpacing_) { rewind(); return; } @@ -216,9 +228,8 @@ this.visualLength_ = _visualLength; this.visualTickSpacing_ = _visualTickSpacing; /* - * Estime le pas qui donnera au moins l'espacement sp\xE9cifi\xE9 entre chaque graduation. D\xE9termine - * ensuite si ce pas est de l'ordre des dizaines, centaines ou autre et on ram\xE8nera - * temporairement ce pas \xE0 l'ordre des unit\xE9es. + * Estime le pas qui donnera au moins l'espacement sp\xE9cifi\xE9 entre chaque graduation. D\xE9termine ensuite si ce pas est + * de l'ordre des dizaines, centaines ou autre et on ram\xE8nera temporairement ce pas \xE0 l'ordre des unit\xE9es. */ double incrementTmp = (_maximum - _minimum) * (_visualTickSpacing / _visualLength); final double factor = XMath.pow10((int) Math.floor(XMath.log10(incrementTmp))); @@ -236,38 +247,33 @@ return; } /* - * Le pas se trouve maintenant entre 1 et 10. On l'ajuste maintenant pour lui donner des valeurs - * qui ne sont habituellement pas trop difficiles \xE0 lire. + * Le pas se trouve maintenant entre 1 et 10. On l'ajuste maintenant pour lui donner des valeurs qui ne sont + * habituellement pas trop difficiles \xE0 lire. */ final int subTickCountTmp; if (incrementTmp <= 1.0) { incrementTmp = 1.0; subTickCountTmp = 5; - } - else if (incrementTmp <= 2.0) { + } else if (incrementTmp <= 2.0) { incrementTmp = 2.0; subTickCountTmp = 4; - } - else if (incrementTmp <= 2.5) { + } else if (incrementTmp <= 2.5) { incrementTmp = 2.5; subTickCountTmp = 5; - } - else if (incrementTmp <= 4.0) { + } else if (incrementTmp <= 4.0) { incrementTmp = 4.0; subTickCountTmp = 4; - } - else if (incrementTmp <= 5.0) { + } else if (incrementTmp <= 5.0) { incrementTmp = 5.0; subTickCountTmp = 5; - } - else { + } else { incrementTmp = 10.0; subTickCountTmp = 5; } incrementTmp = incrementTmp * factor; /* - * Arrondie maintenant le minimum sur une des graduations principales. D\xE9termine ensuite combien - * de graduations secondaires il faut sauter sur la premi\xE8re graduation principale. + * Arrondie maintenant le minimum sur une des graduations principales. D\xE9termine ensuite combien de graduations + * secondaires il faut sauter sur la premi\xE8re graduation principale. */ final double tmp = _minimum; double minimumAxe = Math.floor(_minimum / incrementTmp + EPS) * incrementTmp; @@ -288,29 +294,47 @@ iterationDone_ = 0; } - public void init(double _min,double _max, double pasDeTemps){} - - - public final Object clone() throws CloneNotSupportedException{ - final NumberIterator res=(NumberIterator )super.clone(); + public void initExact(double _min, double _max, int _nbIteration, int _nbSousIteration) { + initExactCommon(_min, _max, _nbSousIteration); + increment_ = (maximum_ - minimum_) / Math.max(_nbIteration, 1); + } + + private void initExactCommon(double _min, double _max, int _nbSousIteration) { + minimum_ = Math.min(_min, _max); + maximum_ = Math.max(_min, _max); + subTickCount_ = Math.max(0, _nbSousIteration); + tickIndex_ = 0; + value_ = _min; + this.subTickStart_ = 0; + this.subTickIndex_ = 0; + this.formatValid_ = false; + iterationDone_ = 0; + } + + public void initExactFromDist(double _min, double _max, double _increment, int _nbSousIteration) { + initExactCommon(_min, _max, _nbSousIteration); + increment_ = _increment; + + } + + public final Object clone() throws CloneNotSupportedException { + final NumberIterator res = (NumberIterator) super.clone(); res.initFrom(this); return res; } /** - * Retourne l'\xE9tiquette de la graduation courante. On n'appele g\xE9n\xE9ralement cette m\xE9thode que pour - * les graduations majeures, mais elle peut aussi \xEAtre appel\xE9e pour les graduations mineures. - * Cette m\xE9thode retourne <code>null</code> s'il n'y a pas d'\xE9tiquette pour la graduation - * courante. + * Retourne l'\xE9tiquette de la graduation courante. On n'appele g\xE9n\xE9ralement cette m\xE9thode que pour les graduations + * majeures, mais elle peut aussi \xEAtre appel\xE9e pour les graduations mineures. Cette m\xE9thode retourne <code>null</code> + * s'il n'y a pas d'\xE9tiquette pour la graduation courante. */ - public String currentLabel(){ + public String currentLabel() { if (!formatValid_) { buildFormat(false); /* - * Trouve le nombre de chiffres apr\xE8s la virgule n\xE9cessaires pour repr\xE9senter les \xE9tiquettes - * de la graduation. Impose une limite de six chiffres, limite qui pourrait \xEAtre atteinte - * notamment avec les nombres p\xE9riodiques (par exemple des intervalles de temps exprim\xE9s en - * fractions de jours). + * Trouve le nombre de chiffres apr\xE8s la virgule n\xE9cessaires pour repr\xE9senter les \xE9tiquettes de la graduation. + * Impose une limite de six chiffres, limite qui pourrait \xEAtre atteinte notamment avec les nombres p\xE9riodiques + * (par exemple des intervalles de temps exprim\xE9s en fractions de jours). */ int precision; double step = Math.abs(increment_); @@ -319,7 +343,7 @@ if (minimum_ < 1E-3 && minimum_ > -1E-3 && step <= 1E-3 && !format_.isParseIntegerOnly()) { sci = true; step = step * XMath.pow10(-XMath.log10(step)); - // format=new Decima + // format=new Decima } for (precision = 0; precision < 10; precision++) { final double check = Math.rint(step * 1E+4) % 1E+4; @@ -331,8 +355,7 @@ if (sci) { ((DecimalFormat) format_).applyPattern("0.###E0"); precision++; - } - else if (!format_.isParseIntegerOnly()) { + } else if (!format_.isParseIntegerOnly()) { ((DecimalFormat) format_).applyPattern("0.00"); } if (precision == 0 && step < 1E-4) { @@ -347,14 +370,12 @@ precision = s.length() - i; format_.setMinimumFractionDigits(precision); format_.setMaximumFractionDigits(precision); - } - else { + } else { format_.setMinimumFractionDigits(0); format_.setMaximumFractionDigits(30); } - } - else { - precision=computePrecision(precision); + } else { + precision = computePrecision(precision); format_.setMinimumFractionDigits(precision); format_.setMaximumFractionDigits(precision); } @@ -364,85 +385,84 @@ return formatValue(currentValue()); } - protected int computePrecision(final int _i){ - return _i; + int maxFractionDigits = -1; + + protected int computePrecision(final int _i) { + return maxFractionDigits >= 0 ? Math.min(maxFractionDigits, _i) : _i; } /** - * Returns the position where to draw the current tick. The position is scaled from the - * graduation's minimum to maximum. This is usually the same number than {@link #currentValue}. - * The mean exception is for logarithmic graduation, in which the tick position is not - * proportional to the tick value. + * Returns the position where to draw the current tick. The position is scaled from the graduation's minimum to + * maximum. This is usually the same number than {@link #currentValue}. The mean exception is for logarithmic + * graduation, in which the tick position is not proportional to the tick value. */ - public double currentPosition(){ + public double currentPosition() { return value_; } /** - * Retourne la valeur de la graduation courante. Cette m\xE9thode peut \xEAtre appel\xE9e pour une - * graduation majeure ou mineure. + * Retourne la valeur de la graduation courante. Cette m\xE9thode peut \xEAtre appel\xE9e pour une graduation majeure ou + * mineure. */ - public double currentValue(){ + public double currentValue() { return value_; } - public String formatSubValue(final double _v){ + public String formatSubValue(final double _v) { if (!formatValid_) { currentLabel(); } if (subFormat_ == null) { buildSubFormat(); } - if (subFormat_ == null) { - return Double.toString(_v); - } + if (subFormat_ == null) { return Double.toString(_v); } return subFormat_.format(_v); } - public String formatValue(final double _v){ + public String formatValue(final double _v) { if (!formatValid_) { currentLabel(); } return format_.format(_v); } - public double getIncrement(){ + public double getIncrement() { return increment_; } /** - * Indique s'il reste des graduations \xE0 retourner. Cette m\xE9thode retourne <code>true</code> tant - * que {@link #currentValue}ou {@link #currentLabel}peuvent \xEAtre appel\xE9es. + * Indique s'il reste des graduations \xE0 retourner. Cette m\xE9thode retourne <code>true</code> tant que + * {@link #currentValue}ou {@link #currentLabel}peuvent \xEAtre appel\xE9es. */ - public boolean hasNext(){ + public boolean hasNext() { return iterationDone_ < MAX_ITERATION && value_ <= maximum_; } /** * Initialise l'it\xE9rateur. + * * @param _minimum Valeur minimale de la premi\xE8re graduation. - * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement - * cette valeur. + * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. * @param _nbTick le nombre de graduation */ - public void init(final double _minimum,final double _maximum,final int _nbTick){ + public void init(final double _minimum, final double _maximum, final int _nbTick) { init(_minimum, _maximum, _nbTick <= 1 ? DEFAULT_STICK_NUMBER : _nbTick, 1); } /** * Indique si la graduation courante est une graduation majeure. - * @return <code>true</code> si la graduation courante est une graduation majeure, ou - * <code>false</code> si elle est une graduation mineure. + * + * @return <code>true</code> si la graduation courante est une graduation majeure, ou <code>false</code> si elle est + * une graduation mineure. */ - public boolean isMajorTick(){ + public boolean isMajorTick() { return subTickIndex_ == 0; } - - - public double getValueFromPosition(final double _v){ + public double getValueFromPosition(final double _v) { return _v; } + /** * Conventions \xE0 utiliser pour le formatage des nombres. */ @@ -450,17 +470,18 @@ * private Locale locale; */ - public final boolean isValid(){ + public final boolean isValid() { return formatValid_; } - public double getPositionFromValue(final double _v){ + public double getPositionFromValue(final double _v) { return _v; } + /** * Passe \xE0 la graduation suivante. */ - public void next(){ + public void next() { if (++subTickIndex_ >= subTickCount_) { subTickIndex_ = 0; iterationDone_++; @@ -473,7 +494,7 @@ /** * Passe directement \xE0 la graduation majeure suivante. */ - public void nextMajor(){ + public void nextMajor() { subTickIndex_ = 0; iterationDone_++; value_ = minimum_ + increment_ * (++tickIndex_); @@ -482,14 +503,14 @@ /** * Replace l'it\xE9rateur sur la premi\xE8re graduation. */ - public void rewind(){ + public void rewind() { iterationDone_ = 0; tickIndex_ = 0; subTickIndex_ = subTickStart_; value_ = minimum_ + increment_ * (subTickStart_ / (double) subTickCount_); } - public final void setValid(final boolean _formatValid){ + public final void setValid(final boolean _formatValid) { formatValid_ = _formatValid; } @@ -504,7 +525,7 @@ * Modifie les conventions \xE0 utiliser pour \xE9crire les \xE9tiquettes de graduation. */ /* - * public final void setLocale(final Locale locale){ if (!locale.equals(this.locale)) { - * this.locale = locale; this.format = null; formatValid = false; } } + * public final void setLocale(final Locale locale){ if (!locale.equals(this.locale)) { this.locale = locale; + * this.format = null; formatValid = false; } } */ } \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -1,151 +0,0 @@ -package org.fudaa.ctulu.iterator; - -import java.text.DecimalFormat; - -/** - * Un iterator qui cree une grille avec exactement le meme nombre de graduations que sp\xE9cifi\xE9es. - * @author Adrien Hadoux - * - */ -public class NumberIteratorGraduationsFixe implements TickIterator { - /** - * Pour eviter les loop infinie. - */ - private static final int MAX_ITERATION = 500; - - /** - * Le nombre de graduations totales a ne pas d\xE9passer - */ - int nbGraduations_=10; - double min_; - double max_; - - /** - * Indice courant de la graduation. - */ - int current_=0; - - - /** - * La valeur de la droite de la grille - */ - double value_; - - - public NumberIteratorGraduationsFixe(){ - - } - - public String currentLabel() { - DecimalFormat df = new DecimalFormat("#.0"); - String currentLabel; - currentLabel = df.format(value_); - String chiffreApresVirgule = currentLabel.substring(currentLabel - .lastIndexOf(",") + 1); - if (chiffreApresVirgule.equals("0")) - currentLabel = "" + (int) value_; - return currentLabel; - } - - - public double currentPosition() { - - return current_; - } - - - public double currentValue() { - - return value_; - } - - public Object clone() throws CloneNotSupportedException{ - return null; - } - - - public String formatSubValue(double _v) { - - return null; - } - - - public String formatValue(double _v) { - - return null; - } - - - public double getIncrement() { - - return current_; - } - - - public double getPositionFromValue(double _v) { - - return 0; - } - - - public double getValueFromPosition(double _v) { - - return 0; - } - - - public boolean hasNext() { - if(current_>MAX_ITERATION) - return false; - if(current_<nbGraduations_ ){ - current_++; - return true; - } - return false; - } - - - public void init(double _min, double _max, int iteration) { - min_=_min; - max_=_max; - //-- nb iterations + 1 car utilise une graduation confondue --// - nbGraduations_=iteration+1; - current_=0; - value_=_min; - - - } - - public void init(double _min,double _max, double pasDeTemps){} - - - public boolean isMajorTick() { - // TODO Auto-generated method stub - return true; - } - - - public void next() { - - double distance = max_ - min_;// e - double taillePas = (distance / (nbGraduations_-1)); - - value_= (min_ + (taillePas * (current_))); - - } - - - - - public void nextMajor() { - // TODO Auto-generated method stub - next(); - } - - - public void rewind() { - current_--; - - } - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -1,163 +0,0 @@ -package org.fudaa.ctulu.iterator; - -import java.text.DecimalFormat; - -/** -* Un iterator qui cree une grille avec exactement les graduations avec la m\xEAme longueur sp\xE9cifi\xE9es. -* @author Adrien Hadoux -* -*/ -public class NumberIteratorPasFixe implements TickIterator { - /** - * Pour eviter les loop infinie. - */ - private static final int MAX_ITERATION = 500; - - /** - * La longueur totale a ne pas depasser - */ - double longueurPas_; - double min_; - double max_; - - /** - * Le nombre de graduations total a r\xE9aliser est n\xE9cessaire pour indiquer qu'il prendre en compte le dernier trait m\xEAme si il d\xE9passe de la vue (si taille pas proportionnelle a longueur pas) - * Super utile pour les sous graduations - */ - int nbGraduations_; - - /** - * Indice courant de la graduation. - */ - int current_=0; - - - /** - * La valeur de la graduation - */ - double value_; - - - public NumberIteratorPasFixe(){ - - } - - public String currentLabel() { - DecimalFormat df = new DecimalFormat("#.0"); - String currentLabel; - currentLabel = df.format(value_); - String chiffreApresVirgule = currentLabel.substring(currentLabel - .lastIndexOf(",") + 1); - if (chiffreApresVirgule.equals("0")) - currentLabel = "" + (int) value_; - return currentLabel; - } - - - public double currentPosition() { - - return current_; - } - - - public double currentValue() { - - return value_; - } - - public Object clone() throws CloneNotSupportedException{ - return null; - } - - - public String formatSubValue(double _v) { - - return null; - } - - - public String formatValue(double _v) { - - return null; - } - - - public double getIncrement() { - - return current_; - } - - - public double getPositionFromValue(double _v) { - - return 0; - } - - - public double getValueFromPosition(double _v) { - - return 0; - } - - - public boolean hasNext() { - if(current_>MAX_ITERATION) - return false; - //-- Il faut penser a ses petits (les sous graduations)--// - if( current_==nbGraduations_-1 && value_<max_ ){ - nbGraduations_++; - } - - - if(current_<nbGraduations_){ - current_++; - return true; - } - return false; - } - - - public void init(double _min, double _max, int iteration) { - init(_min,_max,new Double(iteration).doubleValue()); - - } - - - public void init(double _min,double _max, double pasDeTemps){ - min_=_min; - max_=_max; - longueurPas_=pasDeTemps; - current_=0; - value_=_min; - //-- nb iterations + 1 car utilise une graduation confondue --// - - nbGraduations_=(int) ((max_ - min_)/longueurPas_)+1; - - } - - public boolean isMajorTick() { - // TODO Auto-generated method stub - return true; - } - - - public void next() { - - value_= min_ + (longueurPas_ * (current_)); - - - } - - - public void nextMajor() { - // TODO Auto-generated method stub - next(); - } - - - public void rewind() { - current_--; - - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -33,96 +33,108 @@ */ package org.fudaa.ctulu.iterator; - // Miscellaneous //import java.util.Locale; - /** - * Provides the mechanism for Graduation objects to return the - * values and labels of their ticks one tick at a time. This interface - * returns tick values from some minimal value up to some maximal value, - * using some increment value. Note that the increment value <strong>may - * not be constant</strong>. For example, a graduation for the time axis - * may use a slightly variable increment between differents months, since - * all months doesn't have the same number of days. - * + * Provides the mechanism for Graduation objects to return the values and labels of their ticks one tick at a time. This + * interface returns tick values from some minimal value up to some maximal value, using some increment value. Note that + * the increment value <strong>may not be constant</strong>. For example, a graduation for the time axis may use a + * slightly variable increment between differents months, since all months doesn't have the same number of days. + * * @version $Id: TickIterator.java,v 1.1 2007-01-17 10:45:26 deniger Exp $ * @author Martin Desruisseaux */ -public interface TickIterator extends Cloneable{ +public interface TickIterator extends Cloneable { /** * Le nombre de graduation par defaut. */ - int DEFAULT_STICK_NUMBER=10; - /** - * Tests if the iterator has more ticks. - */ - boolean hasNext(); + int DEFAULT_STICK_NUMBER = 10; - /** - * Tests if the current tick is a major one. - * - * @return <code>true</code> if current tick is a major tick, - * or <code>false</code> if it is a minor tick. - */ - boolean isMajorTick(); + /** + * Tests if the iterator has more ticks. + */ + boolean hasNext(); - /** - * Returns the position where to draw the current tick. The position is scaled - * from the graduation's minimum to maximum. This is usually the same number - * than {@link #currentValue}. The mean exception is for logarithmic graduation, - * in which the tick position is not proportional to the tick value. - */ - double currentPosition(); + /** + * Tests if the current tick is a major one. + * + * @return <code>true</code> if current tick is a major tick, or <code>false</code> if it is a minor tick. + */ + boolean isMajorTick(); - /** - * Returns the value for current tick. The - * current tick may be major or minor. - */ - double currentValue(); + /** + * Returns the position where to draw the current tick. The position is scaled from the graduation's minimum to + * maximum. This is usually the same number than {@link #currentValue}. The mean exception is for logarithmic + * graduation, in which the tick position is not proportional to the tick value. + */ + double currentPosition(); - Object clone() throws CloneNotSupportedException; + /** + * Returns the value for current tick. The current tick may be major or minor. + */ + double currentValue(); - /** - * Returns the label for current tick. This method is usually invoked - * only for major ticks, but may be invoked for minor ticks as well. - * This method returns <code>null</code> if it can't produces a label - * for current tick. - * @return the label for current tick - */ - String currentLabel(); + Object clone() throws CloneNotSupportedException; - /** - * @param _v a value - * @return the label for the value _v - */ - String formatValue(double _v); - String formatSubValue(double _v); - /** - * Moves the iterator to the next minor or major tick. - */ - void next(); + /** + * Returns the label for current tick. This method is usually invoked only for major ticks, but may be invoked for + * minor ticks as well. This method returns <code>null</code> if it can't produces a label for current tick. + * + * @return the label for current tick + */ + String currentLabel(); - /** - * Moves the iterator to the next major tick. This move - * ignore any minor ticks between current position and - * the next major tick. - */ - void nextMajor(); + /** + * @param _v a value + * @return the label for the value _v + */ + String formatValue(double _v); - /** - * Reset the iterator on its first tick. - * All other properties are left unchanged. - */ - void rewind(); + String formatSubValue(double _v); + /** + * Moves the iterator to the next minor or major tick. + */ + void next(); - double getIncrement(); - void init(double _min,double _max, int _nbIteration); - void init(double _min,double _max, double pasDeTemps); - double getValueFromPosition(double _v); - double getPositionFromValue(double _v); + /** + * Moves the iterator to the next major tick. This move ignore any minor ticks between current position and the next + * major tick. + */ + void nextMajor(); + /** + * Reset the iterator on its first tick. All other properties are left unchanged. + */ + void rewind(); + + double getIncrement(); + + /** + * Initialisation au mieux + * + * @param _min le min + * @param _max le max + * @param _nbIteration le nombre d'iteration voulu + */ + void init(double _min, double _max, int _nbIteration); + + /** + * Iniatialise exactement avec ces donn\xE9es + * + * @param _min + * @param _max + * @param _nbIteration + * @param _nbSousIteration + */ + void initExact(double _min, double _max, int _nbIteration, int _nbSousIteration); + + void initExactFromDist(double _min, double _max, double _increment, int _nbSousIteration); + + double getValueFromPosition(double _v); + + double getPositionFromValue(double _v); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -18,17 +18,12 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; -import java.text.DecimalFormat; -import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; -import org.apache.tools.ant.filters.TailFilter; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; -import org.fudaa.ctulu.iterator.NumberIteratorGraduationsFixe; -import org.fudaa.ctulu.iterator.NumberIteratorPasFixe; import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliUIProperties; @@ -44,1097 +39,1015 @@ /** * Un calque d'affichage d'une grille. * - * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: - * bmarchan $ + * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: bmarchan $ * @author Guillaume Desnoix */ public class ZCalqueGrille extends ZCalqueAffichageDonnees { - // Proprietes - // private GrBoite boite_; - boolean drawGrid_; - boolean drawX_ = true; - boolean drawY_ = true; - // Envelope customBounds_; - // boolean useCustom_; + // Proprietes + // private GrBoite boite_; + boolean drawGrid_; + boolean drawX_ = true; + boolean drawY_ = true; + // Envelope customBounds_; + // boolean useCustom_; - int nbGraduationX_ = 10; - int nbGraduationY_ = 10; + int nbGraduationX_ = 10; + int nbGraduationY_ = 10; - // -- sous graduations --// - int nbSousGraduationX_ = 3; - // -- sous graduations --// - int nbSousGraduationY_ = 3; + // -- sous graduations --// + int nbSousGraduationX_ = 3; + // -- sous graduations --// + int nbSousGraduationY_ = 3; - - private TraceLigneModel traceGraduations_=new TraceLigneModel(TraceLigne.TIRETE,1,Color.black); - private TraceLigneModel traceSousGraduations_=new TraceLigneModel(TraceLigne.TIRETE,(float)0.5,Color.gray); - - final BVueCalque vue_; + private TraceLigneModel traceGraduations_ = new TraceLigneModel(TraceLigne.TIRETE, 1, Color.black); + private TraceLigneModel traceSousGraduations_ = new TraceLigneModel(TraceLigne.TIRETE, (float) 0.5, Color.gray); - /** - * Indique la facon de calculer les graduations. pour l'axe des x. - */ - boolean modeAutomatiqueX_ = false; - /** - * Indique la facon de calculer les graduations. pour l'axe des y. - */ - boolean modeAutomatiqueY_ = false; + final BVueCalque vue_; - /** - * Indique si on utilise par taille de pas ou par nombre de graduations - */ - boolean modeLongueurPasX_ = false; - boolean modeLongueurPasY_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des x. + */ + boolean modeAutomatiqueX_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des y. + */ + boolean modeAutomatiqueY_ = false; - /** - * Valeur du pas que devront suivrent tous les traits de la grilles si on en - * mode taille pas. - */ - double valeurPasX_; - double valeurPasY_; + /** + * Indique si on utilise par taille de pas ou par nombre de graduations + */ + boolean modeLongueurPasX_ = false; + boolean modeLongueurPasY_ = false; - boolean drawSousGrilleX_ = false; - boolean drawSousGrilleY_ = false; + /** + * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. + */ + double valeurPasX_; + double valeurPasY_; - boolean modeLongueurPasSousGradX_ = false; - boolean modeLongueurPasSousGradY_ = false; + boolean drawSousGrilleX_ = false; + boolean drawSousGrilleY_ = false; - double valeurPasSousGradX_; - double valeurPasSousGradY_; + // boolean modeLongueurPasSousGradX_ = false; + // boolean modeLongueurPasSousGradY_ = false; + // + // double valeurPasSousGradX_; + // double valeurPasSousGradY_; - private Color couleurSousGraduation_ = Color.blue; +// private Color couleurSousGraduation_ = Color.blue; - public ZCalqueGrille(final BVueCalque _vue) { - super(); - vue_ = _vue; - setDestructible(false); - setName("cqGrille"); - setTitle(EbliLib.getS("Grille")); - // setForeground(new Color(204, 153, 0)); - setForeground(Color.BLACK); - } + public ZCalqueGrille(final BVueCalque _vue) { + super(); + vue_ = _vue; + setDestructible(false); + setName("cqGrille"); + setTitle(EbliLib.getS("Grille")); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); + } - public void paintAllInImage(final Graphics2D _g, - final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } - public void changeZoom(double minx, double miny, double maxx, double maxy) { - vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), - new GrPoint(maxx, maxy, 0)), false); - } + public void changeZoom(double minx, double miny, double maxx, double maxy) { + vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); + } - public int getNbXGraduations() { - return nbGraduationX_; - } + public int getNbXGraduations() { + return nbGraduationX_; + } - public int getNbYGraduations() { - return nbGraduationY_; - } + public int getNbYGraduations() { + return nbGraduationY_; + } - public int getNbXSousGraduations() { - return nbSousGraduationX_; - } + public int getNbXSousGraduations() { + return nbSousGraduationX_; + } - public int getNbYSousGraduations() { - return nbSousGraduationY_; - } + public int getNbYSousGraduations() { + return nbSousGraduationY_; + } - public void setSousGraduationColor(Color c) { - if (couleurSousGraduation_ != c) { - couleurSousGraduation_ = c; - grilleChanged(); - } - } + /** + * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. + */ + // public GrBoite getBoite() { + // return boite_; + // } + public GrBoite getDomaine() { + return null; + // GrBoite r = null; + // if (isVisible()) { + // GrBoite d = null; + // d = super.getDomaine(); + // r = getBoite(); + // if (d != null) { + // if (r == null) { + // r = d; + // } else { + // r = r.union(d); + // } + // } + // } + // return r; + } - /** - * Accesseur de la propriete <I>boite</I>. Elle donne la position, la - * taille, le domaine de la grille. - */ - // public GrBoite getBoite() { - // return boite_; - // } - public GrBoite getDomaine() { - return null; - // GrBoite r = null; - // if (isVisible()) { - // GrBoite d = null; - // d = super.getDomaine(); - // r = getBoite(); - // if (d != null) { - // if (r == null) { - // r = d; - // } else { - // r = r.union(d); - // } - // } - // } - // return r; - } + public GrBoite getDomaineOnSelected() { + return getDomaine(); + } - public GrBoite getDomaineOnSelected() { - return getDomaine(); - } + public boolean isCouleurModifiable() { + return true; + } - public boolean isCouleurModifiable() { - return true; - } + public int getTiretLength() { + return 3; + } - public int getTiretLength() { - return 3; - } + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + GrBoite domaine = vue_.getAbstractCalque().getDomaine(); + final GrBoite zv = _clipReel.intersectionXY(domaine); + // GrBoite domaine = vue_.getViewBoite(); + // final GrBoite zv = domaine; - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, - final GrMorphisme _versReel, final GrBoite _clipReel) { - GrBoite domaine = vue_.getAbstractCalque().getDomaine(); - final GrBoite zv = _clipReel.intersectionXY(domaine); -// GrBoite domaine = vue_.getViewBoite(); -// final GrBoite zv = domaine; + if (zv == null) { return; } + // updateBounds(zv); + final GrBoite targetBoite = new GrBoite(); + targetBoite.ajuste(0, 0, 0); + // la boite d'affichage - if (zv == null) { - return; - } - // updateBounds(zv); - final GrBoite targetBoite = new GrBoite(); - targetBoite.ajuste(0, 0, 0); - // la boite d'affichage + if (!_versEcran.isSame(getVersEcran())) { return; } + targetBoite.ajuste(getWidth(), getHeight(), 0); + final Color old = _g.getColor(); + final Font oldFont = _g.getFont(); + // la fonte + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final TDoubleArrayList xValue = new TDoubleArrayList(20); + final TIntArrayList xStrWidth = new TIntArrayList(20); + final List xString = new ArrayList(20); - if (!_versEcran.isSame(getVersEcran())) { - return; - } - targetBoite.ajuste(getWidth(), getHeight(), 0); - final Color old = _g.getColor(); - final Font oldFont = _g.getFont(); - // la fonte - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final TDoubleArrayList xValue = new TDoubleArrayList(20); - final TIntArrayList xStrWidth = new TIntArrayList(20); - final List xString = new ArrayList(20); - - final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() - && nbGraduationX_ > 0; + final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; - if (isXPainted) { - computeXValues(zv, _g, xValue, xStrWidth, xString); - } - double yMax = 0; - final TDoubleArrayList yValue = new TDoubleArrayList(20); - final TIntArrayList yStrWidth = new TIntArrayList(20); - final List yString = new ArrayList(20); - final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() - && nbGraduationY_ > 0; - if (isYPainted) { - yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); - } + if (isXPainted) { + computeXValues(zv, _g, xValue, xStrWidth, xString); + } + double yMax = 0; + final TDoubleArrayList yValue = new TDoubleArrayList(20); + final TIntArrayList yStrWidth = new TIntArrayList(20); + final List yString = new ArrayList(20); + final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; + if (isYPainted) { + ... [truncated message content] |
From: <had...@us...> - 2009-02-16 17:11:17
|
Revision: 4476 http://fudaa.svn.sourceforge.net/fudaa/?rev=4476&view=rev Author: hadouxad Date: 2009-02-16 17:11:11 +0000 (Mon, 16 Feb 2009) Log Message: ----------- # Ajout de l'exportation ps # Ajout des tickiterator unique numberiterator pour les graphe et gestion des modes manuels . # gestion de la r?\195?\169cup?\195?\169ration des points des calque de la vue 2d pour l'assistant des ?\195?\169vol temporelles (cf visualisateur pour les profils spatiaux) Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-2.1.4.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-src-2.1.4.zip branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java Added: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-2.1.4.jar =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-2.1.4.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-src-2.1.4.zip =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-src-2.1.4.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -6,6 +6,7 @@ import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.awt.print.PageFormat; +import java.awt.print.Paper; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; @@ -109,56 +110,57 @@ } + + public static class PrintableObject implements Printable{ - BufferedImage image_; - public PrintableObject(BufferedImage img){ - image_=img; - } - public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) - throws PrinterException { - graphics.drawImage(image_,0,0,null); - return 0; - } + BufferedImage image_; + public PrintableObject(BufferedImage img){ + image_=img; + } + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) + throws PrinterException { + // graphics.drawImage(image_,0,0,image_.getWidth(),image_.getHeight(),null); + + graphics.drawImage(image_,0,0,(int)pageFormat.getWidth(),(int)pageFormat.getHeight(),null); + return 0; + } } - - /** - *Un lecteur ps - *@author Adrien Hadoux - */ - public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ - -// PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); -// -// -// PrinterJob job = PrinterJob.getPrinterJob(); -// job.setPrintable(objectToPrint); -// -// String psMimeType = "application/postscript"; -// FileOutputStream outstream; -// StreamPrintService psPrinter=null; -// StreamPrintServiceFactory []spsFactories = -// PrinterJob.lookupStreamPrintServices(psMimeType); -// if (spsFactories.length > 0) { -// try { -// outstream = new FileOutputStream(_targetFile); -// psPrinter = spsFactories[0].getPrintService(outstream); -// // psPrinter can now be set as the service on a PrinterJob -// } catch (FileNotFoundException e) { -// throw e; -// } -// } -// -// -// -// job.setPrintService(psPrinter); // if app wants to specify this printer. -// PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); -// aset.add(new Copies(1)); -// -// -// -// job.print(aset); + +/** + *Un lecteur ps + *@author Adrien Hadoux + */ +public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ + PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); + PrinterJob job = PrinterJob.getPrinterJob(); + PageFormat format=new PageFormat(); + Paper paper=new Paper(); + paper.setSize(_image.getWidth(),_image.getHeight()); + paper.setImageableArea(0,0, _image.getWidth(), _image.getHeight()); + format.setPaper(paper); + job.setPrintable(objectToPrint,format); + + String psMimeType = "application/postscript"; + FileOutputStream outstream; + StreamPrintService psPrinter=null; + StreamPrintServiceFactory []spsFactories = + PrinterJob.lookupStreamPrintServices(psMimeType); + if (spsFactories.length > 0) { + try { + outstream = new FileOutputStream(_targetFile); + psPrinter = spsFactories[0].getPrintService(outstream); + // psPrinter can now be set as the service on a PrinterJob + } catch (FileNotFoundException e) { + throw e; } + } + job.setPrintService(psPrinter); // if app wants to specify this printer. + PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); + aset.add(new Copies(1)); + job.print(aset); + } + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -167,9 +167,9 @@ if (_userObject instanceof ZCalqueMultiPoint) { icon_ = EbliResource.EBLI.getIcon("draw-multipoint"); } -// else if (_userObject instanceof ZCalquePoint) { -// icon_ = EbliResource.EBLI.getIcon("draw-add-pt"); -// } + else if (_userObject instanceof ZCalquePoint) { + icon_ = EbliResource.EBLI.getIcon("draw-add-pt"); + } else { if (((ZCalqueLigneBrisee)_userObject).getModele().isGeometryFermee(_idx)) { icon_=EbliResource.EBLI.getIcon("draw-polygon"); @@ -273,7 +273,7 @@ } void addGeometries(final LayerNode _parent, final ZCalqueAffichageDonneesAbstract _cq) { - final GISZoneCollection collec = ((ZModeleGeom)_cq.modeleDonnees()).getGeomData(); + final GISZoneCollection collec = ((ZModeleGeom)_cq.modeleDonnees()).getGeomData(); final GISAttributeModelObjectInterface nameAtt = (GISAttributeModelObjectInterface) collec.getModel(GISAttributeConstants.TITRE); final int nb = collec.getNumGeometries(); for (int i = 0; i < nb; i++) { @@ -286,10 +286,10 @@ badd=true; name="Multipoint {0}"; } -// else if (chooser_.isPt() && (finder_.getMask()&GISLib.MASK_POINT)!=0) { -// badd=true; -// name="Point {0}"; -// } + else if (chooser_.isPt() && (finder_.getMask()&GISLib.MASK_POINT)!=0) { + badd=true; + name="Point {0}"; + } else if (chooser_.isPolyligne() && (finder_.getMask()&GISLib.MASK_POLYLINE)!=0) { badd=true; name="Ligne ouverte {0}"; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -55,9 +55,11 @@ if (_cq instanceof ZCalqueMultiPoint && (mask_&GISLib.MASK_MULTIPOINT)!=0) { return ((ZCalqueMultiPoint)_cq).modeleDonnees().getNombre() > 0; } -// else if (_cq instanceof ZCalquePoint && (mask_&GISLib.MASK_POINT)!=0) { -// return ((ZCalquePoint) _cq).modeleDonnees().getNombre() > 0; -// } + //-- rajout du test si le modele implements ZModeleGeom car c'est automatiquement cast\xE9 dans addGeometry sans v\xE9rification pr\xE9alable --// + //-- or c'est pas bon pour le calque des Noeuds ...--// + else if (_cq instanceof ZCalquePoint && (mask_&GISLib.MASK_POINT)!=0 && ((ZCalquePoint) _cq).modeleDonnees() instanceof ZModeleGeom) { + return ((ZCalquePoint) _cq).modeleDonnees().getNombre() > 0; + } else if (_cq instanceof ZCalqueLigneBrisee && (mask_&GISLib.MASK_POLYLINE)!=0) { boolean bok=((ZCalqueLigneBrisee) _cq).modeleDonnees().getNombre() > 0; return bok && ((ZCalqueLigneBrisee)_cq).getModele().getNbLigneBrisee()!=0; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -405,6 +405,14 @@ } return -1; } + + public GrPoint getPoint( int i){ + if(i>= modeleDonnees().getNombre()) + return null; + GrPoint p=new GrPoint(); + modele().point(p, i, true); + return p; + } protected CtuluListSelection selectionBasic(final GrPoint _pt, final int _tolerance) { if (modele().getNombre() == 0 || (!isVisible())) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -17,13 +17,13 @@ import org.fudaa.ctulu.gui.CtuluValueEditorI; import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; import org.fudaa.ctulu.iterator.NumberIterator; -import org.fudaa.ctulu.iterator.NumberIteratorGraduationsFixe; -import org.fudaa.ctulu.iterator.NumberIteratorPasFixe; + import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.controle.BSelecteurCheckBox; import org.fudaa.ebli.controle.BSelecteurColorChooser; import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; import org.fudaa.ebli.controle.BSelecteurTextField; +import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; @@ -79,10 +79,10 @@ Color lineColor_; - public static int MANUEL_GRADUATIONS=999; - public static int MANUEL_LONGUEURPAS=888; - public static int AUTO_GRADUATIONS=0; - public static int AUTO_LONGUEURPAS=1; + public static int MANUEL_GRADUATIONS=0; + public static int MANUEL_LONGUEURPAS=1; + public static int AUTO_GRADUATIONS=2; + public static int AUTO_LONGUEURPAS=3; /** @@ -192,27 +192,33 @@ return null; } + /** + * nombre de sous graduations + */ + int nbSousGraduations_=3; + final TickIterator buildUpToDateMainTickIterator() { - // if (axisIterator_ == null) { - - /*if(modeGraduations_==MANUEL_GRADUATIONS ){ - axisIterator_ = new NumberIteratorGraduationsFixe(); - axisIterator_.init(getMinimum(), getMaximum(), nbPas_); - } - else - if(modeGraduations_==MANUEL_LONGUEURPAS){ - axisIterator_ = new NumberIteratorPasFixe(); - axisIterator_.init(getMinimum(), getMaximum(), longueurPas_); - } - else if(modeGraduations_==AUTO_GRADUATIONS){ - + + axisIterator_ = new NumberIterator(); + ((NumberIterator)axisIterator_).setMaxFractionDigits(2); - }else*/ if(modeGraduations_==AUTO_LONGUEURPAS){ - axisIterator_ = new NumberIterator(); + + double min=getMinimum(); + double max=getMaximum(); + int mode=modeGraduations_; + + if(modeGraduations_==MANUEL_GRADUATIONS ){ + axisIterator_.initExact(getMinimum(),getMaximum(), nbPas_, nbSousGraduations_+1); + }else + if(modeGraduations_==MANUEL_LONGUEURPAS ){ + axisIterator_.initExactFromDist(getMinimum(),getMaximum(), longueurPas_, nbSousGraduations_+1); + }else + if(modeGraduations_==AUTO_LONGUEURPAS){ + axisIterator_.init(getMinimum(), getMaximum(), (int)( (getMaximum()-getMinimum())/longueurPas_)); } else{ - axisIterator_ = new NumberIterator(); + axisIterator_.init(getMinimum(), getMaximum(), nbPas_); } if (FuLog.isDebug() && Fu.DEBUG) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -11,6 +11,7 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; +import java.util.ArrayList; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluNumberFormatDefault; @@ -84,10 +85,16 @@ final boolean grille = isGrille(); int idx = 0; TickIterator iterator = buildUpToDateMainTickIterator(); + ArrayList<Double> vals=new ArrayList<Double>(); + for (final TickIterator it = iterator; it.hasNext() && idx < 300; it.next()) { idx++; _g.setColor(lightfg); - final int xe = _f.getXEcran(it.currentValue()); + double val=it.currentValue(); + final int xe = _f.getXEcran(val); + + vals.add(new Double(val)); + if (graduations_) { if (it.isMajorTick()) { if (specificFormat_ == null) { @@ -129,6 +136,9 @@ grille_.dessineTrait(_g, xe, y, xe, _f.getMinEcranY()); } } + + vals.trimToSize(); + /* * t = getStringAffiche(maximum); int xe = _f.getXEcran(maximum); double * xLeft = xe - fm.stringWidth(t) / 2; if (xLeft > (lastMaxX + 2)) { @@ -370,6 +380,17 @@ .getFont().getSize())); duplic.setTitre(this.getTitre()); + duplic.graduations_=graduations_; + duplic.longueurPas_=longueurPas_; + duplic.modeGraduations_=modeGraduations_; + duplic.nbPas_=nbPas_; + duplic.nbSousGraduations_=nbSousGraduations_; + //duplic.range_=new CtuluRange(range_); + duplic.traceGraduations_=new TraceLigneModel(traceGraduations_); + duplic.traceSousGraduations_=new TraceLigneModel(traceSousGraduations_); + duplic.traceGrille_=traceGrille_; + duplic.traceSousGrille_=traceSousGrille_; + duplic.nbSousGraduations_=nbSousGraduations_; return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -48,7 +48,7 @@ * le mode de graduation */ int modeGraduations_; - + int nbSousGraduations_; public EGAxeHorizontalPersist(EGAxeHorizontal axeX) { // TODO Auto-generated constructor stub fillInfoWith(axeX); @@ -73,7 +73,7 @@ nbPas_=axeX.nbPas_; longueurPas_=axeX.longueurPas_; modeGraduations_=axeX.modeGraduations_; - + nbSousGraduations_=axeX.nbSousGraduations_; } public EGAxeHorizontal generateAxe(){ @@ -96,6 +96,7 @@ axeX.nbPas_=nbPas_; axeX.longueurPas_=longueurPas_; axeX.modeGraduations_=modeGraduations_; + axeX.nbSousGraduations_=nbSousGraduations_; return axeX; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -81,12 +81,13 @@ private BuTextField tfHorPas_; + private BuTextField tfHorSousPas_; + - private JComponent tfVertMax_; private JComponent tfVertMin_; private BuTextField tfVertPas_; - + private BuTextField tfVertSousPas_; EGObject[] targets_; public EGAxeRepereConfigurator(final EGGraphe _m) { @@ -171,12 +172,20 @@ tfVertMax_.setToolTipText(tooltipTxt); tfVertMin_.setToolTipText(tooltipTxt); if (tfVertPas_ == null) { - tfVertPas_ = BuTextField.createIntegerField(); + tfVertPas_ = BuTextField.createDoubleField(); tfVertPas_.setToolTipText(tooltipPas); tfVertPas_.setValueValidator(tfHorPas_.getValueValidator()); tfVertPas_.setColumns(10); tfVertPas_.addKeyListener(this); } + + if (tfVertSousPas_ == null) { + tfVertSousPas_ = BuTextField.createIntegerField(); + tfVertSousPas_.setToolTipText(tooltipPas); + tfVertSousPas_.setValueValidator(BuValueValidator.INTEGER); + tfVertSousPas_.setColumns(10); + tfVertSousPas_.addKeyListener(this); + } // vertical min BuLabel lb = new BuLabel(minTxt); lb.setToolTipText(EbliLib.getS("Borne inf\xE9rieure des axes verticaux")); @@ -194,31 +203,42 @@ //-- selection du type de graduations - final BuComboBox combo = new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"),*/ EbliLib.getS(/*"Automatique:*/" Nb graduations"), - EbliLib.getS(/*"Automatique:*/" Longueur des pas") }); + comboVertical_ = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"), + EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"), + EbliLib.getS("Automatique: Longueur des pas") }); - pnAxeV_.add(combo); + pnAxeV_.add(comboVertical_); pnAxeV_.add(tfVertPas_); + + pnAxeV_.add(new JLabel(EbliResource.EBLI.getString("Sous graduations:"))); + pnAxeV_.add(tfVertSousPas_); //-- listener de la combo --// - combo.addActionListener(new ActionListener() { + comboVertical_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - modeGraduationY_=combo.getSelectedIndex(); - graphe_.axeUpdated(); + modeGraduationY_=comboVertical_.getSelectedIndex(); + if(modeGraduationY_==EGAxe.AUTO_GRADUATIONS|| modeGraduationY_==EGAxe.AUTO_LONGUEURPAS) + tfVertSousPas_.setEnabled(false); + else + tfVertSousPas_.setEnabled(true); + EGAxe axeChoisi=null; if(graphe_.getSelectedComponent()!=null) axeChoisi=graphe_.getSelectedComponent().getAxeY(); if(axeChoisi==null && axes_!=null && axes_.length>0) axeChoisi=axes_[0]; - if(axeChoisi!=null) - if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + if(axeChoisi!=null){ + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS || axeChoisi.modeGraduations_==EGAxe.MANUEL_GRADUATIONS) tfVertPas_.setText(""+axeChoisi.nbPas_); else - if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS || axeChoisi.modeGraduations_==EGAxe.MANUEL_LONGUEURPAS) tfVertPas_.setText(""+axeChoisi.longueurPas_); + axeChoisi.modeGraduations_=modeGraduationY_; + + } + graphe_.axeUpdated(); } }); @@ -231,10 +251,10 @@ axeChoisi=axes_[0]; if(axeChoisi!=null) - if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS || axeChoisi.modeGraduations_==EGAxe.MANUEL_GRADUATIONS) tfVertPas_.setText(""+axeChoisi.nbPas_); else - if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS || axeChoisi.modeGraduations_==EGAxe.MANUEL_LONGUEURPAS) tfVertPas_.setText(""+axeChoisi.longueurPas_); @@ -364,15 +384,22 @@ tfHorPas_.setToolTipText(tooltipPas); tfHorPas_.addKeyListener(this); - if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS || modeGraduationX_==EGAxe.MANUEL_GRADUATIONS) tfHorPas_.setText(""+axeH_.nbPas_); else - if(axeH_.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + if(axeH_.modeGraduations_==EGAxe.AUTO_LONGUEURPAS || modeGraduationX_==EGAxe.MANUEL_LONGUEURPAS) tfHorPas_.setText(""+axeH_.longueurPas_); } - + if (tfHorSousPas_ == null) { + tfHorSousPas_ = BuTextField.createIntegerField(); + tfHorSousPas_.setValueValidator(BuValueValidator.INTEGER); + tfHorSousPas_.setColumns(10); + tfHorSousPas_.setToolTipText(tooltipPas); + tfHorSousPas_.addKeyListener(this); + + } tfHorMax_.addKeyListener(this); tfHorMin_.addKeyListener(this); @@ -391,9 +418,9 @@ //-- selection du type de graduations if(comboHorizontal_==null){ - comboHorizontal_= new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"),*/ EbliLib.getS(/*"Automatique:*/" Nb graduations"), - EbliLib.getS(/*"Automatique:*/" Longueur des pas") }); + comboHorizontal_= new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"), + EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"), + EbliLib.getS("Automatique: Longueur des pas") }); lb = new BuLabel(typePasTxt); //pnAxeH_.add(lb); //-- listener de la combo --// @@ -401,11 +428,18 @@ public void actionPerformed(ActionEvent e) { modeGraduationX_=comboHorizontal_.getSelectedIndex(); - if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS) + if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS ||modeGraduationX_==EGAxe.AUTO_LONGUEURPAS) + tfHorSousPas_.setEnabled(false); + else + tfHorSousPas_.setEnabled(true); + + if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS || modeGraduationX_==EGAxe.MANUEL_GRADUATIONS) tfHorPas_.setText(""+axeH_.nbPas_); else - if(modeGraduationX_==EGAxe.AUTO_LONGUEURPAS) + if(modeGraduationX_==EGAxe.AUTO_LONGUEURPAS || modeGraduationX_==EGAxe.MANUEL_LONGUEURPAS) tfHorPas_.setText(""+axeH_.longueurPas_); + int mode=modeGraduationX_; + axeH_.modeGraduations_=modeGraduationX_; graphe_.axeUpdated(); } @@ -419,7 +453,7 @@ boxAfficheGraduationsX_.setSelected(axeH_.traceGrille_); boxAfficheGraduationsX_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { - + modeGraduationX_=comboHorizontal_.getSelectedIndex(); apply(); } }); @@ -432,6 +466,11 @@ }); // pnAxeH_.add(choixType); pnAxeH_.add(tfHorPas_); + + + pnAxeH_.add(new JLabel(EbliResource.EBLI.getString("Sous graduations:"))); + pnAxeH_.add(tfHorSousPas_); + //-- graduations --// modelGraduationsX_ = new BSelecteurLineModel(GRILLE_AXE_X,axeH_.traceGraduations_); @@ -470,16 +509,23 @@ private boolean applyHorizontal() { final String pas = tfHorPas_.getText().trim(); + final String Souspas = tfHorSousPas_.getText().trim(); + final boolean maxEdited = editorH_.isValueValidFromComponent(tfHorMax_); final boolean minEdited = editorH_.isValueValidFromComponent(tfHorMin_); - final boolean pasEdited = pas.length() > 0; + boolean pasEdited = pas.length() > 0; + if(!pasEdited) + pasEdited=Souspas.length()>0; + final double maxVal = maxEdited ? Double.parseDouble(editorH_.getStringValue(tfHorMax_)) : axeH_.getMaximum(); final double minVal = minEdited ? Double.parseDouble(editorH_.getStringValue(tfHorMin_)) : axeH_.getMinimum(); final double pasVal = pasEdited ? Double.parseDouble(pas) : 0; + final int souspasVal = (Souspas.length()>0) ? Integer.parseInt(Souspas) : 0; + boolean r = false; + if(comboHorizontal_.getSelectedIndex()!=-1) + axeH_.modeGraduations_=comboHorizontal_.getSelectedIndex(); - - if (maxEdited || minEdited || pasEdited) { if (pasEdited) { if(modeGraduationX_==EGAxe.MANUEL_GRADUATIONS || modeGraduationX_==EGAxe.AUTO_GRADUATIONS) @@ -491,6 +537,12 @@ r = axeH_.setBounds(minVal, maxVal,-1,modeGraduationX_); } + if(Souspas.length()>0){ + if(souspasVal!=axeH_.nbSousGraduations_) + r=true; + axeH_.nbSousGraduations_=souspasVal; + + } } TraceLigneModel model=modelGraduationsX_.getNewData(); @@ -551,12 +603,24 @@ } } final String pas = tfVertPas_.getText().trim(); + final String Souspas = tfVertSousPas_.getText().trim(); + + boolean pasModif = pas.length() > 0; - final boolean pasModif = pas.length() > 0; - + if(!pasModif) + pasModif=Souspas.length()>0; + if (maxEdited || minEdited || pasModif) { final double pasVal = pasModif ? Double.parseDouble(pas) : 0; for (int i = 0; i < axes_.length; i++) { + + if(comboVertical_.getSelectedIndex()!=-1) + axes_[i].modeGraduations_=comboVertical_.getSelectedIndex(); + + final int pasSousVal = (Souspas.length()>0) ? Integer.parseInt(Souspas) : 0; + + + double min = minVal; double max = maxVal; if (!minEdited) { @@ -595,7 +659,12 @@ r=true; } + if((Souspas.length()>0)){ + if(axes_[i].nbSousGraduations_!=pasSousVal) + r=true; + axes_[i].nbSousGraduations_=pasSousVal; + } } } @@ -697,7 +766,13 @@ void updateAxeHorValue() { editorH_.setValue(CtuluLib.getDouble(axeH_.getMaximum()), tfHorMax_); editorH_.setValue(CtuluLib.getDouble(axeH_.getMinimum()), tfHorMin_); - tfHorPas_.setText(CtuluLibString.getString(axeH_.getNbPas())); + if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS|| axeH_.modeGraduations_==EGAxe.MANUEL_GRADUATIONS) + tfHorPas_.setText(CtuluLibString.getString(axeH_.getNbPas())); + else + tfHorPas_.setText(""+axeH_.longueurPas_); + + tfHorSousPas_.setText(""+axeH_.nbSousGraduations_); + cbBlockHView_.setSelected(false); cbUnblockBlockHView_.setSelected(false); cbUnblockBlockHView_.setEnabled(graphe_.isUserXRangeSet()); @@ -709,13 +784,17 @@ String min = CtuluLibString.EMPTY_STRING; String max = min; String pas = min; + String longueurPas=""; if (axes_ != null && axes_.length > 0) { boolean minIsCommon = true; boolean maxIsCommon = true; boolean pasIsCommon = true; + + final double commonMin = axes_[0].getMinimum(); final double commonMax = axes_[0].getMaximum(); final int commonPas = axes_[0].getNbPas(); + final double commonLongueurPas=axes_[0].longueurPas_; for (int i = 1; i < axes_.length && (minIsCommon || maxIsCommon || pasIsCommon); i++) { if (axes_[i].getMinimum() != commonMin) { minIsCommon = false; @@ -726,6 +805,9 @@ if (axes_[i].getNbPas() != commonPas) { pasIsCommon = false; } + if (axes_[i].getNbPas() != commonPas) { + pasIsCommon = false; + } } if (minIsCommon) { min = Double.toString(commonMin); @@ -734,14 +816,23 @@ max = Double.toString(commonMax); } if (pasIsCommon) { + longueurPas=""+commonLongueurPas; pas = CtuluLibString.getString(commonPas); } + if(axes_[0].modeGraduations_==EGAxe.AUTO_GRADUATIONS|| axes_[0].modeGraduations_==EGAxe.MANUEL_GRADUATIONS) + tfVertPas_.setText(pas); + else + tfVertPas_.setText(longueurPas); + tfVertSousPas_.setText(""+axes_[0].nbSousGraduations_); } if (editorV_ != null) { editorV_.setValue(max, tfVertMax_); editorV_.setValue(min, tfVertMin_); } - tfVertPas_.setText(pas); + + + + updateAxeHorValue(); cbUseSameAxe_.setEnabled(axes_ != null && axes_.length > 1); cbUseSameAxe_.setSelected(false); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -17,6 +17,7 @@ import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; import com.memoire.fu.Fu; import com.memoire.fu.FuLog; @@ -378,6 +379,18 @@ duplic.setFont(new Font(this.getFont().getFamily(),this.getFont().getStyle(),this.getFont().getSize())); duplic.setTitre(this.getTitre()); + + duplic.graduations_=graduations_; + duplic.longueurPas_=longueurPas_; + duplic.modeGraduations_=modeGraduations_; + duplic.nbPas_=nbPas_; + duplic.nbSousGraduations_=nbSousGraduations_; + //duplic.range_=new CtuluRange(range_); + duplic.traceGraduations_=new TraceLigneModel(traceGraduations_); + duplic.traceSousGraduations_=new TraceLigneModel(traceSousGraduations_); + duplic.traceGrille_=traceGrille_; + duplic.traceSousGrille_=traceSousGrille_; + duplic.nbSousGraduations_=nbSousGraduations_; return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -52,6 +52,8 @@ */ int modeGraduations_; + int nbSousGraduations_; + public EGAxeVerticalPersist(EGAxeVertical axeY) { // TODO Auto-generated constructor stub fillInfoWith(axeY); @@ -79,6 +81,7 @@ nbPas_=axeY.nbPas_; longueurPas_=axeY.longueurPas_; modeGraduations_=axeY.modeGraduations_; + nbSousGraduations_=axeY.nbSousGraduations_; } @@ -106,7 +109,7 @@ axeY.nbPas_=nbPas_; axeY.longueurPas_=longueurPas_; axeY.modeGraduations_=modeGraduations_; - + axeY.nbSousGraduations_=nbSousGraduations_; return axeY; } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -0,0 +1,257 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.swing.JTree; +import javax.swing.tree.TreePath; + +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISPrecision; +import org.fudaa.ctulu.gis.GISZoneCollectionPoint; +import org.fudaa.ebli.calque.BGroupeCalque; +import org.fudaa.ebli.calque.CalqueGISTreeModel; +import org.fudaa.ebli.calque.ZCalqueMultiPoint; +import org.fudaa.ebli.calque.ZCalquePoint; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.CalqueGISTreeModel.LayerNode; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.fudaa.tr.TrPostImplementation; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCourbeTemporelle.ModelListePoints; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; + + + +/** + * Construit un composant arbre g\xE9n\xE9rique qui permet de r\xE9cup\xE9rer les points des calques d'une vue 2d. + * Utiliser surtout pour l'assistant de cr\xE9ation d'\xE9volutions temporelles. + * @author Adrien Hadoux + * + */ +public abstract class TrEvolutionBuilderFromTree { + + + + public static class PostEvolutionTemporelles extends TrEvolutionBuilderFromTree{ + /** + * le modele du tableau a mettre a jour + */ + ModelListePoints modeletableau_; + /** + * la liste des points. Peut etre des points reels mais aussi interpol\xE9s + */ + @SuppressWarnings("unchecked") + List listePoints_; + + + public PostEvolutionTemporelles(TrPostVisuPanel panel, ModelListePoints modeletableau, List liste){ + super(panel); + modeletableau_= modeletableau; + listePoints_=liste; + + } + + protected void apply(){ + + //-- mise a jour des donn\xE9es du tableau--// + modeletableau_.fireTableDataChanged(); + } + + public boolean ajouterSelection(ZCalqueMultiPoint cq){ + boolean modifierStructure=false; + + TrPostInterpolatePoint newPoint=null; + if(cq==null || cq.modeleDonnees()==null) + return false; + + int nb=cq.modeleDonnees().getNombre(); + + for(int i=0;i<nb;i++){ + GrPoint point=(GrPoint) cq.modeleDonnees().getObject(i); + if(point!=null){ + final int idxElt = TrIsoLayerDefault.sondeSelection(point, panel_.getIsoLayer().getIsoModel()); + if (idxElt > -1){ + newPoint= new TrPostInterpolatePoint(idxElt, point.x_, point.y_, new GISPrecision()); + modifierStructure=true; + listePoints_.add(newPoint); + } + } + } + return modifierStructure; + + } + + + public boolean ajouterSelection(ZCalquePoint cq){ + boolean modifierStructure=false; + TrPostInterpolatePoint newPoint=null; + if(cq==null || cq.modeleDonnees()==null) + return false; + + int nb=cq.modeleDonnees().getNombre(); + + for(int i=0;i<nb;i++){ + GrPoint point=cq.getPoint(i); + if(point!=null){ + final int idxElt = TrIsoLayerDefault.sondeSelection(point, panel_.getIsoLayer().getIsoModel()); + if (idxElt > -1){ + newPoint= new TrPostInterpolatePoint(idxElt, point.x_, point.y_, new GISPrecision()); + modifierStructure=true; + if(canAdd(newPoint)) + listePoints_.add(newPoint); + } + } + } + return modifierStructure; + } + + public boolean ajouterSelection(ZCalquePoint cq,int i){ + boolean modifierStructure=false; + TrPostInterpolatePoint newPoint=null; + if(cq==null || cq.modeleDonnees()==null) + return false; + GrPoint point=cq.getPoint(i); + if(point!=null){ + final int idxElt = TrIsoLayerDefault.sondeSelection(point, panel_.getIsoLayer().getIsoModel()); + if (idxElt > -1){ + newPoint= new TrPostInterpolatePoint(idxElt, point.x_, point.y_, new GISPrecision()); + modifierStructure=true; + if(canAdd(newPoint)) + listePoints_.add(newPoint); + } + } + + return modifierStructure; + } + + + private boolean canAdd(TrPostInterpolatePoint pt){ + for(Object ob:listePoints_){ + if(ob instanceof TrPostInterpolatePoint){ + TrPostInterpolatePoint tr=(TrPostInterpolatePoint) ob; + if(tr.equals(pt)) + return false; + } + } + return true; + + } + } + + /** + * Liste des points selectionn\xE9s. + */ + protected GISZoneCollectionPoint pointsSelectionnees_; + + final TrPostVisuPanel panel_; + + protected TrPostImplementation impl_; + + /** + * l'arbre des donn\xE9es representant le calque + */ + public JTree tree_; + + + /** + * le linetreemodel aui filtre uniquement les type d'objets g\xE9om\xE9triaues recherch\xE9s. + */ + final CalqueGISTreeModel lineTreeModel_; + + public TrEvolutionBuilderFromTree(TrPostVisuPanel panel) { + this(panel,null); + } + + public TrEvolutionBuilderFromTree(TrPostVisuPanel panel, TrPostImplementation impl) { + + this.panel_ = panel; + this.impl_ = impl; + pointsSelectionnees_=null; + lineTreeModel_ = new CalqueGISTreeModel(null, panel.getDonneesCalque()); + lineTreeModel_.setMask(GISLib.MASK_POINT); + } + + public GISZoneCollectionPoint getSelection(){ + + if(tree_==null) + return null; + + return null; + } + + public JTree buildTree() { + if(tree_==null){ + tree_=lineTreeModel_.createView(false,false); + //-- gestion double click pour r\xE9cup\xE9rer l'information + tree_.addMouseListener(new MouseAdapter(){ + + + public void mouseClicked(MouseEvent e) { + if(e.getClickCount()<2) + return; + final TreePath clickedElement = tree_.getPathForLocation(e.getX(), e.getY()); + LayerNode treeNode = null; + if (clickedElement != null && clickedElement.getLastPathComponent() instanceof LayerNode) + treeNode=(LayerNode) clickedElement.getLastPathComponent(); + + if(treeNode==null)return; + boolean apply=false; + if(treeNode.getUserObject() instanceof ZCalquePoint && treeNode.isLeaf()) + + apply=ajouterSelection((ZCalquePoint) treeNode.getUserObject(),treeNode.getIdxGeom()); + else + if(treeNode.getUserObject() instanceof ZCalquePoint ) + apply=ajouterSelection((ZCalquePoint) treeNode.getUserObject()); + else + if(treeNode.getUserObject() instanceof ZCalqueMultiPoint) + apply= ajouterSelection((ZCalqueMultiPoint) treeNode.getUserObject()); + else if( treeNode.getUserObject() instanceof BGroupeCalque){ + + if(treeNode.getChildCount()>0 && treeNode.getChildAt(0) instanceof LayerNode){ + + LayerNode treeNodeFils =(LayerNode) treeNode.getChildAt(0); + if(treeNodeFils.getChildCount()>0 && treeNodeFils.getChildAt(0)instanceof LayerNode && !treeNodeFils.isLeaf()) + treeNodeFils=(LayerNode) treeNodeFils.getChildAt(0); + if(treeNodeFils.getUserObject() instanceof ZCalquePoint){ + //-- on recupere le calque global et on l'ajoute direct --// + ZCalquePoint zcq=(ZCalquePoint) treeNodeFils.getUserObject() ; + if(zcq!=null) + apply=ajouterSelection(zcq); + } + + } + + + + } + //-- on fait appel a pply qui met a jour les composants voulues --// + if(apply) + apply(); + } + }); + } + return tree_; + } + + /** + * est appel\xE9e lors du double clic sur le tree. + * @param objectSelection + * @return + */ + public abstract boolean ajouterSelection(ZCalqueMultiPoint cq); + + + + public abstract boolean ajouterSelection(ZCalquePoint cq); + + public abstract boolean ajouterSelection(ZCalquePoint cq,int indice); + + /** + * applique les modifications (listener a appeler ou autre)... + */ + protected abstract void apply(); + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -27,6 +27,7 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JSplitPane; import javax.swing.JTextField; import javax.swing.table.AbstractTableModel; @@ -58,6 +59,7 @@ import org.fudaa.fudaa.sig.layer.FSigLayerGroup; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrEvolutionBuilderFromTree; import org.fudaa.fudaa.tr.post.TrIsoLayerDefault; import org.fudaa.fudaa.tr.post.TrPostCourbeBuilder; import org.fudaa.fudaa.tr.post.TrPostCourbeTreeModel; @@ -72,6 +74,7 @@ import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuPanel; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; @@ -151,6 +154,17 @@ return true; } + + public void fireTableStructureChanged() { + + super.fireTableStructureChanged(); + + if(indicateurPoints_!=null) + indicateurPoints_.setText("Nb points: " + listePoints_.size()); + } + + + // @Override // public void setValueAt(final Object _value, final int _rowIndex, final int _columnIndex) { // if (_columnIndex == 0 || _columnIndex == 3) return; @@ -307,6 +321,9 @@ BuTextField nomCalque_=new BuTextField(10); + TrEvolutionBuilderFromTree builderPointsCalque_; + + /** * Construit le panel qui s occupe de la gestion des points * @@ -314,6 +331,9 @@ */ public JComponent constructSlectionPoint() { // -- le table des points selectionnes --// + final JSplitPane splitpanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + + final JPanel content = new JPanel(new BorderLayout()); final ModelListePoints model = new ModelListePoints(); final JXTable tableau = new JXTable(model) { @@ -380,7 +400,7 @@ } model.fireTableDataChanged(); indicateurPoints_.setText("Nb points: " + listePoints_.size()); - if (listePoints_.size() == 0) pointsSaisis = false; + // if (listePoints_.size() == 0) pointsSaisis = false; } } }); @@ -389,7 +409,25 @@ indicateurPoints_.setText("Nb points: " + listePoints_.size()); control.add(indicateurPoints_); content.add(control, BorderLayout.SOUTH); - return content; + + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Points s\xE9lectionn\xE9s"))); + + //-- ajout du panel de selection des zcqlauePoints de la vue 2d --// + + + builderPointsCalque_=new TrEvolutionBuilderFromTree.PostEvolutionTemporelles(this.calque_,model,listePoints_); + + splitpanel.setTopComponent(content); + + BuPanel conteneurArbre=new BuPanel(new BorderLayout()); + conteneurArbre.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Points de la vue 2d"))); + conteneurArbre.add(new BuScrollPane(builderPointsCalque_.buildTree())); + + conteneurArbre.add(new JLabel(TrResource.getS("<html><body>Pour ajouter les points, double cliquez dessus. Pour ajouter directement tous les points d'un calque,<br /> double-cliquez sur le calque lui m\xEAme</body></html>")),BorderLayout.NORTH); + + splitpanel.setBottomComponent(conteneurArbre); + splitpanel.setDividerLocation(150); + return splitpanel; } /** @@ -691,8 +729,7 @@ public JComponent getStepComponent() { switch (current_) { case 0: { - if (listePoints_.size() != 0) pointsSaisis = true; - else pointsSaisis = false; + if (panelSelectionPoints == null) panelSelectionPoints = constructSlectionPoint(); return panelSelectionPoints; } @@ -716,8 +753,12 @@ return 3; } - private boolean pointsSaisis = false; + private boolean pointsSaisis(){ + return listePoints_.size()>0; + } + + /** * MEthode utilisee pour disabler ou non les boutons suivants */ @@ -725,7 +766,7 @@ public int getStepDisabledButtons() { int r = super.getStepDisabledButtons(); if (current_ == 1) { - if (!pointsSaisis) r |= BuButtonPanel.SUIVANT; + if (!pointsSaisis()) r |= BuButtonPanel.SUIVANT; } else if (current_ == 2) { if ((listeGraphesChoisis_ == null || listeGraphesChoisis_.size() == 0) && !checkboxNewGraphe_.isSelected()) r |= BuButtonPanel.TERMINER; // -- pour empecher d avancer, voir ci dessous @@ -888,7 +929,7 @@ } indicateurPoints_.setText("Nb points: " + listePoints_.size()); - if (listePoints_.size() > 0) pointsSaisis = true; + // if (listePoints_.size() > 0) pointsSaisis = true; dialog.dispose(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-17 18:40:24
|
Revision: 4480 http://fudaa.svn.sourceforge.net/fudaa/?rev=4480&view=rev Author: hadouxad Date: 2009-02-17 18:40:20 +0000 (Tue, 17 Feb 2009) Log Message: ----------- # Gestion des marqueurs multiples: affichage, alignement,valeur trac?\195?\169, persistance des marqueurs # Modification des donn?\195?\169es courbes pour les formats scop # Modification de l'action d'?\195?\169dition des paramteres des graphes: le panel est plus complet et permet en une seule interface de modifier l'ensemble des courbes (et non plus devoir cliquer sur la courbe au pr?\195?\169alable...) Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeMarqueur.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/FudaaHelpPDFViewer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDocPdfFille.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -322,7 +322,17 @@ } return r.toString(); } - + + public static String arrayToString(final boolean[] _o, final String _sep) { + if (_o == null) { return getNullString(); } + if (_o.length == 0) { return getEmptyTableau(); } + final StringBuffer r = new StringBuffer(); + r.append(_o[0]); + for (int i = 1; i < _o.length; i++) { + r.append(_sep).append(_o[i]); + } + return r.toString(); + } /** * @param _o le tableau d'entier a voir * @return une chaine contenant tous les entiers separees par des virgules @@ -654,6 +664,27 @@ return res.toNativeArray(); } + + public static boolean[] parseStringBoolean(final String _s, final String _sepChar) { + if ((_s == null) || (_sepChar == null)) { return null; } + final List l = (parseStringList(_s, _sepChar)); + final List<Boolean> res = new ArrayList<Boolean>(); + for (int i = 0; i < l.size(); i++) { + try { + res.add(Boolean.parseBoolean((String) l.get(i))); + } catch (final NumberFormatException _evt) { + FuLog.error(_evt); + + } + } + boolean[] tab=new boolean[res.size()]; + int cpt=0; + for(Boolean bool:res) + tab[cpt++]=bool.booleanValue(); + + return tab; + } + /** * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie * [1,3,4]; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -79,6 +79,10 @@ public void paletteDeactivated() {} public boolean setPalettePanelTarget(final Object _target) { + return setPalettePanelTarget(_target, -1); + } + + public boolean setPalettePanelTarget(final Object _target,int indiceSelecteurToShow) { BSelecteurTargetInterface vis = null; boolean enable = false; BConfigurableInterface conf = null; @@ -90,10 +94,19 @@ vis = target.getVisibleTitleTarget(); enable = target.isTitleModifiable(); conf = cs[0]; + + //-- ajout de la palette en cours dans le cas des objets reload: permet l'ajout en cours de route de bselecteurInterface --// + if(target instanceof BConfigurePaletteTargetInterfaceReload){ + ((BConfigurePaletteTargetInterfaceReload)target).setPalette(this); + } + } } setTitleVisibleTarget(vis, enable); - setTargetConf(conf); + if(indiceSelecteurToShow!=-1) + setTargetConf(conf,indiceSelecteurToShow); + else + setTargetConf(conf); return res; } @@ -105,7 +118,11 @@ txtTitle_.tf_.setEnabled(_txtEnable); } - public boolean setTargetConf(final BConfigurableInterface _target) { + public boolean setTargetConf(final BConfigurableInterface _target){ + return setTargetConf(_target, -1); + } + + public boolean setTargetConf(final BConfigurableInterface _target,int tabIndiceToAffiche) { // on supprime l'ancienne configuration if (builder_ != null) { if (builder_.pn_ != null) { @@ -116,7 +133,7 @@ } } builder_ = new BConfigureSectionBuilder(_target); - builder_.buildTab(); + builder_.buildTab(tabIndiceToAffiche); builder_.updateTarget(); if (!builder_.isEmpty()) { add(builder_.pn_, BuBorderLayout.CENTER); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -0,0 +1,24 @@ +package org.fudaa.ebli.controle; + +import java.util.Map; + +/** + * BConfigurePaletteTargetInterface custom qui permet de rejouer les donn\xE9es de sa palette en fonction des modifications. + * Utile dans le cas d'ajout de BSelecteurInterface en cours de route. + * @author Adrien Hadoux + * + */ +public interface BConfigurePaletteTargetInterfaceReload extends BConfigurePaletteTargetInterface{ + + public BConfigurePalette getPalette(); + public void setPalette(BConfigurePalette pal); + + /** + * Recharger la palette en cas de necessit\xE9. + * @param infos map qui peut contenir des infos sur le BSelecteurInterface a initialiser... + * @return + */ + public boolean reloadPalette(Map infos); + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -379,7 +379,19 @@ } } + + protected void buildTab(int i) { + buildTab(); + if(i>=0) + selectTab(i); + } + public void selectTab(int i){ + if(pn_==null || !(pn_ instanceof BuTabbedPane)) + return; + ((BuTabbedPane)pn_).setSelectedIndex(i); + } + protected void updateTarget() { if (!CtuluLibArray.isEmpty(sel_)) { for (int i = 0; i < sel_.length; i++) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -18,8 +18,10 @@ import java.awt.Shape; import java.awt.Stroke; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Map; import javax.swing.SwingConstants; import javax.swing.tree.TreeNode; @@ -34,6 +36,7 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.controle.BSelecteurAlpha; import org.fudaa.ebli.controle.BSelecteurColorChooser; import org.fudaa.ebli.controle.BSelecteurIconModel; @@ -58,846 +61,974 @@ */ public abstract class EGCourbe extends EGObject { - private int alpha_ = 255; + private int alpha_ = 255; - private final TraceLigneModel lineModel_; + private final TraceLigneModel lineModel_; - private double[] markH_; + // private double[] markH_; - private boolean markMaxLine_; - private boolean markMinLine_; + /** + * la liste des valeurs marquees + */ + private List<EGCourbeMarqueur> listeMarqueurs_=null; - - - private EGModel model_; + private boolean markMaxLine_; - private TraceLigneModel tLigneMarqueur_; + private boolean markMinLine_; - boolean displayTitleOnCurve_; - Font font_ = CtuluLibSwing.getMiniFont(); - final TraceIconModel iconeModel_; + private EGModel model_; - EGCourbeSurfacePainter surfacePainter_; + private TraceLigneModel tLigneMarqueur_; - TraceBox tbox_; + boolean displayTitleOnCurve_; - /** - * @param _model le model a prendre en compte - */ - public EGCourbe(final EGModel _model) { - iconeModel_ = new TraceIconModel(TraceIcon.RIEN, 1, Color.BLACK); - lineModel_ = new TraceLigneModel(); - model_ = _model; - } + Font font_ = CtuluLibSwing.getMiniFont(); - private void buildLigneMarqueur() { - if (tLigneMarqueur_ == null) { - tLigneMarqueur_ = new TraceLigneModel(); - tLigneMarqueur_.setTypeTrait(TraceLigne.POINTILLE); - tLigneMarqueur_.setCouleur(lineModel_.getCouleur().brighter()); - } - } + final TraceIconModel iconeModel_; - private TraceLigne getLineMarkeur() { - buildLigneMarqueur(); - final TraceLigne trMarqueur = new TraceLigne(new TraceLigneModel(tLigneMarqueur_)); - if (EbliLib.isAlphaChanged(alpha_)) { - trMarqueur.setCouleur(EbliLib.getAlphaColor(tLigneMarqueur_.getCouleur(), alpha_)); - } - return trMarqueur; - } + EGCourbeSurfacePainter surfacePainter_; - private void initTraceBox() { - if (tbox_ == null) { - tbox_ = new TraceBox(); - buildLigneMarqueur(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - tbox_.setColorFond(Color.WHITE); - tbox_.setHMargin(1); - tbox_.setVMargin(1); - tbox_.setHPosition(SwingConstants.LEFT); - tbox_.setVPosition(SwingConstants.CENTER); - tbox_.setColorText(Color.BLACK); - tbox_.setDrawBox(true); - tbox_.setDrawFond(true); - } - } + TraceBox tbox_; - private void traceMarks(final Graphics2D _g, final EGRepere _t) { - final int xmin = _t.getMinEcranX(); - final int xmax = _t.getMaxEcranX(); - final Font f = EGGraphe.DEFAULT_FONT; - final Font old = _g.getFont(); - _g.setFont(f); + /** + * @param _model le model a prendre en compte + */ + public EGCourbe(final EGModel _model) { + iconeModel_ = new TraceIconModel(TraceIcon.RIEN, 1, Color.BLACK); + lineModel_ = new TraceLigneModel(); + model_ = _model; + } - CtuluRange r = null; - TraceLigne trMarqueur = null; - if (isMarkMaxLine() || isMarkMinLine()) { - r = EGCourbeModelDefault.getLocalMinMax(_t.getXAxe(), getModel()); - } - EGAxeVertical axeY = getAxeY(); - if (r != null && isMarkMinLine() && axeY.containsPoint(r.min_)) { - trMarqueur = getLineMarkeur(); - final int yie = _t.getYEcran(r.min_, axeY); - trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); - initTraceBox(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - int x = xmin + 3; - final String str = axeY.getStringAffiche(r.min_); - if (axeY.isDroite()) { - x = xmax - 6 - _g.getFontMetrics().stringWidth(str); - } - tbox_.paintBox(_g, x, yie, str); + private void buildLigneMarqueur() { + if (tLigneMarqueur_ == null) { + tLigneMarqueur_ = new TraceLigneModel(); + tLigneMarqueur_.setTypeTrait(TraceLigne.POINTILLE); + tLigneMarqueur_.setCouleur(lineModel_.getCouleur().brighter()); + } + } - } - if (r != null && isMarkMaxLine() && axeY.containsPoint(r.max_)) { - if (trMarqueur == null) { - trMarqueur = getLineMarkeur(); - } - final int yie = _t.getYEcran(r.max_, axeY); - trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); - initTraceBox(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - int x = xmin + 3; - final String str = axeY.getStringAffiche(r.max_); - if (axeY.isDroite()) { - x = xmax - 6 - _g.getFontMetrics().stringWidth(str); - } - tbox_.paintBox(_g, x, yie, str); - } - if (markH_ != null) { - if (trMarqueur == null) { - trMarqueur = getLineMarkeur(); - } - initTraceBox(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - for (int i = 0; i < markH_.length; i++) { - if (axeY.containsPoint(markH_[i])) { - final int yie = _t.getYEcran(markH_[i], axeY); - int x = xmin + 3; - final String str = axeY.getStringAffiche(markH_[i]); - if (axeY.isDroite()) { - x = xmax - 6 - _g.getFontMetrics().stringWidth(str); - } - trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); - tbox_.paintBox(_g, x, yie, str); - } - } - } + private TraceLigne getLineMarkeur() { + buildLigneMarqueur(); + final TraceLigne trMarqueur = new TraceLigne(new TraceLigneModel(tLigneMarqueur_)); + if (EbliLib.isAlphaChanged(alpha_)) { + trMarqueur.setCouleur(EbliLib.getAlphaColor(tLigneMarqueur_.getCouleur(), alpha_)); + } + return trMarqueur; + } - _g.setFont(old); + private void initTraceBox() { + if (tbox_ == null) { + tbox_ = new TraceBox(); + buildLigneMarqueur(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + tbox_.setColorFond(Color.WHITE); + tbox_.setHMargin(1); + tbox_.setVMargin(1); + tbox_.setHPosition(SwingConstants.LEFT); + tbox_.setVPosition(SwingConstants.CENTER); + tbox_.setColorText(Color.BLACK); + tbox_.setDrawBox(true); + tbox_.setDrawFond(true); + } + } - } + private void traceMarks(final Graphics2D _g, final EGRepere _t) { + final int xmin = _t.getMinEcranX(); + final int xmax = _t.getMaxEcranX(); + final Font f = EGGraphe.DEFAULT_FONT; + final Font old = _g.getFont(); + _g.setFont(f); - void fillWithInfo(final BPaletteInfo.InfoData _table, final CtuluListSelectionInterface _selectedPt) { - _table.setTitle(EbliLib.getS("Courbe:") + CtuluLibString.ESPACE + getTitle()); - getModel().fillWithInfo(_table, _selectedPt); - _table.put(EbliLib.getS("Nombre de points"), CtuluLibString.getString(model_.getNbValues())); - _table.put(EbliLib.getS("Nombre de points s\xE9lectionn\xE9s"), CtuluLibString.getString(_selectedPt == null ? 0 - : _selectedPt.getNbSelectedIndex())); - _table.put(EbliLib.getS("X min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMin())); - _table.put(EbliLib.getS("X max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMax())); - _table.put(EbliLib.getS("Y min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMin())); - _table.put(EbliLib.getS("Y max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMax())); - - } + CtuluRange r = null; + TraceLigne trMarqueur = null; + if (isMarkMaxLine() || isMarkMinLine()) { + r = EGCourbeModelDefault.getLocalMinMax(_t.getXAxe(), getModel()); + } + EGAxeVertical axeY = getAxeY(); + if (r != null && isMarkMinLine() && axeY.containsPoint(r.min_)) { + trMarqueur = getLineMarkeur(); + final int yie = _t.getYEcran(r.min_, axeY); + trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); + initTraceBox(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + int x = xmin + 3; + final String str = axeY.getStringAffiche(r.min_); + if (axeY.isDroite()) { + x = xmax - 6 - _g.getFontMetrics().stringWidth(str); + } + tbox_.paintBox(_g, x, yie, str); - final boolean isMarkMaxLine() { - return markMaxLine_; - } + } + if (r != null && isMarkMaxLine() && axeY.containsPoint(r.max_)) { + if (trMarqueur == null) { + trMarqueur = getLineMarkeur(); + } + final int yie = _t.getYEcran(r.max_, axeY); + trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); + initTraceBox(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + int x = xmin + 3; + final String str = axeY.getStringAffiche(r.max_); + if (axeY.isDroite()) { + x = xmax - 6 - _g.getFontMetrics().stringWidth(str); + } + tbox_.paintBox(_g, x, yie, str); + } + if (getMarqueurs() != null) { +// if (trMarqueur == null) { +// trMarqueur = getLineMarkeur(); +// } + initTraceBox(); - final boolean isMarkMinLine() { - return markMinLine_; - } - boolean setLigneType(final TraceLigneModel _data) { - final boolean res = lineModel_.updateData(_data); - if (res) { - fireCourbeAspectChanged(false); - super.firePropertyChange(BSelecteurLineModel.PROPERTY, null, lineModel_); - } - return res; - } - final boolean setMarkMaxLine(final boolean _markMaxLine) { - if (_markMaxLine != markMaxLine_) { - markMaxLine_ = _markMaxLine; - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MAX, markMaxLine_); - return true; - } - return false; - } - final boolean setMarkMinLine(final boolean _markMinLine) { - if (markMinLine_ != _markMinLine) { - markMinLine_ = _markMinLine; - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MIN, markMinLine_); - return true; - } - return false; - } + for (EGCourbeMarqueur marqueur:getMarqueurs()) { + tbox_.setColorBoite(marqueur.model_.getCouleur()); - protected int getAlpha() { - return alpha_; - } + if (axeY.containsPoint(marqueur.getValue()) && marqueur.isVisible()) { + final int yie = _t.getYEcran(marqueur.getValue(), axeY); + int x = xmin + 3; + final String str = axeY.getStringAffiche(marqueur.getValue()); + if (axeY.isDroite()) { + x = xmax - 6 - _g.getFontMetrics().stringWidth(str); + } + new TraceLigne(marqueur.model_).dessineTrait(_g, xmin, yie, xmax, yie); + tbox_.paintBox(_g, x, yie, str); + } + } + } - protected abstract EGParent getEGParent(); - - public abstract EGCourbe duplicate(EGParent newParent,EGGrapheDuplicator _duplicator); + _g.setFont(old); - protected Font getFont() { - return font_; - } + } - protected boolean isDisplayTitleOnCurve() { - return displayTitleOnCurve_; - } + void fillWithInfo(final BPaletteInfo.InfoData _table, final CtuluListSelectionInterface _selectedPt) { + _table.setTitle(EbliLib.getS("Courbe:") + CtuluLibString.ESPACE + getTitle()); + getModel().fillWithInfo(_table, _selectedPt); + _table.put(EbliLib.getS("Nombre de points"), CtuluLibString.getString(model_.getNbValues())); + _table.put(EbliLib.getS("Nombre de points s\xE9lectionn\xE9s"), CtuluLibString.getString(_selectedPt == null ? 0 + : _selectedPt.getNbSelectedIndex())); + _table.put(EbliLib.getS("X min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMin())); + _table.put(EbliLib.getS("X max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMax())); + _table.put(EbliLib.getS("Y min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMin())); + _table.put(EbliLib.getS("Y max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMax())); - protected boolean isSelected(final double _xToTest, final double _yToTest, final int _x, final int _y, - final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) { - return (CtuluLibGeometrie.getDistance(_x, _y, _t.getXEcran(_xToTest), _t.getYEcran(_yToTest, _yaxe)) <= _precision); - } + } - protected void paintSurface(final Graphics2D _g, final EGRepere _t, final int _i) { - createSurface(); - if (surfacePainter_ != null) { - surfacePainter_.paint(_g, _t, _i); - } - } + final boolean isMarkMaxLine() { + return markMaxLine_; + } - protected boolean setAlpha(final int _alpha) { - if (alpha_ != _alpha) { - alpha_ = _alpha; - firePropertyChange(BSelecteurAlpha.DEFAULT_PROPERTY); - fireCourbeAspectChanged(false); - return true; - } - return false; - } + final boolean isMarkMinLine() { + return markMinLine_; + } - protected boolean setDisplayTitleOnCurve(final boolean _displayTitleOnCurve) { - if (_displayTitleOnCurve == displayTitleOnCurve_) { - return false; - } - displayTitleOnCurve_ = _displayTitleOnCurve; - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_TITLE_CURVE, displayTitleOnCurve_); - return true; - } + boolean setLigneType(final TraceLigneModel _data) { + final boolean res = lineModel_.updateData(_data); + if (res) { + fireCourbeAspectChanged(false); + super.firePropertyChange(BSelecteurLineModel.PROPERTY, null, lineModel_); + } + return res; + } - protected boolean setFont(final Font _font) { - if (_font == font_) { - return false; - } - font_ = _font; - fireCourbeAspectChanged(false); - firePropertyChange(BSelecteurReduitFonteNewVersion.PROPERTY); - return true; - } + final boolean setMarkMaxLine(final boolean _markMaxLine) { + if (_markMaxLine != markMaxLine_) { + markMaxLine_ = _markMaxLine; + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MAX, markMaxLine_); + return true; + } + return false; + } - protected void traceTitle(final Graphics2D _g, final EGRepere _t, final Envelope _r) { - if (_r == null) { - return; - } - final double x = _r.getMinX(); - double y = interpol(x); - final Font old = _g.getFont(); - _g.setFont(getFont()); - final FontMetrics fm = _g.getFontMetrics(); - final String title = getTitle(); - final int xie = _t.getXEcran(x); - final int xlast = xie + fm.stringWidth(title); - final double xLastReal = _t.getXReel(xlast); - final TIntArrayList l = new TIntArrayList(getModel().getNbValues()); - fillWithIdxStrictlyIncluded(Math.floor(x), Math.ceil(xLastReal), l); - for (int i = l.size() - 1; i >= 0; i--) { - final double yi = getModel().getY(l.get(i)); - if (yi > y) { - y = yi; - } - } - final int yie = _t.getYEcran(y, getAxeY()) - fm.getHeight(); - _g.drawString(title, xie, yie); - _g.setFont(old); - } + final boolean setMarkMinLine(final boolean _markMinLine) { + if (markMinLine_ != _markMinLine) { + markMinLine_ = _markMinLine; + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MIN, markMinLine_); + return true; + } + return false; + } - public boolean ajuste(final CtuluRange _x, final CtuluRange _y) { - //un seul | pout ajuster les 2 - return ajusteX(_x) | ajusteY(_y); - } + protected int getAlpha() { + return alpha_; + } - public boolean ajusteX(final CtuluRange _r) { - double x = getXMin(); - boolean r = false; - final boolean mustChange = _r.isNill(); - if (mustChange || x < _r.min_) { - r = true; - _r.min_ = x; - } - x = getXMax(); - if (mustChange || x > _r.max_) { - r = true; - _r.max_ = x; - } - return r; - } + protected abstract EGParent getEGParent(); - public boolean ajusteY(final CtuluRange _r) { - boolean r = false; - double y = getYMin(); - final boolean mustChange = _r.isNill(); - if (mustChange || y < _r.min_) { - r = true; - _r.min_ = y; - } - y = getYMax(); - if (mustChange || y > _r.max_) { - r = true; - _r.max_ = y; - } - return r; - } + public abstract EGCourbe duplicate(EGParent newParent,EGGrapheDuplicator _duplicator); - /** - * @param _x le x a tester - * @return true si afficher - */ - public boolean containsX(final double _x) { - return (_x <= getModel().getXMax()) && (_x >= getModel().getXMin()); - } + protected Font getFont() { + return font_; + } - public void createSurface() { - if (surfacePainter_ == null && getEGParent() != null) { - surfacePainter_ = new EGCourbeSurfacePainter(this, getEGParent().getMainModel()); - } - } + protected boolean isDisplayTitleOnCurve() { + return displayTitleOnCurve_; + } - public void descendre() { - getEGParent().descendre(this); - } + protected boolean isSelected(final double _xToTest, final double _yToTest, final int _x, final int _y, + final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) { + return (CtuluLibGeometrie.getDistance(_x, _y, _t.getXEcran(_xToTest), _t.getYEcran(_yToTest, _yaxe)) <= _precision); + } - /** - * Boolean si oui ou non le graphe est un nuage de points - */ - protected boolean nuagePoints_=false; - /** - * Taille des points du nuages symbolis\xE9s par des carr\xE9s. - */ - protected int largeurPointsNuage_=5; - - public void dessine(final Graphics2D _g, final EGRepere _t) { - if (!isVisible_) { - return; - } - if (model_.getNbValues() == 0) { - return; - } - final Shape oldClip = _g.getClip(); - final int minX = _t.getMinEcranX(); - final int adjust = 3; - _g.setClip(minX - adjust, 0, _t.getMaxEcranX() - minX + adjust * 2, _t.getH()); - final int nbPt = model_.getNbValues(); - double xi, yi, xie, yie; - boolean xiVisible; - boolean yiVisible; - double xpe = 0; - double ype = 0; - boolean xpVisible = false; - Envelope rangeDisplayed = null; - _g.setColor(EbliLib.getAlphaColor(getAspectContour(), alpha_)); - final boolean isAlphaChanged = EbliLib.isAlphaChanged(alpha_); - final TraceIcon trIcon = new TraceIcon(isAlphaChanged ? new TraceIconModel(iconeModel_) : iconeModel_); - final TraceLigne trLigne = new TraceLigne(isAlphaChanged ? new TraceLigneModel(lineModel_) : lineModel_); - if (isAlphaChanged) { - trIcon.setCouleur(EbliLib.getAlphaColor(trIcon.getCouleur(), alpha_)); - trLigne.setCouleur(EbliLib.getAlphaColor(trLigne.getCouleur(), alpha_)); - } - for (int i = 0; i < nbPt; i++) { - xi = model_.getX(i); - yi = model_.getY(i); - xie = _t.getXEcran(xi); - yie = _t.getYEcran(yi, getAxeY()); - xiVisible = _t.getXAxe().containsPoint(xi); - yiVisible = getAxeY().containsPoint(yi); + protected void paintSurface(final Graphics2D _g, final EGRepere _t, final int _i) { + createSurface(); + if (surfacePainter_ != null) { + surfacePainter_.paint(_g, _t, _i); + } + } - if (model_.isPointDrawn(i) && xiVisible && yiVisible && iconeModel_.getType() != TraceIcon.RIEN) { - if (displayTitleOnCurve_) { - if (rangeDisplayed == null) { - rangeDisplayed = new Envelope(); - } - rangeDisplayed.expandToInclude(xi, yi); - } - // icone_.couleur(getAspectContour()); - trIcon.paintIconCentre(_g, xie, yie); - } - if ((i > 0) && model_.isSegmentDrawn(i - 1) && (xpVisible || xiVisible || _t.getXAxe().isContained(xpe, xie))) { - if (displayTitleOnCurve_) { - if (rangeDisplayed == null) { - rangeDisplayed = new Envelope(); - } - rangeDisplayed.expandToInclude(xi, yi); - } - paintSurface(_g, _t, i); - - if(!nuagePoints_) - trLigne.dessineTrait(_g, xie, yie, xpe, ype); - else{ - //-- trace un + --// - //-- ligne | --// - trLigne.dessineTrait(_g, xie, yie-largeurPointsNuage_/2, xie, yie+largeurPointsNuage_/2); - //--ligne - --// - trLigne.dessineTrait(_g, xie-largeurPointsNuage_/2, yie, xie+largeurPointsNuage_/2, yie); - //dessineRectangle(_g, xie-largeurPointsNuage_/2, yie-largeurPointsNuage_/2, largeurPointsNuage_, largeurPointsNuage_); - } - } - xpVisible = xiVisible; - xpe = xie; - ype = yie; - } - _g.setClip(oldClip); - traceMarks(_g, _t); - traceTitle(_g, _t, rangeDisplayed); - } + protected boolean setAlpha(final int _alpha) { + if (alpha_ != _alpha) { + alpha_ = _alpha; + firePropertyChange(BSelecteurAlpha.DEFAULT_PROPERTY); + fireCourbeAspectChanged(false); + return true; + } + return false; + } - public boolean isNuagePoints_() { - return nuagePoints_; -} + protected boolean setDisplayTitleOnCurve(final boolean _displayTitleOnCurve) { + if (_displayTitleOnCurve == displayTitleOnCurve_) { + return false; + } + displayTitleOnCurve_ = _displayTitleOnCurve; + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_TITLE_CURVE, displayTitleOnCurve_); + return true; + } -public void setNuagePoints_(boolean nuagePoints_) { - this.nuagePoints_ = nuagePoints_; -} + protected boolean setFont(final Font _font) { + if (_font == font_) { + return false; + } + font_ = _font; + fireCourbeAspectChanged(false); + firePropertyChange(BSelecteurReduitFonteNewVersion.PROPERTY); + return true; + } -public void enDernier() { - getEGParent().enDernier(this); + protected void traceTitle(final Graphics2D _g, final EGRepere _t, final Envelope _r) { + if (_r == null) { + return; + } + final double x = _r.getMinX(); + double y = interpol(x); + final Font old = _g.getFont(); + _g.setFont(getFont()); + final FontMetrics fm = _g.getFontMetrics(); + final String title = getTitle(); + final int xie = _t.getXEcran(x); + final int xlast = xie + fm.stringWidth(title); + final double xLastReal = _t.getXReel(xlast); + final TIntArrayList l = new TIntArrayList(getModel().getNbValues()); + fillWithIdxStrictlyIncluded(Math.floor(x), Math.ceil(xLastReal), l); + for (int i = l.size() - 1; i >= 0; i--) { + final double yi = getModel().getY(l.get(i)); + if (yi > y) { + y = yi; + } + } + final int yie = _t.getYEcran(y, getAxeY()) - fm.getHeight(); + _g.drawString(title, xie, yie); + _g.setFont(old); + } - } + public boolean ajuste(final CtuluRange _x, final CtuluRange _y) { + //un seul | pout ajuster les 2 + return ajusteX(_x) | ajusteY(_y); + } - public void enPremier() { - getEGParent().enPremier(this); - } + public boolean ajusteX(final CtuluRange _r) { + double x = getXMin(); + boolean r = false; + final boolean mustChange = _r.isNill(); + if (mustChange || x < _r.min_) { + r = true; + _r.min_ = x; + } + x = getXMax(); + if (mustChange || x > _r.max_) { + r = true; + _r.max_ = x; + } + return r; + } - public void fillWithCurves(final List _dest) { - _dest.add(this); - } + public boolean ajusteY(final CtuluRange _r) { + boolean r = false; + double y = getYMin(); + final boolean mustChange = _r.isNill(); + if (mustChange || y < _r.min_) { + r = true; + _r.min_ = y; + } + y = getYMax(); + if (mustChange || y > _r.max_) { + r = true; + _r.max_ = y; + } + return r; + } - /** - * @param _xDeb l'abscisse de deb - * @param _xEnd l'abscisse de deb - * @param _dest la liste qui sera remplie avec les indices des points dont les abscisses sont strictement incluses - * dans ]_xDeb,_xEnd[ - */ - public void fillWithIdxStrictlyIncluded(final double _xDeb, final double _xEnd, final TIntArrayList _dest) { - _dest.clear(); - if (getModel().getNbValues() == 0) { - return; - } - int idx = getNearestIdx(_xDeb); - if (idx < 0) { - idx = -idx - 1; - } else { - idx++; - } - if (idx < 0 || idx >= getModel().getNbValues()) { - return; - } - double x = getModel().getX(idx); - while (x > _xDeb && x < _xEnd) { - _dest.add(idx); - idx++; - if (idx >= getModel().getNbValues()) { - break; - } - x = getModel().getX(idx); + /** + * @param _x le x a tester + * @return true si afficher + */ + public boolean containsX(final double _x) { + return (_x <= getModel().getXMax()) && (_x >= getModel().getXMin()); + } - } - } + public void createSurface() { + if (surfacePainter_ == null && getEGParent() != null) { + surfacePainter_ = new EGCourbeSurfacePainter(this, getEGParent().getMainModel()); + } + } - public final void fireCourbeAspectChanged(final boolean _visibility) { - if (getEGParent() != null) { - getEGParent().fireCourbeAspectChanged(this, _visibility); - } - } + public void descendre() { + getEGParent().descendre(this); + } - public final void fireCourbeContentChanged() { - if (getEGParent() != null) { - getEGParent().fireCourbeContentChanged(this, false); - } + /** + * Boolean si oui ou non le graphe est un nuage de points + */ + protected boolean nuagePoints_=false; + /** + * Taille des points du nuages symbolis\xE9s par des carr\xE9s. + */ + protected int largeurPointsNuage_=5; - } + public void dessine(final Graphics2D _g, final EGRepere _t) { + if (!isVisible_) { + return; + } + if (model_.getNbValues() == 0) { + return; + } + final Shape oldClip = _g.getClip(); + final int minX = _t.getMinEcranX(); + final int adjust = 3; + _g.setClip(minX - adjust, 0, _t.getMaxEcranX() - minX + adjust * 2, _t.getH()); + final int nbPt = model_.getNbValues(); + double xi, yi, xie, yie; + boolean xiVisible; + boolean yiVisible; + double xpe = 0; + double ype = 0; + boolean xpVisible = false; + Envelope rangeDisplayed = null; + _g.setColor(EbliLib.getAlphaColor(getAspectContour(), alpha_)); + final boolean isAlphaChanged = EbliLib.isAlphaChanged(alpha_); + final TraceIcon trIcon = new TraceIcon(isAlphaChanged ? new TraceIconModel(iconeModel_) : iconeModel_); + final TraceLigne trLigne = new TraceLigne(isAlphaChanged ? new TraceLigneModel(lineModel_) : lineModel_); + if (isAlphaChanged) { + trIcon.setCouleur(EbliLib.getAlphaColor(trIcon.getCouleur(), alpha_)); + trLigne.setCouleur(EbliLib.getAlphaColor(trLigne.getCouleur(), alpha_)); + } + for (int i = 0; i < nbPt; i++) { + xi = model_.getX(i); + yi = model_.getY(i); + xie = _t.getXEcran(xi); + yie = _t.getYEcran(yi, getAxeY()); + xiVisible = _t.getXAxe().containsPoint(xi); + yiVisible = getAxeY().containsPoint(yi); - /** - * @return un indice entre 0 et le nombre de point indiquant l'indice active( un pas de temps par exemple) - */ - public int getActiveTimeIdx() { - return -1; - } + if (model_.isPointDrawn(i) && xiVisible && yiVisible && iconeModel_.getType() != TraceIcon.RIEN) { + if (displayTitleOnCurve_) { + if (rangeDisplayed == null) { + rangeDisplayed = new Envelope(); + } + rangeDisplayed.expandToInclude(xi, yi); + } + // icone_.couleur(getAspectContour()); + trIcon.paintIconCentre(_g, xie, yie); + } + if ((i > 0) && model_.isSegmentDrawn(i - 1) && (xpVisible || xiVisible || _t.getXAxe().isContained(xpe, xie))) { + if (displayTitleOnCurve_) { + if (rangeDisplayed == null) { + rangeDisplayed = new Envelope(); + } + rangeDisplayed.expandToInclude(xi, yi); + } + paintSurface(_g, _t, i); - public boolean getAllowsChildren() { - return false; - } + if(!nuagePoints_) + trLigne.dessineTrait(_g, xie, yie, xpe, ype); + else{ + //-- trace un + --// + //-- ligne | --// + trLigne.dessineTrait(_g, xie, yie-largeurPointsNuage_/2, xie, yie+largeurPointsNuage_/2); + //--ligne - --// + trLigne.dessineTrait(_g, xie-largeurPointsNuage_/2, yie, xie+largeurPointsNuage_/2, yie); + //dessineRectangle(_g, xie-largeurPointsNuage_/2, yie-largeurPointsNuage_/2, largeurPointsNuage_, largeurPointsNuage_); + } + } + xpVisible = xiVisible; + xpe = xie; + ype = yie; + } + _g.setClip(oldClip); + traceMarks(_g, _t); + traceTitle(_g, _t, rangeDisplayed); + } - public Color getAspectContour() { - final Color c = lineModel_.getCouleur(); - return c == iconeModel_.getCouleur() ? c : null; - } + public boolean isNuagePoints_() { + return nuagePoints_; + } - public Color getAspectSurface() { - return null; - } + public void setNuagePoints_(boolean nuagePoints_) { + this.nuagePoints_ = nuagePoints_; + } - public Color getAspectTexte() { - return null; - } + public boolean setNuagePointEtApplique(boolean nuagePOints){ + setNuagePoints_(nuagePoints_); + fireCourbeAspectChanged(false); + //fireCourbeContentChanged(); + return true; + + } + + public void enDernier() { + getEGParent().enDernier(this); - public final EGAxeHorizontal getAxeX() { - return getEGParent().getAxeX(); - } + } - public BConfigurableInterface[] getConfigureInterfaces() { - return new BConfigurableInterface[] { getSingleConfigureInterface() }; - } + public void enPremier() { + getEGParent().enPremier(this); + } - public int getIconeType() { - return iconeModel_.getType(); - } + public void fillWithCurves(final List _dest) { + _dest.add(this); + } - public int getIconHeight() { - return 24; - } + /** + * @param _xDeb l'abscisse de deb + * @param _xEnd l'abscisse de deb + * @param _dest la liste qui sera remplie avec les indices des points dont les abscisses sont strictement incluses + * dans ]_xDeb,_xEnd[ + */ + public void fillWithIdxStrictlyIncluded(final double _xDeb, final double _xEnd, final TIntArrayList _dest) { + _dest.clear(); + if (getModel().getNbValues() == 0) { + return; + } + int idx = getNearestIdx(_xDeb); + if (idx < 0) { + idx = -idx - 1; + } else { + idx++; + } + if (idx < 0 || idx >= getModel().getNbValues()) { + return; + } + double x = getModel().getX(idx); + while (x > _xDeb && x < _xEnd) { + _dest.add(idx); + idx++; + if (idx >= getModel().getNbValues()) { + break; + } + x = getModel().getX(idx); - public TraceIconModel getIconModel() { - return iconeModel_; - } + } + } - public int getIconWidth() { - return 24; - } + public final void fireCourbeAspectChanged(final boolean _visibility) { + if (getEGParent() != null) { + getEGParent().fireCourbeAspectChanged(this, _visibility); + } + } - public int getIndex(final TreeNode _node) { - return -1; - } + public final void fireCourbeContentChanged() { + if (getEGParent() != null) { + getEGParent().fireCourbeContentChanged(this, false); + } - public TraceLigneModel getLigneModel() { - return lineModel_; - } + } - public TraceLigneModel getMarkLigneModel() { - return tLigneMarqueur_; - } + /** + * @return un indice entre 0 et le nombre de point indiquant l'indice active( un pas de temps par exemple) + */ + public int getActiveTimeIdx() { + return -1; + } - /** - * @return les marques affichees par cette courbe - */ - public double[] getMarks() { - return CtuluLibArray.copy(markH_); + public boolean getAllowsChildren() { + return false; + } - } + public Color getAspectContour() { + final Color c = lineModel_.getCouleur(); + return c == iconeModel_.getCouleur() ? c : null; + } - public EGModel getModel() { - return model_; - } + public Color getAspectSurface() { + return null; + } - public int getNearestIdx(final double _x) { - int low = 0; - int high = model_.getNbValues() - 1; - while (low <= high) { - final int mid = (low + high) >> 1; - final double midVal = getModel().getX(mid); - if (midVal < _x) { - low = mid + 1; - } else if (midVal > _x) { - high = mid - 1; - } else { - return mid; // value found - } - } - return -(low + 1); // value not found. + public Color getAspectTexte() { + return null; + } - } + public final EGAxeHorizontal getAxeX() { + return getEGParent().getAxeX(); + } - public BConfigurableInterface getSingleConfigureInterface() { - BConfigurableComposite aff = null; - if (surfacePainter_ == null) { - aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), EbliLib - .getS("Courbes")); - } else { - aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), new EGCourbeSurfacePainterConfigure( - surfacePainter_), EbliLib.getS("Courbes")); - } - final BConfigurableComposite axeY = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeY(), - getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeY(), getEGParent()), EbliLib - .getS("Axes verticaux")); - final BConfigurableComposite axeX = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeX(), - getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeX(), getEGParent()), EbliLib - .getS("Axe horizontal")); - return new BConfigurableComposite(aff, new EGCourbeConfigureTarget.Marks(this), axeY, axeX, null); - } + public BConfigurableInterface[] getConfigureInterfaces() { + return new BConfigurableInterface[] { getSingleConfigureInterface() }; + } - public EGCourbeSurfacePainter getSurfacePainter() { - return surfacePainter_; - } + public int getIconeType() { + return iconeModel_.getType(); + } - public String getTitle() { - return model_.getTitle(); - } + public int getIconHeight() { + return 24; + } - public double getXMax() { - return model_.getXMax(); - } + public TraceIconModel getIconModel() { + return iconeModel_; + } - public double getXMin() { - return model_.getXMin(); - } + public int getIconWidth() { + return 24; + } - public double getYMax() { - return model_.getYMax(); - } + public int getIndex(final TreeNode _node) { + return -1; + } - public double getYMin() { - return model_.getYMin(); - } + public TraceLigneModel getLigneModel() { + return lineModel_; + } - public double interpol(final double _x) { - final int i = getNearestIdx(_x); - if (i >= 0) { - return model_.getY(i); - } - final int idx = -i - 2; - if ((idx < 0) || (idx >= model_.getNbValues() - 1)) { - return 0D; - } - final double xlow = model_.getX(idx); - final double xup = model_.getX(idx + 1); - final double ylow = model_.getY(idx); - final double yup = model_.getY(idx + 1); - return yup - (xup - _x) / (xup - xlow) * (yup - ylow); - } + public TraceLigneModel getMarkLigneModel() { + return tLigneMarqueur_; + } - public double interpolOnEcran(final double _x, final EGRepere _rep) { - if (model_.getNbValues() == 0) { - return 0d; - } - final EGAxeVertical vert = getAxeY(); - final int i = getNearestIdx(_x); - if (i >= 0) { - return _rep.getYEcran(model_.getY(i), vert); - } - final int idx = -i - 2; - if (model_.getNbValues() == 0) { - return 0d; - } - if (idx < 0) { - return _rep.getYEcran(model_.getY(0), vert); - } - if (idx >= model_.getNbValues() - 1) { - return _rep.getYEcran(model_.getY(model_.getNbValues() - 1), vert); - } - final double xlow = _rep.getXEcran(model_.getX(idx)); - final double xup = _rep.getXEcran(model_.getX(idx + 1)); - final double ylow = _rep.getYEcran(model_.getY(idx), vert); - final double yup = _rep.getYEcran(model_.getY(idx + 1), vert); - return yup - (xup - _rep.getXEcran(_x)) / (xup - xlow) * (yup - ylow); - } - public boolean isActiveTimeEnable() { - return false; - } +// public double[] getMarks() { +// return CtuluLibArray.copy(markH_); - public final boolean isCourbe() { - return true; - } +// } + /** + * @return les marques affichees par cette courbe + */ + public List<EGCourbeMarqueur> getMarqueurs() { + if(listeMarqueurs_==null){ + //-- init avec 3 marqueurs --// + listeMarqueurs_=new ArrayList<EGCourbeMarqueur>(3); + addMarqueur(); + addMarqueur(); + addMarqueur(); + } + return listeMarqueurs_; - /** - * @return true - */ - public final boolean isLegendAvailable() { - return true; - } + } + public EGModel getModel() { + return model_; + } - public boolean isSomethingToDisplay() { - return true; - } + public int getNearestIdx(final double _x) { + int low = 0; + int high = model_.getNbValues() - 1; + while (low <= high) { + final int mid = (low + high) >> 1; + final double midVal = getModel().getX(mid); + if (midVal < _x) { + low = mid + 1; + } else if (midVal > _x) { + high = mid - 1; + } else { + return mid; // value found + } + } + return -(low + 1); // value not found. - public boolean isTitleModifiable() { - return model_.isTitleModifiable(); - } + } - public void monter() { - getEGParent().monter(this); - } + public BConfigurableInterface getSingleConfigureInterface() { + BConfigurableComposite aff = null; + if (surfacePainter_ == null) { + aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), EbliLib + .getS("Courbes")); + } else { + aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), new EGCourbeSurfacePainterConfigure( + surfacePainter_), EbliLib.getS("Courbes")); + } + final BConfigurableComposite axeY = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeY(), + getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeY(), getEGParent()), EbliLib + .getS("Axes verticaux")); + final BConfigurableComposite axeX = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeX(), + getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeX(), getEGParent()), EbliLib + .getS("Axe horizontal")); + return new BConfigurableComposite(aff, new EGCourbeConfigureTarget.Marks(this), axeY, axeX, null); + } - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - Color c = getAspectContour(); - if (!isVisible()) { - c = FiltreAttenuation.attenueCouleur(c); - } - final Color o = _g.getColor(); - final Graphics2D g = (Graphics2D) _g; - final Stroke oldS = g.getStroke(); - g.setStroke(new BasicStroke(1.5f)); - _g.setColor(c); - int xinit = _x; - int yinit = _y; - final int w4 = getIconWidth() / 4; - final int h = getIconWidth(); - int xfin = xinit + w4; - int yfin = yinit + h / 4; - _g.drawLine(xinit, yinit, xfin, yfin); - xinit = xfin; - yinit = yfin; - xfin += w4; - yfin = _y; - _g.drawLine(xinit, yinit, xfin, yfin); - xinit = xfin; - yinit = yfin; - xfin += w4; - yfin = _y + h; - _g.drawLine(xinit, yinit, xfin, yfin); - xinit = xfin; - yinit = yfin; - xfin += w4; - yfin = _y + h / 2; - _g.drawLine(xinit, yinit, xfin, yfin); - _g.setColor(o); - g.setStroke(oldS); - } + public EGCourbeSurfacePainter getSurfacePainter() { + return surfacePainter_; + } - public void paintSelection(final Graphics2D _g2d, final EGInteractionSelection _d) { - final CtuluListSelectionInterface s = _d.getSelection(); - for (int i = s.getMaxIndex(); i >= s.getMinIndex(); i--) { - if (s.isSelected(i) && i < model_.getNbValues()) { - final int x = _d.getRepere().getXEcran(model_.getX(i)); - final int y = _d.getRepere().getYEcran(model_.getY(i), getAxeY()); - _d.getSelectionIcone().paintIconCentre(_g2d, x, y); - } - } - } + public String getTitle() { + return model_.getTitle(); + } - public void removePropertyChangeListener(final PropertyChangeListener _l) {} + public double getXMax() { + return model_.getXMax(); + } - public int select(final int _xEcran, final int _yEcran, final EGRepere _repere, final int _prec) { - if (model_.getNbValues() == 0) { - return -1; - } - final double x = _repere.getXReel(_xEcran); - int idx = getNearestIdx(x); - if (idx >= 0) { - final boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); - if (r) { - return idx; - } - } - idx = -idx - 2; - final int maxIdx = model_.getNbValues() - 1; - if (idx < 0) { - idx = 0; - } - if (idx > maxIdx) { - idx = maxIdx; - } - boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); - if (r) { - return idx; - } - if (idx < maxIdx) { - idx++; - r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); - if (r) { - return idx; - } - } - return -1; - } + public double getXMin() { + return model_.getXMin(); + } - public boolean setAspectContour(final Color _c) { - if (_c == null) { - return false; - } - boolean r = false; - if (!_c.equals(lineModel_.getCouleur())) { - lineModel_.setCouleur(_c); - firePropertyChange(BSelecteurLineModel.PROPERTY); - r = true; - } - if (!iconeModel_.getCouleur().equals(_c)) { - iconeModel_.setCouleur(_c); - firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY); - r = true; - } - if (r) { - fireCourbeAspectChanged(false); - firePropertyChange(BSelecteurColorChooser.DEFAULT_PROPERTY, null, _c); - } - return r; - } + public double getYMax() { + return model_.getYMax(); + } - public boolean setIconeModel(final TraceIconModel _ic) { - final boolean r = iconeModel_.updateData(_ic); - if (r) { - fireCourbeAspectChanged(false); - super.firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY, null, iconeModel_); - } - return r; - } + public double getYMin() { + return model_.getYMin(); + } - public boolean setLigneMark(final TraceLigneModel _data) { - if (tLigneMarqueur_ == null) { - buildLigneMarqueur(); - } - final boolean res = tLigneMarqueur_.updateData(_data); - if (res) { - fireCourbeAspectChanged(false); - super.firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_LINE, null, iconeModel_); - } - return res; - } + public double interpol(final double _x) { + final int i = getNearestIdx(_x); + if (i >= 0) { + return model_.getY(i); + } + final int idx = -i - 2; + if ((idx < 0) || (idx >= model_.getNbValues() - 1)) { + return 0D; + } + final double xlow = model_.getX(idx); + final double xup = model_.getX(idx + 1); + final double ylow = model_.getY(idx); + final double yup = model_.getY(idx + 1); + return yup - (xup - _x) / (xup - xlow) * (yup - ylow); + } - /** - * @param _marks les nouvelles marques - * @return true si modife - */ - public boolean setMarks(final double[] _marks) { - if (Arrays.equals(markH_, _marks)) { - return false; - } - markH_ = CtuluLibArray.copy(_marks); - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_VALUES, null, _marks); - return true; - } + public double interpolOnEcran(final double _x, final EGRepere _rep) { + if (model_.getNbValues() == 0) { + return 0d; + } + final EGAxeVertical vert = getAxeY(); + final int i = getNearestIdx(_x); + if (i >= 0) { + return _rep.getYEcran(model_.getY(i), vert); + } + final int idx = -i - 2; + if (model_.getNbValues() == 0) { + return 0d; + } + if (idx < 0) { + return _rep.getYEcran(model_.getY(0), vert); + } + if (idx >= model_.getNbValues() - 1) { + return _rep.getYEcran(model_.getY(model_.getNbValues() - 1), vert); + } + final double xlow = _rep.getXEcran(model_.getX(idx)); + final double xup = _rep.getXEcran(model_.getX(idx + 1)); + final double ylow = _rep.getYEcran(model_.getY(idx), vert); + final double yup = _rep.getYEcran(model_.getY(idx + 1), vert); + return yup - (xup - _rep.getXEcran(_x)) / (xup - xlow) * (yup - ylow); + } - public void setModel(final EGModel _model) { - model_ = _model; - } + public boolean isActiveTimeEnable() { + return false; + } - public boolean setTitle(final String _newTitle) { - final boolean res = model_.setTitle(_newTitle); - if (res) { - fireCourbeContentChanged(); - firePropertyChange(BSelecteurTextField.TITLE_PROPERTY, null, model_.getTitle()); - } - return res; - } + public final boolean isCourbe() { + return true; + } - public String toString() { - return getTitle(); - } + /** + * @return true + */ + public final boolean isLegendAvailable() { + return true; + } -public TraceBox getTbox_() { - return tbox_; -} + public boolean isSomethingToDisplay() { + return true; + } -public void setTbox_(TraceBox tbox_) { - this.tbox_ = tbox_; -} - - - - + public boolean isTitleModifiable() { + return model_.isTitleModifiable(); + } + public void monter() { + getEGParent().monter(this); + } + + public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { + Color c = getAspectContour(); + if (!isVisible()) { + c = FiltreAttenuation.attenueCouleur(c); + } + final Color o = _g.getColor(); + final Graphics2D g = (Graphics2D) _g; + final Stroke oldS = g.getStroke(); + g.setStroke(new BasicStroke(1.5f)); + _g.setColor(c); + int xinit = _x; + int yinit = _y; + final int w4 = getIconWidth() / 4; + final int h = getIconWidth(); + int xfin = xinit + w4; + int yfin = yinit + h / 4; + _g.drawLine(xinit, yinit, xfin, yfin); + xinit = xfin; + yinit = yfin; + xfin += w4; + yfin = _y; + _g.drawLine(xinit, yinit, xfin, yfin); + xinit = xfin; + yinit = yfin; + xfin += w4; + yfin = _y + h; + _g.drawLine(xinit, yinit, xfin, yfin); + xinit = xfin; + yinit = yfin; + xfin += w4; + yfin = _y + h / 2; + _g.drawLine(xinit, yinit, xfin, yfin); + _g.setColor(o); + g.setStroke(oldS); + } + + public void paintSelection(final Graphics2D _g2d, final EGInteractionSelection _d) { + final CtuluListSelectionInterface s = _d.getSelection(); + for (int i = s.getMaxIndex(); i >= s.getMinIndex(); i--) { + if (s.isSelected(i) && i < model_.getNbValues()) { + final int x = _d.getRepere().getXEcran(model_.getX(i)); + final int y = _d.getRepere().getYEcran(model_.getY(i), getAxeY()); + _d.getSelectionIcone().paintIconCentre(_g2d, x, y); + } + } + } + + public void removePropertyChangeListener(final PropertyChangeListener _l) {} + + public int select(final int _xEcran, final int _yEcran, final EGRepere _repere, final int _prec) { + if (model_.getNbValues() == 0) { + return -1; + } + final double x = _repere.getXReel(_xEcran); + int idx = getNearestIdx(x); + if (idx >= 0) { + final boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); + if (r) { + return idx; + } + } + idx = -idx - 2; + final int maxIdx = model_.getNbValues() - 1; + if (idx < 0) { + idx = 0; + } + if (idx > maxIdx) { + idx = maxIdx; + } + boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); + if (r) { + return idx; + } + if (idx < maxIdx) { + idx++; + r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); + if (r) { + return idx; + } + } + return -1; + } + + public boolean setAspectContour(final Color _c) { + if (_c == null) { + return false; + } + boolean r = false; + if (!_c.equals(lineModel_.getCouleur())) { + lineModel_.setCouleur(_c); + firePropertyChange(BSelecteurLineModel.PROPERTY); + r = true; + } + if (!iconeModel_.getCouleur().equals(_c)) { + iconeModel_.setCouleur(_c); + firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY); + r = true; + } + if (r) { + fireCourbeAspectChanged(false); + firePropertyChange(BSelecteurColorChooser.DEFAULT_PROPERTY, null, _c); + } + return r; + } + + public boolean setIconeModel(final TraceIconModel _ic) { + final boolean r = iconeModel_.updateData(_ic); + if (r) { + fireCourbeAspectChanged(false); + super.firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY, null, iconeModel_); + } + return r; + } + + public boolean setLigneMark(final TraceLigneModel _data) { + if (tLigneMarqueur_ == null) { + buildLigneMarqueur(); + } + final boolean res = tLigneMarqueur_.updateData(_data); + if (res) { + fireCourbeAspectChanged(false); + super.firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_LINE, null, iconeModel_); + } + return res; + } + + /** + * @param _marks les nouvelles marques + * @return true si modife + */ +// public boolean setMarks(final double[] _marks) { +// if (Arrays.equals(markH_, _marks)) { +// return false; +// } +// markH_ = CtuluLibArray.copy(_marks); +// fireCourbeAspectChanged(false); +// firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_VALUES, null, _marks); +// return true; +// } + /** + * @param boolean affichent _marks + * @return true si modife + */ + public boolean addMarqueur(EGCourbeMarqueur marqueur){ + getMarqueurs().add(marqueur); + modifyMarqueur(marqueur); + return true; + } + + /** + * Applique les modifs sur le graphe des la modif d'un marqueur. + * @param marqueur + */ + public void modifyMarqueur(EGCourbeMarqueur marqueur){ + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_VALUES, null, marqueur); + } + + /** + * Ajoute un marqueur g\xE9n\xE9rique initialis\xE9 a visible=false. + * @return + */ + public boolean addMarqueur(){ + EGCourbeMarqueur marqueur=new EGCourbeMarqueur(0,false,new TraceLigneModel(),true); + return addMarqueur(marqueur); + } + + public boolean deleteLastMarqueur(){ + if(getMarqueurs().size()>1){ + getMarqueurs().remove(getMarqueurs().size()-1); + return true; + } + return false; + } + + public boolean hideAllMarqueur(){ + for(EGCourbeMarqueur marqueur:getMarqueurs()){ + marqueur.setVisible(false); + } + return true; + } + public EGCourbeMarqueur getMarqueur(int indice){ + if(getMarqueurs()!=null && getMarqueurs().size()>indice) + return getMarqueurs().get(indice); + return null; + } + + + public void setMarqueurs(List<EGCourbeMarqueur> liste){ + listeMarqueurs_=liste; + } + +// /** +// * Crecupere le marqueur min +// * par convention il se trouve en premiere position +// * @return +// */ +// public EGCourbeMarqueur getMarqueurMin(){ +// if(getMarqueurs().size()>0) +// return getMarqueurs().get(0); +// return null; +// } + +// /** +// * Crecupere le marqueur max +// * par convention il se trouve en deuxieme position +// * @return +// */ +// public EGCourbeMarqueur getMarqueurMax(){ +// if(getMarqueurs().size()>1) +// return getMarqueurs().get(1); +// return null; +// } + + + public void setModel(final EGModel _model) { + model_ = _model; + } + + public boolean setTitle(final String _newTitle) { + final boolean res = model_.setTitle(_newTitle); + if (res) { + fireCourbeContentChanged(); + firePropertyChange(BSelecteurTextField.TITLE_PROPERTY, null, model_.getTitle()); + } + return res; + } + + public String toString() { + return getTitle(); + } + + public TraceBox getTbox_() { + return tbox_; + } + + public void setTbox_(TraceBox tbox_) { + this.tbox_ = tbox_; + } + + + public BConfigurePalette getPalette(){ + return paletteEnCours_; + } + + + BConfigurePalette paletteEnCours_=null; + public void setPalette(BConfigurePalette pal){ + paletteEnCours_=pal; + + } + +public static String INDICE_PANEL_SHOW="indicePtoshow"; + public boolean reloadPalette(Map infos){ + + int panelToShow=-1; + if(infos.get(INDICE_PANEL_SHOW)!=null){ + panelToShow= ((Integer)infos.get(INDICE_PANEL_SHOW)).intValue(); + } + + if(paletteEnCours_!=null) + return paletteEnCours_.setPalettePanelTarget(this,panelToShow); + + return false; + } + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -7,6 +7,7 @@ package org.fudaa... [truncated message content] |
From: <had...@us...> - 2009-02-18 20:21:32
|
Revision: 4482 http://fudaa.svn.sourceforge.net/fudaa/?rev=4482&view=rev Author: hadouxad Date: 2009-02-18 20:21:27 +0000 (Wed, 18 Feb 2009) Log Message: ----------- l'interface de lecture de l'aide en pdf est tr?\195?\168s bien avanc?\195?\169e * l'interface est tr?\195?\168s souple: cela lis compl?\195?\168tement le jar de documentation et r?\195?\169cup?\195?\168re le moindre fichier d'extension pdf, la structure doit ?\195?\170tre de pr?\195?\169f?\195?\169rence de niveau 1 (1 niveau de r?\195?\169pertoire) pour simplifier. * cela fonctionne aussi avec un r?\195?\169pertoire de fichiers classiques (non jar) et cette fois ci c'est r?\195?\169cursif (accepte tous les niveaux) * pour la lecture pdf depuis le jar, ?\195?\167a ?\195?\169cris un fichier temporaire , et c'est tr?\195?\168s rapide avec le viewer java (+ rapide qu'avec ceux des os) * on peut choisir le viewer pdf int?\195?\169gr?\195?\169 ou executer depuis son lecteur pdf pr?\195?\169f?\195?\169r?\195?\169 * on peut sauvegarder, ouvrir et imprimer son fichier pdf Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/FudaaHelpPDFViewer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPdfPsExport.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDocPdfFille.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -34,6 +34,7 @@ import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.pdf.CtuluPdfPsExport; /** * @author Fred Deniger Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -1,294 +0,0 @@ -package org.fudaa.ctulu.image; - -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.image.BufferedImage; -import java.awt.image.RenderedImage; -import java.awt.print.PageFormat; -import java.awt.print.Paper; -import java.awt.print.Printable; -import java.awt.print.PrinterException; -import java.awt.print.PrinterJob; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collection; - -import javax.print.Doc; -import javax.print.DocFlavor; -import javax.print.DocPrintJob; -import javax.print.PrintException; -import javax.print.PrintService; -import javax.print.PrintServiceLookup; -import javax.print.SimpleDoc; -import javax.print.StreamPrintService; -import javax.print.StreamPrintServiceFactory; -import javax.print.attribute.HashDocAttributeSet; -import javax.print.attribute.HashPrintRequestAttributeSet; -import javax.print.attribute.PrintRequestAttributeSet; -import javax.print.attribute.standard.Copies; -import javax.print.attribute.standard.MediaSize; -import javax.print.attribute.standard.Sides; -import javax.swing.JTable; - -import org.fudaa.ctulu.CtuluResource; -import org.jdesktop.swingx.painter.ImagePainter; - -import sun.print.PageableDoc; - -import com.db4o.inside.Exceptions4; -import com.lowagie.text.Document; -import com.lowagie.text.DocumentException; -import com.lowagie.text.List; -import com.lowagie.text.PageSize; -import com.lowagie.text.Paragraph; -import com.lowagie.text.Rectangle; -import com.lowagie.text.pdf.PdfContentByte; -import com.lowagie.text.pdf.PdfPCell; -import com.lowagie.text.pdf.PdfPTable; -import com.lowagie.text.pdf.PdfTemplate; -import com.lowagie.text.pdf.PdfWriter; - - -/** - * Classe qui g\xE8re l'exportation pdf et ps. - * utilise la librairie iText. - * @author Adrien Hadoux - */ -public class CtuluPdfPsExport { - - public static String FORMATPdf="pdf"; - public static String FORMATPS="ps"; - - /** - * Format A4 portait - */ - public static Rectangle FORMAT_A4_PORTRAIT=PageSize.A4.rotate(); - public static Rectangle FORMAT_A4=PageSize.A4; - - - public static void write(final RenderedImage _image, final File _targetFile, final String _format) throws DocumentException,IOException,Exception{ - - if(isApdfFormat(_format)) - writePDF(_image, _targetFile, _format); - else - if(isApsFormat(_format)) - writePostScript(_image, _targetFile, _format); - - } - /** - *Un lecteur pdf pour ecrire les images - *@author Adrien Hadoux - */ - public static void writePDF(final RenderedImage _image, final File _targetFile, final String _format) throws DocumentException,IOException{ - int w = _image.getWidth(); - int h = _image.getHeight(); - Document document = new Document(new Rectangle(w,h)); - //-- ajout des infos relatives au document --// - document.addTitle(CtuluResource.CTULU.getString("Exportation PDF")); - document.addAuthor("FUDAA generating document"); - try { - PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(_targetFile)); - document.open(); - PdfContentByte cb = writer.getDirectContent(); - PdfTemplate tp = cb.createTemplate(w, h); - Graphics2D graphics = tp.createGraphics(w, h); - //-- dessin de l'image --// - graphics.drawImage((BufferedImage)_image,0,0,null); - graphics.dispose(); - cb.addTemplate(tp, 0, 0); - } catch (DocumentException ex) { - throw ex; - } catch (IOException ex) { - throw ex; - }finally{ - document.close(); - } - } - - - - -public static class PrintableObject implements Printable{ - BufferedImage image_; - public PrintableObject(BufferedImage img){ - image_=img; - } - public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) - throws PrinterException { - // graphics.drawImage(image_,0,0,image_.getWidth(),image_.getHeight(),null); - - graphics.drawImage(image_,0,0,(int)pageFormat.getWidth(),(int)pageFormat.getHeight(),null); - return 0; - } -} - -/** - *Un lecteur ps - *@author Adrien Hadoux - */ -public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ - PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); - PrinterJob job = PrinterJob.getPrinterJob(); - PageFormat format=new PageFormat(); - Paper paper=new Paper(); - paper.setSize(_image.getWidth(),_image.getHeight()); - paper.setImageableArea(0,0, _image.getWidth(), _image.getHeight()); - format.setPaper(paper); - job.setPrintable(objectToPrint,format); - - String psMimeType = "application/postscript"; - FileOutputStream outstream; - StreamPrintService psPrinter=null; - StreamPrintServiceFactory []spsFactories = - PrinterJob.lookupStreamPrintServices(psMimeType); - if (spsFactories.length > 0) { - try { - outstream = new FileOutputStream(_targetFile); - psPrinter = spsFactories[0].getPrintService(outstream); - // psPrinter can now be set as the service on a PrinterJob - } catch (FileNotFoundException e) { - throw e; - } - } - job.setPrintService(psPrinter); // if app wants to specify this printer. - PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); - aset.add(new Copies(1)); - job.print(aset); - } - - - - - - /** - * Test si le format est un format pdf ou ps - * @param format - * @return - */ - public static boolean isApdfPsFormat(String format){ - return isApdfFormat(format) ||isApsFormat(format); - } - - public static boolean isApdfFormat(String format){ - return format.toLowerCase().equals(FORMATPdf); - } - - - - public static boolean isApsFormat(String format){ - return format.toLowerCase().equals(FORMATPS); - } - /** - * Methode qui ajoute le tableau de data dans le fichier pdf - * @param _data tableau de donn\xE9es - * @param _title titre du tableau - * @param _document document pdf - * @throws DocumentException - * @author Adrien Hadoux - */ - public static void addDataToDocPdf(Object[][] _data,String _title,Document _document) throws DocumentException{ - PdfPTable table = new PdfPTable(2); - //-- titre --// - PdfPCell cell = new PdfPCell(new Paragraph(_title)); - cell.setColspan(2); - table.addCell(cell); - //-- remplissage --// - for(int i=0;i<_data.length;i++) - for(int j=0;j<_data.length;i++) - table.addCell(_data[i][j].toString()); - _document.add(table); - } - - /** - * Methode qui ajoute le tableau de data dans le fichier pdf - * @param _data1 donnees colonnes 1 - * @param _data2 donnees colonnes 2 - * - * @param _title titre du tableau - * @param _document document pdf - * @throws DocumentException - * @author Adrien Hadoux - */ - public static void addDataToDocPdf(java.util.List _data1,java.util.List _data2,String _title,Document _document) throws DocumentException{ - - if(_data1.size()!=_data2.size()) - return; - - PdfPTable table = new PdfPTable(2); - //-- titre --// - PdfPCell cell = new PdfPCell(new Paragraph(_title)); - cell.setColspan(2); - table.addCell(cell); - //-- remplissage --// - for(int i=0;i<_data1.size();i++){ - table.addCell(_data1.get(i).toString()); - table.addCell(_data2.get(i).toString()); - - } - _document.add(table); - } - - /** - * Methode qui ajoute le tableau de data dans le fichier pdf - * @param data1 liste de listes - * @param title titre du tableau - * @param document document pdf - * @throws DocumentException - * @author Adrien Hadoux - */ - public static void addDataToDocPdf(java.util.List<java.util.List> _liste,String _title,Document _document) throws DocumentException{ - PdfPTable table = new PdfPTable(_liste.size()); - //-- titre --// - PdfPCell cell = new PdfPCell(new Paragraph(_title)); - cell.setColspan(_liste.size()); - table.addCell(cell); - //-- remplissage --// - for(java.util.List sousListe:_liste) - for(Object l:sousListe) - table.addCell(l.toString()); - - _document.add(table); - } - - - /** - * Methode qui ajoute le tableau jtable dans le fichier pdf - * @param jtable - * @author Adrien Hadoux - */ - - public static void addJTableToPdf(JTable _tableToadd,PdfWriter _writer){ - PdfContentByte cb = _writer.getDirectContent(); - cb.saveState(); - Graphics2D g2 = cb.createGraphicsShapes(500, 500); - cb.createGraphics(500, 500); - Shape oldClip = g2.getClip(); - g2.clipRect(0, 0, 500, 500); - _tableToadd.print(g2); - g2.setClip(oldClip); - g2.dispose(); - cb.restoreState(); - } - - - /** - * Methode qui ajoute une image dans le fichier pdf - * @param BufferedImage image a ins\xE9rer - * @author Adrien Hadoux - */ - public static void addImageToPdf(BufferedImage _img,PdfWriter _writer,int w,int h){ - PdfContentByte cb = _writer.getDirectContent(); - PdfTemplate tp = cb.createTemplate(w, h); - Graphics2D graphics = tp.createGraphics(w, h); - //-- dessin de l'image --// - graphics.drawImage(_img,0,0,null); - graphics.dispose(); - cb.addTemplate(tp, 0, 0); - - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -63,32 +63,8 @@ }); //-- menus --// - JMenuBar mb = new JMenuBar(); - JMenu file = new JMenu("File"); - file.add(pdfViewer.openAction); - file.add(pdfViewer.closeAction); - file.addSeparator(); - file.add(pdfViewer.pageSetupAction); - file.add(pdfViewer.printAction); - file.addSeparator(); - file.add(pdfViewer.quitAction); - mb.add(file); - JMenu view = new JMenu("View"); - JMenu zoom = new JMenu("Zoom"); - zoom.add(pdfViewer.zoomInAction); - zoom.add(pdfViewer.zoomOutAction); - zoom.add(pdfViewer.fitInWindowAction); - zoom.setEnabled(false); - view.add(zoom); - view.add(pdfViewer.fullScreenAction); - - if (pdfViewer.doThumb) { - view.addSeparator(); - view.add(pdfViewer.thumbAction); - } - - mb.add(view); - setJMenuBar(mb); + + setJMenuBar(pdfViewer.getMenuBar()); Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPanelPdfViewer.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -33,6 +33,7 @@ import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JMenu; +import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextField; @@ -46,6 +47,7 @@ import org.fudaa.ctulu.CtuluUI; +import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; import com.sun.pdfview.Flag; import com.sun.pdfview.FullScreenWindow; @@ -121,7 +123,45 @@ /** the document menu */ JMenu docMenu; + + + + BuMenuBar menuBar_ =null; + /** + * Remplit la barre de menu avec les actions importantes. + * @return + */ + public BuMenuBar getMenuBar(){ + if(menuBar_==null){ + menuBar_=new BuMenuBar(); + JMenu file = new JMenu("File"); + file.add(openAction); + file.add(closeAction); + file.addSeparator(); + file.add(pageSetupAction); + file.add(printAction); + file.addSeparator(); + file.add(quitAction); + menuBar_.add(file); + JMenu view = new JMenu("View"); + JMenu zoom = new JMenu("Zoom"); + zoom.add(zoomInAction); + zoom.add(zoomOutAction); + zoom.add(fitInWindowAction); + zoom.setEnabled(false); + view.add(zoom); + view.add(fullScreenAction); + + if (doThumb) { + view.addSeparator(); + view.add(thumbAction); + } + } + return menuBar_; + } + + /** * utility method to get an icon from the resources of this class * @param name the name of the icon * @return the icon, or null if the icon wasn't found. @@ -289,6 +329,11 @@ } /** + * la toolbar du viewer. + */ + JToolBar toolbar_; + + /** * Initialize this PDFViewer by creating the GUI. */ protected void init() { @@ -317,17 +362,17 @@ //outlinePanel=new BuPanel(); //this.add(outlinePanel,BorderLayout.EAST); //outlinePanel.setBorder(BorderFactory.createTitledBorder("Outline")); - JToolBar toolbar = new JToolBar(); - toolbar.setFloatable(false); + toolbar_ = new JToolBar(); + toolbar_.setFloatable(false); JButton jb; jb = new JButton(firstAction); jb.setText(""); - toolbar.add(jb); + toolbar_.add(jb); jb = new JButton(prevAction); jb.setText(""); - toolbar.add(jb); + toolbar_.add(jb); pageField = new JTextField("-", 3); // pageField.setEnabled(false); pageField.setMaximumSize(new Dimension(45, 32)); @@ -337,22 +382,22 @@ doPageTyped(); } }); - toolbar.add(pageField); + toolbar_.add(pageField); jb = new JButton(nextAction); jb.setText(""); - toolbar.add(jb); + toolbar_.add(jb); jb = new JButton(lastAction); jb.setText(""); - toolbar.add(jb); + toolbar_.add(jb); - toolbar.add(Box.createHorizontalGlue()); + //toolbar_.add(Box.createHorizontalGlue()); fullScreenButton = new JToggleButton(fullScreenAction); fullScreenButton.setText(""); - toolbar.add(fullScreenButton); + toolbar_.add(fullScreenButton); fullScreenButton.setEnabled(true); - toolbar.add(Box.createHorizontalGlue()); + //toolbar_.add(Box.createGlue()); JToggleButton jtb; ButtonGroup bg = new ButtonGroup(); @@ -360,20 +405,20 @@ jtb = new JToggleButton(zoomToolAction); jtb.setText(""); bg.add(jtb); - toolbar.add(jtb); + toolbar_.add(jtb); jtb = new JToggleButton(fitInWindowAction); jtb.setText(""); bg.add(jtb); jtb.setSelected(true); - toolbar.add(jtb); + toolbar_.add(jtb); - toolbar.add(Box.createHorizontalGlue()); + //toolbar_.add(Box.createHorizontalGlue()); jb = new JButton(printAction); jb.setText(""); - toolbar.add(jb); + toolbar_.add(jb); - add(toolbar, BorderLayout.NORTH); + add(toolbar_, BorderLayout.NORTH); setEnabling(); @@ -399,6 +444,11 @@ } } + + public JToolBar getToolBar(){ + return toolbar_; + } + /** * Changes the displayed page, desyncing if we're not on the * same page as a presenter. @@ -594,6 +644,7 @@ JScrollPane jsp = new JScrollPane(jt); //-- ajout dans le outline panel --// + outlinePanel.removeAll(); outlinePanel.add(jsp); this.revalidate(); @@ -610,6 +661,10 @@ } } + public PDFFile getCurFile() { + return curFile; + } + /** * Display a dialog indicating an error. */ Copied: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPdfPsExport.java (from rev 4480, branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPdfPsExport.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPdfPsExport.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -0,0 +1,294 @@ +package org.fudaa.ctulu.pdf; + +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; +import java.awt.print.PageFormat; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collection; + +import javax.print.Doc; +import javax.print.DocFlavor; +import javax.print.DocPrintJob; +import javax.print.PrintException; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.SimpleDoc; +import javax.print.StreamPrintService; +import javax.print.StreamPrintServiceFactory; +import javax.print.attribute.HashDocAttributeSet; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.Copies; +import javax.print.attribute.standard.MediaSize; +import javax.print.attribute.standard.Sides; +import javax.swing.JTable; + +import org.fudaa.ctulu.CtuluResource; +import org.jdesktop.swingx.painter.ImagePainter; + +import sun.print.PageableDoc; + +import com.db4o.inside.Exceptions4; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.List; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfTemplate; +import com.lowagie.text.pdf.PdfWriter; + + +/** + * Classe qui g\xE8re l'exportation pdf et ps. + * utilise la librairie iText. + * @author Adrien Hadoux + */ +public class CtuluPdfPsExport { + + public static String FORMATPdf="pdf"; + public static String FORMATPS="ps"; + + /** + * Format A4 portait + */ + public static Rectangle FORMAT_A4_PORTRAIT=PageSize.A4.rotate(); + public static Rectangle FORMAT_A4=PageSize.A4; + + + public static void write(final RenderedImage _image, final File _targetFile, final String _format) throws DocumentException,IOException,Exception{ + + if(isApdfFormat(_format)) + writePDF(_image, _targetFile, _format); + else + if(isApsFormat(_format)) + writePostScript(_image, _targetFile, _format); + + } + /** + *Un lecteur pdf pour ecrire les images + *@author Adrien Hadoux + */ + public static void writePDF(final RenderedImage _image, final File _targetFile, final String _format) throws DocumentException,IOException{ + int w = _image.getWidth(); + int h = _image.getHeight(); + Document document = new Document(new Rectangle(w,h)); + //-- ajout des infos relatives au document --// + document.addTitle(CtuluResource.CTULU.getString("Exportation PDF")); + document.addAuthor("FUDAA generating document"); + try { + PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(_targetFile)); + document.open(); + PdfContentByte cb = writer.getDirectContent(); + PdfTemplate tp = cb.createTemplate(w, h); + Graphics2D graphics = tp.createGraphics(w, h); + //-- dessin de l'image --// + graphics.drawImage((BufferedImage)_image,0,0,null); + graphics.dispose(); + cb.addTemplate(tp, 0, 0); + } catch (DocumentException ex) { + throw ex; + } catch (IOException ex) { + throw ex; + }finally{ + document.close(); + } + } + + + + +public static class PrintableObject implements Printable{ + BufferedImage image_; + public PrintableObject(BufferedImage img){ + image_=img; + } + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) + throws PrinterException { + // graphics.drawImage(image_,0,0,image_.getWidth(),image_.getHeight(),null); + + graphics.drawImage(image_,0,0,(int)pageFormat.getWidth(),(int)pageFormat.getHeight(),null); + return 0; + } +} + +/** + *Un lecteur ps + *@author Adrien Hadoux + */ +public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ + PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); + PrinterJob job = PrinterJob.getPrinterJob(); + PageFormat format=new PageFormat(); + Paper paper=new Paper(); + paper.setSize(_image.getWidth(),_image.getHeight()); + paper.setImageableArea(0,0, _image.getWidth(), _image.getHeight()); + format.setPaper(paper); + job.setPrintable(objectToPrint,format); + + String psMimeType = "application/postscript"; + FileOutputStream outstream; + StreamPrintService psPrinter=null; + StreamPrintServiceFactory []spsFactories = + PrinterJob.lookupStreamPrintServices(psMimeType); + if (spsFactories.length > 0) { + try { + outstream = new FileOutputStream(_targetFile); + psPrinter = spsFactories[0].getPrintService(outstream); + // psPrinter can now be set as the service on a PrinterJob + } catch (FileNotFoundException e) { + throw e; + } + } + job.setPrintService(psPrinter); // if app wants to specify this printer. + PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); + aset.add(new Copies(1)); + job.print(aset); + } + + + + + + /** + * Test si le format est un format pdf ou ps + * @param format + * @return + */ + public static boolean isApdfPsFormat(String format){ + return isApdfFormat(format) ||isApsFormat(format); + } + + public static boolean isApdfFormat(String format){ + return format.toLowerCase().equals(FORMATPdf); + } + + + + public static boolean isApsFormat(String format){ + return format.toLowerCase().equals(FORMATPS); + } + /** + * Methode qui ajoute le tableau de data dans le fichier pdf + * @param _data tableau de donn\xE9es + * @param _title titre du tableau + * @param _document document pdf + * @throws DocumentException + * @author Adrien Hadoux + */ + public static void addDataToDocPdf(Object[][] _data,String _title,Document _document) throws DocumentException{ + PdfPTable table = new PdfPTable(2); + //-- titre --// + PdfPCell cell = new PdfPCell(new Paragraph(_title)); + cell.setColspan(2); + table.addCell(cell); + //-- remplissage --// + for(int i=0;i<_data.length;i++) + for(int j=0;j<_data.length;i++) + table.addCell(_data[i][j].toString()); + _document.add(table); + } + + /** + * Methode qui ajoute le tableau de data dans le fichier pdf + * @param _data1 donnees colonnes 1 + * @param _data2 donnees colonnes 2 + * + * @param _title titre du tableau + * @param _document document pdf + * @throws DocumentException + * @author Adrien Hadoux + */ + public static void addDataToDocPdf(java.util.List _data1,java.util.List _data2,String _title,Document _document) throws DocumentException{ + + if(_data1.size()!=_data2.size()) + return; + + PdfPTable table = new PdfPTable(2); + //-- titre --// + PdfPCell cell = new PdfPCell(new Paragraph(_title)); + cell.setColspan(2); + table.addCell(cell); + //-- remplissage --// + for(int i=0;i<_data1.size();i++){ + table.addCell(_data1.get(i).toString()); + table.addCell(_data2.get(i).toString()); + + } + _document.add(table); + } + + /** + * Methode qui ajoute le tableau de data dans le fichier pdf + * @param data1 liste de listes + * @param title titre du tableau + * @param document document pdf + * @throws DocumentException + * @author Adrien Hadoux + */ + public static void addDataToDocPdf(java.util.List<java.util.List> _liste,String _title,Document _document) throws DocumentException{ + PdfPTable table = new PdfPTable(_liste.size()); + //-- titre --// + PdfPCell cell = new PdfPCell(new Paragraph(_title)); + cell.setColspan(_liste.size()); + table.addCell(cell); + //-- remplissage --// + for(java.util.List sousListe:_liste) + for(Object l:sousListe) + table.addCell(l.toString()); + + _document.add(table); + } + + + /** + * Methode qui ajoute le tableau jtable dans le fichier pdf + * @param jtable + * @author Adrien Hadoux + */ + + public static void addJTableToPdf(JTable _tableToadd,PdfWriter _writer){ + PdfContentByte cb = _writer.getDirectContent(); + cb.saveState(); + Graphics2D g2 = cb.createGraphicsShapes(500, 500); + cb.createGraphics(500, 500); + Shape oldClip = g2.getClip(); + g2.clipRect(0, 0, 500, 500); + _tableToadd.print(g2); + g2.setClip(oldClip); + g2.dispose(); + cb.restoreState(); + } + + + /** + * Methode qui ajoute une image dans le fichier pdf + * @param BufferedImage image a ins\xE9rer + * @author Adrien Hadoux + */ + public static void addImageToPdf(BufferedImage _img,PdfWriter _writer,int w,int h){ + PdfContentByte cb = _writer.getDirectContent(); + PdfTemplate tp = cb.createTemplate(w, h); + Graphics2D graphics = tp.createGraphics(w, h); + //-- dessin de l'image --// + graphics.drawImage(_img,0,0,null); + graphics.dispose(); + cb.addTemplate(tp, 0, 0); + + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluPdfPsExport.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/FudaaHelpPDFViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/FudaaHelpPDFViewer.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/FudaaHelpPDFViewer.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -1,26 +1,55 @@ package org.fudaa.fudaa.commun; import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; +import javax.swing.JMenuBar; import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.tree.TreePath; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.pdf.CtuluPanelPdfViewer; +import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract.SelectionMode; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.tr.common.TrResource; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; +import com.memoire.bu.BuFileChooser; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuPanel; import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuResource; +import com.sun.org.apache.bcel.internal.generic.ATHROW; /** @@ -52,160 +81,606 @@ */ public class FudaaHelpPDFViewer extends BuInternalFrame implements ListSelectionListener{ /** - * La liste des projet afffichage graphique. - */ - public JXTreeTable treePost_; - - /** - * Reperttoire qui contient l'arborescence de fichiers aide. - */ - File repertoireFichiersAide_; - - - /** - * modele structure arborescente - */ - DefaultTreeTableModel modelList_; - - - BuRadioButton useOsPdfViewer_=new BuRadioButton(FudaaLib.getS("Utiliser le lecteur pdf du syst\xE8me d'explloitation")); - BuRadioButton useCtuluPdfViewer_=new BuRadioButton(FudaaLib.getS("Utiliser le lecteur pdf int\xE9gr\xE9 \xE0 Fudaa"));; - - - public FudaaHelpPDFViewer(File repertoireAide) { - this(); - repertoireFichiersAide_=repertoireAide; - } - - FudaaHelpPDFViewer() { - super(); - - // --creation du modele--// - modelList_ = new DefaultTreeTableModel(constructStructureModel()); - - - - treePost_=new JXTreeTable(); - //-- listener du tree --// - treePost_.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(final MouseEvent e) { - if (e.isPopupTrigger() && e.getClickCount() == 1) { - affichePdfNode(e.getX(), e.getY()); + * La liste des projet afffichage graphique. + */ + public JXTreeTable treePost_; - } - } + + + /** + * Jar qui contient l'arborescence de fichiers aide. + */ + String patJarDocAide_; - - public void mouseReleased(final MouseEvent e) { - if (e.isPopupTrigger() && e.getClickCount() == 1) { - affichePdfNode(e.getX(), e.getY()); - } - } - }); - - treePost_.setBorder(BorderFactory.createEtchedBorder()); - setTitle(FudaaLib.getS("Aide Fudaa")); - final JScrollPane listScroller = new JScrollPane(treePost_); - this.add(listScroller, BorderLayout.CENTER); - final BuPanel operationPanel = new BuPanel(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER)); - this.add(operationPanel, BorderLayout.SOUTH); - operationPanel.add(useOsPdfViewer_); - operationPanel.add(useCtuluPdfViewer_); - - - ButtonGroup group=new ButtonGroup(); - group.add(useOsPdfViewer_); - group.add(useCtuluPdfViewer_); - useOsPdfViewer_.setSelected(true); - - } - - - /** - * Construit le model du tableau. - * @return - */ - public DefaultMutableTreeTableNode constructStructureModel() { - - if(repertoireFichiersAide_==null || ! repertoireFichiersAide_.isDirectory()) - return new DefaultMutableTreeTableNode(FudaaLib.getS("Pas de documentation ")); - - //-- root de l'arborescence --// - DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode(FudaaLib.getS("Aide")+" "+repertoireFichiersAide_.getName()); + /** + * Map qui enregistre l'ensemble des fichiers pdf disponibles dans le fichier jar. + */ + public Map<String, JarEntry> mapEntryPdfJar_; + + /** + * File qui contient l'arborescence de fichiers aide. + */ + File fileDocAide_; - //-- ajout recursivement le contenu du reperttoire a l'arbre --// - addRecursiveFilesToTree(root, repertoireFichiersAide_); - - - return root; - } - - /** - * Ajout recursif des fichiers du repertoire d'aide. - * @param parent - * @param repertoire - */ - public void addRecursiveFilesToTree(DefaultMutableTreeTableNode parent,File repertoire){ - - //-- Repertoire ou se situent les fichiers d'aide --// - for(int i=0;i<repertoireFichiersAide_.listFiles().length;i++){ - File fichier=repertoireFichiersAide_.listFiles()[i]; - if(fichier!=null){ - if(fichier.isDirectory()){ - //-- si un repertoire l'user object est un simple nom de fichier et non pas un objet File --// - DefaultMutableTreeTableNode nodeRepertoire=new DefaultMutableTreeTableNode(fichier.getName()); - parent.add(nodeRepertoire); - //-- on ajoute recursivement le contenu du repertoire fils --// - addRecursiveFilesToTree(nodeRepertoire, repertoire); - - }else{ - DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(fichier); - //-- on ajoute le node qui contient le File --// - parent.add(node); - - } - } - } - - } - - /** - * Affiche le fichier pdf correspondant au feuille cliqu\xE9 - * @param x - * @param y - */ - public void affichePdfNode(final int x, final int y) { - // Get the tree element under the mouse - final TreePath clickedElement = treePost_.getPathForLocation(x, y); - MutableTreeTableNode treeNode = null; - if (clickedElement != null) treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent(); - if (treeNode != null) { - // -- recuperation du node associe --// - String pathFichier =null; - if(treeNode.getUserObject() instanceof String) - pathFichier=(String) treeNode.getUserObject(); - else - if(treeNode.getUserObject() instanceof File){ - pathFichier=((File)treeNode.getUserObject()).getAbsolutePath(); - } - if(pathFichier==null) - return; - //-- ouverture dans le viewer du fichier pdf slectionn\xE9 --// + /** + * Boolean qui indique si on recupere la doc depuis un repertoire classique ou un jar. + */ + boolean useJarAide=true; - - // TODO lecture du fichier + /** + * modele structure arborescente + */ + DefaultTreeTableModel modelList_; + ArrayList<String> listeColonnesModel_=new ArrayList<String>(); - } + BuRadioButton useOsPdfViewer_=new BuRadioButton(FudaaLib.getS("Utiliser le lecteur pdf du syst\xE8me d'explloitation")); + BuRadioButton useCtuluPdfViewer_=new BuRadioButton(FudaaLib.getS("Utiliser le lecteur pdf int\xE9gr\xE9 \xE0 Fudaa"));; - } - - - - - public void valueChanged(ListSelectionEvent e) { + /** + * IHM lecteur pdf fudaa + */ + CtuluPanelPdfViewer pdfViewer; + /** + * Implementation mere + */ + CtuluUI ui_; + BuPanel outlinePanel; + BuPanel thumbscrollContainer; + BuPanel conteneurPdf_; + + + /** + * path par defaut de la documentation + */ + public final static String PATH_JAR_DOCUM="C:\\devel\\FUDAAdocumentation.jar"; + + /** + * Constructeur pour la creation de l'interface Fudaa. + * @param fichierJar nom du jar \xE0 utiliser (celui qui contient la doc). Peut etre le jar logiciel lui meme. + * @param _ui implementaion fudaa. + * @param useThumbs Utilise ou non les apercu images des pages (pour un gain de place, mettre \xE0 false). + */ + public FudaaHelpPDFViewer(String pathFichierJar,CtuluUI _ui,boolean useThumbs) { + ui_=_ui; + //-- tentative de verification que le jar existe bien a cet emplacement --// + //TODO a decommenter virer le lien en dur, pour dev et test + pathFichierJar=PATH_JAR_DOCUM; + patJarDocAide_=verifPathForJarIsCorrect(pathFichierJar); + + + // --creation du modele depuis un fichier jar ou un r\xE9pertoire classique selon le constructeur appel\xE9.--// + listeColonnesModel_.add(FudaaResource.FUDAA.getString("Aide disponible")); + modelList_ = new DefaultTreeTableModel(constructStructureModelWithJAREntree(),listeColonnesModel_); + + constructFudaaHelpPDFViewer(useThumbs); } + + /** + * Verifie que le chemin saisi contient bien un jar sinon demande correction a l'utilisateur. + * @param pathPresumePourJar + * @return + */ + public String verifPathForJarIsCorrect(String pathPresumePourJar){ + File test=new File(pathPresumePourJar); + if(test==null || !test.exists() || test.isDirectory()){ + + ui_.error(FudaaResource.FUDAA.getString("Erreur, Il n'y a pas de fichier jar de document \xE0 l'adresse suivante: "+pathPresumePourJar)); + + BuFileChooser chooser=new BuFileChooser(); + int rep=chooser.showOpenDialog(ui_.getParentComponent()); + if(rep==BuFileChooser.APPROVE_OPTION){ + pathPresumePourJar=chooser.getSelectedFile().getAbsolutePath(); + } + + } + return pathPresumePourJar; + + } + + + public FudaaHelpPDFViewer(File fichier,CtuluUI _ui,boolean useThumbs) { + ui_=_ui; + fileDocAide_=fichier; + useJarAide=false; + // --creation du modele depuis un fichier jar ou un r\xE9pertoire classique selon le constructeur appel\xE9.--// + listeColonnesModel_.add(FudaaResource.FUDAA.getString("Aide disponible")); + modelList_ = new DefaultTreeTableModel(constructStructureModelWithFileEntree(),listeColonnesModel_); + + constructFudaaHelpPDFViewer(useThumbs); + } + + + + private void constructFudaaHelpPDFViewer(boolean useThumbs) { + + treePost_=new JXTreeTable(modelList_); + //-- listener du tree --// + treePost_.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(final MouseEvent e) { + if ( e.getClickCount() == 2) { + affichePdfNode(e.getX(), e.getY()); + + } + } + + +// public void mouseReleased(final MouseEvent e) { +// if ( e.getClickCount() == 2) { +// affichePdfNode(e.getX(), e.getY()); +// } +// } + }); + treePost_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + treePost_.setBorder(BorderFactory.createEtchedBorder()); + treePost_.setEditable(false); + setTitle(FudaaLib.getS("Aide Fudaa")); + final JScrollPane listScroller = new JScrollPane(treePost_); + listScroller.setBorder(BorderFactory.createTitledBorder(FudaaResource.FUDAA.getString("Menu des fichiers"))); + + final BuPanel operationPanel = new BuPanel(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER)); + operationPanel.add(useOsPdfViewer_); + operationPanel.add(useCtuluPdfViewer_); + + + ButtonGroup group=new ButtonGroup(); + group.add(useOsPdfViewer_); + group.add(useCtuluPdfViewer_); + + + //-- construction de l'interface pdf--// + outlinePanel=new BuPanel(); + outlinePanel.setBorder(BorderFactory.createTitledBorder("Chapitres")); + thumbscrollContainer=new BuPanel(); + thumbscrollContainer.setBorder(BorderFactory.createTitledBorder(CtuluResource.CTULU.getString("Pages"))); + + pdfViewer=new CtuluPanelPdfViewer(useThumbs,ui_,outlinePanel,thumbscrollContainer); + + conteneurPdf_=new BuPanel(new BorderLayout()); +// JSplitPane panePdf=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); +// panePdf.setTopComponent(pdfViewer); +// panePdf.setBottomComponent(outlinePanel); + // panePdf.setDividerLocation(800); + conteneurPdf_.add(pdfViewer,BorderLayout.CENTER); + conteneurPdf_.add(new JScrollPane(outlinePanel),BorderLayout.EAST); + conteneurPdf_.add(operationPanel, BorderLayout.SOUTH); + + //-- ajotu des thumbnails si activ\xE9--// + if(useThumbs) + conteneurPdf_.add(thumbscrollContainer,BorderLayout.WEST); + + final JSplitPane pane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + pane.setTopComponent(listScroller); + pane.setBottomComponent(conteneurPdf_); + pane.setDividerLocation(250); + + this.setLayout(new BorderLayout()); +// this.add(conteneurPdf_,BorderLayout.CENTER); +// this.add(listScroller, BorderLayout.WEST); + this.add(pane,BorderLayout.CENTER); + useCtuluPdfViewer_.setSelected(true); + + useOsPdfViewer_.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + pane.remove(conteneurPdf_); + + rafraichir(); + } + + }); + useCtuluPdfViewer_.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + pane.setBottomComponent(conteneurPdf_); + pane.setDividerLocation(250); + rafraichir(); + } + + }); + + + //--MenuBarre --// + JMenuBar bm=pdfViewer.getMenuBar(); + this.setJMenuBar(bm); + + //-- construction de la toolbar --// + + BuResource.BU.getToolIcon("pleinecran"); + BuResource.BU.loadToolCommandIcon("RAFRAICHIR"); + + this.add(pdfViewer.getToolBar(),BorderLayout.NORTH); + EbliActionSimple action =new EbliActionSimple(FudaaResource.FUDAA.getString("Sauvegarder"),FudaaResource.FUDAA.getToolIcon("pdfdoc"),"SAUVERPDF"){ + public void actionPerformed(ActionEvent _e) { + sauvegarderFichierPdf(); + } + }; + pdfViewer.getToolBar().add(action.buildToolButton(EbliComponentFactory.INSTANCE),0); + action =new EbliActionSimple(FudaaResource.FUDAA.getString("Rafraichir"),FudaaResource.FUDAA.getToolIcon("RAFRAICHIR"),"RAFRAICHIRPDF"){ + public void actionPerformed(ActionEvent _e) { + rafraichir(); + } + }; + pdfViewer.getToolBar().add(action.buildToolButton(EbliComponentFactory.INSTANCE),0); + + pdfViewer.getToolBar().add(useCtuluPdfViewer_); + pdfViewer.getToolBar().add(useOsPdfViewer_); + + //-- initialiser le pdfviewer interne avec le premier pdf feuille de la liste --// + if(useJarAide){ + //useCtuluPdfViewer_.setSelected(true); + if(mapEntryPdfJar_!=null){ + openPdfJar(mapEntryPdfJar_.get(mapEntryPdfJar_.keySet().iterator().next())); + } + + } + } + + + /** + * Construit le model du tableau si l'aides est propos\xE9es depuis un repertoire classique. + * @return + */ + public DefaultMutableTreeTableNode constructStructureModelWithFileEntree() { + + if(fileDocAide_==null || ! fileDocAide_.isDirectory()) + return new DefaultMutableTreeTableNode(FudaaLib.getS("Pas de documentation ")); + + //-- root de l'arborescence --// + DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode(FudaaLib.getS("Aide")+" "+fileDocAide_.getName()); + + //-- ajout recursivement le contenu du reperttoire a l'arbre --// + addRecursiveFilesToTree(root, fileDocAide_); + + return root; + } + + /** + * Ajout recursif des fichiers du repertoire d'aide. + * @param parent + * @param repertoire + */ + public void addRecursiveFilesToTree(DefaultMutableTreeTableNode parent,File repertoire){ + + //-- Repertoire ou se situent les fichiers d'aide --// + for(int i=0;i<repertoire.listFiles().length;i++){ + File fichier=repertoire.listFiles()[i]; + if(fichier!=null){ + if(fichier.isDirectory()){ + //-- si un repertoire l'user object est un simple nom de fichier et non pas un objet File --// + DefaultMutableTreeTableNode nodeRepertoire=new DefaultMutableTreeTableNode(fichier.getName()); + parent.add(nodeRepertoire); + //-- on ajoute recursivement le contenu du repertoire fils --// + addRecursiveFilesToTree(nodeRepertoire, fichier); + + }else{ + DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(fichier); + //-- on ajoute le node qui contient le File --// + parent.add(node); + + } + } + } + + } + + + + /** + * Construit le model du tableau si l'aides est propos\xE9es d'un fichier jar d'aide. + * @return + */ + public DefaultMutableTreeTableNode constructStructureModelWithJAREntree() { + + mapEntryPdfJar_=new HashMap<String, JarEntry>(); + + if(patJarDocAide_==null ) + return new DefaultMutableTreeTableNode(FudaaLib.getS("Pas de documentation ")); + + JarFile jarDocAide=null; + try { + jarDocAide=new JarFile(patJarDocAide_); + } catch (IOException e1) { + ui_.error(FudaaResource.FUDAA.getString("Erreur, Fichier documentation jar inexact \n Il n'existe pas de fichier jar \xE0 l'emplacement: "+patJarDocAide_)); + + return new DefaultMutableTreeTableNode(FudaaLib.getS("Pas de documentation ")); + } + if(jarDocAide==null ) + return new DefaultMutableTreeTableNode(FudaaLib.getS("Pas de documentation ")); + + //-- root de l'arborescence --// + DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode(FudaaLib.getS("Aide")/*+" "+jarDocAide.getName()*/); + + //-- ajout recursivement le contenu du reperttoire a l'arbre --// + addFilesFromJarToTree(root, jarDocAide.entries()); + + //-- fermeture du jar doc --// + try { + jarDocAide.close(); + } catch (IOException e) { + ui_.error(FudaaResource.FUDAA.getString("Erreur, Impossible de fermer le flux de lecture du jar: "+patJarDocAide_)); + } + + return root; + } + + /** + * Ajout recursif des fichiers d'un fichier jar d'aide. + * N'accepte aue des jar de repertoire de profondeur 1. + * @param root + * @param repertoire + */ + public void addFilesFromJarToTree(DefaultMutableTreeTableNode root,Enumeration<JarEntry> listeEntries){ + //-- map qui stocke l'ensemble des nodes de niveau 1, ce sont ces nodes qui vont attacher les noeuds feuilles pdf --// + HashMap<String, DefaultMutableTreeTableNode> mapSousRepertoireNiveau1=new HashMap<String, DefaultMutableTreeTableNode>(); + + //-- Repertoire ou se situent les fichiers d'aide --// + while(listeEntries.hasMoreElements()){ + + //-- recuperation de l'entree jar --// + JarEntry entry=listeEntries.nextElement(); + if(entry!=null){ + if(entry.isDirectory()){ + //-- si un repertoire l'user object est un simple nom de fichier et non pas un objet File --// +// DefaultMutableTreeTableNode nodeRepertoire=new DefaultMutableTreeTableNode(entry.getName()); +// parent.add(nodeRepertoire); +// //-- on ajoute recursivement le contenu du repertoire fils --// + //addRecursiveFilesFromJarToTree(nodeRepertoire, entry.); + }else{ + //-- recuperation du nom du repertoire --// + String nomRepertoire=null; + + + //-- tentative de recuperation du nom de rep --// + int deb=0; + int fin=entry.getName().lastIndexOf("/"); + if(fin!=-1) + nomRepertoire=(entry.getName()).substring(deb, fin); + + //-- si nom repertoire est null, ceci est un pdf niveau 0 --// + if(nomRepertoire==null){ + + //-- on verifie qu'il s'agit bien d'un fichier pdf --// + if(entry.getName().contains(".pdf")){ + mapEntryPdfJar_.put(entry.getName(), entry); + DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(entry.getName()); + //-- on ajoute le node qui contient le File --// + root.add(node); + } + }else{ + if(entry.getName().contains(".pdf")){ + //-- on tente de recuperer le node associ\xE9 a ce repertoire --// + DefaultMutableTreeTableNode nodeRepertoire=mapSousRepertoireNiveau1.get(nomRepertoire); + //-- si on ne trouve pas de node associ\xE9, on en cree 1 et on l'ajoute dans la map --// + if(nodeRepertoire==null){ + nodeRepertoire=new DefaultMutableTreeTableNode(nomRepertoire); + mapSousRepertoireNiveau1.put(nomRepertoire, nodeRepertoire); + + } + //-- creation du node entry pdf --// + + //-- recuperation du no du fichier --// + String nomFichierPdf=entry.getName().replace(nomRepertoire+"/","").replace("+"," "); + mapEntryPdfJar_.put(nomFichierPdf, entry); + DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(nomFichierPdf); + nodeRepertoire.add(node); + } + } + + + } + } + } + + //-- on ajoute au parent les node de tous les repertoire de la map --// + for(String key:mapSousRepertoireNiveau1.keySet()){ + if(!key.equals("META-INF")){ + DefaultMutableTreeTableNode nodeRep=mapSousRepertoireNiveau1.get(key); + if(nodeRep!=null) + root.add(nodeRep); + } + } + + } + + + /** + * Affiche le fichier pdf correspondant au feuille cliqu\xE9 + * @param x + * @param y + */ + public void affichePdfNode(final int x, final int y) { + // Get the tree element under the mouse + final TreePath clickedElement = treePost_.getPathForLocation(x, y); + MutableTreeTableNode treeNode = null; + if (clickedElement != null) treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent(); + if (treeNode != null) { + // -- recuperation du node associe --// + String nomNoeud =null; + File fichierChoisi=null; + JarEntry jarEntryChoisie=null; + if(treeNode.getUserObject() instanceof String) + nomNoeud=(String) treeNode.getUserObject(); + else + if(treeNode.getUserObject() instanceof File){ + fichierChoisi=(File)treeNode.getUserObject(); + } +// else if(treeNode.getUserObject() instanceof JarEntry){ +// jarEntryChoisie=(JarEntry)treeNode.getUserObject(); +// } + + + if(fichierChoisi==null && nomNoeud==null ) + return; + //-- ouverture dans le viewer du fichier pdf slectionn\xE9 selon le mode pdf ou file--// + + if(fichierChoisi!=null){ + openPdfFile(fichierChoisi); + }else if(mapEntryPdfJar_!=null){ + //-- on tente de recuperer la jar entry pour le nom de fichier specifie --// + jarEntryChoisie=mapEntryPdfJar_.get(nomNoeud); + if(jarEntryChoisie!=null) + openPdfJar(jarEntryChoisie); + } + + + } + + } + + /** + * retourne le fichier courant. + * @return + */ + JarEntry getCurrentJarEntry(){ + return currentJarEntry_; + } + + void rafraichir(){ + pdfViewer.revalidate(); + this.revalidate(); + + } + + /** + * le jar entry en train d'etre test\xE9. + */ + JarEntry currentJarEntry_=null; + /** + * Methode qui ouvre le fichier pdf sp\xE9cifi\xE9 par un fichier dur. + * @param fichier + */ + public void openPdfFile(File fichier){ + try { + if(this.useOsPdfViewer_.isSelected()){ + //-- ouverture du fichier pdf avec le viewer os --// + final String os = System.getProperty("os.name"); + + if (os.startsWith("Windows")) { + //-- sous crosoft --// + Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+fichier.getAbsolutePath()+""); + //p.waitFor(); + }else { + //-- linux power --// + + } + }else{ + //-- ouverture du fichier pdf avec le viewer fudaa --// + this.pdfViewer.openFile(fichier); + + } + } catch (Exception e) { + e.printStackTrace(); + ui_.error(FudaaResource.FUDAA.getString("Impossible d'ouvrir le fichier pdf "+fichier.getName())); + } + + //-- mise a jour de tous les composants --// + this.rafraichir(); + } + + + + /** + * Methode qui ouvre le fichier pdf sp\xE9cifi\xE9 par un fichier dur. + * @param fichier + */ + public void openPdfJar(JarEntry jarEntry){ + //-- creation d'un fichier temporaire depuis la jar entry specifiee ---// + File fileTemporaire=null; + try { + fileTemporaire = File.createTempFile("tmpPDF",".pdf"); + } catch (IOException e) { + ui_.error(FudaaResource.FUDAA.getString("Impossible de g\xE9n\xE9rer un fichier temporaire...")); + return; + } + generateFileFromJar(jarEntry,fileTemporaire); + currentJarEntry_=jarEntry; + + //-- ouverture du fichier pdf --// + openPdfFile(fileTemporaire); + } + + + /** + * Algo de generation du fichier depuis un format jar + * @param entry + * @return + * @throws IOException + */ + private void generateFileFromJar(JarEntry entry, File fTemp) { + JarFile jarDocAide=null; + FileOutputStream file =null; + InputStream entryStream =null; + + try{ + try { + jarDocAide=new JarFile(patJarDocAide_); + } catch (IOException e1) { + ui_.error(FudaaResource.FUDAA.getString("Erreur, Fichier documentation jar inexact \n Il n'existe pas de fichier jar \xE0 l'emplacement: "+patJarDocAide_)); + return ; + } + if(jarDocAide==null) + return ; + + entryStream = jarDocAide.getInputStream(entry); + + //-- creation d' un fichier output --// + file = new FileOutputStream(fTemp); + + + //-- buffer de lecture --// + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = entryStream.read(buffer)) != -1) { + file.write(buffer, 0, bytesRead); + } + System.out.println(entry.getName() + " extrait."); + }catch(IOException e){ + ui_.error(FudaaResource.FUDAA.getString("Impossible d'extraire le fichier depuis le fichier jar "+entry.getName())); + } + + finally { + try { + file.close(); + entryStream.close(); + jarDocAide.close(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + + + + } + + /** + * Methode qui sauvegarde le fichier en cours de lecture sur l'emplacement voulu. + */ + public void sauvegarderFichierPdf(){ + JarEntry fichierJar=getCurrentJarEntry(); + if(fichierJar==null) + return; + File fichierDest=null; + BuFileChooser chooser=new BuFileChooser(); + int rep=chooser.showOpenDialog(ui_.getParentComponent()); + if(rep==BuFileChooser.APPROVE_OPTION){ + fichierDest=chooser.getSelectedFile(); + } + + if(fichierDest!=null){ + generateFileFromJar(fichierJar, fichierDest); + + } + + + } + + public void valueChanged(ListSelectionEvent e) { + + + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -28,8 +28,6 @@ */ public class ScopeCourbeModel extends FudaaCourbeModel{ - - /** * Map d'informations specifiques scop qui a permi de generer ce model de courbe. */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -72,6 +72,7 @@ import org.fudaa.fudaa.commun.FudaaAstuces; import org.fudaa.fudaa.commun.FudaaAstucesAbstract; import org.fudaa.fudaa.commun.FudaaBrowserControl; +import org.fudaa.fudaa.commun.FudaaHelpPDFViewer; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.FudaaTee; import org.fudaa.fudaa.commun.FudaaUI; @@ -472,7 +473,8 @@ ((CtuluSelectionInterface) frame).inverseSelection(); } } else if (action.equals("AIDE")) { - displayHelp(null); + //displayHelp(null); + displayHelpPDF(getInformationsSoftware().baseManUrl()); } else if (action.equals("AIDE_INDEX")) { displayHelp(getInformationsSoftware().baseManUrl()); } else if (action.equals("INDEX_ALPHA")) { @@ -497,6 +499,22 @@ .isCreated()); } + + FudaaHelpPDFViewer frameHelpPDF_; + + /** + * Affiche la fenetre de viewer pdf + */ + public void displayHelpPDF(String url){ + if(frameHelpPDF_==null){ + frameHelpPDF_=new FudaaHelpPDFViewer(url,this,true); + } + //-- ajout de la fenetre --//: + // this.addInternalFrame(frameHelpPDF_); + //TODO a modifier, juste pour le debugger et test + this.addInternalFrame(new FudaaHelpPDFViewer(url,this,false)); + } + protected void rebuildEditionMenu(final BuMenu _dest) { int indSelect=_dest.indexOf("TOUTSELECTIONNER"); _dest.remove(indSelect+2); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -256,7 +256,7 @@ } public boolean isModifiable() { - return false; + return true; } public boolean isPointDrawn(final int _i) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -339,9 +339,11 @@ }*/ else if ("OUVRIR".equals(act)) { ouvrir(); } else if ("AIDE".equals(act)) { - displayAide(); + //displayAide(); + displayHelpPDF(getInformationsSoftware().baseManUrl()); } else if ("AIDE_INDEX".equals(act)) { - displayAideIndex(); + // displayAideIndex(); + displayHelpPDF(getInformationsSoftware().baseManUrl()); } else if ("MAJ".equals(act)) { maj(); } else if ("SEND_COMMENT".equals(act)) { Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDocPdfFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDocPdfFille.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDocPdfFille.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -1,23 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.io.File; - -import org.fudaa.fudaa.commun.FudaaHelpPDFViewer; - - -/** - * gere les aide fudaa du POST au format pdf. - * - * @author Adrien Hadoux - * - */ -public class TrPostDocPdfFille extends FudaaHelpPDFViewer{ - - public TrPostDocPdfFille(File repertoireAide) { - super(repertoireAide); - - } - - - -} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java 2009-02-18 14:04:57 UTC (rev 4481) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java 2009-02-18 20:21:27 UTC (rev 4482) @@ -14,7 +14,7 @@ import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; -import org.fudaa.ctulu.image.CtuluPdfPsExport; +import org.fudaa.ctulu.pdf.CtuluPdfPsExport; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliWidget; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |