From: <had...@us...> - 2008-08-28 17:25:43
|
Revision: 3847 http://fudaa.svn.sourceforge.net/fudaa/?rev=3847&view=rev Author: hadouxad Date: 2008-08-28 17:25:46 +0000 (Thu, 28 Aug 2008) Log Message: ----------- - ajout d'un menu dans le projectmanager pour gerer les ajout/suppression - g?\195?\169rer le cas bordure epaisseur 0 pour masquer la bordure - g?\195?\169rer le undo/redo duplicate - La gestion des duplicate unitaire est g?\195?\169r?\195?\169e (via le menu de la widget) - La gestion des duplicate simultan?\195?\169e est aussi g?\195?\169r?\195?\169e (via le bouton action duplicate et en selectionnant plusieurs widgets) - g?\195?\169rer proprement les tailles par defaut des legendes - Taille correctement calculee par rapport au nb d elements ajoutes - Resize impossible des legendes - tooltip pour les graphes - lors de la modification du libell?\195?\169, reformatte le label pour garder la meme taille et afficher le tout proprement. - les widgets legendes ne sont pas resizes pour les actions de resize min et max Horizontal et vertical. - correction du bug de position de la widget lors du undo/redo sur la suppression - convertisseur de la position de scene a local pour garder la position de la widget - Bordure: gestion intelligente du gapsLayout: - Si on augmente ou diminue la taille de la bordure, cela redimensionne la widget en consequence - synchroniser les graphes/calques avec leur legende: le masquage de l un fait masquer les legendes.... - Si l on masque le calque/graphe, la legende se masque automatiquement - si l on fait un undo sur cetet action, cela fait apparaitre les 2 simultanement - Si l' on d?\195?\169truit une legende, on peut la recreer en cliquant sur le menu 'ajouter legende' depuis le calque/graphe - si l on fait juste r?\195?\169apparaitre le calque/graphe cela ne fait pas reapparaitre la legende (normal) - si l'on fait disparaitre la legende, cela n a aucune incidence sur le calque/graphe - si l on veut creer une legende a partir du graphe/calque (menu popup clic droit): - Ne cree la legende que si il n en existe pas deja - fais apparaitre la legende si celle ci existe mais est cach?\195?\169e. - Gerer un BconfigureInterface specifique a chaque widget - les shape fleche et ellipse benificie de la rotation supplementaire - la widget bordure ne beneficie que des fonction du traceligneModel - synchronisation de l arbre et de la scene - la selection multiple dans la scene realise la meme selection multiple dans l arbre - de meme, la selection multiple dans l arbre realise la selection multiple dans la scene - un systeme de semaphore anti-cycle permet d eviter que les ecouteurs arbre et scene s appelle mutuellement Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.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/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/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/actions/CommandMasquer.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/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/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/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/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/EbliWidgetPlageTitle.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/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/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/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 Added Paths: ----------- 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/CommandeDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetLine.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -58,10 +58,10 @@ return preferedSize; } - public String toString() { - // TODO Auto-generated method stub - return title; - } + // public String toString() { + // // TODO Auto-generated method stub + // return title; + // } public boolean hasWidget() { return (getCreator() != null && getCreator().getWidget() != null); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -53,8 +53,10 @@ * * @return */ - public BConfigurableInterface[] getConfigureInterfaces() { - return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib + 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")) */}; @@ -70,11 +72,12 @@ * * @return */ - private BConfigurableInterface getSingleConfigureInterface() { + private BConfigurableInterface getSingleConfigureInterface(boolean lineModel_, boolean colorsContours_, + boolean colorFonds_, boolean rotations_, boolean police_) { // -- retourne l interface qui va bien qui permet de creer les composants // graphiques correspondant --// - return new WidgetConfigure(this); + return new WidgetConfigure(lineModel_, colorsContours_, colorFonds_, rotations_, police_, this); } 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -28,6 +28,11 @@ * @param scene */ public EbliWidgetBordure(EbliWidget _intern) { + this(_intern, true, true); + + } + + public EbliWidgetBordure(EbliWidget _intern, boolean canMove, boolean canResize) { super(_intern.getEbliScene(), false); intern_ = _intern; @@ -39,8 +44,7 @@ addChild(intern_); // --ajout du controller specifique au bordure --// - this.setController_(new EbliWidgetControllerActionOnly(this)); - + this.setController_(new EbliWidgetControllerActionOnly(this, canMove, canResize)); } @@ -57,23 +61,26 @@ Rectangle rec = getClientArea(); - if(epaisseurHisto_!=getTraceLigneModel().getEpaisseur()) + if (epaisseurHisto_ != getTraceLigneModel().getEpaisseur()) { setLayout(new OverlayLayoutGap(createInset((int) getTraceLigneModel().getEpaisseur()))); - - + 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(); 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,6 +3,7 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.ArrayList; import javax.swing.JDialog; import javax.swing.JMenuItem; @@ -15,6 +16,8 @@ import org.fudaa.ebli.controle.BConfigurePalette; 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.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.widget.Widget; @@ -30,23 +33,51 @@ public class EbliWidgetController { protected boolean canDuplicate_ = true; + public boolean isCanDuplicate_() { + return canDuplicate_; + } + + public boolean isCanMove_() { + return canMove_; + } + + public boolean isCanResize_() { + return canResize_; + } + + protected boolean canMove_ = true; + protected boolean canResize_ = true; private String description_; protected EbliWidget widget_; public EbliWidgetController(EbliWidget widget_) { + this(widget_, true, true, true); + - this.widget_ = widget_; - - // creation des actions par defaut - createdefaultAction(); - - // menu intern propre a la widget +} + + public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize) { + this(widget_, canMove, canResize, true); + } + + public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize, boolean canDuplicate) { + + this.widget_ = widget_; + canDuplicate_ = canDuplicate; + canMove_ = canMove; + canResize_ = canResize; + + + // creation des actions par defaut + createdefaultAction(); + + // menu intern propre a la widget setMenu(); + + } -} - /** * methode qui cree les actions par defaut pour la widget. * @@ -54,9 +85,12 @@ public void createdefaultAction() { // -- construction des actions --// widget_.getActions().addAction(widget_.getEbliScene().createSelectAction()); - widget_.getActions().addAction(ActionFactory.createResizeAction()); + if (canResize_) + widget_.getActions().addAction(ActionFactory.createResizeAction()); + widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); - widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); + if (canMove_) + widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); } @@ -68,35 +102,15 @@ this.description_ = description_; widget_.setToolTipText(description_); } - /** - * Methode de construction des menus de base - * - * @param _popup - */ - public void constructPopupMenuBase(JPopupMenu _popup) { + + + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add("Masquer l'objet"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); + menuItem.addActionListener(new ActionListener() { - // -- reference vers le gestionnaire de commandeundo/redo --// - final CtuluCommandContainer cmd_ = getWidget_().getEbliScene().getCmdMng(); - - JMenuItem menuItem3 = _popup.add("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); - } - - }); - - menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); - menuItem3.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - - // -- si la widget a une bordure c'est la bordure que l on masque --// EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); @@ -104,16 +118,44 @@ n.getCreator().getBordure().setVisible(false); cmd_.addCmd(new CommandMasquer(n.getCreator().getBordure())); } else { - widget_.setVisible(false); - cmd_.addCmd(new CommandMasquer(widget_)); + widget_.setVisible(false); + cmd_.addCmd(new CommandMasquer(widget_)); } - - - + } }); - if (canDuplicate_) { + } + + + protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add("Supprimer l'objet"); + 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); + + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + } + + }); + } + + 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() { @@ -138,6 +180,11 @@ // -- duplication de la taille --// duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().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(); } @@ -145,31 +192,38 @@ } }); - } + } + + /** + * Methode de construction des menus de base + * + * @param _popup + */ + public void constructPopupMenuBase(JPopupMenu _popup) { + + // -- reference vers le gestionnaire de commandeundo/redo --// + final CtuluCommandContainer cmd_ = getWidget_().getEbliScene().getCmdMng(); - JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); - menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem2.addActionListener(new ActionListener() { + JMenuItem menuItem3 = _popup.add("Informations"); + menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); + menuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - - EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - - //-- on enregistre la commande undo redo --// - cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_)); - - //-- on enleve le node de la scene --// - widget_.getEbliScene().removeNode(n); - - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); - + JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); } }); + constructMenuMasquer(_popup, cmd_); + + + if (canDuplicate_) { + constructMenuDupliquer(_popup, cmd_); + } + + constructMenuSupprimer(_popup, cmd_); + } /** @@ -212,7 +266,7 @@ BConfigurePalette palette = new BConfigurePalette(false); - BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); palette.setTargetConf(cmp); JDialog d = new JDialog(); 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -10,8 +10,13 @@ public class EbliWidgetControllerActionOnly extends EbliWidgetController { public EbliWidgetControllerActionOnly(EbliWidget widget_) { - super(widget_); + this(widget_, true, true); } + + + public EbliWidgetControllerActionOnly(EbliWidget widget_, boolean canMove, boolean canResize) { + super(widget_, canMove, canResize); + } /** * surcharge de la methode menu pour ne pas cree de sous menus. 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -14,9 +14,9 @@ } public EbliWidgetControllerMenuOnly(EbliWidget widget_, boolean canDuplicate) { - super(widget_); + super(widget_, true, true, canDuplicate); - canDuplicate_ = canDuplicate; + } 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -26,7 +26,7 @@ Rectangle rec = getClientArea(); // -- dessin de l'image --// - g.drawImage(image, rec.x, rec.y, rec.width, rec.height, this); + g.drawImage(image, rec.x, rec.y, rec.width - 1, rec.height - 1, this); } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,57 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; - -import org.fudaa.ebli.courbe.EGCourbe; -import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigne; - - -/** - * Legende - * Widget qui contient le trac\xE9 de la ligne de la l\xE9gende courbe - * @author genesis - * - */ -public class EbliWidgetLine extends EbliWidget { - - EGCourbe cb_; - - /** - * @param _scene - */ - public EbliWidgetLine(EbliScene _scene, EGCourbe _cb, Point preferedLocation) { - super(_scene, true); - cb_ = _cb; - setMinimumSize(new Dimension(30, 10)); - setPreferredSize(new Dimension(40, 10)); - - setEnabled(false); - - } - - /** - * - */ - @Override - protected void paintWidget() { - Graphics2D g = getGraphics(); - Rectangle rec = getClientArea(); - g.translate(rec.x, rec.y); - //la ligne - TraceLigne l = new TraceLigne(cb_.getLigneModel()); - l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); - //l'icone - TraceIconModel icm = new TraceIconModel(cb_.getIconModel()); - icm.setTaille(Math.min(rec.width / 2, rec.height));//a voir - TraceIcon ic = new TraceIcon(icm); - ic.paintIconCentre(g, rec.width / 2, rec.height / 2); - g.translate(-rec.x, -rec.y); - } - - -} 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -28,7 +28,11 @@ - // public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, + public ShapeCreator getShaper_() { + return shaper_; + } + + // public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, // couleurContour);//pour l'exempls /** * @return the rotation_ Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -0,0 +1,183 @@ +package org.fudaa.ebli.visuallibrary; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.DefaultListSelectionModel; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; + +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; +import org.netbeans.api.visual.model.ObjectSceneEvent; +import org.netbeans.api.visual.model.ObjectSceneListener; +import org.netbeans.api.visual.model.ObjectState; + +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. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetSynchroniser implements ObjectSceneListener, TreeSelectionListener { + + /** + * la scene a synchroniser. + */ + EbliScene scene_; + /** + * 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. + */ + boolean noCycle = true; + + 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); + + } + + + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { + } + + public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) { + } + + public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) { + } + + 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) { + } + + /** + * 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 " + noCycle); + if (noCycle) { + + // on bloque l'effet cycle + noCycle = false; + + if (newSelection != null && newSelection.size() != 0) { + + + + DefaultListSelectionModel model = new DefaultListSelectionModel(); + + for (Iterator<Object> it = newSelection.iterator(); it.hasNext();) { + // -- recuperation du node selectionne --// + 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(); + // mise a jour de la scene + scene_.refresh(); + + + } else { + arbre_.clearSelection(); + } + + + } + + // -- on signale que le danger du cycle est termin\xE9 + noCycle = true; + } + + + /** + * signal envoye par l arbre lors du changement de selection. + */ + public void valueChanged(TreeSelectionEvent e) { + FuLog.warning("NOCYCLE DE TREE " + noCycle); + if (noCycle) { + + noCycle = false; + + if (arbre_.getSelectedRows() != null && arbre_.getSelectedRows().length != 0) { + Set<Object> listeNodeSelect=new HashSet<Object>(); + + + + int[] indices = arbre_.getSelectedRows(); + + + + for (int i = 0; i < indices.length; i++) { + + MutableTreeTableNode treeNode = (MutableTreeTableNode) treeModel_.getChild(treeModel_.getRoot(), indices[i]); + + EbliNode nodeSelect = (EbliNode) treeNode.getUserObject(); + + FuLog.warning("tree selection: " + nodeSelect); + listeNodeSelect.add(nodeSelect); + + } + + + //on force la selection dans la scene + scene_.setSelectedObjects(listeNodeSelect); + + arbre_.validate(); + + // mise a jour de la scene + scene_.refresh(); + } + + } + + // -- on signale que le danger du cycle est termin\xE9 + noCycle = true; + + } + + + + + + +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,96 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Point; - -import org.fudaa.ebli.courbe.EGCourbe; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.TextFieldInplaceEditor; -import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.Scene; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.modules.visual.layout.FlowLayout; - - - -/** - * Legende - * Widget qui contient le titre de la ligne de la l\xE9gende courbe - * @author genesis - * - */ -public class EbliWidgetTitle extends EbliWidget implements TextFieldInplaceEditor{ - - EGCourbe cb_; - - LabelWidget intern; - - /** - * @param _scene - */ - public EbliWidgetTitle(EbliScene _scene, EGCourbe _cb,Point preferedLocation) { - super(_scene); - setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); - intern = new LabelWidget(_scene); - intern.setForeground(_cb.getAspectContour()); - addChild(intern); - setCourbe(_cb); - - //-- ajouter l option de remplacer le text dans le label --// - - //-- creation de l action --// - WidgetAction editorAction = ActionFactory.createInplaceEditorAction (this); - - //-- ajout de l action au label correspondant --// - intern.getActions ().addAction (editorAction); - - //setEnabled(false); - } - - public void majLabel(){ - intern.setForeground(cb_.getAspectContour()); - intern.setLabel(cb_.getTitle()); - } - -// @Override -// public void notifyStateChanged(ObjectState _previousState, ObjectState _newState) { -// } - - - /** - * @return the cb_ - */ - public EGCourbe getCourbe() { - return cb_; - } - - /** - * @param _cb the cb_ to set - */ - public void setCourbe(EGCourbe _cb) { - this.cb_ = _cb; - if (cb_ != null) { - intern.setLabel(cb_.getTitle()); - } - } - - public String getText(Widget widget) { - return ((LabelWidget) widget).getLabel (); - } - - public boolean isEnabled(Widget widget) { - // TODO Auto-generated method stub - return true; - } - - public void setText(Widget widget, String text) { - ((LabelWidget) widget).setLabel (text); - cb_.setTitle(text); - } - - - - -} \ No newline at end of file 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,5 +1,8 @@ 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; @@ -11,25 +14,44 @@ */ public class CommandMasquer implements CtuluCommand { - EbliWidget widget_; + ArrayList<EbliWidget> widget_; + private boolean visible_; + public CommandMasquer(EbliWidget widget) { + + widget_ = new ArrayList<EbliWidget>(); + widget_.add(widget); + + + } - public CommandMasquer(EbliWidget widget_) { + public CommandMasquer(ArrayList<EbliWidget> widget) { + this(widget, false); + + } + + public CommandMasquer(ArrayList<EbliWidget> widget, boolean visible) { super(); - this.widget_ = widget_; + this.widget_ = widget; + visible_ = visible; } - + public void undo() { - widget_.setVisible(true); - widget_.getEbliScene().refresh(); + for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { + it.next().setVisible(!visible_); + } + + widget_.get(0).getEbliScene().refresh(); } public void redo() { - widget_.setVisible(false); - widget_.getEbliScene().refresh(); + 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/CommandSupprimer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,9 +1,10 @@ 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; -import org.fudaa.ebli.visuallibrary.EbliWidget; /** * commande qui effectue un undo/redo sur la suppression. @@ -17,20 +18,20 @@ EbliScene scene_; - EbliWidget widget_; + Point location_; - public CommandSupprimer(EbliNode nodeSupprime_, EbliScene scene_, EbliWidget widget_) { + public CommandSupprimer(EbliNode nodeSupprime_, EbliScene scene_, Point _location) { super(); this.nodeSupprime_ = nodeSupprime_; this.scene_ = scene_; - this.widget_ = widget_; + location_ = _location; } public void redo() { // --rattachement du node dans la scene --// - widget_.getEbliScene().removeNode(nodeSupprime_); + scene_.removeNode(nodeSupprime_); // -- raffraichissement de la scene --// scene_.refresh(); @@ -40,8 +41,12 @@ public void undo() { // -- de nouveau suppression du node dans la scene --// - widget_.getEbliScene().addNode(nodeSupprime_); + scene_.addNode(nodeSupprime_); + // -- repositionnement originel de la widget --// + nodeSupprime_.getCreator().getWidget().setPreferredLocation( + nodeSupprime_.getCreator().getWidget().convertSceneToLocal(location_)); + // -- raffraichissement de la scene --// scene_.refresh(); } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -0,0 +1,75 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * 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); + } + } + + + /** + * redo unitaire pour une unique duplication + * + * @param widget + * @param nodeDuplique + */ + public void redo(EbliWidget widget, EbliNode nodeDuplique) { + // -- de nouveau suppression du node dans la scene --// + widget.getEbliScene().addNode(nodeDuplique); + + // -- raffraichissement de la scene --// + scene_.refresh(); + } + + public void undo() { + // -- redo unitaire execute pour chaque node dupliques --// + for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + undo(node.getCreator().getWidget(), node); + } + } + + public void undo(EbliWidget widget, EbliNode nodeDuplique) { + // --rattachement du node dans la scene --// + widget.getEbliScene().removeNode(nodeDuplique); + + // -- raffraichissement de la scene --// + scene_.refresh(); + } + +} 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -44,10 +44,11 @@ // necessaires --// // BConfigurableComposite cmp = new BConfigurableComposite(new // WidgetConfigure(found), "test"); - - BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); + + palette.setTargetConf(cmp); JDialog d = new JDialog(); d.setModal(true); @@ -59,6 +60,8 @@ } } + + EbliWidget findWidget() { Set objs = scene_.getSelectedObjects(); for (Iterator iterator = objs.iterator(); iterator.hasNext();) { 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,9 +3,9 @@ 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.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -29,11 +29,14 @@ */ private static final long serialVersionUID = 1L; EbliScene scene_; + final CtuluCommandContainer cmd_; public EbliWidgetActionDuplicate(EbliScene _scene){ super(EbliResource.EBLI.getString("dupliquer les objets s\xE9lectionn\xE9s"), CtuluResource.CTULU.getIcon("crystal_copier"), "DUPLICATE"); scene_=_scene; putValue(NAME,"Duplication des \xE9lements s\xE9lectionn\xE9s"); + cmd_ = _scene.getCmdMng(); + } @@ -44,8 +47,11 @@ Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); - List<EbliNode> listeNodeADupliquer=new ArrayList<EbliNode>(); + ArrayList<EbliNode> listeNodeADupliquer = new ArrayList<EbliNode>(); + + ArrayList<EbliNode> listeNouveauxNodes = new ArrayList<EbliNode>(); + //-- parcours des nodes for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ @@ -73,6 +79,8 @@ //-- ajout du node dans la scene --// scene_.addNode(node); + // -- ajout du noeud --// + listeNouveauxNodes.add(node); // -- duplication des map de property graphique de la widget --// node.getCreator().getWidget().propGraphique = currentNode.getCreator().getWidget() @@ -86,6 +94,9 @@ } } + // -- creation de l action undo/redo pour les nodes --// + cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -4,6 +4,7 @@ import java.awt.Rectangle; 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; @@ -56,10 +57,20 @@ // TODO Auto-generated method stub // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNodeAutorises = new HashSet<EbliNode>(); Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- on retire de la liste tous les noeuds dont les widgets ne sont pas + // retaillables --// + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode node = it.next(); + if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize_()) + listeNodeAutorises.add(node); + } + //-- recherche du Min/Max selon choix constructeur --// - Iterator<EbliNode> it = listeNode.iterator(); + Iterator<EbliNode> it = listeNodeAutorises.iterator(); Rectangle tailleAresize = null; if (it.hasNext()){ tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); @@ -82,7 +93,7 @@ return; - //-- recupere les anciennes color --// + // -- recupere les anciennes tailles --// List<Rectangle> oldRectangle = new ArrayList<Rectangle>(); List<Rectangle> newRectangle = new ArrayList<Rectangle>(); //-- liste des widget selectionnees --// @@ -90,7 +101,7 @@ // -- parcours des nodes - for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { + for (Iterator<EbliNode> it2 = listeNodeAutorises.iterator(); it2.hasNext();) { 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -4,6 +4,7 @@ import java.awt.Rectangle; 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; @@ -56,10 +57,20 @@ // TODO Auto-generated method stub // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNodeAutorises = new HashSet<EbliNode>(); Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- on retire de la liste tous les noeuds dont les widgets ne sont pas + // retaillables --// + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode node = it.next(); + if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize_()) + listeNodeAutorises.add(node); + } + // -- recherche du Min/Max selon choix constructeur --// - Iterator<EbliNode> it = listeNode.iterator(); + Iterator<EbliNode> it = listeNodeAutorises.iterator(); Rectangle tailleAresize = null; if (it.hasNext()) { tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); @@ -88,7 +99,7 @@ java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); // -- parcours des nodes - for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { + for (Iterator<EbliNode> it2 = listeNodeAutorises.iterator(); it2.hasNext();) { EbliNode currentNode = it2.next(); if (currentNode != null && currentNode.hasWidget()) { 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,11 +3,13 @@ import java.awt.Font; import java.awt.Frame; import java.awt.event.ActionEvent; +import java.util.ArrayList; 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.BConfigurableInterface; import org.fudaa.ebli.controle.BSelecteurColorChooserBt; import org.fudaa.ebli.controle.BSelecteurFont; @@ -17,6 +19,11 @@ import org.fudaa.ebli.controle.BSelecteurSlider; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; +import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; /** * classe qui permet de creer les selecteurs necessaires pour la configuration. @@ -27,10 +34,26 @@ public class WidgetConfigure implements BConfigurableInterface { - EbliWidget widget; + EbliWidget widget_; + boolean lineModel_; + boolean colorsContours_; + boolean colorFonds_; + boolean rotations_; + boolean police_; + + public WidgetConfigure(boolean lineModel_, boolean colorsContours_, boolean colorFonds_, boolean rotations_, + boolean police_, EbliWidget widget_) { + this.colorFonds_ = colorFonds_; + this.colorsContours_ = colorsContours_; + this.lineModel_ = lineModel_; + this.police_ = police_; + this.rotations_ = rotations_; + this.widget_ = widget_; + } + public WidgetConfigure(EbliWidget widget) { - this.widget = widget; + this(true, true, true, true, true, widget); } /** @@ -38,21 +61,28 @@ */ public BSelecteurInterface[] createSelecteurs() { - + ArrayList<BSelecteurInterface> listeComposants = new ArrayList<BSelecteurInterface>(); + + // -- model des lignes --// + if (lineModel_) { BSelecteurLineModel modelL = new BSelecteurLineModel(EbliWidget.LINEMODEL); modelL.setAddColor(false); - - + listeComposants.add((BSelecteurInterface) modelL); + } // -- model des colors contours --// + if (colorsContours_) { BSelecteurColorChooserBt modelCc = new BSelecteurColorChooserBt(EbliWidget.COLORCONTOUR); modelCc.setTitle("Choix couleur contour"); - + listeComposants.add((BSelecteurInterface) modelCc); + } // -- model des colors de fond --// + if (colorFonds_) { BSelecteurColorChooserBt modelCf = new BSelecteurColorChooserBt(EbliWidget.COLORFOND); modelCf.setTitle("Choix couleur de fond"); - + listeComposants.add((BSelecteurInterface) modelCf); + } // -- model des rotations --// // BSelecteurMolette molette = new BSelecteurMolette(EbliWidget.ROTATION); // molette.setTitle("Rotation"); @@ -60,14 +90,19 @@ // molette.setTooltip( // "Effectuer des drag and drop pour faire tourner le composant"); // - + if (rotations_) { BSelecteurSlider slider = new BSelecteurSlider(EbliWidget.ROTATION, 0, 360); slider.setTitle("Rotation"); slider.slider_.setMajorTickSpacing(45); slider.slider_.setPaintTicks(true); // 0, 90, 180,270 - + listeComposants.add((BSelecteurInterface) slider); + + } + + // -- model des font --// + if (police_) { BSelecteurFont modelF = new BSelecteurFont(EbliWidget.FONT) { public void actionPerformed(final ActionEvent _e) { final Frame f = CtuluLibSwing.getFrameAncestorHelper(bt_); @@ -96,11 +131,54 @@ modelF.bt_.setText("Choisir"); modelF.setTitle("Police"); modelF.bt_.setFont(new Font("Helvetica.Italic", Font.PLAIN, 12)); - return new BSelecteurInterface[] { modelL, modelCc, modelCf, modelF, slider }; + + listeComposants.add((BSelecteurInterface) modelF); } + BSelecteurInterface[] tableau = new BSelecteurInterface[listeComposants.size()]; + return listeComposants.toArray(tableau); + } + + /** + * Methode qui envoie les configurations specifiques en fonctions du type de + * widget qui les demande + * + * @param found + * la widget qui fait appel au service + * @return la configuration disponible + */ + 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 EbliWidgetBordure) { + colorFonds_ = false; + rotations_ = false; + police_ = 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; + } + + } + + palette = new BConfigurableComposite(found.getConfigureInterfaces(lineModel_, colorsContours_, colorFonds_, + rotations_, police_), "palette"); + + return palette; + } + + public BConfigurableInterface[] getSections() { return null; } @@ -119,6 +197,6 @@ } public BSelecteurTargetInterface getTarget() { - return widget; + return widget_; } } 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -5,6 +5,7 @@ package org.fudaa.ebli.visuallibrary.calque; import java.awt.Component; +import java.awt.Dimension; import java.awt.Point; import javax.swing.JLabel; @@ -36,8 +37,16 @@ BCalqueLegendePanel legendePanel_; - + public static int LENGHT_PER_LEGENDE = 15; + public static int WIDTH_PER_LEGENDEICON = 10; + public static int WIDTH_PER_LEGENDETEXT = 130; + public static int WIDTH_LEGENDE = 200; + public static int MAX_BORDURE = 12; + public static Dimension createSizeForWidget(int _nbLibelles) { + return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + } + public EbliWidgetCalqueLegende(EbliScene _scene) { super(); scene_ = _scene; @@ -97,10 +106,11 @@ // --creation de la widget conteneur --// + BPalettePlageInterface listeplages = null; EbliWidget widgetLegende_ = new EbliWidget(_scene, false); widgetLegende_.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); - + if (_calqueLegende != null) { Component[] listeC=_calqueLegende.getComponents(); for(int i=0;i<listeC.length;i++){ @@ -119,7 +129,7 @@ BPalettePlageLegende pal = (BPalettePlageLegende) c; // --recuperation de la liste des plages --// - BPalettePlageInterface listeplages = pal.getModel(); + listeplages = pal.getModel(); for (int j = 0; j < listeplages.getNbPlages(); j++) { @@ -132,6 +142,7 @@ lw.setUseBorder(false); lw.setEnabled(false); + lw.setEnabled(false); widgetLegende_.addChild(lw); @@ -143,8 +154,16 @@ } widgetLegende_.setController_(new EbliWidgetControllerMenuOnly(widgetLegende_, false)); + + // -- creation de la taille de la widget --// + if (listeplages != null) + widgetLegende_.setPreferredSize(createSizeForWidget(listeplages.getNbPlages() + 1)); + + return widgetLegende_; + } else + return null; } } 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,13 +3,17 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.ArrayList; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliWidget; 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; @@ -20,7 +24,8 @@ /** * controller specifique pour les actions de la widget du calque. le calque ne - * cree aucune action par default. + * cree aucune action par default. De plus surcharge de la methode de masquage: + * la widget se masque avec sa widget legende. * * @author Adrien Hadoux. * @@ -42,22 +47,22 @@ this.legendeWidget_ = legendeWidget_; } - EbliWidgetVueCalque widget2_; + EbliWidgetVueCalque widgetCalque_; public EbliWidgetControllerCalque(EbliWidgetVueCalque widget_) { super(widget_); - widget2_ = widget_; + widgetCalque_ = widget_; addActionSpecifiques(); } public EbliNode getNodeLegende() { - return widget2_.nodeLegende; + return widgetCalque_.nodeLegende; } public void setNodeLegende(EbliNode node) { - widget2_.nodeLegende = node; + widgetCalque_.nodeLegende = node; } public void addActionSpecifiques() { @@ -68,6 +73,58 @@ } + + + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add("Masquer l'objet"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); + menuItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + // -- si la widget a une bordure c'est la bordure que l on masque --// + EbliWidget widgetUndo1 = null; + EbliWidget widgetUndo2 = null; + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + if (n.getCreator().getBordure() != null) { + // -- on masque le calque --// + n.getCreator().getBordure().setVisible(false); + + + widgetUndo1 = n.getCreator().getBordure(); + + + } else { + widget_.setVisible(false); + widgetUndo1 = widget_; + + } + + + // -- on masque sa legende associee --// + if (widgetCalque_.nodeLegende.getCreator().getBordure() != null) { + widgetCalque_.nodeLegende.getCreator().getBordure().setVisible(false); + widgetUndo2 = widgetCalque_.nodeLegende.getCreator().getBordure(); + } else { + widgetCalque_.nodeLegende.getCreator().getWidget().setVisible(false); + widgetUndo2 = widgetCalque_.nodeLegende.getCreator().getWidget(); + } + + + // -- creation des comamndes undo/redo pour le masquage --// + ArrayList<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + listeWidget.add(widgetUndo1); + listeWidget.add(widgetUndo2); + + cmd_.addCmd(new CommandMasquer(listeWidget)); + + } + + }); + } + + /** * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ @@ -114,7 +171,9 @@ setNodeLegende(legendeWidget_.createLegende()); widget_.getEbliScene().refresh(); - } + } else if (getNodeLegende().hasWidget()) + // -- cas ou la legende existe mais est cach\xE9e --// + getNodeLegende().getCreator().getWidget().setVisible(true); // GrapheWidget.this.addChild(widgetLegende); } 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-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -36,7 +36,7 @@ } public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetBordure(EbliWidgetCalqueLegende.createLegendeWidget(g, _scene)); + res = new EbliWidgetBordure(EbliWidgetCalqueLegende.createLegendeWidget(g, _scene), true, false); // g.getModel().addModelListener(new EbliWidgetGrapheController(res)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/c... [truncated message content] |