From: <had...@us...> - 2008-08-15 16:32:06
|
Revision: 3808 http://fudaa.svn.sourceforge.net/fudaa/?rev=3808&view=rev Author: hadouxad Date: 2008-08-15 16:32:08 +0000 (Fri, 15 Aug 2008) Log Message: ----------- - Action retaillage Min et Max + Undo/redo g?\195?\169r?\195?\169 - Gestion de toutes les properties graphique des widget dans une map - Gestion de la duplication des propri?\195?\169t?\195?\169s graphiques lors de la duplication d elements - Actions de configurations des propri?\195?\169t?\195?\169es graphiques toutes impl?\195?\169ment?\195?\169es en utilisant els BConfigureInterfaces: selection de la widget+ clic sur configuration - modifications des traceligneModels ( trait, taille) - modification des couleurs de contours - modification des couleurs de remplissage - modification de la fonte (pour le rectangle qui contient du texte c'est ok) - modification de la rotation - Gestion des Undo/ redo sur les proprietes graphiques ! (sur les map de composants graphiques) toutes les undo/redo sont ok (rotation, couleur contour, fond, tracelignemodel, font) - Refontes des fonction des popumenu des widgets: - Masquer, configuration, duplication, suppression - Creation des undo/redo pour les arrieres/avant plans il faudrait que l arbre tienne compte des changements des widgets dans la sc?\195?\168ne pour repositionner son ordre - Refonte du rectangle qui contient le texte , il peut ?\195?\170tre modifie comme les elbiShape sauf la rotation -integration dans prepro Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.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/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.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/EbliWidgetActionBackGround.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/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.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/CommandBringToFront.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/CommandeBringToBack.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/EbliWidgetActionRetaillage.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurFont.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -15,12 +15,11 @@ import javax.swing.JComponent; import javax.swing.JDialog; -import com.memoire.bu.BuButton; - import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.ebli.commun.EbliLib; +import com.memoire.bu.BuButton; + /** * @author fred deniger * @version $Id: BSelecteurFont.java,v 1.4 2007-05-22 14:19:05 deniger Exp $ @@ -48,7 +47,7 @@ } - BuButton bt_ = new BuButton(); + public BuButton bt_ = new BuButton(); public BSelecteurFont(final String _property) { super(_property); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurSlider.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -18,7 +18,7 @@ */ public class BSelecteurSlider extends BSelecteurAbstract implements ChangeListener { - final JSlider slider_; + public final JSlider slider_; public BSelecteurSlider(final String _property, final int _min, final int _max) { this(_property, new JSlider(_min, _max)); 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-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -46,9 +46,13 @@ // instance pas identifie, impossible de dupliquer return null; } - + + + + + // recopie des tailles duplique.setPreferedSize(getPreferedSize()); - + // -- calcul nouvelle position Point nouvellePosition = new Point(getCreator().getWidget().getLocation().x, (int) (getCreator().getWidget() .getLocation().y + getCreator().getWidget().getClientArea().height)); 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-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -6,8 +6,10 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; +import java.util.HashMap; import java.util.Map; +import javax.swing.JDialog; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -15,10 +17,11 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; -import org.fudaa.ebli.controle.BConfigurePaletteTargetInterface; -import org.fudaa.ebli.controle.BSelecteurInterface; -import org.fudaa.ebli.controle.BSelecteurLineModel; +import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.controle.BSelecteurTargetInterface; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; +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.model.ObjectState; @@ -30,71 +33,147 @@ * @author Adrien Hadoux * */ -public class EbliWidget extends Widget implements BConfigurePaletteTargetInterface, BSelecteurTargetInterface { +public class EbliWidget extends Widget implements BSelecteurTargetInterface { private EbliScene scene_; - Map propGraphique; + /** + * Map contenant tous les objets graphiques de la widget generique. key: + * lineModel => le lignemodel du ebliWidget. key: color => couleur de fond. + * + */ + public Map propGraphique; + + + /** + * Liste des clef utilisees pour les composants graphiques + */ + 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"; + + private boolean useBorder_ = true; + /** + * retourne la liste des interfaces configurees. + * + * @return + */ public BConfigurableInterface[] getConfigureInterfaces() { return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib - .getS("Affichage")) }; + .getS("Affichage")) /* + * , new + * BConfigurableComposite(getSingleConfigureInterface + * (), EbliLib.getS("Gizmo caca")) + */}; } + + /** + * Retourne une interface widgetConfigure qui permet de gerer les interfaces a + * creer + * + * @return + */ private BConfigurableInterface getSingleConfigureInterface() { - // return new EGCourbeConfigureTarget.Display(this) - return new BConfigurableInterface() { + + // -- retourne l interface qui va bien qui permet de creer les composants + // graphiques correspondant --// + return new WidgetConfigure(this); - public void stopConfiguration() { - } - - public BSelecteurTargetInterface getTarget() { - return EbliWidget.this; - } - - public BSelecteurInterface[] createSelecteurs() { - return new BSelecteurInterface[] { new BSelecteurLineModel() }; - } - - public String getTitle() { - return "test"; - } - - public BConfigurableInterface[] getSections() { - return null; - } - }; - } - public BSelecteurTargetInterface getVisibleTitleTarget() { - // FIXME voir EGObjectConfigureVisibleTarget(this) - return null; - } + public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { // voir EGObject + } - + + // useless public Object getMin(String _key) { return null; } - + // useless public Object getMoy(String _key) { return null; } + /** + * Retourne l objet correspondant a la clef: retourne l objet graphique + * correspondant depuis la map d objets graphiques de la widget. + */ public Object getProperty(String _key) { + + System.err.println("suis dans getProperty key= " + _key); + + // -- cas particulier si il s agit de la rotation --// + // -- il faut transformer les degres en radian --// + if (_key.equals(ROTATION)) { + + double radian = getRotation(); + int degre = (int) (radian * 180 / Math.PI); + return new Integer(degre); + + } + + return propGraphique.get(_key); - // return new TraceLigneModel(); } public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { } + /** + * 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) { - return false; + + System.err.println("Je suis rentre dans setProperty key= " + _key); + + + + + // --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); + 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().cmdMng_ != null) { + getEbliScene().cmdMng_.addCmd(undoRedo); + } + + // -- mise a jour des parametres de la map --// + refreshMyProperties(); + + return true; } public boolean isTitleModifiable() { @@ -109,6 +188,28 @@ 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); + + + + //-- construction des actions --// getActions().addAction(scene.createSelectAction()); getActions().addAction(ActionFactory.createResizeAction()); getActions().addAction(scene.createWidgetHoverAction()); @@ -128,6 +229,46 @@ * @param _popup */ public void constructPopupMenuBase(JPopupMenu _popup) { + + JMenuItem menuItem4 = _popup.add("Configuration graphique"); + menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); + // BuResource.BU.getIcon("configurer") + menuItem4.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliWidget found = EbliWidget.this; + + BConfigurePalette palette = new BConfigurePalette(false); + + BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + + palette.setTargetConf(cmp); + JDialog d = new JDialog(); + d.setModal(true); + d.setTitle("Configuration graphique"); + d.setContentPane(palette); + + d.pack(); + d.setVisible(true); + + } + + }); + + JMenuItem menuItem3 = _popup.add("Masquer l'objet"); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliWidget.this.setVisible(false); + + } + + }); + + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -146,10 +287,15 @@ // -- ajout dans la scene --// if (duplique != null && EbliWidget.this.getScene() != null) { EbliWidget.this.getEbliScene().addNode(duplique); - // info debug widget duplique - //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator(). - // getWidget().getPreferredBounds()); + + // -- duplication des map de property graphique de la widget --// + duplique.getCreator().getWidget().propGraphique = n.getCreator().getWidget().duplicateGraphicalProperties(); + // -- duplication de la taille --// + duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); + + + // -- raffraichissement de la scene --// EbliWidget.this.getEbliScene().refresh(); } @@ -157,7 +303,14 @@ } }); - JMenuItem menuItem2 = _popup.add("Fermer l'objet"); + + + + + + + + JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem2.addActionListener(new ActionListener() { @@ -172,18 +325,7 @@ } }); - - JMenuItem menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); - menuItem3.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - EbliWidget.this.setVisible(false); - - } - - }); + } /** @@ -242,31 +384,79 @@ } /** - * Methode a surcharger pour la recuperation des colors - * - * @param newColor + * Methode qui raffraichis les proprietes de la widget. */ - public void setColorContour(Color newColor) { + public void refreshMyProperties() { + getEbliScene().refresh(); + } + + + public Map duplicateGraphicalProperties() { + + Map 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; } + + /** + * Retourne les proprietes de la map. + */ + public TraceLigneModel getTraceLigneModel() { + return (TraceLigneModel) propGraphique.get(LINEMODEL); + } + + public void setTraceLigneModel(TraceLigneModel _l) { + propGraphique.put(LINEMODEL, _l); + } + + + + + public void setColorContour(Color newColor) { + propGraphique.put(COLORCONTOUR, newColor); + } + public Color getColorContour() { - return null; + return (Color) propGraphique.get(COLORCONTOUR); } public void setColorFond(Color newColor) { - + propGraphique.put(COLORFOND, newColor); } public Color getColorFond() { - return null; + return (Color) propGraphique.get(COLORFOND); } + + 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 setRotation(double rotation) { + propGraphique.put(ROTATION, rotation); + } + + public Font getFormeFont() { - return null; + return (Font) propGraphique.get(FONT); + } public void setFormeFont(Font newFont) { - + propGraphique.put(FONT, newFont); } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,16 +1,13 @@ 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.awt.Shape; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; 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.widget.LabelWidget; @@ -32,8 +29,7 @@ int largeurBorder = 15; int espaceInterieur = 5; - public Color couleurContour=Color.black; - public Color couleurFond=Color.white; + public Font fontForme; /** @@ -51,7 +47,8 @@ intern = new LabelWidget(_scene); intern.setVerticalAlignment(VerticalAlignment.CENTER); intern.setAlignment(Alignment.CENTER); - + intern.setFont(getFormeFont()); + intern.setLabel(label); //-- layout du texte --// @@ -88,25 +85,35 @@ } protected void paintWidget() { - Graphics2D g = getGraphics(); + + // -- mise a jour de la fonte que si il y a eu une modification --// + if (intern.getFont() != getFormeFont()) + intern.setFont(getFormeFont()); + if (intern.getForeground() != getColorContour()) + intern.setForeground(getColorContour()); + + + Graphics2D g = getGraphics(); + Rectangle rec = getClientArea(); //-- couleur de fond --// - g.setColor(couleurFond); - g.fillRect(0, 0, rec.width, rec.height); + // g.setColor(getColorFond()); + // g.fillRect(0, 0, rec.width, rec.height); g.translate(rec.x, rec.y); // la ligne - TraceLigne l = new TraceLigne(); - l.setCouleur(couleurContour); - l.setEpaisseur(largeurBorder); - // l.dessineTrait(g, 0, 0, rec.width, rec.height / 2); - l.dessineRectangle(g, l.getEpaisseur() / 2, l.getEpaisseur() / 2, - rec.width - l.getEpaisseur(), rec.height - l.getEpaisseur()); + 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); @@ -115,6 +122,7 @@ } public String getText(Widget widget) { + return ((LabelWidget) widget).getLabel(); } @@ -130,38 +138,13 @@ } - public void setColorContour(Color newColor){ - couleurContour=newColor; - intern.setForeground(couleurContour); - repaint(); - } + + - public Color getColorContour(){ - return couleurContour; - } - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); - } - public Color getColorFond(){ - return couleurFond; - } - public Font getFormeFont(){ - return fontForme; - } - public void setFormeFont(Font newFont){ - fontForme=newFont; - intern.setFont(fontForme); - intern.revalidate(); - revalidate(); - repaint(); - - } - } \ No newline at end of file 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-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -13,7 +13,6 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; -import org.netbeans.api.visual.widget.Scene; /** * Classe qui permet de dessinner des shapes. @@ -25,35 +24,36 @@ Map options_; ShapeCreator shaper_; - double rotation_; + // double rotation_; - public Color couleurFond=Color.white; - public Color couleurContour=Color.black; + - public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, couleurContour);//pour l'exempls + // public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, + // couleurContour);//pour l'exempls /** * @return the rotation_ */ - public double getRotation() { - return rotation_; - } + // public double getRotation() { + // return rotation_; + // } + // + // /** + // * @param rotation_ the rotation_ to set + // */ + // public void setRotation(double rotation_) { + // this.rotation_ = rotation_; + // // Dimension dim = getPreferredSize(); + // // if (dim != null) { + // // Shape rec = new Rectangle(0, 0, dim.width, dim.height); + // // AffineTransform tr = AffineTransform.getRotateInstance(dim.width / 2, + // dim.height / 2, rotation_); + // // Rectangle bounds2 = tr.createTransformedShape(rec).getBounds(); + // // dim.height = bounds2.height; + // // dim.width = bounds2.width; + // // setPreferredSize(dim); + // // } + // } - /** - * @param rotation_ the rotation_ to set - */ - public void setRotation(double rotation_) { - this.rotation_ = rotation_; - // Dimension dim = getPreferredSize(); - // if (dim != null) { - // Shape rec = new Rectangle(0, 0, dim.width, dim.height); - // AffineTransform tr = AffineTransform.getRotateInstance(dim.width / 2, dim.height / 2, rotation_); - // Rectangle bounds2 = tr.createTransformedShape(rec).getBounds(); - // dim.height = bounds2.height; - // dim.width = bounds2.width; - // setPreferredSize(dim); - // } - } - public EbliWidgetShape (EbliScene scene, ShapeCreator _shaper, Map _options) { super(scene); super.setCheckClipping(true); @@ -62,6 +62,10 @@ options_.putAll(_options); } shaper_ = _shaper; + + // --mise a jour de la propriete graphique du traceligneModel de la map --// + propGraphique.put("lineModel", new TraceLigneModel(TraceLigne.LISSE, 5, getColorContour())); + } /** @@ -73,17 +77,22 @@ Rectangle recInit = getClientArea(); // AffineTransform oldTr = g.getTransform(); - - TraceLigne tl = new TraceLigne(tl_); + // -- creation du traceligne --// + TraceLigne tl = new TraceLigne(getTraceLigneModel()); + + // -- mise a jour de la couleur du contour --// + getTraceLigneModel().setCouleur(getColorContour()); + + AffineTransform oldTr = g.getTransform(); g.translate(recInit.x, recInit.y); - float ep = tl_.getEpaisseur(); + float ep = tl.getEpaisseur(); //Il faut prendre en compte l'epaisseur de la ligne Rectangle2D.Float rec = new Rectangle2D.Float(ep / 2, ep / 2, recInit.width - ep, recInit.height - ep); Shape shape = shaper_.createShapeFor(rec, options_, ep); - if (rotation_ != 0) { - AffineTransform tr = AffineTransform.getRotateInstance(rotation_, rec.getCenterX(), rec.getCenterY()); + if (getRotation() != 0) { + AffineTransform tr = AffineTransform.getRotateInstance(getRotation(), rec.getCenterX(), rec.getCenterY()); shape = tr.createTransformedShape(shape); Rectangle2D newBound = shape.getBounds2D(); double wRatio = rec.width / newBound.getWidth(); @@ -100,7 +109,7 @@ g.setPaint(fg_); //--couleur de fond --// - g.setColor(couleurFond); + g.setColor(getColorFond()); g.fill(shape); @@ -120,45 +129,33 @@ return fg_; } + /** - * @return the tl_ - */ - public TraceLigneModel getTraceLigneModel() { - return tl_; - } - - /** * @param _fg the fg to set */ public void setFg(Paint _fg) { this.fg_ = _fg; } - /** - * @param _tl the tl_ to set - */ - public void setTraceLigneModel(TraceLigneModel _tl) { - this.tl_ = _tl; - } - public void setColorContour(Color newColor){ - couleurContour=newColor; - tl_.setCouleur(newColor); - repaint(); - } - - public Color getColorContour(){ - return couleurContour; - } +// 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 void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); - } - - public Color getColorFond(){ - return couleurFond; - } - } Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandBringToFront.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,50 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Classe qui permet de faire un undo redo sur le front/back + * + * @author Adrien Hadoux + * + */ +public class CommandBringToFront implements CtuluCommand { + + List<EbliWidget> widgets_; + + public CommandBringToFront(List<EbliWidget> widgets_) { + super(); + this.widgets_ = widgets_; + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToFront(); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToBack(); + + } + refreshScene(); + } + +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,60 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Color; - -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - - -public class CommandColorContour implements CtuluCommand { - - - List<Color> oldColor; - Color newColor; - java.util.List<EbliWidget> widgets_; - - - - public CommandColorContour(List<EbliWidget> listeWidget, - List<Color> oldColor,Color newColor) { - super(); - this.widgets_ = listeWidget; - this.newColor = newColor; - this.oldColor = oldColor; - if (widgets_.size() != oldColor.size()) - throw new IllegalArgumentException("list must ahava the same size"); - - } - - - - public void undo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorContour(oldColor.get(i)); - - } - refreshScene(); - } - - private void refreshScene() { - EbliScene.refreshScene(widgets_.get(0).getScene()); - } - - public void redo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorContour(newColor); - - } - refreshScene(); - } - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,59 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Color; -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - - -public class CommandColorFond implements CtuluCommand { - - - List<Color> oldColor; - Color newColor; - java.util.List<EbliWidget> widgets_; - - - - public CommandColorFond(List<EbliWidget> listeWidget, - List<Color> oldColor,Color newColor) { - super(); - this.widgets_ = listeWidget; - this.newColor = newColor; - this.oldColor = oldColor; - if (widgets_.size() != oldColor.size()) - throw new IllegalArgumentException("list must ahava the same size"); - - } - - - - public void undo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorFond(oldColor.get(i)); - - } - refreshScene(); - } - - private void refreshScene() { - EbliScene.refreshScene(widgets_.get(0).getScene()); - } - - public void redo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setColorFond(newColor); - - } - refreshScene(); - } - -} \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,64 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Color; -import java.awt.Font; -import java.util.List; - -import org.fudaa.ctulu.CtuluCommand; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - -/** - * Commande pour le undo redo sur les fontes - * @author Adrien Hadoux - * - */ -public class CommandFont implements CtuluCommand { - - - List<Font> oldFonts; - Font newFont; - java.util.List<EbliWidget> widgets_; - - - - public CommandFont(List<EbliWidget> listeWidget, - List<Font> oldFont,Font newFont) { - super(); - this.widgets_ = listeWidget; - this.newFont = newFont; - this.oldFonts = oldFont; - if (widgets_.size() != oldFont.size()) - throw new IllegalArgumentException("list must ahava the same size"); - - } - - - - public void undo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setFormeFont(oldFonts.get(i)); - - } - refreshScene(); - } - - private void refreshScene() { - EbliScene.refreshScene(widgets_.get(0).getScene()); - } - - public void redo() { - final int nb = widgets_.size(); - if (nb == 0) - return; - for (int i = 0; i < nb; i++) { - widgets_.get(i).setFormeFont(newFont); - - } - refreshScene(); - } - -} \ No newline at end of file Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,58 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Rectangle; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Commande pour le undo redo sur les retaillages. + * + * @author Adrien Hadoux + * + */ +public class CommandRetaillage implements CtuluCommand { + + List<Rectangle> oldRectangles; + Rectangle newRectangle; + java.util.List<EbliWidget> widgets_; + + public CommandRetaillage(List<EbliWidget> listeWidget, List<Rectangle> oldRectangle, Rectangle newRectangle) { + super(); + this.widgets_ = listeWidget; + this.newRectangle = newRectangle; + this.oldRectangles = oldRectangle; + 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; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setPreferredBounds(oldRectangles.get(i)); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).setPreferredBounds(newRectangle); + + } + refreshScene(); + } + +} \ No newline at end of file Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeBringToBack.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,50 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.List; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Classe qui permet de faire un undo redo sur le front/back + * + * @author Adrien Hadoux + * + */ +public class CommandeBringToBack implements CtuluCommand { + + List<EbliWidget> widgets_; + + public CommandeBringToBack(List<EbliWidget> widgets_) { + super(); + this.widgets_ = widgets_; + } + + public void redo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToBack(); + + } + refreshScene(); + } + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } + + public void undo() { + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).bringToFront(); + + } + refreshScene(); + } + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -0,0 +1,89 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.fudaa.ctulu.CtuluCommand; +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(); + this.newGraphicalProperties = newGraphicalProperties; + this.oldGraphicalProperties = oldGraphicalProperties; + this.widgets_ = widgets_; + } + + /** + * 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; + for (int i = 0; i < nb; i++) { + widgets_.get(i).propGraphique = oldGraphicalProperties.get(i); + + } + refreshScene(); + + + } + + public void redo() { + + final int nb = widgets_.size(); + if (nb == 0) + return; + for (int i = 0; i < nb; i++) { + widgets_.get(i).propGraphique = newGraphicalProperties.get(i); + + } + refreshScene(); + } + + + + private void refreshScene() { + EbliScene.refreshScene(widgets_.get(0).getScene()); + } +} 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-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,17 +1,17 @@ package org.fudaa.ebli.visuallibrary.actions; -import java.awt.Point; import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.Iterator; import java.util.Set; -import javax.swing.AbstractAction; - +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; /** * classe qui permet de placer les widgets selectionnes en arriere plan. @@ -21,11 +21,14 @@ public class EbliWidgetActionBackGround extends EbliActionSimple{ EbliScene scene_; + CtuluCommandContainer cmd_; + public EbliWidgetActionBackGround(EbliScene _scene){ super(EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_arriereplan"), "BACKGROUND"); scene_=_scene; + cmd_ = _scene.getCmdMng(); putValue(NAME,"Arri\xE8re plan"); } @@ -34,42 +37,47 @@ 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_.getNodes(); - //-- parcours des nodes - for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ + + //-- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); - EbliNode currentNode=it.next(); - if(currentNode!=null && currentNode.isMovable()){ + // -- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + //-- parcours des nodes + for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ - //-- deplacement a l arriere plan que si la widget est selectionnee --// - if(currentNode.getCreator().getWidget().getState().isSelected()){ - - - //-- on ajoute au premierplan tous les autres widget sauf currentnode --// - for(Iterator<EbliNode> it2=listeNode.iterator();it2.hasNext();){ - - //-- recuperation du node - EbliNode foregroundNode=it2.next(); - - if(foregroundNode!=null && foregroundNode != currentNode && foregroundNode.isMovable() ) - - //-- ajout au premier plan du node --// - scene_.getVisu().addChild(foregroundNode.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/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -7,10 +7,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import javax.swing.Icon; - import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -52,68 +51,70 @@ - public void actionPerformed(ActionEvent e) { - - - - //-- choix de la couleur par l utilisateur --// - Color couleur = BuColorChooser.showDialog(null,"Couleur du fond",Color.white); - if(couleur != null){ - - //on met a joru les couleurs pour toutes les widgets selectionnees --// - - //-- recupere les anciennes color --// - List<Color> oldColor=new ArrayList<Color>(); ; - - //-- nouvelle couleur --// - - Color newColor=couleur; - - //-- liste des widget selectionnees --// - java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); - - //-- liste des nodes selectionnes --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ - - - for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + public void actionPerformed(ActionEvent e) { - EbliNode currentNode = it.next(); - - if(currentNode.hasWidget()){ - - EbliWidget widget=currentNode.getCreator().getWidget(); - //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// - - //-- test pour savoir si le widget gere le colorcontour --// - if(widget.getColorFond()!=null){ - - //-- ajout pour les undo redo - listeWidget.add(widget); - oldColor.add(widget.getColorFond()); - - //-- mise a jour de la nouvelle couleur --// - widget.setColorFond(newColor); - - - - } - - } - } - //-- rafraichissement de la scene --// - scene_.refresh(); - - //-- ajout de l action undo redo --// - if (cmd_ != null) { - cmd_.addCmd(new CommandColorFond(listeWidget, oldColor, newColor)); - - } + // -- choix de la couleur par l utilisateur --// + Color couleur = BuColorChooser.showDialog(null, "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>>(); + + + // -- liste des nouvelles graphical properties --// + List<Map<String, Object>> newGraphicalProperties = new ArrayList<Map<String, Object>>(); + + + // -- nouvelle couleur --// + + Color newColor = couleur; + + // -- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + // -- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ + + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + EbliNode currentNode = it.next(); + + if (currentNode.hasWidget()) { + + EbliWidget widget = currentNode.getCreator().getWidget(); + + // -- test pour savoir si le widget gere le colorcontour --// + if (widget.getColorFond() != null) { + + // -- ajout pour les undo redo + listeWidget.add(widget); + oldGraphicalProperties.add(widget.duplicateGraphicalProperties()); + + // -- mise a jour de la nouvelle couleur --// + widget.setColorFond(newColor); + + // -- ajout de la nouvelle graphicalProperty --// + newGraphicalProperties.add(widget.propGraphique); + + } + + } + } + // -- rafraichissement de la scene --// + scene_.refresh(); + + if (cmd_ != null) { + cmd_ + .addCmd(new CommandeUndoRedoGraphicalProperties(newGraphicalProperties, oldGraphicalProperties, listeWidget)); + + } + + + + } + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -6,10 +6,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import javax.swing.Icon; - import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -61,9 +60,12 @@ //on met a joru les couleurs pour toutes les widgets selectionnees --// - //-- recupere les anciennes color --// - List<Color> oldColor=new ArrayList<Color>(); ; + //-- recupere les anciennes graphical properties --// + List<Map<String, Object>> oldGraphicalProperties=new ArrayList<Map<String, Object>>(); ; + //-- liste des nouvelles graphical properties --// + List<Map<String, Object>> newGraphicalProperties=new ArrayList<Map<String, Object>>(); ; + //-- nouvelle couleur --// Color newColor=couleur; @@ -82,18 +84,20 @@ if(currentNode.hasWidget()){ EbliWidget widget=currentNode.getCreator().getWidget(); - //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// + //-- test pour savoir si le widget gere le colorcontour --// if(widget.getColorContour()!=null){ //-- ajout pour les undo redo listeWidget.add(widget); - oldColor.add(widget.getColorContour()); + oldGraphicalProperties.add(widget.duplicateGraphicalProperties()); //-- mise a jour de la nouvelle couleur --// widget.setColorContour(newColor); + //-- ajout de la nouvelle graphicalProperty --// + newGraphicalProperties.add(widget.propGraphique); } @@ -103,10 +107,12 @@ //-- rafraichissement de la scene --// scene_.refresh(); - //-- ajout de l action undo redo --// + if (cmd_ != null) { - cmd_.addCmd(new CommandColorContour(listeWidget, oldColor, newColor)); - + cmd_ + .addCmd(new CommandeUndoRedoGraphicalProperties(newGraphicalProperties, oldGraphicalProperties, listeWidget)); + + } 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-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -10,12 +10,19 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; -import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.model.ObjectScene; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuResource; +/** + * Action qui permet de configurer les composants en ouvrant les interfaces qui + * vont bien. Ouvre la dialog de choix des composants + * + * @author Adrien Hadoux + * + */ public class EbliWidgetActionConfigure extends EbliActionSimple { ObjectScene scene_; @@ -29,24 +36,37 @@ * */ public void actionPerformed(ActionEvent e) { - EbliWidgetShape found = findWidget(); + EbliWidget found = findWidget(); if (found != null) { BConfigurePalette palette = new BConfigurePalette(false); - BConfigurableComposite cmp = new BConfigurableComposite(new WidgetConfigure(found), "test"); + + // -- creation du composite avec le configure qui genere les interfaces + // necessaires --// + // BConfigurableComposite cmp = new BConfigurableComposite(new + // WidgetConfigure(found), "test"); + + BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + + palette.setTargetConf(cmp); JDialog d = new JDialog(); + d.setModal(true); + d.setTitle("Configuration graphique"); d.setContentPane(palette); + d.pack(); d.setVisible(true); } } - EbliWidgetShape findWidget() { + EbliWidget findWidget() { Set objs = scene_.getSelectedObjects(); for (Iterator iterator = objs.iterator(); iterator.hasNext();) { Object object = iterator.next(); Widget w = scene_.findWidget(object); - if (w instanceof EbliWidgetShape) { return (EbliWidgetShape) w; } + if (w instanceof EbliWidget) { + return (EbliWidget) w; + } } return null; 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-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,14 +1,11 @@ package org.fudaa.ebli.visuallibrary.actions; -import java.awt.Point; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.swing.AbstractAction; - import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -76,6 +73,13 @@ //-- ajout du node dans la scene --// scene_.addNode(node); + + // -- duplication des map de property graphique de la widget --// + node.getCreator().getWidget().propGraphique = currentNode.getCreator().getWidget() + .duplicateGraphicalProperties(); + // -- duplication de la taille --// + node.getCreator().getWidget().setPreferredBounds(currentNode.getCreator().getWidget().getPreferredBounds()); + //-- rafraichissement de la scene --// scene_.refresh(); Modified: 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/EbliWidgetActionFont.java 2008-08-14 21:42:43 UTC (rev 3807) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-15 16:32:08 UTC (rev 3808) @@ -1,28 +1,22 @@ package org.fudaa.ebli.visuallibrary.actions; -import com.memoire.bu.BuColorChooser; -import com.memoire.bu.BuComboBox; -import com.memoire.bu.BuPanel; - -import java.awt.Color; +import java.awt.Font; import java.awt.GraphicsEnvironment; -import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import javax.swing.JComboBox; - import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ebli.commun.EbliActionSimple; -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 com.memoire.bu.BuComboBox; + /** * Classe qui gere un petit panel permettant de changer la police. Style * logiciel windows. @@ -39,6 +33,12 @@ */ BuComboBox fonts; + BuComboBox sizeFonts; + + public BuComboBox getSizeFonts() { + return sizeFonts; + } + /** * scene. */ @@ -51,19 +51,22 @@ // -- creation de la combobox --// GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); - Font envfonts[] = gEnv.getAllFonts(); - ArrayList<Font> listeFont = new ArrayList<Font>(); - for (int i = 1; i < envfonts.length; i++) { - listeFont.add(envfonts[i]); - } - fonts = new BuComboBox(listeFont.toArray()); + + fonts = new BuComboBox(gEnv.getAvailableFontFamilyNames()); fonts.addActionListener(this); - + + sizeFonts=new BuComboBox(); + int cpt = 8; + while(cpt<100) + sizeFonts.addItem(""+cpt++); + sizeFonts.addActionListener(this); } public BuComboBox getFonts() { return fonts; } + + public void setFonts(BuComboBox fonts) { this.fonts = fonts; @@ -78,12 +81,21 @@ // -- choix de la fontpar l utilisateur --// - // -- recuperation de la font - java.util.List<Font> oldFonts = new ArrayList<Font>(); - // on met a jour les font pour toutes les widgets selectionnees --// - Font newFont = (Font) fonts.getSelectedItem(); + // -- recuperation de la fonte choisie --// + Font newFont = new Font((String) fonts.getSelectedItem(), Font.BOLD, Integer.parseInt((String) sizeFonts + .getSelectedItem())); + // on met a jour les couleurs pour toutes les widgets selectionnees --// + + // -- recupere les anciennes graphical properties --// + List<Map<String, Object>> oldGraphicalProperties = new ArrayList<Map<String, Object>>(); + + // -- liste des nouvelles graphical properties... [truncated message content] |