From: <de...@us...> - 2008-09-07 20:49:42
|
Revision: 3896 http://fudaa.svn.sourceforge.net/fudaa/?rev=3896&view=rev Author: deniger Date: 2008-09-07 20:49:47 +0000 (Sun, 07 Sep 2008) Log Message: ----------- modifs Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMove.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.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/EbliWidgetActionFont.java 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/EbliWidgetActionImageChooser.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/EbliWidgetActionSimple.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/actions/EbliWidgetEditCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.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/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.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/graphe/WidgetLegendeManagerOLD.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.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/TrPostLayoutFille.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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetDegroupAction.java 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/layout/GroupLayout.java 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 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -32,20 +32,16 @@ */ protected Map<String, Object> propGraphique; - public Map<String, Object> getPropGraphique() { return propGraphique; } public void setPropGraphique(Map<String, Object> propGraphique) { this.propGraphique = propGraphique; - - + } protected EbliWidgetController controller_; - - /** * Liste des clef utilisees pour les composants graphiques @@ -53,8 +49,7 @@ public final static String LINEMODEL = "lineModel"; public final static String COLORCONTOUR = "ColorContour"; public final static String COLORFOND = "colorFond"; - - + public final static String ROTATION = "rotation"; public final static String FONT = "font"; @@ -68,10 +63,12 @@ public BConfigurableInterface[] getConfigureInterfaces(boolean lineModel_, boolean colorsContours_, boolean colorFonds_, boolean rotations_, boolean police_) { return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(lineModel_, - colorsContours_, colorFonds_, rotations_, police_), EbliLib - .getS("Affichage")) /* - * , new BConfigurableComposite(getSingleConfigureInterface (), EbliLib.getS("Gizmo caca")) - */}; + colorsContours_, colorFonds_, rotations_, police_), EbliLib.getS("Affichage")) /* + * , newBConfigurableComposite( + * getSingleConfigureInterface + * (), + * EbliLib.getS("Gizmo caca")) + */}; } protected String getTitle() { @@ -175,30 +172,28 @@ public boolean isTitleModifiable() { return true; } - + /** - * Utilise par la plupart des composant sauf calque et graphe qui necessitent - * un controller particulier. + * Utilise par la plupart des composant sauf calque et graphe qui necessitent un controller particulier. * * @param scene * @param controllerDefaut */ public EbliWidget(EbliScene scene, boolean controllerDefaut) { this(scene); - + // -- creation du controller par defaut --// - if (controllerDefaut) - controller_ = new EbliWidgetController(this); + if (controllerDefaut) controller_ = new EbliWidgetController(this); - } + /** * @param scene * @param Point : indiaue la location preferentiel. peut etre nul */ public EbliWidget(EbliScene scene) { super(scene); - setScene_(scene); + setScene(scene); // -- remplisage de la map de propriete grahiques --// propGraphique = new HashMap<String, Object>(); @@ -219,14 +214,6 @@ propGraphique.put(ROTATION, Math.PI); } - - - - - - - - public EbliWidgetController getController_() { return controller_; } @@ -247,12 +234,39 @@ public void notifyStateChanged(ObjectState previousState, ObjectState newState) { if (!useBorder_) { return; } setBorder(getScene().getLookFeel().getBorder(newState)); + // TODO a verifier pour le rendu + EbliWidget parent = getGroup(); + if (newState.isHovered() && parent != null) { + parent.setBorder(getBorder()); + } } - - + boolean isGroup; - public void setScene_(EbliScene _scene) { + /** + * @return the isGroup: true si le widget represente un groupe de widget comme un groupe par exemple + */ + public boolean isGroup() { + return isGroup; + } + + protected EbliWidget getGroup() { + Widget parent = getParentWidget(); + while (parent != getScene() && parent != null) { + if (parent instanceof EbliWidget && ((EbliWidget) parent).isGroup) { return ((EbliWidget) parent); } + parent = parent.getParentWidget(); + } + return null; + } + + /** + * @param isGroup the isGroup to set + */ + public void setGroup(boolean isGroup) { + this.isGroup = isGroup; + } + + public void setScene(EbliScene _scene) { this.scene_ = _scene; } @@ -268,7 +282,7 @@ } public Map<String, Object> duplicateGraphicalProperties() { - + // FIXME il faut juste cloner la map ... Map<String, Object> mapDupliquee = new HashMap<String, Object>(); mapDupliquee.put(LINEMODEL, new TraceLigneModel(getTraceLigneModel())); @@ -276,7 +290,6 @@ mapDupliquee.put(COLORFOND, getColorFond()); mapDupliquee.put(ROTATION, getRotation()); mapDupliquee.put(FONT, getFormeFont()); - return mapDupliquee; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -46,7 +46,6 @@ } public EbliWidget getWidget() { - // TODO Auto-generated method stub return res; } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -0,0 +1,47 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary; + +import org.netbeans.api.visual.widget.Widget; + +/** + * Creator permettant de cr\xE9er un groupe de widget simple. + * + * @author deniger + */ +public class EbliWidgetGroupCreator implements EbliWidgetCreator { + + EbliWidget w; + + public EbliWidget create(EbliScene _scene) { + return w; + } + + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + return null; + } + + public EbliWidgetBordure getBordure() { + return null; + } + + /** + * @return the w + */ + public Widget getW() { + return w; + } + + public EbliWidget getWidget() { + return w; + } + + /** + * @param w the w to set + */ + public void setW(EbliWidget w) { + this.w = w; + } +} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -10,7 +10,6 @@ * Classe qui permet de faire un undo redo sur le front/back * * @author Adrien Hadoux - * */ public class CommandBringToFront implements CtuluCommand { @@ -23,8 +22,7 @@ public void redo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).bringToFront(); @@ -38,8 +36,7 @@ public void undo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).bringToBack(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -10,26 +10,22 @@ * commande qui gere le undo/redo en cas de masquage des widgets * * @author Adrien Hadoux - * */ public class CommandMasquer implements CtuluCommand { ArrayList<EbliWidget> widget_; private boolean visible_; - - - + public CommandMasquer(EbliWidget widget) { - + widget_ = new ArrayList<EbliWidget>(); widget_.add(widget); - - + } - + public CommandMasquer(ArrayList<EbliWidget> widget) { this(widget, false); - + } public CommandMasquer(ArrayList<EbliWidget> widget, boolean visible) { @@ -37,13 +33,13 @@ this.widget_ = widget; visible_ = visible; } - + public void undo() { - + for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { it.next().setVisible(!visible_); } - + widget_.get(0).getEbliScene().refresh(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMove.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMove.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMove.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -12,7 +12,6 @@ * classe qui permet de faire du undo redo de positions de une ou plusieurs widgets * * @author genesis - * */ public class CommandMove implements CtuluCommand { @@ -25,10 +24,8 @@ this.newPos_ = _newPos; this.oldPos_ = _oldPos; this.widgets_ = _widgets; - if (_newPos.size() != _oldPos.size()) - throw new IllegalArgumentException("list must ahava the same size"); - if (_widgets.size() != _oldPos.size()) - throw new IllegalArgumentException("list must ahava the same size"); + if (_newPos.size() != _oldPos.size()) throw new IllegalArgumentException("list must ahava the same size"); + if (_widgets.size() != _oldPos.size()) throw new IllegalArgumentException("list must ahava the same size"); } public CommandMove(Widget _widget, Point _oldPos, Point _newPos) { @@ -40,8 +37,7 @@ public void redo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).setPreferredLocation(newPos_.get(i)); @@ -55,8 +51,7 @@ public void undo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).setPreferredLocation(oldPos_.get(i)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -11,7 +11,6 @@ * Commande pour le undo redo sur les retaillages. * * @author Adrien Hadoux - * */ public class CommandRetaillage implements CtuluCommand { @@ -24,15 +23,13 @@ this.widgets_ = listeWidget; this.newRectangle = newRectangle; this.oldRectangles = oldRectangle; - if (widgets_.size() != oldRectangle.size()) - throw new IllegalArgumentException("list must ahava the same size"); + if (widgets_.size() != oldRectangle.size()) throw new IllegalArgumentException("list must ahava the same size"); } public void undo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).setPreferredBounds(oldRectangles.get(i)); @@ -46,8 +43,7 @@ public void redo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).setPreferredBounds(newRectangle.get(i)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -10,18 +10,15 @@ * commande qui effectue un undo/redo sur la suppression. * * @author Adrien Hadoux - * */ public class CommandSupprimer implements CtuluCommand { EbliNode nodeSupprime_; EbliScene scene_; - + Point location_; - - - + public CommandSupprimer(EbliNode nodeSupprime_, EbliScene scene_, Point _location) { super(); this.nodeSupprime_ = nodeSupprime_; @@ -35,19 +32,19 @@ // -- raffraichissement de la scene --// scene_.refresh(); - + } public void undo() { - + // -- de nouveau suppression du node dans la scene --// scene_.addNode(nodeSupprime_); - + // -- repositionnement originel de la widget --// nodeSupprime_.getCreator().getWidget().setPreferredLocation( nodeSupprime_.getCreator().getWidget().convertSceneToLocal(location_)); - - // -- raffraichissement de la scene --// + + // -- raffraichissement de la scene --// scene_.refresh(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -10,20 +10,13 @@ * Commande undo/redo sur le blocage des widgets. * * @author Adrien Hadoux - * */ - - public class CommandUndoRedoBloque implements CtuluCommand { ArrayList<EbliWidget> widget_; boolean bloque_ = true; - - - - public CommandUndoRedoBloque(ArrayList<EbliWidget> widget, boolean bloque) { super(); this.widget_ = widget; @@ -33,10 +26,8 @@ public void undo() { for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { - if (bloque_) - it.next().getController_().replaceActionResizeAndMove(); - else - it.next().getController_().removeActionResizeAndMove(); + if (bloque_) it.next().getController_().replaceActionResizeAndMove(); + else it.next().getController_().removeActionResizeAndMove(); } widget_.get(0).getEbliScene().refresh(); @@ -44,10 +35,8 @@ public void redo() { for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { - if (bloque_) - it.next().getController_().removeActionResizeAndMove(); - else - it.next().getController_().replaceActionResizeAndMove(); + if (bloque_) it.next().getController_().removeActionResizeAndMove(); + else it.next().getController_().replaceActionResizeAndMove(); } widget_.get(0).getEbliScene().refresh(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -10,7 +10,6 @@ * Classe qui permet de faire un undo redo sur le front/back * * @author Adrien Hadoux - * */ public class CommandeBringToBack implements CtuluCommand { @@ -23,8 +22,7 @@ public void redo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).bringToBack(); @@ -38,8 +36,7 @@ public void undo() { final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).bringToFront(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -11,7 +11,6 @@ * action qui permet de faire le undo/redo sur le changement de scene du node. * * @author genesis - * */ public class CommandeChangeWidgetScene implements CtuluCommand { @@ -20,8 +19,6 @@ EbliScene sceneDepart_; EbliScene sceneDestination_; - - public CommandeChangeWidgetScene(ArrayList<EbliNode> nodeDuplique_, EbliScene sceneDep, EbliScene sceneDest) { super(); this.nodeDuplique_ = nodeDuplique_; @@ -41,7 +38,6 @@ } } - public void undo() { // -- redo unitaire execute pour chaque node dupliques --// for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { @@ -53,5 +49,4 @@ } } - } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -12,36 +12,28 @@ * Command undo/redo pour le duplicate de widget. * * @author Adrien Hadoux - * */ public class CommandeDuplicate implements CtuluCommand { - ArrayList<EbliNode> nodeDuplique_; EbliScene scene_; - - - - - public CommandeDuplicate(ArrayList<EbliNode> nodeDuplique_, EbliScene scene_) { super(); this.nodeDuplique_ = nodeDuplique_; this.scene_ = scene_; - + } public void redo() { // -- redo unitaire execute pour chaque node dupliques --// for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { - EbliNode node=it.next(); - redo(node.getCreator().getWidget(),node); + EbliNode node = it.next(); + redo(node.getCreator().getWidget(), node); } } - - + /** * redo unitaire pour une unique duplication * Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -8,22 +8,18 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; - /** * Command undo/redo sur toutes les proprietes graphiques des widgets. * * @author Adrien Hadoux - * */ public class CommandeUndoRedoGraphicalProperties implements CtuluCommand { List<Map<String, Object>> oldGraphicalProperties; List<Map<String, Object>> newGraphicalProperties; - + java.util.List<EbliWidget> widgets_; - - public CommandeUndoRedoGraphicalProperties(List<Map<String, Object>> newGraphicalProperties, List<Map<String, Object>> oldGraphicalProperties, List<EbliWidget> widgets_) { super(); @@ -31,49 +27,44 @@ this.oldGraphicalProperties = oldGraphicalProperties; this.widgets_ = widgets_; } - + /** - * constructeur sans parametre. il faudra par la suite ajouter des old et new - * graphical properties + * constructeur sans parametre. il faudra par la suite ajouter des old et new graphical properties */ public CommandeUndoRedoGraphicalProperties() { widgets_ = new ArrayList<EbliWidget>(); oldGraphicalProperties = new ArrayList<Map<String, Object>>(); newGraphicalProperties = new ArrayList<Map<String, Object>>(); } - - + public void addWidget(EbliWidget w) { widgets_.add(w); - } + } public void addOldPropertie(Map oldProperty) { oldGraphicalProperties.add(oldProperty); } - + public void addNewPropertie(Map newProperty) { newGraphicalProperties.add(newProperty); } - + public void undo() { - + final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).setPropGraphique(oldGraphicalProperties.get(i)); } refreshScene(); - - + } public void redo() { - + final int nb = widgets_.size(); - if (nb == 0) - return; + if (nb == 0) return; for (int i = 0; i < nb; i++) { widgets_.get(i).setPropGraphique(newGraphicalProperties.get(i)); @@ -81,8 +72,6 @@ refreshScene(); } - - private void refreshScene() { EbliScene.refreshScene(widgets_.get(0).getScene()); } 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 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -21,7 +21,6 @@ * * @author David Kaspar * @pompeur Adrien Hadoux - * */ public final class EbliActionEditorOneClick<C extends JComponent> extends WidgetAction.LockedAdapter implements InplaceEditorProvider.EditorController { @@ -39,37 +38,30 @@ protected boolean isLocked() { return editor != null; } - -/** - * Modification ici: pour activer l editor, il suffit d appuyer une seule fois - * sur l editeur + + /** + * Modification ici: pour activer l editor, il suffit d appuyer une seule fois sur l editeur */ public State mouseClicked(Widget widget, WidgetMouseEvent event) { - if (event.getButton() == MouseEvent.BUTTON1 /*&& event.getClickCount() == 2*/) { - 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 */) { + Point p = event.getPoint(); + if (widget.getClientArea().contains(p)) if (openEditor(widget)) return State.createLocked(widget, this); } return State.REJECTED; } public State mousePressed(Widget widget, WidgetMouseEvent event) { - if (editor != null) - closeEditor(true); + if (editor != null) closeEditor(true); return State.REJECTED; } public State mouseReleased(Widget widget, WidgetAction.WidgetMouseEvent event) { - if (editor != null) - closeEditor(true); + if (editor != null) closeEditor(true); return State.REJECTED; } public State keyPressed(Widget widget, WidgetKeyEvent event) { - if (event.getKeyChar() == KeyEvent.VK_ENTER) - if (openEditor(widget)) - return State.createLocked(widget, this); + if (event.getKeyChar() == KeyEvent.VK_ENTER) if (openEditor(widget)) return State.createLocked(widget, this); return State.REJECTED; } @@ -78,17 +70,14 @@ } public final boolean openEditor(Widget widget) { - if (editor != null) - return false; + if (editor != null) return false; Scene scene = widget.getScene(); JComponent component = scene.getView(); - if (component == null) - return false; + if (component == null) return false; editor = provider.createEditorComponent(this, widget); - if (editor == null) - return false; + if (editor == null) return false; this.widget = widget; component.add(editor); @@ -98,10 +87,8 @@ Point center = GeomUtil.center(rectangle); Dimension size = editor.getMinimumSize(); - if (rectangle.width > size.width) - size.width = rectangle.width; - if (rectangle.height > size.height) - size.height = rectangle.height; + if (rectangle.width > size.width) size.width = rectangle.width; + if (rectangle.height > size.height) size.height = rectangle.height; int x = center.x - size.width / 2; int y = center.y - size.height / 2; @@ -120,19 +107,14 @@ private void updateRectangleToFitToView(Rectangle rectangle) { 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(boolean commit) { - if (editor == null) - return; + if (editor == null) return; Container parent = editor.getParent(); Rectangle bounds = parent != null ? editor.getBounds() : null; provider.notifyClosing(this, widget, editor, commit); @@ -144,24 +126,19 @@ editor = null; widget = null; rectangle = null; - if (hasFocus) - if (parent != null) - parent.requestFocusInWindow(); + if (hasFocus) if (parent != null) parent.requestFocusInWindow(); } public void notifyEditorComponentBoundsChanged() { EnumSet<InplaceEditorProvider.ExpansionDirection> directions = provider .getExpansionDirections(this, widget, editor); - if (directions == null) - directions = EnumSet.noneOf(InplaceEditorProvider.ExpansionDirection.class); + if (directions == null) directions = EnumSet.noneOf(InplaceEditorProvider.ExpansionDirection.class); Rectangle rectangle = this.rectangle; Dimension size = editor.getPreferredSize(); Dimension minimumSize = editor.getMinimumSize(); if (minimumSize != null) { - if (size.width < minimumSize.width) - size.width = minimumSize.width; - if (size.height < minimumSize.height) - size.height = minimumSize.height; + if (size.width < minimumSize.width) size.width = minimumSize.width; + if (size.height < minimumSize.height) size.height = minimumSize.height; } int heightDiff = rectangle.height - size.height; @@ -181,8 +158,7 @@ } else { if (bottom) { rectangle.height = size.height; - } else { - } + } else {} } boolean left = directions.contains(InplaceEditorProvider.ExpansionDirection.LEFT); @@ -199,14 +175,13 @@ } else { if (right) { rectangle.width = size.width; - } else { - } + } else {} } - updateRectangleToFitToView (rectangle); + updateRectangleToFitToView(rectangle); - editor.setBounds (rectangle); - editor.repaint (); - } + editor.setBounds(rectangle); + editor.repaint(); + } } 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 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -17,20 +17,13 @@ import com.memoire.fu.FuLog; /** - * Action qui permet de realiser l alignement des composants. + * Action qui permet de realiser l alignement des composants. ATTTENTION CHOIX DE CONCEPTION: il faut que les EbliNode + * soit movables (isMovable()== true) pour pouvoir les aligner il faut donc lorss de la creation des nodes remplir les + * infos dimensions et size comme suit: EbliNodeDefault node = new EbliNodeDefault(); node.setCreator(new + * EbliWidgetCreatorGraphe(g)); node.setTitle("Graphe"); node.setPreferedSize(new Dimension(300, 300)); + * node.setPreferedLocation(new Point(4, 4)); scene.addNode(node); * - * - *ATTTENTION CHOIX DE CONCEPTION: il faut que les EbliNode soit movables - * (isMovable()== true) pour pouvoir les aligner il faut donc lorss de la - * creation des nodes remplir les infos dimensions et size comme suit: - * - * EbliNodeDefault node = new EbliNodeDefault(); node.setCreator(new - * EbliWidgetCreatorGraphe(g)); node.setTitle("Graphe"); - * node.setPreferedSize(new Dimension(300, 300)); node.setPreferedLocation(new - * Point(4, 4)); scene.addNode(node); - * *@author Adrien Hadoux - * */ public abstract class EbliWidgetActionAlign extends EbliWidgetActionSimple { @@ -42,30 +35,32 @@ @Override protected List<Point> getNewPositionFor(List<Widget> _widgetToMove) { - // on recupere le premier - // minx est le x min dans le repere de la scene - // on est oblige de passer par la car on la location ne suffit pas pour - // determiner - // la position d'un widget: ily a aussi les bounds - int maxY = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y+_widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height; - for (Widget widget : _widgetToMove) { - maxY = Math.max(maxY, widget.convertLocalToScene(widget.getBounds()).y+ widget.convertLocalToScene(widget.getBounds()).height); - } - List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); - for (Widget widget : _widgetToMove) { - Point p = widget.getPreferredLocation(); - // celui la ne change pas - int oldX = p.x; - p.y = maxY; - widget.getParentWidget().convertSceneToLocal(p); - //maintenant le p.x contient la position de bounds dans le repere qu'il faut. - //la location + bounds.x vaut la postion final du dessin donc - //la location final vaut=le point du dessin - bounds.x - p.y = p.y - widget.getBounds().height- widget.getBounds().y; - p.x = oldX; - newPoints.add(p); - } - return newPoints; + // on recupere le premier + // minx est le x min dans le repere de la scene + // on est oblige de passer par la car on la location ne suffit pas pour + // determiner + // la position d'un widget: ily a aussi les bounds + int maxY = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y + + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height; + for (Widget widget : _widgetToMove) { + maxY = Math.max(maxY, widget.convertLocalToScene(widget.getBounds()).y + + widget.convertLocalToScene(widget.getBounds()).height); + } + List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); + for (Widget widget : _widgetToMove) { + Point p = widget.getPreferredLocation(); + // celui la ne change pas + int oldX = p.x; + p.y = maxY; + widget.getParentWidget().convertSceneToLocal(p); + // maintenant le p.x contient la position de bounds dans le repere qu'il faut. + // la location + bounds.x vaut la postion final du dessin donc + // la location final vaut=le point du dessin - bounds.x + p.y = p.y - widget.getBounds().height - widget.getBounds().y; + p.x = oldX; + newPoints.add(p); + } + return newPoints; } } @@ -80,34 +75,36 @@ @Override protected List<Point> getNewPositionFor(List<Widget> _widgetToMove) { // TODO A terminer pour centrer horizontalement les widgets - - //on recupere les coordonnees les plus a gauche - int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y; - for (Widget widget : _widgetToMove) { - minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).y); - } - //on recupere les coordonnees les plus a droite - int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y+_widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height; - for (Widget widget : _widgetToMove) { - maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).y+ widget.convertLocalToScene(widget.getBounds()).height); - } - List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); - for (Widget widget : _widgetToMove) { - Point p = widget.getPreferredLocation(); - // toutes les coordonnees changent, elles s alignent entre elles au centre, cf le super logiciel powerpoint - int oldY = p.x; - - // p.x se trouve a la moyenne des 2 - p.y = (maxx+minx)/2; - widget.getParentWidget().convertSceneToLocal(p); - //maintenant le p.x contient la position du centre des widgets dans le repere qu'il faut. - // - //la location final vaut=le point du milieu du dessin - sa taille/2 - sa bordure - p.y = p.y - widget.getBounds().height/2- widget.getBounds().y; - p.x = oldY; - newPoints.add(p); - } - return newPoints; + + // on recupere les coordonnees les plus a gauche + int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y; + for (Widget widget : _widgetToMove) { + minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).y); + } + // on recupere les coordonnees les plus a droite + int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y + + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).height; + for (Widget widget : _widgetToMove) { + maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).y + + widget.convertLocalToScene(widget.getBounds()).height); + } + List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); + for (Widget widget : _widgetToMove) { + Point p = widget.getPreferredLocation(); + // toutes les coordonnees changent, elles s alignent entre elles au centre, cf le super logiciel powerpoint + int oldY = p.x; + + // p.x se trouve a la moyenne des 2 + p.y = (maxx + minx) / 2; + widget.getParentWidget().convertSceneToLocal(p); + // maintenant le p.x contient la position du centre des widgets dans le repere qu'il faut. + // + // la location final vaut=le point du milieu du dessin - sa taille/2 - sa bordure + p.y = p.y - widget.getBounds().height / 2 - widget.getBounds().y; + p.x = oldY; + newPoints.add(p); + } + return newPoints; } } @@ -137,9 +134,9 @@ int oldY = p.y; p.x = minx; widget.getParentWidget().convertSceneToLocal(p); - //maintenant le p.x contient la position de bounds dans le repere qu'il faut. - //la location + bounds.x vaut la postion final du dessin donc - //la location final vaut=le point du dessin - bounds.x + // maintenant le p.x contient la position de bounds dans le repere qu'il faut. + // la location + bounds.x vaut la postion final du dessin donc + // la location final vaut=le point du dessin - bounds.x p.x = p.x - widget.getBounds().x; p.y = oldY; newPoints.add(p); @@ -158,35 +155,37 @@ @Override protected List<Point> getNewPositionFor(List<Widget> _widgetToMove) { - // TODO A terminer pour centrer horizontalement les widgets - - //on recupere les coordonnees les plus a gauche - int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x; - for (Widget widget : _widgetToMove) { - minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).x); - } - //on recupere les coordonnees les plus a droite - int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x+_widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width; - for (Widget widget : _widgetToMove) { - maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x+ widget.convertLocalToScene(widget.getBounds()).width); - } - List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); - for (Widget widget : _widgetToMove) { - Point p = widget.getPreferredLocation(); - // toutes les coordonnees changent, elles s alignent entre elles au centre, cf le super logiciel powerpoint - int oldY = p.y; - - // p.x se trouve a la moyenne des 2 - p.x = (maxx+minx)/2; - widget.getParentWidget().convertSceneToLocal(p); - //maintenant le p.x contient la position du centre des widgets dans le repere qu'il faut. - // - //la location final vaut=le point du milieu du dessin - sa taille/2 - sa bordure - p.x = p.x - widget.getBounds().width/2- widget.getBounds().x; - p.y = oldY; - newPoints.add(p); - } - return newPoints; + // TODO A terminer pour centrer horizontalement les widgets + + // on recupere les coordonnees les plus a gauche + int minx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x; + for (Widget widget : _widgetToMove) { + minx = Math.min(minx, widget.convertLocalToScene(widget.getBounds()).x); + } + // on recupere les coordonnees les plus a droite + int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x + + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width; + for (Widget widget : _widgetToMove) { + maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x + + widget.convertLocalToScene(widget.getBounds()).width); + } + List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); + for (Widget widget : _widgetToMove) { + Point p = widget.getPreferredLocation(); + // toutes les coordonnees changent, elles s alignent entre elles au centre, cf le super logiciel powerpoint + int oldY = p.y; + + // p.x se trouve a la moyenne des 2 + p.x = (maxx + minx) / 2; + widget.getParentWidget().convertSceneToLocal(p); + // maintenant le p.x contient la position du centre des widgets dans le repere qu'il faut. + // + // la location final vaut=le point du milieu du dessin - sa taille/2 - sa bordure + p.x = p.x - widget.getBounds().width / 2 - widget.getBounds().x; + p.y = oldY; + newPoints.add(p); + } + return newPoints; } } @@ -201,30 +200,32 @@ @Override protected List<Point> getNewPositionFor(List<Widget> _widgetToMove) { - // on recupere le premier - // minx est le x min dans le repere de la scene - // on est oblige de passer par la car on la location ne suffit pas pour - // determiner - // la position d'un widget: ily a aussi les bounds - int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x+_widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width; - for (Widget widget : _widgetToMove) { - maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x+ widget.convertLocalToScene(widget.getBounds()).width); - } - List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); - for (Widget widget : _widgetToMove) { - Point p = widget.getPreferredLocation(); - // celui la ne change pas - int oldY = p.y; - p.x = maxx; - widget.getParentWidget().convertSceneToLocal(p); - //maintenant le p.x contient la position de bounds dans le repere qu'il faut. - //la location + bounds.x vaut la postion final du dessin donc - //la location final vaut=le point du dessin - bounds.x - p.x = p.x - widget.getBounds().width- widget.getBounds().x; - p.y = oldY; - newPoints.add(p); - } - return newPoints; + // on recupere le premier + // minx est le x min dans le repere de la scene + // on est oblige de passer par la car on la location ne suffit pas pour + // determiner + // la position d'un widget: ily a aussi les bounds + int maxx = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).x + + _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).width; + for (Widget widget : _widgetToMove) { + maxx = Math.max(maxx, widget.convertLocalToScene(widget.getBounds()).x + + widget.convertLocalToScene(widget.getBounds()).width); + } + List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); + for (Widget widget : _widgetToMove) { + Point p = widget.getPreferredLocation(); + // celui la ne change pas + int oldY = p.y; + p.x = maxx; + widget.getParentWidget().convertSceneToLocal(p); + // maintenant le p.x contient la position de bounds dans le repere qu'il faut. + // la location + bounds.x vaut la postion final du dessin donc + // la location final vaut=le point du dessin - bounds.x + p.x = p.x - widget.getBounds().width - widget.getBounds().x; + p.y = oldY; + newPoints.add(p); + } + return newPoints; } } @@ -237,30 +238,30 @@ @Override protected List<Point> getNewPositionFor(List<Widget> _widgetToMove) { - // on recupere le premier - // miny est le y min dans le repere de la scene - // on est oblige de passer par la car on la location ne suffit pas pour - // determiner - // la position d'un widget: il y a aussi les bounds - int miny = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y; - for (Widget widget : _widgetToMove) { - miny = Math.min(miny, widget.convertLocalToScene(widget.getBounds()).y); - } - List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); - for (Widget widget : _widgetToMove) { - Point p = widget.getPreferredLocation(); - // celui la ne change pas - int oldX = p.x; - p.y = miny; - widget.getParentWidget().convertSceneToLocal(p); - //maintenant le p.y contient la position de bounds dans le repere qu'il faut. - //la location + bounds.x vaut la postion final du dessin donc - //la location final vaut=le point du dessin - bounds.x - p.y = p.y - widget.getBounds().y; - p.x = oldX; - newPoints.add(p); - } - return newPoints; + // on recupere le premier + // miny est le y min dans le repere de la scene + // on est oblige de passer par la car on la location ne suffit pas pour + // determiner + // la position d'un widget: il y a aussi les bounds + int miny = _widgetToMove.get(0).convertLocalToScene(_widgetToMove.get(0).getBounds()).y; + for (Widget widget : _widgetToMove) { + miny = Math.min(miny, widget.convertLocalToScene(widget.getBounds()).y); + } + List<Point> newPoints = new ArrayList<Point>(_widgetToMove.size()); + for (Widget widget : _widgetToMove) { + Point p = widget.getPreferredLocation(); + // celui la ne change pas + int oldX = p.x; + p.y = miny; + widget.getParentWidget().convertSceneToLocal(p); + // maintenant le p.y contient la position de bounds dans le repere qu'il faut. + // la location + bounds.x vaut la postion final du dessin donc + // la location final vaut=le point du dessin - bounds.x + p.y = p.y - widget.getBounds().y; + p.x = oldX; + newPoints.add(p); + } + return newPoints; } } @@ -269,18 +270,9 @@ * */ private static final long serialVersionUID = 1L; - - - - - public EbliWidgetActionAlign(String name, Icon ic, String id, EbliScene _scene) { super(_scene, name, ic, id); - // TODO Auto-generated constructor stub - - - } @@ -288,8 +280,7 @@ // -- recuperation de la liste des widgets selectionnees --// Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ // pas de selection: on return - if (listeNode == null || listeNode.isEmpty()) - return; + if (listeNode == null || listeNode.isEmpty()) return; List<Widget> widgetToMove = new ArrayList<Widget>(listeNode.size()); // liste des anciens points List<Point> oldSize = new ArrayList<Point>(listeNode.size()); @@ -299,15 +290,13 @@ EbliNode currentNode = it.next(); FuLog.warning("current node movable: " + currentNode.getTitle()); if (currentNode.isMovable()) { - - + Widget widget = scene_.findWidget(currentNode); widgetToMove.add(widget); oldSize.add(widget.getPreferredLocation()); } } - if (widgetToMove.isEmpty()) - return; + if (widgetToMove.isEmpty()) return; // on calcule les nouvelles positions List<Point> newPos = getNewPositionFor(widgetToMove); // on met a jour les positions @@ -324,15 +313,10 @@ } - /** - * @param _widgetToMove - * non vide et non null - * @return les nouvelles positions correspondantes aux points pass\xE9s en - * parametres + * @param _widgetToMove non vide et non null + * @return les nouvelles positions correspondantes aux points pass\xE9s en parametres */ protected abstract List<Point> getNewPositionFor(List<Widget> _widgetToMove); - - } 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 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -14,72 +14,56 @@ /** * classe qui permet de placer les widgets selectionnes en arriere plan. + * * @author genesis - * */ public class EbliWidgetActionBackGround extends EbliWidgetActionSimple { - - CtuluCommandContainer cmd_; - - - public EbliWidgetActionBackGround(EbliScene _scene){ - super(_scene, EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_disposerderriere"), + CtuluCommandContainer cmd_; + + public EbliWidgetActionBackGround(EbliScene _scene) { + super(_scene, EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_disposerderriere"), "BACKGROUND"); - - - cmd_ = _scene.getCmdMng(); - putValue(NAME,"Arri\xE8re plan"); - } - - private static final long serialVersionUID = 1L; - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - + cmd_ = _scene.getCmdMng(); + putValue(NAME, "Arri\xE8re plan"); + } - - //-- recuperation de la liste des nodes de la scene --// + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent e) { + + // -- recuperation de la liste des nodes de la scene --// Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); // -- liste des widget selectionnees --// java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); - - //-- parcours des nodes - for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ - EbliNode currentNode=it.next(); - if(currentNode!=null && currentNode.isMovable()){ + // -- parcours des nodes + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - - //-- ajout au premier plan du node --// - // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); - - currentNode.getCreator().getWidget().bringToBack(); - - listeWidget.add(currentNode.getCreator().getWidget()); - - //-- rafraichissement de la scene --// - scene_.refresh(); - - - + EbliNode currentNode = it.next(); + if (currentNode != null && currentNode.isMovable()) { + + // -- ajout au premier plan du node --// + // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); + + currentNode.getCreator().getWidget().bringToBack(); + + listeWidget.add(currentNode.getCreator().getWidget()); + + // -- rafraichissement de la scene --// + scene_.refresh(); + } } - + // -- enregistrement de la commande undoRedo --// if (cmd_ != null) { cmd_.addCmd(new CommandeBringToBack(listeWidget)); } - - + } - - - - - } - } 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 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -18,38 +18,31 @@ * Action qui empeche les widgets de se resize et d'etre deplacee * * @author Adrien Hadoux - * */ public abstract class EbliWidgetActionBloqueOuDebloqueWidget extends EbliWidgetActionSimple { private static final long serialVersionUID = 1L; - + final CtuluCommandContainer cmd_; boolean bloque_ = true; - - public EbliWidgetActionBloqueOuDebloqueWidget(String name, Icon ic, String id, EbliScene _scene, boolean bloque) { super(_scene, name, ic, id); - - + putValue(NAME, "Duplication des \xE9lements s\xE9lectionn\xE9s"); cmd_ = _scene.getCmdMng(); bloque_ = bloque; } - - - - public static class Bloque extends EbliWidgetActionBloqueOuDebloqueWidget{ - + + public static class Bloque extends EbliWidgetActionBloqueOuDebloqueWidget { + public Bloque(EbliScene _scene) { - super(EbliResource.EBLI.getString("Bloquer les objets s\xE9lectionn\xE9s "), CtuluResource.CTULU - .getIcon("crystal_tuer"), - "BLOQUEWIDGET", _scene, true); + super(EbliResource.EBLI.getString("Bloquer les objets s\xE9lectionn\xE9s "), CtuluResource.CTULU + .getIcon("crystal_tuer"), "BLOQUEWIDGET", _scene, true); } - + } - + public static class DeBloque extends EbliWidgetActionBloqueOuDebloqueWidget { public DeBloque(EbliScene _scene) { @@ -58,10 +51,8 @@ } } - - + public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub // -- recuperation de la liste des nodes de la scene --// Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); @@ -76,10 +67,8 @@ if (currentNode != null && currentNode.hasWidget()) { // -- bloquage de la widget --// - if (bloque_) - currentNode.getCreator().getWidget().getController_().removeActionResizeAndMove(); - else - currentNode.getCreator().getWidget().getController_().replaceActionResizeAndMove(); + if (bloque_) currentNode.getCreator().getWidget().getController_().removeActionResizeAndMove(); + else currentNode.getCreator().getWidget().getController_().replaceActionResizeAndMove(); listeWidget.add(currentNode.getCreator().getWidget()); // -- rafraichissement de la scene --// 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 2008-09-07 16:23:36 UTC (rev 3895) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-09-07 20:49:47 UTC (rev 3896) @@ -1,7 +1,5 @@ package org.fudaa.ebli.visuallibrary.actions; - - import java.awt.Color; import java.awt.event.ActionEvent; import java.util.ArrayList; @@ -18,38 +16,22 @@ import com.memoire.bu.BuColorChooser; - /** - * Classe qui permet de changer la couleur des contours des widgets . + * Classe qui permet de changer la couleur des contours des widgets . + * * @author Adrien Hadoux - * */ public class EbliWidgetActionColorBackground extends EbliWidgetActionSimple { - + CtuluCommandContainer cmd_; - CtuluCommandContainer cmd_; - - - - - - - - public EbliWidgetActionColorBackground(EbliScene _scene) { - super(_scene, EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); - - - - cmd_=_scene.getCmdMng(); - - - // TODO Auto-generated constructor stub - } + public EbliWidgetActionColorBackground(EbliScene _scene) { + super(_scene, EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); - - - + cmd_ = _scene.getCmdMng(); + + } + public void actionPerformed(ActionEvent e) { // -- choix de la couleur par l utilisateur --// @@ -60,11 +42,9 @@ // -- recupere les anciennes gr... [truncated message content] |
From: <had...@us...> - 2008-09-09 18:41:00
|
Revision: 3902 http://fudaa.svn.sourceforge.net/fudaa/?rev=3902&view=rev Author: hadouxad Date: 2008-09-09 18:41:08 +0000 (Tue, 09 Sep 2008) Log Message: ----------- - empecher la transfo de calque lors du clic sur l arbre du calque - G?\195?\169r?\195?\169! surcharge de la methode isHitAt(location) dans EbliWidget - recuperation du curseur souris et verification qu il ne se trouve pas dans la widget - idem pour graphe - reecriture des setMenu des controller afin de gerer proprement les popup graphes et calques - Ajout du champs de suivi souris pour l edition de graphe - Refactorisation pour les addListener et les controllers des widgets - lors du attachNode de ebliscene, on ne cree les widget que si elles n existent pas deja - permet lors de l undo/redo sur la duplication et la suppression de ne pas recreer les widgets associees aux noeuds - Undo/Redo sur la creation ok. - correction d un mechant bug: lors du clic sur les widgets calques et graphe apres deplacements, il n'y a plus les arbre et menus qui apparaissent Graphes - refactorsation de trpostcourbetreemodel - suppression du idx, - refonte de la methode buildTimeSteps => recupere tous les pas de temps de source - Debut du WIzard pour les courbes temporelles 2 paneaux sur 3 de potables Modified Paths: -------------- 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/EbliWidgetSynchroniser.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/calque/EbliWidgetControllerCalque.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/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/export/MvExportChooseVarAndTime.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/TrPostActionAddPointFromWidgetCalque.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/TrPostCourbeTreeModel.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/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCreation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -133,6 +133,8 @@ protected Widget attachNodeWidget(EbliNode node) { // -- creation de la widget ici --// + if (node.getWidget() == null) + // -- on ne cree la widget que sis necessaire node.setWidget(node.getCreator().create(this)); @@ -145,6 +147,9 @@ // -- ajout dans la vue layer --// visu_.addChild(node.getWidget()); + + + return node.getWidget(); } 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -2,6 +2,7 @@ import java.awt.Color; import java.awt.Font; +import java.awt.Point; import java.beans.PropertyChangeListener; import java.util.HashMap; import java.util.Map; @@ -293,6 +294,22 @@ return mapDupliquee; } + + public boolean isHitAt(Point localLocation) { + + + if (localLocation == null) + return false; + + System.err.println("getBounds:" + this.convertLocalToScene(getBounds())); + System.err.println("Location:" + this.convertSceneToLocal(localLocation)); + if (getBounds() != null) + return isVisible() && getBounds().contains(localLocation); + else + // return isVisible() && getPreferredBounds().contains(localLocation); + return false; + } + /** * Retourne les proprietes de la map. */ 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -251,7 +251,7 @@ } - PopupMenuProvider providerPopup_ = null; + protected PopupMenuProvider providerPopup_ = null; protected JPopupMenu popupMenu_ = null; public JPopupMenu getPopup() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -65,6 +65,7 @@ public void mousePressed(MouseEvent e) { if (e.isPopupTrigger() && e.getClickCount() == 1) { affichePopupNode(e.getX(), e.getY()); + } } @@ -114,9 +115,10 @@ if (node.getWidget() instanceof EbliWidgetBordure) { EbliWidgetBordure bordure = (EbliWidgetBordure) node.getWidget(); poppup = bordure.intern_.getController_().getPopup(); - }else + + } else poppup = node.getWidget().getController_().getPopup(); - + poppup.show(arbre_, x, y); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCreation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCreation.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCreation.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -0,0 +1,49 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Point; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; + +public class CommandUndoRedoCreation implements CtuluCommand { + + EbliNode nodeCree_; + + EbliScene scene_; + + Point location_; + + public CommandUndoRedoCreation(EbliNode _nodeCree, EbliScene scene_, Point _location) { + super(); + this.nodeCree_ = _nodeCree; + this.scene_ = scene_; + location_ = _location; + } + + public void redo() { + // --rattachement du node dans la scene --// + scene_.addNode(nodeCree_); + + // -- repositionnement originel de la widget --// + nodeCree_.getWidget().setPreferredLocation(location_); + + // -- raffraichissement de la scene --// + scene_.refresh(); + + } + + public void undo() { + + // -- de nouveau suppression du node dans la scene --// + + scene_.removeNode(nodeCree_); + + + + // -- raffraichissement de la scene --// + scene_.refresh(); + } + + +} \ No newline at end of file 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -40,9 +40,13 @@ } /** - * Modification ici: pour activer l editor, il suffit d appuyer une seule fois sur l editeur + * Modification ici: pour activer l editor, il suffit d appuyer une seule fois + * sur l editeur + * */ public State mouseClicked(Widget widget, WidgetMouseEvent event) { + + if (event.getButton() == MouseEvent.BUTTON1 /* && event.getClickCount() == 2 */) { Point p = event.getPoint(); if (widget.getClientArea().contains(p)) if (openEditor(widget)) return State.createLocked(widget, this); 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -94,8 +94,8 @@ } + - protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Masquer l'objet")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); @@ -150,18 +150,22 @@ * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ public void setMenu() { - widget_.getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + + popupMenu_ = new JPopupMenu(); + + // -- Menu specifiques a l'application--// + constructPopupMenuSpecifique(popupMenu_); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popupMenu_); + System.err.println("je viens de creer ma popup" + popupMenu_); + providerPopup_ = new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - popupMenu_ = new JPopupMenu(); - - // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popupMenu_); - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popupMenu_); - + return popupMenu_; } - })); + }; + widget_.getActions().addAction(ActionFactory.createPopupMenuAction(providerPopup_));// { + } private void constructPopupMenuSpecifique(JPopupMenu _popup) { 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -7,6 +7,7 @@ import java.util.Iterator; import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -14,6 +15,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; @@ -54,6 +56,10 @@ super(widget_); widgetGraphe_ = widget_; + labelTrace_ = (JLabel) CtuluLibSwing.findChildByName(getGraphePanel(), "lbTools"); + getGraphePanel().remove(labelTrace_); + + addActionSpecifiques(); } @@ -115,19 +121,21 @@ * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ public void setMenu() { - widget_.getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { - public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - popupMenu_ = new JPopupMenu(); + + popupMenu_ = new JPopupMenu(); - // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popupMenu_); + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popupMenu_); - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popupMenu_); - + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popupMenu_); + + providerPopup_ = new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { return popupMenu_; } - })); + }; + widget_.getActions().addAction(ActionFactory.createPopupMenuAction(providerPopup_)); } @@ -148,9 +156,42 @@ if (widget_.getEbliScene() != null) { // position a cote de la widget graphe - Point nouvellePosition = new Point((int) (widget_.getLocation().x), (int) (widget_.getLocation().y + widget_ - .getBounds().height * 1.2)); + // Point nouvellePosition = new Point((int) (widget_.getLocation().x), + // (int) (widget_.getLocation().y + widget_ + // .getBounds().height * 1.2)); + // int x, y, width; + // Point nouvellePosition = new Point(); + // + // if (widget_.getLocation() != null) { + // x = + // widget_.getEbliScene().convertSceneToLocal(widget_.getLocation() + // ).x; + // y = + // widget_.getEbliScene().convertSceneToLocal(widget_.getLocation() + // ).y; + // } else { + // + // x = widget_.getEbliScene().convertSceneToLocal(widget_. + // getPreferredLocation()).x; + // y = widget_.getEbliScene().convertSceneToLocal(widget_. + // getPreferredLocation()).y; + // } + // if (widget_.getBounds() != null) + // width = widget_.getBounds().width; + // else + // + // width = widget_.getPreferredBounds().width; + // nouvellePosition.x = x + width + 20; + // nouvellePosition.y = y; + + + Point positionLegende = new Point(); + if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { + positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; + positionLegende.y = widget_.getPreferredLocation().y; + + } // getScene_().addChild(new EbliWidget(getScene_(),null)); // addChild // (WidgetLegendeManager.createLegende(GrapheWidget.this.getGraphe(), @@ -166,7 +207,7 @@ widgetGraphe_.getNodeLegende().setCreator( new EbliWidgetCreatorLegende(((EbliWidgetGraphe) widget_) .getGraphe())); - widgetGraphe_.getNodeLegende().setPreferedLocation(nouvellePosition); + widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); widget_.getEbliScene().addNode(widgetGraphe_.getNodeLegende()); widgetGraphe_.getNodeLegende().setPreferedSize( @@ -204,6 +245,7 @@ JScrollPane panelTreeGraphe_ = null; BuToolBar toolbarGraphe_ = null; BuMenuBar menuGraphe_ = null; + JLabel labelTrace_; public boolean alreadyCreate_ = false; /** @@ -294,6 +336,16 @@ } + /** + * affiche le label des coordonnees + */ + public JComponent geTtracableComponent() { + + + + return labelTrace_; + } + } 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -17,7 +17,6 @@ import javax.swing.JComponent; import javax.swing.SwingUtilities; -import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGFillePanel; @@ -38,7 +37,7 @@ * * @author adrien hadoux */ -public class EbliWidgetGraphe extends EbliWidget implements /* EditProvider */InplaceEditorProvider<BuPanel>, +public class EbliWidgetGraphe extends EbliWidget implements InplaceEditorProvider<BuPanel>, EGGrapheModelListener { // private EGGraphe graphe_; @@ -73,8 +72,8 @@ super(scene); panelGraphe_ = _pn; panelGraphe_.setBorder(null); - // FIXME - panelGraphe_.remove(CtuluLibSwing.findChildByName(panelGraphe_, "lbTools")); + + panelGraphe_.getGraphe().getModel().addModelListener(this); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/export/MvExportChooseVarAndTime.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/export/MvExportChooseVarAndTime.java 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/export/MvExportChooseVarAndTime.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -19,6 +19,14 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluVariable; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; +import org.fudaa.fudaa.meshviewer.MvResource; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuEmptyList; import com.memoire.bu.BuGridLayout; @@ -27,15 +35,6 @@ import com.memoire.bu.BuPanel; import com.memoire.bu.BuScrollPane; -import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluLibArray; -import org.fudaa.ctulu.CtuluLibString; -import org.fudaa.ctulu.CtuluVariable; -import org.fudaa.ctulu.gui.CtuluDialogPanel; - -import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; -import org.fudaa.fudaa.meshviewer.MvResource; - /** * @author Fred Deniger * @version $Id: MvExportChooseVarAndTime.java,v 1.12 2007-05-04 13:59:50 deniger Exp $ @@ -64,6 +63,10 @@ private final CtuluDialogPanel pn_; + public CtuluDialogPanel getPn() { + return pn_; + } + public ListenerForError(final CtuluDialogPanel _pn) { super(); pn_ = _pn; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -20,6 +20,7 @@ import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; +import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; @@ -261,6 +262,9 @@ } else { rechercheGrapheAndCalque(); + + // -- affichage de al dialog --// + constructDialog().setVisible(true); } } @@ -321,8 +325,7 @@ * TrResource .getS("Il n'y a pas de graphes disponibles.")).activate(); return; } */ - // -- affichage de al dialog --// - constructDialog().setVisible(true); + } public abstract boolean isCorrectGraph(EGGrapheModel _model); @@ -356,8 +359,7 @@ * * @return */ - public JDialog constructDialog() { - + public JComponent constructInterface(boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { boxCalques_ = new JComboBox(); for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { boxCalques_.addItem(it.next()); @@ -374,17 +376,29 @@ jlisteGraphesSelections.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Graphes choisis"))); jlisteGraphesSelections.setCellRenderer(new GrapheCellRenderer()); - validation = new JButton(TrResource.TR.getString("Valider"), EbliResource.EBLI.getIcon("crystal_valider")); - validation.addActionListener(this); - creationNewGraphe = new JButton(TrResource.TR.getString("Cr\xE9er un nouveau graphe"), EbliResource.EBLI - .getIcon("crystal_valider")); - creationNewGraphe.addActionListener(this); + JPanel panelControle = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + select = new JButton(TrResource.TR.getString("Ajouter"), EbliResource.EBLI.getIcon("crystal22_avancervite")); unselect = new JButton(TrResource.TR.getString("Enlever"), EbliResource.EBLI.getIcon("crystal22_reculervite")); select.addActionListener(this); unselect.addActionListener(this); + if (closeDialog) { quitter = new JButton(TrResource.TR.getString("Quitter"), EbliResource.EBLI.getIcon("crystal_detruire")); quitter.addActionListener(this); + panelControle.add(quitter); + } + if (canCreate) { + creationNewGraphe = new JButton(TrResource.TR.getString("Cr\xE9er un nouveau graphe"), EbliResource.EBLI + .getIcon("crystal_valider")); + creationNewGraphe.addActionListener(this); + panelControle.add(creationNewGraphe); + } + if (valideAjoutCourbe) { + validation = new JButton(TrResource.TR.getString("Valider"), EbliResource.EBLI.getIcon("crystal_valider")); + validation.addActionListener(this); + panelControle.add(validation); + } // Box box = Box.createHorizontalBox(); JPanel box = new JPanel(new GridLayout(1, 3)); box.setSize(550, 350);// FIXME a enlever car c'est inutile : a moins d'utiliser setPreferredSize @@ -405,17 +419,24 @@ content.add(box, BorderLayout.CENTER); content.add(boxCalques_, BorderLayout.NORTH); - JPanel panelControle = new JPanel(new FlowLayout(FlowLayout.CENTER)); - panelControle.add(quitter); + + - panelControle.add(creationNewGraphe); - panelControle.add(validation); + + content.add(panelControle, BorderLayout.SOUTH); + + return content; + } + public JDialog constructDialog() { + + + frame_ = new JDialog(); - frame_.setContentPane(content); + frame_.setContentPane(constructInterface(true, true, true)); frame_.setModal(true); setTitleForFrame(); @@ -425,6 +446,19 @@ return frame_; } + + + /** + * Methode qui construit le panel de selection ou creation des graphes pour + * les points du calque selectionnes + * + * @return + */ + public JComponent getInterfaceComplete(boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { + rechercheGrapheAndCalque(); + return constructInterface(closeDialog, valideAjoutCourbe, canCreate); + } + public abstract void setTitleForFrame(); } Modified: 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/TrPostCourbeBuilder.java 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -7,33 +7,19 @@ */ package org.fudaa.fudaa.tr.post; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.io.IOException; -import java.util.List; -import javax.swing.BorderFactory; - -import org.fudaa.ctulu.CtuluLibString; -import org.fudaa.ctulu.ProgressionBuAdapter; import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.gui.CtuluDialogPanel; -import org.fudaa.ctulu.gui.CtuluLibSwing; -import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.fudaa.commun.FudaaInternalFrameSelectorPanel; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; -import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuBorders; +import com.memoire.bu.BuWizardDialog; import com.memoire.fu.FuLog; - /** * @author fred deniger * @version $Id: TrPostCourbeBuilder.java,v 1.9 2007-05-04 14:01:51 deniger Exp $ @@ -46,7 +32,9 @@ if (_prog != null) { _prog.setDesc(TrResource.getS("Construction des courbes")); } - final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(_impl, _src, _tidx, _idxPtArray, _vars); + final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(_impl, _src, /* + * _tidx, + */_idxPtArray, _vars); treeModel.addAllCourbes(_prog, null); return treeModel; @@ -85,78 +73,139 @@ chooseAndBuild(_src, _ptIdx, null, _varSelected, _calque); } + + private static int cptGraphe = 1; + /** + * Methode principale de construction d'une courbe avec l'aide d'un wizard + */ public static void chooseAndBuild(final TrPostProjet _src, final int[] _ptIdx, final TrPostInterpolatePoint _pt, final H2dVariableType _varSelected, final TrPostVisuPanel _calque) { if (_ptIdx == null && _pt == null) { return; } - final MvExportChooseVarAndTime chooser = new MvExportChooseVarAndTime(_src.getSource().getNewVarListModel(), _src - .getSource().getNewTimeListModel(), TrResource - .getS("Choisir les variables et les pas de temps \xE0 afficher dans les \xE9volutions temporelles")); + // final MvExportChooseVarAndTime chooser = new + // MvExportChooseVarAndTime(_src.getSource().getNewVarListModel(), _src + // .getSource().getNewTimeListModel(), TrResource + // .getS( + // "Choisir les variables et les pas de temps \xE0 afficher dans les \xE9volutions temporelles" + // )); + // chooser.setVarSelected(_varSelected); + + + + + // --panel No 1 : choix des points a sonder --// + + + + // -- creation du mVExportChooser en degageant les pas de temps pour le + // panel No2 --// + final MvExportChooseVarAndTime chooser = new MvExportChooseVarAndTime(_src.getSource().getNewVarListModel(), null, + TrResource.getS("Choisir les variables et les pas de temps \xE0 afficher dans les \xE9volutions temporelles")); chooser.setVarSelected(_varSelected); + + + + + + final String titre = TrResource.getS("Evolutions temporelles"); - CtuluDialogPanel pn = chooser; + // CtuluDialogPanel pn = chooser; //FIXME: a remplacer par une recherche des frames dans le layout actif. - final List fr = TrPostCourbeFille.getCourbeFilleFrames(_src.getImpl()); - final FudaaInternalFrameSelectorPanel pnFrame = fr.size() == 0 ? null : new FudaaInternalFrameSelectorPanel(fr, - TrLib.getString("Afficher les \xE9volutions temporelles dans une nouvelle fen\xEAtre"), titre); - if (pnFrame != null) { - final CtuluDialogPanel completePn = new CtuluDialogPanel() { - public boolean valide() { - return pnFrame.getCbNew().isSelected() || CtuluLibString.isEmpty(getErrorText()); - } - }; - pn = completePn; - pn.setLayout(new BuBorderLayout(4, 4, true, true)); - pn.setBorder(BuBorders.EMPTY3333); - pn.add(pnFrame, BuBorderLayout.NORTH); - chooser.setErrorTextUnable(); - chooser.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 5)); - CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); - pnFrame.getCbNew().addItemListener(new ItemListener() { - public void itemStateChanged(final ItemEvent _e) { - CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); - if (pnFrame.getCbNew().isSelected()) { - completePn.setErrorText(chooser.computeErrorText()); - } else { - completePn.setErrorText(CtuluLibString.EMPTY_STRING); - } - } - }); - pn.add(chooser, BuBorderLayout.CENTER); + // final List fr = TrPostCourbeFille.getCourbeFilleFrames(_src.getImpl()); + // final FudaaInternalFrameSelectorPanel pnFrame = fr.size() == 0 ? null : + // new FudaaInternalFrameSelectorPanel(fr, + // TrLib.getString( + // "Afficher les \xE9volutions temporelles dans une nouvelle fen\xEAtre"), titre); + // if (pnFrame != null) { + // final CtuluDialogPanel completePn = new CtuluDialogPanel() { + // public boolean valide() { + // return pnFrame.getCbNew().isSelected() || + // CtuluLibString.isEmpty(getErrorText()); + // } + // }; + // // pn = completePn; + // // pn.setLayout(new BuBorderLayout(4, 4, true, true)); + // // pn.setBorder(BuBorders.EMPTY3333); + // pn.add(pnFrame, BuBorderLayout.NORTH); + // chooser.setErrorTextUnable(); + // chooser.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 5)); + // CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); + // pnFrame.getCbNew().addItemListener(new ItemListener() { + // public void itemStateChanged(final ItemEvent _e) { + // CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); + // if (pnFrame.getCbNew().isSelected()) { + // completePn.setErrorText(chooser.computeErrorText()); + // } else { + // completePn.setErrorText(CtuluLibString.EMPTY_STRING); + // } + // } + // }); + // pn.add(chooser, BuBorderLayout.CENTER); + // + // } + // chooser.activeErrorListener(pn); - } - chooser.activeErrorListener(pn); + + // BLOC UTILE POUR REFACTORISATION: LA CREATION DE LA COURBE SE FAIT DANS LE + // THREAD - if (pn.afficheModaleOk(_src.getImpl().getFrame(), titre)) { - final Object[] obj = chooser.getSelectedVar(); - final H2dVariableType[] var = new H2dVariableType[obj.length]; - System.arraycopy(obj, 0, var, 0, var.length); - final TrPostCourbeFille fille = pnFrame == null ? null : (TrPostCourbeFille) pnFrame.getSelectedFrame(); - if (fille == null) { - new CtuluTaskOperationGUI(_src.getImpl(), titre) { + // if (pn.afficheModaleOk(_src.getImpl().getFrame(), titre)) { + // + // + // + // final Object[] obj = chooser.getSelectedVar(); + // final H2dVariableType[] var = new H2dVariableType[obj.length]; + // System.arraycopy(obj, 0, var, 0, var.length); + // // final TrPostCourbeFille fille = pnFrame == null ? null : + // // (TrPostCourbeFille) pnFrame.getSelectedFrame(); + // // if (fille == null) { + // new CtuluTaskOperationGUI(_src.getImpl(), titre) { + // + // public void act() { + // final ProgressionInterface prog = new ProgressionBuAdapter(this); + // final TrPostCourbeTreeModel model = _pt == null ? build(_src.getImpl(), + // _src.getSource(), chooser + // .getSelectedTimeStepIdx(), var, _ptIdx, prog) : build(_src.getImpl(), + // _src.getSource(), chooser + // .getSelectedTimeStepIdx(), var, _pt, prog); + // if (model != null) { + // _src.addFille(model, "graphe " + (cptGraphe++)/* + // * pnFrame == null ? + // * titre :pnFrame. + // * getNewFrameTitle() + // */, prog, _calque); + // } + // } + // }.start(); + // } else { + // if (_ptIdx == null) { + // TrPostCourbeAddPointsAction.startImportInterpolate(_src.getImpl(), + // fille.getGraphe(), _pt); + // } else { + // TrPostCourbeAddPointsAction.startImportIdx(_src.getImpl(), + // fille.getGraphe(), _ptIdx); + // } + // _src.getImpl().activateInternalFrame(fille); + // } - public void act() { - final ProgressionInterface prog = new ProgressionBuAdapter(this); - final TrPostCourbeTreeModel model = _pt == null ? build(_src.getImpl(), _src.getSource(), chooser - .getSelectedTimeStepIdx(), var, _ptIdx, prog) : build(_src.getImpl(), _src.getSource(), chooser - .getSelectedTimeStepIdx(), var, _pt, prog); - if (model != null) { - _src.addFille(model, pnFrame == null ? titre : pnFrame.getNewFrameTitle(), prog, _calque); - } - } - }.start(); - } else { - if (_ptIdx == null) { - TrPostCourbeAddPointsAction.startImportInterpolate(_src.getImpl(), fille.getGraphe(), _pt); - } else { - TrPostCourbeAddPointsAction.startImportIdx(_src.getImpl(), fille.getGraphe(), _ptIdx); - } - _src.getImpl().activateInternalFrame(fille); - } - } + // } + + + // -- wizard construction --// + TrPostWizardCourbeTemporelle wizard = new TrPostWizardCourbeTemporelle(chooser, + new TrPostActionAddPointFromWidgetCalque.Temporel(_src.getSelectedFilleLayout().getScene(), _src.getImpl())); + + BuWizardDialog DialogWizard = new BuWizardDialog(_src.getImpl().getFrame(), wizard); + + // --affichage du wizard --// + DialogWizard.setSize(600, 500); + DialogWizard.setLocationRelativeTo(_src.getSelectedFilleLayout()); + DialogWizard.setVisible(true); + + } public static void chooseAndBuild(final TrPostProjet _src, final TrPostInterpolatePoint _pt, 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -45,7 +45,7 @@ final FudaaCommonImplementation impl_; - private int[] tidx_; + // private int[] tidx_; private EGGroup updating_; @@ -75,22 +75,36 @@ /** * @param _src */ - public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, + public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src/* + * , + * final + * int + * [ + * ] + * _timeIdx + */, final H2dVariableType[] _vars) { src_ = _src; varGroup_ = new HashMap(); - tidx_ = _timeIdx; - Arrays.sort(tidx_); + // tidx_ = _timeIdx; + // Arrays.sort(tidx_); objIdx_ = FuEmptyArrays.INT0; intepolPt_ = new HashSet(); varSupported_ = new HashSet(Arrays.asList(_vars)); impl_ = _impl; - isAllTimeStep_ = tidx_.length == _src.getNbTimeStep(); + isAllTimeStep_ = true;// tidx_.length == _src.getNbTimeStep(); } - public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, + public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src,/* + * final + * int + * [ + * ] + * _timeIdx + * , + */ final int[] _objIdx, final H2dVariableType[] _vars) { - this(_impl, _src, _timeIdx, _vars); + this(_impl, _src/* , _timeIdx */, _vars); objIdx_ = _objIdx; Arrays.sort(objIdx_); } @@ -112,11 +126,11 @@ if (!isAllTimeStep()) { return; } - if (CtuluLibArray.isEmpty(_idx)) { - return; - } + // if (CtuluLibArray.isEmpty(_idx)) { + // return; + // } timeSteps_ = null; - tidx_ = _idx; + // tidx_ = _idx; buildTimeSteps(); final EGCourbe[] cs = getCourbes(); @@ -250,14 +264,18 @@ protected void buildTimeSteps() { if (timeSteps_ == null) { - timeSteps_ = new double[tidx_.length]; + timeSteps_ = new double[this.src_.getNbTimeStep()/* + * tidx_.length + */]; // mise a jour des pas de temps - for (int i = tidx_.length - 1; i >= 0; i--) { - timeSteps_[i] = src_.getTimeStep(tidx_[i]); + for (int i = this.src_.getNbTimeStep()-1; i >= 0; i--) { + // timeSteps_[i] = src_.getTimeStep(tidx_[i]); + timeSteps_[i] = src_.getTimeStep(i); } } } + protected TrPostCourbeModel containsCourbeFor(final H2dVariableType _t, final EGGroup _g, final int _idx) { for (int i = _g.getChildCount() - 1; i >= 0; i--) { final TrPostCourbeModel res = (TrPostCourbeModel) _g.getCourbeAt(i).getModel(); @@ -625,4 +643,7 @@ return isAllTimeStep_; } + // public void updateTimeStep(int[] _idx, ProgressionInterface _prog) { + // } + } 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -374,7 +374,7 @@ // JOptionPane.showMessageDialog(null, "paste(): nb elements " + // nodesCopyied.size()); - + Set<EbliNode> newNodes = new HashSet<EbliNode>(); // --recuperation des noeuds copies --// if (projet_.nodesCopyied != null) { @@ -384,6 +384,7 @@ EbliNode nouveauNode = node.duplicate(null); getScene().addNode(nouveauNode); + newNodes.add(nouveauNode); // -- duplication des map de property graphique de la widget --// node.getWidget().setPropGraphique(node.getWidget().duplicateGraphicalProperties()); // -- duplication de la taille --// @@ -399,7 +400,7 @@ } // --creation de la commande undo/redo --// - getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(projet_.nodesCopyied)); + getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(newNodes)); // reinitialisation de la liste projet_.nodesCopyied = null; @@ -489,22 +490,29 @@ // 3 cas pour le moment: graphe ou calque ou rien if (!node.hasWidget()) return; - if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { - + + Point locationSouris = this.getMousePosition(); + + // projet_.impl_.message("isHitAt: " + + // node.getWidget().isHitAt(locationSouris)); + + if (node.getCreator() instanceof EbliWidgetCreatorVueCalque && locationSouris != null) { + // -- etape 1: ajout du tree dans fudaaImplementation --// changeTree(node.getWidget().getController_()); // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbar(node.getWidget().getController_()); - } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { + } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe && locationSouris != null) { + // -- etape 1: ajout du tree dans fudaaImplementation --// changeTree(node.getWidget().getController_()); // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarSpecifiqueGraphe(node.getWidget().getController_(), (EbliWidgetCreatorGraphe) node.getCreator()); } else { - + // -- etape 1: on fout eventuellement le tree des layouts --// changeTreeScene(); // -- etape 2: rechargement de la toolbar specifique dans this --// 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 2008-09-08 18:35:19 UTC (rev 3901) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -34,6 +34,7 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorShape; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorTextLabel; +import org.fudaa.ebli.visuallibrary.actions.CommandUndoRedoCreation; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; @@ -303,6 +304,7 @@ positionLegende.y = nodeCalque.getWidget().getPreferredLocation().y; creator.getWidgetCalque().nodeLegende = _legende.createLegende(positionLegende); + return nodeCalque; } @@ -324,6 +326,8 @@ // ajout du node au layout addNode(nodeCercle); + + return nodeCercle; } @@ -337,6 +341,8 @@ // ajout du node au layout addNode(nodeEllipse); + + return nodeEllipse; } @@ -356,6 +362,8 @@ // ajout du node au layout addNode(nodeFleche); + + return nodeFleche; } @@ -369,6 +377,10 @@ // -- rafraichissement de la scene pour eviter les plantages --// getSceneCourante().refresh(); + + // -- commande undo/redo pour la creation de widget --// + getSceneCourante().getCmdMng().addCmd( + new CommandUndoRedoCreation(node, getSceneCourante(), node.getPreferedLocation())); } public EbliNode addRectangle() { Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java 2008-09-09 18:41:08 UTC (rev 3902) @@ -0,0 +1,136 @@ +package org.fudaa.fudaa.tr.post; + +import javax.swing.ButtonGroup; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; + +import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrPostActionAddPointFromWidgetCalque.Temporel; + +import com.memoire.bu.BuWizardTask; + + +/** + * Wizard reserv\xE9 pour la creation de courbes temporelles. + * + * @author Adrien Hadoux + * + */ +public class TrPostWizardCourbeTemporelle extends BuWizardTask { + + + + + + public String getTaskTitle() { + return "Evolutions temporelles"; + } + + public TrPostWizardCourbeTemporelle(MvExportChooseVarAndTime _chooserVarTime, Temporel _actionChoixGraphes) { + super(); + actionChoixGraphes_ = _actionChoixGraphes; + chooserVarTime_ = _chooserVarTime; + } + + public int getStepCount() { + return 3; + } + + public String getStepTitle() { + String r = null; + + switch (current_) { + case 0: + r = TrResource.getS("Choisir les points"); + break; + case 1: + r = TrResource.getS("S\xE9lectionner les variables"); + break; + case 2: + r = TrResource.getS("S\xE9lectionner les graphes"); + break; + } + return r; + } + + public String getStepText() { + String r = null; + + switch (current_) { + case 0: + r = TrResource.getS("Voici les points r\xE9cup\xE9r\xE9s du calque"); + break; + case 1: + r = TrResource.getS("Veuillez s\xE9lectionner le(s) variable(s)"); + break; + case 2: + r = TrResource.getS("Veuillez s\xE9lectionner les graphes pour la cr\xE9ation des courbes ou cr\xE9er un nouveau graphe"); + break; + } + + return r; + } + + private JRadioButton rb0_0, rb0_1, rb0_2; + private ButtonGroup bg0; + private JPanel r0; + private JLabel lb1_0; + private JCheckBox cb1_1; + private JTextField tf1_2; + private JPanel r1; + private JLabel r2; + + + private MvExportChooseVarAndTime chooserVarTime_; + TrPostActionAddPointFromWidgetCalque.Temporel actionChoixGraphes_; + + // public MvExportChooseVarAndTime getChooserVarTime() { + // return chooserVarTime_; + // } + // + // public void setChooserVarTime(MvExportChooseVarAndTime _chooser) { + // chooserVarTime_ = _chooser; + // } + + public JComponent getStepComponent() { + switch (current_) { + case 0: { + + // -- le table des points selectionnes --// + + return new JLabel("En cours valeurs selectionnes"); + } + case 1: { + return chooserVarTime_; + + } + case 2: { + + // -- le panel avec les jlists et combobox --// + + return actionChoixGraphes_.getInterfaceComplete(false, false, true); + } + } + + return null; + } + + /** + * MEthode utilisee pour disabler ou non les boutons suivants + */ + public int getStepDisabledButtons() { + int r = super.getStepDisabledButtons(); + if (current_ == 1) { + + // -- pour empecher d avancer, voir ci dessous + // r |= BuButtonPanel.SUIVANT; + } + return r; + } +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-11 22:14:03
|
Revision: 3910 http://fudaa.svn.sourceforge.net/fudaa/?rev=3910&view=rev Author: deniger Date: 2008-09-11 22:14:11 +0000 (Thu, 11 Sep 2008) Log Message: ----------- modification legende Modified Paths: -------------- 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/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.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/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/calque/CalqueLegendeWidgetAdapter.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/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/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.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/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/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSceneEditor.java 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -4,7 +4,6 @@ import java.util.Collections; import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.graph.GraphScene; @@ -23,14 +22,11 @@ * model de la scene pour l affichage de ses composants */ EbliWidgetJXTreeTableModel treeModel_; - + /** * controller de la scene qui gere les actions et les constructions graphiques */ private EbliSceneController controller_; - - - private class ObjectSelectProvider implements SelectProvider { @@ -60,20 +56,13 @@ } - /** * Le gestionnaire de commande associe \xE0 la scene */ private CtuluCommandManager cmdMng_; - EbliWidgetEditCreator editor_ = EbliWidgetEditCreator.INSTANCE; - private LayerWidget interactionLayer_; - - - - /** * la visu du graphscene */ @@ -91,14 +80,12 @@ addChild(interactionLayer_); visu_ = new LayerWidget(this); addChild(visu_); - + // -- creation de son model tree --// treeModel_ = new EbliWidgetJXTreeTableModel(this); // -- creation de son controlleur --// controller_ = new EbliSceneController(this); - - } @@ -134,22 +121,16 @@ // -- creation de la widget ici --// if (node.getWidget() == null) - // -- on ne cree la widget que sis necessaire + // -- on ne cree la widget que sis necessaire node.setWidget(node.getCreator().create(this)); - - // -- remplissage des proprietes node.getWidget().setPreferredLocation(node.getPreferedLocation()); - if (node.getPreferedSize() != null) - node.getWidget().setPreferredSize(node.getPreferedSize()); + if (node.getPreferedSize() != null) node.getWidget().setPreferredSize(node.getPreferedSize()); // -- ajout dans la vue layer --// visu_.addChild(node.getWidget()); - - - return node.getWidget(); } @@ -160,19 +141,10 @@ return cmdMng_; } - /** - * @return the editor - */ - public EbliWidgetEditCreator getEditor() { - return editor_; - } - public LayerWidget getLayerVisu() { return visu_; } - - public LayerWidget getVisu() { return visu_; } @@ -192,7 +164,6 @@ // } // // } - @Override protected void notifyNodeAdded(EbliNode node, Widget widget) { // -- notifier tous les listener que le noeud a ete attache --// @@ -241,25 +212,14 @@ cmdMng_ = _cmdMng; } - /** - * @param _editor the editor to set - */ - public void setEditor(EbliWidgetEditCreator _editor) { - editor_ = _editor; - } - - - - public void setVisu_(LayerWidget visu_) { + public void setVisuLayer(LayerWidget visu_) { this.visu_ = visu_; } - public LayerWidget getInteractionLayer() { return interactionLayer_; } - - + public EbliSceneController getController() { return controller_; } 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -1,5 +1,8 @@ package org.fudaa.ebli.visuallibrary; +import java.util.HashSet; +import java.util.Set; + import javax.swing.ListSelectionModel; import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; @@ -8,6 +11,7 @@ import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.model.ObjectSceneEventType; +import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuToolBar; @@ -25,25 +29,40 @@ final private WidgetAction alignWithMoveAction; final private WidgetAction alignWithResizeAction; - - + Set<EbliWidgetEditModeListener> listeners_ = new HashSet<EbliWidgetEditModeListener>(); + + public void addEditListener(EbliWidgetEditModeListener _l) { + listeners_.add(_l); + } + + public void removeEditListener(EbliWidgetEditModeListener _l) { + listeners_.remove(_l); + } + + public void fireEditStart(Widget w) { + for (EbliWidgetEditModeListener l : listeners_) { + l.editStart(w); + } + } + + public void fireEditStop(Widget w) { + for (EbliWidgetEditModeListener l : listeners_) { + l.editStop(w); + } + } + public final WidgetAction rectangularSelection_; - + public EbliSceneController(EbliScene _scene) { - - + scene_ = _scene; - - alignWithMoveAction = ActionFactory.createAlignWithMoveAction(scene_.getVisu(), scene_.getInteractionLayer(), - ActionFactory - .createDefaultAlignWithMoveDecorator(), false); + ActionFactory.createDefaultAlignWithMoveDecorator(), false); alignWithResizeAction = ActionFactory.createAlignWithResizeAction(scene_.getVisu(), scene_.getInteractionLayer(), - ActionFactory - .createDefaultAlignWithMoveDecorator(), false); + ActionFactory.createDefaultAlignWithMoveDecorator(), false); rectangularSelection_ = ActionFactory.createRectangularSelectAction(scene_, scene_.getInteractionLayer()); // -- ajoute l'action du zoom ( ctrl + clic) @@ -52,52 +71,51 @@ // -- ajouter le menu popup de base setMenuBase(); - + } - - + public void setMenuBase() { - // getActions().addAction(ActionFactory.createPopupMenuAction(new - // PopupMenuProvider() { - // public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - // JPopupMenu popup = new JPopupMenu(); - // - // JMenuItem menuItem1 = popup.add("Ajouter Graphe"); - // menuItem1.addActionListener(new ActionListener() { - // - // public void actionPerformed(ActionEvent e) { - // - // } - // - // }); - // - // JMenuItem menuItem2 = popup.add("Ajouter Maillage"); - // menuItem2.addActionListener(new ActionListener() { - // - // public void actionPerformed(ActionEvent e) { - // - // } - // - // }); - // - // JMenuItem menuItem3 = popup.add("Fermer l'objet"); - // menuItem3.addActionListener(new ActionListener() { - // - // public void actionPerformed(ActionEvent e) { - // - // // fermeture des widgets children - // EbliScene.this.removeChildren(); - // // fermeture du widget donne - // EbliScene.this.removeFromParent(); - // - // } - // - // }); - // return popup; - // } - // })); + // getActions().addAction(ActionFactory.createPopupMenuAction(new + // PopupMenuProvider() { + // public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + // JPopupMenu popup = new JPopupMenu(); + // + // JMenuItem menuItem1 = popup.add("Ajouter Graphe"); + // menuItem1.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // + // } + // + // }); + // + // JMenuItem menuItem2 = popup.add("Ajouter Maillage"); + // menuItem2.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // + // } + // + // }); + // + // JMenuItem menuItem3 = popup.add("Fermer l'objet"); + // menuItem3.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // + // // fermeture des widgets children + // EbliScene.this.removeChildren(); + // // fermeture du widget donne + // EbliScene.this.removeFromParent(); + // + // } + // + // }); + // return popup; + // } + // })); } - + /** * Methode qui retourne ou cree le tree associe a la scene * @@ -145,7 +163,7 @@ // -- ajout du synchroniser du tree/scene --// - scene_.addObjectSceneListener(new EbliWidgetSynchroniser(scene_.getTreeModel(), treeScene_), + scene_.addObjectSceneListener(new EbliWidgetSynchroniser(scene_.getTreeModel(), treeScene_), ObjectSceneEventType.OBJECT_SELECTION_CHANGED); return treeScene_; @@ -159,6 +177,7 @@ public BuMenuBar getMenubarComponent() { return null; } + public WidgetAction getMoveAction() { return alignWithMoveAction; } @@ -169,5 +188,5 @@ public WidgetAction getRectangularSelection() { return rectangularSelection_; } - + } 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -7,6 +7,8 @@ import java.util.HashMap; import java.util.Map; +import javax.swing.JComponent; + import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; @@ -25,37 +27,109 @@ */ public class EbliWidget extends Widget implements BSelecteurTargetInterface { - private EbliScene scene_; + public final static String COLORCONTOUR = "ColorContour"; + public final static String COLORFOND = "colorFond"; + + public final static String FONT = "font"; + /** + * Liste des clef utilisees pour les composants graphiques + */ + public final static String LINEMODEL = "lineModel"; + + public final static String ROTATION = "rotation"; + + protected EbliWidgetController controller_; + boolean isGroup; + boolean isInEditMode_ = false; + + /** * Map contenant tous les objets graphiques de la widget generique. key: lineModel => le lignemodel du ebliWidget. * key: color => couleur de fond. */ protected Map<String, Object> propGraphique; + private EbliScene scene_; - public Map<String, Object> getPropGraphique() { - return propGraphique; - } + private boolean useBorder_ = true; - public void setPropGraphique(Map<String, Object> propGraphique) { - this.propGraphique = propGraphique; + /** + * @param scene + * @param Point : indiaue la location preferentiel. peut etre nul + */ + public EbliWidget(EbliScene scene) { + super(scene); + setScene(scene); + // -- remplisage de la map de propriete grahiques --// + propGraphique = new HashMap<String, Object>(); + + // -- ajout du traceligneModel utilise par les filles--// + propGraphique.put(LINEMODEL, new TraceLigneModel()); + + // -- ajout de la couleur de fond par default blanc--// + propGraphique.put(COLORFOND, Color.WHITE); + + // -- ajout de la couleur de contour par default black--// + propGraphique.put(COLORCONTOUR, Color.BLACK); + + // -- ajout de la font par default--// + propGraphique.put(FONT, new Font("Helvetica.Italic", Font.PLAIN, 12)); + + // -- ajout de l angle de rotation par default PI --// + propGraphique.put(ROTATION, Math.PI); } - protected EbliWidgetController controller_; - /** - * Liste des clef utilisees pour les composants graphiques + * Utilise par la plupart des composant sauf calque et graphe qui necessitent un controller particulier. + * + * @param scene + * @param controllerDefaut */ - public final static String LINEMODEL = "lineModel"; - public final static String COLORCONTOUR = "ColorContour"; - public final static String COLORFOND = "colorFond"; + public EbliWidget(EbliScene scene, boolean controllerDefaut) { + this(scene); - public final static String ROTATION = "rotation"; - public final static String FONT = "font"; + // -- creation du controller par defaut --// + if (controllerDefaut) controller_ = new EbliWidgetController(this); - private boolean useBorder_ = true; + } + public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { + // voir EGObject + + } + + public Map<String, Object> duplicateGraphicalProperties() { + // FIXME il faut juste cloner la map ... + Map<String, Object> mapDupliquee = new HashMap<String, Object>(); + + mapDupliquee.put(LINEMODEL, new TraceLigneModel(getTraceLigneModel())); + mapDupliquee.put(COLORCONTOUR, getColorContour()); + mapDupliquee.put(COLORFOND, getColorFond()); + mapDupliquee.put(ROTATION, getRotation()); + mapDupliquee.put(FONT, getFormeFont()); + return mapDupliquee; + } + + protected void editingStart() { + isInEditMode_ = true; + getEbliScene().getController().fireEditStart(this); + + } + + protected void editingStop() { + isInEditMode_ = false; + getEbliScene().getController().fireEditStop(this); + } + + public Color getColorContour() { + return (Color) propGraphique.get(COLORCONTOUR); + } + + public Color getColorFond() { + return (Color) propGraphique.get(COLORFOND); + } + /** * retourne la liste des interfaces configurees. * @@ -72,28 +146,26 @@ */}; } - protected String getTitle() { - EbliNode n = (EbliNode) getEbliScene().findObject(this); - return n == null ? CtuluLibString.EMPTY_STRING : n.getTitle(); + public EbliWidgetController getController() { + return controller_; } - /** - * Retourne une interface widgetConfigure qui permet de gerer les interfaces a creer - * - * @return - */ - private BConfigurableInterface getSingleConfigureInterface(boolean lineModel_, boolean colorsContours_, - boolean colorFonds_, boolean rotations_, boolean police_) { + public EbliScene getEbliScene() { + return scene_; + } - // -- retourne l interface qui va bien qui permet de creer les composants - // graphiques correspondant --// - return new WidgetConfigure(lineModel_, colorsContours_, colorFonds_, rotations_, police_, this); + public Font getFormeFont() { + return (Font) propGraphique.get(FONT); } - public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { - // voir EGObject - + protected EbliWidget getGroup() { + Widget parent = getParentWidget(); + while (parent != getScene() && parent != null) { + if (parent instanceof EbliWidget && ((EbliWidget) parent).isGroup) { return ((EbliWidget) parent); } + parent = parent.getParentWidget(); + } + return null; } // useless @@ -124,109 +196,67 @@ return propGraphique.get(_key); } - public void removePropertyChangeListener(String _key, PropertyChangeListener _l) {} + public Map<String, Object> getPropGraphique() { + return propGraphique; + } + public double getRotation() { + if (propGraphique.get(ROTATION) instanceof Integer) propGraphique.put(ROTATION, new Double((Integer) propGraphique + .get(ROTATION))); + return (Double) propGraphique.get(ROTATION); + } + /** - * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens - * parametres dans la commande undo/redo. + * Retourne une interface widgetConfigure qui permet de gerer les interfaces a creer + * + * @return */ - public boolean setProperty(String _key, Object prop) { + private BConfigurableInterface getSingleConfigureInterface(boolean lineModel_, boolean colorsContours_, + boolean colorFonds_, boolean rotations_, boolean police_) { - // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour - // l ancien lignemodel --// - if (_key.equals(LINEMODEL)) { - getTraceLigneModel().updateData((TraceLigneModel) prop); - prop = getTraceLigneModel(); - } else if (_key.equals(ROTATION) && prop instanceof Integer) { - // -- cas particulier si il s agit de la rotation --// - // -- il faut transformer les degres en radian --// - int degre = ((Integer) prop).intValue(); - double radian = degre * Math.PI / 180; - prop = new Double(radian); + // -- retourne l interface qui va bien qui permet de creer les composants + // graphiques correspondant --// + return new WidgetConfigure(lineModel_, colorsContours_, colorFonds_, rotations_, police_, this); - } - - // -- creation de la commande undo/redo --// - CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); - - // -- ajout de la widget en question ainsi que la oldpropertie --// - undoRedo.addWidget(this); - undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); - - // --mise a jout de la map de proprietes --// - propGraphique.put(_key, prop); - - // -- ajout de la nouvelle propertie --// - undoRedo.addNewPropertie(propGraphique); - - // -- enregistrement de la commande undo/redo --// - if (getEbliScene().getCmdMng() != null) { - getEbliScene().getCmdMng().addCmd(undoRedo); - } - - // -- mise a jour des parametres de la map --// - refreshMyProperties(); - - return true; } - public boolean isTitleModifiable() { - return true; + protected String getTitle() { + EbliNode n = (EbliNode) getEbliScene().findObject(this); + return n == null ? CtuluLibString.EMPTY_STRING : n.getTitle(); } /** - * Utilise par la plupart des composant sauf calque et graphe qui necessitent un controller particulier. - * - * @param scene - * @param controllerDefaut + * Retourne les proprietes de la map. */ - public EbliWidget(EbliScene scene, boolean controllerDefaut) { - this(scene); - - // -- creation du controller par defaut --// - if (controllerDefaut) controller_ = new EbliWidgetController(this); - + public TraceLigneModel getTraceLigneModel() { + return (TraceLigneModel) propGraphique.get(LINEMODEL); } /** - * @param scene - * @param Point : indiaue la location preferentiel. peut etre nul + * @return the isGroup: true si le widget represente un groupe de widget comme un groupe par exemple */ - public EbliWidget(EbliScene scene) { - super(scene); - setScene(scene); + public boolean isGroup() { + return isGroup; + } - // -- remplisage de la map de propriete grahiques --// - propGraphique = new HashMap<String, Object>(); + public boolean isHitAt(Point localLocation) { - // -- ajout du traceligneModel utilise par les filles--// - propGraphique.put(LINEMODEL, new TraceLigneModel()); + if (localLocation == null) return false; - // -- ajout de la couleur de fond par default blanc--// - propGraphique.put(COLORFOND, Color.WHITE); - - // -- ajout de la couleur de contour par default black--// - propGraphique.put(COLORCONTOUR, Color.BLACK); - - // -- ajout de la font par default--// - propGraphique.put(FONT, new Font("Helvetica.Italic", Font.PLAIN, 12)); - - // -- ajout de l angle de rotation par default PI --// - propGraphique.put(ROTATION, Math.PI); + if (getBounds() != null) return isVisible() && getBounds().contains(localLocation); + else + // return isVisible() && getPreferredBounds().contains(localLocation); + return false; } - public EbliWidgetController getController_() { - return controller_; + public boolean isInEditMode() { + return isInEditMode_; } - public void setController_(EbliWidgetController controller_) { - this.controller_ = controller_; + public boolean isTitleModifiable() { + return true; } - public EbliScene getEbliScene() { - return scene_; - } - public boolean isUseBorder() { return useBorder_; } @@ -242,117 +272,101 @@ } } - boolean isGroup; - /** - * @return the isGroup: true si le widget represente un groupe de widget comme un groupe par exemple + * Methode qui raffraichis les proprietes de la widget. */ - public boolean isGroup() { - return isGroup; + public void refreshMyProperties() { + getEbliScene().refresh(); } - protected EbliWidget getGroup() { - Widget parent = getParentWidget(); - while (parent != getScene() && parent != null) { - if (parent instanceof EbliWidget && ((EbliWidget) parent).isGroup) { return ((EbliWidget) parent); } - parent = parent.getParentWidget(); - } - return null; + public void removePropertyChangeListener(String _key, PropertyChangeListener _l) {} + + public void setColorContour(Color newColor) { + propGraphique.put(COLORCONTOUR, newColor); } - /** - * @param isGroup the isGroup to set - */ - public void setGroup(boolean isGroup) { - this.isGroup = isGroup; + public void setColorFond(Color newColor) { + propGraphique.put(COLORFOND, newColor); } - public void setScene(EbliScene _scene) { - this.scene_ = _scene; + public void setController_(EbliWidgetController controller_) { + this.controller_ = controller_; } - public void setUseBorder(boolean _useBorder) { - useBorder_ = _useBorder; + public void setFormeFont(Font newFont) { + propGraphique.put(FONT, newFont); } /** - * Methode qui raffraichis les proprietes de la widget. + * @param isGroup the isGroup to set */ - public void refreshMyProperties() { - getEbliScene().refresh(); + public void setGroup(boolean isGroup) { + this.isGroup = isGroup; } - public Map<String, Object> duplicateGraphicalProperties() { - // FIXME il faut juste cloner la map ... - Map<String, Object> mapDupliquee = new HashMap<String, Object>(); - - mapDupliquee.put(LINEMODEL, new TraceLigneModel(getTraceLigneModel())); - mapDupliquee.put(COLORCONTOUR, getColorContour()); - mapDupliquee.put(COLORFOND, getColorFond()); - mapDupliquee.put(ROTATION, getRotation()); - mapDupliquee.put(FONT, getFormeFont()); - return mapDupliquee; - } - - - public boolean isHitAt(Point localLocation) { - - - if (localLocation == null) - return false; - - System.err.println("getBounds:" + this.convertLocalToScene(getBounds())); - System.err.println("Location:" + this.convertSceneToLocal(localLocation)); - if (getBounds() != null) - return isVisible() && getBounds().contains(localLocation); - else - // return isVisible() && getPreferredBounds().contains(localLocation); - return false; - } - /** - * Retourne les proprietes de la map. + * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens + * parametres dans la commande undo/redo. */ - public TraceLigneModel getTraceLigneModel() { - return (TraceLigneModel) propGraphique.get(LINEMODEL); - } + public boolean setProperty(String _key, Object prop) { - public void setTraceLigneModel(TraceLigneModel _l) { - propGraphique.put(LINEMODEL, _l); - } + // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour + // l ancien lignemodel --// + if (_key.equals(LINEMODEL)) { + getTraceLigneModel().updateData((TraceLigneModel) prop); + prop = getTraceLigneModel(); + } else if (_key.equals(ROTATION) && prop instanceof Integer) { + // -- cas particulier si il s agit de la rotation --// + // -- il faut transformer les degres en radian --// + int degre = ((Integer) prop).intValue(); + double radian = degre * Math.PI / 180; + prop = new Double(radian); - public void setColorContour(Color newColor) { - propGraphique.put(COLORCONTOUR, newColor); - } + } - public Color getColorContour() { - return (Color) propGraphique.get(COLORCONTOUR); - } + // -- creation de la commande undo/redo --// + CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); - public void setColorFond(Color newColor) { - propGraphique.put(COLORFOND, newColor); - } + // -- ajout de la widget en question ainsi que la oldpropertie --// + undoRedo.addWidget(this); + undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); - public Color getColorFond() { - return (Color) propGraphique.get(COLORFOND); + // --mise a jout de la map de proprietes --// + propGraphique.put(_key, prop); + + // -- ajout de la nouvelle propertie --// + undoRedo.addNewPropertie(propGraphique); + + // -- enregistrement de la commande undo/redo --// + if (getEbliScene().getCmdMng() != null) { + getEbliScene().getCmdMng().addCmd(undoRedo); + } + + // -- mise a jour des parametres de la map --// + refreshMyProperties(); + + return true; } - public double getRotation() { - if (propGraphique.get(ROTATION) instanceof Integer) propGraphique.put(ROTATION, new Double((Integer) propGraphique - .get(ROTATION))); - return (Double) propGraphique.get(ROTATION); + public void setPropGraphique(Map<String, Object> propGraphique) { + this.propGraphique = propGraphique; + } public void setRotation(double rotation) { propGraphique.put(ROTATION, rotation); } - public Font getFormeFont() { - return (Font) propGraphique.get(FONT); + public void setScene(EbliScene _scene) { + this.scene_ = _scene; + } + public void setTraceLigneModel(TraceLigneModel _l) { + propGraphique.put(LINEMODEL, _l); } - public void setFormeFont(Font newFont) { - propGraphique.put(FONT, newFont); + public void setUseBorder(boolean _useBorder) { + useBorder_ = _useBorder; } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -17,7 +17,6 @@ * classe qui genere une bordure pour contenir une widget classique. * * @author genesis - * */ public class EbliWidgetBordure extends EbliWidget { @@ -27,58 +26,65 @@ EbliWidget intern_; /** - * Retourne le controlleur de son objet contenu. Le controlleur de la bordure - * n'a pas besoin d'etre recup\xE9r\xE9. + * Retourne le controlleur de son objet contenu. Le controlleur de la bordure n'a pas besoin d'etre recup\xE9r\xE9. */ @Override - public EbliWidgetController getController_() { - return getIntern().getController_(); + public EbliWidgetController getController() { + return getIntern().getController(); } public float epaisseurHisto_ = 0; + private Insets insets_; + /** * constructeur qui gere un controller uniquement pour les actions. * * @param scene */ public EbliWidgetBordure(EbliWidget _intern) { - this(_intern, true, true); - + this(_intern, true, true); } + @Override + public boolean isInEditMode() { + return intern_.isInEditMode_; + } + public EbliWidgetBordure(EbliWidget _intern, boolean canMove, boolean canResize) { super(_intern.getEbliScene(), false); - + intern_ = _intern; - - //-- mise a jour du layout - setLayout(new OverlayLayoutGap(createInset((int) getTraceLigneModel().getEpaisseur()))); - - // -- ajout du child --// + + insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); + setLayout(new OverlayLayoutGap(insets_)); + + // -- ajout du child --// addChild(intern_); - - // --ajout du controller specifique au bordure --// + + // --ajout du controller specifique au bordure --// this.setController_(new EbliWidgetControllerActionOnly(this, canMove, canResize)); } - - + public Insets createInset(int epaisseur) { return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); } - -protected void paintWidget() { + protected void paintWidget() { + // -- mise a jour de la fonte que si il y a eu une modification --// Graphics2D g = getGraphics(); Rectangle rec = getClientArea(); - + if (epaisseurHisto_ != getTraceLigneModel().getEpaisseur()) { - setLayout(new OverlayLayoutGap(createInset((int) getTraceLigneModel().getEpaisseur()))); + insets_.bottom = (int) getTraceLigneModel().getEpaisseur(); + insets_.top = insets_.bottom; + insets_.left = insets_.bottom; + insets_.right = insets_.bottom; Rectangle newBounds = getBounds(); - newBounds.height += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; + newBounds.height += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; newBounds.width += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; setPreferredBounds(newBounds); } @@ -88,47 +94,44 @@ g.translate(rec.x, rec.y); // la ligne - + TraceLigne l = new TraceLigne(getTraceLigneModel()); - + l.setCouleur(getColorContour()); l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); - + g.translate(-rec.x, -rec.y); - + epaisseurHisto_ = getTraceLigneModel().getEpaisseur(); } /** - * surcharge des methodes getProperty pour recuperer les proprietes graphiques - * et les dipatcher a son conteneur + * surcharge des methodes getProperty pour recuperer les proprietes graphiques et les dipatcher a son conteneur */ public Object getProperty(String _key) { - // -- la bordure ne gere que tracemodel et couleur contour, le reste est + // -- la bordure ne gere que tracemodel et couleur contour, le reste est // dispatch\xE9 a son conteneur --// if (_key.equals(ROTATION)) { - double radian = intern_.getRotation(); + double radian = intern_.getRotation(); return Integer.valueOf((int) (radian * 180 / Math.PI)); - } - else if (_key.equals(FONT)) { + } else if (_key.equals(FONT)) { return intern_.propGraphique.get(_key); } else if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); - } - else - return propGraphique.get(_key); + } else return propGraphique.get(_key); } -/** - * Methode directement appelee apres modification des parametres renvoye par - * le getproperty. Ajoute les anciens parametres dans la commande undo/redo. + /** + * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens + * parametres dans la commande undo/redo. */ public boolean setProperty(String _key, Object prop) { + if (_key.equals(FONT) || _key.equals(COLORFOND)) { return intern_.setProperty(_key, prop); } // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// @@ -149,21 +152,19 @@ // -- ajout de la widget en question ainsi que la oldpropertie --// undoRedo.addWidget(this); - // --mise a jout de la map de proprietes --// if (_key.equals(LINEMODEL) || _key.equals(COLORCONTOUR)) { undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); propGraphique.put(_key, prop); - // -- ajout de la nouvelle propertie --// + // -- ajout de la nouvelle propertie --// undoRedo.addNewPropertie(propGraphique); } else { undoRedo.addOldPropertie(intern_.duplicateGraphicalProperties()); intern_.propGraphique.put(_key, prop); - // -- ajout de la nouvelle propertie --// + // -- ajout de la nouvelle propertie --// undoRedo.addNewPropertie(intern_.propGraphique); } - // -- enregistrement de la commande undo/redo --// if (getEbliScene().getCmdMng() != null) { @@ -177,15 +178,14 @@ } /** - * surcharge des getter et setter graphical properties pour rediriger les - * infos vers les widgets contenu + * surcharge des getter et setter graphical properties pour rediriger les infos vers les widgets contenu */ public Map<String, Object> getPropGraphique() { - + Map<String, Object> mapMeltingPot = new HashMap<String, Object>(); mapMeltingPot.put(COLORCONTOUR, getColorContour()); mapMeltingPot.put(LINEMODEL, getTraceLigneModel()); - + // -- les autres valeurs conernent le contenu --// mapMeltingPot.put(ROTATION, intern_.getRotation()); mapMeltingPot.put(FONT, intern_.getFormeFont()); @@ -194,22 +194,20 @@ return mapMeltingPot; } - /** - * surcharge des getter et setter graphical properties pour rediriger les - * infos vers les widgets contenu + * surcharge des getter et setter graphical properties pour rediriger les infos vers les widgets contenu */ public void setPropGraphique(Map<String, Object> propGraphique) { this.propGraphique.put(COLORCONTOUR, propGraphique.get(COLORCONTOUR)); this.propGraphique.put(LINEMODEL, propGraphique.get(LINEMODEL)); - - + // -- on redirige les proprietes font,couleur de fond et rotation --// this.intern_.setFormeFont((Font) propGraphique.get(FONT)); this.intern_.setColorFond((Color) propGraphique.get(COLORFOND)); this.intern_.setRotation((Double) propGraphique.get(ROTATION)); - + } + public EbliWidget getIntern() { return intern_; } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetEditModeListener.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -0,0 +1,20 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary; + +import org.netbeans.api.visual.widget.Widget; + +/** + * Un Listener pour le mode edition + * @author deniger + * + */ +public interface EbliWidgetEditModeListener { + + + void editStart(Widget w); + void editStop(Widget w); + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -114,10 +114,10 @@ // son contenant --// if (node.getWidget() instanceof EbliWidgetBordure) { EbliWidgetBordure bordure = (EbliWidgetBordure) node.getWidget(); - poppup = bordure.intern_.getController_().getPopup(); + poppup = bordure.intern_.getController().getPopup(); } else - poppup = node.getWidget().getController_().getPopup(); + poppup = node.getWidget().getController().getPopup(); poppup.show(arbre_, x, y); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -26,8 +26,8 @@ public void undo() { for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { - if (bloque_) it.next().getController_().replaceActionResizeAndMove(); - else it.next().getController_().removeActionResizeAndMove(); + if (bloque_) it.next().getController().replaceActionResizeAndMove(); + else it.next().getController().removeActionResizeAndMove(); } widget_.get(0).getEbliScene().refresh(); @@ -35,8 +35,8 @@ public void redo() { for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { - if (bloque_) it.next().getController_().removeActionResizeAndMove(); - else it.next().getController_().replaceActionResizeAndMove(); + if (bloque_) it.next().getController().removeActionResizeAndMove(); + else it.next().getController().replaceActionResizeAndMove(); } widget_.get(0).getEbliScene().refresh(); } 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -68,9 +68,9 @@ // -- bloquage de la widget --// if (bloque_) - currentNode.getWidget().getController_().removeActionResizeAndMove(); + currentNode.getWidget().getController().removeActionResizeAndMove(); else - currentNode.getWidget().getController_().replaceActionResizeAndMove(); + currentNode.getWidget().getController().replaceActionResizeAndMove(); listeWidget.add(currentNode.getWidget()); // -- rafraichissement de la scene --// 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -59,7 +59,7 @@ // retaillables --// for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode node = it.next(); - if (node.hasWidget() && node.getWidget().getController_().isCanResize()) + if (node.hasWidget() && node.getWidget().getController().isCanResize()) listeNodeAutorises .add(node); } 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -60,7 +60,7 @@ // retaillables --// for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode node = it.next(); - if (node.hasWidget() && node.getWidget().getController_().isCanResize()) + if (node.hasWidget() && node.getWidget().getController().isCanResize()) listeNodeAutorises .add(node); } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -1,181 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Window; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Iterator; -import java.util.List; - -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JScrollPane; -import javax.swing.JToolBar; -import javax.swing.JTree; - -import org.flexdock.docking.DockingConstants; -import org.flexdock.docking.DockingManager; -import org.flexdock.docking.DockingPort; -import org.flexdock.docking.defaults.DefaultDockingPort; -import org.flexdock.view.View; -import org.fudaa.ebli.calque.BArbreCalque; -import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.commun.EbliActionInterface; -import org.fudaa.ebli.commun.EbliComponentFactory; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.courbe.EGFillePanel; -import org.fudaa.ebli.courbe.EGGrapheTreeModel; -import org.fudaa.ebli.ressource.EbliResource; - -/** - * @author deniger - */ -public class EbliWidgetEditCreator { - - public EbliWidgetEditCreator() { - - } - - /** - * Singleton pour configurer par defaut EbliScene - */ - public static final EbliWidgetEditCreator INSTANCE = new EbliWidgetEditCreator(); - - public Window createFrame(ZEbliCalquesPanel pn, String title) { - JFrame frame = new JFrame(title); - - frame.getContentPane().setLayout(new BorderLayout()); - JMenu[] specificMenus = pn.getSpecificMenus(EbliLib.getS("Vue 2D")); - JMenuBar mb = new JMenuBar(); - frame.setJMenuBar(mb); - for (int i = 0; i < specificMenus.length; i++) { - mb.add(specificMenus[i]); - } - JToolBar tb = new JToolBar(); - List actions = pn.getController().getActions(); - for (Iterator iterator = actions.iterator(); iterator.hasNext();) { - EbliActionInterface object = (EbliActionInterface) iterator.next(); - if (object == null) { - tb.addSeparator(); - } else { - tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); - } - } - frame.getContentPane().add(tb, BorderLayout.NORTH); - frame.setIconImage(EbliResource.EBLI.getImage("lissage")); - // pn.setPreferredSize(pn.getPreferredSize()); - final DefaultDockingPort globalPort = createDockingPort(); - JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("lissage"), EbliLib.getS("Vue 2D")); - - DockingManager.dock(centerComponent, (DockingPort) globalPort); - JComponent rightComponent = createView(new JScrollPane(new BArbreCalque(pn.getArbreCalqueModel())), - EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); - DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); - - frame.getContentPane().add(globalPort, BorderLayout.CENTER); - frame.addWindowListener(new WindowAdapter() { - - @Override - public void windowClosed(WindowEvent _e) { - globalPort.clear(); - } - - }); - - // -- cas particulier, on ajoute la legende --// - pn.addCalqueLegend(); - pn.repaint(); - - return frame; - - } - - public Window createFrame(EGFillePanel pn, String title) { - JFrame frame = new JFrame(title); - - frame.getContentPane().setLayout(new BorderLayout()); - frame.setTitle(title); - frame.setIconImage(EbliResource.EBLI.getImage("curves")); - EbliActionInterface[] specificInterfaces = pn.getSpecificActions(); - JMenuBar mb = new JMenuBar(); - frame.setJMenuBar(mb); - JMenu menu = new JMenu("Menu graphe"); - pn.fillSpecificMenu(menu); - - // for (int i = 0; i < specificInterfaces.length; i++) { - // mb.add(new JMenu(specificInterfaces[i])); - // } - mb.add(menu); - - JToolBar tb = new JToolBar(); - - for (int i = 0; i < specificInterfaces.length; i++) { - EbliActionInterface object = specificInterfaces[i]; - if (object == null) { - tb.addSeparator(); - } else { - tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); - } - } - frame.getContentPane().add(tb, BorderLayout.NORTH); - pn.setPreferredSize(pn.getPreferredSize()); - final DefaultDockingPort globalPort = createDockingPort(); - JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("curves"), EbliLib.getS("Courbes")); - DockingManager.dock(centerComponent, (DockingPort) globalPort); - // POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// - JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); - tree.setSelectionModel(((EGGrapheTreeModel) pn.getGraphe().getModel()).getSelectionModel()); - JComponent rightComponent = createView(new JScrollPane(tree), EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); - DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); - - frame.getContentPane().add(globalPort, BorderLayout.CENTER); - frame.addWindowListener(new WindowAdapter() { - - @Override - public void windowClosed(WindowEvent _e) { - globalPort.clear(); - } - - }); - return frame; - - } - - protected static DefaultDockingPort createDockingPort() { - DefaultDockingPort port = new DefaultDockingPort(); - port.setPreferredSize(new Dimension(400, 400)); - return port; - } - - // protected static JComponent createDockableComponent(String name) { - // JPanel panel = new JPanel(new BorderLayout()); - // panel.setBorder(new LineBorder(Color.BLUE)); - // panel.add(new JLabel("COUCOU " + name)); - // return createView(panel, name, true); - // } - - public static JComponent createView(JComponent jc, Icon ic, String name) { - return createView(jc, ic, name, false); - } - - public static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { - View view = new View(name); - view.setIcon(ic); - view.getViewProperties().setDockingEnabled(false); - if (dockage) { - view.addAction(DockingConstants.CLOSE_ACTION); - view.getViewProperties().setDockingEnabled(true); - } - view.setContentPane(jc); - view.setTitle(name, true); - view.setPreferredSize(jc.getPreferredSize()); - // DockingManager.registerDockable(view.getComponent(), name); - - return view; - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -77,8 +77,8 @@ * @param _scene la scene * @return la widfget de la legende. */ - public static EbliWidget createLegendeWidget(EbliWidgetCalqueLegende _widgetLegende, BCalqueLegendePanel _calqueLegende, - EbliScene _scene) { + public static EbliWidget createLegendeWidget(EbliWidgetCalqueLegende _widgetLegende, + BCalqueLegendePanel _calqueLegende, EbliScene _scene) { // --creation de la widget conteneur --// BPalettePlageInterface listeplages = null; @@ -99,6 +99,7 @@ titre.setVerticalAlignment(VerticalAlignment.CENTER); titre.setLabel(((JLabel) c).getText()); titre.setEnabled(true); + titre.setFont(c.getFont()); _widgetLegende.addChild(titre); } @@ -115,10 +116,12 @@ titre.setAlignment(Alignment.CENTER); titre.setVerticalAlignment(VerticalAlignment.CENTER); titre.setLabel(listeplages.getTitre()); + titre.setFont(pal.getFont()); titre.setEnabled(true); _widgetLegende.addChild(titre); LabelWidget sstitre = new LabelWidget(_scene); sstitre.setAlignment(Alignment.CENTER); + titre.setFont(pal.getFont()); sstitre.setVerticalAlignment(VerticalAlignment.CENTER); sstitre.setLabel(listeplages.getSousTitre()); sstitre.setEnabled(true); @@ -131,7 +134,7 @@ FuLog.warning("jlist " + j + ") " + plage.getLegende()); // -- ajout d'une widget plage --// - EbliWidgetPlageTitle lw = new EbliWidgetPlageTitle(_scene, plage, null); + EbliWidgetPlage lw = new EbliWidgetPlage(_scene, plage, null); lw.setUseBorder(false); lw.setEnabled(true); @@ -187,7 +190,7 @@ _widgetLegende.setController_(new EbliWidgetControllerMenuOnly(_widgetLegende, false)); // -- prendre en compte le resize automatique --// - _widgetLegende.oldFont_ = new Font("Helvetica", Font.BOLD, 40); + _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); _widgetLegende.repaint(); return _widgetLegende; @@ -228,7 +231,6 @@ */ @Override protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { - legendePanel_ = _pnLeg; @@ -242,8 +244,6 @@ */ public EbliNode createLegende(Point _location) { - - EbliNodeDefault def = new EbliNodeDefault(); def.setPreferedLocation(_location); // def.setPreferedSize(new Dimension(150, 250)); 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 2008-09-11 22:12:30 UTC (rev 3909) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-11 22:14:11 UTC (rev 3910) @@ -19,11 +19,10 @@ 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.action.InplaceEditorProvider.ExpansionDirection; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Widget; -import com.memoire.fu.FuLog; +import com.memoire.bu.BuLib; /** * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font @@ -34,12 +33,13 @@ BCalqueLegendePanel legendePanel_; // BArbreCalqueModel modelTree_; boolean maj = true; - Font oldFont_; + // Font oldFont_; + public EbliWidgetCalqueLegende(EbliScene _scene, boolean _controller/* , BArbreCalqueModel model */, BCalqueLegendePanel _legendePanel) { super(_scene, _controller); - oldFont_ = getFormeFont(); + // oldFont_ = getFormeFont(); // -- la legende est un listener des modifs de son calque --// _legendePanel.getCalque().addPropertyChangeListener("paletteCouleur", this); _legendePanel.getCalque().addPropertyChangeListener("paletteTitle", this); @@ -53,7 +53,6 @@ WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); // -- ajout de l action au label correspondant --// this.getActions().addAction(editorAction); - } /** @@ -73,91 +72,174 @@ return null; } - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, - JComponent _editor) { - return null; + @Override + public void setFormeFont(Font _newFont) { + super.setFormeFont(_newFont); + updateFont(_newFont); } - public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, - JComponent _editor, Rectangle _viewBounds) { - return null; - } + @Override + public boolean setProperty(String _key, Object _prop) { + boolean res = super.setProperty(_key, _prop); + if ("font".equals(_key)) { + Font ft = (Font) _prop; + updateFont(ft); + return true; + } + return res; - public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, - Widget _widget, JComponent _editor, boolean _commit) { - // - // - // reconstructWidget(this, legendePanel_, getEbliScene(), modelTree_); - // this.getEbliScene().refresh(); } - public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, - Widget _widget, JComponent _editor) {} - - protected void notifyRemoved() { - legendePanel_.getCalque().removePropertyChangeListener("paletteCouleur", this); - legendePanel_.getCalque().removePropertyChangeListener("paletteTitle", this); + @Override + protected void paintWidget() { + if (mustUpdateFont_) { + updateFont(getFormeFont()); + } + super.paintWidget(); } - protected void paintWidget() { + boolean mustUpdateFont_ = false; - // -- mise a jour de la fonte que si il y a eu une modification --// - if (oldFont_ != getFormeFont() || maj) { - maj = false; - // -- calcul des max height et width pour resize les composants --// - Rectangle newBounds = resizeMaxLegende(); + private void updateFont(Font ft) { + if (getGraphics() == null) { + mustUpdateFont_ = true; + return; + } + mustUpdateFont_ = false; + boldFont_ = BuLib.deriveFont(ft, Font.BOLD, 0); + // -- calcul des max height et width pour resize les composants --// + FontMetrics fmt = getGraphics().getFontMetrics(ft); + FontMetrics fmtBold = getGraphics().getFontMetrics(boldFont_); + int maxWidth = getMaxWidthLegende(ft); + int maxTitle = maxWidth; + Rectangle newBounds = new Rectangle(maxWidth, fmt.getHeight()); - // -- mise a jour de la widget avec la nouvelle font - List<Widget> listePlage = getChildren(); - for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidgetPlageTitle) { - EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; - new_widget.getIntern().setFont(getFormeFont()); - new_widget.getIntern().majText(); - FuLog.warning("MA plage: " + new_widget.plage_.getLegende()); + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidgetPlage) { + EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; + new_widget.getIntern().setFont(ft); + new_widget.getIntern().majText(); - // -- mise du nouveau bounds max --// - Rectangle boundsIntern = new_widget.getIntern().getBounds(); - boundsIntern.width = newBounds.width; - boundsIntern.height = (int) (newBounds.height); + // -- mise du nouveau bounds max --// + Rectangle boundsIntern = new_widget.getIntern().getBounds(); + boundsIntern.width = newBounds.width; + boundsIntern.height = (int) (newBounds.height); - new_widget.getIntern().setPreferredBounds(boundsIntern); + new_widget.getIntern().setPreferredBounds(boundsIntern); - // resize pour le logo: forme carr\xE9 - Rectangle boundsLogo = new_widget.getLogo_().getBounds(); - boundsLogo.height = (int) (newBounds.height); - boundsLogo.width = (int) (newBounds.height); - new_widget.getLogo_().setPreferredBounds(boundsLogo); - new_widget.getLogo_().repaint(); + // resize pour le logo: forme carr\xE9 + Rectangle boundsLogo = new_widget.getLogo().getBounds(); + boundsLogo.height = (int) (newBounds.height); + boundsLogo.width = (int) (newBounds.height); + new_widget.getLogo().setPreferredBounds(boundsLogo); + new_widget.getLogo().repaint(); - } else if (widget instanceof LabelWidget) { - LabelWidget new_widget = (LabelWidget) widget; + } else if (widget instanceof LabelWidget && (((LabelWidget) widget).getLabel() != null)) { + LabelWidget lbWidget = (LabelWidget) widget; - new_widget.setFont(getFormeFont()); - Rectangle boundsTitre = new_widget.getBounds(); - boundsTitre.width = newBounds.width; - boundsTitre.height = (int) (newBounds.height); - new_widget.setPreferredBounds(boundsTitre); - } - + lbWidget.setFont(boldFont_); + Rectangle boundsTitre = lbWidget.getBounds(); + boundsTitre.width = fmtBold.stringWidth(lbWidget.getLabel()) + 5; + maxTitle = Math.max(maxTitle, boundsTitre.width); + boundsTitre.height = (int) (fmtBold.getHeight() + 2); + // lbWidget.setPreferredBounds(boundsTitre); } - // Resize de la widget - Rectangle newBoundConteneurs = getParentWidget().getBounds(); - newBoundConteneurs.height... [truncated message content] |
From: <de...@us...> - 2008-09-14 20:51:48
|
Revision: 3924 http://fudaa.svn.sourceforge.net/fudaa/?rev=3924&view=rev Author: deniger Date: 2008-09-14 20:51:52 +0000 (Sun, 14 Sep 2008) Log Message: ----------- ajout de l'action grouper Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluDialogPanel.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.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/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.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/EbliWidgetTextLabel.java 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/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.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/calque/EbliWidgetVueCalque.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/EbliWidgetCreatorLegende.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/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/formatgroup_16.png branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/formatungroup_16.png 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/EbliWidgetWithBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetDegroupAction.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluDialogPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluDialogPanel.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluDialogPanel.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -175,6 +175,12 @@ return addLongText(this, _d); } + protected JComboBox addComboBox(Object[] _values, Container _c) { + JComboBox cb = new BuComboBox(_values);; + _c.add(cb); + return cb; + } + /** * ajoute au panel un label dont la couleur de texte est rouge. */ @@ -416,13 +422,9 @@ public static CtuluDialog createDialog(final Component _parent, final CtuluDialogPanel _panel) { if (_parent instanceof JDialog) { return new CtuluDialog((JDialog) _parent, _panel); - } else if (_parent instanceof JFrame) { - return new CtuluDialog((JFrame) _parent, _panel); - } + } else if (_parent instanceof JFrame) { return new CtuluDialog((JFrame) _parent, _panel); } final BuApplication app = (BuApplication) SwingUtilities.getAncestorOfClass(BuApplication.class, _parent); - if (app != null) { - return new CtuluDialog(app, _panel); - } + if (app != null) { return new CtuluDialog(app, _panel); } return new CtuluDialog(_panel); } @@ -529,9 +531,7 @@ } public void setErrorText(final String _error) { - if (lbError_ == null) { - return; - } + if (lbError_ == null) { return; } lbError_.setVisible(true); lbError_.setText(_error); lbError_.revalidate(); Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -22,6 +22,7 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JCheckBox; +import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFrame; @@ -37,8 +38,10 @@ import com.memoire.bu.BuApplication; import com.memoire.bu.BuBorders; import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuLib; import com.memoire.bu.BuList; +import com.memoire.bu.BuVerticalLayout; /** * @author fred deniger @@ -214,6 +217,27 @@ return createTitleBorder(_title, BuBorders.EMPTY2222); } + /** + * @param _values les valeurs parmi lesquelles on veut choisir + * @param _parent le composant parent + * @param _title le titre du dialog + * @param _lb le label + * @param _vert true si on veut que le label est le com soit place verticalement + * @return l'indice de l'objet s\xE9lectionne au -1 si l'utilisateur a refuse + */ + public static int chooseValue(Object[] _values, Component _parent, String _title, String _lb, boolean _vert) { + CtuluDialogPanel pn = new CtuluDialogPanel(); + if (_vert) { + pn.setLayout(new BuVerticalLayout(5)); + } else { + pn.setLayout(new BuGridLayout(2)); + } + pn.addLabel(_lb); + JComboBox res = pn.addComboBox(_values, pn); + if (pn.afficheModaleOk(_parent, _title)) { return res.getSelectedIndex(); } + return -1; + } + public static Border createTitleBorder(final String _title, final Border _inBorder) { return BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(_title), _inBorder); } Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/formatgroup_16.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/formatungroup_16.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -18,7 +18,11 @@ private static final Border RESIZE_BORDER = BorderFactory.createResizeBorder(MINI_THICKNESS, COLOR_HOVERED, true); private static final Border RESIZE_BORDER_SELECTED = BorderFactory.createCompositeBorder(BorderFactory .createRoundedBorder(0, 0, 0, 0, COLOR_SELECTED, COLOR_HOVERED), RESIZE_BORDER); - private static final Border DEFAULT_BORDER = BorderFactory.createEmptyBorder(8); + private static final Border DEFAULT_BORDER = BorderFactory.createEmptyBorder(MINI_THICKNESS); + private static final Border NON_RESIZE_BORDER_SELECTED = BorderFactory.createCompositeBorder(BorderFactory + .createRoundedBorder(0, 0, 0, 0, COLOR_SELECTED, COLOR_HOVERED), DEFAULT_BORDER); + private static final Border NON_RESIZE_BORDER = BorderFactory.createRoundedBorder(MINI_THICKNESS, MINI_THICKNESS, + MINI_THICKNESS, MINI_THICKNESS, null, COLOR_SELECTED.darker()); public Border getBorder(ObjectState _state) { return getBorder(_state, true); @@ -27,18 +31,14 @@ public Border getBorder(ObjectState _state, boolean resizable) { if (resizable) { if (_state.isHovered()) { - if (_state.isSelected()) { - return RESIZE_BORDER_SELECTED; - } + if (_state.isSelected()) { return RESIZE_BORDER_SELECTED; } return RESIZE_BORDER; } - if (_state.isSelected()) { - return MINI_BORDER_SELECTED; - } + if (_state.isSelected()) { return MINI_BORDER_SELECTED; } } else { - // a continuer pour le cas non retaillable - + if (_state.isSelected()) return NON_RESIZE_BORDER_SELECTED; + else if (_state.isHovered()) return NON_RESIZE_BORDER; } return DEFAULT_BORDER; 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 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliSceneController.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -182,6 +182,10 @@ return alignWithMoveAction; } + public WidgetAction getReisizeAction() { + return alignWithResizeAction; + } + /** * @return the rectangularSelection */ 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 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -7,8 +7,7 @@ import java.util.HashMap; import java.util.Map; -import javax.swing.JComponent; - +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; @@ -186,13 +185,8 @@ // -- cas particulier si il s agit de la rotation --// // -- il faut transformer les degres en radian --// - if (_key.equals(ROTATION)) { + if (_key.equals(ROTATION)) { return Integer.valueOf((int) Math.toDegrees(getRotation())); } - double radian = getRotation(); - return Integer.valueOf((int) (radian * 180 / Math.PI)); - - } - return propGraphique.get(_key); } @@ -264,8 +258,7 @@ @Override public void notifyStateChanged(ObjectState previousState, ObjectState newState) { if (!useBorder_) { return; } - setBorder(getScene().getLookFeel().getBorder(newState)); - // TODO a verifier pour le rendu + setBorder(((EbliLookFeel) getScene().getLookFeel()).getBorder(newState, getController().canResize_)); EbliWidget parent = getGroup(); if (newState.isHovered() && parent != null) { parent.setBorder(getBorder()); @@ -275,7 +268,7 @@ /** * Methode qui raffraichis les proprietes de la widget. */ - public void refreshMyProperties() { + public final void refreshMyProperties() { getEbliScene().refresh(); } @@ -289,8 +282,9 @@ propGraphique.put(COLORFOND, newColor); } - public void setController_(EbliWidgetController controller_) { + public void setController(EbliWidgetController controller_) { this.controller_ = controller_; + } public void setFormeFont(Font newFont) { @@ -308,49 +302,47 @@ * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens * parametres dans la commande undo/redo. */ - public boolean setProperty(String _key, Object prop) { + public final boolean setProperty(String _key, Object prop) { // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// + setPropertyCmd(_key, prop, getEbliScene().getCmdMng()); + + return true; + } + + protected void setPropertyCmd(String _key, Object prop, CtuluCommandContainer _cmd) { + CommandeUndoRedoGraphicalProperties undoRedo = null; + if (_cmd != null) { + undoRedo = new CommandeUndoRedoGraphicalProperties(); + // -- ajout de la widget en question ainsi que la oldpropertie --// + undoRedo.addWidget(this); + // inutile de tout dupliquer + undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); + _cmd.addCmd(undoRedo); + } if (_key.equals(LINEMODEL)) { getTraceLigneModel().updateData((TraceLigneModel) prop); prop = getTraceLigneModel(); } else if (_key.equals(ROTATION) && prop instanceof Integer) { - // -- cas particulier si il s agit de la rotation --// - // -- il faut transformer les degres en radian --// - int degre = ((Integer) prop).intValue(); - double radian = degre * Math.PI / 180; - prop = new Double(radian); - + prop = new Double(Math.toRadians(((Integer) prop).intValue())); } - // -- creation de la commande undo/redo --// - CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); - - // -- ajout de la widget en question ainsi que la oldpropertie --// - undoRedo.addWidget(this); - undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); - // --mise a jout de la map de proprietes --// propGraphique.put(_key, prop); - - // -- ajout de la nouvelle propertie --// - undoRedo.addNewPropertie(propGraphique); - - // -- enregistrement de la commande undo/redo --// - if (getEbliScene().getCmdMng() != null) { - getEbliScene().getCmdMng().addCmd(undoRedo); + if (undoRedo != null) { + // -- ajout de la nouvelle propertie --// + undoRedo.addNewPropertie(propGraphique); } // -- mise a jour des parametres de la map --// refreshMyProperties(); - - return true; } - public void setPropGraphique(Map<String, Object> propGraphique) { - this.propGraphique = propGraphique; - + public final void setPropGraphique(Map<String, Object> propGraphique) { + for (Map.Entry<String, Object> it : propGraphique.entrySet()) { + setPropertyCmd(it.getKey(), it.getValue(), null); + } } public void setRotation(double rotation) { Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -1,219 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Rectangle; -import java.util.HashMap; -import java.util.Map; - -import org.fudaa.ebli.trace.TraceLigne; -import org.fudaa.ebli.trace.TraceLigneModel; -import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; -import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; - -/** - * classe qui genere une bordure pour contenir une widget classique. - * - * @author genesis - */ -public class EbliWidgetBordure extends EbliWidget { - - /** - * Widget contenu en intern dans la widget bordure - */ - EbliWidget intern_; - - /** - * Retourne le controlleur de son objet contenu. Le controlleur de la bordure n'a pas besoin d'etre recup\xE9r\xE9. - */ - @Override - public EbliWidgetController getController() { - return getIntern().getController(); - } - - public float epaisseurHisto_ = 0; - private Insets insets_; - - /** - * constructeur qui gere un controller uniquement pour les actions. - * - * @param scene - */ - public EbliWidgetBordure(EbliWidget _intern) { - this(_intern, true, true); - } - - @Override - public boolean isInEditMode() { - return intern_.isInEditMode_; - } - - public EbliWidgetBordure(EbliWidget _intern, boolean canMove, boolean canResize) { - super(_intern.getEbliScene(), false); - - intern_ = _intern; - - insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); - setLayout(new OverlayLayoutGap(insets_)); - - // -- ajout du child --// - addChild(intern_); - - // --ajout du controller specifique au bordure --// - this.setController_(new EbliWidgetControllerActionOnly(this, canMove, canResize)); - } - - public Insets createInset(int epaisseur) { - - return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); - } - - protected void paintWidget() { - - // -- mise a jour de la fonte que si il y a eu une modification --// - - Graphics2D g = getGraphics(); - - Rectangle rec = getClientArea(); - - if (epaisseurHisto_ != getTraceLigneModel().getEpaisseur()) { - insets_.bottom = (int) getTraceLigneModel().getEpaisseur(); - insets_.top = insets_.bottom; - insets_.left = insets_.bottom; - insets_.right = insets_.bottom; - Rectangle newBounds = getBounds(); - newBounds.height += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; - newBounds.width += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; - setPreferredBounds(newBounds); - } - // -- couleur de fond --// - // g.setColor(getColorFond()); - // g.fillRect(0, 0, rec.width, rec.height); - - g.translate(rec.x, rec.y); - // la ligne - - TraceLigne l = new TraceLigne(getTraceLigneModel()); - - l.setCouleur(getColorContour()); - l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l - .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); - - g.translate(-rec.x, -rec.y); - - epaisseurHisto_ = getTraceLigneModel().getEpaisseur(); - - } - - /** - * surcharge des methodes getProperty pour recuperer les proprietes graphiques et les dipatcher a son conteneur - */ - public Object getProperty(String _key) { - - // -- la bordure ne gere que tracemodel et couleur contour, le reste est - // dispatch\xE9 a son conteneur --// - if (_key.equals(ROTATION)) { - - double radian = intern_.getRotation(); - return Integer.valueOf((int) (radian * 180 / Math.PI)); - - } else if (_key.equals(FONT)) { - return intern_.propGraphique.get(_key); - } else if (_key.equals(COLORFOND)) { - return intern_.propGraphique.get(_key); - } else return propGraphique.get(_key); - } - - /** - * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens - * parametres dans la commande undo/redo. - */ - public boolean setProperty(String _key, Object prop) { - if (_key.equals(FONT) || _key.equals(COLORFOND)) { return intern_.setProperty(_key, prop); } - - // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour - // l ancien lignemodel --// - if (_key.equals(LINEMODEL)) { - getTraceLigneModel().updateData((TraceLigneModel) prop); - prop = getTraceLigneModel(); - } else if (_key.equals(ROTATION) && prop instanceof Integer) { - // -- cas particulier si il s agit de la rotation --// - // -- il faut transformer les degres en radian --// - int degre = ((Integer) prop).intValue(); - double radian = degre * Math.PI / 180; - prop = new Double(radian); - - } - - // -- creation de la commande undo/redo --// - CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); - - // -- ajout de la widget en question ainsi que la oldpropertie --// - undoRedo.addWidget(this); - - // --mise a jout de la map de proprietes --// - if (_key.equals(LINEMODEL) || _key.equals(COLORCONTOUR)) { - undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); - propGraphique.put(_key, prop); - // -- ajout de la nouvelle propertie --// - undoRedo.addNewPropertie(propGraphique); - } else { - undoRedo.addOldPropertie(intern_.duplicateGraphicalProperties()); - intern_.propGraphique.put(_key, prop); - // -- ajout de la nouvelle propertie --// - undoRedo.addNewPropertie(intern_.propGraphique); - } - - // -- enregistrement de la commande undo/redo --// - if (getEbliScene().getCmdMng() != null) { - getEbliScene().getCmdMng().addCmd(undoRedo); - } - - // -- mise a jour des parametres de la map --// - refreshMyProperties(); - - return true; - } - - /** - * surcharge des getter et setter graphical properties pour rediriger les infos vers les widgets contenu - */ - public Map<String, Object> getPropGraphique() { - - Map<String, Object> mapMeltingPot = new HashMap<String, Object>(); - mapMeltingPot.put(COLORCONTOUR, getColorContour()); - mapMeltingPot.put(LINEMODEL, getTraceLigneModel()); - - // -- les autres valeurs conernent le contenu --// - mapMeltingPot.put(ROTATION, intern_.getRotation()); - mapMeltingPot.put(FONT, intern_.getFormeFont()); - mapMeltingPot.put(COLORFOND, intern_.getColorFond()); - - return mapMeltingPot; - } - - /** - * surcharge des getter et setter graphical properties pour rediriger les infos vers les widgets contenu - */ - public void setPropGraphique(Map<String, Object> propGraphique) { - this.propGraphique.put(COLORCONTOUR, propGraphique.get(COLORCONTOUR)); - this.propGraphique.put(LINEMODEL, propGraphique.get(LINEMODEL)); - - // -- on redirige les proprietes font,couleur de fond et rotation --// - this.intern_.setFormeFont((Font) propGraphique.get(FONT)); - this.intern_.setColorFond((Color) propGraphique.get(COLORFOND)); - this.intern_.setRotation((Double) propGraphique.get(ROTATION)); - - } - - public EbliWidget getIntern() { - return intern_; - } - - public void setIntern(EbliWidget _intern) { - intern_ = _intern; - } - -} Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java (from rev 3910, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -0,0 +1,131 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Insets; +import java.util.HashMap; +import java.util.Map; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; + +/** + * classe qui genere une bordure pour contenir une widget classique. + * + * @author genesis + */ +public class EbliWidgetBordureSingle extends EbliWidgetWithBordure { + + /** + * Widget contenu en intern dans la widget bordure + */ + EbliWidget intern_; + + /** + * Retourne le controlleur de son objet contenu. Le controlleur de la bordure n'a pas besoin d'etre recup\xE9r\xE9. + */ + @Override + public EbliWidgetController getController() { + return getIntern().getController(); + } + + /** + * constructeur qui gere un controller uniquement pour les actions. + * + * @param scene + */ + public EbliWidgetBordureSingle(EbliWidget _intern) { + this(_intern, true, true); + } + + @Override + public boolean isInEditMode() { + return intern_.isInEditMode_; + } + + public EbliWidgetBordureSingle(EbliWidget _intern, boolean canMove, boolean canResize) { + super(_intern.getEbliScene(), false); + + intern_ = _intern; + + insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); + setLayout(new OverlayLayoutGap(insets_)); + + // -- ajout du child --// + addChild(intern_); + + // --ajout du controller specifique au bordure --// + this.setController(new EbliWidgetControllerActionOnly(this, canMove, canResize)); + } + + public Insets createInset(int epaisseur) { + + return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); + } + + /** + * surcharge des methodes getProperty pour recuperer les proprietes graphiques et les dipatcher a son conteneur + */ + public Object getProperty(String _key) { + + // -- la bordure ne gere que tracemodel et couleur contour, le reste est + // dispatch\xE9 a son conteneur --// + if (_key.equals(ROTATION)) { + + double radian = intern_.getRotation(); + return Integer.valueOf((int) (radian * 180 / Math.PI)); + + } else if (_key.equals(FONT)) { + return intern_.propGraphique.get(_key); + } else if (_key.equals(COLORFOND)) { + return intern_.propGraphique.get(_key); + } else return propGraphique.get(_key); + } + + @Override + protected void setPropertyCmd(String _key, Object _prop, CtuluCommandContainer _cmd) { + if (_key.equals(LINEMODEL) || _key.equals(COLORCONTOUR)) { + super.setPropertyCmd(_key, _prop, _cmd); + } else { + intern_.setPropertyCmd(_key, _prop, _cmd); + } + } + + /** + * surcharge des getter et setter graphical properties pour rediriger les infos vers les widgets contenu + */ + public Map<String, Object> getPropGraphique() { + + Map<String, Object> mapMeltingPot = new HashMap<String, Object>(); + mapMeltingPot.put(COLORCONTOUR, getColorContour()); + mapMeltingPot.put(LINEMODEL, getTraceLigneModel()); + + // -- les autres valeurs conernent le contenu --// + mapMeltingPot.put(ROTATION, intern_.getRotation()); + mapMeltingPot.put(FONT, intern_.getFormeFont()); + mapMeltingPot.put(COLORFOND, intern_.getColorFond()); + + return mapMeltingPot; + } + + // /** + // * surcharge des getter et setter graphical properties pour rediriger les infos vers les widgets contenu + // */ + // public void setPropGraphique(Map<String, Object> propGraphique) { + // this.propGraphique.put(COLORCONTOUR, propGraphique.get(COLORCONTOUR)); + // this.propGraphique.put(LINEMODEL, propGraphique.get(LINEMODEL)); + // + // // -- on redirige les proprietes font,couleur de fond et rotation --// + // this.intern_.setFormeFont((Font) propGraphique.get(FONT)); + // this.intern_.setColorFond((Color) propGraphique.get(COLORFOND)); + // this.intern_.setRotation((Double) propGraphique.get(ROTATION)); + // + // } + + public EbliWidget getIntern() { + return intern_; + } + + public void setIntern(EbliWidget _intern) { + intern_ = _intern; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java ___________________________________________________________________ Added: svn:mergeinfo + 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 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -37,26 +37,30 @@ */ public class EbliWidgetController { - protected boolean canDuplicate_ = true; - protected boolean canMove_ = true; - protected boolean canResize_ = true; - private String description_; - protected EbliWidget widget_; - /** * action de la widget recuperable et eventuellement supprimable */ WidgetAction actionMove_; WidgetAction actionResize_; WidgetAction actionSelect_; + protected boolean canDuplicate_ = true; + protected boolean canMove_ = true; + protected boolean canResize_ = true; + private String description_; + private JPopupMenu popupMenu_; + + protected PopupMenuProvider providerPopup_ = null; + + protected EbliWidget widget_; + public EbliWidgetController(EbliWidget widget_) { this(widget_, true, true, true); } - public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize) { - this(widget_, canMove, canResize, true); + public EbliWidgetController(EbliWidget _widget, boolean _canMove, boolean _canResize) { + this(_widget, _canMove, _canResize, true); } public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize, boolean canDuplicate) { @@ -67,70 +71,54 @@ canResize_ = canResize; // creation des actions par defaut - createdefaultAction(); + createDefaultAction(); + initMenu(); - // menu intern propre a la widget - setMenu(); - } - public boolean isCanDuplicate() { - return canDuplicate_; - } + public void addFonctionsSpecific(ArrayList<EbliActionSimple> _listeActions) { - public boolean isCanMove() { - return canMove_; } - public boolean isCanResize() { - return canResize_; - } + protected void constructMenuDupliquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); + menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); + menuItem1.addActionListener(new ActionListener() { - /** - * methode qui cree les actions par defaut pour la widget. - */ - public void createdefaultAction() { - // -- construction des actions --// - actionSelect_ = widget_.getEbliScene().createSelectAction(); - widget_.getActions().addAction(actionSelect_); + public void actionPerformed(ActionEvent e) { - actionResize_ = ActionFactory.createResizeAction(); - if (canResize_) widget_.getActions().addAction(actionResize_); + // -- recuperation du node a dupliquer --// + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); + // duplication du node en question + EbliNode duplique = n.duplicate(null); - actionMove_ = widget_.getEbliScene().getController().getMoveAction(); - if (canMove_) widget_.getActions().addAction(actionMove_); - } + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); - /** - * Methode appelee pour bloquer une widget: l'empecher de se deplacer. - */ - public void removeActionResizeAndMove() { - widget_.getActions().removeAction(actionMove_); - widget_.getActions().removeAction(actionSelect_); + // -- ajout dans la scene --// + if (duplique != null && widget_.getScene() != null) { + widget_.getEbliScene().addNode(duplique); - } + // -- duplication des map de property graphique de la widget --// + duplique.getWidget().propGraphique = n.getWidget().duplicateGraphicalProperties(); + // -- duplication de la taille --// + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); - /** - * fonction inverse de la precedente. - */ - public void replaceActionResizeAndMove() { + // -- ajout de la commande undo/redo --// + ArrayList<EbliNode> ln = new ArrayList<EbliNode>(); + ln.add(duplique); + cmd_.addCmd(new CommandeDuplicate(ln, widget_.getEbliScene())); - widget_.getActions().addAction(actionMove_); - widget_.getActions().addAction(actionSelect_); + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + } - } + } - public String getDescription() { - return description_; + }); } - public void setDescription(String description_) { - this.description_ = description_; - widget_.setToolTipText(description_); - } - protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add("Masquer l'objet"); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); @@ -181,45 +169,6 @@ }); } - protected void constructMenuDupliquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { - JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); - menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); - menuItem1.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - // -- recuperation du node a dupliquer --// - EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - - // duplication du node en question - EbliNode duplique = n.duplicate(null); - - // nouvelle position a cote de son predecesseur - // duplique.setPreferedLocation(nouvellePosition); - - // -- ajout dans la scene --// - if (duplique != null && widget_.getScene() != null) { - widget_.getEbliScene().addNode(duplique); - - // -- duplication des map de property graphique de la widget --// - duplique.getWidget().propGraphique = n.getWidget().duplicateGraphicalProperties(); - // -- duplication de la taille --// - duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); - - // -- ajout de la commande undo/redo --// - ArrayList<EbliNode> ln = new ArrayList<EbliNode>(); - ln.add(duplique); - cmd_.addCmd(new CommandeDuplicate(ln, widget_.getEbliScene())); - - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); - } - - } - - }); - } - /** * Methode de construction des menus de base * @@ -251,36 +200,7 @@ } - protected PopupMenuProvider providerPopup_ = null; - protected JPopupMenu popupMenu_ = null; - - public JPopupMenu getPopup() { - return popupMenu_; - } - /** - * Methode generique qui fait apparaitre un menuItem propre au composant et offre les op\xE9rations de base on ouvre le - * menu via le clic droit ou le raccourcis shift+F10 - */ - - public void setMenu() { - - popupMenu_ = new JPopupMenu(); - - // -- construction du menu pour les graphismees --// - constructPopupMenuBaseGraphique(popupMenu_); - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popupMenu_); - - providerPopup_ = new PopupMenuProvider() { - public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - return popupMenu_; - } - }; - widget_.getActions().addAction(ActionFactory.createPopupMenuAction(providerPopup_)); - } - - /** * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il n a aucun effet. * * @param _popup @@ -296,11 +216,10 @@ EbliWidget found = null;// widget_; - if (widget_.getParentWidget() != null && widget_.getParentWidget() instanceof EbliWidgetBordure) - found = (EbliWidget) widget_.getParentWidget(); - else - found = widget_; - + if (widget_.getParentWidget() != null && widget_.getParentWidget() instanceof EbliWidgetBordureSingle) found = (EbliWidget) widget_ + .getParentWidget(); + else found = widget_; + BConfigurePalette palette = new BConfigurePalette(false); BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); @@ -319,42 +238,138 @@ }); } - public EbliWidget getWidget() { - return widget_; + /** + * methode qui cree les actions par defaut pour la widget. + */ + public void createDefaultAction() { + // -- construction des actions --// + actionSelect_ = widget_.getEbliScene().createSelectAction(); + widget_.getActions().addAction(actionSelect_); + + actionResize_ = widget_.getEbliScene().getController().getReisizeAction(); + if (canResize_) widget_.getActions().addAction(actionResize_); + + widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); + + actionMove_ = widget_.getEbliScene().getController().getMoveAction(); + if (canMove_) widget_.getActions().addAction(actionMove_); } - public void setWidget(EbliWidget widget_) { - this.widget_ = widget_; - }; + public boolean fonctionsAlreadySpecified() { + return false; + } - - public JComponent getOverviewComponent() { - - - - return null; + public String getDescription() { + return description_; } - - public BuToolBar getToolbarComponent() { + + public BuMenuBar getMenubarComponent() { return null; } - - public BuMenuBar getMenubarComponent() { + + public JComponent getOverviewComponent() { + return null; } - public void addFonctionsSpecific(ArrayList<EbliActionSimple> _listeActions) { + public JPopupMenu getPopup() { + createPopup(); + return popupMenu_; } - - public boolean fonctionsAlreadySpecified() { - return false; + + public BuToolBar getToolbarComponent() { + return null; } - public JComponent geTtracableComponent() { return new JLabel(); } - - + + public EbliWidget getWidget() { + return widget_; + } + + /** + * Methode generique qui fait apparaitre un menuItem propre au composant et offre les op\xE9rations de base on ouvre le + * menu via le clic droit ou le raccourcis shift+F10 + */ + protected final void initMenu() { + if (!isMenuAllowed()) return; + providerPopup_ = new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + createPopup(); + return popupMenu_; + } + + }; + widget_.getActions().addAction(ActionFactory.createPopupMenuAction(providerPopup_)); + } + + void createPopup() { + if (popupMenu_ == null) { + popupMenu_ = new JPopupMenu(); + buildPopupMenu(popupMenu_); + } + } + + /** + * @return true par defaut: le popup menu sera cree + */ + protected boolean isMenuAllowed() { + return true; + } + + protected void buildPopupMenu(JPopupMenu _menu) { + // -- construction du menu pour les graphismees --// + constructPopupMenuBaseGraphique(_menu); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(_menu); + } + + public boolean isCanDuplicate() { + return canDuplicate_; + }; + + public boolean isCanMove() { + return canMove_; + } + + public boolean isCanResize() { + return canResize_; + } + + /** + * Methode appelee pour bloquer une widget: l'empecher de se deplacer. + */ + public void removeActionResizeAndMove() { + widget_.getActions().removeAction(actionMove_); + widget_.getActions().removeAction(actionResize_); + canMove_ = false; + canResize_ = false; + + } + + /** + * fonction inverse de la precedente. + */ + public void replaceActionResizeAndMove() { + if(actionMove_!=null) + widget_.getActions().addAction(actionMove_); + if(actionResize_!=null) + widget_.getActions().addAction(actionResize_); + canMove_ = true; + canResize_ = true; + + } + + public void setDescription(String description_) { + this.description_ = description_; + widget_.setToolTipText(description_); + } + + public void setWidget(EbliWidget widget_) { + this.widget_ = widget_; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -17,13 +17,11 @@ public EbliWidgetControllerActionOnly(EbliWidget widget_, boolean canMove, boolean canResize) { super(widget_, canMove, canResize); } - - /** - * surcharge de la methode menu pour ne pas cree de sous menus. - */ - public void setMenu() { - - // ne rien faire + + @Override + protected boolean isMenuAllowed() { + return false; } + } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -0,0 +1,26 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary; + +import javax.swing.JPopupMenu; + +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetUngroupAction; + +/** + * @author deniger + */ +public class EbliWidgetControllerForGroup extends EbliWidgetController { + + public EbliWidgetControllerForGroup(EbliWidget _widget) { + super(_widget,true,true,false); + } + + @Override + protected void buildPopupMenu(JPopupMenu _menu) { + super.buildPopupMenu(_menu); + EbliNode n=(EbliNode) getWidget().getEbliScene().findObject(getWidget()); + _menu.add(new EbliWidgetUngroupAction(getWidget().getEbliScene(),n)); + } +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -1,37 +1,33 @@ package org.fudaa.ebli.visuallibrary; /** - * Classe qui herite du controller. Gere uniquement les menus. Pas d actions - * gerees par ce controlleur. + * Classe qui herite du controller. Gere uniquement les menus. Pas d actions gerees par ce controlleur. * * @author Adrien Hadoux. - * */ public class EbliWidgetControllerMenuOnly extends EbliWidgetController { - public EbliWidgetControllerMenuOnly(EbliWidget widget_) { - this(widget_, true); + public EbliWidgetControllerMenuOnly(EbliWidget widget) { + this(widget, true); } public EbliWidgetControllerMenuOnly(EbliWidget widget_, boolean canDuplicate) { super(widget_, true, true, canDuplicate); - - + } - - - /** + + /** * surcharge de la methode pour ne pas creer d actions. */ - public void createdefaultAction() { - // -- construction des actions --// - //widget_.getActions().addAction(widget_.getEbliScene().createSelectAction() - // ); - // widget_.getActions().addAction(ActionFactory.createResizeAction()); - // widget_.getActions().addAction(widget_.getEbliScene(). - // createWidgetHoverAction()); - // widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); + public void createDefaultAction() { + // -- construction des actions --// + // widget_.getActions().addAction(widget_.getEbliScene().createSelectAction() + // ); + // widget_.getActions().addAction(ActionFactory.createResizeAction()); + // widget_.getActions().addAction(widget_.getEbliScene(). + // createWidgetHoverAction()); + // widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); } - + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -15,6 +15,6 @@ */ EbliNode duplicate(EbliNode _nodeAdupliquer); - EbliWidgetBordure getBordure(); + EbliWidgetWithBordure getBordure(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -52,7 +52,7 @@ return duplique; } - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -51,7 +51,7 @@ return duplique; } - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -13,7 +13,7 @@ Image image_; // EbliWidgetImage res; - EbliWidgetBordure res; + EbliWidgetWithBordure res; public EbliWidgetCreatorImage(Image g) { @@ -31,7 +31,7 @@ public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetBordure(new EbliWidgetImage(_scene, getG())); + res = new EbliWidgetBordureSingle(new EbliWidgetImage(_scene, getG())); return res; } @@ -58,7 +58,7 @@ return duplique; } - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return res; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -68,7 +68,7 @@ - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -14,7 +14,7 @@ CtuluHtmlEditorPanel editorPane_; // EbliWidgetTextEditor res; - EbliWidgetBordure res; + EbliWidgetWithBordure res; public EbliWidgetCreatorTextEditor(CtuluHtmlEditorPanel g) { @@ -32,7 +32,7 @@ public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetBordure(new EbliWidgetTextEditor(_scene, getG())); + res = new EbliWidgetBordureSingle(new EbliWidgetTextEditor(_scene, getG())); return res; } @@ -61,7 +61,7 @@ } - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return res; } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -8,7 +8,7 @@ String label_; // EbliWidgetRectangle res; - EbliWidgetBordure res; + EbliWidgetWithBordure res; public EbliWidgetCreatorTextLabel(String g) { super(); this.label_ = g; @@ -23,7 +23,7 @@ } public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetBordure(new EbliWidgetTextLabel(_scene, getG())); + res = new EbliWidgetBordureSingle(new EbliWidgetTextLabel(_scene, getG())); return res; } @@ -51,7 +51,7 @@ return duplique; } - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return res; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGroupCreator.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -23,7 +23,7 @@ return null; } - public EbliWidgetBordure getBordure() { + public EbliWidgetWithBordure getBordure() { return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -15,7 +15,7 @@ // -- controller menu seulement, la bordure englobante contient le // controller action --// - setController_(new EbliWidgetControllerMenuOnly(this)); + setController(new EbliWidgetControllerMenuOnly(this)); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-14 20:25:20 UTC (rev 3923) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-14 20:51:52 UTC (rev 3924) @@ -22,11 +22,9 @@ import com.memoire.fu.FuLog; /** - * Classe qui gere la synchronisation entre la scene et les autres composants d - * affichage de la scene tel que l arbre. + * Classe qui gere la synchronisation entre la scene et les autres composants d affichage de la scene tel que l arbre. * * @author Adrien Hadoux - * */ public class EbliWidgetSynchroniser implements ObjectSceneListener, TreeSelectionListener { @@ -38,34 +36,31 @@ * l arbre representant la scene. */ EbliWidgetJXTreeTableModel treeModel_; - - + JXTreeTable arbre_; - + /** - * booleen qui permet d eviter de realiser des cycles entre la selection des - * nodes sur le tree et sur la scene. + * booleen qui permet d eviter de realiser des cycles entre la selection des nodes sur le tree et sur la scene. */ boolean noCycleScene = true; boolean noCycleTree = false; - + public EbliWidgetSynchroniser(EbliWidgetJXTreeTableModel treeModel, JXTreeTable arbre) { super(); treeModel_ = treeModel; this.scene_ = treeModel_.getScene(); arbre_ = arbre; - - + // -- ajout du synchroniser comme listener du tree selecter --// - + arbre_.addTreeSelectionListener(this); - + // -- gestion des popupMenus sur le jtree --// arbre_.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.isPopupTrigger() && e.getClickCount() == 1) { affichePopupNode(e.getX(), e.getY()); - + } } @@ -75,13 +70,11 @@ } } }); - - + } /** - * Methode qui affiche la popup du node selectionn\xE9. entree: la position ou - * afficher la popup + * Methode qui affiche la popup du node selectionn\xE9. entree: la position ou afficher la popup * * @param x * @param y @@ -95,177 +88,135 @@ // Display the name of the selected tree element in the selection field MutableTreeTableNode treeNode = null; - if (clickedElement != null) - treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent(); - + if (clickedElement != null) treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent(); + if (treeNode != null) { // -- recuperation du node associe --// EbliNode node = (EbliNode) treeNode.getUserObject(); - + if (node != null && node.hasWidget() && node.getWidget().isVisible()) { - - + // -- recuperation de la popup du node et ajout a l element du tree a al // bonne location--// - JPopupMenu poppup =null; - + JPopupMenu poppup = null; + // -- cas ou la widget selectionnee est la bordure, il faut recuperer // son contenant --// - if (node.getWidget() instanceof EbliWidgetBordure) { - EbliWidgetBordure bordure = (EbliWidgetBordure) node.getWidget(); + if (node.getWidget() instanceof EbliWidgetBordureSingle) { + EbliWidgetBordureSingle bordure = (EbliWidgetBordureSingle) node.getWidget(); poppup = bordure.intern_.getController().getPopup(); - - } else - poppup = node.getWidget().getController().getPopup(); - - poppup.show(arbre_, x, y); - - + + } else poppup = node.getWidget().getController().getPopup(); + if (poppup != null) poppup.show(arbre_, x, y); + } - + } - - } - public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { } - public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) { - } + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) {} - public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) { - } + public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) {} - public void objectAdded(ObjectSceneEvent event, Object addedObject) { - } + public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) {} - public void objectRemoved(ObjectSceneEvent event, Object removedObject) { - } + public void objectAdded(ObjectSceneEvent event, Object addedObject) {} + public void objectRemoved(ObjectSceneEvent event, Object removedObject) {} + public void objectStateChanged(ObjectSceneEvent event, Object changedObject, ObjectState previousState, - ObjectState newState) { - } + ObjectState newState) {} /** - * Des que la selection change dans la scene, on selectionne le noeud - * correspondand dans le tree. + * Des que la selection change dans la scene, on selectionne le noeud correspondand dans le tree. */ public void selectionChanged(ObjectSceneEvent event, Set<Object> previousSelection, Set<Object> newSelection) { FuLog.warning("NOCYCLE DE SCENE " + noCycleScene); - - - - - + if (noCycleScene) { - + // on bloque l'effet cycle noCycleScene = false; - - final Set<Object> newSelection_ = newSelection; - - if (newSelection_ != null && newSelection_.size() != 0) { - - - - DefaultListSelectionModel model = (DefaultListSelectionModel) arbre_.getSelectionModel();// new - // DefaultListSelectionModel - - // -- mise a jour de la selection a vide--// + + if (newSelection != null && newSelection.size() != 0) { + + DefaultListSelectionModel model = (DefaultListSelectionModel) arbre_.getSelectionModel();// new + // DefaultListSelectionModel + + // -- mise a jour de la selection a vide--// model.clearSelection(); - + FuLog.warning("ITERATOR CHERIE"); - for (Iterator<Object> it = newSelection_.iterator(); it.hasNext();) { - // -- recuperation du node selectionne --// + for (Iterator<Object> it = newSelection.iterator(); it.hasNext();) { + // -- recuperation du node selectionne --// final EbliNode nodeSelect = (EbliNode) it.next(); - - - MutableTreeTableNode treeNode=treeModel_.findTreeTableNode(nodeSelect); - - model.addSelectionInterval(treeModel_.getIndexOfChild(treeModel_.getRoot(), treeNode), treeModel_ - .getIndexOfChild(treeModel_.getRoot(), treeNode)); - - // fonctionne que pour une seule selection - // arbre_.setRowSelectionInterval(treeModel_.getIndexOfChild(treeModel_. - // getRoot(), treeNode), treeModel_ - // .getIndexOfChild(treeModel_.getRoot(), treeNode)); - // arbre_.setSelectionModel(model); - - } - arbre_.validate(); + MutableTreeTableNode treeNode = treeModel_.findTreeTableNode(nodeSelect); + + model.addSelectionInterval(treeModel_.getIndexOfChild(treeModel_.getRoot(), treeNode), treeModel_ + .getIndexOfChild(treeModel_.getRoot(), treeNode)); + + // fonctionne que pour une seule selection + // arbre_.setRowSelectionInterval(treeModel_.getIndexOfChild(treeModel_. + // getRoot(), treeNode), treeModel_ + // .getIndexOfChild(treeModel_.getRoot(), treeNode)); + + // arbre_.setSelectionModel(model); + + } + arbre_.validate(); // mise a jour de la scene scene_.refresh(); - - - } else { + + } else { arbre_.clearSelection(); - } - - ... [truncated message content] |
From: <de...@us...> - 2008-09-16 22:10:40
|
Revision: 3933 http://fudaa.svn.sourceforge.net/fudaa/?rev=3933&view=rev Author: deniger Date: 2008-09-16 22:10:48 +0000 (Tue, 16 Sep 2008) Log Message: ----------- maj animation Modified Paths: -------------- 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/EbliWidgetBordureSingle.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/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.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/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.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/TrPostLayoutFille.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/TrPostMinMaxTableModel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple2.res branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java Property changes on: branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple2.res ___________________________________________________________________ Added: svn:mime-type + application/octet-stream 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -1,9 +1,18 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; import java.util.Collections; +import java.util.Map; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.image.CtuluImageProducer; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.graph.GraphScene; @@ -16,14 +25,55 @@ * * @author Adrien Hadoux */ -public class EbliScene extends GraphScene<EbliNode, EbliEdge> { +public class EbliScene extends GraphScene<EbliNode, EbliEdge> implements CtuluImageProducer { /** * model de la scene pour l affichage de ses composants */ EbliWidgetJXTreeTableModel treeModel_; + final PropertyChangeSupport propertyChangeSupport_ = new PropertyChangeSupport(this); + /** + * @param _listener le listener: a chaque fois le parametre new correspond au widget modifie + */ + public void addPropertyChangeListener(PropertyChangeListener _listener) { + propertyChangeSupport_.addPropertyChangeListener(_listener); + } + + /** + * @param _propertyName + * @param _listener + * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, + * java.beans.PropertyChangeListener) + */ + public void addPropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + propertyChangeSupport_.addPropertyChangeListener(_propertyName, _listener); + } + + /** + * @param _listener + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener _listener) { + propertyChangeSupport_.removePropertyChangeListener(_listener); + } + + protected void firePropertyChange(Object _nodeOrEdge, String _property) { + propertyChangeSupport_.firePropertyChange(_property, null, _nodeOrEdge); + } + + /** + * @param _propertyName + * @param _listener + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, + * java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + propertyChangeSupport_.removePropertyChangeListener(_propertyName, _listener); + } + + /** * controller de la scene qui gere les actions et les constructions graphiques */ private EbliSceneController controller_; @@ -89,6 +139,38 @@ } + public Dimension getDefaultImageDimension() { + Rectangle rec = getBounds(); + Dimension d = new Dimension(); + d.height = rec.height; + d.width = rec.width; + return d; + } + + public BufferedImage produceImage(final Map _params) { + Dimension d = getDefaultImageDimension(); + return produceImage(d.width, d.height, _params); + } + + public BufferedImage produceImage(final int _w, final int _h, final Map _params) { + Dimension d = getDefaultImageDimension(); + final BufferedImage i = CtuluLibImage.createImage(_w, _h, _params); + final Graphics2D g = i.createGraphics(); + CtuluLibImage.setBestQuality(g); + if (_w != d.width || _h != d.height) { + g.scale(CtuluLibImage.getRatio(_w, d.width), CtuluLibImage.getRatio(_h, d.height)); + } + if (CtuluLibImage.mustFillBackground(_params)) { + g.setPaint(getBackground()); + g.fillRect(0, 0, d.width, d.height); + } + paint(g); + g.dispose(); + i.flush(); + return i; + + } + @Override protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -7,11 +7,14 @@ import java.util.HashMap; import java.util.Map; +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BSelecteurCheckBox; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; @@ -51,9 +54,6 @@ private EbliScene scene_; private boolean useBorder_ = true; - - - /** * @param scene @@ -185,6 +185,8 @@ * graphiques de la widget. */ public Object getProperty(String _key) { + if ("title".equals(_key)) return getTitle(); + if (BSelecteurCheckBox.PROP_VISIBLE.equals(_key)) return Boolean.valueOf(isVisible()); // -- cas particulier si il s agit de la rotation --// // -- il faut transformer les degres en radian --// @@ -236,6 +238,7 @@ return isGroup; } + @Override public boolean isHitAt(Point localLocation) { if (localLocation == null) return false; @@ -269,6 +272,13 @@ } /** + * @return une interface non null si la widget peut etre animee + */ + public EbliAnimatedInterface getAnimatedInterface() { + return null; + } + + /** * Methode qui raffraichis les proprietes de la widget. */ public final void refreshMyProperties() { @@ -277,9 +287,8 @@ public void removePropertyChangeListener(String _key, PropertyChangeListener _l) {} - public void removePropertyChangeListenerFormWidget(EbliWidget _widget) { - } - + public void removePropertyChangeListenerFormWidget(EbliWidget _widget) {} + public void setColorContour(Color newColor) { propGraphique.put(COLORCONTOUR, newColor); } @@ -290,7 +299,7 @@ public void setController(EbliWidgetController controller_) { this.controller_ = controller_; - + } public void setFormeFont(Font newFont) { @@ -308,16 +317,65 @@ * Methode directement appelee apres modification des parametres renvoye par le getproperty. Ajoute les anciens * parametres dans la commande undo/redo. */ - public final boolean setProperty(String _key, Object prop) { + public final boolean setProperty(final String _property, final Object _newVlaue) { + if ("title".equals(_property)) { return changeTitle((String) _newVlaue, true); } + if (BSelecteurCheckBox.PROP_VISIBLE.equals(_property)) { return changeVisible(((Boolean) _newVlaue).booleanValue(), + true); } // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// - setPropertyCmd(_key, prop, getEbliScene().getCmdMng()); + setPropertyCmd(_property, _newVlaue, getEbliScene().getCmdMng()); return true; } - protected void setPropertyCmd(String _key, Object prop, CtuluCommandContainer _cmd) { + private boolean changeVisible(final boolean _newValue, boolean _cmd) { + if (_newValue == isVisible()) return false; + setVisible(_newValue); + getEbliScene().firePropertyChange(EbliWidget.this, BSelecteurCheckBox.PROP_VISIBLE); + if (_cmd) getEbliScene().getCmdMng().addCmd(new CtuluCommand() { + + public void undo() { + changeVisible(!_newValue, false); + } + + public void redo() { + changeVisible(_newValue, false); + } + }); + return true; + } + + private boolean changeTitle(final String _title, boolean _cmd) { + final String old = getTitle(); + if (_title != null && !_title.equals(old)) { + final EbliNode n = (EbliNode) getEbliScene().findObject(this); + if (n == null) return false; + n.setTitle(_title); + getEbliScene().firePropertyChange(EbliWidget.this, "title"); + if (_cmd) { + + getEbliScene().getCmdMng().addCmd(new CtuluCommand() { + public void undo() { + changeTitle(old, false); + } + + public void redo() { + changeTitle(_title, false); + } + }); + } + return true; + + } + return false; + + } + + protected void setPropertyCmd(String _property, Object _newValue, CtuluCommandContainer _cmd) { + Object old = propGraphique.get(_property); + if (old == _newValue || (old != null && old.equals(_newValue))) return; + CommandeUndoRedoGraphicalProperties undoRedo = null; if (_cmd != null) { undoRedo = new CommandeUndoRedoGraphicalProperties(); @@ -327,15 +385,16 @@ undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); _cmd.addCmd(undoRedo); } - if (_key.equals(LINEMODEL)) { - getTraceLigneModel().updateData((TraceLigneModel) prop); - prop = getTraceLigneModel(); - } else if (_key.equals(ROTATION) && prop instanceof Integer) { - prop = new Double(Math.toRadians(((Integer) prop).intValue())); + if (_property.equals(LINEMODEL)) { + getTraceLigneModel().updateData((TraceLigneModel) _newValue); + _newValue = getTraceLigneModel(); + } else if (_property.equals(ROTATION) && _newValue instanceof Integer) { + _newValue = new Double(Math.toRadians(((Integer) _newValue).intValue())); } // --mise a jout de la map de proprietes --// - propGraphique.put(_key, prop); + propGraphique.put(_property, _newValue); + getEbliScene().firePropertyChange(this, _property); if (undoRedo != null) { // -- ajout de la nouvelle propertie --// undoRedo.addNewPropertie(propGraphique); 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -5,6 +5,7 @@ import java.util.Map; import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; /** @@ -27,15 +28,17 @@ return getIntern().getController(); } - + @Override + public EbliAnimatedInterface getAnimatedInterface() { + return getIntern().getAnimatedInterface(); + } + EbliWidgetControllerActionOnly controllerBordure_ = null; + public EbliWidgetController getBordureController() { return controllerBordure_; } - - - /** * constructeur qui gere un controller uniquement pour les actions. * @@ -58,14 +61,12 @@ insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); setLayout(new OverlayLayoutGap(insets_)); - // -- ajout du child --// addChild(intern_); - // -- mise a jour des evenements (action,menus) du intern --// // intern_.getController().majActionsBordureSpecific(this); - + // --ajout du controller specifique au bordure --// controllerBordure_ = new EbliWidgetControllerActionOnly(this, canMove, canResize); this.setController(controllerBordure_); @@ -86,10 +87,10 @@ // // TraceLigne tl = new TraceLigne(getTraceLigneModel()); // // tl.dessineRectangle(getGraphics(), 0, 0, getClientArea().width, // getClientArea().getHeight()); -// + // // // } - + /** * surcharge des methodes getProperty pour recuperer les proprietes graphiques et les dipatcher a son conteneur */ @@ -97,16 +98,17 @@ // -- la bordure ne gere que tracemodel et couleur contour, le reste est // dispatch\xE9 a son conteneur --// - if (_key.equals(ROTATION)) { - - double radian = intern_.getRotation(); - return Integer.valueOf((int) (radian * 180 / Math.PI)); - - } else if (_key.equals(FONT)) { + // if (_key.equals(ROTATION)) { + // + // double radian = intern_.getRotation(); + // return Integer.valueOf((int) (radian * 180 / Math.PI)); + // + // } + // + if (_key.equals(FONT)) { return intern_.propGraphique.get(_key); - } else if (_key.equals(COLORFOND)) { - return intern_.propGraphique.get(_key); - } else return propGraphique.get(_key); + } else if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } + return super.getProperty(_key); } @Override 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -15,6 +15,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.controle.BConfigurableComposite; @@ -24,6 +25,7 @@ import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; @@ -146,11 +148,10 @@ }); } - - + public AbstractButton boutonBloque = null; public boolean isBlocked = false; - + public void constructMenuBloquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { // EbliWidget widgetListenMove = null; @@ -160,40 +161,37 @@ // widgetListenMove = (EbliWidget) widget_.getParentWidget(); // } else // widgetListenMove = widget_; - + // FuLog.warning("widgetListenMove instanceof " + widgetListenMove); EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); - + boutonBloque = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); - - _popup.add(boutonBloque); + + _popup.add(boutonBloque); } - + public void excecuteBlockOrDeblock() { if (boutonBloque == null) { EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); boutonBloque = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); } - - boutonBloque.doClick(); + + boutonBloque.doClick(); } - + /** - * Methode a appeler apres coup pour mettre a jour les actions, menus et autre - * dans le cas d une bordure englobante de la widget. + * Methode a appeler apres coup pour mettre a jour les actions, menus et autre dans le cas d une bordure englobante de + * la widget. * * @param bordure */ public void majActionsBordureSpecific(EbliWidgetBordureSingle bordure) { - + // -- mise a jour action block/deblock --// EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(bordure); - if (boutonBloque != null) - boutonBloque.setAction(actionBloque); - + if (boutonBloque != null) boutonBloque.setAction(actionBloque); + } - - protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); @@ -250,12 +248,9 @@ constructMenuDupliquer(_popup, cmd_); } - constructMenuBloquer(_popup, cmd_); - + constructMenuSupprimer(_popup, cmd_); - - } @@ -272,26 +267,12 @@ menuItem4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - EbliWidget found = null;// widget_; if (widget_.getParentWidget() != null && widget_.getParentWidget() instanceof EbliWidgetBordureSingle) found = (EbliWidget) widget_ .getParentWidget(); else found = widget_; - - BConfigurePalette palette = new BConfigurePalette(false); - - BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); - - palette.setTargetConf(cmp); - JDialog d = new JDialog(); - d.setModal(true); - d.setTitle(EbliResource.EBLI.getString("Configuration graphique")); - d.setContentPane(palette); - - d.pack(); - d.setVisible(true); - + EbliWidgetActionConfigure.configure(found); } }); @@ -408,7 +389,7 @@ canResize_ = false; } - + public WidgetAction getActionMove() { return actionMove_; } @@ -417,10 +398,8 @@ * fonction inverse de la precedente. */ public void replaceActionResizeAndMove() { - if(actionMove_!=null) - widget_.getActions().addAction(actionMove_); - if(actionResize_!=null) - widget_.getActions().addAction(actionResize_); + if (actionMove_ != null) widget_.getActions().addAction(actionMove_); + if (actionResize_ != null) widget_.getActions().addAction(actionResize_); canMove_ = true; canResize_ = true; 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -6,9 +6,11 @@ import javax.swing.JDialog; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.widget.Widget; @@ -33,8 +35,12 @@ */ public void actionPerformed(ActionEvent e) { EbliWidget found = findWidget(); + configure(found); + } + + public static void configure(EbliWidget found) { if (found != null) { - BConfigurePalette palette = new BConfigurePalette(false); + BConfigurePalette palette = new BConfigurePalette(true); // -- creation du composite avec le configure qui genere les interfaces // necessaires --// @@ -42,14 +48,14 @@ // WidgetConfigure(found), "test"); BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); + palette.setTargetConf(cmp); + palette.setTitleVisibleTarget(found, true); - palette.setTargetConf(cmp); - JDialog d = new JDialog(); + JDialog d = CtuluLibSwing.createDialogOnActiveWindow(EbliLib.getS("Configuration graphique")); d.setModal(true); - d.setTitle("Configuration graphique"); d.setContentPane(palette); - d.pack(); + d.setLocationRelativeTo(d.getParent()); d.setVisible(true); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -33,6 +33,7 @@ * classe qui permet de creer les selecteurs necessaires pour la configuration. * * @author Adrien Hadoux + * TODO a revoir: ce sont les widgets qui doivent la responsabilite de savoir ce qui peut etre configurer ou non */ public class WidgetConfigure implements BConfigurableInterface { @@ -200,7 +201,7 @@ } else { // -- cas des legendes: juste font et color contour pour resizer le tout --// rotations_ = false; - colorFonds_ = false; + colorFonds_ = true; lineModel_ = false; colorsContours_ = false; Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -0,0 +1,79 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.animation.EbliAnimationAction; +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; +import org.fudaa.ebli.animation.EbliAnimationComposite; +import org.fudaa.ebli.animation.EbliAnimationSourceAbstract; +import org.fudaa.ebli.animation.EbliAnimationSourceInterface; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.api.visual.widget.Widget; + +/** + * @author deniger + */ +public class EbliWidgetAnimAdapter extends EbliAnimationSourceAbstract { + + EbliScene scene_; + + public EbliWidgetAnimAdapter(EbliScene _scene) { + super(); + scene_ = _scene; + } + + @SuppressWarnings("serial") + public EbliAnimationAction createAction() { + EbliAnimationAction act = new EbliAnimationAction(this) { + @Override + public void updateBeforeShow() { + super.setAnimAdapterInterface(findAnimAdapter()); + } + }; + act.setEnabled(true); + return act; + } + + public EbliAnimationAdapterInterface findAnimAdapter() { + List<Widget> children = scene_.getLayerVisu().getChildren(); + List<EbliAnimationSourceInterface> anims = new ArrayList<EbliAnimationSourceInterface>(); + for (Widget widget : children) { + EbliWidget ew = (EbliWidget) widget; + EbliAnimatedInterface animatedInterface = ew.getAnimatedInterface(); + if (animatedInterface != null) { + anims.add(animatedInterface.getAnimationSrc()); + } + } + return (new EbliAnimationComposite(anims.toArray(new EbliAnimationSourceInterface[anims.size()]))); + } + + public Component getComponent() { + return scene_.getView(); + } + + public Dimension getDefaultImageDimension() { + return scene_.getDefaultImageDimension(); + } + + public BufferedImage produceImage(int _w, int _h, Map _params) { + return scene_.produceImage(_w, _h, _params); + } + + public BufferedImage produceImage(Map _params) { + return scene_.produceImage(_params); + } + + public void setVideoMode(boolean _b) {} + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -190,8 +190,8 @@ _widgetLegende.setController(new EbliWidgetControllerMenuOnly(_widgetLegende, false)); // -- prendre en compte le resize automatique --// + _widgetLegende.getEbliScene().refresh(); _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); - _widgetLegende.repaint(); return _widgetLegende; } else { 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -143,9 +143,11 @@ lbWidget.setFont(boldFont_); Rectangle boundsTitre = lbWidget.getBounds(); + if(boundsTitre!=null){ boundsTitre.width = fmtBold.stringWidth(lbWidget.getLabel()) + 5; maxTitle = Math.max(maxTitle, boundsTitre.width); boundsTitre.height = (int) (fmtBold.getHeight() + 2); + } // lbWidget.setPreferredBounds(boundsTitre); } 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -17,6 +17,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BCalquePaletteInfo; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -81,7 +82,7 @@ } - + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -13,6 +13,7 @@ import javax.swing.BorderFactory; import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; @@ -47,8 +48,6 @@ // GrBoite zoom_; public EbliWidgetVueCalque(EbliScene _scene, ZEbliCalquesPanel _vue) { this(_scene, _vue, null); - - } @@ -68,9 +67,6 @@ setPreferredSize(new Dimension(500, 400)); initSize(new Rectangle(0, 0, 500, 400)); - - - } public BuPanel createEditorComponent( @@ -110,6 +106,14 @@ } /** + * @return une interface non null si la widget peut etre animee + */ + public EbliAnimatedInterface getAnimatedInterface() { + if (calquePanel_ instanceof EbliAnimatedInterface) return (EbliAnimatedInterface) calquePanel_; + return null; + } + + /** * Creer une frame qui contient toutes les fonctions pour modifier le calque. Ancienne methode edit(). * * @param _widget 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -1,16 +1,20 @@ package org.fudaa.ebli.visuallibrary.tree; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.swing.Icon; +import javax.swing.tree.TreePath; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.DefaultObjectSceneListener; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableNode; @@ -51,55 +55,32 @@ nodeAdded((EbliNode) _addedObject); } - // @Override - // public void selectionChanged(ObjectSceneEvent _event, Set<Object> - // _previousSelection, Set<Object> _newSelection) { - // - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - // - // - // @Override - // public void focusChanged(ObjectSceneEvent _event, Object - // _previousFocusedObject, Object _newFocusedObject) { - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - // - // @Override - // public void hoverChanged(ObjectSceneEvent _event, Object - // _previousHoveredObject, Object _newHoveredObject) { - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - // - // @Override - // public void objectStateChanged(ObjectSceneEvent _event, Object - // _changedObject, ObjectState _previousState, - // ObjectState _newState) { - // // -- mettre a jour l arbre --// - // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( - // null); - // - // } - @Override public void objectRemoved(ObjectSceneEvent _event, Object _removedObject) { nodeRemoved((EbliNode) _removedObject); } }; - scene_.addObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED,ObjectSceneEventType.OBJECT_REMOVED); + scene_.addObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED, + ObjectSceneEventType.OBJECT_REMOVED); + scene_.addPropertyChangeListener(new PropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent _evt) { + if ("title".equals(_evt.getPropertyName()) || "visible".equals(_evt.getPropertyName())) { + EbliWidget widget = (EbliWidget) _evt.getNewValue(); + EbliNode n = (EbliNode) scene_.findObject(widget); + if (n != null) { + MutableTreeTableNode aNode = findTreeTableNode(n); + if (aNode != null) modelSupport.firePathChanged(new TreePath(getPathToRoot(aNode))); + } + } + + } + }); } - - public void removeListener(){ - scene_.removeObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED,ObjectSceneEventType.OBJECT_REMOVED); + + public void removeListener() { + scene_.removeObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED, + ObjectSceneEventType.OBJECT_REMOVED); } public EbliScene getScene() { @@ -180,9 +161,6 @@ } - - - public String getColumnName(int arg0) { if (arg0 < title.length) return title[arg0]; return CtuluLibString.EMPTY_STRING; 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -457,7 +457,7 @@ protected void buildImportMenu() {} protected boolean buildFudaaReportTool() { - return true; + return false; } protected boolean useScrollInBuDesktop() { 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -3,9 +3,11 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.Map; import java.util.Set; import javax.swing.JButton; @@ -52,7 +54,7 @@ * @author Adrien Hadoux */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface, BuCutCopyPasteInterface, EbliWidgetEditModeListener { + BuUndoRedoInterface, BuCutCopyPasteInterface, EbliWidgetEditModeListener, CtuluImageProducer { /** * @@ -116,8 +118,8 @@ // -- enregistrement de this comem listener de la scene pour le type d objet // selection changed--// -// controller_.getSceneCourante().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, -// ObjectSceneEventType.OBJECT_STATE_CHANGED); + // controller_.getSceneCourante().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, + // ObjectSceneEventType.OBJECT_STATE_CHANGED); controller_.getSceneCourante().getController().addEditListener(this); // -- ajout de la toolbar et du menu en haut --// @@ -294,8 +296,8 @@ for (Iterator<EbliNode> it = ((Set<EbliNode>) getScene().getSelectedObjects()).iterator(); it.hasNext();) { EbliNode node = it.next(); if (!(node.getCreator() instanceof EbliWidgetCreatorLegende) - && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) - projet_.nodesCopyied.add(node); + && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) projet_.nodesCopyied + .add(node); } // -- reinit de la commande cut si on voulait faire un ctrl+x projet_.nodesCutted = null; @@ -317,8 +319,8 @@ for (Iterator<EbliNode> it = ((Set<EbliNode>) getScene().getSelectedObjects()).iterator(); it.hasNext();) { EbliNode node = it.next(); if (!(node.getCreator() instanceof EbliWidgetCreatorLegende) - && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) - projet_.nodesCutted.add(node); + && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) projet_.nodesCutted + .add(node); } // -- suppression des nodes depuis cetet kliste pour eviter les concourant @@ -335,8 +337,8 @@ projet_.nodesCopyied = null; // --creation de la commande undo/redo --// - if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) - getScene().getCmdMng().addCmd(new CommandUndoRedoCut(projet_.nodesCutted)); + if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd( + new CommandUndoRedoCut(projet_.nodesCutted)); } @@ -374,8 +376,7 @@ } // --creation de la commande undo/redo --// - if (newNodes.size() != 0) - getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(newNodes)); + if (newNodes.size() != 0) getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(newNodes)); // reinitialisation de la liste projet_.nodesCopyied = null; @@ -391,8 +392,8 @@ getScene().addNode(node); } // --creation de la commande undo/redo --// - if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) - getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(projet_.nodesCutted)); + if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd( + new CommandUndoRedoPaste(projet_.nodesCutted)); // reinit de la liste projet_.nodesCutted = null; @@ -469,6 +470,18 @@ } + public Dimension getDefaultImageDimension() { + return getScene().getDefaultImageDimension(); + } + + public BufferedImage produceImage(int _w, int _h, Map _params) { + return getScene().produceImage(_w, _h, _params); + } + + public BufferedImage produceImage(Map _params) { + return getScene().produceImage(_params); + } + public void editStop(Widget _w) { changeTreeScene(); changeToolbarScene(); 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 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -49,6 +49,7 @@ 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; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; @@ -537,8 +538,8 @@ init.add(null); // -- Action sur le format --// - init.add(new EbliWidgetActionColorForeground(getSceneCourante())); - init.add(new EbliWidgetActionColorBackground(getSceneCourante())); +// init.add(new EbliWidgetActionColorForeground(getSceneCourante())); +// init.add(new EbliWidgetActionColorBackground(getSceneCourante())); // -- action de configuration des composants graphiques--// init.add(new EbliWidgetActionConfigure(getSceneCourante())); init.add(null); @@ -549,6 +550,8 @@ // suppression, on choisit la source a prendre en compte --// init.add(new TrPostActionChooseAndCreateCalque(projet_, this)); + init.add(null); + init.add(new EbliWidgetAnimAdapter(getSceneCourante()).createAction()); // -- action qui permet d ajouter un point du calque dans tous les graphes // selectionnes --// // init.add(new TrPostActionAddPointFromWidgetCalque(getSceneCourante(), Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java 2008-09-16 17:12:47 UTC (rev 3932) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java 2008-09-16 22:10:48 UTC (rev 3933) @@ -280,6 +280,7 @@ } } final int nb = list.size(); + if(nb==0) return; final ProgressionUpdater up = new ProgressionUpdater(_impl.createProgressionForMainPanel()); up.setValue(nb, 10); for (int i = 0; i < nb; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-15 16:58:25
|
Revision: 3926 http://fudaa.svn.sourceforge.net/fudaa/?rev=3926&view=rev Author: hadouxad Date: 2008-09-15 16:57:44 +0000 (Mon, 15 Sep 2008) Log Message: ----------- - Creation des action bloque/debloque avec undo/redo - action au niveau de la widget menu popup - une seule action: action change lors du clic - gestion ds cas bordure ou non - TreeModel: ajout du listener en cas de changement de selection de widget - raffraichis l arbre (masquage + bloquage) - Finalisation de la fonction fusion de graphes - Debut fonction de fusion de calques - Les actions specifiques a tr (fusion de calque, fusion de graphe sont remplies dans la surcharge de attachNode de TrpostSCENE) - Fusion de calques: fonctionne - Les calques se superposent - menu arbre different a droite - ajout d une liste des calques: en cliquant, cela met a jour la superposition - gestion de tous les cas: - fusion de 2 calques widget - fusion widget avec une fusion et reciproquement - fusion de 2 fusions - ppossibilit?\195?\169s d editer Modified Paths: -------------- 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/EbliWidgetBordureSingle.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/actions/CommandUndoRedoBloque.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/calque/EbliWidgetControllerCalque.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/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.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 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/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.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/TrPostLayoutFille.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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/textures/Thumbs.db branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java 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/graphe/GrapheCellRenderer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-15 16:57:44 UTC (rev 3926) @@ -608,4 +608,12 @@ Editeur de texte=text editor Double-cliquez pour \xE9diter=double click in order to edit D\xE9grouper=Degroup -Grouper=Group \ No newline at end of file +Grouper=Group +Bloquer la frame= Lock the frame +Debloquer la frame= Unlock the frame +Supprimer la frame= delete the frame +Informations= Infos +Configuration graphique= Graphical configuration +Masquer la frame= Hide the frame +Dupliquer la frame= Duplicate the frame +R\xE9aliser la fusion= Perform the merging \ No newline at end of file Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/textures/Thumbs.db ___________________________________________________________________ Added: svn:mime-type + application/octet-stream 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -27,6 +27,15 @@ return getIntern().getController(); } + + EbliWidgetControllerActionOnly controllerBordure_ = null; + public EbliWidgetController getBordureController() { + return controllerBordure_; + } + + + + /** * constructeur qui gere un controller uniquement pour les actions. * @@ -52,8 +61,13 @@ // -- ajout du child --// addChild(intern_); + + // -- mise a jour des evenements (action,menus) du intern --// + // intern_.getController().majActionsBordureSpecific(this); + // --ajout du controller specifique au bordure --// - this.setController(new EbliWidgetControllerActionOnly(this, canMove, canResize)); + controllerBordure_ = new EbliWidgetControllerActionOnly(this, canMove, canResize); + this.setController(controllerBordure_); } public Insets createInset(int epaisseur) { 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -5,6 +5,7 @@ import java.awt.event.ActionListener; import java.util.ArrayList; +import javax.swing.AbstractButton; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; @@ -15,11 +16,15 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; @@ -81,7 +86,7 @@ } protected void constructMenuDupliquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { - JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); + JMenuItem menuItem1 = _popup.add(EbliResource.EBLI.getString("Dupliquer la frame")); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -120,7 +125,7 @@ } protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { - JMenuItem menuItem = _popup.add("Masquer l'objet"); + JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Masquer la frame")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); menuItem.addActionListener(new ActionListener() { @@ -141,9 +146,57 @@ }); } + + + public AbstractButton boutonBloque = null; + public boolean isBlocked = false; + + public void constructMenuBloquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + // EbliWidget widgetListenMove = null; + // if (widget_.getParentWidget() != null && widget_.getParentWidget() + // instanceof EbliWidgetBordureSingle) { + // + // widgetListenMove = (EbliWidget) widget_.getParentWidget(); + // } else + // widgetListenMove = widget_; + + // FuLog.warning("widgetListenMove instanceof " + widgetListenMove); + EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); + + boutonBloque = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); + + _popup.add(boutonBloque); + } + + public void excecuteBlockOrDeblock() { + if (boutonBloque == null) { + EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_); + boutonBloque = actionBloque.buildMenuItem(EbliComponentFactory.INSTANCE); + } + + boutonBloque.doClick(); + } + + /** + * Methode a appeler apres coup pour mettre a jour les actions, menus et autre + * dans le cas d une bordure englobante de la widget. + * + * @param bordure + */ + public void majActionsBordureSpecific(EbliWidgetBordureSingle bordure) { + + // -- mise a jour action block/deblock --// + EbliWidgetActionSimple actionBloque = new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(bordure); + if (boutonBloque != null) + boutonBloque.setAction(actionBloque); + + } + + + protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { - JMenuItem menuItem = _popup.add("Supprimer l'objet"); + JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem.addActionListener(new ActionListener() { @@ -179,13 +232,14 @@ // -- reference vers le gestionnaire de commandeundo/redo --// final CtuluCommandContainer cmd_ = getWidget().getEbliScene().getCmdMng(); - JMenuItem menuItem3 = _popup.add("Informations"); + JMenuItem menuItem3 = _popup.add(EbliResource.EBLI.getString("Informations")); menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); menuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(null, getDescription(), "Informations", JOptionPane.DEFAULT_OPTION, null); + JOptionPane.showMessageDialog(null, getDescription(), EbliResource.EBLI.getString("Informations"), + JOptionPane.DEFAULT_OPTION, null); } }); @@ -196,7 +250,12 @@ constructMenuDupliquer(_popup, cmd_); } + + constructMenuBloquer(_popup, cmd_); + constructMenuSupprimer(_popup, cmd_); + + } @@ -207,7 +266,7 @@ */ public void constructPopupMenuBaseGraphique(JPopupMenu _popup) { - JMenuItem menuItem4 = _popup.add("Configuration graphique"); + JMenuItem menuItem4 = _popup.add(EbliResource.EBLI.getString("Configuration graphique")); menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); // BuResource.BU.getIcon("configurer") menuItem4.addActionListener(new ActionListener() { @@ -227,7 +286,7 @@ palette.setTargetConf(cmp); JDialog d = new JDialog(); d.setModal(true); - d.setTitle("Configuration graphique"); + d.setTitle(EbliResource.EBLI.getString("Configuration graphique")); d.setContentPane(palette); d.pack(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -1,10 +1,7 @@ package org.fudaa.ebli.visuallibrary.actions; -import java.util.ArrayList; -import java.util.Iterator; - import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetController; /** * Commande undo/redo sur le blocage des widgets. @@ -14,10 +11,10 @@ public class CommandUndoRedoBloque implements CtuluCommand { - ArrayList<EbliWidget> widget_; + EbliWidgetController widget_; boolean bloque_ = true; - public CommandUndoRedoBloque(ArrayList<EbliWidget> widget, boolean bloque) { + public CommandUndoRedoBloque(EbliWidgetController widget, boolean bloque) { super(); this.widget_ = widget; bloque_ = bloque; @@ -25,20 +22,45 @@ public void undo() { - for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { - if (bloque_) it.next().getController().replaceActionResizeAndMove(); - else it.next().getController().removeActionResizeAndMove(); + + if (bloque_) { + widget_.replaceActionResizeAndMove(); + // -- on change l action du bouton du controller --// + widget_.getWidget().getController().boutonBloque.setAction(new EbliWidgetActionBloqueOuDebloqueWidget.Bloque( + widget_.getWidget())); + widget_.getWidget().getController().isBlocked = true; } + else { + widget_.removeActionResizeAndMove(); + // -- on change l action du bouton du controller --// + widget_.getWidget().getController().boutonBloque.setAction(new EbliWidgetActionBloqueOuDebloqueWidget.DeBloque( + widget_.getWidget())); + widget_.getWidget().getController().isBlocked = false; + } + - widget_.get(0).getEbliScene().refresh(); + widget_.getWidget().getEbliScene().refresh(); } public void redo() { - for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { - if (bloque_) it.next().getController().removeActionResizeAndMove(); - else it.next().getController().replaceActionResizeAndMove(); + + if (bloque_) { + widget_.removeActionResizeAndMove(); + // -- on change l action du bouton du controller --// + widget_.getWidget().getController().boutonBloque.setAction(new EbliWidgetActionBloqueOuDebloqueWidget.DeBloque( + widget_.getWidget())); + widget_.getWidget().getController().isBlocked = true; } - widget_.get(0).getEbliScene().refresh(); + + else { + widget_.replaceActionResizeAndMove(); + // -- on change l action du bouton du controller --// + widget_.getWidget().getController().boutonBloque.setAction(new EbliWidgetActionBloqueOuDebloqueWidget.Bloque( + widget_.getWidget())); + widget_.getWidget().getController().isBlocked = false; + } + + widget_.getWidget().getEbliScene().refresh(); } } \ No newline at end of file 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -1,19 +1,18 @@ package org.fudaa.ebli.visuallibrary.actions; import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Set; import javax.swing.Icon; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; +import org.fudaa.ebli.visuallibrary.EbliWidgetController; +import com.memoire.fu.FuLog; + /** * Action qui empeche les widgets de se resize et d'etre deplacee * @@ -25,64 +24,75 @@ final CtuluCommandContainer cmd_; boolean bloque_ = true; + EbliWidget widget_; + + public EbliWidgetActionBloqueOuDebloqueWidget(String name, Icon ic, String id, EbliWidget _widget, boolean bloque) { + super(_widget.getEbliScene(), name, ic, id); - public EbliWidgetActionBloqueOuDebloqueWidget(String name, Icon ic, String id, EbliScene _scene, boolean bloque) { - super(_scene, name, ic, id); - - - cmd_ = _scene.getCmdMng(); + widget_ = _widget; + cmd_ = _widget.getEbliScene().getCmdMng(); bloque_ = bloque; } public static class Bloque extends EbliWidgetActionBloqueOuDebloqueWidget { - public Bloque(EbliScene _scene) { - super(EbliResource.EBLI.getString("Bloquer les objets s\xE9lectionn\xE9s "), CtuluResource.CTULU - .getIcon("crystal_tuer"), "BLOQUEWIDGET", _scene, true); + public Bloque(EbliWidget _widget) { + super(EbliResource.EBLI.getString("Bloquer la frame"), CtuluResource.CTULU + .getIcon("crystal_tuer"), "BLOQUEWIDGET", _widget, true); } } public static class DeBloque extends EbliWidgetActionBloqueOuDebloqueWidget { - public DeBloque(EbliScene _scene) { - super(EbliResource.EBLI.getString("Debloquer les objets s\xE9lectionn\xE9s "), CtuluResource.CTULU - .getIcon("crystal_valider"), "DEBLOQUEWIDGET", _scene, false); + public DeBloque(EbliWidget _widget) { + super(EbliResource.EBLI.getString("Debloquer la frame"), CtuluResource.CTULU + .getIcon("crystal_valider"), "DEBLOQUEWIDGET", _widget, false); } } public void actionPerformed(ActionEvent e) { - // -- recuperation de la liste des nodes de la scene --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + EbliWidgetController controller = null; + + + if (widget_ instanceof EbliWidgetBordureSingle) { - // -- liste des widget selectionnees --// - ArrayList<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); - - // -- parcours des nodes - for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - - EbliNode currentNode = it.next(); - if (currentNode != null && currentNode.hasWidget()) { - - // -- bloquage de la widget --// - if (bloque_) - currentNode.getWidget().getController().removeActionResizeAndMove(); - else - currentNode.getWidget().getController().replaceActionResizeAndMove(); - listeWidget.add(currentNode.getWidget()); - + controller = ((EbliWidgetBordureSingle) widget_).getBordureController(); + } else + if (widget_.getParentWidget() instanceof EbliWidgetBordureSingle) { + controller = ((EbliWidgetBordureSingle) widget_.getParentWidget()).getBordureController(); + } else + controller = widget_.getController(); + + FuLog.warning("controller instanceof " + controller); + + if (bloque_) { + controller.removeActionResizeAndMove(); + + // -- on change l action du bouton du controller --// + // -- ACHTUNG!! il faut toujours utilsier el controller de la widget car + // le controlelr de la bordure ne contient pas de menus + widget_.getController().boutonBloque.setAction(new EbliWidgetActionBloqueOuDebloqueWidget.DeBloque(widget_)); + widget_.getController().isBlocked = true; + + } else { + controller.replaceActionResizeAndMove(); + // -- on change l action du bouton du controller --// + widget_.getController().boutonBloque.setAction(new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(widget_)); + widget_.getController().isBlocked = false; + } // -- rafraichissement de la scene --// scene_.refresh(); - } + - } + // -- enregistrement de la commande undoRedo --// if (cmd_ != null) { - cmd_.addCmd(new CommandUndoRedoBloque(listeWidget, bloque_)); + cmd_.addCmd(new CommandUndoRedoBloque(controller, bloque_)); } } 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -32,10 +32,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; @@ -51,6 +48,8 @@ JLabel labelTrace_; + public boolean hasAlreadyFusion = false; + /** * widget de la legende */ Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -0,0 +1,269 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +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.ListSelectionModel; + +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.calque.BArbreCalque; +import org.fudaa.ebli.calque.BCalquePaletteInfo; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BSelecteurListComboBox; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; +import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; +import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; + +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuToolBar; + +public class EbliWidgetControllerFusionCalque extends EbliWidgetControllerMenuOnly { + + JLabel labelTrace_; + + /** + * widget de la legende + */ + CalqueLegendeWidgetAdapter legendeWidget_; + + BuMenuBar menuCalque_; + + JPanel panelTreeCalque_; + + BuToolBar toolbarCalque_; + + JList selectionCalque_; + + BArbreCalque arbreCalque_; + + EbliWidgetFusionCalques widgetCalque_; + EbliWidgetWithBordure widgetParent_; + + + + public boolean hasAlreadyFusion = false; + + + public EbliWidgetControllerFusionCalque(EbliWidgetFusionCalques _widget, EbliWidgetWithBordure _parent) { + super(_parent); + widgetCalque_ = _widget; + widgetParent_ = _parent; + addActionSpecifiques(); + + } + + public void addActionSpecifiques() { + + // WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>( + // (EbliWidgetVueCalque) widgetCalque_.widgetCalque1_); + // // -- ajout de l action au widget correspondant --// + // widgetCalque_.getActions().addAction(editorAction); + + } + + + + +public ZEbliCalquesPanel getCalqueCourant() { + return widgetCalque_.getCalqueCourant().calquePanel_; + } + + + /** + * retourne le menuBar associee au calque + * + * @return + */ + public BuMenuBar getMenubarComponent() { + + if (menuCalque_ == null) { + + menuCalque_ = new BuMenuBar(); + + } + menuCalque_.removeAll(); + + JMenu[] specificMenus = getCalqueCourant().getSpecificMenus(EbliLib.getS("Vue 2D")); + + for (int i = 0; i < specificMenus.length; i++) { + menuCalque_.add(specificMenus[i]); + } + + + return menuCalque_; + + } + + /** + * remplit le model de la liste par des labels representants le contenu du + * widgt fusion. + * + * @return + */ +public DefaultListModel fillModelListWithCalques() { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + DefaultListModel model = new DefaultListModel(); + for (int i = 0; i < widgetCalque_.listeWidgetCalque_.size(); i++) { + + JLabel label = new JLabel(); + label.setText("" + widgetCalque_.getWidgetCalque(i).calquePanel_.getCqInfos().getTitle()); + BufferedImage image = widgetCalque_.getWidgetCalque(i).calquePanel_.produceImage(70, 30, params); + Icon icone = new ImageIcon(image); + label.setIcon(icone); + model.addElement(label); + + } + + selectionCalque_.addListSelectionListener(widgetCalque_); + // model.addListDataListener(widgetCalque_); + + return model; + } + + /** + * Recupere les objets graphique tree et panel infos associe au calque. + * + * @return + */ + public JComponent getOverviewComponent() { + + // -- jlist qui propose la liste des composants du calque --// + if (selectionCalque_ == null) { + selectionCalque_ = new JList(); + selectionCalque_.setCellRenderer(new GrapheCellRenderer()); + selectionCalque_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des calques"))); + selectionCalque_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + selectionCalque_.setSize(250, 100); + selectionCalque_.setPreferredSize(new Dimension(250, 100)); + selectionCalque_.setMaximumSize(new Dimension(250, 100)); + + + } + // -- creation du model de la jlist --// + DefaultListModel model = fillModelListWithCalques(); + selectionCalque_.setModel(model); + // selectionCalque_.setSelectedIndex(widgetCalque_.getIndexCalqueCourant()); + + + + if (panelTreeCalque_ == null) { + panelTreeCalque_ = new JPanel(new BorderLayout()); + + + BCalquePaletteInfo info = new BCalquePaletteInfo(getCalqueCourant().getArbreCalqueModel()); + info.setAvailable(true); + panelTreeCalque_.add(info, BorderLayout.NORTH); + JPanel panelConteneur = new JPanel(new BorderLayout()); + + arbreCalque_ = new BArbreCalque(); + arbreCalque_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Arbre du calque"))); + panelConteneur.add(arbreCalque_, BorderLayout.CENTER); + panelConteneur.add(new JScrollPane(selectionCalque_), BorderLayout.NORTH); + + panelTreeCalque_.add(new JScrollPane(panelConteneur), BorderLayout.CENTER); + + } + // -- mise a jour du model de l arbre --// + arbreCalque_.setModel(getCalqueCourant().getArbreCalqueModel()); + + + return panelTreeCalque_; + } + + /** + * Obtient la toolbar specifique au calque + * + * @return + */ + public BuToolBar getToolbarComponent() { + + if (toolbarCalque_ == null) { + toolbarCalque_ = new BuToolBar(); + } + toolbarCalque_.removeAll(); + + // ajout des tool specifiques du calque + List actions = getCalqueCourant().getController().getActions(); + for (Iterator iterator = actions.iterator(); iterator.hasNext();) { + EbliActionInterface object = (EbliActionInterface) iterator.next(); + if (object == null) { + toolbarCalque_.addSeparator(); + } else { + toolbarCalque_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + + // -- ajout des comboBox des variables --// + BSelecteurListComboBox combo = new BSelecteurListComboBox(); + // pour mettre \xE0 jour la combo d\xE8s que la s\xE9lection de l'arbre change + getCalqueCourant().getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(combo); + combo.setPalettePanelTarget(getCalqueCourant().getArbreCalqueModel().getSelectedCalque()); + // combo.setPalettePanelTarget(listselector.getTarget()); + combo.setMinimumSize(combo.getPreferredSize()); + combo.setMaximumSize(combo.getPreferredSize()); + + // ajout combobox + toolbarCalque_.add(combo); + + // -- ajout des combo des pas de temps --// + EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(getCalqueCourant().getArbreCalqueModel() + .getTreeSelectionModel(), true); + // pour activer l'action + chooserT.setSelected(true); + combo = (BSelecteurListComboBox) chooserT.buildContentPane(); + chooserT.updateBeforeShow(); + combo.setMaximumSize(combo.getPreferredSize()); + combo.setMinimumSize(combo.getPreferredSize()); + + // ajout combobox + toolbarCalque_.add(combo); + + + return toolbarCalque_; + } + + /** + * affiche le label des coordonnees + */ + public JComponent geTtracableComponent() { + + + return getCalqueCourant().getLabelSuiviSouris(); + } + + + + @Override + protected void buildPopupMenu(JPopupMenu _menu) { + // constructPopupMenuSpecifique(_menu); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(_menu); + } + + + + + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -0,0 +1,73 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.Iterator; + +import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreator; +import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; + +public class EbliWidgetCreatorFusionCalques implements EbliWidgetCreator { + + ArrayList<EbliWidgetVueCalque> listeWidgetCalque_; + + GrBoite initZoom_; + + EbliWidgetWithBordure res; + + + + public EbliWidgetCreatorFusionCalques(EbliWidgetVueCalque widgetCalque1_, + ArrayList<EbliWidgetVueCalque> listWidgetToMerge) { + this(widgetCalque1_, listWidgetToMerge, null); + } + + public EbliWidgetCreatorFusionCalques(EbliWidgetVueCalque widgetCalque1_, + ArrayList<EbliWidgetVueCalque> listWidgetToMerge, + GrBoite _initZoom) { + super(); + listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); + + listeWidgetCalque_.add(widgetCalque1_); + + for (Iterator<EbliWidgetVueCalque> it = listWidgetToMerge.iterator(); it.hasNext();) + listeWidgetCalque_.add(it.next()); + + initZoom_ = _initZoom; + // legendeDuplic_= + } + + + public EbliWidget create(EbliScene _scene) { + EbliWidgetFusionCalques widgetCalque = new EbliWidgetFusionCalques(_scene, listeWidgetCalque_, + initZoom_); + res = new EbliWidgetBordureSingle(widgetCalque); + res.setPreferredSize(new Dimension(400, 400)); + widgetCalque.setController(new EbliWidgetControllerFusionCalque(widgetCalque, res)); + return res; + } + + + + public EbliWidgetWithBordure getBordure() { + return res; + } + + + + public EbliWidget getWidget() { + return res; + } + + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + return null; + } + + + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -0,0 +1,133 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.Iterator; + +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.modules.visual.layout.OverlayLayout; + +/** + * Widget qui resulte de la fusion de 2 calques. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetFusionCalques extends EbliWidget implements ListSelectionListener { + + ArrayList<EbliWidgetVueCalque> listeWidgetCalque_; + + /** + * Calque courant qui sera modifi\xE9 a chaque fois que l utilisateur changera de + * calque de premier plan. + */ + EbliWidgetVueCalque calqueCourant_; + + OverlayLayout layout_; + + GrBoite initZoom_; + + + public EbliWidgetFusionCalques(EbliScene _scene, ArrayList<EbliWidgetVueCalque> _liste, GrBoite zoom) { + super(_scene); + + initZoom_ = zoom; + listeWidgetCalque_=_liste; + // --creation du layout de mise en page --// + layout_ = new OverlayLayout(); + this.setLayout(layout_); + + // -- ajout des widgets --// + for (Iterator<EbliWidgetVueCalque> it = listeWidgetCalque_.iterator(); it.hasNext();) { + EbliWidgetVueCalque calque = it.next(); + this.addChild(calque); + // -- mise a jour du zoom + calque.initZoom_ = initZoom_; + + // init le calque courant + if (calqueCourant_ == null) + calqueCourant_ = calque; + } + setPreferredSize(new Dimension(500, 400)); + + } + + /** + * Methode utilisee pour mettre au premier plan la widget selectionnee. + * + * @param newCrt + * : nouvelle widget calque a positionner au premier plan + */ + public void changeWidgetCourant(EbliWidgetVueCalque newCrt) { + calqueCourant_ = newCrt; + + // -- mise au premier plan de newCrt --// + bringToFront(calqueCourant_); + + + + } + + + public void bringToFront(EbliWidgetVueCalque widget) { + + this.removeChild(widget); + + // -- ajout pour qu elle soit en premier plan --// + this.addChild(widget); + + // -- refrresh de la scene --// + getEbliScene().refresh(); + } + + public EbliWidgetVueCalque getCalqueCourant() { + return calqueCourant_; + } + + + public ZEbliCalquesPanel getCalque(int i) { + + return getWidgetCalque(i).calquePanel_; + } + + public int getNbWidgets() { + return listeWidgetCalque_.size(); + } + + public EbliWidgetVueCalque getWidgetCalque(int i) { + return listeWidgetCalque_.get(i); + } + + + public int getIndexCalqueCourant() { + + for (int i = 0; i < listeWidgetCalque_.size(); i++) + if (listeWidgetCalque_.get(i) == calqueCourant_) + return i; + + return -1; + } + + public void valueChanged(ListSelectionEvent _e) { + + // -- on est dans un cas single selection mode --// + int selected = _e.getFirstIndex(); + + // -- on change de calque courant --// + if (selected < listeWidgetCalque_.size()) + changeWidgetCourant(getWidgetCalque(selected)); + + } + + + + + + +} 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -1,22 +1,16 @@ package org.fudaa.ebli.visuallibrary.calque; -import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; @@ -46,7 +40,7 @@ Window frame_; BufferedImage image; - GrBoite initZoom_; + public GrBoite initZoom_; BuPanel conteneurEditor; 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -31,10 +31,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; @@ -52,6 +49,8 @@ public boolean alreadyCreate_ ; + public boolean hasAlreadyFusion = false; + JLabel labelTrace_; BuMenuBar menuGraphe_ ; Added: 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/GrapheCellRenderer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheCellRenderer.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -0,0 +1,40 @@ +package org.fudaa.ebli.visuallibrary.graphe; + +import java.awt.Color; +import java.awt.Component; + +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.ListCellRenderer; +import javax.swing.UIManager; + +/** + * Renderer de cellules pour les graphes et calques. Permet d avoir des + * miniatures des widgets. + * + * @author Adrien Hadoux + * + */ +public class GrapheCellRenderer extends JLabel implements ListCellRenderer { + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + + public GrapheCellRenderer() { + setOpaque(true); + setIconTextGap(12); + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + JLabel entry = (JLabel) value; + setText(entry.getText()); + setIcon(entry.getIcon()); + if (isSelected) { + setBackground(HIGHLIGHT_COLOR); + setForeground(Color.white); + } else { + setBackground(Color.white); + setForeground(Color.black); + } + return this; + } +} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -30,8 +30,9 @@ public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal_cacher"); public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir"); public Icon iconRoot=CtuluResource.CTULU.getIcon("crystal_maison"); + public Icon iconBloque = CtuluResource.CTULU.getIcon("crystal_tuer"); + public Icon iconDeBloque = CtuluResource.CTULU.getIcon("crystal_valider"); - public EbliJXTreeTableCellRenderer() { returnLabel.setOpaque(false); returnLabel.setHorizontalAlignment(BuLabel.LEFT); 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -31,7 +31,7 @@ /** * titres des colonnes. */ - private static final String[] title = { "", EbliLib.getS("Nom"), "V" }; + private static final String[] title = { "", EbliLib.getS("Nom"), "V", EbliLib.getS("Bloqu\xE9") }; final EbliScene scene_; final ObjectSceneListener sceneListener_; @@ -51,6 +51,45 @@ nodeAdded((EbliNode) _addedObject); } + // @Override + // public void selectionChanged(ObjectSceneEvent _event, Set<Object> + // _previousSelection, Set<Object> _newSelection) { + // + // // -- mettre a jour l arbre --// + // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( + // null); + // + // } + // + // + // @Override + // public void focusChanged(ObjectSceneEvent _event, Object + // _previousFocusedObject, Object _newFocusedObject) { + // // -- mettre a jour l arbre --// + // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( + // null); + // + // } + // + // @Override + // public void hoverChanged(ObjectSceneEvent _event, Object + // _previousHoveredObject, Object _newHoveredObject) { + // // -- mettre a jour l arbre --// + // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( + // null); + // + // } + // + // @Override + // public void objectStateChanged(ObjectSceneEvent _event, Object + // _changedObject, ObjectState _previousState, + // ObjectState _newState) { + // // -- mettre a jour l arbre --// + // EbliWidgetJXTreeTableModel.this.modelSupport.fireTreeStructureChanged( + // null); + // + // } + @Override public void objectRemoved(ObjectSceneEvent _event, Object _removedObject) { nodeRemoved((EbliNode) _removedObject); @@ -133,6 +172,8 @@ return String.class; case 2: return Boolean.class; + case 3: + return Boolean.class; default: return null; } 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 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -56,7 +56,7 @@ } public int getColumnCount() { - return 3; + return 4; } public Object getValueAt(int _column) { @@ -68,7 +68,13 @@ if (_column == 1) { return ((EbliNodeDefault) getUserObject()).getTitle(); } + if (_column == 2) return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().isVisible()); + + + return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().getController().isBlocked); + + } @Override @@ -121,6 +127,10 @@ ((EbliNode) getUserObject()).getWidget().getEbliScene().refresh(); } + else if (_column == 3) { + // -- bloque debloque --// + ((EbliNode) getUserObject()).getWidget().getController().excecuteBlockOrDeblock(); + } } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-15 13:34:59 UTC (rev 3925) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -1,8 +1,6 @@ package org.fudaa.fudaa.tr.post; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -25,8 +23,6 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import javax.swing.UIManager; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; @@ -40,6 +36,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; import org.fudaa.fudaa.meshviewer.profile.MvProfileBuilderFromTree; import org.fudaa.fudaa.meshviewer.profile.MvProfileCoteTester; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; @@ -327,30 +324,8 @@ public abstract boolean isCorrectGraph(EGGrapheModel _model); - public class GrapheCellRenderer extends JLabel implements ListCellRenderer { - private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + - public GrapheCellRenderer() { - setOpaque(true); - setIconTextGap(12); - } - - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, - boolean cellHasFocus) { - JLabel entry = (JLabel) value; - setText(entry.getText()); - setIcon(entry.getIcon()); - if (isSelected) { - setBackground(HIGHLIGHT_COLOR); - setForeground(Color.white); - } else { - setBackground(Color.white); - setForeground(Color.black); - } - return this; - } - } - /** * construit l interface * Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-15 16:57:44 UTC (rev 3926) @@ -0,0 +1,375 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListSelectionModel; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.ProgressionBuAdapter; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerFusionCalque; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorFusionCalques; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuDialog; +import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuScrollPane; +import com.memoire.fu.FuLog; + +/** + * Action qui realise la fusion des calques + * + * @author Adrien Hadoux + * + */ +public class TrPostActionFusionCalques extends EbliWidgetActionSimple { + + TrPostProjet projet_; + EbliWidgetVueCalque widgetCalque_; + EbliNode nodeCalque_; + JList jListeCalques_; + ArrayList<JLabel> listeObjetsCalques; + + // -- les node possibles a choisir --// + ArrayList<EbliNode> listeCalquesPossibles; + + + + + ArrayList<EbliWidgetVueCalque> listeTotaleWidgetToMerge_ = new ArrayList<EbliWidgetVueCalque>(); + + JComponent content_; + BuDialog dialog_; + DefaultListModel modelCalquesPossibles_; + + + + /** + * constructeur pour le cas de widget calque classiques. + * + * @param widget + * @param nodeGraphe + * @param projet + */ + public TrPostActionFusionCalques(EbliWidgetVueCalque widget, EbliNode nodeGraphe, TrPostProjet projet) { + super(widget.getEbliScene(), TrResource.getS("Fusion avec un autre calque"), CtuluResource.CTULU.getIcon("cible"), + "ADDPOINTWIDGET"); + + + widgetCalque_ = widget; + nodeCalque_ = nodeGraphe; + projet_ = projet; + + // -- ajout de la combo dans la toolbar de la widget --// + if (!((EbliWidgetControllerCalque) widgetCalque_.getController()).hasAlreadyFusion) { + widgetCalque_.getController().getPopup().add(this); + ((EbliWidgetControllerCalque) widgetCalque_.getController()).hasAlreadyFusion = true; + } + } + + + + /** + * Constructeur pour le cas d une widget fusion + */ + public TrPostActionFusionCalques(EbliWidgetFusionCalques widgetFusion, EbliNode nodeGraphe, TrPostProjet projet) { + super(widgetFusion.getEbliScene(), TrResource.getS("Fusion avec un autre calque"), CtuluResource.CTULU + .getIcon("cible"), + "ADDPOINTWIDGET"); + + for (int i = 1; i < widgetFusion.getNbWidgets(); i++) + listeTotaleWidgetToMerge_.add(widgetFusion.getWidgetCalque(i)); + + widgetCalque_ = widgetFusion.getWidgetCalque(0); + nodeCalque_ = nodeGraphe; + projet_ = projet; + + // -- ajout de la combo dans la toolbar de la widget --// + if (!((EbliWidgetControllerFusionCalque) widgetFusion.getController()).hasAlreadyFusion) { + widgetFusion.getController().getPopup().add(this); + ((EbliWidgetControllerFusionCalque) widgetFusion.getController()).hasAlreadyFusion = true; + } + } + + /** + * remplissage de la combo avec les graphes disponibles et compatibles + * + * @param scene + */ + private void remplirCombo() { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + listeCalquesPossibles = new ArrayList<EbliNode>(); + listeObjetsCalques = new ArrayList<JLabel>(); + + // -- remplissage de la liste a partir de l ecoute de la scene--// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getObjects(); + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode currentNode = it.next(); + + if (currentNode != nodeCalque_ && currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque) { + EbliWidgetCreatorVueCalque new_name = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); + + + if (isCompatibleWithCalque(new_name.getCalque())) { + + JLabel label = new JLabel(); + BufferedImage image = new_name.getCalque().produceImage(70, 50, params); + Icon icone = new ImageIcon(image); + + label.setIcon(icone); + label.setText(TrResource.TR.getString("Fusionner avec ") + currentNode.getTitle()); + listeObjetsCalques.add(label); + listeCalquesPossibles.add(currentNode); + } + + + } else if (currentNode != nodeCalque_ && currentNode.getCreator() instanceof EbliWidgetCreatorFusionCalques) { + + // -- on ajoute le node potentiel qui renferme une widget fusion --// + EbliWidgetCreatorFusionCalques new_name = (EbliWidgetCreatorFusionCalques) currentNode.getCreator(); + + if (isCompatibleWithCalque(new_name)) { + + JLabel label = new JLabel(); + label.setText(TrResource.TR.getString("Fusionner avec la Fusion ") + currentNode.getTitle()); + listeObjetsCalques.add(label); + listeCalquesPossibles.add(currentNode); + } + + + } + + + } + + + // -- creation graphique --// + if (jListeCalques_ == null) + jListeCalques_ = new JList(); + + modelCalquesPossibles_ = new DefaultListModel(); + + jListeCalques_.setModel(modelCalquesPossibles_); + + for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { + + modelCalquesPossibles_.addElement(it.next()); + + } + jListeCalques_.setSize(250, 350); + jListeCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Calques possibles"))); + jListeCalques_.setCellRenderer(new GrapheCellRenderer()); + + + } + + /** + * verifie si les graphes sont compatibles + * + * @param graphe + * @return + */ + public boolean isCompatibleWithCalque(ZEbliCalquesPanel calque) { + return true; + } + + public boolean isCompatibleWithCalque(EbliWidgetCreatorFusionCalques widgetFusion) { + return true; + } + + + + + JComponent constructPanel() { + JPanel content = new JPanel(new BorderLayout()); + + content.add(new JLabel(TrResource.getS("Fusion avec un autre calque")), BorderLayout.NORTH); + content.add(new BuScrollPane(jListeCalques_), BorderLayout.CENTER); + JButton valide = new JButton(TrResource.getS("R\xE9aliser la fusion"), EbliResource.EBLI.getIcon("crystal_valider")); + valide.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent _e) { + + mergeCalques(); + dialog_.dispose(); + + } + + }); + jListeCalques_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + + JPanel operations = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + operations.add(valide); + content.add(operations, BorderLayout.SOUTH); + + return content; + } + + /** + * Methode qui: merge le graphe choisi dans la combo avec el ndoe actuel + * degage le node choisi de la scene remet a jour al combo actuelle + */ + private void mergeCalques() { + + int[] selected = jListeCalques_.getSelectedIndices(); + if (selected == null || selected.length==0) { + return; + } + + //-- parcours de la liste des indices selectionnes --// + for(int i=0;i<selected.length;i++){ + + EbliNode nodeToMerge = listeCalquesPossibles.get(selected[i]); + + // --recuperation de son graphe --// + + //cas bordure + if (nodeToMerge.getWidget() instanceof EbliWidgetBordureSingle){ + if(((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern() instanceof EbliWidgetVueCalque){ + EbliWidgetVueCalque calqueWidget = (EbliWidgetVueCalque) ((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern(); + // -- ajout de la widget cible a la liste a merger --// + listeTotaleWidgetToMerge_.add(calqueWidget); + + // -- suppression du noeud de la scene--// + if (nodeToMerge != null) + scene_.removeNodeWithEdges(nodeToMerge); + } + else + //-- cas le noeud selectionne contient des fusionWidget + if(((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern() instanceof EbliWidgetFusionCalques){ + + EbliWidgetFusionCalques calqueWidget = (EbliWidgetFusionCalques) ((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern(); + // -- ajout de toutes les widgets de la FusionWidget --// + for(int k=0;k< calqueWidget.getNbWidgets();k++) + listeTotaleWidgetToMerge_.add(calqueWidget.getWidgetCalque(k)); + + // -- suppression du noeud de la scene--// + if (nodeToMerge != null) + scene_.removeNodeWithEdges(nodeToMerge); + } + + + + } + else{ + if( nodeToMerge.getWidget() instanceof EbliWidgetVueCalque){ + EbliWidgetVueCalque calqueWidget = (EbliWidgetVueCalque) nodeToMerge.getWidget(); + // -- ajout de la widget cible a la liste a merger --// + listeTotaleWidgetToMerge_.add(calqueWidget); + + // -- suppression du noeud de la scene--// + if (nodeToMerge != null) + scene_.removeNodeWithEdges(nodeToMerge); + } + else + //-- cas le noeud selectionne contient des fusionWidget + if( nodeToMerge.getWidget()instanceof EbliWidgetFusionCalques){ + + EbliWidgetFusionCalques calqueWidget = (EbliWidgetFusionCalques) nodeToMerge.getWidget(); + // -- ajout de toutes les widgets de la FusionWidget --// + for(int k=0;k< calqueWidget.getNbWidgets();k++) + listeTotaleWidgetToMerge_.add(calqueWidget.getWidgetCalque(k)); + + // -- suppression du noeud de la scene--// + if (nodeToMerge != null) { + scene_.removeNodeWithEdges(nodeToMerge); + scene_.refresh(); + } + } + + } + } + + + + + + FuLog.warning("NB LISTE DES WIDGETS: " + listeTotaleWidgetToMerge_.size()); + + // --ajout de la courbe au widget de base --// + new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre calque")) { + + public void act() { + final ProgressionInterface prog = new ProgressionBuAdapter(this); + + + // -- creation de la nouvelle widget contenant les 2 calques --// + EbliNode nodeFusion = new EbliNodeDefault(); + nodeFusion.setTitle(TrResource.getS("Fusion de calques")); + + nodeFusion.setCreator(new EbliWidgetCreatorFusionCalques(widgetCalque_, listeTotaleWidgetToMerge_)); + + scene_.addNode(nodeFusion); + + } + }.start(); + ; + + + + + // --suppression du calque de base --// + scene_.removeNodeWithEdges(nodeCalque_); + + scene_.refresh(); + + // -- maj de la combo --// + remplirCombo(); + + } + + + public void actionPerformed(ActionEvent _e) { + + // -- r... [truncated message content] |
From: <had...@us...> - 2008-09-16 17:12:42
|
Revision: 3932 http://fudaa.svn.sourceforge.net/fudaa/?rev=3932&view=rev Author: hadouxad Date: 2008-09-16 17:12:47 +0000 (Tue, 16 Sep 2008) Log Message: ----------- Fusion de calques - utilise le groupage. - on peut defusionner les calques - action 'edition' sur les popup des calques pour editer celui qu on veut et mettre en premier plan - action 'edition' pr?\195?\169sente pour tous les calques. - undo/redo g?\195?\169r?\195?\169 - propertychangelistener fonctionne pas pour les maj des setMachins - couleur de fond pour les bordures ok - modifs de la fusion des courbes temporelles - duplication des courbes en parcourant les variables - ajout des group si manquants dans le graphe initial - modifs de la fusion des profils spatiaux - meme systeme repris mais cela merdouille Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.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/EbliWidgetController.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/EbliWidgetWithBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.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/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/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.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/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -51,6 +51,9 @@ private EbliScene scene_; private boolean useBorder_ = true; + + + /** * @param scene @@ -274,6 +277,9 @@ public void removePropertyChangeListener(String _key, PropertyChangeListener _l) {} + public void removePropertyChangeListenerFormWidget(EbliWidget _widget) { + } + public void setColorContour(Color newColor) { propGraphique.put(COLORCONTOUR, newColor); } 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -58,6 +58,7 @@ insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); setLayout(new OverlayLayoutGap(insets_)); + // -- ajout du child --// addChild(intern_); @@ -75,6 +76,20 @@ return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); } + // protected void paintWidget() { + // // getGraphics().setColor(getColorFond()); + // // getGraphics().fillRect(insets_.left, insets_.top, + // // getClientArea().width - insets_.left - insets_.right, + // // getClientArea().height - insets_.bottom - insets_.top); + // // getGraphics().setColor(getColorContour()); + // // + // // TraceLigne tl = new TraceLigne(getTraceLigneModel()); + // // tl.dessineRectangle(getGraphics(), 0, 0, getClientArea().width, + // getClientArea().getHeight()); +// + // + // } + /** * surcharge des methodes getProperty pour recuperer les proprietes graphiques et les dipatcher a son conteneur */ 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -408,6 +408,10 @@ canResize_ = false; } + + public WidgetAction getActionMove() { + return actionMove_; + } /** * fonction inverse de la precedente. 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -13,6 +13,8 @@ */ public class EbliWidgetControllerForGroup extends EbliWidgetController { + public boolean hasAlreadyFusion = false; + public EbliWidgetControllerForGroup(EbliWidget _widget) { super(_widget,true,true,false); } 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -41,20 +41,28 @@ Rectangle rec = getClientArea(); - // -- couleur de fond --// - // g.setColor(getColorFond()); - // g.fillRect(0, 0, rec.width, rec.height); + g.translate(rec.x, rec.y); - // la ligne - + + + TraceLigne l = new TraceLigne(getTraceLigneModel()); + getGraphics().setColor(getColorFond()); + getGraphics().fillRect(0, 0, (int) (rec.width - l.getEpaisseur()), (int) (rec.height - l.getEpaisseur())); + + l.setCouleur(getColorContour()); l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); + + + g.translate(-rec.x, -rec.y); + + // setBackground(getColorFond()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -7,10 +7,7 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; import java.util.List; -import java.util.Set; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.ressource.EbliResource; @@ -38,7 +35,7 @@ } - protected static void degroupObjects(EbliScene _scene, EbliNode _n) { + public static void degroupObjects(EbliScene _scene, EbliNode _n) { if (_n == null) { return; } // Set cs = new HashSet(); // for (final Iterator iterator = selectedObjects.iterator(); iterator.hasNext();) { @@ -50,6 +47,10 @@ Point toScene = w.convertLocalToScene(p); EbliNode n = (EbliNode) _scene.findObject(widget); widget.removeFromParent(); + + // -- utilis\xE9 pour enlever les propertychange listener + w.removePropertyChangeListenerFormWidget((EbliWidget) widget); + _n.setPreferedLocation(toScene); _n.setPreferedSize(widget.getPreferredSize()); // widget.setPreferredLocation(toScene); 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -28,11 +28,11 @@ import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; -import org.netbeans.api.visual.action.WidgetAction; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; @@ -63,6 +63,7 @@ EbliWidgetVueCalque widgetCalque_; EbliWidgetWithBordure widgetParent_; + EbliActionEditorOneClick<BuPanel> editorAction_; public EbliWidgetControllerCalque(EbliWidgetVueCalque _widget, EbliWidgetWithBordure _parent) { super(_parent); @@ -74,9 +75,10 @@ public void addActionSpecifiques() { - WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>((EbliWidgetVueCalque) widgetCalque_); + editorAction_ = new EbliActionEditorOneClick<BuPanel>((EbliWidgetVueCalque) widgetCalque_); // -- ajout de l action au widget correspondant --// - widgetCalque_.getActions().addAction(editorAction); + widgetCalque_.getActions().addAction(editorAction_); + } @@ -161,12 +163,43 @@ public void actionPerformed(ActionEvent e) { + + ajoutLegende(); } }); + menuItem = new JMenuItem(EbliResource.EBLI.getString("Editer le calque")); + _popup.add(menuItem, 0); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_editer")); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + MenuEditer(); + + + } + }); + } + + /** + * Mise au premier plan de la widget et edition. Sert beaucoup pour la fusion + */ + public void MenuEditer() { + // -- premier plan pour la visualiser dans le groupe --// + if (this.widgetCalque_.getParentWidget() != null + && this.widgetCalque_.getParentWidget() instanceof EbliWidgetBordureSingle) + this.widgetCalque_.getParentWidget().bringToFront(); + else + this.widgetCalque_.bringToFront(); + + // -- executer l action d edition --// + editorAction_.openEditor(widgetCalque_); + + } + public ZEbliCalquesPanel getCalque() { return widgetCalque_.calquePanel_; } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerFusionCalque.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -1,269 +0,0 @@ -package org.fudaa.ebli.visuallibrary.calque; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.swing.BorderFactory; -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JComponent; -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.ListSelectionModel; - -import org.fudaa.ctulu.image.CtuluLibImage; -import org.fudaa.ebli.calque.BArbreCalque; -import org.fudaa.ebli.calque.BCalquePaletteInfo; -import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; -import org.fudaa.ebli.commun.EbliActionInterface; -import org.fudaa.ebli.commun.EbliComponentFactory; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.controle.BSelecteurListComboBox; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; -import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; -import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; - -import com.memoire.bu.BuMenuBar; -import com.memoire.bu.BuToolBar; - -public class EbliWidgetControllerFusionCalque extends EbliWidgetControllerMenuOnly { - - JLabel labelTrace_; - - /** - * widget de la legende - */ - CalqueLegendeWidgetAdapter legendeWidget_; - - BuMenuBar menuCalque_; - - JPanel panelTreeCalque_; - - BuToolBar toolbarCalque_; - - JList selectionCalque_; - - BArbreCalque arbreCalque_; - - EbliWidgetFusionCalques widgetCalque_; - EbliWidgetWithBordure widgetParent_; - - - - public boolean hasAlreadyFusion = false; - - - public EbliWidgetControllerFusionCalque(EbliWidgetFusionCalques _widget, EbliWidgetWithBordure _parent) { - super(_parent); - widgetCalque_ = _widget; - widgetParent_ = _parent; - addActionSpecifiques(); - - } - - public void addActionSpecifiques() { - - // WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>( - // (EbliWidgetVueCalque) widgetCalque_.widgetCalque1_); - // // -- ajout de l action au widget correspondant --// - // widgetCalque_.getActions().addAction(editorAction); - - } - - - - -public ZEbliCalquesPanel getCalqueCourant() { - return widgetCalque_.getCalqueCourant().calquePanel_; - } - - - /** - * retourne le menuBar associee au calque - * - * @return - */ - public BuMenuBar getMenubarComponent() { - - if (menuCalque_ == null) { - - menuCalque_ = new BuMenuBar(); - - } - menuCalque_.removeAll(); - - JMenu[] specificMenus = getCalqueCourant().getSpecificMenus(EbliLib.getS("Vue 2D")); - - for (int i = 0; i < specificMenus.length; i++) { - menuCalque_.add(specificMenus[i]); - } - - - return menuCalque_; - - } - - /** - * remplit le model de la liste par des labels representants le contenu du - * widgt fusion. - * - * @return - */ -public DefaultListModel fillModelListWithCalques() { - Map params = new HashMap(); - CtuluLibImage.setCompatibleImageAsked(params); - DefaultListModel model = new DefaultListModel(); - for (int i = 0; i < widgetCalque_.listeWidgetCalque_.size(); i++) { - - JLabel label = new JLabel(); - label.setText("" + widgetCalque_.getWidgetCalque(i).calquePanel_.getCqInfos().getTitle()); - BufferedImage image = widgetCalque_.getWidgetCalque(i).calquePanel_.produceImage(70, 30, params); - Icon icone = new ImageIcon(image); - label.setIcon(icone); - model.addElement(label); - - } - - selectionCalque_.addListSelectionListener(widgetCalque_); - // model.addListDataListener(widgetCalque_); - - return model; - } - - /** - * Recupere les objets graphique tree et panel infos associe au calque. - * - * @return - */ - public JComponent getOverviewComponent() { - - // -- jlist qui propose la liste des composants du calque --// - if (selectionCalque_ == null) { - selectionCalque_ = new JList(); - selectionCalque_.setCellRenderer(new GrapheCellRenderer()); - selectionCalque_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des calques"))); - selectionCalque_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - selectionCalque_.setSize(250, 100); - selectionCalque_.setPreferredSize(new Dimension(250, 100)); - selectionCalque_.setMaximumSize(new Dimension(250, 100)); - - - } - // -- creation du model de la jlist --// - DefaultListModel model = fillModelListWithCalques(); - selectionCalque_.setModel(model); - // selectionCalque_.setSelectedIndex(widgetCalque_.getIndexCalqueCourant()); - - - - if (panelTreeCalque_ == null) { - panelTreeCalque_ = new JPanel(new BorderLayout()); - - - BCalquePaletteInfo info = new BCalquePaletteInfo(getCalqueCourant().getArbreCalqueModel()); - info.setAvailable(true); - panelTreeCalque_.add(info, BorderLayout.NORTH); - JPanel panelConteneur = new JPanel(new BorderLayout()); - - arbreCalque_ = new BArbreCalque(); - arbreCalque_.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Arbre du calque"))); - panelConteneur.add(arbreCalque_, BorderLayout.CENTER); - panelConteneur.add(new JScrollPane(selectionCalque_), BorderLayout.NORTH); - - panelTreeCalque_.add(new JScrollPane(panelConteneur), BorderLayout.CENTER); - - } - // -- mise a jour du model de l arbre --// - arbreCalque_.setModel(getCalqueCourant().getArbreCalqueModel()); - - - return panelTreeCalque_; - } - - /** - * Obtient la toolbar specifique au calque - * - * @return - */ - public BuToolBar getToolbarComponent() { - - if (toolbarCalque_ == null) { - toolbarCalque_ = new BuToolBar(); - } - toolbarCalque_.removeAll(); - - // ajout des tool specifiques du calque - List actions = getCalqueCourant().getController().getActions(); - for (Iterator iterator = actions.iterator(); iterator.hasNext();) { - EbliActionInterface object = (EbliActionInterface) iterator.next(); - if (object == null) { - toolbarCalque_.addSeparator(); - } else { - toolbarCalque_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); - } - } - - // -- ajout des comboBox des variables --// - BSelecteurListComboBox combo = new BSelecteurListComboBox(); - // pour mettre \xE0 jour la combo d\xE8s que la s\xE9lection de l'arbre change - getCalqueCourant().getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(combo); - combo.setPalettePanelTarget(getCalqueCourant().getArbreCalqueModel().getSelectedCalque()); - // combo.setPalettePanelTarget(listselector.getTarget()); - combo.setMinimumSize(combo.getPreferredSize()); - combo.setMaximumSize(combo.getPreferredSize()); - - // ajout combobox - toolbarCalque_.add(combo); - - // -- ajout des combo des pas de temps --// - EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(getCalqueCourant().getArbreCalqueModel() - .getTreeSelectionModel(), true); - // pour activer l'action - chooserT.setSelected(true); - combo = (BSelecteurListComboBox) chooserT.buildContentPane(); - chooserT.updateBeforeShow(); - combo.setMaximumSize(combo.getPreferredSize()); - combo.setMinimumSize(combo.getPreferredSize()); - - // ajout combobox - toolbarCalque_.add(combo); - - - return toolbarCalque_; - } - - /** - * affiche le label des coordonnees - */ - public JComponent geTtracableComponent() { - - - return getCalqueCourant().getLabelSuiviSouris(); - } - - - - @Override - protected void buildPopupMenu(JPopupMenu _menu) { - // constructPopupMenuSpecifique(_menu); - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(_menu); - } - - - - - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorFusionCalques.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -1,73 +0,0 @@ -package org.fudaa.ebli.visuallibrary.calque; - -import java.awt.Dimension; -import java.util.ArrayList; -import java.util.Iterator; - -import org.fudaa.ebli.geometrie.GrBoite; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; -import org.fudaa.ebli.visuallibrary.EbliWidgetCreator; -import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; - -public class EbliWidgetCreatorFusionCalques implements EbliWidgetCreator { - - ArrayList<EbliWidgetVueCalque> listeWidgetCalque_; - - GrBoite initZoom_; - - EbliWidgetWithBordure res; - - - - public EbliWidgetCreatorFusionCalques(EbliWidgetVueCalque widgetCalque1_, - ArrayList<EbliWidgetVueCalque> listWidgetToMerge) { - this(widgetCalque1_, listWidgetToMerge, null); - } - - public EbliWidgetCreatorFusionCalques(EbliWidgetVueCalque widgetCalque1_, - ArrayList<EbliWidgetVueCalque> listWidgetToMerge, - GrBoite _initZoom) { - super(); - listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); - - listeWidgetCalque_.add(widgetCalque1_); - - for (Iterator<EbliWidgetVueCalque> it = listWidgetToMerge.iterator(); it.hasNext();) - listeWidgetCalque_.add(it.next()); - - initZoom_ = _initZoom; - // legendeDuplic_= - } - - - public EbliWidget create(EbliScene _scene) { - EbliWidgetFusionCalques widgetCalque = new EbliWidgetFusionCalques(_scene, listeWidgetCalque_, - initZoom_); - res = new EbliWidgetBordureSingle(widgetCalque); - res.setPreferredSize(new Dimension(400, 400)); - widgetCalque.setController(new EbliWidgetControllerFusionCalque(widgetCalque, res)); - return res; - } - - - - public EbliWidgetWithBordure getBordure() { - return res; - } - - - - public EbliWidget getWidget() { - return res; - } - - public EbliNode duplicate(EbliNode _nodeAdupliquer) { - return null; - } - - - -} 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -1,133 +1,94 @@ package org.fudaa.ebli.visuallibrary.calque; -import java.awt.Dimension; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Iterator; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.netbeans.modules.visual.layout.OverlayLayout; +import com.memoire.fu.FuLog; + /** - * Widget qui resulte de la fusion de 2 calques. + * Widget qui resulte de la fusion de calques * * @author Adrien Hadoux * */ -public class EbliWidgetFusionCalques extends EbliWidget implements ListSelectionListener { +public final class EbliWidgetFusionCalques extends EbliWidget implements PropertyChangeListener { - ArrayList<EbliWidgetVueCalque> listeWidgetCalque_; - - /** - * Calque courant qui sera modifi\xE9 a chaque fois que l utilisateur changera de - * calque de premier plan. - */ - EbliWidgetVueCalque calqueCourant_; + public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); - OverlayLayout layout_; - GrBoite initZoom_; - - - public EbliWidgetFusionCalques(EbliScene _scene, ArrayList<EbliWidgetVueCalque> _liste, GrBoite zoom) { + public EbliWidgetFusionCalques(EbliScene _scene) { super(_scene); + //calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener( + // "versReel", listener); - initZoom_ = zoom; - listeWidgetCalque_=_liste; - // --creation du layout de mise en page --// - layout_ = new OverlayLayout(); - this.setLayout(layout_); - - // -- ajout des widgets --// - for (Iterator<EbliWidgetVueCalque> it = listeWidgetCalque_.iterator(); it.hasNext();) { - EbliWidgetVueCalque calque = it.next(); - this.addChild(calque); - // -- mise a jour du zoom - calque.initZoom_ = initZoom_; - - // init le calque courant - if (calqueCourant_ == null) - calqueCourant_ = calque; - } - setPreferredSize(new Dimension(500, 400)); - } - /** - * Methode utilisee pour mettre au premier plan la widget selectionnee. - * - * @param newCrt - * : nouvelle widget calque a positionner au premier plan - */ - public void changeWidgetCourant(EbliWidgetVueCalque newCrt) { - calqueCourant_ = newCrt; + public void addChildCalque(EbliWidget child) { + + addChild(child); - // -- mise au premier plan de newCrt --// - bringToFront(calqueCourant_); + EbliWidgetVueCalque widgetCalque; + if (child instanceof EbliWidgetVueCalque) + widgetCalque = (EbliWidgetVueCalque) child; + else + widgetCalque = (EbliWidgetVueCalque) child.getChildren().get(0); + listeWidgetCalque_.add(widgetCalque); + // -- ajout du listener des calques sur this --// + widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener("versEcran", this); + widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener("versReel", this); } + + boolean noCyclePropertieChange = true; - - public void bringToFront(EbliWidgetVueCalque widget) { + public void propertyChange(PropertyChangeEvent _evt) { - this.removeChild(widget); + if (!noCyclePropertieChange) + return; + noCyclePropertieChange = false; + // listeWidgetCalque_.get(0).calquePanel_.getVueCalque().changeViewBoite( + // _source, _boite, _rapide) + FuLog.warning("je rentre dans propertychange !!!"); + GrMorphisme morph = (GrMorphisme) _evt.getNewValue(); - // -- ajout pour qu elle soit en premier plan --// - this.addChild(widget); - - // -- refrresh de la scene --// + for (Iterator<EbliWidgetVueCalque> it = listeWidgetCalque_.iterator(); it.hasNext();) { + EbliWidgetVueCalque widget = it.next(); + if (_evt.getPropertyName().equals("versEcran")) { + ((BCalque) widget.calquePanel_.getVueCalque().getAbstractCalque()).setVersEcran(morph); + + } else { + ((BCalque) widget.calquePanel_.getVueCalque().getAbstractCalque()).setVersReel(morph); + } + + } + noCyclePropertieChange = true; getEbliScene().refresh(); } - public EbliWidgetVueCalque getCalqueCourant() { - return calqueCourant_; - } - - - public ZEbliCalquesPanel getCalque(int i) { + /** + * Surcharge de la methode de ebli, utilisse pour virer les property change + * listener + */ + public void removePropertyChangeListenerFormWidget(EbliWidget child) { + EbliWidgetVueCalque widgetCalque; + if (child instanceof EbliWidgetVueCalque) + widgetCalque = (EbliWidgetVueCalque) child; + else + widgetCalque = (EbliWidgetVueCalque) child.getChildren().get(0); + widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("versEcran", this); + widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("versReel", this); + + - return getWidgetCalque(i).calquePanel_; } - public int getNbWidgets() { - return listeWidgetCalque_.size(); - } - - public EbliWidgetVueCalque getWidgetCalque(int i) { - return listeWidgetCalque_.get(i); - } - - - public int getIndexCalqueCourant() { - - for (int i = 0; i < listeWidgetCalque_.size(); i++) - if (listeWidgetCalque_.get(i) == calqueCourant_) - return i; - - return -1; - } - - public void valueChanged(ListSelectionEvent _e) { - - // -- on est dans un cas single selection mode --// - int selected = _e.getFirstIndex(); - - // -- on change de calque courant --// - if (selected < listeWidgetCalque_.size()) - changeWidgetCourant(getWidgetCalque(selected)); - - } - - - - - - } 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -47,6 +47,8 @@ // GrBoite zoom_; public EbliWidgetVueCalque(EbliScene _scene, ZEbliCalquesPanel _vue) { this(_scene, _vue, null); + + } @@ -66,10 +68,9 @@ setPreferredSize(new Dimension(500, 400)); initSize(new Rectangle(0, 0, 500, 400)); - // _vue.addCqLegende(new BCalqueLegende()); - - // --ajout du controller specifique au graphe --// - + + + } public BuPanel createEditorComponent( 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -18,16 +18,18 @@ import javax.swing.tree.TreePath; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.LineString; - -import com.memoire.bu.BuLib; -import com.memoire.bu.BuResource; - -import org.fudaa.ctulu.*; +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluRunnable; +import org.fudaa.ctulu.CtuluTaskDelegate; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.CtuluVariable; +import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.ef.operation.EfLineIntersection; import org.fudaa.dodico.ef.operation.EfLineIntersectionsCorrectionTester; @@ -35,7 +37,6 @@ import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGCourbeChild; @@ -43,11 +44,15 @@ import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGObject; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuResource; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.LineString; + /** * @author fred deniger * @version $Id: MvProfileTreeModel.java,v 1.12 2007-06-13 14:46:13 deniger Exp @@ -60,7 +65,7 @@ EfLineIntersectionsResultsBuilder builderMesh_; EfLineIntersectionsResultsMng resMesh_; final EfLineIntersectionsCorrectionTester tester_; - final MvProfileTarget target_; + public final MvProfileTarget target_; public MvProfileTreeModel(final MvProfileTarget _target, final EfLineIntersectionsCorrectionTester _tester) { super(); @@ -154,7 +159,15 @@ return GISGeometryFactory.INSTANCE.createLineString(cs); } - protected MvProfileCourbeGroup getGroup(final CtuluVariable _v, final boolean _create) { + /** + * Recherche le bon groupe pour les profils spatiaux. peut creer le groupe si + * booleen est a true. + * + * @param _v + * @param _create + * @return + */ + public MvProfileCourbeGroup getGroup(final CtuluVariable _v, final boolean _create) { for (int i = getNbEGObject() - 1; i >= 0; i--) { final EGGroup g = getGroup(i); if ((g instanceof MvProfileCourbeGroup) && ((MvProfileCourbeGroup) g).getVar() == _v) { return (MvProfileCourbeGroup) g; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -1,12 +1,19 @@ package org.fudaa.fudaa.tr.post; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.FlowLayout; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -22,30 +29,34 @@ import javax.swing.JPanel; import javax.swing.ListSelectionModel; +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.ProgressionBuAdapter; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.ZEbliCalquesPanel; +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.EbliWidgetBordureSingle; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetControllerForGroup; +import org.fudaa.ebli.visuallibrary.EbliWidgetGroupCreator; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetUngroupAction; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerFusionCalque; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorFusionCalques; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; +import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; import org.fudaa.fudaa.tr.common.TrResource; +import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuDialog; -import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuScrollPane; -import com.memoire.fu.FuLog; /** * Action qui realise la fusion des calques @@ -100,28 +111,8 @@ - /** - * Constructeur pour le cas d une widget fusion - */ - public TrPostActionFusionCalques(EbliWidgetFusionCalques widgetFusion, EbliNode nodeGraphe, TrPostProjet projet) { - super(widgetFusion.getEbliScene(), TrResource.getS("Fusion avec un autre calque"), CtuluResource.CTULU - .getIcon("cible"), - "ADDPOINTWIDGET"); + - for (int i = 1; i < widgetFusion.getNbWidgets(); i++) - listeTotaleWidgetToMerge_.add(widgetFusion.getWidgetCalque(i)); - - widgetCalque_ = widgetFusion.getWidgetCalque(0); - nodeCalque_ = nodeGraphe; - projet_ = projet; - - // -- ajout de la combo dans la toolbar de la widget --// - if (!((EbliWidgetControllerFusionCalque) widgetFusion.getController()).hasAlreadyFusion) { - widgetFusion.getController().getPopup().add(this); - ((EbliWidgetControllerFusionCalque) widgetFusion.getController()).hasAlreadyFusion = true; - } - } - /** * remplissage de la combo avec les graphes disponibles et compatibles * @@ -155,21 +146,7 @@ } - } else if (currentNode != nodeCalque_ && currentNode.getCreator() instanceof EbliWidgetCreatorFusionCalques) { - - // -- on ajoute le node potentiel qui renferme une widget fusion --// - EbliWidgetCreatorFusionCalques new_name = (EbliWidgetCreatorFusionCalques) currentNode.getCreator(); - - if (isCompatibleWithCalque(new_name)) { - - JLabel label = new JLabel(); - label.setText(TrResource.TR.getString("Fusionner avec la Fusion ") + currentNode.getTitle()); - listeObjetsCalques.add(label); - listeCalquesPossibles.add(currentNode); - } - - - } + } } @@ -205,9 +182,7 @@ return true; } - public boolean isCompatibleWithCalque(EbliWidgetCreatorFusionCalques widgetFusion) { - return true; - } + @@ -249,116 +224,142 @@ return; } + final ArrayList<EbliNode> listeToMerge = new ArrayList<EbliNode>(); + //-- parcours de la liste des indices selectionnes --// for(int i=0;i<selected.length;i++){ EbliNode nodeToMerge = listeCalquesPossibles.get(selected[i]); - // --recuperation de son graphe --// + // --Ajout du noeud --// + listeToMerge.add(nodeToMerge); - //cas bordure - if (nodeToMerge.getWidget() instanceof EbliWidgetBordureSingle){ - if(((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern() instanceof EbliWidgetVueCalque){ - EbliWidgetVueCalque calqueWidget = (EbliWidgetVueCalque) ((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern(); - // -- ajout de la widget cible a la liste a merger --// - listeTotaleWidgetToMerge_.add(calqueWidget); - - // -- suppression du noeud de la scene--// - if (nodeToMerge != null) - scene_.removeNodeWithEdges(nodeToMerge); - } - else - //-- cas le noeud selectionne contient des fusionWidget - if(((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern() instanceof EbliWidgetFusionCalques){ - - EbliWidgetFusionCalques calqueWidget = (EbliWidgetFusionCalques) ((EbliWidgetBordureSingle) nodeToMerge.getWidget()).getIntern(); - // -- ajout de toutes les widgets de la FusionWidget --// - for(int k=0;k< calqueWidget.getNbWidgets();k++) - listeTotaleWidgetToMerge_.add(calqueWidget.getWidgetCalque(k)); - - // -- suppression du noeud de la scene--// - if (nodeToMerge != null) - scene_.removeNodeWithEdges(nodeToMerge); - } - - - - } - else{ - if( nodeToMerge.getWidget() instanceof EbliWidgetVueCalque){ - EbliWidgetVueCalque calqueWidget = (EbliWidgetVueCalque) nodeToMerge.getWidget(); - // -- ajout de la widget cible a la liste a merger --// - listeTotaleWidgetToMerge_.add(calqueWidget); - - // -- suppression du noeud de la scene--// - if (nodeToMerge != null) - scene_.removeNodeWithEdges(nodeToMerge); - } - else - //-- cas le noeud selectionne contient des fusionWidget - if( nodeToMerge.getWidget()instanceof EbliWidgetFusionCalques){ - - EbliWidgetFusionCalques calqueWidget = (EbliWidgetFusionCalques) nodeToMerge.getWidget(); - // -- ajout de toutes les widgets de la FusionWidget --// - for(int k=0;k< calqueWidget.getNbWidgets();k++) - listeTotaleWidgetToMerge_.add(calqueWidget.getWidgetCalque(k)); - - // -- suppression du noeud de la scene--// - if (nodeToMerge != null) { - scene_.removeNodeWithEdges(nodeToMerge); - scene_.refresh(); - } - } - - } - } - + } + // -- ajout du node initial --// + listeToMerge.add(nodeCalque_); - - FuLog.warning("NB LISTE DES WIDGETS: " + listeTotaleWidgetToMerge_.size()); - // --ajout de la courbe au widget de base --// new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre calque")) { public void act() { final ProgressionInterface prog = new ProgressionBuAdapter(this); + final EbliNode fusion = groupWidgetsFusion(listeToMerge); + + + // -- undo/redo --// + getScene().getCmdMng().addCmd(new CtuluCommand() { - - // -- creation de la nouvelle widget contenant les 2 calques --// - EbliNode nodeFusion = new EbliNodeDefault(); - nodeFusion.setTitle(TrResource.getS("Fusion de calques")); - - nodeFusion.setCreator(new EbliWidgetCreatorFusionCalques(widgetCalque_, listeTotaleWidgetToMerge_)); - - scene_.addNode(nodeFusion); + public void undo() { + EbliWidgetUngroupAction.degroupObjects(getScene(), fusion); + } + + public void redo() { + groupWidgetsFusion(listeToMerge); + } + }); + + } }.start(); ; + // -- maj de la combo --// + // remplirCombo(); + + + + } + + + private EbliNode groupWidgetsFusion(final ArrayList<EbliNode> _selectedObjects) { + EbliWidgetFusionCalques parent = new EbliWidgetFusionCalques(scene_); + // -- il faut des gaps suffisants pour deplacer la widget et avoir le menu + // du groupe --// + Insets insetLayout = new Insets(30, 30, 30, 30); + // parent.setLayout(new OverlayLayout()); + parent.setLayout(new OverlayLayoutGap(insetLayout)); - // --suppression du calque de base --// - scene_.removeNodeWithEdges(nodeCalque_); + Point min = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); + Point max = new Point(-Integer.MAX_VALUE, -Integer.MAX_VALUE); + Rectangle sizeMax = new Rectangle(0, 0); + for (Object object : _selectedObjects) { + Widget findWidget = scene_.findWidget(object); + // Rectangle rec = findWidget.getBounds(); + 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); + + if (sizeMax.height < rec.height) + sizeMax.height = rec.height; + if (sizeMax.width < rec.width) + sizeMax.width = rec.width; + + } + int w = max.x - min.x; + int h = max.y - min.y; + Insets b = parent.getBorder().getInsets(); - scene_.refresh(); - // -- maj de la combo --// - remplirCombo(); + sizeMax.width += 2 * insetLayout.left; + sizeMax.height += 2 * insetLayout.bottom; + parent.setPreferredBounds(sizeMax); + parent.setPreferredSize(new Dimension(sizeMax.width, sizeMax.height)); + + + for (Object object : _selectedObjects) { + Widget findWidget = scene_.findWidget(object); + Rectangle widgetBounds = findWidget.getBounds(); + Rectangle rec = findWidget.convertLocalToScene(widgetBounds); + EbliWidget ew = (EbliWidget) findWidget; + ew.getController().removeActionResizeAndMove(); + + + + findWidget.removeFromParent(); + int dx = rec.x - min.x; + int dy = rec.y - min.y; + + Point pt = new Point(dx - widgetBounds.x, dy - widgetBounds.y); + findWidget.setPreferredLocation(pt); + parent.addChildCalque(ew); + float rMinX = ((float) dx) / w; + float rMinY = ((float) dy) / h; + float rMaxX = ((float) (w - widgetBounds.width - dx)) / w; + float rMaxY = ((float) (h - widgetBounds.height - dy)) / h; + parent.setChildConstraint(findWidget, new Rectangle2D.Float(rMinX, rMinY, rMaxX, rMaxY)); + + } + EbliWidgetGroupCreator creator = new EbliWidgetGroupCreator(); + + parent.setGroup(true); + creator.setW(parent); + + EbliNodeDefault node = new EbliNodeDefault(); + node.setPreferedLocation(min); + node.setTitle(EbliLib.getS("Fusion calquess")); + node.setCreator(creator); + parent.setController(new EbliWidgetControllerForGroup(parent)); + scene_.addNode(node); + scene_.setSelectedObjects(new HashSet(Arrays.asList(node))); + return node; } - + int cpt = 1; public void actionPerformed(ActionEvent _e) { // -- remplisage combo --// remplirCombo(); - - dialog_ = new BuDialogConfirmation(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource - .getS("Fusion avec un autre graphe")); + + dialog_ = new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource + .getS("Fusion avec un autre graphe " + (cpt++))); if (content_ == null) content_ = constructPanel(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -27,7 +27,11 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheDuplicator; +import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; @@ -36,6 +40,9 @@ import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; +import org.fudaa.fudaa.meshviewer.profile.MVProfileCourbeModel; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCourbe; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCourbeGroup; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.common.TrResource; @@ -215,16 +222,30 @@ public void act() { final ProgressionInterface prog = new ProgressionBuAdapter(this); - - //-- cas points reels --// - if (grapheToMerge.getObjIdx() != null && grapheToMerge.getObjIdx().length != 0) - grapheModel.addPoints(grapheToMerge.getObjIdx(), scene_.getCmdMng(), prog, grapheToMerge.getVarSupported()); - //-- cas interpol\xE9 --// - else if(grapheToMerge.getIntepolPt()!=null) - for (Iterator it = grapheToMerge.getIntepolPt().iterator(); it.hasNext();) - grapheModel.addPoints((TrPostInterpolatePoint) it.next(), scene_.getCmdMng(), prog, grapheToMerge - .getVarSupported()); + + + //-- parcours de la liste des variables du graphe a fusionner --// + for (Iterator<Object>it= grapheToMerge.getVarSupported().iterator();it.hasNext();) { + final H2dVariableType var = (H2dVariableType) it.next(); + + //-- on recherche le group associe a la variale dans l autre graphe sinon on le cree --// + EGGroup group = grapheModel.getGroupFor(var); + + //-- on recupere toutes les courbes associees a la var pour le graphe merges + final EGGroup g = grapheToMerge.getGroupFor(var); + for (int i = g.getChildCount() - 1; i >= 0; i--) { + if (g.getCourbeAt(i).getModel() instanceof TrPostCourbeModel) { + if (((TrPostCourbeModel) g.getCourbeAt(i).getModel()).getVar() == var) { + + // -- duplication de la courbe dans le groupe --// + group.addEGComponent((EGCourbeChild) g.getCourbeAt(i).duplicate(group, new EGGrapheDuplicator())); + } + } + + } + } + } }.start(); ; @@ -240,9 +261,45 @@ public void act() { final ProgressionInterface prog = new ProgressionBuAdapter(this); - grapheModel.addNewCourbe(scene_.getCmdMng(), widgetGraphe_.getPanelGraphe(), grapheObject, - projet_.impl_); + // grapheModel.addNewCourbe(scene_.getCmdMng(), + // widgetGraphe_.getPanelGraphe(), grapheObject, projet_.impl_); + + + //-- parcours de la liste des variables du graphe a fusionner --// + for (int i=0;i<grapheToMerge.target_.getVars().length;i++) { + final H2dVariableType var = (H2dVariableType) grapheToMerge.target_.getVars()[i]; + + // -- on recupere toutes les courbes associees a la var pour le + // graphe merges + final MvProfileCourbeGroup g = grapheToMerge.getGroup(var, false); + if (g != null) { + //-- on recherche le group associe a la variale dans l autre graphe sinon on le cree --// + MvProfileCourbeGroup group = grapheModel.getGroup(var, true); + + + for (int k = g.getChildCount() - 1; k >= 0; k--) { + if (g.getCourbeAt(k).getModel() instanceof MVProfileCourbeModel) { + if (((MVProfileCourbeModel) g.getCourbeAt(k).getModel()).getVariable() == var) { + + + // -- duplication de la courbe dans le groupe --// + MvProfileCourbe newChild = new MvProfileCourbe(group, (MVProfileCourbeModel) g.getCourbeAt(k) + .getModel().duplicate()); + + // group.addEGComponent((EGCourbeChild) + // g.getCourbeAt(k).duplicate(group, new + // EGGrapheDuplicator())); + + group.addEGComponent(newChild); + } + } + + } + } + + } + } }.start(); 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -413,6 +413,14 @@ } } + /** + * Determine les courbes qui correspondent a la variable et les stocke dans la + * liste _l. + * + * @param _var + * @param _l + * contient toutes les courbes qui appartiennent a la variable + */ void getCourbeFor(final H2dVariableType _var, final List _l) { final EGGroup g = getGroupFor(_var); for (int i = g.getChildCount() - 1; i >= 0; i--) { @@ -567,6 +575,13 @@ return true; } + /** + * Recherche ou cree un groupe correspondant a la variable pour eviter les + * doublons. + * + * @param _t + * @return + */ public EGGroup getGroupFor(final H2dVariableType _t) { if (_t == null) { return null; 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 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -31,7 +31,6 @@ import org.fudaa.ebli.visuallibrary.actions.CommandUndoRedoPaste; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorFusionCalques; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; @@ -460,16 +459,6 @@ // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarSpecifiqueGraphe(node.getWidget().getController(), (EbliWidgetCreatorGraphe) node.getCreator()); - } else if (node.getCreator() instanceof EbliWidgetCreatorFusionCalques) { - - FuLog.warning("change tree Fusion de calques"); - // -- etape 1: ajout du tree dans fudaaImplementation --// - changeTree(node.getWidget().getController()); - - // -- etape 2: rechargement de la toolbar specifique dans this --// - changeToolbar(node.getWidget().getController()); - - } else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTreeScene(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -3,7 +3,6 @@ import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; import org.netbeans.api.visual.widget.Widget; @@ -53,10 +52,10 @@ new TrPostActionFusionCalques((EbliWidgetVueCalque) ((EbliWidgetBordureSingle) node.getWidget()).getIntern(), node, projet); - else if (((EbliWidgetBordureSingle) node.getWidget()).getIntern() instanceof EbliWidgetFusionCalques) - new TrPostActionFusionCalques((EbliWidgetFusionCalques) ((EbliWidgetBordureSingle) node.getWidget()) - .getIntern(), - node, projet); +// else if (((EbliWidgetBordureSingle) node.getWidget()).getIntern() instanceof EbliWidgetFusionCalques) +// new TrPostActionFusionCalques((EbliWidgetFusionCalques) ((EbliWidgetBordureSingle) node.getWidget()) +// .getIntern(), +// node, projet); } else { @@ -67,8 +66,8 @@ } else if (node.getWidget() instanceof EbliWidgetVueCalque) { new TrPostActionFusionCalques((EbliWidgetVueCalque) node.getWidget(), node, projet); - } else if (node.getWidget() instanceof EbliWidgetFusionCalques) { - new TrPostActionFusionCalques((EbliWidgetFusionCalques) node.getWidget(), node, projet); +// } else if (node.getWidget() instanceof EbliWidgetFusionCalques) { +// new TrPostActionFusionCalques((EbliWidgetFusionCalques) node.getWidget(), node, projet); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -434,7 +434,7 @@ content.add(actionChoixGraphes_.getInterfacePartielle(false, false, false), BorderLayout.CENTER); JPanel bouttonCenter = new JPanel(new FlowLayout(FlowLayout.CENTER)); bouttonCenter.add(creationNewGraphe_); - content.add(bouttonCenter, BorderLayout.SOUTH); + content.add(bouttonCenter, BorderLayout.NORTH); if (actionChoixGraphes_.listeGraphesPossibles.size() == 0 && actionChoixGraphes_.listeGraphesChoisis.size() == 0) { creationNewGraphe_.setSelected(true); creationNewGraphe_.setEnabled(false); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java 2008-09-16 15:35:12 UTC (rev 3931) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java 2008-09-16 17:12:47 UTC (rev 3932) @@ -185,10 +185,16 @@ content.add(actionChoixGraphes_.getInterfacePartielle(false, false, false), BorderLayout.CENTER); JPanel bouttonCenter = new JPanel(new FlowLayout(FlowLayout.CENTER)); bouttonCenter.add(creationNewGraphe_); - content.add(bouttonCenter, BorderLayout.SOUTH); + content.add(bouttonCenter, BorderLayout.NORTH); content.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape 3: S\xE9lection et cr\xE9ation des graphes"))); + if (actionChoixGraphes_.listeGraphesPossibles.size() == 0 && actionChoixGraphes_.listeGraphesChoisis.size() == 0) { + creationNewGraphe_.setSelected(true); + creationNewGraphe_.setEnabled(false); + actionChoixGraphes_.setEnabled(false); + } + return content; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-17 17:08:55
|
Revision: 3948 http://fudaa.svn.sourceforge.net/fudaa/?rev=3948&view=rev Author: hadouxad Date: 2008-09-17 17:09:01 +0000 (Wed, 17 Sep 2008) Log Message: ----------- - Creation action couleur de fond pour la scene - possibilite poru toutes les widget de changer leur couleur de fond - refactorisation des configurations - refonte du wizard des graphes temporel fonctionne nickel creation et integration dans graphe deja existant - refonte fusion graphes temporel marche nickel: recopie jsute du contenu - modifs du wizard des courbes spatiales marche ok pour la creation et l integration - modif fusion courbes spatiales marche ok Modified Paths: -------------- 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/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.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/EbliWidgetActionColorBackground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.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/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.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/common/tr_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.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/TrPostCourbeTreeModel.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/TrPostWizardCourbeTemporelle.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -137,6 +137,7 @@ // -- creation de son controlleur --// controller_ = new EbliSceneController(this); + } public Dimension getDefaultImageDimension() { 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -425,5 +425,27 @@ public void setUseBorder(boolean _useBorder) { useBorder_ = _useBorder; } + + + public boolean canRotate() { + return true; + } + public boolean canColorForeground() { + return true; + } + + public boolean canColorBackground() { + return true; + } + + public boolean canTraceLigneModel() { + return true; + } + + public boolean canFont() { + return true; + } + + } \ No newline at end of file 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -107,13 +107,14 @@ // if (_key.equals(FONT)) { return intern_.propGraphique.get(_key); - } else if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } + } else + // if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } return super.getProperty(_key); } @Override protected void setPropertyCmd(String _key, Object _prop, CtuluCommandContainer _cmd) { - if (_key.equals(LINEMODEL) || _key.equals(COLORCONTOUR)) { + if (_key.equals(LINEMODEL) || _key.equals(COLORCONTOUR) || _key.equals(COLORFOND)) { super.setPropertyCmd(_key, _prop, _cmd); } else { intern_.setPropertyCmd(_key, _prop, _cmd); @@ -158,5 +159,26 @@ public void setIntern(EbliWidget _intern) { intern_ = _intern; } + + public boolean canRotate() { + return intern_.canRotate(); + } + public boolean canColorForeground() { + return true; + } + + public boolean canColorBackground() { + return true; + } + + public boolean canTraceLigneModel() { + return true; + } + + public boolean canFont() { + return intern_.canFont(); + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -36,4 +36,24 @@ return true; } + public boolean canRotate() { + return false; + } + + public boolean canColorForeground() { + return false; + } + + public boolean canColorBackground() { + return false; + } + + public boolean canTraceLigneModel() { + return false; + } + + public boolean canFont() { + return false; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -144,23 +144,24 @@ -// public void setColorContour(Color newColor){ - // couleurContour=newColor; - // getTraceLigneModel().setCouleur(newColor); - // repaint(); - // } - // - // public Color getColorContour(){ - // return couleurContour; - // } - // - // public void setColorFond(Color newColor){ - // couleurFond=newColor; - // repaint(); - // } - // - // public Color getColorFond(){ - // return couleurFond; - // } + public boolean canRotate() { + return true; + } + + public boolean canColorForeground() { + return true; + } + + public boolean canColorBackground() { + return true; + } + + public boolean canTraceLigneModel() { + return true; + } + + public boolean canFont() { + return false; + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -118,7 +118,25 @@ } + public boolean canRotate() { + return false; + } + public boolean canColorForeground() { + return true; + } + + public boolean canColorBackground() { + return true; + } + + public boolean canTraceLigneModel() { + return false; + } + + public boolean canFont() { + return true; + } 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -70,7 +70,8 @@ super.setPropertyCmd(_key, _prop, _cmd); if (LINEMODEL.equals(_prop)) { updateTraceLigne(); - } + } else if (COLORFOND.equals(_prop)) + repaint(); } protected void updateTraceLigne() { 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -1,6 +1,7 @@ package org.fudaa.ebli.visuallibrary.actions; import java.awt.Color; +import java.awt.Paint; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; @@ -8,7 +9,9 @@ import java.util.Map; import java.util.Set; -import org.fudaa.ctulu.CtuluCommandContainer; +import javax.swing.Action; + +import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -21,25 +24,20 @@ * * @author Adrien Hadoux */ -public class EbliWidgetActionColorBackground extends EbliWidgetActionSimple { +public abstract class EbliWidgetActionColorBackground extends EbliWidgetActionSimple { - CtuluCommandContainer cmd_; + + + public static class ForWidget extends EbliWidgetActionColorBackground { - public EbliWidgetActionColorBackground(EbliScene _scene) { - super(_scene, EbliResource.EBLI.getString("Couleur de fond"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); + public ForWidget(EbliScene _scene) { + super(_scene); + + } - cmd_ = _scene.getCmdMng(); + public CtuluCommand changeCouleur(Color color) { + // on met a jour les couleurs pour toutes les widgets selectionnees --// - } - - public void actionPerformed(ActionEvent e) { - - // -- choix de la couleur par l utilisateur --// - Color couleur = BuColorChooser.showDialog(null, EbliResource.EBLI.getString("Couleur de fond"), Color.black); - if (couleur != null) { - - // on met a joru les couleurs pour toutes les widgets selectionnees --// - // -- recupere les anciennes graphical properties --// List<Map<String, Object>> oldGraphicalProperties = new ArrayList<Map<String, Object>>(); @@ -48,7 +46,7 @@ // -- nouvelle couleur --// - Color newColor = couleur; + Color newColor = color; // -- liste des widget selectionnees --// java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); @@ -81,17 +79,72 @@ } } - // -- rafraichissement de la scene --// - scene_.refresh(); - if (cmd_ != null) { - cmd_ - .addCmd(new CommandeUndoRedoGraphicalProperties(newGraphicalProperties, oldGraphicalProperties, listeWidget)); + return new CommandeUndoRedoGraphicalProperties( + newGraphicalProperties, oldGraphicalProperties, listeWidget); + + } + + } + + public static class ForScene extends EbliWidgetActionColorBackground { - } + public ForScene(EbliScene _scene) { + super(_scene); + putValue(Action.NAME, "Couleur de fond Layout"); + + } + + public CtuluCommand changeCouleur(Color color) { + final Paint oldColor = scene_.getBackground(); + + final Paint newColor = color; + + scene_.setBackground(newColor); + + return new CtuluCommand() { + + public void redo() { + scene_.setBackground(newColor); + scene_.refresh(); + } + + public void undo() { + scene_.setBackground(oldColor); + scene_.refresh(); + } + + }; + } + } + + + + public EbliWidgetActionColorBackground(EbliScene _scene) { + super(_scene, EbliResource.EBLI.getString("Couleur de fond"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); + cmd_ = _scene.getCmdMng(); + + } + + public abstract CtuluCommand changeCouleur(Color color); + + public void actionPerformed(ActionEvent e) { + + // -- choix de la couleur par l utilisateur --// + Color couleur = BuColorChooser.showDialog(null, EbliResource.EBLI.getString("Couleur de fond"), Color.black); + if (couleur != null) { + if (cmd_ != null) + cmd_.addCmd(changeCouleur(couleur)); + + scene_.refresh(); + + } + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -19,15 +19,6 @@ import org.fudaa.ebli.controle.BSelecteurSlider; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; -import org.fudaa.ebli.visuallibrary.EbliWidgetImage; -import org.fudaa.ebli.visuallibrary.EbliWidgetShape; -import org.fudaa.ebli.visuallibrary.EbliWidgetTextLabel; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; /** * classe qui permet de creer les selecteurs necessaires pour la configuration. @@ -149,67 +140,11 @@ public static BConfigurableComposite configurePalette(EbliWidget found) { BConfigurableComposite palette = null; - boolean lineModel_ = true; - boolean colorsContours_ = true; - boolean colorFonds_ = true; - boolean rotations_ = true; - boolean police_ = true; + - if (found instanceof EbliWidgetBordureSingle) { - rotations_ = false; + palette = new BConfigurableComposite(found.getConfigureInterfaces(found.canTraceLigneModel(), found + .canColorForeground(), found.canColorBackground(), found.canRotate(), found.canFont()), "palette"); - // -- droit en fonction du type du contenu --// - if (found.getChildren() != null && found.getChildren().size() != 0) { - - // -- cas pour graphe et calques --// - if (found.getChildren().get(0) instanceof EbliWidgetVueCalque - || found.getChildren().get(0) instanceof EbliWidgetGraphe) { - colorFonds_ = false; - - police_ = false; - } else // -- cas image --// - if (found.getChildren().get(0) instanceof EbliWidgetImage) { - colorFonds_ = false; - - police_ = false; - } else {// -- cas legendes --// - - colorFonds_ = false; - - } - - } - - } else if (found instanceof EbliWidgetShape) { - police_ = false; - // -- test du shapeCreator --// - ShapeCreator creator = ((EbliWidgetShape) found).getShaper_(); - if (!(creator instanceof ShapeCreatorFleche) && !(creator instanceof ShapeCreatorEllipse)) { - rotations_ = false; - } - - } else if (found instanceof EbliWidgetTextLabel) { - rotations_ = false; - colorFonds_ = false; - lineModel_ = false; - } else if (found instanceof EbliWidgetImage) { - rotations_ = false; - colorFonds_ = false; - lineModel_ = false; - police_ = false; - colorsContours_ = false; - } else { - // -- cas des legendes: juste font et color contour pour resizer le tout --// - rotations_ = false; - colorFonds_ = true; - lineModel_ = false; - colorsContours_ = false; - - } - - palette = new BConfigurableComposite(found.getConfigureInterfaces(lineModel_, colorsContours_, colorFonds_, - rotations_, police_), "palette"); - return palette; } 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -284,5 +284,26 @@ return maxWidth; } + + + public boolean canRotate() { + return false; + } + public boolean canColorForeground() { + return false; + } + + public boolean canColorBackground() { + return false; + } + + public boolean canTraceLigneModel() { + return false; + } + + public boolean canFont() { + return true; + } + } \ No newline at end of file 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -239,5 +239,25 @@ // image = null; // getEbliScene().refresh(); // } + public boolean canRotate() { + return false; + } + public boolean canColorForeground() { + return false; + } + + public boolean canColorBackground() { + return false; + } + + public boolean canTraceLigneModel() { + return false; + } + + public boolean canFont() { + return false; + } + + } 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -1,22 +1,15 @@ package org.fudaa.ebli.visuallibrary.graphe; -import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; - import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGFillePanel; @@ -249,51 +242,24 @@ this.repaint(); } - // public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider. - // ExpansionDirection> getExpansionDirections( - // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController - // controller, - // Widget widget, /*EGFillePanel*/BuPanel editor) { - // return null; - // } - // - // public Rectangle getInitialEditorComponentBounds( - // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController - // controller, - // Widget widget, /*EGFillePanel*/BuPanel editor, Rectangle viewBounds) { - // return null; - // } - // - // public void notifyClosing( - // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController - // controller, - // Widget widget, /*EGFillePanel*/BuPanel editor, boolean commit) { - // - // } - // - // public void notifyOpened( - // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController - // controller, - // Widget widget, /*EGFillePanel*/BuPanel editor) { - // - // } + public boolean canRotate() { + return false; + } - // public void setColorContour(Color newColor){ - // couleurContour=newColor; - // repaint(); - // } - // - // public Color getColorContour(){ - // return couleurContour; - // } - // - // public void setColorFond(Color newColor){ - // couleurFond=newColor; - // repaint(); - // } - // - // public Color getColorFond(){ - // return couleurFond; - // } + public boolean canColorForeground() { + return false; + } + public boolean canColorBackground() { + return false; + } + + public boolean canTraceLigneModel() { + return false; + } + + public boolean canFont() { + return false; + } + } Modified: 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/graphe/WidgetLegendeManager.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -171,6 +171,26 @@ } + public boolean canRotate() { + return false; + } + + public boolean canColorForeground() { + return false; + } + + public boolean canColorBackground() { + return false; + } + + public boolean canTraceLigneModel() { + return false; + } + + public boolean canFont() { + return true; + } + } /** 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -59,6 +59,10 @@ public void objectRemoved(ObjectSceneEvent _event, Object _removedObject) { nodeRemoved((EbliNode) _removedObject); } + + + + }; scene_.addObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED, ObjectSceneEventType.OBJECT_REMOVED); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -456,7 +456,7 @@ bar.add(new EbliWidgetActionColorForeground(scene)); - bar.add(new EbliWidgetActionColorBackground(scene)); + bar.add(new EbliWidgetActionColorBackground.ForScene(scene)); bar.add(new EbliWidgetActionRetaillageHorizontal(scene, EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MIN)); bar.add(new EbliWidgetActionRetaillageHorizontal(scene, EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MAX)); 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -541,6 +541,46 @@ }); } + /** + * Methode qui permet de fusionner le model courant avec un autre model. + * Utilsier poru la fusion de courbes spatiales et l ajout dans d autres + * courbes. + * + * @author Adrien Hadoux + * @param anotherModel + */ + public void mergeWithAnotherTreeModel(MvProfileTreeModel anotherModel) { + // -- parcours de la liste des variables du graphe a fusionner --// + for (int i = 0; i < anotherModel.target_.getVars().length; i++) { + final H2dVariableType var = (H2dVariableType) anotherModel.target_.getVars()[i]; + + // -- on recupere toutes les courbes associees a la var pour le + // graphe merges + final MvProfileCourbeGroup g = anotherModel.getGroup(var, false); + if (g != null) { + // -- on recherche le group associe a la variale dans l autre graphe + // sinon on le cree --// + MvProfileCourbeGroup group = this.getGroup(var, true); + + for (int k = g.getChildCount() - 1; k >= 0; k--) { + if (g.getCourbeAt(k).getModel() instanceof MVProfileCourbeModel) { + if (((MVProfileCourbeModel) g.getCourbeAt(k).getModel()).getVariable() == var) { + + // -- duplication de la courbe dans le groupe --// + MvProfileCourbe newChild = new MvProfileCourbe(group, (MVProfileCourbeModel) g.getCourbeAt(k).getModel() + .duplicate()); + group.addEGComponent(newChild); + } + } + + } + } + + } + this.fireStructureChanged(); + + } + protected MvProfileGridPalette getPaletteGrid() { return paletteGrid_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -352,14 +352,14 @@ return node; } - int cpt = 1; + public void actionPerformed(ActionEvent _e) { // -- remplisage combo --// remplirCombo(); dialog_ = new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource - .getS("Fusion avec un autre graphe " + (cpt++))); + .getS("Fusion avec un autre graphe ")); if (content_ == null) content_ = constructPanel(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -27,11 +27,7 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.ctulu.image.CtuluLibImage; -import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.ebli.courbe.EGGrapheDuplicator; -import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; @@ -40,9 +36,6 @@ import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; -import org.fudaa.fudaa.meshviewer.profile.MVProfileCourbeModel; -import org.fudaa.fudaa.meshviewer.profile.MvProfileCourbe; -import org.fudaa.fudaa.meshviewer.profile.MvProfileCourbeGroup; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.common.TrResource; @@ -223,29 +216,9 @@ public void act() { final ProgressionInterface prog = new ProgressionBuAdapter(this); - - //-- parcours de la liste des variables du graphe a fusionner --// - for (Iterator<Object>it= grapheToMerge.getVarSupported().iterator();it.hasNext();) { - final H2dVariableType var = (H2dVariableType) it.next(); - - //-- on recherche le group associe a la variale dans l autre graphe sinon on le cree --// - EGGroup group = grapheModel.getGroupFor(var); - - //-- on recupere toutes les courbes associees a la var pour le graphe merges - final EGGroup g = grapheToMerge.getGroupFor(var); - for (int i = g.getChildCount() - 1; i >= 0; i--) { - if (g.getCourbeAt(i).getModel() instanceof TrPostCourbeModel) { - if (((TrPostCourbeModel) g.getCourbeAt(i).getModel()).getVar() == var) { - - // -- duplication de la courbe dans le groupe --// + grapheModel.mergeWithAnotherTreeModel(grapheToMerge); + - group.addEGComponent((EGCourbeChild) g.getCourbeAt(i).duplicate(group, new EGGrapheDuplicator())); - } - } - - } - } - } }.start(); ; @@ -255,51 +228,13 @@ final MvProfileTreeModel grapheToMerge = (MvProfileTreeModel) grapheWidget.getGraphe().getModel(); final MvProfileTreeModel grapheModel = (MvProfileTreeModel) widgetGraphe_.getGraphe().getModel(); // --ajout de la courbe au widget de base --// - final EGGraphe grapheObject = grapheWidget.getGraphe(); new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre graphe")) { public void act() { final ProgressionInterface prog = new ProgressionBuAdapter(this); - // grapheModel.addNewCourbe(scene_.getCmdMng(), - // widgetGraphe_.getPanelGraphe(), grapheObject, projet_.impl_); - - + grapheModel.mergeWithAnotherTreeModel(grapheToMerge); - //-- parcours de la liste des variables du graphe a fusionner --// - for (int i=0;i<grapheToMerge.target_.getVars().length;i++) { - final H2dVariableType var = (H2dVariableType) grapheToMerge.target_.getVars()[i]; - - // -- on recupere toutes les courbes associees a la var pour le - // graphe merges - final MvProfileCourbeGroup g = grapheToMerge.getGroup(var, false); - if (g != null) { - //-- on recherche le group associe a la variale dans l autre graphe sinon on le cree --// - MvProfileCourbeGroup group = grapheModel.getGroup(var, true); - - - for (int k = g.getChildCount() - 1; k >= 0; k--) { - if (g.getCourbeAt(k).getModel() instanceof MVProfileCourbeModel) { - if (((MVProfileCourbeModel) g.getCourbeAt(k).getModel()).getVariable() == var) { - - - // -- duplication de la courbe dans le groupe --// - MvProfileCourbe newChild = new MvProfileCourbe(group, (MVProfileCourbeModel) g.getCourbeAt(k) - .getModel().duplicate()); - - // group.addEGComponent((EGCourbeChild) - // g.getCourbeAt(k).duplicate(group, new - // EGGrapheDuplicator())); - - group.addEGComponent(newChild); - } - } - - } - } - - } - } }.start(); Modified: 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/TrPostCourbeBuilder.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -68,6 +68,29 @@ treeModel.addAllCourbes(_prog, null); return treeModel; } + + /** + * Permet de creer un courbe avec plusieurs point interpoles. + * + * @param projet + * @param _src + * @param _tidx + * @param _vars + * @param _idxPtArray + * @param _prog + * @return + */ + public static TrPostCourbeTreeModel build(final TrPostProjet projet, final TrPostSource _src, final int[] _tidx, + final H2dVariableType[] _vars, final TrPostInterpolatePoint[] _idxPtArray, final ProgressionInterface _prog) { + if (_prog != null) { + _prog.setDesc(TrResource.getS("Construction des courbes")); + } + final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(projet.impl_, _src, _tidx, _idxPtArray, _vars, + projet); + treeModel.addAllCourbes(_prog, null); + return treeModel; + } + public static void chooseAndBuild(final TrPostProjet _src, final int[] _ptIdx, final H2dVariableType _varSelected, TrPostVisuPanel _calque) { @@ -112,91 +135,8 @@ final String titre = TrResource.getS("Evolutions temporelles"); - // CtuluDialogPanel pn = chooser; - //FIXME: a remplacer par une recherche des frames dans le layout actif. - // final List fr = TrPostCourbeFille.getCourbeFilleFrames(_src.getImpl()); -// final FudaaInternalFrameSelectorPanel pnFrame = fr.size() == 0 ? null : -// new FudaaInternalFrameSelectorPanel(fr, -// TrLib.getString( -// "Afficher les \xE9volutions temporelles dans une nouvelle fen\xEAtre"), titre); -// if (pnFrame != null) { -// final CtuluDialogPanel completePn = new CtuluDialogPanel() { -// public boolean valide() { -// return pnFrame.getCbNew().isSelected() || -// CtuluLibString.isEmpty(getErrorText()); -// } -// }; -// // pn = completePn; -// // pn.setLayout(new BuBorderLayout(4, 4, true, true)); -// // pn.setBorder(BuBorders.EMPTY3333); -// pn.add(pnFrame, BuBorderLayout.NORTH); -// chooser.setErrorTextUnable(); -// chooser.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 5)); -// CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); -// pnFrame.getCbNew().addItemListener(new ItemListener() { -// public void itemStateChanged(final ItemEvent _e) { -// CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); -// if (pnFrame.getCbNew().isSelected()) { -// completePn.setErrorText(chooser.computeErrorText()); -// } else { -// completePn.setErrorText(CtuluLibString.EMPTY_STRING); -// } -// } -// }); -// pn.add(chooser, BuBorderLayout.CENTER); -// -// } -// chooser.activeErrorListener(pn); - - - // BLOC UTILE POUR REFACTORISATION: LA CREATION DE LA COURBE SE FAIT DANS LE - // THREAD - -// if (pn.afficheModaleOk(_src.getImpl().getFrame(), titre)) { -// -// -// -// final Object[] obj = chooser.getSelectedVar(); -// final H2dVariableType[] var = new H2dVariableType[obj.length]; -// System.arraycopy(obj, 0, var, 0, var.length); -// final TrPostCourbeFille fille = pnFrame == null ? null : -// (TrPostCourbeFille) pnFrame.getSelectedFrame(); -// if (fille == null) { -// new CtuluTaskOperationGUI(_src.getImpl(), titre) { -// -// public void act() { -// final ProgressionInterface prog = new ProgressionBuAdapter(this); -// final TrPostCourbeTreeModel model = _pt == null ? build(_src.getImpl(), -// _src.getSource(), chooser -// .getSelectedTimeStepIdx(), var, _ptIdx, prog) : build(_src.getImpl(), -// _src.getSource(), chooser -// .getSelectedTimeStepIdx(), var, _pt, prog); -// if (model != null) { -// _src.addFille(model, "graphe " + (cptGraphe++)/* -// * pnFrame == null ? -// * titre :pnFrame. -// * getNewFrameTitle() -// */, prog, _calque); -// } -// } -// }.start(); -// } else { -// if (_ptIdx == null) { -// TrPostCourbeAddPointsAction.startImportInterpolate(_src.getImpl(), -// fille.getGraphe(), _pt); -// } else { -// TrPostCourbeAddPointsAction.startImportIdx(_src.getImpl(), -// fille.getGraphe(), _ptIdx); -// } -// _src.getImpl().activateInternalFrame(fille); -// } -// -// } - - // -- wizard construction --// TrPostWizardCourbeTemporelle wizard = new TrPostWizardCourbeTemporelle(_calque,_src,chooser, - new TrPostActionAddPointFromWidgetCalque.Temporel(_src.getSelectedFilleLayout().getScene(), _src.getImpl()), _ptIdx, _pt); BuWizardDialog DialogWizard = new BuWizardDialog(_src.getImpl().getFrame(), wizard); 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -31,6 +31,7 @@ import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGGrapheDuplicator; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.geometrie.GrPoint; @@ -133,6 +134,28 @@ intepolPt_.add(_interpol); } + /** + * Constructeur permettant de creer un treemodel avec plusieurs point + * interpol\xE9s + * + * @param _impl + * @param _src + * @param _timeIdx + * @param _interpol + * : le tableau de points interpoles + * @param _vars + * @param _projet + * + * @author Adrien Hadoux + */ + public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, + final TrPostInterpolatePoint[] _interpol, final H2dVariableType[] _vars, TrPostProjet _projet) { + this(_impl, _src/* , _timeIdx */, _vars, _projet); + + for (int i = 0; i < _interpol.length; i++) + intepolPt_.add(_interpol[i]); + } + private void buildUpdating() { if (updating_ == null) { updating_ = new EGGroup(); @@ -804,61 +827,7 @@ ((TrPostCourbeModel) newCurve.getModel()).updateY(i, var); } - // } - // else{ - // - // // -- CAS COURBE INTERPOLEE --// - // TrPostCourbeModel.Interpolated - // modelBase=(TrPostCourbeModel.Interpolated) _child.getModel(); - // H2dVariableType var = modelBase.getVar(); - // - // // -- verification si le point du model choisi est reel ou interpol\xE9 - // // dans la nouvelle source --// - // if (srcChoisie.getGrid().contientPoint(modelBase.ptIdx_.x_, - // modelBase.ptIdx_.y_)) { - // - // // -- recuperation du point interpol\xE9 pour la nouvelle source --// - // GrPoint pointInterpol = new GrPoint(modelBase.ptIdx_.x_, - // modelBase.ptIdx_.y_, 0); - // int newPtIdx = TrIsoLayerDefault.sondeSelection(pointInterpol, - // srcChoisie.getGrid()); - // if (newPtIdx != -1) { - // // -- CREATION DE LA COURBE REELE DEPUIS COURBE INTERPOLEE --// - // newCurve = TrPostCourbeModel.Node.buildCourbeModel(var, newPtIdx, - // modelBase.getTime(), _child - // .getParentGroup(), srcChoisie); - // } - // } else { - // // -- on recupere le point le plus proche pour interpoler --// - // GrPoint pointInterpol = new GrPoint(modelBase.ptIdx_.x_, - // modelBase.ptIdx_.y_, 0); - // int newPtIdx = TrIsoLayerDefault.sondeSelection(pointInterpol, - // srcChoisie.getGrid()); - // - // if (newPtIdx != -1) { - // - // TrPostInterpolatePoint interpolatePoint = new - // TrPostInterpolatePoint(newPtIdx, modelBase.ptIdx_.x_, - // modelBase.ptIdx_.y_, new GISPrecision()); - // - // // -- CREATION DE LA COURBE INTERPOLEE DEPUIS COURBE INTERPOLEE --// - // newCurve = - // TrPostCourbeModel.Interpolated.buildCourbeModel(modelBase.getVar(), - // interpolatePoint, modelBase - // .getTime(), _child.getParentGroup(), srcChoisie); - // } - // } - // - // - // // -- recuperation des y de son duplicata --// - // ((TrPostCourbeModel) newCurve.getModel()).setY(new - // double[modelBase.getY().length]); - // double[] ds = modelBase.getTime(); - // for (int i = 0; i < ds.length; i++) { - // ((TrPostCourbeModel) newCurve.getModel()).updateY(i, var); - // } - // - // } + newCurve.setTitle(newCurve.getTitle() + " " + projet_.formatName(projet_.getSource(indiceSOURCESelect).getTitle())); @@ -867,6 +836,40 @@ } return null; } + + /** + * Methode qui permet de fusionner le model courant avec un autre model. + * Utilsier poru la fusion de courbes tempo et l ajout dans d autres courbes. + * + * @author Adrien Hadoux + * @param anotherModel + */ + public void mergeWithAnotherTreeModel(TrPostCourbeTreeModel anotherModel) { + // -- parcours de la liste des variables du graphe a fusionner --// + for (Iterator<Object> it = anotherModel.getVarSupported().iterator(); it.hasNext();) { + final H2dVariableType var = (H2dVariableType) it.next(); + + // -- on recherche le group associe a la variale dans l autre graphe sinon + // on le cree --// + EGGroup group = this.getGroupFor(var); + + // -- on recupere toutes les courbes associees a la var pour le graphe + // merges + final EGGroup g = anotherModel.getGroupFor(var); + for (int i = g.getChildCount() - 1; i >= 0; i--) { + if (g.getCourbeAt(i).getModel() instanceof TrPostCourbeModel) { + if (((TrPostCourbeModel) g.getCourbeAt(i).getModel()).getVar() == var) { + + // -- duplication de la courbe dans le groupe --// + + group.addEGComponent((EGCourbeChild) g.getCourbeAt(i).duplicate(group, new EGGrapheDuplicator())); + } + } + + } + } + this.fireStructureChanged(); + } } 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 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -40,7 +40,6 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorForeground; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; @@ -539,7 +538,7 @@ // -- Action sur le format --// // init.add(new EbliWidgetActionColorForeground(getSceneCourante())); -// init.add(new EbliWidgetActionColorBackground(getSceneCourante())); + init.add(new EbliWidgetActionColorBackground.ForScene(getSceneCourante())); // -- action de configuration des composants graphiques--// init.add(new EbliWidgetActionConfigure(getSceneCourante())); init.add(null); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java 2008-09-17 15:35:06 UTC (rev 3947) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java 2008-09-17 17:09:01 UTC (rev 3948) @@ -2,35 +2,56 @@ import java.awt.BorderLayout; import java.awt.FlowLayout; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; -import javax.swing.ButtonGroup; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.ImageIcon; import javax.swing.JButton; -import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JPanel; -import javax.swing.JRadioButton; import javax.swing.table.AbstractTableModel; +import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.ProgressionBuAdapter; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gis.GISPrecision; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModel; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.ebli.visuallibrary.graphe.GrapheCellRenderer; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; import org.fudaa.fudaa.tr.common.TrResource; -import org.fudaa.fudaa.tr.post.TrPostActionAddPointFromWidgetCalque.Temporel; import org.jdesktop.swingx.JXTable; import com.memoire.bu.BuButtonPanel; +import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuDialog; +import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; +import com.memoire.bu.BuValueValidator; import com.memoire.bu.BuWizardTask; import com.memoire.fu.FuLog; @@ -42,136 +63,36 @@ * */ public class TrPostWizardCourbeTemporelle extends BuWizardTask { - - - private TrPostVisuPanel calque_; - TrPostProjet projet_; - private JRadioButton rb0_0, rb0_1, rb0_2; - private ButtonGroup bg0; - private JPanel r0; - private JLabel lb1_0; - private JCheckBox cb1_1; - private BuTextField tf1_1, tf1_2; - private JPanel r1; - private JLabel r2; - - /** - * les points selectionnes - */ - private int[] ptIdx_; - - /** - * le point interpol\xE9 selectionn\xE9 - */ - TrPostInterpolatePoint pt_; - - BuCheckBox creationNewGraphe_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un nouveau graphe")/* - * , - * EbliResource - * . - * EBLI - * . - * getIcon - * ( - * "crystal_valider" - * ) - */); - - - - - private MvExportChooseVarAndTime chooserVarTime_; - TrPostActionAddPointFromWidgetCalque.Temporel actionChoixGraphes_; - - - public class ModelListePoints extends AbstractTableModel { - // -- variables utilisees pour stocker la saisie de l utilisateur - String xTempCreate = null; - String yTempCreate = null; - - public void setValueAt(Object _value, int _rowIndex, int _columnIndex) { - - if (_columnIndex == 0) + public class ModelListePoints extends AbstractTableModel { + String[] titre_; + + public void setValueAt(Object _value, int _rowIndex, int _columnIndex) { + if (_columnIndex == 0 || _columnIndex == 3) return; - - // -- cas edition interne de nouveau point --// - if (ptIdx_ != null && _rowIndex == ptIdx_.length) { - if (_columnIndex == 1) { - xTempCreate = (String) _value; - - } else if (_columnIndex == 2) { - - yTempCreate = (String) _value; - } - - // -- verification si les 2 params sont saisis, on ajoute le point au - // tableau - if (xTempCreate != null && yTempCreate != null) { - - if (!checkAndReplaceSonde(xTempCreate, yTempCreate, this, ptIdx_.length)) { - - projet_.impl_.error("Le point rentr\xE9 n'est pas dans le maillage."); - //-- on reintialise les donnees --// - if (_columnIndex == 1) { - xTempCreate = null; - - } else if (_columnIndex == 2) { - yTempCreate = null; - } - - } else { - - // -- le point est ajout\xE9 auto dans la methode check, on - // repositionne anull les temp --// - xTempCreate = null; - yTempCreate = null; - } - } - - } else { - // cas normal de modif de val --// - if (_columnIndex == 1) { - String val = (String) _value; - // -- on recupere le y et on v\xE9rifie que le point est toujours bon - // --// - String y = (String) getValueAt(_rowIndex, 2); - - if (!checkAndReplaceSonde(xTempCreate, yTempCreate, this, _rowIndex)) { - projet_.impl_.error("Le point rentr\xE9 n'est pas dans le maillage."); - } - - - } else if (_columnIndex == 2) { - - String val = (String) _value; - // -- on recupere le x et on v\xE9rifie que le point est toujours bon - // --// - String x = (String) getValueAt(_rowIndex, 1); - - - - } - + // cas normal de modif de val --// + if (_columnIndex == 2 || _columnIndex == 1) + saisirPoints("" + (Double) getValueAt(_rowIndex, 1), "" + (Double) getValueAt(_rowIndex, 2), false, _rowIndex, + this); } - - } - String[] titre_; - - public ModelListePoints() { - String[] val = { "Point", "X", "Y" }; + public ModelListePoints() { + String[] val = { "Point", "X", "Y", "Interpol\xE9" }; titre_ = val; - } - + public Class<?> getColumnClass(int _columnIndex) { + if (_columnIndex == 3) + return Boolean.class; + if (_columnIndex == 2 || _columnIndex == 1) + return JButton.class; + return String.class; } public int getColumnCount() { - FuLog.warning("titres colonnes: " + titre_); + return titre_.length; } @@ -180,132 +101,220 @@ } public int getRowCount() { - if (ptIdx_ != null) - return ptIdx_.length + 1; - else - return 1; + return listePoints_.size(); } public Object getValueAt(int _rowIndex, int _columnIndex) { - - // -- cas edition interne de nouveau point --// - if (ptIdx_ != null && _rowIndex == ptIdx_.length) - if (_columnIndex == 1 && xTempCreate != null) - return xTempCreate; - else if (_columnIndex == 2 && yTempCreate != null) - return yTempCreate; + + // -- connaitre la bonen liste entre les points reels et interpol\xE9s + + if (_columnIndex == 0) { + if (!isInterpolated(_rowIndex)) + return "Point " + getPointReel(_rowIndex); else - return ""; - - - - if(_columnIndex==0){ - if(ptIdx_!=null) - return ptIdx_[_rowIndex]; - else - if (pt_ != null) - return pt_.idxElt_; - } - else - if (_columnIndex == 1) { - if (ptIdx_ != null){ - GrPoint point=new GrPoint(); - calque_.getIsoLayer().getIsoModel().point(ptIdx_[_rowIndex], point); + return "Interpol\xE9 en " + getPointInt(_rowIndex).idxElt_; + + } else if (_columnIndex == 1) { + if (!isInterpolated(_rowIndex)) { + GrPoint point = new GrPoint(); + calque_.getIsoLayer().getIsoModel().point(getPointReel(_rowIndex), point); return point.x_; - } - else - if (pt_ != null) - return pt_.x_; + } else + return getPointInt(_rowIndex).x_; } else if (_columnIndex == 2) { - if (ptIdx_ != null) { + if (!isInterpolated(_rowIndex)) { GrPoint point = new GrPoint(); - calque_.getIsoLayer().getIsoModel().point(ptIdx_[_rowIndex], point); + calque_.getIsoLayer().getIsoModel().point(getPointReel(_rowIndex), point); return point.y_; - } - else - if (pt_ != null) - return pt_.y_; + } else + return getPointInt(_rowIndex).y_; + } else if (_columnIndex == 3) { + return isInterpolated(_rowIndex); } - + return null; - + } public boolean isCellEditable(int _rowIndex, int _columnIndex) { - if (_columnIndex == 0) + // if (_columnIndex == 0 || _columnIndex == 3) + // return false; + // else + // return true; return false; - else - return true; } + } + + + + private TrPostVisuPanel calque_; + TrPostProjet projet_; - + /** + * les points selectionnes + */ + // private int[] ptIdx_; - - + + /** + * le point interpol\xE9 selectionn\xE9 + */ + //TrPostInterpolatePoint pt_; + /** + * la liste des points. Peut etre des points reels mais aussi interpol\xE9s + */ + ArrayList listePoints_; + + BuCheckBox checkboxNewGraphe_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un nouveau graphe")/* + * , + * EbliResource + * . + * EBLI + * . + * getIcon + * ( + * "crystal_valider" + * ) + */); + + + + + private MvExportChooseVarAndTime chooserVarTime_; + // TrPostActionAddPointFromWidgetCalque.Temporel actionChoixGraphes_; + + + public boolean isInterpolated(int i) { + return (listePoints_.get(i) instanceof TrPostInterpolatePoint); } - + public TrPostInterpolatePoint getPointInt(int i) { + + return (TrPostInterpolatePoint) listePoints_.get(i); + } + + public int getPointReel(int i) { + return ((Integer) listePoints_.get(i)).intValue(); + } + + + /** + * retourne tous les points reels de la liste en enlevant les interpoles + * + * @return + */ + int[] getAllPOintsReels() { + + ArrayList<Integer> res = new ArrayList<Integer>(); + + for (int i = 0; i < listePoints_.size(); i++) + if (!isInterpolated(i)) + res.add(getPointReel(i)); + + int[] listeReels = new int[res.size()]; + for (int i = 0; i < res.size(); i++) + listeReels[i] = res.get(i); + return listeReels; + } + + /** + * retourne tous les points interpoles de la liste en enlevant les reels + * + * @return + */ + TrPostInterpolatePoint[] getAllPOintsInt() { + + ArrayList<TrPostInterpolatePoint> res = new ArrayList<TrPostInterpolatePoint>(); + + for (int i = 0; i < listePoints_.size(); i++) + if (isInterpolated(i)) + res.add(getPointInt(i)); + + TrPostInterpolatePoint[] listeInt = new TrPostInterpolatePoint[res.size()]; + for (int i = 0; i < res.size(); i++) + listeInt[i] = res.get(i); + return listeInt; + } + + + public EbliScene getScene() { + return projet_.getSelectedFilleLayout().getScene(); + } + + + + public TrPostWizardCourbeTemporelle(TrPostVisuPanel calque, TrPostProjet projet, MvExportChooseVarAndTime _chooserVarTime, - Temporel _actionChoixGraphes, final int[] _ptIdx, + /* Temporel _actionChoixGraphes, */final int[] _ptIdx, final TrPostInterpolatePoint _pt) { super(); projet_ = projet; - actionChoixGraphes_ = _actionChoixGraphes; + // actionChoixGraphes_ = _actionChoixGraphes; chooserVarTime_ = _chooserVarTime; calque_ = calque; - pt_ = _pt; - ptIdx_ = _ptIdx; - // -- si les 2 sont nuls, on initialise la liste des points modifiable --// - if (pt_ == null && ptIdx_ == null) - ptIdx_ = new int[0]; - - - // creationNewGraphe_.addActionListener(new ActionListener() { - // - // public void actionPerformed(ActionEvent _e) { - // createNewGraphe(); - // } - // - // }); - + listePoints_ = new ArrayList(); + if (_ptIdx != null) + for (int i = 0; i < _ptIdx.length; i++) + listePoints_.add(_ptIdx[i]); + + if (_pt != null) + listePoints_.add(_pt); + } + /** + * Action de creation d un nouveau widget graphe en live + */ + protected void createNewGraphe(TrPostCourbeTreeModel modelTotal, ProgressionInterface prog) { + if (modelTotal != null) { + projet_.addFille(modelTotal, "graphe " + (cptGraphe++), prog, calque_); + } + } + /** * appel\xE9 a la fin du wizard */ public void doTask() { done_ = true; - - + new CtuluTaskOperationGUI(projet_.getImpl(), "graphe " + (cptGraphe++)) { + public void act() { + final ProgressionInterface prog = new ProgressionBuAdapter(this); + + // -- creation du model pour les donn\xE9es fournies --// + TrPostCourbeTreeModel modelTotal = createCourbeModel(prog); + // -- creation d un nouveau graphe si coch\xE9 --// - if (creationNewGraphe_.isSelected()) - createNewGraphe(); - + if (checkboxNewGraphe_.isSelected()) + createNewGraphe(modelTotal, prog); + // -- ajout des courbes dans les graphes --// - for (int i = 0; i < this.actionChoixGraphes_.listeGraphesChoisis.size(); i++) { - EGGraphe graphe = this.actionCho... [truncated message content] |
From: <had...@us...> - 2008-09-17 20:00:59
|
Revision: 3949 http://fudaa.svn.sourceforge.net/fudaa/?rev=3949&view=rev Author: hadouxad Date: 2008-09-17 20:01:07 +0000 (Wed, 17 Sep 2008) Log Message: ----------- - correction de pleins de bugs - ajout des duplication des descriptions et utilisation plus importante. - ajout des infos des jeux de donn?\195?\169es dans la dialog informations + - ajout de l action d edition de la palete dans la toolbar du calque -ajout des action d edition depuis les popup pour les legendes/calque/graphe - meilleur gestion et synchronisation des widget/legende - supression simultan?\195?\169e - masquage simultan?\195?\169 - duplication simultan?\195?\169e - Rajout d infos sur la gestion multi source Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.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/calque/CalqueLegendeWidgetAdapter.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/EbliWidgetControllerLegendeCalque.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/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.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/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 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -213,6 +213,10 @@ // -- ajout dans la vue layer --// visu_.addChild(node.getWidget()); + + if (node.getWidget().getController().getDescription() == null + || node.getWidget().getController().getDescription().equals("")) + node.getWidget().getController().setDescription(node.getTitle()); return node.getWidget(); } 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -7,7 +7,6 @@ import javax.swing.AbstractButton; import javax.swing.JComponent; -import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JOptionPane; @@ -15,11 +14,8 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; -import org.fudaa.ebli.controle.BConfigurableComposite; -import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; @@ -27,7 +23,6 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; -import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; @@ -120,12 +115,22 @@ // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); } + + postActionDuplication(n, duplique); } }); } + + /** + * Methode a surcharger si on veut effectuer un traitement particulier apres + * duplication du widget. + */ + public void postActionDuplication(EbliNode node, EbliNode duplique) { + } + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Masquer la frame")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); @@ -300,7 +305,9 @@ } public String getDescription() { + return description_; + } public BuMenuBar getMenubarComponent() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -24,7 +24,6 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; @@ -187,11 +186,11 @@ } - _widgetLegende.setController(new EbliWidgetControllerMenuOnly(_widgetLegende, false)); + _widgetLegende.setController(new EbliWidgetControllerLegendeCalque(_widgetLegende)); // -- prendre en compte le resize automatique --// _widgetLegende.getEbliScene().refresh(); - _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); + // _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); return _widgetLegende; } else { 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -19,9 +19,9 @@ import org.fudaa.ebli.visuallibrary.EbliWidget; 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.LabelWidget; import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.action.InplaceEditorAction; import com.memoire.bu.BuLib; @@ -35,6 +35,7 @@ // BArbreCalqueModel modelTree_; boolean maj = true; + public InplaceEditorAction<JComponent> editorAction_; // Font oldFont_; public EbliWidgetCalqueLegende(EbliScene _scene, boolean _controller/* , BArbreCalqueModel model */, @@ -52,9 +53,10 @@ setEnabled(true); // -- creation de l action edition des labels --// - WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + editorAction_ = (InplaceEditorAction<JComponent>) ActionFactory.createInplaceEditorAction(this); + // -- ajout de l action au label correspondant --// - this.getActions().addAction(editorAction); + this.getActions().addAction(editorAction_); } /** @@ -126,16 +128,20 @@ // -- mise du nouveau bounds max --// Rectangle boundsIntern = new_widget.getIntern().getBounds(); + if (boundsIntern != null) { boundsIntern.width = newBounds.width; boundsIntern.height = (int) (newBounds.height); - + } new_widget.getIntern().setPreferredBounds(boundsIntern); // resize pour le logo: forme carr\xE9 Rectangle boundsLogo = new_widget.getLogo().getBounds(); + if (boundsLogo != null) { + boundsLogo.height = (int) (newBounds.height); boundsLogo.width = (int) (newBounds.height); new_widget.getLogo().setPreferredBounds(boundsLogo); + } new_widget.getLogo().repaint(); } else if (widget instanceof LabelWidget && (((LabelWidget) widget).getLabel() != null)) { @@ -157,9 +163,11 @@ // Resize de la widget // getEbliScene().revalidate(); Rectangle newBoundConteneurs = getParentWidget().getBounds(); + if (newBoundConteneurs != null) { newBoundConteneurs.height = (int) ((fmtBold.getHeight() + 7) * 2 + (listePlage.size()) * (newBounds.height + 7));// ( newBoundConteneurs.width = (int) (Math.max(maxWidth, maxTitle) * 1.5); getParentWidget().setPreferredBounds(newBoundConteneurs); + } getEbliScene().refresh(); } 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -17,7 +17,6 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BCalquePaletteInfo; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -26,6 +25,7 @@ import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BSelecteurListComboBox; +import org.fudaa.ebli.palette.PaletteEditAction; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -33,6 +33,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; +import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import com.memoire.bu.BuMenuBar; @@ -71,6 +72,7 @@ widgetCalque_ = _widget; widgetParent_ = _parent; addActionSpecifiques(); + } @@ -83,6 +85,30 @@ } + + /** + * Methode a surcharger si on veut effectuer un traitement particulier apres + * duplication du widget. + */ + public void postActionDuplication(EbliNode node, EbliNode duplique) { + + // -- il faut verifier que les le node a bien une legende sinon on n ajoute + // pas de legende pour le dupliqu\xE9 --// + EbliWidgetControllerCalque controllerDuDuplique = null; + if (duplique.getWidget() instanceof EbliWidgetBordureSingle) + controllerDuDuplique = (EbliWidgetControllerCalque) ((EbliWidget) duplique.getWidget().getChildren().get(0)) + .getController(); + else + controllerDuDuplique = (EbliWidgetControllerCalque) ((EbliWidget) duplique.getWidget()).getController(); + // -- on ajoute la legende apres duplication --// + if (getNodeLegende() != null && widget_.getEbliScene().isObject(getNodeLegende()) && this.legendeWidget_ != null) + controllerDuDuplique.ajoutLegende(); + + controllerDuDuplique.setDescription(getDescription()); + + } + + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { @@ -112,6 +138,39 @@ } } + + protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + + // -- on prend la location du node au moment de la suppression pour + // pouvoir la retablir dans le undo --// + // n.setPreferedLocation(widget_.getPreferredLocation()); + // -- on enregistre la commande undo redo --// + cmd_ + .addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + + // -- on enleve le node de la scene --// + widget_.getEbliScene().removeNode(n); + + // -- on supprime le node legende associe --// + if (widgetCalque_.nodeLegende != null) { + widget_.getEbliScene().removeNode(widgetCalque_.nodeLegende); + legendeWidget_ = null; + } + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + } + + }); + } + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Masquer l'objet")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); @@ -185,6 +244,8 @@ } + + /** * Mise au premier plan de la widget et edition. Sert beaucoup pour la fusion */ @@ -272,7 +333,8 @@ toolbarCalque_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); } } - + toolbarCalque_.add(new PaletteEditAction(getCalque().getArbreCalqueModel().getTreeSelectionModel())); + // -- ajout des comboBox des variables --// BSelecteurListComboBox combo = new BSelecteurListComboBox(); // pour mettre \xE0 jour la combo d\xE8s que la s\xE9lection de l'arbre change Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -1,5 +1,13 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; @@ -15,4 +23,36 @@ super(widget_); } + protected void buildPopupMenu(JPopupMenu _menu) { + constructPopupMenuSpecifique(_menu); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(_menu); + } + private void constructPopupMenuSpecifique(JPopupMenu _popup) { + + JMenuItem menuItem = new JMenuItem(EbliResource.EBLI.getString("Editer la l\xE9gende")); + _popup.add(menuItem, 0); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_editer")); + menuItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + MenuEditer(); + + } + }); + + } + + + + /** + * Mise au premier plan de la widget et edition. Sert beaucoup pour la fusion + */ + public void MenuEditer() { + // -- executer l action d edition --// + ((EbliWidgetCalqueLegende) getWidget()).editorAction_.openEditor(getWidget()); + + } + } Modified: 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/EbliWidgetCreatorLegende.java 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -1,5 +1,7 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.Font; + import org.fudaa.ebli.calque.BCalqueLegendePanel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -40,7 +42,7 @@ EbliWidget widgetLegende_ = CalqueLegendeWidgetAdapter.createLegendeWidget( new EbliWidgetCalqueLegende(_scene, false, g), g, _scene); res = new EbliWidgetBordureSingle(widgetLegende_, true, true); - + widgetLegende_.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); return res; } 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -25,13 +25,15 @@ import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGSpecificActions; import org.fudaa.ebli.courbe.EGTree; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; +import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; -import org.netbeans.api.visual.action.WidgetAction; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; @@ -61,6 +63,9 @@ EbliWidgetGraphe widgetGraphe_; + + EbliActionEditorOneClick<BuPanel> editorAction_; + public EbliWidgetControllerGraphe(EbliWidgetGraphe widget_, EbliNodeDefault nodeLegende) { super(widget_); widgetGraphe_ = widget_; @@ -72,9 +77,9 @@ } public void addActionSpecifiques() { - WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>((EbliWidgetGraphe) widget_); + editorAction_ = new EbliActionEditorOneClick<BuPanel>((EbliWidgetGraphe) widget_); // -- ajout de l action au widget correspondant --// - widget_.getActions().addAction(editorAction); + widget_.getActions().addAction(editorAction_); } @@ -95,7 +100,62 @@ } } + + /** + * Methode a surcharger si on veut effectuer un traitement particulier apres + * duplication du widget. + */ + public void postActionDuplication(EbliNode node, EbliNode duplique) { + // -- il faut verifier que les le node a bien une legende sinon on n ajoute + // pas de legende pour le dupliqu\xE9 --// + EbliWidgetControllerGraphe controllerDuDuplique = null; + if (duplique.getWidget() instanceof EbliWidgetBordureSingle) + controllerDuDuplique = (EbliWidgetControllerGraphe) ((EbliWidget) duplique.getWidget().getChildren().get(0)) + .getController(); + else + controllerDuDuplique = (EbliWidgetControllerGraphe) ((EbliWidget) duplique.getWidget()).getController(); + // -- on ajoute la legende apres duplication --// + if (widgetGraphe_.getNodeLegende() != null) + controllerDuDuplique.ajoutLegende(); + + controllerDuDuplique.setDescription(getDescription()); + + } + + + protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Supprimer la frame")); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + + // -- on prend la location du node au moment de la suppression pour + // pouvoir la retablir dans le undo --// + // n.setPreferedLocation(widget_.getPreferredLocation()); + // -- on enregistre la commande undo redo --// + cmd_ + .addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + + // -- on enleve le node de la scene --// + widget_.getEbliScene().removeNode(n); + + // -- on supprime le node legende associe --// + if (widgetGraphe_.getNodeLegende() != null) { + widget_.getEbliScene().removeNode(widgetGraphe_.getNodeLegende()); + + } + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + } + + }); + } + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem = _popup.add("Masquer l'objet"); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); @@ -141,6 +201,40 @@ }); } + public void ajoutLegende() { + // -- creation de la l\xE9gende --// + if (widget_.getEbliScene() != null) { + Point positionLegende = new Point(); + if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { + positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; + positionLegende.y = widget_.getPreferredLocation().y; + + } + + if (!widget_.getEbliScene().isObject(widgetGraphe_.getNodeLegende())) { + + // -- creation d'un node legende --// + widgetGraphe_.setNodeLegende(new EbliNodeDefault()); + + // -- non de la legende --// + widgetGraphe_.getNodeLegende().setTitle("L\xE9gende " + (indiceLegende++)); + + widgetGraphe_.getNodeLegende().setCreator( + new EbliWidgetCreatorLegende(((EbliWidgetGraphe) widget_).getGraphe())); + widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); + + widget_.getEbliScene().addNode(widgetGraphe_.getNodeLegende()); + widgetGraphe_.getNodeLegende().setPreferedSize(widgetGraphe_.getNodeLegende().getWidget().getPreferredSize()); + + widget_.getEbliScene().refresh(); + } else if (widgetGraphe_.getNodeLegende().hasWidget()) { + // -- cas ou la legende est masquee --// + widgetGraphe_.getNodeLegende().getWidget().setVisible(true); + } + + } + } + /** * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende * @@ -153,85 +247,39 @@ public void actionPerformed(ActionEvent e) { - // -- creation de la l\xE9gende --// - if (widget_.getEbliScene() != null) { + ajoutLegende(); + } - // position a cote de la widget graphe - // Point nouvellePosition = new Point((int) (widget_.getLocation().x), - // (int) (widget_.getLocation().y + widget_ - // .getBounds().height * 1.2)); + }); - // int x, y, width; - // Point nouvellePosition = new Point(); - // - // if (widget_.getLocation() != null) { - // x = - // widget_.getEbliScene().convertSceneToLocal(widget_.getLocation() - // ).x; - // y = - // widget_.getEbliScene().convertSceneToLocal(widget_.getLocation() - // ).y; - // } else { - // - // x = widget_.getEbliScene().convertSceneToLocal(widget_. - // getPreferredLocation()).x; - // y = widget_.getEbliScene().convertSceneToLocal(widget_. - // getPreferredLocation()).y; - // } - // if (widget_.getBounds() != null) - // width = widget_.getBounds().width; - // else - // - // width = widget_.getPreferredBounds().width; - // nouvellePosition.x = x + width + 20; - // nouvellePosition.y = y; + + menuItem = new JMenuItem(EbliResource.EBLI.getString("Editer le graphe")); + _popup.add(menuItem, 0); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_editer")); + menuItem.addActionListener(new ActionListener() { - Point positionLegende = new Point(); - if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { - positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; - positionLegende.y = widget_.getPreferredLocation().y; + public void actionPerformed(ActionEvent e) { - } - // getScene_().addChild(new EbliWidget(getScene_(),null)); - // addChild - // (WidgetLegendeManager.createLegende(GrapheWidget.this.getGraphe(), - // GrapheWidget.this.getScene_(),null)); - if (!widget_.getEbliScene().isObject(widgetGraphe_.getNodeLegende())) { + MenuEditer(); - // -- creation d'un node legende --// - widgetGraphe_.setNodeLegende(new EbliNodeDefault()); - - // -- non de la legende --// - widgetGraphe_.getNodeLegende().setTitle("L\xE9gende " + (indiceLegende++)); - - widgetGraphe_.getNodeLegende().setCreator( - new EbliWidgetCreatorLegende(((EbliWidgetGraphe) widget_).getGraphe())); - widgetGraphe_.getNodeLegende().setPreferedLocation(positionLegende); - - widget_.getEbliScene().addNode(widgetGraphe_.getNodeLegende()); - widgetGraphe_.getNodeLegende().setPreferedSize( - widgetGraphe_.getNodeLegende().getWidget().getPreferredSize()); - // widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe. - // this.getGraphe(), - // widget_.getScene_(),nouvellePosition); - widget_.getEbliScene().refresh(); - } else if (widgetGraphe_.getNodeLegende().hasWidget()) { - // -- cas ou la legende est masquee --// - widgetGraphe_.getNodeLegende().getWidget().setVisible(true); - } - - // GrapheWidget.this.addChild(widgetLegende); - } } - }); - + // -- creation du menu config de la courbe _popup.add(new EGConfigureActionPalette(((EbliWidgetGraphe) widget_).getGraphe().getModel())); } + + /** + * Mise au premier plan de la widget et edition. Sert beaucoup pour la fusion + */ + public void MenuEditer() { + // -- executer l action d edition --// + editorAction_.openEditor(getWidget()); + } + @Override protected void buildPopupMenu(JPopupMenu _menu) { constructPopupMenuSpecifique(_menu); Modified: 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/EbliWidgetTitle.java 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -59,7 +59,7 @@ public void majLabel(){ intern_.setForeground(cb_.getAspectContour()); intern_.setLabel(cb_.getTitle()); - intern_.setToolTipText(cb_.getTitle()); + intern_.setToolTipText(cb_.getTitle()); } // @Override 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -74,7 +74,7 @@ JComponent right; JComponent[] tools_; - + String previousTitleFrame = getTitle(); /** * Toolbar modifiable qui se met a jour selon la selection de la widget. */ @@ -110,7 +110,7 @@ public TrPostLayoutFille(TrPostProjet _projet) { super(); setTitle(TrResource.getS("vue 2D")); - + previousTitleFrame = getTitle(); projet_ = _projet; // creation de la scene EBLI controller_ = new TrPostLayoutPanelController(new TrPostScene(_projet), _projet); @@ -451,7 +451,7 @@ // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbar(node.getWidget().getController()); - + setTitle(previousTitleFrame + " " + node.getWidget().getController().getDescription()); } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { FuLog.warning("change tree GRAPHE"); // -- etape 1: ajout du tree dans fudaaImplementation --// @@ -460,16 +460,27 @@ // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarSpecifiqueGraphe(node.getWidget().getController(), (EbliWidgetCreatorGraphe) node.getCreator()); + + setTitle(previousTitleFrame + " " + node.getWidget().getController().getDescription()); } else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTreeScene(); // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarScene(); - + setTitle(previousTitleFrame); } } + + + + @Override + public void setTitle(String _title) { + super.setTitle(_title); + previousTitleFrame = title; + } + public Dimension getDefaultImageDimension() { return getScene().getDefaultImageDimension(); } @@ -485,6 +496,7 @@ public void editStop(Widget _w) { changeTreeScene(); changeToolbarScene(); + setTitle(previousTitleFrame); } 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -270,16 +270,10 @@ // ajout du node au layout addNode(nodeCalque); - // -- creation de son action de fusion --// - // EbliWidgetVueCalque calqueWidget = null; - // if (nodeCalque.getWidget() instanceof EbliWidgetBordureSingle) - // calqueWidget = (EbliWidgetVueCalque) ((EbliWidgetBordureSingle) - // nodeCalque.getWidget()).getIntern(); - // else - // calqueWidget = (EbliWidgetVueCalque) nodeCalque.getWidget(); - // new TrPostActionFusionCalques(calqueWidget, nodeCalque, projet_); + - + nodeCalque.getWidget().getController().setDescription(projet_.formatInfoSource(calque.getSource(0))); + // -- ajout de la legende dans le calque associe --// EbliWidget createdWidget = nodeCalque.getWidget(); creator.updateLegend((EbliWidgetBordureSingle) createdWidget, _legende); 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -549,15 +549,15 @@ public String formatFichier(File file) { String nomFichier = file.getAbsolutePath(); - int position = nomFichier.lastIndexOf(File.separator) + 1; - if (position != -1) { - nomFichier = nomFichier.substring(position); - } - position = nomFichier.lastIndexOf(CtuluLibString.DOT); - if (position != -1) { - nomFichier = nomFichier.substring(0, position); - } - FuLog.warning("nom du fichier: " + nomFichier); + // int position = nomFichier.lastIndexOf(File.separator) + 1; + // if (position != -1) { + // nomFichier = nomFichier.substring(position); + // } + // position = nomFichier.lastIndexOf(CtuluLibString.DOT); + // if (position != -1) { + // nomFichier = nomFichier.substring(0, position); + // } + // FuLog.warning("nom du fichier: " + nomFichier); return nomFichier; } @@ -1002,7 +1002,7 @@ * @param pn * @param calque */ - private void addEbliNode(final EGFillePanel pn, TrPostVisuPanel calque) { + private void addEbliNode(final EGFillePanel pn, final TrPostVisuPanel calque) { final EbliNodeDefault nodeG = new EbliNodeDefault(); nodeG.setCreator(new EbliWidgetCreatorGraphe(pn)); nodeG.setTitle("Graphe " + idxFilleG_++); @@ -1018,19 +1018,12 @@ getSelectedFilleLayout().addNode(nodeG); pn.getGraphe().restore(); - // -- ajout du menu specifique de fusion des graphes --// - // EbliWidgetGraphe grapheWidget=null; - // if(nodeG.getWidget() instanceof EbliWidgetBordureSingle) - // grapheWidget=(EbliWidgetGraphe) - // ((EbliWidgetBordureSingle)nodeG.getWidget()).getIntern(); - // else - // grapheWidget=(EbliWidgetGraphe) nodeG.getWidget(); - // new TrPostActionFusionGraphes(grapheWidget, nodeG, - // TrPostProjet.this); + nodeG.getWidget().getController().setDescription(formatInfoSource(calque.getSourceCalque())); } }); + getSelectedFilleLayout().getScene().refresh(); } @@ -1266,7 +1259,7 @@ EbliNode node = filleLayout.addCalque("Calque", location, pnVisu.getPreferredSize(), pnVisu, legendeCalque); // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription(formatInfoSource(getSource(0))); + // -- decoration de la fille layout --// decoreFilleVisu(); 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 2008-09-17 17:09:01 UTC (rev 3948) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2008-09-17 20:01:07 UTC (rev 3949) @@ -101,7 +101,7 @@ case 1: return p.formatName(src.getTitle()); case 2: - return p.formatFichier(src.getFile()); + return src.getFile().getAbsolutePath(); case 3: return new Date(src.getFile().lastModified()); case 4: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-21 18:52:24
|
Revision: 3963 http://fudaa.svn.sourceforge.net/fudaa/?rev=3963&view=rev Author: deniger Date: 2008-09-21 18:52:19 +0000 (Sun, 21 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/repere/ZTransformationDomaine.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/EbliWidgetBordureSingle.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/EbliWidgetVueCalque.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/tree/EbliWidgetTreeTableNode.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/tr/post/TrIsoLayer.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/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/repere/ZTransformationDomaine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/repere/ZTransformationDomaine.java 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/repere/ZTransformationDomaine.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -105,10 +105,10 @@ private void endRapide(final boolean _cursor) { if (rapideIsDone_) { rapideIsDone_ = false; - if (_cursor) { - updateCursor(defaultCursor_); - } } + if (_cursor) { + updateCursor(defaultCursor_); + } } public static int getHPaint(final Dimension _size, final Insets _insets) { @@ -263,12 +263,8 @@ public void mouseDragged(final MouseEvent _e) { - if (_e.getModifiers() != InputEvent.BUTTON1_MASK) { - return; - } - if (isOut_) { - return; - } + if (_e.getModifiers() != InputEvent.BUTTON1_MASK) { return; } + if (isOut_) { return; } if (!rapideIsDone_ && initBoite_ != null) { updateCursor(getMoveCursor()); rapideIsDone_ = true; @@ -297,9 +293,7 @@ public void mousePressed(final MouseEvent _e) { requestFocus(); - if (!isInVue(_e)) { - return; - } + if (!isInVue(_e)) { return; } initBoite_ = getReelBoiteDisplayed(); initXEcran_ = _e.getX(); initYEcran_ = _e.getY(); @@ -316,12 +310,8 @@ vueCalque_.zoomOnRealPoint(p.x_, p.y_, _e.isShiftDown()); return; } - if (_e.getModifiers() != InputEvent.BUTTON1_MASK) { - return; - } - if (isOut_) { - return; - } + if (_e.getModifiers() != InputEvent.BUTTON1_MASK) { return; } + if (isOut_) { return; } if (initBoite_ == null && _e.getClickCount() == 1) { final GrBoite b = getReelBoiteDisplayed(); final GrPoint pClicked = new GrPoint(_e.getPoint()); @@ -372,9 +362,7 @@ // Evenements public void propertyChange(final PropertyChangeEvent _evt) { if ("rapide".equals(_evt.getPropertyName()) || "ajustement".equals(_evt.getPropertyName()) - || "versReel".equals(_evt.getPropertyName())) { - return; - } + || "versReel".equals(_evt.getPropertyName())) { return; } if ("versEcran".equals(_evt.getPropertyName())) { totale_ = null; updateTooltip(); @@ -410,20 +398,13 @@ } private void updateCursor(final Cursor _c) { - if (_c == oldCursor_) { - return; - } + if (_c == oldCursor_) { return; } oldCursor_ = _c; - final JRootPane root = SwingUtilities.getRootPane(this); - if (root != null) { - root.setCursor(_c); - } + setCursor(_c); } public void translate(final double _x, final double _y, final boolean _ajustement) { - if (initBoite_ == null) { - return; - } + if (initBoite_ == null) { return; } if (v_ == null) { v_ = new GrVecteur(); } 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -5,12 +5,14 @@ import java.awt.Point; import java.beans.PropertyChangeListener; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; @@ -19,6 +21,7 @@ import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; +import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimatedItem; import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.Widget; @@ -119,6 +122,10 @@ } + public List<EbliWidgetAnimatedItem> getAnimatedItems() { + return null; + } + protected void editingStop() { isInEditMode_ = false; getEbliScene().getController().fireEditStop(this); 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -2,10 +2,12 @@ import java.awt.Insets; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimatedItem; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; /** @@ -32,6 +34,11 @@ public EbliAnimatedInterface getAnimatedInterface() { return getIntern().getAnimatedInterface(); } + + @Override + public List<EbliWidgetAnimatedItem> getAnimatedItems() { + return getIntern().getAnimatedItems(); + } EbliWidgetControllerActionOnly controllerBordure_ = null; 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -8,17 +8,27 @@ import java.awt.Dimension; import java.awt.image.BufferedImage; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import javax.swing.JDialog; + +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.animation.EbliAnimationAction; import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; import org.fudaa.ebli.animation.EbliAnimationComposite; import org.fudaa.ebli.animation.EbliAnimationSourceAbstract; import org.fudaa.ebli.animation.EbliAnimationSourceInterface; +import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Widget; /** @@ -38,7 +48,10 @@ EbliAnimationAction act = new EbliAnimationAction(this) { @Override public void updateBeforeShow() { - super.setAnimAdapterInterface(findAnimAdapter()); + EbliAnimationAdapterInterface adapter = findAnimAdapter(); + EbliWidgetAnimAdapter.this.setAdapter(adapter); + super.setAnimAdapterInterface(adapter); + updateStateBeforeShow(); } }; act.setEnabled(true); @@ -46,16 +59,42 @@ } public EbliAnimationAdapterInterface findAnimAdapter() { - List<Widget> children = scene_.getLayerVisu().getChildren(); - List<EbliAnimationSourceInterface> anims = new ArrayList<EbliAnimationSourceInterface>(); - for (Widget widget : children) { - EbliWidget ew = (EbliWidget) widget; - EbliAnimatedInterface animatedInterface = ew.getAnimatedInterface(); - if (animatedInterface != null) { - anims.add(animatedInterface.getAnimationSrc()); + LayerWidget widget = scene_.getVisu(); + DefaultMutableTreeTableNode animsNode = new DefaultMutableTreeTableNode(); + findAnimsTreeNode(widget, animsNode); + JDialog d = new JDialog(); + d.setContentPane(new JXTreeTable(new DefaultTreeTableModel(animsNode))); + d.pack(); + d.setVisible(true); + return null; + } + + private void findAnimsTreeNode(Widget widget, DefaultMutableTreeTableNode animsNode) { + List<Widget> children = widget.getChildren(); + for (Widget w : children) { + EbliWidget ew = (EbliWidget) w; + EbliNode n = (EbliNode) scene_.findObject(ew); + if (n.getWidget() == ew) { + EbliAnimatedInterface animatedInterface = ew.getAnimatedInterface(); + if (animatedInterface != null) { + + EbliAnimationSourceInterface animationSrc = animatedInterface.getAnimationSrc(); + DefaultMutableTreeTableNode treeNode = new DefaultMutableTreeTableNode(new EbliWidgetAnimatedItem( + animationSrc, null, n.getTitle())); + List<EbliWidgetAnimatedItem> animatedItems = ew.getAnimatedItems(); + if (CtuluLibArray.isNotEmpty(animatedItems)) { + for (EbliWidgetAnimatedItem ebliWidgetAnimatedItem : animatedItems) { + treeNode.add(new DefaultMutableTreeTableNode(ebliWidgetAnimatedItem)); + } + + animsNode.add(treeNode); + } + } else { + findAnimsTreeNode(ew, animsNode); + } + } } - return (new EbliAnimationComposite(anims.toArray(new EbliAnimationSourceInterface[anims.size()]))); } public Component getComponent() { Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -0,0 +1,83 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import javax.swing.Icon; + +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; + +/** + * @author deniger + */ +public class EbliWidgetAnimatedItem { + + /** + * L'interface d'animation + */ + private EbliAnimationAdapterInterface animated_; + /** + * L'icone + */ + private Icon icon_; + + /** + * L'identifiant + */ + private String id_; + + public EbliWidgetAnimatedItem() { + } + + + public EbliWidgetAnimatedItem(EbliAnimationAdapterInterface _animated, Icon _icon, String _id) { + super(); + animated_ = _animated; + icon_ = _icon; + id_ = _id; + } + + /** + * @return the animated + */ + public EbliAnimationAdapterInterface getAnimated() { + return animated_; + } + + /** + * @return the icon + */ + public Icon getIcon() { + return icon_; + } + + /** + * @return the id + */ + public String getId() { + return id_; + } + + /** + * @param _animated the animated to set + */ + public void setAnimated(EbliAnimationAdapterInterface _animated) { + animated_ = _animated; + } + + /** + * @param _icon the icon to set + */ + public void setIcon(Icon _icon) { + icon_ = _icon; + } + + /** + * @param _id the id to set + */ + public void setId(String _id) { + id_ = _id; + } + +} 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -6,20 +6,26 @@ import java.awt.Rectangle; import java.awt.Window; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Observable; +import java.util.Observer; import javax.swing.BorderFactory; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimatedItem; import org.netbeans.api.visual.action.InplaceEditorProvider; import org.netbeans.api.visual.widget.Widget; @@ -66,7 +72,17 @@ setPreferredSize(new Dimension(500, 400)); initSize(new Rectangle(0, 0, 500, 400)); + calquePanel_.getArbreCalqueModel().getObservable().addObserver(new Observer() { + public void update(Observable _o, Object _arg) { + if (!isInEditMode() && "t".equals(_arg)) { + image = null; + // repaint(); + } + + } + }); + } public BuPanel createEditorComponent( @@ -195,4 +211,15 @@ return false; } + public List<EbliWidgetAnimatedItem> getAnimatedItems() { + BCalque[] cqs = calquePanel_.getVueCalque().getCalque().getTousCalques(); + List<EbliWidgetAnimatedItem> res = new ArrayList<EbliWidgetAnimatedItem>(20); + for (int i = 0; i < cqs.length; i++) { + if (cqs[i].isVisible() && cqs[i] instanceof EbliAnimationAdapterInterface) { + res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], cqs[i].getName())); + } + } + return res; + } + } 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -13,6 +13,7 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; +import javax.swing.tree.TreeModel; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; @@ -25,6 +26,7 @@ import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGSpecificActions; +import org.fudaa.ebli.courbe.EGTableGraphePanel; import org.fudaa.ebli.courbe.EGTree; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -197,14 +199,10 @@ }); } - - - - public boolean hasLegende() { return widget_.getEbliScene().isObject(widgetGraphe_.getNodeLegende()); } - + public void ajoutLegende() { // -- creation de la l\xE9gende --// if (widget_.getEbliScene() != null) { @@ -331,29 +329,18 @@ public JComponent getOverviewComponent() { if (panelTreeGraphe_ == null) { - - // EGTree tree = new EGTree(); - // tree.setExpandsSelectedPaths(true); - // tree.setActions(new EGSpecificActions(getGraphe())); - // EGGrapheTreeModel treeModel = (EGGrapheTreeModel) - // getGraphe().getModel(); - // tree.setModel(treeModel); - // tree.setSelectionModel(treeModel.getSelectionModel()); - // panelTreeGraphe_ = new JScrollPane(tree); - EGTree tree = new EGTree(); - // tree.setExpandsSelectedPaths(true); tree.setActions(new EGSpecificActions(getGraphe())); EGGrapheTreeModel treeModel = (EGGrapheTreeModel) getGraphe().getModel(); tree.setModel(treeModel); tree.setSelectionModel(treeModel.getSelectionModel()); - - JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - splitPane.setTopComponent(getGraphePanel().getInfoPanel()); - splitPane.setBottomComponent(new JScrollPane(tree)); - splitPane.setDividerLocation(0.3D); - - panelTreeGraphe_ = splitPane; + JSplitPane pane = new JSplitPane(); + pane.setDividerLocation(0.3D); + pane.setTopComponent(new JScrollPane(tree)); + final EGTableGraphePanel tablePanel = new EGTableGraphePanel(); + tablePanel.setGraphe(getGraphe()); + pane.setBottomComponent(tablePanel); + panelTreeGraphe_ = pane; } return panelTreeGraphe_; 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -60,21 +60,13 @@ } public Object getValueAt(int _column) { - if (root) - return "root"; - if (_column == 0) { - return getUserObject(); - } - if (_column == 1) { - return ((EbliNodeDefault) getUserObject()).getTitle(); - } - if (_column == 2) - return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().isVisible()); - - - return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().getController().isBlocked); - - + if (root) return "root"; + if (_column == 0) { return getUserObject(); } + if (_column == 1) { return ((EbliNodeDefault) getUserObject()).getTitle(); } + if (_column == 2) return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().isVisible()); + + return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().getController().isBlocked); + } @Override @@ -85,49 +77,41 @@ @Override public void setValueAt(Object _value, int _column) { if (!root) { - if (_column == 1) - ((EbliNode) getUserObject()).setTitle((String) _value); + if (_column == 1) ((EbliNode) getUserObject()).setTitle((String) _value); else if (_column == 2) { // -- mise a jour du masquage --// ((EbliNode) getUserObject()).getWidget().setVisible(((Boolean) _value).booleanValue()); - - - // -- reference vers le gestionnaire de commandeundo/redo --// - final CtuluCommandContainer cmd_ = ((EbliNode) getUserObject()).getWidget().getEbliScene() - .getCmdMng(); - ArrayList<EbliWidget> listeWidgetUndo = new ArrayList<EbliWidget>(); - listeWidgetUndo.add(((EbliNode) getUserObject()).getWidget()); - - // -- cas particulier si il s agit d un calque ou d un graphe, on masque + + // -- reference vers le gestionnaire de commandeundo/redo --// + final CtuluCommandContainer cmd_ = ((EbliNode) getUserObject()).getWidget().getEbliScene().getCmdMng(); + ArrayList<EbliWidget> listeWidgetUndo = new ArrayList<EbliWidget>(); + listeWidgetUndo.add(((EbliNode) getUserObject()).getWidget()); + + // -- cas particulier si il s agit d un calque ou d un graphe, on masque // les sous fils --// if ((((EbliNode) getUserObject()).getWidget()) instanceof EbliWidgetBordureSingle && (((EbliNode) getUserObject()).getWidget()).getChildren() != null) { - - - if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetVueCalque) { - EbliWidgetVueCalque wid = (EbliWidgetVueCalque) (((EbliNode) getUserObject()).getWidget()) - .getChildren().get(0); - wid.nodeLegende.getWidget().setVisible(((Boolean) _value).booleanValue()); + + if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetVueCalque) { + EbliWidgetVueCalque wid = (EbliWidgetVueCalque) (((EbliNode) getUserObject()).getWidget()).getChildren() + .get(0); + wid.nodeLegende.getWidget().setVisible(((Boolean) _value).booleanValue()); listeWidgetUndo.add(wid.nodeLegende.getWidget()); - - } else - if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetGraphe) { + + } else if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetGraphe) { EbliWidgetGraphe wid = (EbliWidgetGraphe) (((EbliNode) getUserObject()).getWidget()).getChildren().get(0); wid.getNodeLegende().getWidget().setVisible(((Boolean) _value).booleanValue()); listeWidgetUndo.add(wid.getNodeLegende().getWidget()); - } - } - - // -- ajout de la commande undo/redo pour l ensemble des widgets + } + } + + // -- ajout de la commande undo/redo pour l ensemble des widgets // masquees --// cmd_.addCmd(new CommandMasquer(listeWidgetUndo, ((Boolean) _value).booleanValue())); - - - + ((EbliNode) getUserObject()).getWidget().getEbliScene().refresh(); - } - else if (_column == 3) { + } else if (_column == 3) { // -- bloque debloque --// ((EbliNode) getUserObject()).getWidget().getController().excecuteBlockOrDeblock(); } 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -113,23 +113,32 @@ */ protected boolean useNewHelp_; + /** + * + */ + public static final String RIGHT_COMPONENT_IN_SCROLL = "useScrollPane"; + private void addRightComponent(final CtuluFilleWithComponent _comp) { - if (oldRightComponent_ == null || _comp == null) { - return; - } + if (oldRightComponent_ == null || _comp == null) { return; } _comp.majComponent(oldRightComponent_); oldRightComponent_.setToolTipText(_comp.getComponentTitle()); - if (rightC_ == null) { - rightC_ = new JScrollPane(oldRightComponent_); - // rightC_.setSize(250, 150); - rightC_.setPreferredSize(new Dimension(175, 350)); - rightC_.setVisible(true); + JComponent toUse = null; + if (oldRightComponent_.getClientProperty(RIGHT_COMPONENT_IN_SCROLL) == Boolean.FALSE) { + toUse = oldRightComponent_; } else { - rightC_.setViewportView(oldRightComponent_); - // rightC_.setPreferredSize(new Dimension(150, 350)); + if (rightC_ == null) { + rightC_ = new JScrollPane(oldRightComponent_); + // rightC_.setSize(250, 150); + rightC_.setPreferredSize(new Dimension(175, 350)); + rightC_.setVisible(true); + } else { + rightC_.setViewportView(oldRightComponent_); + // rightC_.setPreferredSize(new Dimension(150, 350)); + } + toUse = rightC_; } getMainPanel().getRightColumn().addToggledComponent(_comp.getComponentTitle(), "TOGGLE_SPEC", - BuResource.BU.getToolIcon("arbre"), rightC_, rightC_.isVisible(), this).setToolTipText( + BuResource.BU.getToolIcon("arbre"), toUse, toUse.isVisible(), this).setToolTipText( FudaaLib.getS("Afficher/Cacher") + CtuluLibString.ESPACE + _comp.getComponentTitle()); getMainPanel().updateSplits(); } @@ -280,9 +289,7 @@ */ protected void exportImage() { final JInternalFrame frame = getCurrentInternalFrame(); - if (frame == null) { - return; - } + if (frame == null) { return; } if (frame instanceof CtuluImageProducer) { CtuluImageExport.exportImageFor(this, (CtuluImageProducer) frame); } @@ -290,9 +297,7 @@ protected void exportImageInClipboard() { final JInternalFrame frame = getCurrentInternalFrame(); - if (frame == null) { - return; - } + if (frame == null) { return; } if (frame instanceof CtuluImageProducer) { final BufferedImage produceImage = ((CtuluImageProducer) frame).produceImage(null); final CtuluTaskDelegate task = createTask(FudaaLib.getS("Enregistrement dans le presse-papier")); @@ -586,8 +591,8 @@ } /** - * Permet d'afficher une url <code>_url</code> dans un browser. Le browser est choisi en fonction des preferences (<code>browser.type</code>). - * Si l'url ne commence pas par http, elle est modifiee en fonction de la plate-forme. + * Permet d'afficher une url <code>_url</code> dans un browser. Le browser est choisi en fonction des preferences ( + * <code>browser.type</code>). Si l'url ne commence pas par http, elle est modifiee en fonction de la plate-forme. * * @see CtuluLibString#pathToUrl(String) * @param _url l'url (http) ou le chemin du fichier a afficher @@ -870,9 +875,7 @@ } public boolean manageAnalyzeAndIsFatal(final CtuluAnalyze _analyze) { - if (_analyze == null) { - return false; - } + if (_analyze == null) { return false; } if (!_analyze.isEmpty()) { _analyze.printResume(); } @@ -898,9 +901,7 @@ if (_opResult.getClosingException() != null) { CtuluLibMessage.error("FATAL :can't close " + _opResult.getAnalyze().getResource()); } - if (_opResult.getAnalyze() != null) { - return manageAnalyzeAndIsFatal(_opResult.getAnalyze()); - } + if (_opResult.getAnalyze() != null) { return manageAnalyzeAndIsFatal(_opResult.getAnalyze()); } return false; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayer.java 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayer.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -226,6 +226,7 @@ paletteCouleur_.setSousTitre(getIsoModel().getTimeSelected()); updateLegendeTitre(); fireSelectionEvent(); + firePropertyChange("t", true, false); repaint(); } 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheLayer.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -109,9 +109,7 @@ } protected void changeTimeStep() { - if (timeSelection_ == null) { - return; - } + if (timeSelection_ == null) { return; } final int i = timeSelection_.getMinSelectionIndex(); initModel_.setTimeIdx(i); if (paletteCouleur_ != null) { @@ -119,6 +117,7 @@ } updateLegendeTitre(); fireSelectionEvent(); + firePropertyChange("t", true, false); updateCalqueInfo(); repaint(); } @@ -172,9 +171,7 @@ } protected void setPaletteCouleur(final BPalettePlageAbstract _paletteCouleur) { - if (_paletteCouleur == null) { - return; - } + if (_paletteCouleur == null) { return; } super.setPaletteCouleur(_paletteCouleur); updateLegendeTitre(); } @@ -195,9 +192,7 @@ } protected void construitLegende() { - if (!isPaletteCouleurUsed_) { - return; - } + if (!isPaletteCouleurUsed_) { return; } super.construitLegende(); } @@ -211,9 +206,7 @@ } initPaletteMap(); final String v = initModel_.getSelectedVarName(); - if (CtuluLibString.isEmpty(v)) { - return; - } + if (CtuluLibString.isEmpty(v)) { return; } BPalettePlage s = (BPalettePlage) namePalette_.get(v); if (s == null) { s = new BPalettePlage(); @@ -245,9 +238,7 @@ } public boolean changeSonde(final GrPoint _pt) { - if (!isSondeEnable()) { - return false; - } + if (!isSondeEnable()) { return false; } if (sondePt_ == null) { sondePt_ = new GrPoint(); } @@ -294,9 +285,7 @@ public void dataChanged(final H2dVariableType _old, final H2dVariableType _new, final boolean _contentChanged, final boolean _isFleche, final Set _varDepending) { - if (!_isFleche) { - return; - } + if (!_isFleche) { return; } if (_old == initModel_.current_.getVar() || _varDepending.contains(initModel_.current_.getVar())) { // la variable en cours d'affichage est modifi\xE9e if (_old != _new && _old == initModel_.current_.getVar()) { @@ -370,9 +359,7 @@ } public EbliFindExpressionContainerInterface getExpressionContainer() { - if (isGrilleActivated()) { - return super.getExpressionContainer(); - } + if (isGrilleActivated()) { return super.getExpressionContainer(); } return new EbliFindExpressionComposite(new CalqueFindFlecheExpression(initModel_, true), new TrPostExprFlecheSupplier(initModel_)); } @@ -476,16 +463,12 @@ } public int[] getSelectedElementIdx() { - if (isSelectionElementEmpty()) { - return null; - } + if (isSelectionElementEmpty()) { return null; } return getSelectedIndex(); } public int[] getSelectedPtIdx() { - if (isSelectionPointEmpty()) { - return null; - } + if (isSelectionPointEmpty()) { return null; } return getSelectedIndex(); } @@ -543,12 +526,8 @@ */ public void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage) { - if (getListSelectionModel().isSelectionEmpty()) { - return; - } - if (_newPlage == null) { - return; - } + if (getListSelectionModel().isSelectionEmpty()) { return; } + if (_newPlage == null) { return; } final boolean old = isPaletteCouleurUsed_; super.setPaletteCouleurPlages(_newPlage); // si c'est la premiere fois, il faut mettre \xE0 jour les titres @@ -579,9 +558,7 @@ } public void valueChanged(final ListSelectionEvent _e) { - if (_e.getValueIsAdjusting()) { - return; - } + if (_e.getValueIsAdjusting()) { return; } if (_e.getSource() == timeSelection_) { changeTimeStep(); } else { 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -37,6 +37,7 @@ import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.netbeans.api.visual.widget.Widget; @@ -179,7 +180,9 @@ */ public JComponent createPanelComponent() { if (right_ == null) { + right_ = new JPanel(new BorderLayout()); + right_.putClientProperty(FudaaCommonImplementation.RIGHT_COMPONENT_IN_SCROLL, Boolean.FALSE); toggleTree_ = new JButton(TrLib.getString("Arbre")); toggleTree_.setText("Composants"); @@ -506,6 +509,7 @@ // conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); changeSouth(_widget); right_.revalidate(); + right_.repaint(); } 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 2008-09-19 17:49:30 UTC (rev 3962) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-21 18:52:19 UTC (rev 3963) @@ -526,17 +526,6 @@ init.add(new TrPostActionChooseAndCreateCalque(projet_, this)); init.add(null); init.add(new EbliWidgetAnimAdapter(getSceneCourante()).createAction()); - // -- action qui permet d ajouter un point du calque dans tous les graphes - // selectionnes --// - // init.add(new TrPostActionAddPointFromWidgetCalque(getSceneCourante(), - // projet_.impl_)); - // init.add(new - // TrPostActionAddPointFromWidgetCalque.Temporel(getSceneCourante(), - // projet_.impl_)); - // init.add(new - // TrPostActionAddPointFromWidgetCalque.Spatial(getSceneCourante(), - // projet_.impl_)); - // init.add(null); actions_ = Collections.unmodifiableList(init); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-18 13:02:24
|
Revision: 3950 http://fudaa.svn.sourceforge.net/fudaa/?rev=3950&view=rev Author: hadouxad Date: 2008-09-18 20:02:30 +0000 (Thu, 18 Sep 2008) Log Message: ----------- - correction de la plupart des bugs restant de la fiche de retour de recette - modifs des copier/couper/coller duplicate et change de scene: fonctionne ok - correction bug mise a jour du tree du graphe. fonctionne ok - fonctionnalit?\195?\169 comparaison de projet g?\195?\169n?\195?\168re une widget qui contient le visupanel fusion Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.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/actions/EbliWidgetActionDuplicate.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/graphe/EbliWidgetControllerGraphe.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/TrPostActionChangeSceneForWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.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/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -27,6 +27,8 @@ protected BuButton btValider_; protected BuButton btAnnuler_; protected BuComboBox chValeur_; + + protected BuLabelMultiLine lbValeur_; protected BuLabelMultiLine lbCommentaire_; @@ -79,6 +81,10 @@ content_.add(pnb,BuBorderLayout.SOUTH); } + public BuComboBox getChValeur() { + return chValeur_; + } + public JComponent getComponent() { chValeur_=new BuComboBox(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -13,6 +13,8 @@ EbliWidget nodeWidget_; + + public String getTitle() { return title; } 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -203,10 +203,12 @@ protected Widget attachNodeWidget(EbliNode node) { // -- creation de la widget ici --// - if (node.getWidget() == null) + // if (node.getWidget() == null) // -- on ne cree la widget que sis necessaire node.setWidget(node.getCreator().create(this)); - + // else + // node.getWidget().setScene(this); + // // -- remplissage des proprietes node.getWidget().setPreferredLocation(node.getPreferedLocation()); if (node.getPreferedSize() != null) node.getWidget().setPreferredSize(node.getPreferedSize()); 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -79,6 +79,8 @@ // -- ajout du node dans la scene --// sceneDestination_.addNode(node); + node.getWidget().getController().postActionDuplication(currentNode, node); + node.getWidget().getController().setDescription(currentNode.getWidget().getController().getDescription()); // -- ajout du noeud --// listeNouveauxNodes.add(node); 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -353,7 +353,7 @@ // pour activer l'action chooserT.setSelected(true); combo = (BSelecteurListComboBox) chooserT.buildContentPane(); - chooserT.updateBeforeShow(); + chooserT.updateBeforeShow(); combo.setMaximumSize(combo.getPreferredSize()); combo.setMinimumSize(combo.getPreferredSize()); 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.graphe; +import java.awt.BorderLayout; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -10,8 +11,8 @@ import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; +import javax.swing.JPanel; import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; @@ -57,7 +58,8 @@ BuMenuBar menuGraphe_ ; - JScrollPane panelTreeGraphe_ ; + // JScrollPane panelTreeGraphe_; + JPanel panelTreeGraphe_; BuToolBar toolbarGraphe_ ; @@ -71,7 +73,7 @@ widgetGraphe_ = widget_; labelTrace_ = (JLabel) CtuluLibSwing.findChildByName(getGraphePanel(), "lbTools"); - getGraphePanel().remove(labelTrace_); + // getGraphePanel().remove(labelTrace_); addActionSpecifiques(); } @@ -329,14 +331,27 @@ if (panelTreeGraphe_ == null) { - EGTree tree = new EGTree(); - tree.setExpandsSelectedPaths(true); + // EGTree tree = new EGTree(); + // tree.setExpandsSelectedPaths(true); + // tree.setActions(new EGSpecificActions(getGraphe())); + // EGGrapheTreeModel treeModel = (EGGrapheTreeModel) + // getGraphe().getModel(); + // tree.setModel(treeModel); + // tree.setSelectionModel(treeModel.getSelectionModel()); + // panelTreeGraphe_ = new JScrollPane(tree); + + + EGTree tree = new EGTree(); + // tree.setExpandsSelectedPaths(true); tree.setActions(new EGSpecificActions(getGraphe())); EGGrapheTreeModel treeModel = (EGGrapheTreeModel) getGraphe().getModel(); tree.setModel(treeModel); tree.setSelectionModel(treeModel.getSelectionModel()); - panelTreeGraphe_ = new JScrollPane(tree); + panelTreeGraphe_ = new JPanel(new BorderLayout()); + panelTreeGraphe_.add(tree); + + } return panelTreeGraphe_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -6,7 +6,6 @@ import java.util.Set; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -14,10 +13,7 @@ import org.fudaa.ebli.visuallibrary.actions.CommandeChangeWidgetScene; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.fudaa.tr.common.TrLib; -import org.fudaa.fudaa.tr.common.TrResource; -import com.memoire.bu.BuDialogChoice; - /** * Creation de l action cahngement de sscene pruo le widget qui g\xE8re le multi-layout. Chooser qui demande la fille * layout puis autre chooser qui demande l'onglet. Si la fille est unique pas de chooser idem pour l onglet de la fille @@ -66,9 +62,17 @@ scene_.refresh(); + + String previousDescr = ""; + if (currentNode.getWidget() != null) + previousDescr = currentNode.getWidget().getController().getDescription(); + // -- ajout du node dans la scene destination --// sceneDestination.addNode(currentNode); + if (previousDescr != null) + currentNode.getWidget().getController().setDescription(previousDescr); + // -- rafraichissement de la scene --// sceneDestination.refresh(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -1,7 +1,6 @@ package org.fudaa.fudaa.tr.post; import java.awt.event.ActionEvent; -import java.util.Iterator; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -9,8 +8,6 @@ import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.fudaa.tr.common.TrResource; -import com.memoire.bu.BuDialogChoice; -import com.memoire.bu.BuDialogError; import com.memoire.bu.BuResource; /** @@ -42,70 +39,27 @@ } - /** - * Methode qui formatte les donnees de la liste. - * - * @return - */ - String[] formattageDonnees() { - String[] listeSimul = new String[projet_.listeSrc_.size()]; - int cpt = 0; - for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { - - TrPostSource src = it.next(); - - - // --ajout dans la liste des titres --// - listeSimul[cpt++] = projet_.formatInfoSource(src); - } - - return listeSimul; - } + public void actionPerformed(ActionEvent _evt) { - - // -- recuperation de la liste des src sous forme de liste --// - String[] values = formattageDonnees(); - // -- ouverture du chooser --// - BuDialogChoice chooser = new BuDialogChoice(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - TrResource.getS("Cr\xE9ation d'un calque"), TrResource.getS("S\xE9lectionnez le jeux de donn\xE9es "), values); - - int response = chooser.activate(); - - if (response == 0) { - - int indiceSOURCESelect = chooser.getSelectedIndex(); - - if (indiceSOURCESelect >= projet_.listeSrc_.size()) { - new BuDialogError(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - TrResource - .getS("La source s\xE9lecionn\xE9e n'existe pas")).activate(); - return; - } - - - - - // -- TRES IMPORTANT: on cree le calque en precisant l indice de la SOURCE + TrPostSource srcChoisie = projet_.getChooserMultiSources(-1); + if (srcChoisie == null) { + projet_.impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } + // -- TRES IMPORTANT: on cree le calque en precisant l indice de la SOURCE // SELECTIONNEE --// CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(getScene(), null); - TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, legendeCalque, projet_ - .getSource(indiceSOURCESelect)); + TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, legendeCalque, srcChoisie); EbliNode node = controller_.addCalque(TrResource.getS("Calque"), pnVisu.getLocation(), pnVisu .getPreferredSize(), pnVisu, legendeCalque); - - // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription("Source: " + values[indiceSOURCESelect]); - - - - - } - } + node.getWidget().getController().setDescription("Source: " + projet_.formatInfoSource(srcChoisie)); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -358,16 +358,13 @@ // -- remplisage combo --// remplirCombo(); - dialog_ = new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource - .getS("Fusion avec un autre graphe ")); + dialog_ = new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource.getS("Fusion avec un autre graphe ")); if (content_ == null) content_ = constructPanel(); - dialog_.setContentPane(content_); dialog_.setSize(400, 250); - dialog_.setModal(true); - + dialog_.setTitle(TrResource.getS("Fusion avec un autre graphe ")); // dialog_.setLocation(widgetGraphe_.getLocation()); dialog_.activate(); } 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -362,6 +362,8 @@ EbliNode nouveauNode = node.duplicate(null); getScene().addNode(nouveauNode); + + nouveauNode.getWidget().getController().setDescription(node.getWidget().getController().getDescription()); newNodes.add(nouveauNode); // -- duplication des map de property graphique de la widget --// node.getWidget().setPropGraphique(node.getWidget().duplicateGraphicalProperties()); @@ -388,8 +390,17 @@ for (Iterator<EbliNode> it = projet_.nodesCutted.iterator(); it.hasNext();) { EbliNode node = it.next(); // --ajout du node --// - + FuLog.warning("je dois cut/coller " + node.getTitle()); + + String previousDescr=""; + if(node.getWidget()!=null) + previousDescr = node.getWidget().getController().getDescription(); + getScene().addNode(node); + + if (previousDescr != null) + node.getWidget().getController().setDescription(previousDescr); + } // --creation de la commande undo/redo --// if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd( @@ -451,7 +462,7 @@ // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbar(node.getWidget().getController()); - setTitle(previousTitleFrame + " " + node.getWidget().getController().getDescription()); + setTitle(previousTitleFrame + " " + node.getWidget().getController().getDescription(), false); } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { FuLog.warning("change tree GRAPHE"); // -- etape 1: ajout du tree dans fudaaImplementation --// @@ -461,7 +472,7 @@ changeToolbarSpecifiqueGraphe(node.getWidget().getController(), (EbliWidgetCreatorGraphe) node.getCreator()); - setTitle(previousTitleFrame + " " + node.getWidget().getController().getDescription()); + setTitle(previousTitleFrame + " " + node.getWidget().getController().getDescription(), false); } else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTreeScene(); @@ -474,13 +485,23 @@ + boolean ecrasePrevious_=true; - @Override public void setTitle(String _title) { super.setTitle(_title); + if (ecrasePrevious_) previousTitleFrame = title; + else + ecrasePrevious_ = true; } + public void setTitle(String _title, boolean ecrasePrevious) { + ecrasePrevious_ = ecrasePrevious; + this.setTitle(_title); + + + } + public Dimension getDefaultImageDimension() { return getScene().getDefaultImageDimension(); } 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -93,6 +93,7 @@ import com.db4o.ext.Db4oException; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuButton; +import com.memoire.bu.BuDialogChoice; import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuGlassPaneStop; import com.memoire.bu.BuHorizontalLayout; @@ -262,7 +263,7 @@ } - + transient TrPostFille fille_; /** @@ -271,10 +272,10 @@ */ // protected transient TrPostLayoutFille filleLayout_; - + ArrayList<TrPostLayoutFille> listeFillesLayout = new ArrayList<TrPostLayoutFille>(); - + /** * liste des noeuds pour gerer le cut/copy/paste avec en + le undo/redo */ @@ -282,7 +283,7 @@ Set<EbliNode> nodesCopyied = null; // liste des noeuuds coupes Set<EbliNode> nodesCutted = null; - + /** *ajout une fillelayout a la liste des frame layout * @@ -290,7 +291,7 @@ */ public void addFillesLayout(TrPostLayoutFille _fille) { listeFillesLayout.add(_fille); - + // -- ajout dans le menu post d'un onglet de la fenetre --// // if (listeFillesLayout.size() > 1) { // //-- ajout du separator des filles layout --// @@ -319,24 +320,24 @@ // sinon retourne la premier frame return listeFillesLayout.get(0); } - - + + transient BuInternalFrame frVariables_; - + /** * internalframe qui gere les multiProjets */ public TrPostProjetsManagerFille filleProjetctManager_; - + /** * Le menu du post qui contient tout les sous menus des projets */ BuMenu menuPost_; BuMenu menuLayout_ = new BuMenu(TrResource.getS("Layout"), "LAYOUTMANAGER");; List<BuMenu> listeMenuProjets_; - + List<ArrayList<BuMenuItem>> listeSousMenuProjets_; - + /** * Observable custom reserv\xE9 aux modifs apport\xE9es a la liste des src. * @@ -352,25 +353,25 @@ this.setChanged(); super.notifyObservers(arg); } - + } - + private observableSupport observable; - + public observableSupport getObservable() { - if (observable == null) + if (observable == null) observable = new observableSupport(); - return observable; + return observable; } - + public void notifyObservers() { // getObservable().setChanged(); getObservable().notifyObservers(); } - - + + int idx_; transient int idxFilleG_; @@ -388,7 +389,7 @@ * liste des sources pour le multiProjet. */ transient ArrayList<TrPostSource> listeSrc_ = new ArrayList<TrPostSource>(); - + transient TimeContentUpdater timeUpdater_; /** @@ -397,18 +398,18 @@ public TrPostProjet(final TrPostSource _src) { src_ = _src; src_.addVariableListener(new VariableListener()); - + // -- ajout de la source de base dans la liste de sources --// ajouterSource(_src); - - + + // -- creation de la frame de gestion multi projet --// filleProjetctManager_ = new TrPostProjetsManagerFille(this); - - + + } - - + + public TrPostProjet(final TrPostSource _src, final TrPostCommonImplementation _impl) { this(_src); impl_ = _impl; @@ -422,22 +423,23 @@ * @param _src */ public void ajouterSource(TrPostSource _src) { - if (!isSourceLoaded(_src.getFile().getAbsolutePath())) { + + if (_src.getFile() == null || !isSourceLoaded(_src.getFile().getAbsolutePath())) { listeSrc_.add(_src); - - + + // -- ajout du menu correspondant uniquement a partir de la 2eme --// if (listeSrc_.size() > 1) - construitMenuPostSpecifiqueSource(_src); - + construitMenuPostSpecifiqueSource(_src); + } else { // -- messqge d erreur: le fichier est deja ouvert --// new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), - "Le fichier.").activate(); + "Le fichier est deja ouvert.").activate(); } - + } /** @@ -455,13 +457,13 @@ if (src.getFile().getAbsolutePath().equals(_file)) return src; } - + return null; } - - - + + + /** * indique si il existe une source portant le nom du fichier en param. * @@ -475,7 +477,7 @@ return true; } - + /** * methode qui change la source courante et retourne true si la source existe * bien, false sinon @@ -490,8 +492,8 @@ return true; } - + /** * Methode de suppression de la source * @@ -500,42 +502,41 @@ * effectuee. */ public boolean removeSource(TrPostSource src, int n) { - + if (isSourceLoaded(src.getFile().getAbsolutePath())) { - listeSrc_.remove(src); - - // --recuperation du menu simul --// + listeSrc_.remove(src); + + // --recuperation du menu simul --// BuMenu menuSimul = listeMenuProjets_.get(n); - - // --on retire les menus correspondants --// + + // --on retire les menus correspondants --// for (int i = 0; i < listeSousMenuProjets_.get(n).size(); i++) { BuMenuItem item = listeSousMenuProjets_.get(n).get(i); menuSimul.remove(item); } - + // -- on retire le menuSimul de la liste --// menuPost_.remove(menuSimul); - + // -- on retire de la liste des menus le menusimul et la liste des sous // menus --// listeMenuProjets_.remove(n); listeSousMenuProjets_.remove(n); - + // -- mise a jour de la barre des menus --// impl_.getMainMenuBar().revalidate(); - - return true; + + return true; } else { // -- messqge d erreur: le fichier est deja ouvert --// new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), - "Impossible de supprimer ce fichier de la liste.") - .activate(); + "Impossible de supprimer ce fichier de la liste.").activate(); return false; } - + } - + /** * methode qui formatte les infos de la source * @@ -546,8 +547,10 @@ // --ajout dans la liste des titres --// return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(_src.getFile()); } - + public String formatFichier(File file) { + if (file == null) + return ""; String nomFichier = file.getAbsolutePath(); // int position = nomFichier.lastIndexOf(File.separator) + 1; // if (position != -1) { @@ -569,7 +572,7 @@ */ public String formatName(String title) { // --suppression des trop long espaces du titre --// - + title = title.replaceAll(" ", ""); return title; @@ -582,49 +585,56 @@ * @param _src */ public void construitMenuPostSpecifiqueSource(TrPostSource _src){ - + BuMenu menuSimul = new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFile()), "SIMULATION" + (listeSrc_.size())); - + // -- ajout du menu au menu post --// menuPost_.add(menuSimul); - + // -- sauvegarde d une trace du menu dans la liste pour une suppression // ulterieure --// listeMenuProjets_.add(menuSimul); - + ArrayList<BuMenuItem> listSousMenus = new ArrayList<BuMenuItem>(); - - final BuIcon ic = BuResource.BU.getIcon("aucun"); - - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), "COMPUTE_EXTREMA", ic, TrPostProjet.this)); - listSousMenus.add(menuSimul.addMenuItem(CtuluLib.getS("Editer les variables..."), "VARIABLES", ic, TrPostProjet.this)); - menuSimul.addSeparator(); - listSousMenus.add( menuSimul.addMenuItem(TrResource.getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, TrPostProjet.this)); - listSousMenus.add( menuSimul.addMenuItem(TrResource.getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", ic, + + final BuIcon ic = BuResource.BU.getIcon("aucun"); + + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), "COMPUTE_EXTREMA", ic, TrPostProjet.this)); + listSousMenus.add(menuSimul.addMenuItem(CtuluLib.getS("Editer les variables..."), "VARIABLES", ic, TrPostProjet.this)); - menuSimul.addSeparator(); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, + TrPostProjet.this)); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", + ic, + TrPostProjet.this)); + + menuSimul.addSeparator(); 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")); 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)); - - // -- ajout de la sous liste de menus pour la garder en memoire --// + 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)); + + // -- ajout de la sous liste de menus pour la garder en memoire --// listeSousMenuProjets_.add(listSousMenus); - -} + + } } - - + + /** * Construit le menu Layout. Cette methode doit etre appelee une seule fois */ @@ -632,10 +642,10 @@ //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"), @@ -651,70 +661,68 @@ // listeFillesLayout.size(), "FILLELAYOUT" // + (listeFillesLayout.size() - 1), null, this); // - + menubar.add(menuLayout_, 2); - + } - + /** * Creation par defaut du menu post de l interface. Cette methdoe est appelee * une seule dfois au moment de la creation de l impl. */ public void setMenuPost() { final BuMenuBar menubar = impl_.getMainMenuBar(); - - - menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); - menuPost_.setIcon(null); - menuPost_.setName("mnPost"); - - addSpecificItemInMainMenu(menuPost_); - menubar.add(menuPost_, 2); - - - //-- ajout de l action de gestion des simus dans post --// - BuMenuItem item=new BuMenuItem("Gestion Multi-projets"); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // -- affichage de la fenetre de gestion multi projet --// + menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); + menuPost_.setIcon(null); + menuPost_.setName("mnPost"); + + addSpecificItemInMainMenu(menuPost_); + menubar.add(menuPost_, 2); + + // -- ajout de l action de gestion des simus dans post --// + BuMenuItem item = new BuMenuItem("Gestion Multi-projets"); + item.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // -- affichage de la fenetre de gestion multi projet --// + if (!filleProjetctManager_.isVisible()) { filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, filleProjetctManager_.getSize().height / 2); - - impl_.addInternalFrame(filleProjetctManager_); - } - - - } - }); - - menuPost_.add(item); - menuPost_.addSeparator(TrResource.getS("Vue 2D")); - //-- ajout de l action de creation du calque --// + impl_.addInternalFrame(filleProjetctManager_); + } + + } + + }); + + menuPost_.add(item); + menuPost_.addSeparator(TrResource.getS("Vue 2D")); + // -- ajout de l action de creation du calque --// // menuPost_.add(new TrPostActionChooseAndCreateCalque(this)); - menuPost_.addMenuItem(TrResource.getS("Vue 2D"), "VIEW_2D", BuResource.BU.getIcon("aucun"), TrPostProjet.this); - menuPost_.addSeparator("Liste des projets"); - // -- init de la liste des menus --// + menuPost_.addMenuItem(TrResource.getS("Vue 2D"), "VIEW_2D", BuResource.BU.getIcon("aucun"), TrPostProjet.this); + menuPost_.addSeparator("Liste des projets"); + // -- init de la liste des menus --// listeMenuProjets_ = new ArrayList<BuMenu>(); - - + + listeSousMenuProjets_ = new ArrayList<ArrayList<BuMenuItem>>(); - // -- construction par defaut du premier menu de simulation --// + // -- construction par defaut du premier menu de simulation --// construitMenuPostSpecifiqueSource(getSource(0)); - - + + } - - + + private void showError(final CtuluUI _ui, final File _dbFile, final String _err) { String mess = TrResource.getS("Les sauvegardes ne seront pas effectu\xE9es") - + CtuluLibString.LINE_SEP + + CtuluLibString.LINE_SEP + TrResource.getS("Le fichier de sauvegarde {0} n'est pas accessible:", (_dbFile == null ? "?" : _dbFile .getName())) + (_err == null ? CtuluLibString.EMPTY_STRING : (CtuluLibString.LINE_SEP + _err)); _ui.warn(FudaaSaveLib.getActionSaveTitle(), mess, false); @@ -937,7 +945,7 @@ // trPostProjet.fille_ = compFille; // trPostProjet.filleLayout_ = compFille; addFillesLayout(compFille); - + BuLib.invokeLater(new Runnable() { public void run() { @@ -993,7 +1001,7 @@ // Pour EDF: ajout directement dans la scene du graphe sans passe par une // frame d edition addEbliNode(new EGFillePanel(graphe), calque); - + } /** @@ -1007,23 +1015,23 @@ nodeG.setCreator(new EbliWidgetCreatorGraphe(pn)); nodeG.setTitle("Graphe " + idxFilleG_++); nodeG.setPreferedSize(new Dimension(600, 400)); - + nodeG.setPreferedLocation(new Point(20, 20)); BuLib.invokeLater(new Runnable() { public void run() { - + // Ajout du node dans la scene getSelectedFilleLayout().addNode(nodeG); pn.getGraphe().restore(); - + nodeG.getWidget().getController().setDescription(formatInfoSource(calque.getSourceCalque())); - + } }); - - + + getSelectedFilleLayout().getScene().refresh(); } @@ -1048,28 +1056,28 @@ * Methode qui parametre la frame layout ainsi que le menu associe. */ protected void decoreFilleVisu() { - + // -- realisation idem pour fillelayout --// getSelectedFilleLayout().setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); - + getSelectedFilleLayout().setClosable(true); getSelectedFilleLayout().setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - // -- creation du menu POST de base --// + // -- creation du menu POST de base --// setMenuPost(); - + // -- a decommenter pour activer les menus des fillelayout setMenuLayout(); - + } protected Runnable getRunnableForVisu(final Runnable _other) { return new Runnable() { public void run() { - + // -- ajout de la frame layout impl_.addInternalFrame(getSelectedFilleLayout()); @@ -1119,71 +1127,73 @@ if ("VIEW_2D".equals(commandeBrute) ) { activeFille(getSelectedFilleLayout()); return; - } else if (commandeBrute.startsWith("FILLELAYOUT")) { - FuLog.warning("OKAAAAAAAAYYYYYYYYYy"); + } else if (commandeBrute.startsWith("FILLELAYOUT")) { + // -- recuperation de l'indice --// String number = commandeBrute.substring(commandeBrute.lastIndexOf('T') + 1); int indiceFenetre = Integer.parseInt(number); // -- ajout de la fenetre correspondante --// // addFillesLayout(listeFillesLayout.get(indiceFenetre)); activeFille(listeFillesLayout.get(indiceFenetre)); - return; + return; } - else { - // -- gestion des actions en fonction de la simul choisie --// - int indiceSimulation = 0; - - for (int i = 0; i < listeSousMenuProjets_.size(); i++) { + else { + // -- gestion des actions en fonction de la simul choisie --// + int indiceSimulation = 0; - // --recuperation de la liste des sousmenu de la simulation i --// - ArrayList<BuMenuItem> listeSousMenus = listeSousMenuProjets_.get(i); - - indiceSimulation = i; - - // -- on recherche si l action provient d un des fils --// - for (int j = 0; j < listeSousMenus.size(); j++) { - BuMenuItem item = listeSousMenus.get(j); - - //-- on essaie de matcher a la fois la commande et l objet pour savoir si c est le bon --// - // -- si une clause du if est v\xE9rifi\xE9 alors on gere la simulation i --// - if ("COMPUTE_EXTREMA".equals(commandeBrute) && item == _event.getSource()) { - - FuLog.warning("je fais partie de la simulation " + indiceSimulation); - showExtremum(indiceSimulation); - } else if ("PALETTE_DEFAULT".equals(commandeBrute) && item == _event.getSource()) { - updatePaletteMin(); - } else if ("TIME_FORMAT".equals(commandeBrute) && item == _event.getSource()) { - TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); - } else if ("VARIABLES".equals(commandeBrute) && item == _event.getSource()) { - activeVarFrame(); - } else if ("EXPORTDATA".equals(commandeBrute) && item == _event.getSource()) { - TrPostVisuPanel.startExport(getImpl(), getSource(indiceSimulation), null); - } else if ("COMPARE".equals(commandeBrute) && item == _event.getSource()) { - compareWith(); - } else if ("PROJECT".equals(commandeBrute) && item == _event.getSource()) { - projectOn(); - } else if ("IMPORTER_RESULTS".equals(commandeBrute) && item == _event.getSource()) { - importerVars(); - } else if ("MAJ_DATA_ALWAYS".equals(commandeBrute) && item == _event.getSource()) { - if (src_.isInspected()) { return; } - new TrPostInspector(this).start(); - } else if ("MAJ_DATA".equals(commandeBrute) && item == _event.getSource()) { - final TrPostInspectorReader watcher = getSource(indiceSimulation).createWatcher(this, false); - if (watcher != null) { - watcher.read(); - watcher.close(); - } - } - - - + for (int i = 0; i < listeSousMenuProjets_.size(); i++) { + + // --recuperation de la liste des sousmenu de la simulation i --// + ArrayList<BuMenuItem> listeSousMenus = listeSousMenuProjets_.get(i); + + indiceSimulation = i; + + // -- on recherche si l action provient d un des fils --// + for (int j = 0; j < listeSousMenus.size(); j++) { + BuMenuItem item = listeSousMenus.get(j); + + // -- on essaie de matcher a la fois la commande et l objet pour + // savoir si c est le bon --// + // -- si une clause du if est v\xE9rifi\xE9 alors on gere la simulation i + // --// + if ("COMPUTE_EXTREMA".equals(commandeBrute) && item == _event.getSource()) { + + FuLog.warning("je fais partie de la simulation " + indiceSimulation); + showExtremum(indiceSimulation); + } else if ("PALETTE_DEFAULT".equals(commandeBrute) && item == _event.getSource()) { + updatePaletteMin(); + } else if ("TIME_FORMAT".equals(commandeBrute) && item == _event.getSource()) { + TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); + } else if ("VARIABLES".equals(commandeBrute) && item == _event.getSource()) { + activeVarFrame(); + } else if ("EXPORTDATA".equals(commandeBrute) && item == _event.getSource()) { + TrPostVisuPanel.startExport(getImpl(), getSource(indiceSimulation), null); + } else if ("COMPARE".equals(commandeBrute) && item == _event.getSource()) { + compareWith(getSource(indiceSimulation)); + } else if ("PROJECT".equals(commandeBrute) && item == _event.getSource()) { + projectOn(); + } else if ("IMPORTER_RESULTS".equals(commandeBrute) && item == _event.getSource()) { + importerVars(); + } else if ("MAJ_DATA_ALWAYS".equals(commandeBrute) && item == _event.getSource()) { + if (src_.isInspected()) { + return; + } + new TrPostInspector(this).start(); + } else if ("MAJ_DATA".equals(commandeBrute) && item == _event.getSource()) { + final TrPostInspectorReader watcher = getSource(indiceSimulation).createWatcher(this, false); + if (watcher != null) { + watcher.read(); + watcher.close(); + } + } + + } + } - } - } - - -// if ("VIEW_2D".equals(commandeBrute)) { + + + // if ("VIEW_2D".equals(commandeBrute)) { // activeFille(); // } else if ("COMPUTE_EXTREMA".equals(commandeBrute)) { // showExtremum(0); @@ -1211,9 +1221,9 @@ // watcher.close(); // } // } - - - + + + } public void activate(final File _f) {} @@ -1243,23 +1253,23 @@ addFillesLayout(filleLayout); // -- creation d une instance de la legende du calque --// CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(filleLayout.getScene(), null); - + final TrPostVisuPanel pnVisu = buildVisuPanel(filleLayout.getScene(), legendeCalque); -// legendeCalque.setModelTreeCalque(pnVisu.getArbreCalqueModel()); + // legendeCalque.setModelTreeCalque(pnVisu.getArbreCalqueModel()); // fille_ = new TrPostFille(pnVisu); // --creation de l internalframe layout --// - + // -- ajout du visuPanel au layout --// Point location= pnVisu.getLocation(); location.x+=10; location.y+=10; - + EbliNode node = filleLayout.addCalque("Calque", location, pnVisu.getPreferredSize(), pnVisu, legendeCalque); // -- ajout de l INFO de la source utilis\xE9e --// - + // -- decoration de la fille layout --// decoreFilleVisu(); @@ -1269,7 +1279,7 @@ // -- construction des actions sans passer par la frame fille --// filleLayout.getVisuPanel().getController().buildActions(); - + final Runnable other = FudaaSaveLib.restoreMainFille(impl_, getSaveFile(), getOldSaveFile(), fille_, getStateReceiver()); @@ -1286,7 +1296,7 @@ if (frVariables_ == null) { frVariables_ = new TrPostDataCreationPanel(TrPostProjet.this, new CtuluCommandManager(), impl_) - .createInternalFrame(); + .createInternalFrame(); frVariables_.pack(); impl_.addInternalFrame(frVariables_); TrLib.initFrameDimensionWithPref(frVariables_, impl_.getMainPanel().getDesktop().getSize()); @@ -1327,7 +1337,7 @@ public void changedMainFrameState() { getImpl().getFrame().setTitle( "Post " + CtuluLibString.ESPACE + FuLib.reducedPath(src_.getFile().getAbsolutePath()) - + (isModified() ? " *" : CtuluLibString.EMPTY_STRING)); + + (isModified() ? " *" : CtuluLibString.EMPTY_STRING)); } /** @@ -1366,20 +1376,102 @@ } - public void compareWith() { + + /** + * Methode qui formatte les donnees de la liste. + * + * @return + */ + String[] formattageDonnees() { + return this.formattageDonnees(false); + } + + String[] formattageDonnees(boolean proposeNewDAtaFirst) { + + String[] listeSimul; + int cpt = 0; + if (proposeNewDAtaFirst) { + listeSimul = new String[listeSrc_.size() + 1]; + listeSimul[cpt++] = TrResource.getS("Ajouter un nouveau projet"); + } + else + listeSimul = new String[listeSrc_.size()]; + + for (Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { + + TrPostSource src = it.next(); + + // --ajout dans la liste des titres --// + listeSimul[cpt++] = formatInfoSource(src); + } + + return listeSimul; + } + + /** + * retourne un chooser avec tous les multi sources et un bouton pour ajouter + * un nouveau projet. + * + * @return + */ + public TrPostSource getChooserMultiSources(int indiceChoix) { + + BuDialogChoice dialog = null; + // -- recuperation de la liste des src sous forme de liste --// + String[] values = formattageDonnees(true); + + // --construction graphique --// + dialog = new BuDialogChoice(impl_.getApp(), impl_.getInformationsSoftware(), + TrResource.getS("S\xE9lection du projet"), TrResource.getS("S\xE9lectionnez le jeux de donn\xE9es "), values); + dialog.setSize(400, 250); + // -- on indice au choix +1 car on a le choix creation au debut --// + if (indiceChoix != -1) + dialog.getChValeur().setSelectedIndex(indiceChoix + 1); + dialog.setModal(true); + // dialog.setTitle(TrResource.getS("Choix du projet")); + if (dialog.activate() == 0) { + int reponse = dialog.getSelectedIndex(); + + if (reponse == -1) + impl_.error(TrResource.getS("Il faut choisir un projet")); + else if (reponse == 0) { + // -- ouverture d un nouveau projet --// + new TrPostActionOpenSrc(this).actionPerformed(null); + // -- on retourne le dernier projet ouvert --// + // return getSource(listeSrc_.size() - 1); + impl_.message(TrResource.getS("Projet charg\xE9, il est d\xE9sormais disponible")); + return getChooserMultiSources(listeSrc_.size() - 1); + + } else { + return getSource(reponse - 1); + } + } + + return null; + } + + + /** + * Ouvre une interface permettant de comparer 2 source entre elles. + */ + public void compareWith(final TrPostSource sourceSelectionnee) { final CtuluTaskDelegate task = getImpl().createTask(TrPostSourceComparatorBuilder.getComparaisonTitle()); final ProgressionInterface prog = task.getStateReceiver(); final Runnable r = new Runnable() { public void run() { - final TrPostSource toProject = TrPostSourceActivator.activeSourceAction(getImpl().ouvrirFileChooser( - TrResource.getS("Fichier post"), null), getImpl(), prog); + + // final TrPostSource toProject = + // TrPostSourceActivator.activeSourceAction(getImpl().ouvrirFileChooser( + // TrResource.getS("Fichier post"), null), getImpl(), prog); + final TrPostSource toProject = getChooserMultiSources(-1); if (toProject != null) { BuLib.invokeLater(new Runnable() { public void run() { - TrPostSourceComparatorBuilder.activeComparaison(getSource(), toProject, EfLib.isDiffQuick(src_.getGrid(), - toProject.getGrid()), getImpl()); + TrPostSourceComparatorBuilder.activeComparaison(sourceSelectionnee, toProject, EfLib.isDiffQuick(src_ + .getGrid(), + toProject.getGrid()), TrPostProjet.this); } }); } @@ -1432,7 +1524,7 @@ * @return la source courante utilisee */ public TrPostSource getSource() { - + return src_; } @@ -1448,7 +1540,7 @@ else return null; } - + public FudaaCourbeTimeListModel getTimeModel() { return getSource().getNewTimeListModel(); } @@ -1534,7 +1626,7 @@ public void projectOn() { final FudaaLib.OpenResult open = FudaaGuiLib.openFile(getImpl(), TrFileFormatManager.getAllGridFormat(), MvResource .getS("Ouverture fichier de maillage"), TrFileFormatManager.getDefaultGridFormat(getImpl().getLauncher() - .getCurrentPrefHydId())); + .getCurrentPrefHydId())); if (open == null) { return; } final CtuluTaskDelegate task = getImpl().createTask(TrPostSourceComparatorBuilder.getComparaisonTitle()); final ProgressionInterface prog = task.getStateReceiver(); @@ -1597,8 +1689,8 @@ } } - - + + /** * Cree une nouvelle fenetre dans le post contenant son jeu de layouts */ @@ -1610,6 +1702,6 @@ addFillesLayout(newLayoutFille); impl_.addInternalFrame(newLayoutFille); } - - + + } \ No newline at end of file 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 2008-09-17 20:01:07 UTC (rev 3949) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2008-09-18 20:02:30 UTC (rev 3950) @@ -7,35 +7,28 @@ */ package org.fudaa.fudaa.tr.post; +import java.awt.Point; import java.io.File; import java.util.List; -import java.util.Map; import javax.swing.ListModel; -import javax.swing.WindowConstants; -import javax.swing.event.InternalFrameAdapter; -import javax.swing.event.InternalFrameEvent; -import org.geotools.util.WeakValueHashMap; - -import com.memoire.bu.BuLib; - import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluDialog; - import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.calque.BCalqueLegende; - +import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.fudaa.fdico.FDicoLib; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.layer.MvGridLayerGroup; -import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.tr.common.TrResource; +import org.geotools.util.WeakValueHashMap; +import com.memoire.bu.BuLib; + /** * Classe utilitaire pour construire des sources issues d'une comparaison. * @@ -189,18 +182,20 @@ } protected static void activeComparaison(final TrPostSource _src, final TrPostSource _toProject, - final String _quickDiff, final TrPostCommonImplementation _impl) { + final String _quickDiff, final TrPostProjet projet) { + + final TrPostCommonImplementation impl = projet.getImpl(); final TrPostProjectCompPanel pn = new TrPostProjectCompPanel(_src.getGrid(), _toProject.getGrid(), _quickDiff, - _impl); + impl); pn.addComparePanel(); final TrPostProjetCompTimeStepPanel timeStep = new TrPostProjetCompTimeStepPanel(_src, _toProject); pn.add(timeStep.getPn()); - final CtuluDialog dial = pn.createDialog(_impl.getFrame()); + final CtuluDialog dial = pn.createDialog(impl.getFrame()); pn.setParent(dial); dial.setTitle(FDicoLib.getS("Comparaison avec {0}", _toProject.getTitle())); if (dial.afficheAndIsOk()) { - final CtuluTaskDelegate task = _impl.createTask(TrPostSourceComparatorBuilder.getComparaisonTitle()); + final CtuluTaskDelegate task = impl.createTask(TrPostSourceComparatorBuilder.getComparaisonTitle()); final ProgressionInterface prog = task.getStateReceiver(); // true si le fichier src contient des donn\xE9es zfn d\xE9finies sur les noeuds final boolean mustCreateSrcForZfn = _src.isRubar() && _toProject.isRubar() @@ -209,41 +204,49 @@ boolean mustChangeTime = timeStep.useOneTimeStepImported(); int selectedTimeStep = timeStep.getImportedTimeStepToUse(); // la projection - final TrPostSource proj = createSrcForSelectedTime(_toProject, _impl, mustChangeTime, selectedTimeStep); + final TrPostSource proj = createSrcForSelectedTime(_toProject, impl, mustChangeTime, selectedTimeStep); final TrPostSource toProjectZfn = mustCreateSrcForZfn ? createSrcForSelectedTime(new TrPostSourceRubarZFN( - (TrPostSourceRubar) _toProject), _impl, mustChangeTime, selectedTimeStep) : null; + (TrPostSourceRubar) _toProject), impl, mustChangeTime, selectedTimeStep) : null; mustChangeTime = timeStep.useOneTimeStepSrc(); selectedTimeStep = timeStep.getSrcTimeStepToUse(); // la source - final TrPostSource src = createSrcForSelectedTime(_src, _impl, mustChangeTime, selectedTimeStep); + final TrPostSource src = createSrcForSelectedTime(_src, impl, mustChangeTime, selectedTimeStep); final TrPostSource srcZfn = mustCreateSrcForZfn ? createSrcForSelectedTime(new TrPostSourceRubarZFN( - (TrPostSourceRubar) _src), _impl, mustChangeTime, selectedTimeStep) : null; + (TrPostSourceRubar) _src), impl, mustChangeTime, selectedTimeStep) : null; final Runnable r = new Runnable() { public void run() { final boolean isOnImpGrid = pn.isCompareOnImportedGrid(); final TrPostSourceComparator comparaison = createSrcComparator(src, proj, pn.isGridEquals(), isOnImpGrid, pn - .isCompareOnImportedTime(), _impl, prog); + .isCompareOnImportedTime(), impl, prog); comparaison.setInv(pn.isInv()); TrPostSourceComparator comparaisonZfn = null; if (srcZfn != null && toProjectZfn != null) { comparaisonZfn = createSrcComparator(srcZfn, toProjectZfn, pn.isGridEquals(), isOnImpGrid, pn - .isCompareOnImportedTime(), _impl, prog); + .isCompareOnImportedTime(), impl, prog); comparaisonZfn.setInv(pn.isInv()); } - final TrPostProjet trPostProjet = new TrPostProjet(comparaison, _impl); - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(_impl, trPostProjet, comparaison.getFlecheListModel() - .getSize() == 0,new BCalqueLegende()); - final TrPostFille compFille = new TrPostFille(pnVisu); - compFille.addInternalFrameListener(new InternalFrameAdapter() { - public void internalFrameClosed(InternalFrameEvent _e) { - comparaison.close(); - _toProject.close(); - } - }); + final TrPostProjet trPostProjet = new TrPostProjet(comparaison, impl); + + //-- creation de la legende --// + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(projet.getSelectedFilleLayout().getScene(), null); + + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl, trPostProjet, comparaison.getFlecheListModel() + .getSize() == 0,legendeCalque); + + + + // final TrPostFille compFille = new TrPostFille(pnVisu); + // compFille.addInternalFrameListener(new InternalFrameAdapter() { + // public void internalFrameClosed(InternalFrameEvent _e) { + // comparaison.close(); + // _toProject.close(); + // } + // }); + if (isOnImpGrid) { pnVisu.getGridGroup().setTitle(MvResource.getS("Maillage import\xE9")); } @@ -262,16 +265,23 @@ trIsoLayerDefault.monter(); } - compFille.setTitle(TrPostSourceComparatorBuilder.getComparaisonTitle()); - compFille.setClosable(true); - compFille.setFrameIcon(FudaaResource.FUDAA.getToolIcon("diff")); - compFille.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); +// compFille.setTitle(TrPostSourceComparatorBuilder.getComparaisonTitle()); +// compFille.setClosable(true); +// compFille.setFrameIcon(FudaaResource.FUDAA.getToolIcon("diff")); +// compFille.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - trPostProjet.fille_ = compFille; + // trPostProjet.fille_ = compFille; BuLib.invokeLater(new Runnable() { public void run() { - _impl.addInternalFrame(compFille); + // _impl.addInternalFrame(compFille); + // -- ajout de la comparaison en tant que widget --// + Point location = pnVisu.getLocation(); + location.x += 10; + location.y += 10; + projet.getSelectedFilleLayout().addCalque(TrPostSourceComparatorBuilder.getComparaisonTitle(), location, + pnVisu.getPreferredSize(), pnVisu, legendeCalque); + pnVisu.restaurer(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-22 21:23:05
|
Revision: 3970 http://fudaa.svn.sourceforge.net/fudaa/?rev=3970&view=rev Author: deniger Date: 2008-09-22 21:22:51 +0000 (Mon, 22 Sep 2008) 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/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/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.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 2008-09-22 18:27:08 UTC (rev 3969) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2008-09-22 21:22:51 UTC (rev 3970) @@ -273,8 +273,8 @@ } /** - * Methode interne de mise a jour du calque. Elle recalcule les transformations <I>versEcran</I> et <I>versReel</I> - * du calque a partir de la matrice repere. + * Methode interne de mise a jour du calque. Elle recalcule les transformations <I>versEcran</I> et <I>versReel</I> du + * calque a partir de la matrice repere. */ protected void changeMorphismes() { Dimension d; @@ -342,12 +342,8 @@ public void changeRepere(final Object _source, final GrBoite _boite, final double _rz, final int _mrg, final boolean _rapide, final boolean _changeZ) { - if (_boite == null) { - return; - } - if (!checkBoite(_boite, true, true)) { - return; - } + if (_boite == null) { return; } + if (!checkBoite(_boite, true, true)) { return; } final Insets insets = getInsets(); final double wd = _boite.getDeltaX(); final double hd = _boite.getDeltaY(); @@ -619,9 +615,7 @@ */ public void popMenu(final int _x, final int _y) { final JPopupMenu menu = listener_.getCmdsContextuelles(); - if (menu == null) { - return; - } + if (menu == null) { return; } menu.pack(); menu.show(this, _x, _y); } @@ -639,9 +633,7 @@ if (isVisible()) { if (repaintTask_ != null) { synchronized (repaintTask_) { - if (!repaintTask_.isTermine()) { - return; - } + if (!repaintTask_.isTermine()) { return; } } // repaintTask_= null; } @@ -676,6 +668,7 @@ getCalque().setRapide(ajustement_); if (ajusteRepere(_evt)) { changeMorphismes(); + firePropertyChange("repere", lastRepere_, repere_); if (lastRepere_ == null) { lastRepere_ = CtuluLibArray.copy(repere_); } @@ -765,9 +758,7 @@ public void translation(final double _realDx, final double _realDy, final boolean _rapide) { vect_.x_ = _realDx; vect_.y_ = _realDy; - if (!checkTranslation(vect_)) { - return; - } + if (!checkTranslation(vect_)) { return; } vect_.autoApplique(getVersEcran()); final RepereEvent re = new RepereEvent(this, _rapide); re.ajouteTransformation(RepereEvent.TRANS_X, vect_.x_, true); 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 2008-09-22 18:27:08 UTC (rev 3969) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-22 21:22:51 UTC (rev 3970) @@ -2,25 +2,26 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.ArrayList; import java.util.Iterator; +import org.fudaa.ebli.calque.BVueCalque; +import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.api.visual.widget.Widget; /** * Widget qui resulte de la fusion de calques * * @author Adrien Hadoux - * */ public final class EbliWidgetFusionCalques extends EbliWidget implements PropertyChangeListener { - public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); + // public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); public EbliWidgetFusionCalques(EbliScene _scene) { super(_scene); - //calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener( + // calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener( // "versReel", listener); } @@ -29,14 +30,9 @@ addChild(child); - EbliWidgetVueCalque widgetCalque; - if (child instanceof EbliWidgetVueCalque) - widgetCalque = (EbliWidgetVueCalque) child; - else - widgetCalque = (EbliWidgetVueCalque) child.getChildren().get(0); + EbliWidgetVueCalque widgetCalque = (EbliWidgetVueCalque) child.getIntern(); + // listeWidgetCalque_.add(widgetCalque); - listeWidgetCalque_.add(widgetCalque); - // -- ajout du listener des calques sur this --// widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); // widgetCalque.calquePanel_.getVueCalque().getAbstractCalque(). @@ -48,32 +44,32 @@ public void propertyChange(PropertyChangeEvent _evt) { - if (!noCyclePropertieChange) - return; + if (!noCyclePropertieChange) return; noCyclePropertieChange = false; // listeWidgetCalque_.get(0).calquePanel_.getVueCalque().changeViewBoite( // _source, _boite, _rapide) - for (Iterator<EbliWidgetVueCalque> it = listeWidgetCalque_.iterator(); it.hasNext();) { - EbliWidgetVueCalque widget = it.next(); - widget.calquePanel_.getVueCalque().setRepere((double[][]) _evt.getNewValue()); + BVueCalque vueCalque = (BVueCalque) _evt.getSource(); + GrBoite boite = vueCalque.getViewBoite(); + for (Iterator<Widget> it = getChildren().iterator(); it.hasNext();) { + EbliWidgetVueCalque widget = (EbliWidgetVueCalque) ((EbliWidget) it.next()).getIntern(); + if (widget.calquePanel_.getVueCalque() != vueCalque) { + widget.calquePanel_.getVueCalque().changeRepere(widget.calquePanel_, boite,0,0); + } widget.image = null; + widget.repaint(); } noCyclePropertieChange = true; getEbliScene().refresh(); } /** - * Surcharge de la methode de ebli, utilisse pour virer les property change - * listener + * Surcharge de la methode de ebli, utilisse pour virer les property change listener */ public void removePropertyChangeListenerFormWidget(EbliWidget child) { EbliWidgetVueCalque widgetCalque; - if (child instanceof EbliWidgetVueCalque) - widgetCalque = (EbliWidgetVueCalque) child; - else - widgetCalque = (EbliWidgetVueCalque) child.getChildren().get(0); - widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("versEcran", this); - widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("versReel", this); + if (child instanceof EbliWidgetVueCalque) widgetCalque = (EbliWidgetVueCalque) child; + else widgetCalque = (EbliWidgetVueCalque) ((EbliWidget) child.getChildren().get(0)).getIntern(); + widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("repere", this); } 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 2008-09-22 18:27:08 UTC (rev 3969) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-22 21:22:51 UTC (rev 3970) @@ -126,6 +126,14 @@ } } + public GrBoite getViewBoite() { + return calquePanel_.getVueCalque().getViewBoite(); + } + + public EbliWidgetControllerCalque getCalqueController(){ + return (EbliWidgetControllerCalque) getController(); + } + boolean first_ = true; @SuppressWarnings("unchecked") 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 2008-09-22 18:27:08 UTC (rev 3969) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2008-09-22 21:22:51 UTC (rev 3970) @@ -134,7 +134,7 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.92-MAQUETTE-V4"; + infoSoft.version = "0.92-MAQUETTE-V5"; infoSoft.date = "2008-09-20"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2007"; infoSoft.contact = "fre...@fu..."; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-22 18:27:08 UTC (rev 3969) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-22 21:22:51 UTC (rev 3970) @@ -37,6 +37,7 @@ import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; @@ -62,7 +63,6 @@ * Action qui realise la fusion des calques * * @author Adrien Hadoux - * */ public class TrPostActionFusionCalques extends EbliWidgetActionSimple { @@ -71,21 +71,16 @@ EbliNode nodeCalque_; JList jListeCalques_; ArrayList<JLabel> listeObjetsCalques; - + // -- les node possibles a choisir --// ArrayList<EbliNode> listeCalquesPossibles; - - - - + ArrayList<EbliWidgetVueCalque> listeTotaleWidgetToMerge_ = new ArrayList<EbliWidgetVueCalque>(); - + JComponent content_; BuDialog dialog_; DefaultListModel modelCalquesPossibles_; - - /** * constructeur pour le cas de widget calque classiques. * @@ -97,21 +92,16 @@ super(widget.getEbliScene(), TrResource.getS("Fusion avec un autre calque"), CtuluResource.CTULU.getIcon("cible"), "ADDPOINTWIDGET"); - widgetCalque_ = widget; nodeCalque_ = nodeGraphe; projet_ = projet; // -- ajout de la combo dans la toolbar de la widget --// if (!((EbliWidgetControllerCalque) widgetCalque_.getController()).hasAlreadyFusion) { - widgetCalque_.getController().getPopup().add(this); - ((EbliWidgetControllerCalque) widgetCalque_.getController()).hasAlreadyFusion = true; + widgetCalque_.getController().getPopup().add(this); + ((EbliWidgetControllerCalque) widgetCalque_.getController()).hasAlreadyFusion = true; } } - - - - /** * remplissage de la combo avec les graphes disponibles et compatibles @@ -128,11 +118,10 @@ Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getObjects(); for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode currentNode = it.next(); - + if (currentNode != nodeCalque_ && currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque) { EbliWidgetCreatorVueCalque new_name = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); - if (isCompatibleWithCalque(new_name.getCalque())) { JLabel label = new JLabel(); @@ -144,17 +133,13 @@ listeObjetsCalques.add(label); listeCalquesPossibles.add(currentNode); } - - - } - + } + } - - + // -- creation graphique --// - if (jListeCalques_ == null) - jListeCalques_ = new JList(); + if (jListeCalques_ == null) jListeCalques_ = new JList(); modelCalquesPossibles_ = new DefaultListModel(); @@ -168,7 +153,6 @@ jListeCalques_.setSize(250, 350); jListeCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Calques possibles"))); jListeCalques_.setCellRenderer(new GrapheCellRenderer()); - } @@ -181,12 +165,7 @@ public boolean isCompatibleWithCalque(ZEbliCalquesPanel calque) { return true; } - - - - - JComponent constructPanel() { JPanel content = new JPanel(new BorderLayout()); @@ -196,15 +175,15 @@ valide.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent _e) { - - mergeCalques(); - dialog_.dispose(); - + + mergeCalques(); + dialog_.dispose(); + } }); jListeCalques_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - + JPanel operations = new JPanel(new FlowLayout(FlowLayout.CENTER)); operations.add(valide); @@ -214,76 +193,67 @@ } /** - * Methode qui: merge le graphe choisi dans la combo avec el ndoe actuel - * degage le node choisi de la scene remet a jour al combo actuelle + * Methode qui: merge le graphe choisi dans la combo avec el ndoe actuel degage le node choisi de la scene remet a + * jour al combo actuelle */ private void mergeCalques() { - + int[] selected = jListeCalques_.getSelectedIndices(); - if (selected == null || selected.length==0) { - return; - } - + if (selected == null || selected.length == 0) { return; } + final ArrayList<EbliNode> listeToMerge = new ArrayList<EbliNode>(); - - //-- parcours de la liste des indices selectionnes --// - for(int i=0;i<selected.length;i++){ - + + // -- parcours de la liste des indices selectionnes --// + for (int i = 0; i < selected.length; i++) { + EbliNode nodeToMerge = listeCalquesPossibles.get(selected[i]); - - // --Ajout du noeud --// + + // --Ajout du noeud --// listeToMerge.add(nodeToMerge); - - - + } // -- ajout du node initial --// listeToMerge.add(nodeCalque_); - - // --ajout de la courbe au widget de base --// - new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre calque")) { - public void act() { - final ProgressionInterface prog = new ProgressionBuAdapter(this); - final EbliNode fusion = groupWidgetsFusion(listeToMerge); - - - // -- undo/redo --// - getScene().getCmdMng().addCmd(new CtuluCommand() { + // --ajout de la courbe au widget de base --// + // new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre calque")) { + // + // public void act() { + // final ProgressionInterface prog = new ProgressionBuAdapter(this); + final EbliNode fusion = groupWidgetsFusion(listeToMerge); - public void undo() { - EbliWidgetUngroupAction.degroupObjects(getScene(), fusion); + // -- undo/redo --// + getScene().getCmdMng().addCmd(new CtuluCommand() { - } + public void undo() { + EbliWidgetUngroupAction.degroupObjects(getScene(), fusion); - public void redo() { - groupWidgetsFusion(listeToMerge); - } - }); - - - } - }.start(); - ; - + } + + public void redo() { + groupWidgetsFusion(listeToMerge); + } + }); + + // } + // }.start(); + // ; + // -- maj de la combo --// // remplirCombo(); - - - + } - - + private EbliNode groupWidgetsFusion(final ArrayList<EbliNode> _selectedObjects) { EbliWidgetFusionCalques parent = new EbliWidgetFusionCalques(scene_); // -- il faut des gaps suffisants pour deplacer la widget et avoir le menu // du groupe --// Insets insetLayout = new Insets(30, 30, 30, 30); - - // parent.setLayout(new OverlayLayout()); + + // parent.setLayout(new OverlayLayout()); parent.setLayout(new OverlayLayoutGap(insetLayout)); - + Point min = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); Point max = new Point(-Integer.MAX_VALUE, -Integer.MAX_VALUE); Rectangle sizeMax = new Rectangle(0, 0); @@ -295,46 +265,48 @@ 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); - - if (sizeMax.height < rec.height) - sizeMax.height = rec.height; - if (sizeMax.width < rec.width) - sizeMax.width = rec.width; - + + if (sizeMax.height < rec.height) sizeMax.height = rec.height; + if (sizeMax.width < rec.width) sizeMax.width = rec.width; + } - int w = max.x - min.x; - int h = max.y - min.y; - Insets b = parent.getBorder().getInsets(); - - + // int w = max.x - min.x; + // int h = max.y - min.y; + // Insets b = parent.getBorder().getInsets(); + sizeMax.width += 2 * insetLayout.left; sizeMax.height += 2 * insetLayout.bottom; parent.setPreferredBounds(sizeMax); parent.setPreferredSize(new Dimension(sizeMax.width, sizeMax.height)); - - + GrBoite boite = null; + ZEbliCalquesPanel pn = null; for (Object object : _selectedObjects) { Widget findWidget = scene_.findWidget(object); Rectangle widgetBounds = findWidget.getBounds(); - Rectangle rec = findWidget.convertLocalToScene(widgetBounds); + // Rectangle rec = findWidget.convertLocalToScene(widgetBounds); EbliWidget ew = (EbliWidget) findWidget; + EbliWidgetVueCalque vue = (EbliWidgetVueCalque) ew.getIntern(); + if (boite == null) { + boite = vue.getViewBoite(); + pn = vue.getCalqueController().getVisuPanel(); + } else if (vue.getViewBoite() != null) { + boite.ajuste(vue.getViewBoite()); + } ew.getController().removeActionResizeAndMove(); - - - - findWidget.removeFromParent(); - int dx = rec.x - min.x; - int dy = rec.y - min.y; - Point pt = new Point(dx - widgetBounds.x, dy - widgetBounds.y); - findWidget.setPreferredLocation(pt); + findWidget.removeFromParent(); + // int dx = rec.x - min.x; + // int dy = rec.y - min.y; + // + // Point pt = new Point(dx - widgetBounds.x, dy - widgetBounds.y); + // findWidget.setPreferredLocation(pt); parent.addChildCalque(ew); - float rMinX = ((float) dx) / w; - float rMinY = ((float) dy) / h; - float rMaxX = ((float) (w - widgetBounds.width - dx)) / w; - float rMaxY = ((float) (h - widgetBounds.height - dy)) / h; - parent.setChildConstraint(findWidget, new Rectangle2D.Float(rMinX, rMinY, rMaxX, rMaxY)); + // float rMinX = ((float) dx) / w; + // float rMinY = ((float) dy) / h; + // float rMaxX = ((float) (w - widgetBounds.width - dx)) / w; + // float rMaxY = ((float) (h - widgetBounds.height - dy)) / h; + // parent.setChildConstraint(findWidget, new Rectangle2D.Float(rMinX, rMinY, rMaxX, rMaxY)); } EbliWidgetGroupCreator creator = new EbliWidgetGroupCreator(); @@ -348,19 +320,21 @@ node.setCreator(creator); parent.setController(new EbliWidgetControllerForGroup(parent)); scene_.addNode(node); + if (pn != null && boite != null) { + pn.getVueCalque().changeRepere(pn, boite, 0, 0); + } scene_.setSelectedObjects(new HashSet(Arrays.asList(node))); return node; } - - + public void actionPerformed(ActionEvent _e) { // -- remplisage combo --// remplirCombo(); - - dialog_ = new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource.getS("Fusion avec un autre graphe ")); - if (content_ == null) - content_ = constructPanel(); + + dialog_ = new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), TrResource + .getS("Fusion avec un autre graphe ")); + if (content_ == null) content_ = constructPanel(); dialog_.setContentPane(content_); dialog_.setSize(400, 250); dialog_.setModal(true); @@ -369,5 +343,4 @@ dialog_.activate(); } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-22 18:28:21
|
Revision: 3969 http://fudaa.svn.sourceforge.net/fudaa/?rev=3969&view=rev Author: hadouxad Date: 2008-09-22 18:27:08 +0000 (Mon, 22 Sep 2008) Log Message: ----------- lot 1: - modification du overview du graphe (mis les splitpane en commentaire pour la nouvelle version) - paint background uniquement pour les widget autre que calque -> r?\195?\169solution de la superposition des calques pour la fusion lot 2: - Creation des files format , reader, writer et keyword pour le format scope - debut de creation de la classe de test junit - Creation du composant JXTreeTable pour afficher l ensemble des ordonn?\195?\169es pour un x donn?\195?\169 -> il va falloir modifier pour int?\195?\169grer cela dans une palette Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.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/calque/EbliWidgetCalqueLegende.java 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/graphe/EbliWidgetControllerGraphe.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/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.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/ScopeReader.java 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/ScopeWriter.java branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -0,0 +1,53 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.File; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; +import org.fudaa.dodico.commun.DodicoLib; +import org.fudaa.dodico.fichiers.FileFormatSoftware; + + +/** + * Manager de fichiers au format scope. Utilis\xE9 poru la cr\xE9ation des graphes. + * + * @author Adrien Hadoux + * + */ +public class ScopeFileFormat extends FileFormatUnique { + + static final ScopeFileFormat INSTANCE = new ScopeFileFormat(); + + /** + * @return singleton + */ + public static ScopeFileFormat getInstance() { + return INSTANCE; + } + + private ScopeFileFormat() { + super(1); + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_TEMPORELLE, ScopeKeyWord.TYPE_COURBE_SPATIALE, + ScopeKeyWord.TYPE_COURBE_MIXTE }; + id_ = "SCOPE"; + nom_ = "Scope"; + description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); + software_ = FileFormatSoftware.TELEMAC_IS; + } + + public FileReadOperationAbstract createReader() { + return new ScopeReader(this); + } + + public CtuluIOOperationSynthese write(final File _f, final Object _source, final ProgressionInterface _prog) { + return super.write(_f, _source, _prog); + } + + public FileWriteOperationAbstract createWriter() { + return new ScopeWriter(this); + } + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeKeyWord.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -0,0 +1,69 @@ +package org.fudaa.dodico.telemac.io; + +/** + * Classe qui d\xE9finit les parametres li\xE9s au format ScopT,ScopS et ScopGEN + * + * @author Adrien Hadoux + * + */ +public class ScopeKeyWord { + + 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_SPATIALE = "ScopT"; + public final static String TYPE_COURBE_MIXTE = "SCOPGENE"; + + public ScopeKeyWord() { + } + + /** + * @return Version + */ + public String getVersion() { + return version_; + } + + + /** + * @return BlocCommentaire + */ + public String getBlocCommentaire() { + return blocCommentaireSorT_; + } + + /** + * Verifie que lon est pas en presence d un commentaire a la fois pour les + * formats s,t et gene + * + * @param _t + * @return BlocCommentaire + */ + public boolean isBlocCommentaire(final String _t) { + return (blocCommentaireSorT_.equals(_t) || blocCommentaireGene_.equals(_t)); + } + + /** + * retourne la bonen chaine separator en fonction de la valeur de iparam + * envoy\xE9e. + * + * @param IPARAM + * @return + */ + public String getScopeGENESeparator(int IPARAM) { + switch (IPARAM) { + case 0: + return "TEMPS ="; + case 1: + return " X ="; + case 2: + return " Y ="; + case 3: + return " Z ="; + } + return null; + } + + +} Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -0,0 +1,301 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.EOFException; +import java.io.File; +import java.io.IOException; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; +import org.fudaa.dodico.fortran.FileOpReadCharSimpleAbstract; +import org.fudaa.dodico.h2d.resource.H2dResource; + +/** + * Classe reader de fichier au format scope. Utilise fortranReader + * @author Adrien Hadoux + * + */ +public class ScopeReader extends FileOpReadCharSimpleAbstract implements CtuluActivity { + + + FileFormatVersionInterface v_; + private String name_; + ScopeKeyWord key = new ScopeKeyWord(); + private int nbOctets_; + private String extension_; + public ScopeReader(final FileFormatVersionInterface _v) { + v_ = _v; + } + + + protected void processFile(final File _f) { + name_ = CtuluLibFile.getSansExtension(_f.getName()); + nbOctets_ = (int) _f.length(); + extension_ = CtuluLibFile.getExtension(_f.getName()); + } + + @Override + protected Object internalRead() { + return readZones(); + } + + public void stop() { + } + + + /** + * Lit selon l extension un format gen ou alors s ou t plsu simple a lire. + * + * @return + */ + ScopeStructure readZones() { + + if (ScopeKeyWord.TYPE_COURBE_MIXTE.equals(extension_)) + return readZonesMixte(); + else + return readZonesSorT(); + } + + /** + * + * Retourne une map. La premiere clef indique le type de data (tempo,spatial + * ou mixte, cf var static de ScopeKeyWord) les 3 clef suivantes contiennent + * les titres ensuite chaque paire contient le titre de la variables et ses + * valeurs associ\xE9es sous arraylist de doubles. + * + * @return + */ + ScopeStructure readZonesSorT() { + + if (super.in_ == null) { + analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); + return null; + } + + ScopeStructure.SorT structure = new ScopeStructure.SorT(); + String typeLigne = null; + String ligne = null; + + try { + if ((progress_ != null) && (nbOctets_ > 0)) { + progress_.setProgression(0); + progress_.setDesc("R\xE9cup\xE9ration des titres et nons des variables"); + } + + // -- creation du type de courbe contenu dans les datas --// + structure.type = extension_; + + + // -- on commence a lire a partir de la ligne 3 pour recuperer les variables + int cpt = 0; + do { + in_.readFields(); + typeLigne = in_.stringField(0); + ligne = in_.getLine(); + + if (key.isBlocCommentaire(typeLigne) && cpt < 3) + // titre + structure.addTitle(ligne); + else if (key.isBlocCommentaire(typeLigne)) { + // nom de variable + structure.addVariable(ligne); + } + cpt++; + } while (key.isBlocCommentaire(typeLigne)); + progress_.setProgression(30); + progress_.setDesc("R\xE9cup\xE9ration des donn\xE9es"); + + // -- on lit toutes les valeurs pour une variable jusqu a l a fin de fichier--// + try{ + while(true){ + typeLigne = in_.stringField(0); + if (!key.isBlocCommentaire(typeLigne)) { + // -- on recupere toutes les valeurs de la variable --// + for (int i = 0; i < structure.getNbVariables(); i++) { + double val = in_.doubleField(i); + // ajout dans la map + structure.addValueForVariable(val, i); + } + } + in_.readFields(); + + } + + + }catch(EOFException Exc){ + return structure; + } + + + } catch (IOException e) { + e.printStackTrace(); + return null; + } + + } + + + private ScopeStructure readZonesMixte() { + + if (super.in_ == null) { + analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); + return null; + } + + ScopeStructure.Gene structure = new ScopeStructure.Gene(); + String typeLigne = null; + String ligne = null; + + try { + if ((progress_ != null) && (nbOctets_ > 0)) { + progress_.setProgression(0); + progress_.setDesc("R\xE9cup\xE9ration des titres et nons des variables"); + } + + // -- creation du type de courbe contenu dans les datas --// + structure.type = extension_; + + // --on lit touts les titres tant qu il y a un com --// + + do { + in_.readFields(); + typeLigne = in_.stringField(0); + ligne = in_.getLine(); + // titre + if (key.isBlocCommentaire(typeLigne)) + structure.addTitle(ligne); + + } while (key.isBlocCommentaire(typeLigne)); + + // --on lit le nombre de pas de temps --// + int nbVar = in_.intField(0); + + // -- on lit les params des pas de temps et on init les liste de var + // associees + for(int i=0;i<nbVar;i++){ + in_.readFields(); + + structure.addPasDeTemps(in_.getLine()); + } + progress_.setProgression(30); + + // --on lit le tableau IPARAM --// + in_.readFields(); + final int MODE_ECLATE = in_.intField(0); + final int SEPARATOR = in_.intField(1); + + int indicePasDeTemps = -1; + + in_.readFields(); + // -- on lit toutes les pas de temps --// + try { + while (true) { + + typeLigne = in_.stringField(0); + if (!key.isBlocCommentaire(typeLigne)) { + + if (MODE_ECLATE == 0) { + // -- MODE ECLATE 0 == toutes les valeurs des variabels sont sur + // la meme ligne + + + if (in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + + // -- on est arriv\xE9 a une ligne de pas de temps --// + indicePasDeTemps++; + + in_.readFields(); + + //-- tant qu'on ne revient pas a un nouveau pas de temps on ajoute les var --// + while (!in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + if (!key.isBlocCommentaire(typeLigne)) { + //ce sont des var on les ajoute toutes + int nbFields=in_.getNumberOfFields(); + for (int i = 0; i < nbFields; i++) { + // on alloue la place pour la var + structure.addVariableForPDt("var " + i, indicePasDeTemps); + + //on inscrit la valeur pour la variable du pas de temps correspondant + double value=in_.doubleField(i); + structure.addValueForVariableAtPdt(value, i, indicePasDeTemps); + + } + + + } + // on lit la suite + in_.readFields(); + } + + + } else + in_.readFields(); + + + } else if (MODE_ECLATE == 1) { + // -- MODE ECLATE 1 == toutes les valeurs des variabels sont sur + // la meme ligne + + + if (in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + + // -- on est arriv\xE9 a une ligne de pas de temps --// + indicePasDeTemps++; + + in_.readFields(); + + // -- tant qu'on ne revient pas a un nouveau pas de temps on + // ajoute les var --// + while (!in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + + // -- il faut passer les lignes qui comencent par VARIABLE= ou + // commentaire --// + if (!key.isBlocCommentaire(typeLigne) && !in_.getLine().startsWith("VARIABLE =")) { + + // ce sont des var on les lis ligne par ligne + int indiceVar = 0; + //tant qu on ne revient pas sur une ligne du type VAR= + while (!in_.getLine().startsWith("VARIABLE =")){ + // on alloue la place pour la var + structure.addVariableForPDt("var " + indiceVar, indicePasDeTemps); + + // on inscrit la valeur pour la variable du pas de temps + // correspondant + double value = in_.doubleField(0); + structure.addValueForVariableAtPdt(value, indiceVar, indicePasDeTemps); + indiceVar++; + + //on lit la var suivante + in_.readFields(); + } + + } + else + // on lit la suite + in_.readFields(); + } + + } + + } else + in_.readFields(); + + + } + } + + + + } catch (EOFException Exc) { + return structure; + } + + } catch (IOException e) { + e.printStackTrace(); + return null; + } + + } + + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -0,0 +1,124 @@ +package org.fudaa.dodico.telemac.io; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +/** + * Structure de donn\xE9es utilis\xE9e pour la lecture des fichiers scope. + * + * @author Adrien Hadoux + * + */ +public abstract class ScopeStructure { + + + /** + * Structure pour les fichiers s ou t + * + * @author Adrien + * + */ + public static class SorT extends ScopeStructure { + + private Map<String, List<Double>> data_ = new HashMap<String, List<Double>>(); + + private List<String> listeVariales_ = new ArrayList<String>(); + + private List<String> titles_ = new ArrayList<String>(); + + public String type; + + public SorT() { + } + + public void addTitle(String ligne) { + titles_.add(ligne); + } + + + public void addVariable(String ligne) { + listeVariales_.add(ligne); + // on init la liste des valeurs de la variabel correspondante + data_.put(ligne, new ArrayList<Double>()); + } + + public int getNbVariables() { + return listeVariales_.size(); + } + + + public void addValueForVariable(double value, int indexVariable) { + data_.get(listeVariales_.get(indexVariable)).add(value); + } + + } + + /** + * + * @author Adrien Hadoux. + * + * Classe les donnees par pas de temps. Chaque pas de temps contient + * une liste de variables. chaque variable contient des valeurs. + * + */ + public static class Gene extends ScopeStructure { + + private Map<String, ArrayList<ArrayList<Double>>> data_ = new HashMap<String, ArrayList<ArrayList<Double>>>(); + + private List<String> listePasDeTemps = new ArrayList<String>(); + + private HashSet<String> listeVariales_ = new HashSet<String>(); + + private List<String> titles_ = new ArrayList<String>(); + + public String type = ScopeKeyWord.TYPE_COURBE_MIXTE; + + public Gene() { + } + + public void addTitle(String ligne) { + titles_.add(ligne); + } + + public void addPasDeTemps(String ligne) { + listePasDeTemps.add(ligne); + // on init la liste des valeurs de la variabel correspondante + data_.put(ligne, new ArrayList<ArrayList<Double>>()); + } + + public void addVariableForPDt(String labelVariable, int pdt) { + + listeVariales_.add(labelVariable); + getListeVarForPasDeTemps(pdt).add(new ArrayList<Double>()); + + } + + public int getNbPasDeTemps() { + return listePasDeTemps.size(); + } + + + public int getNbVariables() { + return listeVariales_.size(); + } + + public ArrayList<ArrayList<Double>> getListeVarForPasDeTemps(int pdt) { + return data_.get(listePasDeTemps.get(pdt)); + } + + public ArrayList<Double> getListValueForVariableForPDT(int pdt, int var) { + return getListeVarForPasDeTemps(pdt).get(var); + } + + + public void addValueForVariableAtPdt(double value, int indexVariable, int indexPasDeTemps) { + getListValueForVariableForPDT(indexPasDeTemps, indexVariable).add(value); + } + + } + + +} Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -0,0 +1,34 @@ +package org.fudaa.dodico.telemac.io; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; +import org.fudaa.dodico.fortran.FileOpWriterCharSimpleAbstract; + +/** + * Classe writer de fichier au format scope. Utilise fortranWriter + * + * @author Adrien Hadoux + * + */ +public class ScopeWriter extends FileOpWriterCharSimpleAbstract implements CtuluActivity { + + boolean stop_; + final FileFormatVersionInterface v_; + + ScopeKeyWord key = new ScopeKeyWord(); + + public ScopeWriter(final FileFormatVersionInterface _v) { + v_ = _v; + + } + + + public void stop() { + stop_ = true; + } + + @Override + protected void internalWrite(Object _o) { + } + +} Added: branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -0,0 +1,127 @@ +package org.fudaa.dodico.telemac; + +import java.io.File; + +import junit.framework.TestCase; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.gis.GISZone; +import org.fudaa.dodico.all.TestIO; +import org.fudaa.dodico.telemac.io.ScopeFileFormat; +import org.fudaa.dodico.telemac.io.SinusxFileFormat; + +public class TestJScope extends TestCase { + /** + * Le fichier de lecture. + */ + String testLectureFic_; + + + + /** + * Constructeur par defaut. + */ + public TestJScope() {} + + /** + * @see junit.framework.TestCase#setUp() + */ + public void setUp() { + testLectureFic_ = "fichier.scopT"; + + } + + /** + * @param _f + * @return Les zones lues + * @throws NumberFormatException + */ + private GISZone lecture(final File _f) { + + final CtuluIOOperationSynthese op = ScopeFileFormat.getInstance().getLastVersionInstance(null).read(_f, null); + final GISZone zone = (GISZone) op.getSource(); +// // assertEquals(zone.getNom(), CtuluLibFile.getSansExtension(_f.getName())); +// final GISZoneCollectionPoint[] pts = zone.getPointCollections(); +// assertEquals(2, pts.length); +// GISZoneCollectionPoint pt1 = pts[0]; +// assertNotNull(pt1); +// assertEquals(pt1.getNumGeometries(), 4); +// GISPointMutable p = new GISPointMutable(); +// double t; +// for (int i = 0; i < pt1.getNumGeometries(); i++) { +// pt1.get(i, p); +// t = i; +// assertEquals(p.getX(), t, delta_); +// assertEquals(p.getY(), t, delta_); +// assertEquals(p.getZ(), t, delta_); +// } +// pt1 = pts[1]; +// assertEquals(pt1.getNumGeometries(), 1); +// pt1.get(0, p); +// assertEquals(p.getX(), 4, delta_); +// assertEquals(p.getY(), 4, delta_); +// assertEquals(p.getZ(), 4, delta_); +// final GISZoneCollectionPolygone[] polygones = zone.getPolygoneCollections(); +// assertNotNull(polygones); +// assertEquals(1, polygones.length); +// assertEquals(polygones[0].getNumGeometries(), 1); +// final GISZoneCollectionPolyligne[] polys = zone.getPolyligneCollections(); +// assertNotNull(polys); +// assertEquals(1, polys.length); +// final GISZoneCollectionPolyligne poly0 = polys[0]; +// assertNotNull(poly0); +// assertEquals(poly0.getNumGeometries(), 2); +// GISPolyligne poly = (GISPolyligne) poly0.getGeometry(0); +// assertEquals(poly.getNumPoints(), 4); +// p = new GISPointMutable(-1d, -1d, -1d); +// for (int i = 0; i < 4; i++) { +// final CoordinateSequence s = poly.getCoordinateSequence(); +// t = (double) i * 5; +// assertEquals(s.getX(i), t, delta_); +// assertEquals(s.getY(i), t, delta_); +// assertEquals(s.getOrdinate(i, 2), t, delta_); +// } +// poly = (GISPolyligne) poly0.getGeometry(1); +// assertEquals(poly.getNumPoints(), 2); +// p = new GISPointMutable(-1, -1, -1); +// for (int i = 0; i < 2; i++) { +// final CoordinateSequence s = poly.getCoordinateSequence(); +// t = (double) i * 100 + 100; +// assertEquals(s.getX(i), t, delta_); +// assertEquals(s.getY(i), t, delta_); +// assertEquals(s.getOrdinate(i, 2), 100, delta_); +// } + return zone; + } + + public void testLectureEcriture() { + File f = null; + try { + final File initFile = getFile(testLectureFic_); + assertNotNull("Le fichier " + testLectureFic_ + " est introuvable", initFile); + assertTrue(initFile.getAbsolutePath() + " n'existe pas !", initFile.exists()); + final GISZone zones = lecture(initFile); + assertNotNull(zones); + f = File.createTempFile("testSinux", ".sx"); + assertNotNull(f); + SinusxFileFormat.getInstance().getLastVersionInstance(null).write(f, zones, null); + lecture(f); + } catch (final Exception _e) { + _e.printStackTrace(); + } finally { + if (f != null) { + f.delete(); + } + } + } + + /** + * @param _f + * @return File + */ + public File getFile(final String _f) { + return TestIO.getFile(getClass(), _f); + } + + +} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -38,7 +38,7 @@ * $ */ public class EGInteractionSuiviAllOrdonnees extends EGInteractiveComponent implements MouseListener, - MouseMotionListener { + MouseMotionListener, EGGrapheModelListener { boolean dessine_; @@ -56,8 +56,9 @@ double xreel_; - JXTreeTable treeTableNodes_; - TreeTableModelGraphe modelGraphe_; + + TreeTableModelGraphe modelGraphe_ = new TreeTableModelGraphe(); + JXTreeTable treeTableNodes_ = new JXTreeTable(modelGraphe_); HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>(); JLabel labelX_ = new JLabel(""); @@ -120,7 +121,7 @@ /** Methode qui construit la structure du model **/ - public TreeTableModelGraphe constructStructureModel() { + public void constructStructureModel() { DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Ordonn\xE9es pour X=" + xreel_); @@ -141,10 +142,10 @@ } - TreeTableModelGraphe model = new TreeTableModelGraphe(); - model.setRoot(root); - return model; + modelGraphe_.setRoot(root); + + } /** @@ -177,10 +178,11 @@ panel.add(labelX_); tableInfo_ = new JPanel(new BorderLayout()); tableInfo_.add(panel,BorderLayout.NORTH); - tableInfo_.add(treeTableNodes_,BorderLayout.CENTER); + tableInfo_.add(new JScrollPane(treeTableNodes_), BorderLayout.CENTER); + tableInfo_.add(treeTableNodes_.getTableHeader(), BorderLayout.PAGE_START); } - return new JScrollPane(tableInfo_); + return tableInfo_; } public String getDescription() { @@ -200,10 +202,20 @@ target_.addMouseListener(this); target_.addMouseMotionListener(this); - modelGraphe_ = constructStructureModel(); + constructStructureModel(); - treeTableNodes_ = new JXTreeTable(modelGraphe_); + +// final EGTreeCellRenderer treeCellRenderer = new EGTreeCellRenderer(); +// treeTableNodes_.setTreeCellRenderer(treeCellRenderer); + treeTableNodes_.setLeafIcon((EGObject) _a.getModel().getCourbes()[0]); + treeTableNodes_.setOpenIcon((EGObject) _a.getModel().getEGObject(0)); + treeTableNodes_.setClosedIcon((EGObject) _a.getModel().getEGObject(0)); + treeTableNodes_.setRowHeight(30); + // treeTableNodes_.setCollapsedIcon(_a.getModel().getEGObject(0)); + + _a.getModel().addModelListener(this); + } int yPressed_; @@ -388,4 +400,30 @@ } } + public void axeAspectChanged(EGAxe _c) { + constructStructureModel(); + + } + + public void axeContentChanged(EGAxe _c) { + constructStructureModel(); + + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + constructStructureModel(); + + } + + public void courbeContentChanged(EGObject _c, boolean _mustRestore) { + constructStructureModel(); + + } + + public void structureChanged() { + constructStructureModel(); + + + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -45,7 +45,7 @@ } public boolean canColorBackground() { - return false; + return true; } public boolean canTraceLigneModel() { 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 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetWithBordure.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -49,10 +49,12 @@ TraceLigne l = new TraceLigne(getTraceLigneModel()); - getGraphics().setColor(getColorFond()); + // --test on autorise que si son widget fils le permet --// + if (this.getIntern().canColorBackground()) { + getGraphics().setColor(getColorFond()); getGraphics().fillRect(0, 0, (int) (rec.width - l.getEpaisseur()), (int) (rec.height - l.getEpaisseur())); + } - l.setCouleur(getColorContour()); l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); 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 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -304,7 +304,7 @@ } public boolean canColorBackground() { - return false; + return true; } public boolean canTraceLigneModel() { 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 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -5,13 +5,9 @@ import java.util.ArrayList; import java.util.Iterator; -import org.fudaa.ebli.calque.BCalque; -import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import com.memoire.fu.FuLog; - /** * Widget qui resulte de la fusion de calques * @@ -21,35 +17,35 @@ public final class EbliWidgetFusionCalques extends EbliWidget implements PropertyChangeListener { public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); - - + public EbliWidgetFusionCalques(EbliScene _scene) { super(_scene); //calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener( // "versReel", listener); - + } public void addChildCalque(EbliWidget child) { addChild(child); - + EbliWidgetVueCalque widgetCalque; if (child instanceof EbliWidgetVueCalque) widgetCalque = (EbliWidgetVueCalque) child; else widgetCalque = (EbliWidgetVueCalque) child.getChildren().get(0); - + listeWidgetCalque_.add(widgetCalque); - + // -- ajout du listener des calques sur this --// - widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener("versEcran", this); - widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().addPropertyChangeListener("versReel", this); - + widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); + // widgetCalque.calquePanel_.getVueCalque().getAbstractCalque(). + // addPropertyChangeListener("versReel", this); + } boolean noCyclePropertieChange = true; - + public void propertyChange(PropertyChangeEvent _evt) { if (!noCyclePropertieChange) @@ -57,22 +53,15 @@ noCyclePropertieChange = false; // listeWidgetCalque_.get(0).calquePanel_.getVueCalque().changeViewBoite( // _source, _boite, _rapide) - GrMorphisme morph = (GrMorphisme) _evt.getNewValue(); - for (Iterator<EbliWidgetVueCalque> it = listeWidgetCalque_.iterator(); it.hasNext();) { EbliWidgetVueCalque widget = it.next(); - if (_evt.getPropertyName().equals("versEcran")) { - ((BCalque) widget.calquePanel_.getVueCalque().getAbstractCalque()).setVersEcran(morph); - - } else { - ((BCalque) widget.calquePanel_.getVueCalque().getAbstractCalque()).setVersReel(morph); - } - + widget.calquePanel_.getVueCalque().setRepere((double[][]) _evt.getNewValue()); + widget.image = null; } noCyclePropertieChange = true; getEbliScene().refresh(); } - + /** * Surcharge de la methode de ebli, utilisse pour virer les property change * listener @@ -85,9 +74,7 @@ widgetCalque = (EbliWidgetVueCalque) child.getChildren().get(0); widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("versEcran", this); widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("versReel", this); - - } - + } 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 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -12,8 +12,6 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.tree.TreeModel; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; @@ -26,7 +24,6 @@ import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGSpecificActions; -import org.fudaa.ebli.courbe.EGTableGraphePanel; import org.fudaa.ebli.courbe.EGTree; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -334,13 +331,21 @@ EGGrapheTreeModel treeModel = (EGGrapheTreeModel) getGraphe().getModel(); tree.setModel(treeModel); tree.setSelectionModel(treeModel.getSelectionModel()); - JSplitPane pane = new JSplitPane(); - pane.setDividerLocation(0.3D); - pane.setTopComponent(new JScrollPane(tree)); - final EGTableGraphePanel tablePanel = new EGTableGraphePanel(); - tablePanel.setGraphe(getGraphe()); - pane.setBottomComponent(tablePanel); - panelTreeGraphe_ = pane; + // JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + // pane.setDividerLocation(200);// 0.3D); + // pane.setTopComponent(new JScrollPane(tree)); + // final EGTableGraphePanel tablePanel = new EGTableGraphePanel(); + // tablePanel.setGraphe(getGraphe()); + // pane.setBottomComponent(tablePanel); + // + // JSplitPane paneGlobal = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + // + // paneGlobal.setDividerLocation(100); + // + // paneGlobal.setTopComponent(getGraphePanel().getInfoPanel()); + // paneGlobal.setBottomComponent(pane); + + panelTreeGraphe_ = new JScrollPane(tree);// paneGlobal; } return panelTreeGraphe_; 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 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -251,7 +251,7 @@ } public boolean canColorBackground() { - return false; + return true; } public boolean canTraceLigneModel() { Modified: 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/graphe/WidgetLegendeManager.java 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -180,7 +180,7 @@ } public boolean canColorBackground() { - return false; + return true; } public boolean canTraceLigneModel() { 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 2008-09-22 15:58:47 UTC (rev 3968) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-22 18:27:08 UTC (rev 3969) @@ -504,6 +504,7 @@ @SuppressWarnings("unchecked") private void changeTree(final EbliWidgetInterface _widget) { right_.remove(overview_); + right_.revalidate(); overview_ = _widget.getController().getOverviewComponent(); right_.add(overview_); // conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-24 21:16:05
|
Revision: 3977 http://fudaa.svn.sourceforge.net/fudaa/?rev=3977&view=rev Author: deniger Date: 2008-09-24 21:15:55 +0000 (Wed, 24 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple.res.post.fzip branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.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/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.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/commun/save/FudaaSaveLib.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -5,9 +5,6 @@ package org.fudaa.ebli.visuallibrary.calque; import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; import java.awt.Point; import javax.swing.JLabel; @@ -25,8 +22,10 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; +import org.netbeans.api.visual.border.BorderFactory; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.Widget; import org.netbeans.api.visual.widget.LabelWidget.Alignment; import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; import org.netbeans.modules.visual.layout.FlowLayout; @@ -38,45 +37,17 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public class CalqueLegendeWidgetAdapter extends BCalqueLegende { - static class MetricLegend extends FontMetrics { - - // protected MetricLegend(Font font) { - // super(font); - // } - public MetricLegend(Font font) { - super(font); - } - - } - /** - * Methode statique qui recree la widget associee au calque. Il faut que son parent la bordure ajoute et prenne en - * compte sa nouvelle fille pour bien gerer le dispatch des composants graphiques. - * - * @param widgetLegende_ - * @param _calqueLegende - * @param _scene - * @param model - */ - public static int cp = 1; - public static int LENGHT_PER_LEGENDE = 15; - public static int MAX_BORDURE = 12; - public static int WIDTH_LEGENDE = 200; - - public static int WIDTH_PER_LEGENDEICON = 10; - - public static int WIDTH_PER_LEGENDETEXT = 130; - - /** * Mananger statique qui se charge de creer \xE9a widget associee au calque. * * @param _calqueLegende le panel legende qui sera recopie version widget * @param _scene la scene * @return la widfget de la legende. */ - public static EbliWidget createLegendeWidget(EbliWidgetCalqueLegende _widgetLegende, + public static EbliWidgetCalqueLegende updateLegendeWidget(EbliWidgetCalqueLegende _widgetLegende, BCalqueLegendePanel _calqueLegende, EbliScene _scene) { // --creation de la widget conteneur --// @@ -84,6 +55,7 @@ // widgetLegende_ = new WidgetCalqueLegende(_scene, false, model, // _calqueLegende); _widgetLegende.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); + _widgetLegende.setBorder(BorderFactory.createEmptyBorder(10)); if (_calqueLegende != null) { Component[] listeC = _calqueLegende.getComponents(); @@ -102,6 +74,7 @@ } if (c instanceof BPalettePlageLegende) { + BPalettePlageLegende pal = (BPalettePlageLegende) c; // --recuperation de la liste des plages --// @@ -122,7 +95,8 @@ sstitre.setLabel(listeplages.getSousTitre()); sstitre.setEnabled(true); _widgetLegende.addChild(sstitre); - + Widget ws = new Widget(_scene); + ws.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 5)); if (listeplages.getNbPlages() != 0) { for (int j = 0; j < listeplages.getNbPlages(); j++) { @@ -134,7 +108,7 @@ lw.setUseBorder(false); lw.setEnabled(true); - _widgetLegende.addChild(lw); + ws.addChild(lw); } } else { @@ -154,7 +128,7 @@ titre.setVerticalAlignment(VerticalAlignment.CENTER); titre.setLabel(((JLabel) panel.getComponents()[k]).getText()); titre.setEnabled(true); - _widgetLegende.addChild(titre); + ws.addChild(titre); } else if (panel.getComponents()[k] instanceof JList) { JList jlst = (JList) panel.getComponents()[k]; for (int g = 0; g < jlst.getModel().getSize(); g++) { @@ -163,7 +137,7 @@ titre.setVerticalAlignment(VerticalAlignment.CENTER); titre.setLabel((String) jlst.getModel().getElementAt(g)); titre.setEnabled(true); - _widgetLegende.addChild(titre); + ws.addChild(titre); } } @@ -173,7 +147,10 @@ } } + } + _widgetLegende.addChild(ws); + _widgetLegende.setLegendsWidget(ws); } } @@ -182,7 +159,7 @@ // -- prendre en compte le resize automatique --// _widgetLegende.getEbliScene().refresh(); - // _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); + // _widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); return _widgetLegende; } else { @@ -191,16 +168,16 @@ } } - public static Dimension createSizeForWidget(int _nbLibelles) { - return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); - } + // public static Dimension createSizeForWidget(int _nbLibelles) { + // return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + // } public static void reconstructWidget(EbliWidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, EbliScene _scene/* , BArbreCalqueModel model */) { EbliWidgetWithBordure parent = (EbliWidgetWithBordure) widgetLegende_.getParentWidget(); - widgetLegende_ = (EbliWidgetCalqueLegende) createLegendeWidget(widgetLegende_, _calqueLegende, _scene); + widgetLegende_ = (EbliWidgetCalqueLegende) updateLegendeWidget(widgetLegende_, _calqueLegende, _scene); parent.repaint(); 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 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -19,6 +19,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Widget; import org.netbeans.modules.visual.action.InplaceEditorAction; @@ -31,15 +32,21 @@ public class EbliWidgetCalqueLegende extends EbliWidget implements InplaceEditorProvider<JComponent>, PropertyChangeListener { + Font boldFont_; + public InplaceEditorAction<JComponent> editorAction_; BCalqueLegendePanel legendePanel_; + + Widget legendsWidget_; + // BArbreCalqueModel modelTree_; boolean maj = true; - public InplaceEditorAction<JComponent> editorAction_; // Font oldFont_; - public EbliWidgetCalqueLegende(EbliScene _scene, boolean _controller/* , BArbreCalqueModel model */, - BCalqueLegendePanel _legendePanel) { + boolean mustUpdateFont_ = false; + + public EbliWidgetCalqueLegende(final EbliScene _scene, final boolean _controller/* , BArbreCalqueModel model */, + final BCalqueLegendePanel _legendePanel) { super(_scene, _controller); setCheckClipping(true); // oldFont_ = getFormeFont(); @@ -54,18 +61,48 @@ // -- creation de l action edition des labels --// editorAction_ = (InplaceEditorAction<JComponent>) ActionFactory.createInplaceEditorAction(this); - + // -- ajout de l action au label correspondant --// this.getActions().addAction(editorAction_); } + @Override + public boolean canColorBackground() { + return true; + } + + @Override + public void notifyStateChanged(ObjectState _previousState, ObjectState _newState) { + // super.notifyStateChanged(_previousState, _newState); + } + + @Override + public boolean canColorForeground() { + return false; + } + + @Override + public boolean canFont() { + return true; + } + + @Override + public boolean canRotate() { + return false; + } + + @Override + public boolean canTraceLigneModel() { + return false; + } + /** * Methode qui cree l editeur du calque. */ public JComponent createEditorComponent( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget) { + final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, final Widget _widget) { if (PaletteSelecteurCouleurPlage.isTargetValid(legendePanel_.getCalque())) { - PaletteSelecteurCouleurPlage palette = new PaletteSelecteurCouleurPlage(); + final PaletteSelecteurCouleurPlage palette = new PaletteSelecteurCouleurPlage(); palette.setPalettePanelTarget(legendePanel_.getCalque()); palette.setSize(this.getBounds().width, this.getBounds().height); palette.setMaximumSize(new Dimension(this.getBounds().width, this.getBounds().height)); @@ -76,184 +113,84 @@ return null; } - @Override - public void setFormeFont(Font _newFont) { - super.setFormeFont(_newFont); - updateFont(_newFont); + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, final Widget _widget, + final JComponent _editor) { + return null; } - @Override - public void setPropertyCmd(String _key, Object _prop, CtuluCommandContainer _cmd) { - super.setPropertyCmd(_key, _prop, _cmd); - if ("font".equals(_key)) { - Font ft = (Font) _prop; - updateFont(ft); - } - + public Rectangle getInitialEditorComponentBounds( + final org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, final Widget _widget, + final JComponent _editor, final Rectangle _viewBounds) { + return null; } - @Override - protected void paintWidget() { - if (mustUpdateFont_) { - updateFont(getFormeFont()); - } - super.paintWidget(); - } +// protected int getMaxTitle(final Font boldFt) { +// final FontMetrics ftmBold = this.getGraphics().getFontMetrics(boldFt); +// int maxWidth = 0; +// // -- mise a jour de la widget avec la nouvelle font +// final List<Widget> listePlage = getChildren(); +// for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { +// final Widget widget = it.next(); +// // -- test si il s agit d un widget plage --// +// if (widget instanceof LabelWidget && (((LabelWidget) widget).getLabel() != null)) { +// final LabelWidget lbWidget = (LabelWidget) widget; +// maxWidth = Math.max(maxWidth, ftmBold.stringWidth(lbWidget.getLabel()) + 5); +// // lbWidget.setPreferredBounds(boundsTitre); +// } +// } +// +// return maxWidth; +// +// } - boolean mustUpdateFont_ = false; +// protected int getMaxWidthLegende(final Font ft) { +// final FontMetrics ftm = this.getGraphics().getFontMetrics(ft); +// int maxWidth = 0; +// // -- mise a jour de la widget avec la nouvelle font +// final List<Widget> listePlage = getChildren(); +// for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { +// final Widget widget = it.next(); +// // -- test si il s agit d un widget plage --// +// if (widget instanceof EbliWidgetPlage) { +// final EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; +// maxWidth = Math.max(maxWidth, ftm.stringWidth(new_widget.getInternWidget().getLabel())); +// } +// } +// +// return maxWidth; +// +// } - private void updateFont(Font ft) { - if (getGraphics() == null) { - mustUpdateFont_ = true; - return; - } - mustUpdateFont_ = false; - boldFont_ = BuLib.deriveFont(ft, Font.BOLD, 0); - // -- calcul des max height et width pour resize les composants --// - FontMetrics fmt = getGraphics().getFontMetrics(ft); - FontMetrics fmtBold = getGraphics().getFontMetrics(boldFont_); - int maxWidth = getMaxWidthLegende(ft); - int maxTitle = maxWidth; - Rectangle newBounds = new Rectangle(maxWidth, fmt.getHeight()); + public void notifyClosing(final EditorController _controller, final Widget _widget, final JComponent _editor, + final boolean _commit) { + editingStop(); - // -- mise a jour de la widget avec la nouvelle font - List<Widget> listePlage = getChildren(); - for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidgetPlage) { - EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - new_widget.getInternWidget().setFont(ft); - new_widget.getInternWidget().majText(); - - // -- mise du nouveau bounds max --// - Rectangle boundsIntern = new_widget.getIntern().getBounds(); - if (boundsIntern != null) { - boundsIntern.width = newBounds.width; - boundsIntern.height = (int) (newBounds.height); - } - new_widget.getIntern().setPreferredBounds(boundsIntern); - - // resize pour le logo: forme carr\xE9 - Rectangle boundsLogo = new_widget.getLogo().getBounds(); - if (boundsLogo != null) { - - boundsLogo.height = (int) (newBounds.height); - boundsLogo.width = (int) (newBounds.height); - new_widget.getLogo().setPreferredBounds(boundsLogo); - } - new_widget.getLogo().repaint(); - - } else if (widget instanceof LabelWidget && (((LabelWidget) widget).getLabel() != null)) { - LabelWidget lbWidget = (LabelWidget) widget; - - lbWidget.setFont(boldFont_); - Rectangle boundsTitre = lbWidget.getBounds(); - if(boundsTitre!=null){ - boundsTitre.width = fmtBold.stringWidth(lbWidget.getLabel()) + 5; - maxTitle = Math.max(maxTitle, boundsTitre.width); - boundsTitre.height = (int) (fmtBold.getHeight() + 2); - } - // lbWidget.setPreferredBounds(boundsTitre); - } - - } - // getParentWidget().revalidate(); - // revalidate(); - // Resize de la widget - // getEbliScene().revalidate(); - Rectangle newBoundConteneurs = getParentWidget().getBounds(); - if (newBoundConteneurs != null) { - newBoundConteneurs.height = (int) ((fmtBold.getHeight() + 7) * 2 + (listePlage.size()) * (newBounds.height + 7));// ( - newBoundConteneurs.width = (int) (Math.max(maxWidth, maxTitle) * 1.5); - getParentWidget().setPreferredBounds(newBoundConteneurs); - } - getEbliScene().refresh(); } - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, - JComponent _editor) { - return null; - } + public void notifyOpened(final EditorController _controller, final Widget _widget, final JComponent _editor) { + editingStart(); - public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, - JComponent _editor, Rectangle _viewBounds) { - return null; } + @Override protected void notifyRemoved() { legendePanel_.getCalque().removePropertyChangeListener("paletteCouleur", this); legendePanel_.getCalque().removePropertyChangeListener("paletteTitle", this); } - Font boldFont_; + @Override + protected void paintWidget() { + if (mustUpdateFont_) { + updateFont(getFormeFont()); + } + super.paintWidget(); + } - // protected void paintWidget() { - // - // // -- mise a jour de la fonte que si il y a eu une modification --// - // if (maj) { - // maj = false; - // boldFont_ = BuLib.deriveFont(getFormeFont(), Font.BOLD, 0); - // // -- calcul des max height et width pour resize les composants --// - // Rectangle newBounds = resizeMaxLegende(); - // - // // -- mise a jour de la widget avec la nouvelle font - // List<Widget> listePlage = getChildren(); - // for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - // Widget widget = it.next(); - // // -- test si il s agit d un widget plage --// - // if (widget instanceof EbliWidgetPlage) { - // EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - // new_widget.getIntern().setFont(getFormeFont()); - // new_widget.getIntern().majText(); - // FuLog.warning("MA plage: " + new_widget.plage_.getLegende()); - // - // // -- mise du nouveau bounds max --// - // Rectangle boundsIntern = new_widget.getIntern().getBounds(); - // boundsIntern.width = newBounds.width; - // boundsIntern.height = (int) (newBounds.height); - // - // new_widget.getIntern().setPreferredBounds(boundsIntern); - // - // // resize pour le logo: forme carr\xE9 - // Rectangle boundsLogo = new_widget.getLogo().getBounds(); - // boundsLogo.height = (int) (newBounds.height); - // boundsLogo.width = (int) (newBounds.height); - // new_widget.getLogo().setPreferredBounds(boundsLogo); - // new_widget.getLogo().repaint(); - // - // } else if (widget instanceof LabelWidget) { - // LabelWidget new_widget = (LabelWidget) widget; - // - // new_widget.setFont(boldFont_); - // Rectangle boundsTitre = new_widget.getBounds(); - // boundsTitre.width = newBounds.width; - // boundsTitre.height = (int) (newBounds.height); - // new_widget.setPreferredBounds(boundsTitre); - // } - // - // } - // // getParentWidget().revalidate(); - // // revalidate(); - // // Resize de la widget - // // getEbliScene().revalidate(); - // Rectangle newBoundConteneurs = getParentWidget().getBounds(); - // newBoundConteneurs.height = (int) ((listePlage.size() + 2) * (newBounds.height * 1.5));// ( - // newBoundConteneurs.width = (int) (newBounds.width * 1.5); - // getParentWidget().setPreferredBounds(newBoundConteneurs); - // getEbliScene().refresh(); - // // oldFont_ = getFormeFont(); - // - // } - // - // } - /** * Si la palette est modifiee on change la widget */ - public void propertyChange(PropertyChangeEvent _evt) { + public void propertyChange(final PropertyChangeEvent _evt) { rebuildWidget(); } @@ -266,53 +203,62 @@ this.getEbliScene().refresh(); } - public void notifyClosing(EditorController _controller, Widget _widget, JComponent _editor, boolean _commit) { - editingStop(); + @Override + public void setFormeFont(final Font _newFont) { + super.setFormeFont(_newFont); + updateFont(_newFont); + } + /** + * @param _legendsWidget the legendsWidget to set + */ + public void setLegendsWidget(Widget _legendsWidget) { + legendsWidget_ = _legendsWidget; } - public void notifyOpened(EditorController _controller, Widget _widget, JComponent _editor) { - editingStart(); + @Override + public void setPropertyCmd(final String _key, final Object _prop, final CtuluCommandContainer _cmd) { + super.setPropertyCmd(_key, _prop, _cmd); + if ("font".equals(_key)) { + final Font ft = (Font) _prop; + updateFont(ft); + } } - protected int getMaxWidthLegende(Font ft) { - FontMetrics ftm = this.getGraphics().getFontMetrics(ft); - int maxWidth = 0; - // -- mise a jour de la widget avec la nouvelle font - List<Widget> listePlage = getChildren(); - for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { - Widget widget = it.next(); - // -- test si il s agit d un widget plage --// - if (widget instanceof EbliWidgetPlage) { - EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - maxWidth = Math.max(maxWidth, ftm.stringWidth(new_widget.getInternWidget().getLabel())); + protected void updateFont(final Font ft) { + if (getGraphics() == null) { + mustUpdateFont_ = true; + return; + } + mustUpdateFont_ = false; + boldFont_ = BuLib.deriveFont(ft, Font.BOLD, 1); + if (legendsWidget_ != null) { + final List<Widget> listePlage = legendsWidget_.getChildren(); + for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + final Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidgetPlage) { + final EbliWidgetPlage widgetPlage = (EbliWidgetPlage) widget; + widgetPlage.getInternWidget().setFont(ft); + widgetPlage.getInternWidget().majText(); + } } } - return maxWidth; + // -- mise a jour de la widget avec la nouvelle font + final List<Widget> listePlage = getChildren(); + for (final Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + final Widget widget = it.next(); + if (widget instanceof LabelWidget && (((LabelWidget) widget).getLabel() != null)) { + final LabelWidget lbWidget = (LabelWidget) widget; + lbWidget.setFont(boldFont_); + } + } + getParentWidget().revalidate(); + revalidate(); + getEbliScene().refresh(); } - - - public boolean canRotate() { - return false; - } - public boolean canColorForeground() { - return false; - } - - public boolean canColorBackground() { - return true; - } - - public boolean canTraceLigneModel() { - return false; - } - - public boolean canFont() { - return true; - } - } \ No newline at end of file Modified: 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/EbliWidgetCreatorLegende.java 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -39,10 +39,11 @@ } public EbliWidget create(EbliScene _scene) { - EbliWidget widgetLegende_ = CalqueLegendeWidgetAdapter.createLegendeWidget( - new EbliWidgetCalqueLegende(_scene, false, g), g, _scene); - res = new EbliWidgetBordureSingle(widgetLegende_, true, true); - widgetLegende_.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); + EbliWidgetCalqueLegende widgetLegende = CalqueLegendeWidgetAdapter.updateLegendeWidget(new EbliWidgetCalqueLegende( + _scene, false, g), g, _scene); + res = new EbliWidgetBordureSingle(widgetLegende, true, true); + widgetLegende.setFormeFont(new Font("Helvetica", Font.PLAIN, 10)); + widgetLegende.updateFont(widgetLegende.getFormeFont()); return res; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -31,7 +31,7 @@ *Methode utilisee pour mettre a jour la plage. */ public void majText() { - this.setLabel(plage_.getLegende()); + this.setLabel(plage_.getLegende() + " "); setToolTipText(plage_.getLegende()); // setForeground(plage_.getCouleur()); } @@ -53,7 +53,7 @@ super(_scene); plage_ = _cb; - setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); + setLayout(new FlowLayout(false, SerialAlignment.CENTER, 2)); // setEnabled(false); setEnabled(true); logo_ = new EbliWidget(_scene) { @@ -67,7 +67,13 @@ @Override protected Rectangle calculateClientArea() { Rectangle rec = new Rectangle(); - rec.width = (int) intern_.getPreferredBounds().getHeight(); + // rec.width = (int) intern_.getPreferredBounds().getHeight(); + Rectangle bounds = intern_.getBounds(); + if (bounds != null) { + rec.width = (int) bounds.getHeight(); + } else { + rec.width = (int) intern_.getPreferredBounds().getHeight(); + } rec.height = rec.width; return rec; } @@ -79,9 +85,8 @@ // -- creation de la legende --// intern_ = new InternWidget(_scene); + intern_.majText(); - intern_.setLabel(_cb.getLegende()); - // intern_.setForeground(_cb.getCouleur()); setToolTipText(_cb.getLegende()); addChild(intern_); @@ -115,7 +120,7 @@ public void majLabel() { // intern_.setForeground(plage_.getCouleur()); - intern_.setLabel(plage_.getLegende()); + intern_.majText(); } public void setInternLabel(InternWidget intern_) { Modified: 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/graphe/WidgetLegendeManager.java 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -24,28 +24,21 @@ * @author denf01a adrien hadoux * @creation 5 ao\xFBt 2008 * @version - * */ public class WidgetLegendeManager { - - public static int LENGHT_PER_LEGENDE = 15; - public static int WIDTH_PER_LEGENDEICON = 100; - public static int WIDTH_PER_LEGENDETEXT = 120; - public static int MAX_BORDURE = 12; - - public static Dimension createSizeForWidget(int _nbLibelles){ - return new Dimension(WIDTH_PER_LEGENDEICON + WIDTH_PER_LEGENDETEXT, _nbLibelles - * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); - } - - - - + // public static int LENGHT_PER_LEGENDE = 15; + // public static int WIDTH_PER_LEGENDEICON = 100; + // public static int WIDTH_PER_LEGENDETEXT = 120; + // public static int MAX_BORDURE = 12; + + // public static Dimension createSizeForWidget(int _nbLibelles){ + // return new Dimension(WIDTH_PER_LEGENDEICON + WIDTH_PER_LEGENDETEXT, _nbLibelles + // * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + // } + /** - * Creation de la classe widget specifique au calque. Permet de gerer le - * resize via le changement de font - * + * Creation de la classe widget specifique au calque. Permet de gerer le resize via le changement de font */ public static class WidgetCalqueLegende extends EbliWidget { @@ -55,8 +48,7 @@ super(scene, _controller); oldFont_ = getFormeFont(); } - - + protected Rectangle resizeMaxLegende() { this.getGraphics().setFont(getFormeFont()); int maxHeight = 0; @@ -71,22 +63,20 @@ EbliWidgetTitle tw = null; - if (new_widget.getChildren().get(0) instanceof EbliWidgetTitle) - tw = (EbliWidgetTitle) new_widget.getChildren().get(0); - else - if (new_widget.getChildren().get(1) instanceof EbliWidgetTitle) - tw = (EbliWidgetTitle) new_widget.getChildren().get(1); - + if (new_widget.getChildren().get(0) instanceof EbliWidgetTitle) tw = (EbliWidgetTitle) new_widget + .getChildren().get(0); + else if (new_widget.getChildren().get(1) instanceof EbliWidgetTitle) tw = (EbliWidgetTitle) new_widget + .getChildren().get(1); + if (tw != null) { - // -- recuperation des tailles des font pour les textes saisies + // -- recuperation des tailles des font pour les textes saisies - FontMetrics ftm = this.getGraphics().getFontMetrics(); + FontMetrics ftm = this.getGraphics().getFontMetrics(); - int newWidth = ftm.stringWidth(tw.intern_.getLabel()); - int newHeight = ftm.getHeight(); - if (maxWidth < newWidth) - maxWidth = newWidth; - maxHeight = newHeight; + int newWidth = ftm.stringWidth(tw.intern_.getLabel()); + int newHeight = ftm.getHeight(); + if (maxWidth < newWidth) maxWidth = newWidth; + maxHeight = newHeight; } } @@ -105,7 +95,7 @@ // -- calcul des max height et width pour resize les composants --// Rectangle newBounds = resizeMaxLegende(); - + // -- mise a jour de la widget avec la nouvelle font List<Widget> listePlage = getChildren(); for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { @@ -113,24 +103,22 @@ // -- test si il s agit d un widget plage --// if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { EbliWidget new_widget = (EbliWidget) widget; - + EbliWidgetLine lw = null; EbliWidgetTitle tw = null; - - if (new_widget.getChildren().get(0) instanceof EbliWidgetLine) - lw = (EbliWidgetLine) new_widget.getChildren().get(0); - else - tw = (EbliWidgetTitle) new_widget.getChildren().get(0); - - if (new_widget.getChildren().get(1) instanceof EbliWidgetLine) - lw = (EbliWidgetLine) new_widget.getChildren().get(1); - else - tw = (EbliWidgetTitle) new_widget.getChildren().get(1); + + if (new_widget.getChildren().get(0) instanceof EbliWidgetLine) lw = (EbliWidgetLine) new_widget + .getChildren().get(0); + else tw = (EbliWidgetTitle) new_widget.getChildren().get(0); + + if (new_widget.getChildren().get(1) instanceof EbliWidgetLine) lw = (EbliWidgetLine) new_widget + .getChildren().get(1); + else tw = (EbliWidgetTitle) new_widget.getChildren().get(1); if (lw != null && tw != null) { - + tw.getIntern_().setFont(getFormeFont()); - // resize du composant texte + // resize du composant texte Rectangle internBounds = tw.getIntern_().getBounds(); // internBounds.height += (getFormeFont().getSize() - // oldFont_.getSize()) * 2; @@ -140,16 +128,16 @@ internBounds.height = (int) (newBounds.height); tw.getIntern_().setPreferredBounds(internBounds); - // resize pour le logo: forme carr\xE9 + // resize pour le logo: forme carr\xE9 Rectangle boundsLogo = lw.getBounds(); // boundsLogo.height = internBounds.height; // boundsLogo.width = internBounds.height; boundsLogo.height = (int) (newBounds.height); boundsLogo.width = (int) (newBounds.height); lw.setPreferredBounds(boundsLogo); - + } - } + } } // Resize de la widget @@ -190,16 +178,15 @@ public boolean canFont() { return true; } - + } - + /** * Creation de la legende * * @param g * @param scene - * @param PreferredLocation - * peut etre null + * @param PreferredLocation peut etre null * @return */ public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene, final Point PreferredLocation) { @@ -263,14 +250,13 @@ }); } - + res.setController(new EbliWidgetControllerMenuOnly(res, false)); - // -- prendre en compte le resize automatique --// res.oldFont_ = new Font("Helvetica", Font.BOLD, 40); res.repaint(); - + return res; } 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 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -118,9 +118,7 @@ // pas joli joli mais c'est pour \xE9viter certaines erreurs de db4o try { final FilleVisuSaver saveData = findDataInDb(_db); - if (saveData == null) { - return null; - } + if (saveData == null) { return null; } final BCalque parent = visu_.getDonneesCalque(); if (saveData.props_ != null) { final BCalquePersistenceGroupe gr = new BCalquePersistenceGroupe(); @@ -136,9 +134,7 @@ private Runnable restoreFille(final FilleVisuSaver _saveData, final BuCommonImplementation _impl, final BCalque _parent) { - if (_saveData == null) { - return null; - } + if (_saveData == null) { return null; } final BuDesktop ds = _impl.getMainPanel().getDesktop(); if (ds != null) { if (Fu.DEBUG) { @@ -173,10 +169,9 @@ } private FilleVisuSaver findDataInDb(final ObjectContainer _db) { - if (_db == null) { - return null; - } + if (_db == null) { return null; } final Query q = _db.query(); + if (q == null || visu_ == null) return null; q.constrain(FilleVisuSaver.class); q.descend("name_").constrain(visu_.getName()); final ObjectSet set = q.execute(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java 2008-09-24 17:58:35 UTC (rev 3976) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaSaveLib.java 2008-09-24 21:15:55 UTC (rev 3977) @@ -49,9 +49,7 @@ } public static synchronized void configureDb4o() { - if (isConfigure_) { - return; - } + if (isConfigure_) { return; } isConfigure_ = true; final Configuration conf = Db4o.configure(); // conf.objectClass(FilleVisuSaver.class).cascadeOnDelete(true); @@ -119,27 +117,21 @@ } public static int count(final ObjectContainer _db, final Class _c) { - if (_db == null) { - return 0; - } + if (_db == null) { return 0; } final Query q = _db.query(); q.constrain(_c); return q.execute().size(); } public static void deleteAll(final ObjectContainer _db, final Class _c) { - if (_db == null) { - return; - } + if (_db == null) { return; } final Query q = _db.query(); q.constrain(_c); deleteAll(_db, q); } public static void deleteAll(final ObjectContainer _db, final ObjectSet _set) { - if (_db == null) { - return; - } + if (_db == null) { return; } while (_set.hasNext()) { _db.delete(_set.next()); } @@ -176,13 +168,9 @@ } public static FudaaSaveMainData getProjectDataOld(final File _file) { - if (_file == null) { - return null; - } + if (_file == null) { return null; } final File dbFile = _file; - if (!dbFile.exists()) { - return null; - } + if (!dbFile.exists()) { return null; } final ObjectContainer container = Db4o.openFile(dbFile.getAbsolutePath()); FudaaSaveMainData res = null; try { @@ -199,13 +187,9 @@ } public static Object getUniqueDataInDb(final File _dbFile, final Class _class) { - if (_dbFile == null) { - return null; - } + if (_dbFile == null) { return null; } final File dbFile = _dbFile; - if (!dbFile.exists()) { - return null; - } + if (!dbFile.exists()) { return null; } ObjectContainer container = null; Object res = null; try { @@ -223,9 +207,7 @@ } public static FudaaSaveMainData getProjectMainData(final ObjectContainer _cont) { - if (_cont == null) { - return null; - } + if (_cont == null) { return null; } final FudaaSaveMainData data = (FudaaSaveMainData) getUniqueData(FudaaSaveMainData.class, _cont); return data == null ? null : data; } @@ -240,15 +222,11 @@ * @return l'unique objet de class _class. Sinon null */ public static Object getUniqueData(final Class _class, final ObjectContainer _db) { - if (_db == null) { - return null; - } + if (_db == null) { return null; } final Query query = _db.query(); query.constrain(_class); final ObjectSet res = query.execute(); - if (res.size() != 1) { - return null; - } + if (res.size() != 1) { return null; } return res.next(); } @@ -298,7 +276,7 @@ Runnable res = null; final File zip = _zipFile; - if (zip != null && zip.exists()) { + if (zip != null && zip.exists() && _fille != null) { res = FudaaSaveLib.restoreFille(_impl, _fille, _prog, zip); } else { final File oldDb = _oldFile; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-23 18:36:12
|
Revision: 3975 http://fudaa.svn.sourceforge.net/fudaa/?rev=3975&view=rev Author: hadouxad Date: 2008-09-23 18:34:17 +0000 (Tue, 23 Sep 2008) Log Message: ----------- - Sepration des classes pour els format scope: une pour chaque format - tous les algorithmes ecriture/lecture sont ?\195?\169crits et blind?\195?\169s prou tous les formats - r?\195?\169alisation des junit et test unitaires ok pour tous les formats Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/resource/h2d_en.fr_txt 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/ScopeStructure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.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/tr/post/TrPostLayoutFille.java Added Paths: ----------- 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/ScopeReaderGene.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.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/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterSorT.java branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScopeGENE.java branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScopeSorT.java branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple.res.post.fzip branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple.scopGENE branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple.scopS branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/exemple.scopT branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/fichier.scopGENE branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/fichier.scopS branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/fichier.scopT branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/scope.scopGENE branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/scope.scopS branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/scope.scopT Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java Deleted: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java 2008-09-23 15:17:21 UTC (rev 3974) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -1,53 +0,0 @@ -package org.fudaa.dodico.telemac.io; - -import java.io.File; - -import org.fudaa.ctulu.CtuluIOOperationSynthese; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.fileformat.FileFormatUnique; -import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; -import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; -import org.fudaa.dodico.commun.DodicoLib; -import org.fudaa.dodico.fichiers.FileFormatSoftware; - - -/** - * Manager de fichiers au format scope. Utilis\xE9 poru la cr\xE9ation des graphes. - * - * @author Adrien Hadoux - * - */ -public class ScopeFileFormat extends FileFormatUnique { - - static final ScopeFileFormat INSTANCE = new ScopeFileFormat(); - - /** - * @return singleton - */ - public static ScopeFileFormat getInstance() { - return INSTANCE; - } - - private ScopeFileFormat() { - super(1); - extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_TEMPORELLE, ScopeKeyWord.TYPE_COURBE_SPATIALE, - ScopeKeyWord.TYPE_COURBE_MIXTE }; - id_ = "SCOPE"; - nom_ = "Scope"; - description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); - software_ = FileFormatSoftware.TELEMAC_IS; - } - - public FileReadOperationAbstract createReader() { - return new ScopeReader(this); - } - - public CtuluIOOperationSynthese write(final File _f, final Object _source, final ProgressionInterface _prog) { - return super.write(_f, _source, _prog); - } - - public FileWriteOperationAbstract createWriter() { - return new ScopeWriter(this); - } - -} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeGENEFileFormat.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,52 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.File; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; +import org.fudaa.dodico.commun.DodicoLib; +import org.fudaa.dodico.fichiers.FileFormatSoftware; + +/** + * Manager de fichiers au format scope. Utilis\xE9 pour la cr\xE9ation des graphes. au + * format SCOPGENE + * + * @author Adrien Hadoux + * + */ +public class ScopeGENEFileFormat extends FileFormatUnique { + + static final ScopeGENEFileFormat INSTANCE = new ScopeGENEFileFormat(); + + /** + * @return singleton + */ + public static ScopeGENEFileFormat getInstance() { + return INSTANCE; + } + + private ScopeGENEFileFormat() { + super(1); + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_MIXTE }; + id_ = "SCOPE"; + nom_ = "Scope"; + description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); + software_ = FileFormatSoftware.TELEMAC_IS; + } + + public FileReadOperationAbstract createReader() { + return new ScopeReaderGene(this); + } + + public CtuluIOOperationSynthese write(final File _f, final Object _source, final ProgressionInterface _prog) { + return super.write(_f, _source, _prog); + } + + public FileWriteOperationAbstract createWriter() { + return new ScopeWriterGENE(this); + } + +} \ 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 2008-09-23 15:17:21 UTC (rev 3974) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeKeyWord.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -14,7 +14,9 @@ public final static String TYPE_COURBE_TEMPORELLE = "ScopS"; public final static String TYPE_COURBE_SPATIALE = "ScopT"; public final static String TYPE_COURBE_MIXTE = "SCOPGENE"; + public final static String SYMBOL_VALUE_UNDEFINED = "*"; + public ScopeKeyWord() { } @@ -25,25 +27,47 @@ return version_; } + public boolean isUndefined(String val) { + return SYMBOL_VALUE_UNDEFINED.equals(val); + } + /** * @return BlocCommentaire */ - public String getBlocCommentaire() { + public String getBlocCommentaireSorT() { return blocCommentaireSorT_; } + + public String getBlocCommentaireGENE() { + return blocCommentaireGene_; + } /** * Verifie que lon est pas en presence d un commentaire a la fois pour les - * formats s,t et gene + * formats s et t * * @param _t * @return BlocCommentaire */ - public boolean isBlocCommentaire(final String _t) { - return (blocCommentaireSorT_.equals(_t) || blocCommentaireGene_.equals(_t)); + public boolean isBlocCommentaireSorT(final String _t) { + // return (blocCommentaireSorT_.equals(_t) || blocCommentaireGene_.equals(_t)); + + if(_t==null) + return false; + return _t.startsWith(blocCommentaireSorT_); } + + + public boolean isBlocCommentaireGENE(final String _t) { + // return (blocCommentaireSorT_.equals(_t) || + // blocCommentaireGene_.equals(_t)); + if (_t == null) + return false; + return _t.startsWith(blocCommentaireGene_); + } + /** * retourne la bonen chaine separator en fonction de la valeur de iparam * envoy\xE9e. @@ -56,14 +80,31 @@ case 0: return "TEMPS ="; case 1: - return " X ="; + return "X ="; case 2: - return " Y ="; + return "Y ="; case 3: - return " Z ="; + return "Z ="; } return null; } + public int getScopeGENESeparator(String debutLigne) { + + if(debutLigne.startsWith("TEMPS =")) + return 0; + else + if(debutLigne.startsWith("X =")) + return 1; + else + if(debutLigne.startsWith("Y =")) + return 2; + else + if(debutLigne.startsWith("Z =")) + return 3; + else + return 0; + } + } Deleted: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java 2008-09-23 15:17:21 UTC (rev 3974) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -1,301 +0,0 @@ -package org.fudaa.dodico.telemac.io; - -import java.io.EOFException; -import java.io.File; -import java.io.IOException; - -import org.fudaa.ctulu.CtuluActivity; -import org.fudaa.ctulu.CtuluLibFile; -import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; -import org.fudaa.dodico.fortran.FileOpReadCharSimpleAbstract; -import org.fudaa.dodico.h2d.resource.H2dResource; - -/** - * Classe reader de fichier au format scope. Utilise fortranReader - * @author Adrien Hadoux - * - */ -public class ScopeReader extends FileOpReadCharSimpleAbstract implements CtuluActivity { - - - FileFormatVersionInterface v_; - private String name_; - ScopeKeyWord key = new ScopeKeyWord(); - private int nbOctets_; - private String extension_; - public ScopeReader(final FileFormatVersionInterface _v) { - v_ = _v; - } - - - protected void processFile(final File _f) { - name_ = CtuluLibFile.getSansExtension(_f.getName()); - nbOctets_ = (int) _f.length(); - extension_ = CtuluLibFile.getExtension(_f.getName()); - } - - @Override - protected Object internalRead() { - return readZones(); - } - - public void stop() { - } - - - /** - * Lit selon l extension un format gen ou alors s ou t plsu simple a lire. - * - * @return - */ - ScopeStructure readZones() { - - if (ScopeKeyWord.TYPE_COURBE_MIXTE.equals(extension_)) - return readZonesMixte(); - else - return readZonesSorT(); - } - - /** - * - * Retourne une map. La premiere clef indique le type de data (tempo,spatial - * ou mixte, cf var static de ScopeKeyWord) les 3 clef suivantes contiennent - * les titres ensuite chaque paire contient le titre de la variables et ses - * valeurs associ\xE9es sous arraylist de doubles. - * - * @return - */ - ScopeStructure readZonesSorT() { - - if (super.in_ == null) { - analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); - return null; - } - - ScopeStructure.SorT structure = new ScopeStructure.SorT(); - String typeLigne = null; - String ligne = null; - - try { - if ((progress_ != null) && (nbOctets_ > 0)) { - progress_.setProgression(0); - progress_.setDesc("R\xE9cup\xE9ration des titres et nons des variables"); - } - - // -- creation du type de courbe contenu dans les datas --// - structure.type = extension_; - - - // -- on commence a lire a partir de la ligne 3 pour recuperer les variables - int cpt = 0; - do { - in_.readFields(); - typeLigne = in_.stringField(0); - ligne = in_.getLine(); - - if (key.isBlocCommentaire(typeLigne) && cpt < 3) - // titre - structure.addTitle(ligne); - else if (key.isBlocCommentaire(typeLigne)) { - // nom de variable - structure.addVariable(ligne); - } - cpt++; - } while (key.isBlocCommentaire(typeLigne)); - progress_.setProgression(30); - progress_.setDesc("R\xE9cup\xE9ration des donn\xE9es"); - - // -- on lit toutes les valeurs pour une variable jusqu a l a fin de fichier--// - try{ - while(true){ - typeLigne = in_.stringField(0); - if (!key.isBlocCommentaire(typeLigne)) { - // -- on recupere toutes les valeurs de la variable --// - for (int i = 0; i < structure.getNbVariables(); i++) { - double val = in_.doubleField(i); - // ajout dans la map - structure.addValueForVariable(val, i); - } - } - in_.readFields(); - - } - - - }catch(EOFException Exc){ - return structure; - } - - - } catch (IOException e) { - e.printStackTrace(); - return null; - } - - } - - - private ScopeStructure readZonesMixte() { - - if (super.in_ == null) { - analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); - return null; - } - - ScopeStructure.Gene structure = new ScopeStructure.Gene(); - String typeLigne = null; - String ligne = null; - - try { - if ((progress_ != null) && (nbOctets_ > 0)) { - progress_.setProgression(0); - progress_.setDesc("R\xE9cup\xE9ration des titres et nons des variables"); - } - - // -- creation du type de courbe contenu dans les datas --// - structure.type = extension_; - - // --on lit touts les titres tant qu il y a un com --// - - do { - in_.readFields(); - typeLigne = in_.stringField(0); - ligne = in_.getLine(); - // titre - if (key.isBlocCommentaire(typeLigne)) - structure.addTitle(ligne); - - } while (key.isBlocCommentaire(typeLigne)); - - // --on lit le nombre de pas de temps --// - int nbVar = in_.intField(0); - - // -- on lit les params des pas de temps et on init les liste de var - // associees - for(int i=0;i<nbVar;i++){ - in_.readFields(); - - structure.addPasDeTemps(in_.getLine()); - } - progress_.setProgression(30); - - // --on lit le tableau IPARAM --// - in_.readFields(); - final int MODE_ECLATE = in_.intField(0); - final int SEPARATOR = in_.intField(1); - - int indicePasDeTemps = -1; - - in_.readFields(); - // -- on lit toutes les pas de temps --// - try { - while (true) { - - typeLigne = in_.stringField(0); - if (!key.isBlocCommentaire(typeLigne)) { - - if (MODE_ECLATE == 0) { - // -- MODE ECLATE 0 == toutes les valeurs des variabels sont sur - // la meme ligne - - - if (in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { - - // -- on est arriv\xE9 a une ligne de pas de temps --// - indicePasDeTemps++; - - in_.readFields(); - - //-- tant qu'on ne revient pas a un nouveau pas de temps on ajoute les var --// - while (!in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { - if (!key.isBlocCommentaire(typeLigne)) { - //ce sont des var on les ajoute toutes - int nbFields=in_.getNumberOfFields(); - for (int i = 0; i < nbFields; i++) { - // on alloue la place pour la var - structure.addVariableForPDt("var " + i, indicePasDeTemps); - - //on inscrit la valeur pour la variable du pas de temps correspondant - double value=in_.doubleField(i); - structure.addValueForVariableAtPdt(value, i, indicePasDeTemps); - - } - - - } - // on lit la suite - in_.readFields(); - } - - - } else - in_.readFields(); - - - } else if (MODE_ECLATE == 1) { - // -- MODE ECLATE 1 == toutes les valeurs des variabels sont sur - // la meme ligne - - - if (in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { - - // -- on est arriv\xE9 a une ligne de pas de temps --// - indicePasDeTemps++; - - in_.readFields(); - - // -- tant qu'on ne revient pas a un nouveau pas de temps on - // ajoute les var --// - while (!in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { - - // -- il faut passer les lignes qui comencent par VARIABLE= ou - // commentaire --// - if (!key.isBlocCommentaire(typeLigne) && !in_.getLine().startsWith("VARIABLE =")) { - - // ce sont des var on les lis ligne par ligne - int indiceVar = 0; - //tant qu on ne revient pas sur une ligne du type VAR= - while (!in_.getLine().startsWith("VARIABLE =")){ - // on alloue la place pour la var - structure.addVariableForPDt("var " + indiceVar, indicePasDeTemps); - - // on inscrit la valeur pour la variable du pas de temps - // correspondant - double value = in_.doubleField(0); - structure.addValueForVariableAtPdt(value, indiceVar, indicePasDeTemps); - indiceVar++; - - //on lit la var suivante - in_.readFields(); - } - - } - else - // on lit la suite - in_.readFields(); - } - - } - - } else - in_.readFields(); - - - } - } - - - - } catch (EOFException Exc) { - return structure; - } - - } catch (IOException e) { - e.printStackTrace(); - return null; - } - - } - - -} Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,254 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.EOFException; +import java.io.File; +import java.io.IOException; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; +import org.fudaa.dodico.fortran.FileOpReadCharSimpleAbstract; +import org.fudaa.dodico.h2d.resource.H2dResource; + +/** + * Classe reader de fichier au format scope Gene, evolu\xE9 par rapport a s ou t. + * Utilise fortranReader + * + * @author Adrien Hadoux + * + */ +public class ScopeReaderGene extends FileOpReadCharSimpleAbstract implements CtuluActivity { + + FileFormatVersionInterface v_; + private String name_; + ScopeKeyWord key = new ScopeKeyWord(); + private int nbOctets_; + private String extension_; + + public ScopeReaderGene(final FileFormatVersionInterface _v) { + v_ = _v; + } + + protected void processFile(final File _f) { + name_ = CtuluLibFile.getSansExtension(_f.getName()); + nbOctets_ = (int) _f.length(); + extension_ = CtuluLibFile.getExtension(_f.getName()); + } + + @Override + protected Object internalRead() { + return readStructure(); + } + + public void stop() { + } + + + public void setProgression(int val, String desc) { + if (progress_ != null) { + progress_.setProgression(val); + progress_.setDesc(desc); + } + } + + + + + + /** + * Lit selon l extension un format gen ou alors s ou t plsu simple a lire. + * + * @return + */ + ScopeStructure readStructure() { + + if (super.in_ == null) { + analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); + return null; + } + + ScopeStructure.Gene structure = new ScopeStructure.Gene(); + + + + try { + if ((progress_ != null) && (nbOctets_ > 0)) { + setProgression(0, H2dResource.getS("R\xE9cup\xE9ration des titres et nons des variables")); + } + + // -- creation du type de courbe contenu dans les datas --// + structure.type = extension_; + + // --on lit touts les titres tant qu il y a un com --// + + readHeader(structure); + + + readVariable(structure); + + setProgression(30, H2dResource.getS("R\xE9cup\xE9ration des valeurs")); + + // --on lit le tableau IPARAM --// + in_.readFields(); + final int MODE_ECLATE = in_.intField(0); + final int SEPARATOR = in_.intField(1); + + int indicePasDeTemps = -1; + + in_.readFields(); + // -- on lit toutes les pas de temps --// + try { + while (true) { + + + if (!key.isBlocCommentaireGENE(in_.getLine())) { + + if (MODE_ECLATE == 0) { + + readValuesModeNonEclate(structure, SEPARATOR); + + } else if (MODE_ECLATE == 1) { + + readValuesModeEclate(structure, SEPARATOR); + + } else + in_.readFields(); + } else + in_.readFields(); + } + + } catch (EOFException Exc) { + return structure; + } + + } catch (IOException e) { + e.printStackTrace(); + return null; + } + + } + + + public void readHeader(ScopeStructure.Gene structure) throws IOException { + String ligne = null; + do { + in_.readFields(); + + ligne = in_.getLine(); + // titre + if (key.isBlocCommentaireGENE(ligne)) + structure.addTitle(ligne); + + } while (key.isBlocCommentaireGENE(ligne)); + + } + + public void readVariable(ScopeStructure.Gene structure) throws IOException { + // --on lit le nombre de variables--// + int nbVar = in_.intField(0); + + // -- on lit les params des pas de temps et on init les liste de var + // associees + for (int i = 0; i < nbVar; i++) { + in_.readFields(); + + structure.addVariable(in_.getLine()); + } + } + + + /** + * MODE ECLATE 0 == toutes les valeurs des variabels sont sur la meme ligne + * @param structure + * @param SEPARATOR + * @param indicePasDeTemps + * @throws IOException + */ + public void readValuesModeNonEclate(ScopeStructure.Gene structure, int SEPARATOR) + throws IOException { + if (in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + + // -- on est arriv\xE9 a une ligne de pas de temps, on ajoute le pas de temps + // dans la structure --// + String valuePasDetemps = in_.getLine(); + structure.addPasDeTemps(valuePasDetemps); + + + in_.readFields(); + + // -- tant qu'on ne revient pas a un nouveau pas de temps on + // ajoute les var --// + while (!in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + if (!key.isBlocCommentaireGENE(in_.getLine())) { + // ce sont des var on les ajoute toutes + int nbFields = in_.getNumberOfFields(); + for (int i = 0; i < nbFields; i++) { + // on inscrit la valeur pour la variable du pas de temps + // correspondant + double value =0; + if (!key.isUndefined(in_.stringField(i))) + value = in_.doubleField(i); + + structure.addValueForVariableAtPdt(value, i, valuePasDetemps); + } + } + // on lit la suite + in_.readFields(); + } + + } else + in_.readFields(); + } + + /** + * MODE ECLATE 1 == toutes les valeurs des variabels sont sur la meme ligne + * @param structure + * @param SEPARATOR + * @param indicePasDeTemps + * @throws IOException + */ + public void readValuesModeEclate(ScopeStructure.Gene structure, int SEPARATOR) + throws IOException { + if (in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + + // -- on est arriv\xE9 a une ligne de pas de temps --// + + String valuePasDetemps = in_.getLine(); + structure.addPasDeTemps(valuePasDetemps); + + in_.readFields(); + + // -- tant qu'on ne revient pas a un nouveau pas de temps on + // ajoute les var --// + while (!in_.getLine().startsWith(key.getScopeGENESeparator(SEPARATOR))) { + + // -- il faut passer les lignes qui comencent par VARIABLE= ou + // commentaire --// + if (!key.isBlocCommentaireGENE(in_.getLine()) && !in_.getLine().startsWith("VARIABLE =")) { + + // ce sont des var on les lis ligne par ligne + int indiceVar = 0; + // tant qu on ne revient pas sur une ligne du type VAR= + while (!in_.getLine().startsWith("VARIABLE =")) { + + + // on inscrit la valeur pour la variable du pas de temps + // correspondant + double value = in_.doubleField(0); + structure.addValueForVariableAtPdt(value, indiceVar, valuePasDetemps); + indiceVar++; + + // on lit la var suivante + in_.readFields(); + } + + } else + // on lit la suite + in_.readFields(); + } + + } + + } + +} Copied: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java (from rev 3969, branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReader.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,149 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.EOFException; +import java.io.File; +import java.io.IOException; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; +import org.fudaa.dodico.fortran.FileOpReadCharSimpleAbstract; +import org.fudaa.dodico.h2d.resource.H2dResource; + +/** + * Classe reader de fichier au format scope. Utilise fortranReader + * @author Adrien Hadoux + * + */ +public class ScopeReaderSorT extends FileOpReadCharSimpleAbstract implements CtuluActivity { + + + FileFormatVersionInterface v_; + private String name_; + ScopeKeyWord key = new ScopeKeyWord(); + private int nbOctets_; + private String extension_; + public ScopeReaderSorT(final FileFormatVersionInterface _v) { + v_ = _v; + } + + + protected void processFile(final File _f) { + name_ = CtuluLibFile.getSansExtension(_f.getName()); + nbOctets_ = (int) _f.length(); + extension_ = CtuluLibFile.getExtension(_f.getName()); + } + + @Override + protected Object internalRead() { + return readStructure(); + } + + public void stop() { + } + + + public void setProgression(int val, String desc) { + if (progress_ != null) { + progress_.setProgression(val); + progress_.setDesc(desc); + } + } + + /** + * + * Retourne une map. La premiere clef indique le type de data (tempo,spatial + * ou mixte, cf var static de ScopeKeyWord) les 3 clef suivantes contiennent + * les titres ensuite chaque paire contient le titre de la variables et ses + * valeurs associ\xE9es sous arraylist de doubles. + * + * @return + */ + ScopeStructure readStructure() { + + + if (super.in_ == null) { + analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); + return null; + } + + ScopeStructure.SorT structure = new ScopeStructure.SorT(); + + String ligne = null; + + try { + if ((progress_ != null) && (nbOctets_ > 0)) { + setProgression(0, "R\xE9cup\xE9ration des titres et nons des variables"); + } + + // -- creation du type de courbe contenu dans les datas --// + structure.type = extension_; + + readHeader(structure); + + + setProgression(30, "R\xE9cup\xE9ration des donn\xE9es"); + + + // -- on lit toutes les valeurs pour une variable jusqu a l a fin de fichier--// + try{ + readData(structure); + + + }catch(EOFException Exc){ + + + return structure; + } + + + } catch (IOException e) { + e.printStackTrace(); + return null; + } + return null; + } + + + + public void readHeader(ScopeStructure.SorT structure) throws IOException { + String ligne = null; + int cpt = 0; + do { + in_.readFields(); + + ligne = in_.getLine(); + + if (key.isBlocCommentaireSorT(ligne) && cpt < 3) + // titre + structure.addTitle(ligne); + else if (key.isBlocCommentaireSorT(ligne)) { + // nom de variable + structure.addVariable(ligne); + } + cpt++; + } while (key.isBlocCommentaireSorT(ligne)); + + } + + + public void readData(ScopeStructure.SorT structure) throws IOException { + + while (true) { + + if (!key.isBlocCommentaireSorT(in_.getLine())) { + // -- on recupere toutes les valeurs de la variable --// + for (int i = 0; i < structure.getNbVariables(); i++) { + double val = in_.doubleField(i); + // ajout dans la map + structure.addValueForVariable(val, i); + } + } + in_.readFields(); + + } + } + + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java ___________________________________________________________________ Added: svn:mergeinfo + Copied: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java (from rev 3969, branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeFileFormat.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,52 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.File; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; +import org.fudaa.dodico.commun.DodicoLib; +import org.fudaa.dodico.fichiers.FileFormatSoftware; + +/** + * Manager de fichiers au format scope. Utilis\xE9 pour la cr\xE9ation des graphes. au + * format ScopS + * + * @author Adrien Hadoux + * + */ +public class ScopeSFileFormat extends FileFormatUnique { + + static final ScopeSFileFormat INSTANCE = new ScopeSFileFormat(); + + /** + * @return singleton + */ + public static ScopeSFileFormat getInstance() { + return INSTANCE; + } + + private ScopeSFileFormat() { + super(1); + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_TEMPORELLE }; + id_ = "SCOPE"; + nom_ = "Scope"; + description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); + software_ = FileFormatSoftware.TELEMAC_IS; + } + + public FileReadOperationAbstract createReader() { + return new ScopeReaderSorT(this); + } + + public CtuluIOOperationSynthese write(final File _f, final Object _source, final ProgressionInterface _prog) { + return super.write(_f, _source, _prog); + } + + public FileWriteOperationAbstract createWriter() { + return new ScopeWriterSorT(this); + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeSFileFormat.java ___________________________________________________________________ Added: svn:mergeinfo + 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 2008-09-23 15:17:21 UTC (rev 3974) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; @@ -14,7 +13,10 @@ */ public abstract class ScopeStructure { + public final static ScopeKeyWord KEY = new ScopeKeyWord(); + public abstract void printResults(); + /** * Structure pour les fichiers s ou t * @@ -35,11 +37,15 @@ } public void addTitle(String ligne) { + ligne = ligne.replace(KEY.getBlocCommentaireSorT(), ""); titles_.add(ligne); } public void addVariable(String ligne) { + + ligne = ligne.replace(KEY.getBlocCommentaireSorT(), ""); + listeVariales_.add(ligne); // on init la liste des valeurs de la variabel correspondante data_.put(ligne, new ArrayList<Double>()); @@ -49,13 +55,61 @@ return listeVariales_.size(); } + public String getVariable(int _i) { + return listeVariales_.get(_i); + } public void addValueForVariable(double value, int indexVariable) { data_.get(listeVariales_.get(indexVariable)).add(value); } + /** + * Retourne le nombre de valeur pour chaque variables + * + * @return + */ + public int getNbValuePerVariables() { + + if (listeVariales_.size() == 0) + return 0; + return data_.get(listeVariales_.get(0)).size(); + } + + /** + * retourne une string qui contient toutes les valeurs a l indice value pour + * toutes les variables + * + * @param indice + * dans les tableaux des variables + * @return + */ + public String getListValuesofAllVariable(int indiceValue) { + String brochetteVal = ""; + + for (int i = 0; i < getNbVariables(); i++) { + if (i > 0) + brochetteVal += " "; + brochetteVal += data_.get(listeVariales_.get(i)).get(indiceValue); + + } + return brochetteVal; } + @Override + public void printResults() { + System.err.print("\n Contenu du fichier scope"); + for(int i=0;i<titles_.size();i++) + System.err.print("\n" + titles_.get(i)); + for(int i=0;i<listeVariales_.size();i++) + System.err.print("\n" + listeVariales_.get(i)); + + for (int i = 0; i < getNbValuePerVariables(); i++) + System.err.print("\n" + getListValuesofAllVariable(i)); + + } + + } + /** * * @author Adrien Hadoux. @@ -66,35 +120,63 @@ */ public static class Gene extends ScopeStructure { + /** + * Map qui donne a chaque pas de temps sa liste de valeurs pour chaque + * variables. + */ private Map<String, ArrayList<ArrayList<Double>>> data_ = new HashMap<String, ArrayList<ArrayList<Double>>>(); private List<String> listePasDeTemps = new ArrayList<String>(); - private HashSet<String> listeVariales_ = new HashSet<String>(); + private List<String> listeVariales_ = new ArrayList<String>(); private List<String> titles_ = new ArrayList<String>(); + + public String type = ScopeKeyWord.TYPE_COURBE_MIXTE; public Gene() { + // ajout par defaut des variables x + listeVariales_.add("X"); } public void addTitle(String ligne) { + ligne = ligne.replace(KEY.getBlocCommentaireGENE(), ""); titles_.add(ligne); } + public void addVariable(String ligne) { + ligne = ligne.replace(KEY.getBlocCommentaireGENE(), ""); + listeVariales_.add(ligne); + + + + } + public void addPasDeTemps(String ligne) { + ligne = ligne.replace(KEY.getBlocCommentaireGENE(), ""); + listePasDeTemps.add(ligne); - // on init la liste des valeurs de la variabel correspondante - data_.put(ligne, new ArrayList<ArrayList<Double>>()); + + // on ajoute un enregistrment dans data pour le pas de temps + // correspondant + ArrayList<ArrayList<Double>> listeDuPdt = new ArrayList<ArrayList<Double>>(); + data_.put(ligne, listeDuPdt); + + // --il faut initialiser cette liste du pas de temps en y ajoutant autant + // de listes qu il y a de variables --// + for (int i = 0; i < getNbVariables(); i++) + listeDuPdt.add(new ArrayList<Double>()); + } - - public void addVariableForPDt(String labelVariable, int pdt) { - listeVariales_.add(labelVariable); - getListeVarForPasDeTemps(pdt).add(new ArrayList<Double>()); - - } + // public void addVariableForPDt(String labelVariable, int pdt) { + // labelVariable = labelVariable.replace(KEY.getBlocCommentaireGENE(), ""); + // listeVariales_.add(labelVariable); + // getListeVarForPasDeTemps(pdt).add(new ArrayList<Double>()); + // + // } public int getNbPasDeTemps() { return listePasDeTemps.size(); @@ -105,19 +187,114 @@ return listeVariales_.size(); } + public ArrayList<ArrayList<Double>> getListeVarForPasDeTemps(String pdt) { + return data_.get(pdt); + } + public ArrayList<ArrayList<Double>> getListeVarForPasDeTemps(int pdt) { return data_.get(listePasDeTemps.get(pdt)); } - public ArrayList<Double> getListValueForVariableForPDT(int pdt, int var) { + public ArrayList<Double> getListValueForVariableForPDT(String pdt, int var) { + + return getListeVarForPasDeTemps(pdt).get(var); } - public void addValueForVariableAtPdt(double value, int indexVariable, int indexPasDeTemps) { - getListValueForVariableForPDT(indexPasDeTemps, indexVariable).add(value); + public void addValueForVariableAtPdt(double value, int indexVariable, String valuePasDetemps) { + ArrayList<Double> listeValueOfVar = getListValueForVariableForPDT(valuePasDetemps, indexVariable); + // if (listeValueOfVar == null) + // listeValueOfVar = new ArrayList<Double>(); + + listeValueOfVar.add(value); } + + + /** + * tailel par defaut des donnees pour une variale donn\xE9 pour un pas de temps + * donn\xE9 + * + * @return + */ + // public int getNbValuePerVariablesPerPdt() { + // + // return getListValueForVariableForPDT(listePasDeTemps.get(0), 0).size(); + // } + + /** + * retourne l equivalent d une ligne du fichier qui contient les valeurs + * pour chaque variables pour un pas de temps donn\xE9. + * + * @param pasDetemps + * @return + */ + public String getAllValuesForVariableAndPasDeTemps(String pasDetemps,int indiceValue) { + + String ligneBrochette = ""; + for (int i = 0; i < listeVariales_.size(); i++) { + ArrayList<Double> listeValueOfVar = getListValueForVariableForPDT(pasDetemps, i); + if (i != 0) + ligneBrochette += " "; + ligneBrochette += listeValueOfVar.get(indiceValue); + } + + return ligneBrochette; + } + + + public String getPasDeTemps(int i) { + return listePasDeTemps.get(i); + } + public String getVariable(int i) { + return listeVariales_.get(i); + } + + + public int getNbTitles() { + return titles_.size(); + } + public String getTitle(int i) { + return titles_.get(i); + } + + + @Override + public void printResults() { + // titres + for (int i = 0; i < getNbTitles(); i++) { + System.err.print("\n" + getTitle(i)); + } + // nb variabels - le x + System.err.print("\n" + (getNbVariables() - 1)); + + for (int i = 0; i < getNbVariables(); i++) { + System.err.print("\n" + getVariable(i)); + } + + // tableau de val mode non eclatee + String tableauVal = "0 " + KEY.getScopeGENESeparator(getPasDeTemps(0)) + " 0 0 0 0 0 0 0 0"; + System.err.print("\n" + tableauVal); + + // pour chaque pas de temps + for (int i = 0; i < listePasDeTemps.size(); i++) { + // separator pas de temps + System.err.print("\n " + getPasDeTemps(i)); + + int nbValuesForThisPdt = getListeVarForPasDeTemps(i).get(0).size(); + // -- parcours la liste des donnees + for (int k = 0; k < nbValuesForThisPdt; k++) { + + System.err.print("\n" + getAllValuesForVariableAndPasDeTemps(getPasDeTemps(i), k)); + + + } + + } + + } + } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeTFileFormat.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,52 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.File; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.fileformat.FileReadOperationAbstract; +import org.fudaa.ctulu.fileformat.FileWriteOperationAbstract; +import org.fudaa.dodico.commun.DodicoLib; +import org.fudaa.dodico.fichiers.FileFormatSoftware; + +/** + * Manager de fichiers au format scope. Utilis\xE9 pour la cr\xE9ation des graphes. au + * format ScopT + * + * @author Adrien Hadoux + * + */ +public class ScopeTFileFormat extends FileFormatUnique { + + static final ScopeTFileFormat INSTANCE = new ScopeTFileFormat(); + + /** + * @return singleton + */ + public static ScopeTFileFormat getInstance() { + return INSTANCE; + } + + private ScopeTFileFormat() { + super(1); + extensions_ = new String[] { ScopeKeyWord.TYPE_COURBE_SPATIALE }; + id_ = "SCOPE"; + nom_ = "Scope"; + description_ = DodicoLib.getS("Comporte les d\xE9finitions de courbes temporelles et spatiales."); + software_ = FileFormatSoftware.TELEMAC_IS; + } + + public FileReadOperationAbstract createReader() { + return new ScopeReaderSorT(this); + } + + public CtuluIOOperationSynthese write(final File _f, final Object _source, final ProgressionInterface _prog) { + return super.write(_f, _source, _prog); + } + + public FileWriteOperationAbstract createWriter() { + return new ScopeWriterSorT(this); + } + +} \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java 2008-09-23 15:17:21 UTC (rev 3974) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -1,34 +0,0 @@ -package org.fudaa.dodico.telemac.io; - -import org.fudaa.ctulu.CtuluActivity; -import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; -import org.fudaa.dodico.fortran.FileOpWriterCharSimpleAbstract; - -/** - * Classe writer de fichier au format scope. Utilise fortranWriter - * - * @author Adrien Hadoux - * - */ -public class ScopeWriter extends FileOpWriterCharSimpleAbstract implements CtuluActivity { - - boolean stop_; - final FileFormatVersionInterface v_; - - ScopeKeyWord key = new ScopeKeyWord(); - - public ScopeWriter(final FileFormatVersionInterface _v) { - v_ = _v; - - } - - - public void stop() { - stop_ = true; - } - - @Override - protected void internalWrite(Object _o) { - } - -} Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,113 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.IOException; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; +import org.fudaa.dodico.fortran.FileOpWriterCharSimpleAbstract; +import org.fudaa.dodico.h2d.resource.H2dResource; + +/** + * Classe writer de fichier au format scope GENE. Utilise fortranWriter + * + * @author Adrien Hadoux + * + */ +public class ScopeWriterGENE extends FileOpWriterCharSimpleAbstract implements CtuluActivity { + + boolean stop_; + final FileFormatVersionInterface v_; + + ScopeKeyWord key_ = new ScopeKeyWord(); + + public ScopeWriterGENE(final FileFormatVersionInterface _v) { + v_ = _v; + + } + + public void stop() { + stop_ = true; + } + + @Override + protected void internalWrite(Object _o) { + if (_o instanceof ScopeStructure) { + writeStruct((ScopeStructure.Gene) _o); + } else { + donneesInvalides(_o); + } + } + + protected void writeStruct(ScopeStructure.Gene _struct) { + + if (super.out_ == null) { + analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); + return; + } + + // -- ecriture dans le fichier --// + try { + // -- ecriture des lignes titres --// + writeHeader(_struct); + + // -- ecritures des variables --// + writeVariable(_struct); + + // -- ecritures de toutes les valeurs des variables --// + writeData(_struct); + + } catch (final IOException e) { + analyze_.manageException(e); + } + } + + public void setProgression(int val, String desc) { + if (progress_ != null) { + progress_.setProgression(val); + progress_.setDesc(desc); + } + } + + protected void writeHeader(ScopeStructure.Gene _struct) throws IOException { + String bc = key_.getBlocCommentaireGENE(); + setProgression(0, H2dResource.getS("Cr\xE9ation des en-t\xEAtes") + bc); + for (int i = 0; i < _struct.getNbTitles(); i++) { + writelnToOut(bc + _struct.getTitle(i)); + } + + } + + protected void writeVariable(ScopeStructure.Gene _struct) throws IOException { + + setProgression(10, H2dResource.getS("Cr\xE9ation des variables")); + // nb variabels - le x + writelnToOut("" + (_struct.getNbVariables() - 1)); + for (int i = 1; i < _struct.getNbVariables(); i++) { + writelnToOut(_struct.getVariable(i)); + } + // tableau de val mode non eclatee + String tableauVal = "0 " + key_.getScopeGENESeparator(_struct.getPasDeTemps(0)) + " 0 0 0 0 0 0 0 0"; + writelnToOut(tableauVal); + } + + protected void writeData(ScopeStructure.Gene _struct) throws IOException { + + setProgression(30, H2dResource.getS("Cr\xE9ation des donn\xE9es")); + // pour chaque pas de temps + for (int i = 0; i < _struct.getNbPasDeTemps(); i++) { + // separator pas de temps + writelnToOut(_struct.getPasDeTemps(i)); + + // -- parcours la liste des donnees + int nbValuesForThisPdt = _struct.getListeVarForPasDeTemps(i).get(0).size(); + for (int k = 0; k < nbValuesForThisPdt; k++) { + + writelnToOut(_struct.getAllValuesForVariableAndPasDeTemps(_struct.getPasDeTemps(i), k)); + + } + + } + } + + +} Copied: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterSorT.java (from rev 3969, branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriter.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterSorT.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterSorT.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,108 @@ +package org.fudaa.dodico.telemac.io; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; +import org.fudaa.dodico.fortran.FileOpWriterCharSimpleAbstract; +import org.fudaa.dodico.h2d.resource.H2dResource; + +/** + * Classe writer de fichier au format scope. Utilise fortranWriter + * + * @author Adrien Hadoux + * + */ +public class ScopeWriterSorT extends FileOpWriterCharSimpleAbstract implements CtuluActivity { + + boolean stop_; + final FileFormatVersionInterface v_; + + ScopeKeyWord key_ = new ScopeKeyWord(); + + public ScopeWriterSorT(final FileFormatVersionInterface _v) { + v_ = _v; + + } + + + public void stop() { + stop_ = true; + } + + @Override + protected void internalWrite(Object _o) { + if (_o instanceof ScopeStructure) { + writeStruct((ScopeStructure.SorT) _o); + } else { + donneesInvalides(_o); + } + } + + /** + * Ecriture de la structure dans un fichier + * + * @param _struct + */ + protected void writeStruct(ScopeStructure.SorT _struct) { + + if (super.out_ == null) { + analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); + return; + } + + // -- ecriture dans le fichier --// + try { + // -- ecriture des 3 premieres lignes titres --// + writeHeader(); + + // -- ecritures des variables --// + writeVariable(_struct); + + // -- ecritures de toutes les valeurs des variables --// + writeData(_struct); + + + } catch (final IOException e) { + analyze_.manageException(e); + } + } + + public void setProgression(int val, String desc) { + if (progress_ != null) { + progress_.setProgression(val); + progress_.setDesc(desc); + } + } + + + protected void writeHeader() throws IOException { + String bc = key_.getBlocCommentaireSorT(); + setProgression(0, H2dResource.getS("Cr\xE9ation des en-t\xEAtes") + bc); + writelnToOut(bc + H2dResource.getS("Fichier g\xE9n\xE9r\xE9 par Fudaa") + bc); + final String date = new SimpleDateFormat("yyyy-M-d k:mm:ss").format(Calendar.getInstance().getTime()); + writelnToOut(bc + "Version " + key_.getVersion() + " - Date " + date + bc); + writelnToOut(bc); + } + + protected void writeVariable(ScopeStructure.SorT _struct) throws IOException { + String bc = key_.getBlocCommentaireSorT(); + setProgression(10, H2dResource.getS("Cr\xE9ation des variables")); + + for (int i = 0; i < _struct.getNbVariables(); i++) { + writelnToOut(bc + _struct.getVariable(i) + bc); + } + } + + protected void writeData(ScopeStructure.SorT _struct) throws IOException { + String bc = key_.getBlocCommentaireSorT(); + setProgression(30, H2dResource.getS("Cr\xE9ation des donn\xE9es")); + for (int i = 0; i < _struct.getNbValuePerVariables(); i++) { + writelnToOut(_struct.getListValuesofAllVariable(i)); + } + } + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterSorT.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java 2008-09-23 15:17:21 UTC (rev 3974) +++ branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScope.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -1,127 +0,0 @@ -package org.fudaa.dodico.telemac; - -import java.io.File; - -import junit.framework.TestCase; - -import org.fudaa.ctulu.CtuluIOOperationSynthese; -import org.fudaa.ctulu.gis.GISZone; -import org.fudaa.dodico.all.TestIO; -import org.fudaa.dodico.telemac.io.ScopeFileFormat; -import org.fudaa.dodico.telemac.io.SinusxFileFormat; - -public class TestJScope extends TestCase { - /** - * Le fichier de lecture. - */ - String testLectureFic_; - - - - /** - * Constructeur par defaut. - */ - public TestJScope() {} - - /** - * @see junit.framework.TestCase#setUp() - */ - public void setUp() { - testLectureFic_ = "fichier.scopT"; - - } - - /** - * @param _f - * @return Les zones lues - * @throws NumberFormatException - */ - private GISZone lecture(final File _f) { - - final CtuluIOOperationSynthese op = ScopeFileFormat.getInstance().getLastVersionInstance(null).read(_f, null); - final GISZone zone = (GISZone) op.getSource(); -// // assertEquals(zone.getNom(), CtuluLibFile.getSansExtension(_f.getName())); -// final GISZoneCollectionPoint[] pts = zone.getPointCollections(); -// assertEquals(2, pts.length); -// GISZoneCollectionPoint pt1 = pts[0]; -// assertNotNull(pt1); -// assertEquals(pt1.getNumGeometries(), 4); -// GISPointMutable p = new GISPointMutable(); -// double t; -// for (int i = 0; i < pt1.getNumGeometries(); i++) { -// pt1.get(i, p); -// t = i; -// assertEquals(p.getX(), t, delta_); -// assertEquals(p.getY(), t, delta_); -// assertEquals(p.getZ(), t, delta_); -// } -// pt1 = pts[1]; -// assertEquals(pt1.getNumGeometries(), 1); -// pt1.get(0, p); -// assertEquals(p.getX(), 4, delta_); -// assertEquals(p.getY(), 4, delta_); -// assertEquals(p.getZ(), 4, delta_); -// final GISZoneCollectionPolygone[] polygones = zone.getPolygoneCollections(); -// assertNotNull(polygones); -// assertEquals(1, polygones.length); -// assertEquals(polygones[0].getNumGeometries(), 1); -// final GISZoneCollectionPolyligne[] polys = zone.getPolyligneCollections(); -// assertNotNull(polys); -// assertEquals(1, polys.length); -// final GISZoneCollectionPolyligne poly0 = polys[0]; -// assertNotNull(poly0); -// assertEquals(poly0.getNumGeometries(), 2); -// GISPolyligne poly = (GISPolyligne) poly0.getGeometry(0); -// assertEquals(poly.getNumPoints(), 4); -// p = new GISPointMutable(-1d, -1d, -1d); -// for (int i = 0; i < 4; i++) { -// final CoordinateSequence s = poly.getCoordinateSequence(); -// t = (double) i * 5; -// assertEquals(s.getX(i), t, delta_); -// assertEquals(s.getY(i), t, delta_); -// assertEquals(s.getOrdinate(i, 2), t, delta_); -// } -// poly = (GISPolyligne) poly0.getGeometry(1); -// assertEquals(poly.getNumPoints(), 2); -// p = new GISPointMutable(-1, -1, -1); -// for (int i = 0; i < 2; i++) { -// final CoordinateSequence s = poly.getCoordinateSequence(); -// t = (double) i * 100 + 100; -// assertEquals(s.getX(i), t, delta_); -// assertEquals(s.getY(i), t, delta_); -// assertEquals(s.getOrdinate(i, 2), 100, delta_); -// } - return zone; - } - - public void testLectureEcriture() { - File f = null; - try { - final File initFile = getFile(testLectureFic_); - assertNotNull("Le fichier " + testLectureFic_ + " est introuvable", initFile); - assertTrue(initFile.getAbsolutePath() + " n'existe pas !", initFile.exists()); - final GISZone zones = lecture(initFile); - assertNotNull(zones); - f = File.createTempFile("testSinux", ".sx"); - assertNotNull(f); - SinusxFileFormat.getInstance().getLastVersionInstance(null).write(f, zones, null); - lecture(f); - } catch (final Exception _e) { - _e.printStackTrace(); - } finally { - if (f != null) { - f.delete(); - } - } - } - - /** - * @param _f - * @return File - */ - public File getFile(final String _f) { - return TestIO.getFile(getClass(), _f); - } - - -} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScopeGENE.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScopeGENE.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/test/org/fudaa/dodico/telemac/TestJScopeGENE.java 2008-09-23 18:34:17 UTC (rev 3975) @@ -0,0 +1,106 @@ +package org.fudaa.dodico.telemac; + +import java.io.File; + +import junit.framework.TestCase; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.dodico.all.TestIO; +import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; +import org.fudaa.dodico.telemac.io.ScopeStructure; + +public class TestJScopeGENE extends TestCase { + /** + * Le fichier de lecture. + */ + String testLectureFic_; + + String[] listeExemplesAtester = { "scope.scopGENE", "exemple.scopGENE" }; + + /** + * Constructeur par defaut. + */ + public TestJScopeGENE() {} + + /** + * @see junit.framework.TestCase#setUp() + */ + public void setUp() { + + + } + + /** + * @param _f + * @return Les zones lues + * @throws NumberFormatException + */ + private ScopeStructure lecture(final File _f) { + + final CtuluIOOperationSynthese op = ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).read(_f, null); + final ScopeStructure struct = (ScopeStructure) op.getSource(); + + return struct; + } + + + private void ecriture(final File _f,ScopeStructure struct) { + + ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).write(_f, struct, null); + + + } + + public void lectureEcriture(int typeFichier) { + File f = null; + try { + final File initFile = getFile(listeExemplesAtester[typeFichier]); + assertNotNull("Le fichier " + listeExemplesAtester[typeFichier] + " est introuvable", initFile); + assertTrue(initFile.getAbsolutePath() + " n'existe pas !", initFile.exists()); + ScopeStructure structureScope = lecture(initFile); + assertNotNull(structureScope); + + // --test tecriture contenu --// + System.err.print("\n\n\n***contenu structure du fichier " + listeExemplesAtester[typeFichier] + "***"); + structureScope.printResults(); + + f = File.createTempFile("scopeGENE", ".scopGENE"); + System.err.print("\n\nemplacement copie: " + f.getAbsolutePath() + "\n\n"); + assertNotNull(f); + ecriture(f, structureScope); + structureScope = lecture(f); + System.err.print("\n\n\n***contenu structure du fichier apres ecriture " + listeExemplesAtester[typeFichier] + + "***"); + structureScope.printResults(); + + } catch (final Exception... [truncated message content] |
From: <had...@us...> - 2008-09-24 17:58:48
|
Revision: 3976 http://fudaa.svn.sourceforge.net/fudaa/?rev=3976&view=rev Author: hadouxad Date: 2008-09-24 17:58:35 +0000 (Wed, 24 Sep 2008) Log Message: ----------- RESOLUTION D UN MEGA BUG DU LOT 1: lors de la duplication ou creation d autre calques, il n y a pas tous les panels info/palette/ -- Creation de la palette pour les ordonnees de toutes les courbes pour un point donn?\195?\169 - jxtreetable qui affiche les donn?\195?\169es group?\195?\169es par variables (comme arborescence du tree) - mise a jour auto des donnees lors du clic sur le graphe - mise a jour auto de la structure lors de la maj de celle du graphe -- Creation de la palette sonde multi-fusion - Creation d'une interface listener des sondeInteraction - Creation d'une classe manager des sondesInteraction de tous les graphes - implemente l interface precedente - a chaque fois qu une sonde est modifiee, cela envoie un signal au manager qui repositionne toutes les autres sondes des calques de la fusion - Creation d une palette pour afficher les infos de la sonde dans un jxtreetable dont l arborescence suit celle des calques dela fusion - synchronisation au moment du groupage - desynchronisation au moment du ungroup ou du undo:remove de tous les listener . Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInteraction.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/EGFillePanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.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/EbliWidgetControllerForGroup.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.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/EbliWidgetFusionCalques.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/tr/post/TrIsoLayerDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.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/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionPaletteAllCoordonnees.java branches/Prepro-0.92-SNAPSHOT/fudaa/swing.zip 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -8,6 +8,8 @@ package org.fudaa.ebli.calque; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; import org.fudaa.ebli.geometrie.GrPoint; @@ -20,6 +22,11 @@ private ZCalqueSondeInterface target_; + /** + * liste des listener sur le calquesondeInteraction + */ + private List<ZCalqueSondeListener> listeners_ = new ArrayList<ZCalqueSondeListener>(); + protected ZCalqueSondeInteraction() { super(); super.setGele(true); @@ -29,6 +36,22 @@ return target_; } + + public void addZCalqueSondeListener(ZCalqueSondeListener _l) { + listeners_.add(_l); + } + + public void removeZCalqueSondeListener(ZCalqueSondeListener _l) { + if (listeners_.contains(_l)) + listeners_.remove(_l); + } + + public void notifySondeListener(final MouseEvent _e) { + for (ZCalqueSondeListener l : listeners_) + l.notifySondeMoved(this, _e); + } + + public void mouseClicked(final MouseEvent _e){ if(_e.isPopupTrigger()) { return; @@ -41,6 +64,9 @@ final GrPoint pt=new GrPoint(_e.getX(),_e.getY(),0); pt.autoApplique(((BCalque)target_).getVersReel()); target_.changeSonde(pt); + + // -- notify aux sondeListener --// + notifySondeListener(_e); } } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeListener.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeListener.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -0,0 +1,19 @@ +package org.fudaa.ebli.calque; + +import java.awt.event.MouseEvent; + +/** + * Interface pour les listener sur les calqueSondeInteraction. En particulier + * utilis\xE9 pour les fusions de calques afin de synchroniser les sondes entre + * elles. + * + * @author Adrien Hadoux + * + */ +public interface ZCalqueSondeListener { + + + public void notifySondeMoved(final ZCalqueSondeInteraction activator, final MouseEvent _e); + + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -0,0 +1,150 @@ +package org.fudaa.ebli.calque; + +import java.awt.BorderLayout; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.ressource.EbliResource; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; + +/** + * Manager sp\xE9ciale fusion. Elle contient plusieurs sonde ( de tous les calques + * de la fusion). Lors de sa mise a jour, met a jour les sonde de tous les + * calques. + * + * @author Adrien Hadoux + * + */ +public class ZCalqueSondeSynchroniserFusion implements ZCalqueSondeListener { + + //private List<ZCalqueSondeInterface> listeTarget_; + + final List<ZCalqueSondeInteraction> listeSondeInteractions_ = new ArrayList<ZCalqueSondeInteraction>(); + final List<String> listeNodeCalques = new ArrayList<String>(); + + + public ZCalqueSondeSynchroniserFusion() { + } + + int cpt = 1; + public void addZCalqueSondeInteraction(ZCalqueSondeInteraction si/* + * , EbliNode + * node + */) { + // -- ajout de la sonde dans le manager --// + listeSondeInteractions_.add(si); + + listeNodeCalques.add("calque " + (cpt++)); + // -- enregistrement aupres de la sonde du manager comme listener --// + si.addZCalqueSondeListener(this); + + } + + /** + * Methode a appeler a la fin de la fusion pour retirer tous les listener qui + * lient les sondes entre elles. + */ + public void removeAllListenningSonde() { + for (ZCalqueSondeInteraction sondeInteraction : listeSondeInteractions_) + sondeInteraction.removeZCalqueSondeListener(this); + } + + /** + * lorsque c'est appel\xE9, met a jour les sondes pour tous les autre + * zcalquesondeInteraction. + */ + public void notifySondeMoved(ZCalqueSondeInteraction _activator, MouseEvent _e) { + + for (ZCalqueSondeInteraction sondeInteraction : listeSondeInteractions_) { + if (sondeInteraction != _activator && sondeInteraction.getTarget() != null) { + // -- on recupere le point et on met a jour les sondes --// + final GrPoint pt = new GrPoint(_e.getX(), _e.getY(), 0); + pt.autoApplique(((BCalque) sondeInteraction.getTarget()).getVersReel()); + // -- on replace la sonde des autres calques --// + ZCalqueSondeInterface objet = sondeInteraction.getTarget(); + objet.changeSonde(pt); + } + } + buildDialog(); + + } + + JDialog dialog_; + public void buildDialog() { + if (dialog_ != null) { + dialog_.setVisible(true); + return; + } + +// CtuluUIDialog ui = new CtuluUIDialog(listeSondeInteractions_); +// final Frame f = CtuluLibSwing.getFrameAncestorHelper(ui.getParentComponent()); + dialog_ = new JDialog(/*f*/); + + dialog_.addWindowListener(new WindowAdapter() { + public void windowClosed(WindowEvent _e) { + // on desactive l action de suivi sur le graphe + dialog_ = null; + } + + public void windowClosing(WindowEvent _e) { + dialog_ = null; + } + }); + + + dialog_.setModal(false); + dialog_.pack(); + dialog_.setTitle(getTitle()); + JPanel container=new JPanel(new BorderLayout()); + container.add(new JScrollPane(buildComponent()),BorderLayout.CENTER); + container + .add( + new JLabel( + "<html> <body><b>" + getTitle() + "</b> </body></html>"), + BorderLayout.NORTH); + dialog_.setContentPane(container); + dialog_.setSize(250, 400); + // dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(ui. + // getParentComponent())); + dialog_.setVisible(true); + + } + + public String getTitle() { + return EbliResource.EBLI.getString("-- Interpolation r\xE9sultats -- "); + } + + public JComponent buildComponent() { + JPanel container = new JPanel(new BorderLayout()); + JXTreeTable treeTableNodes_ = new JXTreeTable(constructStructureModel()); + container.add(treeTableNodes_, BorderLayout.CENTER); + container.add(treeTableNodes_.getTableHeader(), BorderLayout.NORTH); + return container; + } + + public DefaultTreeTableModel constructStructureModel() { + DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Sonde pour la fusion des calques"); + + for (String titre : listeNodeCalques) + root.add(new DefaultMutableTreeTableNode(titre)); + + DefaultTreeTableModel model = new DefaultTreeTableModel(); + model.setRoot(root); + + return model; + } + + +} 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -27,15 +27,10 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import com.memoire.bu.BuSeparator; -import com.memoire.fu.Fu; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibMessage; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluUI; - import org.fudaa.ebli.calque.action.CalqueActionInteraction; import org.fudaa.ebli.calque.action.CalqueActionTable; import org.fudaa.ebli.calque.action.CalqueSelectionAction; @@ -55,6 +50,10 @@ import org.fudaa.ebli.repere.ZTransformationDomaine; import org.fudaa.ebli.ressource.EbliResource; +import com.memoire.bu.BuSeparator; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; + /** * @author Fred Deniger * @version $Id: ZEbliCalquePanelController.java,v 1.25 2007-06-13 12:57:44 deniger Exp $ @@ -426,6 +425,8 @@ return r; } + + /** Methode pour vider la selection. */ public void clearSelections() { cqSelectionI_.clearSelections(); @@ -503,13 +504,18 @@ return null; } - protected void initSpecificActions() { + public void initSpecificActions() { if (!isSpecificActionInit_) { specificActionGroup_ = getApplicationActions(); isSpecificActionInit_ = true; } } + public void initTabAndSpecificAction() { + + } + + protected EbliActionInterface[] getApplicationActions() { return pn_.getApplicationActions(); } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionPaletteAllCoordonnees.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionPaletteAllCoordonnees.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionPaletteAllCoordonnees.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -0,0 +1,309 @@ +package org.fudaa.ebli.courbe; + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.HashMap; + +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluUIDialog; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; + +/** + * Action qui ouvre une palette contenant un JXTreeTable pour l'affichage des + * ordonnees pour un point selectionn\xE9 donn\xE9 + * + * @author Adrien Hadoux + * + */ +public class EGActionPaletteAllCoordonnees extends EbliActionSimple implements EGGrapheModelListener { + + + public class TreeTableModelGraphe extends DefaultTreeTableModel { + String[] titre_; + + // -- data correspondant au x donn\xE9 --// + double[] dataY_ = new double[0]; + + public TreeTableModelGraphe() { + String[] val = { "Label", "Y" }; + titre_ = val; + } + + 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 graphe_.getModel().getCourbes().length; + + } + + public Object getValueAt(Object node, int column) { + Object res = "n/a"; + if (node instanceof DefaultMutableTreeTableNode) { + DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node; + if (defNode.getUserObject() instanceof EGGroup) { + if (column == 0) + return ((EGGroup) defNode.getUserObject()).getTitle(); + else + return ""; + } else if (defNode.getUserObject() instanceof EGCourbeChild) { + if (column == 0) + return ((EGCourbeChild) defNode.getUserObject()).getTitle(); + else + return getValueForSelectedX(((EGCourbeChild) defNode.getUserObject())); + } + } + return res; + } + + } + + EGInteractionSuiviAllOrdonnees suiviInfos_; + EGGraphe graphe_; + EGFillePanel panelGraphe_; + HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>(); + TreeTableModelGraphe modelGraphe_ = new TreeTableModelGraphe(); + JXTreeTable treeTableNodes_ = new JXTreeTable(modelGraphe_); + + + public EGActionPaletteAllCoordonnees(EGFillePanel panel) { + super(EbliLib.getS("Coordonn\xE9es"), EbliResource.EBLI.getIcon("crystal_pointeuraide.png"), "SUIVIALL"); + + panelGraphe_ = panel; + EGVue vue = panel.vue_; + graphe_ = vue.getGraphe(); + + suiviInfos_ = new EGInteractionSuiviAllOrdonnees(graphe_, this); + // + // // -- creation des interactions --// + vue.addInteractiveCmp(suiviInfos_); + suiviInfos_.addPropertyChangeListener(panel); + + + constructStructureModel(); + // final EGTreeCellRenderer treeCellRenderer = new EGTreeCellRenderer(); + // treeTableNodes_.setTreeCellRenderer(treeCellRenderer); + + // treeTableNodes_.setLeafIcon((EGObject) panel.getModel().getCourbes()[0]); + // treeTableNodes_.setOpenIcon((EGObject) panel.getModel().getEGObject(0)); + // treeTableNodes_.setClosedIcon((EGObject) + // panel.getModel().getEGObject(0)); + // treeTableNodes_.setRowHeight(30); + // treeTableNodes_.setCollapsedIcon(_a.getModel().getEGObject(0)); + + // panel.getModel().addModelListener(this); + + } + + + /** + * Met a jour a chaque clic dans le graphe + */ + public void maj(double x, HashMap<EGCourbe, Double> mapCurvesY) { + dialog_.setTitle(EbliResource.EBLI.getString("X s\xE9lectionn\xE9:") + x); + + mapCurvesY_ = mapCurvesY; + + treeTableNodes_.setTreeTableModel(constructStructureModel()); + treeTableNodes_.expandAll(); + } + + JDialog dialog_; + public void actionPerformed(final ActionEvent _e) { + + CtuluUIDialog ui = new CtuluUIDialog(graphe_); + final Frame f = CtuluLibSwing.getFrameAncestorHelper(ui.getParentComponent()); + + if (dialog_ == null) { + dialog_ = new JDialog(f); + + dialog_.addWindowListener(new WindowAdapter() { + + + + public void windowClosed(WindowEvent _e) { + // on desactive l action de suivi sur le graphe + suiviInfos_.setActive(false); + dialog_ = null; + } + + public void windowClosing(WindowEvent _e) { + suiviInfos_.setActive(false); + dialog_ = null; + } + + + + }); + } + // dialog_.setModal(false); + // dialog_.setContentPane(buildContentPane()); + // dialog_.setSize(200, 400); + // dialog_.setVisible(true); + + dialog_.setModal(false); + dialog_.pack(); + dialog_.setTitle(getTitle()); + // JPanel container=new JPanel(new BorderLayout()); + // JXTreeTable tree = new JXTreeTable(constructStructureModel()); + // tree.setLeafIcon((EGObject) panelGraphe_.getModel().getCourbes()[0]); + // tree.setOpenIcon((EGObject) panelGraphe_.getModel().getEGObject(0)); + // tree.setClosedIcon((EGObject) panelGraphe_.getModel().getEGObject(0)); + // tree.setRowHeight(30); + // tree.getColumn(0).setMinWidth(200); + // container.add(tree, BorderLayout.CENTER); + // container.add(tree.getTableHeader(), BorderLayout.NORTH); + + //container.add(buildTree()); + JPanel container=new JPanel(new BorderLayout()); + container.add(new JScrollPane(buildTree()),BorderLayout.CENTER); + container + .add( + new JLabel( + "<html> <body><b>" + + EbliResource.EBLI.getString("Cliquez sur le graphe pour s\xE9lectionner le x voulu.") + "</b><br />" + + EbliResource.EBLI + .getString("Fermer la palette pour quitter le mode s\xE9lection du graphe") + + " </body></html>"), + BorderLayout.NORTH); + dialog_.setContentPane(container); + dialog_.setSize(400, 400); + dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(ui.getParentComponent())); + dialog_.setVisible(true); + // dialog.dispose(); + // dialog = null; + + // --activation du suivi --// + suiviInfos_.setActive(true); + + } + + + public JComponent buildTree() { + // return suiviInfos_.getTableInfos(); + + // TreeTableModelGraphe model = constructStructureModel(); + // JXTreeTable tree = new JXTreeTable(model); + // tree.setLeafIcon((EGObject) panelGraphe_.getModel().getCourbes()[0]); + // tree.setOpenIcon((EGObject) panelGraphe_.getModel().getEGObject(0)); + // tree.setClosedIcon((EGObject) panelGraphe_.getModel().getEGObject(0)); + // tree.setRowHeight(30); + // + // JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + // panel.add(new JLabel(EbliResource.EBLI.getString("ordonn\xE9es pour X="))); + // // panel.add(labelX_); + // JPanel tableInfo = new JPanel(new BorderLayout()); + // tableInfo.add(panel, BorderLayout.NORTH); + // tableInfo.add(new JScrollPane(tree), BorderLayout.CENTER); + // tableInfo.add(tree.getTableHeader(), BorderLayout.PAGE_START); + JPanel container = new JPanel(new BorderLayout()); + treeTableNodes_ = new JXTreeTable(constructStructureModel()); + + treeTableNodes_.setLeafIcon((EGObject) panelGraphe_.getModel().getCourbes()[0]); + treeTableNodes_.setOpenIcon((EGObject) panelGraphe_.getModel().getEGObject(0)); + treeTableNodes_.setClosedIcon((EGObject) panelGraphe_.getModel().getEGObject(0)); + treeTableNodes_.setRowHeight(30); + treeTableNodes_.getColumn(0).setMinWidth(200); + // treeTableNodes_.setMaximumSize(new Dimension(, 390)); + container.add(treeTableNodes_, BorderLayout.CENTER); + container.add(treeTableNodes_.getTableHeader(), BorderLayout.NORTH); + + return container; + } + + + /** Methode qui construit la structure du model **/ + public TreeTableModelGraphe constructStructureModel() { + DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Ordonn\xE9es pour X donn\xE9" ); + for (int i = 0; i < graphe_.getModel().getNbEGObject(); i++) { + final EGObject ci = graphe_.getModel().getEGObject(i); + if (ci instanceof EGGroup) { + EGGroup groupe = (EGGroup) ci; + DefaultMutableTreeTableNode group=new DefaultMutableTreeTableNode(groupe); + root.add(group); + + for (int k = 0; k < groupe.getChildCount(); k++) { + EGCourbeChild courbe = groupe.getCourbeAt(k); + DefaultMutableTreeTableNode courb = new DefaultMutableTreeTableNode(courbe); + group.add(courb); + } + } + + + } + TreeTableModelGraphe model=new TreeTableModelGraphe(); + model.setRoot(root); + + return model; + } + + /** + * Recupere la valeure associee a la courbe dans la map + * + * @param child + * @return + */ + private Double getValueForSelectedX(EGCourbe child) { + if (child != null && mapCurvesY_.containsKey(child)) + return mapCurvesY_.get(child); + else + return new Double(0); + } + + + JPanel tableInfo_; + JLabel labelX_ = new JLabel(""); + + + public void axeAspectChanged(EGAxe _c) { + constructStructureModel(); + + } + + public void axeContentChanged(EGAxe _c) { + constructStructureModel(); + + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + constructStructureModel(); + + } + + public void courbeContentChanged(EGObject _c, boolean _mustRestore) { + constructStructureModel(); + + } + + public void structureChanged() { + constructStructureModel(); + + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -69,7 +69,7 @@ EbliActionInterface[] specificTools_; - final EGInteractionSuiviAllOrdonnees suiviInfos_; + // final EGInteractionSuiviAllOrdonnees suiviInfos_; /** * @param _a le graphe @@ -103,7 +103,7 @@ add(vue_, BuBorderLayout.CENTER); selection_ = new EGInteractionSelection(vue_.graphe_); - suiviInfos_ = new EGInteractionSuiviAllOrdonnees(vue_.getGraphe()); + // suiviInfos_ = new EGInteractionSuiviAllOrdonnees(vue_.getGraphe()); } @@ -111,11 +111,10 @@ selection_.getSelection().addListeSelectionListener(_l); } + // public JComponent getInfoPanel() { + // return suiviInfos_.getTableInfos(); + // } - public JComponent getInfoPanel() { - return suiviInfos_.getTableInfos(); - } - protected EbliActionInterface[] buildActions() { final List r = new ArrayList(8); final List actionForGroup = new ArrayList(5); @@ -168,17 +167,22 @@ r.add(a); suivi.addPropertyChangeListener(this); actionForGroup.add(a); + + // vue_.addInteractiveCmp(suiviInfos_); + // a = new EGActionInteraction(EbliLib.getS("Coordonn\xE9es"), + // EbliResource.EBLI.getIcon("crystal_pointeuraide.png"), + // "SUIVIALL", suiviInfos_); + // a.putValue(Action.SHORT_DESCRIPTION, EbliResource.EBLI.getString( + // "Informations sur les ordonn\xE9es du point choisi")); + // a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('f')); + // r.add(a); + // + // suiviInfos_.addPropertyChangeListener(this); + // actionForGroup.add(a); + EbliActionSimple actionpal = new EGActionPaletteAllCoordonnees(this); + r.add(actionpal); + // actionForGroup.add(actionpal); - vue_.addInteractiveCmp(suiviInfos_); - a = new EGActionInteraction(EbliLib.getS("Coordonn\xE9es"), EbliResource.EBLI.getIcon("crystal_pointeuraide.png"), - "SUIVIALL", suiviInfos_); - a.putValue(Action.SHORT_DESCRIPTION, EbliResource.EBLI.getString("Informations sur les ordonn\xE9es du point choisi")); - a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('f')); - r.add(a); - - suiviInfos_.addPropertyChangeListener(this); - actionForGroup.add(a); - if (getModel().isContentModifiable()) { r.add(null); final EGInteractionDeplacementPoint pt = new EGInteractionDeplacementPoint(this); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGInteractionSuiviAllOrdonnees.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -7,9 +7,7 @@ */ package org.fudaa.ebli.courbe; -import java.awt.BorderLayout; import java.awt.Color; -import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; @@ -18,19 +16,11 @@ import java.awt.event.MouseMotionListener; import java.util.HashMap; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; import javax.swing.SwingConstants; import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.trace.TraceBox; import org.fudaa.ebli.trace.TraceIcon; -import org.jdesktop.swingx.JXTreeTable; -import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; -import org.jdesktop.swingx.treetable.DefaultTreeTableModel; /** * @author Fred Deniger @@ -38,7 +28,7 @@ * $ */ public class EGInteractionSuiviAllOrdonnees extends EGInteractiveComponent implements MouseListener, - MouseMotionListener, EGGrapheModelListener { + MouseMotionListener/* , EGGrapheModelListener */{ boolean dessine_; @@ -56,15 +46,67 @@ double xreel_; - - TreeTableModelGraphe modelGraphe_ = new TreeTableModelGraphe(); - JXTreeTable treeTableNodes_ = new JXTreeTable(modelGraphe_); - HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>(); - JLabel labelX_ = new JLabel(""); - - - + // TreeTableModelGraphe modelGraphe_ = new TreeTableModelGraphe(); + // JXTreeTable treeTableNodes_ = new JXTreeTable(modelGraphe_); + // HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>(); + // JLabel labelX_ = new JLabel(""); + // public class TreeTableModelGraphe extends DefaultTreeTableModel { + // String[] titre_; + // + // // -- data correspondant au x donn\xE9 --// + // double[] dataY_ = new double[0]; + // + // public TreeTableModelGraphe() { + // String[] val = { "Label", "Y" }; + // titre_ = val; + // } + // + // + // 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 target_.getModel().getCourbes().length; + // + // } + // + // public Object getValueAt(Object node, int column) { + // Object res = "n/a"; + // if (node instanceof DefaultMutableTreeTableNode) { + // DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node; + // if (defNode.getUserObject() instanceof EGGroup) { + // if (column == 0) + // return ((EGGroup)defNode.getUserObject()).getTitle(); + // else + // return ""; + // }else + // if (defNode.getUserObject() instanceof EGCourbeChild) { + // if (column == 0) + // return ((EGCourbeChild) defNode.getUserObject()).getTitle(); + // else + // return getValueForSelectedX(((EGCourbeChild) defNode.getUserObject())); + // } + // } + // return res; + // } + // + // + // + // } @@ -73,133 +115,80 @@ - public class TreeTableModelGraphe extends DefaultTreeTableModel { - String[] titre_; - - // -- data correspondant au x donn\xE9 --// - double[] dataY_ = new double[0]; - - public TreeTableModelGraphe() { - String[] val = { "Label", "Y" }; - titre_ = val; - } - - - 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 target_.getModel().getCourbes().length; - - } - - public Object getValueAt(Object node, int column) { - Object res = "n/a"; - if (node instanceof DefaultMutableTreeTableNode) { - DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node; - if (defNode.getUserObject() instanceof EGGroup) { - if (column == 0) - return ((EGGroup)defNode.getUserObject()).getTitle(); - else - return ""; - }else - if (defNode.getUserObject() instanceof EGCourbeChild) { - if (column == 0) - return ((EGCourbeChild) defNode.getUserObject()).getTitle(); - else - return getValueForSelectedX(((EGCourbeChild) defNode.getUserObject())); - } - } - return res; - } - - - - } + - /** Methode qui construit la structure du model **/ - public void constructStructureModel() { +// /** Methode qui construit la structure du model **/ + // public void constructStructureModel() { + // + // DefaultMutableTreeTableNode root = new + // DefaultMutableTreeTableNode("Ordonn\xE9es pour X=" + xreel_); + // + // for (int i = 0; i < target_.getModel().getNbEGObject(); i++) { + // final EGObject ci = target_.getModel().getEGObject(i); + // if (ci instanceof EGGroup) { + // EGGroup groupe = (EGGroup) ci; + // DefaultMutableTreeTableNode group=new DefaultMutableTreeTableNode(groupe); + // root.add(group); + // + // for (int k = 0; k < groupe.getChildCount(); k++) { + // EGCourbeChild courbe = groupe.getCourbeAt(k); + // DefaultMutableTreeTableNode courb = new + // DefaultMutableTreeTableNode(courbe); + // group.add(courb); + // } + // } + // + // + // } + // - DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Ordonn\xE9es pour X=" + xreel_); - - for (int i = 0; i < target_.getModel().getNbEGObject(); i++) { - final EGObject ci = target_.getModel().getEGObject(i); - if (ci instanceof EGGroup) { - EGGroup groupe = (EGGroup) ci; - DefaultMutableTreeTableNode group=new DefaultMutableTreeTableNode(groupe); - root.add(group); - - for (int k = 0; k < groupe.getChildCount(); k++) { - EGCourbeChild courbe = groupe.getCourbeAt(k); - DefaultMutableTreeTableNode courb = new DefaultMutableTreeTableNode(courbe); - group.add(courb); - } - } + // modelGraphe_.setRoot(root); + // + // + // } - - } - - - modelGraphe_.setRoot(root); - - - } + // /** + // * Recupere la valeure associee a la courbe dans la map + // * + // * @param child + // * @return + // */ + // private Double getValueForSelectedX(EGCourbe child) { + // if (child != null && mapCurvesY_.containsKey(child)) + // return mapCurvesY_.get(child); + // else + // return new Double(0); + // } - /** - * Recupere la valeure associee a la courbe dans la map - * - * @param child - * @return - */ - private Double getValueForSelectedX(EGCourbe child) { - if (child != null && mapCurvesY_.containsKey(child)) - return mapCurvesY_.get(child); - else - return new Double(0); - } - /** * Retourne le composant graphique qui se met a jour auto en fonction du clic * utilisateur. * * @return */ - JPanel tableInfo_; + // JPanel tableInfo_; + // + // public JComponent getTableInfos() { + // + // if (tableInfo_ == null) { + // JPanel panel=new JPanel(new FlowLayout(FlowLayout.CENTER)); + // panel.add(new JLabel(EbliResource.EBLI.getString("ordonn\xE9es pour X="))); + // panel.add(labelX_); + // tableInfo_ = new JPanel(new BorderLayout()); + // tableInfo_.add(panel,BorderLayout.NORTH); + // tableInfo_.add(new JScrollPane(treeTableNodes_), BorderLayout.CENTER); + // tableInfo_.add(treeTableNodes_.getTableHeader(), BorderLayout.PAGE_START); + // } + // + // return tableInfo_; + // } - public JComponent getTableInfos() { - - if (tableInfo_ == null) { - JPanel panel=new JPanel(new FlowLayout(FlowLayout.CENTER)); - panel.add(new JLabel(EbliResource.EBLI.getString("ordonn\xE9es pour X="))); - panel.add(labelX_); - tableInfo_ = new JPanel(new BorderLayout()); - tableInfo_.add(panel,BorderLayout.NORTH); - tableInfo_.add(new JScrollPane(treeTableNodes_), BorderLayout.CENTER); - tableInfo_.add(treeTableNodes_.getTableHeader(), BorderLayout.PAGE_START); - } - - return tableInfo_; - } - public String getDescription() { return EbliLib.getS("suivi"); } @@ -208,29 +197,31 @@ int selectedPtIdx_; + EGActionPaletteAllCoordonnees paelette_; + /** * @param _a * la cible pour le suivi. */ - public EGInteractionSuiviAllOrdonnees(final EGGraphe _a) { + public EGInteractionSuiviAllOrdonnees(final EGGraphe _a, EGActionPaletteAllCoordonnees palette) { target_ = _a; target_.addMouseListener(this); target_.addMouseMotionListener(this); - - constructStructureModel(); + paelette_ = palette; + // constructStructureModel(); + // + // + // // final EGTreeCellRenderer treeCellRenderer = new EGTreeCellRenderer(); + // // treeTableNodes_.setTreeCellRenderer(treeCellRenderer); + // + // treeTableNodes_.setLeafIcon((EGObject) _a.getModel().getCourbes()[0]); + // treeTableNodes_.setOpenIcon((EGObject) _a.getModel().getEGObject(0)); + // treeTableNodes_.setClosedIcon((EGObject) _a.getModel().getEGObject(0)); + // treeTableNodes_.setRowHeight(30); + // // treeTableNodes_.setCollapsedIcon(_a.getModel().getEGObject(0)); + // + // _a.getModel().addModelListener(this); - -// final EGTreeCellRenderer treeCellRenderer = new EGTreeCellRenderer(); -// treeTableNodes_.setTreeCellRenderer(treeCellRenderer); - - treeTableNodes_.setLeafIcon((EGObject) _a.getModel().getCourbes()[0]); - treeTableNodes_.setOpenIcon((EGObject) _a.getModel().getEGObject(0)); - treeTableNodes_.setClosedIcon((EGObject) _a.getModel().getEGObject(0)); - treeTableNodes_.setRowHeight(30); - // treeTableNodes_.setCollapsedIcon(_a.getModel().getEGObject(0)); - - _a.getModel().addModelListener(this); - // palette_ = new DialogPalette(); // palette_.setContentPane(getTableInfos()); // palette_.setTitle("Ordonn\xE9es pour le X s\xE9lectionn\xE9"); @@ -243,7 +234,7 @@ } int yPressed_; - + HashMap<EGCourbe, Double> mapCurvesY_ = new HashMap<EGCourbe, Double>(); private void updateWithMouse(final int _x, final int _y) { if (!isActive()) { return; @@ -253,47 +244,37 @@ if (target_.getTransformer().getXAxe().isDiscret()) { xreel_ = (int) xreel_; } - - - for (int i = 0; i < target_.getModel().getCourbes().length; i++) { + + for (int i = 0; i < target_.getModel().getCourbes().length; i++) { final EGCourbe ci = target_.getModel().getCourbes()[i]; // target_. - // getSelectedComponent(); - - - - + // getSelectedComponent(); + selectedPtIdx_ = ci.select(_x, _y, target_.getTransformer(), 5); // on dessine si un point selectionne ou si le point appartient a la // courbe - - v_ = ci.getAxeY(); - if (selectedPtIdx_ >= 0) { - xreel_ = ci.getModel().getX(selectedPtIdx_); - yreel_ = ci.getModel().getY(selectedPtIdx_); - } else { - yreel_ = ci.interpol(xreel_); - if (target_.getTransformer().getXAxe().isLogarithmique()) { - yPressed_ = (int) ci.interpolOnEcran(xreel_, target_.getTransformer()); - } + + v_ = ci.getAxeY(); + if (selectedPtIdx_ >= 0) { + xreel_ = ci.getModel().getX(selectedPtIdx_); + yreel_ = ci.getModel().getY(selectedPtIdx_); + } else { + yreel_ = ci.interpol(xreel_); + if (target_.getTransformer().getXAxe().isLogarithmique()) { + yPressed_ = (int) ci.interpolOnEcran(xreel_, target_.getTransformer()); } + } - // -- ajout dans la map + // -- ajout dans la map mapCurvesY_.put(ci, yreel_); - - - - } + // labelX_.setText("" + xreel_); + + } + paelette_.maj(xreel_, mapCurvesY_); - repaint(); - // -- envoie du signal a l arbre --// - // JFrame frame=new JFrame(); - // frame.setContentPane(treeTableNodes_); - // frame.setSize(400, 400); - // frame.setVisible(true); - labelX_.setText("" + xreel_); + } private boolean isExactPtSelect() { @@ -435,40 +416,36 @@ // palette_.firePropertyChange("visible", 0, 1); } + // public void axeAspectChanged(EGAxe _c) { + // constructStructureModel(); + // + // } + // + // public void axeContentChanged(EGAxe _c) { + // constructStructureModel(); + // + // } + // + // public void courbeAspectChanged(EGObject _c, boolean _visibil) { + // constructStructureModel(); + // + // } + // + // public void courbeContentChanged(EGObject _c, boolean _mustRestore) { + // constructStructureModel(); + // + // } + // + // public void structureChanged() { + // constructStructureModel(); + // + // + // } - - - public void axeAspectChanged(EGAxe _c) { - constructStructureModel(); - } - public void axeContentChanged(EGAxe _c) { - constructStructureModel(); - } - public void courbeAspectChanged(EGObject _c, boolean _visibil) { - constructStructureModel(); - } - - public void courbeContentChanged(EGObject _c, boolean _mustRestore) { - constructStructureModel(); - - } - - public void structureChanged() { - constructStructureModel(); - - - } - - - - - - - } \ No newline at end of file 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-24 17:58:35 UTC (rev 3976) @@ -617,4 +617,8 @@ Masquer la frame= Hide the frame Dupliquer la frame= Duplicate the frame R\xE9aliser la fusion= Perform the merging -Anim\xE9=Animated \ No newline at end of file +Anim\xE9=Animated +Cliquez sur le graphe pour s\xE9lectionner le x voulu.=Click on the graph in order to select the proper x +Fermer la palette pour quitter le mode s\xE9lection du graphe=Close the graphical ui in order to quit the graph's selection mode +X s\xE9lectionn\xE9:=Selected X: +Interpolation Fusion=Fusion interpolation \ No newline at end of file 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerForGroup.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -14,15 +14,22 @@ public class EbliWidgetControllerForGroup extends EbliWidgetController { public boolean hasAlreadyFusion = false; + public boolean isFusionCalque = false; + public EbliWidgetControllerForGroup(EbliWidget _widget, boolean isFusionClaques) { + super(_widget, true, true, false); + isFusionCalque = isFusionClaques; + } + + public EbliWidgetControllerForGroup(EbliWidget _widget) { - super(_widget,true,true,false); + this(_widget, false); } @Override protected void buildPopupMenu(JPopupMenu _menu) { super.buildPopupMenu(_menu); EbliNode n=(EbliNode) getWidget().getEbliScene().findObject(getWidget()); - _menu.add(new EbliWidgetUngroupAction(getWidget().getEbliScene(),n)); + _menu.add(new EbliWidgetUngroupAction(getWidget().getEbliScene(), n, isFusionCalque)); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetUngroupAction.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -14,6 +14,7 @@ import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetFusionCalques; import org.netbeans.api.visual.widget.Widget; /** @@ -23,16 +24,19 @@ public class EbliWidgetUngroupAction extends EbliWidgetActionSimple { EbliNode target_; - - public EbliWidgetUngroupAction(EbliScene _scene, EbliNode _target) { + boolean isFusionCalque_; + public EbliWidgetUngroupAction(EbliScene _scene, EbliNode _target, boolean isFusionCalque) { super(_scene, EbliLib.getS("D\xE9grouper"), EbliResource.EBLI.getToolIcon("formatungroup_16.png"), "DEGROUP_WIDGET"); target_ = _target; + isFusionCalque_ = isFusionCalque; } @Override public void actionPerformed(ActionEvent e) { + if (!isFusionCalque_) degroupObjects(scene_, target_); - + else + degroupObjectsFromFusion(scene_, target_); } public static void degroupObjects(EbliScene _scene, EbliNode _n) { @@ -62,4 +66,21 @@ _scene.validate(); // _scene.setSelectedObjects(cs); } + + /** + * Methode a appeler pour degrouper la fusion de calques. Enleve la + * synchronisation des sondes des calques. + * + * @param _scene + * @param _n + */ + public static void degroupObjectsFromFusion(EbliScene _scene, EbliNode _n) { + // --desyncrhonisation des sondes --// + ((EbliWidgetFusionCalques) _n.getWidget()).desynchroniseSondeFusion(); + + // -- degroupage classique du group --// + degroupObjects(_scene, _n); + + } + } \ 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -93,6 +93,8 @@ @Override public void postActionDuplication(final EbliNode node, final EbliNode duplique) { + + // -- il faut verifier que les le node a bien une legende sinon on n ajoute // pas de legende pour le dupliqu\xE9 --// EbliWidgetControllerCalque controllerDuDuplique = null; @@ -105,6 +107,9 @@ controllerDuDuplique.setDescription(getDescription()); + // -- construction des actions sans passer par la frame fille --// + controllerDuDuplique.widgetCalque_.calquePanel_.getController().buildActions(); + } public boolean hasLegende() { @@ -257,7 +262,16 @@ editorAction_.openEditor(widgetCalque_); } + + public void ouvrirEditeur() { + editorAction_.openEditor(widgetCalque_); + } + public void fermerEditeur() { + editorAction_.closeEditor(true); + } + + public ZEbliCalquesPanel getVisuPanel() { return widgetCalque_.calquePanel_; } @@ -306,6 +320,7 @@ // info.setAvailable(true); // JComponent jc = info; final Collection<EbliActionPaletteAbstract> acts = getVisuPanel().getController().getTabPaletteAction(); + if (!CtuluLibArray.isEmpty(acts)) { final BuTabbedPane tb = new BuTabbedPane(); for (final EbliActionPaletteAbstract pals : acts) { @@ -332,6 +347,8 @@ return panelTreeCalque_; } + + /** * Obtient la toolbar specifique au calque * 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -2,9 +2,13 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.Iterator; import org.fudaa.ebli.calque.BVueCalque; +import org.fudaa.ebli.calque.ZCalqueSondeInteraction; +import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -17,7 +21,7 @@ */ public final class EbliWidgetFusionCalques extends EbliWidget implements PropertyChangeListener { - // public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); + public final ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); public EbliWidgetFusionCalques(EbliScene _scene) { super(_scene); @@ -31,7 +35,7 @@ addChild(child); EbliWidgetVueCalque widgetCalque = (EbliWidgetVueCalque) child.getIntern(); - // listeWidgetCalque_.add(widgetCalque); + listeWidgetCalque_.add(widgetCalque); // -- ajout du listener des calques sur this --// widgetCalque.calquePanel_.getVueCalque().addPropertyChangeListener("repere", this); @@ -72,5 +76,48 @@ widgetCalque.calquePanel_.getVueCalque().getAbstractCalque().removePropertyChangeListener("repere", this); } + + + ZCalqueSondeSynchroniserFusion managerSondesFusion_; + /** + * Methode a appeler a la fin de la creation de la sonde fusion pour ajouter l + * action sonde fusion dans chaque calques. + */ + public void synchroniseSondeFusion() { + + // -- creation du manager de sonde fusion qui synchronise toute ses sondes + // --// + managerSondesFusion_ = new ZCalqueSondeSynchroniserFusion(); + for (EbliWidgetVueCalque widget : listeWidgetCalque_) { + ZEbliCalquesPanel panel = widget.calquePanel_; + + // -- il faut initialiser les actions specifiques si pas deja fait pour + // activer les interactions--// + panel.getController().initSpecificActions(); + + // --recuperation de la sonde du calque --// + ZCalqueSondeInteraction sonde = panel.getController().getCalqueSondeInteraction(); + + // -- ajout de la sonde dans le manager + managerSondesFusion_.addZCalqueSondeInteraction(sonde); + } + // -- ajout dans les toolbars de tous les calques de la meme action --// + // for (EbliWidgetVueCalque widget : listeWidgetCalque_) { + // + // ((EbliWidgetControllerCalque) + // widget.getController()).getToolbarComponent().add( + // new CalqueActionSonde(sondeFusion)); + // + // } + } + + /** + * Methode a appeler au ungroup ou undo sur la fusion. Desynchronise les + * sondes des calques. + */ + public void desynchroniseSondeFusion() { + managerSondesFusion_.removeAllListenningSonde(); + } + } 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -12,7 +12,6 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; -import javax.swing.JSplitPane; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; @@ -339,14 +338,14 @@ // tablePanel.setGraphe(getGraphe()); // pane.setBottomComponent(tablePanel); // - JSplitPane paneGlobal = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + // JSplitPane paneGlobal = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + // + // paneGlobal.setDividerLocation(100); + // + // paneGlobal.setTopComponent(getGraphePanel().getInfoPanel()); + // paneGlobal.setBottomComponent(new JScrollPane(tree)); - paneGlobal.setDividerLocation(100); - - paneGlobal.setTopComponent(getGraphePanel().getInfoPanel()); - paneGlobal.setBottomComponent(new JScrollPane(tree)); - - panelTreeGraphe_ = paneGlobal; + panelTreeGraphe_ = new JScrollPane(tree); ;// paneGlobal; } 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -93,6 +93,8 @@ final TraceIcon r = new TraceIcon(TraceIcon.RIEN, 6) { public void paintIconCentre(Component _c, Graphics _g, int _x, int _y) { + if (_g == null) + return; Color old = null; if (getCouleur() != null) { old = _g.getColor(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -8,10 +8,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import javax.swing.Action; @@ -67,10 +65,13 @@ standardActionGroup_ = removePalettes(standardActionGroup_); } + /** + * recupere les palettes et initialise les actions + */ public Collection<EbliActionPaletteAbstract> getTabPaletteAction() { // si deja fait on retourne de suite if (tabPalettes_ != null) return tabPalettes_; - initSpecificActions(); + initSpecificActions(); tabPalettes_ = new ArrayList<EbliActionPaletteAbstract>(3); for (String str : useAsTab) { EbliActionPaletteAbstract o = mapTabPalettes_.get(str); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -8,7 +8,6 @@ import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Arrays; @@ -31,9 +30,6 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.ProgressionBuAdapter; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliLib; @@ -226,8 +222,9 @@ getScene().getCmdMng().addCmd(new CtuluCommand() { public void undo() { - EbliWidgetUngroupAction.degroupObjects(getScene(), fusion); - + + // -- degroupe et desynchronise le tout --// + EbliWidgetUngroupAction.degroupObjectsFromFusion(getScene(), fusion); } public void redo() { @@ -318,7 +315,12 @@ node.setPreferedLocation(min); node.setTitle(EbliLib.getS("Fusion calquess")); node.setCreator(creator); - parent.setController(new EbliWidgetControllerForGroup(parent)); + parent.setController(new EbliWidgetControllerForGroup(parent, true)); + + //-- synchronisation des sondes des fusions --// + parent.synchroniseSondeFusion(); + + scene_.addNode(node); if (pn != null && boite != null) { pn.getVueCalque().changeRepere(pn, boite, 0, 0); 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -60,9 +60,6 @@ import org.jdesktop.swingx.ScrollPaneSelector; import com.memoire.bu.BuDesktop; -import com.memoire.bu.BuDialogConfirmation; -import com.memoire.bu.BuDialogError; -import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuMenu; import com.memoire.bu.BuMenuItem; import com.memoire.bu.BuResource; @@ -255,6 +252,10 @@ nodeCalque.getWidget().getController().setDescription(projet_.formatInfoSource(calque.getSource(0))); + + // -- construction des actions sans passer par la frame fille --// + calque.getController().buildActions(); + // -- ajout de la legende dans le calque associe --// EbliWidget createdWidget = nodeCalque.getWidget(); creator.updateLegend((EbliWidgetBordureSingle) createdWidget, _legende); 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -1280,10 +1280,9 @@ // pour charger les icones dans un thread a part // fille_.getVisuPanel().getController().buildActions(); - // -- construction des actions sans passer par la frame fille --// - filleLayout.getVisuPanel().getController().buildActions(); + final Runnable other = FudaaSaveLib.restoreMainFille(impl_, getSaveFile(), getOldSaveFile(), fille_, getStateReceiver()); 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 2008-09-23 18:34:17 UTC (rev 3975) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-09-24 17:58:35 UTC (rev 3976) @@ -83,6 +83,8 @@ addEvolutionFor(); } + + public String getEnableCondition() { if (rubar_) { return TrResource.getS("S\xE9lectionner au moins \xE9l\xE9ment"); } return new StringBuffer().append(EbliLib.getS("S\xE9lectionner au moins noeud")).append("<br>").append( @@ -368,9 +370,14 @@ plTime.putValue(Action.ACCELERATOR_KEY, ks); thisMap.put(ks, "VARIABLE_CHOOSE"); m.put("VARIABLE_CHOOSE", plTime); + + + final ZCalqueSondeInteraction sonde = _res.addCalqueSondeInteraction(); _l.add(new CalqueActionSonde(sonde, getArbreCalqueModel())); + + // _l.add(new MvProfileAction(getProjet(), getImpl(), this)); _l.add(new TrPostProfileAction(getProjet(), getImpl(), this, getProjet())); Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/swing.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-29 21:39:17
|
Revision: 4009 http://fudaa.svn.sourceforge.net/fudaa/?rev=4009&view=rev Author: deniger Date: 2008-09-29 21:38:52 +0000 (Mon, 29 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java 2008-09-29 21:35:47 UTC (rev 4008) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliLookFeel.java 2008-09-29 21:38:52 UTC (rev 4009) @@ -35,10 +35,13 @@ return getBorder(_state, true); } + public static int getBorderThickness() { + return MINI_THICKNESS; + } + public Border getBorderInGroup(ObjectState _state) { - return DEFAULT_BORDER; -// if (_state.isHovered()) { return ROUNDED_BORDER; } -// return EMPTY_BORDER; + return getBorder(_state, false); + // return EMPTY_BORDER; } public Border getBorder(ObjectState _state, boolean resizable) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-29 21:35:47 UTC (rev 4008) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionCalques.java 2008-09-29 21:38:52 UTC (rev 4009) @@ -35,6 +35,7 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliLookFeel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -249,7 +250,8 @@ // Insets insetLayout = new Insets(30, 30, 30, 30); // parent.setLayout(new OverlayLayout()); - parent.setLayout(new OverlayLayoutGap(new Insets(0, 0, 0, 0))); + parent.setLayout(new OverlayLayoutGap(new Insets(-EbliLookFeel.getBorderThickness(), -EbliLookFeel + .getBorderThickness(), -EbliLookFeel.getBorderThickness(), -EbliLookFeel.getBorderThickness()))); Point min = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); Point max = new Point(-Integer.MAX_VALUE, -Integer.MAX_VALUE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-26 09:28:53
|
Revision: 3988 http://fudaa.svn.sourceforge.net/fudaa/?rev=3988&view=rev Author: hadouxad Date: 2008-09-26 09:28:40 +0000 (Fri, 26 Sep 2008) Log Message: ----------- import/export de graphes Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluExportDataInterface.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCsvWriter.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableExcelWriter.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/courbe/EGExportData.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExporter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserWriter.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluWriter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeS.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluExportDataInterface.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluExportDataInterface.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluExportDataInterface.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -9,6 +9,7 @@ + /** * Une interface permettant de reconnaitre les internal frames qui ont des donn\xE9es \xE0 exporter. * @author Fred Deniger @@ -31,5 +32,7 @@ * @param _impl l'impl parent. */ void startExport(CtuluUI _impl); + + } Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -11,13 +11,13 @@ import javax.swing.JFileChooser; -import com.memoire.bu.BuFileFilter; -import com.memoire.bu.BuResource; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluUI; +import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuResource; + /** * @author Fred Deniger * @version $Id: CtuluFileChooserCsvExcel.java,v 1.6 2007-06-14 11:58:18 deniger Exp $ @@ -28,6 +28,8 @@ final BuFileFilter ftXsl_; + + final CtuluUI ui_; public CtuluFileChooserCsvExcel(CtuluUI _ui) { @@ -60,12 +62,21 @@ return null; } File f = getSelectedFile(); + + + completeExtension(f); + + + return f; + } + + private void completeExtension(File f){ final javax.swing.filechooser.FileFilter filter = getFileFilter(); final String name = f.getName(); if (name.indexOf('.') < 0) { f = new File(f.getAbsolutePath() + (filter == ftXsl_ ? ".xls" : ".txt")); } - return f; } + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserWriter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserWriter.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFileChooserWriter.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -0,0 +1,82 @@ +package org.fudaa.ctulu.gui; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JFileChooser; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluUI; + +import com.memoire.bu.BuResource; + +/** + * Chooser G\xE9n\xE9rique qui complete tous les formats en ajoutant les interfaces + * CtuluWriter appropri\xE9es. + * + * @author Adrien Hadoux + * + */ +public class CtuluFileChooserWriter extends CtuluFileChooser { + + + + final List<CtuluWriter> listWriter_; + final CtuluUI ui_; + + public CtuluFileChooserWriter(CtuluUI _ui, final List<CtuluWriter> _listWriter) { + + ui_ = _ui; + + if(_listWriter!=null) + listWriter_ = _listWriter; + else{ + // -- on ajoute par defaut les import export csv et excel --// + listWriter_=new ArrayList<CtuluWriter>(); + listWriter_.add(new CtuluTableExcelWriter()); + listWriter_.add(new CtuluTableCsvWriter()); + } + for (CtuluWriter writer : listWriter_) { + writer.getFilter().setExtensionListInDescription(true); + addChoosableFileFilter(writer.getFilter()); + } + setDialogType(JFileChooser.SAVE_DIALOG); + setApproveButtonToolTipText(CtuluLib.getS("L'extension du fichier sera automatiquement compl\xE9t\xE9e")); + CtuluFileChooserTestWritable tester = new CtuluFileChooserTestWritable(_ui); + tester.setAppendExtension(true, null); + setTester(tester); + + + } + + /** + * retourne le writter selectionn\xE9 + * + * @return + */ + public CtuluWriter getSelectedWriter() { + for (CtuluWriter writer : listWriter_) + if (writer.getFilter() == getFileFilter()) + return writer; + return null; + } + + public File getDestFile() { + final int res = showDialog(ui_.getParentComponent(), BuResource.BU.getString("Continuer")); + if (res != JFileChooser.APPROVE_OPTION) { + return null; + } + File f = getSelectedFile(); + + + + return completeExtension(f); + } + + private File completeExtension(File f) { + f = new File(f.getAbsolutePath() + getSelectedWriter().getMostPopularExtension()); + return f; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCsvWriter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCsvWriter.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableCsvWriter.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -7,23 +7,27 @@ */ package org.fudaa.ctulu.gui; +import java.io.File; import java.io.IOException; import org.fudaa.ctulu.CsvWriter; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; +import com.memoire.bu.BuFileFilter; + /** * @author Fred Deniger * @version $Id: CtuluTableCsvWriter.java,v 1.5 2007-03-30 15:35:20 deniger Exp $ */ -public class CtuluTableCsvWriter { +public class CtuluTableCsvWriter implements CtuluWriter { CtuluTableModelInterface table_; CsvWriter w_; boolean writeHeader_ = true; - + BuFileFilter ftCsv_ = new BuFileFilter(new String[] { "txt", "csv" }, CtuluResource.CTULU.getString("Texte CSV")); /** * @param _w * @param _table @@ -34,6 +38,10 @@ w_.setSepChar(';'); table_ = _table; } + + public CtuluTableCsvWriter() { + super(); + } public void write(final ProgressionInterface _prog) throws IOException { try { @@ -77,4 +85,33 @@ writeHeader_ = _writeHeader; } + public BuFileFilter getFilter() { + return ftCsv_; + } + + public void setFile(File _f) { + CsvWriter c; + try { + c = new CsvWriter(_f); + w_ = c; + w_.setSepChar(';'); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + public void setModel(CtuluTableModelInterface _model) { + table_ = _model; + } + + String extension_ = ".txt"; + public String getMostPopularExtension() { + return extension_; + } + + public boolean allowFormatData() { + return true; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableExcelWriter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableExcelWriter.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluTableExcelWriter.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -24,11 +24,13 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; +import com.memoire.bu.BuFileFilter; + /** * @author Fred Deniger * @version $Id: CtuluTableExcelWriter.java,v 1.7 2007-04-16 16:33:53 deniger Exp $ */ -public class CtuluTableExcelWriter { +public class CtuluTableExcelWriter implements CtuluWriter { CtuluTableModelInterface table_; @@ -44,6 +46,10 @@ dest_ = _dest; } + public CtuluTableExcelWriter() { + super(); + } + /** * @param _p le receveur de l'avancement * @throws IOException @@ -94,4 +100,28 @@ } } + + BuFileFilter ftXsl_ = new BuFileFilter(new String[] { "xls" }, CtuluResource.CTULU.getString("Fichier excel")); + + public BuFileFilter getFilter() { + return ftXsl_; + } + + public void setFile(File f) { + dest_ = f; + } + + public void setModel(CtuluTableModelInterface _model) { + table_ = _model; + } + + String extension_ = ".xls"; + public String getMostPopularExtension() { + return extension_; + } + + public boolean allowFormatData() { + return true; + } + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluWriter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluWriter.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluWriter.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -0,0 +1,66 @@ +package org.fudaa.ctulu.gui; + +import java.io.File; +import java.io.IOException; + +import jxl.write.WriteException; + +import org.fudaa.ctulu.ProgressionInterface; + +import com.memoire.bu.BuFileFilter; + +/** + * interface qui gere l'export dans les formats donn\xE9s + * + * @author Adrien Hadoux + * + */ +public interface CtuluWriter { + + /** + * indique le fichier ou ecrire les donn\xE9es + * + * @param f + */ + public void setFile(File f); + + + /** + * g\xE9n\xE8re le fichier en \xE9crivant le model de donn\xE9es. + * + * @param _p + * @throws IOException + * @throws WriteException + */ + public void write(final ProgressionInterface _p) throws IOException, WriteException; + + /** + * r\xE9cup\xE8re les filtres g\xE9r\xE9s par le writer + * + * @return + */ + public BuFileFilter getFilter(); + + /** + * ins\xE8re le mod\xE8le de donn\xE9es. + * + * @param model + */ + public void setModel(CtuluTableModelInterface model); + + + /** + * donne l'extension de fichier la plus fr\xE9quente. + * + * @return + */ + public String getMostPopularExtension(); + + /** + * indique si le wizard peut proposer des formattages de donnees. + * + * @return + */ + public boolean allowFormatData(); + +} 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 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -16,9 +16,10 @@ public final static ScopeKeyWord KEY = new ScopeKeyWord(); public abstract void printResults(); - + /** - * Structure pour les fichiers s ou t + * Structure pour les fichiers s ou t Par convention les x sont les premieres + * variables. * * @author Adrien * @@ -64,6 +65,27 @@ } /** + * Recupere la liste des x. Par convention les x sont les premieres + * variables. + * + * @return + */ + public List<Double> getAllX() { + return data_.get(listeVariales_.get(0)); + } + + + /** + * retourne un x sp\xE9cifi\xE9. + * + * @param i + * @return + */ + public double getX(int i) { + return getAllX().get(i); + } + + /** * Retourne le nombre de valeur pour chaque variables * * @return Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExportData.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExportData.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExportData.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -15,8 +15,6 @@ import jxl.write.Number; import jxl.write.WritableCell; -import com.memoire.bu.BuTask; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.ProgressionInterface; @@ -161,6 +159,9 @@ EGCourbe[] cs_; EGGraphe g_; + + + int maxCol_; int maxLine_; @@ -168,7 +169,15 @@ cs_ = _cs; g_ = _g; } + + public EGCourbe[] getCourbes() { + return cs_; + } + public EGGraphe getGraphe() { + return g_; + } + public String getColumnName(final int _i) { return column_[_i]; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExporter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExporter.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGExporter.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -27,15 +27,6 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; -import com.memoire.bu.BuBorders; -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuList; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuScrollPane; -import com.memoire.bu.BuVerticalLayout; -import com.memoire.fu.FuLog; - -import org.fudaa.ctulu.CsvWriter; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluResource; @@ -44,14 +35,20 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluCellTextRenderer; import org.fudaa.ctulu.gui.CtuluDialogPanel; -import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; +import org.fudaa.ctulu.gui.CtuluFileChooserWriter; import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluLibSwing; -import org.fudaa.ctulu.gui.CtuluTableCsvWriter; -import org.fudaa.ctulu.gui.CtuluTableExcelWriter; - +import org.fudaa.ctulu.gui.CtuluWriter; import org.fudaa.ebli.commun.EbliLib; +import com.memoire.bu.BuBorders; +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuList; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuVerticalLayout; +import com.memoire.fu.FuLog; + /** * @author Fred Deniger * @version $Id: EGExporter.java,v 1.19 2007-06-14 12:00:22 deniger Exp $ @@ -66,9 +63,11 @@ } } - public static void startExport(final EGGraphe _target, final CtuluUI _impl) { + public static void startExport(final EGGraphe _target, final CtuluUI _impl, final List<CtuluWriter> _listWriter) { - final CtuluFileChooserCsvExcel ch = new CtuluFileChooserCsvExcel(_impl); + + + final CtuluFileChooserWriter ch = new CtuluFileChooserWriter(_impl, _listWriter); final Frame f = CtuluLibSwing.getFrameAncestorHelper(_impl.getParentComponent()); final File destFile = ch.getDestFile(); if (destFile == null) { @@ -87,14 +86,14 @@ .getS("Aucune donn\xE9e \xE0 exporter")); } try { - if (ch.isExcelChoosen()) { - final CtuluTableExcelWriter c = new CtuluTableExcelWriter(d, destFile); - c.write(_proj); - } else { - final CsvWriter c = new CsvWriter(destFile); - final CtuluTableCsvWriter w = new CtuluTableCsvWriter(c, d); - w.write(_proj); - } + // -- recuperation du writer + CtuluWriter writer=ch.getSelectedWriter(); + + writer.setFile(destFile); + writer.setModel(d); + writer.write(_proj); + + } catch (final Exception _e) { FuLog.error(_e); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFille.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFille.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -22,8 +22,6 @@ import javax.swing.JMenu; import javax.swing.SwingUtilities; -import com.memoire.bu.*; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluExportDataInterface; import org.fudaa.ctulu.CtuluLibString; @@ -33,7 +31,6 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluPopupListener; import org.fudaa.ctulu.image.CtuluImageProducer; - import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliComponentFactory; @@ -41,6 +38,17 @@ import org.fudaa.ebli.impression.EbliFilleImprimable; import org.fudaa.ebli.impression.EbliPrinter; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuCommonInterface; +import com.memoire.bu.BuCutCopyPasteInterface; +import com.memoire.bu.BuDesktop; +import com.memoire.bu.BuInformationsDocument; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuSplit2Pane; +import com.memoire.bu.BuUndoRedoInterface; + /** * @author Fred Deniger * @version $Id: EGFille.java,v 1.26 2007-06-28 09:26:47 deniger Exp $ @@ -78,7 +86,8 @@ } public void startExport(final CtuluUI _impl) { - EGExporter.startExport(getGraphe(), _impl); + + EGExporter.startExport(getGraphe(), _impl, null); } /** Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -11,6 +11,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.Map; import javax.swing.filechooser.FileFilter; @@ -26,6 +27,9 @@ import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTableCsvWriter; +import org.fudaa.ctulu.gui.CtuluTableExcelWriter; +import org.fudaa.ctulu.gui.CtuluWriter; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.dodico.mesure.EvolutionFileFormatVersion; @@ -130,7 +134,7 @@ } public void actionPerformed(final ActionEvent _e) { - EGExporter.startExport(graphe_, impl_); + EGExporter.startExport(graphe_, impl_, getFileFormatForExport()); } } @@ -196,4 +200,23 @@ return rf; } + + /** + * Methode statique qui retourne les writer possible pour l exportation des + * courbes + * + * @return + */ + public static List<CtuluWriter> getFileFormatForExport() { + final ArrayList<CtuluWriter> liste = new ArrayList<CtuluWriter>(10); + + liste.add(new CtuluTableExcelWriter()); + liste.add(new CtuluTableCsvWriter()); + + // --ajout des formats scope --// + liste.add(new FudaaWriterScopeS()); + + return liste; + } + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeS.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeS.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeS.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -0,0 +1,124 @@ +package org.fudaa.fudaa.commun.courbe; + +import java.io.File; +import java.io.IOException; + +import jxl.write.WriteException; + +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluTableModelInterface; +import org.fudaa.ctulu.gui.CtuluWriter; +import org.fudaa.dodico.telemac.io.ScopeSFileFormat; +import org.fudaa.dodico.telemac.io.ScopeStructure; +import org.fudaa.ebli.courbe.EGAxeHorizontal; +import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGExportData; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGObject; + +import com.memoire.bu.BuFileFilter; + +public class FudaaWriterScopeS implements CtuluWriter { + + ScopeSFileFormat format_; + File destination_; + ScopeStructure.SorT structure_; + String extension_ = ".scopS"; + BuFileFilter filter_; + + + public FudaaWriterScopeS(){ + format_ = ScopeSFileFormat.getInstance(); + filter_ = format_.createFileFilter(); + + } + + public BuFileFilter getFilter() { + return filter_; + } + + public String getMostPopularExtension() { + return extension_; + } + + public void setFile(File _f) { + destination_ = _f; + + } + + public void setModel(CtuluTableModelInterface _model) { + + structure_ = new ScopeStructure.SorT(); + + //-- data qui contient les courbes choisies --// + EGExportData data = (EGExportData) _model; + EGGraphe graphe_ = data.getGraphe(); + EGCourbe[] liste=data.getCourbes(); + + //-- on ajoute la var des x, debut de chaque ligne de valeurs --// + structure_.addVariable("X"); + //--on ajoute tous les x donn\xE9s de la courbe--// + + + final EGAxeHorizontal h = graphe_.getTransformer().getXAxe(); + for (int i = liste.length - 1; i >= 0; i--) { + final EGCourbe c = liste[i]; + for (int j = c.getModel().getNbValues() - 1; j >= 0; j--) { + final double x = c.getModel().getX(j); + if ( (h.containsPoint(x))) { + //-- on ajoute le x pour les variables x --// + structure_.addValueForVariable(x,0); + } + } + } + + + for (int i = 0; i < graphe_.getModel().getNbEGObject(); i++) { + final EGObject ci = graphe_.getModel().getEGObject(i); + if (ci instanceof EGGroup) { + EGGroup groupe = (EGGroup) ci; + + structure_.addVariable(groupe.getTitle()); + + for (int k = 0; k < groupe.getChildCount(); k++) { + EGCourbeChild courbe = groupe.getCourbeAt(k); + + boolean selected = false; + for (int j = 0; !selected && j < liste.length; j++) + if (liste[j] == courbe) + selected = true; + + if (selected) { + // --ajout des valeurs pour chaque X--/ + for (int g = 0; g < structure_.getAllX().size(); g++) { + //-- on ajoute la valeur interpol\xE9e pour les x pr\xE9cemment saisis --// + double x = structure_.getX(g); + double yInterpole = courbe.interpol(x); + structure_.addValueForVariable(yInterpole, structure_.getNbVariables() - 1); + } + + } + } + + + + } + + } + + + + } + + public void write(ProgressionInterface _p) throws IOException, WriteException { + format_.getLastVersionInstance(null).write(destination_, structure_, null); + + } + + public boolean allowFormatData() { + return true; + } + +} 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 2008-09-25 20:31:07 UTC (rev 3987) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-09-26 09:28:40 UTC (rev 3988) @@ -45,10 +45,6 @@ import javax.swing.plaf.InternalFrameUI; import javax.swing.plaf.basic.BasicInternalFrameUI; -import com.memoire.bu.*; -import com.memoire.fu.Fu; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluAnalyze; import org.fudaa.ctulu.CtuluExportDataInterface; import org.fudaa.ctulu.CtuluIOOperationSynthese; @@ -65,12 +61,10 @@ import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.ctulu.image.CtuluImageExport; import org.fudaa.ctulu.image.CtuluImageProducer; - import org.fudaa.ebli.impression.EbliFillePrevisualisation; import org.fudaa.ebli.impression.EbliMiseEnPageDialog; import org.fudaa.ebli.impression.EbliMiseEnPagePreferencesPanel; import org.fudaa.ebli.impression.EbliPageable; - import org.fudaa.fudaa.commun.FudaaAstuces; import org.fudaa.fudaa.commun.FudaaAstucesAbstract; import org.fudaa.fudaa.commun.FudaaBrowserControl; @@ -83,6 +77,35 @@ import org.fudaa.fudaa.commun.undo.FudaaUndoCmdMngListener; import org.fudaa.fudaa.ressource.FudaaResource; +import com.memoire.bu.BuAbstractPreferencesPanel; +import com.memoire.bu.BuBrowserPreferencesPanel; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuColumn; +import com.memoire.bu.BuCommonImplementation; +import com.memoire.bu.BuDesktopPreferencesPanel; +import com.memoire.bu.BuDialogWarning; +import com.memoire.bu.BuGlassPaneStop; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuInsets; +import com.memoire.bu.BuLanguagePreferencesPanel; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuLookPreferencesPanel; +import com.memoire.bu.BuMainPanel; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuMenuInterface; +import com.memoire.bu.BuMenuItem; +import com.memoire.bu.BuPreferences; +import com.memoire.bu.BuPreferencesDialog; +import com.memoire.bu.BuPreferencesMainPanel; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuTask; +import com.memoire.bu.BuToolBar; +import com.memoire.bu.BuToolButton; +import com.memoire.bu.BuUserPreferencesPanel; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; + /** * @author deniger * @version $Id: FudaaCommonImplementation.java,v 1.10 2007-06-11 13:08:24 deniger Exp $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-26 22:34:58
|
Revision: 3993 http://fudaa.svn.sourceforge.net/fudaa/?rev=3993&view=rev Author: deniger Date: 2008-09-26 22:34:47 +0000 (Fri, 26 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.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/MvProfileBuilderFromTree.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/TrIsoLineAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizard.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizardListValue.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostAnalyze.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/TrPostCourbeBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDataCreationPanel.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/TrPostLayoutFille.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/TrPostMultiSourceActivator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProfileAction.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/TrPostRubarEdgesResults.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarLimniMng.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/TrPostSourceComparatorBuilder.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/TrPostSourceSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTimeFmtPanel.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/TrPostVisuPanelRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/mv/TestProfile.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/tr/Test3D.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/tr/TestJTrPostProject.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/tr/TrTestPostWatcherRubar.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluCommandAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarSpecificAction.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/save/ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/save/TrPostProjetSaver.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceActivator.java Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluCommandAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluCommandAction.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluCommandAction.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -0,0 +1,86 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ctulu; + +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.KeyStroke; + +import com.memoire.bu.BuResource; + +/** + * @author deniger + */ +@SuppressWarnings("serial") +public abstract class CtuluCommandAction extends AbstractAction { + + /** + * Action de undo + * + * @author deniger + */ + public static class Undo extends CtuluCommandAction { + + public Undo(CtuluCommandManager _mng) { + super(CtuluLib.getS("D\xE9faire"), BuResource.BU.getIcon("defaire"), _mng); + putValue(Action.ACTION_COMMAND_KEY, KeyStroke.getKeyStroke("ctrl z")); + } + + @Override + protected void updateState() { + setEnabled(mng_.canUndo()); + } + + public void actionPerformed(ActionEvent _e) { + mng_.undo(); + + } + + } + + /** + * action de redo. + * + * @author deniger + */ + public static class Redo extends CtuluCommandAction { + + public Redo(CtuluCommandManager _mng) { + super(CtuluLib.getS("Refaire"), BuResource.BU.getIcon("refaire"), _mng); + putValue(Action.ACTION_COMMAND_KEY, KeyStroke.getKeyStroke("ctrl shift Z")); + } + + @Override + protected void updateState() { + setEnabled(mng_.canRedo()); + } + + public void actionPerformed(ActionEvent _e) { + mng_.redo(); + } + + } + + final CtuluCommandManager mng_; + + protected CtuluCommandAction(String _name, Icon _icon, CtuluCommandManager _mng) { + super(_name, _icon); + putValue(Action.SHORT_DESCRIPTION, getValue(Action.NAME)); + mng_ = _mng; + mng_.setListener(new CtuluCmdMngListener() { + + public void undoredoStateChange(CtuluCommandManager _source) { + updateState(); + } + }); + } + + protected void updateState() {} + +} 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 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -113,7 +113,7 @@ public ZCalquePoint getIsoLayer() { return null; } - + /** * @author Fred Deniger * @version $Id: ZEbliCalquesPanel.java,v 1.55 2007-06-05 08:58:38 deniger Exp $ @@ -274,6 +274,10 @@ this(_cq, new ZEbliCalquePanelController(_ui)); } + public CtuluUI getCtuluUI() { + return getController().getUI(); + } + BuLabel info_; /** @@ -858,8 +862,7 @@ } protected void removeCalqueLegend() { - if(getCqLegend()!=null) - getCqInfos().remove(getCqLegend()); + if (getCqLegend() != null) getCqInfos().remove(getCqLegend()); // getCqLegend().setVisible(false); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -146,12 +146,12 @@ g.axeUpdated(); g.fullRepaint(); -// EventQueue.invokeLater(new Runnable() { -// public void run() { -// g.axeUpdated(); -// // g.restore(); -// -// } -// }); + EventQueue.invokeLater(new Runnable() { + public void run() { + g.axeUpdated(); + // g.restore(); + + } + }); } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -83,7 +83,7 @@ public final CtuluUI ui_; - public MvProfileBuilder(final MvProfileTarget _data, final CtuluUI _ui, final ZEbliCalquesPanel _panel, + public MvProfileBuilder(final MvProfileTarget _data, final ZEbliCalquesPanel _panel, EfLineIntersectionsCorrectionTester _tester) { super(); data_ = _data; @@ -91,7 +91,7 @@ tester_ = _tester; initVar_ = CtuluLibSwing.createListModel(data_.getVars()); act_ = new EfLineIntersectorActivity(data_.getData(), data_.getInterpolator()); - ui_ = _ui; + ui_ = panel_.getCtuluUI(); timeModel_ = _data.getTimeModel(); } @@ -235,8 +235,7 @@ } /** - * Methode qui permet d ajouter une courbe spatiale poru un grapeh deja - * existant. + * Methode qui permet d ajouter une courbe spatiale poru un grapeh deja existant. * * @author Adrien Hadoux * @param _prog @@ -244,129 +243,129 @@ */ public MvProfileFillePanel actAddGroupForExistingModel(final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { - int[] time = _selected.getSelectedTimeStepIdx(); - final CtuluVariable[] vs = _selected.getSelectedVar(); + int[] time = _selected.getSelectedTimeStepIdx(); + final CtuluVariable[] vs = _selected.getSelectedVar(); - final int nbVar = vs == null ? 0 : vs.length; - final boolean isTime = timeModel_ != null; - if (time == null) { - time = new int[] { 0 }; - } - boolean addXYForNode = false; - boolean addXYForMesh = false; - for (int i = initVar_.getSize() - 1; i >= 0; i--) { - if (data_.getData().isElementVar((CtuluVariable) initVar_.getElementAt(i))) { - addXYForMesh = true; - } else { - addXYForNode = true; + final int nbVar = vs == null ? 0 : vs.length; + final boolean isTime = timeModel_ != null; + if (time == null) { + time = new int[] { 0 }; } - // les 2 sont a true - if (addXYForMesh && addXYForNode) { - break; + boolean addXYForNode = false; + boolean addXYForMesh = false; + for (int i = initVar_.getSize() - 1; i >= 0; i--) { + if (data_.getData().isElementVar((CtuluVariable) initVar_.getElementAt(i))) { + addXYForMesh = true; + } else { + addXYForNode = true; + } + // les 2 sont a true + if (addXYForMesh && addXYForNode) { + break; + } } - } - final int nbTIme = time.length; - final MvProfileTreeModel tree = new MvProfileTreeModel(this.data_, tester_); - if (addXYForNode) { - tree.setNodesResults(getNodeResultsMng(_prog), getNodeResultBuilder(_prog)); - } - if (addXYForMesh) { - tree.setMeshesResults(getMeshResultsMng(_prog), getMeshesResultBuilder(_prog)); + final int nbTIme = time.length; + final MvProfileTreeModel tree = new MvProfileTreeModel(this.data_, tester_); + if (addXYForNode) { + tree.setNodesResults(getNodeResultsMng(_prog), getNodeResultBuilder(_prog)); + } + if (addXYForMesh) { + tree.setMeshesResults(getMeshResultsMng(_prog), getMeshesResultBuilder(_prog)); - } - final EGGroup grCoord = new EGGroup(); - final String s = EbliLib.getS("Coordonn\xE9es"); - grCoord.setTitle(s); - final EGAxeVertical yCoordonnees = new EGAxeVertical(); - yCoordonnees.setTitre(s); - yCoordonnees.setUnite("m"); - grCoord.setAxeY(yCoordonnees); - final String sep = " - "; - if (addXYForNode) { - final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( - getNodeResultsMng(_prog).getDefaultRes(), true)); - final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( - getNodeResultsMng(_prog).getDefaultRes(), false)); - if (addXYForNode && addXYForMesh) { - courbeChild.setTitle(courbeChild.getTitle() + sep + MvResource.getS("Noeuds")); - courbeChild2.setTitle(courbeChild2.getTitle() + sep + MvResource.getS("Noeuds")); } - grCoord.addEGComponent(courbeChild); + final EGGroup grCoord = new EGGroup(); + final String s = EbliLib.getS("Coordonn\xE9es"); + grCoord.setTitle(s); + final EGAxeVertical yCoordonnees = new EGAxeVertical(); + yCoordonnees.setTitre(s); + yCoordonnees.setUnite("m"); + grCoord.setAxeY(yCoordonnees); + final String sep = " - "; + if (addXYForNode) { + final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getNodeResultsMng(_prog).getDefaultRes(), true)); + final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getNodeResultsMng(_prog).getDefaultRes(), false)); + if (addXYForNode && addXYForMesh) { + courbeChild.setTitle(courbeChild.getTitle() + sep + MvResource.getS("Noeuds")); + courbeChild2.setTitle(courbeChild2.getTitle() + sep + MvResource.getS("Noeuds")); + } + grCoord.addEGComponent(courbeChild); - grCoord.addEGComponent(courbeChild2); + grCoord.addEGComponent(courbeChild2); - } - if (addXYForMesh) { - final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( - getMeshResultsMng(_prog).getDefaultRes(), true)); - final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( - getMeshResultsMng(_prog).getDefaultRes(), false)); - if (addXYForNode && addXYForMesh) { - courbeChild.setTitle(courbeChild.getTitle() + sep + MvResource.getS("Elements")); - courbeChild2.setTitle(courbeChild2.getTitle() + sep + MvResource.getS("Elements")); } - grCoord.addEGComponent(courbeChild); + if (addXYForMesh) { + final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getMeshResultsMng(_prog).getDefaultRes(), true)); + final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getMeshResultsMng(_prog).getDefaultRes(), false)); + if (addXYForNode && addXYForMesh) { + courbeChild.setTitle(courbeChild.getTitle() + sep + MvResource.getS("Elements")); + courbeChild2.setTitle(courbeChild2.getTitle() + sep + MvResource.getS("Elements")); + } + grCoord.addEGComponent(courbeChild); - grCoord.addEGComponent(courbeChild2); + grCoord.addEGComponent(courbeChild2); - } - grCoord.setVisible(false); - tree.add(grCoord); - // map permettant de stocker la correspondance var -> groupe - final Map varGroup = new HashMap(); - if (vs != null) { - for (int i = 0; i < nbVar; i++) { - // pas null - final CtuluVariable var = vs[i]; - MvProfileCourbeGroup gri = null; - // dans ce cas, on va g\xE9rer les variables parents: inutile de creer des groupe different - // pour des variables de meme type - Color c = null; - boolean mustAddGr = true; - if (var instanceof H2dVariableType) { - H2dVariableType parent = ((H2dVariableType) var).getParentVariable(); - if (parent == null) { - parent = (H2dVariableType) var; + } + grCoord.setVisible(false); + tree.add(grCoord); + // map permettant de stocker la correspondance var -> groupe + final Map varGroup = new HashMap(); + if (vs != null) { + for (int i = 0; i < nbVar; i++) { + // pas null + final CtuluVariable var = vs[i]; + MvProfileCourbeGroup gri = null; + // dans ce cas, on va g\xE9rer les variables parents: inutile de creer des groupe different + // pour des variables de meme type + Color c = null; + boolean mustAddGr = true; + if (var instanceof H2dVariableType) { + H2dVariableType parent = ((H2dVariableType) var).getParentVariable(); + if (parent == null) { + parent = (H2dVariableType) var; + } + c = MvProfileFillePanel.getColorFor(i, parent); + gri = (MvProfileCourbeGroup) varGroup.get(parent); + if (gri == null) { + gri = MvProfileFillePanel.createGroupFor(parent); + varGroup.put(parent, gri); + } else { + mustAddGr = false; + } } - c = MvProfileFillePanel.getColorFor(i, parent); - gri = (MvProfileCourbeGroup) varGroup.get(parent); if (gri == null) { - gri = MvProfileFillePanel.createGroupFor(parent); - varGroup.put(parent, gri); - } else { - mustAddGr = false; + gri = MvProfileFillePanel.createGroupFor(var); } - } - if (gri == null) { - gri = MvProfileFillePanel.createGroupFor(var); - } - if (c == null) { - c = MvProfileFillePanel.getColorFor(i, var); - } - // on doit construire les courbes - for (int t = 0; t < nbTIme; t++) { - final MVProfileCourbeModel model = new MVProfileCourbeModel(var, data_.getData(), time[t], getResBuilder(var, - _prog), _prog); - EGCourbeChild child; - if (isTime) { - model.setTitle(var.toString() + CtuluLibString.ESPACE + timeModel_.getElementAt(time[t])); - child = new MvProfileCourbeTime(gri, model, timeModel_); - } else { - child = new MvProfileCourbe(gri, model); + if (c == null) { + c = MvProfileFillePanel.getColorFor(i, var); } - child.setAspectContour(c); - gri.addEGComponent(child); + // on doit construire les courbes + for (int t = 0; t < nbTIme; t++) { + final MVProfileCourbeModel model = new MVProfileCourbeModel(var, data_.getData(), time[t], getResBuilder(var, + _prog), _prog); + EGCourbeChild child; + if (isTime) { + model.setTitle(var.toString() + CtuluLibString.ESPACE + timeModel_.getElementAt(time[t])); + child = new MvProfileCourbeTime(gri, model, timeModel_); + } else { + child = new MvProfileCourbe(gri, model); + } + child.setAspectContour(c); + gri.addEGComponent(child); + } + if (mustAddGr) { + tree.add(gri); + } } - if (mustAddGr) { - tree.add(gri); - } } - } - return new MvProfileFillePanel(tree, ui_); + return new MvProfileFillePanel(tree, ui_); } - + protected void close() { if (tmp_ != null) { tmp_.detruire(); @@ -383,23 +382,17 @@ } protected EfLineIntersectionsResultsI getRes(final CtuluVariable _o, final int _tidx, final ProgressionInterface _prog) { - if (data_.getData().isElementVar(_o)) { - return getMeshResults(_prog, _tidx); - } + if (data_.getData().isElementVar(_o)) { return getMeshResults(_prog, _tidx); } return getNodeResults(_prog, _tidx); } protected EfLineIntersectionsResultsBuilder getResBuilder(final CtuluVariable _o, final ProgressionInterface _prog) { - if (data_.getData().isElementVar(_o)) { - return getMeshesResultBuilder(_prog); - } + if (data_.getData().isElementVar(_o)) { return getMeshesResultBuilder(_prog); } return getNodeResultBuilder(_prog); } public EfLineIntersectionsResultsI getDefaultRes(final CtuluVariable _o, final ProgressionInterface _prog) { - if (data_.getData().isElementVar(_o)) { - return getMeshResultsMng(_prog).getDefaultRes(); - } + if (data_.getData().isElementVar(_o)) { return getMeshResultsMng(_prog).getDefaultRes(); } return getNodeResultsMng(_prog).getDefaultRes(); } @@ -415,9 +408,7 @@ protected abstract void stepOne(); protected void update(final LineString _s, final boolean _zoom) { - if (panel_ == null) { - return; - } + if (panel_ == null) { return; } if (_s == null) { if (tmp_ != null) { tmp_.setVisible(false); Modified: 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/MvProfileBuilderFromLine.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -26,7 +26,7 @@ public MvProfileBuilderFromLine(final MvProfileTarget _data, final CtuluUI _ui, final LineString _line, final ZEbliCalquesPanel _panel, EfLineIntersectionsCorrectionTester _tester) { - super(_data, _ui, _panel, _tester); + super(_data, _panel, _tester); selectedLine_ = _line; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -73,7 +73,7 @@ public MvProfileBuilderFromTree(final MvProfileTarget _data, final CtuluUI _ui, final LineString _selected, final ZEbliCalquesPanel _panel, EfLineIntersectionsCorrectionTester _tester) { - super(_data, _ui, _panel, _tester); + super(_data, _panel, _tester); lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _panel.getDonneesCalque()); initSelected_ = _selected; calque_ = _panel; 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 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -431,7 +431,7 @@ alreadyOpened.getFrame().setState(Frame.NORMAL); alreadyOpened.getFrame().requestFocus(); // pour Rubar - alreadyOpened.getCurrentProject().activate(_f); +// alreadyOpened.getCurrentProject().activate(_f); return alreadyOpened; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineAction.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineAction.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -29,11 +29,11 @@ public TrIsoLineAction(final TrPostVisuPanel _dest) { super(TrResource.getS("Rechercher les isolignes"), null, "FIND_ISOS"); dest_ = _dest; - project_ = dest_.srcCont_; + project_ = dest_.projet_; } public void actionPerformed(final ActionEvent _e) { - final BuWizardDialog dialog = new BuWizardDialog(dest_.getImpl().getFrame(), new TrIsoLineWizard(dest_, project_)); + final BuWizardDialog dialog = new BuWizardDialog(dest_.getImpl().getFrame(), new TrIsoLineWizard(dest_)); dialog.pack(); dialog.setModal(true); dialog.setLocationRelativeTo(dest_.getImpl().getFrame()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizard.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizard.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizard.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -49,28 +49,34 @@ */ public class TrIsoLineWizard extends BuWizardTask { + BuCheckBox cbOneLayer_; + BuComboBox cbVariables_; + + CtuluListEditorPanel ctuluListEditorPanel_; CtuluVariable currentVariable_; final TrPostVisuPanel dest_; - BuList listTimes_; + MvExportPanelFilter filter_; - BuPanel pnValues_; + BuLabel lbTime_; - BuPanel pnVars_; + BuList listTimes_; BuPanel pnFinish_; - final TrPostProjet project_; + BuPanel pnValues_; + BuPanel pnVars_; + BuTextField tfPrec_; + final TrIsoLineWizardListValue values_; - Map varIsoValues_ = new HashMap(); + Map<CtuluVariable, List> varIsoValues_ = new HashMap<CtuluVariable, List>(); - public TrIsoLineWizard(final TrPostVisuPanel _dest, final TrPostProjet _project) { + public TrIsoLineWizard(final TrPostVisuPanel _dest) { super(); dest_ = _dest; - project_ = _project; - final ListModel newVarListModel = project_.getSource().getNewVarListModel(); + final ListModel newVarListModel = dest_.getSource().getNewVarListModel(); // rien ! Object selected = getSelectedVarInLayer(); // on recherche si la variable selectionn\xE9 dans le calque courant est bien dispo @@ -85,7 +91,7 @@ cbModel.setSelectedItem(selected); cbVariables_ = new BuComboBox(cbModel); - final ListModel time = project_.getSource().getNewTimeListModel(); + final ListModel time = dest_.getSource().getNewTimeListModel(); final int idx = getSelectedTimeInLayer(); listTimes_ = new BuList(time); listTimes_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -105,12 +111,34 @@ } - BuLabel lbTime_; + private void buildFinishPn() { + if (pnFinish_ != null) { return; } + pnFinish_ = new BuPanel(new BuBorderLayout(0, 10)); + BuPanel pnCommon = new BuPanel(); + pnCommon.setLayout(new BuGridLayout(2, 5, 5)); + tfPrec_ = BuTextField.createDoubleField(); + final CtuluValueValidator min = new CtuluValueValidator.DoubleMin(0); + tfPrec_.setValueValidator(min); + tfPrec_.setToolTipText(min.getDescription()); + tfPrec_.setValue(new Double(1E-4)); + pnCommon.add(new BuLabel(TrLib.getString("Pr\xE9cision des isolignes"))); + pnCommon.add(tfPrec_); + pnCommon.add(new BuLabel(TrLib.getString("Cr\xE9er un calque par valeur"))); + cbOneLayer_ = new BuCheckBox(); + pnCommon.add(cbOneLayer_); + pnFinish_.add(pnCommon, BuBorderLayout.NORTH); + pnCommon = new BuPanel(); + pnCommon.setLayout(new BuVerticalLayout(1)); + pnCommon.add(new BuLabel(TrLib + .getString("Utiliser un filtre pour extraire les isoslignes que sur une partie du maillage:"))); + filter_ = TrExportPanelFilterFactory.buildFilterForEachTimeStep(dest_.getCurrentSelection(), dest_.getSource()); + pnCommon.add(filter_.getComponent()); + pnFinish_.add(pnCommon, BuBorderLayout.CENTER); + } + private void buildFirstPn() { - if (pnVars_ != null) { - return; - } + if (pnVars_ != null) { return; } pnVars_ = new BuPanel(); pnVars_.setLayout(new BuVerticalLayout(5)); BuPanel pn = new BuPanel(new BuBorderLayout()); @@ -135,9 +163,7 @@ } private void buildValuesPn() { - if (pnValues_ != null) { - return; - } + if (pnValues_ != null) { return; } pnValues_ = new BuPanel(); pnValues_.setLayout(new BuBorderLayout(5, 5, false, true)); final BuButton bt = new BuButton(BuResource.BU.getIcon("effacer")); @@ -155,45 +181,37 @@ pnValues_.add(ctuluListEditorPanel_, BuBorderLayout.CENTER); } - CtuluListEditorPanel ctuluListEditorPanel_; - BuCheckBox cbOneLayer_; - MvExportPanelFilter filter_; - - private void buildFinishPn() { - if (pnFinish_ != null) { - return; + public void doTask() { + final H2dVariableType var = (H2dVariableType) cbVariables_.getSelectedItem(); + final int[] times = listTimes_.getSelectedIndices(); + final TDoubleHashSet set = new TDoubleHashSet(values_.getRowCount()); + for (int i = 0; i < values_.getRowCount(); i++) { + set.add(Double.parseDouble((String) values_.getValueAt(i))); } - pnFinish_ = new BuPanel(new BuBorderLayout(0, 10)); - BuPanel pnCommon = new BuPanel(); - pnCommon.setLayout(new BuGridLayout(2, 5, 5)); - tfPrec_ = BuTextField.createDoubleField(); - final CtuluValueValidator min = new CtuluValueValidator.DoubleMin(0); - tfPrec_.setValueValidator(min); - tfPrec_.setToolTipText(min.getDescription()); - tfPrec_.setValue(new Double(1E-4)); - pnCommon.add(new BuLabel(TrLib.getString("Pr\xE9cision des isolignes"))); - pnCommon.add(tfPrec_); - pnCommon.add(new BuLabel(TrLib.getString("Cr\xE9er un calque par valeur"))); - cbOneLayer_ = new BuCheckBox(); - pnCommon.add(cbOneLayer_); - pnFinish_.add(pnCommon, BuBorderLayout.NORTH); - pnCommon = new BuPanel(); - pnCommon.setLayout(new BuVerticalLayout(1)); - pnCommon.add(new BuLabel(TrLib - .getString("Utiliser un filtre pour extraire les isoslignes que sur une partie du maillage:"))); - filter_ = TrExportPanelFilterFactory.buildFilterForEachTimeStep(dest_.getCurrentSelection(), project_.getSource()); - pnCommon.add(filter_.getComponent()); - pnFinish_.add(pnCommon, BuBorderLayout.CENTER); + final double[] values = set.toArray(); + Arrays.sort(values); + final TrIsoLineAdder trIsoLineAdder = new TrIsoLineAdder(dest_.getSource(), dest_, values, times, var, + ((Double) tfPrec_.getValue()).doubleValue()); + trIsoLineAdder.setUseOnValueByLayer(cbOneLayer_.isSelected()); + trIsoLineAdder.setFilter(filter_.getFilter(dest_.getSource())); + trIsoLineAdder.go(); + done_ = true; + } + /** + * @return + * @see org.fudaa.fudaa.tr.post.TrPostVisuPanel#getProjet() + */ + public TrPostProjet getProjet() { + return dest_.getProjet(); } private int getSelectedTimeInLayer() { final BCalque cq = dest_.getCalqueActif(); - if (cq instanceof BSelecteurListTimeTarget) { - return ((BSelecteurListTimeTarget) cq).getTimeListSelectionModel().getMaxSelectionIndex(); - } - return project_.getSource().getNbTimeStep() - 1; + if (cq instanceof BSelecteurListTimeTarget) { return ((BSelecteurListTimeTarget) cq).getTimeListSelectionModel() + .getMaxSelectionIndex(); } + return dest_.getSource().getNbTimeStep() - 1; } private Object getSelectedVarInLayer() { @@ -201,55 +219,19 @@ if (cq instanceof BSelecteurListTarget) { final BSelecteurListTarget selecteurListTarget = (BSelecteurListTarget) cq; final int idx = selecteurListTarget.getListSelectionModel().getMaxSelectionIndex(); - if (idx >= 0) { - return selecteurListTarget.getListModel().getElementAt(idx); - } + if (idx >= 0) { return selecteurListTarget.getListModel().getElementAt(idx); } } return H2dVariableType.HAUTEUR_EAU; } - boolean isCurrentValide() { - if (current_ == 0) { - final boolean res = !listTimes_.isSelectionEmpty(); - if (res) { - lbTime_.setText(CtuluLibString.ESPACE); - } else { - lbTime_.setText(TrLib.getString("S\xE9lectionner au moins un pas de temps")); - } - return res; - } - return true; + /** + * @return + * @see org.fudaa.fudaa.tr.post.TrPostVisuPanel#getSource() + */ + public TrPostSource getSource() { + return dest_.getSource(); } - void varChanged() { - // on sauvegarde les anciennes valeurs - varIsoValues_.put(currentVariable_, values_.getValuesInList()); - currentVariable_ = (CtuluVariable) cbVariables_.getSelectedItem(); - final List saved = (List) varIsoValues_.get(currentVariable_); - if (saved == null) { - values_.updateOrCreateValues(); - } else { - values_.setData(saved); - } - } - - public void doTask() { - final H2dVariableType var = (H2dVariableType) cbVariables_.getSelectedItem(); - final int[] times = listTimes_.getSelectedIndices(); - final TDoubleHashSet set = new TDoubleHashSet(values_.getRowCount()); - for (int i = 0; i < values_.getRowCount(); i++) { - set.add(Double.parseDouble((String) values_.getValueAt(i))); - } - final double[] values = set.toArray(); - Arrays.sort(values); - final TrIsoLineAdder trIsoLineAdder = new TrIsoLineAdder(project_.getSource(), dest_, values, times, var, - ((Double) tfPrec_.getValue()).doubleValue()); - trIsoLineAdder.setUseOnValueByLayer(cbOneLayer_.isSelected()); - trIsoLineAdder.setFilter(filter_.getFilter(project_.getSource())); - trIsoLineAdder.go(); - done_ = true; - } - public JComponent getStepComponent() { // pour prendre en compte les modifications dans le tableau au cas ou la cellule serait toujours en \xE9dition if (ctuluListEditorPanel_ != null) { @@ -277,22 +259,16 @@ } public String getStepText() { - if (current_ == 0) { - return TrLib.getString("Vous devez choisir une variable et un ou plusieurs pas de temps"); - } - if (current_ == 1) { - return TrLib.getString("Choisir les valeurs \xE0 utiliser pour construire les isolignes"); - } - if (current_ == 2) { - return "+ " - + TrLib.getString("La pr\xE9cision permet de prendre en compte les impr\xE9cisions num\xE9riques.") - + CtuluLibString.LINE_SEP_SIMPLE - + " " - + TrLib - .getString("2 valeurs seront suppos\xE9es \xE9gales si leur diff\xE9rence est inf\xE9rieure \xE0 la pr\xE9cision ci-dessus.") - + CtuluLibString.LINE_SEP_SIMPLE + CtuluLibString.ESPACE + CtuluLibString.LINE_SEP_SIMPLE + "+ " - + TrLib.getString("La case \xE0 cocher permet de cr\xE9er un calque par valeurs sp\xE9cifi\xE9es pr\xE9c\xE9demment."); - } + if (current_ == 0) { return TrLib.getString("Vous devez choisir une variable et un ou plusieurs pas de temps"); } + if (current_ == 1) { return TrLib.getString("Choisir les valeurs \xE0 utiliser pour construire les isolignes"); } + if (current_ == 2) { return "+ " + + TrLib.getString("La pr\xE9cision permet de prendre en compte les impr\xE9cisions num\xE9riques.") + + CtuluLibString.LINE_SEP_SIMPLE + + " " + + TrLib + .getString("2 valeurs seront suppos\xE9es \xE9gales si leur diff\xE9rence est inf\xE9rieure \xE0 la pr\xE9cision ci-dessus.") + + CtuluLibString.LINE_SEP_SIMPLE + CtuluLibString.ESPACE + CtuluLibString.LINE_SEP_SIMPLE + "+ " + + TrLib.getString("La case \xE0 cocher permet de cr\xE9er un calque par valeurs sp\xE9cifi\xE9es pr\xE9c\xE9demment."); } return CtuluLibString.EMPTY_STRING; } @@ -303,9 +279,7 @@ } else if (current_ == 1) { return TrLib.getString("Choisir les valeurs des isolignes"); - } else if (current_ == 2) { - return TrLib.getString("Pr\xE9cision et calques"); - } + } else if (current_ == 2) { return TrLib.getString("Pr\xE9cision et calques"); } return CtuluLibString.EMPTY_STRING; } @@ -313,10 +287,35 @@ return TrLib.getString("Rechercher les isolignes"); } + boolean isCurrentValide() { + if (current_ == 0) { + final boolean res = !listTimes_.isSelectionEmpty(); + if (res) { + lbTime_.setText(CtuluLibString.ESPACE); + } else { + lbTime_.setText(TrLib.getString("S\xE9lectionner au moins un pas de temps")); + } + return res; + } + return true; + } + public void nextStep() { if (isCurrentValide()) { super.nextStep(); } } + void varChanged() { + // on sauvegarde les anciennes valeurs + varIsoValues_.put(currentVariable_, values_.getValuesInList()); + currentVariable_ = (CtuluVariable) cbVariables_.getSelectedItem(); + final List saved = varIsoValues_.get(currentVariable_); + if (saved == null) { + values_.updateOrCreateValues(); + } else { + values_.setData(saved); + } + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizardListValue.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizardListValue.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLineWizardListValue.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -39,7 +39,7 @@ try { final int idx = support_.listTimes_.getSelectedIndex(); if (idx >= 0) { - currentData_ = support_.project_.getSource().getData(support_.currentVariable_, idx); + currentData_ = support_.getSource().getData(support_.currentVariable_, idx); } } catch (final IOException _evt) { FuLog.error(_evt); @@ -80,9 +80,7 @@ } public void initFor(final EfData _data, final List _l) { - if (_data == null || _l == null) { - return; - } + if (_data == null || _l == null) { return; } _l.clear(); final NumberIterator it = new NumberIterator(); it.init(_data.getMin(), _data.getMax(), 10); @@ -99,7 +97,7 @@ final CtuluVariable var = (CtuluVariable) support_.cbVariables_.getModel().getSelectedItem(); if (idx >= 0 && var != null) { try { - currentData_ = support_.project_.getSource().getData(var, idx); + currentData_ = support_.getSource().getData(var, idx); if (currentData_ != null) { initFor(currentData_, newValue); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -43,7 +43,6 @@ import org.fudaa.fudaa.tr.common.TrResource; import com.memoire.bu.BuDialogError; -import com.memoire.fu.FuLog; /** * Action qui: - recupere la liste des calques potentiels - recupere la liste des graphes potentiels - propose a l @@ -52,6 +51,7 @@ * * @author Adrien Hadoux */ +@SuppressWarnings("serial") public abstract class TrPostActionAddPointFromWidgetCalque extends EbliWidgetActionSimple { /** @@ -125,10 +125,10 @@ @Override public void executeAction(TrPostCommonImplementation _impl, EGGraphe _graphe, TrPostVisuPanel _calque) { - /** - * @see TrPostWizardProfilSpatiaux.java pour savoir comment fusionenr une - * courbe spatiale dans un graphe existant. methode doTask() - */ + /** + * @see TrPostWizardProfilSpatiaux.java pour savoir comment fusionenr une courbe spatiale dans un graphe existant. + * methode doTask() + */ } @@ -138,9 +138,9 @@ // creation automatique d un graphe avec les spatiales poru le calque // vhoisi - new MvProfileBuilderFromTree(_calqueChoisi.getProjet(), impl_, ((ZCalqueAffichageDonneesInterface) _calqueChoisi - .getArbreCalqueModel().getSelectedCalque()).getSelectedLine(), _calqueChoisi, new MvProfileCoteTester()) - .start(); + new MvProfileBuilderFromTree(TrPostProfileAction.createProfileAdapter(_calqueChoisi), impl_, + ((ZCalqueAffichageDonneesInterface) _calqueChoisi.getArbreCalqueModel().getSelectedCalque()) + .getSelectedLine(), _calqueChoisi, new MvProfileCoteTester()).start(); } @@ -244,10 +244,10 @@ // -- creation d un nouveau graphe --// if (boxCalques_ != null) { - TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); + TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); - // -- methode appelee qui doit creer un graphe avec la selection --// - createNewGraphe(calqueChoisi); + // -- methode appelee qui doit creer un graphe avec la selection --// + createNewGraphe(calqueChoisi); } else { createNewGraphe(listeCalquesPossibles.get(0)); } @@ -257,7 +257,7 @@ } else { rechercheGrapheAndCalque(); - + // -- affichage de al dialog --// constructDialog().setVisible(true); } @@ -318,13 +318,10 @@ * TrResource .getS("Il n'y a pas de graphes disponibles.")).activate(); return; } */ - } public abstract boolean isCorrectGraph(EGGrapheModel _model); - - /** * construit l interface * @@ -332,19 +329,19 @@ */ public JComponent constructInterface(boolean chooserCalque, boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { - + JPanel content = new JPanel(new BorderLayout()); - + if (chooserCalque) { - boxCalques_ = new JComboBox(); - for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { - boxCalques_.addItem(it.next()); + boxCalques_ = new JComboBox(); + for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { + boxCalques_.addItem(it.next()); + } + boxCalques_.setRenderer(new GrapheCellRenderer()); + boxCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Liste des calques de la scene"))); + content.add(boxCalques_, BorderLayout.NORTH); + } - boxCalques_.setRenderer(new GrapheCellRenderer()); - boxCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Liste des calques de la scene"))); - content.add(boxCalques_, BorderLayout.NORTH); - - } jlisteGraphesChoix = new JList(modelGraphesPossibles); jlisteGraphesChoix.setCellRenderer(new GrapheCellRenderer()); @@ -356,16 +353,15 @@ jlisteGraphesSelections.setCellRenderer(new GrapheCellRenderer()); JPanel panelControle = new JPanel(new FlowLayout(FlowLayout.CENTER)); - - + select = new JButton(TrResource.TR.getString("Ajouter"), EbliResource.EBLI.getIcon("crystal22_avancervite")); unselect = new JButton(TrResource.TR.getString("Enlever"), EbliResource.EBLI.getIcon("crystal22_reculervite")); select.addActionListener(this); unselect.addActionListener(this); if (closeDialog) { - quitter = new JButton(TrResource.TR.getString("Quitter"), EbliResource.EBLI.getIcon("crystal_detruire")); - quitter.addActionListener(this); - panelControle.add(quitter); + quitter = new JButton(TrResource.TR.getString("Quitter"), EbliResource.EBLI.getIcon("crystal_detruire")); + quitter.addActionListener(this); + panelControle.add(quitter); } if (canCreate) { creationNewGraphe = new JButton(TrResource.TR.getString("Cr\xE9er un nouveau graphe"), EbliResource.EBLI @@ -393,26 +389,15 @@ box.add(boxButton); box.add(jlisteGraphesSelections); - - content.add(box, BorderLayout.CENTER); - - - - - - - content.add(panelControle, BorderLayout.SOUTH); - + return content; } public JDialog constructDialog() { - - frame_ = new JDialog(); frame_.setContentPane(constructInterface(true, true, true, true)); @@ -425,11 +410,8 @@ return frame_; } - - /** - * Methode qui construit le panel de selection ou creation des graphes pour - * les points du calque selectionnes + * Methode qui construit le panel de selection ou creation des graphes pour les points du calque selectionnes * * @return */ @@ -437,24 +419,22 @@ rechercheGrapheAndCalque(); return constructInterface(true, closeDialog, valideAjoutCourbe, canCreate); } - + public JComponent getInterfacePartielle(boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { rechercheGrapheAndCalque(); - + return constructInterface(false, closeDialog, valideAjoutCourbe, canCreate); } - - + public void setEnabled(boolean enabled) { - if (this.boxCalques_ != null) - this.boxCalques_.setEnabled(enabled); + if (this.boxCalques_ != null) this.boxCalques_.setEnabled(enabled); this.jlisteGraphesChoix.setEnabled(enabled); this.jlisteGraphesSelections.setEnabled(enabled); this.select.setEnabled(enabled); this.unselect.setEnabled(enabled); } - + public abstract void setTitleForFrame(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -3,6 +3,7 @@ import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Set; import org.fudaa.ctulu.CtuluResource; @@ -62,17 +63,14 @@ scene_.refresh(); - String previousDescr = ""; - if (currentNode.getWidget() != null) - previousDescr = currentNode.getWidget().getController().getDescription(); - + if (currentNode.getWidget() != null) previousDescr = currentNode.getWidget().getController().getDescription(); + // -- ajout du node dans la scene destination --// sceneDestination.addNode(currentNode); - if (previousDescr != null) - currentNode.getWidget().getController().setDescription(previousDescr); - + if (previousDescr != null) currentNode.getWidget().getController().setDescription(previousDescr); + // -- rafraichissement de la scene --// sceneDestination.refresh(); @@ -88,17 +86,19 @@ private EbliScene selectionneSceneNode() { TrPostLayoutFille fenetre = null; - if (projet_.listeFillesLayout.size() <= 1) { - fenetre = projet_.getSelectedFilleLayout(); + TrPostCommonImplementation impl = projet_.getImpl(); + List<TrPostLayoutFille> ls = impl.getAllLayoutFille(); + if (ls.size() == 1) { + fenetre = ls.get(0); } else { // recuperation de toutes les noms des frames post du projet --// - String[] listeFillesLayout = formatteFilles(); + String[] listeFillesLayout = TrPostActionDuplicate.formatteFilles(ls); int indiceFilleelect = CtuluLibSwing.chooseValue(listeFillesLayout, projet_.getImpl().getFrame(), TrLib .getString("Dupliquer l'objet"), TrLib.getString("S\xE9lectionnez la fen\xEAtre dans laquelle dupliquer l'objet"), true); if (indiceFilleelect < 0) return null; - fenetre = projet_.listeFillesLayout.get(indiceFilleelect); + fenetre = ls.get(indiceFilleelect); } return fenetre.controller_.getSceneCourante(); // EbliScene dest = null; @@ -126,22 +126,13 @@ } - public String[] formatteFilles() { - String[] noms = new String[projet_.listeFillesLayout.size()]; - int cpt = 0; - for (Iterator<TrPostLayoutFille> it = projet_.listeFillesLayout.iterator(); it.hasNext();) { - noms[cpt++] = it.next().getTitle(); - } - return noms; - } + // public String[] formatteLayout(TrPostLayoutPanelController _controller) { + // String[] noms = new String[_controller.listeScenes_.size()]; + // + // for (int cpt = 0; cpt < _controller.listeScenes_.size(); cpt++) { + // noms[cpt] = "Layout " + (cpt + 1); + // } + // return noms; + // } -// public String[] formatteLayout(TrPostLayoutPanelController _controller) { -// String[] noms = new String[_controller.listeScenes_.size()]; -// -// for (int cpt = 0; cpt < _controller.listeScenes_.size(); cpt++) { -// noms[cpt] = "Layout " + (cpt + 1); -// } -// return noms; -// } - } Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -1,73 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.awt.event.ActionEvent; -import java.util.Iterator; - -import org.fudaa.ebli.commun.EbliActionSimple; - -import com.memoire.bu.BuDialogConfirmation; -import com.memoire.bu.BuDialogMessage; -import com.memoire.bu.BuResource; -import com.memoire.fu.FuLog; - -public class TrPostActionChangeSrc extends EbliActionSimple { - /** - * projet en cours contenant les multi projets. - */ - TrPostProjet projet_; - - /** - * Activator multi source permettant de gerer une nouvelle source pour - * trpostProjet - */ - TrPostMultiSourceActivator multiProjectActivator_; - - public TrPostActionChangeSrc(TrPostProjet _projet) { - super("Changer de donn\xE9es", BuResource.BU.getIcon("crystal_valider"), "Changer de donn\xE9es"); - projet_ = _projet; - - // -- creation de l activator multi-source avec le projet param --// - this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); - } - - public void actionPerformed(ActionEvent e) { - - - // -- recuperation de la source a supprimer --// - - // -- cas rien de selectionnee --// - if (projet_.filleProjetctManager_.listProjets_.getSelectedRow() == -1) { - new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - "Il faut selectionner le fichier dans la liste avant de cliquer.").activate(); - } else { - - // -- recupeation de la source a enlever --// - TrPostSource src = (TrPostSource) projet_.getSource(projet_.filleProjetctManager_.listProjets_.getSelectedRow()); - - // -- demande confirmationa l user --// - int confirmation = new BuDialogConfirmation(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - "\xCAtes-vous sur de vouloir changer les donn\xE9es par celles \n du fichier " + src.getTitle() + " ?") - .activate(); - - if (confirmation == 0) { - if (projet_.changeSource(src)) { - new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - "Les donn\xE9es ont \xE9t\xE9 correctement charg\xE9es.").activate(); - } else { - new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - "Les donn\xE9es n'ont pas \xE9t\xE9 correctement charg\xE9es.").activate(); - } - - testAfficheMesSimu(); - } - } - - } - - public void testAfficheMesSimu() { - int i = 0; - for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { - TrPostSource src = it.next(); - } - } -} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionDuplicate.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionDuplicate.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -1,6 +1,7 @@ package org.fudaa.fudaa.tr.post; import java.util.Iterator; +import java.util.List; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; @@ -9,101 +10,96 @@ import com.memoire.bu.BuDialogChoice; /** - * Refonte de l action duplicate qui g\xE8re le multi-layout. Chooser qui demande - * la fille layout puis autre chooser qui demande l'onglet. Si la fille est - * unique pas de chooser idem pour l onglet de la fille selectionnee. + * Refonte de l action duplicate qui g\xE8re le multi-layout. Chooser qui demande la fille layout puis autre chooser qui + * demande l'onglet. Si la fille est unique pas de chooser idem pour l onglet de la fille selectionnee. * * @author Adrien Hadoux - * */ +@SuppressWarnings("serial") public class TrPostActionDuplicate extends EbliWidgetActionDuplicate { - TrPostProjet projet_; - + public TrPostActionDuplicate(EbliScene _scene, TrPostProjet _projet) { super(_scene); - + projet_ = _projet; } - - -/** - * surcharge de la methode. Envoie de la liste des frame layout + interne - * layout si il y e na plusieurs + /** + * surcharge de la methode. Envoie de la liste des frame layout + interne layout si il y e na plusieurs */ protected EbliScene selectionneSceneNode() { TrPostLayoutFille fenetre = null; EbliScene dest = null; + TrPostCommonImplementation impl = projet_.getImpl(); + List<TrPostLayoutFille> ls = impl.getAllLayoutFille(); - if (projet_.listeFillesLayout.size() <= 1) { - fenetre = projet_.getSelectedFilleLayout(); + if (ls.size() == 1) { + fenetre = ls.get(0); } else { - - - // recuperation de toutes les noms des frames post du projet --// - String[] listeFillesLayout = formatteFilles(); - - BuDialogChoice chooser = new BuDialogChoice(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - TrResource.TR.getS("S\xE9lectionnez"), TrResource.TR - .getS("S\xE9lectionnez la fen\xEAtre dans laquelle dupliquer l'objet "), listeFillesLayout); - int response = chooser.activate(); + // recuperation de toutes les noms des frames post du projet --// + String[] listeFillesLayout = formatteFilles(ls); - if (response == 0) { - int indiceFilleelect = chooser.getSelectedIndex(); - fenetre = projet_.listeFillesLayout.get(indiceFilleelect); + BuDialogChoice chooser = new BuDialogChoice(impl.getApp(), impl.getInformationsSoftware(), TrResource.TR + .getS("S\xE9lectionnez"), TrResource.TR.getS("S\xE9lectionnez la fen\xEAtre dans laquelle dupliquer l'objet "), + listeFillesLayout); + + int response = chooser.activate(); + + if (response == 0) { + int indiceFilleelect = chooser.getSelectedIndex(); + fenetre = ls.get(indiceFilleelect); + } + } - - } - + // -- on recherche si dans la fille selectionne il existe plusieurs sous // layout --// -// if (fenetre.controller_.listeScenes_.size() <= 1) { - dest = fenetre.controller_.getSceneCourante(); -// } else { -// -// // recuperation de toutes les noms des frames post du projet --// -// String[] listeLayout = formatteLayout(fenetre.controller_); -// -// BuDialogChoice chooser = new BuDialogChoice(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), -// TrResource.TR.getS("S\xE9lectionnez"), TrResource.TR.getS("S\xE9lectionnez le layout de la fen\xEAtre") -// + fenetre.getTitle() -// + TrResource.TR.getS(" dans laquelle dupliquer l'objet "), listeLayout); -// -// int response = chooser.activate(); -// -// if (response == 0) { -// int indiceLayoutelect = chooser.getSelectedIndex(); -// dest = fenetre.controller_.getScene(indiceLayoutelect); -// } -// -// -// -// } - - + // if (fenetre.controller_.listeScenes_.size() <= 1) { + dest = fenetre.controller_.getSceneCourante(); + // } else { + // + // // recuperation de toutes les noms des frames post du projet --// + // String[] listeLayout = formatteLayout(fenetre.controller_); + // + // BuDialogChoice chooser = new BuDialogChoice(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + // TrResource.TR.getS("S\xE9lectionnez"), TrResource.TR.getS("S\xE9lectionnez le layout de la fen\xEAtre") + // + fenetre.getTitle() + // + TrResource.TR.getS(" dans laquelle dupliquer l'objet "), listeLayout); + // + // int response = chooser.activate(); + // + // if (response == 0) { + // int indiceLayoutelect = chooser.getSelectedIndex(); + // dest = fenetre.controller_.getScene(indiceLayoutelect); + // } + // + // + // + // } + return dest; } - - public String[] formatteFilles() { - String[] noms = new String[projet_.listeFillesLayout.size()]; - int cpt=0; - for (Iterator<TrPostLayoutFille> it = projet_.listeFillesLayout.iterator(); it.hasNext();) { + + public static String[] formatteFilles(List<TrPostLayoutFille> ls) { + String[] noms = new String[ls.size()]; + int cpt = 0; + for (Iterator<TrPostLayoutFille> it = ls.iterator(); it.hasNext();) { noms[cpt++] = it.next().getTitle(); } return noms; } - -// public String[] formatteLayout(TrPostLayoutPanelController _controller) { -// String[] noms = new String[_controller.listeScenes_.size()]; -// -// for (int cpt = 0; cpt < _controller.listeScenes_.size(); cpt++) { -// noms[cpt] = "Layout " + (cpt + 1); -// } -// return noms; -// } - + + // public String[] formatteLayout(TrPostLayoutPanelController _controller) { + // String[] noms = new String[_controller.listeScenes_.size()]; + // + // for (int cpt = 0; cpt < _controller.listeScenes_.size(); cpt++) { + // noms[cpt] = "Layout " + (cpt + 1); + // } + // return noms; + // } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostAnalyze.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostAnalyze.java 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostAnalyze.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -64,7 +64,7 @@ protected void loadPost(final File _f) { final Map m = new HashMap(); - src_ = TrPostSourceActivator.activeSourceAction(_f, ui_, prefId_, ui_.getMainProgression(), m); + src_ = TrPostSourceBuilder.activeSourceAction(_f, ui_, prefId_, ui_.getMainProgression(), m); ipobo_ = (int[]) m.get("IPOBO"); iparams_ = (int[]) m.get("IPARAMS"); if (src_ == null) { 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 2008-09-26 15:21:04 UTC (rev 3992) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-09-26 22:34:47 UTC (rev 3993) @@ -9,7 +9,11 @@ import java.awt.event.ActionEvent; import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.swing.JInternalFrame; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; @@ -36,6 +40,42 @@ return c_; } + /** + * @return toutes les fenetres de PostLayout + */ + public List<TrPostLayoutFille> getAllLayoutFille() { + JInternalFrame[] allInternalFrames = get... [truncated message content] |
From: <had...@us...> - 2008-09-27 19:07:05
|
Revision: 3995 http://fudaa.svn.sourceforge.net/fudaa/?rev=3995&view=rev Author: hadouxad Date: 2008-09-27 19:06:59 +0000 (Sat, 27 Sep 2008) Log Message: ----------- - Importation des structures scopeS,t et gene idfferenciation des structure en fonction des graphes debut mise en place du lnf substance Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaLookPreferencesPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileFormatManager.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/rubar/TrRubarTarageCourbesManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/lib/asm-all-2.2.2.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/forms-1.2.0.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/laf-plugin-50.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/laf-widget.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/substance-baseline.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/substance-swingx.jar branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeT.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrImportCourbeScopeManager.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/asm-all-2.2.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/forms-1.2.0.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/laf-plugin-50.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/laf-widget.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/substance-baseline.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/substance-swingx.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream 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 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -60,6 +60,14 @@ return listeVariales_.get(_i); } + public List<Double> getListValueForVariable(int i) { + return data_.get(getVariable(i)); + } + + public double getValueOfvariable(int indexVar,int indexValue){ + return getListValueForVariable(indexVar).get(indexValue); + } + public void addValueForVariable(double value, int indexVariable) { data_.get(listeVariales_.get(indexVariable)).add(value); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -41,6 +41,7 @@ import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; import org.fudaa.dodico.telemac.io.ScopeSFileFormat; import org.fudaa.dodico.telemac.io.ScopeStructure; +import org.fudaa.dodico.telemac.io.ScopeTFileFormat; import org.fudaa.dodico.telemac.io.TelemacLiquideFileFormat; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionSimple; @@ -50,6 +51,7 @@ import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.commun.impl.FudaaImportCsvPanel; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import com.memoire.bu.BuFileFilter; import com.memoire.bu.BuResource; @@ -121,6 +123,8 @@ */ void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog); + public boolean isSpatial(); + } public static class ExportAction extends EbliActionSimple { @@ -134,7 +138,7 @@ } public void actionPerformed(final ActionEvent _e) { - EGExporter.startExport(graphe_, impl_, getFileFormatForExport()); + EGExporter.startExport(graphe_, impl_, getFileFormatForExport(graphe_)); } } @@ -158,7 +162,7 @@ } public void actionPerformed(final ActionEvent _e) { - final FileFormat[] ft = getFileFormatForImportEvol(); + final FileFormat[] ft = getFileFormatForImportEvol(target_); Arrays.sort(ft); final BuFileFilter[] filters = FileFormat.createFilters(ft); final CtuluFileChooser fileChooser = FudaaGuiLib.getFileChooser(BuResource.BU.getString("Importer"), filters, @@ -184,7 +188,7 @@ } } - public static FileFormat[] getFileFormatForImportEvol() { + public static FileFormat[] getFileFormatForImportEvol(final FudaaCourbeImporter.Target target) { final ArrayList r = new ArrayList(10); r.add(TelemacLiquideFileFormat.getInstance()); r.add(EvolutionFileFormat.getInstance()); @@ -192,7 +196,11 @@ r.add(CLTransitoireFileFormat.getInstance()); r.add(RubarTARFileFormat.getInstance()); r.add(RubarCLIFileFormat.getInstance()); + if (target != null && target.isSpatial()) r.add(ScopeSFileFormat.getInstance()); + else + if (target != null) + r.add(ScopeTFileFormat.getInstance()); r.add(ScopeGENEFileFormat.getInstance()); final FileFormat[] rf = new FileFormat[r.size()]; @@ -207,14 +215,18 @@ * * @return */ - public static List<CtuluWriter> getFileFormatForExport() { + public static List<CtuluWriter> getFileFormatForExport(EGGraphe graphe) { final ArrayList<CtuluWriter> liste = new ArrayList<CtuluWriter>(10); liste.add(new CtuluTableExcelWriter()); liste.add(new CtuluTableCsvWriter()); // --ajout des formats scope --// + if (graphe.getModel() instanceof MvProfileTreeModel) liste.add(new FudaaWriterScopeS()); + else + liste.add(new FudaaWriterScopeT()); + liste.add(new FudaaWriterScopeGENE()); return liste; } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeT.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeT.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeT.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -0,0 +1,17 @@ +package org.fudaa.fudaa.commun.courbe; + +import org.fudaa.dodico.telemac.io.ScopeTFileFormat; + +public class FudaaWriterScopeT extends FudaaWriterScopeS { + + + ScopeTFileFormat format_; + String extension_ = ".scopT"; + + public FudaaWriterScopeT() { + format_ = ScopeTFileFormat.getInstance(); + filter_ = format_.createFileFilter(); + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaLookPreferencesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaLookPreferencesPanel.java 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaLookPreferencesPanel.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -25,7 +25,20 @@ import org.fudaa.fudaa.tr.common.TrResource; -import com.memoire.bu.*; +import com.memoire.bu.BuAbstractPreferencesPanel; +import com.memoire.bu.BuColorIcon; +import com.memoire.bu.BuComboBox; +import com.memoire.bu.BuCommonInterface; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuOptionItem; +import com.memoire.bu.BuOptionRenderer; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuPreferences; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuTextureIcon; +import com.memoire.bu.BuVerticalLayout; import com.memoire.fu.FuLib; /** @@ -93,6 +106,8 @@ .isEnabled("ASPECT_KUNSTSTOFF"))); optionsStr_.put("ASPECT_LIQUID", new BuOptionItem("Liquid", BuResource.BU.getMenuIcon(aspectStr), options_ .isEnabled("ASPECT_LIQUID"))); + optionsStr_.put("ASPECT_SUBSTANCE", new BuOptionItem("Substance", BuResource.BU.getMenuIcon(aspectStr), options_ + .isEnabled("ASPECT_SUBSTANCE"))); optionsStr_.put("ASPECT_MAC", new BuOptionItem("Mac", BuResource.BU.getMenuIcon(aspectStr), options_ .isEnabled("ASPECT_MAC"))); optionsStr_.put("ASPECT_METAL", new BuOptionItem("Metal", BuResource.BU.getMenuIcon(aspectStr), options_ @@ -153,7 +168,7 @@ // Aspect lbGenAspAspect_ = new BuLabel(getS("Aspect:"), SwingConstants.RIGHT); - items = new BuOptionItem[10]; + items = new BuOptionItem[11]; int i = 0; items[i++] = optionsStr_.get(getAspectDefaut()); // items[ i++]=optionsStr_.get("ASPECT_AMIGA"); @@ -161,6 +176,7 @@ items[i++] = optionsStr_.get("ASPECT_GTK"); // items[ i++]=optionsStr_.get("ASPECT_KUNSTSTOFF"); items[i++] = optionsStr_.get("ASPECT_LIQUID"); + items[i++] = optionsStr_.get("ASPECT_SUBSTANCE"); items[i++] = optionsStr_.get("ASPECT_MAC"); items[i++] = optionsStr_.get("ASPECT_METAL"); items[i++] = optionsStr_.get("ASPECT_MOTIF"); Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -1,51 +0,0 @@ -package org.fudaa.fudaa.tr.common; - -import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.dodico.mesure.EvolutionReguliereInterface; -import org.fudaa.dodico.telemac.io.ScopeStructure; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; -import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; - -/** - * Manager pour gerer l'importation de courbes au format scope. - * - * @author Adrien Hadoux - * - */ -public class TrCourbeSpatialManager implements FudaaCourbeImporter.Target { - - EGGraphe graphe_; - MvProfileTreeModel modelGraphe_; - /** - * indique si la courbe a importer est correcte - */ - private boolean enabled = true; - TrCommonImplementation impl_; - - - public TrCourbeSpatialManager(EGGraphe _graphe, TrCommonImplementation _impl) { - super(); - graphe_ = _graphe; - impl_ = _impl; - if (_graphe.getModel() instanceof MvProfileTreeModel) - modelGraphe_ = (MvProfileTreeModel) _graphe.getModel(); - else - enabled = false; - } - - public void importCourbes(EvolutionReguliereInterface[] _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { - } - - public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { - if (!enabled) { - impl_.error("Le graphe n'est pas compatible. Il ne s'agit pas de profil spatiaux."); - return; - } else { - // blablabli recup de ma structure - - } - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -464,5 +464,10 @@ public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { } + + public boolean isSpatial() { + return false; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileFormatManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileFormatManager.java 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrFileFormatManager.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -13,11 +13,7 @@ import java.util.Map; import java.util.TreeMap; -import com.memoire.bu.BuInformationsSoftware; -import com.memoire.bu.BuMenu; - import org.fudaa.ctulu.fileformat.FileFormat; - import org.fudaa.dodico.dunes.io.DunesFileFormat; import org.fudaa.dodico.h2d.type.H2dFileFormatType; import org.fudaa.dodico.reflux.io.CorEleBthFileFormat; @@ -30,12 +26,14 @@ import org.fudaa.dodico.telemac.TelemacDicoFileFormat; import org.fudaa.dodico.telemac.io.SerafinFileFormat; import org.fudaa.dodico.trigrid.TrigridFileFormat; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.tr.reflux.TrRefluxImplHelper; import org.fudaa.fudaa.tr.rubar.TrRubarImplHelper; import org.fudaa.fudaa.tr.telemac.TrTelemacImplHelper; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuMenu; + /** * @author deniger * @version $Id: TrFileFormatManager.java,v 1.30 2007-06-20 12:23:38 deniger Exp $ @@ -53,7 +51,7 @@ } public static FileFormat getFileFormatImportForId(final String _id) { - final FileFormat[] ftsImport = FudaaCourbeImporter.getFileFormatForImportEvol(); + final FileFormat[] ftsImport = FudaaCourbeImporter.getFileFormatForImportEvol(null); for (int i = ftsImport.length - 1; i >= 0; i--) { if (ftsImport[i].getID().equals(_id)) { return ftsImport[i]; Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrImportCourbeScopeManager.java (from rev 3994, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrImportCourbeScopeManager.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrImportCourbeScopeManager.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -0,0 +1,99 @@ +package org.fudaa.fudaa.tr.common; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.dodico.telemac.io.ScopeStructure; +import org.fudaa.dodico.telemac.io.ScopeStructure.Gene; +import org.fudaa.dodico.telemac.io.ScopeStructure.SorT; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; + +/** + * Manager pour gerer l'importation de courbes au format scope. + * + * @author Adrien Hadoux + * + */ +public class TrImportCourbeScopeManager implements FudaaCourbeImporter.Target { + + EGGraphe graphe_; + MvProfileTreeModel modelGraphe_; + /** + * indique si la courbe a importer est correcte + */ + private boolean enabled = true; + TrCommonImplementation impl_; + + + public TrImportCourbeScopeManager(EGGraphe _graphe, TrCommonImplementation _impl) { + super(); + graphe_ = _graphe; + impl_ = _impl; + // if (_graphe.getModel() instanceof MvProfileTreeModel) + modelGraphe_ = (MvProfileTreeModel) _graphe.getModel(); + // else + // enabled = false; + } + + public void importCourbes(EvolutionReguliereInterface[] _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { + + // do nothing + + + + } + + public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { + // if (!enabled) { + // impl_.error( + // "Le graphe n'est pas compatible. Il ne s'agit pas de profil spatiaux."); + // return; + // } else { + // -- import des courbes dans le graphe --// + + if(_crb instanceof ScopeStructure.SorT) + importCourbesSorT((SorT) _crb, _mng, _prog); + else + importCourbesGENE((Gene) _crb, _mng, _prog); + // } + } + + /** + * Methode d import depuis format scope S ou t + * + * @param _crb + * @param _mng + * @param _prog + */ + public void importCourbesSorT(ScopeStructure.SorT s, CtuluCommandManager _mng, ProgressionInterface _prog) { + + // -- on parcours toutes les variables --// + for (int i = 0; i < s.getNbVariables(); i++) { + + // --on recherche si cette variable n'existe pas deja dans le graphe --// + // graphe_.getModel().get + + } + + + } + + + /** + * Methode d import depusi scope GENE + * + * @param _crb + * @param _mng + * @param _prog + */ + public void importCourbesGENE(ScopeStructure.Gene s, CtuluCommandManager _mng, ProgressionInterface _prog) { + + } + + public boolean isSpatial() { + return graphe_.getModel() instanceof MvProfileTreeModel; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrImportCourbeScopeManager.java ___________________________________________________________________ Added: svn:mergeinfo + 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 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -39,7 +39,7 @@ import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; -import org.fudaa.fudaa.tr.common.TrCourbeSpatialManager; +import org.fudaa.fudaa.tr.common.TrImportCourbeScopeManager; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.netbeans.api.visual.widget.Widget; @@ -563,7 +563,7 @@ listeActions.add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); //--ajout des actions import export format scope --// - listeActions.add(new FudaaCourbeImporter.ImportAction(new TrCourbeSpatialManager(_graphe.getGraphe(), + listeActions.add(new FudaaCourbeImporter.ImportAction(new TrImportCourbeScopeManager(_graphe.getGraphe(), projet_.impl_), projet_.impl_, creator.getGraphe().getCmd())); listeActions.add( new FudaaCourbeImporter.ExportAction(creator.getGraphe(), projet_.impl_)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java 2008-09-27 16:20:25 UTC (rev 3994) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java 2008-09-27 19:06:59 UTC (rev 3995) @@ -152,4 +152,8 @@ public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { } + public boolean isSpatial() { + return false; + } + } \ 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...> - 2008-09-30 19:08:18
|
Revision: 4013 http://fudaa.svn.sourceforge.net/fudaa/?rev=4013&view=rev Author: hadouxad Date: 2008-09-30 19:07:57 +0000 (Tue, 30 Sep 2008) Log Message: ----------- - IHM calculs de cubature - IHM de bilan. Modified Paths: -------------- 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/common/tr_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfDataIntegrale.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBilanAction.java Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfDataIntegrale.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfDataIntegrale.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfDataIntegrale.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -0,0 +1,215 @@ +package org.fudaa.dodico.ef; + +import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; + +/** + * Classe qui gere les bilans ainsi que les cubatures. + * + * @author Adrien Hadoux + * + */ +public class EfDataIntegrale { + + /** + * Valeur pour la zone plus + */ + double zonePlus_ = 0; + + /** + * Valeur int\xE9grale pour la zone moins + */ + double zoneMoins_ = 0; + + + + + public double getZonePlus() { + return zonePlus_; + } + + public double getZoneMoins() { + return zoneMoins_; + } + + /** + * Integration des donnees par la methode des trapezes entre la courbe + * representee par les x et y et la droite d\xE9finie par la fonction affine de + * coeff a et d'ordonn\xE9\xE9e a l origine b y=a*x+b + * + * @param lx + * @param ly + * @return + */ + public static EfDataIntegrale integrerMethodeTrapeze(double[] lx, double[] ly, double a, double b) { + + EfDataIntegrale data = new EfDataIntegrale(); + + for (int i = 0; i < Math.min(lx.length, ly.length)-1; i++) { + double x = lx[i]; + double x2=lx[i+1]; + double y = ly[i]; + double y2 = ly[i+1]; + + double ySeuil1=a*x+b; + double ySeuil2=a*x2+b; + if (y > ySeuil1 && y2 > ySeuil2) { + // courbe au dessus de la ligne + data.zonePlus_ += calculAireTrapeze(x, y, x2, y2, ySeuil1, ySeuil2); + + } else if (y < ySeuil1 && y2 < ySeuil2) { + // courbe en dessous de la ligne + data.zoneMoins_ += calculAireTrapeze(x, y, x2, y2, ySeuil1, ySeuil2); + + } else { + // cas particulier : intersection, on calcule l'intersection entre les + // points + // cas particulier : intersection, on calcule l'intersection entre les + // points + double yIntersect = 0; + double xIntersect = 0; + // on prend la droite form\xE9e par les 2 points et on calcule son + // intersection avec la droite affine + if (x2 - x != 0) { + // droite non parrallele a l axe des abscisses + double coefDirecteur = (y2 - y) / (x2 - x); + double ordoOrigine = y2 - coefDirecteur * x2; + + // intersection de droites avec le seuil + + + if(coefDirecteur - a!=0){ + //droie non paralleles + xIntersect = (ordoOrigine-b) / (coefDirecteur-a); + yIntersect=coefDirecteur*xIntersect+ordoOrigine; + } + else + { + // droite parrallele confondue au seuil, on ne fais rien... + } + + } else { + // x2=x droite d equation x=Cste + + xIntersect = x; + yIntersect = a*x+b; + } + + //maintenant que l on a le point d'intersection, on test si on ajoute en positif ou negatif + if (y >= ySeuil1 && y2 <= ySeuil2) { + data.zonePlus_ += calculAireTrapeze(x, y, xIntersect, yIntersect, ySeuil1, ySeuil2); + data.zoneMoins_ += calculAireTrapeze(xIntersect, yIntersect, x2, y2, ySeuil1, ySeuil2); + + } else { + data.zoneMoins_ += calculAireTrapeze(x, y, xIntersect, yIntersect, ySeuil1, ySeuil2); + data.zonePlus_ += calculAireTrapeze(xIntersect, yIntersect, x2, y2, ySeuil1, ySeuil2); + } + + } + + + } + + + return data; + } + + + + /** + * Calcule l'aire du trapeze en utilisant un objet + * EfLineIntersectionsResultsI. EfLineIntersectionsResultsI fonctionne de la + * maniere suivante: getNbIntersect():donne le nombre de points + * getDistFromDeb(i) donne le Xi: distance entre le debut et le point + * getIntersect(i) getValueBadInterpolation(EfData _d) donne le y associ\xE9 au x + */ + public static EfDataIntegrale integrerMethodeTrapeze(EfLineIntersectionsResultsI interfaceResults, EfData crbdata, + double seuil) { + + EfDataIntegrale data = new EfDataIntegrale(); + + for (int i = 0; i < interfaceResults.getNbIntersect() - 1; i++) { + double x = interfaceResults.getDistFromDeb(i); + double x2 = interfaceResults.getDistFromDeb(i + 1); + double y = interfaceResults.getIntersect(i).getValueBadInterpolation(crbdata); + double y2 = interfaceResults.getIntersect(i + 1).getValueBadInterpolation(crbdata); + + + if (y >= seuil && y2 >= seuil) { + // courbe au dessus de la ligne + data.zonePlus_ += calculAireTrapeze(x, y, x2, y2, seuil, seuil); + } else if (y <= seuil && y2 <= seuil) { + // courbe en dessous de la ligne + data.zoneMoins_ += calculAireTrapeze(x, y, x2, y2, seuil, seuil); + } else { + // cas particulier : intersection, on calcule l'intersection entre les + // points + double yIntersect = 0; + double xIntersect = 0; + // on prend la droite form\xE9e par les 2 points et on calcule son + // intersection avec la droite affine + if (x2 - x != 0) { + // droite non parrallele a l axe des abscisses + double coefDirecteur = (y2 - y) / (x2 - x); + double ordoOrigine = y2 - coefDirecteur * x2; + + // intersection de droites avec le seuil + yIntersect = seuil; + + + if(coefDirecteur!=0) + //droie non parallele au seuil + xIntersect = (yIntersect - ordoOrigine) / coefDirecteur; + else + { + // droite parrallele confondue au seuil, on ne fais rien... + } + + } else { + // x2=x droite perpendiculaire au seuil, le point d'intersection est + // donc (x,seuil) + xIntersect = x; + yIntersect = seuil; + } + + //maintenant que l on a le point d'intersection, on test si on ajoute en positif ou negatif + if (y >= seuil && y2 <= seuil) { + data.zonePlus_ += calculAireTrapeze(x, y, xIntersect, yIntersect, seuil, seuil); + data.zoneMoins_ += calculAireTrapeze(xIntersect, yIntersect, x2, y2, seuil, seuil); + + } else { + data.zoneMoins_ += calculAireTrapeze(x, y, xIntersect, yIntersect, seuil, seuil); + data.zonePlus_ += calculAireTrapeze(xIntersect, yIntersect, x2, y2, seuil, seuil); + } + + } + + } + + return data; + } + + + /** + * calcul de l'aire du trapeze form\xE9 par les 4 points (x,y) (x2,y2) (x,y3) + * (x2,y4) + */ + public static double calculAireTrapeze(double x, double y, double x2, double y2, double y3, double y4) { + double aire = 0; + // 1: calcul de la hauteur + double h = Math.abs(x2 - x); + // 2 base 1: coordonnees cartesiennes entre le point x,y et x,y3 + double base1 = Math.abs(y3 - y); + // 3 base 2: coordonnees cartesiennes entre le point x2,y2 et x2,y4 + double base2 = Math.abs(y4 - y2); + // 4 calcul de l'aire + aire = h * (base1 + base2) / 2; + return aire; +} + + + public double getResultat() { + return zonePlus_ - zoneMoins_; + } + + +} 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 2008-09-30 18:10:23 UTC (rev 4012) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -64,6 +64,8 @@ EfLineIntersectionsResultsBuilder builderNode_; EfLineIntersectionsResultsBuilder builderMesh_; EfLineIntersectionsResultsMng resMesh_; + + final EfLineIntersectionsCorrectionTester tester_; public final MvProfileTarget target_; @@ -98,8 +100,10 @@ } + public EfLineIntersectionsResultsMng getResMesh() { + return resMesh_; + } - public H2dVariableType[] getVariables() { List values = getShownVar(); Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java (from rev 4009, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBilanAction.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -0,0 +1,61 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; + +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.meshviewer.MvResource; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; + +import com.vividsolutions.jts.geom.LineString; + +/** + * Action pour le calcul des bilans. Cette action peut etre executee depuis le + * mode edition du calque pu le mode edition d'un profil spoatial. + * + * @author Adrien Hadoux + * + */ +public class TrPostActionBilan extends EbliActionSimple { + + // final MvProfileTarget src_; + final TrPostVisuPanel panel_; + final MvProfileTreeModel modelGraphe_; + final boolean startWithCalque; + TrPostCommonImplementation impl_; + + public TrPostActionBilan(final TrPostVisuPanel _visu, TrPostCommonImplementation impl) { + super(MvResource.getS("Calcul des bilans"), MvResource.MV.getIcon("profile"), "BILAN"); + panel_ = _visu; + modelGraphe_ = null; + startWithCalque = true; + impl_ = impl; + } + + public TrPostActionBilan(final MvProfileTreeModel _model, TrPostCommonImplementation impl) { + super(MvResource.getS("Calcul des bilans"), MvResource.MV.getIcon("profile"), "BILAN"); + modelGraphe_ = _model; + panel_ = null; + startWithCalque = false; + impl_ = impl; + } + + public void actionPerformed(final ActionEvent _e) { + // -- creation du wizard depusi le calque --// + if (startWithCalque) { + new TrPostDialogBilan(panel_, impl_); + } else { + new TrPostDialogBilan(modelGraphe_, impl_); + } + } + + + protected LineString getSelectedLine() { + // pas de calque s\xE9lectionn\xE9 + if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { + return null; + } + return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + } +} + Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java ___________________________________________________________________ Added: svn:mergeinfo + Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -0,0 +1,59 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; + +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.meshviewer.MvResource; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; + +import com.vividsolutions.jts.geom.LineString; + +/** + * Action de gestion des cubatures + * + * @author Adrien Hadoux + * + */ +public class TrPostActionCubature extends EbliActionSimple { + + // final MvProfileTarget src_; + final TrPostVisuPanel panel_; + final MvProfileTreeModel modelGraphe_; + final boolean startWithCalque; + TrPostCommonImplementation impl_; + + public TrPostActionCubature(final TrPostVisuPanel _visu, TrPostCommonImplementation impl) { + super(MvResource.getS("Calcul des cubatures"), MvResource.MV.getIcon("profile"), "CUBATURE"); + panel_ = _visu; + modelGraphe_ = null; + startWithCalque = true; + impl_ = impl; + } + + public TrPostActionCubature(final MvProfileTreeModel _model, TrPostCommonImplementation impl) { + super(MvResource.getS("Calcul des cubatures"), MvResource.MV.getIcon("profile"), "CUBATURE"); + modelGraphe_ = _model; + panel_ = null; + startWithCalque = false; + impl_ = impl; + } + + public void actionPerformed(final ActionEvent _e) { + // -- creation du wizard depusi le calque --// + if (startWithCalque) { + new TrPostDialogCubature(panel_, impl_); + } else { + new TrPostDialogCubature(modelGraphe_, impl_); + } + } + + + protected LineString getSelectedLine() { + // pas de calque s\xE9lectionn\xE9 + if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { + return null; + } + return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + } +} Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBilanAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBilanAction.java 2008-09-30 18:10:23 UTC (rev 4012) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBilanAction.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -1,61 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.awt.event.ActionEvent; - -import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; -import org.fudaa.ebli.commun.EbliActionSimple; -import org.fudaa.fudaa.meshviewer.MvResource; -import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; - -import com.vividsolutions.jts.geom.LineString; - -/** - * Action pour le calcul des bilans. Cette action peut etre executee depuis le - * mode edition du calque pu le mode edition d'un profil spoatial. - * - * @author Adrien Hadoux - * - */ -public class TrPostBilanAction extends EbliActionSimple { - - // final MvProfileTarget src_; - final TrPostVisuPanel panel_; - final MvProfileTreeModel modelGraphe_; - final boolean startWithCalque; - TrPostCommonImplementation impl_; - - public TrPostBilanAction(final TrPostVisuPanel _visu, TrPostCommonImplementation impl) { - super(MvResource.getS("Calcul des bilans"), MvResource.MV.getIcon("profile"), "BILAN"); - panel_ = _visu; - modelGraphe_ = null; - startWithCalque = true; - impl_ = impl; - } - - public TrPostBilanAction(final MvProfileTreeModel _model, TrPostCommonImplementation impl) { - super(MvResource.getS("Calcul des bilans"), MvResource.MV.getIcon("profile"), "BILAN"); - modelGraphe_ = _model; - panel_ = null; - startWithCalque = false; - impl_ = impl; - } - - public void actionPerformed(final ActionEvent _e) { - // -- creation du wizard depusi le calque --// - if (startWithCalque) { - new TrPostDialogBilan(panel_, impl_); - } else { - new TrPostDialogBilan(modelGraphe_, impl_); - } - } - - - protected LineString getSelectedLine() { - // pas de calque s\xE9lectionn\xE9 - if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { - return null; - } - return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); - } -} - Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-09-30 18:10:23 UTC (rev 4012) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -5,6 +5,7 @@ import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -18,12 +19,27 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTable; import javax.swing.ListModel; import javax.swing.ListSelectionModel; +import javax.swing.table.DefaultTableModel; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; +import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; +import org.fudaa.dodico.ef.operation.EfLineIntersectorActivity; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.common.TrResource; @@ -31,6 +47,7 @@ import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; import com.memoire.bu.BuValueValidator; +import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.LineString; /** @@ -50,14 +67,21 @@ TrPostVisuPanel calque_; MvProfileTreeModel modelGraphe_; TrPostCommonImplementation impl_; + EfDataIntegrale resCalcul_ = new EfDataIntegrale(); // donnees graphiques JDialog dialog_; - // variables + // seuil + private JPanel panelSeuil_; + BuTextField seuil_ = new BuTextField(5); + + // variables et pdt private JPanel panelVariables_; ListModel modelVariables_; JList listVar_; + ListModel modelPdt_; + JList listPdt_; // isolignes private JPanel panelIsolignes_; @@ -71,7 +95,9 @@ // results JPanel panelResults_; JLabel results_; - JButton ajouter = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); + JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); + DefaultTableModel modelResult_; + /** * Constructeur reserv\xE9 au calques * @@ -87,6 +113,7 @@ modelGraphe_ = null; source_ = calque_.getSource(); modelVariables_ = source_.getNewVarListModel(); + modelPdt_ = source_.getNewTimeListModel(); startWithCalque_ = true; // -- construction de la dialog --// @@ -109,7 +136,7 @@ source_ = (TrPostSource) _modelGraphe.target_.getData(); startWithCalque_ = false; modelVariables_ = source_.getNewVarListModel(); - + modelPdt_ = source_.getNewTimeListModel(); // -- construction de la dialog --// buildDialog(); } @@ -170,9 +197,9 @@ textY2.setEnabled(enabled); boxSelectLineManu_.setSelected(false); if (boxSelectLineAuto_.isSelected()) - ajouter.setEnabled(true); + ajouter_.setEnabled(true); else - ajouter.setEnabled(false); + ajouter_.setEnabled(false); } }); @@ -185,9 +212,9 @@ textY2.setEnabled(enabled); boxSelectLineAuto_.setSelected(false); if (boxSelectLineManu_.isSelected()) - ajouter.setEnabled(true); + ajouter_.setEnabled(true); else - ajouter.setEnabled(false); + ajouter_.setEnabled(false); } }); @@ -213,19 +240,112 @@ return content; } + /** + * Methode qui genere une lineString en entrant 2 points. + * + * @return + */ + LineString createLineString() { + double x1 = Double.parseDouble(textX1.getText()); + double y1 = Double.parseDouble(textY1.getText()); + double x2 = Double.parseDouble(textX2.getText()); + double y2 = Double.parseDouble(textY2.getText()); + + + final Coordinate[] cs = new Coordinate[2]; + cs[0] = new Coordinate(x1, y1); + cs[1] = new Coordinate(x2, y2); + + return GISGeometryFactory.INSTANCE.createLineString(cs); + + } + private JPanel buildresults() { - JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel conteneur = new JPanel(new BorderLayout()); + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); + results_ = new JLabel(""); - content.add(ajouter); - content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(ajouter_); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); content.add(results_); - content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); - return content; + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + + // -- action relatives aux resultats --// + ajouter_.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent _e) { + if (controleDataOk()) { + computeResults(); + } + } + + }); + + modelResult_ = new DefaultTableModel() { + public int getColumnCount() { + return 3; + } + public String getColumnName(int _column) { + if (_column == 0) + return "Zone positive"; + else if (_column == 1) + return "Zone n\xE9gative"; + else + return "R\xE9sultat"; + } + public int getRowCount() { + return 1; + } + public boolean isCellEditable(int _row, int _column) { + return false; + } + public Object getValueAt(int _row, int _column) { + if (_column == 0) + return resCalcul_.getZoneMoins(); + else if (_column == 0) + return resCalcul_.getZonePlus(); + else + return resCalcul_.getResultat(); + } + }; + + JTable tableauRes = new JTable(modelResult_); + conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); + conteneur.add(tableauRes, BorderLayout.CENTER); + conteneur.add(content, BorderLayout.SOUTH); + return conteneur; } + + public boolean controleDataOk() { + if (boxSelectLineManu_.isSelected()) { + if (textX1.getText().equals("")) + return false; + if (textX2.getText().equals("")) + return false; + if (textY1.getText().equals("")) + return false; + if (textY2.getText().equals("")) + return false; + + } + + if(seuil_.getText().equals("")) + return false; + if(listVar_.getSelectedIndex()==-1) + return false; + + return true; + } + + /** + * Retourne la ligne selectionnee dans le calque. + * + * @return + */ protected LineString getSelectedLineOfCalque() { // pas de calque s\xE9lectionn\xE9 if (!(calque_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { @@ -234,17 +354,60 @@ return ((ZCalqueAffichageDonneesInterface) calque_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); } + /** + * retourne la variable selectionnee + * + * @return + */ + protected H2dVariableType getSelectedVariable() { + + return (H2dVariableType) modelVariables_.getElementAt(listVar_.getSelectedIndex()); + } + + /** + * retourne l indice du pas de temps. + * + * @return + */ + protected int getSelectedTimeStep() { + return listPdt_.getSelectedIndex(); + } + + + protected double getSeuil() { + return Double.parseDouble(seuil_.getText()); + } + + private JPanel buildVariables() { - JPanel content = new JPanel(new BorderLayout()); + JPanel conteneur = new JPanel(new BorderLayout()); + JPanel content = new JPanel(new GridLayout(1, 2)); listVar_ = new JList(modelVariables_); + listPdt_ = new JList(modelPdt_); listVar_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - content.add(new JScrollPane(listVar_), BorderLayout.CENTER); - content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de la variable"))); - content.add(new JLabel(TrResource.getS("Veuillez s\xE9lectionner la variable sur laquelle appliquer le calcul")), + listPdt_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + content.add(new JScrollPane(listVar_)); + content.add(new JScrollPane(listPdt_)); + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables et pas de temps"))); + conteneur.add(content, BorderLayout.CENTER); + conteneur.add(new JLabel(TrResource + .getS("Veuillez s\xE9lectionner la variable et pas de temps")), BorderLayout.NORTH); return content; } + + private JPanel buildSeuil(){ + seuil_.setCharValidator(BuCharValidator.FLOAT); + seuil_.setStringValidator(BuStringValidator.FLOAT); + seuil_.setValueValidator(BuValueValidator.FLOAT); + + JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); + conteneur.add( seuil_); + + return conteneur; + } /** * Creation du panel graphique. @@ -265,6 +428,12 @@ panelVariables_ = buildVariables(); content.add(panelVariables_); + + // -- panelSeuil + if (panelSeuil_ == null) + panelSeuil_ = buildSeuil(); + content.add(panelSeuil_); + // -- panel des resultats --// if (panelResults_ == null) panelResults_ = buildresults(); @@ -315,5 +484,53 @@ return TrResource.getS("Bilans"); } + + /** + * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es + */ + private void computeResults() { + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan") + CtuluLibString.ESPACE + + EvolutionFileFormat.getInstance().getName()) { + public void act() { + final ProgressionInterface prog = getMainStateReceiver(); + // -- calcul de la EfLineIntersectionsResultsMng --// + impl_.setMainMessage(FudaaLib.getS("Calcul des intersections")); + impl_.setMainProgression(10); + EfLineIntersectionsResultsMng lineRes = null; + if (startWithCalque_) { + EfLineIntersectorActivity lineIntersect = new EfLineIntersectorActivity(calque_.getSource()); + if (boxSelectLineAuto_.isSelected()) + lineRes = lineIntersect.computeForMeshes(getSelectedLineOfCalque(), prog); + else + lineRes = lineIntersect.computeForMeshes(createLineString(), prog); + } else { + lineRes = modelGraphe_.getResMesh(); + } + EfLineIntersectionsResultsI interfaceRes = lineRes.getDefaultRes(); + + // -- calcul des efdata --// + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Calcul des donn\xE9es pour les pas de temps et variables r\xE9cup\xE9r\xE9s")); + EfData data = source_.getData(getSelectedVariable(), getSelectedTimeStep()); + + + + // -- calcul de l'int\xE9grale --// + impl_.setMainProgression(70); + impl_.setMainMessage(CtuluLib.getS("Calcul de l'int\xE9grale")); + + resCalcul_ = EfDataIntegrale.integrerMethodeTrapeze(interfaceRes, data, getSeuil()); + + // -- mise a jour du tableau de res --// + modelGraphe_.fireStructureChanged(); + + + impl_.unsetMainMessage(); + impl_.unsetMainProgression(); + } + }.start(); + } + + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -0,0 +1,288 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import javax.swing.AbstractAction; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.ListModel; +import javax.swing.ListSelectionModel; + +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.mesure.EvolutionFileFormat; +import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; +import org.fudaa.fudaa.tr.common.TrResource; + +public class TrPostDialogCubature { + + /** + * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque + */ + + private boolean startWithCalque_ = true; + TrPostSource source_; + TrPostVisuPanel calque_; + MvProfileTreeModel modelGraphe_; + TrPostCommonImplementation impl_; + EfDataIntegrale resCalcul_ = new EfDataIntegrale(); + + // donnees graphiques + JDialog dialog_; + + // variables et pdt + private JPanel panelVariables_; + ListModel modelVariables_; + JList listVar_; + ListModel modelPdt_; + JList listPdt_; + + // isolignes + private JPanel panelIsolignes_; + JTree treeLignes_; + CalqueFindCourbeTreeModel lineTreeModel_; + + // results + JPanel panelResults_; + JLabel results_; + JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); + + /** + * Constructeur reserv\xE9 au calques + * + * @param _builderParams + * @param _calque + * @param _modelGraphe + * @param _panelVariables + * @param _source + */ + public TrPostDialogCubature(TrPostVisuPanel _calque, TrPostCommonImplementation impl) { + impl_ = impl; + calque_ = _calque; + modelGraphe_ = null; + source_ = calque_.getSource(); + modelVariables_ = source_.getNewVarListModel(); + modelPdt_ = source_.getNewTimeListModel(); + startWithCalque_ = true; + lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _calque.getDonneesCalque()); + // -- construction de la dialog --// + buildDialog(); + } + + /** + * constructeur reserv\xE9 aux graphes spatiaux + * + * @param _builderParams + * @param _calque + * @param _modelGraphe + * @param _panelVariables + * @param _source + */ + public TrPostDialogCubature(MvProfileTreeModel _modelGraphe, TrPostCommonImplementation impl) { + calque_ = null; + impl_ = impl; + modelGraphe_ = _modelGraphe; + source_ = (TrPostSource) _modelGraphe.target_.getData(); + startWithCalque_ = false; + modelVariables_ = source_.getNewVarListModel(); + modelPdt_ = source_.getNewTimeListModel(); + // -- construction de la dialog --// + buildDialog(); + } + + + protected JTree buildTree() { + return CalqueFindCourbeTreeModel.createCalqueTree(lineTreeModel_, true); + } + /** + * Construit le panel des variables + * + * @return + */ + private JPanel buildIsoLignes() { + JPanel content = new JPanel(new BorderLayout()); + treeLignes_ = buildTree(); + content.add(treeLignes_, BorderLayout.CENTER); + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de la ligne bris\xE9e du calque"))); + return content; + } + + + private JPanel buildresults() { + JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT)); + + results_ = new JLabel(""); + content.add(ajouter_); + content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(results_); + + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + + // -- action relatives aux resultats --// + ajouter_.setAction(new AbstractAction() { + + public void actionPerformed(ActionEvent _e) { + if (controleDataOk()) { + computeResults(); + } + } + + }); + + return content; + } + + public boolean controleDataOk() { + + if (listVar_.getSelectedIndex() == -1) + return false; + if (treeLignes_.getSelectionCount() == 0) + return false; + return true; + } + + + + /** + * retourne la variable selectionnee + * + * @return + */ + protected H2dVariableType getSelectedVariable() { + + return (H2dVariableType) modelVariables_.getElementAt(listVar_.getSelectedIndex()); + } + + /** + * retourne l indice du pas de temps. + * + * @return + */ + protected int getSelectedTimeStep() { + return listPdt_.getSelectedIndex(); + } + + private JPanel buildVariables() { + JPanel conteneur = new JPanel(new BorderLayout()); + JPanel content = new JPanel(new GridLayout(1, 2)); + listVar_ = new JList(modelVariables_); + listPdt_ = new JList(modelPdt_); + listVar_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listPdt_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + content.add(new JScrollPane(listVar_)); + content.add(new JScrollPane(listPdt_)); + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables et pas de temps"))); + conteneur.add(content, BorderLayout.CENTER); + conteneur.add(new JLabel(TrResource.getS("Veuillez s\xE9lectionner la variable et pas de temps")), BorderLayout.NORTH); + return content; + } + + /** + * Creation du panel graphique. + * + * @return + */ + public Box buildContent() { + + Box content = Box.createVerticalBox(); + + // -- panel des isolignes --// + if (panelIsolignes_ == null) + panelIsolignes_ = buildIsoLignes(); + content.add(panelIsolignes_); + + // -- panel des variables --// + if (panelVariables_ == null) + panelVariables_ = buildVariables(); + content.add(panelVariables_); + + // -- panel des resultats --// + if (panelResults_ == null) + panelResults_ = buildresults(); + content.add(panelResults_); + + return content; + } + + public void buildDialog() { + + // CtuluUIDialog ui_ = new + // CtuluUIDialog(listeWidgetCalque_.get(0).getCalqueController + // ().getVisuPanel()); + + final Frame f = CtuluLibSwing.getFrameAncestorHelper(impl_.getCurrentInternalFrame()); + dialog_ = new JDialog(f); + + dialog_.addWindowListener(new WindowAdapter() { + public void windowClosed(WindowEvent _e) { + // on desactive l action de suivi sur le graphe + dialog_ = null; + } + + public void windowClosing(WindowEvent _e) { + dialog_ = null; + } + }); + + dialog_.setModal(true); + dialog_.pack(); + dialog_.setTitle(getTitle()); + JPanel container = new JPanel(new BorderLayout()); + container.add(buildContent(), BorderLayout.CENTER); + container.add(new JLabel("<html> <body><b><center>" + getTitle() + "</center></b> </body></html>"), + BorderLayout.NORTH); + dialog_.setContentPane(container); + dialog_.setSize(400, 450); + dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(impl_.getCurrentInternalFrame())); + dialog_.setVisible(true); + + } + + public String getTitle() { + return TrResource.getS("Bilans"); + + } + + /** + * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es + */ + private void computeResults() { + + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan") + CtuluLibString.ESPACE + + EvolutionFileFormat.getInstance().getName()) { + public void act() { + final ProgressionInterface prog = getMainStateReceiver(); + + + // a faire + + + impl_.unsetMainMessage(); + impl_.unsetMainProgression(); + } + }.start(); + } + + +} + 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 2008-09-30 18:10:23 UTC (rev 4012) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-30 19:07:57 UTC (rev 4013) @@ -570,7 +570,9 @@ if (_graphe.getGraphe().getModel() instanceof MvProfileTreeModel) { listeActions - .add(new TrPostBilanAction(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_.getImpl())); + .add(new TrPostActionBilan(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_.getImpl())); + listeActions.add(new TrPostActionCubature(((MvProfileTreeModel) _graphe.getGraphe().getModel()), projet_ + .getImpl())); } //--ajout des actions import export format scope --// @@ -601,8 +603,10 @@ // -- ajout des actions tr --// final ArrayList<EbliActionSimple> listeActions = new ArrayList<EbliActionSimple>(); - listeActions.add(new TrPostBilanAction((TrPostVisuPanel) creator.getCalque(), projet_.getImpl())); + listeActions.add(new TrPostActionBilan((TrPostVisuPanel) creator.getCalque(), projet_.getImpl())); _controller.addFonctionsSpecific(listeActions); + listeActions.add(new TrPostActionCubature((TrPostVisuPanel) creator.getCalque(), projet_.getImpl())); + _controller.addFonctionsSpecific(listeActions); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-10-01 21:14:35
|
Revision: 4022 http://fudaa.svn.sourceforge.net/fudaa/?rev=4022&view=rev Author: deniger Date: 2008-10-01 21:14:21 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.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/TrPostDialogBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -84,23 +84,35 @@ public static final EfLineIntersection[] NO_DATA = new EfLineIntersection[0]; + protected static double[] computeDist(EfLineIntersectionsResultsI _res) { + final double[] dist = new double[_res.getNbIntersect()]; + for (int i = 1; i < dist.length; i++) { + EfLineIntersection i1 = _res.getIntersect(i - 1); + EfLineIntersection i2 = _res.getIntersect(i); + double distance = CtuluLibGeometrie.getDistance(i1.getX(), i1.getY(), i2.getX(), i2.getY()); + if (distance <= 0) { + System.err.println("erreur!"); + } + dist[i] = dist[i - 1] + distance; + } + return dist; + } + final EfLineIntersection[] datas_; + EfLineIntersectionsResultsI defaultRes_; double[] dist_; + final boolean forMesh_; - final EfGridDataInterpolator grid_; final LineString initLine_; + final boolean isInit_; final BitSet isOut_; + boolean isOutRemoved_; - final boolean isInit_; EfNeighborMesh neighbor_; - public EfLineIntersectionsResultsBuilder createBuilder(EfLineIntersectionsCorrectionTester _tester) { - return new EfLineIntersectionsResultsBuilder(getDefaultRes(), _tester); - } - EfLineIntersectionsResultsMng(final EfGridDataInterpolator _grid, final EfLineIntersection[] _dataPerSeg, final BitSet _isOut, final LineString _string, final boolean _forMesh) { super(); @@ -128,28 +140,34 @@ } - protected static double[] computeDist(EfLineIntersectionsResultsI _res) { - final double[] dist = new double[_res.getNbIntersect()]; - for (int i = 1; i < dist.length; i++) { - EfLineIntersection i1 = _res.getIntersect(i - 1); - EfLineIntersection i2 = _res.getIntersect(i); - double distance = CtuluLibGeometrie.getDistance(i1.getX(), i1.getY(), i2.getX(), i2.getY()); - if (distance <= 0) { - System.err.println("erreur!"); - } - dist[i] = dist[i - 1] + distance; - } - return dist; + public void buildNeighbor(final ProgressionInterface _prog) { + neighbor_ = EfNeighborMesh.compute(grid_.getGridData().getGrid(), _prog); } - private void initSeg() { - for (int i = datas_.length - 1; i >= 0; i--) { - datas_[i].setParent(this); + public EfLineIntersectionsResultsBuilder createBuilder(EfLineIntersectionsCorrectionTester _tester) { + return new EfLineIntersectionsResultsBuilder(getDefaultRes(), _tester); + } + + public EfLineIntersectionsResultsMng extract(final int _i1, final int _i2) { + final int nb = _i2 - _i1 + 1; + // on ne fait pas car c'est pas normal. + if (nb <= 1 || nb == datas_.length || datas_.length <= 2) { + return this; } + final EfLineIntersection[] newRes = new EfLineIntersection[nb]; + final BitSet out = new BitSet(nb - 1); + for (int i = _i1; i <= _i2; i++) { + final int j = i - _i1; + newRes[j] = datas_[i]; + out.set(j, isOut_.get(i)); + } + return new EfLineIntersectionsResultsMng(this, newRes, out, isOutRemoved_); + } - public void buildNeighbor(final ProgressionInterface _prog) { - neighbor_ = EfNeighborMesh.compute(grid_.getGridData().getGrid(), _prog); + public EfLineIntersectionsResultsI getDefaultRes() { + if (defaultRes_ == null) defaultRes_ = new EfLineIntersectionsResultsDefault(this); + return defaultRes_; } public double getFoundDistFromDeb(final int _idxInter) { @@ -159,10 +177,6 @@ return dist_[_idxInter]; } - public EfGridInterface getGrid() { - return grid_.getGridData().getGrid(); - } - public EfLineIntersection getFoundIntersect(final int _i) { return datas_[_i]; } @@ -171,10 +185,44 @@ return datas_ == null ? 0 : datas_.length; } + public EfGridInterface getGrid() { + return grid_.getGridData().getGrid(); + } + + public EfGridDataInterpolator getGridData() { + return grid_; + } + + /** + * @return the initLine la ligne utilisee pour construire les intersections. + */ + public LineString getInitLine() { + return initLine_; + } + public EfNeighborMesh getNeighbor() { return neighbor_; } + private void initSeg() { + for (int i = datas_.length - 1; i >= 0; i--) { + datas_[i].setParent(this); + } + } + + public EfLineIntersectionsResultsMng inversion() { + final EfLineIntersection[] newInter = new EfLineIntersection[datas_.length]; + int n = datas_.length - 1; + final BitSet newOut = new BitSet(n); + for (int i = n; i >= 0; i--) { + newInter[i] = datas_[n - i]; + newOut.set(i, isOut_.get(n - i)); + } + final EfLineIntersectionsResultsMng res = new EfLineIntersectionsResultsMng(this, newInter, newOut, true); + return res; + + } + public boolean isAllOut() { for (int i = getFoundNbIntersect() - 1; i >= 0; i--) { if (getFoundIntersect(i).isRealIntersection()) { @@ -188,13 +236,18 @@ return getFoundNbIntersect() == 0 || isAllOut(); } - EfLineIntersectionsResultsI defaultRes_; + public boolean isForMesh() { + return forMesh_; + } - public EfLineIntersectionsResultsI getDefaultRes() { - if (defaultRes_ == null) defaultRes_ = new EfLineIntersectionsResultsDefault(this); - return defaultRes_; + public boolean isInit() { + return isInit_; } + public boolean isOutRemoved() { + return isOutRemoved_; + } + public boolean isSegmentIn(final int _idxInters) { return !isSegmentOut(_idxInters); } @@ -203,43 +256,6 @@ return isOut_.get(_idxInters); } - public EfLineIntersectionsResultsMng restoreInit(final ProgressionInterface _prog) { - if (isInit_) { - return this; - } - return new EfLineIntersectorActivity(grid_).computeFor(initLine_, _prog, forMesh_); - } - - public EfLineIntersectionsResultsMng extract(final int _i1, final int _i2) { - final int nb = _i2 - _i1 + 1; - // on ne fait pas car c'est pas normal. - if (nb <= 1 || nb == datas_.length || datas_.length <= 2) { - return this; - } - final EfLineIntersection[] newRes = new EfLineIntersection[nb]; - final BitSet out = new BitSet(nb - 1); - for (int i = _i1; i <= _i2; i++) { - final int j = i - _i1; - newRes[j] = datas_[i]; - out.set(j, isOut_.get(i)); - } - return new EfLineIntersectionsResultsMng(this, newRes, out, isOutRemoved_); - - } - - public EfLineIntersectionsResultsMng inversion() { - final EfLineIntersection[] newInter = new EfLineIntersection[datas_.length]; - int n = datas_.length - 1; - final BitSet newOut = new BitSet(n); - for (int i = n; i >= 0; i--) { - newInter[i] = datas_[n - i]; - newOut.set(i, isOut_.get(n - i)); - } - final EfLineIntersectionsResultsMng res = new EfLineIntersectionsResultsMng(this, newInter, newOut, true); - return res; - - } - public EfLineIntersectionsResultsMng removeExt() { if (isOutRemoved_) { return this; @@ -264,20 +280,11 @@ } - public boolean isInit() { - return isInit_; + public EfLineIntersectionsResultsMng restoreInit(final ProgressionInterface _prog) { + if (isInit_) { + return this; + } + return new EfLineIntersectorActivity(grid_).computeFor(initLine_, _prog, forMesh_); } - public boolean isOutRemoved() { - return isOutRemoved_; - } - - public boolean isForMesh() { - return forMesh_; - } - - public EfGridDataInterpolator getGridData() { - return grid_; - } - } 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 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -91,6 +91,8 @@ //choix donnees S et T BuTextField plageDeb_=new BuTextField(5); BuTextField plageFin_=new BuTextField(5); + double xMin; + double xMax; JList listVariables_; @@ -145,13 +147,11 @@ @Override public int getStepCount() { - // TODO Auto-generated method stub return 2; } @Override public String getStepText() { - // TODO Auto-generated method stub return null; } @@ -292,7 +292,6 @@ * Construit le panel de choix des donn\xE9es a importer pour les formats s et t * @return */ - double Xmin,Xmax; JPanel buildPanelScopeSorT(){ JPanel content=new JPanel(new BorderLayout()); @@ -315,17 +314,17 @@ plageFin_.setValueValidator(BuValueValidator.FLOAT); //-- on init les plages --// - Xmin=dataST().getXMin(); - plageDeb_.setText(""+Xmin); - Xmax=dataST().getXMax(); - plageFin_.setText(""+Xmax); + 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_); plages.add(new JLabel("-")); plages.add(plageFin_); - plages.add(new JLabel("(Min: "+Xmin+", Max: "+Xmax+")")); + plages.add(new JLabel("(Min: "+xMin+", Max: "+xMax+")")); content.add(plages,BorderLayout.SOUTH); return content; @@ -381,7 +380,7 @@ //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) + if(valDeb<xMin || xMax<valFin) r |= BuButtonPanel.TERMINER; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -32,6 +32,7 @@ import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsBuilder; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; import org.fudaa.dodico.ef.operation.EfLineIntersectorActivity; @@ -40,6 +41,7 @@ import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCoteTester; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.common.TrResource; @@ -54,35 +56,34 @@ * Wizard pour gerer les bilans des courbes. * * @author Adrien Hadoux - * */ public class TrPostDialogBilan { /** * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque */ - + private boolean startWithCalque_ = true; TrPostSource source_; TrPostVisuPanel calque_; MvProfileTreeModel modelGraphe_; TrPostCommonImplementation impl_; EfDataIntegrale resCalcul_ = new EfDataIntegrale(); - + // donnees graphiques JDialog dialog_; - + // seuil private JPanel panelSeuil_; BuTextField seuil_ = new BuTextField(5); - + // variables et pdt private JPanel panelVariables_; ListModel modelVariables_; JList listVar_; ListModel modelPdt_; JList listPdt_; - + // isolignes private JPanel panelIsolignes_; JCheckBox boxSelectLineAuto_ = new JCheckBox(TrResource.getS("Choisir l'isoligne du calque")); @@ -91,13 +92,13 @@ BuTextField textX2 = new BuTextField(10); BuTextField textY1 = new BuTextField(10); BuTextField textY2 = new BuTextField(10); - + // results JPanel panelResults_; JLabel results_; JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); DefaultTableModel modelResult_; - + /** * Constructeur reserv\xE9 au calques * @@ -115,7 +116,7 @@ modelVariables_ = source_.getNewVarListModel(); modelPdt_ = source_.getNewTimeListModel(); startWithCalque_ = true; - + // -- construction de la dialog --// buildDialog(); } @@ -140,21 +141,21 @@ // -- construction de la dialog --// buildDialog(); } - + /** * Construit le panel des variables * * @return */ private JPanel buildIsoLignes() { - JPanel content=new JPanel(new BorderLayout()); + JPanel content = new JPanel(new BorderLayout()); JPanel panelChek = new JPanel(new FlowLayout(FlowLayout.CENTER)); panelChek.add(new JLabel(TrResource.getS("Choisir l'isoligne du calque"))); panelChek.add(boxSelectLineAuto_); panelChek.add(new JLabel(TrResource.getS("Cr\xE9er manuellement l'isoligne"))); panelChek.add(boxSelectLineManu_); content.add(panelChek, BorderLayout.NORTH); - + JPanel center = new JPanel(new GridLayout(2, 1)); JPanel center1 = new JPanel(new FlowLayout(FlowLayout.CENTER)); center1.add(new JLabel("Point 1 X:")); @@ -170,7 +171,7 @@ center.add(center2); content.add(center, BorderLayout.CENTER); content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de l'isoligne"))); - + // -- init et gestion des evenements --// textX1.setCharValidator(BuCharValidator.FLOAT); textX1.setStringValidator(BuStringValidator.FLOAT); @@ -187,7 +188,7 @@ textY2.setCharValidator(BuCharValidator.FLOAT); textY2.setStringValidator(BuStringValidator.FLOAT); textY2.setValueValidator(BuValueValidator.FLOAT); - + boxSelectLineAuto_.setAction(new AbstractAction() { public void actionPerformed(ActionEvent _e) { boolean enabled = false; @@ -196,10 +197,8 @@ textY1.setEnabled(enabled); textY2.setEnabled(enabled); boxSelectLineManu_.setSelected(false); - if (boxSelectLineAuto_.isSelected()) - ajouter_.setEnabled(true); - else - ajouter_.setEnabled(false); + if (boxSelectLineAuto_.isSelected()) ajouter_.setEnabled(true); + else ajouter_.setEnabled(false); } }); @@ -211,14 +210,12 @@ textY1.setEnabled(enabled); textY2.setEnabled(enabled); boxSelectLineAuto_.setSelected(false); - if (boxSelectLineManu_.isSelected()) - ajouter_.setEnabled(true); - else - ajouter_.setEnabled(false); + if (boxSelectLineManu_.isSelected()) ajouter_.setEnabled(true); + else ajouter_.setEnabled(false); } }); - + // -- test si une ligne a ete au prealable selectionnee par l user sur le // calque --// if (calque_ != null && getSelectedLineOfCalque() != null) { @@ -229,14 +226,14 @@ textY1.setEnabled(enabled); textY2.setEnabled(enabled); boxSelectLineManu_.setSelected(false); - + } else { boxSelectLineAuto_.setSelected(false); boxSelectLineManu_.setSelected(true); // impossible de choisir cetet checkbox boxSelectLineAuto_.setEnabled(false); } - + return content; } @@ -250,29 +247,27 @@ double y1 = Double.parseDouble(textY1.getText()); double x2 = Double.parseDouble(textX2.getText()); double y2 = Double.parseDouble(textY2.getText()); - - + final Coordinate[] cs = new Coordinate[2]; cs[0] = new Coordinate(x1, y1); cs[1] = new Coordinate(x2, y2); - + return GISGeometryFactory.INSTANCE.createLineString(cs); } - - + private JPanel buildresults() { JPanel conteneur = new JPanel(new BorderLayout()); - + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); - + results_ = new JLabel(""); content.add(ajouter_); - // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); content.add(results_); - + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); - + // -- action relatives aux resultats --// ajouter_.addActionListener(new ActionListener() { @@ -283,32 +278,30 @@ } }); - + modelResult_ = new DefaultTableModel() { public int getColumnCount() { return 3; } + public String getColumnName(int _column) { - if (_column == 0) - return "Zone positive"; - else if (_column == 1) - return "Zone n\xE9gative"; - else - return "R\xE9sultat"; + if (_column == 0) return "Zone positive"; + else if (_column == 1) return "Zone n\xE9gative"; + else return "R\xE9sultat"; } + public int getRowCount() { return 1; } + public boolean isCellEditable(int _row, int _column) { return false; } + public Object getValueAt(int _row, int _column) { - if (_column == 1) - return resCalcul_.getZoneMoins(); - else if (_column == 0) - return resCalcul_.getZonePlus(); - else - return resCalcul_.getResultat(); + if (_column == 1) return resCalcul_.getZoneMoins(); + else if (_column == 0) return resCalcul_.getZonePlus(); + else return resCalcul_.getResultat(); } }; @@ -318,43 +311,42 @@ conteneur.add(content, BorderLayout.SOUTH); return conteneur; } - - + public boolean controleDataOk() { if (boxSelectLineManu_.isSelected()) { - if (textX1.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - + if (textX1.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } - if (textX2.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - + if (textX2.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } - if (textY1.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - + if (textY1.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } - if (textY2.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - } + if (textY2.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } } - - if(seuil_.getText().equals("")){ - impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); - return false; - } - if(listVar_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir une variable")); + + if (seuil_.getText().equals("")) { + impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); return false; } - if(listPdt_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + if (listVar_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir une variable")); return false; } + if (listPdt_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + return false; + } return true; } @@ -365,12 +357,10 @@ */ protected LineString getSelectedLineOfCalque() { // pas de calque s\xE9lectionn\xE9 - if (!(calque_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { - return null; - } + if (!(calque_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { return null; } return ((ZCalqueAffichageDonneesInterface) calque_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); } - + /** * retourne la variable selectionnee * @@ -389,13 +379,11 @@ protected int getSelectedTimeStep() { return listPdt_.getSelectedIndex(); } - - + protected double getSeuil() { - return Double.parseDouble(seuil_.getText()); + return Double.parseDouble(seuil_.getText()); } - - + private JPanel buildVariables() { JPanel conteneur = new JPanel(new BorderLayout()); JPanel content = new JPanel(new GridLayout(1, 2)); @@ -409,22 +397,19 @@ content.add(new JScrollPane(listPdt_)); content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables et pas de temps"))); conteneur.add(content, BorderLayout.CENTER); - conteneur.add(new JLabel(TrResource - .getS("Veuillez s\xE9lectionner la variable et pas de temps")), - BorderLayout.NORTH); + conteneur.add(new JLabel(TrResource.getS("Veuillez s\xE9lectionner la variable et pas de temps")), BorderLayout.NORTH); return content; } - - - private JPanel buildSeuil(){ + + private JPanel buildSeuil() { seuil_.setCharValidator(BuCharValidator.FLOAT); seuil_.setStringValidator(BuStringValidator.FLOAT); seuil_.setValueValidator(BuValueValidator.FLOAT); - + JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); - conteneur.add( seuil_); - + conteneur.add(seuil_); + return conteneur; } @@ -436,41 +421,32 @@ public Box buildContent() { Box content = Box.createVerticalBox(); - + // -- panel des isolignes --// - if (panelIsolignes_ == null) - panelIsolignes_ = buildIsoLignes(); + if (panelIsolignes_ == null) panelIsolignes_ = buildIsoLignes(); content.add(panelIsolignes_); - + // -- panel des variables --// - if (panelVariables_ == null) - panelVariables_ = buildVariables(); + if (panelVariables_ == null) panelVariables_ = buildVariables(); content.add(panelVariables_); - - + // -- panelSeuil - if (panelSeuil_ == null) - panelSeuil_ = buildSeuil(); + if (panelSeuil_ == null) panelSeuil_ = buildSeuil(); content.add(panelSeuil_); - + // -- panel des resultats --// - if (panelResults_ == null) - panelResults_ = buildresults(); + if (panelResults_ == null) panelResults_ = buildresults(); content.add(panelResults_); - - - + return content; } - - + public void buildDialog() { - // CtuluUIDialog ui_ = new // CtuluUIDialog(listeWidgetCalque_.get(0).getCalqueController // ().getVisuPanel()); - + final Frame f = CtuluLibSwing.getFrameAncestorHelper(impl_.getCurrentInternalFrame()); dialog_ = new JDialog(f); @@ -503,52 +479,53 @@ return TrResource.getS("Bilans"); } - + /** * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es */ private void computeResults() { - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan") ) { - public void act() { - final ProgressionInterface prog = getMainStateReceiver(); + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan")) { + public void act() { + final ProgressionInterface prog = getMainStateReceiver(); // -- calcul de la EfLineIntersectionsResultsMng --// impl_.setMainMessage(FudaaLib.getS("Calcul des intersections")); impl_.setMainProgression(10); - EfLineIntersectionsResultsMng lineRes = null; - if (startWithCalque_) { - EfLineIntersectorActivity lineIntersect = new EfLineIntersectorActivity(calque_.getSource()); - if (boxSelectLineAuto_.isSelected()) - lineRes = lineIntersect.computeForMeshes(getSelectedLineOfCalque(), prog); - else - lineRes = lineIntersect.computeForMeshes(createLineString(), prog); - } else { - lineRes = modelGraphe_.getResMesh(); - } - EfLineIntersectionsResultsI interfaceRes = lineRes.getDefaultRes(); - + EfLineIntersectionsResultsI interfaceRes = null; + H2dVariableType selectedVariable = getSelectedVariable(); + if (startWithCalque_) { + EfLineIntersectorActivity lineIntersect = new EfLineIntersectorActivity(calque_.getSource()); + LineString lineString = boxSelectLineAuto_.isSelected() ? getSelectedLineOfCalque() : createLineString(); + + interfaceRes = (source_.isElementVar(selectedVariable) ? lineIntersect.computeForMeshes(lineString, prog) + : lineIntersect.computeForNodes(lineString, prog)).getDefaultRes(); + } else { + //TODO a continuer... + interfaceRes = modelGraphe_.getBuilderFor(selectedVariable).getInitRes(); + } + + // le builder permet de corriger les erreurs concernant les cote d'eau / bathymetrie + EfLineIntersectionsResultsBuilder builder = new EfLineIntersectionsResultsBuilder(interfaceRes, + new MvProfileCoteTester()); // -- calcul des efdata --// impl_.setMainProgression(30); impl_.setMainMessage(CtuluLib.getS("Calcul des donn\xE9es pour les pas de temps et variables r\xE9cup\xE9r\xE9s")); - EfData data = source_.getData(getSelectedVariable(), getSelectedTimeStep()); - - - + + EfData data = source_.getData(selectedVariable, getSelectedTimeStep()); + // -- calcul de l'int\xE9grale --// impl_.setMainProgression(70); impl_.setMainMessage(CtuluLib.getS("Calcul de l'int\xE9grale")); - - resCalcul_ = EfDataIntegrale.integrerMethodeTrapeze(interfaceRes, data, getSeuil()); - - // -- mise a jour du tableau de res --// - modelResult_.fireTableDataChanged(); - - - impl_.unsetMainMessage(); - impl_.unsetMainProgression(); - } - }.start(); - } - + resCalcul_ = EfDataIntegrale.integrerMethodeTrapeze(builder.createResults(getSelectedTimeStep(), prog), data, + getSeuil()); + + // -- mise a jour du tableau de res --// + modelResult_.fireTableDataChanged(); + + impl_.unsetMainMessage(); + impl_.unsetMainProgression(); + } + }.start(); + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -40,7 +40,9 @@ import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract.SelectionMode; import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; +import org.fudaa.ebli.commun.EbliSelectionMode; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.layer.MvElementLayer; @@ -77,12 +79,10 @@ ListModel modelPdt_; JList listPdt_; - - //seuil + // seuil private JPanel panelSeuil_; BuTextField seuil_ = new BuTextField(5); - - + // isolignes private JPanel panelIsolignes_; JTree treeLignes_; @@ -93,6 +93,7 @@ JLabel results_; JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); DefaultTableModel modelResult_; + /** * Constructeur reserv\xE9 au calques * @@ -137,10 +138,10 @@ buildDialog(); } - protected JTree buildTree() { return CalqueFindCourbeTreeModel.createCalqueTree(lineTreeModel_, true); } + /** * Construit le panel des variables * @@ -153,101 +154,96 @@ content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de la ligne bris\xE9e du calque"))); return content; } - - private JPanel buildSeuil(){ - seuil_.setCharValidator(BuCharValidator.FLOAT); - seuil_.setStringValidator(BuStringValidator.FLOAT); - seuil_.setValueValidator(BuValueValidator.FLOAT); - - JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); - conteneur.add( seuil_); - - return conteneur; - } + private JPanel buildSeuil() { + seuil_.setCharValidator(BuCharValidator.FLOAT); + seuil_.setStringValidator(BuStringValidator.FLOAT); + seuil_.setValueValidator(BuValueValidator.FLOAT); + + JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); + conteneur.add(seuil_); + + return conteneur; + } + private JPanel buildresults() { - JPanel conteneur = new JPanel(new BorderLayout()); - - JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); - - results_ = new JLabel(""); - content.add(ajouter_); - // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); - content.add(results_); - - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); - - // -- action relatives aux resultats --// - ajouter_.addActionListener(new ActionListener() { + JPanel conteneur = new JPanel(new BorderLayout()); - public void actionPerformed(ActionEvent _e) { - if (controleDataOk()) { - computeResults(); - } - } + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); - }); - - modelResult_ = new DefaultTableModel() { - public int getColumnCount() { - return 3; - } - public String getColumnName(int _column) { - if (_column == 1) - return "Zone positive"; - else if (_column == 0) - return "Zone n\xE9gative"; - else - return "R\xE9sultat"; - } - public int getRowCount() { - return 1; - } - public boolean isCellEditable(int _row, int _column) { - return false; - } - public Object getValueAt(int _row, int _column) { - if (_column == 0) - return resCalcul_.getZoneMoins(); - else if (_column == 1) - return resCalcul_.getZonePlus(); - else - return resCalcul_.getResultat(); - } - }; + results_ = new JLabel(""); + content.add(ajouter_); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(results_); - JTable tableauRes = new JTable(modelResult_); - conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); - conteneur.add(tableauRes, BorderLayout.CENTER); - conteneur.add(content, BorderLayout.SOUTH); - return conteneur; - } + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + // -- action relatives aux resultats --// + ajouter_.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent _e) { + if (controleDataOk()) { + computeResults(); + } + } + + }); + + modelResult_ = new DefaultTableModel() { + public int getColumnCount() { + return 3; + } + + public String getColumnName(int _column) { + if (_column == 1) return "Zone positive"; + else if (_column == 0) return "Zone n\xE9gative"; + else return "R\xE9sultat"; + } + + public int getRowCount() { + return 1; + } + + public boolean isCellEditable(int _row, int _column) { + return false; + } + + public Object getValueAt(int _row, int _column) { + if (_column == 0) return resCalcul_.getZoneMoins(); + else if (_column == 1) return resCalcul_.getZonePlus(); + else return resCalcul_.getResultat(); + } + }; + + JTable tableauRes = new JTable(modelResult_); + conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); + conteneur.add(tableauRes, BorderLayout.CENTER); + conteneur.add(content, BorderLayout.SOUTH); + return conteneur; + } + public boolean controleDataOk() { - - - if (treeLignes_.getSelectionCount() == 0){ - impl_.error(TrResource.getS("Il faut choisir une ligne bris\xE9e")); - return false; - } - if(seuil_.getText().equals("")){ - impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); - return false; - } - if(listVar_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir une variable")); + + if (treeLignes_.getSelectionCount() == 0) { + impl_.error(TrResource.getS("Il faut choisir une ligne bris\xE9e")); return false; } - if(listPdt_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + if (seuil_.getText().equals("")) { + impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); return false; } + if (listVar_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir une variable")); + return false; + } + if (listPdt_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + return false; + } return true; } - - /** * retourne la variable selectionnee * @@ -294,23 +290,19 @@ Box content = Box.createVerticalBox(); // -- panel des isolignes --// - if (panelIsolignes_ == null) - panelIsolignes_ = buildIsoLignes(); + if (panelIsolignes_ == null) panelIsolignes_ = buildIsoLignes(); content.add(panelIsolignes_); // -- panel des variables --// - if (panelVariables_ == null) - panelVariables_ = buildVariables(); + if (panelVariables_ == null) panelVariables_ = buildVariables(); content.add(panelVariables_); // -- panelSeuil - if (panelSeuil_ == null) - panelSeuil_ = buildSeuil(); + if (panelSeuil_ == null) panelSeuil_ = buildSeuil(); content.add(panelSeuil_); - + // -- panel des resultats --// - if (panelResults_ == null) - panelResults_ = buildresults(); + if (panelResults_ == null) panelResults_ = buildresults(); content.add(panelResults_); return content; @@ -357,24 +349,21 @@ /** * Recupere la ligne brisee du tree + * * @return */ public LinearRing getSelectedLineInTree() { - if (treeLignes_.isSelectionEmpty()) { - return null; - } - final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) treeLignes_.getSelectionPath() - .getLastPathComponent(); - final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); - return (LinearRing) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); - } - - + if (treeLignes_.isSelectionEmpty()) { return null; } + final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) treeLignes_ + .getSelectionPath().getLastPathComponent(); + final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); + return (LinearRing) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); + } + protected double getSeuil() { - return Double.parseDouble(seuil_.getText()); - } - - + return Double.parseDouble(seuil_.getText()); + } + /** * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es */ @@ -383,37 +372,44 @@ new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan")) { public void act() { final ProgressionInterface prog = getMainStateReceiver(); - - //-- calcul du ef filter --// + + // -- calcul du ef filter --// impl_.setMainProgression(10); impl_.setMainMessage(CtuluLib.getS("R\xE9cup\xE9ration des lignes bris\xE9es")); EfFilter selectedElt; - MvElementLayer layer=calque_.getGridGroup().getPolygonLayer(); - CtuluListSelection listSelect=layer.selection(getSelectedLineInTree(), 0); - selectedElt=new EfFilterSelectedElement(listSelect,source_.getGrid()); - - + MvElementLayer layer = calque_.getGridGroup().getPolygonLayer(); + CtuluListSelection listSelect = layer.selection(getSelectedLineInTree(), EbliSelectionMode.MODE_ONE);// le mode + // ONE veut + // dire que + // si un + // point du + // polygone + // est + // selectionne, + // le poly + // l'est + selectedElt = new EfFilterSelectedElement(listSelect, source_.getGrid()); + // -- calcul des efdata --// impl_.setMainProgression(30); impl_.setMainMessage(CtuluLib.getS("Calcul des donn\xE9es pour les pas de temps et variables r\xE9cup\xE9r\xE9s")); EfData data = source_.getData(getSelectedVariable(), getSelectedTimeStep()); - // -- calcul de l'int\xE9grale --// + // -- calcul de l'int\xE9grale --// impl_.setMainProgression(70); impl_.setMainMessage(CtuluLib.getS("Calcul de l'int\xE9grale")); - - EfComputeVolumeSeuil compute= EfComputeVolumeSeuil.getVolumeComputer(selectedElt, prog, source_, getSelectedVariable(), getSelectedTimeStep(), getSeuil(), new CtuluAnalyze()); - - resCalcul_ =compute.getVolume(getSelectedTimeStep()); - - // -- mise a jour du tableau de res --// + + EfComputeVolumeSeuil compute = EfComputeVolumeSeuil.getVolumeComputer(selectedElt, prog, source_, + getSelectedVariable(), getSelectedTimeStep(), getSeuil(), new CtuluAnalyze()); + + resCalcul_ = compute.getVolume(getSelectedTimeStep()); + + // -- mise a jour du tableau de res --// modelResult_.fireTableDataChanged(); impl_.unsetMainMessage(); impl_.unsetMainProgression(); } }.start(); } - } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-01 10:02:39
|
Revision: 4015 http://fudaa.svn.sourceforge.net/fudaa/?rev=4015&view=rev Author: hadouxad Date: 2008-10-01 10:02:14 +0000 (Wed, 01 Oct 2008) Log Message: ----------- creation des cubatures, bilan et wizard import scop s,t,gene Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.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/TrPostActionBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfComputeVolumeSeuil.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java Added: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfComputeVolumeSeuil.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfComputeVolumeSeuil.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfComputeVolumeSeuil.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -0,0 +1,201 @@ +package org.fudaa.dodico.ef; + +import gnu.trove.TIntArrayList; +import gnu.trove.TIntObjectHashMap; + +import java.io.IOException; + +import org.fudaa.ctulu.CtuluActivity; +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluVariable; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.ProgressionUpdater; +import org.fudaa.dodico.all.SeuilClient; +import org.fudaa.dodico.commun.DodicoLib; +import org.fudaa.dodico.ef.EfComputeVolume.ForMeshData; +import org.fudaa.dodico.ef.EfComputeVolume.ForNodeData; + +import com.memoire.fu.FuLog; + +/** + * Calcul du volume par rapport a un seuil et non plus 0. + * @author Adrien Hadoux + * + */ +public abstract class EfComputeVolumeSeuil implements CtuluActivity { + + public static class ForMeshData extends EfComputeVolumeSeuil { + + ForMeshData(final EfFilter _filter, final ProgressionInterface _prog, final EfGridData _data, + final CtuluVariable _hVar, final int timestep,final double seuil) { + super(_filter, _prog, _data, _hVar,timestep,seuil); + } + + + EfDataIntegrale computeVolume(final EfGridInterface _grid, final EfData _h) { + EfDataIntegrale resi = new EfDataIntegrale(); + for (int ielt = 0; ielt < _grid.getEltNb(); ielt++) { + if (filter_.isActivatedElt(ielt, _grid, false)) { + + if(_h.getValue(ielt)<=seuil_) + resi.zoneMoins_ += _grid.getAire(ielt) * _h.getValue(ielt); + else + resi.zonePlus_ += _grid.getAire(ielt) * _h.getValue(ielt); + } + } + return resi; + } + } + + public static class ForNodeData extends EfComputeVolumeSeuil { + + ForNodeData(final EfFilter _filter, final ProgressionInterface _prog, final EfGridData _data, + final CtuluVariable _hVar, final int timestep,final double seuil) { + super(_filter, _prog, _data, _hVar,timestep,seuil); + } + + EfDataIntegrale computeVolume(final EfGridInterface _grid, final EfData _h) { + EfDataIntegrale resi = new EfDataIntegrale(); + for (int ipt = 0; ipt < _grid.getPtsNb(); ipt++) { + // le calcul du volume se fait: + // Volume=(surface des elements adjacents)* hauteur au point /3 + if (filter_.isActivated(ipt)) { + // liste des elements adjacents. + final TIntArrayList list = (TIntArrayList) idxPtAdjMes_.get(ipt); + // la liste est nulle: ne devrait jamais arriv\xE9: un point isol\xE9 que faire ? + // pour l'instant on ignore. + if (list != null) { + // s est la surface des elements adjacents. + double s = 0D; + for (int k = 0; k < list.size(); k++) { + s += _grid.getAire(list.getQuick(k)); + } + // la formule qui tue + if(_h.getValue(ipt)<=seuil_) + resi.zoneMoins_ += s * _h.getValue(ipt) / 3D; + else + resi.zonePlus_ += s * _h.getValue(ipt) / 3D; + } + } + } + return resi; + } + + public EfDataIntegrale getVolume(int choosenTimestep) { + computeNeighborMeshes(); + return super.getVolume(choosenTimestep); + } + } + + final EfGridData data_; + final EfFilter filter_; + final CtuluVariable h_; + protected final int timeStep_; + protected final double seuil_; + + /** + * Stocke indice du noeuds -> list element adjacent. Pour les noeuds s\xE9lecionn\xE9s uniquement + */ + TIntObjectHashMap idxPtAdjMes_; + ProgressionInterface prog_; + + boolean stop_; + + public static EfComputeVolumeSeuil getVolumeComputer(final EfFilter _filter, final ProgressionInterface _prog, + final EfGridData _data, final CtuluVariable _hVar, final int timestep,final double seuil, final CtuluAnalyze _analyze) { + if (!_data.isDefined(_hVar)) { + _analyze.addFatalError(DodicoLib.getS("La hauteur d'eau n'est pas d\xE9finie")); + return null; + } + if (_data.isElementVar(_hVar)) { + return new ForMeshData(_filter, _prog, _data, _hVar,timestep,seuil); + } + return new ForNodeData(_filter, _prog, _data, _hVar,timestep,seuil); + + } + + EfComputeVolumeSeuil(final EfFilter _filter, final ProgressionInterface _prog, final EfGridData _data, + final CtuluVariable _hVar, final int timestep,final double seuil) { + super(); + prog_ = _prog; + data_ = _data; + h_ = _hVar; + timeStep_=timestep; + seuil_=seuil; + filter_ = _filter == null ? new EfFilterNone() : _filter; + } + + abstract EfDataIntegrale computeVolume(final EfGridInterface _grid, EfData _h); + + protected void computeNeighborMeshes() { + if (idxPtAdjMes_ != null) { + return; + } + final ProgressionUpdater up = new ProgressionUpdater(prog_); + final EfGridInterface grid = data_.getGrid(); + up.setValue(10, grid.getEltNb()); + up.majProgessionStateOnly(DodicoLib.getS("Recherche des \xE9l\xE9ments voisins")); + idxPtAdjMes_ = new TIntObjectHashMap(grid.getPtsNb()); + for (int i = 0; i < grid.getEltNb(); i++) { + if (stop_) { + idxPtAdjMes_ = null; + return; + } + final EfElement elt = grid.getElement(i); + for (int j = 0; j < elt.getPtNb(); j++) { + final int ptIndex = elt.getPtIndex(j); + // si le noeud est s\xE9lectionne + if (filter_.isActivated(ptIndex)) { + TIntArrayList list = (TIntArrayList) idxPtAdjMes_.get(ptIndex); + // ce noeud n'a pas encore \xE9t\xE9 trait\xE9 + if (list == null) { + list = new TIntArrayList(10); + idxPtAdjMes_.put(ptIndex, list); + } + list.add(i); + + } + } + up.majAvancement(); + } + } + + public EfDataIntegrale getVolume(int choosenTimestep) { + final ProgressionUpdater up = new ProgressionUpdater(prog_); + final EfGridInterface grid = data_.getGrid(); + up.setValue(10, 100); + EfDataIntegrale res ; + up.majProgessionStateOnly(DodicoLib.getS("Calcul du volume")); + + if (stop_) { + return null; + } + EfData h = null; + try { + h = data_.getData(h_, timeStep_); + } catch (final IOException _evt) { + FuLog.error(_evt); + + } + if (h == null) { + return null; + } + res = computeVolume(grid, h); + up.majAvancement(); + + return res; + } + + public ProgressionInterface getProg() { + return prog_; + } + + public void setProg(final ProgressionInterface _prog) { + prog_ = _prog; + } + + public void stop() { + stop_ = true; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -61,7 +61,7 @@ * * @return */ - EvolutionReguliere[] readStructure() { + ScopeStructure.Gene readStructure() { if (super.in_ == null) { analyze_.addError(H2dResource.getS("Flux d'entr\xE9e non trouv\xE9"), 0); @@ -119,7 +119,7 @@ } } catch (EOFException Exc) { - return structure.returnEvolReguliere(); + return structure; } } catch (IOException e) { Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderSorT.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -60,7 +60,7 @@ * * @return */ - EvolutionReguliere[] readStructure() { + ScopeStructure.SorT readStructure() { if (super.in_ == null) { @@ -94,7 +94,7 @@ }catch(EOFException Exc){ - return structure.returnEvolReguliere(); + return structure; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionBilan.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -50,12 +50,6 @@ } - protected LineString getSelectedLine() { - // pas de calque s\xE9lectionn\xE9 - if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { - return null; - } - return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); - } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionCubature.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -49,11 +49,5 @@ } - protected LineString getSelectedLine() { - // pas de calque s\xE9lectionn\xE9 - if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { - return null; - } - return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); - } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -303,7 +303,7 @@ return false; } public Object getValueAt(int _row, int _column) { - if (_column == 0) + if (_column == 1) return resCalcul_.getZoneMoins(); else if (_column == 0) return resCalcul_.getZonePlus(); @@ -322,22 +322,39 @@ public boolean controleDataOk() { if (boxSelectLineManu_.isSelected()) { - if (textX1.getText().equals("")) - return false; - if (textX2.getText().equals("")) - return false; - if (textY1.getText().equals("")) - return false; - if (textY2.getText().equals("")) - return false; + if (textX1.getText().equals("")){ + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } + if (textX2.getText().equals("")){ + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + + } + if (textY1.getText().equals("")){ + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + + } + if (textY2.getText().equals("")){ + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } } - if(seuil_.getText().equals("")) + if(seuil_.getText().equals("")){ + impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); + return false; + } + if(listVar_.getSelectedIndex()==-1){ + impl_.error(TrResource.getS("Il faut choisir une variable")); return false; - if(listVar_.getSelectedIndex()==-1) + } + if(listPdt_.getSelectedIndex()==-1){ + impl_.error(TrResource.getS("Il faut choisir un pas de temps")); return false; - + } return true; } @@ -384,6 +401,8 @@ JPanel content = new JPanel(new GridLayout(1, 2)); listVar_ = new JList(modelVariables_); listPdt_ = new JList(modelPdt_); + listVar_.setSelectedIndex(0); + listPdt_.setSelectedIndex(0); listVar_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listPdt_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); content.add(new JScrollPane(listVar_)); @@ -523,7 +542,7 @@ resCalcul_ = EfDataIntegrale.integrerMethodeTrapeze(interfaceRes, data, getSeuil()); // -- mise a jour du tableau de res --// - modelGraphe_.fireStructureChanged(); + modelResult_.fireTableDataChanged(); impl_.unsetMainMessage(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -5,6 +5,7 @@ import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -17,23 +18,42 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTable; import javax.swing.JTree; import javax.swing.ListModel; import javax.swing.ListSelectionModel; +import javax.swing.table.DefaultTableModel; +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfComputeVolumeSeuil; +import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.ef.EfFilter; +import org.fudaa.dodico.ef.EfFilterSelectedElement; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionFileFormat; +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.layer.MvElementLayer; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuCharValidator; +import com.memoire.bu.BuStringValidator; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuValueValidator; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; + public class TrPostDialogCubature { /** @@ -57,6 +77,12 @@ ListModel modelPdt_; JList listPdt_; + + //seuil + private JPanel panelSeuil_; + BuTextField seuil_ = new BuTextField(5); + + // isolignes private JPanel panelIsolignes_; JTree treeLignes_; @@ -66,7 +92,7 @@ JPanel panelResults_; JLabel results_; JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); - + DefaultTableModel modelResult_; /** * Constructeur reserv\xE9 au calques * @@ -122,42 +148,100 @@ private JPanel buildIsoLignes() { JPanel content = new JPanel(new BorderLayout()); treeLignes_ = buildTree(); - content.add(treeLignes_, BorderLayout.CENTER); + content.add(new JScrollPane(treeLignes_), BorderLayout.CENTER); content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de la ligne bris\xE9e du calque"))); return content; } + + private JPanel buildSeuil(){ + seuil_.setCharValidator(BuCharValidator.FLOAT); + seuil_.setStringValidator(BuStringValidator.FLOAT); + seuil_.setValueValidator(BuValueValidator.FLOAT); + + JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); + conteneur.add( seuil_); + + return conteneur; + } - private JPanel buildresults() { - JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel conteneur = new JPanel(new BorderLayout()); + + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + results_ = new JLabel(""); + content.add(ajouter_); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(results_); + + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + + // -- action relatives aux resultats --// + ajouter_.addActionListener(new ActionListener() { - results_ = new JLabel(""); - content.add(ajouter_); - content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); - content.add(results_); + public void actionPerformed(ActionEvent _e) { + if (controleDataOk()) { + computeResults(); + } + } - content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + }); + + modelResult_ = new DefaultTableModel() { + public int getColumnCount() { + return 3; + } + public String getColumnName(int _column) { + if (_column == 1) + return "Zone positive"; + else if (_column == 0) + return "Zone n\xE9gative"; + else + return "R\xE9sultat"; + } + public int getRowCount() { + return 1; + } + public boolean isCellEditable(int _row, int _column) { + return false; + } + public Object getValueAt(int _row, int _column) { + if (_column == 0) + return resCalcul_.getZoneMoins(); + else if (_column == 1) + return resCalcul_.getZonePlus(); + else + return resCalcul_.getResultat(); + } + }; - // -- action relatives aux resultats --// - ajouter_.setAction(new AbstractAction() { + JTable tableauRes = new JTable(modelResult_); + conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); + conteneur.add(tableauRes, BorderLayout.CENTER); + conteneur.add(content, BorderLayout.SOUTH); + return conteneur; + } - public void actionPerformed(ActionEvent _e) { - if (controleDataOk()) { - computeResults(); - } - } - - }); - - return content; - } - public boolean controleDataOk() { - if (listVar_.getSelectedIndex() == -1) + + if (treeLignes_.getSelectionCount() == 0){ + impl_.error(TrResource.getS("Il faut choisir une ligne bris\xE9e")); + return false; + } + if(seuil_.getText().equals("")){ + impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); + return false; + } + if(listVar_.getSelectedIndex()==-1){ + impl_.error(TrResource.getS("Il faut choisir une variable")); return false; - if (treeLignes_.getSelectionCount() == 0) + } + if(listPdt_.getSelectedIndex()==-1){ + impl_.error(TrResource.getS("Il faut choisir un pas de temps")); return false; + } return true; } @@ -186,7 +270,9 @@ JPanel conteneur = new JPanel(new BorderLayout()); JPanel content = new JPanel(new GridLayout(1, 2)); listVar_ = new JList(modelVariables_); + listVar_.setSelectedIndex(0); listPdt_ = new JList(modelPdt_); + listPdt_.setSelectedIndex(0); listVar_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listPdt_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); content.add(new JScrollPane(listVar_)); @@ -216,6 +302,11 @@ panelVariables_ = buildVariables(); content.add(panelVariables_); + // -- panelSeuil + if (panelSeuil_ == null) + panelSeuil_ = buildSeuil(); + content.add(panelSeuil_); + // -- panel des resultats --// if (panelResults_ == null) panelResults_ = buildresults(); @@ -264,6 +355,26 @@ } /** + * Recupere la ligne brisee du tree + * @return + */ + public LinearRing getSelectedLineInTree() { + if (treeLignes_.isSelectionEmpty()) { + return null; + } + final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) treeLignes_.getSelectionPath() + .getLastPathComponent(); + final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); + return (LinearRing) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); + } + + + protected double getSeuil() { + return Double.parseDouble(seuil_.getText()); + } + + + /** * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es */ private void computeResults() { @@ -273,10 +384,30 @@ public void act() { final ProgressionInterface prog = getMainStateReceiver(); + //-- calcul du ef filter --// + impl_.setMainProgression(10); + impl_.setMainMessage(CtuluLib.getS("R\xE9cup\xE9ration des lignes bris\xE9es")); + EfFilter selectedElt; + MvElementLayer layer=calque_.getGridGroup().getPolygonLayer(); + CtuluListSelection listSelect=layer.selection(getSelectedLineInTree(), 0); + selectedElt=new EfFilterSelectedElement(listSelect,source_.getGrid()); - // a faire + // -- calcul des efdata --// + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Calcul des donn\xE9es pour les pas de temps et variables r\xE9cup\xE9r\xE9s")); + EfData data = source_.getData(getSelectedVariable(), getSelectedTimeStep()); + // -- calcul de l'int\xE9grale --// + impl_.setMainProgression(70); + impl_.setMainMessage(CtuluLib.getS("Calcul de l'int\xE9grale")); + + EfComputeVolumeSeuil compute= EfComputeVolumeSeuil.getVolumeComputer(selectedElt, prog, source_, getSelectedVariable(), getSelectedTimeStep(), getSeuil(), new CtuluAnalyze()); + + resCalcul_ =compute.getVolume(getSelectedTimeStep()); + + // -- mise a jour du tableau de res --// + modelResult_.fireTableDataChanged(); impl_.unsetMainMessage(); impl_.unsetMainProgression(); } 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 2008-10-01 09:20:04 UTC (rev 4014) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -571,8 +571,8 @@ 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 des actions import export format scope --// @@ -604,7 +604,6 @@ final ArrayList<EbliActionSimple> listeActions = new ArrayList<EbliActionSimple>(); listeActions.add(new TrPostActionBilan((TrPostVisuPanel) creator.getCalque(), projet_.getImpl())); - _controller.addFonctionsSpecific(listeActions); listeActions.add(new TrPostActionCubature((TrPostVisuPanel) creator.getCalque(), projet_.getImpl())); _controller.addFonctionsSpecific(listeActions); Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java 2008-10-01 10:02:14 UTC (rev 4015) @@ -0,0 +1,205 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; + +import javax.swing.AbstractAction; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.filechooser.FileFilter; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.fileformat.FileFormat; +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.dodico.mesure.EvolutionFileFormat; +import org.fudaa.dodico.reflux.io.CLTransitoireFileFormat; +import org.fudaa.dodico.reflux.io.CrbFileFormat; +import org.fudaa.dodico.rubar.io.RubarCLIFileFormat; +import org.fudaa.dodico.rubar.io.RubarTARFileFormat; +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.TelemacLiquideFileFormat; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; +import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import org.fudaa.fudaa.commun.impl.FudaaGuiLib; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuButton; +import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuWizardTask; + +/** + * Wizard qui se charge d'importer des courbes au format scope dans le post. + * @author Adrien Hadoux + * + */ +public class TrPostWizardImportScope extends BuWizardTask { + + //donnees haut niveau + FudaaCommonImplementation impl_; + TrPostProjet projet_; + /** + * type de fomat: + * 0 => scops + * 1 =>scopet + * 2=>scopgene + */ + int typeFormat_; + File fileChoosen_=null; + + //choix du fichier + JPanel panelFichier_; + JTextField filePath_=new JTextField(20); + + + public TrPostWizardImportScope(TrPostProjet projet_) { + super(); + this.projet_ = projet_; + impl_=projet_.impl_; + } + + + @Override + public JComponent getStepComponent() { + switch (current_) { + case 0: { + + if(panelFichier_==null) + panelFichier_=buildFilePanel(); + return panelFichier_; + } + case 1: { + + } + + } + + return null; + } + + @Override + public int getStepCount() { + // TODO Auto-generated method stub + return 2; + } + + @Override + public String getStepText() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getStepTitle() { + String r = null; + + switch (current_) { + case 0: + r = TrResource.getS("Choisir le fichier"); + break; + case 1: + r = TrResource.getS("S\xE9lectionner les variables"); + break; + case 2: + r = TrResource.getS("S\xE9lectionner les graphes"); + break; + } + return r; + } + + + JPanel buildFilePanel(){ + JPanel content=new JPanel(new FlowLayout(FlowLayout.CENTER)); + content.add(new JLabel(TrResource.getS("Choisir le fichier:"))); + content.add(filePath_); + BuButton parcourir =new BuButton(TrResource.getS("Parcourir...")); + parcourir.setAction(new AbstractAction(){ + 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; + } + final FileFilter filter = fileChooser.getFileFilter(); + final int i = CtuluLibArray.getIndex(filter, filters); + if (i < 0) { + return; + } + typeFormat_=i; + fileChoosen_=initFile; + importData(); + + } + + }); + content.add(parcourir); + return content; + } + + /** + * 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; + } + + + /** + * Methode iumportante d'importation des datas en fonction du fichier choisi et du type. + */ + private void importData(){ + + switch(typeFormat_){ + + case 0: + //cas s + break; + case 1: + //cas scopT + break; + case 2: + //cas scopGENE + break; + } + + } + + + public String getTaskTitle() { + // TODO Auto-generated method stub + return null; + } + + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-01 16:07:45
|
Revision: 4017 http://fudaa.svn.sourceforge.net/fudaa/?rev=4017&view=rev Author: hadouxad Date: 2008-10-01 16:07:21 +0000 (Wed, 01 Oct 2008) Log Message: ----------- commit partiel Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.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/TrPostDialogBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.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/TrPostWizardImportScope.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java 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 2008-10-01 11:00:40 UTC (rev 4016) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -99,6 +99,23 @@ private void insertX(double x) { getAllX().add(x); } + + public double getXMax(){ + double max=getX(0); + for(int i=1;i<getAllX().size();i++) + if(max<getX(i)) + max=getX(i); + return max; + } + + public double getXMin(){ + double min=getX(0); + for(int i=1;i<getAllX().size();i++) + if(min>getX(i)) + min=getX(i); + return min; + } + /** * Methode qui insert le x dans les variables que si il n'existe pas deja. * @@ -177,6 +194,51 @@ return evolReg; } + + /** + * Methode qui restreint lq structure en ne prenant que les variqbles choisies et la plage de x. + * @param selectedVariables + * @param xMin + * @param xMax + */ + public void restreindreStructure(int[] selectedVariables,double xMin,double xMax){ + + //--on retire toutes les variables qui ne sont pas voulues --// + Map<String, List<Double>> newdatas_ = new HashMap<String, List<Double>>(); + ArrayList<String> newVariables=new ArrayList<String>(); + + //ajout des x + newVariables.add(getVariable(0)); + newdatas_.put(getVariable(0), getAllX()); + + for(int i=0;i<selectedVariables.length;i++){ + //la bonne variable est selectedVariables[i]+1 car dans le choix on avait enlev\xE9 les X + newdatas_.put(getVariable(selectedVariables[i]+1), getListValueForVariable(selectedVariables[i]+1)); + newVariables.add(getVariable(selectedVariables[i]+1)); + } + + + //on retire les x qui ne sont pas les plages + for(int k=0;k<getNbValuePerVariables();k++){ + if(getX(k)>xMax || getX(k)<xMin){ + for(String var:newVariables){ + newdatas_.get(var).remove(k); + } + k--; + } + } + + //-- on remplace les nouvelles valeurs --// + data_=newdatas_; + listeVariales_=newVariables; + + //test + printResults(); + + + } + + @Override public void printResults() { Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -0,0 +1,93 @@ +package org.fudaa.fudaa.commun.courbe; + +import java.awt.event.ActionEvent; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.telemac.io.ScopeStructure; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGCourbeModelDefault; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGModel; +import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; + +import com.memoire.bu.BuResource; +import com.memoire.bu.BuWizardDialog; + +/** + * Gere l'importation de donn\xE9es scope s ou t et cr\xE9e un graphe temporel ou spatial selon le format + * S'utilise avec le wizard FudaaCourbeWizardImportScope + * @author Adrien Hadoux + * + */ +public class FudaaCourbeImporterScope { + + /** + * Action qui genere un wizard pour le parametrage des structures import\xE9es. + * @author Adrien Hadoux + * + */ + + + public static EGGraphe createGrapheTemporel(ScopeStructure.SorT data_,ProgressionInterface prog){ + + + return createGrapheSpatialGraphe(data_, prog); + } + + /** + * genere un graphe spatial + * @param data_ + * @return + */ + public static EGGraphe createGrapheSpatialGraphe(ScopeStructure.SorT data_,ProgressionInterface prog){ + + EGGrapheTreeModel model=new EGGrapheTreeModel(); + double[] tabX=new double[data_.getAllX().size()]; + for(int i=0;i<data_.getAllX().size();i++) + tabX[i]=data_.getX(i); + + + for(int i=0;i<data_.getNbVariables();i++){ + + EGGroup varg=new EGGroup(); + varg.setTitle(data_.getVariable(i)); + model.add(varg); + + //--remplissage de valeurs --// + //tableau des y + double[] tabY=new double[tabX.length]; + + for(int j=0;j<tabX.length;j++) + tabY[j]=data_.getValueOfvariable(i, j); + EGCourbeModelDefault modelCourbe=new EGCourbeModelDefault(tabX,tabY); + EGCourbeChild courbe=new EGCourbeChild(varg,modelCourbe); + + varg.addEGComponent(courbe); + + } + + + EGGraphe graphe=new EGGraphe(model); + + + return graphe; + } + + +public static EGGraphe createGrapheSpatialGENE(ScopeStructure.Gene data_,ProgressionInterface prog){ + + + return null; + } + + +public static EGGraphe createGrapheTemporelGENE(ScopeStructure.Gene data_,ProgressionInterface prog){ + + + return null; +} +} Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -0,0 +1,434 @@ +package org.fudaa.fudaa.commun.courbe; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; + +import javax.swing.AbstractAction; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JTextField; +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; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormat; +import org.fudaa.ctulu.fileformat.FileFormatUnique; +import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.mesure.EvolutionFileFormat; +import org.fudaa.dodico.reflux.io.CLTransitoireFileFormat; +import org.fudaa.dodico.reflux.io.CrbFileFormat; +import org.fudaa.dodico.rubar.io.RubarCLIFileFormat; +import org.fudaa.dodico.rubar.io.RubarTARFileFormat; +import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; +import org.fudaa.dodico.telemac.io.ScopeSFileFormat; +import org.fudaa.dodico.telemac.io.ScopeStructure; +import org.fudaa.dodico.telemac.io.ScopeTFileFormat; +import org.fudaa.dodico.telemac.io.TelemacLiquideFileFormat; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporterScope; +import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import org.fudaa.fudaa.commun.impl.FudaaGuiLib; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuButton; +import com.memoire.bu.BuButtonPanel; +import com.memoire.bu.BuCharValidator; +import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuStringValidator; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuValueValidator; +import com.memoire.bu.BuWizardDialog; +import com.memoire.bu.BuWizardTask; + +/** + * Wizard qui se charge d'importer des courbes au format scope dans le post. + * + * Pour personnaliser le format final du graphe et son affichage, il faut surcharger la methode + * createGraphImported() + * @author Adrien Hadoux + * + */ +public class FudaaGrapheWizardImportScope extends BuWizardTask { + + //donnees haut niveau + FudaaCommonImplementation impl_; + + /** + * type de fomat: + * 0 => scops + * 1 =>scopT + * 2=>scopgene + */ + int typeFormat_; + File fileChoosen_=null; + 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); + JList listVariables_; + + + public static class ImportAction extends EbliActionSimple { + final FudaaCommonImplementation ui_; + public ImportAction(final FudaaCommonImplementation _ui) { + super(BuResource.BU.getString("Importer au format scope"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); + ui_ = _ui; + } + public void actionPerformed(final ActionEvent _e) { + FudaaGrapheWizardImportScope wizard=new FudaaGrapheWizardImportScope(ui_); + BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); + // --affichage du wizard --// + DialogWizard.setSize(600, 500); + DialogWizard.setLocationRelativeTo(ui_.getFrame()); + DialogWizard.setVisible(true); + } + } + + + public FudaaGrapheWizardImportScope(FudaaCommonImplementation impl) { + super(); + + impl_=impl; + } + + + @Override + public JComponent getStepComponent() { + 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 panelParametres_; + } + + } + + return null; + } + + @Override + public int getStepCount() { + // TODO Auto-generated method stub + return 2; + } + + @Override + public String getStepText() { + // TODO Auto-generated method stub + return null; + } + + ScopeStructure.SorT dataST(){ + return (ScopeStructure.SorT)data_; + } + + ScopeStructure.Gene dataG(){ + return (ScopeStructure.Gene)data_; + } + + @Override + public String getStepTitle() { + 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; + } + + /** + * construit le panel de selection du fichier + * @return + */ + JPanel buildFilePanel(){ + JPanel content=new JPanel(new FlowLayout(FlowLayout.CENTER)); + content.add(new JLabel(TrResource.getS("Choisir le fichier:"))); + filePath_=new BuTextField(20); + filePath_.setEnabled(false); + content.add(filePath_); + 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(); + + + + } + + }); + content.add(parcourir); + return content; + } + + /** + * 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; + } + + + /** + * 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() { + final ProgressionInterface prog = getMainStateReceiver(); + + switch(typeFormat_){ + case 0: + //cas s + data_=lectureScopeS(fileChoosen_,prog); + break; + case 1: + //cas scopT + data_=lectureScopeT(fileChoosen_,prog); + break; + case 2: + //cas scopGENE + data_=lectureScopeGENE(fileChoosen_,prog); + break; + } + + }}.start(); + + } + + 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; + } + 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; + } + 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; + } + + + /** + * Construit le panel de choix des donn\xE9es a importer pour les formats s et t + * @return + */ + double Xmin,Xmax; + 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); + + listVariables_=new JList(listeVar); + listVariables_.setSelectedIndex(0); + content.add(listVariables_,BorderLayout.CENTER); + listVariables_.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_); + plages.add(new JLabel("-")); + plages.add(plageFin_); + plages.add(new JLabel("(Min: "+Xmin+", Max: "+Xmax+")")); + content.add(plages,BorderLayout.SOUTH); + + return content; + } + + JPanel buildPanelScopeGENE(){ + return null; + } + + JPanel buildPanelParametresImportation(){ + switch(typeFormat_){ + case 0: + //cas s + return buildPanelScopeSorT(); + case 1: + //cas scopT + return buildPanelScopeSorT(); + case 2: + //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() { + 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(listVariables_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); + + + impl_.setMainProgression(30); + impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); + // creation du graphe + switch(typeFormat_){ + case 0: + //cas s + result_=FudaaCourbeImporterScope.createGrapheSpatialGraphe(dataST(),prog);break; + case 1: + //cas scopT + result_=FudaaCourbeImporterScope.createGrapheTemporel(dataST(),prog);break; + case 2: + //cas scopGENE + result_=FudaaCourbeImporterScope.createGrapheTemporelGENE(dataG(),prog);break; + } + + //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// + createGraphImported(result_); + } + }.start(); + } + + + /** + * Methode a surcharger. + * Appel\xE9e a la toute fin, gere le resultat + */ + public void createGraphImported(EGGraphe grapheGenere){ + //placer le graphe ou vous voulez... + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 11:00:40 UTC (rev 4016) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -509,8 +509,7 @@ */ private void computeResults() { - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan") + CtuluLibString.ESPACE - + EvolutionFileFormat.getInstance().getName()) { + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan") ) { public void act() { final ProgressionInterface prog = getMainStateReceiver(); // -- calcul de la EfLineIntersectionsResultsMng --// Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 11:00:40 UTC (rev 4016) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -379,8 +379,7 @@ */ private void computeResults() { - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan") + CtuluLibString.ESPACE - + EvolutionFileFormat.getInstance().getName()) { + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan")) { public void act() { final ProgressionInterface prog = getMainStateReceiver(); 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 2008-10-01 11:00:40 UTC (rev 4016) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -496,6 +496,9 @@ init.add(null); init.add(new EbliWidgetAnimAdapter(getSceneCourante()).createAction()); + init.add(null); + init.add(new TrPostWizardImportScope.ImportAction(projet_)); + actions_ = Collections.unmodifiableList(init); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java 2008-10-01 11:00:40 UTC (rev 4016) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java 2008-10-01 16:07:21 UTC (rev 4017) @@ -8,18 +8,23 @@ import java.util.Arrays; import javax.swing.AbstractAction; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; +import org.fudaa.ctulu.CtuluIOOperationSynthese; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.fileformat.FileFormat; import org.fudaa.ctulu.fileformat.FileFormatUnique; import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.dodico.reflux.io.CLTransitoireFileFormat; import org.fudaa.dodico.reflux.io.CrbFileFormat; @@ -27,179 +32,66 @@ import org.fudaa.dodico.rubar.io.RubarTARFileFormat; import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; import org.fudaa.dodico.telemac.io.ScopeSFileFormat; +import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.dodico.telemac.io.ScopeTFileFormat; import org.fudaa.dodico.telemac.io.TelemacLiquideFileFormat; +import org.fudaa.ebli.commun.EbliActionSimple; +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; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporterScope; +import org.fudaa.fudaa.commun.courbe.FudaaGrapheWizardImportScope; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.tr.common.TrResource; import com.memoire.bu.BuButton; +import com.memoire.bu.BuButtonPanel; +import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuFileFilter; import com.memoire.bu.BuResource; +import com.memoire.bu.BuStringValidator; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuValueValidator; +import com.memoire.bu.BuWizardDialog; import com.memoire.bu.BuWizardTask; /** - * Wizard qui se charge d'importer des courbes au format scope dans le post. + * Wizard qui surcharge le wizard de parametrage d'import des scope. * @author Adrien Hadoux * */ -public class TrPostWizardImportScope extends BuWizardTask { +public class TrPostWizardImportScope extends FudaaGrapheWizardImportScope { - //donnees haut niveau - FudaaCommonImplementation impl_; TrPostProjet projet_; - /** - * type de fomat: - * 0 => scops - * 1 =>scopet - * 2=>scopgene - */ - int typeFormat_; - File fileChoosen_=null; + - //choix du fichier - JPanel panelFichier_; - JTextField filePath_=new JTextField(20); + public static class ImportAction extends EbliActionSimple { + final FudaaCommonImplementation ui_; + TrPostProjet projet_; + public ImportAction( TrPostProjet projet) { + super(BuResource.BU.getString("Importer"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); + ui_ = projet.impl_; + projet_=projet; + } + public void actionPerformed(final ActionEvent _e) { + TrPostWizardImportScope wizard=new TrPostWizardImportScope(projet_); + BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); + // --affichage du wizard --// + DialogWizard.setSize(600, 500); + DialogWizard.setLocationRelativeTo(ui_.getFrame()); + DialogWizard.setVisible(true); + } + } - public TrPostWizardImportScope(TrPostProjet projet_) { - super(); + super(projet_.impl_); this.projet_ = projet_; - impl_=projet_.impl_; } - - @Override - public JComponent getStepComponent() { - switch (current_) { - case 0: { - - if(panelFichier_==null) - panelFichier_=buildFilePanel(); - return panelFichier_; - } - case 1: { - - } - - } - - return null; - } - - @Override - public int getStepCount() { - // TODO Auto-generated method stub - return 2; - } - - @Override - public String getStepText() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getStepTitle() { - String r = null; - - switch (current_) { - case 0: - r = TrResource.getS("Choisir le fichier"); - break; - case 1: - r = TrResource.getS("S\xE9lectionner les variables"); - break; - case 2: - r = TrResource.getS("S\xE9lectionner les graphes"); - break; - } - return r; - } - - - JPanel buildFilePanel(){ - JPanel content=new JPanel(new FlowLayout(FlowLayout.CENTER)); - content.add(new JLabel(TrResource.getS("Choisir le fichier:"))); - content.add(filePath_); - BuButton parcourir =new BuButton(TrResource.getS("Parcourir...")); - parcourir.setAction(new AbstractAction(){ - 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; - } - final FileFilter filter = fileChooser.getFileFilter(); - final int i = CtuluLibArray.getIndex(filter, filters); - if (i < 0) { - return; - } - typeFormat_=i; - fileChoosen_=initFile; - importData(); - - } - - }); - content.add(parcourir); - return content; - } - - /** - * 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; + public void createGraphImported(EGGraphe grapheGenere){ + projet_.addGrapheNodeInCurrentScene(new EGFillePanel(grapheGenere), "Graphe import\xE9 (format scope)"); } - - - /** - * Methode iumportante d'importation des datas en fonction du fichier choisi et du type. - */ - private void importData(){ - - switch(typeFormat_){ - - case 0: - //cas s - break; - case 1: - //cas scopT - break; - case 2: - //cas scopGENE - break; - } - - } - - - public String getTaskTitle() { - // TODO Auto-generated method stub - return null; - } - - - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-10-02 18:33:00
|
Revision: 4025 http://fudaa.svn.sourceforge.net/fudaa/?rev=4025&view=rev Author: hadouxad Date: 2008-10-02 18:32:19 +0000 (Thu, 02 Oct 2008) Log Message: ----------- - d?\195?\169but de l'algodes lignes de courant - l'interface de choix des donn?\195?\169es pour les lignes de courant - mise en place du target pour les importations de courbes, il ne reste plus qu'a instancier les les treemodel qui vont bien. - cr?\195?\169ation de toutes les interfaces pour les import scopGENE et scop s, t, tout est en place C'est du lourd avec choix pour scopgene du type de graphe (cardlayout pour gerer les plusieurs cas...) Tout est fait jusque a la cr?\195?\169ation des ?\195?\169volutions regulieres pour le scopGene, tout est g?\195?\169r?\195?\169; spatial, temporel, corr?\195?\169l?\195?\169 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java 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/ScopeWriterGENE.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.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/FudaaWriterScopeGENE.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/TrPostDialogCubature.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/TrPostWizardImportScope.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/classes/ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeReaderGene.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -172,7 +172,7 @@ // -- on est arriv\xE9 a une ligne de pas de temps, on ajoute le pas de temps // dans la structure --// String valuePasDetemps = in_.getLine(); - structure.addPasDeTemps(valuePasDetemps); + structure.addSeparator(valuePasDetemps); in_.readFields(); @@ -191,7 +191,7 @@ value = in_.doubleField(i); - structure.addValueForVariableAtPdt(value, i, valuePasDetemps); + structure.addValueForVariableAtSeparator(value, i, valuePasDetemps); } } // on lit la suite @@ -216,7 +216,7 @@ // -- on est arriv\xE9 a une ligne de pas de temps --// String valuePasDetemps = in_.getLine(); - structure.addPasDeTemps(valuePasDetemps); + structure.addSeparator(valuePasDetemps); in_.readFields(); @@ -237,7 +237,7 @@ // on inscrit la valeur pour la variable du pas de temps // correspondant double value = in_.doubleField(0); - structure.addValueForVariableAtPdt(value, indiceVar, valuePasDetemps); + structure.addValueForVariableAtSeparator(value, indiceVar, valuePasDetemps); indiceVar++; // on lit la var suivante 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 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -19,6 +19,8 @@ public abstract void printResults(); + public abstract EvolutionReguliere[] returnEvolReguliere(); + /** * Structure pour les fichiers s ou t Par convention les x sont les premieres * variables. @@ -183,8 +185,8 @@ double[] tabY = new double[listeY.size()]; for (int j = 0; j < listeX.size(); j++) { - tabX[i] = listeX.get(i); - tabY[i] = listeY.get(i); + tabX[j] = listeX.get(j); + tabY[j] = listeY.get(j); } @@ -266,12 +268,12 @@ public static class Gene extends ScopeStructure { /** - * Map qui donne a chaque pas de temps sa liste de valeurs pour chaque + * Map qui donne a chaque separator sa liste de valeurs pour chaque * variables. */ private Map<String, ArrayList<ArrayList<Double>>> data_ = new HashMap<String, ArrayList<ArrayList<Double>>>(); - private List<String> listePasDeTemps = new ArrayList<String>(); + private List<String> listeSeparator = new ArrayList<String>(); private List<String> listeVariales_ = new ArrayList<String>(); @@ -298,7 +300,7 @@ - public List<Double> getAllX(String pdt) { + public ArrayList<Double> getAllX(String pdt) { return data_.get(pdt).get(0); } @@ -316,6 +318,27 @@ getAllX(pdt).add(x); } + + public double getXMax(){ + double max=getX(0,listeSeparator.get(0)); + + for(int j=0;j<listeSeparator.size();j++) + for(int i=1;i<getAllX(listeSeparator.get(j)).size();i++) + if(max<getX(i,listeSeparator.get(j))) + max=getX(i,listeSeparator.get(j)); + return max; + } + + public double getXMin(){ + double min=getX(0,listeSeparator.get(0)); + + for(int j=0;j<listeSeparator.size();j++) + for(int i=1;i<getAllX(listeSeparator.get(j)).size();i++) + if(min>getX(i,listeSeparator.get(j))) + min=getX(i,listeSeparator.get(j)); + return min; + } + /** * Methode qui insert le x dans les variables que si il n'existe pas deja. * @@ -331,10 +354,10 @@ - public void addPasDeTemps(String ligne) { + public void addSeparator(String ligne) { ligne = ligne.replace(KEY.getBlocCommentaireGENE(), ""); - listePasDeTemps.add(ligne); + listeSeparator.add(ligne); // on ajoute un enregistrment dans data pour le pas de temps // correspondant @@ -355,8 +378,8 @@ // // } - public int getNbPasDeTemps() { - return listePasDeTemps.size(); + public int getNbSeparator() { + return listeSeparator.size(); } @@ -364,23 +387,23 @@ return listeVariales_.size(); } - public ArrayList<ArrayList<Double>> getListeVarForPasDeTemps(String pdt) { + public ArrayList<ArrayList<Double>> getListeVarForSeparator(String pdt) { return data_.get(pdt); } - public ArrayList<ArrayList<Double>> getListeVarForPasDeTemps(int pdt) { - return data_.get(listePasDeTemps.get(pdt)); + public ArrayList<ArrayList<Double>> getListeVarForSeparator(int pdt) { + return data_.get(listeSeparator.get(pdt)); } - public ArrayList<Double> getListValueForVariableForPDT(String pdt, int var) { + public ArrayList<Double> getListValueForVariableForSeparator(String separator, int var) { - return getListeVarForPasDeTemps(pdt).get(var); + return getListeVarForSeparator(separator).get(var); } - public void addValueForVariableAtPdt(double value, int indexVariable, String valuePasDetemps) { - ArrayList<Double> listeValueOfVar = getListValueForVariableForPDT(valuePasDetemps, indexVariable); + public void addValueForVariableAtSeparator(double value, int indexVariable, String nameSeparator) { + ArrayList<Double> listeValueOfVar = getListValueForVariableForSeparator(nameSeparator, indexVariable); // if (listeValueOfVar == null) // listeValueOfVar = new ArrayList<Double>(); @@ -403,14 +426,14 @@ * retourne l equivalent d une ligne du fichier qui contient les valeurs * pour chaque variables pour un pas de temps donn\xE9. * - * @param pasDetemps + * @param separator * @return */ - public String getAllValuesForVariableAndPasDeTemps(String pasDetemps,int indiceValue) { + public String getAllValuesForVariableAndSeparator(String separator,int indiceValue) { String ligneBrochette = ""; for (int i = 0; i < listeVariales_.size(); i++) { - ArrayList<Double> listeValueOfVar = getListValueForVariableForPDT(pasDetemps, i); + ArrayList<Double> listeValueOfVar = getListValueForVariableForSeparator(separator, i); if (i != 0) ligneBrochette += " "; if (listeValueOfVar.get(indiceValue) != KEY.VALUE_UNDEFINED) @@ -423,8 +446,8 @@ } - public String getPasDeTemps(int i) { - return listePasDeTemps.get(i); + public String getSeparator(int i) { + return listeSeparator.get(i); } public String getVariable(int i) { return listeVariales_.get(i); @@ -441,26 +464,26 @@ public EvolutionReguliere[] returnEvolReguliere() { - EvolutionReguliere[] evolReg = new EvolutionReguliere[getNbPasDeTemps() * getNbVariables()]; + EvolutionReguliere[] evolReg = new EvolutionReguliere[getNbSeparator() * getNbVariables()]; // -- on parcours tous les pas de temps --// - for (int h = 0; h < getNbPasDeTemps(); h++) { + for (int h = 0; h < getNbSeparator(); h++) { - String pdt = getPasDeTemps(h); + String pdt = getSeparator(h); - // -- on parcours toutes les variables --// - for (int i = 0; i < getNbVariables(); i++) { + // -- on parcours toutes les variables et non les x --// + for (int i = 1; i < getNbVariables(); i++) { String nomVar = getVariable(i); List<Double> listeX = getAllX(pdt); - List<Double> listeY = getListValueForVariableForPDT(pdt, i); + List<Double> listeY = getListValueForVariableForSeparator(pdt, i); double[] tabX = new double[listeX.size()]; double[] tabY = new double[listeY.size()]; for (int j = 0; j < listeX.size(); j++) { - tabX[i] = listeX.get(i); - tabY[i] = listeY.get(i); + tabX[j] = listeX.get(j); + tabY[j] = listeY.get(j); } @@ -472,6 +495,190 @@ return evolReg; } + /** + * A utiliser poru transformer scopgen en evol temporelles. + * On cree une courbe par variables, et on prend les points de tous les separaor pou les former. + * @return + */ + public EvolutionReguliere[] returnEvolRegulierePourTemporelles() { + EvolutionReguliere[] evolReg = new EvolutionReguliere[getNbVariables()]; + + + // -- on parcours toutes les variables et non les x, on a une seule variable --// + for (int i = 1; i < getNbVariables(); i++) { + String nomVar = getVariable(i); + + List<Double> listeTOTALX =new ArrayList<Double>(); + List<Double> listeTOTALY = new ArrayList<Double>(); + + for(int k=0;k<getNbSeparator();k++){ + + //on recupere les x de ce separator + List<Double> listX=getListValueForVariableForSeparator(getSeparator(k), 0); + //on recupere les y de la variable de la courbe + List<Double> listY=getListValueForVariableForSeparator(getSeparator(k), i); + + //on ajoute tout cela au x et y totaux + listeTOTALX.addAll(listX); + listeTOTALY.addAll(listY); + + + } + + //creation de l evol reguliere + double[] tabX = new double[listeTOTALX.size()]; + double[] tabY = new double[listeTOTALX.size()]; + for (int j = 0; j < listeTOTALX.size(); j++) { + tabX[j] = listeTOTALX.get(j); + tabY[j] = listeTOTALY.get(j); + } + evolReg[i] = new EvolutionReguliere(tabX, tabY, false); + evolReg[i].setNom("courbe de " + nomVar); + + + } + + return evolReg; + } + + /** + * Methode reservee pour les correlations, on genere une courbe a la fois. + *les x seront la variable du separator specifi\xE9 + *les Y idem + * @return + */ + public EvolutionReguliere[] returnEvolReguliereCorrelation(int varX,int varY,int separatorX,int separatorY){ + EvolutionReguliere[] evolReg = new EvolutionReguliere[1]; + + List<Double> listeX=getListValueForVariableForSeparator(getSeparator(separatorX), varX+1); + List<Double> listeY=getListValueForVariableForSeparator(getSeparator(separatorY), varY+1); + + double[] tabX = new double[listeX.size()]; + double[] tabY = new double[listeY.size()]; + + for (int j = 0; j < listeX.size(); j++) { + tabX[j] = listeX.get(j); + tabY[j] = listeY.get(j); + + } + + evolReg[0] = new EvolutionReguliere(tabX, tabY, false); + evolReg[0].setNom("courbe corr\xE9l\xE9e X="+getVariable(varX+1)+"/Y="+getVariable(varY+1)); + + + return evolReg; + } + + + /** + * Methode qui reduit la structure en ne conservant que les separator de debut et de fin. + * la liste des variables dont les indices doivents etre incr\xE9ment\xE9s car pas de x. + * et ne garder que le x choisi et interpoler les valeur de facon lin\xE9aire. + * @param debSeparator + * @param finSeparator + * @param listVariables + * @param xchoosen + */ + public void restreindreStructure(int debSeparator,int finSeparator,int[] listVariables, double xchoosen){ + + //on reduit les separator a la liste voulue + restreindreStructure(debSeparator, finSeparator); + + //on reduit les variables + restreindreStructure(listVariables); + + //on interpole pour le x choisi + restreindreStructure(xchoosen); + + printResults(); + } + + public void restreindreStructure(int debSeparator,int finSeparator){ + Map<String, ArrayList<ArrayList<Double>>> newdata_ = new HashMap<String, ArrayList<ArrayList<Double>>>(); + List<String> newlisteSeparator = new ArrayList<String>(); + + + // on ajoute les separator de la plage + for(int i=0;i<getNbSeparator();i++){ + if(i>=debSeparator && i<=finSeparator){ + String newSepa= getSeparator(i); + newlisteSeparator.add(newSepa); + newdata_.put(newSepa, getListeVarForSeparator(i)); + } + } + listeSeparator=newlisteSeparator; + data_=newdata_; + + } + + public void restreindreStructure(int[] listVariables){ + Map<String, ArrayList<ArrayList<Double>>> newdata_ = new HashMap<String, ArrayList<ArrayList<Double>>>(); + List<String> newlisteVariables = new ArrayList<String>(); + + //on ajoute par defaut les x + newlisteVariables.add(getVariable(0)); + + + + //on ajout les news variabels + for(int j=0;j<listVariables.length;j++) + newlisteVariables.add(getVariable(listVariables[j]+1)); + + // on ajoute uniquement les datas de ces variables + for(int i=0;i<getNbSeparator();i++){ + + ArrayList<ArrayList<Double>> newVariablePerValidator=new ArrayList<ArrayList<Double>>(); + + //on ajoute tout dabord tous les x + newVariablePerValidator.add(getAllX(getSeparator(i))); + + for(int j=0;j<listVariables.length;j++){ + //il faut incrementer de 1 car pas de X pris en compte pour les choix de var or ici c est l'elt 0 + int selectedVar=listVariables[j]+1; + newVariablePerValidator.add(getListValueForVariableForSeparator(getSeparator(i), selectedVar)); + + + } + newdata_.put(getSeparator(i), newVariablePerValidator); + + } + listeVariales_=newlisteVariables; + data_=newdata_; + + } + + public void restreindreStructure(double xchoosen){ + + for(int i=0;i<getNbSeparator();i++){ + + ArrayList<Double> listeX=getAllX(getSeparator(i)); + + int indiceProche=0; + double xProche=listeX.get(0); + //etape 1 on recherche le x le plus proche du xchoosen + for(int k=1;k<listeX.size();k++){ + double test=listeX.get(k); + if(Math.abs(test-xchoosen)<Math.abs(xProche-xchoosen)){ + xProche=test; + indiceProche=k; + } + } + + //on ne conserve dans chaque liste des variables que la valeur correspondante au xProche + for(int j=0;j<getNbVariables();j++){ + + ArrayList<Double> listeValueVar=getListValueForVariableForSeparator(getSeparator(i), j); + double conservVar=listeValueVar.get(indiceProche); + for(int h=0;h<listeValueVar.size();) + listeValueVar.remove(h); + listeValueVar.add(conservVar); + + + } + } + + } + @Override public void printResults() { // titres @@ -486,19 +693,19 @@ } // tableau de val mode non eclatee - String tableauVal = "0 " + KEY.getScopeGENESeparator(getPasDeTemps(0)) + " 0 0 0 0 0 0 0 0"; + String tableauVal = "0 " + KEY.getScopeGENESeparator(getSeparator(0)) + " 0 0 0 0 0 0 0 0"; System.err.print("\n" + tableauVal); // pour chaque pas de temps - for (int i = 0; i < listePasDeTemps.size(); i++) { + for (int i = 0; i < listeSeparator.size(); i++) { // separator pas de temps - System.err.print("\n " + getPasDeTemps(i)); + System.err.print("\n " + getSeparator(i)); - int nbValuesForThisPdt = getListeVarForPasDeTemps(i).get(0).size(); + int nbValuesForThisPdt = getListeVarForSeparator(i).get(0).size(); // -- parcours la liste des donnees for (int k = 0; k < nbValuesForThisPdt; k++) { - System.err.print("\n" + getAllValuesForVariableAndPasDeTemps(getPasDeTemps(i), k)); + System.err.print("\n" + getAllValuesForVariableAndSeparator(getSeparator(i), k)); } Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeWriterGENE.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -1,6 +1,8 @@ package org.fudaa.dodico.telemac.io; import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Calendar; import org.fudaa.ctulu.CtuluActivity; import org.fudaa.ctulu.fileformat.FileFormatVersionInterface; @@ -69,11 +71,12 @@ } protected void writeHeader(ScopeStructure.Gene _struct) throws IOException { - String bc = key_.getBlocCommentaireGENE(); - setProgression(0, H2dResource.getS("Cr\xE9ation des en-t\xEAtes") + bc); - for (int i = 0; i < _struct.getNbTitles(); i++) { - writelnToOut(bc + _struct.getTitle(i)); - } + String bc = key_.getBlocCommentaireGENE(); + setProgression(0, H2dResource.getS("Cr\xE9ation des en-t\xEAtes") + bc); + writelnToOut(bc + H2dResource.getS("Fichier g\xE9n\xE9r\xE9 par Fudaa") + bc); + final String date = new SimpleDateFormat("yyyy-M-d k:mm:ss").format(Calendar.getInstance().getTime()); + writelnToOut(bc + "Version " + key_.getVersion() + " - Date " + date + bc); + writelnToOut(bc); } @@ -86,7 +89,7 @@ writelnToOut(_struct.getVariable(i)); } // tableau de val mode non eclatee - String tableauVal = "0 " + key_.getScopeGENESeparator(_struct.getPasDeTemps(0)) + " 0 0 0 0 0 0 0 0"; + String tableauVal = "0 " + key_.getScopeGENESeparator(_struct.getSeparator(0)) + " 0 0 0 0 0 0 0 0"; writelnToOut(tableauVal); } @@ -94,15 +97,15 @@ setProgression(30, H2dResource.getS("Cr\xE9ation des donn\xE9es")); // pour chaque pas de temps - for (int i = 0; i < _struct.getNbPasDeTemps(); i++) { + for (int i = 0; i < _struct.getNbSeparator(); i++) { // separator pas de temps - writelnToOut(_struct.getPasDeTemps(i)); + writelnToOut(_struct.getSeparator(i)); // -- parcours la liste des donnees - int nbValuesForThisPdt = _struct.getListeVarForPasDeTemps(i).get(0).size(); + int nbValuesForThisPdt = _struct.getListeVarForSeparator(i).get(0).size(); for (int k = 0; k < nbValuesForThisPdt; k++) { - writelnToOut(_struct.getAllValuesForVariableAndPasDeTemps(_struct.getPasDeTemps(i), k)); + writelnToOut(_struct.getAllValuesForVariableAndSeparator(_struct.getSeparator(i), k)); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporterScope.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -4,6 +4,7 @@ import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGCourbeChild; @@ -32,18 +33,26 @@ */ - public static EGGraphe createGrapheTemporel(ScopeStructure.SorT data_,ProgressionInterface prog){ + public static void createGraphe(FudaaCourbeImporter.Target target,ScopeStructure _data, CtuluCommandManager _mng,ProgressionInterface _prog){ - return createGrapheSpatialGraphe(data_, prog); + createGraphe(target,_data.returnEvolReguliere(), _mng, _prog); } + public static void createGraphe(FudaaCourbeImporter.Target target,EvolutionReguliere[] _data, CtuluCommandManager _mng,ProgressionInterface _prog){ + + + target.importCourbes(_data, _mng, _prog); + } + + + /** * genere un graphe spatial * @param data_ * @return */ - public static EGGraphe createGrapheSpatialGraphe(ScopeStructure.SorT data_,ProgressionInterface prog){ + public static void createGrapheSpatialGrapheOLD(FudaaCourbeImporter.Target target,ScopeStructure.SorT data_,ProgressionInterface prog){ EGGrapheTreeModel model=new EGGrapheTreeModel(); double[] tabX=new double[data_.getAllX().size()]; @@ -74,20 +83,7 @@ EGGraphe graphe=new EGGraphe(model); - return graphe; - } - - -public static EGGraphe createGrapheSpatialGENE(ScopeStructure.Gene data_,ProgressionInterface prog){ - - return null; } - -public static EGGraphe createGrapheTemporelGENE(ScopeStructure.Gene data_,ProgressionInterface prog){ - - - return null; } -} 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 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -1,20 +1,28 @@ package org.fudaa.fudaa.commun.courbe; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.FlowLayout; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import javax.swing.AbstractAction; +import javax.swing.AbstractListModel; import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.ListSelectionModel; import javax.swing.filechooser.FileFilter; import org.fudaa.ctulu.CtuluCommandManager; @@ -28,6 +36,7 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.mesure.EvolutionFileFormat; +import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.reflux.io.CLTransitoireFileFormat; import org.fudaa.dodico.reflux.io.CrbFileFormat; import org.fudaa.dodico.rubar.io.RubarCLIFileFormat; @@ -44,12 +53,14 @@ import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporterScope; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaGuiLib; +import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.tr.common.TrResource; import com.memoire.bu.BuButton; import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuIcon; import com.memoire.bu.BuResource; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; @@ -69,7 +80,7 @@ //donnees haut niveau FudaaCommonImplementation impl_; - + FudaaCourbeImporter.Target target_; /** * type de fomat: * 0 => scops @@ -93,17 +104,19 @@ BuTextField plageFin_=new BuTextField(5); double xMin; double xMax; - JList listVariables_; + JList listVariablesST_; public static class ImportAction extends EbliActionSimple { final FudaaCommonImplementation ui_; - public ImportAction(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; + ui_ = _ui; + target_=target; } public void actionPerformed(final ActionEvent _e) { - FudaaCourbeWizardImportScope wizard=new FudaaCourbeWizardImportScope(ui_); + FudaaCourbeWizardImportScope wizard=new FudaaCourbeWizardImportScope(ui_,target_); BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); // --affichage du wizard --// DialogWizard.setSize(600, 500); @@ -113,7 +126,7 @@ } - public FudaaCourbeWizardImportScope(FudaaCommonImplementation impl) { + public FudaaCourbeWizardImportScope(FudaaCommonImplementation impl,FudaaCourbeImporter.Target target) { super(); impl_=impl; @@ -301,10 +314,10 @@ for(int i=1;i<dataST().getNbVariables();i++) listeVar[i-1]=dataST().getVariable(i); - listVariables_=new JList(listeVar); - listVariables_.setSelectedIndex(0); - content.add(listVariables_,BorderLayout.CENTER); - listVariables_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); + 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); @@ -331,14 +344,216 @@ } + + 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_; + CardLayout layoutParamGene=new CardLayout(); + BuTextField fieldX=new BuTextField(10); /** + * Liste des couples a importer. + * Ces couples utilisent la classe coupleVarSepartor + */ + JList listCoupleSpatiauxGENE_; + DefaultListModel modelCoupleSpatiauxGENE_; + public class CoupleVarSepartor{ + String nomVar,nomSeparator; + ArrayList<Double> listX; + ArrayList<Double> listY; + public CoupleVarSepartor(String nomVar, String nomSeparator, + ArrayList<Double> listX, ArrayList<Double> listY) { + this.nomVar = nomVar; + this.nomSeparator = nomSeparator; + this.listX = listX; + this.listY = listY; + } + @Override + public String toString() { + // 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); + } + EvolutionReguliere evol=new EvolutionReguliere(tabX, tabY,_time); + evol.setNom(nomVar+" "+nomSeparator); + return evol; + } + + } + + /** * Creation du panel scopGene pour choisir ses parametres * @return */ JPanel buildPanelScopeGENE(){ + final JPanel content=new JPanel(new BorderLayout()); + content.add(comBoChoixTypeGraphe_,BorderLayout.NORTH); + final JPanel container=new JPanel(layoutParamGene); + content.add(container,BorderLayout.CENTER); + comBoChoixTypeGraphe_.setAction(new AbstractAction(){ + public void actionPerformed(ActionEvent arg0) { + String val=(String) comBoChoixTypeGraphe_.getSelectedItem(); + layoutParamGene.show(container, val); + //layoutParamGene.next(container); +// content.revalidate(); +// container.revalidate(); + + } + }); + + //-- 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]; + //on ne prends pas les x + for(int i=1;i<dataG().getNbVariables();i++) + listeVar[i-1]=dataG().getVariable(i); + listVariablesGENE_=new JList(listeVar); + listVariablesGENE_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listVariablesGENE_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - return null; + //-- creation de la liste des separators --// + listeVar=new String[dataG().getNbSeparator()]; + //on ne prends pas les x + for(int i=0;i<dataG().getNbSeparator();i++) + listeVar[i]=dataG().getSeparator(i); + listSeparator_=new JList(listeVar); + listSeparator_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listSeparator_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); + + + //-- 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)); + choixVar.add(listVariablesGENE_); + choixVar.add(listSeparator_); + paramProfils.add(choixVar,BorderLayout.NORTH); + //--panel du milieu: liste de couples VAR/SEPARATOR --// + modelCoupleSpatiauxGENE_=new DefaultListModel(); + listCoupleSpatiauxGENE_=new JList(modelCoupleSpatiauxGENE_); + listCoupleSpatiauxGENE_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); + paramProfils.add(listCoupleSpatiauxGENE_,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()); + } + } + + }); + //ajout des boutons + 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")); + listeVar=new String[dataG().getNbVariables()-1]; + for(int i=1;i<dataG().getNbVariables();i++) + listeVar[i-1]=dataG().getVariable(i); + listVariablesGENE2_=new JList(listeVar); + listVariablesGENE2_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + listVariablesGENE2_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); + listeVar=new String[dataG().getNbSeparator()]; + for(int i=0;i<dataG().getNbSeparator();i++) + listeVar[i]=dataG().getSeparator(i); + listSeparatorDebPlage_=new JList(listeVar); + listSeparatorDebPlage_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listSeparatorDebPlage_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage d\xE9part du s\xE9parateur de bloc"))); + listSeparatorDebPlage_.setSelectedIndex(0); + listSeparatorFinPlage_=new JList(listeVar); + listSeparatorFinPlage_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listSeparatorFinPlage_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage fin du s\xE9parateur de bloc"))); + listSeparatorFinPlage_.setSelectedIndex(listSeparatorDebPlage_.getModel().getSize()-1); + + JPanel listData=new JPanel(new GridLayout(1,2)); + JPanel listData2=new JPanel(new GridLayout(2,1)); + listData.add(listVariablesGENE2_); + listData.add(listData2); + listData2.add(listSeparatorDebPlage_); + listData2.add(listSeparatorFinPlage_); + paramTempo.add(listData,BorderLayout.CENTER); + + //textField contenant le x choisi + xMax=dataG().getXMax(); + xMin=dataG().getXMin(); + JPanel panelInfo=new JPanel(); + panelInfo.add(new JLabel(TrResource.getS("Veuillez saisir le X:") +xMin+"<=X<="+xMax)); + fieldX.setCharValidator(BuCharValidator.FLOAT); + fieldX.setStringValidator(BuStringValidator.FLOAT); + fieldX.setValueValidator(BuValueValidator.FLOAT); + panelInfo.add(fieldX); + paramTempo.add(panelInfo,BorderLayout.SOUTH); + fieldX.setText(""+((xMax+xMin)/2)); + + + + //-- panel reserv\xE9s au corr\xE9lations --// + JPanel paramCorrel=new JPanel(new GridLayout(2,2)); + container.add(paramCorrel, TrResource.getS("Corr\xE9lation")); + + listeVar=new String[dataG().getNbVariables()-1]; + for(int i=1;i<dataG().getNbVariables();i++) + listeVar[i-1]=dataG().getVariable(i); + listVariablesGENECorrlX_=new JList(listeVar); + listVariablesGENECorrlX_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listVariablesGENECorrlX_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe X"))); + listVariablesGENECorrlY_=new JList(listeVar); + listVariablesGENECorrlY_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listVariablesGENECorrlY_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe Y"))); + + + 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_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable X"))); + listSeparatorCorrel1_.setSelectedIndex(0); + + listSeparatorCorrel2_=new JList(listeVar); + listSeparatorCorrel2_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listSeparatorCorrel2_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable Y"))); + listSeparatorCorrel2_.setSelectedIndex(0); + + paramCorrel.add(listVariablesGENECorrlX_); + paramCorrel.add(listSeparatorCorrel1_); + paramCorrel.add(listVariablesGENECorrlY_); + paramCorrel.add(listSeparatorCorrel2_); + + return content; } JPanel buildPanelParametresImportation(){ @@ -403,27 +618,57 @@ impl_.setMainMessage(CtuluLib.getS("Structure modification")); prog.setProgression(10); prog.setDesc(CtuluLib.getS("Structure modification")); - if(typeFormat_<=1) - dataST().restreindreStructure(listVariables_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); - - + 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")); - // creation du graphe - switch(typeFormat_){ - case 0: - //cas s - result_=FudaaCourbeImporterScope.createGrapheSpatialGraphe(dataST(),prog);break; - case 1: - //cas scopT - result_=FudaaCourbeImporterScope.createGrapheTemporel(dataST(),prog);break; - case 2: - //cas scopGENE - result_=FudaaCourbeImporterScope.createGrapheTemporelGENE(dataG(),prog);break; - } - - //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// - createGraphImported(result_); + FudaaCourbeImporterScope.createGraphe(target_, data_, null, prog); + } + 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); + }else + if(comBoChoixTypeGraphe_.getSelectedIndex()==1){ + //profil spatial + 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(), null, prog); + + }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(); + + FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolReguliereCorrelation(varX,varY,plageX,plageY), null, prog); + + + } + + } + + //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// + createGraphImported(); } }.start(); } @@ -433,7 +678,7 @@ * Methode a surcharger. * Appel\xE9e a la toute fin, gere le resultat */ - public void createGraphImported(EGGraphe grapheGenere){ + public void createGraphImported(){ //placer le graphe ou vous voulez... } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeGENE.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeGENE.java 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeGENE.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -2,6 +2,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; import jxl.write.WriteException; @@ -65,8 +66,8 @@ EGCourbe[] listeChoixUser = data.getCourbes(); //-- on ajoute un pas de temps qui decrit le graphe --// - String keyPDt="contenu graphe"; - structure_.addPasDeTemps(keyPDt); + String keyPDt="X=contenu graphe"; + structure_.addSeparator(keyPDt); @@ -107,6 +108,8 @@ if (!hasAlreadyRegistered) { hasAlreadyRegistered = true; structure_.addVariable(groupe.getTitle()); + //ACHTUNG IL FAUT AJOUTER CETTE LISTE QUI PERMETTRA AU VARIABLE D INITIALISER LEUR DATA. + structure_.getListeVarForSeparator(keyPDt).add(new ArrayList<Double>()); } // --ajout des valeurs pour chaque X--/ @@ -129,10 +132,10 @@ // -- si le x existe dans la courbe alors on inscrit son y // correspondant pour la bonne variable--// if (xExistForCourbe) - structure_.addValueForVariableAtPdt(courbe.getModel().getY(emplacementYcorrespondant), structure_.getNbVariables()-1, keyPDt); + structure_.addValueForVariableAtSeparator(courbe.getModel().getY(emplacementYcorrespondant), structure_.getNbVariables()-1, keyPDt); else // -- on enregistre une valeure foireuse. - structure_.addValueForVariableAtPdt(ScopeKeyWord.VALUE_UNDEFINED, structure_.getNbVariables()-1, keyPDt); + structure_.addValueForVariableAtSeparator(ScopeKeyWord.VALUE_UNDEFINED, structure_.getNbVariables()-1, keyPDt); } } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -0,0 +1,36 @@ +package org.fudaa.fudaa.tr.common; + +import java.awt.event.ActionEvent; + +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.meshviewer.MvResource; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; +import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; +import org.fudaa.fudaa.tr.post.TrPostDialogBilan; +import org.fudaa.fudaa.tr.post.TrPostDialogCurrentLine; +import org.fudaa.fudaa.tr.post.TrPostProjet; +import org.fudaa.fudaa.tr.post.TrPostVisuPanel; + +public class TrPostActionLigneCourants extends EbliActionSimple { + + // final MvProfileTarget src_; + TrPostProjet projet_; + + + public TrPostActionLigneCourants(TrPostProjet projet) { + super(MvResource.getS("Calcul des bilans"), MvResource.MV.getIcon("profile"), "BILAN"); + projet_=projet; + + } + + + + public void actionPerformed(final ActionEvent _e) { + // -- creation du wizard depusi le calque --// + + new TrPostDialogCurrentLine(projet_,projet_.getImpl()); + } + + + + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -0,0 +1,198 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.Point; +import java.util.ArrayList; + +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfGridData; +import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.ef.EfNeighborMesh; +import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; +import org.fudaa.dodico.ef.interpolation.EfInterpolator; +import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestElt; +import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; +import org.fudaa.dodico.ef.operation.EfLineIntersection; +import org.fudaa.dodico.ef.operation.EfLineIntersectionParent; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.geometrie.GrPolygone; +import org.fudaa.fudaa.tr.common.TrResource; + + +/** + * Algorithme de Calcul les lignes de courants + * @author Adrien Hadoux + * + */ +public class TrComputeCurrentLine implements EfLineIntersectionParent{ + + +/** + * data + */ +final TrPostSource data_; + +/** + * pour interpoler les valeur + */ +final EfInterpolator interpolator_; + +ProgressionInterface prog_; + +/** + * Liste des intersections r\xE9sultats + */ +ArrayList<EfLineIntersection> listeIntersection_=null; + + +public TrComputeCurrentLine(TrPostSource data_) { + super(); + this.data_ = data_; + this.interpolator_ = data_.getInterpolator(); +} + +public void progression(String desc, int completionRate){ + if(prog_==null) + return; + prog_.setDesc(TrResource.getS(desc)); + prog_.setProgression(5); + +} +/** + * Methode appel\xE9e par l'interface de calcul des lignes de courant. + * @param init point de depart + * @param dureeIntegration duree totale de l'integration en secondes + * @param indicePdt indice du pas de temps + * @param finesse coefficient de finesse double + * @param variable la variable a utiliser + * @param prog l'interface de progression, peut etre null + * @return + */ +public ArrayList<EfLineIntersection> computeLine(GrPoint init, double dureeIntegration, int indicePdt,double finesse ,H2dVariableType variable, ProgressionInterface prog){ + prog_=prog; + //on init le temps total avec l'indice du pas de temps fourni au depart + double tempsTotal=data_.getTimeStep(indicePdt); + double oldTempsTotal; + boolean inactif=false; + + + + + while(!inactif && tempsTotal<=dureeIntegration){ + oldTempsTotal=tempsTotal; + + //etape 1 \xE9l\xE9ment englobant de init + progression("Recherche \xE9l\xE9ment englobant",5); + int eltEnglob=elementEnglobant(init); + if(eltEnglob !=-1){ + //creation de la premiere intersection + EfLineIntersection.ItemMesh intersection=new EfLineIntersection.ItemMesh(eltEnglob,init.x_,init.y_); + //recup des datas + EfData dataX=data_.getData(variable, indicePdt); + double vx=intersection.getDistanceFrom(init.x_, init.y_); + double vy=intersection.getValueBadInterpolation(dataX); + + //calcul des distances avec son voisinage + EfNeighborMesh voisinage=EfNeighborMesh.compute(data_.getGrid(), prog_); + double distanceMaxEntrePoints=0; + int[] listeEltVoisins=null; + int voisinChoisi=0; + //cas sur un noeud + if(intersection.isNodeIntersection()){ + int nbVoisins=voisinage.getNbNeighborMeshes(eltEnglob); + listeEltVoisins=new int[nbVoisins]; + for(int i=0;i<nbVoisins;i++){ + //On calcule la distance avec lequel de ces points??? + listeEltVoisins[i] =voisinage.getNeighborMesh(eltEnglob, i); + } + + }else { + //comment faire en fudaa pour les autres cas??? + } + + //calcul de la distance max + if(listeEltVoisins!=null && listeEltVoisins.length>0) + voisinChoisi=listeEltVoisins[0]; + for(int i=0;i<listeEltVoisins.length;i++){ + int eltVoisin=listeEltVoisins[i]; + // comment je fais pour avoir les coordonn\xE9es x et y du point eltVoisin??? + double x=0 ;//a remplacer par les coordonn\xE9es de eltVoisin + double y=0; + double distance=Math.sqrt((init.x_-x)*(init.x_-x) + (init.y_-y)*(init.y_-y) ); + if(distanceMaxEntrePoints>distance){ + + //ACHTUNG!! VERIFIER QUE LE t+ deltaT<dureeIntegration si on choisit cette distance + if(vy!=0 && (tempsTotal+ distance/vy<=dureeIntegration)){ + distanceMaxEntrePoints=distance; + voisinChoisi=eltVoisin; + } + } + } + + //on calcul le nouveau temps total + if(vy !=0) + tempsTotal+=distanceMaxEntrePoints/vy; + + + + + + + + } + //on verifie que l'on n'est pas inactif + if(oldTempsTotal==tempsTotal) + inactif=true; + } + + return listeIntersection_; +} + + + + +/** + * Recherche l'\xE9l\xE9lment englobant pour un point donn\xE9 + * @param _prReel + * @param grid + * @return + */ +public int elementEnglobant(final GrPoint _prReel) { + EfGridInterface grid=data_.getGrid(); + if (grid.getIndex() != null) { + final EfIndexVisitorNearestElt visitor = new EfIndexVisitorNearestElt(grid, _prReel.x_, _prReel.y_, 0); + grid.getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_prReel.x_, _prReel.y_, 0), visitor); + return visitor.isIn() ? visitor.getSelected() : -1; + } + else + return -1; + } + +@Override +public void buildNeighbor(ProgressionInterface _prog) { + // TODO Auto-generated method stub + +} + +@Override +public EfGridInterface getGrid() { + // TODO Auto-generated method stub + return data_.getGrid(); +} + +@Override +public EfGridDataInterpolator getGridData() { + // TODO Auto-generated method stub + return null; +} + +@Override +public EfNeighborMesh getNeighbor() { + // TODO Auto-generated method stub + return null; +} + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-02 16:17:18 UTC (rev 4024) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -343,7 +343,7 @@ } public String getTitle() { - return TrResource.getS("Bilans"); + return TrResource.getS("Cubatures"); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java 2008-10-02 18:32:19 UTC (rev 4025) @@ -0,0 +1,392 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.GridLayout; +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 javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTree; +import javax.swing.ListModel; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableModel; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluListSelection; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfComputeVolumeSeuil; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.ef.EfFilter; +import org.fudaa.dodico.ef.EfFilterSelectedElement; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; +import org.fudaa.ebli.commun.EbliSelectionMode; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.layer.MvElementLayer; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuCharValidator; +import com.memoire.bu.BuStringValidator; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuValueValidator; +import com.vividsolutions.jts.geom.LinearRing; + +public class TrPostDialogCurrentLine { +/** + * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque + */ + + +ArrayList<TrPostSource> source_; +TrPostCommonImplementation impl_; +TrComputeCurrentLine algoCalcul_; + +// donnees graphiques +JDialog dialog_; + +// variables et pdt +private JPanel panelVariables_; +ListModel modelVariables_; +JList listVar_; +ListModel modelPdt_; +JList listPdt_; + +// finesse et duree et point +private JPanel panelSeuil_; +BuTextField finesse_ = new BuTextField(5); +BuTextField duree_ = new BuTextField(5); +BuTextField x_ = new BuTextField(5); +BuTextField y_ = new BuTextField(5); + +// results +JPanel panelResults_; +JLabel results_; +JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); +DefaultTableModel modelResult_; + +/** + * Constructeur reserv\xE9 au calques + * + * @param _builderParams + * @param _calque + * @param _modelGraphe + * @param _panelVariables + * @param _source + */ +public TrPostDialogCurrentLine(TrPostProjet projet,TrPostCommonImplementation impl) { + impl_ = impl; + source_ = projet.listeSrc_; + modelVariables_ = source_.get(0).getNewVarListModel(); + modelPdt_ = source_.get(0).getNewTimeListModel(); + + // -- construction de la dialog --// + buildDialog(); +} + + + + + + + +private JPanel buildresults() { + JPanel conteneur = new JPanel(new BorderLayout()); + + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + results_ = new JLabel(""); + content.add(ajouter_); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(results_); + + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + + // -- action relatives aux resultats --// + ajouter_.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent _e) { + if (controleDataOk()) { + computeResults(); + } + } + + }); + + modelResult_ = new DefaultTableModel(); + + JTable tableauRes = new JTable(modelResult_); + conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); + conteneur.add(tableauRes, BorderLayout.CENTER); + conteneur.add(content, BorderLayout.SOUTH); + return conteneur; +} + +public boolean controleDataOk() { + + + if (finesse_.getText().equals("")) { + impl_.error(TrResource.getS("La finesse doit \xEAtre d\xE9fini par un r\xE9el ")); + return false; + } + if (duree_.getText().equals("")) { + impl_.error(TrResource.getS("La dur\xE9e doit \xEAtre d\xE9fini par un r\xE9el en secondes ")); + return false; + } + if (x_.getText().equals("")) { + impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); + return false; + } + if (y_.getText().equals("")) { + impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); + return false; + } + if (listVar_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir une variable")); + return false; + } + if (listPdt_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + return false; + } + return true; +} + +/** + * retourne la variable selectionnee + * + * @return + */ +protected H2dVariableType getSelectedVariable() { + + return (H2dVariableType) modelVariables_.getElementAt(listVar_.getSelectedIndex()); +} + +/** + * retourne l indice du pas de temps. + * + * @return + */ +protected int getSelectedTimeStep() { + return listPdt_.getSelectedIndex(); +} + +JList listeSources_; +DefaultListModel modelSources_; +private JPanel buildSources() { + JPanel conteneur = new JPanel(new BorderLayout()); + JPanel content = new JPanel(new GridLayout(1, 2)); + modelSources_=new DefaultListModel(); + for(TrPostSource source:source_) + modelSources_.addElement(source.getFile().getPath()); + listeSources_ = new JList(modelSources_); + listeSources_.setSelectedIndex(0); + listeSources_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + content.add(new JScrollPane(listeSources_)); + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du source"))); + conteneur.add(content, BorderLayout.CENTER); + + listeSources_.addListSelectionListener(new ListSelectionListener(){ + + @Override + public void valueChanged(ListSelectionEvent e) { + //reconstruction des models de var et de pdt + if(listeSources_.getSelectedIndex()!=-1){ + modelVariables_ = source_.get(listeSources_.getSelectedIndex()).getNewVarListModel(); + modelPdt_ = source_.get(listeSources_.getSelectedIndex()).getNewTimeListModel(); + listPdt_.setModel(modelPdt_); + listVar_.setModel(modelVariables_); + } + } + + }); + + return content; + } + + +private JPanel buildVariables() { + JPanel conteneur = new JPanel(new BorderLayout()); + JPanel content = new JPanel(new GridLayout(1, 2)); + listVar_ = new JList(modelVariables_); + listVar_.setSelectedIndex(0); + listPdt_ = new JList(modelPdt_); + listPdt_.setSelectedIndex(0); + listVar_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + listPdt_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + content.add(new JScrollPane(listVar_)); + content.add(new JScrollPane(listPdt_)); + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables et pas de temps"))); + conteneur.add(content, BorderLayout.CENTER); + conteneur.add(new JLabel(TrResource.getS("Veuillez s\xE9lectionner la variable et pas de temps")), BorderLayout.NORTH); + return content; +} + + +private JPanel buildParams() { + finesse_.setCharValidator(BuCharValidator.FLOAT); + finesse_.setStringVa... [truncated message content] |