From: <had...@us...> - 2008-08-12 15:03:50
|
Revision: 3781 http://fudaa.svn.sourceforge.net/fudaa/?rev=3781&view=rev Author: hadouxad Date: 2008-08-12 15:03:56 +0000 (Tue, 12 Aug 2008) Log Message: ----------- - integration de la scene dans fudaa prepro : creation de la classe TrPostLayoutFille extends BuInternalFrame - integration des actions de bases (alignements, arriere, avant plan et duplication) - integration de la palette de base (pour le moment ractangle et fleche) - ajout des l ouverture du calque de resultat (possibiliter d editer, de dupliauer et supprimer la legende du bidule) Modified Paths: -------------- 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/EbliWidgetActionDuplicate.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/tree/EbliWidgetJXTree.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 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-12 14:51:12 UTC (rev 3780) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-12 15:03:56 UTC (rev 3781) @@ -7,6 +7,9 @@ import javax.swing.AbstractAction; +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; @@ -15,11 +18,13 @@ * @author genesis * */ -public class EbliWidgetActionBackGround extends AbstractAction{ +public class EbliWidgetActionBackGround extends EbliActionSimple{ EbliScene scene_; public EbliWidgetActionBackGround(EbliScene _scene){ + super(EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_arriereplan"), "BACKGROUND"); + scene_=_scene; putValue(NAME,"Arri\xE8re plan"); } 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-12 14:51:12 UTC (rev 3780) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-12 15:03:56 UTC (rev 3781) @@ -9,6 +9,9 @@ import javax.swing.AbstractAction; +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; @@ -22,7 +25,7 @@ * @author genesis * */ -public class EbliWidgetActionDuplicate extends AbstractAction{ +public class EbliWidgetActionDuplicate extends EbliActionSimple{ /** * @@ -31,6 +34,7 @@ EbliScene scene_; public EbliWidgetActionDuplicate(EbliScene _scene){ + super(EbliResource.EBLI.getString("dupliquer les objets s\xE9lectionn\xE9s"), CtuluResource.CTULU.getIcon("crystal_copier"), "DUPLICATE"); scene_=_scene; putValue(NAME,"Duplication des \xE9lements s\xE9lectionn\xE9s"); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-12 14:51:12 UTC (rev 3780) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-12 15:03:56 UTC (rev 3781) @@ -7,6 +7,9 @@ import javax.swing.AbstractAction; +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; @@ -15,11 +18,13 @@ * @author genesis * */ -public class EbliWidgetActionForeGround extends AbstractAction{ +public class EbliWidgetActionForeGround extends EbliActionSimple{ EbliScene scene_; public EbliWidgetActionForeGround(EbliScene _scene){ + super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_analyser"), "FORGROUND"); + scene_=_scene; putValue(NAME,"Premier plan"); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java 2008-08-12 14:51:12 UTC (rev 3780) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java 2008-08-12 15:03:56 UTC (rev 3781) @@ -2,12 +2,13 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreeModel; + import org.jdesktop.swingx.JXTree; public class EbliWidgetJXTree extends JXTree implements TreeSelectionListener{ + // modele du tree private EbliWidgetJXTreeModel model_; Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-12 15:03:56 UTC (rev 3781) @@ -0,0 +1,360 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorFleche; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangle; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; +import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxTreeRenderer; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; +import org.fudaa.fudaa.tr.common.TrResource; + +import javax.swing.Box; +import javax.swing.JScrollPane; +import javax.swing.JToolBar; +import javax.swing.JTree; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuInternalFrame; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; +/** + * InternalFrame qui contient la scene EbliScene. + * @author Adrien Hadoux + * + */ +public class TrPostLayoutFille extends BuInternalFrame { + + /** + * + */ + private static final long serialVersionUID = -2769884291563880931L; + + /** + * scene de l internalFrame. + */ + final private EbliScene scene_; + + /** + * Calque principal associ\xE9 a la vue layout. + */ + private ZEbliCalquesPanel calquePrincipal; + + + + + /** + * Model du Jxtree associe. + */ + private EbliWidgetJXTreeModel modelTree_; + + /** + * Tree associe a la scene. + */ + private EbliWidgetJXTree tree_; + + + + + + + /** + * Constructeur de la fenetre. + */ + public TrPostLayoutFille() { + super(); + // TODO Auto-generated constructor stub + setTitle(TrResource.getS("vue 2D")); + // creation de la scene EBLI + scene_ = new EbliScene(); + + // -- construction du jtree + + // etape 1 construction du model + EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1); + + // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene + scene_.addEbliNodeListener(model); + + // etape 3 creation du jxtree + tree_ = new EbliWidgetJXTree(model); + + //renderer du jxtree + EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + tree_.setCellRenderer(renderer); + tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); + tree_.setEditable(true); + //tree_.setPreferredSize(new Dimension(300,600)); + //-- initialisation de la frame --// + init(); + } + + + public ZEbliCalquesPanel getCalquePrincipal() { + return calquePrincipal; + } + + public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { + this.calquePrincipal = calquePrincipal; + } + + public EbliScene getScene_() { + return scene_; + } + + + public EbliWidgetJXTreeModel getModelTree_() { + return modelTree_; + } + + public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { + this.modelTree_ = modelTree_; + } + + public EbliWidgetJXTree getTree_() { + return tree_; + } + + public void setTree_(EbliWidgetJXTree tree_) { + this.tree_ = tree_; + } + + /** + * methode appelee pour l init de la construction de la internalframe + */ + public void init(){ + + //-- creation du conteneur de base qui contient tout --// + BuPanel content =new BuPanel(new BuBorderLayout()); + + //-- creation de la box sur le cote qui contient le tree et la sattelite view --// + Box contentEast=Box.createVerticalBox(); + + + this.add(content); + + this.setLayout(new BuBorderLayout()); + + + + //ajout de la scene au centre + content.add(new JScrollPane(scene_.createView()),BuBorderLayout.CENTER); + + + //FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux + //ajout du jtree sur la droite + getTree_().setPreferredSize(new Dimension(200,500)); + contentEast.add(new BuScrollPane(getTree_())); + + //-- ajout de la vue sattelite dans la box --// + contentEast.add(getScene_().createSatelliteView()); + + //-- ajout de la box dans le content --// + content.add(contentEast,BuBorderLayout.EAST); + + // content.doLayout(); + //this.pack(); + this.setVisible(true); + + + //-- construction de la barre des commandes de base --// + content.add(buildToolBar(),BuBorderLayout.NORTH); + + + } + + + /** + * Methode generique d ajout d un node widget a la scene. + * @param node + */ + public void addNode(EbliNode node){ + getScene_().addNode(node); + + //-- rafraichissement de la scene pour eviter les plantages --// + getScene_().refresh(); + } + + + /** + * Methode specialisee dans l ajout d un ndoe de type calque a la scene. + * @param title de la widget + * @param preferredLocation de la widget + * @param preferedDimension de la widget + * @param calque contenu de la widget + * @return le node cree + */ + public EbliNode addCalque(String title, Point preferredLocation, Dimension preferedDimension,ZEbliCalquesPanel calque ){ + + //-- enregistrement du calque principal --// + if(calquePrincipal==null) + //-- alors le calque recupere sera considere comem le calque principal --// + setCalquePrincipal(calque); + + + //on ajoute le calque sous forme d'un node + + //construction du node correspondant + final EbliNode nodeCalque = new EbliNodeDefault(); + nodeCalque.setTitle(title); + nodeCalque.setPreferedSize(preferedDimension);//new Dimension(400, 200) + nodeCalque.setPreferedLocation(preferredLocation);//new Point(250, 170) + nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(calque)); + + //ajout du node au layout + addNode(nodeCalque); + + return nodeCalque; + } + + /** + * Methode d ajout de composant de base graphique. + * @return + */ + public EbliNode addRectangle( ){ + // -- ajout du rectangle --// + final EbliNodeDefault nodeRect = new EbliNodeDefault(); + nodeRect.setTitle("Rectangle"); + nodeRect.setCreator(new EbliWidgetCreatorRectangle("Tapez votre texte ici")); + nodeRect.setPreferedSize(new Dimension(200, 100)); + nodeRect.setPreferedLocation(new Point(350, 125)); + //ajout du node au layout + addNode(nodeRect); + + return nodeRect; + } + + /** + * Methode d ajout de composant de base graphique. + * @return + */ + public EbliNode addFleche( ){ + // -- ajout du rectangle --// + final EbliNodeDefault nodeFleche = new EbliNodeDefault(); + nodeFleche.setTitle("Fleche"); + nodeFleche.setCreator(new EbliWidgetCreatorFleche(0)); + nodeFleche.setPreferedSize(new Dimension(100, 50)); + nodeFleche.setPreferedLocation(new Point(350, 125)); + + //ajout du node au layout + addNode(nodeFleche); + + + return nodeFleche; + } + + /** + * Methode utilisee dans la classe fille TrPostFille pour recuperer le calque principal et enregistrer. + * @return + */ + public final ZEbliCalquesPanel getVisuPanel() { + return getCalquePrincipal(); + } + + + /** + * Methode qui construit la toolbar contenant toutes les actions alignements, duplication et premier plan de la scene + * @return + */ + public JToolBar buildToolBar(){ + + JToolBar bar = new JToolBar(); + //-- actions d etat des widgets --// + buildActions(bar); + + //-- action liees a la palette d objets graphiques --// + buildPaletteGraphique(bar); + + bar.setFloatable(false); + + return bar; + } + + + /** + * Ajoute les actions a la toolbar + */ + public void buildActions(JToolBar bar){ + // om met en place le undo/redo + scene_.setCmdMng(new CtuluCommandManager()); + bar.add(new EbliActionSimple("undo", BuResource.BU.getToolIcon("defaire"), "UNDO") { + @Override + public void actionPerformed(ActionEvent _e) { + if (scene_.getCmdMng().canUndo()) + scene_.getCmdMng().undo(); + } + }); + + bar.add(new EbliActionSimple("redo", BuResource.BU.getToolIcon("refaire"), "REDO") { + @Override + public void actionPerformed(ActionEvent _e) { + if (scene_.getCmdMng().canRedo()) + scene_.getCmdMng().redo(); + } + }); + bar.addSeparator(); + //-- actions d alignement --// + bar.add(new EbliWidgetActionAlign.Left(scene_)); + bar.add(new EbliWidgetActionAlign.Right(scene_)); + bar.add(new EbliWidgetActionAlign.Middle(scene_)); + bar.add(new EbliWidgetActionAlign.Center(scene_)); + bar.add(new EbliWidgetActionAlign.Top(scene_)); + bar.add(new EbliWidgetActionAlign.Bottom(scene_)); + bar.addSeparator(); + //-- action de positions --// + bar.add(new EbliWidgetActionForeGround(scene_)); + bar.add(new EbliWidgetActionBackGround(scene_)); + bar.addSeparator(); + //-- action de duplication --// + bar.add(new EbliWidgetActionDuplicate(scene_)); + bar.addSeparator(); + } + + /** + * Ajoute la palette graphique a la toolbar + */ + public void buildPaletteGraphique(JToolBar bar){ + + //-- palette rectangle --// + bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Rectangle texte"), EbliResource.EBLI.getToolIcon("draw-rectangle"), "WIDGETRECTANGLE"){ + public void actionPerformed(ActionEvent _evt) { + System.out.println("je passe dans le actionperformed de layout"); + addRectangle(); + + } + }); + //-- palette fleche --// + bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Fleche"), EbliResource.EBLI.getToolIcon("crystal_bu_link"), "WIDGETFLECHE"){ + public void actionPerformed(ActionEvent _evt) { + System.out.println("je passe dans le actionperformed de layout"); + addFleche(); + //-- rafraichissement de la scene pour eviter les plantages --// + getScene_().refresh(); + } + }); + + //getVisuPanel().getArbreCalqueModel().fillMenu(_m); + } + + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-12 14:51:12 UTC (rev 3780) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-12 15:03:56 UTC (rev 3781) @@ -8,6 +8,7 @@ package org.fudaa.fudaa.tr.post; import java.awt.Dimension; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyVetoException; @@ -56,6 +57,9 @@ import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; @@ -236,9 +240,17 @@ } } - + //FIXME: remplacer par une TrPostLayout = scene ADRIEN => remplac\xE9 mais je conserve cette variable pour me rep\xE9rer dans le code la ou je dois faire des modifs transient TrPostFille fille_; - + + /** + * Fenetre fille qui contient le layout scene. + * Cette fenetre remplace petit a petit fille_ + */ + transient TrPostLayoutFille filleLayout_=new TrPostLayoutFille(); + + + transient BuInternalFrame frVariables_; int idx_; @@ -404,10 +416,21 @@ return res; } + /** + * Methode qui qctive l'internalFrame layout. + */ protected void activeFille() { - impl_.addInternalFrame(fille_); + //impl_.addInternalFrame(fille_); + impl_.addInternalFrame(filleLayout_); } + +/** + * Methode appelee apres ouverture du fichier de resultats. + * @param _destGrid + * @param _prog + * @param _isInitGridDisplay + */ protected void activeProjectionAction(final EfGridInterface _destGrid, final ProgressionInterface _prog, final boolean _isInitGridDisplay) { final CtuluAnalyze ana = new CtuluAnalyze(); @@ -417,21 +440,40 @@ _destGrid, null, getSource().isRubar(), false, getImpl()); projection.openDatas(_prog, null, null, getImpl()); projection.buildDefaultVectors(); + + //creation du postprojet final TrPostProjet trPostProjet = new TrPostProjet(projection, impl_); + + //creation du panel de visualisation du posttraitement final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl_, trPostProjet, projection.getNbFleche() == 0); - final TrPostFille compFille = new TrPostFille(pnVisu); + + //creation de l internalframe qui contient le panel de visu + // final TrPostFille compFille = new TrPostFille(pnVisu); + //creation de la scene layout identique a au dessus + final TrPostLayoutFille compFille = new TrPostLayoutFille(); + + //-- on ajoute le panel de visu comm widget calque au layout --// + compFille.addCalque(MvResource.getS("Maillage initial"), new Point(250, 170), new Dimension(400, 200), pnVisu); + + //test si il faut ajouter le calque if (_isInitGridDisplay) { final MvGridLayerGroup src = new MvGridLayerGroup(getSource().getGrid()); src.setTitle(MvResource.getS("Maillage initial")); src.setVisible(false); + + //on ajoute le calque dans le panel visu pnVisu.addCalque(src); + src.monter(); src.monter(); } + + // titre et action de la internalFrame compFille.setTitle(FDicoLib.getS("Projection")); compFille.setClosable(true); compFille.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + //ajout du listener associe a la fille compFille.addInternalFrameListener(new InternalFrameListener() { public void internalFrameActivated(final InternalFrameEvent _e) {} @@ -451,7 +493,10 @@ public void internalFrameOpened(final InternalFrameEvent _e) {} }); - trPostProjet.fille_ = compFille; + //FIXME ca sert a quoi la ligne du dessous??? + //trPostProjet.fille_ = compFille; + trPostProjet.filleLayout_ = compFille; + BuLib.invokeLater(new Runnable() { public void run() { @@ -462,28 +507,79 @@ } + + //TODO adrien a redefinir +// protected void addFille(final TrPostCourbeTreeModel _model, final String _titre, final ProgressionInterface _prog) { +// final EGGraphe graphe = new EGGraphe(_model); +// graphe.setXAxe(buildDefaultTimeAxe()); +// final FudaaGrapheTimeAnimatedVisuPanel pn = new FudaaGrapheTimeAnimatedVisuPanel(graphe, TrPostCourbeBuilder +// .getSpecActions(graphe, impl_, (TrPostVisuPanel) fille_.getVisuPanel())); +// graphe.setCmd(new CtuluCommandManager()); +// final TrPostCourbeFille fille = new TrPostCourbeFille(pn, _titre, impl_, null); +// fille.setPreferredSize(new Dimension(600, 400)); +// fille.setName("fille" + idxFilleG_++); +// fille.setTitle(_titre + CtuluLibString.ESPACE + CtuluLibString.getString(idxFilleG_)); +// fille.setFrameIcon(EbliResource.EBLI.getToolIcon("curves")); +// // pour charger les icones dans un autre thread. +// pn.getSpecificActions(); +// BuLib.invokeLater(new Runnable() { +// +// public void run() { +// fille.pack(); +// //TODO ne plus gerer de fille mais un Node dans la scene +// impl_.addInternalFrame(fille); +// graphe.restore(); +// } +// }); +// } + /** + * refonte de addFille qui ajoute des widgets + * + */ protected void addFille(final TrPostCourbeTreeModel _model, final String _titre, final ProgressionInterface _prog) { - final EGGraphe graphe = new EGGraphe(_model); - graphe.setXAxe(buildDefaultTimeAxe()); - final FudaaGrapheTimeAnimatedVisuPanel pn = new FudaaGrapheTimeAnimatedVisuPanel(graphe, TrPostCourbeBuilder - .getSpecActions(graphe, impl_, (TrPostVisuPanel) fille_.getVisuPanel())); - graphe.setCmd(new CtuluCommandManager()); - final TrPostCourbeFille fille = new TrPostCourbeFille(pn, _titre, impl_, null); - fille.setPreferredSize(new Dimension(600, 400)); - fille.setName("fille" + idxFilleG_++); - fille.setTitle(_titre + CtuluLibString.ESPACE + CtuluLibString.getString(idxFilleG_)); - fille.setFrameIcon(EbliResource.EBLI.getToolIcon("curves")); - // pour charger les icones dans un autre thread. - pn.getSpecificActions(); - BuLib.invokeLater(new Runnable() { + final EGGraphe graphe = new EGGraphe(_model); + graphe.setXAxe(buildDefaultTimeAxe()); + + /* final FudaaGrapheTimeAnimatedVisuPanel pn = new FudaaGrapheTimeAnimatedVisuPanel(graphe, TrPostCourbeBuilder + .getSpecActions(graphe, impl_, (TrPostVisuPanel) fille_.getVisuPanel())); + */ + graphe.setCmd(new CtuluCommandManager()); + /* + final TrPostCourbeFille fille = new TrPostCourbeFille(pn, _titre, impl_, null); + fille.setPreferredSize(new Dimension(600, 400)); + fille.setName("fille" + idxFilleG_++); + fille.setTitle(_titre + CtuluLibString.ESPACE + CtuluLibString.getString(idxFilleG_)); + fille.setFrameIcon(EbliResource.EBLI.getToolIcon("curves")); + + // pour charger les icones dans un autre thread. + pn.getSpecificActions(); + */ + + //--creation du node associe au graphe --// + final EbliNodeDefault nodeG = new EbliNodeDefault(); + nodeG.setCreator(new EbliWidgetCreatorGraphe(graphe)); + nodeG.setTitle("Graphe " + idxFilleG_++); + nodeG.setPreferedSize(new Dimension(600, 400)); + //FIXME adrien comment recuperer la bonne location ? + nodeG.setPreferedLocation(new Point(20, 20)); + + + + BuLib.invokeLater(new Runnable() { - public void run() { - fille.pack(); - impl_.addInternalFrame(fille); - graphe.restore(); - } - }); - } + public void run() { + // fille.pack(); + //TODO adrien ne plus gerer de fille mais un Node dans la scene + //impl_.addInternalFrame(fille); + + //Ajout du node dans la scene + filleLayout_.addNode(nodeG); + graphe.restore(); + } + }); + } + + protected void addSpecificItemInMainMenu(final BuMenu _menu) { @@ -502,12 +598,23 @@ return new TrPostVisuPanel(impl_, this); } + + /** + * Methode qui parametre la frame layout ainsi que le menu associe. + */ protected void decoreFilleVisu() { - fille_.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); +// fille_.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); + + // fille_.setClosable(true); + // fille_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + + //-- realisation idem pour fillelayout --// + filleLayout_.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); + //filleLayout_.setTitle(s_.getTitle()); + filleLayout_.setClosable(true); + filleLayout_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - // fille_.setTitle(s_.getTitle()); - fille_.setClosable(true); - fille_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + final BuMenuBar menubar = impl_.getMainMenuBar(); final BuMenu menu = new BuMenu(TrResource.getS("Post"), "POST"); menu.setIcon(null); @@ -541,12 +648,19 @@ protected Runnable getRunnableForVisu(final Runnable _other) { return new Runnable() { public void run() { - impl_.addInternalFrame(fille_); - fille_.restaurer(); + //FIXME: ajout le node vue 2d dans la scene et ajouter la scene a impl + // impl_.addInternalFrame(fille_); + + //-- ajout de la frame layout + impl_.addInternalFrame(filleLayout_); + + +// fille_.restaurer(); if (_other != null) { _other.run(); } - fille_.getArbreCalqueModel().getObservable().addObserver(modifyState_); + // fille_.getArbreCalqueModel().getObservable().addObserver(modifyState_); + filleLayout_.getVisuPanel().getArbreCalqueModel().getObservable().addObserver(modifyState_); } }; } @@ -615,7 +729,7 @@ impl_ = _impl; // pour mettre a jour le receveur d'evt impl_.getUndoCmdListener(); - if (fille_ != null) { + if (fille_ != null) { return; // Dans le thread swing } @@ -625,16 +739,35 @@ _impl.setMainMessageAndClear(TrResource .getS("Le fichier des r\xE9sultats a \xE9t\xE9 modifi\xE9: la base de donn\xE9es a \xE9t\xE9 mise \xE0 jour")); } + + //-- lancement du thread d'ouverture du layout avec els widgets calque new CtuluTaskOperationGUI(impl_, TrResource.getS("Ouverture vue 2D...")) { public void act() { final TrPostVisuPanel pnVisu = buildVisuPanel(); - fille_ = new TrPostFille(pnVisu); + + //fille_ = new TrPostFille(pnVisu); + + //--creation de l internalframe layout --// + filleLayout_=new TrPostLayoutFille(); + + //-- ajout du visuPanel au layout --// + filleLayout_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); + + //-- decoration de la fille layout --// decoreFilleVisu(); + // pour charger les icones dans un thread a part - fille_.getVisuPanel().getController().buildActions(); + // fille_.getVisuPanel().getController().buildActions(); + + //-- construction des actions sans passer par la frame fille --// + filleLayout_.getVisuPanel().getController().buildActions(); + + //FIXME adrien comment remplacer cela? final Runnable other = FudaaSaveLib.restoreMainFille(impl_, getSaveFile(), getOldSaveFile(), fille_, getStateReceiver()); + + BuLib.invokeNow(getRunnableForVisu(other)); } }.start(Thread.MAX_PRIORITY); @@ -708,6 +841,12 @@ if (fille_ != null) { fille_.setClosed(true); } + + //fermetire de la fenetre layout + if(filleLayout_ != null) { + filleLayout_.setClosed(true); + } + } catch (PropertyVetoException e) { // ne rien faire .... } @@ -764,9 +903,9 @@ } - public TrPostFille getFille() { - return fille_; - } +// public TrPostFille getFille() { +// return fille_; +// } public final TrPostCommonImplementation getImpl() { return impl_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-13 16:14:12
|
Revision: 3795 http://fudaa.svn.sourceforge.net/fudaa/?rev=3795&view=rev Author: hadouxad Date: 2008-08-13 16:14:17 +0000 (Wed, 13 Aug 2008) Log Message: ----------- - creation du jxtreetablemodel avec 3 colonnes (icon, nom, checkbox) - optimisation d utilisation des objets graphiques avec les renderer (EbliJXTreeTableCellRenderer pour l icone) - gestion des maj en cas d'ajouts suppression d objets - edition du titre des eblinode directement sur le tree - si on clique sur le repertoire courant: ca masque tout les noeuds fils et inversement - integration du tree a droite dans l implementation - surcharge de la methode addFille de trpostProjet, je verrais avec toi comment executer les graphes. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-13 16:13:16 UTC (rev 3794) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-13 16:14:17 UTC (rev 3795) @@ -6,14 +6,18 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.util.EnumSet; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluPopupListener; @@ -26,6 +30,7 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.InplaceEditorProvider; import org.netbeans.api.visual.action.PopupMenuProvider; @@ -51,6 +56,8 @@ private EGGraphe graphe; private EbliNodeDefault nodeLegende=null; + + public EGGraphe getGraphe() { return graphe; } @@ -65,6 +72,7 @@ setGraphe(_graphe); + //-- creation de l action pour editor --// WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); @@ -190,6 +198,9 @@ return panelGraphe; } + + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 16:13:16 UTC (rev 3794) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 16:14:17 UTC (rev 3795) @@ -21,15 +21,20 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxTreeRenderer; +import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.fudaa.fudaa.tr.common.TrResource; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import javax.swing.Box; import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.JTree; +import javax.swing.ListSelectionModel; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuInternalFrame; @@ -69,13 +74,13 @@ /** * Tree associe a la scene. */ - private EbliWidgetJXTree tree_; + private JXTreeTable tree_; + public int indiceLayer=1; - /** * Constructeur de la fenetre. */ @@ -87,7 +92,7 @@ scene_ = new EbliScene(); // -- construction du jtree - +/* // etape 1 construction du model EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1); @@ -98,11 +103,55 @@ tree_ = new EbliWidgetJXTree(model); //renderer du jxtree - EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); tree_.setCellRenderer(renderer); tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); tree_.setEditable(true); //tree_.setPreferredSize(new Dimension(300,600)); +*/ + + // -- construction du JXTABLETREE --// + + //creation du node root--// + DefaultMutableTreeTableNode nodeRoot=new DefaultMutableTreeTableNode("Layer "+indiceLayer); + //-- creation du tablemodel --// + EbliWidgetJXTreeTableModel modeltable= new EbliWidgetJXTreeTableModel(nodeRoot,indiceLayer,scene_); + + //-- ajout au listener de la scene--// + scene_.addEbliNodeListener(modeltable); + + //-- creation du JXtabletree --// + tree_=new JXTreeTable(modeltable); + + //-- ajout du tree au model pour les dimensionnements --// + modeltable.setTree_(tree_); + + //--vision du noeud root --// + tree_.setRootVisible(true); + + //--ajout du renderer pour les images-// + tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); + + //-- ouvert par defaut --// + tree_.expandAll(); + + //-- ajout des highlighters customs --// + tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); + tree_.setShowsRootHandles(true); + //-- selection unique --// + tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tree_.setEditable(true); + + //--dimensions des colonnes --// + tree_.getColumn(0).setPreferredWidth(60); + tree_.getColumn(1).setPreferredWidth(50); + tree_.getColumn(2).setPreferredWidth(5); + //FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se redimensionnents + tree_.getColumn(0).setResizable(false); + tree_.getColumn(1).setResizable(false); + tree_.getColumn(2).setResizable(false); + tree_.validate(); + //-- initialisation de la frame --// init(); } @@ -129,11 +178,11 @@ this.modelTree_ = modelTree_; } - public EbliWidgetJXTree getTree_() { + public JXTreeTable getTree_() { return tree_; } - public void setTree_(EbliWidgetJXTree tree_) { + public void setTree_(JXTreeTable tree_) { this.tree_ = tree_; } @@ -146,7 +195,7 @@ BuPanel content =new BuPanel(new BuBorderLayout()); //-- creation de la box sur le cote qui contient le tree et la sattelite view --// - Box contentEast=Box.createVerticalBox(); + //Box contentEast=Box.createVerticalBox(); this.add(content); @@ -162,13 +211,13 @@ //FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux //ajout du jtree sur la droite getTree_().setPreferredSize(new Dimension(200,500)); - contentEast.add(new BuScrollPane(getTree_())); + //contentEast.add(new BuScrollPane(getTree_())); //-- ajout de la vue sattelite dans la box --// - contentEast.add(getScene_().createSatelliteView()); + //contentEast.add(getScene_().createSatelliteView()); //-- ajout de la box dans le content --// - content.add(contentEast,BuBorderLayout.EAST); + //content.add(contentEast,BuBorderLayout.EAST); // content.doLayout(); //this.pack(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-13 16:13:16 UTC (rev 3794) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-13 16:14:17 UTC (rev 3795) @@ -18,6 +18,7 @@ import java.util.Observer; import java.util.Set; +import javax.swing.JComponent; import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JTable; @@ -613,8 +614,28 @@ //filleLayout_.setTitle(s_.getTitle()); filleLayout_.setClosable(true); filleLayout_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - + //-- agrandissement du panel droit --// + //impl_.getMainPanel().getRightColumn().setPreferredSize(new Dimension(400,impl_.getMainPanel().getPreferredSize().height)); + + + //-- ajout de la vue sattelite de la scene --// + JComponent satt =filleLayout_.getScene_().createSatelliteView(); + + //FIXME Adrien: si je decommente ci-dessous, ca plante, je ne comprends pas!!!!!!! + //impl_.getMainPanel().getRightColumn().addToggledComponent("Aper\xE7u", "SCENEAPERCU",satt,this); + + filleLayout_.getScene_().refresh(); + + //-- ajout du tree de la fille layout dans impl --// + impl_.getMainPanel().getRightColumn().addToggledComponent("Calques", "SCENECALQUES",new BuScrollPane(filleLayout_.getTree_()), this); + + filleLayout_.getScene_().refresh(); + //filleLayout_.getScene_().refresh(); + + + + final BuMenuBar menubar = impl_.getMainMenuBar(); final BuMenu menu = new BuMenu(TrResource.getS("Post"), "POST"); menu.setIcon(null); @@ -642,6 +663,9 @@ } menubar.add(menu, 2); + + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-13 21:13:11
|
Revision: 3796 http://fudaa.svn.sourceforge.net/fudaa/?rev=3796&view=rev Author: deniger Date: 2008-08-13 21:13:14 +0000 (Wed, 13 Aug 2008) Log Message: ----------- modif du JXtreeTable Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.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/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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -157,7 +157,7 @@ return alignWithMoveAction; } - public LayerWidget getVisu_() { + public LayerWidget getVisu() { return visu_; } 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-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -57,7 +57,7 @@ if(foregroundNode!=null && foregroundNode != currentNode && foregroundNode.isMovable() ) //-- ajout au premier plan du node --// - scene_.getVisu_().addChild(foregroundNode.getCreator().getWidget()); + scene_.getVisu().addChild(foregroundNode.getCreator().getWidget()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -48,7 +48,7 @@ if(currentNode.getCreator().getWidget().getState().isSelected()){ //-- ajout au premier plan du node --// - scene_.getVisu_().addChild(currentNode.getCreator().getWidget()); + scene_.getVisu().addChild(currentNode.getCreator().getWidget()); Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,112 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.util.EventObject; - -import javax.swing.AbstractCellEditor; -import javax.swing.JTree; -import javax.swing.event.ChangeEvent; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeCellEditor; -import javax.swing.tree.TreePath; - -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; - -import com.memoire.bu.BuCheckBox; - -/** - * Editeur dans le tree - * - * @author Adrien Hadoux - * - */ -public class EbliCheckBoxNodeEditor extends AbstractCellEditor implements TreeCellEditor { - - -private static final long serialVersionUID = 4576652808917382435L; - -EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); - - ChangeEvent changeEvent = null; - - EbliWidgetJXTree tree; - - public EbliCheckBoxNodeEditor(EbliWidgetJXTree tree) { - this.tree = tree; - } - - public Object getCellEditorValue() { - BuCheckBox checkbox = new BuCheckBox();//renderer.getLeafRenderer().checkBox; - // EbliNodeDefault checkBoxNode = new CheckBoxNode(checkbox.getText(), - // checkbox.isSelected()); - - return checkbox.getText();// checkBoxNode; - } - - public boolean isCellEditable(EventObject event) { - boolean returnValue = false; - if (event instanceof MouseEvent) { - MouseEvent mouseEvent = (MouseEvent) event; - TreePath path = tree.getPathForLocation(mouseEvent.getX(), mouseEvent.getY()); - if (path != null) { - Object node = path.getLastPathComponent(); - if ((node != null) && (node instanceof DefaultMutableTreeNode)) { - DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node; - Object userObject = treeNode.getUserObject(); - returnValue = ((treeNode.isLeaf()) && (userObject instanceof EbliNodeDefault)); - } - } - } - return returnValue; - // return true; - } - - public Component getTreeCellEditorComponent(JTree tree, final Object value, boolean selected, boolean expanded, - boolean leaf, int row) { - - final Component editor = renderer.getTreeCellRendererComponent(tree, value, true, expanded, leaf, row, true); - - // -- recuperation de l instance defaultnode - Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); - - if (userObject instanceof EbliNode && editor instanceof EbliCheckBoxPanel) { - final EbliNodeDefault node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - - // -- suppression des anciens listeners --// - // ((JCheckBox) editor).re - - // ajoute le listener au checkbox pour afficher la widget en fonction de - // son click - if(((EbliCheckBoxPanel) editor).checkBox !=null){ - - System.err.println("checkbox ok poru le node: " + node.getTitle()); - ((EbliCheckBoxPanel) editor).checkBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - - // -- on rend visible la widget en fonction de la checkbox - node.getCreator().getWidget().setVisible((((EbliCheckBoxPanel) editor).checkBox).isSelected()); - node.getCreator().getWidget().getEbliScene().refresh(); - - //-- mise a jour de l icone --// - if(((EbliCheckBoxPanel) editor).checkBox.isSelected()) - ((EbliCheckBoxPanel) editor).labelRenderer.setIcon(renderer.iconLeafEnabled); - - else - ((EbliCheckBoxPanel) editor).labelRenderer.setIcon(renderer.iconLeafDisabled); - - - } - }); - }else{ - System.err.println("checkbox FALSE poru le node: " + node.getTitle()); - } - - } - - return editor; - } -} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -0,0 +1,51 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import java.awt.Component; +import java.awt.Graphics; + +import javax.swing.Icon; +import javax.swing.tree.TreeCellRenderer; + +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.jdesktop.swingx.renderer.DefaultTreeRenderer; +import org.jdesktop.swingx.renderer.IconValue; +import org.jdesktop.swingx.renderer.StringValue; + +public class EbliWidgetCellRendererBuilder { + + private static final class WidgetIconValue implements IconValue { + public Icon getIcon(Object _value) { + EbliNodeDefault node = new EbliNodeDefault(); + Icon ic = new Icon() { + + public void paintIcon(Component _c, Graphics _g, int _x, int _y) { + _g.drawRoundRect(_x, _y, 16, 16, 3, 3); + _g.drawRoundRect(_x + 4, _y + 4, 8, 8, 3, 3); + // TODO Auto-generated method stub + + } + + public int getIconWidth() { + return 16; + } + + public int getIconHeight() { + return 16; + } + }; + System.err.println("eee " + _value.getClass()); + // TODO Auto-generated method stub + return ic; + } + } + + public static TreeCellRenderer getNodeIconCellRenderer() { + return new DefaultTreeRenderer(new WidgetIconValue(), new StringValue() { + + public String getString(Object _value) { + // TODO Auto-generated method stub + return ""; + } + }); + } +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTree.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,41 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; - - -import org.jdesktop.swingx.JXTree; - -public class EbliWidgetJXTree extends JXTree implements TreeSelectionListener{ - - - // modele du tree - private EbliWidgetJXTreeModel model_; - - - - public EbliWidgetJXTree(EbliWidgetJXTreeModel newModel) { - super(newModel.getModeleTree()); - // TODO Auto-generated constructor stub - model_=newModel; - - //-- selection unique des elments du - - } - - public EbliWidgetJXTreeModel getModel_() { - return model_; - } - - public void setModel_(EbliWidgetJXTreeModel model_) { - this.model_ = model_; - } - - public void valueChanged(TreeSelectionEvent e) { - // TODO Auto-generated method stub - - } - - - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,140 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.swing.Icon; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeListener; -import org.fudaa.ebli.visuallibrary.EbliScene; - - -/** - * Modele du Jxtree: - * contient l'ensemble des infos du tree - * les infos sont des node referencant les widgets - * @author Adrien Hadoux - * - */ -public class EbliWidgetJXTreeModel implements EbliNodeListener{ - -public static String NAMELAYER="Layer"; - -//-- noeud aui se trouve au sommet --// -public DefaultMutableTreeNode nodeRoot_; - -//-- modele du tree --// -DefaultTreeModel modeleTree; - - - - - - -//-- scene principale pour recuperer la liste des noeuds --// -//EbliScene scene; - -public EbliWidgetJXTreeModel(int numLayer/*, EbliScene scene*/) { - - // TODO Auto-generated constructor stub - - nodeRoot_=new DefaultMutableTreeNode(NAMELAYER+numLayer); - - //this.scene=scene; - - //-- construction de la hierarchie des nodes a partir des nodes de la scene --// - //constructModelNode(); - - - modeleTree=new DefaultTreeModel(nodeRoot_); -} - - -public DefaultTreeModel getModeleTree() { - return modeleTree; -} - - -public void setModeleTree(DefaultTreeModel modeleTree) { - this.modeleTree = modeleTree; -} - - -public void setNodeRoot_(DefaultMutableTreeNode nodeRoot_) { - this.nodeRoot_ = nodeRoot_; -} - - -/** - * methode qui construit la hierarchie des nodes a partir de la scene - */ -/* - public DefaultMutableTreeNode constructModelNode(){ - - //-- recuperation de la liste des nodes de scene --// - ArrayList<EbliNode> listeNodes=new ArrayList<EbliNode>(scene.getNodes()); - - for(Iterator<EbliNode> it=listeNodes.iterator();it.hasNext();){ - //-- pqr lq suite on pourra faire un test si le noeud est sous element, par exemple la legende par rapport au graphe --// - EbliNode node=it.next(); - nodeRoot_.add(new DefaultMutableTreeNode(node)); - } - return nodeRoot_; - } -*/ - -public DefaultMutableTreeNode getNodeRoot_() { - return nodeRoot_; -} - -public void addNode(EbliNode node){ -nodeRoot_.add(new DefaultMutableTreeNode(node)); - -//-- rafraichissement du modele --// -modeleTree.reload(); - -} - - -public void nodeAdded(EbliNode node) { - addNode(node); - - -} - - -public void noderemoved(EbliNode _node) { - // TODO Auto-generated method stub - - //-- reconstruction des noeuds --// - nodeRoot_.removeAllChildren(); - - //-- recuperation de la scene --// - EbliScene scene=_node.getCreator().getWidget().getEbliScene(); - - //-- recuperation de la liste des nodes de scene --// - ArrayList<EbliNode> listeNodes=new ArrayList<EbliNode>(scene.getNodes()); - - for(Iterator<EbliNode> it=listeNodes.iterator();it.hasNext();){ - //-- pqr lq suite on pourra faire un test si le noeud est sous element, par exemple la legende par rapport au graphe --// - EbliNode node=it.next(); - nodeRoot_.add(new DefaultMutableTreeNode(node)); - } - - //-- rafraichissement du modele --// - modeleTree.reload(); - -} - - - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,442 +1,435 @@ package org.fudaa.ebli.visuallibrary.tree; -import java.awt.Checkbox; -import java.awt.Image; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; +import java.util.List; import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.jdesktop.swingx.JXTreeTable; -import org.jdesktop.swingx.treetable.AbstractTreeTableModel; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableModel; +import org.jdesktop.swingx.treetable.TreeTableNode; +import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuLabel; - /** - * Model du treetable. - * contient 3 colonnes: - * colonne 1:icone - * colonne 2:nom - * colonne 3:checkbox associee + * Model du treetable. contient 3 colonnes: colonne 1:icone colonne 2:nom + * colonne 3:checkbox associee * * @author Adrien Hadoux - * + * */ -public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener{ +public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener { - //-- le nombre de colonnes est statique --// - final static int NBCOLUMN=3; - - /** - * titres des colonnes. - */ - public String[] title={"Icon","Nom","V" }; - - /** - * Icones associees au treemodeltable. - */ - public Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); - public Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_cacher"); - public Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); - public Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); - - /** - * composant graphique utiliser ppuor afficher l etat masquer/visible du widget . - */ - public BuCheckBox chexBox_=new BuCheckBox(); - - public BuLabel labelIcon=new BuLabel(); - - public BuLabel labelTexte=new BuLabel(); - - /** - * scene dont le model est associe - */ - public EbliScene scene_; - - /** - * numero du layer - */ - int numLayer; - - JXTreeTable tree_; - - - public JXTreeTable getTree_() { - return tree_; - } + // -- le nombre de colonnes est statique --// + final static int NBCOLUMN = 3; - public void setTree_(JXTreeTable tree_) { - this.tree_ = tree_; - } + /** + * titres des colonnes. + */ + public String[] title = { "", EbliLib.getS("Nom"), "V" }; + /** + * Icones associees au treemodeltable. + */ + // public Icon iconLeafEnabled = + // CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + // public Icon iconLeafDisabled = + // CtuluResource.CTULU.getIcon("crystal22_cacher"); + // public Icon iconSubDirectorie = CtuluResource.CTULU.getIcon("reouvrir_26"); + // public Icon iconRoot = CtuluResource.CTULU.getIcon("maison_32"); + // + // /** + // * composant graphique utiliser ppuor afficher l etat masquer/visible du + // * widget . + // */ + // public BuCheckBox chexBox_ = new BuCheckBox(); + // + // public BuLabel labelIcon = new BuLabel(); + // + // public BuLabel labelTexte = new BuLabel(); + /** + * scene dont le model est associe + */ + // public EbliScene scene_; + /** + * numero du layer + */ + // int numLayer; + // FIXME le model n'a pas a connaitre le JXTree + // JXTreeTable tree_; + // + // public JXTreeTable getTree() { + // return tree_; + // } + // + // public void setTree_(JXTreeTable tree) { + // this.tree_ = tree; + // } + // -- noeud aui se trouve au sommet --// + // FIXME deja donne par getNodeRoot + // DefaultMutableTreeTableNode nodeRoot_; + /** + * constructeur. + * + * @param numLayer + * @param scene_ + */ + public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot/* + * , + * Widget + * parent + */) { + super(nodeRoot); + // this.numLayer = numLayer; + // this.scene_ = scene_; - //-- noeud aui se trouve au sommet --// - DefaultMutableTreeTableNode nodeRoot_; - - /** - * constructeur. - * @param numLayer - * @param scene_ - */ - public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot,int numLayer, EbliScene scene_) { - super(nodeRoot); - this.numLayer = numLayer; - this.scene_ = scene_; - - //--initialisation du node root --// - nodeRoot_=nodeRoot;//new DefaultMutableTreeTableNode("Layer "+numLayer); - - - } + // --initialisation du node root --// + // nodeRoot_ = nodeRoot;// new + // DefaultMutableTreeTableNode("Layer "+numLayer); - public Class<?> getColumnClass(int arg0) { - // TODO Auto-generated method stub - switch(arg0){ - case 0: return Icon.class; - case 1: return String.class; - case 2: return Boolean.class; - default: return null; - } - - } + } - public int getColumnCount() { - // TODO Auto-generated method stub - return NBCOLUMN; - } + public void nodeAdded(EbliNode _node) { + refresh(); + } - public String getColumnName(int arg0) { - // TODO Auto-generated method stub - if(arg0<NBCOLUMN) - return title[arg0]; - else return ""; - } + public void noderemoved(EbliNode _node) { + refresh(); + } - public int getHierarchicalColumn() { - // TODO Auto-generated method stub - return 0; - } + private void refresh() { + EbliWidgetTreeTableNode root = (EbliWidgetTreeTableNode) getRoot(); - /** - * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. - */ - public Object getValueAt(Object arg0, int column) { - - - //-- recuperation du mutableTreenode qui contient le node de la scene --// - DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode)arg0; + Enumeration<? extends MutableTreeTableNode> children = root.children(); + int childCount = root.getChildCount(); + List<TreeTableNode> res = new ArrayList(childCount); + for (int i = 0; i < childCount; i++) { + res.add(root.getChildAt(i)); + } + for (TreeTableNode treeTableNode : res) { + root.remove((MutableTreeTableNode) treeTableNode); + } + EbliWidgetTreeTableNode.fillRoot(root); + modelSupport.fireNewRoot(); + } - //-- test si il s agit du node root --// - if(nodeTree == nodeRoot_) - { - if(column==0){ - labelIcon.setIcon(iconRoot); - return iconRoot;//labelIcon; - } - else - if(column==1){ - - return "Layer "+numLayer; - } - else{ - // recherche si au moins un sous fils est affiche sinon retourne false - boolean auMoinsUnSousElementAffiche=false; - - Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - while(liste.hasMoreElements() && !auMoinsUnSousElementAffiche){ - - //System.err.println("je suis setValueAt(Object arg0, int column et value) )"+box); - DefaultMutableTreeTableNode modif= (DefaultMutableTreeTableNode) liste.nextElement(); - - - //-- si il existe au moins un sous fils qi est affiche alors on est ok --// - if(((Boolean)getValueAt(modif, 2)).booleanValue()){ - auMoinsUnSousElementAffiche=true; - } - - } - - return auMoinsUnSousElementAffiche; - } - } - //--recuperation du node de la scene --// - EbliNode node= (EbliNode) nodeTree.getUserObject(); - + public Class<?> getColumnClass(int arg0) { + // TODO Auto-generated method stub + switch (arg0) { + case 0: + return Icon.class; + case 1: + return String.class; + case 2: + return Boolean.class; + default: + return null; + } - - //-- cas 1 recuperation de l icone --// - if(column==0){ - if(node.hasWidget() && node.getCreator().getWidget().isVisible()) - labelIcon.setIcon(iconLeafEnabled); - else - labelIcon.setIcon(iconLeafDisabled); - - return iconLeafEnabled;//labelIcon; - - }else - //-- recuperation du title --// - if(column==1){ - //labelTexte.setText(node.getTitle()); - return node.getTitle();//labelTexte; - - }else - //-- recuperation de la checkbox --// - if(column==2){ - boolean coche; - System.err.println("je suis la checbox: wodget selectionee:"+node.getCreator().getWidget().isVisible()); - if(node.hasWidget() && node.getCreator().getWidget().isVisible()) - //coche la checkbox - coche=true;//chexBox_.setSelected(true); - else - coche=false;//chexBox_.setSelected(false); - - return coche;//chexBox_; - } - - - - - return null; - } + } - /** - * seul le texte et la checkbox sont editables - */ - public boolean isCellEditable(Object arg0, int column) { - // TODO Auto-generated method stub + // + // public int getColumnCount() { + // return NBCOLUMN; + // } + // + public String getColumnName(int arg0) { + if (arg0 < NBCOLUMN) + return title[arg0]; + else + return ""; + } + // + // /** + // * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. + // */ + // public Object getValueAt(Object arg0, int column) { + // + // // -- recuperation du mutableTreenode qui contient le node de la scene --// + // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) arg0; + // return nodeTree.getUserObject(); + // // + // // // -- test si il s agit du node root --// + // // if (nodeTree == nodeRoot_) { + // // if (column == 0) { + // // labelIcon.setIcon(iconRoot); + // // return iconRoot;// labelIcon; + // // } else if (column == 1) { + // // + // // return "Layer " + numLayer; + // // } else { + // // // recherche si au moins un sous fils est affiche sinon retourne false + // // boolean auMoinsUnSousElementAffiche = false; + // // + // // Enumeration<MutableTreeTableNode> liste = + // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + // // while (liste.hasMoreElements() && !auMoinsUnSousElementAffiche) { + // // + // // // System.err.println( + // // // "je suis setValueAt(Object arg0, int column et value) )"+box); + // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) + // // liste.nextElement(); + // // + // // // -- si il existe au moins un sous fils qi est affiche alors on est + // // // ok --// + // // if (((Boolean) getValueAt(modif, 2)).booleanValue()) { + // // auMoinsUnSousElementAffiche = true; + // // } + // // + // // } + // // + // // return auMoinsUnSousElementAffiche; + // // } + // // } + // // // --recuperation du node de la scene --// + // // EbliNode node = (EbliNode) nodeTree.getUserObject(); + // // + // // // -- cas 1 recuperation de l icone --// + // // if (column == 0) { + // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) + // // labelIcon.setIcon(iconLeafEnabled); + // // else + // // labelIcon.setIcon(iconLeafDisabled); + // // + // // return iconLeafEnabled;// labelIcon; + // // + // // } else + // // // -- recuperation du title --// + // // if (column == 1) { + // // // labelTexte.setText(node.getTitle()); + // // return node.getTitle();// labelTexte; + // // + // // } else + // // // -- recuperation de la checkbox --// + // // if (column == 2) { + // // boolean coche; + // // System.err.println("je suis la checbox: wodget selectionee:" + + // // node.getCreator().getWidget().isVisible()); + // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) + // // // coche la checkbox + // // coche = true;// chexBox_.setSelected(true); + // // else + // // coche = false;// chexBox_.setSelected(false); + // // + // // return coche;// chexBox_; + // // } + // // + // // return null; + // } + // + // /** + // * seul le texte et la checkbox sont editables + // */ + // public boolean isCellEditable(Object arg0, int column) { + // // TODO Auto-generated method stub + // + // if (column == 0 || column >= NBCOLUMN) + // return false; + // else + // return true; + // } + // + // /** + // * placer une valeur + // */ + // + // public void setValueAt(Object value, Object nodeT, int column) { + // // TODO Auto-generated method stub + // + // // -- recuperation du mutableTreenode qui contient le node de la scene --// + // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) nodeT; + // + // // // -- on essaie de masquer tous les sous repertoires --// + // // if (nodeTree == nodeRoot_ && column == 2) { + // // + // // // si on coche sur la check, on fait tout disparaitre + // // // --recupeation de la checkBox --// + // // boolean box = ((Boolean) value).booleanValue(); + // // Enumeration<MutableTreeTableNode> liste = + // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); + // // while (liste.hasMoreElements()) { + // // + ////System.err.println("je suis setValueAt(Object arg0, int column et value) )" + // // + box); + // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) + // // liste.nextElement(); + // // + // // //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible( + // // // box); + // // + // // // -- envoi du signal a tous les noeuds fils: reccurence sur le checkbox + // // // --// + // // setValueAt(value, modif, 2); + // // + // // } + // // + // // } + // // // -- si node tree = ROOT on arrete les frais --// + // // if (!nodeTree.isLeaf()) + // // return; + // // + // // // --recuperation du node de la scene --// + // // EbliNode node = (EbliNode) nodeTree.getUserObject(); + // // + // // // -- recuperation de la value en fonction de la colonne --// + // // if (column == 1) { + // // // --recuperation du nouveau nom --// + // // String newTitle = ((/* BuLabel */String) value);// .getText(); + // // node.setTitle(newTitle); + // // } else { + // // // --recupeation de la checkBox --// + // // boolean box = ((Boolean) value).booleanValue(); + // // + // // // -- affichage de la widget --// + // // node.getCreator().getWidget().setVisible(box); + // // + // // // -- rafraichissement de la scene --// + // // scene_.refresh(); + // // } + // // + // // // rafraichissement de l arbre + // // reload(); + // // + // // setResizeColumn(); + // + // } + // + // /** + // * Raffraichissement maison du jxtreetable + // */ + // public void reload() { + // + // this.modelSupport.fireTreeStructureChanged(new + // TreePath(getPathToRoot(getRoot()))); + // } + // + // /** + // * methode qui redimensionne les colonens du table. + // */ + // // public void setResizeColumn() { + // // if (tree_ == null) + // // return; + // // tree_.getColumn(0).setPreferredWidth(60); + // // tree_.getColumn(1).setPreferredWidth(50); + // // tree_.getColumn(2).setPreferredWidth(5); + // // + // // tree_.getColumn(0).setResizable(false); + // // tree_.getColumn(1).setResizable(false); + // // tree_.getColumn(2).setResizable(false); + // // tree_.validate(); + // // } + // /* + // * public void addTreeModelListener(TreeModelListener l) { // TODO + // * Auto-generated method stub + // * + // * } + // */ + // /* + // * public Object getChild(Object parent, int index) { // TODO Auto-generated + // * method stub DefaultMutableTreeTableNode nodeParent= + // * (DefaultMutableTreeTableNode) parent; + // * + // * return nodeParent.getChildAt(index); + // * + // * } + // * + // * public int getChildCount(Object parent) { // TODO Auto-generated method + // * stub DefaultMutableTreeTableNode nodeParent= + // (DefaultMutableTreeTableNode) + // * parent; return nodeParent.getChildCount(); } + // * + // * public int getIndexOfChild(Object parent, Object child) { // TODO + // * Auto-generated method stub DefaultMutableTreeTableNode nodeParent= + // * (DefaultMutableTreeTableNode) parent; + // * + // * return nodeParent.getIndex((TreeNode) child); } / public Object getRoot() + // { + // * // TODO Auto-generated method stub return nodeRoot_; } + // * + // * public boolean isLeaf(Object _node) { // TODO Auto-generated method stub + // * DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; + // * + // * return node.isLeaf(); } + // * + // * public void removeTreeModelListener(TreeModelListener l) { // TODO + // * Auto-generated method stub + // * + // * } + // * + // * public void valueForPathChanged(TreePath path, Object newValue) { // TODO + // * Auto-generated method stubSystem.err.println( + // * "je suis valueForPathChanged(TreePath path, Object newValue)"); } + // */ + // // -- utilisation de l interface node added + // public void nodeAdded(EbliNode node) { + // // TODO Auto-generated method stub + // + // System.err.println("je suis nodeAdded(EbliNode node)"); + // // -- ajout du nouveau node --// + // + // DefaultMutableTreeTableNode newNode = new + // DefaultMutableTreeTableNode(node); + // // nodeRoot_.add(newNode); + // + // // -- rafraichissement du modele --// + // + // // -- ajout du node dans le tree en fin de liste--// + // // insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); + // + // // -- ajout du node dans le tree en debut de liste--// + // insertNodeInto(newNode, (MutableTreeTableNode) getRoot(), 0); + // + // // setResizeColumn(); + // // scene_.refresh(); + // + // } + // + // /** + // * Methode appelee lorsau elel recoit un signal de suppression de node de la + // * scene. a pour effet de chercher le treetableNode associee et de le + // * supprimer du tree ainsi que mettre a jour l arbre. + // */ + // public void noderemoved(EbliNode node) { + // + // DefaultMutableTreeTableNode Asuppr = null; + // // -- recuperation des nodes --// + // Enumeration<MutableTreeTableNode> liste = + // (Enumeration<MutableTreeTableNode>) getRoot().children(); + // + // while (liste.hasMoreElements() && Asuppr == null) { + // + // DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) + // liste.nextElement(); + // + // // recuperation du node + // EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); + // + // if (nodeSuspect != null && nodeSuspect == node) + // Asuppr = suspect; + // + // } + // + // // -- suppression du node de ses parents + // if (Asuppr != null) + // removeNodeFromParent(Asuppr); + // + // // -- rafraichissement du modele --// + // // modeleTree.reload(); + // reload(); + // + // // setResizeColumn(); + // } - if(column==0 || column>=NBCOLUMN) - return false; - else - return true; - } - - /** - * placer une valeur - */ - - public void setValueAt(Object value, Object nodeT, int column) { - // TODO Auto-generated method stub - - //-- recuperation du mutableTreenode qui contient le node de la scene --// - DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode)nodeT; - - - //-- on essaie de masquer tous les sous repertoires --// - if(nodeTree==nodeRoot_ && column==2){ - - // si on coche sur la check, on fait tout disparaitre - //--recupeation de la checkBox --// - boolean box= ((Boolean) value).booleanValue(); - Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - while(liste.hasMoreElements()){ - - System.err.println("je suis setValueAt(Object arg0, int column et value) )"+box); - DefaultMutableTreeTableNode modif= (DefaultMutableTreeTableNode) liste.nextElement(); - - - //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible(box); - - //-- envoi du signal a tous les noeuds fils: reccurence sur le checkbox --// - setValueAt(value, modif, 2); - - } - - - - - - } - //-- si node tree = ROOT on arrete les frais --// - if(!nodeTree.isLeaf()) - return; - - //--recuperation du node de la scene --// - EbliNode node= (EbliNode) nodeTree.getUserObject(); - - - //-- recuperation de la value en fonction de la colonne --// - if(column==1){ - //--recuperation du nouveau nom --// - String newTitle=((/*BuLabel*/String) value);//.getText(); - node.setTitle(newTitle); - }else{ - //--recupeation de la checkBox --// - boolean box= ((Boolean) value).booleanValue(); - - - //-- affichage de la widget --// - node.getCreator().getWidget().setVisible(box); - - //-- rafraichissement de la scene --// - scene_.refresh(); - } - - //rafraichissement de l arbre - reload(); - - setResizeColumn(); - - } - - - - /** - * Raffraichissement maison du jxtreetable - */ - public void reload(){ - - this.modelSupport.fireTreeStructureChanged(new TreePath(getPathToRoot(nodeRoot_))); - } - - /** - * methode qui redimensionne les colonens du table. - */ - public void setResizeColumn(){ - if(tree_==null) - return; - tree_.getColumn(0).setPreferredWidth(60); - tree_.getColumn(1).setPreferredWidth(50); - tree_.getColumn(2).setPreferredWidth(5); - - tree_.getColumn(0).setResizable(false); - tree_.getColumn(1).setResizable(false); - tree_.getColumn(2).setResizable(false); - tree_.validate(); - } - - - /*public void addTreeModelListener(TreeModelListener l) { - // TODO Auto-generated method stub - - } - -*/ - /* - public Object getChild(Object parent, int index) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; - - return nodeParent.getChildAt(index); - - } - - public int getChildCount(Object parent) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; - return nodeParent.getChildCount(); - } - - public int getIndexOfChild(Object parent, Object child) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode nodeParent= (DefaultMutableTreeTableNode) parent; - - return nodeParent.getIndex((TreeNode) child); - } -/* - public Object getRoot() { - // TODO Auto-generated method stub - return nodeRoot_; - } - - public boolean isLeaf(Object _node) { - // TODO Auto-generated method stub - DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; - - return node.isLeaf(); - } - - public void removeTreeModelListener(TreeModelListener l) { - // TODO Auto-generated method stub - - } - - public void valueForPathChanged(TreePath path, Object newValue) { - // TODO Auto-generated method stub - System.err.println("je suis valueForPathChanged(TreePath path, Object newValue)"); - } -*/ - //-- utilisation de l interface node added - - public void nodeAdded(EbliNode node) { - // TODO Auto-generated method stub - - System.err.println("je suis nodeAdded(EbliNode node)"); - //-- ajout du nouveau node --// - - DefaultMutableTreeTableNode newNode=new DefaultMutableTreeTableNode(node); - //nodeRoot_.add(newNode); - - //-- rafraichissement du modele --// - - //-- ajout du node dans le tree en fin de liste--// - //insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); - - //-- ajout du node dans le tree en debut de liste--// - insertNodeInto(newNode,nodeRoot_, 0); - - - //setResizeColumn(); - //scene_.refresh(); - - } - - - /** - * Methode appelee lorsau elel recoit un signal de suppression de node de la scene. - * a pour effet de chercher le treetableNode associee et de le supprimer du tree ainsi que mettre a jour l arbre. - */ - public void noderemoved(EbliNode node) { - - - DefaultMutableTreeTableNode Asuppr=null; - //-- recuperation des nodes --// - Enumeration<MutableTreeTableNode> liste= (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - - - while(liste.hasMoreElements() && Asuppr==null){ - - - DefaultMutableTreeTableNode suspect= (DefaultMutableTreeTableNode) liste.nextElement(); - - //recuperation du node - EbliNode nodeSuspect=(EbliNode) suspect.getUserObject(); - - if(nodeSuspect!=null && nodeSuspect == node) - Asuppr=suspect; - - - } - - //-- suppression du node de ses parents - if(Asuppr!=null) - removeNodeFromParent(Asuppr); - - - - //-- rafraichissement du modele --// - //modeleTree.reload(); - reload(); - - setResizeColumn(); - } - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -0,0 +1,84 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; +import org.netbeans.api.visual.model.ObjectScene; +import org.netbeans.api.visual.widget.Widget; + +public class EbliWidgetTreeTableNode extends DefaultMutableTreeTableNode { + + public static EbliWidgetTreeTableNode build(EbliScene _sc) { + Widget w = _sc.getVisu(); + EbliWidgetTreeTableNode root = new EbliWidgetTreeTableNode(w); + addChilds(_sc, w, root, null); + return root; + } + + static void fillRoot(EbliWidgetTreeTableNode _root) { + Widget w = (Widget) _root.getUserObject(); + addChilds((ObjectScene) w.getScene(), w, _root, null); + } + + static void addChilds(ObjectScene _sc, Widget w, EbliWidgetTreeTableNode parent, EbliNode parentNode) { + for (Widget child : w.getChildren()) { + EbliNode n = (EbliNode) _sc.findObject(child); + if (n != null && n != parentNode) { + EbliWidgetTreeTableNode treeNode = new EbliWidgetTreeTableNode(n); + parent.add(treeNode); + addChilds(_sc, child, treeNode, n); + } + } + } + + // public Icon iconLeafEnabled = + // CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + boolean root; + + EbliWidgetTreeTableNode(Widget w) { + super(w); + root = true; + + } + + EbliWidgetTreeTableNode(EbliNode _userObject) { + super(_userObject, true); + + } + + public int getColumnCount() { + return 3; + } + + public Object getValueAt(int _column) { + System.err.println("get at" + _column); + if (root) + return "root"; + if (_column == 0) { + return getUserObject(); + } + if (_column == 1) { + return ((EbliNodeDefault) getUserObject()).getTitle(); + } + return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getCreator().getWidget().isVisible()); + } + + @Override + public boolean isEditable(int _column) { + return _column > 0; + } + + @Override + public void setValueAt(Object _value, int _column) { + if (!root) { + if (_column == 1) + ((EbliNode) getUserObject()).setTitle((String) _value); + else if (_column == 2) { + ((EbliNode) getUserObject()).getCreator().getWidget().setVisible(((Boolean) _value).booleanValue()); + ((EbliNode) getUserObject()).getCreator().getWidget().getEbliScene().refresh(); + } + } + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -44,6 +44,7 @@ import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorDblFleche; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorFleche; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangle; @@ -55,10 +56,10 @@ import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxTreeRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetCellRendererBuilder; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetTreeTableNode; +import org.jdesktop.swingx.JXTreeTable; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.border.BorderFactory; import org.netbeans.api.visual.model.ObjectState; @@ -156,18 +157,15 @@ // -- construction du jtree // etape 1 construction du model - EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1/* ,scene */); + // EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1/* ,scene */); // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene - scene.addEbliNodeListener(model); + // scene.addEbliNodeListener(model); // etape 3 creation du jtree - EbliWidgetJXTree tree = new EbliWidgetJXTree(model); - EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); - tree.setCellRenderer(renderer); - tree.setCellEditor(new EbliCheckBoxNodeEditor(tree)); - tree.setEditable(true); + // tree.setCellEditor(new EbliCheckBoxNodeEditor(tree)); + // tree.setEditable(true); // -- creation d un noeud Graphe --// final EbliNodeDefault nodeG = new EbliNodeDefault(); @@ -240,7 +238,9 @@ nodeFleche.setPreferedSize(new Dimension(100, 100)); nodeFleche.setPreferedLocation(new Point(250, 525)); scene.addNode(nodeFleche); - + EbliWidget widget = nodeFleche.getCreator().getWidget(); + widget.removeFromParent(); + node.getCreator().getWidget().addChild(widget); // node.getCreator().getWidget().setState(state) // if(node.getCreator().getWidget().) @@ -282,7 +282,19 @@ f.setSize(new Dimension(1024, 768)); final BuPanel p = new BuPanel(); p.setLayout(new BuBorderLayout()); - p.add(tree, BuBorderLayout.WEST); + EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene)); + scene.addEbliNodeListener(tree); + // FIXME: mettre tout cela dans la construction de EbliWidgetJXTree + // EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + // tree.setCellRenderer(renderer); + //tree.setCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer + // ()); + // tree.getColumn(0).setPreferredWidth(60); + // tree.getColumn(1).setPreferredWidth(50); + // tree.getColumn(2).setPreferredWidth(5); + JXTreeTable view = new JXTreeTable(tree); + view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); + p.add(new JScrollPane(view), BuBorderLayout.WEST); g.setPreferredSize(new Dimension(200, 300)); g.setSize(g.getPreferredSize()); final JTree t = new JTree((EGGrapheTreeModel) g.getModel()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 16:14:17 UTC (rev 3795) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-13 21:13:14 UTC (rev 3796) @@ -1,12 +1,14 @@ package org.fudaa.fudaa.tr.post; -import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; +import javax.swing.JScrollPane; +import javax.swing.JToolBar; +import javax.swing.ListSelectionModel; + import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -20,390 +22,373 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.tree.EbliCheckBoxNodeEditor; import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTree; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeModel; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetTreeTableNode; import org.fudaa.fudaa.tr.common.TrResource; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.decorator.HighlighterFactory; -import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; -import javax.swing.Box; -import javax.swing.JScrollPane; -import javax.swing.JToolBar; -import javax.swing.JTree; -import javax.swing.ListSelectionModel; - import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; -import com.memoire.bu.BuScrollPane; + /** - * InternalFrame qui contient la scene EbliScene. + * InternalFrame qui contient la scene EbliScene. + * * @author Adrien Hadoux - * + * */ public class TrPostLayoutFille extends BuInternalFrame { - /** + /** * */ - private static final long serialVersionUID = -2769884291563880931L; + private static final long serialVersionUID = -2769884291563880931L; - /** - * scene de l internalFrame. - */ - final private EbliScene scene_; + /** + * scene de l internalFrame. + */ + final private EbliScene scene_; - /** - * Calque principal associ\xE9 a la vue layout. - */ - private ZEbliCalquesPanel calquePrincipal; + /** + * Calque principal associ\xE9 a la vue layout. + */ + private ZEbliCalquesPanel calquePrincipal; + /** + * Model du Jxtree associe. + */ + // private EbliWidgetJXTreeModel modelTree_; + /** + * Tree associe a la scene. + */ + private JXTreeTable tree_; + public int indiceLayer = 1; + /** + * Constructeur de la fenetre. + */ + public TrPostLayoutFille() { + super(); + // TODO Auto-generated constructor stub + setTitle(TrResource.getS("vue 2D")); + // creation de la scene EBLI + scene_ = new EbliScene(); - /** - * Model du Jxtree associe. - */ - private EbliWidgetJXTreeModel modelTree_; + // -- construction du jtree + /* + * // etape 1 construction du model EbliWidgetJXTreeModel model = new + * EbliWidgetJXTreeModel(1); + * + * // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene + * scene_.addEbliNodeListener(model); + * + * // etape 3 creation du jxtree tree_ = new EbliWidgetJXTree(model); + * + * //renderer du jxtree EbliJXTreeTableCellRenderer renderer = new + * EbliJXTreeTableCellRenderer(); tree_.setCellRenderer(renderer); + * tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); + * tree_.setEditable(true); //tree_.setPreferredSize(new + * Dimension(300,600)); + */ - /** - * Tree associe a la scene. - */ - private JXTreeTable tree_; + // -- construction du JXTABLETREE --// + // creation du node root--// + // DefaultMutableTreeTableNode nodeRoot=new + // DefaultMutableTreeTableNode("Layer "+indiceLayer); + // -- creation du tablemodel --// + EbliWidgetJXTreeTableModel modeltable = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene_)); + // -- ajout au listener de la scene--// + scene_.addEbliNodeListener(modeltable); - public int indiceLayer=1; + // -- creation du JXtabletree --// + tree_ = new JXTreeTable(modeltable); + // -- ajout du tree au model pour les dimensionnements --// + // modeltable.setTree_(tree_); + // --vision du noeud root --// + tree_.setRootVisible(false); - /** - * Constructeur de la fenetre. - */ - public TrPostLayoutFille() { - super(); - // TODO Auto-generated constructor stub - setTitle(TrResource.getS("vue 2D")); - // creation de la scene EBLI - scene_ = new EbliScene(); + // --ajout du renderer pour les images-// + tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - // -- construction du jtree -/* - // etape 1 construction du model - EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1); + // -- ouvert par defaut --// + tree_.expandAll(); - // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene - scene_.addEbliNodeListener(model); + // -- ajout des highlighters customs --// + tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); + tree_.setShowsRootHandles(true); + // -- selection unique --// + tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tree_.setEditable(true); - // etape 3 creation du jxtree - tree_ = new EbliWidgetJXTree(model); + // --dimensions des colonnes --// + tree_.getColumn(0).setPreferredWidth(60); + tree_.getColumn(1).setPreferredWidth(50); + tree_.getColumn(2).setPreferredWidth(5); + // FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se + // redimensionnents + tree_.getColumn(0).setResizable(false); + tree_.getColumn(1).setResizable(false); + tree_.getColumn(2).setResizable(false); + tree_.validate(); - //renderer du jxtree - EbliJXTreeTableCellRenderer renderer = new EbliJXTreeTableCellRenderer(); - tree_.setCellRenderer(renderer); - tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); - tree_.setEditable(true); - //tree_.setPreferredSize(new Dimension(300,600)); -*/ - - // -- construction du JXTABLETREE --// - - //creation du node root--// - DefaultMutableTreeTableNode nodeRoot=new DefaultMutableTreeTableNode("Layer "+indiceLayer); - //-- creation du tablemodel --// - EbliWidgetJXTreeTableModel modeltable= new EbliWidgetJXTreeTableModel(nodeRoot,indiceLayer,scene_); - - //-- ajout au listener de la scene--// - scene_.addEbliNodeListener(modeltable); - - //-- creation du JXtabletree --// - tree_=new JXTreeTable(modeltable); - - //-- ajout du tree au model pour les dimensionnements --// - modeltable.setTree_(tree_); - - //--vision du noeud root --// - tree_.setRootVisible(true); - - //--ajout du renderer pour les images-// - tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - - //-- ouvert par defaut --// - tree_.expandAll(); - - //-- ajout des highlighters customs --// - tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); - tree_.setShowsRootHandles(true); - //-- selection unique --// - tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tree_.setEditable(true); - - //--dimensions des colonnes --// - tree_.getColumn(0).setPreferredWidth(60); - tree_.getColumn(1).setPreferredWidth(50); - tree_.getColumn(2).setPreferredWidth(5); - //FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se redimensionnents - tree_.getColumn(0).setResizable(false); - tree_.getColumn(1).setResizable(false); - tree_.getColumn(2).setResizable(false); - tree_.validate(); - - //-- initialisation de la frame --// - init(); - } + // -- initialisation de la frame --// + init(); + } + public ZEbliCalquesPanel getCalquePrincipal() { + return calquePrincipal; + } - public ZEbliCalquesPanel getCalquePrincipal() { - return calquePrincipal; - } + public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { + this.calquePrincipal = calquePrincipal; + } - public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { - this.calquePrincipal = calquePrincipal; - } + public EbliScene getScene_() { + return scene_; + } - public EbliScene getScene_() { - return scene_; - } +// public EbliWidgetJXTreeModel getModelTree_() { +// return modelTree_; +// } +// +// public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { +// this.modelTree_ = modelTree_; +// } + public JXTreeTable getTree_() { + return tree_; + } - public EbliWidgetJXTreeModel getModelTree_() { - return modelTree_; - } + public void setTree_(JXTreeTable tree_) { + this.tree_ = tree_; + } - public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { - this.modelTree_ = modelTree_; - } + /** + * methode appelee pour l init de la construction de la internalframe + */ + public void init() { - public JXTreeTable getTree_() { - return tree_; - } + // -- creation du conteneur de base qui contient tout --// + BuPanel content = new BuPanel(new BuBorderLayout()); - public void setTree_(JXTreeTable tree_) { - this.tree_ = tree_; - } + // -- creation de la box sur le cote qui contient le tree et la sattelite + // view --// + // Box contentEast=Box.createVerticalBox(); - /** - * methode appelee pour l init de la construction de la internalframe - */ - public void init(){ + this.add(content); - //-- creation du conteneur de base qui contient tout --// - BuPanel content =new BuPanel(new BuBorderLayout()); + this.setLayout(new BuBorderLayout()); - //-- creation de la box sur le cote qui contient le tree et la sattelite view --// - //Box contentEast=Box.createVerticalBox(); + // ajout de la scene au centre + content.add(new JScrollPane(scene_.createView()), BuBorderLayout.CENTER); + // FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux + // ajout du jtree sur la droite + getTree_().setPreferredSize(new Dimension(200, 500)); + // contentEast.add(new BuScrollPane(getTree_())); - this.add(content); + // -- ajout de la vue sattelite dans la box --// + // contentEast.add(getScene_().createSatelliteView()); - this.setLayout(new BuBorderLayout()); + // -- ajout de la box dans le content --// + // content.add(contentEast,BuBorderLayout.EAST); + // content.doLayout(); + // this.pack(); + this.setVisible(true); + // -- construction de la barre des commandes de base --// + content.add(buildToolBar(), BuBorderLayout.NORTH); - //ajout de la scene au centre - content.add(new JScrollPane(scene_.createView()),BuBorderLayout.CENTER); + } - - //FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux - //ajout du jtree sur la droite - getTree_().setPreferredSize(new Dimension(200,500)); - //contentEast.add(new BuScrollPane(getTree_())); + /** + * Methode generique d ajout d un node widget a la scene. + * + * @param node + */ + public void addNode(EbliNode node) { + getScene_().addNode(node); - //-- ajout de la vue sattelite dans la box --// - //contentEast.add(getScene_().createSatelliteView()); + // -- rafraichissement de la scene pour eviter les plantages --// + getScene_().refresh(); + } - //-- ajout de la box dans le content --// - //content.add(contentEast,BuBorderLayout.EAST); + /** + * Methode specialisee dans l ajout d un ndoe de type calque a la scene. + * + * @param title + * de la widget + * @param preferredLocation + * de la widget + * @param preferedDimension + * de la widget + * @param calque + * contenu de la widget + * @return le node cree + */ + public EbliNode addCalque(String title, Point preferredLocation, Dimension preferedDimension, ZEbliCalquesPanel calque) { - // content.doLayout(); - //this.pack(); - this.setVisible(true); + // -- enregistrement du calque principal --// + if (calquePrincipal == null) + // -- alors le calque recupere sera considere comem le calque principal + // --// + setCalquePrincipal(calque); + // on ajoute le calque sous forme d'un node - //-- construction de la barre des commandes de base --// - content.add(buildToolBar(),BuBorderLayout.NORTH); + // construction du node correspondant + final EbliNode nodeCalque = new EbliNodeDefault(); + nodeCalque.setTitle(title); + nodeCalque.setPreferedSize(preferedDimension);// new Dimension(400, 200) + nodeCalque.setPreferedLocation(preferredLocation);// new Point(250, 170) + nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(calque)); + ... [truncated message content] |
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] |
From: <de...@us...> - 2008-08-14 21:42:35
|
Revision: 3807 http://fudaa.svn.sourceforge.net/fudaa/?rev=3807&view=rev Author: deniger Date: 2008-08-14 21:42:43 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Corrections bogues Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/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/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java branches/Prepro-0.92-SNAPSHOT/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/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -29,7 +29,6 @@ // 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())); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -4,6 +4,6 @@ void nodeAdded(EbliNode node); - void noderemoved(EbliNode node); + void nodeRemoved(EbliNode node); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -87,19 +87,16 @@ @Override protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { - // TODO Auto-generated method stub } @Override protected void attachEdgeTargetAnchor(EbliEdge edge, EbliNode oldTargetNode, EbliNode targetNode) { - // TODO Auto-generated method stub } @Override protected Widget attachEdgeWidget(EbliEdge edge) { - // TODO Auto-generated method stub return null; } @@ -186,7 +183,7 @@ for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { EbliNodeListener listener = it.next(); - listener.noderemoved(node); + listener.nodeRemoved(node); } } 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 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -4,53 +4,51 @@ import java.util.Iterator; import java.util.Set; -import javax.swing.AbstractAction; import javax.swing.JDialog; +import org.fudaa.ebli.commun.EbliActionSimple; +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.netbeans.api.visual.model.ObjectScene; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuResource; +public class EbliWidgetActionConfigure extends EbliActionSimple { -public class EbliWidgetActionConfigure extends AbstractAction { + ObjectScene scene_; - ObjectScene scene_; + public EbliWidgetActionConfigure(ObjectScene _widget) { + super(EbliLib.getS("Configure"), BuResource.BU.getIcon("configurer"), "CONFIGURE"); + scene_ = _widget; + } - 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); - } + 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; - + 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; + } +} 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 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -23,133 +23,108 @@ 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. + * Classe qui gere un petit panel permettant de changer la police. Style + * logiciel windows. + * * @author Adrien Hadoux - * + * */ -public class EbliWidgetActionFont implements ActionListener{ +public class EbliWidgetActionFont implements ActionListener { - -CtuluCommandContainer cmd_; + CtuluCommandContainer cmd_; -/** - * liste de tous les fontes - */ -BuComboBox fonts ; - + /** + * liste de tous les fontes + */ + BuComboBox fonts; -/** - * scene. - */ -EbliScene scene_; - + /** + * scene. + */ + EbliScene scene_; + public EbliWidgetActionFont(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); - -} + 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 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) { -public void setFonts(BuComboBox fonts) { - this.fonts = fonts; -} + if (e.getSource().equals(fonts)) { + // -- 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>(); -/** - * 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();) { + // -- liste des nodes selectionnes --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// scene_ - 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)); - - } + 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)); + + } + + } + + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -27,6 +27,15 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.fu.FuLog; + +/** + * + * Classe permettant d'afficher un calque en tant que Widget + * + * @author deniger + * + */ public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { ZEbliCalquesPanel calquePanel_; @@ -37,10 +46,9 @@ GrBoite zoom_; - public Color couleurContour=Color.black; - public Color couleurFond=Color.white; + public Color couleurContour = Color.black; + public Color couleurFond = Color.white; - public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { super(scene); calquePanel_ = vue; @@ -61,16 +69,8 @@ } - /* - * (non-Javadoc) - * - * @see - * org.netbeans.api.visual.action.EditProvider#edit(org.netbeans.api.visual - * .widget.Widget) - */ public void edit(Widget _widget) { - if (frame_ != null) - frame_.toFront(); + if (frame_ != null) frame_.toFront(); else { // final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); @@ -88,8 +88,7 @@ @Override public void windowClosed(WindowEvent _e) { - if (frame_ != null) - frame_.dispose(); + if (frame_ != null) frame_.dispose(); frame_ = null; } @@ -121,40 +120,35 @@ Rectangle rec = getClientArea(); Graphics2D g = getGraphics(); - - - + if (frame_ == null) { initSize(rec); + if (zoom_ != null) { + // image=null; + calquePanel_.getVueCalque().changeRepere(this, zoom_); + + } else calquePanel_.restaurer(); } - if (zoom_ != null) { -// image=null; - calquePanel_.getVueCalque().changeRepere(this, zoom_); - } else - calquePanel_.restaurer(); // mode edition if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + FuLog.debug("EWI: recreate image"); Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - - if(image==null) image = calquePanel_.produceImage(rec.width, rec.height, params); - - + } g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } - - - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); + + public void setColorFond(Color newColor) { + couleurFond = newColor; + repaint(); } - - public Color getColorFond(){ - return couleurFond; + + public Color getColorFond() { + return couleurFond; } - + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -6,16 +6,21 @@ import javax.swing.Icon; import javax.swing.tree.TreeCellRenderer; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ctulu.CtuluLibString; import org.jdesktop.swingx.renderer.DefaultTreeRenderer; import org.jdesktop.swingx.renderer.IconValue; import org.jdesktop.swingx.renderer.StringValue; +/** + * @author deniger + * + */ +// TODO a am\xE9liorer public class EbliWidgetCellRendererBuilder { private static final class WidgetIconValue implements IconValue { public Icon getIcon(Object _value) { - EbliNodeDefault node = new EbliNodeDefault(); + // EbliNodeDefault node = new EbliNodeDefault(); Icon ic = new Icon() { public void paintIcon(Component _c, Graphics _g, int _x, int _y) { @@ -33,18 +38,16 @@ return 16; } }; - System.err.println("eee " + _value.getClass()); - // TODO Auto-generated method stub return ic; } } + @SuppressWarnings("serial") public static TreeCellRenderer getNodeIconCellRenderer() { return new DefaultTreeRenderer(new WidgetIconValue(), new StringValue() { public String getString(Object _value) { - // TODO Auto-generated method stub - return ""; + return CtuluLibString.EMPTY_STRING; } }); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -7,9 +7,11 @@ import javax.swing.Icon; import javax.swing.tree.TreePath; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; +import org.fudaa.ebli.visuallibrary.EbliScene; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; @@ -22,448 +24,117 @@ * @author Adrien Hadoux * */ -public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements - EbliNodeListener { +public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener { - // -- le nombre de colonnes est statique --// - final static int NBCOLUMN = 3; + // -- le nombre de colonnes est statique --// + // final static int NBCOLUMN = 3; - /** - * titres des colonnes. - */ - public String[] title = { "", EbliLib.getS("Nom"), "V" }; + /** + * titres des colonnes. + */ + private static final String[] title = { "", EbliLib.getS("Nom"), "V" }; - /** - * Icones associees au treemodeltable. - */ - // public Icon iconLeafEnabled = - // CtuluResource.CTULU.getIcon("crystal22_previsualiser"); - // public Icon iconLeafDisabled = - // CtuluResource.CTULU.getIcon("crystal22_cacher"); - // public Icon iconSubDirectorie = - // CtuluResource.CTULU.getIcon("reouvrir_26"); - // public Icon iconRoot = CtuluResource.CTULU.getIcon("maison_32"); - // - // /** - // * composant graphique utiliser ppuor afficher l etat masquer/visible du - // * widget . - // */ - // public BuCheckBox chexBox_ = new BuCheckBox(); - // - // public BuLabel labelIcon = new BuLabel(); - // - // public BuLabel labelTexte = new BuLabel(); - /** - * scene dont le model est associe - */ - // public EbliScene scene_; - /** - * numero du layer - */ - // int numLayer; - // FIXME le model n'a pas a connaitre le JXTree - // JXTreeTable tree_; - // - // public JXTreeTable getTree() { - // return tree_; - // } - // - // public void setTree_(JXTreeTable tree) { - // this.tree_ = tree; - // } - // -- noeud aui se trouve au sommet --// - // FIXME deja donne par getNodeRoot - // DefaultMutableTreeTableNode nodeRoot_; - /** - * constructeur. - * - * @param numLayer - * @param scene_ - */ - public EbliWidgetJXTreeTableModel(DefaultMutableTreeTableNode nodeRoot/* - * , - * Widget - * parent - */) { - super(nodeRoot); - // this.numLayer = numLayer; - // this.scene_ = scene_; + final EbliScene scene_; - // --initialisation du node root --// - // nodeRoot_ = nodeRoot;// new - // DefaultMutableTreeTableNode("Layer "+numLayer); + /** + * constructeur. + * + * @param numLayer + * @param scene_ + */ + public EbliWidgetJXTreeTableModel(EbliScene _scene) { + super(EbliWidgetTreeTableNode.build(_scene)); + scene_ = _scene; + } - } + public EbliScene getScene() { + return scene_; + } - public void nodeAdded(EbliNode _node) { - refresh(); - } + public void nodeAdded(EbliNode _node) { + refresh(); + } - public void noderemoved(EbliNode _node) { - // refresh(); + public void nodeRemoved(EbliNode _node) { + MutableTreeTableNode aSuppr = findTreeTableNode(_node); - // -- modifs --// - DefaultMutableTreeTableNode Asuppr = null; - // -- recuperation des nodes --// - Enumeration<MutableTreeTableNode> liste = (Enumeration<MutableTreeTableNode>) getRoot().children(); + // -- suppression du node de ses parents + if (aSuppr != null) removeNodeFromParent(aSuppr); - while (liste.hasMoreElements() && Asuppr == null) { + // -- rafraichissement du modele --// + // modeleTree.reload(); + // reload(); - DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) liste.nextElement(); + // setResizeColumn(); - // recuperation du node - EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); + } - if (nodeSuspect != null && nodeSuspect == _node) - Asuppr = suspect; + public MutableTreeTableNode findTreeTableNode(EbliNode _node) { + // -- recuperation des nodes --// + TreeTableNode parent = getRoot(); + Enumeration<? extends TreeTableNode> childrens = parent.children(); + while (childrens.hasMoreElements()) { + MutableTreeTableNode suspect = findTreeTableNode(_node, (MutableTreeTableNode) childrens.nextElement()); + if (suspect != null) return suspect; } + return null; + } - // -- suppression du node de ses parents - if (Asuppr != null) - removeNodeFromParent(Asuppr); + public MutableTreeTableNode findTreeTableNode(EbliNode _node, MutableTreeTableNode parent) { + if (parent.getUserObject() == _node) return parent; + Enumeration<? extends TreeTableNode> childrens = parent.children(); + while (childrens.hasMoreElements()) { + MutableTreeTableNode suspect = (MutableTreeTableNode) childrens.nextElement(); + if (suspect.getUserObject() == _node) return suspect; - // -- rafraichissement du modele --// - // modeleTree.reload(); - reload(); + } + return null; - // setResizeColumn(); - - - } + } - private void refresh() { - EbliWidgetTreeTableNode root = (EbliWidgetTreeTableNode) getRoot(); + private void refresh() { + EbliWidgetTreeTableNode root = (EbliWidgetTreeTableNode) getRoot(); - Enumeration<? extends MutableTreeTableNode> children = root.children(); - int childCount = root.getChildCount(); - List<TreeTableNode> res = new ArrayList(childCount); - for (int i = 0; i < childCount; i++) { - res.add(root.getChildAt(i)); - } - for (TreeTableNode treeTableNode : res) { - removeNodeFromParent((MutableTreeTableNode) treeTableNode); - } - EbliWidgetTreeTableNode.fillRoot(root); - modelSupport.fireNewRoot(); - } + Enumeration<? extends MutableTreeTableNode> children = root.children(); + int childCount = root.getChildCount(); + List<TreeTableNode> res = new ArrayList(childCount); + for (int i = 0; i < childCount; i++) { + res.add(root.getChildAt(i)); + } + for (TreeTableNode treeTableNode : res) { + removeNodeFromParent((MutableTreeTableNode) treeTableNode); + } + EbliWidgetTreeTableNode.fillRoot(root); + modelSupport.fireNewRoot(); + } - public Class<?> getColumnClass(int arg0) { - // TODO Auto-generated method stub - switch (arg0) { - case 0: - return Icon.class; - case 1: - return String.class; - case 2: - return Boolean.class; - default: - return null; - } + public Class<?> getColumnClass(int arg0) { + switch (arg0) { + case 0: + return Icon.class; + case 1: + return String.class; + case 2: + return Boolean.class; + default: + return null; + } - } + } - // - // public int getColumnCount() { - // return NBCOLUMN; - // } - // - public String getColumnName(int arg0) { - if (arg0 < NBCOLUMN) - return title[arg0]; - else - return ""; - } - // - // /** - // * recupere l objet correspondant: il s agit d un defaultMutableTreeNoce. - // */ - // public Object getValueAt(Object arg0, int column) { - // - // // -- recuperation du mutableTreenode qui contient le node de la scene - // --// - // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) - // arg0; - // return nodeTree.getUserObject(); - // // - // // // -- test si il s agit du node root --// - // // if (nodeTree == nodeRoot_) { - // // if (column == 0) { - // // labelIcon.setIcon(iconRoot); - // // return iconRoot;// labelIcon; - // // } else if (column == 1) { - // // - // // return "Layer " + numLayer; - // // } else { - // // // recherche si au moins un sous fils est affiche sinon retourne false - // // boolean auMoinsUnSousElementAffiche = false; - // // - // // Enumeration<MutableTreeTableNode> liste = - // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - // // while (liste.hasMoreElements() && !auMoinsUnSousElementAffiche) { - // // - // // // System.err.println( - // // // "je suis setValueAt(Object arg0, int column et value) )"+box); - // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) - // // liste.nextElement(); - // // - // // // -- si il existe au moins un sous fils qi est affiche alors on est - // // // ok --// - // // if (((Boolean) getValueAt(modif, 2)).booleanValue()) { - // // auMoinsUnSousElementAffiche = true; - // // } - // // - // // } - // // - // // return auMoinsUnSousElementAffiche; - // // } - // // } - // // // --recuperation du node de la scene --// - // // EbliNode node = (EbliNode) nodeTree.getUserObject(); - // // - // // // -- cas 1 recuperation de l icone --// - // // if (column == 0) { - // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) - // // labelIcon.setIcon(iconLeafEnabled); - // // else - // // labelIcon.setIcon(iconLeafDisabled); - // // - // // return iconLeafEnabled;// labelIcon; - // // - // // } else - // // // -- recuperation du title --// - // // if (column == 1) { - // // // labelTexte.setText(node.getTitle()); - // // return node.getTitle();// labelTexte; - // // - // // } else - // // // -- recuperation de la checkbox --// - // // if (column == 2) { - // // boolean coche; - // // System.err.println("je suis la checbox: wodget selectionee:" + - // // node.getCreator().getWidget().isVisible()); - // // if (node.hasWidget() && node.getCreator().getWidget().isVisible()) - // // // coche la checkbox - // // coche = true;// chexBox_.setSelected(true); - // // else - // // coche = false;// chexBox_.setSelected(false); - // // - // // return coche;// chexBox_; - // // } - // // - // // return null; - // } - // - // /** - // * seul le texte et la checkbox sont editables - // */ - // public boolean isCellEditable(Object arg0, int column) { - // // TODO Auto-generated method stub - // - // if (column == 0 || column >= NBCOLUMN) - // return false; - // else - // return true; - // } - // - // /** - // * placer une valeur - // */ - // - // public void setValueAt(Object value, Object nodeT, int column) { - // // TODO Auto-generated method stub - // - // // -- recuperation du mutableTreenode qui contient le node de la scene - // --// - // DefaultMutableTreeTableNode nodeTree = (DefaultMutableTreeTableNode) - // nodeT; - // - // // // -- on essaie de masquer tous les sous repertoires --// - // // if (nodeTree == nodeRoot_ && column == 2) { - // // - // // // si on coche sur la check, on fait tout disparaitre - // // // --recupeation de la checkBox --// - // // boolean box = ((Boolean) value).booleanValue(); - // // Enumeration<MutableTreeTableNode> liste = - // // (Enumeration<MutableTreeTableNode>) nodeRoot_.children(); - // // while (liste.hasMoreElements()) { - // // - // //System.err.println( - // "je suis setValueAt(Object arg0, int column et value) )" - // // + box); - // // DefaultMutableTreeTableNode modif = (DefaultMutableTreeTableNode) - // // liste.nextElement(); - // // - // // - // //((EbliNode)modif.getUserObject()).getCreator().getWidget().setVisible( - // // // box); - // // - // // // -- envoi du signal a tous les noeuds fils: reccurence sur le - // checkbox - // // // --// - // // setValueAt(value, modif, 2); - // // - // // } - // // - // // } - // // // -- si node tree = ROOT on arrete les frais --// - // // if (!nodeTree.isLeaf()) - // // return; - // // - // // // --recuperation du node de la scene --// - // // EbliNode node = (EbliNode) nodeTree.getUserObject(); - // // - // // // -- recuperation de la value en fonction de la colonne --// - // // if (column == 1) { - // // // --recuperation du nouveau nom --// - // // String newTitle = ((/* BuLabel */String) value);// .getText(); - // // node.setTitle(newTitle); - // // } else { - // // // --recupeation de la checkBox --// - // // boolean box = ((Boolean) value).booleanValue(); - // // - // // // -- affichage de la widget --// - // // node.getCreator().getWidget().setVisible(box); - // // - // // // -- rafraichissement de la scene --// - // // scene_.refresh(); - // // } - // // - // // // rafraichissement de l arbre - // // reload(); - // // - // // setResizeColumn(); - // - // } - // - // /** - // * Raffraichissement maison du jxtreetable - // */ - public void reload() { - - this.modelSupport.fireTreeStructureChanged(new TreePath(getPathToRoot(getRoot()))); + public String getColumnName(int arg0) { + if (arg0 < title.length) return title[arg0]; + return CtuluLibString.EMPTY_STRING; } - // - // /** - // * methode qui redimensionne les colonens du table. - // */ - // // public void setResizeColumn() { - // // if (tree_ == null) - // // return; - // // tree_.getColumn(0).setPreferredWidth(60); - // // tree_.getColumn(1).setPreferredWidth(50); - // // tree_.getColumn(2).setPreferredWidth(5); - // // - // // tree_.getColumn(0).setResizable(false); - // // tree_.getColumn(1).setResizable(false); - // // tree_.getColumn(2).setResizable(false); - // // tree_.validate(); - // // } - // /* - // * public void addTreeModelListener(TreeModelListener l) { // TODO - // * Auto-generated method stub - // * - // * } - // */ - // /* - // * public Object getChild(Object parent, int index) { // TODO - // Auto-generated - // * method stub DefaultMutableTreeTableNode nodeParent= - // * (DefaultMutableTreeTableNode) parent; - // * - // * return nodeParent.getChildAt(index); - // * - // * } - // * - // * public int getChildCount(Object parent) { // TODO Auto-generated method - // * stub DefaultMutableTreeTableNode nodeParent= - // (DefaultMutableTreeTableNode) - // * parent; return nodeParent.getChildCount(); } - // * - // * public int getIndexOfChild(Object parent, Object child) { // TODO - // * Auto-generated method stub DefaultMutableTreeTableNode nodeParent= - // * (DefaultMutableTreeTableNode) parent; - // * - // * return nodeParent.getIndex((TreeNode) child); } / public Object - // getRoot() - // { - // * // TODO Auto-generated method stub return nodeRoot_; } - // * - // * public boolean isLeaf(Object _node) { // TODO Auto-generated method - // stub - // * DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _node; - // * - // * return node.isLeaf(); } - // * - // * public void removeTreeModelListener(TreeModelListener l) { // TODO - // * Auto-generated method stub - // * - // * } - // * - // * public void valueForPathChanged(TreePath path, Object newValue) { // - // TODO - // * Auto-generated method stubSystem.err.println( - // * "je suis valueForPathChanged(TreePath path, Object newValue)"); } - // */ - // // -- utilisation de l interface node added - // public void nodeAdded(EbliNode node) { - // // TODO Auto-generated method stub - // - // System.err.println("je suis nodeAdded(EbliNode node)"); - // // -- ajout du nouveau node --// - // - // DefaultMutableTreeTableNode newNode = new - // DefaultMutableTreeTableNode(node); - // // nodeRoot_.add(newNode); - // - // // -- rafraichissement du modele --// - // - // // -- ajout du node dans le tree en fin de liste--// - // // insertNodeInto(newNode,nodeRoot_, nodeRoot_.getChildCount()); - // - // // -- ajout du node dans le tree en debut de liste--// - // insertNodeInto(newNode, (MutableTreeTableNode) getRoot(), 0); - // - // // setResizeColumn(); - // // scene_.refresh(); - // - // } - // - // /** - // * Methode appelee lorsau elel recoit un signal de suppression de node de - // la - // * scene. a pour effet de chercher le treetableNode associee et de le - // * supprimer du tree ainsi que mettre a jour l arbre. - // */ - // public void noderemoved(EbliNode node) { - // - // DefaultMutableTreeTableNode Asuppr = null; - // // -- recuperation des nodes --// - // Enumeration<MutableTreeTableNode> liste = - // (Enumeration<MutableTreeTableNode>) getRoot().children(); - // - // while (liste.hasMoreElements() && Asuppr == null) { - // - // DefaultMutableTreeTableNode suspect = (DefaultMutableTreeTableNode) - // liste.nextElement(); - // - // // recuperation du node - // EbliNode nodeSuspect = (EbliNode) suspect.getUserObject(); - // - // if (nodeSuspect != null && nodeSuspect == node) - // Asuppr = suspect; - // - // } - // - // // -- suppression du node de ses parents - // if (Asuppr != null) - // removeNodeFromParent(Asuppr); - // - // // -- rafraichissement du modele --// - // // modeleTree.reload(); - // reload(); - // - // // setResizeColumn(); - // } + // /** + // * Raffraichissement maison du jxtreetable + // */ + // private void reload() { + // + // this.modelSupport.fireTreeStructureChanged(new + // TreePath(getPathToRoot(getRoot()))); + // } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -52,7 +52,6 @@ } public Object getValueAt(int _column) { - System.err.println("get at" + _column); if (root) return "root"; if (_column == 0) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -323,7 +323,7 @@ f.setSize(new Dimension(1024, 768)); final BuPanel p = new BuPanel(); p.setLayout(new BuBorderLayout()); - EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene)); + EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(scene); scene.addEbliNodeListener(tree); // FIXME: mettre tout cela dans la construction de EbliWidgetJXTree // EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); @@ -335,8 +335,8 @@ // tree.getColumn(2).setPreferredWidth(5); JXTreeTable view = new JXTreeTable(tree); - BConfigurePaletteAction action = new BConfigurePaletteAction(view.getTreeSelectionModel()){ - + BConfigurePaletteAction action = new BConfigurePaletteAction(view.getTreeSelectionModel()) { + protected Object getTarget(final TreeSelectionModel _m) { final TreePath[] p = _m.getSelectionPaths(); @@ -351,7 +351,7 @@ } return null; } - + }; view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); p.add(new JScrollPane(view), BuBorderLayout.WEST); @@ -403,15 +403,13 @@ bar.add(new EbliActionSimple("undo", BuResource.BU.getToolIcon("defaire"), "UNDO") { @Override public void actionPerformed(ActionEvent _e) { - if (scene.getCmdMng().canUndo()) - scene.getCmdMng().undo(); + if (scene.getCmdMng().canUndo()) scene.getCmdMng().undo(); } }); bar.add(new EbliActionSimple("redo", BuResource.BU.getToolIcon("refaire"), "REDO") { @Override public void actionPerformed(ActionEvent _e) { - if (scene.getCmdMng().canRedo()) - scene.getCmdMng().redo(); + if (scene.getCmdMng().canRedo()) scene.getCmdMng().redo(); } }); bar.addSeparator(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-14 19:08:56 UTC (rev 3806) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -1,46 +1,27 @@ package org.fudaa.fudaa.tr.post; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; -import java.awt.event.ActionEvent; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JMenu; +import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JToolBar; -import javax.swing.ListSelectionModel; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUndoRedoInterface; +import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.commun.EbliActionSimple; -import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorFleche; -import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangleTexte; -import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorShape; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorForeground; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; -import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetTreeTableNode; +import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; -import org.jdesktop.swingx.JXTreeTable; -import org.jdesktop.swingx.decorator.HighlighterFactory; +import org.jdesktop.swingx.JXCollapsiblePane; -import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuInternalFrame; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuResource; +import com.memoire.bu.BuUndoRedoInterface; /** * InternalFrame qui contient la scene EbliScene. @@ -48,9 +29,18 @@ * @author Adrien Hadoux * */ -public class TrPostLayoutFille extends BuInternalFrame { +public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, + BuUndoRedoInterface { /** + * @param _node + * @see org.fudaa.fudaa.tr.post.TrPostLayoutPanelController#addNode(org.fudaa.ebli.visuallibrary.EbliNode) + */ + public void addNode(EbliNode _node) { + controller_.addNode(_node); + } + + /** * */ private static final long serialVersionUID = -2769884291563880931L; @@ -58,288 +48,97 @@ /** * scene de l internalFrame. */ - final private EbliScene scene_; + // final private EbliScene scene_; + TrPostLayoutPanelController controller_; - /** - * Calque principal associ\xE9 a la vue layout. - */ - private ZEbliCalquesPanel calquePrincipal; + JComponent right; /** - * Model du Jxtree associe. - */ - // private EbliWidgetJXTreeModel modelTree_; - /** - * Tree associe a la scene. - */ - private JXTreeTable tree_; - - public int indiceLayer = 1; - - /** * Constructeur de la fenetre. */ public TrPostLayoutFille() { super(); - // TODO Auto-generated constructor stub setTitle(TrResource.getS("vue 2D")); // creation de la scene EBLI - scene_ = new EbliScene(); + controller_ = new TrPostLayoutPanelController(new EbliScene()); + setContentPane(controller_.getPanel()); + } - // -- construction du jtree - /* - * // etape 1 construction du model EbliWidgetJXTreeModel model = new - * EbliWidgetJXTreeModel(1); - * - * // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene - * scene_.addEbliNodeListener(model); - * - * // etape 3 creation du jxtree tree_ = new EbliWidgetJXTree(model); - * - * //renderer du jxtree EbliJXTreeTableCellRenderer renderer = new - * EbliJXTreeTableCellRenderer(); tree_.setCellRenderer(renderer); - * tree_.setCellEditor(new EbliCheckBoxNodeEditor(tree_)); - * tree_.setEditable(true); //tree_.setPreferredSize(new - * Dimension(300,600)); - */ + JMenu[] menus_; + JComponent[] tools_; - // -- construction du JXTABLETREE --// - // creation du node root--// - // DefaultMutableTreeTableNode nodeRoot=new - // DefaultMutableTreeTableNode("Layer "+indiceLayer); - // -- creation du tablemodel --// - EbliWidgetJXTreeTableModel modeltable = new EbliWidgetJXTreeTableModel(EbliWidgetTreeTableNode.build(scene_)); - - // -- ajout au listener de la scene--// - scene_.addEbliNodeListener(modeltable); - - // -- creation du JXtabletree --// - tree_ = new JXTreeTable(modeltable); - - // -- ajout du tree au model pour les dimensionnements --// - // modeltable.setTree_(tree_); - - // --vision du noeud root --// - tree_.setRootVisible(false); - - // --ajout du renderer pour les images-// - tree_.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - - // -- ouvert par defaut --// - tree_.expandAll(); - - // -- ajout des highlighters customs --// - tree_.setHighlighters(HighlighterFactory.createSimpleStriping()); - tree_.setShowsRootHandles(true); - // -- selection unique --// - tree_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tree_.setEditable(true); - - // --dimensions des colonnes --// - tree_.getColumn(0).setPreferredWidth(60); - tree_.getColumn(1).setPreferredWidth(50); - tree_.getColumn(2).setPreferredWidth(5); - // FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se - // redimensionnents - tree_.getColumn(0).setResizable(false); - tree_.getColumn(1).setResizable(false); - tree_.getColumn(2).setResizable(false); - tree_.validate(); - - // -- initialisation de la frame --// - init(); + @Override + public JMenu[] getSpecificMenus() { + if (menus_ == null) { + menus_ = new JMenu[] { controller_.createMenu() }; + } + return menus_; } - public ZEbliCalquesPanel getCalquePrincipal() { - return calquePrincipal; + @Override + public JComponent[] getSpecificTools() { + if (tools_ == null) { + tools_ = controller_.createSpecificComponent(getDesktopPane(), this); + } + return tools_; } - public void setCalquePrincipal(ZEbliCalquesPanel calquePrincipal) { - this.calquePrincipal = calquePrincipal; + public void clearCmd(final CtuluCommandManager _source) { + if (getCmdMng() != null && _source != getCmdMng()) { + getCmdMng().clean(); + } } - public EbliScene getScene_() { - return scene_; - } + public JComponent createComponent() { + if (right == null) { + right = new JPanel(new BorderLayout()); -// public EbliWidgetJXTreeModel getModelTree_() { -// return modelTree_; -// } -// -// public void setModelTree_(EbliWidgetJXTreeModel modelTree_) { -// this.modelTree_ = modelTree_; -// } - - public JXTreeTable getTree_() { - return tree_; + JXCollapsiblePane pane = new JXCollapsiblePane(); + JButton toggle = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); + toggle.setText("Overview"); + JPanel over = new JPanel(new BorderLayout()); + over.add(toggle, BorderLayout.NORTH); + over.add(pane, BorderLayout.CENTER); + pane.add(getScene().createSatelliteView()); + right.add(over, BorderLayout.NORTH); + right.add(new JScrollPane(controller_.createTree()), BorderLayout.CENTER); + } + return right; } - public void setTree_(JXTreeTable tree_) { - this.tree_ = tree_; + public ZEbliCalquesPanel getCalquePrincipal() { + return controller_.getCalquePrincipal(); } /** - * methode appelee pour l init de la construction de la internalframe + * @param _title + * @param _preferredLocation + * @param _preferedDimension + * @param _calque + * @return + * @see org.fudaa.fudaa.tr.post.TrPostLayoutPanelController#addCalque(java.lang.String, + * java.awt.Point, java.awt.Dimension, + * org.fudaa.ebli.calque.ZEbliCalquesPanel) */ - public void init() { - - // -- creation du conteneur de base qui contient tout --// - BuPanel content = new BuPanel(new BuBorderLayout()); - - // -- creation de la box sur le cote qui contient le tree et la sattelite - // view --// - // Box contentEast=Box.createVerticalBox(); - - this.add(content); - - this.setLayout(new BuBorderLayout()); - - // ajout de la scene au centre - content.add(new JScrollPane(scene_.createView()), BuBorderLayout.CENTER); - - // FIXME Adrien bug affichage du tree les noeuds sont renfonces sur eux - // ajout du jtree sur la droite - getTree_().setPreferredSize(new Dimension(200, 500)); - // contentEast.add(new BuScrollPane(getTree_())); - - // -- ajout de la vue sattelite dans la box --// - // contentEast.add(getScene_().createSatelliteView()); - - // -- ajout de la box dans le content --// - // content.add(contentEast,BuBorderLayout.EAST); - - // content.doLayout(); - // this.pack(); - this.setVisible(true); - - // -- construction de la barre des commandes de base --// - content.add(buildToolBar(), BuBorderLayout.NORTH); - + public EbliNode addCalque(String _title, Point _preferredLocation, Dimension _preferedDimension, + ZEbliCalquesPanel _calque) { + return controller_.addCalque(_title, _preferredLocation, _preferedDimension, _calque); } - /** - * Methode generique d ajout d un node widget a la scene. - * - * @param node - */ - public void addNode(EbliNode node) { - getScene_().addNode(node); - - // -- rafraichissement de la scene pour eviter les plantages --// - getScene_().refresh(); + public CtuluCommandManager getCmdMng() { + return getScene().getCmdMng(); } - /** - * Methode specialisee dans l ajout d un ndoe de type calque a la scene. - * - * @param title - * de la widget - * @param preferredLocation - * de la widget - * @param preferedDimension - * de la widget - * @param calque - * contenu de la widget - * @return le node cree - */ - public EbliNode addCalque(String title, Point preferredLocation, Dimension preferedDimension, ZEbliCalquesPanel calque) { - - // -- enregistrement du calque principal --// - if (calquePrincipal == null) - // -- alors le calque recupere sera considere comem le calque principal - // --// - setCalquePrincipal(calque); - - // on ajoute le calque sous forme d'un node - - // construction du node correspondant - final EbliNode nodeCalque = new EbliNodeDefault(); - nodeCalque.setTitle(title); - nodeCalque.setPreferedSize(preferedDimension);// new Dimension(400, 200) - nodeCalque.setPreferedLocation(preferredLocation);// new Point(250, 170) - nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(calque)); - - // ajout du node au layout - addNode(nodeCalque); - - return nodeCalque; + public Class getComponentClass() { + return JPanel.class; } - /** - * Methode d ajout de composant de base graphique. - * - * @return - */ - public EbliNode addRectangleTexte() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeRect = new EbliNodeDefault(); - nodeRect.setTitle("Rectangle texte"); - nodeRect.setCreator(new EbliWidgetCreatorRectangleTexte("Tapez votre texte ici")); - nodeRect.setPreferedSize(new Dimension(200, 100)); - nodeRect.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeRect); - - return nodeRect; + public String getComponentTitle() { + return TrLib.getString("Layout"); } - - public EbliNode addEllipse() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeEllipse = new EbliNodeDefault(); - nodeEllipse.setTitle("Ellipse"); - nodeEllipse.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorEllipse())); - nodeEllipse.setPreferedSize(new Dimension(200, 100)); - nodeEllipse.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeEllipse); - return nodeEllipse; - } - - public EbliNode addCercle() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeCercle = new EbliNodeDefault(); - nodeCercle.setTitle("Cercle"); - nodeCercle.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorCircle())); - nodeCercle.setPreferedSize(new Dimension(200, 100)); - nodeCercle.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeCercle); - - return nodeCercle; - } - - - public EbliNode addRectangle() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeCercle = new EbliNodeDefault(); - nodeCercle.setTitle("rectangle"); - nodeCercle.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorRectangle())); - nodeCercle.setPreferedSize(new Dimension(200, 100)); - nodeCercle.setPreferedLocation(new Point(350, 125)); - // ajout du node au layout - addNode(nodeCercle); - - return nodeCercle; - } - - /** - * Methode d ajout de composant de base graphique. - * - * @return - */ - public EbliNode addFleche() { - // -- ajout du rectangle --// - final EbliNodeDefault nodeFleche = new EbliNodeDefault(); - nodeFleche.setTitle("Fleche"); - nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFleche())); - nodeFleche.setPreferedSize(new Dimension(100, 50)); - nodeFleche.setPreferedLocation(new Point(350, 125)); - - // ajout du node au layout - addNode(nodeFleche); - - return nodeFleche; + public EbliScene getScene() { + return controller_.getScene(); } /** @@ -352,118 +151,22 @@ return getCalquePrincipal(); } - /** - * Methode qui construit la toolbar contenant toutes les actions alignements, - * duplication et premier plan de la scene - * - * @return - */ - public JToolBar buildToolBar() { + public void majComponent(Object _o) {} - JToolBar bar = new JToolBar(); - // -- actions d etat des widgets --// - buildActions(bar); - - // -- action liees a la palette d objets graphiques --// - buildPaletteGraphique(bar); - - bar.setFloatable(false); - - return bar; + public void redo() { + final CtuluCommandManager c = getCmdMng(); + if (c != null) { + c.redo(); + } } - /** - * Ajoute les actions a la toolbar - */ - public void buildActions(JToolBar bar) { - // om met en place le undo/redo - scene_.setCmdMng(new CtuluCommandManager()); - bar.add(new EbliActionSimple("undo", BuResource.BU.getToolIcon("defaire"), "UNDO") { - @Override - public void actionPerformed(ActionEvent _e) { - if (scene_.getCmdMng().canUndo()) - scene_.getCmdMng().undo(); - } - }); + public void setActive(final boolean _b) {} - bar.add(new EbliActionSimple("redo", BuResource.BU.getToolIcon("refaire"), "REDO") { - @Override - public void actionPerformed(ActionEvent _e) { - if (scene_.getCmdMng().canRedo()) - scene_.getCmdMng().redo(); - } - }); - bar.addSeparator(); - // -- actions d alignement --// - bar.add(new EbliWidgetActionAlign.Left(scene_)); - bar.add(new EbliWidgetActionAlign.Right(scene_)); - bar.add(new EbliWidgetActionAlign.Middle(scene_)); - bar.add(new EbliWidgetActionAlign.Center(scene_)); - bar.add(new EbliWidgetActionAlign.Top(scene_)); - bar.add(new EbliWidgetActionAlign.Bottom(scene_)); - bar.addSeparator(); - // -- action de positions --// - bar.add(new EbliWidgetActionForeGround(scene_)); - bar.add(new EbliWidgetActionBackGround(scene_)); - bar.addSeparator(); - // -- action de duplication --// - bar.add(new EbliWidgetActionDuplicate(scene_)); - bar.addSeparator(); - - //-- Action sur le format --// - bar.add(new EbliWidgetActionColorForeground(scene_)); - bar.add(new EbliWidgetActionColorBackground(scene_)); - bar.add(new EbliWidgetActionConfigure(scene_)); - bar.addSeparator(); + public void undo() { + final CtuluCommandManager c = getCmdMng(); + if (c != null) { + c.undo(); + } } - /** - * Ajoute la palette graphique a la toolbar - */ - public void buildPaletteGraphique(JToolBar bar) { - bar.addSeparator(); - // -- palette rectangle texte--// - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Rectangle texte"), EbliResource.EBLI - .getToolIcon("draw-rectangle"), "WIDGETRECTANGLE") { - public void actionPerformed(ActionEvent _evt) { - addRectangleTexte(); - } - }); - // -- palette fleche --// - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Fleche"), EbliResource.EBLI - .getToolIcon("crystal_bu_link"), "WIDGETFLECHE") { - public void actionPerformed(ActionEvent _evt) { - addFleche(); - } - }); - //-- palette Ellipse --// - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Ellipse"), EbliResource.EBLI - .getToolIcon("ellip"), "WIDGETELLIPSE") { - public void actionPerformed(ActionEvent _evt) { - - addEllipse(); - } - }); - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Cercle"), EbliResource.EBLI - .getToolIcon("cerc"), "WIDGETCERCLE") { - public void actionPerformed(ActionEvent _evt) { - - addCercle(); - } - }); - bar.add(new EbliActionSimple(EbliResource.EBLI.getString("Rectangle"), EbliResource.EBLI - .getToolIcon("rect"), "WIDGETRECT") { - public void actionPerformed(ActionEvent _evt) { - - addRectangle(); - } - }); - - - - - bar.addSeparator(); - // getVisuPanel().getArbreCalqueModel().fillMenu(_m); - } - } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-14 21:42:43 UTC (rev 3807) @@ -0,0 +1,371 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JDesktopPane; +import javax.swing.JMenu; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionAbstract; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliActionPaletteAbstract; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangleTexte; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorShape; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorBackground; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionColorForeground; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; +import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuDesktop; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuSeparator; + +public class TrPostLayoutPanelController { + + JPanel pn_; + EbliWidgetJXTreeTableModel treeModel_; + List<EbliActionAbstract> actions; + + /** + * Calque principal associ\xE9 a la vue layout. + */ + private ZEbliCalquesPanel calquePrincipal; + + TrPostLayoutPanelController(EbliScene _scene) { + treeModel_ = new EbliWidgetJXTreeTableModel(_scene); + _scene.addEbliNodeListener(treeModel_); + _scene.setCmdMng(new CtuluCommandManager()); + } + + /** + * Methode specialisee dans l ajout d un ndoe de type calque a la scene. + * + * @param title + * de la widget + ... [truncated message content] |
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] |
From: <had...@us...> - 2008-08-18 07:11:56
|
Revision: 3810 http://fudaa.svn.sourceforge.net/fudaa/?rev=3810&view=rev Author: hadouxad Date: 2008-08-18 07:12:03 +0000 (Mon, 18 Aug 2008) Log Message: ----------- - widget qui permet de cr?\195?\169er une image movable, resizable, de la dupliquer et la supprimer - widget editor text html Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/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/EbliWidgetCreatorImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -42,6 +42,8 @@ duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque())); } else if (creator instanceof EbliWidgetCreatorShape) { duplique.setCreator(new EbliWidgetCreatorShape(((EbliWidgetCreatorShape) getCreator()).getTypeObject_())); + } else if (creator instanceof EbliWidgetCreatorImage) { + duplique.setCreator(new EbliWidgetCreatorImage(((EbliWidgetCreatorImage) getCreator()).getG())); } else { // instance pas identifie, impossible de dupliquer return null; Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,41 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Image; + +/** + * Creator de la widget image. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorImage implements EbliWidgetCreator { + + Image image_; + EbliWidgetImage res; + + public EbliWidgetCreatorImage(Image g) { + super(); + this.image_ = g; + } + + public Image getG() { + return image_; + } + + public void setG(Image g) { + this.image_ = g; + } + + public EbliWidget create(EbliScene _scene) { + + res = new EbliWidgetImage(_scene, getG()); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,41 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; + +/** + * creator Editeur de texte widget. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorTextEditor implements EbliWidgetCreator { + + CtuluHtmlEditorPanel editorPane_; + EbliWidgetTextEditor res; + + public EbliWidgetCreatorTextEditor(CtuluHtmlEditorPanel g) { + super(); + this.editorPane_ = g; + } + + public CtuluHtmlEditorPanel getG() { + return editorPane_; + } + + public void setG(CtuluHtmlEditorPanel g) { + this.editorPane_ = g; + } + + public EbliWidget create(EbliScene _scene) { + + res = new EbliWidgetTextEditor(_scene, getG()); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,35 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.image.ImageObserver; + +public class EbliWidgetImage extends EbliWidget implements ImageObserver { + + Image image; + + public EbliWidgetImage(EbliScene scene, Image _img) { + super(scene); + image = _img; + } + + + + protected void paintWidget() { + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + // -- dessin de l'image --// + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, this); + } + + + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + repaint(); + return true; + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,128 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.util.EnumSet; + +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.widget.Widget; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuPanel; + +public class EbliWidgetTextEditor extends EbliWidget implements InplaceEditorProvider<BuPanel> { + + // contenu du texte + String content_ = "Double-cliquez pour \xE9diter"; + + // editeur de texte + CtuluHtmlEditorPanel editorPane_ = new CtuluHtmlEditorPanel(); + // ComponentWidget widget; + BuPanel conteneur = null; + + public EbliWidgetTextEditor(EbliScene scene, CtuluHtmlEditorPanel content) { + super(scene); + editorPane_ = content; + + // widget = new ComponentWidget(scene, editorPane_) { + // public void notifyStateChanged(ObjectState previousState, ObjectState + // newState) { + // + // setBorder(getScene().getLookFeel().getBorder(newState)); + // } + // }; + // + // setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); + // addChild(widget); + // + // -- creation de l action pour editor --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); + + } + + protected void paintWidget() { + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + decoupeEcriture(editorPane_.getDocumentText(), g); + } + + /** + * Methode qui redessine l edition de texte proprement. + * + * @param text + * de l editeur html + * @param g + */ + public void decoupeEcriture(String text, Graphics2D g) { + + int espaceLignes = 10; + + if(text==null || text.length()==0) + return; + + Rectangle rec = getClientArea(); + int indiceDep=0; + int espaceAffichable = Math.min((int) (rec.width / 5), text.length()); + + for (int i = 0; indiceDep + espaceAffichable < text.length(); i++) { + g.drawString(text.substring(indiceDep, indiceDep + espaceAffichable), rec.x, rec.y + i * espaceLignes); + indiceDep = indiceDep + espaceAffichable; + + } + + + } + + + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { + //--creation du panel ekitcore + if(conteneur==null){ + conteneur=new BuPanel(new BuBorderLayout()); + + Rectangle rec = getClientArea(); + editorPane_.setSize(rec.width, rec.height); + editorPane_.setPreferredSize(new Dimension(rec.width, rec.height)); + conteneur.setPreferredSize(new Dimension(rec.width, rec.height)); + + conteneur.add(editorPane_, BuBorderLayout.CENTER); + conteneur.add(editorPane_.getToolBar(true), BuBorderLayout.NORTH); + conteneur.add(editorPane_.getMenuBar()); + + } + + + return conteneur; + + + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, + Rectangle viewBounds) { + return null; + } + + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + } + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,57 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; + +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorImage; + +import com.memoire.bu.BuFileChooser; +import com.memoire.bu.BuResource; + +/** + * Action qui permet de creer une widget image. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionImageChooser extends EbliActionSimple { + + EbliScene scene_; + + public EbliWidgetActionImageChooser(EbliScene _widget) { + super(EbliLib.getS("Ins\xE9rer une image"), BuResource.BU.getIcon("crystal_image"), "INSERTIONIMAGE"); + scene_ = _widget; + } + + + public void actionPerformed(ActionEvent e) { + + BuFileChooser chooser = new BuFileChooser(/* System.getProperty("user.dir") */); + + int rep = chooser.showOpenDialog(scene_.getView()); + + if (rep == BuFileChooser.APPROVE_OPTION) { + Image img = Toolkit.getDefaultToolkit().getImage(chooser.getSelectedFile().getAbsolutePath()); + + // -- creation de la widget et ajout dans la scene --// + EbliNodeDefault nodeImage = new EbliNodeDefault(); + nodeImage.setTitle(" " + chooser.getSelectedFile()); + nodeImage.setCreator(new EbliWidgetCreatorImage(img)); + nodeImage.setPreferedSize(new Dimension(200, 200)); + nodeImage.setPreferedLocation(new Point(270, 225)); + scene_.addNode(nodeImage); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + } + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -0,0 +1,48 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; + +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorTextEditor; + +import com.memoire.bu.BuResource; + +/** + * Classe qui genere une widget editeur de texte. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActiontextEditor extends EbliActionSimple { + + EbliScene scene_; + + public EbliWidgetActiontextEditor(EbliScene _widget) { + super(EbliLib.getS("Ins\xE9rer une texte"), BuResource.BU.getIcon("crystal_fonte"), "INSERTIONTEXTE"); + scene_ = _widget; + } + + public void actionPerformed(ActionEvent e) { + + + // -- creation de la widget et ajout dans la scene --// + EbliNodeDefault nodeText = new EbliNodeDefault(); + nodeText.setTitle("Texte"); + nodeText.setCreator(new EbliWidgetCreatorTextEditor(new CtuluHtmlEditorPanel())); + nodeText.setPreferedSize(new Dimension(200, 200)); + nodeText.setPreferedLocation(new Point(270, 225)); + scene_.addNode(nodeText); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -220,23 +220,23 @@ // TODO Auto-generated method stub } - - public void setColorContour(Color newColor){ - couleurContour=newColor; - repaint(); - } - - public Color getColorContour(){ - return couleurContour; - } - - public void setColorFond(Color newColor){ - couleurFond=newColor; - repaint(); - } - - public Color getColorFond(){ - return couleurFond; - } + + // public void setColorContour(Color newColor){ + // couleurContour=newColor; + // repaint(); + // } + // + // public Color getColorContour(){ + // return couleurContour; + // } + // + // public void setColorFond(Color newColor){ + // couleurFond=newColor; + // repaint(); + // } + // + // public Color getColorFond(){ + // return couleurFond; + // } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -59,7 +59,9 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionFont; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillage; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; @@ -442,8 +444,11 @@ bar.add(new EbliWidgetActionRetaillage(scene, EbliWidgetActionRetaillage.RETAIILLAGE_MIN)); bar.add(new EbliWidgetActionRetaillage(scene, EbliWidgetActionRetaillage.RETAIILLAGE_MAX)); + bar.add(new EbliWidgetActionImageChooser(scene)); + bar.add(new EbliWidgetActiontextEditor(scene)); + p.doLayout(); // -- creation de l action pour les fonts --// @@ -453,5 +458,8 @@ bar.add(actionFont.getFonts()); bar.add(actionFont.getSizeFonts()); + + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-15 16:42:44 UTC (rev 3809) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-18 07:12:03 UTC (rev 3810) @@ -35,6 +35,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillage; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -237,6 +238,8 @@ addRectangle(); } }); + + _l.add(new EbliWidgetActionImageChooser(getScene())); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-18 11:41:46
|
Revision: 3820 http://fudaa.svn.sourceforge.net/fudaa/?rev=3820&view=rev Author: hadouxad Date: 2008-08-18 11:41:45 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Duplication des elements ci dessous: GRAPHES: methode duplicate( ) EGAxeHorizontal EGAxeVertical EGCourbe EGCourbeChild : utilise un objet surfacePainter_ EGGroup TraceBox EGCourbeSurfacePainter EGCourbeSimple: utilise un objet surfacePainter_ EGRepere MODELS: methode duplicate( ) EGModel EGCourbeModelDefault FudaaCourbeDefautModel FudaaCourbeTimeModel MvProfileCoordinatesModel TrTelemacBoundaryCourbeModel TrTelemacWeirCourbeModel EGGrapheModel EGGrapheSimpleModel EGGrapheTreeModel Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/trace/TraceBox.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCourbeTime.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -12,9 +12,6 @@ import java.awt.FontMetrics; import java.awt.Graphics2D; -import com.memoire.fu.Fu; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluNumberFormatDefault; import org.fudaa.ctulu.CtuluNumberFormatI; @@ -23,7 +20,10 @@ import org.fudaa.ctulu.iterator.NumberIntegerIterator; import org.fudaa.ctulu.iterator.TickIterator; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; + /** * @author Fred Deniger * @version $Id: EGAxeHorizontal.java,v 1.17 2007-05-04 13:49:41 deniger Exp $ @@ -343,5 +343,10 @@ * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = _isIntegerStep; * if(axisIterator_!=null) axisIterator_=null; } */ + + public EGAxeHorizontal duplicate() { + return new EGAxeHorizontal(this); + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -12,14 +12,14 @@ import java.awt.Graphics2D; import java.awt.geom.AffineTransform; -import com.memoire.fu.Fu; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.iterator.TickIterator; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; + /** * @author Fred Deniger * @version $Id: EGAxeVertical.java,v 1.22 2007-05-04 13:49:41 deniger Exp $ @@ -354,5 +354,9 @@ } return false; } + + public EGAxeVertical duplicate() { + return new EGAxeVertical(this); + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -24,8 +24,6 @@ import javax.swing.SwingConstants; import javax.swing.tree.TreeNode; -import com.vividsolutions.jts.geom.Envelope; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibGeometrie; @@ -33,7 +31,6 @@ import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; @@ -51,6 +48,8 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +import com.vividsolutions.jts.geom.Envelope; + /** * Cette Courbe suppose que tous les x du mod\xE8le sont rang\xE9es dans l'ordre croissant. * @@ -244,6 +243,8 @@ } protected abstract EGParent getEGParent(); + + public abstract EGCourbe duplicate(); protected Font getFont() { return font_; @@ -856,5 +857,9 @@ public String toString() { return getTitle(); } + + + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -6,6 +6,7 @@ */ package org.fudaa.ebli.courbe; +import java.awt.Font; import java.util.Enumeration; import javax.swing.tree.TreeNode; @@ -30,6 +31,9 @@ super(_model); parent_ = _m; } + + + boolean setYaxe(final EGAxeVertical _v) { FuLog.warning(new Throwable()); @@ -79,5 +83,33 @@ public void setParentGroup(final EGGroup _g) { parent_ = _g; } + + + public EGCourbe duplicate() { + + EGCourbeChild duplic = null; + + + if (this.getModel() != null) + duplic = new EGCourbeChild(this.parent_.duplicate(), this.getModel().duplicate()); + else + duplic = new EGCourbeChild(this.parent_.duplicate(), null); + + + duplic.isVisible_ = this.isVisible_; + + + duplic.displayTitleOnCurve_ = this.displayTitleOnCurve_; + duplic.font_ = new Font(this.font_.getFamily(), this.font_.getStyle(), this.font_.getSize()); + duplic.tbox_ = this.tbox_.duplicate(); + + + // -- duplication du egCourbeSurfacePainter --// + duplic.surfacePainter_ = this.surfacePainter_.duplicate(); + + return duplic; + } + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -11,7 +11,6 @@ import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; - import org.fudaa.ebli.palette.BPaletteInfo.InfoData; /** @@ -206,4 +205,17 @@ public boolean setValues(final int[] _idx, final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { return false; } + + public EGModel duplicate() { + + EGCourbeModelDefault duplic = new EGCourbeModelDefault(this.x_, this.y_); + if (this.nom_ != null) + duplic.nom_ = this.nom_; + duplic.ymax_ = this.ymax_; + duplic.ymin_ = this.ymin_; + duplic.yrangeComute_ = this.yrangeComute_; + + + return duplic; + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -7,9 +7,10 @@ */ package org.fudaa.ebli.courbe; +import java.awt.Font; + import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionInterface; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -58,4 +59,20 @@ public void setParent(final EGParent _eventDispatcher) { eventDispatcher_ = _eventDispatcher; } + + @Override + public EGCourbe duplicate() { + EGCourbeSimple duplic = new EGCourbeSimple(this.v_.duplicate(), this.getModel().duplicate()); + + duplic.isVisible_ = this.isVisible_; + + duplic.displayTitleOnCurve_ = this.displayTitleOnCurve_; + duplic.font_ = new Font(this.font_.getFamily(), this.font_.getStyle(), this.font_.getSize()); + duplic.tbox_ = this.tbox_.duplicate(); + + // -- duplication du egCourbeSurfacePainter --// + duplic.surfacePainter_ = this.surfacePainter_.duplicate(); + + return duplic; + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -16,7 +16,6 @@ import javax.swing.DefaultComboBoxModel; import org.fudaa.ctulu.CtuluLib; - import org.fudaa.ebli.commun.EbliLib; /** @@ -318,6 +317,28 @@ model_ = _model; } + public EGCourbeSurfacePainter duplicate() { + EGCourbeSurfacePainter duplic = new EGCourbeSurfacePainter(this.targetCourbe_.duplicate(), this.model_.duplicate()); + duplic.alpha_ = this.alpha_; + duplic.delegateCourbe_ = new DelegateCourbe(duplic.model_); + duplic.down_ = this.down_; + duplic.maxIdx_ = this.maxIdx_; + duplic.minIdx_ = this.minIdx_; + duplic.delegatePalier_ = new DelegatePalier(((int) Math.floor(targetCourbe_.getYMin()))); + duplic.selectedPainter_ = this.selectedPainter_; + // painter.painter_= + duplic.setSelectedPainter(this.selectedPainter_); + duplic.up_ = this.up_; + // painter.x_ = CtuluLibArray.copy(this.x_); + // painter.y_ = CtuluLibArray.copy(this.y_); + + + + return duplic; + + } + + protected int getAlpha() { return alpha_; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -33,28 +33,27 @@ import javax.swing.JComponent; -import com.memoire.bu.BuLib; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.image.CtuluImageProducer; import org.fudaa.ctulu.image.CtuluLibImage; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliPreferences; import org.fudaa.ebli.palette.BPaletteInfo; import org.fudaa.ebli.repere.RepereMouseKeyController; import org.fudaa.ebli.repere.RepereMouseKeyTarget; +import com.memoire.bu.BuLib; +import com.memoire.fu.FuLog; + /** * @author Fred Deniger * @version $Id: EGGraphe.java,v 1.26 2007-05-22 14:19:04 deniger Exp $ */ public class EGGraphe extends JComponent implements ComponentListener, EGGrapheModelListener, RepereMouseKeyTarget, - CtuluImageProducer { +CtuluImageProducer { public static final Font DEFAULT_FONT = new Font("SansSerif", Font.PLAIN, 10); @@ -626,7 +625,7 @@ } public void setRapide(final boolean _b) { - // on ne fait rien + // on ne fait rien } public final void setUserXRange(final CtuluRange _rangeSpecByUser) { @@ -830,11 +829,11 @@ g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, _w, _h); } - + if (getWidth() != _w || getHeight() != _h) { g2d.scale(CtuluLibImage.getRatio(_w, getWidth()), CtuluLibImage.getRatio(_h, getHeight())); } - + print(g2d); g2d.dispose(); i.flush(); @@ -863,4 +862,48 @@ } + public EGGraphe duplicate() { + + EGGraphe duplic = new EGGraphe(this.getModel().duplicate()); + duplic.autoRestore_ = this.autoRestore_; + duplic.cache_ = null; + duplic.cmd_ = this.cmd_; + + // -- copie des axes --// + if(this.axeOffset_!=null){ + duplic.axeOffset_=new TObjectIntHashMap(); + int[] values=this.axeOffset_.getValues(); + Object[] liste=this.axeOffset_.keys(); + for (int i = 0; i < liste.length; i++) { + int value = values[i]; + EGAxeVertical axe = (EGAxeVertical) liste[i]; + duplic.axeOffset_.put(axe.duplicate(), value); + } + } + duplic.coeffLarger_=this.coeffLarger_; + + if (this.objectInitAxe_ != null) { + duplic.objectInitAxe_ = new HashMap(); + + Set set = this.objectInitAxe_.keySet(); + Object[] vals = this.objectInitAxe_.values().toArray() ; + int cpt = 0; + for (Iterator it = set.iterator(); it.hasNext();) { + EGAxeVertical axe = (EGAxeVertical) it.next(); + duplic.objectInitAxe_.put(axe.duplicate(), vals[cpt++]); + } + } + if (this.xRange_ != null) + duplic.xRange_ = new CtuluRange(this.xRange_); + if (this.transformer_ != null) + duplic.transformer_ = this.transformer_.duplicate(); + if (this.xRangeSpecByUser_ != null) + duplic.xRangeSpecByUser_ = new CtuluRange(this.xRangeSpecByUser_); + + + + return duplic; +} + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -12,7 +12,6 @@ import javax.swing.JComboBox; import org.fudaa.ctulu.CtuluCommandManager; - import org.fudaa.ebli.commun.EbliActionInterface; /** @@ -141,5 +140,10 @@ * @param _c la courbe a dupliquer */ void duplicateCourbe(CtuluCommandManager _mng, EGCourbe _c); + + /** + * methode qui permet de dupliquer les models de courbe + */ + public EGGrapheModel duplicate(); } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -13,6 +13,7 @@ import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; +import java.util.Iterator; import java.util.List; import javax.swing.AbstractListModel; @@ -23,15 +24,14 @@ import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; -import com.memoire.bu.BuComboBox; - import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibString; - import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliLib; +import com.memoire.bu.BuComboBox; + /** * @author Fred Deniger * @version $Id: EGGrapheSimpleModel.java,v 1.19 2007-05-04 13:49:42 deniger Exp $ @@ -756,4 +756,36 @@ } + public EGGrapheModel duplicate() { + + + //--duplication de la liste des courbes --// + ArrayList<EGCourbeSimple> listeElements = new ArrayList<EGCourbeSimple>(); + + for (Iterator<EGCourbeSimple> it = this.element_.iterator(); it.hasNext();) { + EGCourbeSimple courbe = it.next(); + listeElements.add((EGCourbeSimple) courbe.duplicate()); + } + + EGGrapheSimpleModel duplic = new EGGrapheSimpleModel((EGCourbeSimple[]) listeElements.toArray()); + + duplic.axeX_ = this.axeX_.duplicate(); + // duplication du listselectionModel + try { + duplic.selection_ = (DefaultListSelectionModel) this.selection_.clone(); + } catch (CloneNotSupportedException e) { + + // -- si ce n'est pas duplicable, en cree un par defaut --// + duplic.selection_ = new DefaultListSelectionModel(); + + } + + // -- pas besoin de dupliquer le tableModel, il ne fait que gerer la liste + // elements --// + duplic.tableModel_ = new SimpleTableModel(); + + + return duplic; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -29,16 +29,15 @@ import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import com.memoire.bu.BuComboBox; - import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; import org.fudaa.ctulu.gui.CtuluTreeComboboxRenderer; - import org.fudaa.ebli.commun.EbliActionInterface; +import com.memoire.bu.BuComboBox; + /** * @author Fred Deniger * @version $Id: EGGrapheTreeModel.java,v 1.14 2007-05-04 13:49:41 deniger Exp $ @@ -1065,4 +1064,14 @@ internFireCourbeChanged((EGObject) _path.getLastPathComponent()); } + public EGGrapheModel duplicate() { + EGGrapheTreeModel duplic = new EGGrapheTreeModel(); + duplic.axeX_ = this.axeX_.duplicate(); + duplic.selectionModel_.setSelectionMode(this.selectionModel_.getSelectionMode()); + + + + return duplic; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -23,7 +23,6 @@ import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableInterface; import org.fudaa.ebli.controle.BSelecteurTextField; @@ -47,6 +46,12 @@ super(); comp_ = new ArrayList(10); } + + public EGGroup(List l) { + super(); + comp_ = l; + } + private EGParent.TreeNodes getEgParent() { return n_; @@ -504,5 +509,37 @@ public String toString() { return EbliLib.getS("Groupe") + CtuluLibString.ESPACE + title_; } + + public EGGroup duplicate() { + + + //-- duplication de comp --// + + ArrayList liste = new ArrayList(this.comp_.size()); + for(Iterator it=this.comp_.iterator();it.hasNext();){ + Object item=it.next(); + if (item instanceof EGCourbeChild) { + + // -- !!! reccurence !!! egcourbechild se duplique provoquqnt la + // duplication de eggroup et ainsi de suite --// + liste.add(((EGCourbeChild) item).duplicate()); + }else + // FIXME: adrien si c est pas instance de egcourbeChild, c estquoi ??? + // dans ce cas on duplique ?? + liste.add(item); + + } + + // -- duplication de l objet --// + EGGroup duplic = new EGGroup(liste); + duplic.isVisible_ = this.isVisible_; + duplic.title_ = this.title_; + duplic.n_ = this.n_; + duplic.y_ = this.y_.duplicate(); + + + return duplic; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -10,7 +10,6 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.collection.CourbeInterface; - import org.fudaa.ebli.palette.BPaletteInfo; /** @@ -182,5 +181,12 @@ * @param _selectedPt la s\xE9lection */ void fillWithInfo(final BPaletteInfo.InfoData _table, final CtuluListSelectionInterface _selectedPt); + + /** + * methode qui permet de dupliquer le model + * + * @return + */ + EGModel duplicate(); } 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-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -16,7 +16,6 @@ import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; - import org.fudaa.ebli.controle.BConfigurePaletteTargetInterface; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.palette.BPaletteInfo; @@ -60,6 +59,8 @@ public abstract EGAxeVertical getAxeY(); + + public abstract EGAxeHorizontal getAxeX(); public abstract void monter(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -114,4 +114,15 @@ return h_; } + + public EGRepere duplicate() { + + EGRepere duplic = new EGRepere(); + duplic.h_ = this.h_; + duplic.w_ = this.w_; + duplic.xAxe_ = this.xAxe_.duplicate(); + return duplic; + + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/trace/TraceBox.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/trace/TraceBox.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/trace/TraceBox.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -166,4 +166,21 @@ public void setVPosition(final int _position) { vPosition_ = _position; } + + public TraceBox duplicate() { + TraceBox duplic = new TraceBox(); + duplic.colorBoite_ = this.colorBoite_; + duplic.colorFond_ = this.colorFond_; + duplic.colorText_ = this.colorText_; + duplic.drawBox_ = this.drawBox_; + duplic.drawFond_ = this.drawFond_; + duplic.hMargin_ = this.hMargin_; + duplic.hPosition_ = this.hPosition_; + duplic.traceLigne_ = new TraceLigne(this.traceLigne_); + duplic.vMargin_ = this.vMargin_; + duplic.vPosition_ = this.vPosition_; + + return duplic; + } + } \ No newline at end of file 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-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -37,7 +37,8 @@ } else if (creator instanceof EbliWidgetCreatorDblFleche) { duplique.setCreator(new EbliWidgetCreatorDblFleche(((EbliWidgetCreatorDblFleche) getCreator()).getG())); } else if (creator instanceof EbliWidgetCreatorGraphe) { - duplique.setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe) getCreator()).getGraphe())); + duplique + .setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe) getCreator()).getGraphe().duplicate())); } else if (creator instanceof EbliWidgetCreatorVueCalque) { duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque())); } else if (creator instanceof EbliWidgetCreatorShape) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -459,7 +459,7 @@ bar.add(actionFont.getSizeFonts()); + - } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -11,12 +11,9 @@ import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelectionInterface; - import org.fudaa.dodico.mesure.EvolutionReguliereInterface; - import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; - import org.fudaa.fudaa.commun.FudaaLib; /** @@ -158,4 +155,8 @@ public boolean setValues(final int[] _idx, final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { return false; } + + public EGModel duplicate() { + return new FudaaCourbeDefautModel(this.e_.getCopy(this.e_.getListener())); + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -8,9 +8,9 @@ package org.fudaa.fudaa.commun.courbe; import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; - import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -192,4 +192,17 @@ yRange_ = null; } + public EGModel duplicate() { + FudaaCourbeTimeModel duplic = new FudaaCourbeTimeModel(this.time_); + if (this.yRange_ != null) + duplic.yRange_ = new CtuluRange(this.yRange_); + if(this.nom_!=null) + duplic.nom_ = nom_; + if (this.y_ != null) + duplic.y_ = CtuluLibArray.copy(y_); + + + return duplic; + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -10,10 +10,9 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.ProgressionInterface; - import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsBuilder; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; - +import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; /** @@ -179,4 +178,14 @@ public void fillWithInfo(final InfoData _table, final CtuluListSelectionInterface _selectedPt) {} + public EGModel duplicate() { + + MvProfileCoordinatesModel duplic = new MvProfileCoordinatesModel(this.res_, isX_); + duplic.title_ = this.title_; + duplic.ymax_ = this.ymax_; + duplic.ymin_ = this.ymin_; + + return duplic; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCourbeTime.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCourbeTime.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCourbeTime.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -15,14 +15,13 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import com.memoire.bu.BuResource; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluVariable; - import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; import org.fudaa.ebli.controle.BSelecteurListTimeTarget; +import com.memoire.bu.BuResource; + /** * @author fred deniger * @version $Id: MvProfileCourbeTime.java,v 1.6 2007-05-04 13:59:49 deniger Exp $ @@ -43,13 +42,16 @@ selection_.addListSelectionListener(this); } - MvProfileCourbe duplicate() { + public MvProfileCourbe duplicate() { final MvProfileCourbeTime res = new MvProfileCourbeTime((MvProfileCourbeGroup) getParent(), getM().duplicate(), time_); res.setAspectContour(getAspectContour()); res.getM().setTitle(getTitle() + CtuluLibString.ESPACE + BuResource.BU.getString("Copie")); return res; } + + + public void contentsChanged(final ListDataEvent _e) { updateTitle(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -8,13 +8,12 @@ package org.fudaa.fudaa.tr.telemac; import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; - import org.fudaa.dodico.h2d.telemac.H2dTelemacBordParFrontiere; import org.fudaa.dodico.h2d.telemac.H2dTelemacBoundary; import org.fudaa.dodico.h2d.telemac.H2dTelemacBoundaryCondition; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.courbe.EGCourbeModelDefault; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -247,4 +246,13 @@ public void fillWithInfo(final InfoData _table, final CtuluListSelectionInterface _selectedPt) {} + public EGModel duplicate() { + + return new TrTelemacBoundaryCourbeModel(this.nom_, this.fr_, this.b_, this.t_, + CtuluLibArray.copy(this.x_)); + + } + + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2008-08-18 08:51:17 UTC (rev 3819) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2008-08-18 11:41:45 UTC (rev 3820) @@ -8,12 +8,11 @@ package org.fudaa.fudaa.tr.telemac; import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; - import org.fudaa.dodico.h2d.resource.H2dResource; import org.fudaa.dodico.h2d.telemac.H2dTelemacSeuil; import org.fudaa.dodico.h2d.telemac.H2dTelemacSeuilMng; - import org.fudaa.ebli.courbe.EGCourbeModelDefault; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; @@ -166,4 +165,8 @@ } public void fillWithInfo(final InfoData _table, final CtuluListSelectionInterface _selectedPt) {} + + public EGModel duplicate() { + return new TrTelemacWeirCourbeModel(this.i_, this.mng_, this.cote_, CtuluLibArray.copy(this.x_)); + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-18 13:33:04
|
Revision: 3822 http://fudaa.svn.sourceforge.net/fudaa/?rev=3822&view=rev Author: hadouxad Date: 2008-08-18 13:33:11 +0000 (Mon, 18 Aug 2008) Log Message: ----------- - Gestion des retaillage: - horizontal min et max - vertical min et max Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.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/EbliWidgetActionRetaillageHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java 2008-08-18 13:07:12 UTC (rev 3821) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandRetaillage.java 2008-08-18 13:33:11 UTC (rev 3822) @@ -16,10 +16,10 @@ public class CommandRetaillage implements CtuluCommand { List<Rectangle> oldRectangles; - Rectangle newRectangle; + List<Rectangle> newRectangle; java.util.List<EbliWidget> widgets_; - public CommandRetaillage(List<EbliWidget> listeWidget, List<Rectangle> oldRectangle, Rectangle newRectangle) { + public CommandRetaillage(List<EbliWidget> listeWidget, List<Rectangle> oldRectangle, List<Rectangle> newRectangle) { super(); this.widgets_ = listeWidget; this.newRectangle = newRectangle; @@ -49,7 +49,7 @@ if (nb == 0) return; for (int i = 0; i < nb; i++) { - widgets_.get(i).setPreferredBounds(newRectangle); + widgets_.get(i).setPreferredBounds(newRectangle.get(i)); } refreshScene(); Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java 2008-08-18 13:07:12 UTC (rev 3821) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java 2008-08-18 13:33:11 UTC (rev 3822) @@ -1,123 +0,0 @@ -package org.fudaa.ebli.visuallibrary.actions; - -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.commun.EbliActionSimple; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; - -/** - * classe qui permet de redimensionnner les widgets selectionnes au min ou max - * selon choix du type dans le constructeur. - * - * @author genesis - * - */ -public class EbliWidgetActionRetaillage extends EbliActionSimple { - - public final static int RETAIILLAGE_MAX = 0; - public final static int RETAIILLAGE_MIN = 1; - - public int typeRetaillage_; - EbliScene scene_; - CtuluCommandContainer cmd_; - - public EbliWidgetActionRetaillage(EbliScene _scene, int _typeRetaillage) { - super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), "FORGROUND"); - - // -- type retailage --// - typeRetaillage_ = _typeRetaillage; - - scene_ = _scene; - cmd_=_scene.getCmdMng(); - if (_typeRetaillage == RETAIILLAGE_MAX) { - putValue(NAME, "Resize max"); - setIcon(CtuluResource.CTULU.getIcon("crystal_rangericones")); - } else { - putValue(NAME, "Resize min"); - setIcon(CtuluResource.CTULU.getIcon("crystal_rangerpalettes")); - - } - } - - private static final long serialVersionUID = 1L; - - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - - // -- recuperation de la liste des nodes de la scene --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); - - //-- recherche du Min/Max selon choix constructeur --// - Iterator<EbliNode> it = listeNode.iterator(); - Rectangle tailleAresize = null; - if (it.hasNext()){ - tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); - for (; it.hasNext();) { - - EbliNode currentNode=it.next(); - - if(typeRetaillage_==RETAIILLAGE_MAX && currentNode.hasWidget()){ - if (tailleAresize.width < currentNode.getCreator().getWidget().getPreferredBounds().width - && tailleAresize.height < currentNode.getCreator().getWidget().getPreferredBounds().height) - tailleAresize = currentNode.getCreator().getWidget().getPreferredBounds(); - } else if(currentNode.hasWidget()){ - if (tailleAresize.width > currentNode.getCreator().getWidget().getPreferredBounds().width - && tailleAresize.height > currentNode.getCreator().getWidget().getPreferredBounds().height) - tailleAresize = currentNode.getCreator().getWidget().getPreferredBounds(); - } - } - } - - //-- si rien n est selectionne --// - if(tailleAresize==null) - return; - - - //-- recupere les anciennes color --// - List<Rectangle> oldRectangle = new ArrayList<Rectangle>(); - ; - //-- liste des widget selectionnees --// - java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); - - - // -- parcours des nodes - for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { - - - - EbliNode currentNode = it2.next(); - if (currentNode != null && currentNode.hasWidget()) { - - listeWidget.add(currentNode.getCreator().getWidget()); - oldRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); - - // -- retaillage --// - currentNode.getCreator().getWidget().setPreferredBounds(tailleAresize); - - // -- rafraichissement de la scene --// - scene_.refresh(); - - - } - - } - //-- ajout de l action undo redo --// - - if (cmd_ != null) { - cmd_.addCmd(new CommandRetaillage(listeWidget, oldRectangle, tailleAresize)); - } - - - - } -} Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java (from rev 3809, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillage.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-08-18 13:33:11 UTC (rev 3822) @@ -0,0 +1,126 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * classe qui permet de redimensionnner les widgets selectionnes au min ou max + * selon choix du type dans le constructeur. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionRetaillageHorizontal extends EbliActionSimple { + + public final static int RETAIILLAGE_MAX = 0; + public final static int RETAIILLAGE_MIN = 1; + + public int typeRetaillage_; + EbliScene scene_; + CtuluCommandContainer cmd_; + + public EbliWidgetActionRetaillageHorizontal(EbliScene _scene, int _typeRetaillage) { + super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), "FORGROUND"); + + // -- type retailage --// + typeRetaillage_ = _typeRetaillage; + + scene_ = _scene; + cmd_=_scene.getCmdMng(); + if (_typeRetaillage == RETAIILLAGE_MAX) { + putValue(NAME, "Resize Horizontal Max"); + setIcon(EbliResource.EBLI.getToolIcon("aowidest")); + } else { + putValue(NAME, "Resize Horizontal Min"); + setIcon(CtuluResource.CTULU.getIcon("crystal_rangericones")); + + } + } + + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + //-- recherche du Min/Max selon choix constructeur --// + Iterator<EbliNode> it = listeNode.iterator(); + Rectangle tailleAresize = null; + if (it.hasNext()){ + tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); + for (; it.hasNext();) { + + EbliNode currentNode=it.next(); + + if(typeRetaillage_==RETAIILLAGE_MAX && currentNode.hasWidget()){ + if (tailleAresize.width < currentNode.getCreator().getWidget().getPreferredBounds().width) + tailleAresize = currentNode.getCreator().getWidget().getPreferredBounds(); + } else if(currentNode.hasWidget()){ + if (tailleAresize.width > currentNode.getCreator().getWidget().getPreferredBounds().width) + tailleAresize = currentNode.getCreator().getWidget().getPreferredBounds(); + } + } + } + + //-- si rien n est selectionne --// + if(tailleAresize==null) + return; + + + //-- recupere les anciennes color --// + List<Rectangle> oldRectangle = new ArrayList<Rectangle>(); + List<Rectangle> newRectangle = new ArrayList<Rectangle>(); + //-- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget=new ArrayList<EbliWidget>(); + + + // -- parcours des nodes + for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { + + + + EbliNode currentNode = it2.next(); + if (currentNode != null && currentNode.hasWidget()) { + + listeWidget.add(currentNode.getCreator().getWidget()); + oldRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + + // -- retaillage --// + currentNode.getCreator().getWidget().setPreferredBounds( + new Rectangle(new Dimension(tailleAresize.width, + currentNode.getCreator().getWidget().getPreferredBounds().height))); + + newRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + + } + + } + //-- ajout de l action undo redo --// + + if (cmd_ != null) { + cmd_.addCmd(new CommandRetaillage(listeWidget, oldRectangle, newRectangle)); + } + + + + } +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java ___________________________________________________________________ Added: svn:mergeinfo + Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-08-18 13:33:11 UTC (rev 3822) @@ -0,0 +1,119 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * classe qui permet de redimensionnner les widgets selectionnes au min ou max + * selon choix du type dans le constructeur. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionRetaillageVertical extends EbliActionSimple { + + public final static int RETAIILLAGE_MAX = 0; + public final static int RETAIILLAGE_MIN = 1; + + public int typeRetaillage_; + EbliScene scene_; + CtuluCommandContainer cmd_; + + public EbliWidgetActionRetaillageVertical(EbliScene _scene, int _typeRetaillage) { + super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), "FORGROUND"); + + // -- type retailage --// + typeRetaillage_ = _typeRetaillage; + + scene_ = _scene; + cmd_ = _scene.getCmdMng(); + if (_typeRetaillage == RETAIILLAGE_MAX) { + putValue(NAME, "Resize Vertical Max"); + setIcon(EbliResource.EBLI.getToolIcon("aotallest")); + } else { + putValue(NAME, "Resize Vertical Min"); + setIcon(CtuluResource.CTULU.getIcon("crystal_rangerpalettes")); + + } + } + + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- recherche du Min/Max selon choix constructeur --// + Iterator<EbliNode> it = listeNode.iterator(); + Rectangle tailleAresize = null; + if (it.hasNext()) { + tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); + for (; it.hasNext();) { + + EbliNode currentNode = it.next(); + + if (typeRetaillage_ == RETAIILLAGE_MAX && currentNode.hasWidget()) { + if (tailleAresize.height < currentNode.getCreator().getWidget().getPreferredBounds().height) + tailleAresize = currentNode.getCreator().getWidget().getPreferredBounds(); + } else if (currentNode.hasWidget()) { + if (tailleAresize.height > currentNode.getCreator().getWidget().getPreferredBounds().height) + tailleAresize = currentNode.getCreator().getWidget().getPreferredBounds(); + } + } + } + + // -- si rien n est selectionne --// + if (tailleAresize == null) + return; + + // -- recupere les anciennes color --// + List<Rectangle> oldRectangle = new ArrayList<Rectangle>(); + List<Rectangle> newRectangle = new ArrayList<Rectangle>(); + // -- liste des widget selectionnees --// + java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + // -- parcours des nodes + for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { + + EbliNode currentNode = it2.next(); + if (currentNode != null && currentNode.hasWidget()) { + + listeWidget.add(currentNode.getCreator().getWidget()); + oldRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + + // -- retaillage --// + currentNode.getCreator().getWidget().setPreferredBounds( + new Rectangle(new Dimension(currentNode.getCreator().getWidget().getPreferredBounds().width, + tailleAresize.height))); + + + newRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + // -- rafraichissement de la scene --// + scene_.refresh(); + + } + + } + // -- ajout de l action undo redo --// + + if (cmd_ != null) { + cmd_.addCmd(new CommandRetaillage(listeWidget, oldRectangle, newRectangle)); + } + + } +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-18 13:07:12 UTC (rev 3821) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-18 13:33:11 UTC (rev 3822) @@ -60,7 +60,8 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionFont; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillage; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -441,8 +442,10 @@ bar.add(new EbliWidgetActionColorBackground(scene)); - bar.add(new EbliWidgetActionRetaillage(scene, EbliWidgetActionRetaillage.RETAIILLAGE_MIN)); - bar.add(new EbliWidgetActionRetaillage(scene, EbliWidgetActionRetaillage.RETAIILLAGE_MAX)); + bar.add(new EbliWidgetActionRetaillageHorizontal(scene, EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MIN)); + bar.add(new EbliWidgetActionRetaillageHorizontal(scene, EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MAX)); + bar.add(new EbliWidgetActionRetaillageVertical(scene, EbliWidgetActionRetaillageVertical.RETAIILLAGE_MIN)); + bar.add(new EbliWidgetActionRetaillageVertical(scene, EbliWidgetActionRetaillageVertical.RETAIILLAGE_MAX)); bar.add(new EbliWidgetActionImageChooser(scene)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-18 13:07:12 UTC (rev 3821) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-18 13:33:11 UTC (rev 3822) @@ -36,7 +36,8 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionDuplicate; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillage; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -355,11 +356,12 @@ init.add(null); // -- actions de retaillage min et max --// - init.add(new EbliWidgetActionRetaillage(getScene(), EbliWidgetActionRetaillage.RETAIILLAGE_MIN)); - init.add(new EbliWidgetActionRetaillage(getScene(), EbliWidgetActionRetaillage.RETAIILLAGE_MAX)); + init.add(new EbliWidgetActionRetaillageHorizontal(getScene(), EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MIN)); + init.add(new EbliWidgetActionRetaillageHorizontal(getScene(), EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MAX)); init.add(null); - - + init.add(new EbliWidgetActionRetaillageVertical(getScene(), EbliWidgetActionRetaillageVertical.RETAIILLAGE_MIN)); + init.add(new EbliWidgetActionRetaillageVertical(getScene(), EbliWidgetActionRetaillageVertical.RETAIILLAGE_MAX)); + init.add(null); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-19 03:46:16
|
Revision: 3826 http://fudaa.svn.sourceforge.net/fudaa/?rev=3826&view=rev Author: deniger Date: 2008-08-19 03:46:23 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaInternalFrameModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileFillePanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/prepro.properties Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostScene.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSceneEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/extensions.jnlp branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/prepro-maquette.jnlp Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -10,22 +10,36 @@ import java.awt.Color; import java.awt.Component; import java.awt.Container; +import java.awt.Dialog; import java.awt.Font; import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.Window; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.*; +import javax.swing.AbstractListModel; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.border.Border; +import org.fudaa.ctulu.CtuluLib; + import com.memoire.bu.BuApplication; import com.memoire.bu.BuBorders; import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuLib; import com.memoire.bu.BuList; -import org.fudaa.ctulu.CtuluLib; - /** * @author fred deniger * @version $Id: CtuluLibSwing.java,v 1.8 2007-05-04 13:43:23 deniger Exp $ @@ -49,9 +63,11 @@ } /** - * Ajouter un actionListener a la checkbox _res afin d'activer ou non un panneau (et tous ces composants). + * Ajouter un actionListener a la checkbox _res afin d'activer ou non un + * panneau (et tous ces composants). * - * @param _target le panneau dont les composants seront activ\xE9es ou non, selon l'\xE9tat de la checkbox _res + * @param _target le panneau dont les composants seront activ\xE9es ou non, selon + * l'\xE9tat de la checkbox _res * @param _res la checkbox permettant de activer ou non un panneau */ public static void addActionListenerForCheckBoxTitle(final JPanel _target, final JCheckBox _res) { @@ -74,9 +90,7 @@ } public static String getHelpUrl(final JComponent _c) { - if (_c == null) { - return null; - } + if (_c == null) { return null; } String r = (String) _c.getClientProperty(CtuluLib.getHelpProperty()); if (r == null) { final Container parent = _c.getParent(); @@ -88,20 +102,31 @@ } public static Frame getFrameAncestor(final Component _c) { - if (_c instanceof Frame) { - return (Frame) _c; - } + if (_c instanceof Frame) { return (Frame) _c; } + Frame fr = (Frame) SwingUtilities.getAncestorOfClass(JFrame.class, _c); + if (fr != null) return fr; final BuApplication app = (BuApplication) SwingUtilities.getAncestorOfClass(BuApplication.class, _c); - if (app != null) { - return app; - } - return (Frame) SwingUtilities.getAncestorOfClass(JFrame.class, _c); + if (app != null) { return app; } + return null; } + /** + * @return la window active + */ + public static Window getActiveWindow() { + return KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); + } + + public static JDialog createDialogOnActiveWindow(String _title) { + Window w = getActiveWindow(); + if (w instanceof Frame) { return new JDialog((Frame) w, _title); } + if (w instanceof Dialog) { return new JDialog((Dialog) w, _title); } + return new JDialog(BuLib.HELPER, _title); + + } + public static BuList createBuList(final Object[] _o) { - if (_o == null) { - return new BuList(); - } + if (_o == null) { return new BuList(); } final BuList l = new BuList(); l.setModel(CtuluLibSwing.createListModel(_o)); return l; @@ -154,12 +179,8 @@ d.dispose(); final Object selectedValue = _optionPane.getValue(); - if (selectedValue == null) { - return JOptionPane.CLOSED_OPTION; - } - if (selectedValue instanceof Integer) { - return ((Integer) selectedValue).intValue(); - } + if (selectedValue == null) { return JOptionPane.CLOSED_OPTION; } + if (selectedValue instanceof Integer) { return ((Integer) selectedValue).intValue(); } return JOptionPane.CLOSED_OPTION; } @@ -210,7 +231,7 @@ c.setEnabled(_enable); if (c instanceof Container) { setEnable((Container) c, _resToAvoid, _enable); - } + } } } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -106,7 +106,7 @@ CalqueInteractionListener interactionListener_; protected ZEbliCalquesPanel pn_; - boolean isSpecificActionInit_; + protected boolean isSpecificActionInit_; EbliActionInterface[] selectedActionGroup_; @@ -175,6 +175,7 @@ /** * Construction du groupe de navigation par defaut. */ + @SuppressWarnings("serial") protected void buildButtonGroupNavigation() { if (navigationActionGroup_ != null) { return; @@ -490,7 +491,7 @@ return actions; } - void initSpecificActions() { + protected void initSpecificActions() { if (!isSpecificActionInit_) { specificActionGroup_ = pn_.getApplicationActions(); isSpecificActionInit_ = true; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/action/CalqueActionSonde.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -28,7 +28,7 @@ "SONDE", _cq); _m.addTreeSelectionListener(this); super.setDefaultToolTip(EbliLib.getS("Interpoler les valeurs en un point")); - super.setEnabled(_m.getSelectedCalque() instanceof ZCalqueSondeInterface); + updateForLayer(_m.getSelectedCalque()); } public void valueChanged(final TreeSelectionEvent _e){ @@ -39,14 +39,18 @@ final BCalque c = (BCalque) _e.getPath().getLastPathComponent(); //le calque en cours doit passer en mode inactif // active si le nouveau calque le permet - if (c instanceof ZCalqueSondeInterface) { + updateForLayer(c); + + } + + private void updateForLayer(final BCalque _c) { + if (_c instanceof ZCalqueSondeInterface) { super.setEnabled(true); - ((ZCalqueSondeInteraction)bc_).setTarget((ZCalqueSondeInterface)c); + ((ZCalqueSondeInteraction)bc_).setTarget((ZCalqueSondeInterface)_c); } else { super.setEnabled(false); ((ZCalqueSondeInteraction)bc_).setTarget(null); } - } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -9,6 +9,7 @@ import java.awt.Component; import java.awt.Dialog; import java.awt.Dimension; +import java.awt.Frame; import java.awt.Point; import java.awt.Window; import java.awt.event.MouseWheelListener; @@ -24,15 +25,16 @@ import javax.swing.SwingUtilities; import javax.swing.event.InternalFrameEvent; +import org.fudaa.ctulu.gui.CtuluLibSwing; + import com.memoire.bu.BuDesktop; import com.memoire.bu.BuLib; import com.memoire.bu.BuPalette; -import org.fudaa.ctulu.gui.CtuluLibSwing; - /** * @author deniger - * @version $Id: EbliActionPaletteAbstract.java,v 1.21 2007-06-13 12:57:45 deniger Exp $ + * @version $Id: EbliActionPaletteAbstract.java,v 1.21 2007-06-13 12:57:45 + * deniger Exp $ */ public abstract class EbliActionPaletteAbstract extends EbliActionChangeState { @@ -97,9 +99,7 @@ dial_.dispose(); dial_ = null; } - if ((window_ == null) || !window_.isVisible()) { - return; - } + if ((window_ == null) || !window_.isVisible()) { return; } loc_ = window_.getLocation(); window_.setVisible(false); window_.getContent().setVisible(false); @@ -152,14 +152,16 @@ } if (desktop_ == null) { - Dialog d = (Dialog) SwingUtilities.getAncestorOfClass(Dialog.class, parent_); + Window d = (Window) SwingUtilities.getAncestorOfClass(Window.class, parent_); if (d != null) { - dial_ = new JDialog(d); + dial_ = (d instanceof Frame) ? new JDialog((Frame) d) : new JDialog((Dialog) d); dial_.setLocation(d.getLocationOnScreen()); } else { dial_ = new JDialog(CtuluLibSwing.getFrameAncestor(parent_)); + dial_.setLocationRelativeTo(parent_); } + dial_.setModal(true); dial_.setContentPane(window_.getContentPane()); dial_.pack(); dial_.addWindowListener(new WindowAdapter() { @@ -214,9 +216,7 @@ } public JComponent getPaletteContent() { - if (window_ == null) { - return null; - } + if (window_ == null) { return null; } return window_.getContent(); } @@ -233,7 +233,8 @@ } /** - * Methode appele lorsque le bouton de cette palette change d'\xE9tat (visible ou non). + * Methode appele lorsque le bouton de cette palette change d'\xE9tat (visible ou + * non). */ public void setMainButtonVisible(final boolean _b) { if (_b && isSelected()) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -23,7 +23,6 @@ import com.memoire.fu.Fu; import com.memoire.fu.FuLog; - /** * @author Fred Deniger * @version $Id: EGAxeHorizontal.java,v 1.17 2007-05-04 13:49:41 deniger Exp $ @@ -32,7 +31,7 @@ private boolean isDiscret_; - //private boolean isIntegerStep_; + // private boolean isIntegerStep_; /** * Rien. @@ -64,11 +63,11 @@ } - protected void afficheGraduationsEtGrille(final Graphics2D _g,final EGRepere _f){ - //NumberFormat nf = isIntegerStep_ ? null : getNumberFormat(); + protected void afficheGraduationsEtGrille(final Graphics2D _g, final EGRepere _f) { + // NumberFormat nf = isIntegerStep_ ? null : getNumberFormat(); final FontMetrics fm = _g.getFontMetrics(); final Color lightfg = getLightColor(); - //Color superlightfg = getSuperLightColor(); + // Color superlightfg = getSuperLightColor(); final int y = _f.getMaxEcranY(); final int yBasMajor = y + 3; final int yBas = y + 1; @@ -76,8 +75,8 @@ double lastMaxX = -10; final double ftHaut = fm.getMaxAscent() + 5; final boolean grille = isGrille(); - int idx=0; - for (final TickIterator it = buildUpToDateMainTickIterator(); it.hasNext() && idx<300; it.next()) { + int idx = 0; + for (final TickIterator it = buildUpToDateMainTickIterator(); it.hasNext() && idx < 300; it.next()) { idx++; _g.setColor(lightfg); final int xe = _f.getXEcran(it.currentValue()); @@ -90,7 +89,7 @@ } final double wordWidth = fm.stringWidth(t); final double xLeft = xe - wordWidth / 2; - //pour eviter que les graduations se chevauchent + // pour eviter que les graduations se chevauchent if (xLeft > (lastMaxX + 2) && (xe + wordWidth / 2) < _f.getMaxEcranX()) { _g.drawLine(xe, y, xe, yBasMajor); @@ -99,8 +98,7 @@ } else { _g.drawLine(xe, y, xe, yBas); } - } - else { + } else { _g.drawLine(xe, y, xe, yBas); } } @@ -109,32 +107,33 @@ } } /* - * t = getStringAffiche(maximum); int xe = _f.getXEcran(maximum); double xLeft = xe - - * fm.stringWidth(t) / 2; if (xLeft > (lastMaxX + 2)) { g.drawString(t, (int) xLeft, (int) (y + - * ftHaut)); } + * t = getStringAffiche(maximum); int xe = _f.getXEcran(maximum); double + * xLeft = xe - fm.stringWidth(t) / 2; if (xLeft > (lastMaxX + 2)) { + * g.drawString(t, (int) xLeft, (int) (y + ftHaut)); } */ } /** - * Appelee uniquement si isIntegerStep est true: permet de donner une repr\xE9sentation specifique - * pour la graduation passee en parametres. Par defaut, l'entier est traduit en string. + * Appelee uniquement si isIntegerStep est true: permet de donner une + * repr\xE9sentation specifique pour la graduation passee en parametres. Par + * defaut, l'entier est traduit en string. + * * @param _i la graduation a dessiner * @return la chaine representant cette graduation */ - protected String getGraduationFor(final int _i){ + protected String getGraduationFor(final int _i) { return CtuluLibString.getString(_i); } - protected Color getLightColor(){ + protected Color getLightColor() { final int rc = lineColor_.getRed(); final int gc = lineColor_.getGreen(); final int bc = lineColor_.getBlue(); final int incr = Math.max(Math.max((200 - rc), (200 - gc)), (200 - bc)); - return new Color(Math.min(255, rc + incr / 5), Math.min(255, gc + incr / 5), Math.min(255, bc - + incr / 5)); + return new Color(Math.min(255, rc + incr / 5), Math.min(255, gc + incr / 5), Math.min(255, bc + incr / 5)); } - protected Color getSuperLightColor(){ + protected Color getSuperLightColor() { final int rc = lineColor_.getRed(); final int gc = lineColor_.getGreen(); final int bc = lineColor_.getBlue(); @@ -142,7 +141,7 @@ return new Color(Math.min(255, rc + incr), Math.min(255, gc + incr), Math.min(255, bc + incr)); } - protected TickIterator createMainTickIterator(){ + protected TickIterator createMainTickIterator() { if (isDiscret_ && axisIterator_ == null) { axisIterator_ = new NumberIntegerIterator(); } @@ -151,13 +150,12 @@ /** * Dessine l'axe horizontal. + * * @param _g le graphics cible * @param _f le repere */ - public void dessine(final Graphics2D _g,final EGRepere _f){ - if (!visible_) { - return; - } + public void dessine(final Graphics2D _g, final EGRepere _f) { + if (!visible_) { return; } final Font old = _g.getFont(); if (font_ != null) { _g.setFont(font_); @@ -179,8 +177,8 @@ _g.drawLine(xf, y, xf - 3, y + 2); } _g.setFont(old); - if(FuLog.isDebug()&& Fu.DEBUG) { - FuLog.debug(getClass().getName()+" paint END"); + if (FuLog.isDebug() && Fu.DEBUG) { + FuLog.debug(getClass().getName() + " paint END"); } } @@ -188,7 +186,7 @@ if (titreVisible_ || uniteVisible_) { final String t = titreVisible_ ? titre_ : null; String unit = null; - if (uniteVisible_ && unite_!=null && unite_.length()>0) { + if (uniteVisible_ && unite_ != null && unite_.length() > 0) { unit = '[' + unite_ + ']'; } _g.setColor(lineColor_); @@ -206,8 +204,7 @@ } final int xtext = _xi + (_f.getMaxEcranX() - _xi) / 2 - fm.stringWidth(txt) / 2; _g.drawString(txt, xtext, _y + _f.getMargesBas() - fm.getHeight() - 1); - } - else { + } else { if (t != null) { width = fm.stringWidth(t); } @@ -234,45 +231,45 @@ * @param _g la cible * @return l'espace requis en bas de l'axe */ - public int getBottomHeightNeeded(final Graphics2D _g){ - //epaisseur trait + public int getBottomHeightNeeded(final Graphics2D _g) { + // epaisseur trait int r = 3; - if (_g == null) { - return r; - } + if (_g == null) { return r; } if (graduations_ || isGrille()) { if (font_ == null) { font_ = EGGraphe.DEFAULT_FONT; } - //la graduation + // la graduation r += 10; r += _g.getFontMetrics(font_).getHeight(); } - //si la legende est centree elle est dessinee en-dessous de la graduation + // si la legende est centree elle est dessinee en-dessous de la graduation if (isTitreCentre_) { r += _g.getFontMetrics(font_).getHeight(); } /* - * if (titre != null && unite != null) { r += _g.getFontMetrics(font).getDescent(); } + * if (titre != null && unite != null) { r += + * _g.getFontMetrics(font).getDescent(); } */ return r; } /* *//** - * Renvoie la chaine reelle et non formatee. - * @param _val la valeur a considerer - * @return la chaine a utiliser pour l'affichage - */ + * Renvoie la chaine reelle et non formatee. + * + * @param _val la valeur a considerer + * @return la chaine a utiliser pour l'affichage + */ /* - * public String getReelString(double _val){ if (isIntegerStep_) { return getGraduationFor((int) - * _val); } return Double.toString(_val); } + * public String getReelString(double _val){ if (isIntegerStep_) { return + * getGraduationFor((int) _val); } return Double.toString(_val); } */ /** * @param _g le graphics dessine * @return l'espace requis a droite de l'axe */ - public int getRightWidthNeeded(final Graphics2D _g){ + public int getRightWidthNeeded(final Graphics2D _g) { int r = 0; if (!isTitreCentre_) { if (titreVisible_ && titre_ != null) { @@ -295,31 +292,30 @@ * @param _val la valeur a considerer * @return la chaine a utiliser pour l'affichage */ - public String getStringAffiche(final double _val){ - if (specificFormat_ != null) { - return specificFormat_.format(_val); - } + public String getStringAffiche(final double _val) { + if (specificFormat_ != null) { return specificFormat_.format(_val); } return super.getStringAffiche(_val); } - public final boolean isDiscret(){ + public final boolean isDiscret() { return isDiscret_; } /** - * Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est effectuee en - * consequence: seul des entiers sont dessin\xE9s. + * Les graduations peuvent sous forme d'entier. Dans ce cas, la graduation est + * effectuee en consequence: seul des entiers sont dessin\xE9s. + * * @return true si la graduation est faite par palier. */ /* * public final boolean isIntegerStep(){ return isIntegerStep_; } */ - public final boolean isVertical(){ + public final boolean isVertical() { return false; } - public static EGAxeHorizontal buildDefautTimeAxe(final CtuluNumberFormatI _i){ + public static EGAxeHorizontal buildDefautTimeAxe(final CtuluNumberFormatI _i) { final EGAxeHorizontal h = new EGAxeHorizontal(); h.setTitre("t"); h.setAxisIterator(new DateIterator()); @@ -340,18 +336,18 @@ * @param _isIntegerStep si la graduation est faite par palier. */ /* - * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = _isIntegerStep; - * if(axisIterator_!=null) axisIterator_=null; } + * public final void setIntegerStep(boolean _isIntegerStep){ isIntegerStep_ = + * _isIntegerStep; if(axisIterator_!=null) axisIterator_=null; } */ - + public EGAxeHorizontal duplicate() { - + EGAxeHorizontal duplic = new EGAxeHorizontal(this); - duplic.setFont(new Font(this.getFont().getFamily(),this.getFont().getStyle(),this.getFont().getSize())); + if (getFont() != null) duplic.setFont(new Font(this.getFont().getFamily(), this.getFont().getStyle(), this + .getFont().getSize())); duplic.setTitre(this.getTitre()); - + return duplic; } - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -627,7 +627,7 @@ } - void setLabel(final BuLabel _lb) { + public void setLabel(final BuLabel _lb) { lbXyInfo_ = _lb; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -11,6 +11,7 @@ import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; @@ -26,16 +27,31 @@ * */ public class EbliScene extends GraphScene<EbliNode, EbliEdge> { - + public static void refreshScene(Scene _sc) { _sc.validate(); _sc.repaint(); - if (_sc.getView() != null) - _sc.getView().repaint(); + if (_sc.getView() != null) _sc.getView().repaint(); } + EbliWidgetEditCreator editor_ = EbliWidgetEditCreator.INSTANCE; + /** + * @return the editor + */ + public EbliWidgetEditCreator getEditor() { + return editor_; + } + + /** + * @param _editor the editor to set + */ + public void setEditor(EbliWidgetEditCreator _editor) { + editor_ = _editor; + } + + /** * Le gestionnaire de commande associe \xE0 la scene */ CtuluCommandManager cmdMng_; @@ -72,6 +88,7 @@ setMenuBase(); } + /** * Methode qui permet d ajouter un listener * @@ -79,8 +96,7 @@ */ public void addEbliNodeListener(EbliNodeListener listener) { // init si necessaire - if (listenerList == null) - listenerList = new HashSet<EbliNodeListener>(); + if (listenerList == null) listenerList = new HashSet<EbliNodeListener>(); // ajout listenerList.add(listener); } @@ -108,8 +124,7 @@ // -- remplissage des proprietes res.setPreferredLocation(node.getPreferedLocation()); - if (node.getPreferedSize() != null) - res.setPreferredSize(node.getPreferedSize()); + if (node.getPreferedSize() != null) res.setPreferredSize(node.getPreferedSize()); // -- ajout dans la vue layer --// visu_.addChild(res); @@ -122,10 +137,8 @@ * graph model. The default implementation removes the node widget from its * parent widget. * - * @param node - * the removed node - * @param widget - * the removed node widget; null if the node is non-visual + * @param node the removed node + * @param widget the removed node widget; null if the node is non-visual * * Surcharge pour faire appel au notify des listener et ainsi mettre * ajour les listener @@ -134,8 +147,7 @@ // -- indique la suppresion du node chez le parent notifyAllListenerNodeRemoved(node); - if (widget != null) - widget.removeFromParent(); + if (widget != null) widget.removeFromParent(); } @@ -164,8 +176,7 @@ * @param listener */ public void notifyAllListenerNodeAdded(EbliNode node) { - if (listenerList == null) - return; + if (listenerList == null) return; for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { it.next().nodeAdded(node); } @@ -178,8 +189,7 @@ * @param listener */ public void notifyAllListenerNodeRemoved(EbliNode node) { - if (listenerList == null) - return; + if (listenerList == null) return; for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { EbliNodeListener listener = it.next(); 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-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -13,6 +13,7 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; @@ -44,7 +45,6 @@ */ public Map propGraphique; - /** * Liste des clef utilisees pour les composants graphiques */ @@ -53,8 +53,7 @@ public final static String COLORFOND = "colorFond"; public final static String ROTATION = "rotation"; public final static String FONT = "font"; - - + private boolean useBorder_ = true; /** @@ -71,7 +70,11 @@ */}; } - + protected String getTitle() { + EbliNode n = (EbliNode) getEbliScene().findObject(this); + return n == null ? CtuluLibString.EMPTY_STRING : n.getTitle(); + } + /** * Retourne une interface widgetConfigure qui permet de gerer les interfaces a * creer @@ -79,24 +82,23 @@ * @return */ private BConfigurableInterface getSingleConfigureInterface() { - + // -- retourne l interface qui va bien qui permet de creer les composants // graphiques correspondant --// return new WidgetConfigure(this); } - - public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { - // voir EGObject + // voir EGObject } - + // useless public Object getMin(String _key) { return null; } + // useless public Object getMoy(String _key) { return null; @@ -107,72 +109,67 @@ * 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 new Integer(degre); } - - + return propGraphique.get(_key); } - public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { - } + 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) { - + 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 --// + // -- 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 --// + + // -- 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; } @@ -182,34 +179,31 @@ /** * @param scene - * @param Point - * : indiaue la location preferentiel. peut etre nul + * @param Point : indiaue la location preferentiel. peut etre nul */ public EbliWidget(EbliScene scene) { super(scene); setScene_(scene); - - //-- remplisage de la map de propriete grahiques --// + + // -- 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 --// + + // -- construction des actions --// getActions().addAction(scene.createSelectAction()); getActions().addAction(ActionFactory.createResizeAction()); getActions().addAction(scene.createWidgetHoverAction()); @@ -229,7 +223,7 @@ * @param _popup */ public void constructPopupMenuBase(JPopupMenu _popup) { - + JMenuItem menuItem4 = _popup.add("Configuration graphique"); menuItem4.setIcon(CtuluResource.CTULU.getIcon("crystal_configurer")); // BuResource.BU.getIcon("configurer") @@ -267,8 +261,7 @@ } }); - - + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -288,14 +281,11 @@ if (duplique != null && EbliWidget.this.getScene() != null) { EbliWidget.this.getEbliScene().addNode(duplique); - // -- 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(); } @@ -303,13 +293,7 @@ } }); - - - - - - JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); menuItem2.addActionListener(new ActionListener() { @@ -325,7 +309,7 @@ } }); - + } /** @@ -350,9 +334,7 @@ @Override public void notifyStateChanged(ObjectState previousState, ObjectState newState) { - if (!useBorder_) { - return; - } + if (!useBorder_) { return; } setBorder(getScene().getLookFeel().getBorder(newState)); } @@ -389,25 +371,19 @@ 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. @@ -420,9 +396,6 @@ propGraphique.put(LINEMODEL, _l); } - - - public void setColorContour(Color newColor) { propGraphique.put(COLORCONTOUR, newColor); } @@ -439,21 +412,19 @@ return (Color) propGraphique.get(COLORFOND); } - public double getRotation() { - if (propGraphique.get(ROTATION) instanceof Integer) - propGraphique.put(ROTATION, new Double((Integer) propGraphique.get(ROTATION))); + 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 (Font) propGraphique.get(FONT); - + return (Font) propGraphique.get(FONT); + } public void setFormeFont(Font newFont) { Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java (from rev 3819, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EditCreator.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -0,0 +1,174 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Window; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Iterator; +import java.util.List; + +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JScrollPane; +import javax.swing.JToolBar; +import javax.swing.JTree; + +import org.flexdock.docking.DockingConstants; +import org.flexdock.docking.DockingManager; +import org.flexdock.docking.DockingPort; +import org.flexdock.docking.defaults.DefaultDockingPort; +import org.flexdock.view.View; +import org.fudaa.ebli.calque.BArbreCalque; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.ressource.EbliResource; + +/** + * + * @author deniger + * + */ +public class EbliWidgetEditCreator { + + public EbliWidgetEditCreator() { + + } + + /** + * Singleton pour configurer par defaut EbliScene + */ + public static final EbliWidgetEditCreator INSTANCE = new EbliWidgetEditCreator(); + + public Window createFrame(ZEbliCalquesPanel pn, String title) { + JFrame frame = new JFrame(title); + + frame.getContentPane().setLayout(new BorderLayout()); + JMenu[] specificMenus = pn.getSpecificMenus(EbliLib.getS("Vue 2D")); + JMenuBar mb = new JMenuBar(); + frame.setJMenuBar(mb); + for (int i = 0; i < specificMenus.length; i++) { + mb.add(specificMenus[i]); + } + JToolBar tb = new JToolBar(); + List actions = pn.getController().getActions(); + for (Iterator iterator = actions.iterator(); iterator.hasNext();) { + EbliActionInterface object = (EbliActionInterface) iterator.next(); + if (object == null) { + tb.addSeparator(); + } else { + tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + frame.getContentPane().add(tb, BorderLayout.NORTH); + frame.setIconImage(EbliResource.EBLI.getImage("lissage")); +// pn.setPreferredSize(pn.getPreferredSize()); + final DefaultDockingPort globalPort = createDockingPort(); + JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("lissage"), EbliLib.getS("Vue 2D")); + DockingManager.dock(centerComponent, (DockingPort) globalPort); + JComponent rightComponent = createView(new JScrollPane(new BArbreCalque(pn.getArbreCalqueModel())), + EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); + DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); + + frame.getContentPane().add(globalPort, BorderLayout.CENTER); + frame.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent _e) { + globalPort.clear(); + } + + }); + return frame; + + } + + public Window createFrame(EGFillePanel pn, String title) { + JFrame frame = new JFrame(title); + + frame.getContentPane().setLayout(new BorderLayout()); + frame.setTitle(title); + frame.setIconImage(EbliResource.EBLI.getImage("curves")); + EbliActionInterface[] specificInterfaces = pn.getSpecificActions(); + JMenuBar mb = new JMenuBar(); + frame.setJMenuBar(mb); + JMenu menu = new JMenu("Menu graphe"); + pn.fillSpecificMenu(menu); + + // for (int i = 0; i < specificInterfaces.length; i++) { + // mb.add(new JMenu(specificInterfaces[i])); + // } + mb.add(menu); + + JToolBar tb = new JToolBar(); + + for (int i = 0; i < specificInterfaces.length; i++) { + EbliActionInterface object = specificInterfaces[i]; + if (object == null) { + tb.addSeparator(); + } else { + tb.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + frame.getContentPane().add(tb, BorderLayout.NORTH); + pn.setPreferredSize(pn.getPreferredSize()); + final DefaultDockingPort globalPort = createDockingPort(); + JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("curves"), EbliLib.getS("Courbes")); + DockingManager.dock(centerComponent, (DockingPort) globalPort); + JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); + JComponent rightComponent = createView(new JScrollPane(tree), EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); + DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); + + frame.getContentPane().add(globalPort, BorderLayout.CENTER); + frame.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent _e) { + globalPort.clear(); + } + + }); + return frame; + + } + + protected static DefaultDockingPort createDockingPort() { + DefaultDockingPort port = new DefaultDockingPort(); + port.setPreferredSize(new Dimension(400, 400)); + return port; + } + + // protected static JComponent createDockableComponent(String name) { + // JPanel panel = new JPanel(new BorderLayout()); + // panel.setBorder(new LineBorder(Color.BLUE)); + // panel.add(new JLabel("COUCOU " + name)); + // return createView(panel, name, true); + // } + + protected static JComponent createView(JComponent jc, Icon ic, String name) { + return createView(jc, ic, name, false); + } + + protected static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { + View view = new View(name); + view.setIcon(ic); + view.getViewProperties().setDockingEnabled(false); + if (dockage) { + view.addAction(DockingConstants.CLOSE_ACTION); + view.getViewProperties().setDockingEnabled(true); + } + view.setContentPane(jc); + view.setTitle(name, true); + // DockingManager.registerDockable(view.getComponent(), name); + + return view; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -5,12 +5,14 @@ import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; +import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Observable; +import java.util.Observer; import javax.swing.JComponent; import javax.swing.JFrame; @@ -36,28 +38,27 @@ * @author deniger * */ -public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { +public class EbliWidgetVueCalque extends EbliWidget implements EditProvider, Observer { ZEbliCalquesPanel calquePanel_; - EditCreator editor_; - JFrame frame_; + public Color couleurContour = Color.black; + public Color couleurFond = Color.white; + + Window frame_; + BufferedImage image; GrBoite zoom_; - public Color couleurContour = Color.black; - public Color couleurFond = Color.white; - public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { super(scene); calquePanel_ = vue; - editor_ = EditCreator.INSTANCE; // FIXME a enlever par la suite - setPreferredSize(new Dimension(200, 200)); - setMinimumSize(new Dimension(200, 200)); - initSize(new Rectangle(0, 0, 200, 200)); + setPreferredSize(new Dimension(500, 400)); + initSize(new Rectangle(0, 0, 500, 400)); + // calquePanel_.getArbreCalqueModel().getObservable().addObserver(this); // zoom_ = calquePanel_.getVueCalque().getCalque().getDomaine(); // calquePanel_.restaurer(); @@ -72,18 +73,19 @@ public void edit(Widget _widget) { if (frame_ != null) frame_.toFront(); else { - // final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); + final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); Point p = new Point(rec.x, rec.y); JComponent jc = getEbliScene().getView(); SwingUtilities.convertPointToScreen(p, jc); - frame_ = editor_.createFrame(calquePanel_); + frame_ = getEbliScene().getEditor().createFrame(calquePanel_, getTitle()); + p.x = p.x - 50; + p.y = p.y - 50; frame_.setLocation(p); - frame_.pack(); - // calquePanel_.getVueCalque().changeRepere(this, gr); + calquePanel_.getVueCalque().changeRepere(this, gr); frame_.setVisible(true); - frame_.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame_.addWindowListener(new WindowAdapter() { @Override @@ -94,17 +96,21 @@ @Override public void windowClosing(WindowEvent _e) { + setPreferredSize(calquePanel_.getVueCalque().getSize()); zoom_ = calquePanel_.getVueCalque().getViewBoite(); - // image = null; - // getEbliScene().refresh(); + image = null; + getEbliScene().refresh(); } }); } - // TODO Auto-generated method stub } + public Color getColorFond() { + return couleurFond; + } + private void initSize(Rectangle rec) { BCalque[] tousCalques = calquePanel_.getVueCalque().getCalque().getTousCalques(); calquePanel_.getVueCalque().setSize(rec.width, rec.height); @@ -115,6 +121,7 @@ } } + @SuppressWarnings("unchecked") @Override protected void paintWidget() { @@ -147,8 +154,9 @@ repaint(); } - public Color getColorFond() { - return couleurFond; + public void update(Observable _o, Object _arg) { + image = null; + getEbliScene().refresh(); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -1,48 +1,56 @@ package org.fudaa.ebli.visuallibrary.graphe; +import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetCreator; + /** * interface qui permet de creer un widget + * * @author genesis - * + * */ public class EbliWidgetCreatorGraphe implements EbliWidgetCreator { - EGGraphe graphe; - public EGGraphe getGraphe() { - return graphe; - } + EGFillePanel pn_; - public void setGraphe(EGGraphe graphe) { - this.graphe = graphe; - } + public EGGraphe getGraphe() { + return pn_.getGraphe(); + } - EbliWidgetGraphe res; + // + // public void setGraphe(EGGraphe graphe) { + // this.graphe = graphe; + // } - public EbliWidgetCreatorGraphe(EGGraphe g) { - super(); - this.graphe = g; - } + EbliWidgetGraphe res; - public EbliWidget create(EbliScene _scene) { - // TODO Auto-generated method stub - // creation de la widget correspondante - res= new EbliWidgetGraphe(_scene, null, graphe); - - // ajout des listener d ecoute du graphe - graphe.getModel().addModelListener( - new EbliWidgetGrapheController(res)); - - return res; - } + public EbliWidgetCreatorGraphe(EGGraphe _g) { + super(); + this.pn_ = new EGFillePanel(_g); + } - public EbliWidget getWidget() { - // TODO Auto-generated method stub - return res; - } + public EbliWidgetCreatorGraphe(EGFillePanel _pn) { + super(); + this.pn_ = _pn; + } + public EbliWidget create(EbliScene _scene) { + // TODO Auto-generated method stub + // creation de la widget correspondante + res = new EbliWidgetGraphe(_scene, null, pn_); + // ajout des listener d ecoute du graphe + pn_.getGraphe().getModel().addModelListener(new EbliWidgetGrapheController(res)); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 03:44:44 UTC (rev 3825) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 03:46:23 UTC (rev 3826) @@ -5,36 +5,42 @@ import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.Map; import javax.swing.JComponent; -import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.courbe.EGConfigureActionPalette; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.calque.EditCreator; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.EditProvider; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.fu.FuLog; /** * widget qui contient un objet graphe + * * @author adrien hadoux - * + * */ public class EbliWidgetGraphe extends EbliWidget implements EditProvider/* * , @@ -44,165 +50,145 @@ * > */{ - private EGGraphe graphe; - JFrame frame_; - EditCreator editor_; - EGFillePanel panelGraphe_; - - private EbliNodeDefault nodeLegende=null; - - public Color couleurContour=Color.black; - public Color couleurFond=Color.white; - - public EGGraphe getGraphe() { - return graphe; - } + // private EGGraphe graphe_; + Window frame_; + EGFillePanel panelGraphe_; - public void setGraphe(EGGraphe graphe) { - this.graphe = graphe; - } + private EbliNodeDefault nodeLegende = null; - public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { - super(scene); - // TODO Auto-generated constructor stub - setGraphe(_graphe); - - editor_ = EditCreator.INSTANCE; - panelGraphe_=new EGFillePanel(_graphe); - //-- creation de l action pour editor --// + public Color couleurContour = Color.black; + public Color couleurFond = Color.white; + + public EGGraphe getGraphe() { + return panelGraphe_.getGraphe(); + } + + // + // public void setGraphe(EGGraphe graphe) { + // this.graphe_ = graphe; + // } + + public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGFillePanel _pn) { + super(scene); + panelGraphe_ = _pn; + WidgetAction editorAction = ActionFactory.createEditAction(this); + + // -- ajout de l action au widget correspondant --// + this.getActions().addAction(editorAction); + } + + public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { + this(scene, preferredLocation, new EGFillePanel(_graphe)); + // -- creation de l action pour editor --// // WidgetAction editorAction = // ActionFactory.createInplaceEditorAction(this); - WidgetAction editorAction = ActionFactory.createEditAction(this); - - // -- ajout de l action au widget correspondant --// - this.getActions().addAction(editorAction); - - } + } - - protected void paintWidget() { - Rectangle rec = getClientArea(); - Graphics2D g = getGraphics(); - //-- couleur de fond --// + BufferedImage image; + + protected void paintWidget() { + Rectangle rec = getClientArea(); + Graphics2D g = getGraphics(); + g.translate(rec.x, rec.y); + + if (frame_ == null) { + getGraphe().setSize(rec.width - 1, rec.height - 1); +// getGraphe().computeMarges(g); +// getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); + } + + // mode edition + if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + FuLog.debug("EWI: recreate image"); + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // a ameliorer: il ne faudrait pas recreer l'image a chaque fois + image = getGraphe().produceImage(rec.width, rec.height, params); + + } + g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); + // -- couleur de fond --// // g.setColor(couleurFond); // g.fillRect(0, 0, rec.width, rec.height); - - // BufferedImage image = courbe.produceImage( - // rec.width - 1, rec.height - 1, - // Collections.EMPTY_MAP); - g.translate(rec.x, rec.y); - graphe.setSize(rec.width - 1, - rec.height - 1); - graphe.computeMarges(g); - - graphe.dessine(g, rec.width - 1, - rec.height - 1, false ); - } - - - /** - * Surcharge de la creation du menu de base en ajoutant les menus specifiques - */ - public void setMenu() { - getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { - public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu (); + // BufferedImage image = courbe.produceImage( + // rec.width - 1, rec.height - 1, + // Collections.EMPTY_MAP); - //-- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); - - //-- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); - return popup; - } - })); - } - - /** - * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende - * @param _popup - */ - private void constructPopupMenuSpecifique(JPopupMenu _popup){ - JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); - menuItem.addActionListener(new ActionListener(){ + g.translate(-rec.x, -rec.y); + } - public void actionPerformed(ActionEvent e) { + /** + * Surcharge de la creation du menu de base en ajoutant les menus specifiques + */ + public void setMenu() { + getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu(); - //-- creation de la l\xE9gende --// - if(EbliWidgetGraphe.this.getEbliScene()!=null){ - - //position a cote de la widget graphe - Point nouvellePosition=new Point((int)(EbliWidgetGraphe.this.getLocation().x),(int)(EbliWidgetGraphe.this.getLocation().y+EbliWidgetGraphe.this.getBounds().height*1.2)); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); - //getScene_().addChild(new EbliWidget(getScene_(),null)); - //addChild (WidgetLegendeManager.createLegende(GrapheWidget.this.getGraphe(), GrapheWidget.this.getScene_(),null)); - if(!EbliWidgetGraphe.this.getEbliScene().isObject(nodeLegende)){ - - //-- creation d'un node legende --// - nodeLegende = new EbliNodeDefault(); - - nodeLegende.setCreator(new EbliWidgetCreatorLegende(getGraphe())); - nodeLegende.setPreferedLocation(nouvellePosition); - nodeLegende.setPreferedSize(new Dimension(100, 100)); - EbliWidgetGraphe.this.getEbliScene().addNode(nodeLegende); - - //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe.this.getGraphe(), EbliWidgetGraphe.this.getScene_(),nouvellePosition); - - } - - //GrapheWidget.this.addChild(widgetLegende); - } - } + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); + return popup; + } + })); + } - }); + /** + * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende + * + * @param _popup + */ + private void constructPopupMenuSpecifique(JPopupMenu _popup) { + JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.addActionListener(new ActionListener() { - - //-- creation du menu config de la courbe - _popup.add(new EGConfigureActionPalette(graphe.getModel())); + public void actionPerformed(ActionEvent e) { - - - } + // -- creation de la l\xE9gende --// + if (EbliWidgetGraphe.this.getEbliScene() != null) { - - //-- methodes implements InplaceEditorProvider --// - - /** - * Methode appeleee pour creer un editor EGFillePanel correspondant a la vue - */ - // public /*EGFillePanel*/ BuPanel createEditorComponent( - // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController - // controller, - // Widget widget) { - // - // //-- creation du menu d'actions--// - // final JMenu menu = new JMenu(); - // menu.setName("menu du graphe"); - // menu.setText("menu du graphe"); - // // creation du panel Egfille correspondant - // final EGFillePanel panelGraphe=new EGFillePanel(this.graphe); - // new CtuluPopupListener(new CtuluPopupListener.PopupReceiver() { - // - // public void popup(MouseEvent _evt) { - // panelGraphe.popupMenu(_evt.getX(), _evt.getY()); - // - // } - // },panelGraphe); - // - // //--remplissage du menu --// - // panelGraphe.fillSpecificMenu(menu); - // - // //FIXME : comment construire le Jmenu principal ainsi que le tree qui - // qffiche les courbes ??? - // - // - // return panelGraphe; - // } - - public void edit(Widget _widget) { + // position a cote de la widget graphe + Point nouvellePosition = new Point((int) (EbliWidgetGraphe.this.getLocation().x), + (in... [truncated message content] |
From: <had...@us...> - 2008-08-19 16:29:59
|
Revision: 3828 http://fudaa.svn.sourceforge.net/fudaa/?rev=3828&view=rev Author: hadouxad Date: 2008-08-19 16:30:04 +0000 (Tue, 19 Aug 2008) Log Message: ----------- - Duplication des Calques - Creation de la legende pour les calques via clic droit + "afficher legende" - Mise en place d usysteme de copier coller (trPostLayoutFille implements BuCutCopyPasteInterface) Bug que je n'arrive pas ?\195?\160 r?\195?\169soudre - duplication calques: les parametres variables ne sont pas enregistr?\195?\169s - duplication calques: les noeuds "resultats" et "vecteurs" sont dupliques et je n arrive pas a les supprimer - legende calque: error bizarre WIN32OSSD .... - Cut/copy/paste action pas prises en compte par trPostLayoutFille , peut etre du a EbliScene.... Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.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/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/fudaa/bin/ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BGroupeCalque.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -16,16 +16,15 @@ import java.util.Arrays; import java.util.List; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluLibString; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableInterface; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import com.memoire.fu.FuLog; + /** * Un groupe de calques. Cette classe joue un role structurant. C'est un noeud dans la hierarchie arborescente des * calques. @@ -266,4 +265,7 @@ } return r; } + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -23,26 +23,28 @@ import java.awt.print.Printable; import java.util.Map; -import javax.swing.*; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.ComboBoxModel; +import javax.swing.JComponent; +import javax.swing.JInternalFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JMenu; +import javax.swing.JPopupMenu; +import javax.swing.JTabbedPane; +import javax.swing.ListCellRenderer; +import javax.swing.SwingUtilities; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuDynamicMenu; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuLib; -import com.memoire.bu.BuMenu; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuPopupMenu; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; import org.fudaa.ctulu.gui.CtuluTreeComboboxRenderer; import org.fudaa.ctulu.image.CtuluImageProducer; import org.fudaa.ctulu.image.CtuluLibImage; - import org.fudaa.ebli.animation.EbliAnimationSourceAbstract; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliComponentFactory; @@ -55,6 +57,14 @@ import org.fudaa.ebli.impression.EbliPrinter; import org.fudaa.ebli.ressource.EbliResource; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuDynamicMenu; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuPopupMenu; + /** * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. @@ -234,6 +244,11 @@ private BGroupeCalque gcDonnees_; + public void setGcDonnees_(BGroupeCalque gcDonnees_) { + + this.gcDonnees_ = gcDonnees_; + } + protected BuMenu contextTools_; protected BuLabel mode_; @@ -819,17 +834,34 @@ * @return le calque legende */ public final BCalqueLegende getCqLegend() { + if (getCqInfos() == null) + addCqInfos(); return (BCalqueLegende) getCqInfos().getCalqueParNom("cqLegende"); } protected void removeCalqueLegend() { - getCqInfos().remove(getCqLegend()); + getCqInfos().remove(getCqLegend()); + // getCqLegend().setVisible(false); } + + public void addCalqueLegend() { + getCqInfos().add(getCqLegend()); + getCqLegend().setVisible(true); + } public void setInfoPaletteActive() { - getController().setInfoPaletteActive(); + getController().setInfoPaletteActive(); + } + + + /** + * Methdoe a surhcarger puor le cas des widgets. + */ + public void addWidgetLegendeCalque() { + } + protected JMenu getMenuSelectionPath() { final BuMenu selection = new BuMenu(EbliLib.getS("S\xE9lection"), "SELECTION"); getController().addSelectionActionTo(selection); @@ -840,4 +872,23 @@ return selection; } + + public ZEbliCalquesPanel duplicate() { + /* + * ZEbliCalquesPanel duplic = new ZEbliCalquesPanel(new CtuluUIDefault()); + * + * // --pas besoin de duplication des groupes de calques --// + * duplic.gcDonnees_ = new BGroupeCalque(); + * + * // -- mais le contenu si --// BCalque[] contenuAdupliquer = + * this.getDonneesCalque().getCalques(); + * + * // -- ajout des calques dupliques un a un --// for (int i = 0; i < + * contenuAdupliquer.length; i++) { + * duplic.addCalque(contenuAdupliquer[i].duplicate()); } + */ + return null; + } + + } \ No newline at end of file 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-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -40,7 +40,12 @@ duplique .setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe) getCreator()).getGraphe().duplicate())); } else if (creator instanceof EbliWidgetCreatorVueCalque) { - duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque())); + + + duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque() + .duplicate())); + + } else if (creator instanceof EbliWidgetCreatorShape) { duplique.setCreator(new EbliWidgetCreatorShape(((EbliWidgetCreatorShape) getCreator()).getTypeObject_())); } else if (creator instanceof EbliWidgetCreatorImage) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -262,5 +262,12 @@ public void setVisu_(LayerWidget visu_) { this.visu_ = visu_; } + + + + + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -86,6 +86,11 @@ } }); + + // -- cas particulier, on ajoute la legende --// + pn.addCalqueLegend(); + pn.repaint(); + return frame; } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -0,0 +1,45 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Rectangle; + +import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.widget.ComponentWidget; +import org.netbeans.modules.visual.layout.FlowLayout; + +/** + * Classe de la l\xE9gende associ\xE9e au graphe. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetCalqueLegende extends EbliWidget { + + BCalqueLegendePanel calqueLegende_; + ComponentWidget intern_; + + public EbliWidgetCalqueLegende(EbliScene scene, BCalqueLegendePanel _calqueLegende) { + super(scene); + calqueLegende_ = _calqueLegende; + + setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); + + + intern_ = new ComponentWidget(scene, _calqueLegende); + + + // intern_.setPreferredSize(preferredSize) + addChild(intern_); + + this.setPreferredBounds(new Rectangle(200, 200)); + + intern_.setPreferredBounds(new Rectangle(150, 150)); + + } + + + + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -0,0 +1,42 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import java.awt.Dimension; + +import org.fudaa.ebli.calque.BCalqueLegendePanel; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreator; + +public class EbliWidgetCreatorCalqueLegende implements EbliWidgetCreator { + + BCalqueLegendePanel calque; + EbliWidgetCalqueLegende res; + + + public BCalqueLegendePanel getCalque() { + return calque; + } + + public void setCalque(BCalqueLegendePanel calque) { + this.calque = calque; + } + + + + public EbliWidgetCreatorCalqueLegende(BCalqueLegendePanel legende) { + super(); + this.calque = legende; + } + + public EbliWidget create(EbliScene _scene) { + res = new EbliWidgetCalqueLegende(_scene, calque); + res.setPreferredSize(new Dimension(200, 200)); + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -6,26 +6,30 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Map; -import java.util.Observable; -import java.util.Observer; import javax.swing.JComponent; -import javax.swing.JFrame; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; +import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.EditProvider; +import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; @@ -38,13 +42,15 @@ * @author deniger * */ -public class EbliWidgetVueCalque extends EbliWidget implements EditProvider, Observer { +public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { ZEbliCalquesPanel calquePanel_; public Color couleurContour = Color.black; public Color couleurFond = Color.white; + private EbliNodeDefault nodeLegende = null; + Window frame_; BufferedImage image; @@ -149,14 +155,80 @@ g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } - public void setColorFond(Color newColor) { - couleurFond = newColor; - repaint(); + + /** + * Surcharge de la creation du menu de base en ajoutant les menus specifiques + */ + public void setMenu() { + getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu(); + + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); + + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); + return popup; + } + })); } + private void constructPopupMenuSpecifique(JPopupMenu _popup) { + JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.addActionListener(new ActionListener() { - public void update(Observable _o, Object _arg) { - image = null; - getEbliScene().refresh(); + public void actionPerformed(ActionEvent e) { + + // -- creation de la l\xE9gende --// + if (EbliWidgetVueCalque.this.getEbliScene() != null) { + + // position a cote de la widget graphe + Point nouvellePosition = new Point((int) (EbliWidgetVueCalque.this.getLocation().x), + (int) (EbliWidgetVueCalque.this.getLocation().y + EbliWidgetVueCalque.this.getBounds().height * 1.2)); + + + if (!EbliWidgetVueCalque.this.getEbliScene().isObject(nodeLegende)) { + + + nodeLegende = new EbliNodeDefault(); + // nodeLegende.setTitle("Legende calque"); + // + // if (calquePanel_.getCqLegend()==null) + //JOptionPane.showMessageDialog(null,"calquePqnel.getCqlegend null") + // ; + // nodeLegende.setCreator(new + // EbliWidgetCreatorCalqueLegende(calquePanel_.getCqLegend())); + // nodeLegende.setPreferedSize(new Dimension(200, 100)); + // nodeLegende.setPreferedLocation(new Point(350, 125)); + // // ajout du node au layout + // EbliWidgetVueCalque.this.getEbliScene().addNode(nodeLegende); + + // methode qui permet d ajouter une legemde + calquePanel_.addWidgetLegendeCalque(); + + + EbliWidgetVueCalque.this.getEbliScene().refresh(); + } + + // GrapheWidget.this.addChild(widgetLegende); + } + } + + }); + + } + + +// public void setColorFond(Color newColor) { + // couleurFond = newColor; + // repaint(); + // } + // + // public void update(Observable _o, Object _arg) { + // image = null; + // getEbliScene().refresh(); + // } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -27,7 +27,6 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.EditProvider; import org.netbeans.api.visual.action.PopupMenuProvider; @@ -173,7 +172,7 @@ //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe. // this.getGraphe(), // EbliWidgetGraphe.this.getScene_(),nouvellePosition); - + EbliWidgetGraphe.this.getEbliScene().refresh(); } // GrapheWidget.this.addChild(widgetLegende); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -28,6 +28,7 @@ import org.fudaa.ctulu.CtuluUIDefault; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.BVueCalque; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -272,14 +273,28 @@ nodeShape.setPreferedSize(new Dimension(100, 100)); nodeShape.setPreferedLocation(new Point(270, 225)); scene.addNode(nodeShape); - + scene.refresh(); + + nodeShape = new EbliNodeDefault(); nodeShape.setTitle("Shape Elipse"); nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorEllipse())); nodeShape.setPreferedSize(new Dimension(100, 100)); nodeShape.setPreferedLocation(new Point(290, 225)); scene.addNode(nodeShape); - + + scene.refresh(); + /* + * nodeLegende = new EbliNodeDefault(); + * nodeLegende.setTitle("Legende calque"); + * + * nodeLegende.setCreator(new EbliWidgetCreatorCalqueLegende(new + * BCalqueLegende().getLegendePanel(0))); nodeLegende.setPreferedSize(new + * Dimension(200, 100)); nodeLegende.setPreferedLocation(new Point(10, 10)); + * // ajout du node au scene.addNode(nodeLegende); + * + * scene.refresh(); + */ // node.getCreator().getWidget().setState(state) // if(node.getCreator().getWidget().) @@ -463,6 +478,9 @@ bar.add(actionFont.getSizeFonts()); + boxEast.add(new BCalqueLegende()); + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -18,24 +18,17 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; -import com.memoire.bu.BuDynamicMenu; -import com.memoire.bu.BuMenu; -import com.memoire.bu.BuPopupMenu; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gis.GISPolygone; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluDialogPanel; - import org.fudaa.dodico.ef.EfFrontierInterface; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.EfGridVolumeInterface; - import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.edition.ZCalqueEditionGroup; import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvLayerGrid; import org.fudaa.fudaa.meshviewer.MvResource; @@ -54,6 +47,10 @@ import org.fudaa.fudaa.sig.layer.FSigVisuPanel; import org.fudaa.fudaa.sig.layer.FSigVisuPanelController; +import com.memoire.bu.BuDynamicMenu; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuPopupMenu; + /** * @author deniger * @version $Id: MvVisuPanel.java,v 1.5 2007-05-04 13:59:50 deniger Exp $ @@ -271,7 +268,7 @@ * * @param _g le maillage associe */ - public final void addCqInfos(final EfGridInterface _g) { + public void addCqInfos(final EfGridInterface _g) { if (getCqInfos() != null) { return; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -3,10 +3,13 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.util.Iterator; +import java.util.Set; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JMenu; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -20,6 +23,7 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.jdesktop.swingx.JXCollapsiblePane; +import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuUndoRedoInterface; @@ -30,7 +34,7 @@ * */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface { + BuUndoRedoInterface, BuCutCopyPasteInterface { /** * @@ -58,7 +62,9 @@ // creation de la scene EBLI controller_ = new TrPostLayoutPanelController(new TrPostScene()); setContentPane(controller_.getPanel()); + } + /** * @param _title * @param _preferredLocation @@ -151,7 +157,8 @@ return getCalquePrincipal(); } - public void majComponent(Object _o) {} + public void majComponent(Object _o) { + } public void redo() { final CtuluCommandManager c = getCmdMng(); @@ -160,7 +167,8 @@ } } - public void setActive(final boolean _b) {} + public void setActive(final boolean _b) { + } public void undo() { final CtuluCommandManager c = getCmdMng(); @@ -169,4 +177,73 @@ } } + + // liste des noeuds copies + Set<EbliNode> nodesCopyied = null; + // liste des noeuuds coupes + Set<EbliNode> nodesCutted = null; + public void copy() { + + JOptionPane.showMessageDialog(null, "copy()"); + // on copie la widget selectionnee + // ie on fait une duplication partielle + // on ajoute pas tout de suite le noeud dans la scene + + + //--recuperation des noeuds a copier --// + nodesCopyied = (Set<EbliNode>) getScene().getSelectedObjects(); + + } + + public void cut() { + JOptionPane.showMessageDialog(null, "cut()"); + + // --recuperation des noeuds a copier --// + nodesCutted = (Set<EbliNode>) getScene().getSelectedObjects(); + + + // enlever les nodes de la scene + for (Iterator<EbliNode> it = nodesCutted.iterator(); it.hasNext();) { + EbliNode node = it.next(); + + // le node existe toujours apres l'avoir enleve + getScene().removeNode(node); + + + + } + + } + + public void duplicate() { + JOptionPane.showMessageDialog(null, "duplicate()"); + } + + public void paste() { + + //TODO a ameliorer : TENIR COMPTE DE LA POSITION DE LA SOURIS + + JOptionPane.showMessageDialog(null, "paste()"); + + // --recuperation des noeuds copies --// + if (nodesCopyied != null) { + + + for (Iterator<EbliNode> it = nodesCopyied.iterator(); it.hasNext();) { + EbliNode node = it.next(); + // --duplication du node --// + node.duplicate(null); + } + }else if (nodesCutted != null) { + + + for (Iterator<EbliNode> it = nodesCutted.iterator(); it.hasNext();) { + EbliNode node = it.next(); + // --ajout du node --// + getScene().addNode(node); + } + + } + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -15,6 +15,7 @@ import javax.swing.ListSelectionModel; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionAbstract; import org.fudaa.ebli.commun.EbliActionInterface; @@ -38,7 +39,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActiontextEditor; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; @@ -56,6 +57,7 @@ import com.memoire.bu.BuSeparator; public class TrPostLayoutPanelController { + JPanel pn_; EbliWidgetJXTreeTableModel treeModel_; @@ -102,9 +104,16 @@ nodeCalque.setPreferedLocation(preferredLocation);// new Point(250, 170) nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(calque)); + + + + // ajout du node au layout addNode(nodeCalque); + + + return nodeCalque; } @@ -202,7 +211,27 @@ return nodeRect; } + + /** + * Methode d ajout d'un calque legende. + * @return + */ + public EbliNode addCalqueLegende(BCalqueLegende legende) { + // -- ajout du rectangle --// + final EbliNodeDefault nodeLegende = new EbliNodeDefault(); + nodeLegende.setTitle("Legende calque"); + nodeLegende.setCreator(new EbliWidgetCreatorCalqueLegende(legende.getLegendePanel(0))); + nodeLegende.setPreferedSize(new Dimension(200, 100)); + nodeLegende.setPreferedLocation(new Point(350, 125)); + // ajout du node au layout + addNode(nodeLegende); + getScene().refresh(); + + return nodeLegende; + } + + protected void addShapeActions(List<EbliActionAbstract> _l) { // -- palette rectangle texte--// _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Rectangle texte"), EbliResource.EBLI Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -10,7 +10,6 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; -import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyVetoException; @@ -80,7 +79,6 @@ import org.fudaa.fudaa.meshviewer.layer.MvGridLayerGroup; import org.fudaa.fudaa.meshviewer.profile.MvProfileFillePanel; import org.fudaa.fudaa.meshviewer.profile.MvProfileTarget; -import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.ressource.FudaaResource; import org.fudaa.fudaa.sig.FSigLib; import org.fudaa.fudaa.tr.common.TrFileFormatManager; @@ -297,6 +295,10 @@ public TrPostProjet(final TrPostSource _src, final TrPostCommonImplementation _impl) { this(_src); impl_ = _impl; + + + + } private void showError(final CtuluUI _ui, final File _dbFile, final String _err) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-08-19 03:47:18 UTC (rev 3827) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-08-19 16:30:04 UTC (rev 3828) @@ -21,13 +21,14 @@ import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluLibDialog; - +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.animation.ActionAnimationTreeSelection; import org.fudaa.ebli.animation.EbliAnimatedInterface; import org.fudaa.ebli.animation.EbliAnimationSourceInterface; import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.calque.BCalqueSaverInterface; import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.ZCalqueSondeInteraction; @@ -40,14 +41,12 @@ import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvSelectionNodeOrEltData; import org.fudaa.fudaa.meshviewer.export.MvExportFactory; import org.fudaa.fudaa.meshviewer.layer.MvFrontierLayerAbstract; import org.fudaa.fudaa.meshviewer.layer.MvGridLayerGroup; import org.fudaa.fudaa.meshviewer.profile.MvProfileAction; -import org.fudaa.fudaa.sig.layer.FSigVisuPanelController; import org.fudaa.fudaa.tr.common.Tr3DFactory; import org.fudaa.fudaa.tr.common.Tr3DInitialiser; import org.fudaa.fudaa.tr.common.TrLib; @@ -148,9 +147,67 @@ gc.putClientProperty(Action.SHORT_DESCRIPTION, TrResource.getS("Affichage des images de fond")); getArbreCalqueModel().setSelectionCalque(isoLayer_); //TODO Fred a enlever - removeCalqueLegend(); + // removeCalqueLegend(); + } + /** + * Methode qui ajoute une widget de legende de calque. + */ + public void addWidgetLegendeCalque() { + // JOptionPane.showMessageDialog(null, + // "addWidgetLegendeCalque de Trpostvisupanel"); + // recupetration de la widget legende + BCalqueLegende legend = getCqLegend(); + // -- ajout de la legende du calque dans la scene --// + this.getProjet().filleLayout_.controller_.addCalqueLegende(legend); + + // rafraichissement de la scene + this.getProjet().filleLayout_.controller_.getScene().refresh(); + + + } + + // BCalqueLegende malegende = new BCalqueLegende(); + // /** + // * Surcharge de la methode du ZebliCalquePanel Ajoute les calques + // * d'informations. + // * + // * Ajoute au format widget specialement pour prepro. + // */ + // protected BGroupeCalque addCqInfos() { + // + // // this.getProjet().filleLayout_.getScene() + // JOptionPane.showMessageDialog(null, "addCqInfo de Trpostvisupanel"); + // + // final BGroupeCalque gr = new BGroupeCalque(); + // gr.setName("gpInfo"); + // gr.setTitle(EbliLib.getS("infos")); + // final BCalqueLegende l = new BCalqueLegende(); + // l.setDestructible(false); + // l.setTitle(EbliLib.getS("L\xE9gende")); + // l.setName("cqLegende"); + // + // gr.add(malegende); + // + // // -- ajout de la legende du calque dans la scene --// + // this.getProjet().filleLayout_.controller_.addCalqueLegende(malegende); + // + // // vc_.getCalque().enPremier(gr); + // // on affiche pas la legende dans le groupe + // return gr; + // } + // + // /** + // * surhcarge de gectCqInfos afin de controller les calques envoyes. on + // envoie + // * plus de legende mais un calque vide. + // */ + // public BGroupeCalque getCqInfos() { + // + // return new BGroupeCalque(); + // } + protected EbliActionInterface addActionEvolutionFor(final boolean _rubar) { return new EvolutionAction(_rubar); } @@ -417,4 +474,63 @@ } MvExportFactory.startExport(fac, _impl, _selection); } + + /** + * duplication du trPostVisuPanel. surcharge de la duplication du + * zeblicalquePanel. + */ + public TrPostVisuPanel duplicate(){ + + final TrPostVisuPanel duplic = new TrPostVisuPanel(this.getImpl(), this.getProjet()); + // -- duplication du layer qui contient les memes proprietes --// + duplic.isoLayer_ = (TrIsoLayer) this.isoLayer_.duplicate(); + + + + // -- duplication des donnees via sauvegarde thread--// + new CtuluTaskOperationGUI(this.impl_, TrResource.getS("Enregistrement")) { + + public void act() { + + // -- sauvegarde de l etat --// + BCalqueSaverInterface savedData= getDonneesCalque().getPersistenceMng().save(getDonneesCalque(),impl_.createProgressionInterface(this)); + + // -- chargement de l etat dans le calque duplique --// + duplic.getDonneesCalque().getPersistenceMng().restore(savedData, duplic, duplic.getDonneesCalque(), + impl_.createProgressionInterface(this)); + + // -- destruction des calques doublons du duplic pour recuperer une + // bonne arborescence --// + + // BCalque[] liste = duplic.getDonneesCalque().getCalques(); + // for (int i = 0; i < liste.length; i++) { + // BCalque calque = liste[i]; + // boolean existeDeja = false; + // // --recherche si doublon --// + // for (int j = i + 1; j < liste.length; j++) { + // BCalque calque2 = liste[j]; + // if (calque == calque2) + // liste[j].setDestructible(true); + // // duplic.getDonneesCalque().detruire(liste[j]); + // duplic.detruireCalque(liste[j]); + // + // } + // + // } + + + } + }.start(); + + + + + + + + + return duplic; + } + + } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-20 15:07:12
|
Revision: 3829 http://fudaa.svn.sourceforge.net/fudaa/?rev=3829&view=rev Author: hadouxad Date: 2008-08-20 15:07:17 +0000 (Wed, 20 Aug 2008) Log Message: ----------- - Modification de l'ajout des graphes: ajoute directement dans la scene le widget - implementation de l niterface ObjectSceneListener pour trPostLayoutFille qui modifie l'arbre de FudaaImplementation et sa toolBar des reception du notify - Composant scrollPane de droite en memoire et toolbar de la frame en memoire - Modification de ces composants en fonction du type de widget selectionne 4 cas: - Calque selectionne: affichage du tree calque a droite et de sa toolbar et menu dans trpostlayoutfille - Graphe selectionne: affichage du tree graphe a droite et de sa toolbar et menu dans trpostlayoutfille - Autre composant selectionne: affichage du tree des widgets a droite et toolbar et menu contient juste action modif couleur contour,rotation... - Rien de selectionn?\195?\169: on affiche le tree des widgets - Amelioration pour EDF: Un seul clic sur le widget: modification du widget (CF: EbliActionEditorOneClick) - creation de l editeur dans la widget pour les graphes - creation de l editeur dans la widget pour les calques - Depuis l'editeur de graphe et calque, possibilit?\195?\169 d'exporter ers la fenetre dock avec toutes les fonctionnalites - Demarrage du post avec les fonctions associees au calque. - Bouton permettant de recr?\195?\169er un calque initial (si jamais l'utilisateur supprime le sien...) - Correction du bug de configurer les graphismes du graphe. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.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/EbliWidgetCreatorGraphe.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/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/all/FudaaCourbeExample.java branches/Prepro-0.92-SNAPSHOT/fudaa/test/org/fudaa/fudaa/all/TestFudaaDjaFrame.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluFilleWithComponent.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -31,7 +31,7 @@ * La classe de l'objet doit etre la meme que getComponentClass. * @return le composant a l'etat initiale. Appele la premiere fois pour construire le composant. */ - JComponent createComponent(); + JComponent createPanelComponent(); /** * La classe de l'objet doit etre la meme que getComponentClass. * @param o le composant a mettre a jour Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliFilleCalques.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -148,7 +148,7 @@ pn_.getController().clearSelections(); } - public JComponent createComponent() { + public JComponent createPanelComponent() { if (arbre_ == null) { arbre_ = new BArbreCalque(); arbre_.setName("ARBRE_CALQUE"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleSimple.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -95,7 +95,7 @@ TableModel listModel_; - public JComponent createComponent() { + public JComponent createPanelComponent() { if (list_ == null) { list_ = new EGListSimple(); list_.setColumnSelectionAllowed(false); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFilleTree.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -92,7 +92,7 @@ EGSpecificActions actions_; EGTree tree_; - public JComponent createComponent(){ + public JComponent createPanelComponent(){ if (tree_ == null) { if (CtuluLibMessage.DEBUG) { CtuluLibMessage.debug("init composant pour graphe fille"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -6,4 +6,6 @@ void nodeRemoved(EbliNode node); + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -197,7 +197,26 @@ } } + + /** + * Methode qui permet d envoyer le signal du node selectionn\xE9 a tous les + * listener + * + * @param listener + */ + public void notifyAllListenerNodeSelected(EbliNode node) { + if (listenerList == null) + return; + for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + EbliNodeListener listener = it.next(); + listener.nodeRemoved(node); + } + + } + + + @Override protected void notifyNodeAdded(EbliNode node, Widget widget) { // -- notifier tous les listener que le noeud a ete attache --// 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-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -110,7 +110,7 @@ */ 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 --// @@ -133,7 +133,7 @@ */ public boolean setProperty(String _key, Object prop) { - 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 --// @@ -224,32 +224,8 @@ */ 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() { @@ -349,6 +325,8 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); + // -- construction du menu pour les graphismees --// + constructPopupMenuBaseGraphique(popup); // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); @@ -357,6 +335,42 @@ })); } + /** + * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il + * n a aucun effet. + * + * @param _popup + */ + public void constructPopupMenuBaseGraphique(JPopupMenu _popup) { + + JMenuItem menuItem4 = _popup.add("Configuration"); + 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); + + } + + }); + } + + public void setScene_(EbliScene scene_) { this.scene_ = scene_; } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -0,0 +1,210 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.util.EnumSet; + +import javax.swing.JComponent; + +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.util.GeomUtil; + +/** + * Classe qui permet d'ouvrir l editor en 1 seul clic. + * + * @author David Kaspar + * @pompeur Adrien Hadoux + * + */ +public final class EbliActionEditorOneClick<C extends JComponent> extends WidgetAction.LockedAdapter implements + InplaceEditorProvider.EditorController { + + private InplaceEditorProvider<C> provider; + + private C editor = null; + private Widget widget = null; + private Rectangle rectangle = null; + + public EbliActionEditorOneClick(InplaceEditorProvider<C> provider) { + this.provider = provider; + } + + protected boolean isLocked() { + return editor != null; + } + +/** + * Modification ici: pour activer l editor, il suffit d appuyer une seule fois + * sur l editeur + */ + public State mouseClicked(Widget widget, WidgetMouseEvent event) { + if (event.getButton() == MouseEvent.BUTTON1 /*&& event.getClickCount() == 2*/) { + if (openEditor(widget)) + return State.createLocked(widget, this); + } + return State.REJECTED; + } + + public State mousePressed(Widget widget, WidgetMouseEvent event) { + if (editor != null) + closeEditor(true); + return State.REJECTED; + } + + public State mouseReleased(Widget widget, WidgetAction.WidgetMouseEvent event) { + if (editor != null) + closeEditor(true); + return State.REJECTED; + } + + public State keyPressed(Widget widget, WidgetKeyEvent event) { + if (event.getKeyChar() == KeyEvent.VK_ENTER) + if (openEditor(widget)) + return State.createLocked(widget, this); + return State.REJECTED; + } + + public final boolean isEditorVisible() { + return editor != null; + } + + public final boolean openEditor(Widget widget) { + if (editor != null) + return false; + + Scene scene = widget.getScene(); + JComponent component = scene.getView(); + if (component == null) + return false; + + editor = provider.createEditorComponent(this, widget); + if (editor == null) + return false; + this.widget = widget; + + component.add(editor); + provider.notifyOpened(this, widget, editor); + + Rectangle rectangle = widget.getScene().convertSceneToView(widget.convertLocalToScene(widget.getBounds())); + + Point center = GeomUtil.center(rectangle); + Dimension size = editor.getMinimumSize(); + if (rectangle.width > size.width) + size.width = rectangle.width; + if (rectangle.height > size.height) + size.height = rectangle.height; + int x = center.x - size.width / 2; + int y = center.y - size.height / 2; + + rectangle = new Rectangle(x, y, size.width, size.height); + updateRectangleToFitToView(rectangle); + + Rectangle r = provider.getInitialEditorComponentBounds(this, widget, editor, rectangle); + this.rectangle = r != null ? r : rectangle; + + editor.setBounds(x, y, size.width, size.height); + notifyEditorComponentBoundsChanged(); + editor.requestFocusInWindow(); + + return true; + } + + private void updateRectangleToFitToView(Rectangle rectangle) { + JComponent component = widget.getScene().getView(); + if (rectangle.x + rectangle.width > component.getWidth()) + rectangle.x = component.getWidth() - rectangle.width; + if (rectangle.y + rectangle.height > component.getHeight()) + rectangle.y = component.getHeight() - rectangle.height; + if (rectangle.x < 0) + rectangle.x = 0; + if (rectangle.y < 0) + rectangle.y = 0; + } + + public final void closeEditor(boolean commit) { + if (editor == null) + return; + Container parent = editor.getParent(); + Rectangle bounds = parent != null ? editor.getBounds() : null; + provider.notifyClosing(this, widget, editor, commit); + boolean hasFocus = editor.hasFocus(); + if (bounds != null) { + parent.remove(editor); + parent.repaint(bounds.x, bounds.y, bounds.width, bounds.height); + } + editor = null; + widget = null; + rectangle = null; + if (hasFocus) + if (parent != null) + parent.requestFocusInWindow(); + } + + public void notifyEditorComponentBoundsChanged() { + EnumSet<InplaceEditorProvider.ExpansionDirection> directions = provider + .getExpansionDirections(this, widget, editor); + if (directions == null) + directions = EnumSet.noneOf(InplaceEditorProvider.ExpansionDirection.class); + Rectangle rectangle = this.rectangle; + Dimension size = editor.getPreferredSize(); + Dimension minimumSize = editor.getMinimumSize(); + if (minimumSize != null) { + if (size.width < minimumSize.width) + size.width = minimumSize.width; + if (size.height < minimumSize.height) + size.height = minimumSize.height; + } + + int heightDiff = rectangle.height - size.height; + int widthDiff = rectangle.width - size.width; + + boolean top = directions.contains(InplaceEditorProvider.ExpansionDirection.TOP); + boolean bottom = directions.contains(InplaceEditorProvider.ExpansionDirection.BOTTOM); + + if (top) { + if (bottom) { + rectangle.y += heightDiff / 2; + rectangle.height = size.height; + } else { + rectangle.y += heightDiff; + rectangle.height = size.height; + } + } else { + if (bottom) { + rectangle.height = size.height; + } else { + } + } + + boolean left = directions.contains(InplaceEditorProvider.ExpansionDirection.LEFT); + boolean right = directions.contains(InplaceEditorProvider.ExpansionDirection.RIGHT); + + if (left) { + if (right) { + rectangle.x += widthDiff / 2; + rectangle.width = size.width; + } else { + rectangle.x += widthDiff; + rectangle.width = size.width; + } + } else { + if (right) { + rectangle.width = size.width; + } else { + } + } + + updateRectangleToFitToView (rectangle); + + editor.setBounds (rectangle); + editor.repaint (); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -127,7 +127,9 @@ final DefaultDockingPort globalPort = createDockingPort(); JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("curves"), EbliLib.getS("Courbes")); DockingManager.dock(centerComponent, (DockingPort) globalPort); + // POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// JTree tree = new JTree((EGGrapheTreeModel) pn.getGraphe().getModel()); + tree.setSelectionModel(((EGGrapheTreeModel) pn.getGraphe().getModel()).getSelectionModel()); JComponent rightComponent = createView(new JScrollPane(tree), EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); DockingManager.dock(rightComponent, centerComponent, DockingConstants.EAST_REGION, 0.75f); @@ -157,11 +159,11 @@ // return createView(panel, name, true); // } - protected static JComponent createView(JComponent jc, Icon ic, String name) { + public static JComponent createView(JComponent jc, Icon ic, String name) { return createView(jc, ic, name, false); } - protected static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { + public static JComponent createView(JComponent jc, Icon ic, String name, boolean dockage) { View view = new View(name); view.setIcon(ic); view.getViewProperties().setDockingEnabled(false); @@ -171,6 +173,7 @@ } view.setContentPane(jc); view.setTitle(name, true); + view.setPreferredSize(jc.getPreferredSize()); // DockingManager.registerDockable(view.getComponent(), name); return view; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.calque; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -11,6 +12,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; +import java.util.EnumSet; import java.util.HashMap; import java.util.Map; @@ -27,14 +29,20 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.EditProvider; +import org.netbeans.api.visual.action.InplaceEditorProvider; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; + + /** * * Classe permettant d'afficher un calque en tant que Widget @@ -42,7 +50,8 @@ * @author deniger * */ -public class EbliWidgetVueCalque extends EbliWidget implements EditProvider { +public class EbliWidgetVueCalque extends EbliWidget implements +/* EditProvider */InplaceEditorProvider<BuPanel> { ZEbliCalquesPanel calquePanel_; @@ -50,11 +59,13 @@ public Color couleurFond = Color.white; private EbliNodeDefault nodeLegende = null; - + Window frame_; BufferedImage image; + BuPanel conteneurEditor; + GrBoite zoom_; public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { @@ -69,15 +80,61 @@ // calquePanel_.restaurer(); // -- creation de l action pour editor --// - WidgetAction editorAction = ActionFactory.createEditAction(this); - + // WidgetAction editorAction = ActionFactory.createEditAction(this); + // WidgetAction editorAction = + // ActionFactory.createInplaceEditorAction(this); + WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); + + + } + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { + + conteneurEditor = new BuPanel(new BorderLayout()); + + conteneurEditor.add(calquePanel_, BorderLayout.CENTER); + + BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); + fonctionsCompletes.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // Cree la frame de docking associee au calque + edit(EbliWidgetVueCalque.this); + + } + + }); + conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); + + return conteneurEditor; + } + + /** + * appel\xE9 lors de la fermeture de l editeur. Il faut redessiner la widget. + */ + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + + zoom_ = calquePanel_.getVueCalque().getViewBoite(); + image = null; + getEbliScene().refresh(); + this.repaint(); + } + + /** + * Creer une frame qui contient toutes les fonctions pour modifier le calque. + * Ancienne methode edit(). + * + * @param _widget + */ public void edit(Widget _widget) { - if (frame_ != null) frame_.toFront(); + if (frame_ != null) + frame_.toFront(); else { final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); @@ -88,7 +145,10 @@ frame_ = getEbliScene().getEditor().createFrame(calquePanel_, getTitle()); p.x = p.x - 50; p.y = p.y - 50; - frame_.setLocation(p); + // frame_.setLocation(p); + // -- centrer la vue par rapport a la frame principal car si le widget est + // en bas a droite, c'est la merde! + frame_.setLocationRelativeTo(this.getScene().getView()); calquePanel_.getVueCalque().changeRepere(this, gr); frame_.setVisible(true); @@ -96,16 +156,20 @@ @Override public void windowClosed(WindowEvent _e) { - if (frame_ != null) frame_.dispose(); + if (frame_ != null) + frame_.dispose(); frame_ = null; } @Override public void windowClosing(WindowEvent _e) { - setPreferredSize(calquePanel_.getVueCalque().getSize()); + // setPreferredSize(calquePanel_.getVueCalque().getSize()); zoom_ = calquePanel_.getVueCalque().getViewBoite(); image = null; getEbliScene().refresh(); + // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL + // EST + conteneurEditor.add(calquePanel_, BorderLayout.CENTER); } }); @@ -155,7 +219,7 @@ g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } - + /** * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ @@ -164,18 +228,19 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); - // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); + return popup; } })); } private void constructPopupMenuSpecifique(JPopupMenu _popup) { JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -190,7 +255,7 @@ if (!EbliWidgetVueCalque.this.getEbliScene().isObject(nodeLegende)) { - + nodeLegende = new EbliNodeDefault(); // nodeLegende.setTitle("Legende calque"); // @@ -206,8 +271,8 @@ // methode qui permet d ajouter une legemde calquePanel_.addWidgetLegendeCalque(); - - + + EbliWidgetVueCalque.this.getEbliScene().refresh(); } @@ -219,9 +284,30 @@ } - - -// public void setColorFond(Color newColor) { + + + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, + BuPanel editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, + BuPanel editor, + Rectangle viewBounds) { + return null; + } + + + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + } + + + // public void setColorFond(Color newColor) { // couleurFond = newColor; // repaint(); // } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -19,6 +19,10 @@ public EGGraphe getGraphe() { return pn_.getGraphe(); } + + public EGFillePanel getGraphePanel() { + return pn_; + } // // public void setGraphe(EGGraphe graphe) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -1,5 +1,6 @@ package org.fudaa.ebli.visuallibrary.graphe; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -11,6 +12,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; +import java.util.EnumSet; import java.util.HashMap; import java.util.Map; @@ -21,18 +23,25 @@ import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGConfigureActionPalette; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; +import org.fudaa.ebli.courbe.EGObject; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.EditProvider; +import org.netbeans.api.visual.action.InplaceEditorProvider; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; /** @@ -41,18 +50,15 @@ * @author adrien hadoux * */ -public class EbliWidgetGraphe extends EbliWidget implements EditProvider/* - * , - * InplaceEditorProvider - * < - * BuPanel - * > - */{ +public class EbliWidgetGraphe extends EbliWidget implements /* EditProvider */InplaceEditorProvider<BuPanel>, + EGGrapheModelListener { // private EGGraphe graphe_; Window frame_; EGFillePanel panelGraphe_; + BuPanel conteneurEditor; + private EbliNodeDefault nodeLegende = null; public Color couleurContour = Color.black; @@ -70,10 +76,16 @@ public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGFillePanel _pn) { super(scene); panelGraphe_ = _pn; - WidgetAction editorAction = ActionFactory.createEditAction(this); - + // WidgetAction editorAction = ActionFactory.createEditAction(this); + // WidgetAction editorAction = + // ActionFactory.createInplaceEditorAction(this); + WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); + + + panelGraphe_.getGraphe().getModel().addModelListener(this); + } public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { @@ -93,10 +105,11 @@ if (frame_ == null) { getGraphe().setSize(rec.width - 1, rec.height - 1); -// getGraphe().computeMarges(g); -// getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); + // getGraphe().computeMarges(g); + // getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); } + // mode edition if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { FuLog.debug("EWI: recreate image"); @@ -107,14 +120,8 @@ } g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); - // -- couleur de fond --// - // g.setColor(couleurFond); - // g.fillRect(0, 0, rec.width, rec.height); + - // BufferedImage image = courbe.produceImage( - // rec.width - 1, rec.height - 1, - // Collections.EMPTY_MAP); - g.translate(-rec.x, -rec.y); } @@ -126,16 +133,19 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); + + // -- Menu sp\xF6cifiques a l'application--// + constructPopupMenuSpecifique(popup); + // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); - // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); + return popup; } })); } - + /** * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende * @@ -143,7 +153,7 @@ */ private void constructPopupMenuSpecifique(JPopupMenu _popup) { JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); - menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal22_commentaire")); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -182,11 +192,42 @@ }); // -- creation du menu config de la courbe + _popup.add(new EGConfigureActionPalette(getGraphe().getModel())); + } + public BuPanel createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { + + conteneurEditor = new BuPanel(new BorderLayout()); + conteneurEditor.add(this.panelGraphe_, BorderLayout.CENTER); + + BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); + fonctionsCompletes.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // Cree la frame de docking associee au graphe + edit(EbliWidgetGraphe.this); + } + + }); + conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); + + return conteneurEditor; + } + + + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor, boolean commit) { + } + // TODO a changer pour ne recreer tout plein de listener a chaque fois + /** + * Ancienne version de edit(). genere une frame complete pour prametrer le + * graphe. + */ public void edit(Widget _widget) { if (frame_ != null) frame_.toFront(); else { @@ -199,7 +240,8 @@ frame_ = getEbliScene().getEditor().createFrame(panelGraphe_, getTitle()); frame_.setPreferredSize(new Dimension(800, 600)); - frame_.setLocation(p); + // frame_.setLocation(p); + frame_.setLocationRelativeTo(this.getScene().getView()); frame_.pack(); frame_.addWindowListener(new WindowAdapter() { @@ -209,11 +251,16 @@ frame_ = null; } - public void windowClosing(WindowEvent _e) { -// zoom_ = calquePanel_.getVueCalque().getViewBoite(); + public void windowClosing(WindowEvent _e) { + // zoom_ = calquePanel_.getVueCalque().getViewBoite(); image = null; getEbliScene().refresh(); - } + frame_ = null; + + // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL + // EST + conteneurEditor.add(panelGraphe_, BorderLayout.CENTER); + } }); // calquePanel_.getVueCalque().changeRepere(this, gr); @@ -223,6 +270,54 @@ } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, + Rectangle viewBounds) { + return null; + } + + + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, + Widget widget, BuPanel editor) { + } + + public void axeAspectChanged(EGAxe _c) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void axeContentChanged(EGAxe _c) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void courbeContentChanged(EGObject _c, boolean restore) { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + + public void structureChanged() { + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + this.image = null; + this.repaint(); + } + // public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider. // ExpansionDirection> getExpansionDirections( // org.netbeans.api.visual.action.InplaceEditorProvider.EditorController Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -5,14 +5,12 @@ import java.util.List; import javax.swing.Icon; -import javax.swing.tree.TreePath; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; import org.fudaa.ebli.visuallibrary.EbliScene; -import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableNode; @@ -128,6 +126,8 @@ return CtuluLibString.EMPTY_STRING; } + + // /** // * Raffraichissement maison du jxtreetable // */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/impl/FudaaCommonImplementation.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -788,7 +788,7 @@ } if (_evt.getInternalFrame() instanceof CtuluFilleWithComponent) { final CtuluFilleWithComponent c = (CtuluFilleWithComponent) _evt.getInternalFrame(); - oldRightComponent_ = c.createComponent(); + oldRightComponent_ = c.createPanelComponent(); addRightComponent(c); } else { removeRightComponent(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/report/FudaaReportFille.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -73,7 +73,7 @@ } - public JComponent createComponent() { + public JComponent createPanelComponent() { return FudaaDjaBuilder.createDjaTable(getFudaaGrid()); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -4,6 +4,7 @@ import java.awt.Dimension; import java.awt.Point; import java.util.Iterator; +import java.util.List; import java.util.Set; import javax.swing.JButton; @@ -12,21 +13,39 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTree; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; +import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.jdesktop.swingx.JXCollapsiblePane; +import org.netbeans.api.visual.model.ObjectSceneEvent; +import org.netbeans.api.visual.model.ObjectSceneEventType; +import org.netbeans.api.visual.model.ObjectSceneListener; +import org.netbeans.api.visual.model.ObjectState; import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuToolBar; import com.memoire.bu.BuUndoRedoInterface; + /** * InternalFrame qui contient la scene EbliScene. * @@ -34,7 +53,7 @@ * */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, - BuUndoRedoInterface, BuCutCopyPasteInterface { + BuUndoRedoInterface, BuCutCopyPasteInterface, ObjectSceneListener { /** * @@ -54,14 +73,51 @@ JComponent[] tools_; /** + * Toolbar modifiable qui se met a jour selon la selection de la widget. + */ + BuToolBar toolBarModifiable_ = new BuToolBar(); + + BuMenuBar menuModifiable_ = new BuMenuBar(); + + /** + * Scroll qui contient le tree a droite. Ce panel est modifi\xE9 des que l on + * change de type d elements. + */ + JScrollPane panelTreeModifiable_; + + /** + * Panel qui contient le tree modifiable + */ + JPanel conteneurTree_; + + /** + * bouton qui permet de masquer/afficher le tree + */ + JButton toggleTree_; + + /** * Constructeur de la fenetre. */ - public TrPostLayoutFille() { + public TrPostLayoutFille(TrPostProjet _projet) { super(); setTitle(TrResource.getS("vue 2D")); // creation de la scene EBLI - controller_ = new TrPostLayoutPanelController(new TrPostScene()); + controller_ = new TrPostLayoutPanelController(new TrPostScene(), _projet); setContentPane(controller_.getPanel()); + + // -- enregistrement de this comem listener de la scene pour le type d objet + // selection changed--// + controller_.getScene().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED); + + + + // -- ajout de la toolbar et du menu en haut --// + toolBarModifiable_.setFloatable(false); + this.add(toolBarModifiable_, BorderLayout.NORTH); + this.setJMenuBar(menuModifiable_); + + // -- init du panel de choix des trees --// + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); } @@ -94,7 +150,10 @@ } } - public JComponent createComponent() { + /** + * Methode qui permet de modifier le panel sur la droite. + */ + public JComponent createPanelComponent() { if (right == null) { right = new JPanel(new BorderLayout()); @@ -106,8 +165,30 @@ over.add(pane, BorderLayout.CENTER); pane.add(getScene().createSatelliteView()); right.add(over, BorderLayout.NORTH); - right.add(new JScrollPane(controller_.createTree()), BorderLayout.CENTER); + + + pane = new JXCollapsiblePane(); + toggleTree_ = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); + toggleTree_.setText("Composants"); + + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + // right.add(panelTreeModifiable_, BorderLayout.CENTER); + conteneurTree_ = new JPanel(new BorderLayout()); + conteneurTree_.add(toggleTree_, BorderLayout.NORTH); + conteneurTree_.add(pane, BorderLayout.CENTER); + pane.add(panelTreeModifiable_); + right.add(conteneurTree_, BorderLayout.CENTER); + + // --verification qu il n existe pas de composant sur la scene auquel cas, + // selection automatique pour modification --// + + if(controller_!=null){ + Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getScene().getObjects(); + if(noeudContenus.size()==1) + getScene().setSelectedObjects(noeudContenus); + getScene().refresh(); } + } return right; } @@ -192,7 +273,9 @@ //--recuperation des noeuds a copier --// nodesCopyied = (Set<EbliNode>) getScene().getSelectedObjects(); - + + // -- reinit de la commande cut si on voulait faire un ctrl+x + nodesCutted = null; } public void cut() { @@ -213,6 +296,9 @@ } + // reinit de la liste des noeuds a copier au cas ou on change d avis + nodesCopyied = null; + } public void duplicate() { @@ -234,6 +320,9 @@ // --duplication du node --// node.duplicate(null); } + // reinititalisation de la liste + nodesCopyied = null; + }else if (nodesCutted != null) { @@ -242,8 +331,310 @@ // --ajout du node --// getScene().addNode(node); } + // reinit de la liste + nodesCutted = null; + } + } + + // ---methode du listener d ecoute de la scene + + /** + * Called to notify that an object was added to an object scene. This is + * called when an object-widget mapping is registered in an ObjectScene only. + * At the moment of the call, the object is still not reqistered in the + * Graph*Scene classes yet. Therefore do not use the methods of Graph*Scene. + * + * @param event + * @param addedObject + */ + public void objectAdded(ObjectSceneEvent event, Object addedObject) { + } + + /** + * Called to notify that an object was removed from an object scene. This is + * called when an object-widget mapping is unregistered in an ObjectScene and + * Graph*Scene classes. At the moment of the call, a widget (visual + * representation of the object) is still in the scene. Therefore do not rely + * on a tree of widgets of the scene. + * + * @param event + * the object scene event + * @param removedObject + * the removed object + */ + public void objectRemoved(ObjectSceneEvent event, Object removedObject) { + } + + /** + * Called to notify that the object state of an object is changed. This method + * is always called before any other ObjectSceneListener method is called. + * + * @param event + * the object scene event + * @param changedObject + * the object with changed object state + * @param previousState + * the previous object state + * @param newState + * the new object state + */ + public void objectStateChanged(ObjectSceneEvent event, Object changedObject, ObjectState previousState, + ObjectState newState) { + } + + /** + * Called to notify that the object-selection is changed. + * + * @param event + * the object scene event + * @param previousSelection + * the set of previously selected objects + * @param newSelection + * the set of newly selected objects + */ + public void selectionChanged(ObjectSceneEvent event, Set<Object> previousSelection, Set<Object> newSelection) { + + + // cas ou de multiples objets sont selectionnes, on ne fait rien pour le + // moment + // A voir pour une fonctionnalit\xE9 magique + if (newSelection != null && newSelection.size() > 1) + return; + else if (newSelection == null || newSelection.size() == 0) { + // -- cas particulier: on met le tree des calques et pas de toolbar --// + changeTreeScene(); + changeToolbarScene(); + return; + } + EbliNode node = (EbliNode) newSelection.iterator().next(); + + // 3 cas pour le moment: graphe ou calque ou rien + if(!node.hasWidget()) + return; + if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { + + // -- etape 1: ajout du tree de calque dans fudaaImplementation --// + changeTreeCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); + + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbarCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); + + + } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { + + + // -- etape 1: ajout du tree de graphe dans fudaaImplementation --// + changeTreeGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphe()); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbarGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphePanel()); + } else { + + // -- etape 1: on fout eventuellement le tree des layouts --// + changeTreeScene(); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbarScene(); + } + } + + /** + * Called to notify that the object-highlighting is changed. + * + * @param event + * the object scene event + * @param previousHighlighting + * the set of previously highlighted objects + * @param newHighlighting + * the set of newly highlighted objects + */ + public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) { } + /** + * Called to notify that the object-hovering is changed. + * + * @param event + * the object scene event + * @param previousHoveredObject + * the previous hovered object; null if there was no hovered object + * @param newHoveredObject + * the new hovered object; null if there is no hovered object + */ + public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) { + } + + /** + * Called to notify that the object-focus is changed. + * + * @param event + * the object scene event + * @param previousFocusedObject + * the previously focused object; null if there was no focused object + * @param newFocusedObject + * the newly focused object; null if there is no focused object + */ + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { + } + + { + } + + /** + * Methode qui met a jour le tree de droite avec le tree du calque + * selectionne. + * + * @param calque + */ + private void changeTreeCalque(ZEbliCalquesPanel _calque) { + + + conteneurTree_.remove(panelTreeModifiable_); + + // JComponent component = EbliWidgetEditCreator.createView(new + // BArbreCalque(_calque.getArbreCalqueModel()), + // EbliResource.EBLI.getToolIcon("arbre"), "Calques", false); + panelTreeModifiable_ = new JScrollPane(new BArbreCalque(_calque.getArbreCalqueModel())); + // panelTreeModifiable_ = new JScrollPane(component); + + this.toggleTree_.setText("Calques"); + + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // mise a jour du panel + conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); + } + + /** + * Methode qui met a jour le tree de droite avec le tree du graphe + * selectionne. + * + * @param _graphe + */ + private void changeTreeGraphe(EGGraphe _graphe) { + + + conteneurTree_.remove(panelTreeModifiable_); + // JComponent component = EbliWidgetEditCreator.createView(new + // JTree((EGGrapheTreeModel) _graphe.getModel()), + // EbliResource.EBLI.getToolIcon("arbre"), "Courbes", false); + + //POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// + JTree yoda = new JTree((EGGrapheTreeModel) _graphe.getModel()); + yoda.setSelectionModel(((EGGrapheTreeModel) _graphe.getModel()).getSelectionModel()); + panelTreeModifiable_ = new JScrollPane(yoda); + if (this.toggleTree_ != null) + this.toggleTree_.setText("Courbes"); + // panelTreeModifiable_ = new JScrollPane(component); + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // mise a jour du panel + conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); + + } + + /** + * Met a jour le tree a droite si ni un graphe ni un calque n est selectionn\xE9. + */ + private void changeTreeScene() { + conteneurTree_.remove(panelTreeModifiable_); + // JComponent component = + // EbliWidgetEditCreator.createView(controller_.createTree(), + // EbliResource.EBLI + // .getToolIcon("arbre"), "Composants", false); + + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + if (this.toggleTree_ != null) + this.toggleTree_.setText("Liste des composants"); + // panelTreeModifiable_ = new JScrollPane(component); + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // mise a jour du panel + conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); + } + + + /** + * Methode qui modifie la toolbar associee au calque selectionne + * + * @param _calque + */ + private void changeToolbarCalque(ZEbliCalquesPanel _calque) { + + // nettoyage de la toolbar + toolBarModifiable_.removeAll(); + menuModifiable_.removeAll(); + + // ajout des tool specifiques du calque + List actions = _calque.getController().getActions(); + for (Iterator iterator = actions.iterator(); iterator.hasNext();) { + EbliActionInterface object = (EbliActionInterface) iterator.next(); + if (object == null) { + toolBarModifiable_.addSeparator(); + } else { + toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + + // ajout des menus specifiques pour le calque + JMenu[] specificMenus = _calque.getSpecificMenus(EbliLib.getS("Vue 2D")); + + for (int i = 0; i < specificMenus.length; i++) { + menuModifiable_.add(specificMenus[i]); + } + + // mise a jour des params + toolBarModifiable_.revalidate(); + menuModifiable_.revalidate(); + this.setJMenuBar(menuModifiable_); + this.revalidate(); + + } + + private void changeToolbarGraphe(EGFillePanel _graphe) { + + // nettoyage de la toolbar + toolBarModifiable_.removeAll(); + menuModifiable_.removeAll(); + + + // ajout des toolbar specifiques du calque + EbliActionInterface[] specificInterfaces = _graphe.getSpecificActions(); + for (int i = 0; i < specificInterfaces.length; i++) { + EbliActionInterface object = specificInterfaces[i]; + if (object == null) { + toolBarModifiable_.addSeparator(); + } else { + toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + + // ajout des menus specifiques + JMenu menu = new JMenu("Menu graphe"); + _graphe.fillSpecificMenu(menu); + menuModifiable_.add(menu); + + // mise a jour des params + toolBarModifiable_.revalidate(); + menuModifiable_.revalidate(); + this.setJMenuBar(menuModifiable_); + this.revalidate(); + } + + private void changeToolbarScene() { + // nettoyage de la toolbar + toolBarModifiable_.removeAll(); + menuModifiable_.removeAll(); + + toolBarModifiable_.add(new EbliWidgetActionConfigure(controller_.getScene())); + JMenu menu = new JMenu("Configurer"); + menu.add(new EbliWidgetActionConfigure(controller_.getScene())); + menuModifiable_.add(menu); + // mise a jour des params + toolBarModifiable_.revalidate(); + menuModifiable_.revalidate(); + this.setJMenuBar(menuModifiable_); + this.revalidate(); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-19 16:30:04 UTC (rev 3828) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-20 15:07:17 UTC (rev 3829) @@ -54,6 +54,7 @@ import com.memoire.bu.BuDesktop; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; import com.memoire.bu.BuSeparator; public class TrPostLayoutPanelController { @@ -64,14 +65,23 @@ List<EbliActionAbstract> actions; /** + * Tree qui contient la hierarchie des widget de la scene. + */ + JXTreeTable treeScene = null; + + + TrPostProjet projet_; + + /** * Calque principal associ\xE9 a la vue layout. */ private ZEbliCalquesPanel calquePrincipal; - TrPostLayoutPanelController(EbliScene _scene) { + TrPostLayoutPanelController(EbliScene _scene, TrPostProjet _projet) { treeModel_ = new EbliWidgetJXTreeTableModel(_scene); _scene.addEbliNodeListener(treeModel_); _scene.setCmdMng(new CtuluCommandManager()); + projet_ = _projet; } /** @@ -110,7 +120,6 @@ // ajout du node au layout addNode(nodeCalque); - @@ -270,6 +279,9 @@ } }); + + + // widget image _l.add(new EbliWidgetActionImageChooser(getScene())); @@ -325,39 +337,49 @@ return (JComponent[]) res.toArray(new JComponent[res.size()]); } + /** + * Methode qui cree le tree ou le renvoie si ce dernier est cree. + * + * @return tree des widgets. + */ public JXTreeTable createTree() { - JXTreeTable tree = new JXTreeTable(treeModel_); + + if (treeScene != null) + return treeScene; + + + treeScene = new JXTreeTable(treeModel_); // -- ajout du tree au model pour les dimensionnements --// // modeltable.setTree_(tree_); // --vision du noeud root --// - tree.setRootVisible(false); + treeScene.setRootVisible(false); // --ajout du renderer pour les images-// - tree.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); + treeScene.setTreeCellRendere... [truncated message content] |
From: <de...@us...> - 2008-08-21 20:14:20
|
Revision: 3831 http://fudaa.svn.sourceforge.net/fudaa/?rev=3831&view=rev Author: deniger Date: 2008-08-21 20:14:24 +0000 (Thu, 21 Aug 2008) Log Message: ----------- maj prepro Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/DefaultObjectSceneListener.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gui/CtuluLibSwing.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -63,11 +63,22 @@ } /** - * Ajouter un actionListener a la checkbox _res afin d'activer ou non un - * panneau (et tous ces composants). + * @param _parent le composant \xE0 partir duquel la recherche commence + * @param _name le nom du composant fils \xE0 chercher + * @return le fils direct de _parent ayant le nom donne ou null si non trouve + */ + public static JComponent findChildByName(JComponent _parent, String _name) { + if (_parent == null || _name == null) return null; + for (int i = _parent.getComponentCount() - 1; i >= 0; i--) { + if (_name.equals(_parent.getComponent(i).getName())) return (JComponent) _parent.getComponent(i); + } + return null; + } + + /** + * Ajouter un actionListener a la checkbox _res afin d'activer ou non un panneau (et tous ces composants). * - * @param _target le panneau dont les composants seront activ\xE9es ou non, selon - * l'\xE9tat de la checkbox _res + * @param _target le panneau dont les composants seront activ\xE9es ou non, selon l'\xE9tat de la checkbox _res * @param _res la checkbox permettant de activer ou non un panneau */ public static void addActionListenerForCheckBoxTitle(final JPanel _target, final JCheckBox _res) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -41,6 +41,7 @@ import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTreeComboboxModel; import org.fudaa.ctulu.gui.CtuluTreeComboboxRenderer; import org.fudaa.ctulu.image.CtuluImageProducer; @@ -313,9 +314,9 @@ // le panel sud contenant le suivi de souris et le mode mode_ = new BuLabel(); - mode_.setFont(BuLib.deriveFont("Label", Font.PLAIN, -2)); - mode_.setPreferredSize(new Dimension(120, 20)); - mode_.setSize(new Dimension(120, 20)); + mode_.setFont(CtuluLibSwing.getMiniFont()); + mode_.setPreferredSize(new Dimension(150, 20)); + mode_.setSize(new Dimension(150, 20)); mode_.setVisible(false); mode_.setOpaque(false); info_ = new BuLabel(); @@ -331,6 +332,7 @@ add(vc_, BuBorderLayout.CENTER); if (_addSouth) { final BuPanel south = new BuPanel(); + south.setName("pnSuivis"); south.setLayout(new BuBorderLayout()); south.setOpaque(false); south.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.gray)); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/DefaultObjectSceneListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/DefaultObjectSceneListener.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/DefaultObjectSceneListener.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -0,0 +1,36 @@ +/* + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary; + +import java.util.Set; + +import org.netbeans.api.visual.model.ObjectSceneEvent; +import org.netbeans.api.visual.model.ObjectSceneListener; +import org.netbeans.api.visual.model.ObjectState; + +/** + * Classe implementant \xE0 vide les m\xE9thodes de ObjectSceneListener. + * + * @author deniger + */ +public class DefaultObjectSceneListener implements ObjectSceneListener { + + public void focusChanged(ObjectSceneEvent _event, Object _previousFocusedObject, Object _newFocusedObject) {} + + public void highlightingChanged(ObjectSceneEvent _event, Set<Object> _previousHighlighting, + Set<Object> _newHighlighting) {} + + public void hoverChanged(ObjectSceneEvent _event, Object _previousHoveredObject, Object _newHoveredObject) {} + + public void objectAdded(ObjectSceneEvent _event, Object _addedObject) {} + + public void objectRemoved(ObjectSceneEvent _event, Object _removedObject) {} + + public void objectStateChanged(ObjectSceneEvent _event, Object _changedObject, ObjectState _previousState, + ObjectState _newState) {} + + public void selectionChanged(ObjectSceneEvent _event, Set<Object> _previousSelection, Set<Object> _newSelection) {} + +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeListener.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -1,11 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -public interface EbliNodeListener { - - void nodeAdded(EbliNode node); - - void nodeRemoved(EbliNode node); - - - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -3,9 +3,7 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; +import java.util.Collections; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -14,20 +12,42 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.graph.GraphScene; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; +import org.netbeans.modules.visual.action.SelectAction; /** * classe de gestion de la scene principale * * @author Adrien Hadoux - * */ public class EbliScene extends GraphScene<EbliNode, EbliEdge> { + private class ObjectSelectProvider implements SelectProvider { + + public boolean isAimingAllowed(Widget widget, Point localLocation, boolean invertSelection) { + return false; + } + + public boolean isSelectionAllowed(Widget widget, Point localLocation, boolean invertSelection) { + return findObject(widget) != null; + } + + public void select(Widget widget, Point localLocation, boolean invertSelection) { + Object object = findObject(widget); + + setFocusedObject(object); + if (object != null) { + if (!invertSelection && getSelectedObjects().contains(object)) return; + userSelectionSuggested(Collections.singleton(object), invertSelection); + } else userSelectionSuggested(Collections.emptySet(), invertSelection); + } + } + public static void refreshScene(Scene _sc) { _sc.validate(); _sc.repaint(); @@ -35,72 +55,50 @@ } - EbliWidgetEditCreator editor_ = EbliWidgetEditCreator.INSTANCE; + final private WidgetAction alignWithMoveAction; /** - * @return the editor - */ - public EbliWidgetEditCreator getEditor() { - return editor_; - } - - /** - * @param _editor the editor to set - */ - public void setEditor(EbliWidgetEditCreator _editor) { - editor_ = _editor; - } - - /** * Le gestionnaire de commande associe \xE0 la scene */ CtuluCommandManager cmdMng_; + EbliWidgetEditCreator editor_ = EbliWidgetEditCreator.INSTANCE; + + private LayerWidget interactionLayer_; + + public final WidgetAction rectangularSelection_; + /** * la visu du graphscene */ private LayerWidget visu_; - private LayerWidget interactionLayer_; - - final private WidgetAction alignWithMoveAction; - /** * la liste des listener associes a la scene */ - Collection<EbliNodeListener> listenerList; - + // Collection<EbliNodeListener> listenerList; public EbliScene() { super(); setLookFeel(new EbliLookFeel()); // creation du layer de mise en page + interactionLayer_ = new LayerWidget(this); + addChild(interactionLayer_); visu_ = new LayerWidget(this); addChild(visu_); - interactionLayer_ = new LayerWidget(this); - addChild(interactionLayer_); + + alignWithMoveAction = ActionFactory.createAlignWithMoveAction(visu_, interactionLayer_, ActionFactory .createDefaultAlignWithMoveDecorator(), false); - + rectangularSelection_=ActionFactory.createRectangularSelectAction(this, interactionLayer_); // -- ajoute l'action du zoom ( ctrl + clic) - getActions().addAction(ActionFactory.createZoomAction(1.1, true)); + getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); + getActions().addAction(rectangularSelection_); // -- ajouter le menu popup de base setMenuBase(); } - /** - * Methode qui permet d ajouter un listener - * - * @param listener - */ - public void addEbliNodeListener(EbliNodeListener listener) { - // init si necessaire - if (listenerList == null) listenerList = new HashSet<EbliNodeListener>(); - // ajout - listenerList.add(listener); - } - @Override protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { @@ -116,6 +114,18 @@ return null; } + // /** + // * Methode qui permet d ajouter un listener + // * + // * @param listener + // */ + // public void addEbliNodeListener(EbliNodeListener listener) { + // // init si necessaire + // if (listenerList == null) listenerList = new HashSet<EbliNodeListener>(); + // // ajout + // listenerList.add(listener); + // } + @Override protected Widget attachNodeWidget(EbliNode node) { @@ -133,29 +143,17 @@ } /** - * Called by the removeNode method to notify that a node is removed from the - * graph model. The default implementation removes the node widget from its - * parent widget. - * - * @param node the removed node - * @param widget the removed node widget; null if the node is non-visual - * - * Surcharge pour faire appel au notify des listener et ainsi mettre - * ajour les listener + * @return the cmdMng */ - protected void detachNodeWidget(EbliNode node, Widget widget) { - // -- indique la suppresion du node chez le parent - notifyAllListenerNodeRemoved(node); - - if (widget != null) widget.removeFromParent(); - + public CtuluCommandManager getCmdMng() { + return cmdMng_; } /** - * @return the cmdMng + * @return the editor */ - public CtuluCommandManager getCmdMng() { - return cmdMng_; + public EbliWidgetEditCreator getEditor() { + return editor_; } public LayerWidget getLayerVisu() { @@ -166,63 +164,67 @@ return alignWithMoveAction; } - public LayerWidget getVisu() { - return visu_; - } - /** - * Methode qui permet d envoyer le signal du node ajout\xE9 a tous les listener - * - * @param listener + * @return the rectangularSelection */ - public void notifyAllListenerNodeAdded(EbliNode node) { - if (listenerList == null) return; - for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { - it.next().nodeAdded(node); - } + public WidgetAction getRectangularSelection() { + return rectangularSelection_; + } + public LayerWidget getVisu() { + return visu_; } /** - * Methode qui permet d envoyer le signal du node retir\xE9 a tous les listener + * Methode qui permet d envoyer le signal du node selectionn\xE9 a tous les listener * * @param listener */ - public void notifyAllListenerNodeRemoved(EbliNode node) { - if (listenerList == null) return; + // public void notifyAllListenerNodeSelected(EbliNode node) { + // if (listenerList == null) + // return; + // + // for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + // EbliNodeListener listener = it.next(); + // listener.nodeRemoved(node); + // } + // + // } - for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { - EbliNodeListener listener = it.next(); - listener.nodeRemoved(node); - } - - } - - /** - * Methode qui permet d envoyer le signal du node selectionn\xE9 a tous les - * listener - * - * @param listener - */ - public void notifyAllListenerNodeSelected(EbliNode node) { - if (listenerList == null) - return; - - for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { - EbliNodeListener listener = it.next(); - listener.nodeRemoved(node); - } - - } - - - @Override protected void notifyNodeAdded(EbliNode node, Widget widget) { - // -- notifier tous les listener que le noeud a ete attache --// - notifyAllListenerNodeAdded(node); + // -- notifier tous les listener que le noeud a ete attache --// + // notifyAllListenerNodeAdded(node); } + // /** + // * Methode qui permet d envoyer le signal du node ajout\xE9 a tous les listener + // * + // * @param listener + // */ + // public void notifyAllListenerNodeAdded(EbliNode node) { + // if (listenerList == null) return; + // for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + // it.next().nodeAdded(node); + // } + // + // } + // + // /** + // * Methode qui permet d envoyer le signal du node retir\xE9 a tous les listener + // * + // * @param listener + // */ + // public void notifyAllListenerNodeRemoved(EbliNode node) { + // if (listenerList == null) return; + // + // for (Iterator<EbliNodeListener> it = listenerList.iterator(); it.hasNext();) { + // EbliNodeListener listener = it.next(); + // listener.nodeRemoved(node); + // } + // + // } + /** * Methode qui permet de raffraichir les elements de la scene */ @@ -237,6 +239,13 @@ cmdMng_ = _cmdMng; } + /** + * @param _editor the editor to set + */ + public void setEditor(EbliWidgetEditCreator _editor) { + editor_ = _editor; + } + public void setMenuBase() { getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { @@ -281,12 +290,5 @@ public void setVisu_(LayerWidget visu_) { this.visu_ = visu_; } - - - - - - - } 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-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -32,16 +32,14 @@ * Widget version EBLI * * @author Adrien Hadoux - * */ public class EbliWidget extends Widget implements BSelecteurTargetInterface { private EbliScene scene_; /** - * Map contenant tous les objets graphiques de la widget generique. key: - * lineModel => le lignemodel du ebliWidget. key: color => couleur de fond. - * + * Map contenant tous les objets graphiques de la widget generique. key: lineModel => le lignemodel du ebliWidget. + * key: color => couleur de fond. */ public Map propGraphique; @@ -64,9 +62,7 @@ public BConfigurableInterface[] getConfigureInterfaces() { return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib .getS("Affichage")) /* - * , new - * BConfigurableComposite(getSingleConfigureInterface - * (), EbliLib.getS("Gizmo caca")) + * , new BConfigurableComposite(getSingleConfigureInterface (), EbliLib.getS("Gizmo caca")) */}; } @@ -76,8 +72,7 @@ } /** - * Retourne une interface widgetConfigure qui permet de gerer les interfaces a - * creer + * Retourne une interface widgetConfigure qui permet de gerer les interfaces a creer * * @return */ @@ -105,20 +100,17 @@ } /** - * Retourne l objet correspondant a la clef: retourne l objet graphique - * correspondant depuis la map d objets graphiques de la widget. + * 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) { - - // -- 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 Integer.valueOf((int) (radian * 180 / Math.PI)); } @@ -128,13 +120,11 @@ 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. + * 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) { - - // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour // l ancien lignemodel --// if (_key.equals(LINEMODEL)) { @@ -224,8 +214,6 @@ */ public void constructPopupMenuBase(JPopupMenu _popup) { - - JMenuItem menuItem3 = _popup.add("Masquer l'objet"); menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); menuItem3.addActionListener(new ActionListener() { @@ -289,8 +277,7 @@ } /** - * 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 */ @@ -315,9 +302,8 @@ } /** - * Methode generique qui fait apparaitre un menuItem propre au composant et - * offre les op\xE9rations de base on ouvre le menu via le clic droit ou le - * raccourcis shift+F10 + * Methode generique qui fait apparaitre un menuItem propre au composant et offre les op\xE9rations de base on ouvre le + * menu via le clic droit ou le raccourcis shift+F10 */ public void setMenu() { @@ -336,8 +322,7 @@ } /** - * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il - * n a aucun effet. + * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il n a aucun effet. * * @param _popup */ @@ -369,10 +354,9 @@ }); } - - - public void setScene_(EbliScene scene_) { - this.scene_ = scene_; + + public void setScene_(EbliScene _scene) { + this.scene_ = _scene; } public void setUseBorder(boolean _useBorder) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -16,6 +16,7 @@ import java.util.HashMap; import java.util.Map; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -36,19 +37,16 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuBorders; import com.memoire.bu.BuButton; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; - - /** - * * Classe permettant d'afficher un calque en tant que Widget * * @author deniger - * */ public class EbliWidgetVueCalque extends EbliWidget implements /* EditProvider */InplaceEditorProvider<BuPanel> { @@ -65,12 +63,13 @@ BufferedImage image; BuPanel conteneurEditor; - - GrBoite zoom_; + // GrBoite zoom_; + public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { super(scene); calquePanel_ = vue; + calquePanel_.setBorder(BuBorders.EMPTY1111); // FIXME a enlever par la suite setPreferredSize(new Dimension(500, 400)); @@ -86,32 +85,29 @@ WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); - - - } public BuPanel createEditorComponent( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { - conteneurEditor = new BuPanel(new BorderLayout()); + // conteneurEditor = new BuPanel(new BorderLayout()); + // + // conteneurEditor.add(calquePanel_, BorderLayout.CENTER); + // + // BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); + // fonctionsCompletes.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // // Cree la frame de docking associee au calque + // edit(EbliWidgetVueCalque.this); + // + // } + // + // }); + // conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); - conteneurEditor.add(calquePanel_, BorderLayout.CENTER); - - BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); - fonctionsCompletes.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - // Cree la frame de docking associee au calque - edit(EbliWidgetVueCalque.this); - - } - - }); - conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); - - return conteneurEditor; + return calquePanel_; } /** @@ -119,22 +115,22 @@ */ public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, boolean commit) { - - zoom_ = calquePanel_.getVueCalque().getViewBoite(); + + // zoom_ = calquePanel_.getVueCalque().getViewBoite(); image = null; + getEbliScene().refresh(); + calquePanel_.setBorder(BuBorders.EMPTY1111); this.repaint(); } /** - * Creer une frame qui contient toutes les fonctions pour modifier le calque. - * Ancienne methode edit(). + * Creer une frame qui contient toutes les fonctions pour modifier le calque. Ancienne methode edit(). * * @param _widget */ public void edit(Widget _widget) { - if (frame_ != null) - frame_.toFront(); + if (frame_ != null) frame_.toFront(); else { final GrBoite gr = calquePanel_.getVueCalque().getViewBoite(); Rectangle rec = convertLocalToScene(getClientArea()); @@ -156,18 +152,17 @@ @Override public void windowClosed(WindowEvent _e) { - if (frame_ != null) - frame_.dispose(); + if (frame_ != null) frame_.dispose(); frame_ = null; } @Override public void windowClosing(WindowEvent _e) { // setPreferredSize(calquePanel_.getVueCalque().getSize()); - zoom_ = calquePanel_.getVueCalque().getViewBoite(); + // zoom_ = calquePanel_.getVueCalque().getViewBoite(); image = null; getEbliScene().refresh(); - // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL + // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL // EST conteneurEditor.add(calquePanel_, BorderLayout.CENTER); } @@ -191,6 +186,8 @@ } } + boolean first_ = true; + @SuppressWarnings("unchecked") @Override protected void paintWidget() { @@ -200,11 +197,15 @@ if (frame_ == null) { initSize(rec); - if (zoom_ != null) { - // image=null; - calquePanel_.getVueCalque().changeRepere(this, zoom_); - - } else calquePanel_.restaurer(); + if (first_) { + first_ = false; + calquePanel_.restaurer(); + } + // if (zoom_ != null) { + // // image=null; + // calquePanel_.getVueCalque().changeRepere(this, zoom_); + // + // } else calquePanel_.restaurer(); } // mode edition @@ -219,7 +220,6 @@ g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); } - /** * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ @@ -228,16 +228,16 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); - // -- Menu sp\xF6cifiques a l'application--// + // -- Menu sp\xF6cifiques a l'application--// constructPopupMenuSpecifique(popup); // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); - return popup; } })); } + private void constructPopupMenuSpecifique(JPopupMenu _popup) { JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire")); @@ -252,15 +252,13 @@ Point nouvellePosition = new Point((int) (EbliWidgetVueCalque.this.getLocation().x), (int) (EbliWidgetVueCalque.this.getLocation().y + EbliWidgetVueCalque.this.getBounds().height * 1.2)); - if (!EbliWidgetVueCalque.this.getEbliScene().isObject(nodeLegende)) { - nodeLegende = new EbliNodeDefault(); // nodeLegende.setTitle("Legende calque"); // // if (calquePanel_.getCqLegend()==null) - //JOptionPane.showMessageDialog(null,"calquePqnel.getCqlegend null") + // JOptionPane.showMessageDialog(null,"calquePqnel.getCqlegend null") // ; // nodeLegende.setCreator(new // EbliWidgetCreatorCalqueLegende(calquePanel_.getCqLegend())); @@ -272,7 +270,6 @@ // methode qui permet d ajouter une legemde calquePanel_.addWidgetLegendeCalque(); - EbliWidgetVueCalque.this.getEbliScene().refresh(); } @@ -282,31 +279,24 @@ }); - } - - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, - BuPanel editor) { + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { return null; } public Rectangle getInitialEditorComponentBounds( - org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, - BuPanel editor, + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, Rectangle viewBounds) { - return null; + return convertLocalToScene(getClientArea()); } - - public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { + calquePanel_.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); } - // public void setColorFond(Color newColor) { // couleurFond = newColor; // repaint(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -8,21 +8,22 @@ import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.DefaultObjectSceneListener; import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliNodeListener; import org.fudaa.ebli.visuallibrary.EbliScene; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableNode; +import org.netbeans.api.visual.model.ObjectSceneEvent; +import org.netbeans.api.visual.model.ObjectSceneEventType; +import org.netbeans.api.visual.model.ObjectSceneListener; /** - * Model du treetable. contient 3 colonnes: colonne 1:icone colonne 2:nom - * colonne 3:checkbox associee + * Model du treetable. contient 3 colonnes: colonne 1:icone colonne 2:nom colonne 3:checkbox associee * * @author Adrien Hadoux - * */ -public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel implements EbliNodeListener { +public class EbliWidgetJXTreeTableModel extends DefaultTreeTableModel { // -- le nombre de colonnes est statique --// // final static int NBCOLUMN = 3; @@ -33,6 +34,7 @@ private static final String[] title = { "", EbliLib.getS("Nom"), "V" }; final EbliScene scene_; + final ObjectSceneListener sceneListener_; /** * constructeur. @@ -43,7 +45,23 @@ public EbliWidgetJXTreeTableModel(EbliScene _scene) { super(EbliWidgetTreeTableNode.build(_scene)); scene_ = _scene; + sceneListener_ = new DefaultObjectSceneListener() { + @Override + public void objectAdded(ObjectSceneEvent _event, Object _addedObject) { + nodeAdded((EbliNode) _addedObject); + } + + @Override + public void objectRemoved(ObjectSceneEvent _event, Object _removedObject) { + nodeRemoved((EbliNode) _removedObject); + } + }; + scene_.addObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED,ObjectSceneEventType.OBJECT_REMOVED); } + + public void removeListener(){ + scene_.removeObjectSceneListener(sceneListener_, ObjectSceneEventType.OBJECT_ADDED,ObjectSceneEventType.OBJECT_REMOVED); + } public EbliScene getScene() { return scene_; @@ -126,8 +144,6 @@ return CtuluLibString.EMPTY_STRING; } - - // /** // * Raffraichissement maison du jxtreetable // */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -337,7 +337,6 @@ final BuPanel p = new BuPanel(); p.setLayout(new BuBorderLayout()); EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(scene); - scene.addEbliNodeListener(tree); // FIXME: mettre tout cela dans la construction de EbliWidgetJXTree // EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); // tree.setCellRenderer(renderer); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -79,7 +79,6 @@ TrPostLayoutPanelController(EbliScene _scene, TrPostProjet _projet) { treeModel_ = new EbliWidgetJXTreeTableModel(_scene); - _scene.addEbliNodeListener(treeModel_); _scene.setCmdMng(new CtuluCommandManager()); projet_ = _projet; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-08-21 20:14:24 UTC (rev 3831) @@ -16,11 +16,14 @@ import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JFrame; +import javax.swing.JPanel; import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluLibDialog; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.animation.ActionAnimationTreeSelection; @@ -104,6 +107,8 @@ TrPostInfoDelegate info_; + final JComponent suiviPanel_; + public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller) { this(_impl, _controller, false); } @@ -146,12 +151,22 @@ getDonneesCalque().enDernier(gc); gc.putClientProperty(Action.SHORT_DESCRIPTION, TrResource.getS("Affichage des images de fond")); getArbreCalqueModel().setSelectionCalque(isoLayer_); - //TODO Fred a enlever - // removeCalqueLegend(); - + // TODO Fred a enlever + removeCalqueLegend(); + + suiviPanel_ = (JPanel) CtuluLibSwing.findChildByName(this, "pnSuivis"); + remove(suiviPanel_); + } /** + * @return the suiviPanel + */ + public JComponent getSuiviPanel() { + return suiviPanel_; + } + + /** * Methode qui ajoute une widget de legende de calque. */ public void addWidgetLegendeCalque() { @@ -164,8 +179,7 @@ // rafraichissement de la scene this.getProjet().filleLayout_.controller_.getScene().refresh(); - - + } // BCalqueLegende malegende = new BCalqueLegende(); @@ -368,8 +382,7 @@ } /* - * protected void anim(){ if (anim_ == null) anim_ = new EbliAnimation(this); - * anim_.go(); } + * protected void anim(){ if (anim_ == null) anim_ = new EbliAnimation(this); anim_.go(); } */ public void dataRemoved(final H2dVariableType[] _vars, final boolean _isFleche) { @@ -476,30 +489,28 @@ } /** - * duplication du trPostVisuPanel. surcharge de la duplication du - * zeblicalquePanel. + * duplication du trPostVisuPanel. surcharge de la duplication du zeblicalquePanel. */ - public TrPostVisuPanel duplicate(){ - + public TrPostVisuPanel duplicate() { + final TrPostVisuPanel duplic = new TrPostVisuPanel(this.getImpl(), this.getProjet()); // -- duplication du layer qui contient les memes proprietes --// duplic.isoLayer_ = (TrIsoLayer) this.isoLayer_.duplicate(); - - - + // -- duplication des donnees via sauvegarde thread--// new CtuluTaskOperationGUI(this.impl_, TrResource.getS("Enregistrement")) { public void act() { - + // -- sauvegarde de l etat --// - BCalqueSaverInterface savedData= getDonneesCalque().getPersistenceMng().save(getDonneesCalque(),impl_.createProgressionInterface(this)); - + BCalqueSaverInterface savedData = getDonneesCalque().getPersistenceMng().save(getDonneesCalque(), + impl_.createProgressionInterface(this)); + // -- chargement de l etat dans le calque duplique --// duplic.getDonneesCalque().getPersistenceMng().restore(savedData, duplic, duplic.getDonneesCalque(), impl_.createProgressionInterface(this)); - - // -- destruction des calques doublons du duplic pour recuperer une + + // -- destruction des calques doublons du duplic pour recuperer une // bonne arborescence --// // BCalque[] liste = duplic.getDonneesCalque().getCalques(); @@ -517,20 +528,11 @@ // } // // } - - + } }.start(); - - - - - - - - + return duplic; } - - + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/fudaa-distrib/prepro/build.xml 2008-08-21 20:14:24 UTC (rev 3831) @@ -194,6 +194,9 @@ <library jar="${ctulu.lib.dir}/fgis.jar" /> <library jar="${ctulu.lib.dir}/looks.jar" /> <library jar="${ctulu.lib.dir}/jep.jar" /> + <library jar="${ctulu.lib.dir}/commons-logging-1.1.jar" /> + <library jar="${ctulu.lib.dir}/flexdock-0.5.1.jar" /> + <library jar="${ctulu.lib.dir}/skinlf.jar" /> <!--Classes appel\xE9es par reflexion--> <class> <fileset dir="${fudaa.dist.classes.dir}"> Modified: branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml 2008-08-21 15:27:05 UTC (rev 3830) +++ branches/Prepro-0.92-SNAPSHOT/fudaaFormatage.xml 2008-08-21 20:14:24 UTC (rev 3831) @@ -9,7 +9,7 @@ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> @@ -17,9 +17,9 @@ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> @@ -68,7 +68,7 @@ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> @@ -88,13 +88,13 @@ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> @@ -134,7 +134,7 @@ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> @@ -166,8 +166,8 @@ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> @@ -179,7 +179,7 @@ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> <setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/> -<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> @@ -203,7 +203,7 @@ <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> @@ -216,7 +216,7 @@ <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> @@ -234,7 +234,7 @@ <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> @@ -262,6 +262,6 @@ <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="true"/> </profile> </profiles> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-24 22:26:30
|
Revision: 3832 http://fudaa.svn.sourceforge.net/fudaa/?rev=3832&view=rev Author: deniger Date: 2008-08-24 22:26:37 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.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/EbliWidgetCreatorRectangleTexte.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/actions/EbliActionEditorOneClick.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.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/test/org/fudaa/ebli/all/TestGraphe2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelRubar.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -141,10 +141,14 @@ final BCalqueLegendePanel pnLeg = new BCalqueLegendePanel(_cq, _titre); pnLeg.setName("pnLEGENDE_" + name); cqAffPanels_.put(_cq, pnLeg); - pnLegendes_.add(pnLeg); + addLegendToPanel(pnLeg); return pnLeg; } + protected void addLegendToPanel(final BCalqueLegendePanel pnLeg) { + pnLegendes_.add(pnLeg); + } + protected void isRestoreFromProperties(BCalqueAffichage _cq) { default_.initFrom(_cq.getLegendProperties()); super.setFont(_cq.getLegendProperties().getFont()); @@ -272,7 +276,7 @@ updateProperties(_finalPanel.aff_); cqAffPanels_.put(_finalPanel.aff_, _finalPanel); _finalPanel.aff_.setLegende(this); - pnLegendes_.add(_finalPanel); + addLegendToPanel(_finalPanel); pnLegendes_.revalidate(); if (!lockRefresh_) { repaint(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -68,8 +68,8 @@ /** * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, - * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. - * Par defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou + * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. Par + * defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou * modifies avec les methodes remove * * @version $Id: ZEbliCalquesPanel.java,v 1.55 2007-06-05 08:58:38 deniger Exp $ @@ -171,9 +171,7 @@ } protected BuMenu createMenu(final BCalque _cq) { - if (_cq == null) { - return null; - } + if (_cq == null) { return null; } BuMenu m = null; if (_cq.isGroupeCalque()) { m = new ThemeMenu(_cq, _cq.getTitle(), _cq.getName()); @@ -246,7 +244,7 @@ private BGroupeCalque gcDonnees_; public void setGcDonnees_(BGroupeCalque gcDonnees_) { - + this.gcDonnees_ = gcDonnees_; } @@ -343,9 +341,7 @@ } modelArbre_.refresh(); - if (_controller == null) { - throw new IllegalArgumentException(); - } + if (_controller == null) { throw new IllegalArgumentException(); } controller_ = _controller; controller_.setView(this); } @@ -577,9 +573,7 @@ } public int print(final Graphics _g, final PageFormat _format, final int _numPage) { - if (_numPage != 0) { - return Printable.NO_SUCH_PAGE; - } + if (_numPage != 0) { return Printable.NO_SUCH_PAGE; } final BVueCalque bv = getVueCalque(); final Graphics2D g2d = (Graphics2D) _g; g2d.setColor(Color.black); @@ -809,13 +803,9 @@ /** * Ajoute les calques d'informations. - * - * @param _g le maillage associe */ protected BGroupeCalque addCqInfos() { - if (getCqInfos() != null) { - return getCqInfos(); - } + if (getCqInfos() != null) { return getCqInfos(); } final BGroupeCalque gr = new BGroupeCalque(); gr.setName("gpInfo"); gr.setTitle(EbliLib.getS("infos")); @@ -828,6 +818,29 @@ return gr; } + protected BGroupeCalque addCqInfos(final BCalqueLegende l) { + if (getCqInfos() != null) { return getCqInfos(); } + final BGroupeCalque gr = new BGroupeCalque(); + gr.setName("gpInfo"); + gr.setTitle(EbliLib.getS("infos")); + l.setDestructible(false); + l.setTitle(EbliLib.getS("L\xE9gende")); + l.setName("cqLegende"); + gr.add(l); + vc_.getCalque().enPremier(gr); + return gr; + } + + public void addCqLegende(final BCalqueLegende _leg) { + if (getCqInfos() != null) { + removeCalqueLegend(); + _leg.setName("cqLegende"); + getCqInfos().add(_leg); + } else { + addCqInfos(_leg); + } + } + protected final void removeCqInfos() { vc_.getCalque().detruire(getCqInfos()); } @@ -836,31 +849,23 @@ * @return le calque legende */ public final BCalqueLegende getCqLegend() { - if (getCqInfos() == null) - addCqInfos(); + if (getCqInfos() == null) addCqInfos(); return (BCalqueLegende) getCqInfos().getCalqueParNom("cqLegende"); } protected void removeCalqueLegend() { - getCqInfos().remove(getCqLegend()); + if(getCqLegend()!=null) + getCqInfos().remove(getCqLegend()); // getCqLegend().setVisible(false); } - + public void addCalqueLegend() { getCqInfos().add(getCqLegend()); getCqLegend().setVisible(true); } public void setInfoPaletteActive() { - getController().setInfoPaletteActive(); - - } - - - /** - * Methdoe a surhcarger puor le cas des widgets. - */ - public void addWidgetLegendeCalque() { + getController().setInfoPaletteActive(); } @@ -874,23 +879,18 @@ return selection; } - - public ZEbliCalquesPanel duplicate() { + public ZEbliCalquesPanel duplicate(Map options) { /* * ZEbliCalquesPanel duplic = new ZEbliCalquesPanel(new CtuluUIDefault()); * - * // --pas besoin de duplication des groupes de calques --// - * duplic.gcDonnees_ = new BGroupeCalque(); + * // --pas besoin de duplication des groupes de calques --// duplic.gcDonnees_ = new BGroupeCalque(); * - * // -- mais le contenu si --// BCalque[] contenuAdupliquer = - * this.getDonneesCalque().getCalques(); + * // -- mais le contenu si --// BCalque[] contenuAdupliquer = this.getDonneesCalque().getCalques(); * - * // -- ajout des calques dupliques un a un --// for (int i = 0; i < - * contenuAdupliquer.length; i++) { + * // -- ajout des calques dupliques un a un --// for (int i = 0; i < contenuAdupliquer.length; i++) { * duplic.addCalque(contenuAdupliquer[i].duplicate()); } */ return null; } - - + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -89,6 +89,8 @@ addMouseListener(_a.getRepereController()); addMouseWheelListener(_a.getRepereController()); lbTools_ = new JLabel(); + //le nom est important et r\xE9utilis\xE9 par d'autres + lbTools_.setName("lbTools"); lbTools_.setFont(BuLib.deriveFont("Label", Font.PLAIN, -2)); lbTools_.setPreferredSize(new Dimension(200, 20)); lbTools_.setSize(new Dimension(100, 20)); 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-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -2,11 +2,14 @@ import java.awt.Dimension; import java.awt.Point; +import java.util.HashMap; import java.util.Map; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import com.sun.org.apache.bcel.internal.generic.GETSTATIC; + public class EbliNodeDefault implements EbliNode { EbliWidgetCreator creator; @@ -41,9 +44,10 @@ .setCreator(new EbliWidgetCreatorGraphe(((EbliWidgetCreatorGraphe) getCreator()).getGraphe().duplicate())); } else if (creator instanceof EbliWidgetCreatorVueCalque) { - + Map duplicOptions=new HashMap(); + duplicOptions.put("scene", getCreator().getWidget().getEbliScene()); duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque() - .duplicate())); + .duplicate(duplicOptions))); } else if (creator instanceof EbliWidgetCreatorShape) { Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetComponent.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -0,0 +1,190 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.awt.geom.AffineTransform; + +import javax.swing.JComponent; + +import org.netbeans.api.visual.widget.Scene; + +/** + * @author deniger + */ +public class EbliWidgetComponent extends EbliWidget { + + private Component component; + private boolean componentAdded; + private boolean widgetAdded; + private double zoomFactor = Double.MIN_VALUE; + private ComponentSceneListener validateListener; + private ComponentComponentListener componentListener; + private boolean componentVisible = false; + + /** + * Creates a component widget. + * + * @param scene the scene + * @param component the AWT/Swing component + */ + public EbliWidgetComponent(EbliScene scene, Component component) { + super(scene); + this.component = component; + validateListener = null; + componentListener = new ComponentComponentListener(); + setComponentVisible(true); + } + + /** + * Returns a AWT/Swing component. + * + * @return the AWT/Swing component + */ + public final Component getComponent() { + return component; + } + + /** + * Returns whether the component should be visible. + * + * @return true if the component is visible + */ + public final boolean isComponentVisible() { + return componentVisible; + } + + /** + * Sets whether the component should be visible. + * + * @param componentVisible if true, then the component is visible + */ + public final void setComponentVisible(boolean componentVisible) { + if (this.componentVisible == componentVisible) return; + this.componentVisible = componentVisible; + attach(); + revalidate(); + } + + protected final void notifyAdded() { + widgetAdded = true; + attach(); + } + + protected final void notifyRemoved() { + widgetAdded = false; + } + + private void attach() { + if (validateListener != null) return; + validateListener = new ComponentSceneListener(); + getScene().addSceneListener(validateListener); + } + + private void detach() { + if (validateListener == null) return; + getScene().removeSceneListener(validateListener); + validateListener = null; + } + + /** + * Calculates a client area from the preferred size of the component. + * + * @return the calculated client area + */ + protected final Rectangle calculateClientArea() { + Dimension preferredSize = component.getPreferredSize(); + zoomFactor = getScene().getZoomFactor(); + preferredSize.width = (int) Math.floor(preferredSize.width / zoomFactor); + preferredSize.height = (int) Math.floor(preferredSize.height / zoomFactor); + return new Rectangle(preferredSize); + } + + private void addComponent() { + Scene scene = getScene(); + if (!componentAdded) { + scene.getView().add(component); + scene.getView().revalidate(); + component.addComponentListener(componentListener); + componentAdded = true; + } + component.removeComponentListener(componentListener); + component.setBounds(scene.convertSceneToView(convertLocalToScene(getClientArea()))); + component.addComponentListener(componentListener); + component.repaint(); + } + + private void removeComponent() { + Scene scene = getScene(); + if (componentAdded) { + component.removeComponentListener(componentListener); + scene.getView().remove(component); + scene.getView().revalidate(); + componentAdded = false; + } + } + + /** + * Paints the component widget. + */ + protected final void paintWidget() { + if (!componentVisible) { + boolean isDoubleBuffered = component instanceof JComponent && component.isDoubleBuffered(); + if (isDoubleBuffered) ((JComponent) component).setDoubleBuffered(false); + Graphics2D graphics = getGraphics(); + Rectangle bounds = getClientArea(); + AffineTransform previousTransform = graphics.getTransform(); + graphics.translate(bounds.x, bounds.y); + double zoomFactor = getScene().getZoomFactor(); + graphics.scale(1 / zoomFactor, 1 / zoomFactor); + component.print(graphics); + graphics.setTransform(previousTransform); + if (isDoubleBuffered) ((JComponent) component).setDoubleBuffered(isDoubleBuffered); + } + } + + private final class ComponentSceneListener implements Scene.SceneListener { + + public void sceneRepaint() {} + + public void sceneValidating() { + double newZoomFactor = getScene().getZoomFactor(); + if (Math.abs(newZoomFactor - zoomFactor) != 0.0) { + revalidate(); + zoomFactor = newZoomFactor; + } + } + + public void sceneValidated() { + if (widgetAdded && componentVisible) addComponent(); + else { + removeComponent(); + detach(); + } + } + } + + private final class ComponentComponentListener implements ComponentListener { + + public void componentResized(ComponentEvent e) { + revalidate(); + } + + public void componentMoved(ComponentEvent e) { + revalidate(); + } + + public void componentShown(ComponentEvent e) {} + + public void componentHidden(ComponentEvent e) {} + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -1,6 +1,5 @@ package org.fudaa.ebli.visuallibrary; -import org.fudaa.ebli.courbe.EGGraphe; public class EbliWidgetCreatorRectangleTexte implements EbliWidgetCreator { 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-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -19,7 +19,7 @@ * Legende Widget qui permet de construire des rectangles avec du texte * * @author Adrien Hadoux - * + * TODO a generaliser avec autre chose qu'un LabelWidget */ public class EbliWidgetRectangle extends EbliWidget implements TextFieldInplaceEditor { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliActionEditorOneClick.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -46,6 +46,8 @@ */ public State mouseClicked(Widget widget, WidgetMouseEvent event) { if (event.getButton() == MouseEvent.BUTTON1 /*&& event.getClickCount() == 2*/) { + Point p=event.getPoint(); + if(widget.getClientArea().contains(p)) if (openEditor(widget)) return State.createLocked(widget, this); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -15,7 +15,7 @@ /** * Classe qui genere une widget editeur de texte. - * + * TODO a enlever * @author Adrien Hadoux * */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -1,42 +1,39 @@ package org.fudaa.ebli.visuallibrary.calque; -import java.awt.Dimension; - import org.fudaa.ebli.calque.BCalqueLegendePanel; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetComponent; import org.fudaa.ebli.visuallibrary.EbliWidgetCreator; public class EbliWidgetCreatorCalqueLegende implements EbliWidgetCreator { BCalqueLegendePanel calque; - EbliWidgetCalqueLegende res; - - - public BCalqueLegendePanel getCalque() { - return calque; - } + EbliWidget res; - public void setCalque(BCalqueLegendePanel calque) { - this.calque = calque; - } - - - public EbliWidgetCreatorCalqueLegende(BCalqueLegendePanel legende) { super(); this.calque = legende; } public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetCalqueLegende(_scene, calque); - res.setPreferredSize(new Dimension(200, 200)); + // calque.setPreferredSize(new Dimension(200, 200)); + res = new EbliWidgetComponent(_scene, calque); + res.setCheckClipping(true); return res; } + public BCalqueLegendePanel getCalque() { + return calque; + } + public EbliWidget getWidget() { // TODO Auto-generated method stub return res; } + public void setCalque(BCalqueLegendePanel calque) { + this.calque = calque; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -66,10 +66,11 @@ // GrBoite zoom_; - public EbliWidgetVueCalque(EbliScene scene, ZEbliCalquesPanel vue) { - super(scene); - calquePanel_ = vue; - calquePanel_.setBorder(BuBorders.EMPTY1111); + public EbliWidgetVueCalque(EbliScene _scene, ZEbliCalquesPanel _vue) { + super(_scene); + calquePanel_ = _vue; + calquePanel_.setBorder(null); +// calquePanel_.setBorder(BuBorders.EMPTY1111); // FIXME a enlever par la suite setPreferredSize(new Dimension(500, 400)); @@ -85,6 +86,7 @@ WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); + _vue.addCqLegende(new EbliWidgetCalqueLegende(_scene)); } @@ -120,7 +122,7 @@ image = null; getEbliScene().refresh(); - calquePanel_.setBorder(BuBorders.EMPTY1111); +// calquePanel_.setBorder(BuBorders.EMPTY1111); this.repaint(); } @@ -193,6 +195,8 @@ protected void paintWidget() { Rectangle rec = getClientArea(); + rec.width-=1; + rec.height-=1; Graphics2D g = getGraphics(); if (frame_ == null) { @@ -268,7 +272,7 @@ // EbliWidgetVueCalque.this.getEbliScene().addNode(nodeLegende); // methode qui permet d ajouter une legemde - calquePanel_.addWidgetLegendeCalque(); +// calquePanel_.addWidgetLegendeCalque(); EbliWidgetVueCalque.this.getEbliScene().refresh(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -22,6 +22,7 @@ import javax.swing.SwingUtilities; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGConfigureActionPalette; @@ -48,7 +49,6 @@ * widget qui contient un objet graphe * * @author adrien hadoux - * */ public class EbliWidgetGraphe extends EbliWidget implements /* EditProvider */InplaceEditorProvider<BuPanel>, EGGrapheModelListener { @@ -58,7 +58,7 @@ EGFillePanel panelGraphe_; BuPanel conteneurEditor; - + private EbliNodeDefault nodeLegende = null; public Color couleurContour = Color.black; @@ -76,23 +76,21 @@ public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGFillePanel _pn) { super(scene); panelGraphe_ = _pn; + panelGraphe_.setBorder(null); + panelGraphe_.remove(CtuluLibSwing.findChildByName(panelGraphe_, "lbTools")); // WidgetAction editorAction = ActionFactory.createEditAction(this); // WidgetAction editorAction = // ActionFactory.createInplaceEditorAction(this); WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); - - + panelGraphe_.getGraphe().getModel().addModelListener(this); - + } public EbliWidgetGraphe(EbliScene scene, Point preferredLocation, EGGraphe _graphe) { this(scene, preferredLocation, new EGFillePanel(_graphe)); - // -- creation de l action pour editor --// - // WidgetAction editorAction = - // ActionFactory.createInplaceEditorAction(this); } @@ -101,7 +99,7 @@ protected void paintWidget() { Rectangle rec = getClientArea(); Graphics2D g = getGraphics(); - g.translate(rec.x, rec.y); +// g.translate(rec.x, rec.y); if (frame_ == null) { getGraphe().setSize(rec.width - 1, rec.height - 1); @@ -109,20 +107,18 @@ // getGraphe().dessine(g, rec.width - 1, rec.height - 1, false); } - // mode edition if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { FuLog.debug("EWI: recreate image"); Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); // a ameliorer: il ne faudrait pas recreer l'image a chaque fois - image = getGraphe().produceImage(rec.width, rec.height, params); + image = getGraphe().produceImage(rec.width-1, rec.height-1, params); } - g.drawImage(image, rec.x, rec.y, rec.width, rec.height, null); - + g.drawImage(image, rec.x, rec.y, rec.width-1, rec.height-1, null); - g.translate(-rec.x, -rec.y); +// g.translate(-rec.x, -rec.y); } /** @@ -133,19 +129,17 @@ public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { JPopupMenu popup = new JPopupMenu(); - - // -- Menu sp\xF6cifiques a l'application--// + // -- Menu sp\xF6cifiques a l'application--// constructPopupMenuSpecifique(popup); - + // -- creation du menu commun a tous les widgets constructPopupMenuBase(popup); - return popup; } })); } - + /** * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende * @@ -179,7 +173,7 @@ nodeLegende.setPreferedSize(new Dimension(100, 100)); EbliWidgetGraphe.this.getEbliScene().addNode(nodeLegende); - //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe. + // widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe. // this.getGraphe(), // EbliWidgetGraphe.this.getScene_(),nouvellePosition); EbliWidgetGraphe.this.getEbliScene().refresh(); @@ -192,41 +186,37 @@ }); // -- creation du menu config de la courbe - + _popup.add(new EGConfigureActionPalette(getGraphe().getModel())); - } public BuPanel createEditorComponent( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { - conteneurEditor = new BuPanel(new BorderLayout()); - conteneurEditor.add(this.panelGraphe_, BorderLayout.CENTER); + // conteneurEditor = new BuPanel(new BorderLayout()); + // conteneurEditor.add(this.panelGraphe_, BorderLayout.CENTER); - BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); - fonctionsCompletes.addActionListener(new ActionListener() { + // BuButton fonctionsCompletes = new BuButton("Ouvrir dans une fen\xEAtre", BuResource.BU.getIcon("crystal_valider")); + // fonctionsCompletes.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // // Cree la frame de docking associee au graphe + // edit(EbliWidgetGraphe.this); + // } + // + // }); + // conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); - public void actionPerformed(ActionEvent e) { - // Cree la frame de docking associee au graphe - edit(EbliWidgetGraphe.this); - } - - }); - conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); - - return conteneurEditor; + return panelGraphe_; } - public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor, boolean commit) { - } + Widget widget, BuPanel editor, boolean commit) {} // TODO a changer pour ne recreer tout plein de listener a chaque fois /** - * Ancienne version de edit(). genere une frame complete pour prametrer le - * graphe. + * Ancienne version de edit(). genere une frame complete pour prametrer le graphe. */ public void edit(Widget _widget) { if (frame_ != null) frame_.toFront(); @@ -256,7 +246,7 @@ image = null; getEbliScene().refresh(); frame_ = null; - + // YODA:RAJOUTER LE GRAPHE DANS EDITOR TU DOIS CAR DANS FRAME IL // EST conteneurEditor.add(panelGraphe_, BorderLayout.CENTER); @@ -270,7 +260,6 @@ } - public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor) { return null; @@ -279,14 +268,14 @@ public Rectangle getInitialEditorComponentBounds( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, Rectangle viewBounds) { - return null; + Rectangle rec= convertLocalToScene(getClientArea()); + rec.width-=1; + rec.height-=1; + return rec; } - - public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, - Widget widget, BuPanel editor) { - } + Widget widget, BuPanel editor) {} public void axeAspectChanged(EGAxe _c) { // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre @@ -295,25 +284,25 @@ } public void axeContentChanged(EGAxe _c) { - // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre this.image = null; this.repaint(); } public void courbeAspectChanged(EGObject _c, boolean _visibil) { - // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre this.image = null; this.repaint(); } public void courbeContentChanged(EGObject _c, boolean restore) { - // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre this.image = null; this.repaint(); } public void structureChanged() { - // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre + // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre this.image = null; this.repaint(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -463,7 +463,7 @@ bar.add(new EbliWidgetActionImageChooser(scene)); - bar.add(new EbliWidgetActiontextEditor(scene)); +// bar.add(new EbliWidgetActiontextEditor(scene)); p.doLayout(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -134,8 +134,8 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.92-MAQUETTE"; - infoSoft.date = "2008-08-18"; + infoSoft.version = "0.92-MAQUETTE-V2"; + infoSoft.date = "2008-08-26"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2007"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -26,6 +26,8 @@ import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.courbe.EGSpecificActions; +import org.fudaa.ebli.courbe.EGTree; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; @@ -45,12 +47,10 @@ import com.memoire.bu.BuToolBar; import com.memoire.bu.BuUndoRedoInterface; - /** * InternalFrame qui contient la scene EbliScene. * * @author Adrien Hadoux - * */ public class TrPostLayoutFille extends BuInternalFrame implements CtuluFilleWithComponent, CtuluUndoRedoInterface, BuUndoRedoInterface, BuCutCopyPasteInterface, ObjectSceneListener { @@ -76,12 +76,11 @@ * Toolbar modifiable qui se met a jour selon la selection de la widget. */ BuToolBar toolBarModifiable_ = new BuToolBar(); - + BuMenuBar menuModifiable_ = new BuMenuBar(); - + /** - * Scroll qui contient le tree a droite. Ce panel est modifi\xE9 des que l on - * change de type d elements. + * Scroll qui contient le tree a droite. Ce panel est modifi\xE9 des que l on change de type d elements. */ JScrollPane panelTreeModifiable_; @@ -89,12 +88,12 @@ * Panel qui contient le tree modifiable */ JPanel conteneurTree_; - + /** * bouton qui permet de masquer/afficher le tree */ JButton toggleTree_; - + /** * Constructeur de la fenetre. */ @@ -104,18 +103,16 @@ // creation de la scene EBLI controller_ = new TrPostLayoutPanelController(new TrPostScene(), _projet); setContentPane(controller_.getPanel()); - + // -- enregistrement de this comem listener de la scene pour le type d objet // selection changed--// controller_.getScene().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED); - - - + // -- ajout de la toolbar et du menu en haut --// toolBarModifiable_.setFloatable(false); this.add(toolBarModifiable_, BorderLayout.NORTH); this.setJMenuBar(menuModifiable_); - + // -- init du panel de choix des trees --// panelTreeModifiable_ = new JScrollPane(controller_.createTree()); @@ -127,9 +124,8 @@ * @param _preferedDimension * @param _calque * @return - * @see org.fudaa.fudaa.tr.post.TrPostLayoutPanelController#addCalque(java.lang.String, - * java.awt.Point, java.awt.Dimension, - * org.fudaa.ebli.calque.ZEbliCalquesPanel) + * @see org.fudaa.fudaa.tr.post.TrPostLayoutPanelController#addCalque(java.lang.String, java.awt.Point, + * java.awt.Dimension, org.fudaa.ebli.calque.ZEbliCalquesPanel) */ public EbliNode addCalque(String _title, Point _preferredLocation, Dimension _preferedDimension, ZEbliCalquesPanel _calque) { @@ -165,30 +161,28 @@ over.add(pane, BorderLayout.CENTER); pane.add(getScene().createSatelliteView()); right.add(over, BorderLayout.NORTH); - - + pane = new JXCollapsiblePane(); toggleTree_ = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); toggleTree_.setText("Composants"); - + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); - // right.add(panelTreeModifiable_, BorderLayout.CENTER); + // right.add(panelTreeModifiable_, BorderLayout.CENTER); conteneurTree_ = new JPanel(new BorderLayout()); conteneurTree_.add(toggleTree_, BorderLayout.NORTH); conteneurTree_.add(pane, BorderLayout.CENTER); pane.add(panelTreeModifiable_); right.add(conteneurTree_, BorderLayout.CENTER); - + // --verification qu il n existe pas de composant sur la scene auquel cas, // selection automatique pour modification --// - if(controller_!=null){ - Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getScene().getObjects(); - if(noeudContenus.size()==1) - getScene().setSelectedObjects(noeudContenus); - getScene().refresh(); + if (controller_ != null) { + Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getScene().getObjects(); + if (noeudContenus.size() == 1) getScene().setSelectedObjects(noeudContenus); + getScene().refresh(); + } } - } return right; } @@ -229,8 +223,7 @@ } /** - * Methode utilisee dans la classe fille TrPostFille pour recuperer le calque - * principal et enregistrer. + * Methode utilisee dans la classe fille TrPostFille pour recuperer le calque principal et enregistrer. * * @return */ @@ -238,8 +231,7 @@ return getCalquePrincipal(); } - public void majComponent(Object _o) { - } + public void majComponent(Object _o) {} public void redo() { final CtuluCommandManager c = getCmdMng(); @@ -248,8 +240,7 @@ } } - public void setActive(final boolean _b) { - } + public void setActive(final boolean _b) {} public void undo() { final CtuluCommandManager c = getCmdMng(); @@ -258,47 +249,43 @@ } } - // liste des noeuds copies Set<EbliNode> nodesCopyied = null; // liste des noeuuds coupes Set<EbliNode> nodesCutted = null; + public void copy() { JOptionPane.showMessageDialog(null, "copy()"); // on copie la widget selectionnee // ie on fait une duplication partielle // on ajoute pas tout de suite le noeud dans la scene - - - //--recuperation des noeuds a copier --// + + // --recuperation des noeuds a copier --// nodesCopyied = (Set<EbliNode>) getScene().getSelectedObjects(); - + // -- reinit de la commande cut si on voulait faire un ctrl+x nodesCutted = null; } public void cut() { JOptionPane.showMessageDialog(null, "cut()"); - + // --recuperation des noeuds a copier --// nodesCutted = (Set<EbliNode>) getScene().getSelectedObjects(); - // enlever les nodes de la scene for (Iterator<EbliNode> it = nodesCutted.iterator(); it.hasNext();) { EbliNode node = it.next(); // le node existe toujours apres l'avoir enleve getScene().removeNode(node); - - - + } - + // reinit de la liste des noeuds a copier au cas ou on change d avis nodesCopyied = null; - + } public void duplicate() { @@ -306,26 +293,24 @@ } public void paste() { - - //TODO a ameliorer : TENIR COMPTE DE LA POSITION DE LA SOURIS - + + // TODO a ameliorer : TENIR COMPTE DE LA POSITION DE LA SOURIS + JOptionPane.showMessageDialog(null, "paste()"); - + // --recuperation des noeuds copies --// if (nodesCopyied != null) { - - - for (Iterator<EbliNode> it = nodesCopyied.iterator(); it.hasNext();) { - EbliNode node = it.next(); - // --duplication du node --// - node.duplicate(null); - } - // reinititalisation de la liste + + for (Iterator<EbliNode> it = nodesCopyied.iterator(); it.hasNext();) { + EbliNode node = it.next(); + // --duplication du node --// + node.duplicate(null); + } + // reinititalisation de la liste nodesCopyied = null; - - }else if (nodesCutted != null) { - - + + } else if (nodesCutted != null) { + for (Iterator<EbliNode> it = nodesCutted.iterator(); it.hasNext();) { EbliNode node = it.next(); // --ajout du node --// @@ -333,73 +318,56 @@ } // reinit de la liste nodesCutted = null; + } } - } // ---methode du listener d ecoute de la scene /** - * Called to notify that an object was added to an object scene. This is - * called when an object-widget mapping is registered in an ObjectScene only. - * At the moment of the call, the object is still not reqistered in the - * Graph*Scene classes yet. Therefore do not use the methods of Graph*Scene. + * Called to notify that an object was added to an object scene. This is called when an object-widget mapping is + * registered in an ObjectScene only. At the moment of the call, the object is still not reqistered in the Graph*Scene + * classes yet. Therefore do not use the methods of Graph*Scene. * * @param event * @param addedObject */ - public void objectAdded(ObjectSceneEvent event, Object addedObject) { - } + public void objectAdded(ObjectSceneEvent event, Object addedObject) {} /** - * Called to notify that an object was removed from an object scene. This is - * called when an object-widget mapping is unregistered in an ObjectScene and - * Graph*Scene classes. At the moment of the call, a widget (visual - * representation of the object) is still in the scene. Therefore do not rely - * on a tree of widgets of the scene. + * Called to notify that an object was removed from an object scene. This is called when an object-widget mapping is + * unregistered in an ObjectScene and Graph*Scene classes. At the moment of the call, a widget (visual representation + * of the object) is still in the scene. Therefore do not rely on a tree of widgets of the scene. * - * @param event - * the object scene event - * @param removedObject - * the removed object + * @param event the object scene event + * @param removedObject the removed object */ - public void objectRemoved(ObjectSceneEvent event, Object removedObject) { - } + public void objectRemoved(ObjectSceneEvent event, Object removedObject) {} /** - * Called to notify that the object state of an object is changed. This method - * is always called before any other ObjectSceneListener method is called. + * Called to notify that the object state of an object is changed. This method is always called before any other + * ObjectSceneListener method is called. * - * @param event - * the object scene event - * @param changedObject - * the object with changed object state - * @param previousState - * the previous object state - * @param newState - * the new object state + * @param event the object scene event + * @param changedObject the object with changed object state + * @param previousState the previous object state + * @param newState the new object state */ public void objectStateChanged(ObjectSceneEvent event, Object changedObject, ObjectState previousState, - ObjectState newState) { - } + ObjectState newState) {} /** * Called to notify that the object-selection is changed. * - * @param event - * the object scene event - * @param previousSelection - * the set of previously selected objects - * @param newSelection - * the set of newly selected objects + * @param event the object scene event + * @param previousSelection the set of previously selected objects + * @param newSelection the set of newly selected objects */ public void selectionChanged(ObjectSceneEvent event, Set<Object> previousSelection, Set<Object> newSelection) { - - + // cas ou de multiples objets sont selectionnes, on ne fait rien pour le // moment // A voir pour une fonctionnalit\xE9 magique - if (newSelection != null && newSelection.size() > 1) - return; + if (newSelection != null && newSelection.size() > 1) return; else if (newSelection == null || newSelection.size() == 0) { // -- cas particulier: on met le tree des calques et pas de toolbar --// changeTreeScene(); @@ -407,132 +375,118 @@ return; } EbliNode node = (EbliNode) newSelection.iterator().next(); - + + // TODO a gerer de maniere Generique + // 3 cas pour le moment: graphe ou calque ou rien - if(!node.hasWidget()) - return; + if (!node.hasWidget()) return; if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { - // -- etape 1: ajout du tree de calque dans fudaaImplementation --// changeTreeCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); - + // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); - - + } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { - - + // -- etape 1: ajout du tree de graphe dans fudaaImplementation --// changeTreeGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphe()); // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphePanel()); } else { - + // -- etape 1: on fout eventuellement le tree des layouts --// changeTreeScene(); // -- etape 2: rechargement de la toolbar specifique dans this --// changeToolbarScene(); } - + } /** * Called to notify that the object-highlighting is changed. * - * @param event - * the object scene event - * @param previousHighlighting - * the set of previously highlighted objects - * @param newHighlighting - * the set of newly highlighted objects + * @param event the object scene event + * @param previousHighlighting the set of previously highlighted objects + * @param newHighlighting the set of newly highlighted objects */ - public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) { - } + public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) {} /** * Called to notify that the object-hovering is changed. * - * @param event - * the object scene event - * @param previousHoveredObject - * the previous hovered object; null if there was no hovered object - * @param newHoveredObject - * the new hovered object; null if there is no hovered object + * @param event the object scene event + * @param previousHoveredObject the previous hovered object; null if there was no hovered object + * @param newHoveredObject the new hovered object; null if there is no hovered object */ - public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) { - } + public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) {} /** * Called to notify that the object-focus is changed. * - * @param event - * the object scene event - * @param previousFocusedObject - * the previously focused object; null if there was no focused object - * @param newFocusedObject - * the newly focused object; null if there is no focused object + * @param event the object scene event + * @param previousFocusedObject the previously focused object; null if there was no focused object + * @param newFocusedObject the newly focused object; null if there is no focused object */ - public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { - } + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) {} - { - } + {} /** - * Methode qui met a jour le tree de droite avec le tree du calque - * selectionne. + * Methode qui met a jour le tree de droite avec le tree du calque selectionne. * * @param calque */ private void changeTreeCalque(ZEbliCalquesPanel _calque) { - conteneurTree_.remove(panelTreeModifiable_); - + // JComponent component = EbliWidgetEditCreator.createView(new // BArbreCalque(_calque.getArbreCalqueModel()), // EbliResource.EBLI.getToolIcon("arbre"), "Calques", false); + //TODO dangereux car chaque arbre s'enregistre en tant que listener du calque et il ne d\xE9sabonne jamais. panelTreeModifiable_ = new JScrollPane(new BArbreCalque(_calque.getArbreCalqueModel())); // panelTreeModifiable_ = new JScrollPane(component); - + this.toggleTree_.setText("Calques"); - + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); // mise a jour du panel conteneurTree_.validate(); panelTreeModifiable_.revalidate(); } - + /** - * Methode qui met a jour le tree de droite avec le tree du graphe - * selectionne. + * Methode qui met a jour le tree de droite avec le tree du graphe selectionne. * * @param _graphe */ private void changeTreeGraphe(EGGraphe _graphe) { - conteneurTree_.remove(panelTreeModifiable_); // JComponent component = EbliWidgetEditCreator.createView(new // JTree((EGGrapheTreeModel) _graphe.getModel()), // EbliResource.EBLI.getToolIcon("arbre"), "Courbes", false); - - //POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// - JTree yoda = new JTree((EGGrapheTreeModel) _graphe.getModel()); - yoda.setSelectionModel(((EGGrapheTreeModel) _graphe.getModel()).getSelectionModel()); - panelTreeModifiable_ = new JScrollPane(yoda); - if (this.toggleTree_ != null) - this.toggleTree_.setText("Courbes"); + + // POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// + // utiliser EGTree + EGTree tree = new EGTree(); + tree.setExpandsSelectedPaths(true); + tree.setActions(new EGSpecificActions(_graphe)); + EGGrapheTreeModel treeModel = (EGGrapheTreeModel) _graphe.getModel(); + tree.setModel(treeModel); + tree.setSelectionModel(treeModel.getSelectionModel()); + panelTreeModifiable_ = new JScrollPane(tree); + if (this.toggleTree_ != null) this.toggleTree_.setText("Courbes"); // panelTreeModifiable_ = new JScrollPane(component); conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); // mise a jour du panel conteneurTree_.validate(); panelTreeModifiable_.revalidate(); - + } - + /** * Met a jour le tree a droite si ni un graphe ni un calque n est selectionn\xE9. */ @@ -543,28 +497,26 @@ // EbliResource.EBLI // .getToolIcon("arbre"), "Composants", false); - panelTreeModifiable_ = new JScrollPane(controller_.createTree()); - if (this.toggleTree_ != null) - this.toggleTree_.setText("Liste des composants"); + panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + if (this.toggleTree_ != null) this.toggleTree_.setText("Liste des composants"); // panelTreeModifiable_ = new JScrollPane(component); conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); // mise a jour du panel conteneurTree_.validate(); panelTreeModifiable_.revalidate(); } - - + /** * Methode qui modifie la toolbar associee au calque selectionne * * @param _calque */ private void changeToolbarCalque(ZEbliCalquesPanel _calque) { - + // nettoyage de la toolbar toolBarModifiable_.removeAll(); menuModifiable_.removeAll(); - + // ajout des tool specifiques du calque List actions = _calque.getController().getActions(); for (Iterator iterator = actions.iterator(); iterator.hasNext();) { @@ -575,29 +527,28 @@ toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); } } - + // ajout des menus specifiques pour le calque JMenu[] specificMenus = _calque.getSpecificMenus(EbliLib.getS("Vue 2D")); for (int i = 0; i < specificMenus.length; i++) { menuModifiable_.add(specificMenus[i]); } - + // mise a jour des params toolBarModifiable_.revalidate(); menuModifiable_.revalidate(); this.setJMenuBar(menuModifiable_); this.revalidate(); - + } - + private void changeToolbarGraphe(EGFillePanel _graphe) { // nettoyage de la toolbar toolBarModifiable_.removeAll(); menuModifiable_.removeAll(); - - + // ajout des toolbar specifiques du calque EbliActionInterface[] specificInterfaces = _graphe.getSpecificActions(); for (int i = 0; i < specificInterfaces.length; i++) { @@ -608,24 +559,24 @@ toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); } } - + // ajout des menus specifiques JMenu menu = new JMenu("Menu graphe"); _graphe.fillSpecificMenu(menu); menuModifiable_.add(menu); - + // mise a jour des params toolBarModifiable_.revalidate(); menuModifiable_.revalidate(); this.setJMenuBar(menuModifiable_); this.revalidate(); } - + private void changeToolbarScene() { // nettoyage de la toolbar toolBarModifiable_.removeAll(); menuModifiable_.removeAll(); - + toolBarModifiable_.add(new EbliWidgetActionConfigure(controller_.getScene())); JMenu menu = new JMenu("Configurer"); menu.add(new EbliWidgetActionConfigure(controller_.getScene())); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -39,6 +39,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -429,7 +430,7 @@ "WIDGETRECALQUE") { public void actionPerformed(ActionEvent _evt) { - TrPostVisuPanel pnVisu =new TrPostVisuPanel(projet_.getImpl(),projet_); + TrPostVisuPanel pnVisu =new TrPostVisuPanel(projet_.getImpl(),projet_,new EbliWidgetCalqueLegende(getScene())); addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); } }); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -15,6 +15,7 @@ import java.beans.PropertyVetoException; import java.io.File; import java.io.IOException; +import java.util.Map; import java.util.Observable; import java.util.Observer; import java.util.Set; @@ -59,12 +60,14 @@ import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.h2d.type.H2dVariableTypeCreated; import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; @@ -468,7 +471,7 @@ final TrPostProjet trPostProjet = new TrPostProjet(projection, impl_); // creation du panel de visualisation du posttraitement - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl_, trPostProjet, projection.getNbFleche() == 0); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(impl_, trPostProjet, projection.getNbFleche() == 0,new BCalqueLegende()); // creation de l internalframe qui contient le panel de visu // final TrPostFille compFille = new TrPostFille(pnVisu); @@ -642,7 +645,7 @@ } protected TrPostVisuPanel buildVisuPanel() { - return new TrPostVisuPanel(impl_, this); + return new TrPostVisuPanel(impl_, this,new EbliWidgetCalqueLegende(filleLayout_.getScene())); } /** @@ -808,12 +811,13 @@ new CtuluTaskOperationGUI(impl_, TrResource.getS("Ouverture vue 2D...")) { public void act() { + filleLayout_ = new TrPostLayoutFille(TrPostProjet.this); final TrPostVisuPanel pnVisu = buildVisuPanel(); // fille_ = new TrPostFille(pnVisu); // --creation de l internalframe layout --// - filleLayout_ = new TrPostLayoutFille(TrPostProjet.this); + // -- ajout du visuPanel au layout --// filleLayout_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java 2008-08-24 22:26:37 UTC (rev 3832) @@ -19,6 +19,7 @@ import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.h2d.resource.H2dResource; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.fudaa.tr.common.TrResource; @@ -127,6 +128,6 @@ } protected TrPostVisuPanel buildVisuPanel() { - return new TrPostVisuPanelRubar(super.impl_, this); + return new TrPostVisuPanelRubar(super.impl_, this,new BCalqueLegende()); } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2008-08-21 20:14:24 UTC (rev 3831) +++ branches/Prepr... [truncated message content] |
From: <had...@us...> - 2008-08-25 18:11:36
|
Revision: 3833 http://fudaa.svn.sourceforge.net/fudaa/?rev=3833&view=rev Author: hadouxad Date: 2008-08-25 18:11:33 +0000 (Mon, 25 Aug 2008) Log Message: ----------- - gestion de plusieurs trpostsource dans trpostprojet - interface graphique de gestion des projets - Action d ajout de source - Action d'enlevement de source - gestion d un activator sepecial multi-source: ie qui gere tous les sources au sein du meme projet trpost Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.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/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostRubarEdgeFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -23,21 +23,22 @@ import javax.swing.border.Border; import javax.swing.event.ListSelectionListener; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ebli.trace.BPlageInterface; +import org.fudaa.ebli.trace.TraceIcon; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuPanel; import com.memoire.bu.BuVerticalLayout; -import org.fudaa.ctulu.CtuluLibString; - -import org.fudaa.ebli.trace.BPlageInterface; -import org.fudaa.ebli.trace.TraceIcon; - /** - * Une palette de couleurs associ\xE9es \xE0 des plages de valeurs. Les valeurs hors plages sont consid\xE9r\xE9es comme "autres". + * Une palette de couleurs associ\xE9es \xE0 des plages de valeurs. Les valeurs hors + * plages sont consid\xE9r\xE9es comme "autres". * - * @version $Id: BPalettePlageLegende.java,v 1.23 2007-05-04 13:49:42 deniger Exp $ - * @author Bertrand Marchand + * @version $Id: BPalettePlageLegende.java,v 1.23 2007-05-04 13:49:42 deniger + * Exp $ + * @author Bertrand Marchand TODO refaire en widget */ public class BPalettePlageLegende extends JPanel implements BPalettePlageListener { 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-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -76,13 +76,13 @@ revalidate(); } - @Override - protected Rectangle calculateClientArea() { - Rectangle res = intern.getPreferredBounds(); - // TODO Auto-generated method stub - return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) - + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); - } + // @Override + // protected Rectangle calculateClientArea() { + // // Rectangle res = intern.getPreferredBounds(); + // // // TODO Auto-generated method stub + // // return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) + // // + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); + // } protected void paintWidget() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -17,7 +17,7 @@ */ public class EbliWidgetCalqueLegende extends EbliWidget { - BCalqueLegendePanel calqueLegende_; + public BCalqueLegendePanel calqueLegende_; ComponentWidget intern_; public EbliWidgetCalqueLegende(EbliScene scene, BCalqueLegendePanel _calqueLegende) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -25,6 +25,7 @@ import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; @@ -37,10 +38,7 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; -import com.memoire.bu.BuBorders; -import com.memoire.bu.BuButton; import com.memoire.bu.BuPanel; -import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; /** @@ -86,7 +84,7 @@ WidgetAction editorAction = new EbliActionEditorOneClick<BuPanel>(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); - _vue.addCqLegende(new EbliWidgetCalqueLegende(_scene)); + _vue.addCqLegende(new BCalqueLegende()); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrSupervisorImplementation.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -17,17 +17,13 @@ import javax.swing.BorderFactory; import javax.swing.JComponent; -import com.memoire.bu.*; -import com.memoire.vfs.VfsFile; - import org.fudaa.ctulu.BuNetworkPreferencesPanel; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluFavoriteFiles; - import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.exec.FudaaExec; +import org.fudaa.fudaa.commun.impl.FudaaLookPreferencesPanel; import org.fudaa.fudaa.commun.impl.FudaaStartupExitPreferencesPanel; -import org.fudaa.fudaa.commun.impl.FudaaLookPreferencesPanel; import org.fudaa.fudaa.tr.common.TrApplicationManager; import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrExplorer; @@ -41,6 +37,19 @@ import org.fudaa.fudaa.tr.telemac.TrTelemacExecPreferencesPanel; import org.fudaa.fudaa.tr.telemac.TrTelemacImplHelper; +import com.memoire.bu.BuBrowserPreferencesPanel; +import com.memoire.bu.BuDynamicMenu; +import com.memoire.bu.BuIcon; +import com.memoire.bu.BuInformationsSoftware; +import com.memoire.bu.BuLanguagePreferencesPanel; +import com.memoire.bu.BuMenu; +import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuSeparator; +import com.memoire.bu.BuToolButton; +import com.memoire.bu.BuUserPreferencesPanel; +import com.memoire.vfs.VfsFile; + /** * @author Fred Deniger * @version $Id: TrSupervisorImplementation.java,v 1.38 2008-01-15 11:38:49 bmarchan Exp $ Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,74 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.Iterator; + +import org.fudaa.ebli.commun.EbliActionSimple; + +import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + +public class TrPostActionChangeSrc extends EbliActionSimple { + /** + * projet en cours contenant les multi projets. + */ + TrPostProjet projet_; + + /** + * Activator multi source permettant de gerer une nouvelle source pour + * trpostProjet + */ + TrPostMultiSourceActivator multiProjectActivator_; + + public TrPostActionChangeSrc(TrPostProjet _projet) { + super("Changer de donn\xE9es", BuResource.BU.getIcon("crystal_valider"), "Changer de donn\xE9es"); + projet_ = _projet; + + // -- creation de l activator multi-source avec le projet param --// + this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); + } + + public void actionPerformed(ActionEvent e) { + + + // -- recuperation de la source a supprimer --// + + // -- cas rien de selectionnee --// + if (projet_.filleProjetctManager_.listProjets_.getSelectedIndex() == -1) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Il faut selectionner le fichier dans la liste avant de cliquer.").activate(); + } else { + + // -- recupeation de la source a enlever --// + TrPostSource src = (TrPostSource) projet_.filleProjetctManager_.listProjets_.getSelectedValue(); + + // -- demande confirmationa l user --// + int confirmation = new BuDialogConfirmation(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "\xCAtes-vous sur de vouloir changer les donn\xE9es par celles \n du fichier " + src.getTitle() + " ?") + .activate(); + + if (confirmation == 0) { + if (projet_.changeSource(src)) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Les donn\xE9es ont \xE9t\xE9 correctement charg\xE9es.").activate(); + } else { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Les donn\xE9es n'ont pas \xE9t\xE9 correctement charg\xE9es.").activate(); + } + + testAfficheMesSimu(); + } + } + + } + + public void testAfficheMesSimu() { + int i = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + FuLog.warning("simul " + (i++) + ": " + src.getTitle()); + } + } +} Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,87 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.io.File; +import java.util.Iterator; + +import org.fudaa.ebli.commun.EbliActionSimple; + +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuFileChooser; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + + +/** + * Gere l'action d'ouvrir un nouveau source et de l integrer au projet + * + * @author Adrien Hadoux + * + */ + +public class TrPostActionOpenSrc extends EbliActionSimple { + + /** + * projet en cours contenant les multi projets. + */ + TrPostProjet projet_; + + + /** + * Activator multi source permettant de gerer une nouvelle source pour + * trpostProjet + */ + TrPostMultiSourceActivator multiProjectActivator_; + + public TrPostActionOpenSrc(TrPostProjet _projet) { + super("Ajouter projet", BuResource.BU.getIcon("crystal_ouvrirprojet"), "Ajouter projet"); + projet_ = _projet; + + // -- creation de l activator multi-source avec le projet param --// + this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); + } + + public void actionPerformed(ActionEvent e) { + + BuFileChooser chooser = new BuFileChooser(/* System.getProperty("user.dir") */); + + int rep = chooser.showOpenDialog(projet_.impl_.getParentComponent()); + + if (rep == BuFileChooser.APPROVE_OPTION) { + + // --chargement du fichier source correspondant et ajout dans le projet + // --// + File fichierAbsolu = chooser.getSelectedFile(); + + // -- verification que le fichier n est pas deja ouvert --// + if (projet_.isSourceExist(fichierAbsolu.getAbsolutePath())) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier source existe d\xE9j\xE0 et ne peut \xEAtre ajout\xE9 au projet.").activate(); + + return; + } + + + // -- tentative de chargement du source dans le multi-projet --// + multiProjectActivator_.active(fichierAbsolu, projet_.impl_); + + + testAfficheMesSimu(); + + + + + } + + } + + public void testAfficheMesSimu() { + int i = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + FuLog.warning("simul " + (i++) + ": " + src.getTitle()); + } + } + + +} Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,85 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.Iterator; + +import org.fudaa.ebli.commun.EbliActionSimple; + +import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuDialogMessage; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + +/** + * Action de suppression d un source du multi-projet. + * + * @author Adrien Hadoux + * + */ + +public class TrPostActionRemoveSrc extends EbliActionSimple { + /** + * projet en cours contenant les multi projets. + */ + TrPostProjet projet_; + + + /** + * Activator multi source permettant de gerer une nouvelle source pour + * trpostProjet + */ + TrPostMultiSourceActivator multiProjectActivator_; + + public TrPostActionRemoveSrc(TrPostProjet _projet) { + super("Enlever projet", BuResource.BU.getIcon("crystal_enlever"), "Enlever projet"); + projet_ = _projet; + + // -- creation de l activator multi-source avec le projet param --// + this.multiProjectActivator_ = new TrPostMultiSourceActivator(_projet); + } + + public void actionPerformed(ActionEvent e) { + + + //-- recuperation de la source a supprimer --// + + // -- cas rien de selectionnee --// + if (projet_.filleProjetctManager_.listProjets_.getSelectedIndex() == -1) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Il faut selectionner le fichier \xE0 retirer de la liste avant de cliquer.").activate(); + } else { + + // -- recupeation de la source a enlever --// + TrPostSource src = (TrPostSource) projet_.filleProjetctManager_.listProjets_.getSelectedValue(); + + + // -- demande confirmationa l user --// + int confirmation = new BuDialogConfirmation( + projet_.impl_.getApp(), + projet_.impl_.getInformationsSoftware(), + "\xCAtes-vous sur de vouloir enlever \n le fichier " + src.getTitle() + "\n du projet?") + .activate(); + + if (confirmation == 0) { + if (projet_.removeSource(src)) { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier a \xE9t\xE9 correctement enlev\xE9 du projet").activate(); + } else { + new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier n'a pas \xE9t\xE9t correctement enlev\xE9 du projet.").activate(); + } + + testAfficheMesSimu(); + } + } + + } + + public void testAfficheMesSimu() { + int i = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + FuLog.warning("simul " + (i++) + ": " + src.getTitle()); + } + } +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -3,6 +3,8 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -13,7 +15,6 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTree; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluUndoRedoInterface; @@ -41,6 +42,7 @@ import org.netbeans.api.visual.model.ObjectSceneListener; import org.netbeans.api.visual.model.ObjectState; +import com.memoire.bu.BuButton; import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuMenuBar; @@ -93,6 +95,8 @@ * bouton qui permet de masquer/afficher le tree */ JButton toggleTree_; + + TrPostProjet projet_; /** * Constructeur de la fenetre. @@ -100,6 +104,8 @@ public TrPostLayoutFille(TrPostProjet _projet) { super(); setTitle(TrResource.getS("vue 2D")); + + projet_ = _projet; // creation de la scene EBLI controller_ = new TrPostLayoutPanelController(new TrPostScene(), _projet); setContentPane(controller_.getPanel()); @@ -174,6 +180,23 @@ pane.add(panelTreeModifiable_); right.add(conteneurTree_, BorderLayout.CENTER); + + // -- ajout du bouton qui permet de g\xE9rer tous les resultats + BuButton boutonGestionMultiSrc = new BuButton("Gestion des projets"); + + boutonGestionMultiSrc.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + // -- affichage de la fenetre de gestion multi projet --// + if (!projet_.filleProjetctManager_.isVisible()) + projet_.impl_.addInternalFrame(projet_.filleProjetctManager_); + + projet_.filleProjetctManager_.setSize(500, 250); + + } + + }); + over.add(boutonGestionMultiSrc, BorderLayout.SOUTH); // --verification qu il n existe pas de composant sur la scene auquel cas, // selection automatique pour modification --// Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -39,7 +39,6 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -430,7 +429,7 @@ "WIDGETRECALQUE") { public void actionPerformed(ActionEvent _evt) { - TrPostVisuPanel pnVisu =new TrPostVisuPanel(projet_.getImpl(),projet_,new EbliWidgetCalqueLegende(getScene())); + TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, null); addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); } }); Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,755 @@ +/* + * @creation 24 mars 2004 + * @modification $Date: 2007-06-20 12:23:39 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ + package org.fudaa.fudaa.tr.post; + + import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JFrame; +import javax.swing.JTextField; + +import org.fudaa.ctulu.CtuluIOOperationSynthese; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.CtuluUIAbstract; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.fileformat.FileFormat; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.ef.EfGridSource; +import org.fudaa.dodico.ef.EfLib; +import org.fudaa.dodico.ef.FileFormatGridVersion; +import org.fudaa.dodico.fichiers.FileFormatSoftware; +import org.fudaa.dodico.h2d.rubar.H2dRubarGridAreteSource; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.reflux.io.CorEleBthFileFormat; +import org.fudaa.dodico.reflux.io.INPFileFormat; +import org.fudaa.dodico.reflux.io.RefluxRefondeSolutionFileFormat; +import org.fudaa.dodico.reflux.io.RefluxRefondeSolutionNewReader; +import org.fudaa.dodico.reflux.io.RefluxRefondeSolutionSequentielResult; +import org.fudaa.dodico.reflux.io.RefluxSolutionSequentielReader; +import org.fudaa.dodico.refonde.io.RefondeINPResult; +import org.fudaa.dodico.refonde.io.RefondeQuickINPReader; +import org.fudaa.dodico.rubar.io.RubarDATFileFormat; +import org.fudaa.dodico.telemac.io.SerafinFileFormat; +import org.fudaa.dodico.telemac.io.SerafinInterface; +import org.fudaa.dodico.telemac.io.TelemacVariableMapper; +import org.fudaa.ebli.commun.BJava3DVersionTest; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.meshviewer.MvResource; +import org.fudaa.fudaa.tr.common.Tr3DFactory; +import org.fudaa.fudaa.tr.common.TrFileFormatManager; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabelMultiLine; +import com.memoire.bu.BuLib; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; + +/** + * + * refonte de TrPostSourceActivator poru gerer plusieurs source au sein du meme + * post. La difference avec le sourceActivator c'est qu'ici on ajoute toutes les + * sources a un meme TrPostProjet afin de gere le multi source au sein du + * trpojet. TODO mettre la construction des sources dans le + * TrPostSourceActivator TODO renommmer cette classe en TrPostProjetActivator + * + * @author Adrien Hadoux + */ +public final class TrPostMultiSourceActivator { + + public TrPostProjet projetCourant_; + + + + public TrPostMultiSourceActivator(TrPostProjet _projet) { + super(); + projetCourant_ = _projet; + + } + + /** + * @param _s la source + * @param _impl l'impl parente + */ + protected static void afficheFrame(final TrPostProjet _p, final TrPostCommonImplementation _impl) { + BuLib.invokeNow(new Runnable() { + + public void run() { + _impl.setProjet(_p); + } + }); + + } + + /** + * @param _f le fichier a ouvrir + * @param _impl l'impl parent + */ + public void activeSerafin(final File _f, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + activeSerafinAction(_f, _impl, _impl.createProgressionInterface(this)); + if (projetCourant_ == null) { + return; + } + if (SerafinFileFormat.is3DGrid(projetCourant_.getSource().getGrid())) { + BuLib.invokeLater(new Runnable() { + + public void run() { + affiche3D(projetCourant_, _impl); + } + + }); + } else { + afficheFrame(projetCourant_, _impl); + } + } + }.start(); + } + + protected static void affiche3D(final TrPostProjet _p, final TrPostCommonImplementation _impl) { + if (!BJava3DVersionTest.isJava3DFound()) { + _impl + .error( + "3D", + TrResource + .getS("Le fichier de r\xE9sultats corresond \xE0 un calcul 3D\n. Or, Java3D n'est pas install\xE9 sur votre poste.\nVous ne pouvez pas visualiser ce fichier de r\xE9sultats.\nVoir le menu 'Aide>Tester Java3D' pour installer Java 3D")); + return; + } + if (_impl.question("3D", TrResource + .getS("Le fichier de r\xE9sultats corresond \xE0 un calcul 3D.\nVoulez-vous ouvrir la vue 3D?"))) { + final JFrame f = new JFrame(); + f.setIconImage(EbliResource.EBLI.getImage("3d")); + Tr3DFactory.afficheFrame(f, _p.getSource(), _p.getSource().getInterpolator().getVect(), _impl, null, null); + } + + } + + public void activeGrid(final File _f, final FileFormatGridVersion _fmt, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + activeGridAction(_f, _fmt, _impl, _impl.createProgressionInterface(this)); + if (projetCourant_ != null) { + afficheFrame(projetCourant_, _impl); + } + } + }.start(); + } + + /** + * Ouvre le fichier en fonction de l'extension. + * + * @param _f le fichier correct + * @param _impl l'impl parent + */ + public void active(final File _f, final TrPostCommonImplementation _impl) { + if (_f == null) { + return; + } + final TrFileFormatManager mng = TrFileFormatManager.INSTANCE; + final String name = _f.getName(); + if (isReflux(name)) { + activeINP(_f, _impl); + return; + } + if (mng.isRubarTPSFile(name)) { + activeRubar(_f, _impl); + return; + } + // mettre serafin en dernier car le test est tres large .... + if (SerafinFileFormat.getInstance().createFileFilter().accept(_f)) { + activeSerafin(_f, _impl); + return; + } + final FileFormat ft = FileFormat.findFileFormat(TrFileFormatManager.getAllGridFormat(), _f); + if (ft == null) { + final String id = _impl.getLauncher().getCurrentPrefHydId(); + if (FileFormatSoftware.REFLUX_IS.name.equals(id)) { + activeINP(_f, _impl); + } else if (FileFormatSoftware.TELEMAC_IS.name.equals(id)) { + activeSerafin(_f, _impl); + } else if (FileFormatSoftware.RUBAR_IS.name.equals(id)) { + activeRubar(_f, _impl); + } + } else { + activeGrid(_f, (FileFormatGridVersion) ft, _impl); + } + } + + private static boolean isReflux(final String _name) { + return INPFileFormat.getInstance().isAccepted(_name) + || RefluxRefondeSolutionFileFormat.getInstance().isAccepted(_name); + } + + public static TrPostSource activeSourceAction(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _prog) { + return activeSourceAction(_f, _impl, _impl.getLauncher().getCurrentPrefHydId(), _prog, null); + } + + public static TrPostSource activeSourceAction(final File _f, final CtuluUI _impl, final String _id, + final ProgressionInterface _prog, final Map _otherData) { + if (_f == null) { + return null; + } + final TrFileFormatManager mng = TrFileFormatManager.INSTANCE; + final String name = _f.getName(); + if (isReflux(name)) { + return activeINPSource(_f, _impl, _prog); + } else if (mng.isRubarTPSFile(name)) { + final TrPostSourceRubar rubar = activeRubarSrcAction(_f, _impl, _prog); + if (rubar == null) { + return null; + } + final TrPostRubarLoader loader = new TrPostRubarLoader(rubar, _f, true); + loader.active(_impl, _prog); + return rubar; + + } + // mettre serafin en dernier car le test est tres large .... + else if (SerafinFileFormat.getInstance().createFileFilter().accept(_f)) { + return activeSerafinSourceAction(_f, _impl, _prog, _otherData); + } + final FileFormat ft = FileFormat.findFileFormat(TrFileFormatManager.getAllGridFormat(), _f); + if (ft != null) { + return activeGridSource(_f, (FileFormatGridVersion) ft, _impl, _prog); + } + final String id = _id; + if (FileFormatSoftware.REFLUX_IS.name.equals(id) || RefluxRefondeSolutionFileFormat.getInstance().isAccepted(_f)) { + return activeINPSource(_f, _impl, _prog); + } else if (FileFormatSoftware.TELEMAC_IS.name.equals(id)) { + return activeSerafinSourceAction(_f, _impl, _prog, _otherData); + } else if (FileFormatSoftware.RUBAR_IS.name.equals(id)) { + final TrPostSourceRubar rubar = activeRubarSrcAction(_f, _impl, _prog); + if (rubar != null) { + final TrPostRubarLoader loader = new TrPostRubarLoader(rubar, _f, true); + loader.active(_impl, _prog); + return rubar; + } + } + return null; + } + + /** + * Ouvir une boite de dialogue pour determiner le fichier inp et le fichier sov. + * + * @param _f le fichier xinp,sov ou inp + * @param _impl l'impl parent + */ + public void activeINP(final File _f, final TrPostCommonImplementation _impl) { + if (RefluxRefondeSolutionSequentielResult.isRefonde(_f)) { + final File inp = getInpFileForRefonde(_f, _impl); + if (inp != null) { + activeINP(inp, _f, _impl); + } + return; + } + final INPChooseFile pn = new INPChooseFile(_f); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_impl.getFrame()))) { + activeINP(pn.getInp(), pn.getsov(), _impl); + } + } + + /** + * @param _f le fichier tps + * @param _impl l'impl parente + */ + public void activeRubar(final File _f, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + final ProgressionInterface prog = _impl.createProgressionInterface(this); + activeRubarAction(_f, _impl, prog); + final TrPostProjetRubar rubar = new TrPostProjetRubar(projetCourant_); + if (rubar == null) { + return; + } + final TrPostRubarLoader loader = new TrPostRubarLoader(rubar, _f, true); + loader.active(_impl, prog); + afficheFrame(rubar, _impl); + + } + }.start(); + } + + /** + * @param _f le fichier inp + * @param _sov le fichier sov + * @param _impl l'impl parente + */ + public void activeINP(final File _f, final File _sov, final TrPostCommonImplementation _impl) { + new CtuluTaskOperationGUI(_impl, CtuluLibString.ESPACE) { + + public void act() { + activeINPAction(_f, _sov, _impl, _impl.createProgressionInterface(this)); + if (projetCourant_ != null) { + afficheFrame(projetCourant_, _impl); + } + } + }.start(); + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public void activeSerafinAction(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _inter) { + final TrPostSource r = activeSerafinSourceAction(_f, _impl, _inter, null); + if (r == null) { + return; + } + + + // ajout de la source au postProjet + this.projetCourant_.ajouterSource(r); + + /* + * final boolean isDataModified = + * projetCourant_.openSrcDataAndIsModified(_impl, _inter); + * r.buildDefaultVarUpdateLists(); if (isDataModified) { + * this.projetCourant_.setProjectModified(); } + */ + return; + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public static TrPostSource activeSerafinSourceAction(final File _f, final CtuluUI _impl, + final ProgressionInterface _inter, final Map _otherData) { + final CtuluIOOperationSynthese s = SerafinFileFormat.getInstance().read(_f, _inter); + if (isFatalError(_impl, s)) { + return null; + } + final SerafinInterface ser = (SerafinInterface) s.getSource(); + if (_otherData != null) { + _otherData.put("IPOBO", ser.getIpoboInitial()); + } + if (_otherData != null) { + _otherData.put("IPARAMS", ser.getIparam()); + } + final EfGridInterface g = ser.getGrid(); + // 3D + if (!SerafinFileFormat.is3DGrid(g)) { + s.getAnalyze().clear(); + g.computeBord(/* ser.getPtsFrontiere(), */_inter, s.getAnalyze()); + g.createIndexRegular(_inter); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(s.getAnalyze()); + } + } + final double[] timeStep = new double[ser.getTimeStepNb()]; + for (int i = timeStep.length - 1; i >= 0; i--) { + timeStep[i] = ser.getTimeStep(i); + } + final Map shortNameVar = new HashMap(); + final H2dVariableType[] variable = new H2dVariableType[ser.getValueNb()]; + final TelemacVariableMapper mapper = new TelemacVariableMapper(); + for (int i = variable.length - 1; i >= 0; i--) { + variable[i] = mapper.getUsedKnownVar(ser.getValueId(i)); + if (variable[i] == null) { + variable[i] = H2dVariableType.createTempVar(ser.getValueId(i), shortNameVar); + } + } + TrPostSourceAbstract r = new TrPostSourceSerafin(_f, ser.getTitre(), g, timeStep, variable, ser.getReadingInfo(), + _impl); + if (SerafinFileFormat.is3DGrid(g)) { + r = TrPostSourceTelemac3D.build((TrPostSourceSerafin) r, timeStep, ser, shortNameVar, _inter, _impl); + } + r.initShortNameMap(shortNameVar); + return r; + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public void activeRubarAction(final File _f, final TrPostCommonImplementation _impl, + final ProgressionInterface _inter) { + final TrPostSourceRubar src = activeRubarSrcAction(_f, _impl, _inter); + if (src == null) { + return; + } + + this.projetCourant_.ajouterSource(src); + + return; + } + + public static void loadData(final CtuluUI _impl, final ProgressionInterface _inter, final TrPostProjet _proj) { + if (_proj != null && _proj.openSrcDataAndIsModified(_impl, _inter)) { + _proj.setProjectModified(); + } + } + + /** + * @param _f le fichier serafin + * @param _impl l'impl parent + * @param _inter la barre de progress + * @return le source post + */ + public static TrPostSourceRubar activeRubarSrcAction(final File _f, final CtuluUI _impl, + final ProgressionInterface _inter) { + // on recherche le fichier contenant le maillage + final File dir = _f.getParentFile(); + final String name = CtuluLibFile.getSansExtension(_f.getName()); + final File maillage = RubarDATFileFormat.getInstance().getFileFor(dir, name); + CtuluIOOperationSynthese s; + H2dRubarGridAreteSource grid; + // fichier DAT existe + if (maillage.exists()) { + s = RubarDATFileFormat.getInstance().readGrid(maillage, _inter); + if (isFatalError(_impl, s)) { + return null; + } + grid = (H2dRubarGridAreteSource) s.getSource(); + } else { + _impl.error(TrResource.getS("Le fichier {0} est requis", maillage.getName())); + return null; + + } + if (grid == null) { + return null; + } + grid.getGrid().computeBord(_inter, s.getAnalyze()); + grid.getGrid().createIndexRegular(_inter); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(s.getAnalyze()); + } + return new TrPostSourceRubar(_f, name, grid, _impl); + } + + /** + * @param _gridFile le fichier inp ou ximp + * @param _sovFile le fichier contenant les solutions + * @param _impl l'impl parent + * @param _inter la barre de progression + * @return le source + */ + public void activeINPAction(final File _gridFile, final File _sovFile, final CtuluUI _impl, + final ProgressionInterface _inter) { + + final TrPostSourceReflux retour = (TrPostSourceReflux) activeINPSource(_gridFile, _sovFile, _impl, _inter); + if (retour == null) { + return; + } + retour.buildDefaultVarUpdateLists(); + + projetCourant_.ajouterSource(retour); + + loadData(_impl, _inter, projetCourant_); + return; + } + + public void activeGridAction(final File _f, final FileFormatGridVersion _ftGrid, + final TrPostCommonImplementation _impl, final ProgressionInterface _inter) { + + final TrPostSource retour = activeGridSource(_f, _ftGrid, _impl, _inter); + if (retour == null) { + return; + } + + this.projetCourant_.ajouterSource(retour); + + loadData(_impl, _inter, projetCourant_); + return; + } + + public static TrPostSource activeINPSource(final File _f, final CtuluUI _impl, final ProgressionInterface _inter) { + if (RefluxRefondeSolutionSequentielResult.isRefonde(_f)) { + final File inp = getInpFileForRefonde(_f, _impl); + if (inp == null) { + return null; + } + return activeINPSource(inp, _f, _impl, _inter); + } + final INPChooseFile pn = new INPChooseFile(_f); + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_impl.getParentComponent()))) { + return activeINPSource(pn.getInp(), pn.getsov(), _impl, _inter); + } + return null; + } + + private static File getInpFileForRefonde(final File _f, final CtuluUI _impl) { + final File inp = CtuluLibFile.changeExtension(_f, "inp"); + if (!CtuluLibFile.exists(inp)) { + _impl.error("Refonde:\n" + TrResource.getS("Le fichier inp est requis pour la lecture des r\xE9sultats.") + + CtuluLibString.LINE_SEP + + TrResource.getS("Vous pouvez le cr\xE9er en utilisant les foncitons d'exportation de Fudaa-Refonde")); + return null; + } + return inp; + } + + public static TrPostSource activeGridSource(final File _f, final FileFormatGridVersion _fmt, final CtuluUI _impl, + final ProgressionInterface _prog) { + final CtuluIOOperationSynthese op = _fmt.readGrid(_f, _prog); + if (isFatalError(_impl, op)) { + return null; + } + final String[] ext = _fmt.getFileFormat().getExtensions(); + File f = _f; + // pour les formats \xE0 fichier multiple, on prend la premiere extension (cor,ele,bth au hasard). + if (ext.length > 1 && !CtuluLibFile.getExtension(f.getName()).toLowerCase().equals(ext[0].toLowerCase())) { + f = CtuluLibFile.changeExtension(f, ext[0]); + } + + final EfGridInterface grid = ((EfGridSource) op.getSource()).getGrid(); + op.getAnalyze().clear(); + grid.computeBord(_prog, op.getAnalyze()); + grid.createIndexRegular(_prog); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(op.getAnalyze()); + } + final EfData[][] data = new EfData[1][1]; + data[0][0] = EfLib.getBathy(grid); + return new TrPostSourceDefault(f, f.getName(), grid, new double[] { 0 }, + new H2dVariableType[] { H2dVariableType.BATHYMETRIE }, data, _impl); + + } + + public static boolean fileExists(final CtuluUI _ui, final File _f) { + if (_f == null || !_f.exists()) { + if (_ui != null) { + _ui.error(CtuluUIAbstract.getDefaultErrorTitle(), getNotFoundErr(_f), false); + } + return false; + } + return true; + } + + public static String getNotFoundErr(final File _f) { + return CtuluLib.getS("Le fichier {0} n'existe pas", _f == null ? "?" : _f.getAbsolutePath()); + } + + /** + * @param _inpOrxinp le fichier inp ou ximp + * @param _sovFile le fichier contenant les solutions + * @param _impl l'impl parent + * @param _inter la barre de progression + * @return le source + */ + public static TrPostSource activeINPSource(final File _inpOrxinp, final File _sovFile, final CtuluUI _impl, + final ProgressionInterface _inter) { + if (_impl == null) { + FuLog.warning("_impl is null"); + } + if (_inter != null) { + _inter.setDesc(MvResource.getS("Lecture maillage")); + } + final File inpFile = _inpOrxinp; + if (!fileExists(_impl, inpFile)) { + return null; + } + EfGridInterface g = null; + FileFormatGridVersion ft = null; + boolean isSeiche = false; + H2dVariableType refondeFirstVar = H2dVariableType.PHASE; + CtuluIOOperationSynthese s = null; + // le cas refonde + if (RefluxRefondeSolutionSequentielResult.isRefonde(_sovFile)) { + s = new RefondeQuickINPReader().read(_inpOrxinp, _inter); + if (isFatalError(_impl, s)) { + return null; + } + final RefondeINPResult res = (RefondeINPResult) s.getSource(); + g = res.getGrid(); + isSeiche = res.isModuleSeiche(); + refondeFirstVar = res.getVariableForFirstCol(); + } else { + if (INPFileFormat.getInstance().createFileFilter().accept(_inpOrxinp)) { + ft = INPFileFormat.getInstance().getLastINPVersionImpl(); + // final INPFileFormat.INPVersion v = (INPFileFormat.INPVersion) + // INPFileFormat.getInstance().getLastVersionImpl(); + } else if (CorEleBthFileFormat.getInstance().createFileFilter().accept(_inpOrxinp)) { + ft = CorEleBthFileFormat.getInstance(); + } else { + ft = (FileFormatGridVersion) FileFormat.findFileFormat(TrFileFormatManager.getAllGridFormat(), _inpOrxinp); + } + s = ft.readGrid(inpFile, _inter); + if (isFatalError(_impl, s)) { + return null; + } + s.getAnalyze().clear(); + g = ((EfGridSource) s.getSource()).getGrid(); + + } + g.computeBord(_inter, s.getAnalyze()); + g.createIndexRegular(_inter); + if (_impl != null) { + _impl.manageAnalyzeAndIsFatal(s.getAnalyze()); + } + final File sovFile = _sovFile; + if (!fileExists(_impl, sovFile)) { + return null; + } + if (_inter != null) { + _inter.setDesc(TrResource.getS("Lecture solutions")); + _inter.setProgression(0); + } + final RefluxRefondeSolutionNewReader r = new RefluxRefondeSolutionNewReader(RefluxRefondeSolutionFileFormat + .getInstance()); + r.setFile(sovFile); + s = r.read(); + if (isFatalError(_impl, s)) { + return null; + } + final RefluxRefondeSolutionSequentielResult sol = (RefluxRefondeSolutionSequentielResult) s.getSource(); + // pour le cas refonde + if (sol.isRefonde()) { + sol.setRefondeSeiche(isSeiche, refondeFirstVar); + } + if (sol.getNbPoint() == 0) { + if (_impl != null) { + _impl.error(TrResource.getS("Le fichier {0} est corrompu", sovFile != null ? sovFile.getAbsolutePath() : "?")); + } + return null; + } + if (sol.getNbPoint() != g.getPtsNb()) { + if (_impl != null) { + _impl.error(TrResource.getS("Le fichier de maillage ne correspond pas au fichier des solutions s\xE9lectionn\xE9")); + } + if (Fu.DEBUG) { + FuLog.debug("FTR: nb point maillage: " + g.getPtsNb() + " sol=" + sol.getNbPoint()); + } + return null; + } + final double[] timeStep = new double[sol.getTimeStepNb()]; + for (int i = timeStep.length - 1; i >= 0; i--) { + timeStep[i] = sol.getTimeStep(i); + } + + // final boolean isSot = RefluxRefondeSolutionFileFormat.isSot(sovFile); + // support temperature + final H2dVariableType[] variable = sol.getVars(); + final int[] placement = sol.getPosition(); + final TrPostSourceReflux res = new TrPostSourceReflux(sovFile, sovFile.getAbsolutePath(), g, timeStep, variable, + placement, new RefluxSolutionSequentielReader(sol, sovFile), _impl); + // findGravitation(inp, res); + return res; + } + + private static boolean isFatalError(final CtuluUI _impl, final CtuluIOOperationSynthese _s) { + if (_s == null) { + return false; + } + if (_impl == null) { + if (_s.containsFatalError()) { + _s.printAnalyze(); + return true; + } + return false; + } + return _impl.manageErrorOperationAndIsFatal(_s); + } + + private static class INPChooseFile extends CtuluDialogPanel { + + private JTextField inpField_; + + private JTextField sovField_; + + private File inp_; + + private File sov_; + + /** + * @param _inpOrSov le fichier inp ou sov + */ + public INPChooseFile(final File _inpOrSov) { + final String fic = CtuluLibFile.getSansExtension(_inpOrSov.getName()); + File inp = new File(_inpOrSov.getParentFile(), CtuluLibFile.getFileName(fic, INPFileFormat.getINPExtension())); + if (!inp.exists()) { + final File cor = CtuluLibFile.changeExtension(_inpOrSov, CorEleBthFileFormat.getInstance().getExtensions()[0]); + if (cor.exists()) { + inp = cor; + } + + } + + final File sov = RefluxRefondeSolutionFileFormat.getInstance().isAccepted(_inpOrSov) ? _inpOrSov : new File( + _inpOrSov.getParentFile(), CtuluLibFile.getFileName(fic, RefluxRefondeSolutionFileFormat.getInstance() + .getExtensions()[0])); + init(inp, sov); + } + + /** + * @param _inp le chemin du fichier inp + * @param _sov le chemin du fichier sov + */ + public INPChooseFile(final File _inp, final File _sov) { + init(_inp, _sov); + } + + private void init(final File _inp, final File _sov) { + addEmptyBorder(10); + final String s = TrResource.getS("Fichier") + CtuluLibString.ESPACE; + setLayout(new BuGridLayout(2, 10, 10, true, false)); + addLabel(CtuluLibString.EMPTY_STRING); + add(new BuLabelMultiLine(TrResource.getS("Choisir le fichier sov et le fichier de maillage correspondant"))); + inpField_ = addLabelFileChooserPanel(MvResource.getS("Fichier de maillage"), _inp, false, false); + sovField_ = addLabelFileChooserPanel(s + RefluxRefondeSolutionFileFormat.getInstance().getExtensions()[0], _sov, + false, false); + } + + /** + * @return le fichier inp choisi + */ + public File getInp() { + return inp_; + } + + /** + * @return le fichier sov + */ + public File getsov() { + return sov_; + } + + public boolean valide() { + inp_ = new File(inpField_.getText()); + sov_ = new File(sovField_.getText()); + if (!inp_.exists() || !sov_.exists()) { + final StringBuffer b = new StringBuffer(); + if (!inp_.exists()) { + b.append(getNotFoundErr(inp_)); + } + if (!sov_.exists()) { + if (b.length() > 0) { + b.append(CtuluLibString.LINE_SEP); + } + b.append(getNotFoundErr(sov_)); + } + setErrorText(b.toString()); + return false; + } + return true; + + } + } + + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -15,7 +15,8 @@ import java.beans.PropertyVetoException; import java.io.File; import java.io.IOException; -import java.util.Map; +import java.util.HashSet; +import java.util.Iterator; import java.util.Observable; import java.util.Observer; import java.util.Set; @@ -67,7 +68,6 @@ import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; @@ -95,6 +95,7 @@ import com.db4o.ext.Db4oException; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuButton; +import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuGlassPaneStop; import com.memoire.bu.BuHorizontalLayout; import com.memoire.bu.BuIcon; @@ -274,6 +275,12 @@ transient TrPostLayoutFille filleLayout_ = new TrPostLayoutFille(this); transient BuInternalFrame frVariables_; + + /** + * internalframe qui gere les multiProjets + */ + public TrPostProjetsManagerFille filleProjetctManager_; + int idx_; @@ -283,8 +290,16 @@ ModifyObserver modifyState_ = new ModifyObserver(); + /** + * Donnees courantes du trpost. + */ transient TrPostSource src_; + /** + * liste des sources pour le multiProjet. + */ + transient Set<TrPostSource> listeSrc_ = new HashSet<TrPostSource>(); + transient TimeContentUpdater timeUpdater_; /** @@ -293,17 +308,162 @@ public TrPostProjet(final TrPostSource _src) { src_ = _src; src_.addVariableListener(new VariableListener()); + + // -- ajout de la source de base dans la liste de sources --// + ajouterSource(_src); + + + // -- creation de la frame de gestion multi projet --// + filleProjetctManager_ = new TrPostProjetsManagerFille(this); + } - + + public TrPostProjet(final TrPostSource _src, final TrPostCommonImplementation _impl) { this(_src); impl_ = _impl; + + } + + /** + * Permet d ajouter une source dans le projet afin de gerer le multi source. + * + * @param _src + */ + public void ajouterSource(TrPostSource _src) { + if (!isSourceExist(_src.getFile().getAbsolutePath())) { + listeSrc_.add(_src); + // -- mise a jour de la jlist graphique --// + if (filleProjetctManager_ != null && filleProjetctManager_.modelList_ != null) + filleProjetctManager_.modelList_.addElement(_src); + + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), + "Le fichier.").activate(); + + } + + } + + /** + * retourne la source dans la liste des sources correspondant au fichier. + * retourne null sinon. + * + * @param _file + * : path absolu du fichier + * @return + */ + public TrPostSource findSource(String _file) { + + for (Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { + TrPostSource src = it.next(); + if (src.getFile().getAbsolutePath().equals(_file)) + return src; + } + + return null; + } + + + + /** + * indique si il existe une source portant le nom du fichier en param. + * + * @param _file + * : path absolu du fichier + * @return + */ + public boolean isSourceExist(String _file) { + if (findSource(_file) == null) + return false; + return true; + } + + +// public boolean changeSource(String _file) { + // + // TrPostSource newSrcCourante = findSource(_file); + // if (newSrcCourante == null) + // return false; + // else { + // src_ = newSrcCourante; + // return true; + // } + // + // } + + /** + * methode qui change la source courante et retourne true si la source existe + * bien, false sinon + * + * @param _file + * : path absolu du fichier + * @return + */ + public boolean changeSource(TrPostSource _src) { + + src_ = _src; + + return true; + } + + // public boolean removeSource(String _file) { + // for (Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { + // + // TrPostSource src = it.next(); + // if (src.getFile().getAbsolutePath().equals(_file)) { + // it.remove(); + // return true; + // } + // + // } + // return false; + // + // } + + /** + * Methode de suppression de la source + * + * @param src + * : TrPostSource, retourne true si la suppression a bien ete + * effectuee. + */ + public boolean removeSource(TrPostSource src){ + if (isSourceExist(src.getFile().getAbsolutePath())) { + listeSrc_.remove(src); + // -- mise a jour de la jlist graphique --// + if (filleProjetctManager_ != null && filleProjetctManager_.modelList_ != null) + filleProjetctManager_.modelList_.removeElement(src); + + return true; + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), + "Impossible de supprimer ce fichier de la liste.") + .activate(); + + return false; + } + } + /** + * Methode qui affiche la frame de gestion des multi projets. + */ + public void showProjectFrame() { + + if (filleProjetctManager_ == null) + filleProjetctManager_ = new TrPostProjetsManagerFille(this); + + filleProjetctManager_.setVisible(true); + } + + private void showError(final CtuluUI _ui, final File _dbFile, final String _err) { String mess = TrResource.getS("Les sauvegardes ne seront pas effectu\xE9es") + CtuluLibString.LINE_SEP @@ -645,7 +805,7 @@ } protected TrPostVisuPanel buildVisuPanel() { - return new TrPostVisuPanel(impl_, this,new EbliWidgetCalqueLegende(filleLayout_.getScene())); + return new TrPostVisuPanel(impl_, this, new BCalqueLegende()); } /** @@ -684,7 +844,7 @@ // // filleLayout_.getScene().refresh(); // filleLayout_.getScene_().refresh(); - + // TODO modifier final BuMenuBar menubar = impl_.getMainMenuBar(); final BuMenu menu = new BuMenu(TrResource.getS("Post"), "POST"); menu.setIcon(null); @@ -708,6 +868,8 @@ TrResource.getS("Les fichiers de r\xE9sultats seront relus")); menu.addMenuItem(TrResource.getS("Rafra\xEEchir automatiquement"), "MAJ_DATA_ALWAYS", ic, TrPostProjet.this) .setToolTipText(TrResource.getS("Les fichiers sont surveill\xE9s p\xE9riodiquement")); + menu.addSeparator(); + menu.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this); } @@ -770,6 +932,8 @@ TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); } else if ("VARIABLES".equals(com)) { activeVarFrame(); + } else if ("EXPORTDATA".equals(com)) { + TrPostVisuPanel.startExport(getImpl(), getSource(), null); } else if ("COMPARE".equals(com)) { compareWith(); } else if ("PROJECT".equals(com)) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java 2008-08-24 22:26:37 UTC (rev 3832) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -12,17 +12,15 @@ import javax.swing.SwingUtilities; -import com.memoire.bu.BuCheckBoxMenuItem; -import com.memoire.bu.BuMenu; - import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.dodico.h2d.resource.H2dResource; import org.fudaa.ebli.calque.BCalqueLegende; - import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuCheckBoxMenuItem; +import com.memoire.bu.BuMenu; + /** * @author Fred Deniger * @version $Id: TrPostProjetRubar.java,v 1.14 2007-02-07 09:56:17 deniger Exp $ @@ -58,7 +56,32 @@ super(_s); } + /** + * Constructeur ajout\xE9 pour construire un postProjetRubar identique au + * postProjet initial et ajouter un source pour gerer la multi simu. + * + * @param projet + */ + public TrPostProjetRubar(final TrPostProjet projet) { + super(projet.src_); + + // -- recuperation de la liste des src --// + this.listeSrc_ = projet.listeSrc_; + + // -- recuperation des autres infos --// + this.filleLayout_ = projet.filleLayout_; + this.frVariables_ = projet.frVariables_; + this.idx_ = projet.idx_; + this.idxFilleG_ = projet.idxFilleG_; + this.impl_ = projet.impl_; + this.modifyState_ = projet.modifyState_; + this.timeUpdater_ = projet.timeUpdater_; + + } + + + /** * @return true si le fond est variable */ public final boolean isFondVariable() { Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2008-08-25 18:11:33 UTC (rev 3833) @@ -0,0 +1,183 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JScrollPane; +import javax.swing.ListCellRenderer; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.fudaa.fudaa.tr.common.TrResource; +import org.jdesktop.swingx.JXList; + +import ... [truncated message content] |
From: <had...@us...> - 2008-08-26 16:06:33
|
Revision: 3839 http://fudaa.svn.sourceforge.net/fudaa/?rev=3839&view=rev Author: hadouxad Date: 2008-08-26 16:06:40 +0000 (Tue, 26 Aug 2008) Log Message: ----------- - Panel de Gestion des projets utilisant un jxtable et model associ?\195?\169 - Panel de chooser des projet pour la fonction de creation du calque: on choisit dans la liste le jeux de donn?\195?\169es a utiliser - Implementation du design pattern observer observable pour les modifs de la liste des src. - Mise en place des modifs auto en cas de suppression ou ajout de jeux de donn?\195?\169es. - Creation de l action TrPostActionChooseAndCreateCalque qui permet de choisir le jeux de donn?\195?\169es et de cr?\195?\169er le widget correspondant. Fonctionne OK - Modif de TRPOSTVISUPANEL: il prend en parametre l indice de la source utilis?\195?\169e, et utilise l accesseur getSource(int index) pour r?\195?\169cup?\195?\169rer le bon jeu de donn?\195?\169es. - Information du jeux de donn?\195?\169e utilis?\195?\169e: indiqu?\195?\169 en toolTip sur la widget - Menu 'Info' suppl?\195?\169mentaire ajout?\195?\169 a la widget pour indiquer entre autre le jeux de donn?\195?\169es utilis?\195?\169es. - Creation des menus sp?\195?\169cifiques pour chaque simulation: - chaque simulation a son onglet de menu qui porte le nom du fichier - les evenements sont numerotes dans le meme ordre que le rangement des simulations - Refonte de la fonction "ouvrir" qui ouvre un source dans le multi-source dans le projet. Un truc sympa car il fallait tenir compte des plusieurs simul et de la possibilite d en supprimer: - refonte des evenements liees au multi-sources: - on gere une liste de menu qui representent chacun une simulation - pour retrouver l evenement du bon menu enclench?\195?\169, on parcours la liste et onv?\195?\169rifie 2 choses: le menuitem est le bon et l'event est bon. Au final la complexit?\195?\169 de l algo: lin?\195?\169aire (* par constante ?\195?\169gale au nombre de sous menus de post donc n?\195?\169gligeable...) Refonte des fonctions li?\195?\169es au post pour gere le multi osurce: - Export data OK. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/Tr.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuDialogChoice.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -123,6 +123,10 @@ public String getValue() { return valeur_; } + public int getSelectedIndex() { + return chValeur_.getSelectedIndex(); + } + public void setValue(String _value) { chValeur_.setSelectedItem(_value); 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-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -11,6 +11,7 @@ import javax.swing.JDialog; import javax.swing.JMenuItem; +import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluLibString; @@ -28,6 +29,8 @@ import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuResource; + /** * Widget version EBLI * @@ -43,6 +46,17 @@ */ public Map propGraphique; + private String description_; + + public String getDescription_() { + return description_; + } + + public void setDescription_(String description_) { + this.description_ = description_; + setToolTipText(description_); + } + /** * Liste des clef utilisees pour les composants graphiques */ @@ -205,6 +219,8 @@ // menu clic droit basique (fermeture, duplication) setMenu(); + + } /** @@ -214,12 +230,23 @@ */ public void constructPopupMenuBase(JPopupMenu _popup) { - JMenuItem menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); + JMenuItem menuItem3 = _popup.add("Informations"); + menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); menuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); + } + + }); + + menuItem3 = _popup.add("Masquer l'objet"); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + EbliWidget.this.setVisible(false); } @@ -227,7 +254,7 @@ }); JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); - menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal22_cascade")); + menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); menuItem1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/Tr.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/Tr.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/Tr.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -7,6 +7,7 @@ */ package org.fudaa.fudaa.tr; + /** * Classe de lancement de l'application Tr. Contient la methode main. * @@ -21,5 +22,26 @@ TrLauncherDefault.init(); TrLauncherDefault.launch(_args, null, new TrSupervisorImplementation()); + // EbliNodeDefault srcCourant=new EbliNodeDefault(); + // srcCourant.setTitle("moumoune"); + // + // EbliNodeDefault newCourant = new EbliNodeDefault(); + // srcCourant.setTitle("marmitte"); + // + // EbliNodeDefault pnVisu = new EbliNodeDefault(); + // pnVisu.setTitle("pnVisu"); + // + // // on donne la ref de srcCourant a pnVisu + // pnVisu = srcCourant; + // + // // on test pnVisu + // FuLog.warning("test pnVisu= " + pnVisu.getTitle()); + // + // // on donne la ref de newCourant a srcCourant + // srcCourant = newCourant; + // + // // on verif que pnVisu a pas change + // FuLog.warning("test pnVisu= " + pnVisu.getTitle()); + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSrc.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -36,13 +36,13 @@ // -- recuperation de la source a supprimer --// // -- cas rien de selectionnee --// - if (projet_.filleProjetctManager_.listProjets_.getSelectedIndex() == -1) { + if (projet_.filleProjetctManager_.listProjets_.getSelectedRow() == -1) { new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), "Il faut selectionner le fichier dans la liste avant de cliquer.").activate(); } else { // -- recupeation de la source a enlever --// - TrPostSource src = (TrPostSource) projet_.filleProjetctManager_.listProjets_.getSelectedValue(); + TrPostSource src = (TrPostSource) projet_.getSource(projet_.filleProjetctManager_.listProjets_.getSelectedRow()); // -- demande confirmationa l user --// int confirmation = new BuDialogConfirmation(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -0,0 +1,102 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.Iterator; + +import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; + +import com.memoire.bu.BuDialogChoice; +import com.memoire.bu.BuDialogError; +import com.memoire.bu.BuResource; + +/** + * Action qui permet de cr\xE9er un widget calque en choisissant un jeu de donn\xE9es. + * Le jeux de donn\xE9es est donn\xE9 par le chooser. Il est choisi par l utilisateur. + * Le calque correspondant est alors cr\xE9\xE9. + * + * @author Adrien Hadoux + * + */ +public class TrPostActionChooseAndCreateCalque extends EbliActionSimple { + + TrPostProjet projet_; + + /** + * Chooser associ\xE9 au projet. + */ + public TrPostProjetChooser filleProjetctChooser_; + + public TrPostActionChooseAndCreateCalque(TrPostProjet _projet) { + super(EbliResource.EBLI.getString("Calque principal"), BuResource.BU.getToolIcon("crystal_graphe"), + "WIDGETRECALQUE"); + + projet_ = _projet; + + + + } + + /** + * Methode qui formatte les donnees de la liste. + * + * @return + */ + String[] formattageDonnees() { + + String[] listeSimul = new String[projet_.listeSrc_.size()]; + int cpt = 0; + for (Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + + TrPostSource src = it.next(); + + + // --ajout dans la liste des titres --// + listeSimul[cpt++] = projet_.formatInfoSource(src); + } + + return listeSimul; + } + + public void actionPerformed(ActionEvent _evt) { + + // -- recuperation de la liste des src sous forme de liste --// + String[] values = formattageDonnees(); + + // -- ouverture du chooser --// + BuDialogChoice chooser = new BuDialogChoice(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier a \xE9t\xE9 correctement enlev\xE9 du projet", "S\xE9lectionnez le jeux de donn\xE9es ", values); + + int response = chooser.activate(); + + if (response == 0) { + + int indiceSOURCESelect = chooser.getSelectedIndex(); + + if (indiceSOURCESelect >= projet_.listeSrc_.size()) { + new BuDialogError(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "La source s\xE9lecionn\xE9e n'existe pas.").activate(); + return; + } + + + + + // -- TRES IMPORTANT: on cree le calque en precisant l indice de la SOURCE + // SELECTIONNEE --// + TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, new BCalqueLegende(), indiceSOURCESelect); + EbliNode node = projet_.filleLayout_.controller_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu + .getPreferredSize(), + pnVisu); + + + // -- ajout de l INFO de la source utilis\xE9e --// + node.getCreator().getWidget().setDescription_("Source: " + values[indiceSOURCESelect]); + + + } + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionOpenSrc.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -66,6 +66,9 @@ multiProjectActivator_.active(fichierAbsolu, projet_.impl_); + // -- notify aux observers --// + projet_.notifyObservers(); + testAfficheMesSimu(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionRemoveSrc.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -6,6 +6,7 @@ import org.fudaa.ebli.commun.EbliActionSimple; import com.memoire.bu.BuDialogConfirmation; +import com.memoire.bu.BuDialogError; import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; @@ -44,13 +45,20 @@ //-- recuperation de la source a supprimer --// // -- cas rien de selectionnee --// - if (projet_.filleProjetctManager_.listProjets_.getSelectedIndex() == -1) { - new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + if (projet_.listeSrc_.size() <= 1) { + new BuDialogError(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Ce fichier ne peut \xEAtre supprim\xE9.\n Il faut garder au moins un fichier de donn\xE9es.").activate(); + return; + } + + if (projet_.filleProjetctManager_.listProjets_.getSelectedRow() == -1) { + new BuDialogError(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), "Il faut selectionner le fichier \xE0 retirer de la liste avant de cliquer.").activate(); } else { // -- recupeation de la source a enlever --// - TrPostSource src = (TrPostSource) projet_.filleProjetctManager_.listProjets_.getSelectedValue(); + TrPostSource src = (TrPostSource) projet_.listeSrc_.get(projet_.filleProjetctManager_.listProjets_ + .getSelectedRow()); // -- demande confirmationa l user --// @@ -64,9 +72,13 @@ if (projet_.removeSource(src)) { new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), "Le fichier a \xE9t\xE9 correctement enlev\xE9 du projet").activate(); + + // -- notify aux observers --// + projet_.notifyObservers(); + } else { - new BuDialogMessage(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - "Le fichier n'a pas \xE9t\xE9t correctement enlev\xE9 du projet.").activate(); + new BuDialogError(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), + "Le fichier n'a pas \xE9t\xE9 correctement enlev\xE9 du projet.").activate(); } testAfficheMesSimu(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -13,18 +13,17 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; -import com.memoire.bu.BuLib; -import com.memoire.bu.BuMenu; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuMenu; + /** * @author Fred Deniger * @version $Id: TrPostCommonImplementation.java,v 1.24 2007-05-04 14:01:51 deniger Exp $ @@ -115,6 +114,12 @@ public void actionPerformed(final ActionEvent _evt) { final String com = _evt.getActionCommand(); + + if ("OUVRIR".equals(com)) { + // -- ouverture d un multi source --// + new TrPostActionOpenSrc(c_).actionPerformed(_evt); + } else + if ("FERMER".equals(com)) { new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -191,7 +191,7 @@ if (!projet_.filleProjetctManager_.isVisible()) projet_.impl_.addInternalFrame(projet_.filleProjetctManager_); - projet_.filleProjetctManager_.setSize(500, 250); + // projet_.filleProjetctManager_.setSize(500, 250); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -54,9 +54,14 @@ import com.memoire.bu.BuDesktop; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPanel; -import com.memoire.bu.BuResource; import com.memoire.bu.BuSeparator; +/** + * Controller des actions pour les ebliWidget. + * + * @author genesis + * + */ public class TrPostLayoutPanelController { @@ -424,15 +429,7 @@ // -- ajout d'une action specifique de recreation du calque en cas de // suppression --// - init.add(new EbliActionSimple(EbliResource.EBLI.getString("Calque principal"), BuResource.BU - .getToolIcon("crystal_graphe"), - "WIDGETRECALQUE") { - public void actionPerformed(ActionEvent _evt) { - - TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, null); - addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); - } - }); + init.add(new TrPostActionChooseAndCreateCalque(projet_)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinMaxTableModel.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -26,20 +26,18 @@ import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellEditor; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuScrollPane; -import com.memoire.bu.BuTextArea; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; - import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.fudaa.tr.common.TrCommonImplementation; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuTextArea; + /** * @author Fred Deniger * @version $Id: TrPostMinMaxTableModel.java,v 1.14 2007-03-30 15:39:29 deniger Exp $ @@ -264,9 +262,12 @@ boolean apply_; protected void apply(final ProgressionInterface _inter, final TrCommonImplementation _impl) { + + if (apply_) { return; } + apply_ = true; _impl.setMainMessage(TrResource.getS("Calcul des extrema")); final TIntArrayList list = new TIntArrayList(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -15,8 +15,9 @@ import java.beans.PropertyVetoException; import java.io.File; import java.io.IOException; -import java.util.HashSet; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Observable; import java.util.Observer; import java.util.Set; @@ -67,6 +68,7 @@ import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; @@ -105,6 +107,7 @@ import com.memoire.bu.BuLib; import com.memoire.bu.BuMenu; import com.memoire.bu.BuMenuBar; +import com.memoire.bu.BuMenuItem; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; import com.memoire.bu.BuScrollPane; @@ -283,7 +286,48 @@ */ public TrPostProjetsManagerFille filleProjetctManager_; + /** + * Le menu du post qui contient tout les sous menus des projets + */ + BuMenu menuPost_; + List<BuMenu> listeMenuProjets_; + + List<ArrayList<BuMenuItem>> listeSousMenuProjets_; + + /** + * Observable custom reserv\xE9 aux modifs apport\xE9es a la liste des src. + * + * @author Adrien Hadoux + * + */ + class observableSupport extends Observable { + public void notifyObservers() { + this.setChanged(); + super.notifyObservers(); + } + public void notifyObservers(Object arg) { + this.setChanged(); + super.notifyObservers(arg); + } + + } + + private observableSupport observable; + + public observableSupport getObservable() { + if (observable == null) + observable = new observableSupport(); + return observable; + } + + public void notifyObservers() { + // getObservable().setChanged(); + getObservable().notifyObservers(); + + } + + int idx_; transient int idxFilleG_; @@ -300,7 +344,7 @@ /** * liste des sources pour le multiProjet. */ - transient Set<TrPostSource> listeSrc_ = new HashSet<TrPostSource>(); + transient ArrayList<TrPostSource> listeSrc_ = new ArrayList<TrPostSource>(); transient TimeContentUpdater timeUpdater_; @@ -317,6 +361,7 @@ // -- creation de la frame de gestion multi projet --// filleProjetctManager_ = new TrPostProjetsManagerFille(this); + } @@ -326,20 +371,23 @@ impl_ = _impl; } - + /** * Permet d ajouter une source dans le projet afin de gerer le multi source. + * On doit toujorus passer par cette methode pour ajouter une source. * * @param _src */ public void ajouterSource(TrPostSource _src) { if (!isSourceExist(_src.getFile().getAbsolutePath())) { listeSrc_.add(_src); + + + + // -- ajout du menu correspondant uniquement a partir de la 2eme --// + if (listeSrc_.size() > 1) + construitMenuPostSpecifiqueSource(_src); - // -- mise a jour de la jlist graphique --// - if (filleProjetctManager_ != null && filleProjetctManager_.modelList_ != null) - filleProjetctManager_.modelList_.addElement(_src); - } else { // -- messqge d erreur: le fichier est deja ouvert --// new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), @@ -385,18 +433,6 @@ } -// public boolean changeSource(String _file) { - // - // TrPostSource newSrcCourante = findSource(_file); - // if (newSrcCourante == null) - // return false; - // else { - // src_ = newSrcCourante; - // return true; - // } - // - // } - /** * methode qui change la source courante et retourne true si la source existe * bien, false sinon @@ -412,19 +448,6 @@ return true; } - // public boolean removeSource(String _file) { - // for (Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { - // - // TrPostSource src = it.next(); - // if (src.getFile().getAbsolutePath().equals(_file)) { - // it.remove(); - // return true; - // } - // - // } - // return false; - // - // } /** * Methode de suppression de la source @@ -438,9 +461,7 @@ if (isSourceExist(src.getFile().getAbsolutePath())) { listeSrc_.remove(src); - // -- mise a jour de la jlist graphique --// - if (filleProjetctManager_ != null && filleProjetctManager_.modelList_ != null) - filleProjetctManager_.modelList_.removeElement(src); + return true; } else { @@ -453,19 +474,147 @@ } } + + /** + * methode qui formatte les infos de la source + * + * @param _src + * @return + */ + public String formatInfoSource(TrPostSource _src) { + // --ajout dans la liste des titres --// + return formatName(_src.getTitle()) + " | Fichier: " + formatFichier(_src.getFile()); + } + + public String formatFichier(File file) { + String nomFichier = file.getAbsolutePath(); + int position = nomFichier.lastIndexOf(File.separator) + 1; + if (position != -1) { + nomFichier = nomFichier.substring(position); + } + position = nomFichier.lastIndexOf(CtuluLibString.DOT); + if (position != -1) { + nomFichier = nomFichier.substring(0, position); + } + FuLog.warning("nom du fichier: " + nomFichier); + return nomFichier; + } /** - * Methode qui affiche la frame de gestion des multi projets. + * formatte le titre + * + * @param file + * @return */ - public void showProjectFrame() { + public String formatName(String title) { + // --suppression des trop long espaces du titre --// + + title = title.replaceAll(" ", ""); - if (filleProjetctManager_ == null) - filleProjetctManager_ = new TrPostProjetsManagerFille(this); + return title; + } + + /** + * Construit un menu specifique a la source choisie. A chaque fois que l on + * ajoute une source au projet, il faut ajouter un menu sp\xE9cifique. + * + * @param _src + */ + public void construitMenuPostSpecifiqueSource(TrPostSource _src){ + + BuMenu menuSimul = new BuMenu((listeSrc_.size()) + ". " + formatFichier(_src.getFile()), "SIMULATION" + + (listeSrc_.size())); + + // -- ajout du menu au menu post --// + menuPost_.add(menuSimul); - filleProjetctManager_.setVisible(true); + // -- sauvegarde d une trace du menu dans la liste pour une suppression + // ulterieure --// + listeMenuProjets_.add(menuSimul); + + ArrayList<BuMenuItem> listSousMenus = new ArrayList<BuMenuItem>(); + + final BuIcon ic = BuResource.BU.getIcon("aucun"); + + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), "COMPUTE_EXTREMA", ic, TrPostProjet.this)); + listSousMenus.add(menuSimul.addMenuItem(CtuluLib.getS("Editer les variables..."), "VARIABLES", ic, TrPostProjet.this)); + menuSimul.addSeparator(); + listSousMenus.add( menuSimul.addMenuItem(TrResource.getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, TrPostProjet.this)); + listSousMenus.add( menuSimul.addMenuItem(TrResource.getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", ic, + TrPostProjet.this)); + + menuSimul.addSeparator(); + listSousMenus.add( menuSimul.addMenuItem(TrResource.getS("Comparer..."), "COMPARE", ic, TrPostProjet.this)); + listSousMenus.get(listSousMenus.size()-1).setToolTipText(TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Projeter..."), "PROJECT", ic, TrPostProjet.this)); + listSousMenus.get(listSousMenus.size()-1).setToolTipText(TrResource.getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); + if (src_ != null && src_.isInspectable()) { + menuSimul.addSeparator(); + listSousMenus.add( menuSimul.addMenuItem(TrResource.getS("Rafra\xEEchir les r\xE9sultats"), "MAJ_DATA", ic, TrPostProjet.this)); + listSousMenus.get(listSousMenus.size()-1).setToolTipText(TrResource.getS("Les fichiers de r\xE9sultats seront relus")); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Rafra\xEEchir automatiquement"), "MAJ_DATA_ALWAYS", ic, TrPostProjet.this)); + listSousMenus.get(listSousMenus.size()-1).setToolTipText(TrResource.getS("Les fichiers sont surveill\xE9s p\xE9riodiquement")); + menuSimul.addSeparator(); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this)); + + // -- ajout de la sous liste de menus pour la garder en memoire --// + listeSousMenuProjets_.add(listSousMenus); + +} } + /** + * Creation par defaut du menu post de l interface. Cette methdoe est appelee + * une seule dfois au moment de la creation de l impl. + */ + public void setMenuPost() { + final BuMenuBar menubar = impl_.getMainMenuBar(); + + + menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); + menuPost_.setIcon(null); + menuPost_.setName("mnPost"); + + addSpecificItemInMainMenu(menuPost_); + menubar.add(menuPost_, 2); + + + //-- ajout de l action de gestion des simus dans post --// + BuMenuItem item=new BuMenuItem("Gestion Multi-projets"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // -- affichage de la fenetre de gestion multi projet --// + if (!filleProjetctManager_.isVisible()) + impl_.addInternalFrame(filleProjetctManager_); + + // projet_.filleProjetctManager_.setSize(500, 250); + + } + + }); + + menuPost_.add(item); + menuPost_.addSeparator("Cr\xE9ation calque"); + //-- ajout de l action de creation du calque --// + menuPost_.add(new TrPostActionChooseAndCreateCalque(this)); + menuPost_.addMenuItem(TrResource.getS("Vue 2D"), "VIEW_2D", BuResource.BU.getIcon("aucun"), TrPostProjet.this); + menuPost_.addSeparator("Liste des projets"); + // -- init de la liste des menus --// + listeMenuProjets_ = new ArrayList<BuMenu>(); + + + listeSousMenuProjets_ = new ArrayList<ArrayList<BuMenuItem>>(); + // -- construction par defaut du premier menu de simulation --// + construitMenuPostSpecifiqueSource(getSource(0)); + + + } + + + + + private void showError(final CtuluUI _ui, final File _dbFile, final String _err) { String mess = TrResource.getS("Les sauvegardes ne seront pas effectu\xE9es") + CtuluLibString.LINE_SEP @@ -474,8 +623,13 @@ _ui.warn(FudaaSaveLib.getActionSaveTitle(), mess, false); } - private void showExtremum() { - final JTable table = TrPostMinMaxTableModel.createTableFor(src_); + /** + * calcul les extrema en fonction de la source proposee + * + * @param indiceSource_ + */ + private void showExtremum(int indiceSource_) { + final JTable table = TrPostMinMaxTableModel.createTableFor(getSource(indiceSource_)); final TrPostMinMaxTableModel model = (TrPostMinMaxTableModel) table.getModel(); final CtuluDialogPanel panel = new CtuluDialogPanel(); final CtuluDialog dial = new CtuluDialog(getImpl().getFrame(), panel); @@ -695,34 +849,7 @@ } - // TODO adrien a redefinir - // protected void addFille(final TrPostCourbeTreeModel _model, final String - // _titre, final ProgressionInterface _prog) { - // final EGGraphe graphe = new EGGraphe(_model); - // graphe.setXAxe(buildDefaultTimeAxe()); - // final FudaaGrapheTimeAnimatedVisuPanel pn = new - // FudaaGrapheTimeAnimatedVisuPanel(graphe, TrPostCourbeBuilder - // .getSpecActions(graphe, impl_, (TrPostVisuPanel) fille_.getVisuPanel())); - // graphe.setCmd(new CtuluCommandManager()); - // final TrPostCourbeFille fille = new TrPostCourbeFille(pn, _titre, impl_, - // null); - // fille.setPreferredSize(new Dimension(600, 400)); - // fille.setName("fille" + idxFilleG_++); - // fille.setTitle(_titre + CtuluLibString.ESPACE + - // CtuluLibString.getString(idxFilleG_)); - // fille.setFrameIcon(EbliResource.EBLI.getToolIcon("curves")); - // // pour charger les icones dans un autre thread. - // pn.getSpecificActions(); - // BuLib.invokeLater(new Runnable() { - // - // public void run() { - // fille.pack(); - // //TODO ne plus gerer de fille mais un Node dans la scene - // impl_.addInternalFrame(fille); - // graphe.restore(); - // } - // }); - // } + /** * refonte de addFille qui ajoute des widgets * @@ -814,69 +941,20 @@ * Methode qui parametre la frame layout ainsi que le menu associe. */ protected void decoreFilleVisu() { - // fille_.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); + - // fille_.setClosable(true); - // fille_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - // -- realisation idem pour fillelayout --// filleLayout_.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); - // filleLayout_.setTitle(getTitle()); + filleLayout_.setClosable(true); filleLayout_.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - // -- agrandissement du panel droit --// - // impl_.getMainPanel().getRightColumn().setPreferredSize(new - // Dimension(400,impl_.getMainPanel().getPreferredSize().height)); + // -- creation du menu POST de base --// + setMenuPost(); + + + - // -- ajout de la vue sattelite de la scene --// - // JComponent satt = filleLayout_.getScene().createSatelliteView(); - - // FIXME Adrien: si je decommente ci-dessous, ca plante, je ne comprends - // pas!!!!!!! - // impl_.getMainPanel().getRightColumn().addToggledComponent("Aper\xE7u", - // "SCENEAPERCU", satt, this); - - // filleLayout_.getScene().refresh(); - - // -- ajout du tree de la fille layout dans impl --// - // impl_.getMainPanel().getRightColumn().addToggledComponent("Calques", - // "SCENECALQUES", - // new BuScrollPane(filleLayout_.getTree_()), this); - // - // filleLayout_.getScene().refresh(); - // filleLayout_.getScene_().refresh(); - // TODO modifier - final BuMenuBar menubar = impl_.getMainMenuBar(); - final BuMenu menu = new BuMenu(TrResource.getS("Post"), "POST"); - menu.setIcon(null); - menu.setName("mnPost"); - final BuIcon ic = BuResource.BU.getIcon("aucun"); - menu.addMenuItem(TrResource.getS("Vue 2D"), "VIEW_2D", ic, TrPostProjet.this); - menu.addMenuItem(TrResource.getS("Extrema..."), "COMPUTE_EXTREMA", ic, TrPostProjet.this); - menu.addMenuItem(CtuluLib.getS("Editer les variables..."), "VARIABLES", ic, TrPostProjet.this); - menu.addSeparator(); - menu.addMenuItem(TrResource.getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, TrPostProjet.this); - menu.addMenuItem(TrResource.getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", ic, TrPostProjet.this); - addSpecificItemInMainMenu(menu); - menu.addSeparator(); - menu.addMenuItem(TrResource.getS("Comparer..."), "COMPARE", ic, TrPostProjet.this).setToolTipText( - TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); - menu.addMenuItem(TrResource.getS("Projeter..."), "PROJECT", ic, TrPostProjet.this).setToolTipText( - TrResource.getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); - if (src_ != null && src_.isInspectable()) { - menu.addSeparator(); - menu.addMenuItem(TrResource.getS("Rafra\xEEchir les r\xE9sultats"), "MAJ_DATA", ic, TrPostProjet.this).setToolTipText( - TrResource.getS("Les fichiers de r\xE9sultats seront relus")); - menu.addMenuItem(TrResource.getS("Rafra\xEEchir automatiquement"), "MAJ_DATA_ALWAYS", ic, TrPostProjet.this) - .setToolTipText(TrResource.getS("Les fichiers sont surveill\xE9s p\xE9riodiquement")); - menu.addSeparator(); - menu.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this); - - } - - menubar.add(menu, 2); - } protected Runnable getRunnableForVisu(final Runnable _other) { @@ -922,36 +1000,104 @@ } } + /** + * performed d action pour toutes les simulations charg\xE9es. compl\xE9xit\xE9 de l + * algo: lin\xE9aire Cette methode est robuste en cas de suppression de sources + * et donc de menus. + */ public void actionPerformed(final ActionEvent _event) { - final String com = _event.getActionCommand(); - if ("VIEW_2D".equals(com)) { + final String commandeBrute = _event.getActionCommand(); + + // -- cas de base ou c est la vue 2d + if ("VIEW_2D".equals(commandeBrute) ) { activeFille(); - } else if ("COMPUTE_EXTREMA".equals(com)) { - showExtremum(); - } else if ("PALETTE_DEFAULT".equals(com)) { - updatePaletteMin(); - } else if ("TIME_FORMAT".equals(com)) { - TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); - } else if ("VARIABLES".equals(com)) { - activeVarFrame(); - } else if ("EXPORTDATA".equals(com)) { - TrPostVisuPanel.startExport(getImpl(), getSource(), null); - } else if ("COMPARE".equals(com)) { - compareWith(); - } else if ("PROJECT".equals(com)) { - projectOn(); - } else if ("IMPORTER_RESULTS".equals(com)) { - importerVars(); - } else if ("MAJ_DATA_ALWAYS".equals(com)) { - if (src_.isInspected()) { return; } - new TrPostInspector(this).start(); - } else if ("MAJ_DATA".equals(com)) { - final TrPostInspectorReader watcher = src_.createWatcher(this, false); - if (watcher != null) { - watcher.read(); - watcher.close(); + return; + } + + // -- gestion des actions en fonction de la simul choisie --// + int indiceSimulation = 0; + + for (int i = 0; i < listeSousMenuProjets_.size(); i++) { + + // --recuperation de la liste des sousmenu de la simulation i --// + ArrayList<BuMenuItem> listeSousMenus = listeSousMenuProjets_.get(i); + + indiceSimulation = i; + + // -- on recherche si l action provient d un des fils --// + for (int j = 0; j < listeSousMenus.size(); j++) { + BuMenuItem item = listeSousMenus.get(j); + + //-- on essaie de matcher a la fois la commande et l objet pour savoir si c est le bon --// + // -- si une clause du if est v\xE9rifi\xE9 alors on gere la simulation i --// + if ("COMPUTE_EXTREMA".equals(commandeBrute) && item == _event.getSource()) { + + FuLog.warning("je fais partie de la simulation " + indiceSimulation); + showExtremum(indiceSimulation); + } else if ("PALETTE_DEFAULT".equals(commandeBrute) && item == _event.getSource()) { + updatePaletteMin(); + } else if ("TIME_FORMAT".equals(commandeBrute) && item == _event.getSource()) { + TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); + } else if ("VARIABLES".equals(commandeBrute) && item == _event.getSource()) { + activeVarFrame(); + } else if ("EXPORTDATA".equals(commandeBrute) && item == _event.getSource()) { + TrPostVisuPanel.startExport(getImpl(), getSource(indiceSimulation), null); + } else if ("COMPARE".equals(commandeBrute) && item == _event.getSource()) { + compareWith(); + } else if ("PROJECT".equals(commandeBrute) && item == _event.getSource()) { + projectOn(); + } else if ("IMPORTER_RESULTS".equals(commandeBrute) && item == _event.getSource()) { + importerVars(); + } else if ("MAJ_DATA_ALWAYS".equals(commandeBrute) && item == _event.getSource()) { + if (src_.isInspected()) { return; } + new TrPostInspector(this).start(); + } else if ("MAJ_DATA".equals(commandeBrute) && item == _event.getSource()) { + final TrPostInspectorReader watcher = getSource(indiceSimulation).createWatcher(this, false); + if (watcher != null) { + watcher.read(); + watcher.close(); + } + } + + + } + + } + + +// if ("VIEW_2D".equals(commandeBrute)) { + // activeFille(); + // } else if ("COMPUTE_EXTREMA".equals(commandeBrute)) { + // showExtremum(0); + // } else if ("PALETTE_DEFAULT".equals(commandeBrute)) { + // updatePaletteMin(); + // } else if ("TIME_FORMAT".equals(commandeBrute)) { + // TrPostTimeFmtPanel.updateTimeStepFmt(this, getImpl().getFrame()); + // } else if ("VARIABLES".equals(commandeBrute)) { + // activeVarFrame(); + // } else if ("EXPORTDATA".equals(commandeBrute)) { + // TrPostVisuPanel.startExport(getImpl(), getSource(), null); + // } else if ("COMPARE".equals(commandeBrute)) { + // compareWith(); + // } else if ("PROJECT".equals(commandeBrute)) { + // projectOn(); + // } else if ("IMPORTER_RESULTS".equals(commandeBrute)) { + // importerVars(); + // } else if ("MAJ_DATA_ALWAYS".equals(commandeBrute)) { + // if (src_.isInspected()) { return; } + // new TrPostInspector(this).start(); + // } else if ("MAJ_DATA".equals(commandeBrute)) { + // final TrPostInspectorReader watcher = src_.createWatcher(this, false); + // if (watcher != null) { + // watcher.read(); + // watcher.close(); + // } + // } + + + } public void activate(final File _f) {} @@ -986,8 +1132,10 @@ // -- ajout du visuPanel au layout --// - filleLayout_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), pnVisu); - + EbliNode node = filleLayout_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getCreator().getWidget().setDescription_(formatInfoSource(getSource(0))); // -- decoration de la fille layout --// decoreFilleVisu(); @@ -1157,12 +1305,25 @@ } /** - * @return la source utilisee + * @return la source courante utilisee */ public TrPostSource getSource() { return src_; } + /** + * retourne la source de la liste des sources + * + * @param i + * @return + */ + public TrPostSource getSource(int i) { + if (i < listeSrc_.size()) + return listeSrc_.get(i); + else + return null; + } + public FudaaCourbeTimeListModel getTimeModel() { return getSource().getNewTimeListModel(); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetChooser.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -0,0 +1,176 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.io.File; +import java.util.Observable; +import java.util.Observer; + +import javax.swing.AbstractListModel; +import javax.swing.BorderFactory; +import javax.swing.JList; +import javax.swing.JScrollPane; +import javax.swing.ListCellRenderer; +import javax.swing.ListSelectionModel; +import javax.swing.border.Border; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.fudaa.ctulu.CtuluLibString; +import org.jdesktop.swingx.JXList; + +import com.memoire.bu.BuInternalFrame; +import com.memoire.bu.BuLabel; +import com.memoire.fu.FuLog; + +/** + * chooser qui demande a l user de choisir la simulation a prendre pour la + * selection. + * + * @author Adrien Hadoux + * + */ +public class TrPostProjetChooser extends BuInternalFrame implements ListSelectionListener, Observer { + + /** + * projet contenant la liste des sources. + */ + TrPostProjet projet_; + + /** + * La liste des projet afffichage graphique. + */ + JXList listProjets_; + + + JScrollPane listScroller_; + /** + * Classe Model de la jlist + */ + class ModelProjets extends AbstractListModel implements /* ListModel, */ListCellRenderer { + + TrPostProjet p; + BuLabel labelTexte = new BuLabel(""); + Color background; + Color foreground; + + public ModelProjets(TrPostProjet _p) { + p = _p; + labelTexte.setOpaque(true); + } + + public Object getElementAt(int index) { + + TrPostSource src = (TrPostSource) p.listeSrc_.toArray()[index]; + return src; + } + + public int getSize() { + return p.listeSrc_.size(); + } + + // TODO utiliser CtuluCellTextRenderer + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + Border border = null; + + // -- recuperation du simple nom du fichier --// + String nomFichier = ((TrPostSource) value).getFile().getAbsolutePath(); + int position = nomFichier.lastIndexOf(File.separator) + 1; + if (position != -1) { + nomFichier = nomFichier.substring(position); + } + position = nomFichier.lastIndexOf(CtuluLibString.DOT); + if (position != -1) { + nomFichier = nomFichier.substring(0, position); + } + FuLog.warning("nom du fichier: " + nomFichier); + + // --suppression des trop long espaces du titre --// + String title = ((TrPostSource) value).getTitle(); + title = title.replaceAll(" ", ""); + + // -- on ajoute un indicateur pour le projet selectionn\xE9 --// + if ((TrPostSource) value != projet_.src_) + labelTexte.setText(title + " | Fichier: " + nomFichier); + else { + labelTexte.setText("-> " + title + " | Fichier: " + nomFichier); + // labelTexte.setForeground(Color.YELLOW); + } + + labelTexte.setBackground(list.getBackground()); + labelTexte.setForeground(list.getForeground()); + labelTexte.setOpaque(true); + if (isSelected) { + labelTexte.setBackground(list.getSelectionBackground()); + labelTexte.setForeground(list.getSelectionForeground()); + } + + return labelTexte; + } + + } + + ModelProjets modelList_; + + + + + public TrPostProjetChooser(TrPostProjet _projet) { + super(); + + // -- recuperation du projet --// + projet_ = _projet; + + + // -- ajout comme observer --// + projet_.getObservable().addObserver(this); + + // --creation de la liste graphique des projets --// + modelList_ = new ModelProjets(projet_); + listProjets_ = new JXList(modelList_); + listProjets_.setCellRenderer(modelList_); + + listProjets_.setBorder(BorderFactory.createEtchedBorder()); + + // -- ajoute un selecteur --// + // listProjets_.addListSelectionListener(this); + + // -- oblige la selection unique pour ne pas ajouter qu un seul projet a la + // fois--// + listProjets_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + // -- selectionne par default le src courant --// + listProjets_.setSelectedValue(projet_.src_, true); + + // --creation graphique --// + + + // setSize(500, 250); + // setPreferredSize(new Dimension(500, 250)); + setLayout(new BorderLayout()); + listScroller_ = new JScrollPane(listProjets_); + this.add(listScroller_, BorderLayout.CENTER); + } + + public void valueChanged(ListSelectionEvent e) { + + // -- recuperation de l element selectionn\xE9 --// + FuLog.warning("l'objet selectionne est: " + listProjets_.getSelectedValue()); + + } + + public void update(Observable o, Object arg) { + FuLog.warning("je suis entre dans le update()"); + // mise a jour de la liste + listProjets_.revalidate(); + + } + + + + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -1,24 +1,23 @@ package org.fudaa.fudaa.tr.post; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; +import java.util.Date; +import java.util.Observable; +import java.util.Observer; import javax.swing.BorderFactory; -import javax.swing.DefaultListModel; -import javax.swing.JList; import javax.swing.JScrollPane; -import javax.swing.ListCellRenderer; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import javax.swing.event.TableModelListener; +import javax.swing.table.AbstractTableModel; import org.fudaa.fudaa.tr.common.TrResource; -import org.jdesktop.swingx.JXList; +import org.jdesktop.swingx.JXTable; import com.memoire.bu.BuButton; import com.memoire.bu.BuInternalFrame; -import com.memoire.bu.BuLabel; import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; @@ -29,7 +28,7 @@ * @author Adrien Hadoux * */ -public class TrPostProjetsManagerFille extends BuInternalFrame implements ListSelectionListener { +public class TrPostProjetsManagerFille extends BuInternalFrame implements ListSelectionListener, Observer { /** * projet contenant la liste des sources. @@ -39,7 +38,7 @@ /** * La liste des projet afffichage graphique. */ - JXList listProjets_; + JXTable listProjets_; @@ -48,63 +47,112 @@ /** * Classe Model de la jlist */ - class ModelProjets extends DefaultListModel implements /* ListModel, */ListCellRenderer { + class ModelTableProjets extends AbstractTableModel { TrPostProjet p; - BuLabel labelTexte = new BuLabel(""); - Color background; - Color foreground; + + String[] titres_ = { "N\xB0", "Nom", "Fichier", "Date de derni\xE8re modification", "Statut", "Donn\xE9es Rubar" }; - public ModelProjets(TrPostProjet _p) { + public ModelTableProjets(TrPostProjet _p) { p = _p; - labelTexte.setOpaque(true); + } - - public Object getElementAt(int index) { + + + public void addTableModelListener(TableModelListener l) { + } + + public Class<?> getColumnClass(int columnIndex) { - TrPostSource src = (TrPostSource) p.listeSrc_.toArray()[index]; - return src; + switch (columnIndex) { + case 0: + return Integer.class; + case 1: + return String.class; + case 2: + return String.class; + case 3: + return Date.class; + case 4: + return Boolean.class; + case 5: + return Boolean.class; + } + return null; } - public int getSize() { - return p.listeSrc_.size(); + public int getColumnCount() { + return titres_.length; } - - // TODO utiliser CtuluCellTextRenderer - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, - boolean cellHasFocus) { - - if (isSelected) { - background = Color.BLUE; - foreground = Color.WHITE; + public String getColumnName(int columnIndex) { + return titres_[columnIndex]; + } - } else { - background = Color.WHITE; - foreground = Color.BLUE; + public int getRowCount() { + return p.listeSrc_.size(); + } - } - labelTexte.setBackground(background); - labelTexte.setForeground(foreground); - - // -- on ajoute un indicateur pour le projet selectionn\xE9 --// - if ((TrPostSource) value != projet_.src_) - labelTexte.setText(((TrPostSource) value).getTitle()); - else { - labelTexte.setText("-> " + ((TrPostSource) value).getTitle()); - labelTexte.setForeground(Color.YELLOW); - } + public Object getValueAt(int rowIndex, int columnIndex) { + if (columnIndex >= getColumnCount()) + return null; + TrPostSource src = p.listeSrc_.get(rowIndex); + + + - return labelTexte; + switch (columnIndex) { + case 0: + return rowIndex + 1; + case 1: + return p.formatName(src.getTitle()); + case 2: + return p.formatFichier(src.getFile()); + case 3: + return new Date(src.getFile().lastModified()); + case 4: + return src.isInspectable(); + case 5: + return src.isRubar(); + } + return null; } + + + /** + * Format le nom du fichier + * + * @param file + * @return + */ + + + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return false; + } + + public void removeTableModelListener(TableModelListener l) { + } + + public void setValueAt(Object value, int rowIndex, int columnIndex) { + } + + + + + + // TODO utiliser CtuluCellTextRenderer + + } - ModelProjets modelList_; + ModelTableProjets modelList_; BuButton boutonAjoutSrc_ = new BuButton("Ajouter un projet", BuResource.BU.getIcon("crystal_ouvrirprojet")); BuButton boutonEnleveSrc_ = new BuButton("Enlever un projet", BuResource.BU.getIcon("crystal_enlever")); @@ -119,24 +167,34 @@ projet_ = _projet; - + // -- ajout de la fenetre comme observer du projet --// + projet_.getObservable().addObserver(this); // --creation de la liste graphique des projets --// - modelList_ = new ModelProjets(projet_); - listProjets_ = new JXList(modelList_); - listProjets_.setCellRenderer(modelList_); + modelList_ = new ModelTableProjets(projet_); + + + + listProjets_ = new JXTable(modelList_); + // listProjets_.setCellRenderer(modelList_); + // -- mise en forme des colonnes --// + listProjets_.getColumnModel().getColumn(0).setPreferredWidth(5); + listProjets_.getColumnModel().getColumn(1).setPreferredWidth(250); + listProjets_.getColumnModel().getColumn(2).setPreferredWidth(100); + + listProjets_.setBorder(BorderFactory.createEtchedBorder()); // -- ajoute un selecteur --// - listProjets_.addListSelectionListener(this); + // listProjets_.addListSelectionListener(this); // -- oblige la selection unique pour ne pas ajouter qu un seul projet a la // fois--// listProjets_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // -- selectionne par default le src courant --// - listProjets_.setSelectedValue(projet_.src_, true); + // listProjets_.setSelectedValue(projet_.src_, true); // --creation graphique --// // setSize(500, 250); @@ -157,7 +215,7 @@ this.add(operationPanel, BorderLayout.SOUTH); operationPanel.add(boutonAjoutSrc_); operationPanel.add(boutonEnleveSrc_); - operationPanel.add(boutonChangeSrc_); + // operationPanel.add(boutonChangeSrc_); // -- ajout du listener du bouton d ajout d'un element source this.boutonAjoutSrc_.setAction(new TrPostActionOpenSrc(projet_)); @@ -171,11 +229,23 @@ public void valueChanged(ListSelectionEvent e) { // -- recuperation de l element selectionn\xE9 --// - FuLog.warning("l'objet selectionne est: " + listProjets_.getSelectedValue()); + // FuLog.warning("l'objet selectionne est: " + + // listProjets_.getSelectedValue()); } + + + + public void update(Observable o, Object arg) { + FuLog.warning("je suis entre dans le update()"); + // mise a jour de la liste + modelList_.fireTableStructureChanged(); + + // selection par defaut de la premiere simul + listProjets_.clearSelection(); + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-08-25 20:39:03 UTC (rev 3838) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-08-26 16:06:40 UTC (rev 3839) @@ -24,7 +24,6 @@ import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluLibDialog; import org.fudaa.ctulu.gui.CtuluLibSwing; -import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.animation.ActionAnimationTreeSelection; import org.fudaa.ebli.animation.EbliAnimatedInterface; @@ -44,7 +43,6 @@ import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; @@ -111,23 +109,53 @@ TrPostInfoDelegate info_; final JComponent suiviPanel_; + + /** + * Tres important!!! c'est l'indice de la source utilisee par le + * trpostvisupanel. Il est automatiquement plac\xE9 en param du constructeur. Si + * rien n est mis apr defaut ce sera 0, donc le cas ou il y a une seule simul. + */ + private int indiceSOURCECourant_ = 0; + public int getIndiceSOURCECourant_() { + return indiceSOURCECourant_; + } + public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, BCalqueLegende _leg) { - this(_impl, _controller, false, _leg); + this(_impl, _controller, false, _leg, 0); } + + public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, BCalqueLegende _leg, + int _indiceSOURCECourant) { + this(_impl, _controller, false, _leg, _indiceSOURCECourant); + + + } + public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, boolean _simplified, + BCalqueLegende _leg) { + this(_impl, _controller, _simplified, _leg, 0); + + + } + /** * @param _impl l'impl parent * @param _controller le controller contenant la source + * @param _indiceSOURCECourant : l indice de la source courante utilis\xE9e */ public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, boolean _simplified, - BCalqueLegende _leg) { + BCalqueLegende _leg, int _indiceSOURCECourant) { super(new TrPostActionController(_impl), _impl); + + // -- mise a jour de l indice de ls source courante --// + indiceSOURCECourant_ = _indiceSOURCECourant; + srcCont_ = _controller; - info_ = new TrPostInfo... [truncated message content] |
From: <had...@us...> - 2008-08-27 16:53:45
|
Revision: 3846 http://fudaa.svn.sourceforge.net/fudaa/?rev=3846&view=rev Author: hadouxad Date: 2008-08-27 16:53:48 +0000 (Wed, 27 Aug 2008) Log Message: ----------- reecriture de code - Methode duplicate dans le widgetCreator, prend en param un node - Creation d un EbliWidgetController qui gere les actions et les menus de la widget. Est surcharge pour les calques et graphe car il n utilise pas les memes actions - remplacement dans trpostVisu de l indice par la source courante utilisee pour le multi-source - Creation d une bordure par defaut pour toutes les widgets EbliWidgetBordure widget qui contient une ebliWidget au choix. - prise en compte des actions masquer/supprimer / dupliquer - Creation de controller speciaux: un qui ne gere que les actions -> utilis?\195?\169 par la bordure. un qui ne gere que les bordures -> utilis?\195?\169 par les widget contenus dans la bordure. - la bordure est modifiable en selectionnant la widget et en cliquant sur l icone "configuration" - prise en compte de la bordure pour: - les calques - les graphes - le textLabel - l imageWidget - gestion du undo/redo pour le masquage (g?\195?\169r?\195?\169 pour les 2 cas: depuis le tree et menu widget) - gestion du undo/redo pour la suppression des widgets - Creation des Legende des calques tout en widget !!! - Affichage des legende - Affichage des couleurs - Affichage aussi des tooltips!! - gestion de toutes les fonctionnalit?\195?\169s pour toutes les legendes ( calque et graphe) - creation depuis le calque/graphe - impossible d en cree plus d'une a la fois - action undo redo pour la suppression/masquage - duplication impossible pour ces elements - LES bordures sont aussi g?\195?\169r?\195?\169es ! Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegendePanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/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/EbliWidgetCreatorDblFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.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/EbliWidgetImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.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/EbliWidgetTextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManagerOLD.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.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/TrPostImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java Removed 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/EbliWidgetRectangle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorCalqueLegende.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegende.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -26,11 +26,7 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; -import com.memoire.bu.BuGridLayout; -import com.memoire.bu.BuPanel; - import org.fudaa.ctulu.gui.CtuluHorizontalLayout; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliPreferences; import org.fudaa.ebli.commun.EbliUIProperties; @@ -38,6 +34,9 @@ import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.palette.BPaletteCouleurSimple; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuPanel; + /** * Un calque d'affichage de legendes. * @@ -55,7 +54,7 @@ } private int ancre_; - private Map cqAffPanels_; + protected Map cqAffPanels_; /** * Bloque le rafraichissement en modification d'attribut. */ @@ -659,5 +658,8 @@ default_.setBorderColor(_c); repaint(); } + + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegendePanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegendePanel.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BCalqueLegendePanel.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -16,12 +16,12 @@ import javax.swing.JLabel; import javax.swing.SwingConstants; +import org.fudaa.ebli.commun.EbliPreferences; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuLib; import com.memoire.bu.BuPanel; -import org.fudaa.ebli.commun.EbliPreferences; - /** * @author Fred Deniger * @version $Id: BCalqueLegendePanel.java,v 1.14 2007-06-28 09:26:47 deniger Exp $ @@ -32,6 +32,14 @@ BCalqueAffichage aff_; + public BCalqueAffichage getAff_() { + return aff_; + } + + public void setAff_(BCalqueAffichage aff_) { + this.aff_ = aff_; + } + /** * @return la couleur du bord sauvee */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPalettePlageLegende.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -76,6 +76,14 @@ } BPalettePlageInterface model_; + public BPalettePlageInterface getModel_() { + return model_; + } + + public void setModel_(BPalettePlageInterface model_) { + this.model_ = model_; + } + // Le symbole par d\xE9faut pour les plages private final JLabel lbTitre_ = new JLabel(); private final JPanel pnPlages_ = new JPanel(); @@ -86,6 +94,10 @@ private final JLabel lbSSTitre_ = new JLabel(); final JList listPlages_; + public JList getListPlages_() { + return listPlages_; + } + /** * Cr\xE9ation d'une palette vide. */ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -2,14 +2,8 @@ import java.awt.Dimension; import java.awt.Point; -import java.util.HashMap; import java.util.Map; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; - -import com.sun.org.apache.bcel.internal.generic.GETSTATIC; - public class EbliNodeDefault implements EbliNode { EbliWidgetCreator creator; @@ -25,54 +19,9 @@ * methode qui permet de dupliquer un node */ public EbliNode duplicate(Map options) { - // TODO Auto-generated method stub - EbliNode duplique = new EbliNodeDefault(); + return getCreator().duplicate(this); + } - duplique.setTitle(getTitle()); - // FIXME cree un methode duplicate dans le creator. - // Les params doivent contenir - // ne pas oublier de - // duplicate(Map optionsGraphique) - // -- 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().duplicate())); - } else if (creator instanceof EbliWidgetCreatorVueCalque) { - - Map duplicOptions = new HashMap(); - duplicOptions.put("scene", getCreator().getWidget().getEbliScene()); - duplique.setCreator(new EbliWidgetCreatorVueCalque(((EbliWidgetCreatorVueCalque) getCreator()).getCalque() - .duplicate(duplicOptions), ((EbliWidgetCreatorVueCalque) getCreator()).getCalque().getVueCalque() - .getViewBoite())); - - } else if (creator instanceof EbliWidgetCreatorShape) { - duplique.setCreator(new EbliWidgetCreatorShape(((EbliWidgetCreatorShape) getCreator()).getTypeObject_())); - } else if (creator instanceof EbliWidgetCreatorImage) { - duplique.setCreator(new EbliWidgetCreatorImage(((EbliWidgetCreatorImage) getCreator()).getG())); - } else { - // 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)); - - duplique.setPreferedLocation(nouvellePosition); - // duplique.setPreferedLocation(getPreferedLocation()); - - return duplique; - } - public void setTitle(String title) { this.title = title; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -18,7 +18,6 @@ import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; -import org.netbeans.modules.visual.action.SelectAction; /** * classe de gestion de la scene principale @@ -290,5 +289,8 @@ public void setVisu_(LayerWidget visu_) { this.visu_ = visu_; } + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -2,35 +2,21 @@ 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.HashMap; import java.util.Map; -import javax.swing.JDialog; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; - import org.fudaa.ctulu.CtuluLibString; -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.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; import org.netbeans.api.visual.widget.Widget; -import com.memoire.bu.BuResource; - /** * Widget version EBLI * @@ -46,17 +32,11 @@ */ public Map propGraphique; - private String description_; + + protected EbliWidgetController controller_; - public String getDescription_() { - return description_; - } + - public void setDescription_(String description_) { - this.description_ = description_; - setToolTipText(description_); - } - /** * Liste des clef utilisees pour les composants graphiques */ @@ -180,7 +160,23 @@ public boolean isTitleModifiable() { return true; } + + /** + * Utilise par la plupart des composant sauf calque et graphe qui necessitent + * un controller particulier. + * + * @param scene + * @param controllerDefaut + */ + public EbliWidget(EbliScene scene, boolean controllerDefaut) { + this(scene); + + // -- creation du controller par defaut --// + if (controllerDefaut) + controller_ = new EbliWidgetController(this); + + } /** * @param scene * @param Point : indiaue la location preferentiel. peut etre nul @@ -206,112 +202,22 @@ // -- 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()); - 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 - */ - public void constructPopupMenuBase(JPopupMenu _popup) { - JMenuItem menuItem3 = _popup.add("Informations"); - menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); - menuItem3.addActionListener(new ActionListener() { + + - public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); - } - }); - - menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); - menuItem3.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - EbliWidget.this.setVisible(false); - - } - - }); - - JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); - menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); - menuItem1.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - // -- recuperation du node a dupliquer --// - EbliNode n = (EbliNode) 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); - - // -- ajout dans la scene --// - if (duplique != null && EbliWidget.this.getScene() != null) { - EbliWidget.this.getEbliScene().addNode(duplique); - - // -- 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(); - } - - } - - }); - - JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); - menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem2.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); - EbliWidget.this.getEbliScene().removeNode(n); - - // -- raffraichissement de la scene --// - EbliWidget.this.getEbliScene().refresh(); - - } - - }); - + + + public EbliWidgetController getController_() { + return controller_; } - /** - * 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 void setController_(EbliWidgetController controller_) { + this.controller_ = controller_; } public EbliScene getEbliScene() { @@ -328,60 +234,9 @@ setBorder(getScene().getLookFeel().getBorder(newState)); } - /** - * Methode generique qui fait apparaitre un menuItem propre au composant et offre les op\xE9rations de base on ouvre le - * menu via le clic droit ou le raccourcis shift+F10 - */ + + - public void setMenu() { - getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { - public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu(); - - // -- construction du menu pour les graphismees --// - constructPopupMenuBaseGraphique(popup); - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); - - return popup; - } - })); - } - - /** - * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il n a aucun effet. - * - * @param _popup - */ - public void constructPopupMenuBaseGraphique(JPopupMenu _popup) { - - JMenuItem menuItem4 = _popup.add("Configuration"); - 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); - - } - - }); - } - public void setScene_(EbliScene _scene) { this.scene_ = _scene; } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -0,0 +1,83 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Rectangle; + +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; + +/** + * classe qui genere une bordure pour contenir une widget classique. + * + * @author genesis + * + */ +public class EbliWidgetBordure extends EbliWidget { + + /** + * Widget contenu en intern dans la widget bordure + */ + EbliWidget intern_; + + + public float epaisseurHisto_ = 0; + /** + * constructeur qui gere un controller uniquement pour les actions. + * + * @param scene + */ + public EbliWidgetBordure(EbliWidget _intern) { + super(_intern.getEbliScene(), false); + + intern_ = _intern; + + //-- mise a jour du layout + setLayout(new OverlayLayoutGap(createInset((int) getTraceLigneModel().getEpaisseur()))); + + // -- ajout du child --// + addChild(intern_); + + // --ajout du controller specifique au bordure --// + this.setController_(new EbliWidgetControllerActionOnly(this)); + + } + + + public Insets createInset(int epaisseur) { + + return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); + } + +protected void paintWidget() { + + // -- mise a jour de la fonte que si il y a eu une modification --// + + Graphics2D g = getGraphics(); + + Rectangle rec = getClientArea(); + + if(epaisseurHisto_!=getTraceLigneModel().getEpaisseur()) + setLayout(new OverlayLayoutGap(createInset((int) getTraceLigneModel().getEpaisseur()))); + + + // -- couleur de fond --// + // g.setColor(getColorFond()); + // g.fillRect(0, 0, rec.width, rec.height); + + g.translate(rec.x, rec.y); + // la ligne + + TraceLigne l = new TraceLigne(getTraceLigneModel()); + l.setCouleur(getColorContour()); + + l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l + .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); + + g.translate(-rec.x, -rec.y); + + epaisseurHisto_ = getTraceLigneModel().getEpaisseur(); + + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -0,0 +1,243 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JDialog; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.controle.BConfigurableComposite; +import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; +import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.widget.Widget; + +import com.memoire.bu.BuResource; + +/** + * Classe qui g\xE8re les actions de contr\xF4le de la widget + * + * @author genesis + * + */ +public class EbliWidgetController { + + protected boolean canDuplicate_ = true; + + private String description_; + + protected EbliWidget widget_; + +public EbliWidgetController(EbliWidget widget_) { + + this.widget_ = widget_; + + // creation des actions par defaut + createdefaultAction(); + + // menu intern propre a la widget + setMenu(); + +} + + /** + * methode qui cree les actions par defaut pour la widget. + * + */ + public void createdefaultAction() { + // -- construction des actions --// + widget_.getActions().addAction(widget_.getEbliScene().createSelectAction()); + widget_.getActions().addAction(ActionFactory.createResizeAction()); + widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); + widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); + } + + + + public String getDescription_() { + return description_; + } + public void setDescription_(String description_) { + this.description_ = description_; + widget_.setToolTipText(description_); + } + /** + * Methode de construction des menus de base + * + * @param _popup + */ + public void constructPopupMenuBase(JPopupMenu _popup) { + + // -- reference vers le gestionnaire de commandeundo/redo --// + final CtuluCommandContainer cmd_ = getWidget_().getEbliScene().getCmdMng(); + + JMenuItem menuItem3 = _popup.add("Informations"); + menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); + } + + }); + + menuItem3 = _popup.add("Masquer l'objet"); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + + + // -- si la widget a une bordure c'est la bordure que l on masque --// + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + if (n.getCreator().getBordure() != null) { + n.getCreator().getBordure().setVisible(false); + cmd_.addCmd(new CommandMasquer(n.getCreator().getBordure())); + } else { + widget_.setVisible(false); + cmd_.addCmd(new CommandMasquer(widget_)); + } + + + + } + + }); + if (canDuplicate_) { + JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); + menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); + menuItem1.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + // -- recuperation du node a dupliquer --// + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + + // duplication du node en question + EbliNode duplique = n.duplicate(null); + + // nouvelle position a cote de son predecesseur + // duplique.setPreferedLocation(nouvellePosition); + + // -- ajout dans la scene --// + if (duplique != null && widget_.getScene() != null) { + widget_.getEbliScene().addNode(duplique); + + // -- duplication des map de property graphique de la widget --// + duplique.getCreator().getWidget().propGraphique = n.getCreator().getWidget().duplicateGraphicalProperties(); + // -- duplication de la taille --// + duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); + + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + } + + } + + }); + } + + JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); + menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem2.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + + //-- on enregistre la commande undo redo --// + cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_)); + + //-- on enleve le node de la scene --// + widget_.getEbliScene().removeNode(n); + + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + } + + }); + + } + + /** + * Methode generique qui fait apparaitre un menuItem propre au composant et + * offre les op\xE9rations de base on ouvre le menu via le clic droit ou le + * raccourcis shift+F10 + */ + + public void setMenu() { + widget_.getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu(); + + // -- construction du menu pour les graphismees --// + constructPopupMenuBaseGraphique(popup); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popup); + + return popup; + } + })); + } + + /** + * Attention ce menu ne doit pas apparaitre pour les calques et graphe car il + * n a aucun effet. + * + * @param _popup + */ + public void constructPopupMenuBaseGraphique(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 = widget_; + + 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); + + } + + }); + } + + + +public EbliWidget getWidget_() { + return widget_; +} + +public void setWidget_(EbliWidget widget_) { + this.widget_ = widget_; +}; + + + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -0,0 +1,24 @@ +package org.fudaa.ebli.visuallibrary; + +/** + * Classe qui herite du controller. Gere uniquement les actions. ne gere pas + * menus + * + * @author Adrien Hadoux. + * + */ +public class EbliWidgetControllerActionOnly extends EbliWidgetController { + + public EbliWidgetControllerActionOnly(EbliWidget widget_) { + super(widget_); + } + + /** + * surcharge de la methode menu pour ne pas cree de sous menus. + */ + public void setMenu() { + + // ne rien faire + } + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -0,0 +1,37 @@ +package org.fudaa.ebli.visuallibrary; + +/** + * Classe qui herite du controller. Gere uniquement les menus. Pas d actions + * gerees par ce controlleur. + * + * @author Adrien Hadoux. + * + */ +public class EbliWidgetControllerMenuOnly extends EbliWidgetController { + + public EbliWidgetControllerMenuOnly(EbliWidget widget_) { + super(widget_); + } + + public EbliWidgetControllerMenuOnly(EbliWidget widget_, boolean canDuplicate) { + super(widget_); + + canDuplicate_ = canDuplicate; + } + + + /** + * surcharge de la methode pour ne pas creer d actions. + */ + public void createdefaultAction() { + // -- construction des actions --// + //widget_.getActions().addAction(widget_.getEbliScene().createSelectAction() + // ); + // widget_.getActions().addAction(ActionFactory.createResizeAction()); + // widget_.getActions().addAction(widget_.getEbliScene(). + // createWidgetHoverAction()); + // widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); + + } + +} 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-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -7,7 +7,14 @@ // FIXME a mettre dans le EbliNode EbliWidget getWidget(); -// void widgetCreated(EbliWidget w); - //void nodeRemoved(); - + /** + * Duplication de l ebliNode en fonction de son creator. + * + * @param options + * @return + */ + EbliNode duplicate(EbliNode _nodeAdupliquer); + + EbliWidgetBordure getBordure(); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorDblFleche.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,5 +1,7 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Point; + public class EbliWidgetCreatorDblFleche implements EbliWidgetCreator { @@ -32,5 +34,26 @@ return res; } + + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + + EbliNode duplique = new EbliNodeDefault(); + + duplique.setCreator(new EbliWidgetCreatorDblFleche(getG())); + + duplique.setTitle(_nodeAdupliquer.getTitle()); + // recopie des tailles + duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); + // -- calcul nouvelle position + Point nouvellePosition = new Point(getWidget().getLocation().x, (int) (getWidget().getLocation().y + getWidget() + .getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + + return duplique; + } + + public EbliWidgetBordure getBordure() { + return null; + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorFleche.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,5 +1,7 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Point; + public class EbliWidgetCreatorFleche implements EbliWidgetCreator { int orientation; @@ -31,4 +33,27 @@ return res; } + + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + + EbliNode duplique = new EbliNodeDefault(); + + duplique.setCreator(new EbliWidgetCreatorFleche(orientation)); + + duplique.setTitle(_nodeAdupliquer.getTitle()); + // recopie des tailles + duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); + // -- calcul nouvelle position + Point nouvellePosition = new Point(getWidget().getLocation().x, (int) (getWidget().getLocation().y + getWidget() + .getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + + return duplique; + } + + public EbliWidgetBordure getBordure() { + return null; + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorImage.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,6 +1,7 @@ package org.fudaa.ebli.visuallibrary; import java.awt.Image; +import java.awt.Point; /** * Creator de la widget image. @@ -11,8 +12,10 @@ public class EbliWidgetCreatorImage implements EbliWidgetCreator { Image image_; - EbliWidgetImage res; + // EbliWidgetImage res; + EbliWidgetBordure res; + public EbliWidgetCreatorImage(Image g) { super(); this.image_ = g; @@ -28,7 +31,7 @@ public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetImage(_scene, getG()); + res = new EbliWidgetBordure(new EbliWidgetImage(_scene, getG())); return res; } @@ -38,4 +41,25 @@ return res; } + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + + EbliNode duplique = new EbliNodeDefault(); + + duplique.setCreator(new EbliWidgetCreatorImage(getG())); + + duplique.setTitle(_nodeAdupliquer.getTitle()); + // recopie des tailles + duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); + // -- calcul nouvelle position + Point nouvellePosition = new Point(getWidget().getLocation().x, (int) (getWidget().getLocation().y + getWidget() + .getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + + return duplique; + } + + public EbliWidgetBordure getBordure() { + return res; + } + } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,34 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - - - -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; - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorShape.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,7 +1,8 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Point; + import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; -import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; /** * Creator pour les objets graphiques de type shape. @@ -48,5 +49,29 @@ // TODO Auto-generated method stub return res; } + + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + EbliNode duplique = new EbliNodeDefault(); + + duplique.setCreator(new EbliWidgetCreatorShape(getTypeObject_())); + + duplique.setTitle(_nodeAdupliquer.getTitle()); + // recopie des tailles + duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); + // -- calcul nouvelle position + Point nouvellePosition = new Point(getWidget().getLocation().x, (int) (getWidget().getLocation().y + getWidget() + .getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + + return duplique; + } + + + + public EbliWidgetBordure getBordure() { + return null; + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -38,4 +38,12 @@ return res; } + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + return null; + } + + public EbliWidgetBordure getBordure() { + return null; + } + } Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java (from rev 3832, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangleTexte.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextLabel.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -0,0 +1,59 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Point; + + + +public class EbliWidgetCreatorTextLabel implements EbliWidgetCreator { + + String label_; + // EbliWidgetRectangle res; + EbliWidgetBordure res; + public EbliWidgetCreatorTextLabel(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 EbliWidgetBordure(new EbliWidgetTextLabel(_scene, getG())); + + return res; + } + + public EbliWidget getWidget() { + // TODO Auto-generated method stub + return res; + } + + + public EbliNode duplicate(EbliNode _nodeAdupliquer) { + + EbliNode duplique = new EbliNodeDefault(); + + duplique.setCreator(new EbliWidgetCreatorTextLabel(getG())); + + duplique.setTitle(_nodeAdupliquer.getTitle()); + // recopie des tailles + duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); + // -- calcul nouvelle position + Point nouvellePosition = new Point(getWidget().getLocation().x, (int) (getWidget().getLocation().y + getWidget() + .getClientArea().height)); + duplique.setPreferedLocation(nouvellePosition); + + return duplique; + } + + public EbliWidgetBordure getBordure() { + return res; + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetDBLFleche.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,34 +1,13 @@ package org.fudaa.ebli.visuallibrary; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.GeneralPath; -import java.util.ArrayList; -import org.fudaa.ebli.courbe.EGCourbe; -import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigne; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.ConnectProvider; -import org.netbeans.api.visual.action.TextFieldInplaceEditor; -import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.anchor.AnchorFactory; import org.netbeans.api.visual.anchor.AnchorShape; import org.netbeans.api.visual.anchor.AnchorShapeFactory; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.ConnectionWidget; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.Scene; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; -import org.netbeans.modules.visual.layout.FlowLayout; -import org.netbeans.modules.visual.layout.OverlayLayout; /** * Legende Widget qui permet de construire une fleche double @@ -62,7 +41,7 @@ * @param _scene */ public EbliWidgetDBLFleche(EbliScene _scene, int orientation) { - super(_scene); + super(_scene, true); //-- creation de la fleche --// 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-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -3,37 +3,13 @@ -import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Insets; -import java.awt.Point; -import java.awt.Polygon; import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.GeneralPath; -import java.util.ArrayList; -import org.fudaa.ebli.courbe.EGCourbe; -import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; 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.ConnectProvider; -import org.netbeans.api.visual.action.TextFieldInplaceEditor; -import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.anchor.AnchorFactory; -import org.netbeans.api.visual.anchor.AnchorShape; -import org.netbeans.api.visual.anchor.AnchorShapeFactory; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; -import org.netbeans.api.visual.widget.ConnectionWidget; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.Scene; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; -import org.netbeans.modules.visual.layout.FlowLayout; -import org.netbeans.modules.visual.layout.OverlayLayout; /** * Legende Widget qui permet de construire une fleche @@ -59,7 +35,7 @@ * @param _scene */ public EbliWidgetFleche(EbliScene _scene, int orientation) { - super(_scene); + super(_scene, true); inGaps_ = new Insets(largeurBorder + espaceInterieur, largeurBorder + espaceInterieur, largeurBorder + espaceInterieur, largeurBorder + espaceInterieur); @@ -100,7 +76,7 @@ l.setEpaisseur(largeurBorder); 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)); /*Shape shape; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -10,8 +10,12 @@ Image image; public EbliWidgetImage(EbliScene scene, Image _img) { - super(scene); + super(scene, false); image = _img; + + // -- controller menu seulement, la bordure englobante contient le + // controller action --// + setController_(new EbliWidgetControllerMenuOnly(this)); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -9,7 +9,6 @@ import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigne; -import org.netbeans.api.visual.widget.Scene; /** @@ -26,7 +25,7 @@ * @param _scene */ public EbliWidgetLine(EbliScene _scene, EGCourbe _cb, Point preferedLocation) { - super(_scene); + super(_scene, true); cb_ = _cb; setMinimumSize(new Dimension(30, 10)); setPreferredSize(new Dimension(40, 10)); Deleted: 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-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -1,150 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Rectangle; - -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; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.api.visual.widget.LabelWidget.Alignment; -import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; - -/** - * Legende Widget qui permet de construire des rectangles avec du texte - * - * @author Adrien Hadoux - * TODO a generaliser avec autre chose qu'un LabelWidget - */ -public class EbliWidgetRectangle extends EbliWidget implements - TextFieldInplaceEditor { - - LabelWidget intern; - Insets inGaps_; - int largeurBorder = 15; - int espaceInterieur = 5; - - - public Font fontForme; - - /** - * @param _scene - */ - public EbliWidgetRectangle(EbliScene _scene, String label) { - super(_scene); - inGaps_ = new Insets(largeurBorder + espaceInterieur, largeurBorder - + espaceInterieur, largeurBorder + espaceInterieur, - largeurBorder + espaceInterieur); - // Ce layout permet de placer le texte - - setLayout(new OverlayLayoutGap(inGaps_)); - - intern = new LabelWidget(_scene); - intern.setVerticalAlignment(VerticalAlignment.CENTER); - intern.setAlignment(Alignment.CENTER); - intern.setFont(getFormeFont()); - - intern.setLabel(label); - - //-- layout du texte --// - addChild(intern); - - // -- ajouter l option de remplacer le text dans le label --// - - // -- creation de l action --// - WidgetAction editorAction = ActionFactory - .createInplaceEditorAction(this); - - - - // -- ajout de l action au label correspondant --// - intern.getActions().addAction(editorAction); - - intern.getActions().addAction(ActionFactory.createResizeAction()); - - // setEnabled(false); - } - - public void majLabel(String label) { - // intern.setForeground(); - intern.setLabel(label); - revalidate(); - } - - // @Override - // protected Rectangle calculateClientArea() { - // // Rectangle res = intern.getPreferredBounds(); - // // // TODO Auto-generated method stub - // // return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) - // // + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); - // } - - protected void paintWidget() { - - // -- 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(getColorFond()); - // g.fillRect(0, 0, rec.width, rec.height); - - - g.translate(rec.x, rec.y); - // la ligne - - TraceLigne l = new TraceLigne(getTraceLigneModel()); - l.setCouleur(getColorContour()); - - l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), - (int) (rec.width - l - .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); - - g.translate(-rec.x, -rec.y); - - - - - } - - public String getText(Widget widget) { - - return ((LabelWidget) widget).getLabel(); - } - - public boolean isEnabled(Widget widget) { - // TODO Auto-generated method stub - return true; - } - - public void setText(Widget widget, String text) { - ((LabelWidget) widget).setLabel(text); - revalidate(); - - } - - - - - - - - - - - -} \ 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-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -55,7 +55,7 @@ // } public EbliWidgetShape (EbliScene scene, ShapeCreator _shaper, Map _options) { - super(scene); + super(scene, true); super.setCheckClipping(true); options_ = new HashMap(); if (_options != null) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2008-08-27 07:19:28 UTC (rev 3845) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -25,7 +25,7 @@ BuPanel conteneur = null; public EbliWidgetTextEditor(EbliScene scene, CtuluHtmlEditorPanel content) { - super(scene); + super(scene, true); editorPane_ = content; // widget = new ComponentWidget(scene, editorPane_) { Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java (from rev 3833, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextLabel.java 2008-08-27 16:53:48 UTC (rev 3846) @@ -0,0 +1,130 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Font; +import java.awt.Insets; + +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; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.LabelWidget.Alignment; +import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; + +/** + * Legende Widget qui permet de construire des rectangles avec du texte + * + * @author Adrien Hadoux + * TODO a generaliser avec autre chose qu'un LabelWidget + */ +public class EbliWidgetTextLabel extends EbliWidget implements + TextFieldInplaceEditor { + + LabelWidget intern; + Insets inGaps_; + int largeurBorder = 15; + int espaceInterieur = 5; + + + public Font fontForme; + + /** + * @param _scene + */ + public EbliWidgetTextLabel(EbliScene _scene, String label) { + super(_scene, false); + // inGaps_ = new Insets(largeurBorder + espaceInterieur, largeurBorder + // + espaceInterieur, largeurBorder + espaceInterieur, + // largeurBorder + espaceInterieur); + // Ce layout permet de placer le texte + + // setLayout(new OverlayLayoutGap(inGaps_)); + + intern = new LabelWidget(_scene); + intern.setVerticalAlignment(VerticalAlignment.CENTER); + intern.setAlignment(Alignment.CENTER); + intern.setFont(getFormeFont()); + + intern.setLabel(label); + + //-- layout du texte --// + addChild(intern); + + // -- ajouter l option de remplacer le text dans le label --// + + // -- creation de l action --// + WidgetAction editorAction = ActionFactory + .createInplaceEditorAction(this); + + + + // -- ajout de l action au label correspondant --// + this.getActions().addAction(editorAction); + + // intern.getActions().addAction(ActionFactory.createResizeAction()); + + // setEnabled(false); + + // -- ajout du controller special sans actions, juste le menu --/ + setController_(new EbliWidgetControllerMenuOnly(this)); + } + + public void majLabel(String label) { + // intern.setForeground(); + intern.setLabel(label); + revalidate(); + } + + // @Override + // protected Rectangle calculateClientArea() { + // // Rectangle res = intern.getPreferredBounds(); + // // // TODO Auto-generated method stub + // // return new Rectangle(0, 0, 2 * (largeurBorder + espaceInterieur) + // // + res.width, 2 * (largeurBorder + espaceInterieur) + res.height); + // } + + protected void paintWidget() { + + // -- mise a jour de la fonte que s... [truncated message content] |
From: <had...@us...> - 2008-08-28 17:25:43
|
Revision: 3847 http://fudaa.svn.sourceforge.net/fudaa/?rev=3847&view=rev Author: hadouxad Date: 2008-08-28 17:25:46 +0000 (Thu, 28 Aug 2008) Log Message: ----------- - ajout d'un menu dans le projectmanager pour gerer les ajout/suppression - g?\195?\169rer le cas bordure epaisseur 0 pour masquer la bordure - g?\195?\169rer le undo/redo duplicate - La gestion des duplicate unitaire est g?\195?\169r?\195?\169e (via le menu de la widget) - La gestion des duplicate simultan?\195?\169e est aussi g?\195?\169r?\195?\169e (via le bouton action duplicate et en selectionnant plusieurs widgets) - g?\195?\169rer proprement les tailles par defaut des legendes - Taille correctement calculee par rapport au nb d elements ajoutes - Resize impossible des legendes - tooltip pour les graphes - lors de la modification du libell?\195?\169, reformatte le label pour garder la meme taille et afficher le tout proprement. - les widgets legendes ne sont pas resizes pour les actions de resize min et max Horizontal et vertical. - correction du bug de position de la widget lors du undo/redo sur la suppression - convertisseur de la position de scene a local pour garder la position de la widget - Bordure: gestion intelligente du gapsLayout: - Si on augmente ou diminue la taille de la bordure, cela redimensionne la widget en consequence - synchroniser les graphes/calques avec leur legende: le masquage de l un fait masquer les legendes.... - Si l on masque le calque/graphe, la legende se masque automatiquement - si l on fait un undo sur cetet action, cela fait apparaitre les 2 simultanement - Si l' on d?\195?\169truit une legende, on peut la recreer en cliquant sur le menu 'ajouter legende' depuis le calque/graphe - si l on fait juste r?\195?\169apparaitre le calque/graphe cela ne fait pas reapparaitre la legende (normal) - si l'on fait disparaitre la legende, cela n a aucune incidence sur le calque/graphe - si l on veut creer une legende a partir du graphe/calque (menu popup clic droit): - Ne cree la legende que si il n en existe pas deja - fais apparaitre la legende si celle ci existe mais est cach?\195?\169e. - Gerer un BconfigureInterface specifique a chaque widget - les shape fleche et ellipse benificie de la rotation supplementaire - la widget bordure ne beneficie que des fonction du traceligneModel - synchronisation de l arbre et de la scene - la selection multiple dans la scene realise la meme selection multiple dans l arbre - de meme, la selection multiple dans l arbre realise la selection multiple dans la scene - un systeme de semaphore anti-cycle permet d eviter que les ecouteurs arbre et scene s appelle mutuellement Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetLine.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -58,10 +58,10 @@ return preferedSize; } - public String toString() { - // TODO Auto-generated method stub - return title; - } + // public String toString() { + // // TODO Auto-generated method stub + // return title; + // } public boolean hasWidget() { return (getCreator() != null && getCreator().getWidget() != null); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -53,8 +53,10 @@ * * @return */ - public BConfigurableInterface[] getConfigureInterfaces() { - return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(), EbliLib + public BConfigurableInterface[] getConfigureInterfaces(boolean lineModel_, boolean colorsContours_, + boolean colorFonds_, boolean rotations_, boolean police_) { + return new BConfigurableInterface[] { new BConfigurableComposite(getSingleConfigureInterface(lineModel_, + colorsContours_, colorFonds_, rotations_, police_), EbliLib .getS("Affichage")) /* * , new BConfigurableComposite(getSingleConfigureInterface (), EbliLib.getS("Gizmo caca")) */}; @@ -70,11 +72,12 @@ * * @return */ - private BConfigurableInterface getSingleConfigureInterface() { + private BConfigurableInterface getSingleConfigureInterface(boolean lineModel_, boolean colorsContours_, + boolean colorFonds_, boolean rotations_, boolean police_) { // -- retourne l interface qui va bien qui permet de creer les composants // graphiques correspondant --// - return new WidgetConfigure(this); + return new WidgetConfigure(lineModel_, colorsContours_, colorFonds_, rotations_, police_, this); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -28,6 +28,11 @@ * @param scene */ public EbliWidgetBordure(EbliWidget _intern) { + this(_intern, true, true); + + } + + public EbliWidgetBordure(EbliWidget _intern, boolean canMove, boolean canResize) { super(_intern.getEbliScene(), false); intern_ = _intern; @@ -39,8 +44,7 @@ addChild(intern_); // --ajout du controller specifique au bordure --// - this.setController_(new EbliWidgetControllerActionOnly(this)); - + this.setController_(new EbliWidgetControllerActionOnly(this, canMove, canResize)); } @@ -57,23 +61,26 @@ Rectangle rec = getClientArea(); - if(epaisseurHisto_!=getTraceLigneModel().getEpaisseur()) + if (epaisseurHisto_ != getTraceLigneModel().getEpaisseur()) { setLayout(new OverlayLayoutGap(createInset((int) getTraceLigneModel().getEpaisseur()))); - - + Rectangle newBounds = getBounds(); + newBounds.height += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; + newBounds.width += (getTraceLigneModel().getEpaisseur() - epaisseurHisto_) * 2; + setPreferredBounds(newBounds); + } // -- couleur de fond --// // g.setColor(getColorFond()); // g.fillRect(0, 0, rec.width, rec.height); g.translate(rec.x, rec.y); // la ligne - + TraceLigne l = new TraceLigne(getTraceLigneModel()); + l.setCouleur(getColorContour()); - l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* , rec.width */); - + g.translate(-rec.x, -rec.y); epaisseurHisto_ = getTraceLigneModel().getEpaisseur(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,6 +3,7 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.ArrayList; import javax.swing.JDialog; import javax.swing.JMenuItem; @@ -15,6 +16,8 @@ import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.CommandSupprimer; +import org.fudaa.ebli.visuallibrary.actions.CommandeDuplicate; +import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.widget.Widget; @@ -30,23 +33,51 @@ public class EbliWidgetController { protected boolean canDuplicate_ = true; + public boolean isCanDuplicate_() { + return canDuplicate_; + } + + public boolean isCanMove_() { + return canMove_; + } + + public boolean isCanResize_() { + return canResize_; + } + + protected boolean canMove_ = true; + protected boolean canResize_ = true; private String description_; protected EbliWidget widget_; public EbliWidgetController(EbliWidget widget_) { + this(widget_, true, true, true); + - this.widget_ = widget_; - - // creation des actions par defaut - createdefaultAction(); - - // menu intern propre a la widget +} + + public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize) { + this(widget_, canMove, canResize, true); + } + + public EbliWidgetController(EbliWidget widget_, boolean canMove, boolean canResize, boolean canDuplicate) { + + this.widget_ = widget_; + canDuplicate_ = canDuplicate; + canMove_ = canMove; + canResize_ = canResize; + + + // creation des actions par defaut + createdefaultAction(); + + // menu intern propre a la widget setMenu(); + + } -} - /** * methode qui cree les actions par defaut pour la widget. * @@ -54,9 +85,12 @@ public void createdefaultAction() { // -- construction des actions --// widget_.getActions().addAction(widget_.getEbliScene().createSelectAction()); - widget_.getActions().addAction(ActionFactory.createResizeAction()); + if (canResize_) + widget_.getActions().addAction(ActionFactory.createResizeAction()); + widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); - widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); + if (canMove_) + widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); } @@ -68,35 +102,15 @@ this.description_ = description_; widget_.setToolTipText(description_); } - /** - * Methode de construction des menus de base - * - * @param _popup - */ - public void constructPopupMenuBase(JPopupMenu _popup) { + + + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add("Masquer l'objet"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); + menuItem.addActionListener(new ActionListener() { - // -- reference vers le gestionnaire de commandeundo/redo --// - final CtuluCommandContainer cmd_ = getWidget_().getEbliScene().getCmdMng(); - - JMenuItem menuItem3 = _popup.add("Informations"); - menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); - menuItem3.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); - } - - }); - - menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); - menuItem3.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - - // -- si la widget a une bordure c'est la bordure que l on masque --// EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); @@ -104,16 +118,44 @@ n.getCreator().getBordure().setVisible(false); cmd_.addCmd(new CommandMasquer(n.getCreator().getBordure())); } else { - widget_.setVisible(false); - cmd_.addCmd(new CommandMasquer(widget_)); + widget_.setVisible(false); + cmd_.addCmd(new CommandMasquer(widget_)); } - - - + } }); - if (canDuplicate_) { + } + + + protected void constructMenuSupprimer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add("Supprimer l'objet"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + + // -- on prend la location du node au moment de la suppression pour + // pouvoir la retablir dans le undo --// + // n.setPreferedLocation(widget_.getPreferredLocation()); + // -- on enregistre la commande undo redo --// + cmd_ + .addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_.convertLocalToScene(widget_.getLocation()))); + + // -- on enleve le node de la scene --// + widget_.getEbliScene().removeNode(n); + + // -- raffraichissement de la scene --// + widget_.getEbliScene().refresh(); + + } + + }); + } + + protected void constructMenuDupliquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { JMenuItem menuItem1 = _popup.add("Dupliquer l'objet"); menuItem1.setIcon(CtuluResource.CTULU.getIcon("crystal_cascade")); menuItem1.addActionListener(new ActionListener() { @@ -138,6 +180,11 @@ // -- duplication de la taille --// duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); + // -- ajout de la commande undo/redo --// + ArrayList<EbliNode> ln = new ArrayList<EbliNode>(); + ln.add(duplique); + cmd_.addCmd(new CommandeDuplicate(ln, widget_.getEbliScene())); + // -- raffraichissement de la scene --// widget_.getEbliScene().refresh(); } @@ -145,31 +192,38 @@ } }); - } + } + + /** + * Methode de construction des menus de base + * + * @param _popup + */ + public void constructPopupMenuBase(JPopupMenu _popup) { + + // -- reference vers le gestionnaire de commandeundo/redo --// + final CtuluCommandContainer cmd_ = getWidget_().getEbliScene().getCmdMng(); - JMenuItem menuItem2 = _popup.add("Supprimer l'objet"); - menuItem2.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); - menuItem2.addActionListener(new ActionListener() { + JMenuItem menuItem3 = _popup.add("Informations"); + menuItem3.setIcon(BuResource.BU.getIcon("crystal_aide")); + menuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - - EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); - - //-- on enregistre la commande undo redo --// - cmd_.addCmd(new CommandSupprimer(n, widget_.getEbliScene(), widget_)); - - //-- on enleve le node de la scene --// - widget_.getEbliScene().removeNode(n); - - // -- raffraichissement de la scene --// - widget_.getEbliScene().refresh(); - + JOptionPane.showMessageDialog(null, getDescription_(), "Informations", JOptionPane.DEFAULT_OPTION, null); } }); + constructMenuMasquer(_popup, cmd_); + + + if (canDuplicate_) { + constructMenuDupliquer(_popup, cmd_); + } + + constructMenuSupprimer(_popup, cmd_); + } /** @@ -212,7 +266,7 @@ BConfigurePalette palette = new BConfigurePalette(false); - BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); palette.setTargetConf(cmp); JDialog d = new JDialog(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerActionOnly.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -10,8 +10,13 @@ public class EbliWidgetControllerActionOnly extends EbliWidgetController { public EbliWidgetControllerActionOnly(EbliWidget widget_) { - super(widget_); + this(widget_, true, true); } + + + public EbliWidgetControllerActionOnly(EbliWidget widget_, boolean canMove, boolean canResize) { + super(widget_, canMove, canResize); + } /** * surcharge de la methode menu pour ne pas cree de sous menus. Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -14,9 +14,9 @@ } public EbliWidgetControllerMenuOnly(EbliWidget widget_, boolean canDuplicate) { - super(widget_); + super(widget_, true, true, canDuplicate); - canDuplicate_ = canDuplicate; + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetImage.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -26,7 +26,7 @@ Rectangle rec = getClientArea(); // -- dessin de l'image --// - g.drawImage(image, rec.x, rec.y, rec.width, rec.height, this); + g.drawImage(image, rec.x, rec.y, rec.width - 1, rec.height - 1, this); } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetLine.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,57 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; - -import org.fudaa.ebli.courbe.EGCourbe; -import org.fudaa.ebli.trace.TraceIcon; -import org.fudaa.ebli.trace.TraceIconModel; -import org.fudaa.ebli.trace.TraceLigne; - - -/** - * Legende - * Widget qui contient le trac\xE9 de la ligne de la l\xE9gende courbe - * @author genesis - * - */ -public class EbliWidgetLine extends EbliWidget { - - EGCourbe cb_; - - /** - * @param _scene - */ - public EbliWidgetLine(EbliScene _scene, EGCourbe _cb, Point preferedLocation) { - super(_scene, true); - cb_ = _cb; - setMinimumSize(new Dimension(30, 10)); - setPreferredSize(new Dimension(40, 10)); - - setEnabled(false); - - } - - /** - * - */ - @Override - protected void paintWidget() { - Graphics2D g = getGraphics(); - Rectangle rec = getClientArea(); - g.translate(rec.x, rec.y); - //la ligne - TraceLigne l = new TraceLigne(cb_.getLigneModel()); - l.dessineTrait(g, 0, rec.height / 2, rec.width, rec.height / 2); - //l'icone - TraceIconModel icm = new TraceIconModel(cb_.getIconModel()); - icm.setTaille(Math.min(rec.width / 2, rec.height));//a voir - TraceIcon ic = new TraceIcon(icm); - ic.paintIconCentre(g, rec.width / 2, rec.height / 2); - g.translate(-rec.x, -rec.y); - } - - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -28,7 +28,11 @@ - // public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, + public ShapeCreator getShaper_() { + return shaper_; + } + + // public TraceLigneModel tl_ = new TraceLigneModel(TraceLigne.LISSE, 5, // couleurContour);//pour l'exempls /** * @return the rotation_ Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -0,0 +1,183 @@ +package org.fudaa.ebli.visuallibrary; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.DefaultListSelectionModel; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; + +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +import org.jdesktop.swingx.JXTreeTable; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; +import org.netbeans.api.visual.model.ObjectSceneEvent; +import org.netbeans.api.visual.model.ObjectSceneListener; +import org.netbeans.api.visual.model.ObjectState; + +import com.memoire.fu.FuLog; + +/** + * Classe qui gere la synchronisation entre la scene et les autres composants d + * affichage de la scene tel que l arbre. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetSynchroniser implements ObjectSceneListener, TreeSelectionListener { + + /** + * la scene a synchroniser. + */ + EbliScene scene_; + /** + * l arbre representant la scene. + */ + EbliWidgetJXTreeTableModel treeModel_; + + + JXTreeTable arbre_; + + /** + * booleen qui permet d eviter de realiser des cycles entre la selection des + * nodes sur le tree et sur la scene. + */ + boolean noCycle = true; + + public EbliWidgetSynchroniser(EbliWidgetJXTreeTableModel treeModel, JXTreeTable arbre) { + super(); + treeModel_ = treeModel; + this.scene_ = treeModel_.getScene(); + arbre_ = arbre; + + + // -- ajout du synchroniser comme listener du tree selecter --// + + arbre_.addTreeSelectionListener(this); + + } + + + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { + } + + public void highlightingChanged(ObjectSceneEvent event, Set<Object> previousHighlighting, Set<Object> newHighlighting) { + } + + public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) { + } + + public void objectAdded(ObjectSceneEvent event, Object addedObject) { + } + + public void objectRemoved(ObjectSceneEvent event, Object removedObject) { + } + + public void objectStateChanged(ObjectSceneEvent event, Object changedObject, ObjectState previousState, + ObjectState newState) { + } + + /** + * Des que la selection change dans la scene, on selectionne le noeud + * correspondand dans le tree. + */ + public void selectionChanged(ObjectSceneEvent event, Set<Object> previousSelection, Set<Object> newSelection) { + FuLog.warning("NOCYCLE DE SCENE " + noCycle); + if (noCycle) { + + // on bloque l'effet cycle + noCycle = false; + + if (newSelection != null && newSelection.size() != 0) { + + + + DefaultListSelectionModel model = new DefaultListSelectionModel(); + + for (Iterator<Object> it = newSelection.iterator(); it.hasNext();) { + // -- recuperation du node selectionne --// + EbliNode nodeSelect = (EbliNode) it.next(); + + + MutableTreeTableNode treeNode=treeModel_.findTreeTableNode(nodeSelect); + + model.addSelectionInterval(treeModel_.getIndexOfChild(treeModel_.getRoot(), treeNode), treeModel_ + .getIndexOfChild(treeModel_.getRoot(), treeNode)); + + // fonctionne que pour une seule selection + // arbre_.setRowSelectionInterval(treeModel_.getIndexOfChild(treeModel_. + // getRoot(), treeNode), treeModel_ + // .getIndexOfChild(treeModel_.getRoot(), treeNode)); + + arbre_.setSelectionModel(model); + + } + arbre_.validate(); + // mise a jour de la scene + scene_.refresh(); + + + } else { + arbre_.clearSelection(); + } + + + } + + // -- on signale que le danger du cycle est termin\xE9 + noCycle = true; + } + + + /** + * signal envoye par l arbre lors du changement de selection. + */ + public void valueChanged(TreeSelectionEvent e) { + FuLog.warning("NOCYCLE DE TREE " + noCycle); + if (noCycle) { + + noCycle = false; + + if (arbre_.getSelectedRows() != null && arbre_.getSelectedRows().length != 0) { + Set<Object> listeNodeSelect=new HashSet<Object>(); + + + + int[] indices = arbre_.getSelectedRows(); + + + + for (int i = 0; i < indices.length; i++) { + + MutableTreeTableNode treeNode = (MutableTreeTableNode) treeModel_.getChild(treeModel_.getRoot(), indices[i]); + + EbliNode nodeSelect = (EbliNode) treeNode.getUserObject(); + + FuLog.warning("tree selection: " + nodeSelect); + listeNodeSelect.add(nodeSelect); + + } + + + //on force la selection dans la scene + scene_.setSelectedObjects(listeNodeSelect); + + arbre_.validate(); + + // mise a jour de la scene + scene_.refresh(); + } + + } + + // -- on signale que le danger du cycle est termin\xE9 + noCycle = true; + + } + + + + + + +} Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,96 +0,0 @@ -package org.fudaa.ebli.visuallibrary; - -import java.awt.Point; - -import org.fudaa.ebli.courbe.EGCourbe; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.TextFieldInplaceEditor; -import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.LabelWidget; -import org.netbeans.api.visual.widget.Scene; -import org.netbeans.api.visual.widget.Widget; -import org.netbeans.modules.visual.layout.FlowLayout; - - - -/** - * Legende - * Widget qui contient le titre de la ligne de la l\xE9gende courbe - * @author genesis - * - */ -public class EbliWidgetTitle extends EbliWidget implements TextFieldInplaceEditor{ - - EGCourbe cb_; - - LabelWidget intern; - - /** - * @param _scene - */ - public EbliWidgetTitle(EbliScene _scene, EGCourbe _cb,Point preferedLocation) { - super(_scene); - setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); - intern = new LabelWidget(_scene); - intern.setForeground(_cb.getAspectContour()); - addChild(intern); - setCourbe(_cb); - - //-- ajouter l option de remplacer le text dans le label --// - - //-- creation de l action --// - WidgetAction editorAction = ActionFactory.createInplaceEditorAction (this); - - //-- ajout de l action au label correspondant --// - intern.getActions ().addAction (editorAction); - - //setEnabled(false); - } - - public void majLabel(){ - intern.setForeground(cb_.getAspectContour()); - intern.setLabel(cb_.getTitle()); - } - -// @Override -// public void notifyStateChanged(ObjectState _previousState, ObjectState _newState) { -// } - - - /** - * @return the cb_ - */ - public EGCourbe getCourbe() { - return cb_; - } - - /** - * @param _cb the cb_ to set - */ - public void setCourbe(EGCourbe _cb) { - this.cb_ = _cb; - if (cb_ != null) { - intern.setLabel(cb_.getTitle()); - } - } - - public String getText(Widget widget) { - return ((LabelWidget) widget).getLabel (); - } - - public boolean isEnabled(Widget widget) { - // TODO Auto-generated method stub - return true; - } - - public void setText(Widget widget, String text) { - ((LabelWidget) widget).setLabel (text); - cb_.setTitle(text); - } - - - - -} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandMasquer.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,5 +1,8 @@ package org.fudaa.ebli.visuallibrary.actions; +import java.util.ArrayList; +import java.util.Iterator; + import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -11,25 +14,44 @@ */ public class CommandMasquer implements CtuluCommand { - EbliWidget widget_; + ArrayList<EbliWidget> widget_; + private boolean visible_; + public CommandMasquer(EbliWidget widget) { + + widget_ = new ArrayList<EbliWidget>(); + widget_.add(widget); + + + } - public CommandMasquer(EbliWidget widget_) { + public CommandMasquer(ArrayList<EbliWidget> widget) { + this(widget, false); + + } + + public CommandMasquer(ArrayList<EbliWidget> widget, boolean visible) { super(); - this.widget_ = widget_; + this.widget_ = widget; + visible_ = visible; } - + public void undo() { - widget_.setVisible(true); - widget_.getEbliScene().refresh(); + for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { + it.next().setVisible(!visible_); + } + + widget_.get(0).getEbliScene().refresh(); } public void redo() { - widget_.setVisible(false); - widget_.getEbliScene().refresh(); + for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { + it.next().setVisible(visible_); + } + widget_.get(0).getEbliScene().refresh(); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -1,9 +1,10 @@ package org.fudaa.ebli.visuallibrary.actions; +import java.awt.Point; + import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.EbliWidget; /** * commande qui effectue un undo/redo sur la suppression. @@ -17,20 +18,20 @@ EbliScene scene_; - EbliWidget widget_; + Point location_; - public CommandSupprimer(EbliNode nodeSupprime_, EbliScene scene_, EbliWidget widget_) { + public CommandSupprimer(EbliNode nodeSupprime_, EbliScene scene_, Point _location) { super(); this.nodeSupprime_ = nodeSupprime_; this.scene_ = scene_; - this.widget_ = widget_; + location_ = _location; } public void redo() { // --rattachement du node dans la scene --// - widget_.getEbliScene().removeNode(nodeSupprime_); + scene_.removeNode(nodeSupprime_); // -- raffraichissement de la scene --// scene_.refresh(); @@ -40,8 +41,12 @@ public void undo() { // -- de nouveau suppression du node dans la scene --// - widget_.getEbliScene().addNode(nodeSupprime_); + scene_.addNode(nodeSupprime_); + // -- repositionnement originel de la widget --// + nodeSupprime_.getCreator().getWidget().setPreferredLocation( + nodeSupprime_.getCreator().getWidget().convertSceneToLocal(location_)); + // -- raffraichissement de la scene --// scene_.refresh(); } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -0,0 +1,75 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Command undo/redo pour le duplicate de widget. + * + * @author Adrien Hadoux + * + */ +public class CommandeDuplicate implements CtuluCommand { + + + ArrayList<EbliNode> nodeDuplique_; + + EbliScene scene_; + + + + + + + public CommandeDuplicate(ArrayList<EbliNode> nodeDuplique_, EbliScene scene_) { + super(); + this.nodeDuplique_ = nodeDuplique_; + this.scene_ = scene_; + + } + + public void redo() { + // -- redo unitaire execute pour chaque node dupliques --// + for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { + EbliNode node=it.next(); + redo(node.getCreator().getWidget(),node); + } + } + + + /** + * redo unitaire pour une unique duplication + * + * @param widget + * @param nodeDuplique + */ + public void redo(EbliWidget widget, EbliNode nodeDuplique) { + // -- de nouveau suppression du node dans la scene --// + widget.getEbliScene().addNode(nodeDuplique); + + // -- raffraichissement de la scene --// + scene_.refresh(); + } + + public void undo() { + // -- redo unitaire execute pour chaque node dupliques --// + for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + undo(node.getCreator().getWidget(), node); + } + } + + public void undo(EbliWidget widget, EbliNode nodeDuplique) { + // --rattachement du node dans la scene --// + widget.getEbliScene().removeNode(nodeDuplique); + + // -- raffraichissement de la scene --// + scene_.refresh(); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -44,10 +44,11 @@ // necessaires --// // BConfigurableComposite cmp = new BConfigurableComposite(new // WidgetConfigure(found), "test"); - - BConfigurableComposite cmp = new BConfigurableComposite(found.getConfigureInterfaces(), "test"); + BConfigurableComposite cmp = WidgetConfigure.configurePalette(found); + + palette.setTargetConf(cmp); JDialog d = new JDialog(); d.setModal(true); @@ -59,6 +60,8 @@ } } + + EbliWidget findWidget() { Set objs = scene_.getSelectedObjects(); for (Iterator iterator = objs.iterator(); iterator.hasNext();) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,9 +3,9 @@ import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.Set; +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; @@ -29,11 +29,14 @@ */ private static final long serialVersionUID = 1L; EbliScene scene_; + final CtuluCommandContainer cmd_; public EbliWidgetActionDuplicate(EbliScene _scene){ super(EbliResource.EBLI.getString("dupliquer les objets s\xE9lectionn\xE9s"), CtuluResource.CTULU.getIcon("crystal_copier"), "DUPLICATE"); scene_=_scene; putValue(NAME,"Duplication des \xE9lements s\xE9lectionn\xE9s"); + cmd_ = _scene.getCmdMng(); + } @@ -44,8 +47,11 @@ Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); - List<EbliNode> listeNodeADupliquer=new ArrayList<EbliNode>(); + ArrayList<EbliNode> listeNodeADupliquer = new ArrayList<EbliNode>(); + + ArrayList<EbliNode> listeNouveauxNodes = new ArrayList<EbliNode>(); + //-- parcours des nodes for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ @@ -73,6 +79,8 @@ //-- ajout du node dans la scene --// scene_.addNode(node); + // -- ajout du noeud --// + listeNouveauxNodes.add(node); // -- duplication des map de property graphique de la widget --// node.getCreator().getWidget().propGraphique = currentNode.getCreator().getWidget() @@ -86,6 +94,9 @@ } } + // -- creation de l action undo/redo pour les nodes --// + cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, scene_)); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -4,6 +4,7 @@ import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -56,10 +57,20 @@ // TODO Auto-generated method stub // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNodeAutorises = new HashSet<EbliNode>(); Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- on retire de la liste tous les noeuds dont les widgets ne sont pas + // retaillables --// + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode node = it.next(); + if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize_()) + listeNodeAutorises.add(node); + } + //-- recherche du Min/Max selon choix constructeur --// - Iterator<EbliNode> it = listeNode.iterator(); + Iterator<EbliNode> it = listeNodeAutorises.iterator(); Rectangle tailleAresize = null; if (it.hasNext()){ tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); @@ -82,7 +93,7 @@ return; - //-- recupere les anciennes color --// + // -- recupere les anciennes tailles --// List<Rectangle> oldRectangle = new ArrayList<Rectangle>(); List<Rectangle> newRectangle = new ArrayList<Rectangle>(); //-- liste des widget selectionnees --// @@ -90,7 +101,7 @@ // -- parcours des nodes - for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { + for (Iterator<EbliNode> it2 = listeNodeAutorises.iterator(); it2.hasNext();) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -4,6 +4,7 @@ import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -56,10 +57,20 @@ // TODO Auto-generated method stub // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNodeAutorises = new HashSet<EbliNode>(); Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- on retire de la liste tous les noeuds dont les widgets ne sont pas + // retaillables --// + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode node = it.next(); + if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize_()) + listeNodeAutorises.add(node); + } + // -- recherche du Min/Max selon choix constructeur --// - Iterator<EbliNode> it = listeNode.iterator(); + Iterator<EbliNode> it = listeNodeAutorises.iterator(); Rectangle tailleAresize = null; if (it.hasNext()) { tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); @@ -88,7 +99,7 @@ java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); // -- parcours des nodes - for (Iterator<EbliNode> it2 = listeNode.iterator(); it2.hasNext();) { + for (Iterator<EbliNode> it2 = listeNodeAutorises.iterator(); it2.hasNext();) { EbliNode currentNode = it2.next(); if (currentNode != null && currentNode.hasWidget()) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,11 +3,13 @@ import java.awt.Font; import java.awt.Frame; import java.awt.event.ActionEvent; +import java.util.ArrayList; import javax.swing.JDialog; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; import org.fudaa.ebli.controle.BSelecteurColorChooserBt; import org.fudaa.ebli.controle.BSelecteurFont; @@ -17,6 +19,11 @@ import org.fudaa.ebli.controle.BSelecteurSlider; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; +import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; /** * classe qui permet de creer les selecteurs necessaires pour la configuration. @@ -27,10 +34,26 @@ public class WidgetConfigure implements BConfigurableInterface { - EbliWidget widget; + EbliWidget widget_; + boolean lineModel_; + boolean colorsContours_; + boolean colorFonds_; + boolean rotations_; + boolean police_; + + public WidgetConfigure(boolean lineModel_, boolean colorsContours_, boolean colorFonds_, boolean rotations_, + boolean police_, EbliWidget widget_) { + this.colorFonds_ = colorFonds_; + this.colorsContours_ = colorsContours_; + this.lineModel_ = lineModel_; + this.police_ = police_; + this.rotations_ = rotations_; + this.widget_ = widget_; + } + public WidgetConfigure(EbliWidget widget) { - this.widget = widget; + this(true, true, true, true, true, widget); } /** @@ -38,21 +61,28 @@ */ public BSelecteurInterface[] createSelecteurs() { - + ArrayList<BSelecteurInterface> listeComposants = new ArrayList<BSelecteurInterface>(); + + // -- model des lignes --// + if (lineModel_) { BSelecteurLineModel modelL = new BSelecteurLineModel(EbliWidget.LINEMODEL); modelL.setAddColor(false); - - + listeComposants.add((BSelecteurInterface) modelL); + } // -- model des colors contours --// + if (colorsContours_) { BSelecteurColorChooserBt modelCc = new BSelecteurColorChooserBt(EbliWidget.COLORCONTOUR); modelCc.setTitle("Choix couleur contour"); - + listeComposants.add((BSelecteurInterface) modelCc); + } // -- model des colors de fond --// + if (colorFonds_) { BSelecteurColorChooserBt modelCf = new BSelecteurColorChooserBt(EbliWidget.COLORFOND); modelCf.setTitle("Choix couleur de fond"); - + listeComposants.add((BSelecteurInterface) modelCf); + } // -- model des rotations --// // BSelecteurMolette molette = new BSelecteurMolette(EbliWidget.ROTATION); // molette.setTitle("Rotation"); @@ -60,14 +90,19 @@ // molette.setTooltip( // "Effectuer des drag and drop pour faire tourner le composant"); // - + if (rotations_) { BSelecteurSlider slider = new BSelecteurSlider(EbliWidget.ROTATION, 0, 360); slider.setTitle("Rotation"); slider.slider_.setMajorTickSpacing(45); slider.slider_.setPaintTicks(true); // 0, 90, 180,270 - + listeComposants.add((BSelecteurInterface) slider); + + } + + // -- model des font --// + if (police_) { BSelecteurFont modelF = new BSelecteurFont(EbliWidget.FONT) { public void actionPerformed(final ActionEvent _e) { final Frame f = CtuluLibSwing.getFrameAncestorHelper(bt_); @@ -96,11 +131,54 @@ modelF.bt_.setText("Choisir"); modelF.setTitle("Police"); modelF.bt_.setFont(new Font("Helvetica.Italic", Font.PLAIN, 12)); - return new BSelecteurInterface[] { modelL, modelCc, modelCf, modelF, slider }; + + listeComposants.add((BSelecteurInterface) modelF); } + BSelecteurInterface[] tableau = new BSelecteurInterface[listeComposants.size()]; + return listeComposants.toArray(tableau); + } + + /** + * Methode qui envoie les configurations specifiques en fonctions du type de + * widget qui les demande + * + * @param found + * la widget qui fait appel au service + * @return la configuration disponible + */ + public static BConfigurableComposite configurePalette(EbliWidget found) { + BConfigurableComposite palette = null; + boolean lineModel_ = true; + boolean colorsContours_ = true; + boolean colorFonds_ = true; + boolean rotations_ = true; + boolean police_ = true; + + if (found instanceof EbliWidgetBordure) { + colorFonds_ = false; + rotations_ = false; + police_ = false; + } + else if (found instanceof EbliWidgetShape) { + police_ = false; + //-- test du shapeCreator --// + ShapeCreator creator = ((EbliWidgetShape) found).getShaper_(); + if (!(creator instanceof ShapeCreatorFleche) && !(creator instanceof ShapeCreatorEllipse)) { + rotations_ = false; + } + + } + + palette = new BConfigurableComposite(found.getConfigureInterfaces(lineModel_, colorsContours_, colorFonds_, + rotations_, police_), "palette"); + + return palette; + } + + public BConfigurableInterface[] getSections() { return null; } @@ -119,6 +197,6 @@ } public BSelecteurTargetInterface getTarget() { - return widget; + return widget_; } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -5,6 +5,7 @@ package org.fudaa.ebli.visuallibrary.calque; import java.awt.Component; +import java.awt.Dimension; import java.awt.Point; import javax.swing.JLabel; @@ -36,8 +37,16 @@ BCalqueLegendePanel legendePanel_; - + public static int LENGHT_PER_LEGENDE = 15; + public static int WIDTH_PER_LEGENDEICON = 10; + public static int WIDTH_PER_LEGENDETEXT = 130; + public static int WIDTH_LEGENDE = 200; + public static int MAX_BORDURE = 12; + public static Dimension createSizeForWidget(int _nbLibelles) { + return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); + } + public EbliWidgetCalqueLegende(EbliScene _scene) { super(); scene_ = _scene; @@ -97,10 +106,11 @@ // --creation de la widget conteneur --// + BPalettePlageInterface listeplages = null; EbliWidget widgetLegende_ = new EbliWidget(_scene, false); widgetLegende_.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); - + if (_calqueLegende != null) { Component[] listeC=_calqueLegende.getComponents(); for(int i=0;i<listeC.length;i++){ @@ -119,7 +129,7 @@ BPalettePlageLegende pal = (BPalettePlageLegende) c; // --recuperation de la liste des plages --// - BPalettePlageInterface listeplages = pal.getModel(); + listeplages = pal.getModel(); for (int j = 0; j < listeplages.getNbPlages(); j++) { @@ -132,6 +142,7 @@ lw.setUseBorder(false); lw.setEnabled(false); + lw.setEnabled(false); widgetLegende_.addChild(lw); @@ -143,8 +154,16 @@ } widgetLegende_.setController_(new EbliWidgetControllerMenuOnly(widgetLegende_, false)); + + // -- creation de la taille de la widget --// + if (listeplages != null) + widgetLegende_.setPreferredSize(createSizeForWidget(listeplages.getNbPlages() + 1)); + + return widgetLegende_; + } else + return null; } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -3,13 +3,17 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.ArrayList; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; +import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; import org.fudaa.ebli.visuallibrary.actions.EbliActionEditorOneClick; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; @@ -20,7 +24,8 @@ /** * controller specifique pour les actions de la widget du calque. le calque ne - * cree aucune action par default. + * cree aucune action par default. De plus surcharge de la methode de masquage: + * la widget se masque avec sa widget legende. * * @author Adrien Hadoux. * @@ -42,22 +47,22 @@ this.legendeWidget_ = legendeWidget_; } - EbliWidgetVueCalque widget2_; + EbliWidgetVueCalque widgetCalque_; public EbliWidgetControllerCalque(EbliWidgetVueCalque widget_) { super(widget_); - widget2_ = widget_; + widgetCalque_ = widget_; addActionSpecifiques(); } public EbliNode getNodeLegende() { - return widget2_.nodeLegende; + return widgetCalque_.nodeLegende; } public void setNodeLegende(EbliNode node) { - widget2_.nodeLegende = node; + widgetCalque_.nodeLegende = node; } public void addActionSpecifiques() { @@ -68,6 +73,58 @@ } + + + protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { + JMenuItem menuItem = _popup.add("Masquer l'objet"); + menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); + menuItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + // -- si la widget a une bordure c'est la bordure que l on masque --// + EbliWidget widgetUndo1 = null; + EbliWidget widgetUndo2 = null; + + EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); + if (n.getCreator().getBordure() != null) { + // -- on masque le calque --// + n.getCreator().getBordure().setVisible(false); + + + widgetUndo1 = n.getCreator().getBordure(); + + + } else { + widget_.setVisible(false); + widgetUndo1 = widget_; + + } + + + // -- on masque sa legende associee --// + if (widgetCalque_.nodeLegende.getCreator().getBordure() != null) { + widgetCalque_.nodeLegende.getCreator().getBordure().setVisible(false); + widgetUndo2 = widgetCalque_.nodeLegende.getCreator().getBordure(); + } else { + widgetCalque_.nodeLegende.getCreator().getWidget().setVisible(false); + widgetUndo2 = widgetCalque_.nodeLegende.getCreator().getWidget(); + } + + + // -- creation des comamndes undo/redo pour le masquage --// + ArrayList<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + listeWidget.add(widgetUndo1); + listeWidget.add(widgetUndo2); + + cmd_.addCmd(new CommandMasquer(listeWidget)); + + } + + }); + } + + /** * Surcharge de la creation du menu de base en ajoutant les menus specifiques */ @@ -114,7 +171,9 @@ setNodeLegende(legendeWidget_.createLegende()); widget_.getEbliScene().refresh(); - } + } else if (getNodeLegende().hasWidget()) + // -- cas ou la legende existe mais est cach\xE9e --// + getNodeLegende().getCreator().getWidget().setVisible(true); // GrapheWidget.this.addChild(widgetLegende); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-08-27 16:53:48 UTC (rev 3846) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-08-28 17:25:46 UTC (rev 3847) @@ -36,7 +36,7 @@ } public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetBordure(EbliWidgetCalqueLegende.createLegendeWidget(g, _scene)); + res = new EbliWidgetBordure(EbliWidgetCalqueLegende.createLegendeWidget(g, _scene), true, false); // g.getModel().addModelListener(new EbliWidgetGrapheController(res)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/c... [truncated message content] |
From: <had...@us...> - 2008-08-29 17:05:39
|
Revision: 3853 http://fudaa.svn.sourceforge.net/fudaa/?rev=3853&view=rev Author: hadouxad Date: 2008-08-29 17:05:47 +0000 (Fri, 29 Aug 2008) Log Message: ----------- - synchronisation graphe/tree ok - WidgetBordure: surcharge de get et setProperty: les proprietes graphiques autre que le ligneModel et le contour sont envoyes a son widget conteneur, lui ne gete que le cadre. - Personalisation propre de la widget text grace a precedent - Personalisation propre des widget legende -les l?\195?\169gendes sont retaill?\195?\169es automatiqument que si on change leur font - pour les legendes calques, les icones sont retailles pa rapport a la taille de la fonte - gestion undo sur la font des legendes - BUG lorsque la police depasse 20 - proposer le popupmenu dans l'arbre des widgets. - la popup du widget est recuperee et est affichee au niveau de l arbre demand?\195?\169 - synchronisation ok - Resolution du bug d'affichage pour tree des differents widget selectionnees l affichage est propre et les composant bien raffraichis - le bouton de la satelliteview est vir?\195?\169 - il est plac?\195?\169 dans le scrollpaneSlector, un clic dessus ouvre la vue satelite. - la vue sattellite par defaut n est pas visible il faudra cliquer sur le bouton pour l afficher -ajoute d'une action permettant d'interdire le d?\195?\169placement et le retaillage. Cette action, devra virer les 2 actions correspondante de la widget. (design pattern template pour gerer les 2 actions) - l action inverse a ete cree - les comandes undo/redo sur ces actions ont ete realisees Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMainPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.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/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/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/EbliWidgetEditCreator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 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/CommandUndoRedoBloque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMainPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMainPanel.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuMainPanel.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -30,6 +30,9 @@ protected BuSplit3Pane splitpane_; private BuColumn leftcolumn_; private BuColumn rightcolumn_; + private BuScrollPane scrollDesktop_; + + private boolean swapped_ ; public BuMainPanel() { @@ -41,6 +44,14 @@ } + public BuScrollPane getScrollDesktop_() { + return scrollDesktop_; + } + + public void setScrollDesktop_(BuScrollPane scrollDesktop_) { + this.scrollDesktop_ = scrollDesktop_; + } + public BuMainPanel(JComponent _middle, boolean _useScroll) { super(); @@ -70,10 +81,10 @@ if (middle instanceof BuDesktop) { desktop_ = (BuDesktop) middle; if (!desktop_.isTabbed() && _useScroll) { - BuScrollPane sp = new BuScrollPane(desktop_); - sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - middle = sp; + scrollDesktop_ = new BuScrollPane(desktop_); + scrollDesktop_.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollDesktop_.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + middle = scrollDesktop_; } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -55,7 +55,7 @@ } final private WidgetAction alignWithMoveAction; - + final private WidgetAction alignWithResizeAction; /** * Le gestionnaire de commande associe \xE0 la scene */ @@ -88,6 +88,10 @@ alignWithMoveAction = ActionFactory.createAlignWithMoveAction(visu_, interactionLayer_, ActionFactory .createDefaultAlignWithMoveDecorator(), false); + + alignWithResizeAction = ActionFactory.createAlignWithResizeAction(visu_, interactionLayer_, ActionFactory + .createDefaultAlignWithMoveDecorator(), false); + rectangularSelection_=ActionFactory.createRectangularSelectAction(this, interactionLayer_); // -- ajoute l'action du zoom ( ctrl + clic) getActions().addAction(ActionFactory.createCenteredZoomAction(1.1)); 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-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -30,9 +30,17 @@ * Map contenant tous les objets graphiques de la widget generique. key: lineModel => le lignemodel du ebliWidget. * key: color => couleur de fond. */ - public Map propGraphique; + protected Map<String, Object> propGraphique; + public Map<String, Object> getPropGraphique() { + return propGraphique; + } + + public void setPropGraphique(Map<String, Object> propGraphique) { + this.propGraphique = propGraphique; + } + protected EbliWidgetController controller_; @@ -255,9 +263,9 @@ getEbliScene().refresh(); } - public Map duplicateGraphicalProperties() { + public Map<String, Object> duplicateGraphicalProperties() { - Map mapDupliquee = new HashMap<String, Object>(); + Map<String, Object> mapDupliquee = new HashMap<String, Object>(); mapDupliquee.put(LINEMODEL, new TraceLigneModel(getTraceLigneModel())); mapDupliquee.put(COLORCONTOUR, getColorContour()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -1,10 +1,16 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Color; +import java.awt.Font; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; +import java.util.HashMap; +import java.util.Map; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.actions.CommandeUndoRedoGraphicalProperties; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; /** @@ -87,4 +93,115 @@ } + /** + * surcharge des methodes getProperty pour recuperer les proprietes graphiques + * et les dipatcher a son conteneur + */ + public Object getProperty(String _key) { + + // -- la bordure ne gere que tracemodel et couleur contour, le reste est + // dispatch\xE9 a son conteneur --// + if (_key.equals(ROTATION)) { + + double radian = intern_.getRotation(); + return Integer.valueOf((int) (radian * 180 / Math.PI)); + + } + else if (_key.equals(FONT)) { + return intern_.propGraphique.get(_key); + } else if (_key.equals(COLORFOND)) { + return intern_.propGraphique.get(_key); + } + else + return propGraphique.get(_key); + } + +/** + * Methode directement appelee apres modification des parametres renvoye par + * le getproperty. Ajoute les anciens parametres dans la commande undo/redo. + */ + public boolean setProperty(String _key, Object prop) { + + // --cas particulier si il s agit du tracelignemodel: il faut mettre a jour + // l ancien lignemodel --// + if (_key.equals(LINEMODEL)) { + getTraceLigneModel().updateData((TraceLigneModel) prop); + prop = getTraceLigneModel(); + } else if (_key.equals(ROTATION) && prop instanceof Integer) { + // -- cas particulier si il s agit de la rotation --// + // -- il faut transformer les degres en radian --// + int degre = ((Integer) prop).intValue(); + double radian = degre * Math.PI / 180; + prop = new Double(radian); + + } + + // -- creation de la commande undo/redo --// + CommandeUndoRedoGraphicalProperties undoRedo = new CommandeUndoRedoGraphicalProperties(); + + // -- ajout de la widget en question ainsi que la oldpropertie --// + undoRedo.addWidget(this); + + + // --mise a jout de la map de proprietes --// + if (_key.equals(LINEMODEL) || _key.equals(COLORCONTOUR)) { + undoRedo.addOldPropertie(this.duplicateGraphicalProperties()); + propGraphique.put(_key, prop); + // -- ajout de la nouvelle propertie --// + undoRedo.addNewPropertie(propGraphique); + } else { + undoRedo.addOldPropertie(intern_.duplicateGraphicalProperties()); + intern_.propGraphique.put(_key, prop); + // -- ajout de la nouvelle propertie --// + undoRedo.addNewPropertie(intern_.propGraphique); + } + + + // -- enregistrement de la commande undo/redo --// + if (getEbliScene().cmdMng_ != null) { + getEbliScene().cmdMng_.addCmd(undoRedo); + } + + // -- mise a jour des parametres de la map --// + refreshMyProperties(); + + return true; + } + + /** + * surcharge des getter et setter graphical properties pour rediriger les + * infos vers les widgets contenu + */ + public Map<String, Object> getPropGraphique() { + + Map<String, Object> mapMeltingPot = new HashMap<String, Object>(); + mapMeltingPot.put(COLORCONTOUR, getColorContour()); + mapMeltingPot.put(LINEMODEL, getTraceLigneModel()); + + // -- les autres valeurs conernent le contenu --// + mapMeltingPot.put(ROTATION, intern_.getRotation()); + mapMeltingPot.put(FONT, intern_.getFormeFont()); + mapMeltingPot.put(COLORFOND, intern_.getColorFond()); + + return mapMeltingPot; + } + + + /** + * surcharge des getter et setter graphical properties pour rediriger les + * infos vers les widgets contenu + */ + public void setPropGraphique(Map<String, Object> propGraphique) { + this.propGraphique.put(COLORCONTOUR, propGraphique.get(COLORCONTOUR)); + this.propGraphique.put(LINEMODEL, propGraphique.get(LINEMODEL)); + + + // -- on redirige les proprietes font,couleur de fond et rotation --// + this.intern_.setFormeFont((Font) propGraphique.get(FONT)); + this.intern_.setColorFond((Color) propGraphique.get(COLORFOND)); + this.intern_.setRotation((Double) propGraphique.get(ROTATION)); + + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -20,6 +20,7 @@ import org.fudaa.ebli.visuallibrary.actions.WidgetConfigure; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuResource; @@ -33,25 +34,18 @@ public class EbliWidgetController { protected boolean canDuplicate_ = true; - public boolean isCanDuplicate_() { - return canDuplicate_; - } - - public boolean isCanMove_() { - return canMove_; - } - - public boolean isCanResize_() { - return canResize_; - } - protected boolean canMove_ = true; protected boolean canResize_ = true; - private String description_; - protected EbliWidget widget_; + /** + * action de la widget recuperable et eventuellement supprimable + */ + WidgetAction actionMove_; + WidgetAction actionResize_; + WidgetAction actionSelect_; + public EbliWidgetController(EbliWidget widget_) { this(widget_, true, true, true); @@ -78,23 +72,60 @@ } + + public boolean isCanDuplicate_() { + return canDuplicate_; + } + + public boolean isCanMove_() { + return canMove_; + } + + public boolean isCanResize_() { + return canResize_; + } + + /** * methode qui cree les actions par defaut pour la widget. * */ public void createdefaultAction() { // -- construction des actions --// - widget_.getActions().addAction(widget_.getEbliScene().createSelectAction()); + actionSelect_ = widget_.getEbliScene().createSelectAction(); + widget_.getActions().addAction(actionSelect_); + + actionResize_ = ActionFactory.createResizeAction(); if (canResize_) - widget_.getActions().addAction(ActionFactory.createResizeAction()); + widget_.getActions().addAction(actionResize_); widget_.getActions().addAction(widget_.getEbliScene().createWidgetHoverAction()); + + actionMove_ = widget_.getEbliScene().getMoveAction(); if (canMove_) - widget_.getActions().addAction(widget_.getEbliScene().getMoveAction()); + widget_.getActions().addAction(actionMove_); } + + /** + * Methode appelee pour bloquer une widget: l'empecher de se deplacer. + */ + public void removeActionResizeAndMove(){ + widget_.getActions().removeAction(actionMove_); + widget_.getActions().removeAction(actionSelect_); + + } + /** + * fonction inverse de la precedente. + */ + public void replaceActionResizeAndMove() { + widget_.getActions().addAction(actionMove_); + widget_.getActions().addAction(actionSelect_); + + } + public String getDescription_() { return description_; } @@ -121,7 +152,7 @@ widget_.setVisible(false); cmd_.addCmd(new CommandMasquer(widget_)); } - + widget_.getEbliScene().refresh(); } }); @@ -226,6 +257,12 @@ } + + PopupMenuProvider providerPopup_ = null; + protected JPopupMenu popupMenu_ = null; + public JPopupMenu getPopup() { + return popupMenu_; + } /** * Methode generique qui fait apparaitre un menuItem propre au composant et * offre les op\xE9rations de base on ouvre le menu via le clic droit ou le @@ -233,18 +270,21 @@ */ public void setMenu() { - widget_.getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { + + popupMenu_ = new JPopupMenu(); + + // -- construction du menu pour les graphismees --// + constructPopupMenuBaseGraphique(popupMenu_); + // -- creation du menu commun a tous les widgets + constructPopupMenuBase(popupMenu_); + + + providerPopup_=new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu(); - - // -- construction du menu pour les graphismees --// - constructPopupMenuBaseGraphique(popup); - // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); - - return popup; + return popupMenu_; } - })); + }; + widget_.getActions().addAction(ActionFactory.createPopupMenuAction(providerPopup_)); } /** Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -1,12 +1,16 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.swing.DefaultListSelectionModel; +import javax.swing.JPopupMenu; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.TreePath; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.jdesktop.swingx.JXTreeTable; @@ -42,7 +46,8 @@ * booleen qui permet d eviter de realiser des cycles entre la selection des * nodes sur le tree et sur la scene. */ - boolean noCycle = true; + boolean noCycleScene = true; + boolean noCycleTree = false; public EbliWidgetSynchroniser(EbliWidgetJXTreeTableModel treeModel, JXTreeTable arbre) { super(); @@ -55,9 +60,72 @@ arbre_.addTreeSelectionListener(this); + // -- gestion des popupMenus sur le jtree --// + arbre_.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + if (e.isPopupTrigger() && e.getClickCount() == 1) { + affichePopupNode(e.getX(), e.getY()); + } + } + + public void mouseReleased(MouseEvent e) { + if (e.isPopupTrigger() && e.getClickCount() == 1) { + affichePopupNode(e.getX(), e.getY()); + } + } + }); + + } + /** + * Methode qui affiche la popup du node selectionn\xE9. entree: la position ou + * afficher la popup + * + * @param x + * @param y + */ + public void affichePopupNode(int x, int y) { + // Get the tree element under the mouse + TreePath clickedElement = arbre_.getPathForLocation(x, y); + // Update the selection if necessary + // updateSelection(clickedElement); + + // Display the name of the selected tree element in the selection field + MutableTreeTableNode treeNode = null; + if (clickedElement != null) + treeNode = (MutableTreeTableNode) clickedElement.getLastPathComponent(); + + if (treeNode != null) { + + // -- recuperation du node associe --// + EbliNode node = (EbliNode) treeNode.getUserObject(); + + if (node != null && node.hasWidget() && node.getCreator().getWidget().isVisible()) { + + + // -- recuperation de la popup du node et ajout a l element du tree a al + // bonne location--// + JPopupMenu poppup =null; + + // -- cas ou la widget selectionnee est la bordure, il faut recuperer + // son contenant --// + if(node.getCreator().getWidget() instanceof EbliWidgetBordure){ + EbliWidgetBordure bordure = (EbliWidgetBordure) node.getCreator().getWidget(); + poppup = bordure.intern_.getController_().getPopup(); + }else + poppup=node.getCreator().getWidget().getController_().getPopup(); + + poppup.show(arbre_, x, y); + + + } + + } + + } + public void focusChanged(ObjectSceneEvent event, Object previousFocusedObject, Object newFocusedObject) { } @@ -82,21 +150,33 @@ * correspondand dans le tree. */ public void selectionChanged(ObjectSceneEvent event, Set<Object> previousSelection, Set<Object> newSelection) { - FuLog.warning("NOCYCLE DE SCENE " + noCycle); - if (noCycle) { + FuLog.warning("NOCYCLE DE SCENE " + noCycleScene); + + + + + + if (noCycleScene) { // on bloque l'effet cycle - noCycle = false; + noCycleScene = false; - if (newSelection != null && newSelection.size() != 0) { + final Set<Object> newSelection_ = newSelection; + + if (newSelection_ != null && newSelection_.size() != 0) { - DefaultListSelectionModel model = new DefaultListSelectionModel(); + DefaultListSelectionModel model = (DefaultListSelectionModel) arbre_.getSelectionModel();// new + // DefaultListSelectionModel - for (Iterator<Object> it = newSelection.iterator(); it.hasNext();) { + // -- mise a jour de la selection a vide--// + model.clearSelection(); + + FuLog.warning("ITERATOR CHERIE"); + for (Iterator<Object> it = newSelection_.iterator(); it.hasNext();) { // -- recuperation du node selectionne --// - EbliNode nodeSelect = (EbliNode) it.next(); + final EbliNode nodeSelect = (EbliNode) it.next(); MutableTreeTableNode treeNode=treeModel_.findTreeTableNode(nodeSelect); @@ -109,7 +189,7 @@ // getRoot(), treeNode), treeModel_ // .getIndexOfChild(treeModel_.getRoot(), treeNode)); - arbre_.setSelectionModel(model); + // arbre_.setSelectionModel(model); } arbre_.validate(); @@ -122,10 +202,15 @@ } + // -- verification que le tree a toujours son treeselectionlistener --// + // arbre_.addTreeSelectionListener(this); + + + // -- on signale que le danger du cycle est termin\xE9 + noCycleScene = true; } - // -- on signale que le danger du cycle est termin\xE9 - noCycle = true; + } @@ -133,13 +218,13 @@ * signal envoye par l arbre lors du changement de selection. */ public void valueChanged(TreeSelectionEvent e) { - FuLog.warning("NOCYCLE DE TREE " + noCycle); - if (noCycle) { + FuLog.warning("NOCYCLE DE TREE " + noCycleScene); + if (noCycleScene) { - noCycle = false; + noCycleScene = false; if (arbre_.getSelectedRows() != null && arbre_.getSelectedRows().length != 0) { - Set<Object> listeNodeSelect=new HashSet<Object>(); + final Set<Object> listeNodeSelect = new HashSet<Object>(); @@ -151,7 +236,7 @@ MutableTreeTableNode treeNode = (MutableTreeTableNode) treeModel_.getChild(treeModel_.getRoot(), indices[i]); - EbliNode nodeSelect = (EbliNode) treeNode.getUserObject(); + final EbliNode nodeSelect = (EbliNode) treeNode.getUserObject(); FuLog.warning("tree selection: " + nodeSelect); listeNodeSelect.add(nodeSelect); @@ -167,11 +252,12 @@ // mise a jour de la scene scene_.refresh(); } + // -- on signale que le danger du cycle est termin\xE9 + noCycleScene = true; } - // -- on signale que le danger du cycle est termin\xE9 - noCycle = true; + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoBloque.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -0,0 +1,55 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliWidget; + +/** + * Commande undo/redo sur le blocage des widgets. + * + * @author Adrien Hadoux + * + */ + + + +public class CommandUndoRedoBloque implements CtuluCommand { + + ArrayList<EbliWidget> widget_; + boolean bloque_ = true; + + + + + + public CommandUndoRedoBloque(ArrayList<EbliWidget> widget, boolean bloque) { + super(); + this.widget_ = widget; + bloque_ = bloque; + } + + public void undo() { + + for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { + if (bloque_) + it.next().getController_().replaceActionResizeAndMove(); + else + it.next().getController_().removeActionResizeAndMove(); + } + + widget_.get(0).getEbliScene().refresh(); + } + + public void redo() { + for (Iterator<EbliWidget> it = widget_.iterator(); it.hasNext();) { + if (bloque_) + it.next().getController_().removeActionResizeAndMove(); + else + it.next().getController_().replaceActionResizeAndMove(); + } + widget_.get(0).getEbliScene().refresh(); + } + +} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeUndoRedoGraphicalProperties.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -61,7 +61,7 @@ if (nb == 0) return; for (int i = 0; i < nb; i++) { - widgets_.get(i).propGraphique = oldGraphicalProperties.get(i); + widgets_.get(i).setPropGraphique(oldGraphicalProperties.get(i)); } refreshScene(); @@ -75,7 +75,7 @@ if (nb == 0) return; for (int i = 0; i < nb; i++) { - widgets_.get(i).propGraphique = newGraphicalProperties.get(i); + widgets_.get(i).setPropGraphique(newGraphicalProperties.get(i)); } refreshScene(); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -0,0 +1,100 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.Icon; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.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; + +/** + * Action qui empeche les widgets de se resize et d'etre deplacee + * + * @author Adrien Hadoux + * + */ +public abstract class EbliWidgetActionBloqueOuDebloqueWidget extends EbliActionSimple { + + private static final long serialVersionUID = 1L; + EbliScene scene_; + final CtuluCommandContainer cmd_; + boolean bloque_ = true; + + + + public EbliWidgetActionBloqueOuDebloqueWidget(String name, Icon ic, String id, EbliScene _scene, boolean bloque) { + super(name, ic, id); + + scene_ = _scene; + putValue(NAME, "Duplication des \xE9lements s\xE9lectionn\xE9s"); + cmd_ = _scene.getCmdMng(); + bloque_ = bloque; + } + + + + public static class Bloque extends EbliWidgetActionBloqueOuDebloqueWidget{ + + public Bloque(EbliScene _scene) { + super(EbliResource.EBLI.getString("Bloquer les objets s\xE9lectionn\xE9s "), CtuluResource.CTULU + .getIcon("crystal_tuer"), + "BLOQUEWIDGET", _scene, true); + } + + } + + public static class DeBloque extends EbliWidgetActionBloqueOuDebloqueWidget { + + public DeBloque(EbliScene _scene) { + super(EbliResource.EBLI.getString("Debloquer les objets s\xE9lectionn\xE9s "), CtuluResource.CTULU + .getIcon("crystal_valider"), "DEBLOQUEWIDGET", _scene, false); + } + + } + + + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- liste des widget selectionnees --// + ArrayList<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + // -- parcours des nodes + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + EbliNode currentNode = it.next(); + if (currentNode != null && currentNode.hasWidget()) { + + // -- bloquage de la widget --// + if (bloque_) + currentNode.getCreator().getWidget().getController_().removeActionResizeAndMove(); + else + currentNode.getCreator().getWidget().getController_().replaceActionResizeAndMove(); + listeWidget.add(currentNode.getCreator().getWidget()); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + } + + } + + // -- enregistrement de la commande undoRedo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandUndoRedoBloque(listeWidget, bloque_)); + } + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -96,7 +96,7 @@ widget.setColorFond(newColor); // -- ajout de la nouvelle graphicalProperty --// - newGraphicalProperties.add(widget.propGraphique); + newGraphicalProperties.add(widget.getPropGraphique()); } 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-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -97,7 +97,7 @@ widget.setColorContour(newColor); //-- ajout de la nouvelle graphicalProperty --// - newGraphicalProperties.add(widget.propGraphique); + newGraphicalProperties.add(widget.getPropGraphique()); } 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-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -83,8 +83,8 @@ listeNouveauxNodes.add(node); // -- duplication des map de property graphique de la widget --// - node.getCreator().getWidget().propGraphique = currentNode.getCreator().getWidget() - .duplicateGraphicalProperties(); + node.getCreator().getWidget().setPropGraphique( + currentNode.getCreator().getWidget().duplicateGraphicalProperties()); // -- duplication de la taille --// node.getCreator().getWidget().setPreferredBounds(currentNode.getCreator().getWidget().getPreferredBounds()); 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-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -121,7 +121,7 @@ widget.setFormeFont(newFont); // -- ajout de la nouvelle graphicalProperty --// - newGraphicalProperties.add(widget.propGraphique); + newGraphicalProperties.add(widget.getPropGraphique()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetEditCreator.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -47,6 +47,10 @@ */ public static final EbliWidgetEditCreator INSTANCE = new EbliWidgetEditCreator(); + + + + public Window createFrame(ZEbliCalquesPanel pn, String title) { JFrame frame = new JFrame(title); @@ -72,6 +76,7 @@ // pn.setPreferredSize(pn.getPreferredSize()); final DefaultDockingPort globalPort = createDockingPort(); JComponent centerComponent = createView(pn, EbliResource.EBLI.getToolIcon("lissage"), EbliLib.getS("Vue 2D")); + DockingManager.dock(centerComponent, (DockingPort) globalPort); JComponent rightComponent = createView(new JScrollPane(new BArbreCalque(pn.getArbreCalqueModel())), EbliResource.EBLI.getToolIcon("arbre"), "arbre", true); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -20,10 +20,14 @@ import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; +import org.fudaa.ebli.visuallibrary.EbliWidgetImage; import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +import org.fudaa.ebli.visuallibrary.EbliWidgetTextLabel; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; /** * classe qui permet de creer les selecteurs necessaires pour la configuration. @@ -158,10 +162,32 @@ boolean police_ = true; if (found instanceof EbliWidgetBordure) { - colorFonds_ = false; rotations_ = false; - police_ = false; + + // -- droit en fonction du type du contenu --// + if (found.getChildren() != null && found.getChildren().size() != 0) { + + //-- cas pour graphe et calques --// + if (found.getChildren().get(0) instanceof EbliWidgetVueCalque + || found.getChildren().get(0) instanceof EbliWidgetGraphe) { + colorFonds_ = false; + + police_ = false; + } + else //-- cas image --// + if (found.getChildren().get(0) instanceof EbliWidgetImage) { + colorFonds_ = false; + + police_ = false; + }else {//-- cas legendes --// + + colorFonds_=false; + + } + } + + } else if (found instanceof EbliWidgetShape) { police_ = false; //-- test du shapeCreator --// @@ -170,7 +196,25 @@ rotations_ = false; } + } else if (found instanceof EbliWidgetTextLabel) { + rotations_ = false; + colorFonds_ = false; + lineModel_ = false; } + else if(found instanceof EbliWidgetImage ){ + rotations_ = false; + colorFonds_ = false; + lineModel_ = false; + police_ = false; + colorsContours_=false; + }else{ + //-- cas des legendes: juste font et color contour pour resizer le tout --// + rotations_ = false; + colorFonds_ = false; + lineModel_ = false; + colorsContours_ = false; + + } palette = new BConfigurableComposite(found.getConfigureInterfaces(lineModel_, colorsContours_, colorFonds_, rotations_, police_), "palette"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -6,7 +6,11 @@ import java.awt.Component; import java.awt.Dimension; +import java.awt.Font; import java.awt.Point; +import java.awt.Rectangle; +import java.util.Iterator; +import java.util.List; import javax.swing.JLabel; @@ -22,14 +26,15 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; +import org.netbeans.api.visual.widget.Widget; import org.netbeans.modules.visual.layout.FlowLayout; import com.memoire.fu.FuLog; /** - * Test d'un widget pour afficher la legende A remplacer. + * La classe de gestion des legendes pour le calque. * - * @author deniger + * @author Adrien Hadoux */ public class EbliWidgetCalqueLegende extends BCalqueLegende { @@ -94,6 +99,77 @@ } /** + * Creation de la classe widget specifique au calque. Permet de gerer le + * resize via le changement de font + * + */ + public static class WidgetCalqueLegende extends EbliWidget { + + Font oldFont_; + + public WidgetCalqueLegende(EbliScene scene, boolean _controller) { + super(scene, _controller); + oldFont_ = getFormeFont(); + } + + protected void paintWidget() { + + // -- mise a jour de la fonte que si il y a eu une modification --// + if (oldFont_ != getFormeFont()) { + + + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidgetPlageTitle) { + EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; + new_widget.getIntern_().setFont(getFormeFont()); + + // resize du composant texte + Rectangle newBounds = new_widget.getIntern_().getBounds(); + newBounds.height += (getFormeFont().getSize() - oldFont_.getSize()) * 2; + newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; + new_widget.getIntern_().setPreferredBounds(newBounds); + + // resize pour le logo: forme carr\xE9 + Rectangle boundsLogo = new_widget.getLogo_().getBounds(); + boundsLogo.height = newBounds.height; + boundsLogo.width = newBounds.height; + new_widget.getLogo_().setPreferredBounds(boundsLogo); + // setPreferredSize(new Dimension(newBounds.width, + // newBounds.height)); + + } else if (widget instanceof LabelWidget) { + LabelWidget new_widget = (LabelWidget) widget; + new_widget.setFont(getFormeFont()); + + // resize du composant + Rectangle newBounds = new_widget.getBounds(); + newBounds.height += (getFormeFont().getSize() - oldFont_.getSize()) * 2; + newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; + new_widget.setPreferredBounds(newBounds); + } + + } + // Resize de la widget + + Rectangle newBounds = getParentWidget().getBounds(); + newBounds.height += (listePlage.size() + 1) * (getFormeFont().getSize() - oldFont_.getSize()) * 2; + newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; + getParentWidget().setPreferredBounds(newBounds); + getEbliScene().refresh(); + oldFont_ = getFormeFont(); + + } + + } + + } + + + /** * Mananger statique qui se charge de creer \xE9a widget associee au calque. * * @param _calqueLegende @@ -107,7 +183,7 @@ // --creation de la widget conteneur --// BPalettePlageInterface listeplages = null; - EbliWidget widgetLegende_ = new EbliWidget(_scene, false); + WidgetCalqueLegende widgetLegende_ = new WidgetCalqueLegende(_scene, false); widgetLegende_.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); if (_calqueLegende != null) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -131,14 +131,14 @@ public void setMenu() { widget_.getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu(); + popupMenu_ = new JPopupMenu(); // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); + constructPopupMenuSpecifique(popupMenu_); // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); + constructPopupMenuBase(popupMenu_); - return popup; + return popupMenu_; } })); } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerLegendeCalque.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -0,0 +1,18 @@ +package org.fudaa.ebli.visuallibrary.calque; + +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; + +/** + * controller specifique aux legendes. gere + * + * @author genesis + * + */ +public class EbliWidgetControllerLegendeCalque extends EbliWidgetControllerMenuOnly { + + public EbliWidgetControllerLegendeCalque(EbliWidget widget_) { + super(widget_); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -3,6 +3,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -35,6 +36,7 @@ public internWidget(Scene scene) { super(scene); + setLayout(new FlowLayout(false, SerialAlignment.CENTER, 0)); } public String getText(Widget widget) { @@ -54,6 +56,22 @@ } internWidget intern_; + public internWidget getIntern_() { + return intern_; + } + + public void setIntern_(internWidget intern_) { + this.intern_ = intern_; + } + + public EbliWidget getLogo_() { + return logo_; + } + + public void setLogo_(EbliWidget logo_) { + this.logo_ = logo_; + } + EbliWidget logo_; /** * @param _scene @@ -69,8 +87,13 @@ protected void paintWidget() { Graphics2D g = getGraphics(); g.setColor(plage_.getCouleur()); - g.fillRect(0, 0, EbliWidgetCalqueLegende.WIDTH_PER_LEGENDEICON, - EbliWidgetCalqueLegende.LENGHT_PER_LEGENDE); + Rectangle newBounds = getBounds(); + g.fillRect(0, 0, newBounds.width/* + * EbliWidgetCalqueLegende.WIDTH_PER_LEGENDEICON + */, newBounds.height/* + * EbliWidgetCalqueLegende. + * LENGHT_PER_LEGENDE + */); } }; logo_.setPreferredSize(new Dimension(EbliWidgetCalqueLegende.WIDTH_PER_LEGENDEICON, Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -104,7 +104,6 @@ // // }); // conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); - return calquePanel_; } @@ -143,7 +142,7 @@ // -- centrer la vue par rapport a la frame principal car si le widget est // en bas a droite, c'est la merde! frame_.setLocationRelativeTo(this.getScene().getView()); - calquePanel_.getVueCalque().changeRepere(this, gr); + calquePanel_.getVueCalque().changeRepere(this, gr); frame_.setVisible(true); frame_.addWindowListener(new WindowAdapter() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -103,19 +103,21 @@ public void setMenu() { widget_.getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu(); + popupMenu_ = new JPopupMenu(); // -- Menu sp\xF6cifiques a l'application--// - constructPopupMenuSpecifique(popup); + constructPopupMenuSpecifique(popupMenu_); // -- creation du menu commun a tous les widgets - constructPopupMenuBase(popup); + constructPopupMenuBase(popupMenu_); - return popup; + return popupMenu_; } })); } + + private static int indiceLegende = 1; /** * ajoutant la possibilit\xE9 de configurer la courbe ainsi que la l\xE9gende * @@ -144,6 +146,9 @@ // -- creation d'un node legende --// widgetGraphe_.setNodeLegende(new EbliNodeDefault()); + // -- non de la legende --// + widgetGraphe_.getNodeLegende().setTitle("L\xE9gende " + (indiceLegende++)); + widgetGraphe_.getNodeLegende().setCreator( new EbliWidgetCreatorLegende(((EbliWidgetGraphe) widget_) .getGraphe())); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -26,17 +26,25 @@ EGCourbe cb_; - LabelWidget intern; + LabelWidget intern_; + public LabelWidget getIntern_() { + return intern_; + } + + public void setIntern_(LabelWidget intern_) { + this.intern_ = intern_; + } + /** * @param _scene */ public EbliWidgetTitle(EbliScene _scene, EGCourbe _cb,Point preferedLocation) { super(_scene); setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); - intern = new LabelWidget(_scene); - intern.setForeground(_cb.getAspectContour()); - addChild(intern); + intern_ = new LabelWidget(_scene); + intern_.setForeground(_cb.getAspectContour()); + addChild(intern_); setCourbe(_cb); setPreferredSize(new Dimension(WidgetLegendeManager.WIDTH_PER_LEGENDETEXT, WidgetLegendeManager.LENGHT_PER_LEGENDE)); @@ -47,15 +55,15 @@ WidgetAction editorAction = ActionFactory.createInplaceEditorAction (this); //-- ajout de l action au label correspondant --// - intern.getActions ().addAction (editorAction); + intern_.getActions ().addAction (editorAction); //setEnabled(false); } public void majLabel(){ - intern.setForeground(cb_.getAspectContour()); - intern.setLabel(cb_.getTitle()); - intern.setToolTipText(cb_.getTitle()); + intern_.setForeground(cb_.getAspectContour()); + intern_.setLabel(cb_.getTitle()); + intern_.setToolTipText(cb_.getTitle()); } // @Override @@ -76,7 +84,7 @@ public void setCourbe(EGCourbe _cb) { this.cb_ = _cb; if (cb_ != null) { - intern.setLabel(cb_.getTitle()); + intern_.setLabel(cb_.getTitle()); } } @@ -93,7 +101,7 @@ String texte = formatte(text); ((LabelWidget) widget).setLabel(texte); cb_.setTitle(texte); - intern.setToolTipText(texte); + intern_.setToolTipText(texte); } /** Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -1,7 +1,11 @@ package org.fudaa.ebli.visuallibrary.graphe; import java.awt.Dimension; +import java.awt.Font; import java.awt.Point; +import java.awt.Rectangle; +import java.util.Iterator; +import java.util.List; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGCourbe; @@ -12,6 +16,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.widget.Widget; import org.netbeans.modules.visual.layout.FlowLayout; /** @@ -33,7 +38,84 @@ * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); } + + + /** + * Creation de la classe widget specifique au calque. Permet de gerer le + * resize via le changement de font + * + */ + public static class WidgetCalqueLegende extends EbliWidget { + + Font oldFont_; + + public WidgetCalqueLegende(EbliScene scene, boolean _controller) { + super(scene, _controller); + oldFont_ = getFormeFont(); + } + + protected void paintWidget() { + + // -- mise a jour de la fonte que si il y a eu une modification --// + if (oldFont_ != getFormeFont()) { + + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { + EbliWidget new_widget = (EbliWidget) widget; + + EbliWidgetLine lw = null; + EbliWidgetTitle tw = null; + + if (new_widget.getChildren().get(0) instanceof EbliWidgetLine) + lw = (EbliWidgetLine) new_widget.getChildren().get(0); + else + tw = (EbliWidgetTitle) new_widget.getChildren().get(0); + + if (new_widget.getChildren().get(1) instanceof EbliWidgetLine) + lw = (EbliWidgetLine) new_widget.getChildren().get(1); + else + tw = (EbliWidgetTitle) new_widget.getChildren().get(1); + if (lw != null && tw != null) { + + tw.getIntern_().setFont(getFormeFont()); + + // resize du composant texte + Rectangle newBounds = tw.getIntern_().getBounds(); + newBounds.height += (getFormeFont().getSize() - oldFont_.getSize()) * 2; + newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; + tw.getIntern_().setPreferredBounds(newBounds); + + // resize pour le logo: forme carr\xE9 + Rectangle boundsLogo = lw.getBounds(); + boundsLogo.height = newBounds.height; + boundsLogo.width = newBounds.height; + lw.setPreferredBounds(boundsLogo); + + } + } + + } + // Resize de la widget + + Rectangle newBounds = getParentWidget().getBounds(); + newBounds.height += (listePlage.size() + 1) * (getFormeFont().getSize() - oldFont_.getSize()) * 2; + newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; + getParentWidget().setPreferredBounds(newBounds); + getEbliScene().refresh(); + oldFont_ = getFormeFont(); + + } + + } + + } + + /** * Creation de la legende * * @param g @@ -44,7 +126,7 @@ */ public static EbliWidget createLegende(final EGGraphe g, final EbliScene scene, final Point PreferredLocation) { final EGCourbe[] cs = g.getModel().getCourbes(); - final EbliWidget res = new EbliWidget(scene, false); + final WidgetCalqueLegende res = new WidgetCalqueLegende(scene, false); res.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5));// a // modifier // pour Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-29 16:15:44 UTC (rev 3852) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-08-29 17:05:47 UTC (rev 3853) @@ -165,25 +165,49 @@ JXCollapsiblePane pane = new JXCollapsiblePane(); JButton toggle = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); toggle.setText("Overview"); + pane.setCollapsed(true); + // -- ajout du bouton comme scrollpane selector --// + JPanel selector = new JPanel(); + selector.add(projet_.impl_.getMainPanel().getScrollDesktop_().getCorner(JScrollPane.LOWER_RIGHT_CORNER)); + selector.add(toggle); + projet_.impl_.getMainPanel().getScrollDesktop_().setCorner(JScrollPane.LOWER_RIGHT_CORNER, toggle);// selector + // ) + // ; + + JPanel over = new JPanel(new BorderLayout()); - over.add(toggle, BorderLayout.NORTH); + // over.add(toggle, BorderLayout.NORTH); over.add(pane, BorderLayout.CENTER); pane.add(getScene().createSatelliteView()); right.add(over, BorderLayout.NORTH); - pane = new JXCollapsiblePane(); - toggleTree_ = new JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); + // pane = new JXCollapsiblePane(); + // toggleTree_ = new + // JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); + // toggleTree_.setText("Composants"); + // + // panelTreeModifiable_ = new JScrollPane(contrRoller_.createTree()); + // // right.add(panelTreeModifiable_, BorderLayout.CENTER); + // conteneurTree_ = new JPanel(new BorderLayout()); + // conteneurTree_.add(toggleTree_, BorderLayout.NORTH); + // conteneurTree_.add(pane, BorderLayout.CENTER); + // pane.add(panelTreeModifiable_); + // right.add(conteneurTree_, BorderLayout.CENTER); + + + toggleTree_ = new JButton("Arbre"); toggleTree_.setText("Composants"); panelTreeModifiable_ = new JScrollPane(controller_.createTree()); // right.add(panelTreeModifiable_, BorderLayout.CENTER); conteneurTree_ = new JPanel(new BorderLayout()); - conteneurTree_.add(toggleTree_, BorderLayout.NORTH); - conteneurTree_.add(pane, BorderLayout.CENTER); - pane.add(panelTreeModifiable_); + // conteneurTree_.add(toggleTree_, BorderLayout.NORTH); + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + right.add(conteneurTree_, BorderLayout.CENTER); + // -- ajout du bouton qui permet de g\xE9rer tous les resultats BuButton boutonGestionMultiSrc = new BuButton("Gestion des projets"); @@ -209,6 +233,10 @@ getScene().refresh(); } } + + + + return right; } @@ -476,8 +504,11 @@ // panelTreeModifiable_ = new JScrollPane(component); this.toggleTree_.setText("Calques"); - + conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + // conteneurTree_.add(, BorderLayout.SOUTH); + + ... [truncated message content] |
From: <had...@us...> - 2008-09-01 20:11:24
|
Revision: 3862 http://fudaa.svn.sourceforge.net/fudaa/?rev=3862&view=rev Author: hadouxad Date: 2008-09-01 20:11:31 +0000 (Mon, 01 Sep 2008) Log Message: ----------- - utilisation de fontmetric pour rendre les retaillage des legendes plus propres - ajout de la palette d infos pour le calque - ajout de la jlist format toolbouton pour les variables - corriger bug duplicate: la legende fonctionne en cas de duplication Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurList.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.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/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetLine.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDataListener.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/TrPostVisuPanel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -832,9 +832,9 @@ } public void addCqLegende(final BCalqueLegende _leg) { + _leg.setName("cqLegende"); if (getCqInfos() != null) { removeCalqueLegend(); - _leg.setName("cqLegende"); getCqInfos().add(_leg); } else { addCqInfos(_leg); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliActionPaletteSpecAbstract.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -20,6 +20,10 @@ public abstract class EbliActionPaletteSpecAbstract extends EbliActionPaletteAbstract { protected transient BPalettePanelInterface palette_; + public BPalettePanelInterface getPalette_() { + return palette_; + } + protected boolean setDisableWhenHide_; protected Object target_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurList.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurList.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurList.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -19,16 +19,15 @@ import javax.swing.event.ListSelectionListener; import javax.swing.text.Position; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuLib; -import com.memoire.bu.BuPanel; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListModelSelectionEmpty; import org.fudaa.ctulu.gui.CtuluListModelEmpty; - import org.fudaa.ebli.commun.BPalettePanelInterface; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuPanel; + /** * @author Fred Deniger * @version $Id: BSelecteurList.java,v 1.1 2007-03-09 08:38:20 deniger Exp $ @@ -50,6 +49,10 @@ BSelecteurListTarget target_; // BControleVisible visible_; + public BSelecteurListTarget getTarget_() { + return target_; + } + static class SpecificHandler implements KeyListener { private String prefix_ = CtuluLibString.EMPTY_STRING; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BSelecteurListComboBox.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -18,17 +18,16 @@ import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreeSelectionModel; +import org.fudaa.ctulu.gui.CtuluComboBoxModelAdapter; +import org.fudaa.ctulu.gui.CtuluListModelEmpty; +import org.fudaa.ebli.commun.BPalettePanelInterface; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuComboBox; import com.memoire.bu.BuPanel; import com.memoire.fu.Fu; import com.memoire.fu.FuLog; -import org.fudaa.ctulu.gui.CtuluComboBoxModelAdapter; -import org.fudaa.ctulu.gui.CtuluListModelEmpty; - -import org.fudaa.ebli.commun.BPalettePanelInterface; - /** * @author Fred Deniger * @version $Id: BSelecteurListComboBox.java,v 1.1 2007-03-09 08:38:20 deniger Exp $ @@ -90,6 +89,7 @@ adapter_.addListDataListener(cbListener_); cb_.setEnabled(false); add(cb_, BuBorderLayout.CENTER); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -51,6 +51,8 @@ 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"; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -68,7 +68,7 @@ shaper_ = _shaper; // --mise a jour de la propriete graphique du traceligneModel de la map --// - propGraphique.put("lineModel", new TraceLigneModel(TraceLigne.LISSE, 5, getColorContour())); + propGraphique.put("lineModel", new TraceLigneModel(TraceLigne.LISSE, 2, getColorContour())); } @@ -88,6 +88,7 @@ // -- mise a jour de la couleur du contour --// getTraceLigneModel().setCouleur(getColorContour()); + AffineTransform oldTr = g.getTransform(); g.translate(recInit.x, recInit.y); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/WidgetConfigure.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -72,6 +72,7 @@ if (lineModel_) { BSelecteurLineModel modelL = new BSelecteurLineModel(EbliWidget.LINEMODEL); modelL.setAddColor(false); + listeComposants.add((BSelecteurInterface) modelL); } // -- model des colors contours --// @@ -81,6 +82,8 @@ listeComposants.add((BSelecteurInterface) modelCc); } + + // -- model des colors de fond --// if (colorFonds_) { BSelecteurColorChooserBt modelCf = new BSelecteurColorChooserBt(EbliWidget.COLORFOND); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -7,6 +7,7 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.Font; +import java.awt.FontMetrics; import java.awt.Point; import java.awt.Rectangle; import java.util.Iterator; @@ -27,6 +28,8 @@ import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.LabelWidget.Alignment; +import org.netbeans.api.visual.widget.LabelWidget.VerticalAlignment; import org.netbeans.modules.visual.layout.FlowLayout; import com.memoire.fu.FuLog; @@ -41,17 +44,18 @@ EbliScene scene_; BCalqueLegendePanel legendePanel_; - + public static int LENGHT_PER_LEGENDE = 15; public static int WIDTH_PER_LEGENDEICON = 10; public static int WIDTH_PER_LEGENDETEXT = 130; public static int WIDTH_LEGENDE = 200; - + public static int MAX_BORDURE = 12; + public static Dimension createSizeForWidget(int _nbLibelles) { return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); } - + public EbliWidgetCalqueLegende(EbliScene _scene) { super(); scene_ = _scene; @@ -62,10 +66,10 @@ */ @Override protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { - + legendePanel_ = _pnLeg; - // createLegende(); + // createLegende(); } /** @@ -84,8 +88,7 @@ // // EbliWidgetCreatorLegende(legendePanel_); // // legendePanel_.setDoubleBuffered(false); // // BuLib.setDoubleBuffered(legendePanel_, false); - - + EbliNodeDefault def = new EbliNodeDefault(); def.setPreferedLocation(new Point(200, 200)); // def.setPreferedSize(new Dimension(150, 250)); @@ -98,6 +101,17 @@ return def; } + static class MetricLegend extends FontMetrics { + + // protected MetricLegend(Font font) { + // super(font); + // } + public MetricLegend(Font font) { + super(font); + } + + } + /** * Creation de la classe widget specifique au calque. Permet de gerer le * resize via le changement de font @@ -112,12 +126,44 @@ oldFont_ = getFormeFont(); } + protected Rectangle resizeMaxLegende() { + this.getGraphics().setFont(getFormeFont()); + int maxHeight = 0; + int maxWidth = 0; + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidgetPlageTitle) { + EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; + + // -- recuperation des tailles des font pour les textes saisies + + FontMetrics ftm = this.getGraphics().getFontMetrics(); + + int newWidth = ftm.stringWidth(new_widget.getIntern().getLabel()); + int newHeight = ftm.getHeight(); + if (maxWidth < newWidth) + maxWidth = newWidth; + maxHeight = newHeight; + + } + + } + Rectangle newBounds = new Rectangle(); + newBounds.height /* + */= maxHeight; + newBounds.width /* + */= maxWidth; + + return newBounds; + } + protected void paintWidget() { - // -- mise a jour de la fonte que si il y a eu une modification --// if (oldFont_ != getFormeFont()) { - - + // -- calcul des max height et width pour resize les composants --// + Rectangle newBounds = resizeMaxLegende(); + // -- mise a jour de la widget avec la nouvelle font List<Widget> listePlage = getChildren(); for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { @@ -125,50 +171,48 @@ // -- test si il s agit d un widget plage --// if (widget instanceof EbliWidgetPlageTitle) { EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; - new_widget.getIntern_().setFont(getFormeFont()); + new_widget.getIntern().setFont(getFormeFont()); - // resize du composant texte - Rectangle newBounds = new_widget.getIntern_().getBounds(); - newBounds.height += (getFormeFont().getSize() - oldFont_.getSize()) * 2; - newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; - new_widget.getIntern_().setPreferredBounds(newBounds); - + FuLog.warning("TAILLE TITLE DES WIDGETS: " + new_widget.getIntern().getLabel()); + // -- mise du nouveau bounds max --// + Rectangle boundsIntern = new_widget.getIntern().getBounds(); + boundsIntern.width = newBounds.width; + boundsIntern.height = (int) (newBounds.height); + + new_widget.getIntern().setPreferredBounds(boundsIntern); + // resize pour le logo: forme carr\xE9 Rectangle boundsLogo = new_widget.getLogo_().getBounds(); - boundsLogo.height = newBounds.height; - boundsLogo.width = newBounds.height; - new_widget.getLogo_().setPreferredBounds(boundsLogo); - // setPreferredSize(new Dimension(newBounds.width, - // newBounds.height)); - + boundsLogo.height = (int) (newBounds.height); + boundsLogo.width = (int) (newBounds.height); + new_widget.getLogo_().setPreferredBounds(boundsLogo); + } else if (widget instanceof LabelWidget) { LabelWidget new_widget = (LabelWidget) widget; + new_widget.setFont(getFormeFont()); - - // resize du composant - Rectangle newBounds = new_widget.getBounds(); - newBounds.height += (getFormeFont().getSize() - oldFont_.getSize()) * 2; - newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; - new_widget.setPreferredBounds(newBounds); + Rectangle boundsTitre = new_widget.getBounds(); + boundsTitre.width = newBounds.width; + boundsTitre.height = (int) (newBounds.height); + new_widget.setPreferredBounds(boundsTitre); } - + } // Resize de la widget - - Rectangle newBounds = getParentWidget().getBounds(); - newBounds.height += (listePlage.size() + 1) * (getFormeFont().getSize() - oldFont_.getSize()) * 2; - newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; - getParentWidget().setPreferredBounds(newBounds); + + Rectangle newBoundConteneurs = getParentWidget().getBounds(); + newBoundConteneurs.height = (int) ((listePlage.size() + 1) * (newBounds.height * 1.5));// ( + newBoundConteneurs.width = (int) (newBounds.width * 1.5); + getParentWidget().setPreferredBounds(newBoundConteneurs); getEbliScene().refresh(); oldFont_ = getFormeFont(); - + } } } - - + /** * Mananger statique qui se charge de creer \xE9a widget associee au calque. * @@ -180,66 +224,64 @@ */ public static EbliWidget createLegendeWidget(BCalqueLegendePanel _calqueLegende, EbliScene _scene) { - // --creation de la widget conteneur --// BPalettePlageInterface listeplages = null; WidgetCalqueLegende widgetLegende_ = new WidgetCalqueLegende(_scene, false); widgetLegende_.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); - + if (_calqueLegende != null) { - Component[] listeC=_calqueLegende.getComponents(); - - for(int i=0;i<listeC.length;i++){ - Component c=listeC[i]; - FuLog.warning(i + ") " + c); - if (c instanceof JLabel) { - FuLog.warning(" " + ((JLabel) c).getText()); - - LabelWidget titre = new LabelWidget(_scene); - titre.setLabel(((JLabel) c).getText()); - titre.setEnabled(false); - widgetLegende_.addChild(titre); - } + Component[] listeC = _calqueLegende.getComponents(); - if (c instanceof BPalettePlageLegende) { - BPalettePlageLegende pal = (BPalettePlageLegende) c; - - // --recuperation de la liste des plages --// + for (int i = 0; i < listeC.length; i++) { + Component c = listeC[i]; + FuLog.warning(i + ") " + c); + if (c instanceof JLabel) { + FuLog.warning(" " + ((JLabel) c).getText()); + + LabelWidget titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(((JLabel) c).getText()); + titre.setEnabled(false); + widgetLegende_.addChild(titre); + } + + if (c instanceof BPalettePlageLegende) { + BPalettePlageLegende pal = (BPalettePlageLegende) c; + + // --recuperation de la liste des plages --// listeplages = pal.getModel(); - - for (int j = 0; j < listeplages.getNbPlages(); j++) { - - BPlageInterface plage = listeplages.getPlageInterface(j); - FuLog.warning("jlist " + j + ") " + plage.getLegende()); - - - // -- ajout d'une widget plage --// - EbliWidgetPlageTitle lw = new EbliWidgetPlageTitle(_scene, plage, null); - - lw.setUseBorder(false); - lw.setEnabled(false); - lw.setEnabled(false); - widgetLegende_.addChild(lw); - - - + + for (int j = 0; j < listeplages.getNbPlages(); j++) { + + BPlageInterface plage = listeplages.getPlageInterface(j); + FuLog.warning("jlist " + j + ") " + plage.getLegende()); + + // -- ajout d'une widget plage --// + EbliWidgetPlageTitle lw = new EbliWidgetPlageTitle(_scene, plage, null); + + lw.setUseBorder(false); + lw.setEnabled(false); + lw.setEnabled(false); + widgetLegende_.addChild(lw); + + } + } - + } - - } - - widgetLegende_.setController_(new EbliWidgetControllerMenuOnly(widgetLegende_, false)); - // -- creation de la taille de la widget --// - if (listeplages != null) - widgetLegende_.setPreferredSize(createSizeForWidget(listeplages.getNbPlages() + 1)); - - - - return widgetLegende_; - } else + widgetLegende_.setController_(new EbliWidgetControllerMenuOnly(widgetLegende_, false)); + + // -- prendre en compte le resize automatique --// + widgetLegende_.oldFont_ = new Font("Helvetica", Font.BOLD, 40); + widgetLegende_.repaint(); + + return widgetLegende_; + } else { + FuLog.warning("createLegendeWidget retourne widget null"); return null; + } } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -165,8 +165,11 @@ Point nouvellePosition = new Point((int) (widget_.getLocation().x), (int) (widget_.getLocation().y + widget_ .getBounds().height * 1.2)); - if (!widget_.getEbliScene().isObject(getNodeLegende()) && legendeWidget_ != null) { + if (!widget_.getEbliScene().isObject(getNodeLegende())) { + if (this.legendeWidget_ == null) { + legendeWidget_ = (EbliWidgetCalqueLegende) widgetCalque_.calquePanel_.getCqLegend(); + } // -- creation de la legende setNodeLegende(legendeWidget_.createLegende()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -36,10 +36,13 @@ } public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetBordure(EbliWidgetCalqueLegende.createLegendeWidget(g, _scene), true, false); + EbliWidget widgetLegende_=EbliWidgetCalqueLegende.createLegendeWidget(g, _scene); + res = new EbliWidgetBordure(widgetLegende_, true, false); // g.getModel().addModelListener(new EbliWidgetGrapheController(res)); + + return res; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorVueCalque.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -18,6 +18,14 @@ ZEbliCalquesPanel calque_; + + /** + * parametre qui n est rensginee que dans le cas d une duplication. Sinon c + * est cree des le debut avec le bon ebliwidgetCalqueLegende qui va. + */ + // public EbliWidgetCalqueLegende legendeDuplic_; + + public ZEbliCalquesPanel getCalque() { return calque_; } @@ -35,14 +43,14 @@ public EbliWidgetCreatorVueCalque(ZEbliCalquesPanel calque) { - super(); - this.calque_ = calque; + this(calque, null); } public EbliWidgetCreatorVueCalque(ZEbliCalquesPanel calque, GrBoite _initZoom) { super(); this.calque_ = calque; initZoom_ = _initZoom; + // legendeDuplic_= } public EbliWidget create(EbliScene _scene) { @@ -75,10 +83,18 @@ Map duplicOptions = new HashMap(); duplicOptions.put("scene", getWidget().getEbliScene()); - duplique.setCreator(new EbliWidgetCreatorVueCalque(getCalque().duplicate(duplicOptions), getCalque().getVueCalque() - .getViewBoite())); + EbliWidgetCreatorVueCalque creator = new EbliWidgetCreatorVueCalque(getCalque().duplicate(duplicOptions), + getCalque().getVueCalque().getViewBoite()); + duplique.setCreator(creator); + + + // -- ajout de la reference de la legende dans le widget calque --// + // ((EbliWidgetControllerCalque) + // creator.getWidgetCalque().getController_()).legendeWidget_ = + // calqueLegende; + duplique.setTitle(_nodeAdupliquer.getTitle()); // recopie des tailles duplique.setPreferedSize(_nodeAdupliquer.getPreferedSize()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -1,6 +1,5 @@ package org.fudaa.ebli.visuallibrary.calque; -import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; @@ -31,12 +30,12 @@ BPlageInterface plage_; // LabelWidget intern_; - - public class internWidget extends LabelWidget implements TextFieldInplaceEditor { - public internWidget(Scene scene) { + public class InternWidget extends LabelWidget implements TextFieldInplaceEditor { + + public InternWidget(Scene scene) { super(scene); - setLayout(new FlowLayout(false, SerialAlignment.CENTER, 0)); + setVerticalAlignment(VerticalAlignment.CENTER); } public String getText(Widget widget) { @@ -55,12 +54,14 @@ } } - internWidget intern_; - public internWidget getIntern_() { + + InternWidget intern_; + + public InternWidget getIntern() { return intern_; } - public void setIntern_(internWidget intern_) { + public void setIntern(InternWidget intern_) { this.intern_ = intern_; } @@ -73,45 +74,37 @@ } EbliWidget logo_; + /** * @param _scene */ public EbliWidgetPlageTitle(EbliScene _scene, BPlageInterface _cb, Point preferedLocation) { super(_scene); plage_ = _cb; - + setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); - setEnabled(false); - + // setEnabled(false); + logo_ = new EbliWidget(_scene) { protected void paintWidget() { Graphics2D g = getGraphics(); g.setColor(plage_.getCouleur()); Rectangle newBounds = getBounds(); - g.fillRect(0, 0, newBounds.width/* - * EbliWidgetCalqueLegende.WIDTH_PER_LEGENDEICON - */, newBounds.height/* - * EbliWidgetCalqueLegende. - * LENGHT_PER_LEGENDE - */); + g.fillRect(0, 0, newBounds.width, newBounds.height); } }; - logo_.setPreferredSize(new Dimension(EbliWidgetCalqueLegende.WIDTH_PER_LEGENDEICON, - EbliWidgetCalqueLegende.LENGHT_PER_LEGENDE)); - logo_.setEnabled(false); + + logo_.setEnabled(false); addChild(logo_); - - + // -- creation de la legende --// - intern_ = new internWidget(_scene); - intern_.setPreferredSize(new Dimension(EbliWidgetCalqueLegende.WIDTH_PER_LEGENDETEXT, - EbliWidgetCalqueLegende.LENGHT_PER_LEGENDE)); + intern_ = new InternWidget(_scene); + intern_.setLabel(_cb.getLegende()); - + intern_.setForeground(_cb.getCouleur()); setToolTipText(_cb.getLegende()); addChild(intern_); - // -- ajouter l option de remplacer le text dans le label --// @@ -125,7 +118,7 @@ } public void majLabel() { - intern_.setForeground(plage_.getCouleur()); + intern_.setForeground(plage_.getCouleur()); intern_.setLabel(plage_.getLegende()); } @@ -155,13 +148,10 @@ public String formatte(String texte) { if (texte.length() < plage_.getLegende().length()) { - return texte; } else return texte.substring(0, plage_.getLegende().length()); } - - } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -20,7 +20,6 @@ import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.BCalque; -import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -73,9 +72,9 @@ setPreferredSize(new Dimension(500, 400)); initSize(new Rectangle(0, 0, 500, 400)); + + // _vue.addCqLegende(new BCalqueLegende()); - _vue.addCqLegende(new BCalqueLegende()); - // --ajout du controller specifique au graphe --// this.setController_(new EbliWidgetControllerCalque(this)); @@ -104,6 +103,7 @@ // // }); // conteneurEditor.add(fonctionsCompletes, BorderLayout.SOUTH); + return calquePanel_; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetLine.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetLine.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -1,6 +1,5 @@ package org.fudaa.ebli.visuallibrary.graphe; -import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; @@ -29,9 +28,7 @@ public EbliWidgetLine(EbliScene _scene, EGCourbe _cb, Point preferedLocation) { super(_scene, true); cb_ = _cb; - // setMinimumSize(new Dimension(30, 10)); - setPreferredSize(new Dimension(WidgetLegendeManager.WIDTH_PER_LEGENDEICON, - WidgetLegendeManager.LENGHT_PER_LEGENDE)); + setEnabled(false); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetTitle.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -1,6 +1,5 @@ package org.fudaa.ebli.visuallibrary.graphe; -import java.awt.Dimension; import java.awt.Point; import org.fudaa.ebli.courbe.EGCourbe; @@ -45,10 +44,7 @@ intern_ = new LabelWidget(_scene); intern_.setForeground(_cb.getAspectContour()); addChild(intern_); - setCourbe(_cb); - setPreferredSize(new Dimension(WidgetLegendeManager.WIDTH_PER_LEGENDETEXT, - WidgetLegendeManager.LENGHT_PER_LEGENDE)); - + setCourbe(_cb); //-- ajouter l option de remplacer le text dans le label --// //-- creation de l action --// Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/WidgetLegendeManager.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -2,6 +2,7 @@ import java.awt.Dimension; import java.awt.Font; +import java.awt.FontMetrics; import java.awt.Point; import java.awt.Rectangle; import java.util.Iterator; @@ -54,12 +55,57 @@ super(scene, _controller); oldFont_ = getFormeFont(); } + + + protected Rectangle resizeMaxLegende() { + this.getGraphics().setFont(getFormeFont()); + int maxHeight = 0; + int maxWidth = 0; + // -- mise a jour de la widget avec la nouvelle font + List<Widget> listePlage = getChildren(); + for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { + Widget widget = it.next(); + // -- test si il s agit d un widget plage --// + if (widget instanceof EbliWidget && widget.getChildren().size() == 2) { + EbliWidget new_widget = (EbliWidget) widget; + EbliWidgetTitle tw = null; + + if (new_widget.getChildren().get(0) instanceof EbliWidgetTitle) + tw = (EbliWidgetTitle) new_widget.getChildren().get(0); + else + if (new_widget.getChildren().get(1) instanceof EbliWidgetTitle) + tw = (EbliWidgetTitle) new_widget.getChildren().get(1); + + if (tw != null) { + // -- recuperation des tailles des font pour les textes saisies + + FontMetrics ftm = this.getGraphics().getFontMetrics(); + + int newWidth = ftm.stringWidth(tw.intern_.getLabel()); + int newHeight = ftm.getHeight(); + if (maxWidth < newWidth) + maxWidth = newWidth; + maxHeight = newHeight; + } + } + + } + Rectangle newBounds = new Rectangle(); + newBounds.height /* + */= maxHeight; + newBounds.width /* + */= maxWidth; + + return newBounds; + } + protected void paintWidget() { // -- mise a jour de la fonte que si il y a eu une modification --// if (oldFont_ != getFormeFont()) { + // -- calcul des max height et width pour resize les composants --// + Rectangle newBounds = resizeMaxLegende(); + // -- mise a jour de la widget avec la nouvelle font List<Widget> listePlage = getChildren(); for (Iterator<Widget> it = listePlage.iterator(); it.hasNext();) { @@ -85,15 +131,21 @@ tw.getIntern_().setFont(getFormeFont()); // resize du composant texte - Rectangle newBounds = tw.getIntern_().getBounds(); - newBounds.height += (getFormeFont().getSize() - oldFont_.getSize()) * 2; - newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; - tw.getIntern_().setPreferredBounds(newBounds); + Rectangle internBounds = tw.getIntern_().getBounds(); + // internBounds.height += (getFormeFont().getSize() - + // oldFont_.getSize()) * 2; + // internBounds.width += (getFormeFont().getSize() - + // oldFont_.getSize()) * 12; + internBounds.width = newBounds.width; + internBounds.height = (int) (newBounds.height); + tw.getIntern_().setPreferredBounds(internBounds); // resize pour le logo: forme carr\xE9 Rectangle boundsLogo = lw.getBounds(); - boundsLogo.height = newBounds.height; - boundsLogo.width = newBounds.height; + // boundsLogo.height = internBounds.height; + // boundsLogo.width = internBounds.height; + boundsLogo.height = (int) (newBounds.height); + boundsLogo.width = (int) (newBounds.height); lw.setPreferredBounds(boundsLogo); } @@ -102,10 +154,16 @@ } // Resize de la widget - Rectangle newBounds = getParentWidget().getBounds(); - newBounds.height += (listePlage.size() + 1) * (getFormeFont().getSize() - oldFont_.getSize()) * 2; - newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * 12; - getParentWidget().setPreferredBounds(newBounds); + // Rectangle newBounds = getParentWidget().getBounds(); + // newBounds.height += (listePlage.size() + 1) * + // (getFormeFont().getSize() - oldFont_.getSize()) * 2; + // newBounds.width += (getFormeFont().getSize() - oldFont_.getSize()) * + // 12; + // getParentWidget().setPreferredBounds(newBounds); + Rectangle newBoundConteneurs = getParentWidget().getBounds(); + newBoundConteneurs.height = (int) ((listePlage.size() + 1) * newBounds.height * 1.5);// ( + newBoundConteneurs.width = (int) (newBounds.width * 1.5); + getParentWidget().setPreferredBounds(newBoundConteneurs); getEbliScene().refresh(); oldFont_ = getFormeFont(); @@ -188,8 +246,10 @@ res.setController_(new EbliWidgetControllerMenuOnly(res, false)); - // -- creation de la taille de la widget --// - res.setPreferredSize(createSizeForWidget(cs.length)); + + // -- prendre en compte le resize automatique --// + res.oldFont_ = new Font("Helvetica", Font.BOLD, 40); + res.repaint(); return res; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -16,28 +16,26 @@ import javax.swing.Action; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuBorders; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuList; -import com.memoire.bu.BuResource; -import com.memoire.bu.BuScrollPane; -import com.memoire.fu.FuComparator; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.ProgressionBuAdapter; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGGraphe; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuBorders; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuList; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; +import com.memoire.fu.FuComparator; + +//TODO a modifier class TrPostCourbeAddVariableAction extends EbliActionSimple { final FudaaCommonImplementation impl_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -20,30 +20,27 @@ import java.util.Map; import java.util.Set; -import com.memoire.bu.BuLib; -import com.memoire.fu.FuComparator; -import com.memoire.fu.FuEmptyArrays; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; - import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuLib; +import com.memoire.fu.FuComparator; +import com.memoire.fu.FuEmptyArrays; +import com.memoire.fu.FuLog; + public class TrPostCourbeTreeModel extends EGGrapheTreeModel implements TrPostTimeContentListener { private final boolean isAllTimeStep_; @@ -58,6 +55,7 @@ int[] objIdx_; + // les sources devront etre affectees au CourbeModel final TrPostSource src_; double[] timeSteps_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDataListener.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDataListener.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDataListener.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -12,6 +12,8 @@ import org.fudaa.dodico.h2d.type.H2dVariableType; /** + * TODO a changer pour preciser la source + * * @author Fred Deniger * @version $Id: TrPostDataListener.java,v 1.3 2006-09-19 15:07:27 deniger Exp $ */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -21,17 +21,24 @@ import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; +import org.fudaa.ebli.calque.action.EbliCalqueActionVariableChooser; import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BSelecteurList; +import org.fudaa.ebli.controle.BSelecteurListComboBox; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGSpecificActions; import org.fudaa.ebli.courbe.EGTree; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCalqueLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; @@ -86,8 +93,11 @@ * Scroll qui contient le tree a droite. Ce panel est modifi\xE9 des que l on change de type d elements. */ JScrollPane panelTreeModifiable_; - /** + * palette d infos pour le calque associe. + */ + JComponent palette_; + /** * Panel qui contient le tree modifiable */ JPanel conteneurTree_; @@ -113,7 +123,8 @@ // -- enregistrement de this comem listener de la scene pour le type d objet // selection changed--// - controller_.getScene().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED); + controller_.getScene().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, + ObjectSceneEventType.OBJECT_STATE_CHANGED); // -- ajout de la toolbar et du menu en haut --// toolBarModifiable_.setFloatable(false); @@ -407,8 +418,11 @@ * @param newState the new object state */ public void objectStateChanged(ObjectSceneEvent event, Object changedObject, ObjectState previousState, - ObjectState newState) {} + ObjectState newState) { + System.err.println("ucu"); + } + /** * Called to notify that the object-selection is changed. * @@ -509,8 +523,20 @@ // conteneurTree_.add(, BorderLayout.SOUTH); + // -- ajout de la toolBar d'infos au sud --// + TrPostActionController controller = (TrPostActionController) _calque.getController(); + EbliActionPaletteAbstract pal = controller.getPaletteAction("INFOS"); + if (pal != null) { + pal.updateBeforeShow(); + pal.setSelected(true); + palette_ = pal.buildContentPane(); + conteneurTree_.add(palette_, BorderLayout.SOUTH); + } + + // mise a jour du panel conteneurTree_.validate(); + panelTreeModifiable_.revalidate(); } @@ -522,6 +548,8 @@ private void changeTreeGraphe(EGGraphe _graphe) { conteneurTree_.remove(panelTreeModifiable_); + if (palette_ != null) + conteneurTree_.remove(palette_); // JComponent component = EbliWidgetEditCreator.createView(new // JTree((EGGrapheTreeModel) _graphe.getModel()), // EbliResource.EBLI.getToolIcon("arbre"), "Courbes", false); @@ -549,10 +577,10 @@ */ private void changeTreeScene() { conteneurTree_.remove(panelTreeModifiable_); - // JComponent component = - // EbliWidgetEditCreator.createView(controller_.createTree(), - // EbliResource.EBLI - // .getToolIcon("arbre"), "Composants", false); + if (palette_ != null) + conteneurTree_.remove(palette_); + JComponent component = EbliWidgetEditCreator.createView(controller_.createTree(), EbliResource.EBLI + .getToolIcon("arbre"), "Composants", false); panelTreeModifiable_ = new JScrollPane(controller_.createTree()); if (this.toggleTree_ != null) this.toggleTree_.setText("Liste des composants"); @@ -594,6 +622,43 @@ menuModifiable_.add(specificMenus[i]); } + + // -- ajout des comboBox des variables --// + EbliCalqueActionVariableChooser chooser = new EbliCalqueActionVariableChooser(_calque.getArbreCalqueModel()); + // obligatoire pour creer le BselecteurList + chooser.buildContentPane(); + chooser.updateBeforeShow(); + BSelecteurList listselector = (BSelecteurList) chooser.getPalette_(); + BSelecteurListComboBox combo = new BSelecteurListComboBox(); + combo.setPalettePanelTarget(listselector.getTarget_()); + combo.setMaximumSize(combo.getPreferredSize()); + + // ajout combobox + toolBarModifiable_.add(chooser.buildToolButton(EbliComponentFactory.INSTANCE)); + // combo.setToolTipText(); + toolBarModifiable_.add(combo); + + + + EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(_calque.getArbreCalqueModel()); + // obligatoire pour creer le BselecteurList + chooserT.buildContentPane(); + chooserT.updateBeforeShow(); + listselector = (BSelecteurList) chooserT.getPalette_(); + combo = new BSelecteurListComboBox(); + combo.setPalettePanelTarget(listselector.getTarget_()); + combo.setMaximumSize(combo.getPreferredSize()); + + // ajout combobox + toolBarModifiable_.add(chooserT.buildToolButton(EbliComponentFactory.INSTANCE)); + // combo.setToolTipText(); + toolBarModifiable_.add(combo); + + // ajout bouton toolbar + + + + // mise a jour des params toolBarModifiable_.revalidate(); menuModifiable_.revalidate(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-09-01 14:56:43 UTC (rev 3861) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-09-01 20:11:31 UTC (rev 3862) @@ -85,7 +85,9 @@ } public String getEnableCondition() { - if (rubar_) { return TrResource.getS("S\xE9lectionner au moins \xE9l\xE9ment"); } + if (rubar_) { + return TrResource.getS("S\xE9lectionner au moins \xE9l\xE9ment"); + } return new StringBuffer().append(EbliLib.getS("S\xE9lectionner au moins noeud")).append("<br>").append( CtuluResource.CTULU.getString("ou")).append("<br>").append(TrResource.getS("sonder un point")).toString(); } @@ -124,33 +126,34 @@ public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, BCalqueLegende _leg) { this(_impl, _controller, false, _leg, _controller.getSource(0)); } - + public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, BCalqueLegende _leg, TrPostSource _indiceSOURCECourant) { this(_impl, _controller, false, _leg, _indiceSOURCECourant); - - + } public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, boolean _simplified, BCalqueLegende _leg) { this(_impl, _controller, _simplified, _leg, _controller.getSource(0)); - } - + /** - * @param _impl l'impl parent - * @param _controller le controller contenant la source - * @param _indiceSOURCECourant : l indice de la source courante utilis\xE9e + * @param _impl + * l'impl parent + * @param _controller + * le controller contenant la source + * @param _indiceSOURCECourant + * : l indice de la source courante utilis\xE9e */ public TrPostVisuPanel(final FudaaCommonImplementation _impl, final TrPostProjet _controller, boolean _simplified, BCalqueLegende _leg, TrPostSource _indiceSOURCECourant) { super(new TrPostActionController(_impl), _impl); - - // -- mise a jour de l indice de ls source courante --// + + // -- mise a jour de l indice de ls source courante --// sourceCourante_ = _indiceSOURCECourant; - + srcCont_ = _controller; info_ = new TrPostInfoDelegate(sourceCourante_, getEbliFormatter()); addCqInfos(sourceCourante_.getGrid()); @@ -185,7 +188,7 @@ gc.putClientProperty(Action.SHORT_DESCRIPTION, TrResource.getS("Affichage des images de fond")); getArbreCalqueModel().setSelectionCalque(isoLayer_); // TODO Fred a enlever - removeCalqueLegend(); + // removeCalqueLegend(); suiviPanel_ = (JPanel) CtuluLibSwing.findChildByName(this, "pnSuivis"); remove(suiviPanel_); @@ -295,8 +298,9 @@ } public int[] getSelectionForEvolution() { - if (getCalqueActif() instanceof ZCalqueAffichageDonnees) { return ((ZCalqueAffichageDonnees) getCalqueActif()) - .getSelectedIndex(); } + if (getCalqueActif() instanceof ZCalqueAffichageDonnees) { + return ((ZCalqueAffichageDonnees) getCalqueActif()).getSelectedIndex(); + } return null; } @@ -415,7 +419,8 @@ } /* - * protected void anim(){ if (anim_ == null) anim_ = new EbliAnimation(this); anim_.go(); } + * protected void anim(){ if (anim_ == null) anim_ = new EbliAnimation(this); + * anim_.go(); } */ public void dataRemoved(final H2dVariableType[] _vars, final boolean _isFleche) { @@ -485,14 +490,12 @@ } public void startExport(final CtuluUI _impl) { - TrPostVisuPanel.startExport((FudaaCommonImplementation) _impl, sourceCourante_, super - .getCurrentSelection()); + TrPostVisuPanel.startExport((FudaaCommonImplementation) _impl, sourceCourante_, super.getCurrentSelection()); } public void view3D(final JFrame _f) { - Tr3DFactory.afficheFrame(_f, sourceCourante_, sourceCourante_.getInterpolator() - .getVect(), getImpl(), getGroupFond(), - getFrontierLayer3D()); + Tr3DFactory.afficheFrame(_f, sourceCourante_, sourceCourante_.getInterpolator().getVect(), getImpl(), + getGroupFond(), getFrontierLayer3D()); } @@ -501,9 +504,12 @@ } /** - * @param _impl l'implementation - * @param _src la source - * @param _selection la selection + * @param _impl + * l'implementation + * @param _src + * la source + * @param _selection + * la selection */ public static void startExport(final CtuluUI _impl, final TrPostSource _src, final MvSelectionNodeOrEltData _selection) { TrExportFactory fac = null; @@ -529,12 +535,15 @@ } /** - * duplication du trPostVisuPanel. surcharge de la duplication du zeblicalquePanel. + * duplication du trPostVisuPanel. surcharge de la duplication du + * zeblicalquePanel. */ public TrPostVisuPanel duplicate(Map _options) { final TrPostVisuPanel duplic = new TrPostVisuPanel(this.getImpl(), this.getProjet(), new EbliWidgetCalqueLegende( (EbliScene) _options.get("scene"))); + System.err.println(duplic.getCqLegend()); + // -- sauvegarde de l etat --// BCalqueSaverInterface savedData = getDonneesCalque().getPersistenceMng().save(getDonneesCalque(), null); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-02 16:29:29
|
Revision: 3863 http://fudaa.svn.sourceforge.net/fudaa/?rev=3863&view=rev Author: hadouxad Date: 2008-09-02 16:29:18 +0000 (Tue, 02 Sep 2008) Log Message: ----------- - corriger bug legendes aligns marche pas - corriger bug edition des legendes calques - ajout de l action de parametrage des legendes depuis la toolbar du calque - edition de la legende calque: lors du clic sur la legende, affiche la palette de configuration des legendes. - edition ok pour la legende - ajouter toutes les legendes liees au calques: a chaque changement de variables, cela a pour effet de modifier la legende - gestion des suppression/masquages et undo/redo synchronises calques/ multi legendes (pour le moment c est gerer pour le seul calque que je croyais unique... ) - ajout des libelles au calque (hauteur d eau) et possibilit?\195?\169 de le modifier via l editeur incorpor?\195?\169 Gestion des graphes: - modification du creator du graphe: il contient une r?\195?\169f?\195?\169rence vers le calque qui l'a g?\195?\169n?\195?\169r?\195?\169 - creation des actions permettant d ajouter un point dans le graphe pour fonctionner: il faut choisir un point sur le widget calque et ensuite retourner dans l edition de la widget graphe puis cliquer sur l action. - Creation de l action permettant d ajouter des variables dans le graphe: Marche OK Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.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/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -68,9 +68,17 @@ } + /** + * @see hasWidget() + * @return EbliWidget + */ + public EbliWidget getWidget() { + return creator.getWidget(); + } + public boolean isMovable() { // TODO Auto-generated method stub - return (hasWidget() && getPreferedLocation() != null && getPreferedSize() != null); + return (hasWidget() && getPreferedLocation() != null && getWidget().getBounds() != null); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -1,17 +1,11 @@ package org.fudaa.ebli.visuallibrary; import java.awt.Point; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.Collections; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.graph.GraphScene; @@ -250,44 +244,45 @@ } public void setMenuBase() { - getActions().addAction(ActionFactory.createPopupMenuAction(new PopupMenuProvider() { - public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { - JPopupMenu popup = new JPopupMenu(); - - JMenuItem menuItem1 = popup.add("Ajouter Graphe"); - menuItem1.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - } - - }); - - JMenuItem menuItem2 = popup.add("Ajouter Maillage"); - menuItem2.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - } - - }); - - JMenuItem menuItem3 = popup.add("Fermer l'objet"); - menuItem3.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - // fermeture des widgets children - EbliScene.this.removeChildren(); - // fermeture du widget donne - EbliScene.this.removeFromParent(); - - } - - }); - return popup; - } - })); + // getActions().addAction(ActionFactory.createPopupMenuAction(new + // PopupMenuProvider() { + // public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { + // JPopupMenu popup = new JPopupMenu(); + // + // JMenuItem menuItem1 = popup.add("Ajouter Graphe"); + // menuItem1.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // + // } + // + // }); + // + // JMenuItem menuItem2 = popup.add("Ajouter Maillage"); + // menuItem2.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // + // } + // + // }); + // + // JMenuItem menuItem3 = popup.add("Fermer l'objet"); + // menuItem3.addActionListener(new ActionListener() { + // + // public void actionPerformed(ActionEvent e) { + // + // // fermeture des widgets children + // EbliScene.this.removeChildren(); + // // fermeture du widget donne + // EbliScene.this.removeFromParent(); + // + // } + // + // }); + // return popup; + // } + // })); } public void setVisu_(LayerWidget visu_) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -27,6 +27,9 @@ EbliWidget intern_; + + + public float epaisseurHisto_ = 0; /** * constructeur qui gere un controller uniquement pour les actions. @@ -202,6 +205,12 @@ this.intern_.setRotation((Double) propGraphique.get(ROTATION)); } + public EbliWidget getIntern() { + return intern_; + } + public void setIntern(EbliWidget _intern) { + intern_ = _intern; + } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -1,8 +1,6 @@ package org.fudaa.ebli.visuallibrary.actions; -import java.awt.Dimension; import java.awt.Point; -import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Iterator; @@ -12,14 +10,13 @@ import javax.swing.Icon; import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluCommandManager; 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.netbeans.api.visual.widget.Widget; -import sun.security.action.GetLongAction; +import com.memoire.fu.FuLog; /** * Action qui permet de realiser l alignement des composants. @@ -316,7 +313,10 @@ for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode currentNode = it.next(); + FuLog.warning("current node movable: " + currentNode.getTitle()); if (currentNode.isMovable()) { + + Widget widget = scene_.findWidget(currentNode); widgetToMove.add(widget); oldSize.add(widget.getPreferredLocation()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -10,21 +10,33 @@ import java.awt.FontMetrics; import java.awt.Point; import java.awt.Rectangle; +import java.util.EnumSet; import java.util.Iterator; import java.util.List; +import javax.swing.JComponent; import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.BCalqueLegendePanel; import org.fudaa.ebli.palette.BPalettePlageInterface; import org.fudaa.ebli.palette.BPalettePlageLegende; +import org.fudaa.ebli.palette.PaletteEditAction; import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.InplaceEditorProvider; +import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Widget; @@ -45,6 +57,17 @@ BCalqueLegendePanel legendePanel_; + BArbreCalqueModel modelTreeCalque_; + + public BArbreCalqueModel getModelTreeCalque() { + return modelTreeCalque_; + } + + public void setModelTreeCalque(BArbreCalqueModel _modelTreeCalque) { + modelTreeCalque_ = _modelTreeCalque; + + } + public static int LENGHT_PER_LEGENDE = 15; public static int WIDTH_PER_LEGENDEICON = 10; public static int WIDTH_PER_LEGENDETEXT = 130; @@ -56,9 +79,11 @@ return new Dimension(WIDTH_LEGENDE + MAX_BORDURE, _nbLibelles * (LENGHT_PER_LEGENDE + MAX_BORDURE / 2)); } - public EbliWidgetCalqueLegende(EbliScene _scene) { + public EbliWidgetCalqueLegende(EbliScene _scene, BArbreCalqueModel model) { super(); scene_ = _scene; + modelTreeCalque_ = model; + } /** @@ -66,9 +91,10 @@ */ @Override protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { - + FuLog.warning("J'ajoute un nouveau BCalqueLegendePanel dans la widget legende:" + _pnLeg); + legendePanel_ = _pnLeg; - + // createLegende(); } @@ -92,7 +118,7 @@ EbliNodeDefault def = new EbliNodeDefault(); def.setPreferedLocation(new Point(200, 200)); // def.setPreferedSize(new Dimension(150, 250)); - def.setCreator(new EbliWidgetCreatorLegende(legendePanel_)); + def.setCreator(new EbliWidgetCreatorLegende(legendePanel_, modelTreeCalque_)); def.setTitle("L\xE9gende calque"); // TODO non stable scene_.addNode(def); @@ -117,13 +143,33 @@ * resize via le changement de font * */ - public static class WidgetCalqueLegende extends EbliWidget { + public static class WidgetCalqueLegende extends EbliWidget implements InplaceEditorProvider<JComponent>, + TreeModelListener { Font oldFont_; + BArbreCalqueModel modelTree_; + boolean maj = true; + BCalqueLegendePanel legendePanel_; - public WidgetCalqueLegende(EbliScene scene, boolean _controller) { + public WidgetCalqueLegende(EbliScene scene, boolean _controller, BArbreCalqueModel model, + BCalqueLegendePanel legendePanel) { super(scene, _controller); oldFont_ = getFormeFont(); + modelTree_ = model; + + // -- la legende est un listener des modifs de son calque --// + modelTree_.addTreeModelListener(this); + + legendePanel_ = legendePanel; + setEnabled(true); + + // -- creation de l action edition des labels --// + WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); + // -- ajout de l action au label correspondant --// + this.getActions().addAction(editorAction); + + + } protected Rectangle resizeMaxLegende() { @@ -159,8 +205,10 @@ } protected void paintWidget() { + // -- mise a jour de la fonte que si il y a eu une modification --// - if (oldFont_ != getFormeFont()) { + if (oldFont_ != getFormeFont() || maj) { + maj = false; // -- calcul des max height et width pour resize les composants --// Rectangle newBounds = resizeMaxLegende(); @@ -172,8 +220,9 @@ if (widget instanceof EbliWidgetPlageTitle) { EbliWidgetPlageTitle new_widget = (EbliWidgetPlageTitle) widget; new_widget.getIntern().setFont(getFormeFont()); - - FuLog.warning("TAILLE TITLE DES WIDGETS: " + new_widget.getIntern().getLabel()); + new_widget.getIntern().majText(); + FuLog.warning("MA plage: " + new_widget.plage_.getLegende()); + // -- mise du nouveau bounds max --// Rectangle boundsIntern = new_widget.getIntern().getBounds(); boundsIntern.width = newBounds.width; @@ -186,7 +235,8 @@ boundsLogo.height = (int) (newBounds.height); boundsLogo.width = (int) (newBounds.height); new_widget.getLogo_().setPreferredBounds(boundsLogo); - + new_widget.getLogo_().repaint(); + } else if (widget instanceof LabelWidget) { LabelWidget new_widget = (LabelWidget) widget; @@ -211,9 +261,113 @@ } + /** + * Methode qui cree l editeur du calque. + */ + public JComponent createEditorComponent( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget) { + + // -- creation de la palette de la legende --// + if (modelTree_ != null) { + PaletteEditAction editeur = new PaletteEditAction(modelTree_.getTreeSelectionModel()); + editeur.setSelected(true); + JComponent comp = editeur.buildContentPane(); + comp.setSize(this.getBounds().width, this.getBounds().height); + comp.setMaximumSize(new Dimension(this.getBounds().width, this.getBounds().height)); + comp.setPreferredSize(new Dimension(this.getBounds().width, this.getBounds().height)); + + editeur.updateBeforeShow(); + return comp; + } + return null; + } + + public EnumSet<org.netbeans.api.visual.action.InplaceEditorProvider.ExpansionDirection> getExpansionDirections( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, + JComponent _editor) { + return null; + } + + public Rectangle getInitialEditorComponentBounds( + org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, Widget _widget, + JComponent _editor, Rectangle _viewBounds) { + return null; + } + + public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, + Widget _widget, JComponent _editor, boolean _commit) { + // + // + // reconstructWidget(this, legendePanel_, getEbliScene(), modelTree_); + // this.getEbliScene().refresh(); + } + + + + public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController _controller, + Widget _widget, JComponent _editor) { + } + + + // ----------------------------- listener du calque + // ----------------------------// + /** + * cas ou l arbre est modifie pour changer de variable, on reconstruit sa + * legende associee + */ + public void treeNodesChanged(TreeModelEvent _e) { + FuLog.warning("J ENTRE DANS treeNodesChanged " + cp++); + FuLog.warning("treeNodesChanged"); + // -- on supprime le listener aupres du calque --// + // modelTree_.removeTreeModelListener(this); + + // -- on retire tous les widget children du widget legende --// + this.removeChildren(); + + reconstructWidget(this, legendePanel_, getEbliScene(), modelTree_); + this.getEbliScene().refresh(); + } + + public void treeNodesInserted(TreeModelEvent _e) { + FuLog.warning("treeNodesInserted"); + } + + public void treeNodesRemoved(TreeModelEvent _e) { + FuLog.warning("treeNodesRemoved"); + } + + + public void treeStructureChanged(TreeModelEvent _e) { + FuLog.warning("treeStructureChanged"); + } + + + } /** + * Methode statique qui recree la widget associee au calque. Il faut que son + * parent la bordure ajoute et prenne en compte sa nouvelle fille pour bien + * gerer le dispatch des composants graphiques. + * + * @param widgetLegende_ + * @param _calqueLegende + * @param _scene + * @param model + */ + public static int cp = 1; + public static void reconstructWidget(WidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, + EbliScene _scene, BArbreCalqueModel model) { + + // -- on retire de la bordure la widget fille --// + EbliWidgetBordure parent = (EbliWidgetBordure) widgetLegende_.getParentWidget(); + + widgetLegende_ = (WidgetCalqueLegende) createLegendeWidget(widgetLegende_, _calqueLegende, _scene, model); + + parent.repaint(); + + } + /** * Mananger statique qui se charge de creer \xE9a widget associee au calque. * * @param _calqueLegende @@ -222,11 +376,14 @@ * la scene * @return la widfget de la legende. */ - public static EbliWidget createLegendeWidget(BCalqueLegendePanel _calqueLegende, EbliScene _scene) { + public static EbliWidget createLegendeWidget(WidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, + EbliScene _scene, + BArbreCalqueModel model) { // --creation de la widget conteneur --// BPalettePlageInterface listeplages = null; - WidgetCalqueLegende widgetLegende_ = new WidgetCalqueLegende(_scene, false); + // widgetLegende_ = new WidgetCalqueLegende(_scene, false, model, + // _calqueLegende); widgetLegende_.setLayout(new FlowLayout(true, SerialAlignment.CENTER, 5)); if (_calqueLegende != null) { @@ -236,22 +393,34 @@ Component c = listeC[i]; FuLog.warning(i + ") " + c); if (c instanceof JLabel) { - FuLog.warning(" " + ((JLabel) c).getText()); + LabelWidget titre = new LabelWidget(_scene); titre.setAlignment(Alignment.CENTER); titre.setVerticalAlignment(VerticalAlignment.CENTER); titre.setLabel(((JLabel) c).getText()); - titre.setEnabled(false); + titre.setEnabled(true); widgetLegende_.addChild(titre); } if (c instanceof BPalettePlageLegende) { BPalettePlageLegende pal = (BPalettePlageLegende) c; - + FuLog.warning("title) " + pal.getModel().getTitre() + "| nb de composant du model: " + + pal.getModel().getNbPlages()); + // --recuperation de la liste des plages --// listeplages = pal.getModel(); - + + + // --creation du titre --// + LabelWidget titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(listeplages.getTitre()); + titre.setEnabled(true); + widgetLegende_.addChild(titre); + + if (listeplages.getNbPlages() != 0) { for (int j = 0; j < listeplages.getNbPlages(); j++) { BPlageInterface plage = listeplages.getPlageInterface(j); @@ -261,12 +430,52 @@ EbliWidgetPlageTitle lw = new EbliWidgetPlageTitle(_scene, plage, null); lw.setUseBorder(false); - lw.setEnabled(false); - lw.setEnabled(false); + lw.setEnabled(true); + widgetLegende_.addChild(lw); } + } else { + // liste des plages est vide il s agit d une autre legende + Component[] lcomp = pal.getComponents(); + for (int j = 0; j < lcomp.length; j++) { + Component co = lcomp[j]; + FuLog.warning(j + ") autre legende: " + co); + + if (co instanceof JPanel) { + JPanel panel = (JPanel) co; + for (int k = 0; k < panel.getComponents().length; k++) { + FuLog.warning(j + ") appartien a panel: " + panel.getComponents()[k]); + + if (panel.getComponents()[k] instanceof JLabel) { + FuLog.warning("label) =" + ((JLabel) panel.getComponents()[k]).getText()); + titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel(((JLabel) panel.getComponents()[k]).getText()); + titre.setEnabled(true); + widgetLegende_.addChild(titre); + } else if (panel.getComponents()[k] instanceof JList) { + JList jlst = (JList) panel.getComponents()[k]; + for (int g = 0; g < jlst.getModel().getSize(); g++) { + FuLog.warning(g + ")jlist: element=" + jlst.getModel().getElementAt(g)); + titre = new LabelWidget(_scene); + titre.setAlignment(Alignment.CENTER); + titre.setVerticalAlignment(VerticalAlignment.CENTER); + titre.setLabel((String) jlst.getModel().getElementAt(g)); + titre.setEnabled(true); + widgetLegende_.addChild(titre); + } + + } + + } + + } + + } + } } } @@ -284,4 +493,8 @@ } } + + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCreatorLegende.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -1,7 +1,6 @@ package org.fudaa.ebli.visuallibrary.calque; - - +import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.calque.BCalqueLegendePanel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -22,9 +21,12 @@ EbliWidgetBordure res; - public EbliWidgetCreatorLegende(BCalqueLegendePanel g) { + BArbreCalqueModel modelTreeCalque_; + + public EbliWidgetCreatorLegende(BCalqueLegendePanel g, BArbreCalqueModel model) { super(); this.g = g; + modelTreeCalque_ = model; } public BCalqueLegendePanel getG() { @@ -36,7 +38,9 @@ } public EbliWidget create(EbliScene _scene) { - EbliWidget widgetLegende_=EbliWidgetCalqueLegende.createLegendeWidget(g, _scene); + EbliWidget widgetLegende_ = EbliWidgetCalqueLegende.createLegendeWidget( + new EbliWidgetCalqueLegende.WidgetCalqueLegende(_scene, false, modelTreeCalque_, g), g, _scene, + modelTreeCalque_); res = new EbliWidgetBordure(widgetLegende_, true, false); // g.getModel().addModelListener(new EbliWidgetGrapheController(res)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlageTitle.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -7,13 +7,9 @@ import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; -import org.netbeans.api.visual.action.ActionFactory; -import org.netbeans.api.visual.action.TextFieldInplaceEditor; -import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.Scene; -import org.netbeans.api.visual.widget.Widget; import org.netbeans.modules.visual.layout.FlowLayout; /** @@ -22,35 +18,27 @@ * @author Adrien Hadoux * */ -public class EbliWidgetPlageTitle extends EbliWidget /* - * implements - * TextFieldInplaceEditor - */{ +public class EbliWidgetPlageTitle extends EbliWidget { BPlageInterface plage_; // LabelWidget intern_; - public class InternWidget extends LabelWidget implements TextFieldInplaceEditor { + public class InternWidget extends LabelWidget { public InternWidget(Scene scene) { super(scene); setVerticalAlignment(VerticalAlignment.CENTER); + setEnabled(true); } - public String getText(Widget widget) { - return ((LabelWidget) widget).getLabel(); - } - - public boolean isEnabled(Widget widget) { - return true; - } - - public void setText(Widget widget, String text) { - String texte = formatte(text); - ((LabelWidget) widget).setLabel(texte); - plage_.setLegende(texte); + /** + *Methode utilisee pour mettre a jour la plage. + */ + public void majText() { + this.setLabel(plage_.getLegende()); setToolTipText(plage_.getLegende()); + setForeground(plage_.getCouleur()); } } @@ -84,7 +72,7 @@ setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); // setEnabled(false); - + setEnabled(true); logo_ = new EbliWidget(_scene) { protected void paintWidget() { Graphics2D g = getGraphics(); @@ -94,7 +82,7 @@ } }; - logo_.setEnabled(false); + logo_.setEnabled(true); addChild(logo_); // -- creation de la legende --// @@ -108,12 +96,15 @@ // -- ajouter l option de remplacer le text dans le label --// - // -- creation de l action --// - WidgetAction editorAction = ActionFactory.createInplaceEditorAction(intern_); + // -- creation de l action edition des labels --// + // WidgetAction editorAction = + // ActionFactory.createInplaceEditorAction(intern_); + // // -- ajout de l action au label correspondant --// + // intern_.getActions().addAction(editorAction); - // -- ajout de l action au label correspondant --// - intern_.getActions().addAction(editorAction); + + // setEnabled(false); } @@ -122,29 +113,7 @@ intern_.setLabel(plage_.getLegende()); } - // public String getText(Widget widget) { - // return ((LabelWidget) widget).getLabel(); - // } - // public boolean isEnabled(Widget widget) { - // // TODO Auto-generated method stub - // return true; - // } - // - // public void setText(Widget widget, String text) { - // String texte = formatte(text); - // ((LabelWidget) widget).setLabel(texte); - // plage_.setLegende(texte); - // setToolTipText(plage_.getLegende()); - // } - // - // /** - // * methode qui reformatte le texte avec la meme tailel que le libell\xE9 - // * pr\xE9c\xE9dent pour bien afficher les modifs - // * - // * @param texte - // * @return - // */ public String formatte(String texte) { if (texte.length() < plage_.getLegende().length()) { @@ -154,4 +123,7 @@ } + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -2,6 +2,7 @@ import java.awt.Point; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -21,6 +22,16 @@ EGFillePanel pn_; + ZEbliCalquesPanel CalquepanelProvenance; + + public ZEbliCalquesPanel getCalquepanelProvenance() { + return CalquepanelProvenance; + } + + public void setCalquepanelProvenance(ZEbliCalquesPanel _calquepanelProvenance) { + CalquepanelProvenance = _calquepanelProvenance; + } + public EGGraphe getGraphe() { return pn_.getGraphe(); } @@ -37,14 +48,16 @@ // EbliWidgetGraphe res; EbliWidgetBordure res; - public EbliWidgetCreatorGraphe(EGGraphe _g) { - super(); - this.pn_ = new EGFillePanel(_g); + public EbliWidgetCreatorGraphe(EGGraphe _g, ZEbliCalquesPanel _calquepanelProvenance) { + this(new EGFillePanel(_g), _calquepanelProvenance); + + } - public EbliWidgetCreatorGraphe(EGFillePanel _pn) { + public EbliWidgetCreatorGraphe(EGFillePanel _pn, ZEbliCalquesPanel _calquepanelProvenance) { super(); this.pn_ = _pn; + CalquepanelProvenance = _calquepanelProvenance; } public EbliWidget create(EbliScene _scene) { @@ -71,7 +84,7 @@ EbliNode duplique = new EbliNodeDefault(); - duplique.setCreator(new EbliWidgetCreatorGraphe(getGraphe().duplicate())); + duplique.setCreator(new EbliWidgetCreatorGraphe(getGraphe().duplicate(), CalquepanelProvenance)); duplique.setTitle(_nodeAdupliquer.getTitle()); // recopie des tailles Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -181,7 +181,7 @@ // -- creation d un noeud Graphe --// final EbliNodeDefault nodeG = new EbliNodeDefault(); - nodeG.setCreator(new EbliWidgetCreatorGraphe(g)); + nodeG.setCreator(new EbliWidgetCreatorGraphe(g, null)); nodeG.setTitle("Graphe"); nodeG.setPreferedSize(new Dimension(200, 250)); nodeG.setPreferedLocation(new Point(12, 420)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -91,7 +91,8 @@ .getSource(indiceSOURCESelect)); EbliNode node = projet_.filleLayout_.controller_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu .getPreferredSize(), - pnVisu, new EbliWidgetCalqueLegende(projet_.filleLayout_.getScene())); + pnVisu, new EbliWidgetCalqueLegende(projet_.filleLayout_.getScene(), pnVisu + .getArbreCalqueModel())); // -- ajout de l INFO de la source utilis\xE9e --// Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -9,17 +9,16 @@ import java.awt.event.ActionEvent; -import com.memoire.bu.BuLib; - import org.fudaa.ctulu.ProgressionBuAdapter; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGGraphe; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuResource; + class TrPostCourbeAddPointsAction extends EbliActionSimple { final FudaaCommonImplementation impl_; @@ -28,7 +27,8 @@ public TrPostCourbeAddPointsAction(final FudaaCommonImplementation _impl, final EGGraphe _model, final TrPostVisuPanel _panel) { - super(TrResource.getS("Ajouter les courbes pour les points s\xE9lectionn\xE9s"), null, "ADD_SELECTED_NODES"); + super(TrResource.getS("Ajouter les courbes pour les points s\xE9lectionn\xE9s"), BuResource.BU.getToolIcon("cible"), + "ADD_SELECTED_NODES"); impl_ = _impl; panel_ = _panel; model_ = _model; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -14,29 +14,26 @@ import javax.swing.BorderFactory; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuBorders; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.ProgressionBuAdapter; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionReguliere; - import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.courbe.EGGraphe; - import org.fudaa.fudaa.commun.FudaaInternalFrameSelectorPanel; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuBorders; +import com.memoire.fu.FuLog; + /** * @author fred deniger * @version $Id: TrPostCourbeBuilder.java,v 1.9 2007-05-04 14:01:51 deniger Exp $ @@ -83,12 +80,13 @@ return treeModel; } - public static void chooseAndBuild(final TrPostProjet _src, final int[] _ptIdx, final H2dVariableType _varSelected) { - chooseAndBuild(_src, _ptIdx, null, _varSelected); + public static void chooseAndBuild(final TrPostProjet _src, final int[] _ptIdx, final H2dVariableType _varSelected, + TrPostVisuPanel _calque) { + chooseAndBuild(_src, _ptIdx, null, _varSelected, _calque); } public static void chooseAndBuild(final TrPostProjet _src, final int[] _ptIdx, final TrPostInterpolatePoint _pt, - final H2dVariableType _varSelected) { + final H2dVariableType _varSelected, final TrPostVisuPanel _calque) { if (_ptIdx == null && _pt == null) { return; } @@ -146,7 +144,7 @@ .getSelectedTimeStepIdx(), var, _ptIdx, prog) : build(_src.getImpl(), _src.getSource(), chooser .getSelectedTimeStepIdx(), var, _pt, prog); if (model != null) { - _src.addFille(model, pnFrame == null ? titre : pnFrame.getNewFrameTitle(), prog); + _src.addFille(model, pnFrame == null ? titre : pnFrame.getNewFrameTitle(), prog, _calque); } } }.start(); @@ -162,8 +160,8 @@ } public static void chooseAndBuild(final TrPostProjet _src, final TrPostInterpolatePoint _pt, - final H2dVariableType _varSelected) { - chooseAndBuild(_src, null, _pt, _varSelected); + final H2dVariableType _varSelected, TrPostVisuPanel _calque) { + chooseAndBuild(_src, null, _pt, _varSelected, _calque); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -461,7 +461,7 @@ // -- etape 1: ajout du tree de graphe dans fudaaImplementation --// changeTreeGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphe()); // -- etape 2: rechargement de la toolbar specifique dans this --// - changeToolbarGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphePanel()); + changeToolbarGraphe((EbliWidgetCreatorGraphe) node.getCreator()); } else { // -- etape 1: on fout eventuellement le tree des layouts --// @@ -638,6 +638,7 @@ // combo.setToolTipText(); toolBarModifiable_.add(combo); + EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(_calque.getArbreCalqueModel()); @@ -654,7 +655,10 @@ // combo.setToolTipText(); toolBarModifiable_.add(combo); - // ajout bouton toolbar + // -- ajotu d un bouton pour la paletet des legendes --// + // toolBarModifiable_.add(new + // PaletteEditAction(_calque.getArbreCalqueModel() + // .getTreeSelectionModel())); @@ -667,8 +671,11 @@ } - private void changeToolbarGraphe(EGFillePanel _graphe) { + private void changeToolbarGraphe(EbliWidgetCreatorGraphe creator) { + EGFillePanel _graphe = creator.getGraphePanel(); + TrPostVisuPanel _calque = (TrPostVisuPanel) creator.getCalquepanelProvenance(); + // nettoyage de la toolbar toolBarModifiable_.removeAll(); menuModifiable_.removeAll(); @@ -684,11 +691,25 @@ } } + + + // ajout des menus specifiques JMenu menu = new JMenu("Menu graphe"); _graphe.fillSpecificMenu(menu); menuModifiable_.add(menu); + + + // -- ajout de l'action qui ajoute un point au graphe --// + TrPostCourbeAddPointsAction addPoint = new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque); + toolBarModifiable_.add(addPoint.buildToolButton(EbliComponentFactory.INSTANCE)); + menu.add(addPoint); + + TrPostCourbeAddVariableAction addVariable = new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe()); + toolBarModifiable_.add(addVariable.buildToolButton(EbliComponentFactory.INSTANCE)); + menu.add(addVariable); + // mise a jour des params toolBarModifiable_.revalidate(); menuModifiable_.revalidate(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -15,6 +15,7 @@ import javax.swing.ListSelectionModel; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionAbstract; @@ -245,11 +246,11 @@ * Methode d ajout d'un calque legende. * @return */ - public EbliNode addCalqueLegende(BCalqueLegende legende) { + public EbliNode addCalqueLegende(BCalqueLegende legende, BArbreCalqueModel model) { // -- ajout du rectangle --// final EbliNodeDefault nodeLegende = new EbliNodeDefault(); nodeLegende.setTitle("Legende calque"); - nodeLegende.setCreator(new EbliWidgetCreatorLegende(legende.getLegendePanel(0))); + nodeLegende.setCreator(new EbliWidgetCreatorLegende(legende.getLegendePanel(0), model)); nodeLegende.setPreferedSize(new Dimension(200, 100)); nodeLegende.setPreferedLocation(new Point(350, 125)); // ajout du node au layout Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -816,7 +816,7 @@ // -- on ajoute le panel de visu comm widget calque au layout --// compFille.addCalque(MvResource.getS("Maillage initial"), new Point(250, 170), new Dimension(400, 200), pnVisu, - new EbliWidgetCalqueLegende(compFille.getScene())); + new EbliWidgetCalqueLegende(compFille.getScene(), pnVisu.getArbreCalqueModel())); // test si il faut ajouter le calque if (_isInitGridDisplay) { @@ -875,7 +875,8 @@ * refonte de addFille qui ajoute des widgets * */ - protected void addFille(final TrPostCourbeTreeModel _model, final String _titre, final ProgressionInterface _prog) { + protected void addFille(final TrPostCourbeTreeModel _model, final String _titre, final ProgressionInterface _prog, + TrPostVisuPanel calque) { final EGGraphe graphe = new EGGraphe(_model); graphe.setXAxe(buildDefaultTimeAxe()); /* @@ -913,13 +914,13 @@ // Pour EDF: ajout directement dans la scene du graphe sans passe par une // frame d edition - addEbliNode(new EGFillePanel(graphe)); + addEbliNode(new EGFillePanel(graphe), calque); } - private void addEbliNode(final EGFillePanel pn) { + private void addEbliNode(final EGFillePanel pn, TrPostVisuPanel calque) { final EbliNodeDefault nodeG = new EbliNodeDefault(); - nodeG.setCreator(new EbliWidgetCreatorGraphe(pn)); + nodeG.setCreator(new EbliWidgetCreatorGraphe(pn, calque)); nodeG.setTitle("Graphe " + idxFilleG_++); nodeG.setPreferedSize(new Dimension(600, 400)); @@ -1146,10 +1147,10 @@ filleLayout_ = new TrPostLayoutFille(TrPostProjet.this); // -- creation d une instance de la legende du calque --// - EbliWidgetCalqueLegende legendeCalque = new EbliWidgetCalqueLegende(filleLayout_.getScene()); + EbliWidgetCalqueLegende legendeCalque = new EbliWidgetCalqueLegende(filleLayout_.getScene(), null); final TrPostVisuPanel pnVisu = buildVisuPanel(filleLayout_.getScene(), legendeCalque); - + legendeCalque.setModelTreeCalque(pnVisu.getArbreCalqueModel()); // fille_ = new TrPostFille(pnVisu); // --creation de l internalframe layout --// @@ -1211,16 +1212,16 @@ * @param _idx _idx les indices des points * @param _varSelected la variable en cours: peut etre null. */ - public void buildFille(final int[] _idx, final H2dVariableType _varSelected) { - TrPostCourbeBuilder.chooseAndBuild(this, _idx, _varSelected); + public void buildFille(final int[] _idx, final H2dVariableType _varSelected, TrPostVisuPanel _calque) { + TrPostCourbeBuilder.chooseAndBuild(this, _idx, _varSelected, _calque); } /** * @param _pt le point sond\xE9 qui sera affiche dans les evolutions tempo * @param _varSelected la variable en cours: peut etre null. */ - public void buildFille(final TrPostInterpolatePoint _pt, final H2dVariableType _varSelected) { - TrPostCourbeBuilder.chooseAndBuild(this, _pt, _varSelected); + public void buildFille(final TrPostInterpolatePoint _pt, final H2dVariableType _varSelected, TrPostVisuPanel _calque) { + TrPostCourbeBuilder.chooseAndBuild(this, _pt, _varSelected, _calque); } @@ -1395,7 +1396,8 @@ return false; } - public void profilPanelCreated(final MvProfileFillePanel _panel, final ProgressionInterface _prog, final String _title) { + public void profilPanelCreated(final MvProfileFillePanel _panel, final ProgressionInterface _prog, + final String _title) { // final MvProfileTreeFille fille = new TrPostProfileFille(_panel, // MvProfileBuilder.getProfileName(_title), getImpl(), // null); @@ -1408,7 +1410,7 @@ // MvProfileTreeModel duplicate = new // MvProfileTreeModel(_panel.getProfileTreeModel()); // TODO a corriger: duplique ne fonctionne pas - addEbliNode(_panel); + addEbliNode(_panel, null); } }; dial.getContentPane().add(new JButton(addToLayout), BorderLayout.SOUTH); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-09-01 20:11:31 UTC (rev 3862) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java 2008-09-02 16:29:18 UTC (rev 3863) @@ -205,19 +205,19 @@ /** * Methode qui ajoute une widget de legende de calque. */ - public void addWidgetLegendeCalque() { - // JOptionPane.showMessageDialog(null, - // "addWidgetLegendeCalque de Trpostvisupanel"); - // recupetration de la widget legende - BCalqueLegende legend = getCqLegend(); - // -- ajout de la legende du calque dans la scene --// - this.getProjet().filleLayout_.controller_.addCalqueLegende(legend); + // public void addWidgetLegendeCalque() { + // // JOptionPane.showMessageDialog(null, + // // "addWidgetLegendeCalque de Trpostvisupanel"); + // // recupetration de la widget legende + // BCalqueLegende legend = getCqLegend(); + // // -- ajout de la legende du calque dans la scene --// + // this.getProjet().filleLayout_.controller_.addCalqueLegende(legend); + // + // // rafraichissement de la scene + // this.getProjet().filleLayout_.controller_.getScene().refresh(); + // + // } - // rafraichissement de la scene - this.getProjet().filleLayout_.controller_.getScene().refresh(); - - } - // BCalqueLegende malegende = new BCalqueLegende(); // /** // * Surcharge de la methode du ZebliCalquePanel Ajoute les calques @@ -326,10 +326,10 @@ } else if (calque instanceof TrPostFlecheLayer) { selectedVar = ((TrPostFlecheLayer) calque).getSelectedVar(); } - srcCont_.buildFille(idx, selectedVar); + srcCont_.buildFille(idx, selectedVar, this); } else if (isSelectionOkForEvolutionSonde()) { - srcCont_.buildFille(getInterpolePointForEvol(), getSelectedVarInCalqueActif()); + srcCont_.buildFille(getInterpolePointForEvol(), getSelectedVarInCalqueActif(), this); } } @@ -540,8 +540,12 @@ */ public TrPostVisuPanel duplicate(Map _options) { - final TrPostVisuPanel duplic = new TrPostVisuPanel(this.getImpl(), this.getProjet(), new EbliWidgetCalqueLegende( - (EbliScene) _options.get("scene"))); + + EbliWidgetCalqueLegende legendeCalque=new EbliWidgetCalqueLegende((EbliScene) _options.get("scene"), null); + final TrPostVisuPanel duplic = new TrPostVisuPanel(this.getImpl(), this.getProjet(), legendeCalque); + legendeCalque.setModelTreeCalque(duplic.getArbreCalqueModel()); + + System.err.println(duplic.getCqLegend()); // -- sauvegarde de l etat --// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-03 20:17:52
|
Revision: 3882 http://fudaa.svn.sourceforge.net/fudaa/?rev=3882&view=rev Author: deniger Date: 2008-09-03 20:17:44 +0000 (Wed, 03 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/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/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -204,7 +204,6 @@ public static void reconstructWidget(EbliWidgetCalqueLegende widgetLegende_, BCalqueLegendePanel _calqueLegende, EbliScene _scene/* , BArbreCalqueModel model */) { - // -- on retire de la bordure la widget fille --// EbliWidgetBordure parent = (EbliWidgetBordure) widgetLegende_.getParentWidget(); widgetLegende_ = (EbliWidgetCalqueLegende) createLegendeWidget(widgetLegende_, _calqueLegende, _scene); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -307,7 +307,7 @@ /** * affiche le label des coordonnees */ - public JComponent gettracableComponent() { + public JComponent geTtracableComponent() { if (labelTrace_ == null) { labelTrace_ = getCalque().getLabelSuiviSouris(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetCreatorGraphe.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -16,26 +16,25 @@ * interface qui permet de creer un widget * * @author Adrien Hadoux - * */ public class EbliWidgetCreatorGraphe implements EbliWidgetCreator { EGFillePanel pn_; - ZEbliCalquesPanel CalquepanelProvenance; - - public ZEbliCalquesPanel getCalquepanelProvenance() { - return CalquepanelProvenance; - } + // ZEbliCalquesPanel CalquepanelProvenance; + // + // public ZEbliCalquesPanel getCalquepanelProvenance() { + // return CalquepanelProvenance; + // } + // + // public void setCalquepanelProvenance(ZEbliCalquesPanel _calquepanelProvenance) { + // CalquepanelProvenance = _calquepanelProvenance; + // } - public void setCalquepanelProvenance(ZEbliCalquesPanel _calquepanelProvenance) { - CalquepanelProvenance = _calquepanelProvenance; - } - public EGGraphe getGraphe() { return pn_.getGraphe(); } - + public EGFillePanel getGraphePanel() { return pn_; } @@ -47,17 +46,16 @@ // EbliWidgetGraphe res; EbliWidgetBordure res; - - public EbliWidgetCreatorGraphe(EGGraphe _g, ZEbliCalquesPanel _calquepanelProvenance) { - this(new EGFillePanel(_g), _calquepanelProvenance); - - + + public EbliWidgetCreatorGraphe(EGGraphe _g) { + this(new EGFillePanel(_g)); + } - public EbliWidgetCreatorGraphe(EGFillePanel _pn, ZEbliCalquesPanel _calquepanelProvenance) { + public EbliWidgetCreatorGraphe(EGFillePanel _pn) { super(); this.pn_ = _pn; - CalquepanelProvenance = _calquepanelProvenance; + // CalquepanelProvenance = _calquepanelProvenance; } public EbliWidget create(EbliScene _scene) { @@ -78,13 +76,12 @@ // TODO Auto-generated method stub return res; } - - + public EbliNode duplicate(EbliNode _nodeAdupliquer) { EbliNode duplique = new EbliNodeDefault(); - duplique.setCreator(new EbliWidgetCreatorGraphe(getGraphe().duplicate(), CalquepanelProvenance)); + duplique.setCreator(new EbliWidgetCreatorGraphe(getGraphe().duplicate())); duplique.setTitle(_nodeAdupliquer.getTitle()); // recopie des tailles @@ -100,7 +97,5 @@ public EbliWidgetBordure getBordure() { return res; } - - } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -17,6 +17,7 @@ import javax.swing.JComponent; import javax.swing.SwingUtilities; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGFillePanel; @@ -53,9 +54,9 @@ } public void setNodeLegende(EbliNodeDefault node) { - nodeLegende = node; + nodeLegende = node; } - + public Color couleurContour = Color.black; public Color couleurFond = Color.white; @@ -72,12 +73,10 @@ super(scene); panelGraphe_ = _pn; panelGraphe_.setBorder(null); - // panelGraphe_.remove(CtuluLibSwing.findChildByName(panelGraphe_, - // "lbTools")); - - + panelGraphe_.remove(CtuluLibSwing.findChildByName(panelGraphe_, "lbTools")); + panelGraphe_.getGraphe().getModel().addModelListener(this); - + // --ajout du controller specifique au graphe --// this.setController_(new EbliWidgetControllerGraphe(this, nodeLegende)); @@ -93,7 +92,7 @@ protected void paintWidget() { Rectangle rec = getClientArea(); Graphics2D g = getGraphics(); -// g.translate(rec.x, rec.y); + // g.translate(rec.x, rec.y); if (frame_ == null) { getGraphe().setSize(rec.width - 1, rec.height - 1); @@ -106,17 +105,15 @@ FuLog.debug("EWI: recreate image"); Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); - - image = getGraphe().produceImage(rec.width-1, rec.height-1, params); + image = getGraphe().produceImage(rec.width - 1, rec.height - 1, params); + } - g.drawImage(image, rec.x, rec.y, rec.width-1, rec.height-1, null); + g.drawImage(image, rec.x, rec.y, rec.width - 1, rec.height - 1, null); -// g.translate(-rec.x, -rec.y); + // g.translate(-rec.x, -rec.y); } - - public BuPanel createEditorComponent( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget) { @@ -194,9 +191,9 @@ public Rectangle getInitialEditorComponentBounds( org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, Rectangle viewBounds) { - Rectangle rec= convertLocalToScene(getClientArea()); - rec.width-=1; - rec.height-=1; + Rectangle rec = convertLocalToScene(getClientArea()); + rec.width -= 1; + rec.height -= 1; return rec; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -181,7 +181,7 @@ // -- creation d un noeud Graphe --// final EbliNodeDefault nodeG = new EbliNodeDefault(); - nodeG.setCreator(new EbliWidgetCreatorGraphe(g, null)); + nodeG.setCreator(new EbliWidgetCreatorGraphe(g)); nodeG.setTitle("Graphe"); nodeG.setPreferedSize(new Dimension(200, 250)); nodeG.setPreferedLocation(new Point(12, 420)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -204,7 +204,7 @@ right.add(conteneurTree_, BorderLayout.CENTER); - conteneurTree_.add(controller_.getComboMultiScenes(), BorderLayout.NORTH); + if (controller_ != null) { Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getSceneCourante().getObjects(); @@ -497,7 +497,7 @@ /** * Met a jour le tree a droite si ni un graphe ni un calque n est selectionn\xE9. */ - public synchronized void changeTreeScene() { + private synchronized void changeTreeScene() { conteneurTree_.remove(panelTreeModifiable_); panelTreeModifiable_ = new JScrollPane(getScene().getController().getOverviewComponent()); @@ -518,7 +518,7 @@ * * @param _calque */ - private synchronized void changeToolbar(EbliWidgetController _controller) { + private void changeToolbar(EbliWidgetController _controller) { // nettoyage de la toolbar this.remove(toolBarModifiable_); @@ -546,7 +546,7 @@ * @param _controller * @param creator */ - private synchronized void changeToolbarSpecifiqueGraphe(EbliWidgetController _controller, + private void changeToolbarSpecifiqueGraphe(EbliWidgetController _controller, EbliWidgetCreatorGraphe creator) { // -- change la toolbar avec els actions generiques du controller --// @@ -556,9 +556,9 @@ // -- ajout des actions tr --// ArrayList<EbliActionSimple> listeActions = new ArrayList<EbliActionSimple>(); EGFillePanel _graphe = creator.getGraphePanel(); - TrPostVisuPanel _calque = (TrPostVisuPanel) creator.getCalquepanelProvenance(); - - listeActions.add(new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque)); +// TrPostVisuPanel _calque = (TrPostVisuPanel) creator.getCalquepanelProvenance(); + //TODO trop dangereux... +// listeActions.add(new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque)); listeActions.add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); _controller.addFonctionsSpecific(listeActions); } @@ -567,6 +567,7 @@ this.revalidate(); } + private void changeToolbarScene() { public synchronized void changeToolbarScene() { // nettoyage de la toolbar this.remove(toolBarModifiable_); @@ -594,16 +595,16 @@ * * @param _controller */ - private synchronized void changeSouth(EbliWidgetController _controller) { + private void changeSouth(EbliWidgetController _controller) { this.remove(this.panelSouthSuiviSouris_); - this.panelSouthSuiviSouris_ = _controller.gettracableComponent(); + this.panelSouthSuiviSouris_ = _controller.geTtracableComponent(); this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH); panelSouthSuiviSouris_.revalidate(); this.revalidate(); } - private synchronized void changeSouth() { + private void changeSouth() { this.remove(this.panelSouthSuiviSouris_); this.panelSouthSuiviSouris_ = new JLabel(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-03 20:15:27 UTC (rev 3881) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-09-03 20:17:44 UTC (rev 3882) @@ -920,7 +920,7 @@ private void addEbliNode(final EGFillePanel pn, TrPostVisuPanel calque) { final EbliNodeDefault nodeG = new EbliNodeDefault(); - nodeG.setCreator(new EbliWidgetCreatorGraphe(pn, calque)); + nodeG.setCreator(new EbliWidgetCreatorGraphe(pn)); nodeG.setTitle("Graphe " + idxFilleG_++); nodeG.setPreferedSize(new Dimension(600, 400)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-03 17:07:02
|
Revision: 3877 http://fudaa.svn.sourceforge.net/fudaa/?rev=3877&view=rev Author: hadouxad Date: 2008-09-03 17:07:03 +0000 (Wed, 03 Sep 2008) Log Message: ----------- - refactorisation de trpostLayoutFille - il n' y a plus qu'une unique creation des composants graphique pour les objets calques, graphe et scene - methode d acces au composants graphiques sont dans les controlleurs - getOverviewComponent () donne l arbre principal - getToolbarComponent() donne la toolbar - getMenus() donne le menu - methode addFonctionsSpecific() qui permet d ajouter des actions haut niveau (trpost) sans etre g?\195?\169n?\195?\169 cot?\195?\169 ebli - methode du trpostfilel sont synchronized pour eviter de faire bugger les composant si on clic comme un fou... - ajout du trac?\195?\169 souris dans le cas du calque - creation d un controller de la scene qui gere les actions et els constructions graphiques - l'arbre et de la scene est inclu dans l objet EbliSceneController necessaire pour la gestion multi scene - mise en oeuvre le syst?\195?\168me d?\195?\169crit hier pour la creation de toutes les courbes dans n'importe quel graphe - action disponible dans la palette principale - selection simultan?\195?\169e des graphes et du calque unique - gestion des messages d erreurs en cas de prob. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrpostComboMultiScenes.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-03 17:06:10 UTC (rev 3876) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-03 17:07:03 UTC (rev 3877) @@ -4,13 +4,25 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.Iterator; +import javax.swing.JComponent; +import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.courbe.EGConfigureActionPalette; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.courbe.EGSpecificActions; +import org.fudaa.ebli.courbe.EGTree; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliWidget; @@ -22,7 +34,9 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuPanel; +import com.memoire.bu.BuToolBar; /** * controller specifique pour les actions de la widget du graphe. Ne gere pas @@ -178,5 +192,108 @@ _popup.add(new EGConfigureActionPalette(((EbliWidgetGraphe) widget_).getGraphe().getModel())); } + + public EGGraphe getGraphe() { + return widgetGraphe_.getGraphe(); + } + public EGFillePanel getGraphePanel() { + return widgetGraphe_.panelGraphe_; + } + + JScrollPane panelTreeGraphe_ = null; + BuToolBar toolbarGraphe_ = null; + BuMenuBar menuGraphe_ = null; + public boolean alreadyCreate_ = false; + + /** + * Recupere les objets graphique tree et panel infos associe au calque. + * + * @return + */ + public JComponent getOverviewComponent() { + + if (panelTreeGraphe_ == null) { + + EGTree tree = new EGTree(); + tree.setExpandsSelectedPaths(true); + tree.setActions(new EGSpecificActions(getGraphe())); + EGGrapheTreeModel treeModel = (EGGrapheTreeModel) getGraphe().getModel(); + tree.setModel(treeModel); + tree.setSelectionModel(treeModel.getSelectionModel()); + panelTreeGraphe_ = new JScrollPane(tree); + + } + + return panelTreeGraphe_; + } + + /** + * Obtient la toolbar specifique au calque + * + * @return + */ + public BuToolBar getToolbarComponent() { + + if (toolbarGraphe_ == null) { + toolbarGraphe_ = new BuToolBar(); + // ajout des toolbar specifiques du calque + EbliActionInterface[] specificInterfaces = getGraphePanel().getSpecificActions(); + for (int i = 0; i < specificInterfaces.length; i++) { + EbliActionInterface object = specificInterfaces[i]; + if (object == null) { + toolbarGraphe_.addSeparator(); + } else { + toolbarGraphe_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); + } + } + } + + return toolbarGraphe_; + } + + /** + * retourne le menuBar associee au calque + * + * @return + */ + public BuMenuBar getMenubarComponent() { + + if (menuGraphe_ == null) { + menuGraphe_ = new BuMenuBar(); + JMenu menu = new JMenu("Menu graphe"); + getGraphePanel().fillSpecificMenu(menu); + menuGraphe_.add(menu); + + } + + return menuGraphe_; + + } + + /** + * ajoute des toolsbuton specifiques si pas deja ajoutes. + */ + public void addFonctionsSpecific(ArrayList<EbliActionSimple> _listeActions) { + + if (!fonctionsAlreadySpecified()) { + alreadyCreate_ = true; + + for (Iterator<EbliActionSimple> it = _listeActions.iterator(); it.hasNext();) { + EbliActionSimple action = it.next(); + toolbarGraphe_.add(action.buildToolButton(EbliComponentFactory.INSTANCE)); + menuGraphe_.getMenu(0).add(new JMenuItem(action)); + } + + } + + } + + public boolean fonctionsAlreadySpecified() { + return alreadyCreate_; + } + + + + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-03 17:07:03 UTC (rev 3877) @@ -0,0 +1,110 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuDialogError; + +/** + * Action qui recupere les widgets selectionnes calque et graphe. Recupere + * l'unique calque selectionn\xE9s et l'ensem + * + * @author genesis + * + */ +public class TrPostActionAddPointFromWidgetCalque extends EbliActionSimple { + + + EbliScene scene_; + CtuluCommandContainer cmd_; + TrPostCommonImplementation impl_; + + public TrPostActionAddPointFromWidgetCalque(EbliScene _scene, TrPostCommonImplementation _impl) { + super(TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), + "ADDPOINTWIDGET"); + scene_ = _scene; + cmd_ = _scene.getCmdMng(); + impl_ = _impl; + putValue(NAME, "Arri\xE8re plan"); + this + .setDefaultToolTip(TrResource + .getS("S\xE9lectionnez simultan\xE9ment le calque qui contient les points ainsi que les graphes qui contiendront les courbes ")); + + } + + public void actionPerformed(ActionEvent e) { + + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + boolean isCalqueUnique = true; + boolean isGraphePresent = false; + TrPostVisuPanel calque = null; + ArrayList<EGGraphe> listeGraphes = new ArrayList<EGGraphe>(); + + //-- tentative de recuperation du calque --// + for (Iterator<EbliNode> it = listeNode.iterator(); isCalqueUnique && it.hasNext();) { + + EbliNode currentNode = it.next(); + + if(currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque){ + if (calque == null) { + EbliWidgetCreatorVueCalque creatorCalque = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); + calque = (TrPostVisuPanel) creatorCalque.getCalque(); + } else { + // -- error plus d 'un calque --// + isCalqueUnique = false; + } + } else if (currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { + EbliWidgetCreatorGraphe creatorGraphe = (EbliWidgetCreatorGraphe) currentNode.getCreator(); + listeGraphes.add(creatorGraphe.getGraphe()); + isGraphePresent = true; + } + + + } + + // -- on v\xE9rifie que les booleens n'ont pas d\xE9tect\xE9s d'erreurs --// + if (calque == null) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource + .getS("Il doit y avoir un calque s\xE9lectionn\xE9.")) + .activate(); + return; + } else if (!isCalqueUnique) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), + TrResource + .getS("Il doit y avoir un et un seul calque s\xE9lectionn\xE9.")).activate(); + return; + } else if (!isGraphePresent) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), + TrResource + .getS("Il doit y avoir au moins un graphe s\xE9lectionn\xE9.")).activate(); + return; + } + + // -- on applique l'action \xE0 chaque widget graphe --// + for (Iterator<EGGraphe> it = listeGraphes.iterator(); it.hasNext();) { + EGGraphe graphe = it.next(); + + // -- execution de l action pour le graphe selectionne --// + (new TrPostCourbeAddPointsAction(impl_, graphe, calque)).actionPerformed(new ActionEvent(calque, 0, + "ADDPOINTWIDGET")); + + } + scene_.refresh(); + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-03 17:06:10 UTC (rev 3876) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-03 17:07:03 UTC (rev 3877) @@ -3,14 +3,13 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; -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.JButton; import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -19,27 +18,13 @@ import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; -import org.fudaa.ebli.calque.BArbreCalque; -import org.fudaa.ebli.calque.BCalquePaletteInfo; import org.fudaa.ebli.calque.ZEbliCalquesPanel; -import org.fudaa.ebli.calque.action.EbliCalqueActionTimeChooser; -import org.fudaa.ebli.calque.action.EbliCalqueActionVariableChooser; -import org.fudaa.ebli.commun.EbliActionInterface; -import org.fudaa.ebli.commun.EbliActionPaletteAbstract; -import org.fudaa.ebli.commun.EbliComponentFactory; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.controle.BSelecteurList; -import org.fudaa.ebli.controle.BSelecteurListComboBox; +import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGFillePanel; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.ebli.courbe.EGGrapheTreeModel; -import org.fudaa.ebli.courbe.EGSpecificActions; -import org.fudaa.ebli.courbe.EGTree; -import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidgetController; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionConfigure; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetEditCreator; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; @@ -51,7 +36,6 @@ import org.netbeans.api.visual.model.ObjectSceneListener; import org.netbeans.api.visual.model.ObjectState; -import com.memoire.bu.BuButton; import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; import com.memoire.bu.BuMenuBar; @@ -103,6 +87,9 @@ */ JPanel conteneurTree_; + + JComponent panelSouthSuiviSouris_; + /** * bouton qui permet de masquer/afficher le tree */ @@ -124,18 +111,31 @@ // -- enregistrement de this comem listener de la scene pour le type d objet // selection changed--// - controller_.getScene().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, + controller_.getSceneCourante().addObjectSceneListener(this, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, ObjectSceneEventType.OBJECT_STATE_CHANGED); // -- ajout de la toolbar et du menu en haut --// - toolBarModifiable_.setFloatable(false); - this.add(toolBarModifiable_, BorderLayout.NORTH); + setToolBar(toolBarModifiable_); this.setJMenuBar(menuModifiable_); // -- init du panel de choix des trees --// - panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + panelTreeModifiable_ = new JScrollPane(controller_.getSceneCourante().getController().getOverviewComponent()); + panelSouthSuiviSouris_ = new JLabel(); + this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH); } + + + /** + * Met en place la menubar et la rend floatable false. + * + * @param _toolBar + */ + public void setToolBar(BuToolBar _toolBar) { + _toolBar.setFloatable(false); + this.add(_toolBar, BorderLayout.NORTH); + + } /** * @param _title @@ -191,23 +191,12 @@ pane.add(getScene().createSatelliteView()); right.add(over, BorderLayout.NORTH); - // pane = new JXCollapsiblePane(); - // toggleTree_ = new - // JButton(pane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)); - // toggleTree_.setText("Composants"); - // - // panelTreeModifiable_ = new JScrollPane(contrRoller_.createTree()); - // // right.add(panelTreeModifiable_, BorderLayout.CENTER); - // conteneurTree_ = new JPanel(new BorderLayout()); - // conteneurTree_.add(toggleTree_, BorderLayout.NORTH); - // conteneurTree_.add(pane, BorderLayout.CENTER); - // pane.add(panelTreeModifiable_); - // right.add(conteneurTree_, BorderLayout.CENTER); + toggleTree_ = new JButton("Arbre"); toggleTree_.setText("Composants"); - panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + panelTreeModifiable_ = new JScrollPane(controller_.getSceneCourante().getController().getOverviewComponent()); // right.add(panelTreeModifiable_, BorderLayout.CENTER); conteneurTree_ = new JPanel(new BorderLayout()); // conteneurTree_.add(toggleTree_, BorderLayout.NORTH); @@ -215,27 +204,10 @@ right.add(conteneurTree_, BorderLayout.CENTER); - // -- ajout du bouton qui permet de g\xE9rer tous les resultats - // TODO a enlever doit etre dans le menu Post - // BuButton boutonGestionMultiSrc = new BuButton("Gestion des projets"); - // - // boutonGestionMultiSrc.addActionListener(new ActionListener() { - // - // public void actionPerformed(ActionEvent e) { - // // -- affichage de la fenetre de gestion multi projet --// - // if (!projet_.filleProjetctManager_.isVisible()) projet_.impl_.addInternalFrame(projet_.filleProjetctManager_); - // - // // projet_.filleProjetctManager_.setSize(500, 250); - // - // } - // - // }); - // over.add(boutonGestionMultiSrc, BorderLayout.SOUTH); - // --verification qu il n existe pas de composant sur la scene auquel cas, - // selection automatique pour modification --// + if (controller_ != null) { - Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getScene().getObjects(); + Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getSceneCourante().getObjects(); if (noeudContenus.size() == 1) getScene().setSelectedObjects(noeudContenus); getScene().refresh(); } @@ -261,7 +233,7 @@ } public EbliScene getScene() { - return controller_.getScene(); + return controller_.getSceneCourante(); } @Override @@ -443,19 +415,22 @@ if (!node.hasWidget()) return; if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) { - // -- etape 1: ajout du tree de calque dans fudaaImplementation --// - changeTreeCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); + // -- etape 1: ajout du tree dans fudaaImplementation --// + changeTree(node.getWidget().getController_()); // -- etape 2: rechargement de la toolbar specifique dans this --// - changeToolbarCalque(((EbliWidgetCreatorVueCalque) node.getCreator()).getCalque()); + changeToolbar(node.getWidget().getController_()); + + } else if (node.getCreator() instanceof EbliWidgetCreatorGraphe) { + // -- etape 1: ajout du tree dans fudaaImplementation --// + changeTree(node.getWidget().getController_()); - // -- etape 1: ajout du tree de graphe dans fudaaImplementation --// - changeTreeGraphe(((EbliWidgetCreatorGraphe) node.getCreator()).getGraphe()); // -- etape 2: rechargement de la toolbar specifique dans this --// - changeToolbarGraphe((EbliWidgetCreatorGraphe) node.getCreator()); - } else { + changeToolbarSpecifiqueGraphe(node.getWidget().getController_(), (EbliWidgetCreatorGraphe) node.getCreator()); + } + else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTreeScene(); @@ -495,82 +470,47 @@ {} /** - * Methode qui met a jour le tree de droite avec le tree du calque selectionne. + * Methode qui met a jour le tree de droite avec le tree du calque ou graphe + * selectionne. * * @param calque */ - private void changeTreeCalque(ZEbliCalquesPanel _calque) { - // FIXME ne doit pas recree \xE0 chaque fois: porb de listener... + private synchronized void changeTree(EbliWidgetController _controller) { conteneurTree_.remove(panelTreeModifiable_); - - // JComponent component = EbliWidgetEditCreator.createView(new - // BArbreCalque(_calque.getArbreCalqueModel()), - // EbliResource.EBLI.getToolIcon("arbre"), "Calques", false); - // FIXME dangereux car chaque arbre s'enregistre en tant que listener du calque et il ne d\xE9sabonne jamais. - panelTreeModifiable_ = new JPanel(new BorderLayout()); - // FIXME DANGEREUX: le barbecalque s'enregistre en tant que listener du model a chaque fois !!!!!!! - panelTreeModifiable_.add(new BArbreCalque(_calque.getArbreCalqueModel())); - // panelTreeModifiable_ = new JScrollPane(component); - - this.toggleTree_.setText("Calques"); - - BCalquePaletteInfo info = new BCalquePaletteInfo(_calque.getArbreCalqueModel()); - info.setAvailable(true); - panelTreeModifiable_.add(info, BorderLayout.NORTH); + panelTreeModifiable_ = _controller.getOverviewComponent(); + // this.toggleTree_.setText("Calques"); conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); - // mise a jour du panel - conteneurTree_.validate(); - + + changeSouth(_controller); + + conteneurTree_.revalidate(); panelTreeModifiable_.revalidate(); + this.revalidate(); + + + } - /** - * Methode qui met a jour le tree de droite avec le tree du graphe selectionne. - * - * @param _graphe - */ - private void changeTreeGraphe(EGGraphe _graphe) { + + - conteneurTree_.remove(panelTreeModifiable_); - if (palette_ != null) conteneurTree_.remove(palette_); - // JComponent component = EbliWidgetEditCreator.createView(new - // JTree((EGGrapheTreeModel) _graphe.getModel()), - // EbliResource.EBLI.getToolIcon("arbre"), "Courbes", false); - - // POUR TOI LA FORCE AVOIR LE SELECTION MODEL A TOI ATTACHER TU DOIS// - // utiliser EGTree - EGTree tree = new EGTree(); - tree.setExpandsSelectedPaths(true); - tree.setActions(new EGSpecificActions(_graphe)); - EGGrapheTreeModel treeModel = (EGGrapheTreeModel) _graphe.getModel(); - tree.setModel(treeModel); - tree.setSelectionModel(treeModel.getSelectionModel()); - panelTreeModifiable_ = new JScrollPane(tree); - if (this.toggleTree_ != null) this.toggleTree_.setText("Courbes"); - // panelTreeModifiable_ = new JScrollPane(component); - conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); - // mise a jour du panel - conteneurTree_.validate(); - panelTreeModifiable_.revalidate(); - - } - /** * Met a jour le tree a droite si ni un graphe ni un calque n est selectionn\xE9. */ - private void changeTreeScene() { + private synchronized void changeTreeScene() { conteneurTree_.remove(panelTreeModifiable_); - if (palette_ != null) conteneurTree_.remove(palette_); - JComponent component = EbliWidgetEditCreator.createView(controller_.createTree(), EbliResource.EBLI - .getToolIcon("arbre"), "Composants", false); - - panelTreeModifiable_ = new JScrollPane(controller_.createTree()); + + panelTreeModifiable_ = new JScrollPane(getScene().getController().getOverviewComponent()); if (this.toggleTree_ != null) this.toggleTree_.setText("Liste des composants"); // panelTreeModifiable_ = new JScrollPane(component); conteneurTree_.add(panelTreeModifiable_, BorderLayout.CENTER); + + changeSouth(); + // mise a jour du panel - conteneurTree_.validate(); + conteneurTree_.revalidate(); panelTreeModifiable_.revalidate(); + this.revalidate(); } /** @@ -578,130 +518,98 @@ * * @param _calque */ - private void changeToolbarCalque(ZEbliCalquesPanel _calque) { + private synchronized void changeToolbar(EbliWidgetController _controller) { // nettoyage de la toolbar - toolBarModifiable_.removeAll(); - menuModifiable_.removeAll(); + this.remove(toolBarModifiable_); + this.remove(menuModifiable_); + // toolBarModifiable_.removeAll(); + toolBarModifiable_ = _controller.getToolbarComponent(); + menuModifiable_ = _controller.getMenubarComponent(); - // ajout des tool specifiques du calque - List actions = _calque.getController().getActions(); - for (Iterator iterator = actions.iterator(); iterator.hasNext();) { - EbliActionInterface object = (EbliActionInterface) iterator.next(); - if (object == null) { - toolBarModifiable_.addSeparator(); - } else { - toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); - } - } - - // ajout des menus specifiques pour le calque - JMenu[] specificMenus = _calque.getSpecificMenus(EbliLib.getS("Vue 2D")); - - for (int i = 0; i < specificMenus.length; i++) { - menuModifiable_.add(specificMenus[i]); - } - - // -- ajout des comboBox des variables --// - BSelecteurListComboBox combo = new BSelecteurListComboBox(); - // pour mettre \xE0 jour la combo d\xE8s que la s\xE9lection de l'arbre change - _calque.getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(combo); - combo.setPalettePanelTarget(_calque.getArbreCalqueModel().getSelectedCalque()); - // combo.setPalettePanelTarget(listselector.getTarget()); - combo.setMinimumSize(combo.getPreferredSize()); - combo.setMaximumSize(combo.getPreferredSize()); - - // ajout combobox - toolBarModifiable_.add(combo); - - EbliCalqueActionTimeChooser chooserT = new EbliCalqueActionTimeChooser(_calque.getArbreCalqueModel() - .getTreeSelectionModel(), true); - // pour activer l'action - chooserT.setSelected(true); - // // obligatoire pour creer le BselecteurList - // listselector = (BSelecteurList) chooserT.getPalette_(); - combo = (BSelecteurListComboBox) chooserT.buildContentPane(); - chooserT.updateBeforeShow(); - // _calque.getArbreCalqueModel().getTreeSelectionModel().addTreeSelectionListener(combo); - // combo.setPalettePanelTarget(listselector.getTarget_()); - combo.setMaximumSize(combo.getPreferredSize()); - combo.setMinimumSize(combo.getPreferredSize()); - - // ajout combobox - // toolBarModifiable_.add(chooserT.buildToolButton(EbliComponentFactory.INSTANCE)); - // combo.setToolTipText(); - toolBarModifiable_.add(combo); - - // ajout bouton toolbar - - // -- ajotu d un bouton pour la paletet des legendes --// - // toolBarModifiable_.add(new - // PaletteEditAction(_calque.getArbreCalqueModel() - // .getTreeSelectionModel())); - + // mise a jour des params - toolBarModifiable_.revalidate(); - menuModifiable_.revalidate(); + // toolBarModifiable_.revalidate(); + this.setToolBar(toolBarModifiable_); this.setJMenuBar(menuModifiable_); + + this.revalidate(); } - private void changeToolbarGraphe(EbliWidgetCreatorGraphe creator) { + + + /** + * Methode appelee pour les widget qui contiennent des graphes. + * + * @param _controller + * @param creator + */ + private synchronized void changeToolbarSpecifiqueGraphe(EbliWidgetController _controller, + EbliWidgetCreatorGraphe creator) { + // -- change la toolbar avec els actions generiques du controller --// + changeToolbar(_controller); + + if (!_controller.fonctionsAlreadySpecified()) { + // -- ajout des actions tr --// + ArrayList<EbliActionSimple> listeActions = new ArrayList<EbliActionSimple>(); EGFillePanel _graphe = creator.getGraphePanel(); TrPostVisuPanel _calque = (TrPostVisuPanel) creator.getCalquepanelProvenance(); - - // nettoyage de la toolbar - toolBarModifiable_.removeAll(); - menuModifiable_.removeAll(); - - // ajout des toolbar specifiques du calque - EbliActionInterface[] specificInterfaces = _graphe.getSpecificActions(); - for (int i = 0; i < specificInterfaces.length; i++) { - EbliActionInterface object = specificInterfaces[i]; - if (object == null) { - toolBarModifiable_.addSeparator(); - } else { - toolBarModifiable_.add(object.buildToolButton(EbliComponentFactory.INSTANCE)); - } + + listeActions.add(new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque)); + listeActions.add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); + _controller.addFonctionsSpecific(listeActions); } - - // ajout des menus specifiques - JMenu menu = new JMenu("Menu graphe"); - _graphe.fillSpecificMenu(menu); - menuModifiable_.add(menu); - - // -- ajout de l'action qui ajoute un point au graphe --// - TrPostCourbeAddPointsAction addPoint = new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque); - toolBarModifiable_.add(addPoint.buildToolButton(EbliComponentFactory.INSTANCE)); - menu.add(addPoint); - - TrPostCourbeAddVariableAction addVariable = new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe()); - toolBarModifiable_.add(addVariable.buildToolButton(EbliComponentFactory.INSTANCE)); - menu.add(addVariable); - + // mise a jour des params - toolBarModifiable_.revalidate(); - menuModifiable_.revalidate(); - this.setJMenuBar(menuModifiable_); this.revalidate(); } - private void changeToolbarScene() { + private synchronized void changeToolbarScene() { // nettoyage de la toolbar - toolBarModifiable_.removeAll(); - menuModifiable_.removeAll(); + this.remove(toolBarModifiable_); + this.remove(menuModifiable_); - toolBarModifiable_.add(new EbliWidgetActionConfigure(controller_.getScene())); + toolBarModifiable_ = new BuToolBar(); + menuModifiable_ = new BuMenuBar(); + + + + toolBarModifiable_.add(new EbliWidgetActionConfigure(controller_.getSceneCourante())); JMenu menu = new JMenu("Configurer"); - menu.add(new EbliWidgetActionConfigure(controller_.getScene())); + menu.add(new EbliWidgetActionConfigure(controller_.getSceneCourante())); menuModifiable_.add(menu); // mise a jour des params - toolBarModifiable_.revalidate(); - menuModifiable_.revalidate(); + + this.setToolBar(toolBarModifiable_); this.setJMenuBar(menuModifiable_); this.revalidate(); } + + /** + * change le component south de la frame. dans le cas du calque il s agit du + * suivi souris. + * + * @param _controller + */ + private synchronized void changeSouth(EbliWidgetController _controller) { + this.remove(this.panelSouthSuiviSouris_); + this.panelSouthSuiviSouris_ = _controller.gettracableComponent(); + this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH); + panelSouthSuiviSouris_.revalidate(); + this.revalidate(); + } + + private synchronized void changeSouth() { + this.remove(this.panelSouthSuiviSouris_); + this.panelSouthSuiviSouris_ = new JLabel(); + + this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH); + panelSouthSuiviSouris_.revalidate(); + this.revalidate(); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-03 17:06:10 UTC (rev 3876) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-03 17:07:03 UTC (rev 3877) @@ -12,7 +12,6 @@ import javax.swing.JMenu; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.ListSelectionModel; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ebli.calque.BCalqueLegende; @@ -29,7 +28,6 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorShape; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorTextLabel; -import org.fudaa.ebli.visuallibrary.EbliWidgetSynchroniser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBackGround; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionBloqueOuDebloqueWidget; @@ -49,13 +47,9 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; -import org.fudaa.ebli.visuallibrary.tree.EbliJXTreeTableCellRenderer; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; -import org.jdesktop.swingx.JXTreeTable; -import org.jdesktop.swingx.decorator.HighlighterFactory; -import org.netbeans.api.visual.model.ObjectSceneEventType; import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuComboBox; import com.memoire.bu.BuDesktop; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPanel; @@ -63,24 +57,34 @@ import com.memoire.bu.BuSeparator; /** - * Controller des actions pour les ebliWidget. + * Controller des actions pour les ebliWidget. Gere les multi layout. * - * @author genesis + * @author Adrien Hadoux * */ public class TrPostLayoutPanelController { JPanel pn_; - EbliWidgetJXTreeTableModel treeModel_; - List<EbliActionAbstract> actions; - + /** - * Tree qui contient la hierarchie des widget de la scene. + * scene seelctionnee par l utilisateur */ - JXTreeTable treeScene = null; - + EbliScene sceneCourante_; + + /** + * combobox qui gere le multiscene + */ + BuComboBox comboMultiScenes_; + + /** + * Liste qui contient l'ensemble des scenes. + */ + ArrayList<EbliScene> listeScenes_ = new ArrayList<EbliScene>(); + + List<EbliActionAbstract> actions; + TrPostProjet projet_; /** @@ -89,14 +93,44 @@ private ZEbliCalquesPanel calquePrincipal; TrPostLayoutPanelController(EbliScene _scene, TrPostProjet _projet) { - treeModel_ = new EbliWidgetJXTreeTableModel(_scene); + // treeModel_ = _scene.getTreeModel(); + sceneCourante_ = _scene; + listeScenes_.add(_scene); _scene.setCmdMng(new CtuluCommandManager()); projet_ = _projet; + comboMultiScenes_ = new BuComboBox(); } + + + public void addScene(EbliScene _scene){ + listeScenes_.add(_scene); + } + + public int getNbScene() { + return listeScenes_.size(); + } + + public boolean removeScene(EbliScene _scene) { + return listeScenes_.remove(_scene); + } + + public void changeScene(EbliScene _scene) { + sceneCourante_ = _scene; + } + + public EbliScene getScene(int i) { + return listeScenes_.get(i); + } + + + EbliScene getSceneCourante() { + return sceneCourante_; + } + /** * Methode specialisee dans l ajout d un ndoe de type calque a la scene. * @@ -204,10 +238,10 @@ * @param node */ public void addNode(EbliNode node) { - getScene().addNode(node); + getSceneCourante().addNode(node); // -- rafraichissement de la scene pour eviter les plantages --// - getScene().refresh(); + getSceneCourante().refresh(); } public EbliNode addRectangle() { @@ -255,7 +289,7 @@ // ajout du node au layout addNode(nodeLegende); - getScene().refresh(); + getSceneCourante().refresh(); return nodeLegende; } @@ -303,7 +337,7 @@ // widget image - _l.add(new EbliWidgetActionImageChooser(getScene())); + _l.add(new EbliWidgetActionImageChooser(getSceneCourante())); // widget texte //TODO a revoir @@ -325,13 +359,7 @@ return m; } - /** - * Model du Jxtree associe. - */ - // private EbliWidgetJXTreeModel modelTree_; - /** - * Tree associe a la scene. - */ + protected JComponent[] createSpecificComponent(JDesktopPane j, JComponent parent) { List<EbliActionAbstract> acts = getActions(); @@ -357,96 +385,44 @@ return (JComponent[]) res.toArray(new JComponent[res.size()]); } - /** - * Methode qui cree le tree ou le renvoie si ce dernier est cree. - * - * @return tree des widgets. - */ - public JXTreeTable createTree() { - - if (treeScene != null) { + - // FuLog.warning("treeScene JE SUIS PA nul"); - return treeScene; - } - - treeScene = new JXTreeTable(treeModel_); - - // -- ajout du tree au model pour les dimensionnements --// - // modeltable.setTree_(tree_); - - // --vision du noeud root --// - treeScene.setRootVisible(false); - - // --ajout du renderer pour les images-// - treeScene.setTreeCellRenderer(new EbliJXTreeTableCellRenderer()); - - // -- ouvert par defaut --// - treeScene.expandAll(); - - // -- ajout des highlighters customs --// - treeScene.setHighlighters(HighlighterFactory.createSimpleStriping()); - treeScene.setShowsRootHandles(true); - // -- selection unique --// - treeScene.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - treeScene.setEditable(true); - - // --dimensions des colonnes --// - treeScene.getColumn(0).setPreferredWidth(60); - treeScene.getColumn(1).setPreferredWidth(50); - treeScene.getColumn(2).setPreferredWidth(5); - // FIXME Adrien: si on edite du texte dans le jxtreetable els colonnes se - // redimensionnents - treeScene.getColumn(0).setResizable(false); - treeScene.getColumn(1).setResizable(false); - treeScene.getColumn(2).setResizable(false); - treeScene.validate(); - - //-- ajout du synchroniser du tree/scene --// - - getScene().addObjectSceneListener(new EbliWidgetSynchroniser(treeModel_, treeScene), - ObjectSceneEventType.OBJECT_SELECTION_CHANGED); - - return treeScene; - - } - public List<EbliActionAbstract> getActions() { if (actions == null) { List<EbliActionAbstract> init = new ArrayList<EbliActionAbstract>(20); - init.add(new EbliWidgetActionAlign.Left(getScene())); - init.add(new EbliWidgetActionAlign.Right(getScene())); - init.add(new EbliWidgetActionAlign.Middle(getScene())); - init.add(new EbliWidgetActionAlign.Center(getScene())); - init.add(new EbliWidgetActionAlign.Top(getScene())); - init.add(new EbliWidgetActionAlign.Bottom(getScene())); + init.add(new EbliWidgetActionAlign.Left(getSceneCourante())); + init.add(new EbliWidgetActionAlign.Right(getSceneCourante())); + init.add(new EbliWidgetActionAlign.Middle(getSceneCourante())); + init.add(new EbliWidgetActionAlign.Center(getSceneCourante())); + init.add(new EbliWidgetActionAlign.Top(getSceneCourante())); + init.add(new EbliWidgetActionAlign.Bottom(getSceneCourante())); init.add(null); - init.add(new EbliWidgetActionForeGround(getScene())); - init.add(new EbliWidgetActionBackGround(getScene())); + init.add(new EbliWidgetActionForeGround(getSceneCourante())); + init.add(new EbliWidgetActionBackGround(getSceneCourante())); init.add(null); // -- action de duplication --// - init.add(new EbliWidgetActionDuplicate(getScene())); + init.add(new EbliWidgetActionDuplicate(getSceneCourante())); init.add(null); // -- Action sur le format --// - init.add(new EbliWidgetActionColorForeground(getScene())); - init.add(new EbliWidgetActionColorBackground(getScene())); + init.add(new EbliWidgetActionColorForeground(getSceneCourante())); + init.add(new EbliWidgetActionColorBackground(getSceneCourante())); // -- action de configuration des composants graphiques--// - init.add(new EbliWidgetActionConfigure(getScene())); + init.add(new EbliWidgetActionConfigure(getSceneCourante())); init.add(null); // -- actions de retaillage min et max --// // init.add(new EbliWidgetActionRetaillageHorizontal(getScene(), EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MIN)); - init.add(new EbliWidgetActionRetaillageHorizontal(getScene(), EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MAX)); + init.add(new EbliWidgetActionRetaillageHorizontal(getSceneCourante(), EbliWidgetActionRetaillageHorizontal.RETAIILLAGE_MAX)); // init.add(null); // init.add(new EbliWidgetActionRetaillageVertical(getScene(), // EbliWidgetActionRetaillageVertical.RETAIILLAGE_MIN)); - init.add(new EbliWidgetActionRetaillageVertical(getScene(), EbliWidgetActionRetaillageVertical.RETAIILLAGE_MAX)); + init.add(new EbliWidgetActionRetaillageVertical(getSceneCourante(), EbliWidgetActionRetaillageVertical.RETAIILLAGE_MAX)); init.add(null); // -- blocage des widgets --// - init.add(new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(getScene())); - init.add(new EbliWidgetActionBloqueOuDebloqueWidget.DeBloque(getScene())); + init.add(new EbliWidgetActionBloqueOuDebloqueWidget.Bloque(getSceneCourante())); + init.add(new EbliWidgetActionBloqueOuDebloqueWidget.DeBloque(getSceneCourante())); init.add(null); // -- objets graphiques de base --// @@ -454,10 +430,13 @@ // -- ajout d'une action specifique de recreation du calque en cas de - // suppression --// + // suppression, on choisit la source a prendre en compte --// init.add(new TrPostActionChooseAndCreateCalque(projet_)); + // -- action qui permet d ajouter un point du calque dans tous les graphes + // selectionnes --// + init.add(new TrPostActionAddPointFromWidgetCalque(getSceneCourante(), projet_.impl_)); actions = Collections.unmodifiableList(init); @@ -471,7 +450,7 @@ pn_ = new BuPanel(new BuBorderLayout()); // ajout de la scene au centre - pn_.add(new JScrollPane(treeModel_.getScene().createView()), BuBorderLayout.CENTER); + pn_.add(new JScrollPane(getSceneCourante().createView()), BuBorderLayout.CENTER); // // -- construction de la barre des commandes de base --// // content.add(buildToolBar(), BuBorderLayout.NORTH); @@ -480,7 +459,5 @@ } - EbliScene getScene() { - return treeModel_.getScene(); - } + } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrpostComboMultiScenes.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrpostComboMultiScenes.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrpostComboMultiScenes.java 2008-09-03 17:07:03 UTC (rev 3877) @@ -0,0 +1,20 @@ +package org.fudaa.fudaa.tr.post; + +import javax.swing.DefaultComboBoxModel; + +public class TrpostComboMultiScenes extends DefaultComboBoxModel { + + TrPostLayoutPanelController controller_; + + + public Object getElementAt(int _index) { + return controller_.getScene(_index); + } + + public int getSize() { + + return controller_.getNbScene(); + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-09-04 16:42:52
|
Revision: 3883 http://fudaa.svn.sourceforge.net/fudaa/?rev=3883&view=rev Author: hadouxad Date: 2008-09-04 16:42:59 +0000 (Thu, 04 Sep 2008) Log Message: ----------- Action pour les addpoint des courbes - Genere une interface de selections des graphes : 2 jlist pour les graphes possibles et choisis - on les fais changer de list avec les boutons prevus - renderer des jlist affichant une icone du graphe, c'est plus sexy - un comboBox pour choisir le calque - meme renderer qui recupere une image reduite du calque gestion du multi layout MULTI INTERNALFRAME - on peut cr?\195?\169er plusieurs layoutfille via le menu "layout": action ajout fenetre - menu a cot?\195?\169 de post pour ajouter une nouvelle fenetre - trpostprojet ne contient plus une fillelayout mais une liste de filel layout - pour acc?\195?\169der a la bonne fillelayout, il faut utiliser la methode getSelectedFilleLayout() de trpostprojet qui retourne la fille en cours d utilisation ou sinon (si on selectionne une autre frame) la premiere fille. - methode permet de tracer els graphes et d autes composants dans la bonne fenetre MULTI LAYOUT: tabbedPane dans INTERNALFRAME - on peut g?\195?\169rer plusieurs scene au sein de la meme framelayout - construction d un jtabbedPane pour gerer cela - construction d un menu "layout dans la fillaleayout - modifier toutes les actions pour gerer le multi scene - chaque action herite de la classe ebliWIdgetAction qui reprend EbliActionSimple et gere la scene et le cmdManagement. CELA FONCTIONNE BIEN pour les 2 m?\195?\169thodes: - ajout de widget (objet classique, graphe, calque...) - switch interne et externe sans probleme car c'est vraiment bien foutu les buInternalFrame! - les actions fonctionnent ainsi que leur undo/redo - Pour recuperer toutes les scenes (pour la suite, sauvegarde): - il faut prendre la liste de fillelayout du projet - dans chaque fillelayout il faut prendre la liste des scene dans leur controller pas compliqu?\195?\169. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionSimple.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -64,7 +64,7 @@ /** * Le gestionnaire de commande associe \xE0 la scene */ - CtuluCommandManager cmdMng_; + private CtuluCommandManager cmdMng_; EbliWidgetEditCreator editor_ = EbliWidgetEditCreator.INSTANCE; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -39,6 +39,8 @@ public void setPropGraphique(Map<String, Object> propGraphique) { this.propGraphique = propGraphique; + + } protected EbliWidgetController controller_; @@ -160,8 +162,8 @@ undoRedo.addNewPropertie(propGraphique); // -- enregistrement de la commande undo/redo --// - if (getEbliScene().cmdMng_ != null) { - getEbliScene().cmdMng_.addCmd(undoRedo); + if (getEbliScene().getCmdMng() != null) { + getEbliScene().getCmdMng().addCmd(undoRedo); } // -- mise a jour des parametres de la map --// Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordure.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -166,8 +166,8 @@ // -- enregistrement de la commande undo/redo --// - if (getEbliScene().cmdMng_ != null) { - getEbliScene().cmdMng_.addCmd(undoRedo); + if (getEbliScene().getCmdMng() != null) { + getEbliScene().getCmdMng().addCmd(undoRedo); } // -- mise a jour des parametres de la map --// Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -9,8 +9,6 @@ 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; @@ -34,7 +32,7 @@ *@author Adrien Hadoux * */ -public abstract class EbliWidgetActionAlign extends EbliActionSimple { +public abstract class EbliWidgetActionAlign extends EbliWidgetActionSimple { public static class Bottom extends EbliWidgetActionAlign { @@ -271,32 +269,18 @@ * */ private static final long serialVersionUID = 1L; - EbliScene scene_; + - // public final static int ALIGNLEFT = 0; - // - // public final static int ALIGNRIGHT = 1; - // - // public final static int ALIGNCENTERHORIZONTAL = 2; - // - // public final static int ALIGNCENTERVERTICAL = 3; - // - // public final static int ALIGNTOP = 4; - // - // public final static int ALIGNBOTTOM = 5; - // - // int typeAlignement_; + - CtuluCommandContainer cmd_; + public EbliWidgetActionAlign(String name, Icon ic, String id, EbliScene _scene) { - super(name, ic, id); + super(_scene, name, ic, id); // TODO Auto-generated constructor stub - scene_ = _scene; - cmd_ = _scene.getCmdMng(); - // typeAlignement_ = _typeAlignement; - // -- renseignements des infos complementaires --// - // putValue(NAME, "Alignement " + traduct(_typeAlignement)); + + + } @@ -340,38 +324,8 @@ } + /** - * methode qui recalcule la nouvelle position par rapport a la scene et a l - * alignement choisiT. - */ - - // private Point calculeNewLocation(Point _previousLocation, Rectangle - // _dimensionWidget, Dimension _dimensionScene) { - // - // switch (typeAlignement_) { - // case ALIGNLEFT: - // return new Point(0, _previousLocation.y); - // case ALIGNRIGHT: - // return new Point(_dimensionScene.width - _dimensionWidget.width, - // _previousLocation.y); - // case ALIGNCENTERHORIZONTAL: - // return new Point(_dimensionScene.width / 2 - _dimensionWidget.width / 2, - // _previousLocation.y); - // case ALIGNCENTERVERTICAL: - // return new Point(_previousLocation.x, _dimensionScene.height / 2 - - // _dimensionWidget.height / 2); - // case ALIGNTOP: - // return new Point(_previousLocation.x, 0); - // case ALIGNBOTTOM: - // return new Point(_previousLocation.x, _dimensionScene.height - - // _dimensionWidget.height); - // - // default: - // return _previousLocation; - // } - // - // } - /** * @param _widgetToMove * non vide et non null * @return les nouvelles positions correspondantes aux points pass\xE9s en @@ -379,82 +333,6 @@ */ protected abstract List<Point> getNewPositionFor(List<Widget> _widgetToMove); - // private String traduct(int _align) { - // switch (typeAlignement_) { - // case ALIGNLEFT: - // return "\xE0 gauche"; - // case ALIGNRIGHT: - // return "\xE0 droite"; - // case ALIGNCENTERHORIZONTAL: - // return "centr\xE9 horizontal"; - // case ALIGNCENTERVERTICAL: - // return "centr\xE9 vertical"; - // case ALIGNTOP: - // return "en haut"; - // case ALIGNBOTTOM: - // return "en bas"; - // - // default: - // return ""; - // } - // } - - /** - * action alignement qui realise l alignements de tous les composants - */ - // public void alignComponents() { - // - // // -- recuperation de la liste des widgets selectionnees --// - // - // Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();// - // scene_ - // // . - // // getNodes - // // ( - // // ) - // // ; - // - // // -- parcours des nodes - // for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - // - // EbliNode currentNode = it.next(); - // if (currentNode != null && currentNode.isMovable()) { - // - // // -- deplacement que si la widget est selectionnee --// - // if (currentNode.getCreator().getWidget().getState().isSelected()) { - // - // // -- enregistrement de la previous position --// - // Point previousLocation = currentNode.getPreferedLocation(); - // - // // -- calcul de la nouvelle position du node en fonction de - // // l alignement choisi --// - // Point newLocation = - // calculeNewLocation(currentNode.getCreator().getWidget().getLocation(), - // currentNode - // .getCreator().getWidget().getBounds(), scene_.getView().getSize()); - // - // // -- tentative de modification de la position du node --// - // currentNode.setPreferedLocation(newLocation); - // - // currentNode.getCreator().getWidget().revalidate(); - // currentNode.getCreator().getWidget().repaint(); - // - // // -- enregistrement de la commande undo redo --// - // - // // --creation d une commande undo redo --// - // CommandMove cmd = new CommandMove(currentNode.getCreator().getWidget(), - // previousLocation, newLocation); - // - // // -- ajout de la commande undo redo --// - // if (cmd_ != null) - // cmd_.addCmd(cmd); - // - // } - // } - // - // } - // // -- rafraichissement de la scene --// - // scene_.refresh(); - // - // } + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -7,7 +7,6 @@ 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; @@ -18,17 +17,17 @@ * @author genesis * */ -public class EbliWidgetActionBackGround extends EbliActionSimple{ +public class EbliWidgetActionBackGround extends EbliWidgetActionSimple { - EbliScene scene_; + CtuluCommandContainer cmd_; public EbliWidgetActionBackGround(EbliScene _scene){ - super(EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_disposerderriere"), + super(_scene, EbliResource.EBLI.getString("Arri\xE8re plan"), CtuluResource.CTULU.getIcon("crystal_disposerderriere"), "BACKGROUND"); - scene_=_scene; + cmd_ = _scene.getCmdMng(); putValue(NAME,"Arri\xE8re plan"); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -9,7 +9,6 @@ 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; @@ -21,19 +20,19 @@ * @author Adrien Hadoux * */ -public abstract class EbliWidgetActionBloqueOuDebloqueWidget extends EbliActionSimple { +public abstract class EbliWidgetActionBloqueOuDebloqueWidget extends EbliWidgetActionSimple { private static final long serialVersionUID = 1L; - EbliScene scene_; + final CtuluCommandContainer cmd_; boolean bloque_ = true; public EbliWidgetActionBloqueOuDebloqueWidget(String name, Icon ic, String id, EbliScene _scene, boolean bloque) { - super(name, ic, id); + super(_scene, name, ic, id); - scene_ = _scene; + putValue(NAME, "Duplication des \xE9lements s\xE9lectionn\xE9s"); cmd_ = _scene.getCmdMng(); bloque_ = bloque; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -11,7 +11,6 @@ import java.util.Set; 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; @@ -25,23 +24,23 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActionColorBackground extends EbliActionSimple{ +public class EbliWidgetActionColorBackground extends EbliWidgetActionSimple { CtuluCommandContainer cmd_; - EbliScene scene_; + public EbliWidgetActionColorBackground(EbliScene _scene) { - super(EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); + super(_scene, EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); - scene_=_scene; + cmd_=_scene.getCmdMng(); 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-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -10,7 +10,6 @@ import java.util.Set; 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; @@ -24,23 +23,24 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActionColorForeground extends EbliActionSimple{ +public class EbliWidgetActionColorForeground extends EbliWidgetActionSimple { CtuluCommandContainer cmd_; - EbliScene scene_; + public EbliWidgetActionColorForeground(EbliScene _scene) { - super(EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("palettecouleur"), "CONTOUR"); + super(_scene, EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("palettecouleur"), + "CONTOUR"); - scene_=_scene; + cmd_=_scene.getCmdMng(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionConfigure.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -6,12 +6,11 @@ import javax.swing.JDialog; -import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurePalette; +import org.fudaa.ebli.visuallibrary.EbliScene; 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; @@ -23,13 +22,13 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActionConfigure extends EbliActionSimple { +public class EbliWidgetActionConfigure extends EbliWidgetActionSimple { - ObjectScene scene_; + - public EbliWidgetActionConfigure(ObjectScene _widget) { - super(EbliLib.getS("Configure"), BuResource.BU.getIcon("configurer"), "CONFIGURE"); - scene_ = _widget; + public EbliWidgetActionConfigure(EbliScene _scene) { + super(_scene, EbliLib.getS("Configure"), BuResource.BU.getIcon("configurer"), "CONFIGURE"); + } /** Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -7,7 +7,6 @@ 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; @@ -22,18 +21,19 @@ * @author genesis * */ -public class EbliWidgetActionDuplicate extends EbliActionSimple{ +public class EbliWidgetActionDuplicate extends EbliWidgetActionSimple { /** * */ private static final long serialVersionUID = 1L; - EbliScene scene_; + final CtuluCommandContainer cmd_; public EbliWidgetActionDuplicate(EbliScene _scene){ - super(EbliResource.EBLI.getString("dupliquer les objets s\xE9lectionn\xE9s"), CtuluResource.CTULU.getIcon("crystal_copier"), "DUPLICATE"); - scene_=_scene; + super(_scene, EbliResource.EBLI.getString("dupliquer les objets s\xE9lectionn\xE9s"), CtuluResource.CTULU + .getIcon("crystal_copier"), "DUPLICATE"); + putValue(NAME,"Duplication des \xE9lements s\xE9lectionn\xE9s"); cmd_ = _scene.getCmdMng(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -7,7 +7,6 @@ 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; @@ -18,17 +17,17 @@ * @author genesis * */ -public class EbliWidgetActionForeGround extends EbliActionSimple{ +public class EbliWidgetActionForeGround extends EbliWidgetActionSimple { - EbliScene scene_; + CtuluCommandContainer cmd_; public EbliWidgetActionForeGround(EbliScene _scene){ - super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_disposerdevant"), + super(_scene, EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_disposerdevant"), "FORGROUND"); - scene_=_scene; + cmd_ = _scene.getCmdMng(); putValue(NAME,"Premier plan"); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionImageChooser.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -6,7 +6,6 @@ import java.awt.Toolkit; import java.awt.event.ActionEvent; -import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -21,13 +20,13 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActionImageChooser extends EbliActionSimple { +public class EbliWidgetActionImageChooser extends EbliWidgetActionSimple { - EbliScene scene_; + public EbliWidgetActionImageChooser(EbliScene _widget) { - super(EbliLib.getS("Ins\xE9rer une image"), BuResource.BU.getIcon("crystal_image"), "INSERTIONIMAGE"); - scene_ = _widget; + super(_widget, EbliLib.getS("Ins\xE9rer une image"), BuResource.BU.getIcon("crystal_image"), "INSERTIONIMAGE"); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -11,7 +11,6 @@ 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; @@ -24,22 +23,23 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActionRetaillageHorizontal extends EbliActionSimple { +public class EbliWidgetActionRetaillageHorizontal extends EbliWidgetActionSimple { public final static int RETAIILLAGE_MAX = 0; public final static int RETAIILLAGE_MIN = 1; public int typeRetaillage_; - EbliScene scene_; + CtuluCommandContainer cmd_; public EbliWidgetActionRetaillageHorizontal(EbliScene _scene, int _typeRetaillage) { - super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), "FORGROUND"); + super(_scene, EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), + "FORGROUND"); // -- type retailage --// typeRetaillage_ = _typeRetaillage; - scene_ = _scene; + cmd_=_scene.getCmdMng(); if (_typeRetaillage == RETAIILLAGE_MAX) { putValue(NAME, "Resize Horizontal Max"); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -11,7 +11,6 @@ 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; @@ -24,22 +23,23 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActionRetaillageVertical extends EbliActionSimple { +public class EbliWidgetActionRetaillageVertical extends EbliWidgetActionSimple { public final static int RETAIILLAGE_MAX = 0; public final static int RETAIILLAGE_MIN = 1; public int typeRetaillage_; - EbliScene scene_; + CtuluCommandContainer cmd_; public EbliWidgetActionRetaillageVertical(EbliScene _scene, int _typeRetaillage) { - super(EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), "FORGROUND"); + super(_scene, EbliResource.EBLI.getString("Premier plan"), CtuluResource.CTULU.getIcon("crystal_rangericones"), + "FORGROUND"); // -- type retailage --// typeRetaillage_ = _typeRetaillage; - scene_ = _scene; + cmd_ = _scene.getCmdMng(); if (_typeRetaillage == RETAIILLAGE_MAX) { putValue(NAME, "Resize Vertical Max"); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionSimple.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionSimple.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionSimple.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -0,0 +1,44 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import javax.swing.Icon; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.visuallibrary.EbliScene; + +/** + * Action reservee aux widgets. Uniformise la gestion de la scene dans l action. + * permet de changer de scene pour la meme action. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetActionSimple extends EbliActionSimple { + + protected EbliScene scene_; + protected CtuluCommandContainer cmd_; + + public EbliWidgetActionSimple(EbliScene _scene, String _name, Icon _ic, String _ac) { + super(_name, _ic, _ac); + scene_ = _scene; + cmd_ = _scene.getCmdMng(); + } + + + public EbliScene getScene() { + return scene_; + } + + /** + * met a jour la scene pour l action. + * + * @param _scene + */ + public void setScene(EbliScene _scene) { + scene_ = _scene; + + } + + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -5,7 +5,6 @@ import java.awt.event.ActionEvent; import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; -import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; @@ -19,13 +18,13 @@ * @author Adrien Hadoux * */ -public class EbliWidgetActiontextEditor extends EbliActionSimple { +public class EbliWidgetActiontextEditor extends EbliWidgetActionSimple { - EbliScene scene_; + public EbliWidgetActiontextEditor(EbliScene _widget) { - super(EbliLib.getS("Ins\xE9rer une texte"), BuResource.BU.getIcon("crystal_fonte"), "INSERTIONTEXTE"); - scene_ = _widget; + super(_widget, EbliLib.getS("Ins\xE9rer une texte"), BuResource.BU.getIcon("crystal_fonte"), "INSERTIONTEXTE"); + } public void actionPerformed(ActionEvent e) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -87,8 +87,12 @@ } - BufferedImage image; + BufferedImage imageGraphe; + public BufferedImage getImageGraphe() { + return imageGraphe; + } + protected void paintWidget() { Rectangle rec = getClientArea(); Graphics2D g = getGraphics(); @@ -101,15 +105,15 @@ } // mode edition - if (image == null || image.getWidth() != rec.width || image.getHeight() != rec.height) { + if (imageGraphe == null || imageGraphe.getWidth() != rec.width || imageGraphe.getHeight() != rec.height) { FuLog.debug("EWI: recreate image"); Map params = new HashMap(); CtuluLibImage.setCompatibleImageAsked(params); - image = getGraphe().produceImage(rec.width - 1, rec.height - 1, params); + imageGraphe = getGraphe().produceImage(rec.width - 1, rec.height - 1, params); } - g.drawImage(image, rec.x, rec.y, rec.width - 1, rec.height - 1, null); + g.drawImage(imageGraphe, rec.x, rec.y, rec.width - 1, rec.height - 1, null); // g.translate(-rec.x, -rec.y); } @@ -166,7 +170,7 @@ public void windowClosing(WindowEvent _e) { // zoom_ = calquePanel_.getVueCalque().getViewBoite(); - image = null; + imageGraphe = null; getEbliScene().refresh(); frame_ = null; @@ -202,31 +206,31 @@ public void axeAspectChanged(EGAxe _c) { // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre - this.image = null; + this.imageGraphe = null; this.repaint(); } public void axeContentChanged(EGAxe _c) { // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre - this.image = null; + this.imageGraphe = null; this.repaint(); } public void courbeAspectChanged(EGObject _c, boolean _visibil) { // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre - this.image = null; + this.imageGraphe = null; this.repaint(); } public void courbeContentChanged(EGObject _c, boolean restore) { // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre - this.image = null; + this.imageGraphe = null; this.repaint(); } public void structureChanged() { // il faut indiquer que l image a ete modifiee donc la forcer a se repaindre - this.image = null; + this.imageGraphe = null; this.repaint(); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -7,10 +7,10 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.tr.common.TrResource; @@ -24,17 +24,19 @@ * @author genesis * */ -public class TrPostActionAddPointFromWidgetCalque extends EbliActionSimple { +public class TrPostActionAddPointFromWidgetCalque extends EbliWidgetActionSimple { - EbliScene scene_; + CtuluCommandContainer cmd_; TrPostCommonImplementation impl_; + + public TrPostActionAddPointFromWidgetCalque(EbliScene _scene, TrPostCommonImplementation _impl) { - super(TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), + super(_scene, TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), "ADDPOINTWIDGET"); - scene_ = _scene; + cmd_ = _scene.getCmdMng(); impl_ = _impl; putValue(NAME, "Arri\xE8re plan"); Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -0,0 +1,311 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import javax.swing.UIManager; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuDialogError; + +/** + * Action qui: - recupere la liste des calques potentiels - recupere la liste + * des graphes potentiels - propose a l utilisateur une interface combo pour + * choisir le calque cible - propose a l utilisateur une interface jlist pour + * choisir le(s) graphe(s) cible(s) realise la moulinette + * @author Adrien Hadoux + * + */ +public class TrPostActionAddPointFromWidgetCalque2 extends EbliWidgetActionSimple { + + + CtuluCommandContainer cmd_; + TrPostCommonImplementation impl_; + + JComboBox boxCalques_; + JList jlisteGraphesChoix; + JList jlisteGraphesSelections; + + JButton validation, select, unselect, creationNewGraphe, quitter; + JDialog frame_; + DefaultListModel modelGraphesPossibles; + DefaultListModel modelGraphesChoisis; + ArrayList<TrPostVisuPanel> listeCalquesPossibles; + ArrayList<EGGraphe> listeGraphesPossibles; + ArrayList<EGGraphe> listeGraphesChoisis; + ArrayList<JLabel> listeObjetsCalques; + + + + public TrPostActionAddPointFromWidgetCalque2(EbliScene _scene, TrPostCommonImplementation _impl) { + super(_scene, TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), "ADDPOINTWIDGET"); + + cmd_ = _scene.getCmdMng(); + impl_ = _impl; + putValue(NAME, "Arri\xE8re plan"); + this + .setDefaultToolTip(TrResource + .getS("S\xE9lectionnez simultan\xE9ment le calque qui contient les points ainsi que les graphes qui contiendront les courbes ")); + + } + + + + public void actionPerformed(ActionEvent e) { + + + if (e.getSource() == select) { + if (jlisteGraphesChoix.getSelectedIndex() != -1) { + EGGraphe graphe = listeGraphesPossibles.get(jlisteGraphesChoix.getSelectedIndex()); + JLabel title = (JLabel) modelGraphesPossibles.getElementAt(jlisteGraphesChoix.getSelectedIndex()); + modelGraphesChoisis.addElement(title); + listeGraphesChoisis.add(graphe); + modelGraphesPossibles.removeElementAt(jlisteGraphesChoix.getSelectedIndex()); + listeGraphesPossibles.remove(jlisteGraphesChoix.getSelectedIndex()); + } + } else if (e.getSource() == unselect) { + if (jlisteGraphesSelections.getSelectedIndex() != -1) { + EGGraphe graphe = listeGraphesChoisis.get(jlisteGraphesSelections.getSelectedIndex()); + JLabel title = (JLabel) modelGraphesChoisis.getElementAt(jlisteGraphesSelections.getSelectedIndex()); + modelGraphesPossibles.addElement(title); + listeGraphesPossibles.add(graphe); + modelGraphesChoisis.removeElementAt(jlisteGraphesSelections.getSelectedIndex()); + listeGraphesChoisis.remove(jlisteGraphesSelections.getSelectedIndex()); + } + }else if (e.getSource() == validation) { + // validation de l action + if (listeGraphesChoisis.size() == 0) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource + .getS("Il doit y avoir au moins un graphe s\xE9lectionn\xE9.")).activate(); + return; + } + + + TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); + + // -- on applique l'action \xE0 chaque widget graphe --// + for (int i = 0; i < listeGraphesChoisis.size(); i++) { + EGGraphe graphe = listeGraphesChoisis.get(i); + + // -- execution de l action pour le graphe selectionne --// + (new TrPostCourbeAddPointsAction(impl_, graphe, calqueChoisi)).actionPerformed(new ActionEvent(calqueChoisi, 0, + "ADDPOINTWIDGET")); + + } + scene_.refresh(); + + + + } else if (e.getSource() == quitter) { + frame_.dispose(); + + } else if (e.getSource() == creationNewGraphe) { + + // -- creation d un nouveau graphe --// + TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); + + // -- methode appelee qui doit creer un graphe avec la selection --// + calqueChoisi.addEvolutionFor(); + + // -- on doit remettre a jour les infos --// + // frame_.dispose(); + // rechercheGrapheAndCalque(); + + }else + { + rechercheGrapheAndCalque(); + } + + } + + private void rechercheGrapheAndCalque() { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getObjects(); + System.err.println("Il y a dans la scenne: " + listeNode.size()); + modelGraphesPossibles = new DefaultListModel(); + modelGraphesChoisis = new DefaultListModel(); + listeObjetsCalques = new ArrayList<JLabel>(); + listeCalquesPossibles = new ArrayList<TrPostVisuPanel>(); + listeGraphesPossibles = new ArrayList<EGGraphe>(); + listeGraphesChoisis = new ArrayList<EGGraphe>(); + // -- tentative de recuperation du calque --// + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode currentNode = it.next(); + if (currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque) { + EbliWidgetCreatorVueCalque new_name = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); + listeCalquesPossibles.add((TrPostVisuPanel) new_name.getCalque()); + + JLabel label = new JLabel(); + BufferedImage image = new_name.getCalque().produceImage(50, 50, params); + Icon icone = new ImageIcon(image); + label.setIcon(icone); + label.setText(currentNode.getTitle()); + listeObjetsCalques.add(label); + + } else if (currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { + EbliWidgetCreatorGraphe new_name = (EbliWidgetCreatorGraphe) currentNode.getCreator(); + + JLabel label = new JLabel(); + BufferedImage image = new_name.getGraphe().produceImage(50, 50, params); + Icon icone = new ImageIcon(image); + + label.setIcon(icone); + label.setText(currentNode.getTitle()); + modelGraphesPossibles.addElement(label); + listeGraphesPossibles.add(new_name.getGraphe()); + } + } + if (listeCalquesPossibles.size() == 0) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource + .getS("Il n'y a pas de calques disponibles.")).activate(); + return; + }/* + * else if (modelGraphesPossibles.size() == 0) { new + * BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), + * TrResource .getS("Il n'y a pas de graphes disponibles.")).activate(); + * return; } + */ + + // -- affichage de al dialog --// + constructDialog().setVisible(true); + } + + public class GrapheCellRenderer extends JLabel implements ListCellRenderer { + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + + public GrapheCellRenderer() { + setOpaque(true); + setIconTextGap(12); + } + + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + JLabel entry = (JLabel) value; + setText(entry.getText()); + setIcon(entry.getIcon()); + if (isSelected) { + setBackground(HIGHLIGHT_COLOR); + setForeground(Color.white); + } else { + setBackground(Color.white); + setForeground(Color.black); + } + return this; + } + } + + /** + * construit l interface + * + * @return + */ +public JDialog constructDialog() { + + + boxCalques_ = new JComboBox(); + for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { + boxCalques_.addItem(it.next()); + } + boxCalques_.setRenderer(new GrapheCellRenderer()); + boxCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Liste des calques de la scene"))); + jlisteGraphesChoix = new JList(modelGraphesPossibles); + jlisteGraphesChoix.setCellRenderer(new GrapheCellRenderer()); + + jlisteGraphesChoix.setSize(250, 350); + jlisteGraphesChoix.setBorder(BorderFactory.createTitledBorder(TrResource.TR + .getString("Graphes possibles"))); + jlisteGraphesSelections = new JList(modelGraphesChoisis); + jlisteGraphesSelections.setSize(250, 350); + jlisteGraphesSelections.setBorder(BorderFactory.createTitledBorder(TrResource.TR + .getString("Graphes choisis"))); + jlisteGraphesSelections.setCellRenderer(new GrapheCellRenderer()); + + validation = new JButton(TrResource.TR.getString("Valider"), EbliResource.EBLI.getIcon("crystal_valider")); + validation.addActionListener(this); + creationNewGraphe = new JButton(TrResource.TR.getString("Cr\xE9er un nouveau graphe"), EbliResource.EBLI + .getIcon("crystal_valider")); + creationNewGraphe.addActionListener(this); + select = new JButton(TrResource.TR.getString("Ajouter"), EbliResource.EBLI + .getIcon("crystal22_avancervite")); + unselect = new JButton(TrResource.TR.getString("Enlever"), EbliResource.EBLI + .getIcon("crystal22_reculervite")); + select.addActionListener(this); + unselect.addActionListener(this); + quitter = new JButton(TrResource.TR.getString("Quitter"), EbliResource.EBLI.getIcon("crystal_detruire")); + quitter.addActionListener(this); + //Box box = Box.createHorizontalBox(); + JPanel box = new JPanel(new GridLayout(1, 3)); + box.setSize(550, 350); + box.add(jlisteGraphesChoix); + Box boxButton = Box.createVerticalBox(); + JPanel panSelect = new JPanel(new FlowLayout(FlowLayout.CENTER)); + panSelect.add(select); + boxButton.add(panSelect); + boxButton.add(Box.createGlue()); + panSelect = new JPanel(new FlowLayout(FlowLayout.CENTER)); + panSelect.add(unselect); + boxButton.add(panSelect); + box.add(boxButton); + box.add(jlisteGraphesSelections); + + JPanel content = new JPanel(new BorderLayout()); + + content.add(box, BorderLayout.CENTER); + content.add(boxCalques_, BorderLayout.NORTH); + + + JPanel panelControle = new JPanel(new FlowLayout(FlowLayout.CENTER)); + panelControle.add(quitter); + + + panelControle.add(creationNewGraphe); + panelControle.add(validation); + + content.add(panelControle, BorderLayout.SOUTH); + + frame_ = new BuDialog(); + + frame_.setContentPane(content); + frame_.setModal(true); + frame_.setTitle(TrResource.TR.getString("Choix des \xE9l\xE9ments")); + frame_.setIconImage(null); + frame_.setSize(550, 400); + return frame_; +} + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -3,10 +3,9 @@ import java.awt.event.ActionEvent; import java.util.Iterator; -import org.fudaa.ebli.calque.BCalqueLegende; -import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import com.memoire.bu.BuDialogChoice; @@ -21,7 +20,7 @@ * @author Adrien Hadoux * */ -public class TrPostActionChooseAndCreateCalque extends EbliActionSimple { +public class TrPostActionChooseAndCreateCalque extends EbliWidgetActionSimple { TrPostProjet projet_; @@ -29,15 +28,17 @@ * Chooser associ\xE9 au projet. */ public TrPostProjetChooser filleProjetctChooser_; - - public TrPostActionChooseAndCreateCalque(TrPostProjet _projet) { - super(EbliResource.EBLI.getString("Calque principal"), BuResource.BU.getToolIcon("crystal_graphe"), + TrPostLayoutPanelController controller_; + + public TrPostActionChooseAndCreateCalque(TrPostProjet _projet, TrPostLayoutPanelController _controller) { + super(_controller.getSceneCourante(), EbliResource.EBLI.getString("Calque principal"), BuResource.BU + .getToolIcon("crystal_graphe"), "WIDGETRECALQUE"); projet_ = _projet; + controller_ = _controller; - } /** @@ -87,18 +88,21 @@ // -- TRES IMPORTANT: on cree le calque en precisant l indice de la SOURCE // SELECTIONNEE --// - TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, new BCalqueLegende(), projet_ + CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(getScene(), null); + + TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, legendeCalque, projet_ .getSource(indiceSOURCESelect)); - EbliNode node = projet_.filleLayout_.controller_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu + EbliNode node = controller_.addCalque("Calque principal", pnVisu.getLocation(), pnVisu .getPreferredSize(), - pnVisu, new CalqueLegendeWidgetAdapter(projet_.filleLayout_.getScene(), pnVisu - .getArbreCalqueModel())); + pnVisu, legendeCalque); // -- ajout de l INFO de la source utilis\xE9e --// node.getCreator().getWidget().getController_().setDescription("Source: " + values[indiceSOURCESelect]); - + + + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -16,6 +16,7 @@ import javax.swing.JScrollPane; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluUndoRedoInterface; import org.fudaa.ctulu.gui.CtuluFilleWithComponent; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -38,6 +39,7 @@ import com.memoire.bu.BuCutCopyPasteInterface; import com.memoire.bu.BuInternalFrame; +import com.memoire.bu.BuMenu; import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuToolBar; import com.memoire.bu.BuUndoRedoInterface; @@ -63,6 +65,8 @@ JMenu[] menus_; + BuMenu menuLayoutManager_; + JComponent right; JComponent[] tools_; @@ -117,7 +121,7 @@ // -- ajout de la toolbar et du menu en haut --// setToolBar(toolBarModifiable_); this.setJMenuBar(menuModifiable_); - + changeToolbarScene(); // -- init du panel de choix des trees --// panelTreeModifiable_ = new JScrollPane(controller_.getSceneCourante().getController().getOverviewComponent()); @@ -497,7 +501,7 @@ /** * Met a jour le tree a droite si ni un graphe ni un calque n est selectionn\xE9. */ - private synchronized void changeTreeScene() { + public synchronized void changeTreeScene() { conteneurTree_.remove(panelTreeModifiable_); panelTreeModifiable_ = new JScrollPane(getScene().getController().getOverviewComponent()); @@ -527,6 +531,7 @@ toolBarModifiable_ = _controller.getToolbarComponent(); menuModifiable_ = _controller.getMenubarComponent(); + ajoutMenusLayoutTabbed(menuModifiable_); // mise a jour des params // toolBarModifiable_.revalidate(); @@ -540,6 +545,8 @@ + + /** * Methode appelee pour les widget qui contiennent des graphes. * @@ -567,8 +574,11 @@ this.revalidate(); } - private void changeToolbarScene() { - public synchronized void changeToolbarScene() { + + + + + public synchronized void changeToolbarScene() { // nettoyage de la toolbar this.remove(toolBarModifiable_); this.remove(menuModifiable_); @@ -584,6 +594,8 @@ menuModifiable_.add(menu); // mise a jour des params + ajoutMenusLayoutTabbed(menuModifiable_); + this.setToolBar(toolBarModifiable_); this.setJMenuBar(menuModifiable_); this.revalidate(); @@ -613,4 +625,30 @@ this.revalidate(); } + + public void ajoutMenusLayoutTabbed(final BuMenuBar menubar) { + + if (menuLayoutManager_ == null) { + menuLayoutManager_ = new BuMenu(TrResource.getS("Layout"), "LAYOUTMANAGER"); + menuLayoutManager_.addMenuItem(TrResource.getS(("Ajouter un layout dans la vue")), "AJOUTLAYOUT", + CtuluResource.CTULU.getIcon("crystal_ajouter"), controller_); + menuLayoutManager_.addMenuItem(TrResource.getS(("Retirer un layout de la vue")), "RETIRELAYOUT", + CtuluResource.CTULU.getIcon("crystal_enlever"), controller_); + menuLayoutManager_.addSeparator("Layouts"); + menuLayoutManager_.addSubMenu(controller_.menuScenes_, true); + } + + boolean appartient=false; + for (int i = 0; !appartient && i < menubar.getComponentCount(); i++) { + if(menubar.getComponent(i) !=null && menubar.getComponent(i)==menuLayoutManager_) + appartient = true; + } + + if (!appartient) + // -- creation du menu principal des scenes a cote de post --// + + // ajout a cote de menu post + menubar.add(menuLayoutManager_, menubar.getComponentCount()); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-03 20:17:44 UTC (rev 3882) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-09-04 16:42:59 UTC (rev 3883) @@ -1,11 +1,13 @@ package org.fudaa.fudaa.tr.post; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; import javax.swing.JComponent; @@ -13,9 +15,11 @@ import javax.swing.JMenu; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionAbstract; @@ -41,6 +45,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionImageChooser; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; @@ -51,16 +56,12 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; import org.fudaa.fudaa.tr.common.TrResource; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuComboBox; import com.memoire.bu.BuDesktop; import com.memoire.bu.BuDialogConfirmation; import com.memoire.bu.BuDialogError; import com.memoire.bu.BuDialogMessage; import com.memoire.bu.BuMenu; -import com.memoire.bu.BuMenuBar; import com.memoire.bu.BuMenuItem; -import com.memoire.bu.BuPanel; import com.memoire.bu.BuResource; import com.memoire.bu.BuSeparator; @@ -70,11 +71,14 @@ * @author Adrien Hadoux * */ -public class TrPostLayoutPanelController implements ActionListener { +public class TrPostLayoutPanelController implements ActionListener, ChangeListener { - JPanel pn_; + // JPanel pn_; + JTabbedPane pn_; + JPanel conteneur_; + /** * scene seelctionnee par l utilisateur */ @@ -84,7 +88,7 @@ /** * combobox qui gere le multiscene */ - BuComboBox comboMultiScenes_ = new BuComboBox();; + // JComboBox comboMultiScenes_ = new JComboBox();; JScrollPane conteneurSceneView_; @@ -97,7 +101,7 @@ BuMenu menuScenes_ = new BuMenu(TrResource.getS("Liste des Layouts"), "LISTELAYOUT"); ArrayList<BuMenuItem> listeMenusScenes_ = new ArrayList<BuMenuItem>(); - List<EbliActionAbstract> actions; + List<EbliActionAbstract> actions_; TrPostProjet projet_; @@ -112,44 +116,66 @@ addScene(_scene); _scene.setCmdMng(new CtuluCommandManager()); projet_ = _projet; + + // comboMultiScenes_.addActionListener(this); + // comboMultiScenes_.setMaximumSize(comboMultiScenes_.getPreferredSize()); + // comboMultiScenes_.setMinimumSize(comboMultiScenes_.getPreferredSize()); - comboMultiScenes_.addActionListener(this); - construitMenuMultiScenes(_projet.impl_.getMainMenuBar()); + } + // public void construitMenuMultiScenes(BuMenuBar _bar) { + // + // // -- creation du menu principal des scenes a cote de post --// + // BuMenu menu = new BuMenu(TrResource.getS("Layout"), "LAYOUTMANAGER"); + // menu.addMenuItem(TrResource.getS(("Ajouter une nouvelle fen\xEAtre")), + // "AJOUTFRAME", CtuluResource.CTULU + // .getIcon("crystal_ajouter"), this); + // menu.addMenuItem(TrResource.getS(("Ajouter un layout dans la vue")), + // "AJOUTLAYOUT", CtuluResource.CTULU + // .getIcon("crystal_ajouter"), + // this); + // menu.addMenuItem(TrResource.getS(("Retirer un layout de la vue")), + // "RETIRELAYOUT", CtuluResource.CTULU + // .getIcon("crystal_enlever"), this); + // menu.addSeparator("Layouts"); + // menu.addSubMenu(menuScenes_, true); + // + // // ajout a cote de menu post + // _bar.add(menu, 2); + // + // } - public void construitMenuMultiScenes(BuMenuBar _bar) { - - // -- creation du menu principal des scenes a cote de post --// - BuMenu menu = new BuMenu(TrResource.getS("Layout"), "LAYOUTMANAGER"); - menu.addMenuItem(TrResource.getS(("Ajouter un layout")), "AJOUTLAYOUT", CtuluResource.CTULU - .getIcon("crystal_ajouter"), - this); - menu.addMenuItem(TrResource.getS(("Retirer un layout")), "RETIRELAYOUT", CtuluResource.CTULU - .getIcon("crystal_enlever"), this); - menu.addSeparator("Layouts"); - menu.addSubMenu(menuScenes_, true); - - // ajout a cote de menu post - _bar.add(menu, 2); - - } - public void addScene(EbliScene _scene){ listeScenes_.add(_scene); + // -- recuperation du cmdmanagement da la scene precedente --// + _scene.setCmdMng(sceneCourante_.getCmdMng()); + // -- ajout dans la combo --// - comboMultiScenes_.addItem("Layout " + listeScenes_.size()); + // comboMultiScenes_.addItem("Layout " + listeScenes_.size()); // -- ajout dans le menu la scene --// listeMenusScenes_.add(menuScenes_.addMenuItem(TrResource.getS(("Layout ")) + listeScenes_.size(), "LAYOUT" + (listeScenes_.size() - 1), null, this)); + + + // -- switch automatique de scene --// + if (liste... [truncated message content] |
From: <had...@us...> - 2008-09-06 17:18:10
|
Revision: 3894 http://fudaa.svn.sourceforge.net/fudaa/?rev=3894&view=rev Author: hadouxad Date: 2008-09-06 17:18:19 +0000 (Sat, 06 Sep 2008) Log Message: ----------- - ajout du multi-source dans les courbes - ajout de la source pour les objets trpostCourbeModel - pour la methode update, ne passe plus en parametre le source, on recuperer celui de la source et on y recuepre les datas - la ou je suis pas tres sur sur les modifs, j ai mis le FIXME suivant: // FIXME Adrien: Fred, je ne me suis pas gour?\195?\169 ? - creation du graphe spatial en widget - modifs de profilPanelCreated() de la classe trpostprojet - creer la widget automatiquement - mode edition ok (il faudra qu'on discute des fonctions, certaines ne marchent pas) - correction de la duplication: marche OK - modification de l'action ADDPOINT des evol temporelles: ne selectionne que les graphes temporels et ne propose pas les graphes Spatiaux - Creation de la meme action ADDPOINT poru les actions spatiales que celle des evolutions temporelles - utilisation du design pattern template dans la classe TrPostActionAddPointFromWidgetCalque2 - possibilite de creation d une courbe spatiale - BUG: la fonction ajout de courbe sur le graphe NE MARCHE PAS: TrPostActionAddPointFromWidgetCalque.Spatial.executeAction - REFONTE de l'actions de duplication g?\195?\169n?\195?\169rale dans la scene au choix: - action dupliquer: ouvre une liste pour choisir la scene dans laquelle dupliquer la widget - si il n y a qu une fenetre: fonction de duplication classique - si il y a plusieurs fenetre: chooser de fenetre - si il y a plusieurs onglets: chooser d'onglet apres choix de la fenetre. - les undo/redo fonctionnent - action de deplacement dans une autre scene - chooser pour choisir la fenetre de destination (si une seule fenetre, pas de chooser) - chooser pour choisir l'onglet de destination (si un seul onglet, pas de chooser) - gestion des undo/redo - tout se met correctement ?\195?\160 jour. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionDuplicate.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -101,6 +101,7 @@ duplic.tbox_ = this.tbox_.duplicate(); // -- duplication du egCourbeSurfacePainter --// + if (this.surfacePainter_ != null) duplic.surfacePainter_ = this.surfacePainter_.duplicate(duplic, _duplicator); //-- aspect couleur contour+surface de la courbe --// Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -276,7 +276,7 @@ public SelectedIndex maxIdx_ = NONE; SelectedIndex minIdx_ = NONE; - final EGGrapheModel model_; + EGGrapheModel model_; Delegate painter_; @@ -327,9 +327,11 @@ EGCourbeSurfacePainter duplic = new EGCourbeSurfacePainter(cibleDuplique, _duplicator.getModelDuplique_()); duplic.alpha_ = this.alpha_; - if (this.delegateCourbe_ != null) + if (this.delegateCourbe_ != null && duplic.model_ != null) { + // if (duplic.model_ == null) + // duplic.model_ = this.model_.duplicate(_duplicator); duplic.delegateCourbe_ = new DelegateCourbe(duplic.model_); - + } duplic.down_ = this.down_; duplic.maxIdx_ = this.maxIdx_; duplic.minIdx_ = this.minIdx_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -891,8 +891,20 @@ Object[] vals = this.objectInitAxe_.values().toArray() ; int cpt = 0; for (Iterator it = set.iterator(); it.hasNext();) { - EGAxeVertical axe = (EGAxeVertical) it.next(); + Object objet = it.next(); + if (objet instanceof EGAxeVertical) { + EGAxeVertical axe = (EGAxeVertical) objet; duplic.objectInitAxe_.put(duplicator.duplicateAxeV(axe), vals[cpt++]); + } + // else if (objet instanceof meshviewer.profile.MvProfileCourbeGroup) { + // meshviewer.profile.MvProfileCourbeGroup profcourbe = objet; + // + // } + + + else if (objet instanceof EGGroup) { + EGGroup groupe = (EGGroup) objet; + duplic.objectInitAxe_.put(groupe.duplicate(duplicator), vals[cpt++]); } } if (this.xRange_ != null) @@ -904,8 +916,10 @@ - return duplic; + } + return duplic; + } } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeChangeWidgetScene.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -0,0 +1,57 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; + +/** + * action qui permet de faire le undo/redo sur le changement de scene du node. + * + * @author genesis + * + */ +public class CommandeChangeWidgetScene implements CtuluCommand { + + ArrayList<EbliNode> nodeDuplique_; + + EbliScene sceneDepart_; + EbliScene sceneDestination_; + + + + public CommandeChangeWidgetScene(ArrayList<EbliNode> nodeDuplique_, EbliScene sceneDep, EbliScene sceneDest) { + super(); + this.nodeDuplique_ = nodeDuplique_; + this.sceneDepart_ = sceneDep; + sceneDestination_ = sceneDest; + + } + + public void redo() { + // -- redo unitaire execute pour chaque node dupliques --// + for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + sceneDepart_.removeNode(node); + sceneDepart_.refresh(); + sceneDestination_.addNode(node); + sceneDestination_.refresh(); + } + } + + + public void undo() { + // -- redo unitaire execute pour chaque node dupliques --// + for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + sceneDestination_.removeNode(node); + sceneDestination_.refresh(); + sceneDepart_.addNode(node); + sceneDepart_.refresh(); + } + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -26,6 +26,14 @@ /** * */ + + /** + * Possibilit\xE9 de changer la scene de destination + */ + EbliScene sceneDestination_ = null; + + + private static final long serialVersionUID = 1L; final CtuluCommandContainer cmd_; @@ -68,6 +76,10 @@ } } + + + sceneDestination_ = selectionneSceneNode(); + //-- duplication des noeuds saisis --// for(Iterator<EbliNode> it=listeNodeADupliquer.iterator();it.hasNext();){ EbliNode currentNode=it.next(); @@ -77,7 +89,7 @@ if(node !=null){ //-- ajout du node dans la scene --// - scene_.addNode(node); + sceneDestination_.addNode(node); // -- ajout du noeud --// listeNouveauxNodes.add(node); @@ -89,15 +101,24 @@ node.getCreator().getWidget().setPreferredBounds(currentNode.getCreator().getWidget().getPreferredBounds()); //-- rafraichissement de la scene --// - scene_.refresh(); + sceneDestination_.refresh(); } } // -- creation de l action undo/redo pour les nodes --// - cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, scene_)); + cmd_.addCmd(new CommandeDuplicate(listeNouveauxNodes, sceneDestination_)); } + /** + * methode qui doit etre surchargee par les filles pour selectionner la scene + * de destination + */ + protected EbliScene selectionneSceneNode() { + return scene_; + } + + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -13,10 +13,6 @@ import javax.swing.ListModel; -import com.vividsolutions.jts.geom.LineString; - -import com.memoire.bu.BuLib; - import org.fudaa.ctulu.CtuluActivity; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; @@ -24,7 +20,6 @@ import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.ef.operation.EfLineIntersectionsCorrectionTester; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsBuilder; @@ -32,7 +27,6 @@ import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; import org.fudaa.dodico.ef.operation.EfLineIntersectorActivity; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.calque.BArbreCalqueModel; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZEbliCalquesPanel; @@ -45,12 +39,15 @@ import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; import org.fudaa.fudaa.sig.FSigLineSingleModel; +import org.fudaa.fudaa.tr.post.TrPostSource; +import com.memoire.bu.BuLib; +import com.vividsolutions.jts.geom.LineString; + /** * @author fred deniger * @version $Id: MvProfileBuilder.java,v 1.14 2007-06-13 12:58:10 deniger Exp $ @@ -232,6 +229,158 @@ } + /** + * Methode qui permet d ajouter une courbe spatiale poru un grapeh deja + * existant. + * + * @author Adrien Hadoux + * @param _prog + * @param _selected + */ + public void actAddGroupForExistingModel(final ProgressionInterface _prog, + MvProfileTreeModel _tree, TrPostSource _src) { + + +// int[] time = _selected.getSelectedTimeStepIdx(); + // final CtuluVariable[] vs = _selected.getSelectedVar(); + + double[] time = _src.getTime().getTimeListModel().getTimesInSec(); + H2dVariableType[] vs = _src.getAllVariablesNonVec(); + + + + + final int nbVar = vs == null ? 0 : vs.length; + final boolean isTime = timeModel_ != null; + + // boolean addXYForNode = false; + // boolean addXYForMesh = false; + // for (int i = initVar_.getSize() - 1; i >= 0; i--) { + // if (data_.getData().isElementVar((CtuluVariable) + // initVar_.getElementAt(i))) { + // addXYForMesh = true; + // } else { + // addXYForNode = true; + // } + // // les 2 sont a true + // if (addXYForMesh && addXYForNode) { + // break; + // } + // } + final int nbTIme = time.length; + final MvProfileTreeModel tree = _tree; + // if (addXYForNode) { + // tree.setNodesResults(getNodeResultsMng(_prog), + // getNodeResultBuilder(_prog)); + // } + // if (addXYForMesh) { + // tree.setMeshesResults(getMeshResultsMng(_prog), + // getMeshesResultBuilder(_prog)); + // + // } + final EGGroup grCoord = new EGGroup(); + final String s = EbliLib.getS("Coordonn\xE9es"); + grCoord.setTitle(s); + final EGAxeVertical yCoordonnees = new EGAxeVertical(); + yCoordonnees.setTitre(s); + yCoordonnees.setUnite("m"); + grCoord.setAxeY(yCoordonnees); + final String sep = " - "; + // if (addXYForNode) { + // final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, + // new MvProfileCoordinatesModel( + // getNodeResultsMng(_prog).getDefaultRes(), true)); + // final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, + // new MvProfileCoordinatesModel( + // getNodeResultsMng(_prog).getDefaultRes(), false)); + // if (addXYForNode && addXYForMesh) { + // courbeChild.setTitle(courbeChild.getTitle() + sep + + // MvResource.getS("Noeuds")); + // courbeChild2.setTitle(courbeChild2.getTitle() + sep + + // MvResource.getS("Noeuds")); + // } + // grCoord.addEGComponent(courbeChild); + // + // grCoord.addEGComponent(courbeChild2); + // + // } + // if (addXYForMesh) { + // final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, + // new MvProfileCoordinatesModel( + // getMeshResultsMng(_prog).getDefaultRes(), true)); + // final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, + // new MvProfileCoordinatesModel( + // getMeshResultsMng(_prog).getDefaultRes(), false)); + // if (addXYForNode && addXYForMesh) { + // courbeChild.setTitle(courbeChild.getTitle() + sep + + // MvResource.getS("Elements")); + // courbeChild2.setTitle(courbeChild2.getTitle() + sep + + // MvResource.getS("Elements")); + // } + // grCoord.addEGComponent(courbeChild); + // + // grCoord.addEGComponent(courbeChild2); + // + // } + grCoord.setVisible(false); + tree.add(grCoord); + // map permettant de stocker la correspondance var -> groupe + final Map varGroup = new HashMap(); + if (vs != null) { + for (int i = 0; i < nbVar; i++) { + // pas null + final CtuluVariable var = vs[i]; + MvProfileCourbeGroup gri = null; + // dans ce cas, on va g\xE9rer les variables parents: inutile de creer des + // groupe different + // pour des variables de meme type + Color c = null; + boolean mustAddGr = true; + if (var instanceof H2dVariableType) { + H2dVariableType parent = ((H2dVariableType) var).getParentVariable(); + if (parent == null) { + parent = (H2dVariableType) var; + } + c = MvProfileFillePanel.getColorFor(i, parent); + gri = (MvProfileCourbeGroup) varGroup.get(parent); + if (gri == null) { + gri = MvProfileFillePanel.createGroupFor(parent); + varGroup.put(parent, gri); + } else { + mustAddGr = false; + } + } + if (gri == null) { + gri = MvProfileFillePanel.createGroupFor(var); + } + if (c == null) { + c = MvProfileFillePanel.getColorFor(i, var); + } + // on doit construire les courbes + for (int t = 0; t < nbTIme; t++) { + final MVProfileCourbeModel model = new MVProfileCourbeModel(var, data_.getData(), (int) time[t], + getResBuilder(var, + _prog), _prog); + EGCourbeChild child; + if (isTime) { + model.setTitle(var.toString() + CtuluLibString.ESPACE + time[t]); + child = new MvProfileCourbeTime(gri, model, timeModel_); + } else { + child = new MvProfileCourbe(gri, model); + } + child.setAspectContour(c); + gri.addEGComponent(child); + } + if (mustAddGr) { + tree.add(gri); + } + } + } + + //data_.profilPanelCreated(new MvProfileFillePanel(tree, ui_), _prog, name_); + + } + protected void close() { if (tmp_ != null) { tmp_.detruire(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -19,16 +19,12 @@ import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; -import com.memoire.bu.BuWizardDialog; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluValuesEditorPanel; - import org.fudaa.dodico.ef.EfGridData; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.interpolation.EfInterpolator; @@ -38,7 +34,6 @@ import org.fudaa.dodico.h2d.H2dVariableProviderInterface; import org.fudaa.dodico.h2d.resource.H2dResource; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; @@ -49,7 +44,6 @@ import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.find.EbliFindExpressionContainerInterface; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.meshviewer.MvLayerGrid; @@ -67,6 +61,9 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.export.TrExportFactory; +import com.memoire.bu.BuWizardDialog; +import com.memoire.fu.FuLog; + /** * @author Fred Deniger * @version $Id: TrVisuPanelEditor.java,v 1.34 2007-06-14 12:01:41 deniger Exp $ @@ -376,7 +373,7 @@ _l.add(new MvProfileAction(new ProfileAdapter(), getImpl(), this)); } - protected class ProfileAdapter implements MvProfileTarget { + public class ProfileAdapter implements MvProfileTarget { final EfGridData data_ = getParams().createGridDataAdapter(); final EfInterpolator interpolator_ = new EfInterpolator(data_, getParams().getVectorContainer()); Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -1,112 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Set; - -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; -import org.fudaa.fudaa.tr.common.TrResource; - -import com.memoire.bu.BuDialogError; - -/** - * Action qui recupere les widgets selectionnes calque et graphe. Recupere - * l'unique calque selectionn\xE9s et l'ensem - * - * @author genesis - * - */ -public class TrPostActionAddPointFromWidgetCalque extends EbliWidgetActionSimple { - - - - CtuluCommandContainer cmd_; - TrPostCommonImplementation impl_; - - - - public TrPostActionAddPointFromWidgetCalque(EbliScene _scene, TrPostCommonImplementation _impl) { - super(_scene, TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), - "ADDPOINTWIDGET"); - - cmd_ = _scene.getCmdMng(); - impl_ = _impl; - putValue(NAME, "Arri\xE8re plan"); - this - .setDefaultToolTip(TrResource - .getS("S\xE9lectionnez simultan\xE9ment le calque qui contient les points ainsi que les graphes qui contiendront les courbes ")); - - } - - public void actionPerformed(ActionEvent e) { - - // -- recuperation de la liste des nodes de la scene --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); - - boolean isCalqueUnique = true; - boolean isGraphePresent = false; - TrPostVisuPanel calque = null; - ArrayList<EGGraphe> listeGraphes = new ArrayList<EGGraphe>(); - - //-- tentative de recuperation du calque --// - for (Iterator<EbliNode> it = listeNode.iterator(); isCalqueUnique && it.hasNext();) { - - EbliNode currentNode = it.next(); - - if(currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque){ - if (calque == null) { - EbliWidgetCreatorVueCalque creatorCalque = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); - calque = (TrPostVisuPanel) creatorCalque.getCalque(); - } else { - // -- error plus d 'un calque --// - isCalqueUnique = false; - } - } else if (currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { - EbliWidgetCreatorGraphe creatorGraphe = (EbliWidgetCreatorGraphe) currentNode.getCreator(); - listeGraphes.add(creatorGraphe.getGraphe()); - isGraphePresent = true; - } - - - } - - // -- on v\xE9rifie que les booleens n'ont pas d\xE9tect\xE9s d'erreurs --// - if (calque == null) { - new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource - .getS("Il doit y avoir un calque s\xE9lectionn\xE9.")) - .activate(); - return; - } else if (!isCalqueUnique) { - new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), - TrResource - .getS("Il doit y avoir un et un seul calque s\xE9lectionn\xE9.")).activate(); - return; - } else if (!isGraphePresent) { - new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), - TrResource - .getS("Il doit y avoir au moins un graphe s\xE9lectionn\xE9.")).activate(); - return; - } - - // -- on applique l'action \xE0 chaque widget graphe --// - for (Iterator<EGGraphe> it = listeGraphes.iterator(); it.hasNext();) { - EGGraphe graphe = it.next(); - - // -- execution de l action pour le graphe selectionne --// - (new TrPostCourbeAddPointsAction(impl_, graphe, calque)).actionPerformed(new ActionEvent(calque, 0, - "ADDPOINTWIDGET")); - - } - scene_.refresh(); - - } - -} Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java (from rev 3884, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -0,0 +1,469 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import javax.swing.UIManager; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.CtuluTaskDelegate; +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModel; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.profile.MvProfileBuilderFromTree; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCoteTester; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuDialogError; +import com.memoire.fu.FuLog; + +/** + * Action qui: - recupere la liste des calques potentiels - recupere la liste + * des graphes potentiels - propose a l utilisateur une interface combo pour + * choisir le calque cible - propose a l utilisateur une interface jlist pour + * choisir le(s) graphe(s) cible(s) realise la moulinette + * @author Adrien Hadoux + * + */ +public abstract class TrPostActionAddPointFromWidgetCalque extends EbliWidgetActionSimple { + + /** + * Action specialisee pour les courbes temporelles. NE propose que les widget + * graphes qui respectent les donnees temporelles + * + * @author Adrien Hadoux + * + */ + public static class Temporel extends TrPostActionAddPointFromWidgetCalque{ + + public Temporel(EbliScene _scene, TrPostCommonImplementation _impl) { + super(_scene, _impl); + } + + @Override + public void setTitleForFrame() { + frame_.setTitle(TrResource.TR.getString("Ajout des points du calques dans les \xE9volutions temporels")); + } + + @Override + public boolean isCorrectGraph(EGGrapheModel _model) { + // -- ATTENTION ICI ON AJOUTE JUSTE POUR LES COUURBE TEMPORELLE --// + return (_model instanceof TrPostCourbeTreeModel); + + } + + @Override + public void executeAction(TrPostCommonImplementation _impl, EGGraphe _graphe, TrPostVisuPanel _calque) { + (new TrPostCourbeAddPointsAction(impl_, _graphe, _calque)).actionPerformed(new ActionEvent(_calque, 0, + "ADDPOINTWIDGET")); + } + + @Override + protected void createNewGraphe(TrPostVisuPanel _calqueChoisi) { + + // -- creation auto d un nouveau graphe widget avec courbe temporelle + _calqueChoisi.addEvolutionFor(); + } + + @Override + public void setToolTip() { + this + .setDefaultToolTip(TrResource + .getS("Ajoute aux graphes selectionn\xE9s les points s\xE9lectionn\xE9es du calque")); + } + + } + + + + + /** + * Action specialisee pour les courbes spatiales. NE propose que les widget + * graphes qui respectent les donnees patiales + * + * @author Adrien Hadoux + * + */ + public static class Spatial extends TrPostActionAddPointFromWidgetCalque { + + public Spatial(EbliScene _scene, TrPostCommonImplementation _impl) { + super(_scene, _impl); + } + + @Override + public void setTitleForFrame() { + frame_.setTitle(TrResource.TR.getString("Ajout des points du calques dans les courbes spatiales")); + } + + @Override + public boolean isCorrectGraph(EGGrapheModel _model) { + // -- ATTENTION ICI ON AJOUTE JUSTE POUR LES COUURBE TEMPORELLE --// + return (_model instanceof MvProfileTreeModel); + + } + + @Override + public void executeAction(TrPostCommonImplementation _impl, EGGraphe _graphe, TrPostVisuPanel _calque) { + + // -- utilisation de l action qui permet d ajouter un profil spatial selectionn\xE9 dans le calque au + // graphe + final CtuluTaskDelegate task = impl_.createTask(FudaaLib.getS("Construction des courbes")); + new MvProfileBuilderFromTree( _calque.getProjet(), impl_, ((ZCalqueAffichageDonneesInterface) _calque.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(), _calque, new MvProfileCoteTester()). + actAddGroupForExistingModel(task.getStateReceiver(), (MvProfileTreeModel) _graphe.getModel(), + _calque.srcCont_.src_); + + } + + @Override + protected void createNewGraphe(TrPostVisuPanel _calqueChoisi) { + + + // creation automatique d un graphe avec les spatiales poru le calque + // vhoisi + + new MvProfileBuilderFromTree( _calqueChoisi.getProjet(), impl_, ((ZCalqueAffichageDonneesInterface) _calqueChoisi.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(), _calqueChoisi, new MvProfileCoteTester()) + .start(); + + } + + String[] formattageDonnees(TrPostProjet _projet) { + + String[] listeSimul = new String[_projet.listeSrc_.size()]; + int cpt = 0; + for (Iterator<TrPostSource> it = _projet.listeSrc_.iterator(); it.hasNext();) { + + TrPostSource src = it.next(); + + // --ajout dans la liste des titres --// + listeSimul[cpt++] = _projet.formatInfoSource(src); + } + + return listeSimul; + } + + @Override + public void setToolTip() { + this + .setDefaultToolTip(TrResource + .getS("Ajoute aux graphes selectionn\xE9s les courbes s\xE9lectionn\xE9es du calque ")); + } + + } + + + + + + + + + CtuluCommandContainer cmd_; + TrPostCommonImplementation impl_; + + JComboBox boxCalques_; + JList jlisteGraphesChoix; + JList jlisteGraphesSelections; + + JButton validation, select, unselect, creationNewGraphe, quitter; + JDialog frame_; + DefaultListModel modelGraphesPossibles; + DefaultListModel modelGraphesChoisis; + ArrayList<TrPostVisuPanel> listeCalquesPossibles; + ArrayList<EGGraphe> listeGraphesPossibles; + ArrayList<EGGraphe> listeGraphesChoisis; + ArrayList<JLabel> listeObjetsCalques; + + + + public TrPostActionAddPointFromWidgetCalque(EbliScene _scene, TrPostCommonImplementation _impl) { + super(_scene, TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), "ADDPOINTWIDGET"); + + cmd_ = _scene.getCmdMng(); + impl_ = _impl; + putValue(NAME, "Arri\xE8re plan"); + + + setToolTip(); + + + } + + public abstract void setToolTip(); + + public void actionPerformed(ActionEvent e) { + + + if (e.getSource() == select) { + if (jlisteGraphesChoix.getSelectedIndex() != -1) { + int indice = jlisteGraphesChoix.getSelectedIndex(); + EGGraphe graphe = listeGraphesPossibles.get(indice); + JLabel title = (JLabel) modelGraphesPossibles.getElementAt(indice); + modelGraphesChoisis.addElement(title); + listeGraphesChoisis.add(graphe); + modelGraphesPossibles.removeElementAt(indice); + listeGraphesPossibles.remove(indice); + } + } else if (e.getSource() == unselect) { + if (jlisteGraphesSelections.getSelectedIndex() != -1) { + int indice = jlisteGraphesSelections.getSelectedIndex(); + EGGraphe graphe = listeGraphesChoisis.get(indice); + JLabel title = (JLabel) modelGraphesChoisis.getElementAt(indice); + modelGraphesPossibles.addElement(title); + listeGraphesPossibles.add(graphe); + modelGraphesChoisis.removeElementAt(indice); + listeGraphesChoisis.remove(indice); + } + }else if (e.getSource() == validation) { + // validation de l action + if (listeGraphesChoisis.size() == 0) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource + .getS("Il doit y avoir au moins un graphe s\xE9lectionn\xE9.")).activate(); + return; + } + + + TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); + + // -- on applique l'action \xE0 chaque widget graphe --// + for (int i = 0; i < listeGraphesChoisis.size(); i++) { + EGGraphe graphe = listeGraphesChoisis.get(i); + + // -- execution de l action pour le graphe selectionne --// + executeAction(impl_, graphe, calqueChoisi); + + + } + scene_.refresh(); + + + + } else if (e.getSource() == quitter) { + frame_.dispose(); + + } else if (e.getSource() == creationNewGraphe) { + + // -- creation d un nouveau graphe --// + TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); + + // -- methode appelee qui doit creer un graphe avec la selection --// + createNewGraphe(calqueChoisi); + + + // -- on doit remettre a jour les infos --// + // frame_.dispose(); + // rechercheGrapheAndCalque(); + + }else + { + rechercheGrapheAndCalque(); + } + + } + + + protected abstract void createNewGraphe(TrPostVisuPanel _calqueChoisi); + + + + public abstract void executeAction(TrPostCommonImplementation _impl, EGGraphe _graphe, TrPostVisuPanel _calque); + + private void rechercheGrapheAndCalque() { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getObjects(); + System.err.println("Il y a dans la scenne: " + listeNode.size()); + modelGraphesPossibles = new DefaultListModel(); + modelGraphesChoisis = new DefaultListModel(); + listeObjetsCalques = new ArrayList<JLabel>(); + listeCalquesPossibles = new ArrayList<TrPostVisuPanel>(); + listeGraphesPossibles = new ArrayList<EGGraphe>(); + listeGraphesChoisis = new ArrayList<EGGraphe>(); + // -- tentative de recuperation du calque --// + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode currentNode = it.next(); + if (currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque) { + EbliWidgetCreatorVueCalque new_name = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); + listeCalquesPossibles.add((TrPostVisuPanel) new_name.getCalque()); + + JLabel label = new JLabel(); + BufferedImage image = new_name.getCalque().produceImage(50, 50, params); + Icon icone = new ImageIcon(image); + label.setIcon(icone); + label.setText(currentNode.getTitle()); + listeObjetsCalques.add(label); + + } else if (currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { + EbliWidgetCreatorGraphe new_name = (EbliWidgetCreatorGraphe) currentNode.getCreator(); + + FuLog.warning("MODEL GRAPHE je suis instance de " + new_name.getGraphe().getModel()); + if (isCorrectGraph(new_name.getGraphe().getModel())) { + + JLabel label = new JLabel(); + BufferedImage image = new_name.getGraphe().produceImage(50, 50, params); + Icon icone = new ImageIcon(image); + + label.setIcon(icone); + label.setText(currentNode.getTitle()); + modelGraphesPossibles.addElement(label); + listeGraphesPossibles.add(new_name.getGraphe()); + } + } + } + if (listeCalquesPossibles.size() == 0) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource + .getS("Il n'y a pas de calques disponibles.")).activate(); + return; + }/* + * else if (modelGraphesPossibles.size() == 0) { new + * BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), + * TrResource .getS("Il n'y a pas de graphes disponibles.")).activate(); + * return; } + */ + + // -- affichage de al dialog --// + constructDialog().setVisible(true); + } + + public abstract boolean isCorrectGraph(EGGrapheModel _model); + + public class GrapheCellRenderer extends JLabel implements ListCellRenderer { + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + + public GrapheCellRenderer() { + setOpaque(true); + setIconTextGap(12); + } + + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + JLabel entry = (JLabel) value; + setText(entry.getText()); + setIcon(entry.getIcon()); + if (isSelected) { + setBackground(HIGHLIGHT_COLOR); + setForeground(Color.white); + } else { + setBackground(Color.white); + setForeground(Color.black); + } + return this; + } + } + + /** + * construit l interface + * + * @return + */ +public JDialog constructDialog() { + + + boxCalques_ = new JComboBox(); + for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { + boxCalques_.addItem(it.next()); + } + boxCalques_.setRenderer(new GrapheCellRenderer()); + boxCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Liste des calques de la scene"))); + jlisteGraphesChoix = new JList(modelGraphesPossibles); + jlisteGraphesChoix.setCellRenderer(new GrapheCellRenderer()); + + jlisteGraphesChoix.setSize(250, 350); + jlisteGraphesChoix.setBorder(BorderFactory.createTitledBorder(TrResource.TR + .getString("Graphes possibles"))); + jlisteGraphesSelections = new JList(modelGraphesChoisis); + jlisteGraphesSelections.setSize(250, 350); + jlisteGraphesSelections.setBorder(BorderFactory.createTitledBorder(TrResource.TR + .getString("Graphes choisis"))); + jlisteGraphesSelections.setCellRenderer(new GrapheCellRenderer()); + + validation = new JButton(TrResource.TR.getString("Valider"), EbliResource.EBLI.getIcon("crystal_valider")); + validation.addActionListener(this); + creationNewGraphe = new JButton(TrResource.TR.getString("Cr\xE9er un nouveau graphe"), EbliResource.EBLI + .getIcon("crystal_valider")); + creationNewGraphe.addActionListener(this); + select = new JButton(TrResource.TR.getString("Ajouter"), EbliResource.EBLI + .getIcon("crystal22_avancervite")); + unselect = new JButton(TrResource.TR.getString("Enlever"), EbliResource.EBLI + .getIcon("crystal22_reculervite")); + select.addActionListener(this); + unselect.addActionListener(this); + quitter = new JButton(TrResource.TR.getString("Quitter"), EbliResource.EBLI.getIcon("crystal_detruire")); + quitter.addActionListener(this); + //Box box = Box.createHorizontalBox(); + JPanel box = new JPanel(new GridLayout(1, 3)); + box.setSize(550, 350); + box.add(jlisteGraphesChoix); + Box boxButton = Box.createVerticalBox(); + JPanel panSelect = new JPanel(new FlowLayout(FlowLayout.CENTER)); + panSelect.add(select); + boxButton.add(panSelect); + boxButton.add(Box.createGlue()); + panSelect = new JPanel(new FlowLayout(FlowLayout.CENTER)); + panSelect.add(unselect); + boxButton.add(panSelect); + box.add(boxButton); + box.add(jlisteGraphesSelections); + + JPanel content = new JPanel(new BorderLayout()); + + content.add(box, BorderLayout.CENTER); + content.add(boxCalques_, BorderLayout.NORTH); + + + JPanel panelControle = new JPanel(new FlowLayout(FlowLayout.CENTER)); + panelControle.add(quitter); + + + panelControle.add(creationNewGraphe); + panelControle.add(validation); + + content.add(panelControle, BorderLayout.SOUTH); + + frame_ = new JDialog(); + + frame_.setContentPane(content); + frame_.setModal(true); + setTitleForFrame(); + + frame_.setIconImage(null); + frame_.setSize(550, 400); + return frame_; +} + + public abstract void setTitleForFrame(); + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java 2008-09-05 15:01:51 UTC (rev 3893) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -1,311 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import javax.swing.UIManager; - -import org.fudaa.ctulu.CtuluCommandContainer; -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.image.CtuluLibImage; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.visuallibrary.EbliNode; -import org.fudaa.ebli.visuallibrary.EbliScene; -import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; -import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; -import org.fudaa.fudaa.tr.common.TrResource; - -import com.memoire.bu.BuDialogError; - -/** - * Action qui: - recupere la liste des calques potentiels - recupere la liste - * des graphes potentiels - propose a l utilisateur une interface combo pour - * choisir le calque cible - propose a l utilisateur une interface jlist pour - * choisir le(s) graphe(s) cible(s) realise la moulinette - * @author Adrien Hadoux - * - */ -public class TrPostActionAddPointFromWidgetCalque2 extends EbliWidgetActionSimple { - - - CtuluCommandContainer cmd_; - TrPostCommonImplementation impl_; - - JComboBox boxCalques_; - JList jlisteGraphesChoix; - JList jlisteGraphesSelections; - - JButton validation, select, unselect, creationNewGraphe, quitter; - JDialog frame_; - DefaultListModel modelGraphesPossibles; - DefaultListModel modelGraphesChoisis; - ArrayList<TrPostVisuPanel> listeCalquesPossibles; - ArrayList<EGGraphe> listeGraphesPossibles; - ArrayList<EGGraphe> listeGraphesChoisis; - ArrayList<JLabel> listeObjetsCalques; - - - - public TrPostActionAddPointFromWidgetCalque2(EbliScene _scene, TrPostCommonImplementation _impl) { - super(_scene, TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), "ADDPOINTWIDGET"); - - cmd_ = _scene.getCmdMng(); - impl_ = _impl; - putValue(NAME, "Arri\xE8re plan"); - this - .setDefaultToolTip(TrResource - .getS("S\xE9lectionnez simultan\xE9ment le calque qui contient les points ainsi que les graphes qui contiendront les courbes ")); - - } - - - - public void actionPerformed(ActionEvent e) { - - - if (e.getSource() == select) { - if (jlisteGraphesChoix.getSelectedIndex() != -1) { - EGGraphe graphe = listeGraphesPossibles.get(jlisteGraphesChoix.getSelectedIndex()); - JLabel title = (JLabel) modelGraphesPossibles.getElementAt(jlisteGraphesChoix.getSelectedIndex()); - modelGraphesChoisis.addElement(title); - listeGraphesChoisis.add(graphe); - modelGraphesPossibles.removeElementAt(jlisteGraphesChoix.getSelectedIndex()); - listeGraphesPossibles.remove(jlisteGraphesChoix.getSelectedIndex()); - } - } else if (e.getSource() == unselect) { - if (jlisteGraphesSelections.getSelectedIndex() != -1) { - EGGraphe graphe = listeGraphesChoisis.get(jlisteGraphesSelections.getSelectedIndex()); - JLabel title = (JLabel) modelGraphesChoisis.getElementAt(jlisteGraphesSelections.getSelectedIndex()); - modelGraphesPossibles.addElement(title); - listeGraphesPossibles.add(graphe); - modelGraphesChoisis.removeElementAt(jlisteGraphesSelections.getSelectedIndex()); - listeGraphesChoisis.remove(jlisteGraphesSelections.getSelectedIndex()); - } - }else if (e.getSource() == validation) { - // validation de l action - if (listeGraphesChoisis.size() == 0) { - new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource - .getS("Il doit y avoir au moins un graphe s\xE9lectionn\xE9.")).activate(); - return; - } - - - TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); - - // -- on applique l'action \xE0 chaque widget graphe --// - for (int i = 0; i < listeGraphesChoisis.size(); i++) { - EGGraphe graphe = listeGraphesChoisis.get(i); - - // -- execution de l action pour le graphe selectionne --// - (new TrPostCourbeAddPointsAction(impl_, graphe, calqueChoisi)).actionPerformed(new ActionEvent(calqueChoisi, 0, - "ADDPOINTWIDGET")); - - } - scene_.refresh(); - - - - } else if (e.getSource() == quitter) { - frame_.dispose(); - - } else if (e.getSource() == creationNewGraphe) { - - // -- creation d un nouveau graphe --// - TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); - - // -- methode appelee qui doit creer un graphe avec la selection --// - calqueChoisi.addEvolutionFor(); - - // -- on doit remettre a jour les infos --// - // frame_.dispose(); - // rechercheGrapheAndCalque(); - - }else - { - rechercheGrapheAndCalque(); - } - - } - - private void rechercheGrapheAndCalque() { - Map params = new HashMap(); - CtuluLibImage.setCompatibleImageAsked(params); - // -- recuperation de la liste des nodes de la scene --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getObjects(); - System.err.println("Il y a dans la scenne: " + listeNode.size()); - modelGraphesPossibles = new DefaultListModel(); - modelGraphesChoisis = new DefaultListModel(); - listeObjetsCalques = new ArrayList<JLabel>(); - listeCalquesPossibles = new ArrayList<TrPostVisuPanel>(); - listeGraphesPossibles = new ArrayList<EGGraphe>(); - listeGraphesChoisis = new ArrayList<EGGraphe>(); - // -- tentative de recuperation du calque --// - for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { - EbliNode currentNode = it.next(); - if (currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque) { - EbliWidgetCreatorVueCalque new_name = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); - listeCalquesPossibles.add((TrPostVisuPanel) new_name.getCalque()); - - JLabel label = new JLabel(); - BufferedImage image = new_name.getCalque().produceImage(50, 50, params); - Icon icone = new ImageIcon(image); - label.setIcon(icone); - label.setText(currentNode.getTitle()); - listeObjetsCalques.add(label); - - } else if (currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { - EbliWidgetCreatorGraphe new_name = (EbliWidgetCreatorGraphe) currentNode.getCreator(); - - JLabel label = new JLabel(); - BufferedImage image = new_name.getGraphe().produceImage(50, 50, params); - Icon icone = new ImageIcon(image); - - label.setIcon(icone); - label.setText(currentNode.getTitle()); - modelGraphesPossibles.addElement(label); - listeGraphesPossibles.add(new_name.getGraphe()); - } - } - if (listeCalquesPossibles.size() == 0) { - new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource - .getS("Il n'y a pas de calques disponibles.")).activate(); - return; - }/* - * else if (modelGraphesPossibles.size() == 0) { new - * BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), - * TrResource .getS("Il n'y a pas de graphes disponibles.")).activate(); - * return; } - */ - - // -- affichage de al dialog --// - constructDialog().setVisible(true); - } - - public class GrapheCellRenderer extends JLabel implements ListCellRenderer { - private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); - - public GrapheCellRenderer() { - setOpaque(true); - setIconTextGap(12); - } - - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - JLabel entry = (JLabel) value; - setText(entry.getText()); - setIcon(entry.getIcon()); - if (isSelected) { - setBackground(HIGHLIGHT_COLOR); - setForeground(Color.white); - } else { - setBackground(Color.white); - setForeground(Color.black); - } - return this; - } - } - - /** - * construit l interface - * - * @return - */ -public JDialog constructDialog() { - - - boxCalques_ = new JComboBox(); - for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { - boxCalques_.addItem(it.next()); - } - boxCalques_.setRenderer(new GrapheCellRenderer()); - boxCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Liste des calques de la scene"))); - jlisteGraphesChoix = new JList(modelGraphesPossibles); - jlisteGraphesChoix.setCellRenderer(new GrapheCellRenderer()); - - jlisteGraphesChoix.setSize(250, 350); - jlisteGraphesChoix.setBorder(BorderFactory.createTitledBorder(TrResource.TR - .getString("Graphes possibles"))); - jlisteGraphesSelections = new JList(modelGraphesChoisis); - jlisteGraphesSelections.setSize(250, 350); - jlisteGraphesSelections.setBorder(BorderFactory.createTitledBorder(TrResource.TR - .getString("Graphes choisis"))); - jlisteGraphesSelections.setCellRenderer(new GrapheCellRenderer()); - - validation = new JButton(TrResource.TR.getString("Valider"), EbliResource.EBLI.getIcon("crystal_valider")); - validation.addActionListener(this); - creationNewGraphe = new JButton(TrResource.TR.getString("Cr\xE9er un nouveau graphe"), EbliResource.EBLI - .getIcon("crystal_valider")); - creationNewGraphe.addActionListener(this); - select = new JButton(TrResource.TR.getString("Ajouter"), EbliResource.EBLI - .getIcon("crystal22_avancervite")); - unselect = new JButton(TrResource.TR.getString("Enlever"), EbliResource.EBLI - .getIcon("crystal22_reculervite")); - select.addActionListener(this); - unselect.addActionListener(this); - quitter = new JButton(TrResource.TR.getString("Quitter"), EbliResource.EBLI.getIcon("crystal_detruire")); - quitter.addActionListener(this); - //Box box = Box.createHorizontalBox(); - JPanel box = new JPanel(new GridLayout(1, 3)); - box.setSize(550, 350); - box.add(jlisteGraphesChoix); - Box boxButton = Box.createVerticalBox(); - JPanel panSelect = new JPanel(new FlowLayout(FlowLayout.CENTER)); - panSelect.add(select); - boxButton.add(panSelect); - boxButton.add(Box.createGlue()); - panSelect = new JPanel(new FlowLayout(FlowLayout.CENTER)); - panSelect.add(unselect); - boxButton.add(panSelect); - box.add(boxButton); - box.add(jlisteGraphesSelections); - - JPanel content = new JPanel(new BorderLayout()); - - content.add(box, BorderLayout.CENTER); - content.add(boxCalques_, BorderLayout.NORTH); - - - JPanel panelControle = new JPanel(new FlowLayout(FlowLayout.CENTER)); - panelControle.add(quitter); - - - panelControle.add(creationNewGraphe); - panelControle.add(validation); - - content.add(panelControle, BorderLayout.SOUTH); - - frame_ = new JDialog(); - - frame_.setContentPane(content); - frame_.setModal(true); - frame_.setTitle(TrResource.TR.getString("Choix des \xE9l\xE9ments")); - frame_.setIconImage(null); - frame_.setSize(550, 400); - return frame_; -} - -} Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java (from rev 3883, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java 2008-09-06 17:18:19 UTC (rev 3894) @@ -0,0 +1,112 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuDialogError; + +/** + * Action qui recupere les widgets selectionnes calque et graphe. Recupere + * l'unique calque selectionn\xE9s et l'ensem + * + * @author genesis + * + */ +public class TrPostActionAddPointFromWidgetCalque2 extends EbliWidgetActionSimple { + + + + CtuluCommandContainer cmd_; + TrPostCommonImplementation impl_; + + + + public TrPostActionAddPointFromWidgetCalque2(EbliScene _scene, TrPostCommonImplementation _impl) { + super(_scene, TrResource.getS("Ajout des points du calque"), CtuluResource.CTULU.getIcon("cible"), + "ADDPOINTWIDGET"); + + cmd_ = _scene.getCmdMng(); + impl_ = _impl; + putValue(NAME, "Arri\xE8re plan"); + this + .setDefaultToolTip(TrResource + .getS("S\xE9lectionnez simultan\xE9ment le calque qui contient les points ainsi que les graphes qui contiendront les courbes ")); + + } + + public void actionPerformed(ActionEvent e) { + + // -- recuperation de la liste des nodes de la scene --// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + boolean isCalqueUnique = true; + boolean isGraphePresent = false; + TrPostVisuPanel calque = null; + ArrayList<EGGraphe> listeGraphes = new ArrayList<EGGraphe>(); + + //-- tentative de recuperation du calque --// + for (Iterator<EbliNode> it = listeNode.iterator(); isCalqueUnique && it.hasNext();) { + + EbliNode currentNode = it.next(); + + if(currentNode.getCreator() instanceof EbliWidgetCreatorVueCalque){ + if (calque == null) { + EbliWidgetCreatorVueCalque creatorCalque = (EbliWidgetCreatorVueCalque) currentNode.getCreator(); + calque = (TrPostVisuPanel) creatorCalque.getCalque(); + } else { + // -- error plus d 'un calque --// + isCalqueUnique = false; + } + } else if (currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { + EbliWidgetCreatorGraphe creatorGraphe = (EbliWidgetCreatorGraphe) currentNode.getCreator(); + listeGraphes.add(creatorGraphe.getGraphe()); + isGraphePresent = true; + } + + + } + + // -- on v\xE9rifie que les booleens n'ont pas d\xE9tect\xE9s d'erreurs --// + if (calque == null) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), TrResource + .getS("Il doit y avoir un calque s\xE9lectionn\xE9.")) + .activate(); + return; + } else if (!isCalqueUnique) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), + TrResource + .getS("Il doit y avoir un et un seul calque s\xE9lectionn\xE9.")).activate(); + return; + } else if (!isGraphePresent) { + new BuDialogError(impl_.getApp(), impl_.getInformationsSoftware(), + TrResource + .getS("Il doit y avoir au moins un graphe s\xE9lectionn\xE9.")).activate(); + return; + } + + // -- on applique l'action \xE0 chaque widget graphe --// + for (Iterator<EGGraphe> it = listeGraphes.iterator(); it.hasNext();) { + EGGraphe graphe = it.next(); + + // -- execution de l action pour le graphe selectionne --// + (new TrPostCourbeAddPointsAction(impl_, graphe, calque)).actionPerformed(new ActionEvent(calque, 0, + "ADDPOINTWIDGET")); + + } + scene_.refresh(); + + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque2.java ___________________________________________________________________ Added: svn:mergeinfo + Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionChangeSceneForWidget.ja... [truncated message content] |