From: <had...@us...> - 2008-08-11 07:24:37
|
Revision: 3751 http://fudaa.svn.sourceforge.net/fudaa/?rev=3751&view=rev Author: hadouxad Date: 2008-08-11 07:24:44 +0000 (Mon, 11 Aug 2008) Log Message: ----------- implementation de la fonction de duplication pour le graphe, les feleches et fleches double. probleme pour la vue calque 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/test/org/fudaa/ebli/all/TestGraphe2.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-09 15:14:54 UTC (rev 3750) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-11 07:24:44 UTC (rev 3751) @@ -4,6 +4,9 @@ import java.awt.Point; import java.util.Map; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; + public class EbliNodeDefault implements EbliNode { @@ -26,20 +29,22 @@ EbliNode duplique= new EbliNodeDefault(); duplique.setTitle(getTitle()); - - - - //-- creation d une instance similaire du creator--// - EbliWidgetCreator creatorDuplique=null; - + 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()); 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-09 15:14:54 UTC (rev 3750) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-11 07:24:44 UTC (rev 3751) @@ -83,7 +83,7 @@ // duplique.setPreferedLocation(nouvellePosition); // -- ajout dans la scene --// - if (EbliWidget.this.getScene() != null) { + if (duplique!=null && EbliWidget.this.getScene() != null) { EbliWidget.this.getEbliScene().addNode(duplique); //info debug widget duplique //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); 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-09 15:14:54 UTC (rev 3750) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-11 07:24:44 UTC (rev 3751) @@ -14,6 +14,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.AbstractAction; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; @@ -170,14 +171,14 @@ // -- creation d un noeud Graphe --// - EbliNodeDefault node = new EbliNodeDefault(); - node.setCreator(new EbliWidgetCreatorGraphe(g)); - node.setTitle("Graphe"); - node.setPreferedSize(new Dimension(200, 250)); - node.setPreferedLocation(new Point(12, 420)); - scene.addNode(node); + final EbliNodeDefault nodeG = new EbliNodeDefault(); + nodeG.setCreator(new EbliWidgetCreatorGraphe(g)); + nodeG.setTitle("Graphe"); + nodeG.setPreferedSize(new Dimension(200, 250)); + nodeG.setPreferedLocation(new Point(12, 420)); + scene.addNode(nodeG); - + EbliNodeDefault node; // -- creation d un noeud legende --// EbliNodeDefault nodeLegende = new EbliNodeDefault(); nodeLegende.setTitle("Legende"); @@ -192,10 +193,10 @@ br.setLineModel(0, new TraceLigneModel(TraceLigne.LISSE, 5, Color.RED)); BVueCalque vueC = new BVueCalque(br); vueC.setSize(new Dimension(200, 200)); - node = new EbliNodeDefault(); - node.setTitle("Vue Calque"); - node.setPreferedSize(new Dimension(400, 200)); - node.setPreferedLocation(new Point(250, 170)); + final EbliNodeDefault nodeCalque = new EbliNodeDefault(); + nodeCalque.setTitle("Vue Calque"); + nodeCalque.setPreferedSize(new Dimension(400, 200)); + nodeCalque.setPreferedLocation(new Point(250, 170)); // JFrame fr = new JFrame(); ZEbliCalquesPanel ebliCalquesPanel = new ZEbliCalquesPanel(br, new CtuluUIDefault()); @@ -203,8 +204,8 @@ // ebliCalquesPanel.setPreferredSize(new Dimension(400, 400)); // fr.setPreferredSize(new Dimension(400, 400)); // fr.setVisible(true); - node.setCreator(new EbliWidgetCreatorVueCalque(ebliCalquesPanel)); - scene.addNode(node); + nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(ebliCalquesPanel)); + scene.addNode(nodeCalque); // scene.addChild(new ComponentWidget(scene, // test.getVisuPanel().getVueCalque())); @@ -336,18 +337,37 @@ bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNTOP)); bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNBOTTOM)); -JButton boutontestAjout = new JButton("dupliquer rectangle"); -boutontestAjout.addActionListener(new ActionListener(){ +bar =new JToolBar(); +f.add(bar,BorderLayout.PAGE_END); +bar.add(new AbstractAction("duplique rectangle"){ + public void actionPerformed(ActionEvent e) { EbliNode node = nodeRect.duplicate(null); - scene.addNode(node); + if(node !=null){ + scene.addNode(node); scene.getView().repaint(); - - } - + }} }); -bar.add(boutontestAjout); +bar.add(new AbstractAction("duplique graphe"){ + + public void actionPerformed(ActionEvent e) { + EbliNode node = nodeG.duplicate(null); + if(node !=null){ + scene.addNode(node); + scene.getView().repaint(); + }} +}); +bar.add(new AbstractAction("duplique calque"){ + + public void actionPerformed(ActionEvent e) { + EbliNode node = nodeCalque.duplicate(null); + if(node !=null){ + scene.addNode(node); + scene.getView().repaint(); + }} +}); + p.doLayout(); } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |