From: <had...@us...> - 2008-08-14 18:50:24
|
Revision: 3805 http://fudaa.svn.sourceforge.net/fudaa/?rev=3805&view=rev Author: hadouxad Date: 2008-08-14 18:50:30 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Nouvelles fonctionnalites: - Action qui gere les couleurs des contours + undo/redo - Action qui gere les couleurs des contenus + undo/redo - Optimisation du dessin de l image du calque - Mise en forme et int?\195?\169gration des shapes - Cr?\195?\169ation des composants et palettes - Duplication des objets shape Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.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/EbliWidgetCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.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/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 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 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/EbliWidgetActionFont.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/creator/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorCircle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorEllipse.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorRectangle.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteAction.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -14,12 +14,12 @@ import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import com.memoire.bu.BuResource; - import org.fudaa.ebli.commun.BPalettePanelInterface; import org.fudaa.ebli.commun.EbliActionPaletteTreeModel; import org.fudaa.ebli.commun.EbliLib; +import com.memoire.bu.BuResource; + /** * @author Fred Deniger * @version $Id: BConfigurePaletteAction.java,v 1.8 2007-05-04 13:49:44 deniger Exp $ @@ -36,6 +36,7 @@ } protected boolean setPaletteTarget(final Object _target) { + // FIXME a reprendre avec les EbliWidget if (palette_ == null) { return false; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -11,18 +11,31 @@ import java.awt.Font; import java.beans.PropertyChangeListener; -import com.memoire.bu.BuTextField; - import org.fudaa.ctulu.CtuluLibString; - import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.controle.*; +import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BSelecteurAlpha; +import org.fudaa.ebli.controle.BSelecteurCheckBox; +import org.fudaa.ebli.controle.BSelecteurColorChooser; +import org.fudaa.ebli.controle.BSelecteurColorChooserBt; +import org.fudaa.ebli.controle.BSelecteurFont; +import org.fudaa.ebli.controle.BSelecteurIconModel; +import org.fudaa.ebli.controle.BSelecteurInterface; +import org.fudaa.ebli.controle.BSelecteurLineModel; +import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; +import org.fudaa.ebli.controle.BSelecteurTargetInterface; +import org.fudaa.ebli.controle.BSelecteurTextField; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigneModel; +import com.memoire.bu.BuTextField; + /** + * FIXME a reprendre + * * @author fred deniger - * @version $Id: EGCourbeConfigureTarget.java,v 1.2 2007-05-04 13:49:41 deniger Exp $ + * @version $Id: EGCourbeConfigureTarget.java,v 1.2 2007-05-04 13:49:41 deniger + * Exp $ */ public abstract class EGCourbeConfigureTarget implements /*BConfigurableSectionInterface, */BSelecteurTargetInterface, BConfigurableInterface { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -26,7 +26,7 @@ * @version $Id: EGObject.java,v 1.17 2007-05-04 13:49:41 deniger Exp $ */ public abstract class EGObject implements Icon, BConfigurePaletteTargetInterface { - +//FIXME a reprende public BSelecteurTargetInterface getVisibleTitleTarget() { return new EGObjectConfigureVisibleTarget(this); } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,172 +0,0 @@ -package org.fudaa.ebli.courbe; - - - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.image.CtuluImageProducer; -import org.fudaa.ctulu.image.CtuluLibImage; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.graph.GraphScene; -import org.netbeans.api.visual.laf.LookFeel; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.ImageWidget; -import org.netbeans.api.visual.widget.LayerWidget; - -import sun.awt.image.ToolkitImage; - -/** - * Classe qui g\xE9n\xE8re les l\xE9gendes de chacun des graphes - * - * - * @author Adrien Hadoux - * - */ - -public class WidgetLegendeManager { - - - static List<ImageWidget> listeWidgets=null; - - //gap vertical entre chaque widget legendes - final static int Vgap=10; - //gap horizontal entre chaque widget legendes - final static int Hgap=10; - - final static int widthDefault=100; - final static int heightDefault=30; - - - public static void createWidgetLegendeGraphe(GraphScene scene,LayerWidget visu,EGGraphe graphe, Rectangle areaGraphe) { - - - listeWidgets=new ArrayList<ImageWidget>(); - - //-- cr\xE9ation, affichage et ajout du listener du graphe pour chacune des widgets suivantes --// - - for(int i=0; i<graphe.getModel().getCourbes().length;i++){ - - final EGCourbe courbe=graphe.getModel().getCourbes()[i]; - final int cpt=i; - - - - //--creation d un nouveau widget image --// - final ImageWidget legendeWidget=new ImageWidget (scene){ - public void notifyStateChanged(ObjectState previousState, - ObjectState newState) { - LookFeel lookFeel = getScene().getLookFeel(); - // setBorder(lookFeel.getBorder(newState)); - // setForeground(lookFeel.getForeground(newState)); - - setBorder(lookFeel.getBorder(newState)); - // setBorder(newState.isSelected() ? - // (DEFAULT_SELECTED_BORDER) : - // (newState.isHovered() ? RESIZE_BORDER - // : DEFAULT_BORDER)); - //repaint(); - - } - - //-- redessinne la l\xE9gende - protected void paintWidget() { - - // recuperation du rectangle contour - Rectangle rec = getClientArea(); - Graphics2D g=getGraphics(); - - g.translate(rec.x, rec.y); - - - //dimension du cadre de la l\xE9gende // - int widthCadre=rec.width; - int heightCadre=rec.height; - - //cas initial: dessin vide - if(widthCadre==0) - widthCadre=widthDefault; - if(heightCadre==0) - heightCadre=heightDefault; - - g.setColor(Color.GRAY); - g.drawRect(rec.x, rec.y,widthCadre - 1, heightCadre - 1); - - //-- dessin du titre et des lignes --// - g.setFont(new Font("Serif",Font.PLAIN,rec.height/2)); - g.setColor(courbe.getAspectContour()); - g.drawString(courbe.getTitle(),rec.x + Hgap/2 , (int)(rec.y + rec.height/2)); - //FIXME Comment je peux obtenir les icones et les lignes et les dimensionner? - } - - }; -legendeWidget.setPreferredSize(new Dimension(widthDefault,heightDefault)); - - //-- ajouter le listener EGGraphe pour ecouter et \xE9ettre a jour els l\xE9gendes --// - graphe.getModel().addModelListener(new EGGrapheModelListener() { - - public void structureChanged() { - legendeWidget.repaint(); - - } - - public void courbeContentChanged(EGObject _c, boolean restore) { - legendeWidget.repaint(); - - } - - public void courbeAspectChanged(EGObject _c, boolean _visibil) { - legendeWidget.repaint(); - // TODO Auto-generated method stub - - } - - public void axeContentChanged(EGAxe _c) { - legendeWidget.repaint(); - - } - - public void axeAspectChanged(EGAxe _c) { - legendeWidget.repaint(); - - } - }); - - //-- ajouter les actions liees au widget --// - legendeWidget.getActions().addAction( ActionFactory.createResizeAction()); - legendeWidget.getActions().addAction(ActionFactory.createMoveAction()); - legendeWidget.getActions().addAction(scene.createWidgetHoverAction()); - - - - //-- ajout de la widget dans la liste --// - listeWidgets.add(legendeWidget); - - //-- positionner le widget dans la scene par rapport au graphe et a ses autres widgets --// - //FIXME am\xE9eliorer en discuter avec Fred - legendeWidget.setPreferredLocation (new Point ((widthDefault+Hgap)*cpt, Vgap)); - - scene.addChild(legendeWidget); - - }//fin for - - //-- positionner le widget dans la scene par rapport au graphe et a ses autres widgets --// - //TODO am\xE9eliorer en discuter avec Fred - //visu.addChildren(listeWidgets); - - } - - -} 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 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -8,119 +8,109 @@ import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; public class EbliNodeDefault implements EbliNode { - - EbliWidgetCreator creator; - Point preferedLocation; - Dimension preferedSize; - String title; - - - public String getTitle() { - return title; - } - - - /** - * methode qui permet de dupliquer un node - */ - public EbliNode duplicate(Map options) { - // TODO Auto-generated method stub - EbliNode duplique= new EbliNodeDefault(); - - duplique.setTitle(getTitle()); - - System.err.println("je suis instance de la classe "+creator.toString()); - //-- duplique rectangle - if(creator instanceof EbliWidgetCreatorRectangle){ - duplique.setCreator(new EbliWidgetCreatorRectangle(((EbliWidgetCreatorRectangle)getCreator()).getG())); - }else if(creator instanceof EbliWidgetCreatorFleche){ - duplique.setCreator(new EbliWidgetCreatorFleche(((EbliWidgetCreatorFleche)getCreator()).orientation)); - }else if(creator instanceof EbliWidgetCreatorDblFleche){ - duplique.setCreator(new EbliWidgetCreatorDblFleche(((EbliWidgetCreatorDblFleche)getCreator()).getG())); - }else if(creator instanceof EbliWidgetCreatorGraphe){ - duplique.setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe)getCreator()).getGraphe())); - }else if(creator instanceof EbliWidgetCreatorVueCalque){ - duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque)getCreator()).getCalque())); - }else{ - // instance pas identifie, impossible de dupliquer - return null; - } - - duplique.setPreferedSize(getPreferedSize()); - - //-- calcul nouvelle position - Point nouvellePosition = new Point( - getCreator().getWidget().getLocation().x, (int) (getCreator().getWidget().getLocation().y + getCreator().getWidget().getClientArea().height)); - - duplique.setPreferedLocation(nouvellePosition); - //duplique.setPreferedLocation(getPreferedLocation()); - - return duplique; - } + EbliWidgetCreator creator; + Point preferedLocation; + Dimension preferedSize; + String title; + public String getTitle() { + return title; + } + /** + * methode qui permet de dupliquer un node + */ + public EbliNode duplicate(Map options) { + // TODO Auto-generated method stub + EbliNode duplique = new EbliNodeDefault(); - public void setTitle(String title) { - this.title = title; - } + duplique.setTitle(getTitle()); + // FIXME cree un methode duplicate dans le creator + // ne pas oublier de + // duplicate(Map optionsGraphique) + System.err.println("je suis instance de la classe " + creator.toString()); + // -- duplique rectangle + if (creator instanceof EbliWidgetCreatorRectangleTexte) { + duplique.setCreator(new EbliWidgetCreatorRectangleTexte(((EbliWidgetCreatorRectangleTexte) getCreator()).getG())); + } else if (creator instanceof EbliWidgetCreatorFleche) { + duplique.setCreator(new EbliWidgetCreatorFleche(((EbliWidgetCreatorFleche) getCreator()).orientation)); + } else if (creator instanceof EbliWidgetCreatorDblFleche) { + duplique.setCreator(new EbliWidgetCreatorDblFleche(((EbliWidgetCreatorDblFleche) getCreator()).getG())); + } else if (creator instanceof EbliWidgetCreatorGraphe) { + duplique.setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe) getCreator()).getGraphe())); + } else if (creator instanceof EbliWidgetCreatorVueCalque) { + duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque())); + } else if (creator instanceof EbliWidgetCreatorShape) { + duplique.setCreator(new EbliWidgetCreatorShape(((EbliWidgetCreatorShape) getCreator()).getTypeObject_())); + } else { + // instance pas identifie, impossible de dupliquer + return null; + } - public void setPreferedLocation(Point p) { - this.preferedLocation = p; - // repositionnement du widget si existant - if(hasWidget()) - getCreator().getWidget().setPreferredLocation(p); - } + duplique.setPreferedSize(getPreferedSize()); - public void setPreferedSize(Dimension d) { - this.preferedSize = d; - - // repositionnement du widget si existant - if(hasWidget()) - getCreator().getWidget().setPreferredSize(d); - } + // -- calcul nouvelle position + Point nouvellePosition = new Point(getCreator().getWidget().getLocation().x, (int) (getCreator().getWidget() + .getLocation().y + getCreator().getWidget().getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + // duplique.setPreferedLocation(getPreferedLocation()); + return duplique; + } - public void setCreator(EbliWidgetCreator creator) { - this.creator = creator; - } + public void setTitle(String title) { + this.title = title; + } - public EbliWidgetCreator getCreator() { - return creator; - } + public void setPreferedLocation(Point p) { + this.preferedLocation = p; + // repositionnement du widget si existant + if (hasWidget()) + getCreator().getWidget().setPreferredLocation(p); + } - public Point getPreferedLocation() { - - return preferedLocation; - } + public void setPreferedSize(Dimension d) { + this.preferedSize = d; - public Dimension getPreferedSize() { - // TODO Auto-generated method stub - - return preferedSize; - } - - public String toString() { - // TODO Auto-generated method stub - return title; - } + // repositionnement du widget si existant + if (hasWidget()) + getCreator().getWidget().setPreferredSize(d); + } + public void setCreator(EbliWidgetCreator creator) { + this.creator = creator; + } + public EbliWidgetCreator getCreator() { + return creator; + } - public boolean hasWidget() { - return (getCreator()!=null && getCreator().getWidget()!=null); - - } + public Point getPreferedLocation() { + return preferedLocation; + } + public Dimension getPreferedSize() { + // TODO Auto-generated method stub - public boolean isMovable() { - // TODO Auto-generated method stub - return (hasWidget() && getPreferedLocation() !=null && getPreferedSize() !=null); - } + return preferedSize; + } + public String toString() { + // TODO Auto-generated method stub + return title; + } - + public boolean hasWidget() { + return (getCreator() != null && getCreator().getWidget() != null); + } + + public boolean isMovable() { + // TODO Auto-generated method stub + return (hasWidget() && getPreferedLocation() != null && getPreferedSize() != 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-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,13 +1,24 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Color; +import java.awt.Font; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; +import java.util.Map; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluResource; +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.BSelecteurTargetInterface; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.model.ObjectState; @@ -19,34 +30,99 @@ * @author Adrien Hadoux * */ -public class EbliWidget extends Widget { +public class EbliWidget extends Widget implements BConfigurePaletteTargetInterface, BSelecteurTargetInterface { private EbliScene scene_; - + Map propGraphique; + private boolean useBorder_ = true; -/** - * @param scene - * @param Point - * : indiaue la location preferentiel. peut etre nul - */ -public EbliWidget(EbliScene scene) { - super(scene); - setScene_(scene); - getActions().addAction(scene.createSelectAction()); - getActions().addAction(ActionFactory.createResizeAction()); - getActions().addAction(scene.createWidgetHoverAction()); - getActions().addAction(scene.getMoveAction()); + public BConfigurableInterface[] getConfigureInterfaces() { + return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib + .getS("Affichage")) }; + } - // positionnement de la widget si precise - // if(preferredLocation!=null) - // setPreferredLocation(preferredLocation); + private BConfigurableInterface getSingleConfigureInterface() { + // return new EGCourbeConfigureTarget.Display(this) + return new BConfigurableInterface() { - // menu clic droit basique (fermeture, duplication) - setMenu(); -} + 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 + } + + public Object getMin(String _key) { + return null; + } + + public Object getMoy(String _key) { + return null; + } + + public Object getProperty(String _key) { + return propGraphique.get(_key); + // return new TraceLigneModel(); + } + + public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { + } + + public boolean setProperty(String _key, Object prop) { + return false; + } + + public boolean isTitleModifiable() { + return true; + } + /** + * @param scene + * @param Point + * : indiaue la location preferentiel. peut etre nul + */ + public EbliWidget(EbliScene scene) { + super(scene); + setScene_(scene); + getActions().addAction(scene.createSelectAction()); + getActions().addAction(ActionFactory.createResizeAction()); + getActions().addAction(scene.createWidgetHoverAction()); + getActions().addAction(scene.getMoveAction()); + + // positionnement de la widget si precise + // if(preferredLocation!=null) + // setPreferredLocation(preferredLocation); + + // menu clic droit basique (fermeture, duplication) + setMenu(); + } + + /** * Methode de construction des menus de base * * @param _popup @@ -58,28 +134,26 @@ public void actionPerformed(ActionEvent e) { - - - //-- recuperation du node a dupliquer --// + // -- recuperation du node a dupliquer --// EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); - - // duplication du node en question - EbliNode duplique=n.duplicate(null); - - // nouvelle position a cote de son predecesseur - // duplique.setPreferedLocation(nouvellePosition); + // duplication du node en question + EbliNode duplique = n.duplicate(null); + + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); + // -- ajout dans la scene --// - if (duplique!=null && EbliWidget.this.getScene() != null) { - EbliWidget.this.getEbliScene().addNode(duplique); - //info debug widget duplique - //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); - - //-- raffraichissement de la scene --// - EbliWidget.this.getEbliScene().refresh(); + if (duplique != null && EbliWidget.this.getScene() != null) { + EbliWidget.this.getEbliScene().addNode(duplique); + // info debug widget duplique + //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator(). + // getWidget().getPreferredBounds()); + + // -- raffraichissement de la scene --// + EbliWidget.this.getEbliScene().refresh(); } - - + } }); @@ -89,11 +163,10 @@ public void actionPerformed(ActionEvent e) { - EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); EbliWidget.this.getEbliScene().removeNode(n); - - //-- raffraichissement de la scene --// + + // -- raffraichissement de la scene --// EbliWidget.this.getEbliScene().refresh(); } @@ -114,16 +187,16 @@ } /** - * methode qui construit une widget duplication pqr default, doit etre surchargee pour reproduire l' evenement + * methode qui construit une widget duplication pqr default, doit etre + * surchargee pour reproduire l' evenement + * * @return */ - public EbliNode duplicate(){ - EbliNode duplique =null; - - - return duplique; - } + public EbliNode duplicate() { + EbliNode duplique = null; + return duplique; + } public EbliScene getEbliScene() { return scene_; @@ -167,6 +240,33 @@ public void setUseBorder(boolean _useBorder) { useBorder_ = _useBorder; } - - + + /** + * Methode a surcharger pour la recuperation des colors + * + * @param newColor + */ + public void setColorContour(Color newColor) { + + } + + public Color getColorContour() { + return null; + } + + public void setColorFond(Color newColor) { + + } + + public Color getColorFond() { + return null; + } + + public Font getFormeFont() { + return null; + } + + public void setFormeFont(Font newFont) { + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -4,7 +4,7 @@ public interface EbliWidgetCreator { EbliWidget create(EbliScene _scene); - + // FIXME a mettre dans le EbliNode EbliWidget getWidget(); // void widgetCreated(EbliWidget w); Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,35 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import org.fudaa.ebli.courbe.EGGraphe; - - -public class EbliWidgetCreatorRectangle implements EbliWidgetCreator { - - String label_; - EbliWidgetRectangle res; - - public EbliWidgetCreatorRectangle(String g) { - super(); - this.label_ = g; - } - - public String getG() { - return label_; - } - - public void setG(String g) { - this.label_ = g; - } - - public EbliWidget create(EbliScene _scene) { - res= new EbliWidgetRectangle(_scene, getG()); - - return res; - } - - public EbliWidget getWidget() { - // TODO Auto-generated method stub - return res; - } - -} Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java (from rev 3796, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,35 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGGraphe; + + +public class EbliWidgetCreatorRectangleTexte implements EbliWidgetCreator { + + String label_; + EbliWidgetRectangle res; + + public EbliWidgetCreatorRectangleTexte(String g) { + super(); + this.label_ = g; + } + + public String getG() { + return label_; + } + + public void setG(String g) { + this.label_ = g; + } + + public EbliWidget create(EbliScene _scene) { + res= new EbliWidgetRectangle(_scene, getG()); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,52 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; + +/** + * Creator pour les objets graphiques de type shape. + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorShape implements EbliWidgetCreator { + + + EbliWidgetShape res; + + /** + * Le type de l objet a creer. + */ + ShapeCreator typeObject_; + + public ShapeCreator getTypeObject_() { + return typeObject_; + } + + + + public void setTypeObject_(ShapeCreator typeObject_) { + this.typeObject_ = typeObject_; + } + + + + public EbliWidgetCreatorShape(ShapeCreator _typeObject ) { + super(); + + typeObject_=_typeObject; + } + + + + public EbliWidget create(EbliScene _scene) { + res= new EbliWidgetShape(_scene,typeObject_ ,null); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-14 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -52,7 +52,8 @@ public static int ORIENTATION_EAST=2; public static int ORIENTATION_WEST=3; - public Color couleur=Color.black; + public Color couleurContour=Color.black; + public Color couleurFond=Color.white; /** * @param _scene @@ -83,7 +84,14 @@ protected void paintWidget() { Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + //-- couleur de fond --// + g.setColor(couleurFond); + g.fillRect(0, 0, rec.width, rec.height); + g.translate(rec.x, rec.y); // la ligne @@ -91,7 +99,7 @@ l.setEpaisseur(largeurBorder); - l.setCouleur(couleur); + l.setCouleur(couleurContour); //FIXME prob fleche pas tres jolie l.dessineFleche(g,(int)( l.getEpaisseur() / 2),(int)( rec.height/2), (int)(rec.width-l.getEpaisseur()/2), (int)(rec.height/2)); @@ -109,19 +117,24 @@ - public Color getCouleurFleche() { - return couleur; - } + public void setColorContour(Color newColor){ + couleurContour=newColor; + repaint(); + } + + public Color getColorContour(){ + return couleurContour; + } - - - - public void setCouleurFleche(Color couleurFleche) { - this.couleur = couleurFleche; - } - + public void setColorFond(Color newColor){ + couleurFond=newColor; + repaint(); + } + + public Color getColorFond(){ + return couleurFond; + } - 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 16:16:23 UTC (rev 3804) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -1,6 +1,7 @@ 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; @@ -31,7 +32,10 @@ int largeurBorder = 15; int espaceInterieur = 5; - public Color couleur=Color.black; + public Color couleurContour=Color.black; + public Color couleurFond=Color.white; + public Font fontForme; + /** * @param _scene */ @@ -86,12 +90,19 @@ protected void paintWidget() { Graphics2D g = getGraphics(); + Rectangle rec = getClientArea(); + + //-- couleur de fond --// + g.setColor(couleurFond); + g.fillRect(0, 0, rec.width, rec.height); + + g.translate(rec.x, rec.y); // la ligne TraceLigne l = new TraceLigne(); - l.setCouleur(couleur); + 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, @@ -99,6 +110,8 @@ g.translate(-rec.x, -rec.y); + + } public String getText(Widget widget) { @@ -117,5 +130,38 @@ } + 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 Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,164 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.util.HashMap; +import java.util.Map; + +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.netbeans.api.visual.widget.Scene; + +/** + * Classe qui permet de dessinner des shapes. + * @author genesis + * + */ +public class EbliWidgetShape extends EbliWidget { + Paint fg_ = Color.YELLOW;//pour l'exemple + Map options_; + ShapeCreator shaper_; + + double rotation_; + + public Color couleurFond=Color.white; + public Color couleurContour=Color.black; + + public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, couleurContour);//pour l'exempls + /** + * @return the 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); + // } + } + + public EbliWidgetShape (EbliScene scene, ShapeCreator _shaper, Map _options) { + super(scene); + super.setCheckClipping(true); + options_ = new HashMap(); + if (_options != null) { + options_.putAll(_options); + } + shaper_ = _shaper; + } + + /** + * + */ + @Override + protected void paintWidget() { + Graphics2D g = getGraphics(); + Rectangle recInit = getClientArea(); + // AffineTransform oldTr = g.getTransform(); + + + TraceLigne tl = new TraceLigne(tl_); + + AffineTransform oldTr = g.getTransform(); + g.translate(recInit.x, recInit.y); + 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()); + shape = tr.createTransformedShape(shape); + Rectangle2D newBound = shape.getBounds2D(); + double wRatio = rec.width / newBound.getWidth(); + double hRatio = rec.height / newBound.getHeight(); + tr = AffineTransform.getTranslateInstance(-newBound.getX(), -newBound.getY()); + shape = tr.createTransformedShape(shape); + shape = AffineTransform.getScaleInstance(wRatio, hRatio).createTransformedShape(shape); + tr = AffineTransform.getTranslateInstance(ep / 2, ep / 2); + shape = tr.createTransformedShape(shape); + } + + if (fg_ != null) { + Paint old = g.getPaint(); + g.setPaint(fg_); + + //--couleur de fond --// + g.setColor(couleurFond); + g.fill(shape); + + + + g.setPaint(old); + } + tl.dessineShape(g, shape); + g.setTransform(oldTr); + // g.translate(-recInit.x, -recInit.y); + // g.setTransform(oldTr); + } + + /** + * @return the fg + */ + public Paint getFg() { + 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 setColorFond(Color newColor){ + couleurFond=newColor; + repaint(); + } + + public Color getColorFond(){ + return couleurFond; + } + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorContour.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,60 @@ +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(); + } + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandColorFond.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,59 @@ +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 Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandFont.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,64 @@ +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/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,119 @@ +package org.fudaa.ebli.visuallibrary.actions; + + + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +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; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +import com.memoire.bu.BuColorChooser; + + +/** + * Classe qui permet de changer la couleur des contours des widgets . + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionColorBackground extends EbliActionSimple{ + + + + CtuluCommandContainer cmd_; + + + EbliScene scene_; + + + + + public EbliWidgetActionColorBackground(EbliScene _scene) { + super(EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); + + + scene_=_scene; + cmd_=_scene.getCmdMng(); + + + // TODO Auto-generated constructor stub + } + + + + + 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();) { + + 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)); + + } + + + + } + +} + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,118 @@ +package org.fudaa.ebli.visuallibrary.actions; + + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +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; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +import com.memoire.bu.BuColorChooser; + + +/** + * Classe qui permet de changer la couleur des contours des widgets . + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionColorForeground extends EbliActionSimple{ + + + + CtuluCommandContainer cmd_; + + + EbliScene scene_; + + + + + public EbliWidgetActionColorForeground(EbliScene _scene) { + super(EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("palettecouleur"), "CONTOUR"); + + + scene_=_scene; + cmd_=_scene.getCmdMng(); + + + // TODO Auto-generated constructor stub + } + + + + + public void actionPerformed(ActionEvent e) { + + + + //-- choix de la couleur par l utilisateur --// + Color couleur = BuColorChooser.showDialog(null,"Couleur du contour",Color.black); + 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();) { + + 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.getColorContour()!=null){ + + //-- ajout pour les undo redo + listeWidget.add(widget); + oldColor.add(widget.getColorContour()); + + //-- mise a jour de la nouvelle couleur --// + widget.setColorContour(newColor); + + + + } + + } + } + //-- rafraichissement de la scene --// + scene_.refresh(); + + //-- ajout de l action undo redo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandColorContour(listeWidget, oldColor, newColor)); + + } + + + + } + +} + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,56 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.event.ActionEvent; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.AbstractAction; +import javax.swing.JDialog; + +import org.fudaa.ebli.controle.BConfigurableComposite; +import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.netbeans.api.visual.model.ObjectScene; +import org.netbeans.api.visual.widget.Widget; + + + +public class EbliWidgetActionConfigure extends AbstractAction { + + ObjectScene scene_; + + public EbliWidgetActionConfigure(ObjectScene _widget) { + super("configure"); + scene_ = _widget; + } + + /** + * + */ + public void actionPerformed(ActionEvent e) { + EbliWidgetShape found = findWidget(); + if (found != null) { + BConfigurePalette palette = new BConfigurePalette(false); + BConfigurableComposite cmp = new BConfigurableComposite(new WidgetConfigure(found), "test"); + palette.setTargetConf(cmp); + JDialog d = new JDialog(); + d.setContentPane(palette); + d.pack(); + d.setVisible(true); + } + } + + EbliWidgetShape 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; + } + } + return null; + + } +} + Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,155 @@ +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.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.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; + + + +/** + * Classe qui gere un petit panel permettant de changer la police. + * Style logiciel windows. + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionFont implements ActionListener{ + + +CtuluCommandContainer cmd_; + +/** + * liste de tous les fontes + */ +BuComboBox fonts ; + + +/** + * scene. + */ +EbliScene scene_; + + + +public EbliWidgetActionFont(EbliScene _scene){ + +scene_=_scene; +cmd_=_scene.getCmdMng(); + + +//-- 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.addActionListener(this); + +} + + + +public BuComboBox getFonts() { + return fonts; +} + + + +public void setFonts(BuComboBox fonts) { + this.fonts = fonts; +} + + + + + +/** + * appelee dans le cas d event du combo. + */ +public void actionPerformed(ActionEvent e) { + + + + if(e.getSource().equals(fonts)){ + + System.err.println("Aller dans actionperformed du combobox"); + + + //-- 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(); + + //-- 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(); + //-- recuperatioon de l ancienne color et de la widget associee pour le undo --// + + //-- test pour savoir si le widget gere le font --// + if(widget.getFormeFont()!=null){ + + //-- ajout pour les undo redo + listeWidget.add(widget); + oldFonts.add(widget.getFormeFont()); + + //-- mise a jour de la nouvelle couleur --// + widget.setFormeFont(newFont); + + + + } + + } + } + //-- rafraichissement de la scene --// + scene_.refresh(); + + //-- ajout de l action undo redo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandFont(listeWidget, oldFonts, newFont)); + + } + + + +} + +} + + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-14 18:50:30 UTC (rev 3805) @@ -0,0 +1,70 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.beans.PropertyChangeListener... [truncated message content] |