From: <had...@us...> - 2008-08-11 10:05:42
|
Revision: 3757 http://fudaa.svn.sourceforge.net/fudaa/?rev=3757&view=rev Author: hadouxad Date: 2008-08-11 10:05:42 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Ajout des fonctionnalites de - Action de duplication de la totalite des widgets selectionnees - Action de premier plan de la totalite des widgets selectionnee - Action de arriere plan de la totalite des widgets selectionnees Modified Paths: -------------- 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 Added 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 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-11 08:09:27 UTC (rev 3756) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-11 10:05:42 UTC (rev 3757) @@ -67,11 +67,7 @@ public void actionPerformed(ActionEvent e) { - // position a cote de l element initial - Point nouvellePosition = new Point( - (int) (EbliWidget.this.getLocation().x + EbliWidget.this.getClientArea().width / 2), (int) (EbliWidget.this - .getLocation().y + EbliWidget.this.getClientArea().height / 2)); - + //-- recuperation du node a dupliquer --// EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-08-11 10:05:42 UTC (rev 3757) @@ -0,0 +1,72 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.AbstractAction; + +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; + +/** + * classe qui permet de placer les widgets selectionnes en arriere plan. + * @author genesis + * + */ +public class EbliWidgetActionBackGround extends AbstractAction{ + + EbliScene scene_; + + public EbliWidgetActionBackGround(EbliScene _scene){ + scene_=_scene; + putValue(NAME,"Arri\xE8re plan"); + } + + 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_.getNodes(); + + //-- parcours des nodes + for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ + + EbliNode currentNode=it.next(); + if(currentNode!=null && currentNode.isMovable()){ + + //-- 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(); + + + } + } + + } + + + + } + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-08-11 10:05:42 UTC (rev 3757) @@ -0,0 +1,84 @@ +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.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; + + +/** + * classe qui permet de dupliquer l'objet selectionne + * + * pour conna\xEEtre les objet selectionnee, on interroge le state des widget isSelection() + * on duplique via la methode du node duplicate() + * duplication s effectue en bas par default + * @author genesis + * + */ +public class EbliWidgetActionDuplicate extends AbstractAction{ + + /** + * + */ + private static final long serialVersionUID = 1L; + EbliScene scene_; + + public EbliWidgetActionDuplicate(EbliScene _scene){ + scene_=_scene; + putValue(NAME,"Duplication des \xE9lements s\xE9lectionn\xE9s"); + } + + + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + + //-- recuperation de la liste des widgets selectionnees --// + + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); + + List<EbliNode> listeNodeADupliquer=new ArrayList<EbliNode>(); + + //-- parcours des nodes + for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ + + EbliNode currentNode=it.next(); + if(currentNode!=null && currentNode.hasWidget()){ + + //-- duplication que si la widget est selectionnee --// + if(currentNode.getCreator().getWidget().getState().isSelected()){ + + listeNodeADupliquer.add(currentNode); + + + } + + } + } + //-- duplication des noeuds saisis --// + for(Iterator<EbliNode> it=listeNodeADupliquer.iterator();it.hasNext();){ + EbliNode currentNode=it.next(); + + //-- duplication du node --// + EbliNode node = currentNode.duplicate(null); + if(node !=null){ + + //-- ajout du node dans la scene --// + scene_.addNode(node); + + //-- rafraichissement de la scene --// + scene_.refresh(); + + } + } + + } + + +} Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-08-11 10:05:42 UTC (rev 3757) @@ -0,0 +1,63 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.util.Iterator; +import java.util.Set; + +import javax.swing.AbstractAction; + +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; + +/** + * classe qui permet de placer les widgets selectionnes au premier plan. + * @author genesis + * + */ +public class EbliWidgetActionForeGround extends AbstractAction{ + + EbliScene scene_; + + public EbliWidgetActionForeGround(EbliScene _scene){ + scene_=_scene; + putValue(NAME,"Premier plan"); + } + + 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_.getNodes(); + + //-- parcours des nodes + for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ + + EbliNode currentNode=it.next(); + if(currentNode!=null && currentNode.isMovable()){ + + //-- deplacement au premier plan que si la widget est selectionnee --// + if(currentNode.getCreator().getWidget().getState().isSelected()){ + + //-- ajout au premier plan du node --// + scene_.getVisu_().addChild(currentNode.getCreator().getWidget()); + + + + //-- rafraichissement de la scene --// + scene_.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-11 08:09:27 UTC (rev 3756) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-11 10:05:42 UTC (rev 3757) @@ -18,6 +18,7 @@ import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JScrollPane; @@ -52,6 +53,9 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangle; import org.fudaa.ebli.visuallibrary.EbliWidgetDBLFleche; 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.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; @@ -228,26 +232,28 @@ scene.addNode(node); // -- ajout du fleche double sens nord--// - node = new EbliNodeDefault(); - node.setTitle("Fleche Double"); - node.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_WEST)); - node.setPreferedSize(new Dimension(100, 100)); - node.setPreferedLocation(new Point(450, 125)); - scene.addNode(node); + final EbliNodeDefault nodeDbl = new EbliNodeDefault(); + nodeDbl.setTitle("Fleche Double"); + nodeDbl.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_WEST)); + nodeDbl.setPreferedSize(new Dimension(100, 100)); + nodeDbl.setPreferedLocation(new Point(450, 125)); + scene.addNode(nodeDbl); // -- ajout du fleche sens unique--// - node = new EbliNodeDefault(); - node.setTitle("Fleche"); - node.setCreator(new EbliWidgetCreatorFleche(0)); - node.setPreferedSize(new Dimension(100, 100)); - node.setPreferedLocation(new Point(250, 525)); - scene.addNode(node); + final EbliNodeDefault nodeFleche = new EbliNodeDefault(); + nodeFleche.setTitle("Fleche"); + nodeFleche.setCreator(new EbliWidgetCreatorFleche(0)); + nodeFleche.setPreferedSize(new Dimension(100, 100)); + nodeFleche.setPreferedLocation(new Point(250, 525)); + scene.addNode(nodeFleche); + + // node.getCreator().getWidget().setState(state) //if(node.getCreator().getWidget().) + - // WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, // graphe.getClientArea()); @@ -340,34 +346,14 @@ bar =new JToolBar(); f.add(bar,BorderLayout.PAGE_END); -bar.add(new AbstractAction("duplique rectangle"){ +bar.add(new EbliWidgetActionDuplicate(scene)); - public void actionPerformed(ActionEvent e) { - EbliNode node = nodeRect.duplicate(null); - if(node !=null){ - scene.addNode(node); - scene.getView().repaint(); - }} -}); -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"){ +bar.add(new EbliWidgetActionForeGround(scene)); - public void actionPerformed(ActionEvent e) { - EbliNode node = nodeCalque.duplicate(null); - if(node !=null){ - scene.addNode(node); - scene.getView().repaint(); - }} -}); +bar.add(new EbliWidgetActionBackGround(scene)); + 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. |