From: <had...@us...> - 2008-08-05 06:21:24
|
Revision: 3708 http://fudaa.svn.sourceforge.net/fudaa/?rev=3708&view=rev Author: hadouxad Date: 2008-08-05 06:21:31 +0000 (Tue, 05 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.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/courbe/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-04 22:00:16 UTC (rev 3707) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-05 06:21:31 UTC (rev 3708) @@ -106,6 +106,7 @@ //-- 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? } 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-04 22:00:16 UTC (rev 3707) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-05 06:21:31 UTC (rev 3708) @@ -16,6 +16,7 @@ import java.awt.image.BufferedImage; import java.util.Collections; +import javax.swing.Box; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenu; @@ -145,7 +146,10 @@ final JTree t = new JTree(grapheModel); t.setSelectionModel(grapheModel.getSelectionModel()); t.setRootVisible(false); - p.add(new BuScrollPane(t), BuBorderLayout.EAST); + + Box boxEast=Box.createVerticalBox(); + boxEast.add(new BuScrollPane(t)); + p.add(boxEast, BuBorderLayout.EAST); p.doLayout(); f.setContentPane(p); final EGFillePanel pn = new EGFillePanel(g); @@ -384,6 +388,11 @@ scene.addNode(g); // fin p.add(new JScrollPane(scene.createView()), BuBorderLayout.CENTER); + + //ajout de la vue sattelite en bas \xE4 gauche + boxEast.add(scene.createSatelliteView()); + + final JMenu menu = new JMenu(); menu.setName("essai"); menu.setText("essai"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-04 20:47:11
|
Revision: 3706 http://fudaa.svn.sourceforge.net/fudaa/?rev=3706&view=rev Author: hadouxad Date: 2008-08-04 20:47:14 +0000 (Mon, 04 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d d?\195?\169dut de cr?\195?\169ation du manager de widget legendes reste a corriger 1)la position des widget par rapport au graphe 2)l ajout des icones et trac?\195?\169 Modified Paths: -------------- 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/courbe/WidgetLegendeManager.java Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java 2008-08-04 20:47:14 UTC (rev 3706) @@ -0,0 +1,171 @@ +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.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); + + } + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java ___________________________________________________________________ Added: svn:mime-type + text/plain 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-04 12:24:25 UTC (rev 3705) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-04 20:47:14 UTC (rev 3706) @@ -9,132 +9,395 @@ import java.awt.Color; import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.util.Collections; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; +import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.WindowConstants; +import javax.swing.text.Utilities; -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuScrollPane; - +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; - +import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbeChild; import org.fudaa.ebli.courbe.EGCourbeModelDefault; import org.fudaa.ebli.courbe.EGFillePanel; import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGObject; +import org.fudaa.ebli.courbe.WidgetLegendeManager; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +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.LabelWidget; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Widget; +import org.netbeans.api.visual.widget.general.IconNodeWidget; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuScrollPane; + /** * @author Fred Deniger * @version $Id: TestGraphe2.java,v 1.8 2007-01-17 10:45:17 deniger Exp $ */ public final class TestGraphe2 { - private TestGraphe2() { - super(); - } + private TestGraphe2() { + super(); + } - /** - * @param _args non utilise - */ - public static void main(final String[] _args) { - final EGGrapheTreeModel grapheModel = new EGGrapheTreeModel(); - final EGGraphe g = new EGGraphe(grapheModel); - final EGAxeHorizontal x = new EGAxeHorizontal(false); - x.setTitre("temps"); - x.setUnite("sec"); - x.setBounds(0.0001, 1000000); - x.setAxisIterator(new LogarithmicNumberIterator()); - x.setGraduations(true); - g.setXAxe(x); - EGGroup gr = new EGGroup(); - gr.setTitle("gr 1"); - EGCourbeModelDefault m = new EGCourbeModelDefault(new double[] { 0.0001, 3, 4, 1000000 }, new double[] { 10000, 4, - 5, 3 }); - EGCourbeChild c = new EGCourbeChild(gr); - m.setTitle("toto bleue"); - c.setModel(m); - c.setAspectContour(Color.cyan); + /** + * @param _args + * non utilise + */ + public static void main(final String[] _args) { + final EGGrapheTreeModel grapheModel = new EGGrapheTreeModel(); + final EGGraphe g = new EGGraphe(grapheModel); + final EGAxeHorizontal x = new EGAxeHorizontal(false); + x.setTitre("temps"); + x.setUnite("sec"); + x.setBounds(0.0001, 1000000); + x.setAxisIterator(new LogarithmicNumberIterator()); + x.setGraduations(true); + g.setXAxe(x); + EGGroup gr = new EGGroup(); + gr.setTitle("gr 1"); + EGCourbeModelDefault m = new EGCourbeModelDefault(new double[] { + 0.0001, 3, 4, 1000000 }, new double[] { 10000, 4, 5, 3 }); + EGCourbeChild c = new EGCourbeChild(gr); + m.setTitle("toto bleue"); + c.setModel(m); + c.setAspectContour(Color.cyan); - gr.addEGComponent(c); + gr.addEGComponent(c); - m = new EGCourbeModelDefault(new double[] { 0.0002, 5, 7, 900000 }, new double[] { 0.001, 1, 3, 4 }); - c = new EGCourbeChild(gr); - c.setAspectContour(Color.RED); - m.setTitle("toto rouge"); - c.setModel(m); + m = new EGCourbeModelDefault(new double[] { 0.0002, 5, 7, 900000 }, + new double[] { 0.001, 1, 3, 4 }); + c = new EGCourbeChild(gr); + c.setAspectContour(Color.RED); + m.setTitle("toto rouge"); + c.setModel(m); - gr.addEGComponent(c); + gr.addEGComponent(c); - EGAxeVertical y = new EGAxeVertical(); - y.setGraduations(true); - y.setGrille(new TraceLigneModel(TraceLigne.LISSE, 1, Color.LIGHT_GRAY)); - y.setDroite(true); - y.setAxisIterator(new LogarithmicNumberIterator()); - y.setBounds(0.0001, 10000); - y.setLineColor(Color.blue); - y.setTitre("essai 2"); - gr.setAxeY(y); - grapheModel.add(gr); - gr = new EGGroup(); - gr.setTitle("gr 2"); - m = new EGCourbeModelDefault(new double[] { 1, 8, 9, 10 }, new double[] { 10, 4, 2, 24 }); - c = new EGCourbeChild(gr); - c.setAspectContour(Color.yellow); - m.setTitle("toto jaune"); - c.setModel(m); - gr.addEGComponent(c); - y = new EGAxeVertical(); - y.setGraduations(true); - y.setBounds(0, 55); - y.setTitre("essai 1"); - gr.setAxeY(y); - gr.addEGComponent(c); - m = new EGCourbeModelDefault(new double[] { 1, 3, 4, 5 }, new double[] { 14, 54, 25, 43 }); - c = new EGCourbeChild(gr); - m.setTitle("toto vert"); - c.setAspectContour(Color.green); - c.setModel(m); - gr.addEGComponent(c); - grapheModel.add(gr); - final JFrame f = new JFrame(); - f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - final BuPanel p = new BuPanel(); - p.setLayout(new BuBorderLayout()); + EGAxeVertical y = new EGAxeVertical(); + y.setGraduations(true); + y.setGrille(new TraceLigneModel(TraceLigne.LISSE, 1, Color.LIGHT_GRAY)); + y.setDroite(true); + y.setAxisIterator(new LogarithmicNumberIterator()); + y.setBounds(0.0001, 10000); + y.setLineColor(Color.blue); + y.setTitre("essai 2"); + gr.setAxeY(y); + grapheModel.add(gr); + gr = new EGGroup(); + gr.setTitle("gr 2"); + m = new EGCourbeModelDefault(new double[] { 1, 8, 9, 10 }, + new double[] { 10, 4, 2, 24 }); + c = new EGCourbeChild(gr); + c.setAspectContour(Color.yellow); + m.setTitle("toto jaune"); + c.setModel(m); + gr.addEGComponent(c); + y = new EGAxeVertical(); + y.setGraduations(true); + y.setBounds(0, 55); + y.setTitre("essai 1"); + gr.setAxeY(y); + gr.addEGComponent(c); + m = new EGCourbeModelDefault(new double[] { 1, 3, 4, 5 }, new double[] { + 14, 54, 25, 43 }); + c = new EGCourbeChild(gr); + m.setTitle("toto vert"); + c.setAspectContour(Color.green); + c.setModel(m); + gr.addEGComponent(c); + grapheModel.add(gr); + final JFrame f = new JFrame(); + f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + f.setSize(new Dimension(1024,768)); + final BuPanel p = new BuPanel(); + p.setLayout(new BuBorderLayout()); - g.setPreferredSize(new Dimension(200, 300)); - g.setSize(g.getPreferredSize()); - final JTree t = new JTree(grapheModel); - t.setSelectionModel(grapheModel.getSelectionModel()); - t.setRootVisible(false); - p.add(new BuScrollPane(t), BuBorderLayout.EAST); - p.doLayout(); - f.setContentPane(p); - final EGFillePanel pn = new EGFillePanel(g); + g.setPreferredSize(new Dimension(200, 300)); + g.setSize(g.getPreferredSize()); + final JTree t = new JTree(grapheModel); + t.setSelectionModel(grapheModel.getSelectionModel()); + t.setRootVisible(false); + p.add(new BuScrollPane(t), BuBorderLayout.EAST); + p.doLayout(); + f.setContentPane(p); + final EGFillePanel pn = new EGFillePanel(g); + final GraphScene scene = new GraphScene() { + LayerWidget visu; - p.add(pn, BuBorderLayout.CENTER); - final JMenu menu = new JMenu(); - menu.setName("essai"); - menu.setText("essai"); - pn.fillSpecificMenu(menu); - final JMenuBar b = new JMenuBar(); - b.add(menu); - f.setJMenuBar(b); - f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + { + visu = new LayerWidget(this); + addChild(visu); + } - f.pack(); - f.show(); - g.computeMarges(); - g.fullRepaint(); + @Override + protected Widget attachNodeWidget(Object arg0) { + final EGGraphe courbe = (EGGraphe) arg0; + final Widget graphe = new Widget(this) { + 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)); - } + } + + @Override + protected void paintWidget() { + Rectangle rec = getClientArea(); + + // BufferedImage image = courbe.produceImage( + // rec.width - 1, rec.height - 1, + // Collections.EMPTY_MAP); + getGraphics().translate(rec.x, rec.y); + courbe.setSize(rec.width - 1, + rec.height - 1); + courbe.computeMarges(getGraphics()); + courbe.dessine(getGraphics(), rec.width - 1, + rec.height - 1, false ); + } + // } + }; + courbe.getModel().addModelListener(new EGGrapheModelListener() { + + public void structureChanged() { + repaint(); + + } + + public void courbeContentChanged(EGObject _c, boolean restore) { + repaint(); + + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + graphe.paint(); + paint(); + // TODO Auto-generated method stub + + } + + public void axeContentChanged(EGAxe _c) { + repaint(); + + } + + public void axeAspectChanged(EGAxe _c) { + repaint(); + + } + }); + graphe.setPreferredSize(new Dimension(100, 100)); + visu.addChild(graphe); + + +// //creation d un label widget +// LabelWidget labelWidget=new LabelWidget(this, "test") { +// public void notifyStateChanged(ObjectState previousState, +// ObjectState newState) { +// LookFeel lookFeel = getScene().getLookFeel(); +// // setBorder(lookFeel.getBorder(newState)); +// // setForeground(lookFeel.getForeground(newState)); +// +// setBorder(lookFeel.getBorder(newState)); +// // recuperation du rectangle contour +// Rectangle rec = getClientArea(); +// //setFont(new Font("Times New Roman", Font.PLAIN,rec.width )); +// repaint(); +// +// // setBorder(newState.isSelected() ? +// // (DEFAULT_SELECTED_BORDER) : +// // (newState.isHovered() ? RESIZE_BORDER +// // : DEFAULT_BORDER)); +// +// } +// +// +// +// +// +// +// +// }; +// +// +// //marche pas il faut un container jscrollpane +// //graphe.getActions().addAction(ActionFactory.createCenteredZoomAction (500)); +// +// +// labelWidget.getActions().addAction(ActionFactory.createResizeAction()); +// labelWidget.getActions().addAction(ActionFactory.createMoveAction()); +// labelWidget.getActions().addAction(this.createWidgetHoverAction()); +// //zoom de la scene en maintenant ctrl + molette +// labelWidget.getActions().addAction(ActionFactory.createZoomAction()); +// +// +// // +// labelWidget.getActions().addAction(ActionFactory.createPanAction()); +// +// //-- ajout du labelWidget dans le visuel --// +// visu.addChild(labelWidget); +// +// +// //creation d un image widget + ImageWidget imageWidget=new ImageWidget (this,CtuluResource.CTULU.getImage("crystal_oui")){ + 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=10; + if(heightCadre==0) + heightCadre=10; + + + g.fillRect(rec.x, rec.y,widthCadre - 1, heightCadre - 1); + //courbe.setSize(rec.width - 1,rec.height - 1); + //courbe.computeMarges(getGraphics()); + //courbe.dessine(getGraphics(), rec.width - 1,rec.height - 1, false ); + + + } + + }; + + + WidgetLegendeManager.createWidgetLegendeGraphe(this, visu, courbe, graphe.getClientArea()); + + + //ajout des resize et drag + imageWidget.getActions().addAction( ActionFactory.createResizeAction()); + imageWidget.getActions().addAction(ActionFactory.createMoveAction()); + imageWidget.getActions().addAction(this.createWidgetHoverAction()); + //ajout du label widget + visu.addChild (imageWidget); + + + //test avec iconwidget + IconNodeWidget iconNode = new IconNodeWidget (this); + iconNode.setImage (CtuluResource.CTULU.getImage("crystal_non")); + iconNode.setLabel ("MyIconNode"); + this.addChild (iconNode); + this.getActions ().addAction (ActionFactory.createCenteredZoomAction (1.1)); + this.getActions ().addAction (ActionFactory.createPanAction ()); + // assign HoverAction - the actual hovered widget is held by the scene + iconNode.getActions ().addAction (this.createWidgetHoverAction ()); + // MoveAction has to be after the hover action + // otherwise MoveAction will always consume the event and HoverAction will never be invoked + iconNode.getActions ().addAction (ActionFactory.createMoveAction ()); + + + // proprietes graphes + graphe.getActions().addAction( + ActionFactory.createResizeAction()); + graphe.getActions().addAction(ActionFactory.createMoveAction()); + graphe.getActions().addAction(this.createWidgetHoverAction()); + return graphe; + } + + @Override + protected Widget attachEdgeWidget(Object arg0) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void attachEdgeTargetAnchor(Object arg0, Object arg1, + Object arg2) { + // TODO Auto-generated method stub + + } + + @Override + protected void attachEdgeSourceAnchor(Object arg0, Object arg1, + Object arg2) { + // TODO Auto-generated method stub + + } + }; + + + + + + + // debut + // scene.addNode(g); + scene.addNode(g); + // fin + p.add(new JScrollPane(scene.createView()), BuBorderLayout.CENTER); + final JMenu menu = new JMenu(); + menu.setName("essai"); + menu.setText("essai"); + pn.fillSpecificMenu(menu); + final JMenuBar b = new JMenuBar(); + b.add(menu); + f.setJMenuBar(b); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + //f.pack(); + f.show(); + scene.setFont(CtuluLibSwing.getMiniFont()); + g.computeMarges(scene.getGraphics()); + g.fullRepaint(); + + } } \ 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-05 07:51:16
|
Revision: 3709 http://fudaa.svn.sourceforge.net/fudaa/?rev=3709&view=rev Author: hadouxad Date: 2008-08-05 07:51:22 +0000 (Tue, 05 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 - creation du package visual librarie - creation de EbliWidget - creation de LineWidget : dessin de la ligne et icone - creation de TitleWidget : label du titre Les libell?\195?\169s et couleurs icones se mettent a jour a la modification de la conf de la courbe Modified Paths: -------------- 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/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-05 07:51:22 UTC (rev 3709) @@ -0,0 +1,35 @@ +package org.fudaa.ebli.visuallibrary; + +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.laf.LookFeel; +import org.netbeans.api.visual.model.ObjectState; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.widget.Widget; + + +/** + * Widget version EBLI + * @author genesis + * + */ +class EbliWidget extends Widget { + + /** + * @param scene + */ + public EbliWidget(Scene scene) { + super(scene); + getActions().addAction( ActionFactory.createResizeAction()); + getActions().addAction(ActionFactory.createMoveAction()); + getActions().addAction(scene.createWidgetHoverAction());//a voir pour que le parent soit + //aussi en hover : a voir apr\xE8s. + setBorder(getScene().getLookFeel().getMiniBorder(ObjectState.createNormal())); + } + + @Override + public void notifyStateChanged(ObjectState previousState, ObjectState newState) { + LookFeel lookFeel = getScene().getLookFeel(); + setBorder(lookFeel.getMiniBorder(newState)); + } + +} \ No newline at end of file Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java 2008-08-05 07:51:22 UTC (rev 3709) @@ -0,0 +1,52 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Graphics2D; +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; +import org.netbeans.api.visual.widget.Scene; + + +/** + * Legende + * Widget qui contient le trac\xE9 de la ligne de la l\xE9gende courbe + * @author genesis + * + */ +public class LineWidget extends EbliWidget { + + EGCourbe cb_; + + /** + * @param _scene + */ + public LineWidget(Scene _scene, EGCourbe _cb) { + super(_scene); + cb_ = _cb; + setMinimumSize(new Dimension(30, 10)); + setPreferredSize(new Dimension(40, 10)); + } + + /** + * + */ + @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); + } +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java 2008-08-05 07:51:22 UTC (rev 3709) @@ -0,0 +1,57 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGCourbe; +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.modules.visual.layout.FlowLayout; + + +/** + * Legende + * Widget qui contient le titre de la ligne de la l\xE9gende courbe + * @author genesis + * + */ +public class TitleWidget extends EbliWidget { + + EGCourbe cb_; + + LabelWidget intern; + + /** + * @param _scene + */ + public TitleWidget(Scene _scene, EGCourbe _cb) { + super(_scene); + setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); + intern = new LabelWidget(_scene); + intern.setForeground(_cb.getAspectContour()); + addChild(intern); + setCourbe(_cb); + } + + public void majLabel(){ + intern.setForeground(cb_.getAspectContour()); + intern.setLabel(cb_.getTitle()); + } + + + /** + * @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()); + } + } + +} \ No newline at end of file Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java 2008-08-05 07:51:22 UTC (rev 3709) @@ -0,0 +1,108 @@ +package org.fudaa.ebli.visuallibrary; + + + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; + +import javax.swing.JFrame; +import javax.swing.JPanel; + +import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; +import org.fudaa.ebli.courbe.EGAxe; +import org.fudaa.ebli.courbe.EGAxeHorizontal; +import org.fudaa.ebli.courbe.EGAxeVertical; +import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGCourbeModelDefault; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGObject; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; +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.layout.LayoutFactory.SerialAlignment; +import org.netbeans.api.visual.model.ObjectState; +import org.netbeans.api.visual.widget.LabelWidget; +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.layout.FlowLayout; + +/** + * @author denf01a adrien hadous + * @creation 5 ao\xFBt 2008 + * @version + * + */ +public class WidgetLegendeManager { + + + + //exemple a ameliorer + public static EbliWidget createLegende(EGGraphe g, Scene scene) { + EGCourbe[] cs = g.getModel().getCourbes(); + EbliWidget res = new EbliWidget(scene); + res.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 10));// a modifier pour setter le gap + for (int i = 0; i < cs.length; i++) { + final EbliWidget line = new EbliWidget(scene); + line.setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); + + //creation de la widget titre + final TitleWidget tw=new TitleWidget(scene, cs[i]); + + //creation de la widget ligne + LineWidget lw=new LineWidget(scene, cs[i]); + + line.addChild(lw); + line.addChild(tw); + res.addChild(line); + + //-- ajouter le listener EGGraphe pour ecouter et \xE9ettre a jour els l\xE9gendes --// + g.getModel().addModelListener(new EGGrapheModelListener() { + + public void structureChanged() { + line.repaint(); + tw.majLabel(); + + } + + public void courbeContentChanged(EGObject _c, boolean restore) { + line.repaint(); + tw.majLabel(); + + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + line.repaint(); + tw.majLabel(); + + } + + public void axeContentChanged(EGAxe _c) { + line.repaint(); + tw.majLabel(); + } + + public void axeAspectChanged(EGAxe _c) { + line.repaint(); + tw.majLabel(); + } + }); + + } + return res; + } + + + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java (from rev 3708, branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/WidgetLegendeManager.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java 2008-08-05 07:51:22 UTC (rev 3709) @@ -0,0 +1,184 @@ +package org.fudaa.ebli.visuallibrary; + + + +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.fudaa.ebli.courbe.EGAxe; +import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; +import org.fudaa.ebli.courbe.EGObject; +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.SelectProvider; +import org.netbeans.api.visual.action.TextFieldInplaceEditor; +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.LabelWidget; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Widget; + +import sun.awt.image.ToolkitImage; + + + +/** + * Classe qui g\xE9n\xE8re les l\xE9gendes de chacun des graphes + * + * + * @author Adrien Hadoux + * + */ + +public class WidgetLegendeManagerOLD { + + + 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); + + } + + +} + + Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManagerOLD.java ___________________________________________________________________ Added: svn:mime-type + text/plain 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-05 06:21:31 UTC (rev 3708) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-05 07:51:22 UTC (rev 3709) @@ -41,9 +41,10 @@ import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGObject; -import org.fudaa.ebli.courbe.WidgetLegendeManager; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.WidgetLegendeManager; +import org.fudaa.ebli.visuallibrary.WidgetLegendeManagerOLD; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.graph.GraphScene; import org.netbeans.api.visual.laf.LookFeel; @@ -324,8 +325,9 @@ }; - WidgetLegendeManager.createWidgetLegendeGraphe(this, visu, courbe, graphe.getClientArea()); + //WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, graphe.getClientArea()); + visu.addChild (WidgetLegendeManager.createLegende(courbe, this)); //ajout des resize et drag imageWidget.getActions().addAction( ActionFactory.createResizeAction()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-05 15:42:58
|
Revision: 3714 http://fudaa.svn.sourceforge.net/fudaa/?rev=3714&view=rev Author: hadouxad Date: 2008-08-05 15:42:58 +0000 (Tue, 05 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 - creation de la classe GrapheWidget aui dessine un graphe - creation de la classe scene principale fonctions: - menu popup accessible par clic droit ( ffermer l objet graphique) - fonction de zoom (ctrl + clic) - resolution des bugs rafraichissement simultan?\195?\169 des graphes et legende - recuperation de la vue sattelite de la scene principale reste a extendre d image producer Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.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/EbliGraphScene.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -0,0 +1,166 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JComponent; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + +import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.graph.GraphScene; +import org.netbeans.api.visual.widget.LayerWidget; +import org.netbeans.api.visual.widget.Widget; + + +/** + * clqsse de gestion de la scene principale + * @author Adrien Hadoux + * + */ +public class EbliGraphScene extends GraphScene{ + + /** + * la visu du graphscene + */ + private LayerWidget visu_; + + public EbliGraphScene() { + super(); + + // creation du layer de mise en page + visu_ = new LayerWidget(this); + addChild(visu_); + + //-- ajoute l'action du zoom ( ctrl + clic) + getActions ().addAction (ActionFactory.createCenteredZoomAction (1.1)); + + //-- ajouter le menu popup de base + setMenuBase(); + + } + + public LayerWidget getVisu_() { + return visu_; + } + + public void setVisu_(LayerWidget visu_) { + this.visu_ = visu_; + } + + @Override + protected void attachEdgeSourceAnchor(Object edge, Object oldSourceNode, + Object sourceNode) { + // TODO Auto-generated method stub + + } + + @Override + protected void attachEdgeTargetAnchor(Object edge, Object oldTargetNode, + Object targetNode) { + // TODO Auto-generated method stub + + } + + @Override + protected Widget attachEdgeWidget(Object edge) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Widget attachNodeWidget(Object node) { + // TODO Auto-generated method stub + return null; + } + + /** + * methode qui permet d'ajouter une widget dans la vue principale + */ + public void addWidget(EbliWidget widget){ + + addWidget(widget, null,null); + + } + + public void addWidget(EbliWidget widget,Point preferredLocation, Dimension preferedSize){ + + if(preferedSize!=null){ + widget.setPreferredSize(preferedSize); + } + if(preferredLocation !=null){ + widget.setPreferredLocation(preferredLocation); + } + + getVisu_().addChild(widget); + + + } + + + /** + * recupere une version miniature de la vue aui se rafraichit simultanement avec la scene + * @return + */ + public JComponent getSatteliteView(){ + return this.createSatelliteView(); + } + + /** + * retourne la vue Jcomponent associ\xE9 + * Utile pour l'integration dans les components existants + */ + public JComponent getSwingView(){ + return this.getView(); + } + + 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 + EbliGraphScene.this.removeChildren(); + //fermeture du widget donne + EbliGraphScene.this.removeFromParent(); + + } + + }); + return popup; + } + })); + } + + + } Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliGraphScene.java ___________________________________________________________________ Added: svn:mime-type + text/plain 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-05 15:13:59 UTC (rev 3713) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -1,7 +1,19 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Color; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.PopupMenuProvider; +import org.netbeans.api.visual.border.Border; +import org.netbeans.api.visual.border.BorderFactory; import org.netbeans.api.visual.laf.LookFeel; +import org.netbeans.api.visual.layout.LayoutFactory; import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; @@ -14,22 +26,91 @@ */ class EbliWidget extends Widget { + + private static final Border RESIZE_BORDER = BorderFactory.createResizeBorder(8,Color.blue.brighter().brighter(),true); + private static final Border DEFAULT_BORDER =BorderFactory.createEmptyBorder(8); /** * @param scene + * @param Point : indiaue la location preferentiel. peut etre nul */ - public EbliWidget(Scene scene) { + public EbliWidget(Scene scene, Point preferredLocation) { super(scene); getActions().addAction( ActionFactory.createResizeAction()); getActions().addAction(ActionFactory.createMoveAction()); getActions().addAction(scene.createWidgetHoverAction());//a voir pour que le parent soit //aussi en hover : a voir apr\xE8s. + setBorder(getScene().getLookFeel().getMiniBorder(ObjectState.createNormal())); + + // positionnement de la widget si precise + if(preferredLocation!=null) + setPreferredLocation(preferredLocation); + + //menu clic droit basique (fermeture, duplication) + setMenuBase(); } @Override public void notifyStateChanged(ObjectState previousState, ObjectState newState) { LookFeel lookFeel = getScene().getLookFeel(); - setBorder(lookFeel.getMiniBorder(newState)); + + // setBorder(lookFeel.getMiniBorder(newState)); + + + setBorder( newState.isSelected() ? ( + newState.isHovered() ? RESIZE_BORDER : DEFAULT_BORDER) : ( + newState.isHovered() ? RESIZE_BORDER : DEFAULT_BORDER)); } + + /** + * 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 setMenuBase() { + getActions ().addAction (ActionFactory.createPopupMenuAction (new PopupMenuProvider() { + public JPopupMenu getPopupMenu (Widget widget, Point localLocation) { + JPopupMenu popup = new JPopupMenu (); + + JMenuItem menuItem1=popup.add ("Dupliquer l'objet"); + menuItem1.addActionListener(new ActionListener(){ + + 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)); + + EbliWidget duplique; + + try { + //clonage de l'objet + duplique=(EbliWidget)EbliWidget.this.clone(); + duplique.setPreferredSize(EbliWidget.this.getScene().getPreferredSize()); + + } catch (CloneNotSupportedException e1) { + // TODO que fqire si cq pete? une peite fenetre d'erreur, widget pas duplicable? ou alors surcharger la methode dans les filles? + e1.printStackTrace(); + } + } + + }); + JMenuItem menuItem2=popup.add ("Fermer l'objet"); + menuItem2.addActionListener(new ActionListener(){ + + public void actionPerformed(ActionEvent e) { + + //fermeture des widgets children + EbliWidget.this.removeChildren(); + //fermeture du widget donne + EbliWidget.this.removeFromParent(); + + } + + }); + return popup; + } + })); + } + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -0,0 +1,104 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Point; +import java.awt.Rectangle; + +import org.fudaa.ebli.courbe.EGAxe; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheModelListener; +import org.fudaa.ebli.courbe.EGObject; +import org.netbeans.api.visual.laf.LookFeel; +import org.netbeans.api.visual.model.ObjectState; +import org.netbeans.api.visual.widget.Scene; + + +/** + * widget aui contient un objet courbe + * @author adrien hadoux + * + */ +public class GrapheWidget extends EbliWidget{ + + private EGGraphe graphe; + + public EGGraphe getGraphe() { + return graphe; + } + + public void setGraphe(EGGraphe graphe) { + this.graphe = graphe; + } + + public GrapheWidget(Scene scene, Point preferredLocation, EGGraphe _graphe) { + super(scene, preferredLocation); + // TODO Auto-generated constructor stub + setGraphe(_graphe); + + + //prise en compte du listener d'\xE9coute des modif du graphe + listenGraphe(); + + } + + 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)); + + } + + protected void paintWidget() { + Rectangle rec = getClientArea(); + + // BufferedImage image = courbe.produceImage( + // rec.width - 1, rec.height - 1, + // Collections.EMPTY_MAP); + getGraphics().translate(rec.x, rec.y); + graphe.setSize(rec.width - 1, + rec.height - 1); + graphe.computeMarges(getGraphics()); + graphe.dessine(getGraphics(), rec.width - 1, + rec.height - 1, false ); + } + + /** + * methode aui permet d ajouter les fonctions de redessin du graphe + */ + private void listenGraphe(){ + graphe.getModel().addModelListener(new EGGrapheModelListener() { + + public void structureChanged() { + repaint(); + + } + + public void courbeContentChanged(EGObject _c, boolean restore) { + repaint(); + + } + + public void courbeAspectChanged(EGObject _c, boolean _visibil) { + //graphe.paint(); + repaint(); + // TODO Auto-generated method stub + + } + + public void axeContentChanged(EGAxe _c) { + repaint(); + + } + + public void axeAspectChanged(EGAxe _c) { + repaint(); + + } + }); + } +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/GrapheWidget.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java 2008-08-05 15:13:59 UTC (rev 3713) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/LineWidget.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -2,6 +2,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.Rectangle; import org.fudaa.ebli.courbe.EGCourbe; @@ -24,8 +25,8 @@ /** * @param _scene */ - public LineWidget(Scene _scene, EGCourbe _cb) { - super(_scene); + public LineWidget(Scene _scene, EGCourbe _cb, Point preferedLocation) { + super(_scene,preferedLocation); cb_ = _cb; setMinimumSize(new Dimension(30, 10)); setPreferredSize(new Dimension(40, 10)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java 2008-08-05 15:13:59 UTC (rev 3713) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/TitleWidget.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -1,5 +1,7 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Point; + import org.fudaa.ebli.courbe.EGCourbe; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; import org.netbeans.api.visual.widget.LabelWidget; @@ -22,8 +24,8 @@ /** * @param _scene */ - public TitleWidget(Scene _scene, EGCourbe _cb) { - super(_scene); + public TitleWidget(Scene _scene, EGCourbe _cb,Point preferedLocation) { + super(_scene,preferedLocation); setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 0)); intern = new LabelWidget(_scene); intern.setForeground(_cb.getAspectContour()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java 2008-08-05 15:13:59 UTC (rev 3713) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/WidgetLegendeManager.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -6,10 +6,15 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import javax.swing.JFrame; +import javax.swing.JMenuItem; import javax.swing.JPanel; +import javax.swing.JPopupMenu; import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; import org.fudaa.ebli.courbe.EGAxe; @@ -28,6 +33,7 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.netbeans.api.visual.action.ActionFactory; +import org.netbeans.api.visual.action.PopupMenuProvider; import org.netbeans.api.visual.graph.GraphScene; import org.netbeans.api.visual.laf.LookFeel; import org.netbeans.api.visual.layout.LayoutFactory.SerialAlignment; @@ -39,7 +45,7 @@ import org.netbeans.modules.visual.layout.FlowLayout; /** - * @author denf01a adrien hadous + * @author denf01a adrien hadoux * @creation 5 ao\xFBt 2008 * @version * @@ -48,20 +54,26 @@ - //exemple a ameliorer - public static EbliWidget createLegende(EGGraphe g, Scene scene) { + /** + * Creation de la legende + * @param g + * @param scene + * @param PreferredLocation peut etre null + * @return + */ + public static EbliWidget createLegende(EGGraphe g, Scene scene, Point PreferredLocation) { EGCourbe[] cs = g.getModel().getCourbes(); - EbliWidget res = new EbliWidget(scene); + final EbliWidget res = new EbliWidget(scene,PreferredLocation); res.setLayout(new FlowLayout(true, SerialAlignment.LEFT_TOP, 10));// a modifier pour setter le gap for (int i = 0; i < cs.length; i++) { - final EbliWidget line = new EbliWidget(scene); + final EbliWidget line = new EbliWidget(scene,PreferredLocation); line.setLayout(new FlowLayout(false, SerialAlignment.CENTER, 5)); //creation de la widget titre - final TitleWidget tw=new TitleWidget(scene, cs[i]); + final TitleWidget tw=new TitleWidget(scene, cs[i],null); //creation de la widget ligne - LineWidget lw=new LineWidget(scene, cs[i]); + LineWidget lw=new LineWidget(scene, cs[i],null); line.addChild(lw); line.addChild(tw); @@ -100,6 +112,8 @@ }); } + + return res; } 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-05 15:13:59 UTC (rev 3713) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-05 15:42:58 UTC (rev 3714) @@ -11,6 +11,7 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; @@ -43,11 +44,14 @@ import org.fudaa.ebli.courbe.EGObject; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.EbliGraphScene; +import org.fudaa.ebli.visuallibrary.GrapheWidget; import org.fudaa.ebli.visuallibrary.WidgetLegendeManager; import org.fudaa.ebli.visuallibrary.WidgetLegendeManagerOLD; 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.layout.LayoutFactory; import org.netbeans.api.visual.model.ObjectState; import org.netbeans.api.visual.widget.ImageWidget; import org.netbeans.api.visual.widget.LabelWidget; @@ -154,240 +158,41 @@ p.doLayout(); f.setContentPane(p); final EGFillePanel pn = new EGFillePanel(g); - final GraphScene scene = new GraphScene() { - LayerWidget visu; + + + // creation de la scene EBLI + EbliGraphScene scene = new EbliGraphScene(); - { - visu = new LayerWidget(this); - addChild(visu); - } - - @Override - protected Widget attachNodeWidget(Object arg0) { - final EGGraphe courbe = (EGGraphe) arg0; - final Widget graphe = new Widget(this) { - 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)); - - } - - @Override - protected void paintWidget() { - Rectangle rec = getClientArea(); - - // BufferedImage image = courbe.produceImage( - // rec.width - 1, rec.height - 1, - // Collections.EMPTY_MAP); - getGraphics().translate(rec.x, rec.y); - courbe.setSize(rec.width - 1, - rec.height - 1); - courbe.computeMarges(getGraphics()); - courbe.dessine(getGraphics(), rec.width - 1, - rec.height - 1, false ); - } - // } - }; - courbe.getModel().addModelListener(new EGGrapheModelListener() { - - public void structureChanged() { - repaint(); - - } - - public void courbeContentChanged(EGObject _c, boolean restore) { - repaint(); - - } - - public void courbeAspectChanged(EGObject _c, boolean _visibil) { - graphe.paint(); - paint(); - // TODO Auto-generated method stub - - } - - public void axeContentChanged(EGAxe _c) { - repaint(); - - } - - public void axeAspectChanged(EGAxe _c) { - repaint(); - - } - }); - graphe.setPreferredSize(new Dimension(100, 100)); - visu.addChild(graphe); - - -// //creation d un label widget -// LabelWidget labelWidget=new LabelWidget(this, "test") { -// public void notifyStateChanged(ObjectState previousState, -// ObjectState newState) { -// LookFeel lookFeel = getScene().getLookFeel(); -// // setBorder(lookFeel.getBorder(newState)); -// // setForeground(lookFeel.getForeground(newState)); -// -// setBorder(lookFeel.getBorder(newState)); -// // recuperation du rectangle contour -// Rectangle rec = getClientArea(); -// //setFont(new Font("Times New Roman", Font.PLAIN,rec.width )); -// repaint(); -// -// // setBorder(newState.isSelected() ? -// // (DEFAULT_SELECTED_BORDER) : -// // (newState.isHovered() ? RESIZE_BORDER -// // : DEFAULT_BORDER)); -// -// } -// -// -// -// -// -// -// -// }; -// -// -// //marche pas il faut un container jscrollpane -// //graphe.getActions().addAction(ActionFactory.createCenteredZoomAction (500)); -// -// -// labelWidget.getActions().addAction(ActionFactory.createResizeAction()); -// labelWidget.getActions().addAction(ActionFactory.createMoveAction()); -// labelWidget.getActions().addAction(this.createWidgetHoverAction()); -// //zoom de la scene en maintenant ctrl + molette -// labelWidget.getActions().addAction(ActionFactory.createZoomAction()); -// -// -// // -// labelWidget.getActions().addAction(ActionFactory.createPanAction()); -// -// //-- ajout du labelWidget dans le visuel --// -// visu.addChild(labelWidget); -// -// -// //creation d un image widget - ImageWidget imageWidget=new ImageWidget (this,CtuluResource.CTULU.getImage("crystal_oui")){ - 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=10; - if(heightCadre==0) - heightCadre=10; - - - g.fillRect(rec.x, rec.y,widthCadre - 1, heightCadre - 1); - //courbe.setSize(rec.width - 1,rec.height - 1); - //courbe.computeMarges(getGraphics()); - //courbe.dessine(getGraphics(), rec.width - 1,rec.height - 1, false ); - - - } - - }; - - - //WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, graphe.getClientArea()); - - visu.addChild (WidgetLegendeManager.createLegende(courbe, this)); - - //ajout des resize et drag - imageWidget.getActions().addAction( ActionFactory.createResizeAction()); - imageWidget.getActions().addAction(ActionFactory.createMoveAction()); - imageWidget.getActions().addAction(this.createWidgetHoverAction()); - //ajout du label widget - visu.addChild (imageWidget); - - - //test avec iconwidget - IconNodeWidget iconNode = new IconNodeWidget (this); - iconNode.setImage (CtuluResource.CTULU.getImage("crystal_non")); - iconNode.setLabel ("MyIconNode"); - this.addChild (iconNode); - this.getActions ().addAction (ActionFactory.createCenteredZoomAction (1.1)); - this.getActions ().addAction (ActionFactory.createPanAction ()); - // assign HoverAction - the actual hovered widget is held by the scene - iconNode.getActions ().addAction (this.createWidgetHoverAction ()); - // MoveAction has to be after the hover action - // otherwise MoveAction will always consume the event and HoverAction will never be invoked - iconNode.getActions ().addAction (ActionFactory.createMoveAction ()); - - - // proprietes graphes - graphe.getActions().addAction( - ActionFactory.createResizeAction()); - graphe.getActions().addAction(ActionFactory.createMoveAction()); - graphe.getActions().addAction(this.createWidgetHoverAction()); - return graphe; - } - - @Override - protected Widget attachEdgeWidget(Object arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected void attachEdgeTargetAnchor(Object arg0, Object arg1, - Object arg2) { - // TODO Auto-generated method stub - - } - - @Override - protected void attachEdgeSourceAnchor(Object arg0, Object arg1, - Object arg2) { - // TODO Auto-generated method stub - - } - }; - + + + //ajout graphe + GrapheWidget graphe=new GrapheWidget(scene,null,g); + graphe.setPreferredSize(new Dimension(300, 300)); + scene.addChild(graphe); + + //WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, graphe.getClientArea()); + scene.addChild (WidgetLegendeManager.createLegende(g, scene,null)); - // debut - // scene.addNode(g); - scene.addNode(g); + //ajout iconenode + IconNodeWidget iconNode = new IconNodeWidget (scene); + iconNode.setImage (CtuluResource.CTULU.getImage("crystal_non")); + iconNode.setLabel ("MyIconNode"); +// this.addChild (iconNode); + iconNode.getActions ().addAction (ActionFactory.createCenteredZoomAction (1.1)); + iconNode.getActions ().addAction (ActionFactory.createPanAction ()); + // assign HoverAction - the actual hovered widget is held by the scene + iconNode.getActions ().addAction (scene.createWidgetHoverAction ()); + // MoveAction has to be after the hover action + // otherwise MoveAction will always consume the event and HoverAction will never be invoked + iconNode.getActions ().addAction (ActionFactory.createMoveAction ()); + iconNode.setPreferredLocation(new Point(400,150)); + scene.addChild(iconNode); + + //scene.addNode(new Object()); // fin p.add(new JScrollPane(scene.createView()), BuBorderLayout.CENTER); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-06 17:24:29
|
Revision: 3717 http://fudaa.svn.sourceforge.net/fudaa/?rev=3717&view=rev Author: hadouxad Date: 2008-08-06 17:24:35 +0000 (Wed, 06 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 -commit de lq visual library remani?\195?\169e - ajout de la classe rectangle Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.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/EbliWidgetCreatorRectangle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.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-06 15:03:18 UTC (rev 3716) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-06 17:24:35 UTC (rev 3717) @@ -51,7 +51,7 @@ getActions().addAction( ActionFactory.createResizeAction()); getActions().addAction(ActionFactory.createMoveAction()); getActions().addAction(scene.createWidgetHoverAction()); - getActions().addAction( scene.createSelectAction()); + //getActions().addAction( scene.createSelectAction()); setBorder(getScene().getLookFeel().getMiniBorder(ObjectState.createNormal())); @@ -137,6 +137,8 @@ public void actionPerformed(ActionEvent e) { EbliWidget.this.setVisible(false); + EbliNode n=(EbliNode)EbliWidget.this.getScene_().findObject(EbliWidget.this); + EbliWidget.this.getScene_().removeNode(n); // NE PAS DECOCHER CES ELEMENTS //fermeture des widgets children Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java 2008-08-06 17:24:35 UTC (rev 3717) @@ -0,0 +1,29 @@ +package org.fudaa.ebli.visuallibrary; + +import org.fudaa.ebli.courbe.EGGraphe; + + +public class EbliWidgetCreatorRectangle implements EbliWidgetCreator { + + String label_; + + 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) { + EbliWidgetRectangle res= new EbliWidgetRectangle(_scene, getG()); + + return res; + } + +} Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorRectangle.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java 2008-08-06 15:03:18 UTC (rev 3716) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetGraphe.java 2008-08-06 17:24:35 UTC (rev 3717) @@ -115,7 +115,7 @@ //getScene_().addChild(new EbliWidget(getScene_(),null)); //addChild (WidgetLegendeManager.createLegende(GrapheWidget.this.getGraphe(), GrapheWidget.this.getScene_(),null)); - if(nodeLegende==null){ + if(!EbliWidgetGraphe.this.getScene_().isObject(nodeLegende)){ //-- creation d'un node legende --// nodeLegende = new EbliNodeDefault(); Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-06 17:24:35 UTC (rev 3717) @@ -0,0 +1,100 @@ +package org.fudaa.ebli.visuallibrary; + + +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; +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.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; + + + +/** + * Legende + * Widget qui permet de construire des rectangles avec du texte + * @author Adrien Hadoux + * + */ +public class EbliWidgetRectangle extends EbliWidget implements TextFieldInplaceEditor{ + + + + LabelWidget intern; + + /** + * @param _scene + */ + public EbliWidgetRectangle(EbliScene _scene, String label) { + super(_scene); + setLayout(new FlowLayout(true, SerialAlignment.CENTER, 23)); + intern = new LabelWidget(_scene); + intern.setLabel(label); + + 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); + } + + + protected void paintWidget() { + Graphics2D g = getGraphics(); + Rectangle rec = getClientArea(); + g.translate(rec.x, rec.y); + //la ligne + + TraceLigne l = new TraceLigne(); + l.setEpaisseur(5); + //l.dessineTrait(g, 0, 0, rec.width, rec.height / 2); + l.dessineRectangle(g, 0, 0, rec.width, rec.height); + 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); + + } + + + + +} \ No newline at end of file Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: 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-06 15:03:18 UTC (rev 3716) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTitle.java 2008-08-06 17:24:35 UTC (rev 3717) @@ -45,7 +45,7 @@ //-- ajout de l action au label correspondant --// intern.getActions ().addAction (editorAction); - setEnabled(false); + //setEnabled(false); } public void majLabel(){ 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-06 15:03:18 UTC (rev 3716) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-06 17:24:35 UTC (rev 3717) @@ -51,6 +51,7 @@ import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorLegende; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangle; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorVue2d; import org.fudaa.ebli.visuallibrary.EbliWidgetGraphe; import org.fudaa.ebli.visuallibrary.WidgetLegendeManager; @@ -201,6 +202,16 @@ // scene.addNode(node); //scene.addChild(new ComponentWidget(scene, test.getVisuPanel().getVueCalque())); + + + //-- ajout du rectangle --// + node = new EbliNodeDefault(); + node.setCreator(new EbliWidgetCreatorRectangle("Test recangle")); + node.setD(new Dimension(100, 100)); + node.setP(new Point(350,125)); + scene.addNode(node); + + // WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, // graphe.getClientArea()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-07 16:50:51
|
Revision: 3732 http://fudaa.svn.sourceforge.net/fudaa/?rev=3732&view=rev Author: hadouxad Date: 2008-08-07 16:50:58 +0000 (Thu, 07 Aug 2008) Log Message: ----------- AFFECT?\195?\137 - # 40: L?\195?\169gende pour les courbe 1d http://mantis.genesis-groupe.com//view.php?id=40 - ajout du renderermodel checkbox du tree - ajout du renderer editeur du tree - fonctionnalite de masquage affichage des widget fonctionne - fonction de masquage clic droit surla widget fonctionne aussi avec le jtree FIXME: il faut trouver une astuce pour faire un revalidate/repaint de la scene car sinon il faut mettre le curseur dessus pour voir les maj Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.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/test/org/fudaa/ebli/all/TestGraphe2.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java 2008-08-07 16:50:58 UTC (rev 3732) @@ -0,0 +1,102 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.util.EventObject; + +import javax.swing.AbstractCellEditor; +import javax.swing.JCheckBox; +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 com.memoire.bu.BuCheckBox; +/** + * Editeur dans le tree + * @author Adrien Hadoux + * + */ +public class EbliCheckBoxNodeEditor extends AbstractCellEditor implements TreeCellEditor { + + EbliCheckBoxTreeRenderer renderer = new EbliCheckBoxTreeRenderer(); + + ChangeEvent changeEvent = null; + + EbliWidgetJXTree tree; + + public EbliCheckBoxNodeEditor(EbliWidgetJXTree tree) { + this.tree = tree; + } + + public Object getCellEditorValue() { + JCheckBox checkbox = renderer.getLeafRenderer(); + // 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 JCheckBox) { + 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 + ((JCheckBox) editor).addActionListener( new ActionListener() { + public void actionPerformed(ActionEvent event) { + + //-- on rend visible la widget en fonction de la checkbox + node.getCreator().getWidget().setVisible(((JCheckBox) editor).isSelected()); + + + } + }); + + } + + + + + + return editor; + } + } Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxNodeEditor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java 2008-08-07 16:50:58 UTC (rev 3732) @@ -0,0 +1,98 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; + +import javax.swing.JCheckBox; +import javax.swing.JTree; +import javax.swing.UIManager; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeCellRenderer; + +import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; + +public class EbliCheckBoxTreeRenderer implements TreeCellRenderer { + private JCheckBox leafRenderer = new JCheckBox(); + + private DefaultTreeCellRenderer nonLeafRenderer = new DefaultTreeCellRenderer(); + + Color selectionBorderColor, selectionForeground, selectionBackground, + textForeground, textBackground; + + protected JCheckBox getLeafRenderer() { + return leafRenderer; + } + + public EbliCheckBoxTreeRenderer() { + /*Font fontValue; + fontValue = UIManager.getFont("Tree.font"); + if (fontValue != null) { + leafRenderer.setFont(fontValue); + } + Boolean booleanValue = (Boolean) UIManager + .get("Tree.drawsFocusBorderAroundIcon"); + leafRenderer.setFocusPainted((booleanValue != null) + && (booleanValue.booleanValue())); + + selectionBorderColor = UIManager.getColor("Tree.selectionBorderColor"); + selectionForeground = UIManager.getColor("Tree.selectionForeground"); + selectionBackground = UIManager.getColor("Tree.selectionBackground"); + textForeground = UIManager.getColor("Tree.textForeground"); + textBackground = UIManager.getColor("Tree.textBackground"); + */} + + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean selected, boolean expanded, boolean leaf, int row, + boolean hasFocus) { + + Component returnValue; + if (leaf) { + + + //-- recuperation du node --// + Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); + + + EbliNodeDefault node=null; + if (userObject instanceof EbliNode) { + node= (EbliNodeDefault)(((DefaultMutableTreeNode)value).getUserObject()); + + System.err.println("PS EbliNode!!! ROW: "+row); + + //-- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque composant + leafRenderer=new JCheckBox(); + + leafRenderer.setText(node.getTitle()); + leafRenderer.setSelected(node.getCreator().getWidget().isVisible()); + } + else{ + System.err.println("TROP NULLLLLLLLLLLLLLLLLLL!!!"); + } + // qccessible en fonction du tree + leafRenderer.setEnabled(tree.isEnabled()); + + /* // foreground si selectionne ou non + if (leafRenderer.isSelected()) { + leafRenderer.setForeground(selectionForeground); + leafRenderer.setBackground(selectionBackground); + } else { + leafRenderer.setForeground(textForeground); + leafRenderer.setBackground(textBackground); + } +*/ + + + + returnValue = leafRenderer; + + } else { + returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, + value, selected, expanded, leaf, row, hasFocus); + } + return returnValue; + } + + + } Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliCheckBoxTreeRenderer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-07 14:48:20 UTC (rev 3731) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-07 16:50:58 UTC (rev 3732) @@ -16,5 +16,6 @@ Point getLocation(); public String toString(); + } 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-07 14:48:20 UTC (rev 3731) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-07 16:50:58 UTC (rev 3732) @@ -11,6 +11,8 @@ Point p; Dimension d; String title; + + public String getTitle() { return title; } @@ -60,4 +62,7 @@ return title; } + + + } 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-07 14:48:20 UTC (rev 3731) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-07 16:50:58 UTC (rev 3732) @@ -151,17 +151,26 @@ public void actionPerformed(ActionEvent e) { - EbliWidget.this.setVisible(false); + //EbliWidget.this.setVisible(false); EbliNode n = (EbliNode) EbliWidget.this.getScene_().findObject( EbliWidget.this); EbliWidget.this.getScene_().removeNode(n); + EbliWidget.this.getScene_().getVisu_().removeChild(EbliWidget.this); + - // NE PAS DECOCHER CES ELEMENTS - // fermeture des widgets children - // EbliWidget.this.removeChildren(); - // fermeture du widget donne - // EbliWidget.this.removeFromParent(); + } + }); + + JMenuItem menuItem3 = _popup.add("Masquer l'objet"); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem3.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + EbliWidget.this.setVisible(false); + + } }); 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-07 14:48:20 UTC (rev 3731) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-07 16:50:58 UTC (rev 3732) @@ -49,6 +49,8 @@ import org.fudaa.ebli.tableau.EbliGrapheValeur; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.EbliCheckBoxNodeEditor; +import org.fudaa.ebli.visuallibrary.EbliCheckBoxTreeRenderer; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorDblFleche; @@ -199,7 +201,10 @@ //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); p.add(tree,BuBorderLayout.WEST); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-08-08 15:53:17
|
Revision: 3743 http://fudaa.svn.sourceforge.net/fudaa/?rev=3743&view=rev Author: hadouxad Date: 2008-08-08 15:53:20 +0000 (Fri, 08 Aug 2008) Log Message: ----------- - changement des noms de variables et ajout de fonctions pour EbliNode - ajout de la classe EbliWidgetActionAlign dans org.fudaa.ebli.visuallibrary.actions qui permet de faire des align: - a gauche - a droite - en haut - en bas - centr?\195?\169 horizontal - centr?\195?\169 vertical (on pourra donc combiner pour faire des trucs exotiques: en diagonale bas...) Exemple: pour centrer dans les 2 directions, on combine centre horizontal et centre vertical - gestion du listener d ecoute du tree en cas de suppression de widget: - Fonction de suppression de la widget par clic droit ( on pourra rajouter un key event du style touche suppr...) - fais appel a removeNode() de GraphScene ( non surcharg?\195?\169) mais qui fait appel a detachNodeWidget (node, widget) ( celle la surcharg?\195?\169e) qui fait un notify aux listener de la scene pour indiquer que le noeud a ?\195?\169t?\195?\169 supprim?\195?\169 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.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/graphe/EbliWidgetGraphe.java 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/EbliWidgetJXTreeModel.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/ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -9,13 +9,29 @@ EbliWidgetCreator getCreator(); - Dimension getPreferedDimension(); + void setPreferedSize(Dimension d); + + + Dimension getPreferedSize(); EbliNode duplicate(Map options); - Point getLocation(); + void setPreferedLocation(Point p); + Point getPreferedLocation(); + public String toString(); + /** + * Methode qui verifie que le node a une widget + * @return + */ + public boolean hasWidget(); + /** + * Methode qui verifie que le node est movable + * @return + */ + public boolean isMovable(); + } 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-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -33,15 +33,15 @@ public void setPreferedLocation(Point p) { this.preferedLocation = p; // repositionnement du widget si existant - if(getCreator()!=null && getCreator().getWidget()!=null) + if(hasWidget()) getCreator().getWidget().setPreferredLocation(p); } - public void setPreferedDimension(Dimension d) { + public void setPreferedSize(Dimension d) { this.preferedSize = d; // repositionnement du widget si existant - if(getCreator()!=null && getCreator().getWidget()!=null) + if(hasWidget()) getCreator().getWidget().setPreferredSize(d); } @@ -55,12 +55,14 @@ return creator; } - public Point getLocation() { + public Point getPreferedLocation() { + return preferedLocation; } - public Dimension getPreferedDimension() { + public Dimension getPreferedSize() { // TODO Auto-generated method stub + return preferedSize; } @@ -71,5 +73,19 @@ + 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/EbliScene.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -30,7 +30,15 @@ */ private LayerWidget visu_; - private LayerWidget interactionLayer_; + public LayerWidget getVisu_() { + return visu_; +} + +public void setVisu_(LayerWidget visu_) { + this.visu_ = visu_; +} + +private LayerWidget interactionLayer_; final private WidgetAction alignWithMoveAction; /** @@ -95,15 +103,37 @@ EbliWidget res = node.getCreator().create(this); // -- remplissage des proprietes - res.setPreferredLocation(node.getLocation()); - if (node.getPreferedDimension() != null) - res.setPreferredSize(node.getPreferedDimension()); + res.setPreferredLocation(node.getPreferedLocation()); + if (node.getPreferedSize() != null) + res.setPreferredSize(node.getPreferedSize()); // -- ajout dans la vue layer --// visu_.addChild(res); return res; } + + + /** + * 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 + */ + protected void detachNodeWidget (EbliNode node, Widget widget) { + //-- indique la suppresion du node chez le parent + notifyAllListenerNodeRemoved(node); + + if (widget != null) + widget.removeFromParent (); + + + } + + + public LayerWidget getLayerVisu() { return visu_; @@ -190,4 +220,15 @@ })); } + + /** + * Methode qui permet de raffraichir les elements de la scene + */ + public void refresh(){ + revalidate(); + this.repaint(); + getView().repaint(); + + } + } 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-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -96,17 +96,17 @@ public void actionPerformed(ActionEvent e) { - // EbliWidget.this.setVisible(false); + EbliNode n = (EbliNode) EbliWidget.this.getEbliScene().findObject(EbliWidget.this); EbliWidget.this.getEbliScene().removeNode(n); - EbliWidget.this.getEbliScene().getLayerVisu().removeChild(EbliWidget.this); + } }); JMenuItem menuItem3 = _popup.add("Masquer l'objet"); - menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal_non")); + menuItem3.setIcon(CtuluResource.CTULU.getIcon("crystal22_visibilite")); menuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Added: 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 (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -0,0 +1,149 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.beans.PropertyChangeListener; +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.EbliNodeDefault; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; + +/** + * Action qui permet de realiser l alignement des composants. + * + * + *ATTTENTION CHOIX DE CONCEPTION: + *il faut que les EbliNode soit movables (isMovable()== true) + * pour pouvoir les aligner + * il faut donc lorss de la creation des nodes remplir les infos dimensions et size comme suit: + * + * EbliNodeDefault node = new EbliNodeDefault(); + * node.setCreator(new EbliWidgetCreatorGraphe(g)); + * node.setTitle("Graphe"); + * node.setPreferedSize(new Dimension(300, 300)); + * node.setPreferedLocation(new Point(4, 4)); + * scene.addNode(node); + * + *@author Adrien Hadoux + * + */ +public class EbliWidgetActionAlign extends AbstractAction { + + /** + * + */ + 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_; + + //liste des positions precedentes pour chaque widgets + List<Point> listPreviousPositions_; + + + public EbliWidgetActionAlign(EbliScene _scene, int _typeAlignement) { + super(); + // TODO Auto-generated constructor stub + scene_=_scene; + typeAlignement_=_typeAlignement; + //-- renseignements des infos complementaires --// + putValue(NAME,"Alignement "+traduct(_typeAlignement)); + + + } + + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + alignComponents(); + } + + /** + * methode qui recalcule la nouvelle position par rapport a la scene et a l alignement choisiT. + */ + private Point calculeNewLocation(Point _previousLocation,Dimension _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; + } + + + } + + + 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(){ + + //-- reinitialisation de la liste des historique des positions --// + listPreviousPositions_=new ArrayList<Point>(); + + //-- recuperation de la liste des widgets selectionnees --// + //FIXME comment recuperer les nodes uniquements selectionnes? la je recupere tout... + 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()){ + //-- enregistrement de la previous position --// + listPreviousPositions_.add(currentNode.getPreferedLocation()); + + //-- calcul de la nouvelle position du node en fonction de l alignement choisi --// + Point newLocation=calculeNewLocation(currentNode.getPreferedLocation(), currentNode.getCreator().getWidget().getPreferredSize(),scene_.getView().getSize()); + + //-- tentative de modification de la position du node --// + currentNode.setPreferedLocation(newLocation); + + currentNode.getCreator().getWidget().revalidate(); + currentNode.getCreator().getWidget().repaint(); + } + + } + //-- 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-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -116,8 +116,8 @@ nodeLegende = new EbliNodeDefault(); nodeLegende.setCreator(new EbliWidgetCreatorLegende(getGraphe())); - nodeLegende.setP(nouvellePosition); - nodeLegende.setD(new Dimension(100, 100)); + nodeLegende.setPreferedLocation(nouvellePosition); + nodeLegende.setPreferedSize(new Dimension(100, 100)); EbliWidgetGraphe.this.getEbliScene().addNode(nodeLegende); //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe.this.getGraphe(), EbliWidgetGraphe.this.getScene_(),nouvellePosition); Modified: 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-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -86,7 +86,7 @@ // -- on rend visible la widget en fonction de la checkbox node.getCreator().getWidget().setVisible(((JCheckBox) editor).isSelected()); - node.getCreator().getWidget().getEbliScene().getView().repaint(); + node.getCreator().getWidget().getEbliScene().refresh(); } }); Modified: 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-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetJXTreeModel.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -13,6 +13,7 @@ import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeListener; +import org.fudaa.ebli.visuallibrary.EbliScene; /** @@ -104,9 +105,27 @@ } -public void noderemoved(EbliNode 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/test/org/fudaa/ebli/all/TestGraphe2.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-08 15:20:32 UTC (rev 3742) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-08 15:53:20 UTC (rev 3743) @@ -7,16 +7,19 @@ */ package org.fudaa.ebli.all; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Point; import javax.swing.Box; +import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.JToolBar; import javax.swing.JTree; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; @@ -44,6 +47,7 @@ import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorFleche; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorRectangle; import org.fudaa.ebli.visuallibrary.EbliWidgetDBLFleche; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; @@ -161,24 +165,22 @@ tree.setCellEditor(new EbliCheckBoxNodeEditor(tree)); tree.setEditable(true); - // ajout graphe - // GrapheWidget graphe=new GrapheWidget(scene,null,g); - // graphe.setPreferredSize(new Dimension(300, 300)); - // scene.addWidget(graphe); - + // -- creation d un noeud Graphe --// EbliNodeDefault node = new EbliNodeDefault(); node.setCreator(new EbliWidgetCreatorGraphe(g)); node.setTitle("Graphe"); - node.setD(new Dimension(300, 300)); - node.setP(new Point(4, 4)); + node.setPreferedSize(new Dimension(200, 250)); + node.setPreferedLocation(new Point(12, 420)); scene.addNode(node); + // -- creation d un noeud legende --// EbliNodeDefault nodeLegende = new EbliNodeDefault(); nodeLegende.setTitle("Legende"); nodeLegende.setCreator(new EbliWidgetCreatorLegende(g)); - nodeLegende.setD(new Dimension(100, 100)); + nodeLegende.setPreferedSize(new Dimension(100, 100)); + nodeLegende.setPreferedLocation(new Point(4, 270)); scene.addNode(nodeLegende); // -- creation de la vue calque @@ -189,6 +191,8 @@ 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)); // JFrame fr = new JFrame(); ZEbliCalquesPanel ebliCalquesPanel = new ZEbliCalquesPanel(br, new CtuluUIDefault()); @@ -205,34 +209,39 @@ EbliNodeDefault nodeRect = new EbliNodeDefault(); nodeRect.setTitle("Rectangle"); nodeRect.setCreator(new EbliWidgetCreatorRectangle("Test recangle")); - // nodeRect.setD(new Dimension(100, 100)); - nodeRect.setP(new Point(350, 125)); + nodeRect.setPreferedSize(new Dimension(200, 100)); + nodeRect.setPreferedLocation(new Point(350, 125)); scene.addNode(nodeRect); // -- ajout du fleche double sens diagonale--// node = new EbliNodeDefault(); node.setTitle("Fleche Double"); node.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_DIAG1)); - node.setD(new Dimension(100, 100)); - node.setP(new Point(450, 125)); + node.setPreferedSize(new Dimension(100, 100)); + node.setPreferedLocation(new Point(450, 125)); scene.addNode(node); // -- ajout du fleche double sens nord--// node = new EbliNodeDefault(); node.setTitle("Fleche Double"); node.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_WEST)); - node.setD(new Dimension(100, 100)); - node.setP(new Point(450, 125)); + node.setPreferedSize(new Dimension(100, 100)); + node.setPreferedLocation(new Point(450, 125)); scene.addNode(node); // -- ajout du fleche sens unique--// node = new EbliNodeDefault(); node.setTitle("Fleche"); node.setCreator(new EbliWidgetCreatorFleche(0)); - node.setD(new Dimension(100, 100)); - node.setP(new Point(250, 525)); + node.setPreferedSize(new Dimension(100, 100)); + node.setPreferedLocation(new Point(250, 525)); scene.addNode(node); + + //if(node.getCreator().getWidget().) + + + // WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, // graphe.getClientArea()); @@ -281,8 +290,10 @@ Box boxEast = Box.createVerticalBox(); boxEast.add(new BuScrollPane(t)); p.add(new JScrollPane(boxEast), BuBorderLayout.EAST); - - f.setContentPane(p); + f.setLayout(new BorderLayout()); + + //f.setContentPane(p); + f.add(p,BorderLayout.CENTER); // fin p.add(new JScrollPane(scene.createView()), BuBorderLayout.CENTER); @@ -311,6 +322,14 @@ * scene.addNode(node); */ +JToolBar bar =new JToolBar(); +f.add(bar,BorderLayout.PAGE_START); +bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNLEFT)); +bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNRIGHT)); +bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNCENTERHORIZONTAL)); +bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNCENTERVERTICAL)); +bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNTOP)); +bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNBOTTOM)); 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. |
From: <had...@us...> - 2008-08-09 14:57:36
|
Revision: 3749 http://fudaa.svn.sourceforge.net/fudaa/?rev=3749&view=rev Author: hadouxad Date: 2008-08-09 14:57:45 +0000 (Sat, 09 Aug 2008) Log Message: ----------- implementation de la fonction de duplication et test pour le rectangle objet graphe Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.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/test/org/fudaa/ebli/all/TestGraphe2.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-09 14:06:31 UTC (rev 3748) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-08-09 14:57:45 UTC (rev 3749) @@ -5,20 +5,21 @@ import java.util.Map; public interface EbliNode { + String getTitle(); - + void setTitle(String title); + EbliWidgetCreator getCreator(); - + void setCreator(EbliWidgetCreator creator); + + Dimension getPreferedSize(); void setPreferedSize(Dimension d); - - Dimension getPreferedSize(); - EbliNode duplicate(Map options); + Point getPreferedLocation(); void setPreferedLocation(Point p); - Point getPreferedLocation(); public String toString(); 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 14:06:31 UTC (rev 3748) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-08-09 14:57:45 UTC (rev 3749) @@ -18,10 +18,34 @@ } - + /** + * methode qui permet de dupliquer un node + */ public EbliNode duplicate(Map options) { // TODO Auto-generated method stub - return null; + 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())); + + + } + + duplique.setPreferedSize(getPreferedSize()); + duplique.setPreferedLocation(getPreferedLocation()); + + return duplique; } @@ -86,6 +110,6 @@ } + - } 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 14:06:31 UTC (rev 3748) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-08-09 14:57:45 UTC (rev 3749) @@ -28,8 +28,12 @@ public class EbliWidget extends Widget { private EbliScene scene_; - private boolean useBorder_ = true; + public EbliScene getScene_() { + return scene_; +} +private boolean useBorder_ = true; + /** * @param scene * @param Point @@ -68,25 +72,25 @@ (int) (EbliWidget.this.getLocation().x + EbliWidget.this.getClientArea().width / 2), (int) (EbliWidget.this .getLocation().y + EbliWidget.this.getClientArea().height / 2)); - EbliWidget duplique; + + //-- 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); - try { - // clonage de l'objet - duplique = (EbliWidget) EbliWidget.this.clone(); - duplique.setPreferredSize(EbliWidget.this.getScene().getPreferredSize()); - duplique.setPreferredLocation(nouvellePosition); - - // -- ajout dans la scene --// - if (EbliWidget.this.getScene() != null) { - EbliWidget.this.getScene().addChild(duplique); - } - - } catch (CloneNotSupportedException e1) { - // TODO que fqire si ca pete? une peite fenetre d'erreur, - // widget pas duplicable? ou alors surcharger la methode - // dans les filles? - e1.printStackTrace(); + // -- ajout dans la scene --// + if (EbliWidget.this.getScene() != null) { + EbliWidget.this.getEbliScene().addNode(duplique); + //info debug widget duplique + //duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); + } + + } }); @@ -161,4 +165,16 @@ useBorder_ = _useBorder; } + /** + * methode qui construit une widget duplication pqr default, doit etre surchargee pour reproduire l' evenement + * @return + */ + public EbliNode duplicate(){ + EbliNode duplique =null; + + + return duplique; + } + + } \ 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-09 14:06:31 UTC (rev 3748) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetRectangle.java 2008-08-09 14:57:45 UTC (rev 3749) @@ -107,5 +107,7 @@ revalidate(); } + + } \ No newline at end of file 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 14:06:31 UTC (rev 3748) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-09 14:57:45 UTC (rev 3749) @@ -11,6 +11,8 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.JButton; @@ -41,6 +43,7 @@ import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; +import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorDblFleche; @@ -147,7 +150,7 @@ final EGFillePanel pn = new EGFillePanel(g); // creation de la scene EBLI - EbliScene scene = new EbliScene(); + final EbliScene scene = new EbliScene(); // -- construction du jtree @@ -206,12 +209,14 @@ // test.getVisuPanel().getVueCalque())); // -- ajout du rectangle --// - EbliNodeDefault nodeRect = new EbliNodeDefault(); + final EbliNodeDefault nodeRect = new EbliNodeDefault(); nodeRect.setTitle("Rectangle"); nodeRect.setCreator(new EbliWidgetCreatorRectangle("Test recangle")); nodeRect.setPreferedSize(new Dimension(200, 100)); nodeRect.setPreferedLocation(new Point(350, 125)); scene.addNode(nodeRect); + + // -- ajout du fleche double sens diagonale--// node = new EbliNodeDefault(); @@ -330,6 +335,19 @@ bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNCENTERVERTICAL)); bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNTOP)); bar.add(new EbliWidgetActionAlign(scene, EbliWidgetActionAlign.ALIGNBOTTOM)); - p.doLayout(); + +JButton boutontestAjout = new JButton("dupliquer rectangle"); +boutontestAjout.addActionListener(new ActionListener(){ + + public void actionPerformed(ActionEvent e) { + EbliNode node = nodeRect.duplicate(null); + scene.addNode(node); + scene.getView().repaint(); + + } + +}); +bar.add(boutontestAjout); +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. |
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. |
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. |
From: <had...@us...> - 2008-08-11 13:07:51
|
Revision: 3758 http://fudaa.svn.sourceforge.net/fudaa/?rev=3758&view=rev Author: hadouxad Date: 2008-08-11 13:07:36 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Modification du jtree pour prendre en compte les icons sur 3 niveaux differents - root - subdirectories - leaf Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.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/tree/EbliCheckBoxNodeEditor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.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/tree/EbliCheckBoxPanel.java 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-11 10:05:42 UTC (rev 3757) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetFleche.java 2008-08-11 13:07:36 UTC (rev 3758) @@ -10,6 +10,7 @@ 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; @@ -51,8 +52,8 @@ public static int ORIENTATION_EAST=2; public static int ORIENTATION_WEST=3; + public Color couleurFleche=Color.black; - /** * @param _scene */ @@ -90,14 +91,14 @@ l.setEpaisseur(largeurBorder); - + l.setCouleur(couleurFleche); //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; + l.dessineShape(g, shape); + */ - - - g.translate(-rec.x, -rec.y); @@ -105,6 +106,20 @@ } + + + + public Color getCouleurFleche() { + return couleurFleche; + } + + + + + public void setCouleurFleche(Color couleurFleche) { + this.couleurFleche = couleurFleche; + } + 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-08-11 10:05:42 UTC (rev 3757) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionAlign.java 2008-08-11 13:07:36 UTC (rev 3758) @@ -136,7 +136,7 @@ //-- recuperation de la liste des widgets selectionnees --// - Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getNodes(); + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects();//scene_.getNodes(); //-- parcours des nodes for(Iterator<EbliNode> it=listeNode.iterator();it.hasNext();){ Modified: 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-11 10:05:42 UTC (rev 3757) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxNodeEditor.java 2008-08-11 13:07:36 UTC (rev 3758) @@ -40,7 +40,7 @@ } public Object getCellEditorValue() { - JCheckBox checkbox = renderer.getLeafRenderer(); + BuCheckBox checkbox = renderer.getLeafRenderer().checkBox; // EbliNodeDefault checkBoxNode = new CheckBoxNode(checkbox.getText(), // checkbox.isSelected()); @@ -73,7 +73,7 @@ // -- recuperation de l instance defaultnode Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); - if (userObject instanceof EbliNode && editor instanceof JCheckBox) { + if (userObject instanceof EbliNode && editor instanceof EbliCheckBoxPanel) { final EbliNodeDefault node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); // -- suppression des anciens listeners --// @@ -81,15 +81,21 @@ // ajoute le listener au checkbox pour afficher la widget en fonction de // son click - ((JCheckBox) editor).addActionListener(new ActionListener() { + 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(((JCheckBox) editor).isSelected()); + node.getCreator().getWidget().setVisible((((EbliCheckBoxPanel) editor).checkBox).isSelected()); node.getCreator().getWidget().getEbliScene().refresh(); } }); + }else{ + System.err.println("checkbox FALSE poru le node: " + node.getTitle()); + } } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-08-11 13:07:36 UTC (rev 3758) @@ -0,0 +1,34 @@ +package org.fudaa.ebli.visuallibrary.tree; + +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; + +/** + * Panel de renderer pour le tree + * @author genesis + * + */ +public class EbliCheckBoxPanel extends BuPanel{ + + + private static final long serialVersionUID = -608817114677578183L; + BuCheckBox checkBox; + BuLabel labelRenderer; + public EbliCheckBoxPanel(){ + setOpaque(false); + } + + public void construct(){ + if(labelRenderer !=null){ + labelRenderer.setOpaque(false); + add(labelRenderer); + } + if(checkBox !=null){ + checkBox.setOpaque(false); + add(checkBox); + } + setOpaque(false); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java 2008-08-11 10:05:42 UTC (rev 3757) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxTreeRenderer.java 2008-08-11 13:07:36 UTC (rev 3758) @@ -4,26 +4,44 @@ import java.awt.Component; import java.awt.Font; +import javax.swing.Icon; import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellRenderer; +import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; +import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; public class EbliCheckBoxTreeRenderer implements TreeCellRenderer { - private JCheckBox leafRenderer = new JCheckBox(); + + //-- panel renderer --// + private EbliCheckBoxPanel leafRenderer = new EbliCheckBoxPanel(); private DefaultTreeCellRenderer nonLeafRenderer = new DefaultTreeCellRenderer(); Color selectionBorderColor, selectionForeground, selectionBackground, textForeground, textBackground; - protected JCheckBox getLeafRenderer() { + private Icon iconLeafEnabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + // private Icon iconLeafDisabled=CtuluResource.CTULU.getIcon("crystal22_previsualiser"); + + private Icon iconSubDirectorie=CtuluResource.CTULU.getIcon("reouvrir_26"); + + + private Icon iconRoot=CtuluResource.CTULU.getIcon("maison_32"); + + + protected EbliCheckBoxPanel getLeafRenderer() { return leafRenderer; } @@ -41,12 +59,18 @@ * selectionBackground = UIManager.getColor("Tree.selectionBackground"); * textForeground = UIManager.getColor("Tree.textForeground"); * textBackground = UIManager.getColor("Tree.textBackground"); - */} + */ + + + + } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { - Component returnValue; + + BuLabel returnLabel = null; + BuCheckBox returnValue = null; // cas particulier renderer: on met un checkbox que si on est feuille et pqs root (= cqs ou lqyer depourvu d objet graphique) if (leaf && !((DefaultMutableTreeNode) value).isRoot()) { @@ -57,35 +81,47 @@ if (userObject instanceof EbliNode) { node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - System.err.println("PS EbliNode!!! ROW: " + row); + //System.err.println("c est un EbliNode!!! ROW: " + row); // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque // composant - leafRenderer = new JCheckBox(); - leafRenderer.setOpaque(false); + returnValue=new BuCheckBox(); + //leafRenderer.setOpaque(false); - leafRenderer.setText(node.getTitle()); - leafRenderer.setSelected(node.getCreator().getWidget().isVisible()); - } else { - System.err.println("TROP NULLLLLLLLLLLLLLLLLLL!!!"); - } - // qccessible en fonction du tree - leafRenderer.setEnabled(tree.isEnabled()); - - /* - * // foreground si selectionne ou non if (leafRenderer.isSelected()) { - * leafRenderer.setForeground(selectionForeground); - * leafRenderer.setBackground(selectionBackground); } else { - * leafRenderer.setForeground(textForeground); - * leafRenderer.setBackground(textBackground); } - */ - - returnValue = leafRenderer; - - } else { + returnValue.setText(node.getTitle()); + returnValue.setSelected(node.getCreator().getWidget().isVisible()); + + returnLabel=new BuLabel(this.iconLeafEnabled); + } + + } /*else if (!leaf && !((DefaultMutableTreeNode) value).isRoot()) { + + returnLabel=new BuLabel(this.iconSubDirectorie); returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); + + }*/else { + returnLabel=new BuLabel(((DefaultMutableTreeNode) value).toString(),this.iconRoot); + //returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); + } - return returnValue; + + + //-- creation du panel avec les informations --// + leafRenderer=new EbliCheckBoxPanel(); + + if(returnLabel!=null) + leafRenderer.labelRenderer=returnLabel; + + if(returnValue!=null ) + leafRenderer.checkBox=returnValue; + + //-- construction du composant --// + leafRenderer.construct(); + + // qccessible en fonction du tree + leafRenderer.setEnabled(tree.isEnabled()); + + return leafRenderer; } } 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 10:05:42 UTC (rev 3757) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-08-11 13:07:36 UTC (rev 3758) @@ -43,6 +43,7 @@ import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGTableGraphePanel; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.EbliNode; @@ -353,7 +354,10 @@ bar.add(new EbliWidgetActionBackGround(scene)); +// +//boxEast.add(new ZEbliCalquesPanel()); + 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. |
From: <had...@us...> - 2008-09-08 18:35:11
|
Revision: 3901 http://fudaa.svn.sourceforge.net/fudaa/?rev=3901&view=rev Author: hadouxad Date: 2008-09-08 18:35:19 +0000 (Mon, 08 Sep 2008) Log Message: ----------- - ajout du menu multi-fenetre: permet d activer la fillelayout en cliquant sur son menuitem correspondant => cas ou l utilisateur ferme sa fenetre sans faire gaffe, il peut maintenant la recuperer - Ajout de l action editeur de texte en utilisant ekitcore - possibiliter de mettre: - des formules mathematiaues - gras, soulign?\195?\169,italique... - espaces, passages de lignes - ALARMA! les aligns internes ne marchent pas - REFACTORISATION: methode getWidget et setWidget dans le ebliNode - Repositionnement des widgets dans la scene: miux cal?\195?\169s , calque et sa legende - Traduction des chaines ebli et tr dans les fichiers correspondants - Gestion du cut/copy/paste: fonctionne nickel: - on peut selectionner plusieurs widgets simultanement - On peut copier/couper depuis une fillelayout vers une autre sans prob et vice-versa - Gestion de la position precedentes pour le cut/copy OK - Gestion des multi fenetre: enregistrement des liste cut/copy dans le trpostprojet - GEstion des undo/redo poru le cut/copy/paste - MULTILAYOUT ONGLET:degage des onglets scenes ainsi que des menus correspondant - MULTI LAYOUT FRAME: lors de la suppression, confirmation puis suppression - confirmation suppression - lors de la fermeture degage la reference de la fille - degage les menus d activation des frames Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.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/EbliWidgetController.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/EbliWidgetCreator.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/EbliWidgetSynchroniser.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/CommandSupprimer.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/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/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/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/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/EbliWidgetControllerGraphe.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/EbliJXTreeTableCellRenderer.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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCut.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-08 18:35:19 UTC (rev 3901) @@ -589,4 +589,23 @@ Zoom centr\xE9 sur le point cliqu\xE9=Zoom centered on the clicked point Rectangle dessin\xE9=A rectangle is drawn Zoom sur le rectangle dessin\xE9=Zoom on the drawn rectangle -Zoom arri\xE8re centr\xE9 sur le point cliqu\xE9=Zoom-back centered on the clicked point \ No newline at end of file +Zoom arri\xE8re centr\xE9 sur le point cliqu\xE9=Zoom-back centered on the clicked point +Alignement \xE0 gauche=align to left +en bas=to the bottom +Centrer verticalement=center vertically +Centrer horizontalement=Center horizontally +Alignement \xE0 droite=Align to the right +en haut=to the top +Arri\xE8re plan= Background +Bloquer les objets s\xE9lectionn\xE9s= lock the selected objects +Debloquer les objets s\xE9lectionn\xE9s=unlock the selected objects +Couleur de fond=Background color +Couleur Contour=Foreground color +Configure=Configure +dupliquer les objets s\xE9lectionn\xE9s=duplicate the selected objects +Premier plan=Foreground +Ins\xE9rer une image=Insert a picture +Editeur de texte=text editor +Double-cliquez pour \xE9diter=double click in order to edit +D\xE9grouper=Degroup +Grouper=Group \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNode.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -21,6 +21,8 @@ void setPreferedLocation(Point p); + + public String toString(); /** @@ -41,4 +43,6 @@ */ public EbliWidget getWidget(); + public void setWidget(EbliWidget _widget); + } 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeDefault.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -10,7 +10,9 @@ Point preferedLocation; Dimension preferedSize; String title; - + EbliWidget nodeWidget_; + + public String getTitle() { return title; } @@ -29,14 +31,16 @@ public void setPreferedLocation(Point p) { this.preferedLocation = p; // repositionnement du widget si existant - if (hasWidget()) getCreator().getWidget().setPreferredLocation(p); + if (hasWidget()) + nodeWidget_.setPreferredLocation(p); } public void setPreferedSize(Dimension d) { this.preferedSize = d; // repositionnement du widget si existant - if (hasWidget()) getCreator().getWidget().setPreferredSize(d); + if (hasWidget()) + nodeWidget_.setPreferredSize(d); } public void setCreator(EbliWidgetCreator creator) { @@ -64,7 +68,7 @@ // } public boolean hasWidget() { - return (getCreator() != null && getCreator().getWidget() != null); + return (getCreator() != null && nodeWidget_ != null); } @@ -73,7 +77,7 @@ * @return EbliWidget */ public EbliWidget getWidget() { - return creator.getWidget(); + return nodeWidget_; } public boolean isMovable() { @@ -81,4 +85,8 @@ return (hasWidget() && getPreferedLocation() != null && getWidget().getBounds() != null); } + public void setWidget(EbliWidget _widget) { + nodeWidget_ = _widget; + } + } 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -133,16 +133,19 @@ protected Widget attachNodeWidget(EbliNode node) { // -- creation de la widget ici --// - EbliWidget res = node.getCreator().create(this); + node.setWidget(node.getCreator().create(this)); + + // -- remplissage des proprietes - res.setPreferredLocation(node.getPreferedLocation()); - if (node.getPreferedSize() != null) res.setPreferredSize(node.getPreferedSize()); + node.getWidget().setPreferredLocation(node.getPreferedLocation()); + if (node.getPreferedSize() != null) + node.getWidget().setPreferredSize(node.getPreferedSize()); // -- ajout dans la vue layer --// - visu_.addChild(res); + visu_.addChild(node.getWidget()); - return res; + return node.getWidget(); } /** 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetController.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -202,9 +202,9 @@ widget_.getEbliScene().addNode(duplique); // -- duplication des map de property graphique de la widget --// - duplique.getCreator().getWidget().propGraphique = n.getCreator().getWidget().duplicateGraphicalProperties(); + duplique.getWidget().propGraphique = n.getWidget().duplicateGraphicalProperties(); // -- duplication de la taille --// - duplique.getCreator().getWidget().setPreferredBounds(n.getCreator().getWidget().getPreferredBounds()); + duplique.getWidget().setPreferredBounds(n.getWidget().getPreferredBounds()); // -- ajout de la commande undo/redo --// ArrayList<EbliNode> ln = new ArrayList<EbliNode>(); 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetControllerMenuOnly.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -10,7 +10,7 @@ public class EbliWidgetControllerMenuOnly extends EbliWidgetController { public EbliWidgetControllerMenuOnly(EbliWidget widget_) { - super(widget_); + this(widget_, true); } public EbliWidgetControllerMenuOnly(EbliWidget widget_, boolean canDuplicate) { 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreator.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -5,7 +5,7 @@ EbliWidget create(EbliScene _scene); // FIXME a mettre dans le EbliNode - EbliWidget getWidget(); + // EbliWidget getWidget(); /** * Duplication de l ebliNode en fonction de son creator. 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetCreatorTextEditor.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -1,5 +1,7 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Point; + import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; /** @@ -11,8 +13,10 @@ public class EbliWidgetCreatorTextEditor implements EbliWidgetCreator { CtuluHtmlEditorPanel editorPane_; - EbliWidgetTextEditor res; - + // EbliWidgetTextEditor res; + EbliWidgetBordure res; + + public EbliWidgetCreatorTextEditor(CtuluHtmlEditorPanel g) { super(); this.editorPane_ = g; @@ -28,7 +32,7 @@ public EbliWidget create(EbliScene _scene) { - res = new EbliWidgetTextEditor(_scene, getG()); + res = new EbliWidgetBordure(new EbliWidgetTextEditor(_scene, getG())); return res; } @@ -39,11 +43,25 @@ } public EbliNode duplicate(EbliNode _nodeAdupliquer) { - return null; + + EbliNode duplique = new EbliNodeDefault(); + CtuluHtmlEditorPanel editor=new CtuluHtmlEditorPanel(); + editor.setDocumentText(getG().getDocumentText()); + duplique.setCreator(new EbliWidgetCreatorTextEditor(editor)); + + 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; + return res; } - } 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetSynchroniser.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -102,7 +102,7 @@ // -- recuperation du node associe --// EbliNode node = (EbliNode) treeNode.getUserObject(); - if (node != null && node.hasWidget() && node.getCreator().getWidget().isVisible()) { + if (node != null && node.hasWidget() && node.getWidget().isVisible()) { // -- recuperation de la popup du node et ajout a l element du tree a al @@ -111,11 +111,11 @@ // -- 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(); + if (node.getWidget() instanceof EbliWidgetBordure) { + EbliWidgetBordure bordure = (EbliWidgetBordure) node.getWidget(); poppup = bordure.intern_.getController_().getPopup(); }else - poppup=node.getCreator().getWidget().getController_().getPopup(); + poppup = node.getWidget().getController_().getPopup(); poppup.show(arbre_, x, y); 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetTextEditor.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -5,10 +5,13 @@ import java.awt.Rectangle; import java.util.EnumSet; +import javax.swing.JLabel; + 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.ComponentWidget; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuBorderLayout; @@ -16,45 +19,45 @@ 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; - + // LabelWidget intern_; + ComponentWidget intern_; + + JLabel contenuHTML_ = new JLabel(); + public EbliWidgetTextEditor(EbliScene scene, CtuluHtmlEditorPanel content) { - super(scene, true); + super(scene, false); 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); - // + intern_ = new ComponentWidget(scene, contenuHTML_); + + contenuHTML_.setText(content.getDocumentText()); + // -- ajout en interne du label d affichage --// + this.addChild(intern_); + // -- creation de l action pour editor --// WidgetAction editorAction = ActionFactory.createInplaceEditorAction(this); // -- ajout de l action au widget correspondant --// this.getActions().addAction(editorAction); + + setController_(new EbliWidgetControllerMenuOnly(this)); } - protected void paintWidget() { - Graphics2D g = getGraphics(); + // protected void paintWidget() { + // Graphics2D g = getGraphics(); + // + // Rectangle rec = getClientArea(); + // + // decoupeEcriture(editorPane_.getDocumentText(), g); + // } - Rectangle rec = getClientArea(); - - decoupeEcriture(editorPane_.getDocumentText(), g); - } - /** * Methode qui redessine l edition de texte proprement. * @@ -93,14 +96,16 @@ editorPane_.setSize(rec.width, rec.height); editorPane_.setPreferredSize(new Dimension(rec.width, rec.height)); conteneur.setPreferredSize(new Dimension(rec.width, rec.height)); - + conteneur.setMaximumSize(new Dimension(rec.width, rec.height)); + conteneur.setMinimumSize(new Dimension(rec.width, rec.height)); conteneur.add(editorPane_, BuBorderLayout.CENTER); conteneur.add(editorPane_.getToolBar(true), BuBorderLayout.NORTH); conteneur.add(editorPane_.getMenuBar()); } + // -- on masque l affichage du widgetcomponent --// + contenuHTML_.setText(""); - return conteneur; @@ -119,6 +124,16 @@ public void notifyClosing(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, Widget widget, BuPanel editor, boolean commit) { + + // -- mise a jour de intern avec le contenu du ekitcore --// + + contenuHTML_.setText(editorPane_.getDocumentText()); + intern_.repaint(); + intern_.revalidate(); + this.repaint(); + getEbliScene().refresh(); + // intern_.setLabel(label.getText()); + } public void notifyOpened(org.netbeans.api.visual.action.InplaceEditorProvider.EditorController controller, 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandSupprimer.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -41,8 +41,7 @@ scene_.addNode(nodeSupprime_); // -- repositionnement originel de la widget --// - nodeSupprime_.getCreator().getWidget().setPreferredLocation( - nodeSupprime_.getCreator().getWidget().convertSceneToLocal(location_)); + nodeSupprime_.getWidget().setPreferredLocation(nodeSupprime_.getWidget().convertSceneToLocal(location_)); // -- raffraichissement de la scene --// scene_.refresh(); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCut.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCut.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoCut.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -0,0 +1,57 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.Iterator; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliNode; + +/** + * classe de gestion des undo cut. Gere les undo/redo pour l'action ctrl+x. Pour + * l action paste, un autre undo/redo est g\xE9r\xE9 et permet de g\xE9rer les 2 cas + * copy/cut. + * + * @author Adrien Hadoux + * + * + */ +public class CommandUndoRedoCut implements CtuluCommand { + + Set<EbliNode> nodesCutted_; + + + + + public CommandUndoRedoCut(Set<EbliNode> _nodesCutted) { + super(); + nodesCutted_ = _nodesCutted; + } + + public void redo() { + for (Iterator<EbliNode> it = nodesCutted_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + + // enlever les nodes de la scene + // le node existe toujours apres l'avoir enleve + node.getWidget().getEbliScene().removeNode(node); + } + nodesCutted_.iterator().next().getWidget().getEbliScene().refresh(); + + } + + public void undo() { + for (Iterator<EbliNode> it = nodesCutted_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + + // enlever les nodes de la scene + // le node existe toujours apres l'avoir enleve + node.getWidget().getEbliScene().addNode(node); + } + nodesCutted_.iterator().next().getWidget().getEbliScene().refresh(); + + + } + + + +} Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandUndoRedoPaste.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -0,0 +1,44 @@ +package org.fudaa.ebli.visuallibrary.actions; + +import java.util.Iterator; +import java.util.Set; + +import org.fudaa.ctulu.CtuluCommand; +import org.fudaa.ebli.visuallibrary.EbliNode; + +public class CommandUndoRedoPaste implements CtuluCommand { + + Set<EbliNode> nodesPasted_; + + public CommandUndoRedoPaste(Set<EbliNode> _nodesPasted) { + super(); + nodesPasted_ = _nodesPasted; + } + + public void redo() { + for (Iterator<EbliNode> it = nodesPasted_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + + // enlever les nodes de la scene + // le node existe toujours apres l'avoir enleve + node.getWidget().getEbliScene().addNode(node); + } + nodesPasted_.iterator().next().getWidget().getEbliScene().refresh(); + + } + + public void undo() { + for (Iterator<EbliNode> it = nodesPasted_.iterator(); it.hasNext();) { + EbliNode node = it.next(); + + // enlever les nodes de la scene + // le node existe toujours apres l'avoir enleve + node.getWidget().getEbliScene().removeNode(node); + } + nodesPasted_.iterator().next().getWidget().getEbliScene().refresh(); + + } + + + +} Modified: 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 2008-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/CommandeDuplicate.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -30,7 +30,7 @@ // -- 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(node.getWidget(), node); } } @@ -52,7 +52,7 @@ // -- redo unitaire execute pour chaque node dupliques --// for (Iterator<EbliNode> it = nodeDuplique_.iterator(); it.hasNext();) { EbliNode node = it.next(); - undo(node.getCreator().getWidget(), node); + undo(node.getWidget(), node); } } 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBackGround.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -48,9 +48,9 @@ // -- ajout au premier plan du node --// // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); - currentNode.getCreator().getWidget().bringToBack(); + currentNode.getWidget().bringToBack(); - listeWidget.add(currentNode.getCreator().getWidget()); + listeWidget.add(currentNode.getWidget()); // -- rafraichissement de la scene --// scene_.refresh(); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionBloqueOuDebloqueWidget.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -29,7 +29,7 @@ public EbliWidgetActionBloqueOuDebloqueWidget(String name, Icon ic, String id, EbliScene _scene, boolean bloque) { super(_scene, name, ic, id); - putValue(NAME, "Duplication des \xE9lements s\xE9lectionn\xE9s"); + cmd_ = _scene.getCmdMng(); bloque_ = bloque; } @@ -67,9 +67,11 @@ 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()); + if (bloque_) + currentNode.getWidget().getController_().removeActionResizeAndMove(); + else + currentNode.getWidget().getController_().replaceActionResizeAndMove(); + listeWidget.add(currentNode.getWidget()); // -- rafraichissement de la scene --// scene_.refresh(); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorBackground.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -26,7 +26,7 @@ CtuluCommandContainer cmd_; public EbliWidgetActionColorBackground(EbliScene _scene) { - super(_scene, EbliResource.EBLI.getString("Couleur Contour"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); + super(_scene, EbliResource.EBLI.getString("Couleur de fond"), EbliResource.EBLI.getToolIcon("couleur"), "CONTOUR"); cmd_ = _scene.getCmdMng(); @@ -35,7 +35,7 @@ public void actionPerformed(ActionEvent e) { // -- choix de la couleur par l utilisateur --// - Color couleur = BuColorChooser.showDialog(null, "Couleur de fond", Color.black); + Color couleur = BuColorChooser.showDialog(null, EbliResource.EBLI.getString("Couleur de fond"), Color.black); if (couleur != null) { // on met a joru les couleurs pour toutes les widgets selectionnees --// @@ -62,7 +62,7 @@ if (currentNode.hasWidget()) { - EbliWidget widget = currentNode.getCreator().getWidget(); + EbliWidget widget = currentNode.getWidget(); // -- test pour savoir si le widget gere le colorcontour --// if (widget.getColorFond() != null) { 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionColorForeground.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -35,7 +35,7 @@ public void actionPerformed(ActionEvent e) { // -- choix de la couleur par l utilisateur --// - Color couleur = BuColorChooser.showDialog(null, "Couleur du contour", Color.black); + Color couleur = BuColorChooser.showDialog(null, EbliResource.EBLI.getString("Couleur du contour"), Color.black); if (couleur != null) { // on met a joru les couleurs pour toutes les widgets selectionnees --// @@ -62,7 +62,7 @@ if (currentNode.hasWidget()) { - EbliWidget widget = currentNode.getCreator().getWidget(); + EbliWidget widget = currentNode.getWidget(); // -- test pour savoir si le widget gere le colorcontour --// if (widget.getColorContour() != 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionDuplicate.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -36,7 +36,7 @@ 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"); + putValue(NAME, EbliResource.EBLI.getString("Duplication des \xE9lements s\xE9lectionn\xE9s")); cmd_ = _scene.getCmdMng(); } @@ -57,7 +57,7 @@ if (currentNode != null && currentNode.hasWidget()) { // -- duplication que si la widget est selectionnee --// - if (currentNode.getCreator().getWidget().getState().isSelected()) { + if (currentNode.getWidget().getState().isSelected()) { listeNodeADupliquer.add(currentNode); @@ -83,10 +83,9 @@ listeNouveauxNodes.add(node); // -- duplication des map de property graphique de la widget --// - node.getCreator().getWidget().setPropGraphique( - currentNode.getCreator().getWidget().duplicateGraphicalProperties()); + node.getWidget().setPropGraphique(currentNode.getWidget().duplicateGraphicalProperties()); // -- duplication de la taille --// - node.getCreator().getWidget().setPreferredBounds(currentNode.getCreator().getWidget().getPreferredBounds()); + node.getWidget().setPreferredBounds(currentNode.getWidget().getPreferredBounds()); // -- rafraichissement de la scene --// sceneDestination_.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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionFont.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -101,7 +101,7 @@ if (currentNode.hasWidget()) { - EbliWidget widget = currentNode.getCreator().getWidget(); + EbliWidget widget = currentNode.getWidget(); // -- test pour savoir si le widget gere le colorcontour --// if (widget.getFormeFont() != null) { 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -45,11 +45,11 @@ if (currentNode != null && currentNode.isMovable()) { // -- ajout au premier plan du node --// - // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); + // scene_.getVisu().addChild(currentNode.getWidget()); - currentNode.getCreator().getWidget().bringToFront(); + currentNode.getWidget().bringToFront(); - listeWidget.add(currentNode.getCreator().getWidget()); + listeWidget.add(currentNode.getWidget()); // -- rafraichissement de la scene --// scene_.refresh(); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageHorizontal.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -59,7 +59,8 @@ // retaillables --// for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode node = it.next(); - if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize()) listeNodeAutorises + if (node.hasWidget() && node.getWidget().getController_().isCanResize()) + listeNodeAutorises .add(node); } @@ -67,17 +68,17 @@ Iterator<EbliNode> it = listeNodeAutorises.iterator(); Rectangle tailleAresize = null; if (it.hasNext()) { - tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); + tailleAresize = it.next().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(); + if (tailleAresize.width < currentNode.getWidget().getPreferredBounds().width) + tailleAresize = currentNode.getWidget().getPreferredBounds(); } else if (currentNode.hasWidget()) { - if (tailleAresize.width > currentNode.getCreator().getWidget().getPreferredBounds().width) tailleAresize = currentNode - .getCreator().getWidget().getPreferredBounds(); + if (tailleAresize.width > currentNode.getWidget().getPreferredBounds().width) + tailleAresize = currentNode.getWidget().getPreferredBounds(); } } } @@ -97,15 +98,15 @@ EbliNode currentNode = it2.next(); if (currentNode != null && currentNode.hasWidget()) { - listeWidget.add(currentNode.getCreator().getWidget()); - oldRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + listeWidget.add(currentNode.getWidget()); + oldRectangle.add(currentNode.getWidget().getPreferredBounds()); // -- retaillage --// - currentNode.getCreator().getWidget().setPreferredBounds( + currentNode.getWidget().setPreferredBounds( new Rectangle(new Dimension(tailleAresize.width, - currentNode.getCreator().getWidget().getPreferredBounds().height))); + currentNode.getWidget().getPreferredBounds().height))); - newRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + newRectangle.add(currentNode.getWidget().getPreferredBounds()); // -- rafraichissement de la scene --// scene_.refresh(); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionRetaillageVertical.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -39,10 +39,10 @@ cmd_ = _scene.getCmdMng(); if (_typeRetaillage == RETAIILLAGE_MAX) { - putValue(NAME, "Resize Vertical Max"); + putValue(NAME, EbliResource.EBLI.getString("Resize Vertical Max")); setIcon(EbliResource.EBLI.getToolIcon("aotallest")); } else { - putValue(NAME, "Resize Vertical Min"); + putValue(NAME, EbliResource.EBLI.getString("Resize Vertical Min")); setIcon(CtuluResource.CTULU.getIcon("crystal_rangerpalettes")); } @@ -60,7 +60,8 @@ // retaillables --// for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { EbliNode node = it.next(); - if (node.hasWidget() && node.getCreator().getWidget().getController_().isCanResize()) listeNodeAutorises + if (node.hasWidget() && node.getWidget().getController_().isCanResize()) + listeNodeAutorises .add(node); } @@ -68,17 +69,17 @@ Iterator<EbliNode> it = listeNodeAutorises.iterator(); Rectangle tailleAresize = null; if (it.hasNext()) { - tailleAresize = it.next().getCreator().getWidget().getPreferredBounds(); + tailleAresize = it.next().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(); + if (tailleAresize.height < currentNode.getWidget().getPreferredBounds().height) + tailleAresize = currentNode.getWidget().getPreferredBounds(); } else if (currentNode.hasWidget()) { - if (tailleAresize.height > currentNode.getCreator().getWidget().getPreferredBounds().height) tailleAresize = currentNode - .getCreator().getWidget().getPreferredBounds(); + if (tailleAresize.height > currentNode.getWidget().getPreferredBounds().height) + tailleAresize = currentNode.getWidget().getPreferredBounds(); } } } @@ -98,15 +99,15 @@ EbliNode currentNode = it2.next(); if (currentNode != null && currentNode.hasWidget()) { - listeWidget.add(currentNode.getCreator().getWidget()); - oldRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + listeWidget.add(currentNode.getWidget()); + oldRectangle.add(currentNode.getWidget().getPreferredBounds()); // -- retaillage --// - currentNode.getCreator().getWidget().setPreferredBounds( - new Rectangle(new Dimension(currentNode.getCreator().getWidget().getPreferredBounds().width, + currentNode.getWidget().setPreferredBounds( + new Rectangle(new Dimension(currentNode.getWidget().getPreferredBounds().width, tailleAresize.height))); - newRectangle.add(currentNode.getCreator().getWidget().getPreferredBounds()); + newRectangle.add(currentNode.getWidget().getPreferredBounds()); // -- rafraichissement de la scene --// scene_.refresh(); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActiontextEditor.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -20,7 +20,7 @@ public class EbliWidgetActiontextEditor extends EbliWidgetActionSimple { public EbliWidgetActiontextEditor(EbliScene _widget) { - super(_widget, EbliLib.getS("Ins\xE9rer une texte"), BuResource.BU.getIcon("crystal_fonte"), "INSERTIONTEXTE"); + super(_widget, EbliLib.getS("Editeur de texte"), BuResource.BU.getIcon("crystal_editer"), "INSERTIONTEXTE"); } @@ -29,7 +29,10 @@ // -- creation de la widget et ajout dans la scene --// EbliNodeDefault nodeText = new EbliNodeDefault(); nodeText.setTitle("Texte"); - nodeText.setCreator(new EbliWidgetCreatorTextEditor(new CtuluHtmlEditorPanel())); + CtuluHtmlEditorPanel editor = new CtuluHtmlEditorPanel(); + editor.setDocumentText(EbliLib.getS("Double-cliquez pour \xE9diter")); + + nodeText.setCreator(new EbliWidgetCreatorTextEditor(editor)); nodeText.setPreferedSize(new Dimension(200, 200)); nodeText.setPreferedLocation(new Point(270, 225)); scene_.addNode(nodeText); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/CalqueLegendeWidgetAdapter.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -228,7 +228,7 @@ */ @Override protected void addLegendToPanel(BCalqueLegendePanel _pnLeg) { - FuLog.warning("J'ajoute un nouveau BCalqueLegendePanel dans la widget legende:" + _pnLeg); + legendePanel_ = _pnLeg; @@ -240,20 +240,12 @@ * * @return EbliNode cree ajoute a la scene. */ - public EbliNode createLegende() { + public EbliNode createLegende(Point _location) { - // legendePanel_.setVisible(true); - // legendePanel_.setSize(150, 300); - // legendePanel_.setPreferredSize(new Dimension(150, 300)); - // legendePanel_.setMinimumSize(new Dimension(150, 300)); - // - // // EbliWidgetCreatorLegende creator = new - // // EbliWidgetCreatorLegende(legendePanel_); - // // legendePanel_.setDoubleBuffered(false); - // // BuLib.setDoubleBuffered(legendePanel_, false); + EbliNodeDefault def = new EbliNodeDefault(); - def.setPreferedLocation(new Point(200, 200)); + def.setPreferedLocation(_location); // def.setPreferedSize(new Dimension(150, 250)); def.setCreator(new EbliWidgetCreatorLegende(legendePanel_)); def.setTitle("L\xE9gende calque"); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -25,6 +25,7 @@ import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BSelecteurListComboBox; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetControllerMenuOnly; @@ -96,7 +97,7 @@ protected void constructMenuMasquer(JPopupMenu _popup, final CtuluCommandContainer cmd_) { - JMenuItem menuItem = _popup.add("Masquer l'objet"); + JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Masquer l'objet")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_visibilite")); menuItem.addActionListener(new ActionListener() { @@ -127,8 +128,8 @@ widgetCalque_.nodeLegende.getCreator().getBordure().setVisible(false); widgetUndo2 = widgetCalque_.nodeLegende.getCreator().getBordure(); } else { - widgetCalque_.nodeLegende.getCreator().getWidget().setVisible(false); - widgetUndo2 = widgetCalque_.nodeLegende.getCreator().getWidget(); + widgetCalque_.nodeLegende.getWidget().setVisible(false); + widgetUndo2 = widgetCalque_.nodeLegende.getWidget(); } @@ -164,7 +165,7 @@ } private void constructPopupMenuSpecifique(JPopupMenu _popup) { - JMenuItem menuItem = _popup.add("Ajouter la l\xE9gende"); + JMenuItem menuItem = _popup.add(EbliResource.EBLI.getString("Ajouter la l\xE9gende")); menuItem.setIcon(CtuluResource.CTULU.getIcon("crystal_commentaire")); menuItem.addActionListener(new ActionListener() { @@ -191,12 +192,16 @@ legendeWidget_ = (CalqueLegendeWidgetAdapter) widgetCalque_.calquePanel_.getCqLegend(); } // -- creation de la legende - setNodeLegende(legendeWidget_.createLegende()); - + Point positionLegende = new Point(); + if (widget_.getBounds() != null && widget_.getPreferredLocation() != null) { + positionLegende.x = widget_.getPreferredLocation().x + widget_.getBounds().width + 20; + positionLegende.y = widget_.getPreferredLocation().y; + setNodeLegende(legendeWidget_.createLegende(positionLegende)); + } widget_.getEbliScene().refresh(); } else if (getNodeLegende().hasWidget()) // -- cas ou la legende existe mais est cach\xE9e --// - getNodeLegende().getCreator().getWidget().setVisible(true); + getNodeLegende().getWidget().setVisible(true); // GrapheWidget.this.addChild(widgetLegende); } 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -87,8 +87,8 @@ widgetGraphe_.getNodeLegende().getCreator().getBordure().setVisible(false); widgetUndo2 = widgetGraphe_.getNodeLegende().getCreator().getBordure(); } else { - widgetGraphe_.getNodeLegende().getCreator().getWidget().setVisible(false); - widgetUndo2 = widgetGraphe_.getNodeLegende().getCreator().getWidget(); + widgetGraphe_.getNodeLegende().getWidget().setVisible(false); + widgetUndo2 = widgetGraphe_.getNodeLegende().getWidget(); } // -- creation des comamndes undo/redo pour le masquage --// @@ -170,7 +170,7 @@ widget_.getEbliScene().addNode(widgetGraphe_.getNodeLegende()); widgetGraphe_.getNodeLegende().setPreferedSize( - widgetGraphe_.getNodeLegende().getCreator().getWidget() + widgetGraphe_.getNodeLegende().getWidget() .getPreferredSize()); //widgetLegende=WidgetLegendeManager.createLegende(EbliWidgetGraphe. // this.getGraphe(), @@ -178,7 +178,7 @@ widget_.getEbliScene().refresh(); } else if (widgetGraphe_.getNodeLegende().hasWidget()) { // -- cas ou la legende est masquee --// - widgetGraphe_.getNodeLegende().getCreator().getWidget().setVisible(true); + widgetGraphe_.getNodeLegende().getWidget().setVisible(true); } // GrapheWidget.this.addChild(widgetLegende); 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-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetGraphe.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -73,6 +73,7 @@ super(scene); panelGraphe_ = _pn; panelGraphe_.setBorder(null); + // FIXME panelGraphe_.remove(CtuluLibSwing.findChildByName(panelGraphe_, "lbTools")); panelGraphe_.getGraphe().getModel().addModelListener(this); @@ -92,7 +93,17 @@ public BufferedImage getImageGraphe() { return imageGraphe; } + + @Override + protected void notifyAdded() { + super.notifyAdded(); + } + @Override + protected void notifyRemoved() { + super.notifyRemoved(); + } + protected void paintWidget() { Rectangle rec = getClientArea(); Graphics2D g = getGraphics(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -2,16 +2,9 @@ import java.awt.Color; import java.awt.Component; -import java.awt.Font; import javax.swing.Icon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellRenderer; import org.fudaa.ctulu.CtuluResource; @@ -19,10 +12,7 @@ import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; -import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; -import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; /** * Treecell renderer pour l arbre des calques de visualllibrary. * gere uniquement l affichage des icones optimises. @@ -75,13 +65,13 @@ - if(node.getCreator().getWidget().isVisible()) + if (node.getWidget().isVisible()) returnLabel.setIcon(iconLeafEnabled);//=new BuLabel(this.iconLeafEnabled); else returnLabel.setIcon(iconLeafDisabled);//returnLabel=new BuLabel(this.iconLeafDisabled); - returnLabel.setEnabled(node.getCreator().getWidget().isVisible()); + returnLabel.setEnabled(node.getWidget().isVisible()); } } /*else if (!leaf && !((DefaultMutableTreeTableNode) value).isRoot()) { @@ -97,74 +87,60 @@ return returnLabel; } - - - - - - /* - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, - boolean leaf, int row, boolean hasFocus) { - - BuLabel returnLabel = null; - BuCheckBox returnValue = null; - // cas particulier renderer: on met un checkbox que si on est feuille et pqs root (= cqs ou lqyer depourvu d objet graphique) - if (leaf && !((DefaultMutableTreeNode) value).isRoot()) { - - // -- recuperation du node --// - Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); - - EbliNodeDefault node = null; - if (userObject instanceof EbliNode) { - node = (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - - //System.err.println("c est un EbliNode!!! ROW: " + row); - - // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque - // composant - returnValue=new BuCheckBox(); - //leafRenderer.setOpaque(false); - - returnValue.setText(node.getTitle()); - returnValue.setSelected(node.getCreator().getWidget().isVisible()); - - - returnLabel=new BuLabel(this.iconLeafEnabled); - - - - returnLabel.setEnabled(node.getCreator().getWidget().isVisible()); - } - - } else { - returnLabel=new BuLabel(((DefaultMutableTreeNode) value).toString(),this.iconRoot); - //returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); - - } - + /* + * public Component getTreeCellRendererComponent(JTree tree, Object value, + * boolean selected, boolean expanded, boolean leaf, int row, boolean + * hasFocus) { + * + * + * BuLabel returnLabel = null; BuCheckBox returnValue = null; // cas + * particulier renderer: on met un checkbox que si on est feuille et pqs root + * (= cqs ou lqyer depourvu d objet graphique) if (leaf && + * !((DefaultMutableTreeNode) value).isRoot()) { + * + * // -- recuperation du node --// Object userObject = + * ((DefaultMutableTreeNode) value).getUserObject(); + * + * EbliNodeDefault node = null; if (userObject instanceof EbliNode) { node = + * (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); + * + * //System.err.println("c est un EbliNode!!! ROW: " + row); + * + * // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque // + * composant returnValue=new BuCheckBox(); //leafRenderer.setOpaque(false); + * + * returnValue.setText(node.getTitle()); + * returnValue.setSelected(node.getWidget().isVisible()); + * + * + * returnLabel=new BuLabel(this.iconLeafEnabled); + * + * + * + * returnLabel.setEnabled(node.getWidget().isVisible()); } + * + * } else { returnLabel=new BuLabel(((DefaultMutableTreeNode) + * value).toString(),this.iconRoot); //returnValue = + * nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, + * expanded, leaf, row, hasFocus); + * + * } + * + * + * //-- creation du panel avec les informations --// leafRenderer=new + * EbliCheckBoxPanel(); + * + * if(returnLabel!=null) leafRenderer.labelRenderer=returnLabel; + * + * if(returnValue!=null ) leafRenderer.checkBox=returnValue; + * + * //-- construction du composant --// leafRenderer.construct(); + * + * // qccessible en fonction du tree + * leafRenderer.setEnabled(tree.isEnabled()); if(selected){ + * leafRenderer.setBackground(Color.BLUE); } else + * leafRenderer.setBackground(Color.WHITE); return leafRenderer; } + */ - //-- creation du panel avec les informations --// - leafRenderer=new EbliCheckBoxPanel(); - - if(returnLabel!=null) - leafRenderer.labelRenderer=returnLabel; - - if(returnValue!=null ) - leafRenderer.checkBox=returnValue; - - //-- construction du composant --// - leafRenderer.construct(); - - // qccessible en fonction du tree - leafRenderer.setEnabled(tree.isEnabled()); - if(selected){ - leafRenderer.setBackground(Color.BLUE); - } - else - leafRenderer.setBackground(Color.WHITE); - return leafRenderer; - } -*/ - } 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-09-08 18:34:13 UTC (rev 3900) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-09-08 18:35:19 UTC (rev 3901) @@ -68,7 +68,7 @@ if (_column == 1) { return ((EbliNodeDefault) getUserObject()).getTitle(); } - return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getCreator().getWidget().isVisible()); + return Boolean.valueOf(((EbliNodeDefault) getUserObject()).getWidget().isVisible()); } @Override @@ -83,32 +83,32 @@ ((EbliNode) getUserObject()).setTitle((String) _value); else if (_column == 2) { // -- mise a jour du masquage --// - ((EbliNode) getUserObject()).getCreator().getWidget().setVisible(((Boolean) _value).booleanValue()); + ((EbliNode) getUserObject()).getWidget().setVisible(((Boolean) _value).booleanValue()); // -- reference vers le gestionnaire de commandeundo/redo --// - final CtuluCommandContainer cmd_ = ((EbliNode) getUserObject()).getCreator().getWidget().getEbliScene() + final CtuluCommandContainer cmd_ = ((EbliNode) getUserObject()).getWidget().getEbliScene() .getCmdMng(); ArrayList<EbliWidget> listeWidgetUndo = new ArrayList<EbliWidget>(); - listeWidgetUndo.add(((EbliNode) getUserObject()).getCreator().getWidget()); + listeWidgetUndo.add(((EbliNode) getUserObject()).getWidget()); // -- cas particulier si il s agit d un calque ou d un graphe, on masque // les sous fils --// - if ((((EbliNode) getUserObject()).getCreator().getWidget()) instanceof EbliWidgetBordure - && (((EbliNode) getUserObject()).getCreator().getWidget()).getChildren() != null) { + if ((((EbliNode) getUserObject()).getWidget()) instanceof EbliWidgetBordure + && (((EbliNode) getUserObject()).getWidget()).getChildren() != null) { - if ((((EbliNode) getUserObject()).getCreator().getWidget()).getChildren().get(0) instanceof EbliWidgetVueCalque) { - EbliWidgetVueCalque wid = (EbliWidgetVueCalque) (((EbliNode) getUserObject()).getCreator().getWidget()) + if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetVueCalque) { + EbliWidgetVueCalque wid = (EbliWidgetVueCalque) (((EbliNode) getUserObject()).getWidget()) .getChildren().get(0); - wid.nodeLegende.getCreator().getWidget().setVisible(((Boolean) _value).booleanValue()); - listeWidgetUndo.add(wid.nodeLegende.getCreator().getWidget()); + wid.nodeLegende.getWidget().setVisible(((Boolean) _value).booleanValue()); + listeWidgetUndo.add(wid.nodeLegende.getWidget()); } else - if ((((EbliNode) getUserObject()).getCreator().getWidget()).getChildren().get(0) instanceof EbliWidgetGraphe) { - EbliWidgetGraphe wid = (EbliWidgetGraphe) (((EbliNode) getUserObject()).getCreator().getWidget()).getChildren().get(0); - wid.getNodeLegende().getCreator().getWidget().setVisible(((Boolean) _value).booleanValue()); - listeWidgetUndo.add(wid.getNodeLegende().getCreator... [truncated message content] |
From: <de...@us...> - 2008-09-21 23:14:19
|
Revision: 3965 http://fudaa.svn.sourceforge.net/fudaa/?rev=3965&view=rev Author: deniger Date: 2008-09-21 23:14:14 +0000 (Sun, 21 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 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/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.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/EbliWidgetPlage.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/EbliJXTreeTableCellRenderer.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/animation/EbliWidgetAnimTreeNode.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimation.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -128,6 +128,7 @@ configure_.addItemListener(this); configure_.setHorizontalAlignment(SwingConstants.LEFT); final BuPanel pnConfigure = new BuPanel(new BuButtonLayout(0, SwingConstants.LEFT)); + if (cmpOptions_ != null) pnConfigure.add(cmpOptions_); pnConfigure.add(configure_); pnButton.setBorder(new CtuluRoundEtchBorder(30)); lbTitle_ = new JLabel(); @@ -432,11 +433,10 @@ final BuPalette parent = (BuPalette) SwingUtilities.getAncestorOfClass(BuPalette.class, pn_); if (parent != null) { parent.pack(); + } else { + final Window winParent = (Window) SwingUtilities.getAncestorOfClass(Window.class, pn_); + winParent.pack(); } - else { - final Window winParent = (Window) SwingUtilities.getAncestorOfClass(Window.class, pn_); - winParent.pack(); - } } public void itemStateChanged(final ItemEvent _e) { @@ -594,21 +594,36 @@ Timer timerContainer_; + /** + * Composant optionel ajouter par l'utilisateur + */ + JComponent cmpOptions_; + public EbliAnimation() { task_ = new EbliAnimationTask(); } + /** + * @return the optionCp + */ + public JComponent getOptionCp() { + return cmpOptions_; + } + + /** + * @param _optionCp the optionCp to set + */ + public void setOptionCp(JComponent _optionCp) { + cmpOptions_ = _optionCp; + } + private void createTimer() { if (swingTimer_ == null) { final Runnable r = new Runnable() { public void run() { - if (task_.isFinished_) { - return; - } - if (isPaused()) { - return; - } + if (task_.isFinished_) { return; } + if (isPaused()) { return; } task_.doAnim(); } @@ -734,9 +749,7 @@ } public void active() { - if (task_.getSrc() == null) { - return; - } + if (task_.getSrc() == null) { return; } getPanel(); } @@ -750,9 +763,7 @@ } public JToggleButton getConfigureBt() { - if (pn_ != null) { - return pn_.configure_; - } + if (pn_ != null) { return pn_.configure_; } return null; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAction.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -65,11 +65,11 @@ return anim_.isPlaying(); } - protected void setAnimAdapter(final Object _o) { + public void setAnimAdapter(final Object _o) { setAnimAdapterInterface(_o instanceof EbliAnimationAdapterInterface ? (EbliAnimationAdapterInterface) _o : null); } - protected void setAnimAdapterInterface(final EbliAnimationAdapterInterface _o) { + public void setAnimAdapterInterface(final EbliAnimationAdapterInterface _o) { if (isPlaying()) { return; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationAdapterInterface.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -25,6 +25,12 @@ String getTimeStep(int _idx); /** + * @param _idx indice du pas de temps [0;getNbTimeStep()[ + * @return la valeur en sec de ce pas de temps + */ + double getTimeStepValueSec(int _idx); + + /** * @param _idx l'indice a afficher */ void setTimeStep(int _idx); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationComposite.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -7,6 +7,10 @@ */ package org.fudaa.ebli.animation; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.fudaa.ebli.commun.EbliLib; /** @@ -15,32 +19,51 @@ */ public class EbliAnimationComposite implements EbliAnimationAdapterInterface { - EbliAnimationAdapterInterface[] anims_; + final List<EbliAnimationAdapterInterface> anims_; /** * @param _anims */ public EbliAnimationComposite(final EbliAnimationAdapterInterface[] _anims) { super(); - anims_ = _anims; + anims_ = Collections.unmodifiableList(Arrays.asList(_anims)); } + /** + * @param _anims + */ + public EbliAnimationComposite(final List<EbliAnimationAdapterInterface> _anims) { + super(); + anims_ = Collections.unmodifiableList(_anims); + } + + /** + * @return the anims liste non modifiable + */ + public List<EbliAnimationAdapterInterface> getAnims() { + return anims_; + } + public int getNbTimeStep() { - return anims_[0].getNbTimeStep(); + return anims_.get(0).getNbTimeStep(); } - public String getTimeStep(final int _idx) { - return anims_[0].getTimeStep(_idx); + public double getTimeStepValueSec(int _idx) { + return anims_.get(0).getTimeStepValueSec(_idx); } - public void setTimeStep(final int _idx) { - for (int i = anims_.length - 1; i >= 0; i--) { - anims_[i].setTimeStep(_idx); - } + public String getTimeStep(final int _idx) { + return anims_.get(0).getTimeStep(_idx); } public String getTitle() { return EbliLib.getS("Sources muliples"); } + public void setTimeStep(final int _idx) { + for (EbliAnimationAdapterInterface it : anims_) { + it.setTimeStep(_idx); + } + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/animation/EbliAnimationSourceAbstract.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -40,6 +40,10 @@ return adapter_ == null ? CtuluLibString.EMPTY_STRING : adapter_.getTimeStep(_idx); } + public double getTimeStepValueSec(int _idx) { + return adapter_ == null ? 0D : adapter_.getTimeStepValueSec(_idx); + } + public void setTimeStep(final int _idx) { if (adapter_ != null) { adapter_.setTimeStep(_idx); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2008-09-21 23:14:14 UTC (rev 3965) @@ -616,4 +616,5 @@ Configuration graphique= Graphical configuration Masquer la frame= Hide the frame Dupliquer la frame= Duplicate the frame -R\xE9aliser la fusion= Perform the merging \ No newline at end of file +R\xE9aliser la fusion= Perform the merging +Anim\xE9=Animated \ No newline at end of file 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -2,19 +2,19 @@ import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.util.Collections; +import java.util.Iterator; import java.util.Map; +import java.util.Set; import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.image.CtuluImageProducer; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; -import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.graph.GraphScene; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Scene; @@ -28,6 +28,22 @@ public class EbliScene extends GraphScene<EbliNode, EbliEdge> implements CtuluImageProducer, EbliWidgetInterface<EbliSceneController> { + int idx_ = 0; + + protected String generateId() { + return CtuluLibString.getString(idx_++); + } + + public EbliWidget findById(final String _id) { + final Set obj = getObjects(); + for (final Iterator it = obj.iterator(); it.hasNext();) { + final EbliWidget w = (EbliWidget) findWidget(it.next()); + if (w.getIntern().getId().equals(_id)) return w; + + } + return null; + } + /** * model de la scene pour l affichage de ses composants */ @@ -38,7 +54,7 @@ /** * @param _listener le listener: a chaque fois le parametre new correspond au widget modifie */ - public void addPropertyChangeListener(PropertyChangeListener _listener) { + public void addPropertyChangeListener(final PropertyChangeListener _listener) { propertyChangeSupport_.addPropertyChangeListener(_listener); } @@ -48,7 +64,7 @@ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, * java.beans.PropertyChangeListener) */ - public void addPropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + public void addPropertyChangeListener(final String _propertyName, final PropertyChangeListener _listener) { propertyChangeSupport_.addPropertyChangeListener(_propertyName, _listener); } @@ -56,11 +72,11 @@ * @param _listener * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) */ - public void removePropertyChangeListener(PropertyChangeListener _listener) { + public void removePropertyChangeListener(final PropertyChangeListener _listener) { propertyChangeSupport_.removePropertyChangeListener(_listener); } - protected void firePropertyChange(Object _nodeOrEdge, String _property) { + protected void firePropertyChange(final Object _nodeOrEdge, final String _property) { propertyChangeSupport_.firePropertyChange(_property, null, _nodeOrEdge); } @@ -70,37 +86,37 @@ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, * java.beans.PropertyChangeListener) */ - public void removePropertyChangeListener(String _propertyName, PropertyChangeListener _listener) { + public void removePropertyChangeListener(final String _propertyName, final PropertyChangeListener _listener) { propertyChangeSupport_.removePropertyChangeListener(_propertyName, _listener); } /** * controller de la scene qui gere les actions et les constructions graphiques */ - private EbliSceneController controller_; + private final EbliSceneController controller_; - private class ObjectSelectProvider implements SelectProvider { + // private class ObjectSelectProvider implements SelectProvider { + // + // public boolean isAimingAllowed(final Widget widget, final Point localLocation, final boolean invertSelection) { + // return false; + // } + // + // public boolean isSelectionAllowed(final Widget widget, final Point localLocation, final boolean invertSelection) { + // return findObject(widget) != null; + // } + // + // public void select(final Widget widget, final Point localLocation, final boolean invertSelection) { + // final 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 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) { + public static void refreshScene(final Scene _sc) { _sc.validate(); _sc.repaint(); if (_sc.getView() != null) _sc.getView().repaint(); @@ -112,7 +128,7 @@ */ private CtuluCommandManager cmdMng_; - private LayerWidget interactionLayer_; + private final LayerWidget interactionLayer_; /** * la visu du graphscene @@ -141,20 +157,20 @@ } public Dimension getDefaultImageDimension() { - Rectangle rec = getBounds(); - Dimension d = new Dimension(); + final Rectangle rec = getBounds(); + final Dimension d = new Dimension(); d.height = rec.height; d.width = rec.width; return d; } public BufferedImage produceImage(final Map _params) { - Dimension d = getDefaultImageDimension(); + final Dimension d = getDefaultImageDimension(); return produceImage(d.width, d.height, _params); } public BufferedImage produceImage(final int _w, final int _h, final Map _params) { - Dimension d = getDefaultImageDimension(); + final Dimension d = getDefaultImageDimension(); final BufferedImage i = CtuluLibImage.createImage(_w, _h, _params); final Graphics2D g = i.createGraphics(); CtuluLibImage.setBestQuality(g); @@ -173,17 +189,17 @@ } @Override - protected void attachEdgeSourceAnchor(EbliEdge edge, EbliNode oldSourceNode, EbliNode sourceNode) { + protected void attachEdgeSourceAnchor(final EbliEdge edge, final EbliNode oldSourceNode, final EbliNode sourceNode) { } @Override - protected void attachEdgeTargetAnchor(EbliEdge edge, EbliNode oldTargetNode, EbliNode targetNode) { + protected void attachEdgeTargetAnchor(final EbliEdge edge, final EbliNode oldTargetNode, final EbliNode targetNode) { } @Override - protected Widget attachEdgeWidget(EbliEdge edge) { + protected Widget attachEdgeWidget(final EbliEdge edge) { return null; } @@ -200,7 +216,7 @@ // } @Override - protected Widget attachNodeWidget(EbliNode node) { + protected Widget attachNodeWidget(final EbliNode node) { // -- creation de la widget ici --// // if (node.getWidget() == null) @@ -254,7 +270,7 @@ // // } @Override - protected void notifyNodeAdded(EbliNode node, Widget widget) { + protected void notifyNodeAdded(final EbliNode node, final Widget widget) { // -- notifier tous les listener que le noeud a ete attache --// // notifyAllListenerNodeAdded(node); } @@ -269,11 +285,11 @@ /** * @param _cmdMng the cmdMng to set */ - public void setCmdMng(CtuluCommandManager _cmdMng) { + public void setCmdMng(final CtuluCommandManager _cmdMng) { cmdMng_ = _cmdMng; } - public void setVisuLayer(LayerWidget visu_) { + public void setVisuLayer(final 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-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -46,16 +46,20 @@ public final static String ROTATION = "rotation"; protected EbliWidgetController controller_; + /** + * L'identifiant unique du widget + */ + private final String id_; boolean isGroup; + boolean isInEditMode_ = false; - /** * Map contenant tous les objets graphiques de la widget generique. key: lineModel => le lignemodel du ebliWidget. * key: color => couleur de fond. */ protected Map<String, Object> propGraphique; + private EbliScene scene_; - private boolean useBorder_ = true; /** @@ -64,6 +68,7 @@ */ public EbliWidget(final EbliScene scene) { super(scene); + id_ = scene.generateId(); setScene(scene); // -- remplisage de la map de propriete grahiques --// @@ -104,6 +109,69 @@ } + public boolean canColorBackground() { + return true; + } + + public boolean canColorForeground() { + return true; + } + + public boolean canFont() { + return true; + } + + public boolean canRotate() { + return true; + } + + public boolean canTraceLigneModel() { + return true; + } + + private boolean changeTitle(final String _title, final boolean _cmd) { + final String old = getTitle(); + if (_title != null && !_title.equals(old)) { + final EbliNode n = (EbliNode) getEbliScene().findObject(this); + if (n == null) return false; + n.setTitle(_title); + getEbliScene().firePropertyChange(EbliWidget.this, "title"); + if (_cmd) { + + getEbliScene().getCmdMng().addCmd(new CtuluCommand() { + public void redo() { + changeTitle(_title, false); + } + + public void undo() { + changeTitle(old, false); + } + }); + } + return true; + + } + return false; + + } + + private boolean changeVisible(final boolean _newValue, final boolean _cmd) { + if (_newValue == isVisible()) return false; + setVisible(_newValue); + getEbliScene().firePropertyChange(EbliWidget.this, BSelecteurCheckBox.PROP_VISIBLE); + if (_cmd) getEbliScene().getCmdMng().addCmd(new CtuluCommand() { + + public void redo() { + changeVisible(_newValue, false); + } + + public void undo() { + changeVisible(!_newValue, false); + } + }); + return true; + } + public Map<String, Object> duplicateGraphicalProperties() { // FIXME il faut juste cloner la map ... final Map<String, Object> mapDupliquee = new HashMap<String, Object>(); @@ -122,15 +190,31 @@ } - public List<EbliWidgetAnimatedItem> getAnimatedItems() { - return null; - } - protected void editingStop() { isInEditMode_ = false; getEbliScene().getController().fireEditStop(this); } + /** + * @return une interface non null si la widget peut etre animee + */ + public EbliAnimatedInterface getAnimatedInterface() { + return null; + } + + public List<EbliWidgetAnimatedItem> getAnimatedItems() { + return null; + } + + public EbliWidget getIntern(){ + return this; + } + + + public boolean isAnimatedItemAlive(String _id){ + return false; + } + public Color getColorContour() { return (Color) propGraphique.get(COLORCONTOUR); } @@ -177,6 +261,13 @@ return null; } + /** + * @return the idst + */ + public String getId() { + return id_; + } + // useless public Object getMin(final String _key) { return null; @@ -279,13 +370,6 @@ } /** - * @return une interface non null si la widget peut etre animee - */ - public EbliAnimatedInterface getAnimatedInterface() { - return null; - } - - /** * Methode qui raffraichis les proprietes de la widget. */ public final void refreshMyProperties() { @@ -336,49 +420,6 @@ return true; } - private boolean changeVisible(final boolean _newValue, final boolean _cmd) { - if (_newValue == isVisible()) return false; - setVisible(_newValue); - getEbliScene().firePropertyChange(EbliWidget.this, BSelecteurCheckBox.PROP_VISIBLE); - if (_cmd) getEbliScene().getCmdMng().addCmd(new CtuluCommand() { - - public void undo() { - changeVisible(!_newValue, false); - } - - public void redo() { - changeVisible(_newValue, false); - } - }); - return true; - } - - private boolean changeTitle(final String _title, final boolean _cmd) { - final String old = getTitle(); - if (_title != null && !_title.equals(old)) { - final EbliNode n = (EbliNode) getEbliScene().findObject(this); - if (n == null) return false; - n.setTitle(_title); - getEbliScene().firePropertyChange(EbliWidget.this, "title"); - if (_cmd) { - - getEbliScene().getCmdMng().addCmd(new CtuluCommand() { - public void undo() { - changeTitle(old, false); - } - - public void redo() { - changeTitle(_title, false); - } - }); - } - return true; - - } - return false; - - } - protected void setPropertyCmd(final String _property, Object _newValue, final CtuluCommandContainer _cmd) { final Object old = propGraphique.get(_property); if (old == _newValue || (old != null && old.equals(_newValue))) return; @@ -433,24 +474,4 @@ useBorder_ = _useBorder; } - public boolean canRotate() { - return true; - } - - public boolean canColorForeground() { - return true; - } - - public boolean canColorBackground() { - return true; - } - - public boolean canTraceLigneModel() { - return true; - } - - public boolean canFont() { - return true; - } - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -34,12 +34,17 @@ public EbliAnimatedInterface getAnimatedInterface() { return getIntern().getAnimatedInterface(); } - + @Override public List<EbliWidgetAnimatedItem> getAnimatedItems() { return getIntern().getAnimatedItems(); } + @Override + public boolean isAnimatedItemAlive(String _id) { + return getIntern().isAnimatedItemAlive(_id); + } + EbliWidgetControllerActionOnly controllerBordure_ = null; public EbliWidgetController getBordureController() { @@ -115,7 +120,7 @@ if (_key.equals(FONT)) { return intern_.propGraphique.get(_key); } else - // if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } + // if (_key.equals(COLORFOND)) { return intern_.propGraphique.get(_key); } return super.getProperty(_key); } @@ -166,7 +171,7 @@ public void setIntern(EbliWidget _intern) { intern_ = _intern; } - + public boolean canRotate() { return intern_.canRotate(); } @@ -186,6 +191,5 @@ public boolean canFont() { return intern_.canFont(); } - } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimAdapter.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -6,91 +6,172 @@ import java.awt.Component; import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.Iterator; +import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Set; -import javax.swing.JDialog; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibDialog; +import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.animation.EbliAnimation; import org.fudaa.ebli.animation.EbliAnimationAction; import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; import org.fudaa.ebli.animation.EbliAnimationComposite; import org.fudaa.ebli.animation.EbliAnimationSourceAbstract; import org.fudaa.ebli.animation.EbliAnimationSourceInterface; +import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; -import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.netbeans.api.visual.widget.LayerWidget; import org.netbeans.api.visual.widget.Widget; +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuButton; +import com.sun.org.apache.bcel.internal.generic.GETSTATIC; + /** * @author deniger */ public class EbliWidgetAnimAdapter extends EbliAnimationSourceAbstract { EbliScene scene_; + EbliAnimationAction act_; + BuButton optionCp_; public EbliWidgetAnimAdapter(EbliScene _scene) { super(); scene_ = _scene; } + protected void chooseSources() { + LayerWidget widget = scene_.getVisu(); + EbliWidgetAnimTreeNode animsNode = new EbliWidgetAnimTreeNode(); + List<EbliWidgetAnimTreeNode> animItems = new ArrayList<EbliWidgetAnimTreeNode>(); + findAnimsTreeNode(widget, animsNode, animItems); + CtuluDialogPanel pn = new CtuluDialogPanel(); + pn.setLayout(new BuBorderLayout()); + + JXTreeTable treeTable = new JXTreeTable(new EbliWidgetAnimateTreeTableModel(animsNode, Arrays.asList(EbliLib + .getS("Titre"), EbliLib.getS("Anim\xE9")))); + treeTable.expandAll(); + treeTable.getColumnModel().getColumn(0).setPreferredWidth(200); + treeTable.getColumnModel().getColumn(1).setPreferredWidth(150); + treeTable.setTreeCellRenderer(new AnimTreeCellRenderer()); + pn.add(new JScrollPane(treeTable)); + CtuluDialog dialog = pn.createDialog(CtuluLibSwing.getActiveWindow()); + if (CtuluDialogPanel.isOkResponse(dialog.afficheDialogModal(optionCp_.getLocationOnScreen(), null))) { + List<EbliWidgetAnimatedItem> adapter = new ArrayList<EbliWidgetAnimatedItem>(); + for (EbliWidgetAnimTreeNode item : animItems) { + if (item.isSelected()) adapter.add(((EbliWidgetAnimatedItem) item.getUserObject())); + } + if (adapter.isEmpty()) { + act_.setAnimAdapter(null); + } else { + act_.setAnimAdapter(new EbliWidgetAnimationComposition(scene_, adapter)); + } + } + + } + @SuppressWarnings("serial") public EbliAnimationAction createAction() { - EbliAnimationAction act = new EbliAnimationAction(this) { - @Override - public void updateBeforeShow() { - EbliAnimationAdapterInterface adapter = findAnimAdapter(); - EbliWidgetAnimAdapter.this.setAdapter(adapter); - super.setAnimAdapterInterface(adapter); - updateStateBeforeShow(); + if (act_ != null) return act_; + EbliAnimation anim = new EbliAnimation(); + optionCp_ = new BuButton(EbliLib.getS("Choisir les sources")); + optionCp_.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent _e) { + chooseSources(); } + }); + anim.setOptionCp(optionCp_); + act_ = new EbliAnimationAction(this, anim) { + // @Override + // public void updateBeforeShow() { + // EbliAnimationAdapterInterface adapter = findAnimAdapter(); + // EbliWidgetAnimAdapter.this.setAdapter(adapter); + // super.setAnimAdapterInterface(adapter); + // updateStateBeforeShow(); + // } }; - act.setEnabled(true); - return act; + act_.setEnabled(true); + return act_; } - public EbliAnimationAdapterInterface findAnimAdapter() { - LayerWidget widget = scene_.getVisu(); - DefaultMutableTreeTableNode animsNode = new DefaultMutableTreeTableNode(); - findAnimsTreeNode(widget, animsNode); - JDialog d = new JDialog(); - d.setContentPane(new JXTreeTable(new DefaultTreeTableModel(animsNode))); - d.pack(); - d.setVisible(true); - return null; + private static class AnimTreeCellRenderer extends DefaultTreeCellRenderer { + + @Override + public Component getTreeCellRendererComponent(JTree _tree, Object _value, boolean _sel, boolean _expanded, + boolean _leaf, int _row, boolean _hasFocus) { + Component res = super.getTreeCellRendererComponent(_tree, _value, _sel, _expanded, _leaf, _row, _hasFocus); + if (_value != null) { + DefaultMutableTreeTableNode node = (DefaultMutableTreeTableNode) _value; + EbliWidgetAnimatedItem object = (EbliWidgetAnimatedItem) node.getUserObject(); + if (object != null) { + setText(object.getTitle()); + setIcon(object.getIcon()); + } + } + return res; + } + } - private void findAnimsTreeNode(Widget widget, DefaultMutableTreeTableNode animsNode) { - List<Widget> children = widget.getChildren(); + // public EbliAnimationAdapterInterface findAnimAdapter() { + // LayerWidget widget = scene_.getVisu(); + // EbliWidgetAnimTreeNode animsNode = new EbliWidgetAnimTreeNode(); + // findAnimsTreeNode(widget, animsNode); + // JDialog d = new JDialog(); + // JXTreeTable treeTable = new JXTreeTable(new EbliWidgetAnimateTreeTableModel(animsNode, Arrays + // .asList("Title", "Use"))); + // treeTable.setTreeCellRenderer(new AnimTreeCellRenderer()); + // d.setContentPane(treeTable); + // d.pack(); + // d.setVisible(true); + // return null; + // } + + private void findAnimsTreeNode(Widget _widget, EbliWidgetAnimTreeNode _animsNode, + List<EbliWidgetAnimTreeNode> _animItems) { + EbliWidgetAnimationComposition adapter = (EbliWidgetAnimationComposition) getAdapter(); + List<Widget> children = _widget.getChildren(); for (Widget w : children) { EbliWidget ew = (EbliWidget) w; EbliNode n = (EbliNode) scene_.findObject(ew); - if (n.getWidget() == ew) { + if (n.getWidget() == ew && ew.isVisible()) { EbliAnimatedInterface animatedInterface = ew.getAnimatedInterface(); if (animatedInterface != null) { - EbliAnimationSourceInterface animationSrc = animatedInterface.getAnimationSrc(); - DefaultMutableTreeTableNode treeNode = new DefaultMutableTreeTableNode(new EbliWidgetAnimatedItem( - animationSrc, null, n.getTitle())); + EbliWidgetAnimTreeNode treeNode = new EbliWidgetAnimTreeNode(new EbliWidgetAnimatedItem(animationSrc, null, + ew.getId(), null, n.getTitle())); List<EbliWidgetAnimatedItem> animatedItems = ew.getAnimatedItems(); if (CtuluLibArray.isNotEmpty(animatedItems)) { for (EbliWidgetAnimatedItem ebliWidgetAnimatedItem : animatedItems) { - treeNode.add(new DefaultMutableTreeTableNode(ebliWidgetAnimatedItem)); + EbliWidgetAnimTreeNode animTreeNode = new EbliWidgetAnimTreeNode(ebliWidgetAnimatedItem); + if (adapter != null && adapter.contains(ebliWidgetAnimatedItem.getAnimated())) { + animTreeNode.selected_ = true; + } + treeNode.add(animTreeNode); + _animItems.add(animTreeNode); } - animsNode.add(treeNode); + _animsNode.add(treeNode); } } else { - findAnimsTreeNode(ew, animsNode); + findAnimsTreeNode(ew, _animsNode, _animItems); } } @@ -113,6 +194,14 @@ return scene_.produceImage(_params); } - public void setVideoMode(boolean _b) {} + public void setVideoMode(boolean _b) { + if (_b) { + EbliWidgetAnimationComposition cmp = (EbliWidgetAnimationComposition) getAdapter(); + if (cmp.removeKilledItems()) { + if (cmp.getNbItems() == 0) act_.setAnimAdapter(null); + } + } + } + } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimTreeNode.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -0,0 +1,46 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; + +public class EbliWidgetAnimTreeNode extends DefaultMutableTreeTableNode { + boolean selected_; + + public EbliWidgetAnimTreeNode() {} + + public EbliWidgetAnimTreeNode(EbliWidgetAnimatedItem _userObject) { + super(_userObject); + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public Object getValueAt(int _column) { + if (_column == 1) return Boolean.valueOf(selected_); + return super.getValueAt(_column); + } + + @Override + public boolean isEditable(int _column) { + return _column == 1; + } + + /** + * @return the selected + */ + public boolean isSelected() { + return selected_; + } + + @Override + public void setValueAt(Object _value, int _column) { + Boolean b = (Boolean) _value; + selected_ = b.booleanValue(); + } +} \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimateTreeTableModel.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -0,0 +1,53 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import java.util.List; + +import javax.swing.tree.TreePath; + +import org.jdesktop.swingx.treetable.DefaultTreeTableModel; +import org.jdesktop.swingx.treetable.TreeTableNode; + +/** + * @author deniger + */ +public class EbliWidgetAnimateTreeTableModel extends DefaultTreeTableModel { + + public EbliWidgetAnimateTreeTableModel() { + super(); + } + + public EbliWidgetAnimateTreeTableModel(TreeTableNode _root) { + super(_root); + } + + public EbliWidgetAnimateTreeTableModel(TreeTableNode _root, List<?> _columnNames) { + super(_root, _columnNames); + } + + + @Override + public Class<?> getColumnClass(int _column) { + if (_column == 1) return Boolean.class; + return super.getColumnClass(_column); + } + + @Override + public void setValueAt(Object _value, Object _node, int _column) { + super.setValueAt(_value, _node, _column); + TreeTableNode ttn = (TreeTableNode) _node; + + if (_column == 1 && !ttn.isLeaf()) { + int n = ttn.getChildCount(); + for (int i = 0; i < n; i++) { + TreeTableNode child = ttn.getChildAt(i); + child.setValueAt(_value, _column); + modelSupport.firePathChanged(new TreePath(getPathToRoot(child))); + } + } + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimatedItem.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -4,9 +4,13 @@ */ package org.fudaa.ebli.visuallibrary.animation; +import java.lang.ref.WeakReference; + import javax.swing.Icon; import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; /** * @author deniger @@ -14,42 +18,60 @@ public class EbliWidgetAnimatedItem { /** - * L'interface d'animation + * L'interface d'animation. On utilise une weakreference car l'inteface peut etre supprime de la scene et toujours + * reference dans la liste des anim\xE9es */ - private EbliAnimationAdapterInterface animated_; + private final WeakReference<EbliAnimationAdapterInterface> animated_; /** - * L'icone + * L'icone. On utilise une weakreference car l'inteface peut etre supprime de la scene et toujours reference dans la + * liste des anim\xE9es */ - private Icon icon_; + private final WeakReference<Icon> icon_; /** * L'identifiant */ - private String id_; - - public EbliWidgetAnimatedItem() { - } - - - public EbliWidgetAnimatedItem(EbliAnimationAdapterInterface _animated, Icon _icon, String _id) { + private final String id_; + private final String widgetId_; + private final String title_; + + public EbliWidgetAnimatedItem(EbliAnimationAdapterInterface _animated, Icon _icon, String _widgetId, String _id, + String _title) { super(); - animated_ = _animated; - icon_ = _icon; + animated_ = new WeakReference<EbliAnimationAdapterInterface>(_animated); + icon_ = new WeakReference<Icon>(_icon); id_ = _id; + widgetId_ = _widgetId; + title_ = _title; } /** + * @return the widgetId + */ + public String getWidgetId() { + return widgetId_; + } + + public boolean isAlive(EbliScene _scene) { + if (animated_.get() == null) return false; + EbliWidget w = _scene.findById(getWidgetId()); + if (w == null) return false; + return w.isAnimatedItemAlive(getId()); + + } + + /** * @return the animated */ public EbliAnimationAdapterInterface getAnimated() { - return animated_; + return animated_.get(); } /** * @return the icon */ public Icon getIcon() { - return icon_; + return icon_.get(); } /** @@ -60,24 +82,10 @@ } /** - * @param _animated the animated to set + * @return the title */ - public void setAnimated(EbliAnimationAdapterInterface _animated) { - animated_ = _animated; + public String getTitle() { + return title_; } - /** - * @param _icon the icon to set - */ - public void setIcon(Icon _icon) { - icon_ = _icon; - } - - /** - * @param _id the id to set - */ - public void setId(String _id) { - id_ = _id; - } - } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/animation/EbliWidgetAnimationComposition.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -0,0 +1,136 @@ +/** + * Licence GPL + * Copyright Genesis + */ +package org.fudaa.ebli.visuallibrary.animation; + +import gnu.trove.TIntArrayList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ebli.animation.EbliAnimationAdapterInterface; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.visuallibrary.EbliScene; + +/** + * @author deniger + */ +public class EbliWidgetAnimationComposition implements EbliAnimationAdapterInterface { + + final List<EbliWidgetAnimatedItem> anims_; + final List<TIntArrayList> tsIdx_ = new ArrayList<TIntArrayList>(); + final EbliScene scene_; + final double eps = 1E-3; + + public EbliWidgetAnimationComposition(EbliScene _scene, List<EbliWidgetAnimatedItem> _items) { + super(); + scene_ = _scene; + anims_ = _items; + buildTs(); + } + + private void buildTs() { + tsIdx_.clear(); + if (anims_.isEmpty()) return; + final int size = anims_.size(); + if (size == 1) { + tsIdx_.add(null); + return; + } + EbliWidgetAnimatedItem it = anims_.get(0); + int nbTime = it.getAnimated().getNbTimeStep(); + for (int i = size - 1; i >= 0; i--) { + tsIdx_.add(new TIntArrayList(nbTime)); + } + + int[] indexes = new int[size - 1]; + for (int i = 0; i < nbTime; i++) { + boolean ok = findNext(indexes, it.getAnimated().getTimeStepValueSec(i)); + if (ok) { + tsIdx_.get(0).add(i); + for (int k = size - 1; k > 0; k--) { + tsIdx_.get(k).add(indexes[k - 1]); + } + } + } + + } + + private boolean findNext(int[] idx, double _v) { + Arrays.fill(idx, -1); + int nb = anims_.size(); + boolean ok = true; + for (int i = 1; i < nb; i++) { + int res = findIn(anims_.get(i).getAnimated(), _v); + idx[i - 1] = res; + if (res < 0) ok = false; + } + return ok; + } + + private int findIn(EbliAnimationAdapterInterface _src, double _val) { + for (int i = 0; i < _src.getNbTimeStep(); i++) { + if (CtuluLib.isZero(_val - _src.getTimeStepValueSec(i), eps)) return i; + } + return -1; + } + + public int getNbItems() { + return anims_.size(); + } + + public boolean contains(EbliAnimationAdapterInterface _anim) { + for (EbliWidgetAnimatedItem it : anims_) { + if (CtuluLib.isEquals(_anim, it.getAnimated())) return true; + } + return false; + } + + protected boolean removeKilledItems() { + boolean removed = false; + for (int i = anims_.size() - 1; i >= 0; i--) { + if (!anims_.get(i).isAlive(scene_)) { + anims_.remove(i); + tsIdx_.remove(i); + removed = true; + } + + } + if (removed) buildTs(); + return removed; + } + + protected int getTsFor(int _animsIdx, int _tidx) { + TIntArrayList list = tsIdx_.get(_animsIdx); + return list == null ? _tidx : list.get(_tidx); + } + + public int getNbTimeStep() { + TIntArrayList list = tsIdx_.get(0); + return list == null ? anims_.get(0).getAnimated().getNbTimeStep() : tsIdx_.get(0).size(); + } + + public String getTimeStep(final int _idx) { + return anims_.get(0).getAnimated().getTimeStep(getTsFor(0, _idx)); + } + + public double getTimeStepValueSec(int _idx) { + return anims_.get(0).getAnimated().getTimeStepValueSec(getTsFor(0, _idx)); + } + + public String getTitle() { + return EbliLib.getS("Sources muliples"); + } + + public void setTimeStep(final int _idx) { + int idx = 0; + for (EbliWidgetAnimatedItem it : anims_) { + it.getAnimated().setTimeStep(getTsFor(idx++, _idx)); + } + } + +} 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetCalqueLegende.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -123,8 +123,8 @@ // -- test si il s agit d un widget plage --// if (widget instanceof EbliWidgetPlage) { EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - new_widget.getIntern().setFont(ft); - new_widget.getIntern().majText(); + new_widget.getInternWidget().setFont(ft); + new_widget.getInternWidget().majText(); // -- mise du nouveau bounds max --// Rectangle boundsIntern = new_widget.getIntern().getBounds(); @@ -286,7 +286,7 @@ // -- test si il s agit d un widget plage --// if (widget instanceof EbliWidgetPlage) { EbliWidgetPlage new_widget = (EbliWidgetPlage) widget; - maxWidth = Math.max(maxWidth, ftm.stringWidth(new_widget.getIntern().getLabel())); + maxWidth = Math.max(maxWidth, ftm.stringWidth(new_widget.getInternWidget().getLabel())); } } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetPlage.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -97,15 +97,15 @@ // setEnabled(false); } -// public String formatte(String texte) { -// if (texte.length() < plage_.getLegende().length()) { -// -// return texte; -// } else return texte.substring(0, plage_.getLegende().length()); -// -// } + // public String formatte(String texte) { + // if (texte.length() < plage_.getLegende().length()) { + // + // return texte; + // } else return texte.substring(0, plage_.getLegende().length()); + // + // } - public InternWidget getIntern() { + public InternWidget getInternWidget() { return intern_; } @@ -118,7 +118,7 @@ intern_.setLabel(plage_.getLegende()); } - public void setIntern(InternWidget intern_) { + public void setInternLabel(InternWidget intern_) { this.intern_ = intern_; } 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -216,10 +216,16 @@ List<EbliWidgetAnimatedItem> res = new ArrayList<EbliWidgetAnimatedItem>(20); for (int i = 0; i < cqs.length; i++) { if (cqs[i].isVisible() && cqs[i] instanceof EbliAnimationAdapterInterface) { - res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], cqs[i].getName())); + res.add(new EbliWidgetAnimatedItem((EbliAnimationAdapterInterface) cqs[i], cqs[i], getId(), cqs[i].getName(), + cqs[i].getTitle())); } } return res; } + public boolean isAnimatedItemAlive(String _id) { + BCalque cq = calquePanel_.getVueCalque().getCalque().getCalqueParNom(_id); + return cq != null && cq.isVisible(); + } + } Deleted: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliCheckBoxPanel.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -1,36 +0,0 @@ -package org.fudaa.ebli.visuallibrary.tree; - -import com.memoire.bu.BuCheckBox; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; - -/** - * Panel de renderer pour le tree - * @author genesis - * - */ -public class EbliCheckBoxPanel extends BuPanel{ - - - private static final long serialVersionUID = -608817114677578183L; - BuCheckBox checkBox; - BuLabel labelRenderer; - public EbliCheckBoxPanel(){ - setOpaque(false); - } - - public void construct(){ - if(labelRenderer !=null){ - labelRenderer.setOpaque(false); - add(labelRenderer); - } - if(checkBox !=null){ - checkBox.setOpaque(false); - add(checkBox); - } - setOpaque(false); - - - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliJXTreeTableCellRenderer.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -36,19 +36,6 @@ public EbliJXTreeTableCellRenderer() { returnLabel.setOpaque(false); returnLabel.setHorizontalAlignment(BuLabel.LEFT); - /* - * Font fontValue; fontValue = UIManager.getFont("Tree.font"); if (fontValue - * != null) { leafRenderer.setFont(fontValue); } Boolean booleanValue = - * (Boolean) UIManager .get("Tree.drawsFocusBorderAroundIcon"); - * leafRenderer.setFocusPainted((booleanValue != null) && - * (booleanValue.booleanValue())); - * - * selectionBorderColor = UIManager.getColor("Tree.selectionBorderColor"); - * selectionForeground = UIManager.getColor("Tree.selectionForeground"); - * selectionBackground = UIManager.getColor("Tree.selectionBackground"); - * textForeground = UIManager.getColor("Tree.textForeground"); - * textBackground = UIManager.getColor("Tree.textBackground"); - */ } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, @@ -89,59 +76,5 @@ return returnLabel; } - /* - * public Component getTreeCellRendererComponent(JTree tree, Object value, - * boolean selected, boolean expanded, boolean leaf, int row, boolean - * hasFocus) { - * - * - * BuLabel returnLabel = null; BuCheckBox returnValue = null; // cas - * particulier renderer: on met un checkbox que si on est feuille et pqs root - * (= cqs ou lqyer depourvu d objet graphique) if (leaf && - * !((DefaultMutableTreeNode) value).isRoot()) { - * - * // -- recuperation du node --// Object userObject = - * ((DefaultMutableTreeNode) value).getUserObject(); - * - * EbliNodeDefault node = null; if (userObject instanceof EbliNode) { node = - * (EbliNodeDefault) (((DefaultMutableTreeNode) value).getUserObject()); - * - * //System.err.println("c est un EbliNode!!! ROW: " + row); - * - * // -- creation d'une nouvelle checkbox aui sera ainsi unique pour chaque // - * composant returnValue=new BuCheckBox(); //leafRenderer.setOpaque(false); - * - * returnValue.setText(node.getTitle()); - * returnValue.setSelected(node.getWidget().isVisible()); - * - * - * returnLabel=new BuLabel(this.iconLeafEnabled); - * - * - * - * returnLabel.setEnabled(node.getWidget().isVisible()); } - * - * } else { returnLabel=new BuLabel(((DefaultMutableTreeNode) - * value).toString(),this.iconRoot); //returnValue = - * nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, - * expanded, leaf, row, hasFocus); - * - * } - * - * - * //-- creation du panel avec les informations --// leafRenderer=new - * EbliCheckBoxPanel(); - * - * if(returnLabel!=null) leafRenderer.labelRenderer=returnLabel; - * - * if(returnValue!=null ) leafRenderer.checkBox=returnValue; - * - * //-- construction du composant --// leafRenderer.construct(); - * - * // qccessible en fonction du tree - * leafRenderer.setEnabled(tree.isEnabled()); if(selected){ - * leafRenderer.setBackground(Color.BLUE); } else - * leafRenderer.setBackground(Color.WHITE); return leafRenderer; } - */ } Deleted: 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-09-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetCellRendererBuilder.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -1,53 +0,0 @@ -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.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(); - 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); - - } - - public int getIconWidth() { - return 16; - } - - public int getIconHeight() { - return 16; - } - }; - return ic; - } - } - - @SuppressWarnings("serial") - public static TreeCellRenderer getNodeIconCellRenderer() { - return new DefaultTreeRenderer(new WidgetIconValue(), new StringValue() { - - public String getString(Object _value) { - return CtuluLibString.EMPTY_STRING; - } - }); - } -} 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-21 23:13:17 UTC (rev 3964) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-21 23:14:14 UTC (rev 3965) @@ -71,7 +71,6 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; -import org.fudaa.ebli.visuallibrary.tree.EbliWidgetCellRendererBuilder; import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; import org.jdesktop.swingx.JXTreeTable; import org.netbeans.api.visual.action.ActionFactory; @@ -350,7 +349,7 @@ JXTreeTable view = new JXTreeTable(tree); - view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); +// view.setTreeCellRenderer(EbliWidgetCellRendererBuilder.getNodeIconCellRenderer()); p.add(new JScrollPane(view), BuBorderLayout.WEST); g.setPreferredSize(new Dimension(200, 300)); g.setSize(g.getPreferredSize()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-09-25 20:31:19
|
Revision: 3987 http://fudaa.svn.sourceforge.net/fudaa/?rev=3987&view=rev Author: deniger Date: 2008-09-25 20:31:07 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java 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-25 19:42:20 UTC (rev 3986) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-09-25 20:31:07 UTC (rev 3987) @@ -53,7 +53,7 @@ * @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); @@ -123,9 +123,7 @@ } private void computeXRange() { - if (xRange_ != null) { - return; - } + if (xRange_ != null) { return; } xRange_ = new CtuluRange(); final EGGrapheModel m = getModel(); if (FuLog.isDebug()) { @@ -247,7 +245,11 @@ public void componentShown(final ComponentEvent _e) {} - public EGMarges computeMarges(Graphics2D _gr ) { + public EGMarges computeMarges() { + return computeMarges((Graphics2D) getGraphics()); + } + + public EGMarges computeMarges(Graphics2D _gr) { final EGMarges m = new EGMarges(); final EGAxeHorizontal xaxe = transformer_.getXAxe(); if (xaxe == null) { @@ -330,9 +332,7 @@ } public void dessine(final Graphics _g, final int _w, final int _h, final boolean _fill) { - if (!isVisible()) { - return; - } + if (!isVisible()) { return; } final Graphics2D g2d = (Graphics2D) _g; BuLib.setAntialiasing(g2d); final Color old = _g.getColor(); @@ -348,7 +348,7 @@ g2d.setColor(Color.black); final EGGrapheModel model = getModel(); final int nbElement = model.getNbEGObject(); - transformer_.initFor(g2d,this); + transformer_.initFor(g2d, this); // dessine axe horizontal final Shape oldClip = g2d.getClip(); // g2d.clip(new Rectangle(xMarge, yMarge, wMarge, hMarge)); @@ -403,9 +403,7 @@ final EGAxeVertical v = (EGAxeVertical) iterator.key(); v.dessine(g2d, transformer_, iterator.value()); } - if (transformer_.getXAxe() == null) { - return; - } + if (transformer_.getXAxe() == null) { return; } transformer_.getXAxe().dessine(g2d, transformer_); g2d.setColor(old); @@ -459,9 +457,9 @@ } public void setModel(EGGrapheModel model) { - model_ = model; + model_ = model; } - + public EGObject getObject(final int _i) { return getModel().getEGObject(_i); } @@ -471,9 +469,7 @@ } public int getOffSet(final EGAxeVertical _axe) { - if (axeOffset_ != null) { - return axeOffset_.get(_axe); - } + if (axeOffset_ != null) { return axeOffset_.get(_axe); } return 0; } @@ -526,9 +522,7 @@ public boolean isVerticalAxisConfigurationMod(final EGObject[] _o) { if (objectInitAxe_ != null && _o != null && _o.length > 0) { for (int i = _o.length - 1; i >= 0; i--) { - if (objectInitAxe_.containsKey(_o[i])) { - return true; - } + if (objectInitAxe_.containsKey(_o[i])) { return true; } } } return false; @@ -565,9 +559,7 @@ public void restore() { updateRepere(); - if (transformer_.getXAxe() == null) { - return; - } + if (transformer_.getXAxe() == null) { return; } restoreAxeX(); final Map axeYRange = new HashMap(); final EGGrapheModel m = getModel(); @@ -629,7 +621,7 @@ } public void setRapide(final boolean _b) { - // on ne fait rien + // on ne fait rien } public final void setUserXRange(final CtuluRange _rangeSpecByUser) { @@ -746,9 +738,7 @@ } public void useOneAxe(final EGAxeVertical[] _axes, final String _s, final CtuluRange _r) { - if (_axes == null || _axes.length < 2) { - return; - } + if (_axes == null || _axes.length < 2) { return; } final EGAxeVertical newAxe = new EGAxeVertical(_axes[0]); String t = _s; if (_s == null) { @@ -829,7 +819,7 @@ final BufferedImage i = CtuluLibImage.createImage(_w, _h, _params); final Graphics2D g2d = i.createGraphics(); CtuluLibImage.setBestQuality(g2d); - if(CtuluLibImage.mustFillBackground(_params)){ + if (CtuluLibImage.mustFillBackground(_params)) { g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, _w, _h); } @@ -856,7 +846,7 @@ final int width = (int) (transformer_.getWSansMarges() * factor / 2); final int height = (int) (transformer_.getHSansMarges() * factor / 2); /* - * int width = (int) (factor * getWidth() / 2); int height = (int) (factor * getHeight() / 2); + * int width = (int) (factor getWidth() / 2); int height = (int) (factor getHeight() / 2); */setZoomOn(new Point(x + width, y + height), new Point(x - width, y - height)); } @@ -867,63 +857,55 @@ } public EGGraphe duplicate() { - EGGrapheDuplicator duplicator=new EGGrapheDuplicator(); + EGGrapheDuplicator duplicator = new EGGrapheDuplicator(); EGGraphe duplic = new EGGraphe(this.getModel().duplicate(duplicator)); duplic.autoRestore_ = this.autoRestore_; duplic.cache_ = null; - //on ne partage pas les undo/redo + // on ne partage pas les undo/redo duplic.cmd_ = new CtuluCommandManager(); - //TODO: il y a soucis: les axes verticaux sont dupliqu\xE9 de partout et on n'a plus les ref + // TODO: il y a soucis: les axes verticaux sont dupliqu\xE9 de partout et on n'a plus les ref // -- copie des axes --// - if(this.axeOffset_!=null){ - duplic.axeOffset_=new TObjectIntHashMap(); - int[] values=this.axeOffset_.getValues(); - Object[] liste=this.axeOffset_.keys(); + 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(duplicator.duplicateAxeV(axe), value); } } - duplic.coeffLarger_=this.coeffLarger_; + 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();) { - Object objet = it.next(); + + Set set = this.objectInitAxe_.keySet(); + Object[] vals = this.objectInitAxe_.values().toArray(); + int cpt = 0; + for (Iterator it = set.iterator(); it.hasNext();) { + Object objet = it.next(); if (objet instanceof EGAxeVertical) { - EGAxeVertical axe = (EGAxeVertical) objet; - duplic.objectInitAxe_.put(duplicator.duplicateAxeV(axe), vals[cpt++]); - } + 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) - duplic.xRange_ = new CtuluRange(this.xRange_); - if (this.transformer_ != null) - duplic.transformer_ = this.transformer_.duplicate(duplicator); - if (this.xRangeSpecByUser_ != null) - duplic.xRangeSpecByUser_ = new CtuluRange(this.xRangeSpecByUser_); + else if (objet instanceof EGGroup) { + EGGroup groupe = (EGGroup) objet; + duplic.objectInitAxe_.put(groupe.duplicate(duplicator), vals[cpt++]); + } + } + if (this.xRange_ != null) duplic.xRange_ = new CtuluRange(this.xRange_); + if (this.transformer_ != null) duplic.transformer_ = this.transformer_.duplicate(duplicator); + if (this.xRangeSpecByUser_ != null) duplic.xRangeSpecByUser_ = new CtuluRange(this.xRangeSpecByUser_); - - -} + } return duplic; } - } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestEGGraphe.java 2008-09-25 20:31:07 UTC (rev 3987) @@ -0,0 +1,157 @@ +/** + * @creation 21 juin 2004 + * @modification $Date: 2007-01-17 10:45:17 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ebli.all; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JTree; +import javax.swing.WindowConstants; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuScrollPane; + +import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; + +import org.fudaa.ebli.courbe.EGAxeHorizontal; +import org.fudaa.ebli.courbe.EGAxeVertical; +import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGCourbeModelDefault; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; + +/** + * @author Fred Deniger + * @version $Id: TestGraphe2.java,v 1.8 2007-01-17 10:45:17 deniger Exp $ + */ +public final class TestEGGraphe { + + private TestEGGraphe() { + super(); + } + + /** + * @param _args non utilise + */ + public static void main(final String[] _args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + launch(); + } + }); + + } + + private static void launch() { + final EGGrapheTreeModel grapheModel = new EGGrapheTreeModel(); + final EGGraphe g = new EGGraphe(grapheModel); + final EGAxeHorizontal x = new EGAxeHorizontal(false); + x.setTitre("temps"); + x.setUnite("sec"); + x.setBounds(0.0001, 1000000); + x.setAxisIterator(new LogarithmicNumberIterator()); + x.setGraduations(true); + g.setXAxe(x); + EGGroup gr = new EGGroup(); + gr.setTitle("gr 1"); + EGCourbeModelDefault m = new EGCourbeModelDefault(new double[] { 0.0001, 3, 4, 1000000 }, new double[] { 10000, 4, + 5, 3 }); + EGCourbeChild c = new EGCourbeChild(gr); + m.setTitle("toto bleue"); + c.setModel(m); + c.setAspectContour(Color.cyan); + + gr.addEGComponent(c); + + m = new EGCourbeModelDefault(new double[] { 0.0002, 5, 7, 900000 }, new double[] { 0.001, 1, 3, 4 }); + c = new EGCourbeChild(gr); + c.setAspectContour(Color.RED); + m.setTitle("toto rouge"); + c.setModel(m); + + gr.addEGComponent(c); + + EGAxeVertical y = new EGAxeVertical(); + y.setGraduations(true); + y.setGrille(new TraceLigneModel(TraceLigne.LISSE, 1, Color.LIGHT_GRAY)); + y.setDroite(true); + y.setAxisIterator(new LogarithmicNumberIterator()); + y.setBounds(0.0001, 10000); + y.setLineColor(Color.blue); + y.setTitre("essai 2"); + gr.setAxeY(y); + grapheModel.add(gr); + gr = new EGGroup(); + gr.setTitle("gr 2"); + m = new EGCourbeModelDefault(new double[] { 1, 8, 9, 10 }, new double[] { 10, 4, 2, 24 }); + c = new EGCourbeChild(gr); + c.setAspectContour(Color.yellow); + m.setTitle("toto jaune"); + c.setModel(m); + gr.addEGComponent(c); + y = new EGAxeVertical(); + y.setGraduations(true); + y.setBounds(0, 55); + y.setTitre("essai 1"); + gr.setAxeY(y); + gr.addEGComponent(c); + m = new EGCourbeModelDefault(new double[] { 1, 3, 4, 5 }, new double[] { 14, 54, 25, 43 }); + c = new EGCourbeChild(gr); + m.setTitle("toto vert"); + c.setAspectContour(Color.green); + c.setModel(m); + gr.addEGComponent(c); + grapheModel.add(gr); + final JFrame f = new JFrame(); + f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + final BuPanel p = new BuPanel(); + p.setLayout(new BuBorderLayout()); + + g.setPreferredSize(new Dimension(200, 300)); + g.setSize(g.getPreferredSize()); + final JTree t = new JTree(grapheModel); + t.setSelectionModel(grapheModel.getSelectionModel()); + t.setRootVisible(false); + p.add(new BuScrollPane(t), BuBorderLayout.EAST); + p.doLayout(); + f.setContentPane(p); + final EGFillePanel pn = new EGFillePanel(g); + + p.add(pn, BuBorderLayout.CENTER); + final JMenu menu = new JMenu(); + menu.setName("essai"); + menu.setText("essai"); + pn.fillSpecificMenu(menu); + final JMenuBar b = new JMenuBar(); + b.add(menu); + f.setJMenuBar(b); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + f.pack(); + f.setVisible(true); + g.axeUpdated(); + g.fullRepaint(); + +// EventQueue.invokeLater(new Runnable() { +// public void run() { +// g.axeUpdated(); +// // g.restore(); +// +// } +// }); + } +} \ No newline at end of file Copied: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java (from rev 3965, branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java 2008-09-25 20:31:07 UTC (rev 3987) @@ -0,0 +1,486 @@ +/** + * @creation 21 juin 2004 + * @modification $Date: 2007-01-17 10:45:17 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ebli.all; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; + +import javax.swing.Box; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JToolBar; +import javax.swing.JTree; +import javax.swing.WindowConstants; +import javax.swing.table.DefaultTableModel; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.CtuluUIDefault; +import org.fudaa.ctulu.gui.CtuluHtmlEditorPanel; +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; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.courbe.EGAxeHorizontal; +import org.fudaa.ebli.courbe.EGAxeVertical; +import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGCourbeModelDefault; +import org.fudaa.ebli.courbe.EGFillePanel; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; +import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.trace.TraceLigne; +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.EbliWidgetCreatorShape; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorTextEditor; +import org.fudaa.ebli.visuallibrary.EbliWidgetCreatorTextLabel; +import org.fudaa.ebli.visuallibrary.EbliWidgetDBLFleche; +import org.fudaa.ebli.visuallibrary.EbliWidgetShape; +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.EbliWidgetActionFont; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionForeGround; +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.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.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende; +import org.fudaa.ebli.visuallibrary.tree.EbliWidgetJXTreeTableModel; +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; +import org.netbeans.api.visual.widget.ComponentWidget; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuResource; +import com.memoire.bu.BuScrollPane; + +/** + * @author Fred Deniger + * @version $Id: TestGraphe2.java,v 1.8 2007-01-17 10:45:17 deniger Exp $ + */ +public final class TestVisualLibrary { + + private TestVisualLibrary() { + super(); + } + + private static EGGraphe createGraphe() { + final EGGrapheTreeModel grapheModel = new EGGrapheTreeModel(); + final EGGraphe g = new EGGraphe(grapheModel); + final EGAxeHorizontal x = new EGAxeHorizontal(false); + x.setTitre("temps"); + x.setUnite("sec"); + x.setBounds(0.0001, 1000000); + x.setAxisIterator(new LogarithmicNumberIterator()); + x.setGraduations(true); + g.setXAxe(x); + EGGroup gr = new EGGroup(); + gr.setTitle("gr 1"); + EGCourbeModelDefault m = new EGCourbeModelDefault(new double[] { 0.0001, 3, 4, 1000000 }, new double[] { 10000, 4, + 5, 3 }); + EGCourbeChild c = new EGCourbeChild(gr); + m.setTitle("toto bleue"); + c.setModel(m); + c.setAspectContour(Color.cyan); + + gr.addEGComponent(c); + + m = new EGCourbeModelDefault(new double[] { 0.0002, 5, 7, 900000 }, new double[] { 0.001, 1, 3, 4 }); + c = new EGCourbeChild(gr); + c.setAspectContour(Color.RED); + m.setTitle("toto rouge"); + c.setModel(m); + + gr.addEGComponent(c); + + EGAxeVertical y = new EGAxeVertical(); + y.setGraduations(true); + y.setGrille(new TraceLigneModel(TraceLigne.LISSE, 1, Color.LIGHT_GRAY)); + y.setDroite(true); + y.setAxisIterator(new LogarithmicNumberIterator()); + y.setBounds(0.0001, 10000); + y.setLineColor(Color.blue); + y.setTitre("essai 2"); + gr.setAxeY(y); + grapheModel.add(gr); + gr = new EGGroup(); + gr.setTitle("gr 2"); + m = new EGCourbeModelDefault(new double[] { 1, 8, 9, 10 }, new double[] { 10, 4, 2, 24 }); + c = new EGCourbeChild(gr); + c.setAspectContour(Color.yellow); + m.setTitle("toto jaune"); + c.setModel(m); + gr.addEGComponent(c); + y = new EGAxeVertical(); + y.setGraduations(true); + y.setBounds(0, 55); + y.setTitre("essai 1"); + gr.setAxeY(y); + gr.addEGComponent(c); + m = new EGCourbeModelDefault(new double[] { 1, 3, 4, 5 }, new double[] { 14, 54, 25, 43 }); + c = new EGCourbeChild(gr); + m.setTitle("toto vert"); + c.setAspectContour(Color.green); + c.setModel(m); + gr.addEGComponent(c); + grapheModel.add(gr); + return g; + } + + /** + * @param _args + * non utilise + */ + public static void main(final String[] _args) { + EGGraphe g = createGraphe(); + final EGFillePanel pn = new EGFillePanel(g); + + // creation de la scene EBLI + final EbliScene scene = new EbliScene(); + + // -- construction du jtree + + // etape 1 construction du model + // EbliWidgetJXTreeModel model = new EbliWidgetJXTreeModel(1/* ,scene */); + + // etape 2 SUPER IMPORTANT: ajout du model comme listener de la scene + // scene.addEbliNodeListener(model); + + // etape 3 creation du jtree + + // tree.setCellEditor(new EbliCheckBoxNodeEditor(tree)); + // tree.setEditable(true); + + // -- creation d un noeud Graphe --// + 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"); + nodeLegende.setCreator(new EbliWidgetCreatorLegende(g)); + nodeLegende.setPreferedSize(new Dimension(100, 100)); + nodeLegende.setPreferedLocation(new Point(4, 270)); + scene.addNode(nodeLegende); + + // -- creation de la vue calque + final TestModelLigneBrisee m = TestModelLigneBrisee.buildDefault(); + ZCalqueLigneBrisee br = new ZCalqueLigneBrisee(m); + br.setTitle("test"); + br.setLineModel(0, new TraceLigneModel(TraceLigne.LISSE, 5, Color.RED)); + BVueCalque vueC = new BVueCalque(br); + vueC.setSize(new Dimension(200, 200)); + 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()); + // fr.setContentPane(ebliCalquesPanel); + // ebliCalquesPanel.setPreferredSize(new Dimension(400, 400)); + // fr.setPreferredSize(new Dimension(400, 400)); + // fr.setVisible(true); + nodeCalque.setCreator(new EbliWidgetCreatorVueCalque(ebliCalquesPanel)); + scene.addNode(nodeCalque); + // scene.addChild(new ComponentWidget(scene, + // test.getVisuPanel().getVueCalque())); + + // -- ajout du rectangle --// + final EbliNodeDefault nodeRect = new EbliNodeDefault(); + nodeRect.setTitle("Rectangle"); + nodeRect.setCreator(new EbliWidgetCreatorTextLabel("Test recangle")); + nodeRect.setPreferedSize(new Dimension(200, 100)); + nodeRect.setPreferedLocation(new Point(350, 125)); + scene.addNode(nodeRect); + + // -- ajout du fleche double sens diagonale--// + node = new EbliNodeDefault(); + node.setTitle("Fleche Double"); + node.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_DIAG1)); + node.setPreferedSize(new Dimension(100, 100)); + node.setPreferedLocation(new Point(450, 125)); + scene.addNode(node); + + // -- ajout du fleche double sens nord--// + 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--// + 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); + + EbliWidget widget = nodeFleche.getWidget(); + widget.removeFromParent(); + node.getWidget().addChild(widget); + + EbliNodeDefault nodeShape = new EbliNodeDefault(); + nodeShape.setTitle("Shape fleche"); + nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFleche())); + nodeShape.setPreferedSize(new Dimension(100, 100)); + nodeShape.setPreferedLocation(new Point(250, 225)); + scene.addNode(nodeShape); + + ((EbliWidgetShape) nodeShape.getWidget()).setRotation(Math.PI / 2); + ((EbliWidgetShape) nodeShape.getWidget()).repaint(); + scene.refresh(); + + nodeShape = new EbliNodeDefault(); + nodeShape.setTitle("Shape cercle"); + nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorCircle())); + nodeShape.setPreferedSize(new Dimension(100, 100)); + nodeShape.setPreferedLocation(new Point(270, 225)); + scene.addNode(nodeShape); + scene.refresh(); + + + nodeShape = new EbliNodeDefault(); + nodeShape.setTitle("Shape cercle"); + nodeShape.setCreator(new EbliWidgetCreatorTextEditor(new CtuluHtmlEditorPanel())); + nodeShape.setPreferedSize(new Dimension(400, 400)); + nodeShape.setPreferedLocation(new Point(370, 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.getWidget().setState(state) + // if(node.getWidget().) + + // WidgetLegendeManagerOLD.createWidgetLegendeGraphe(this, visu, courbe, + // graphe.getClientArea()); + + /* + * // ajout iconenode IconNodeWidget iconNode = new IconNodeWidget(scene); + * iconNode.setImage(CtuluResource.CTULU.getImage("crystal_non")); + * iconNode.setLabel("MyIconNode"); // this.addChild (iconNode); + * iconNode.getActions().addAction( + * ActionFactory.createCenteredZoomAction(1.1)); + * iconNode.getActions().addAction(ActionFactory.createPanAction()); // + * assign HoverAction - the actual hovered widget is held by the scene + * iconNode.getActions().addAction(scene.createWidgetHoverAction()); // + * MoveAction has to be after the hover action // otherwise MoveAction will + * always consume the event and HoverAction // will never be invoked + * iconNode.getActions().addAction(ActionFactory.createMoveAction()); + * iconNode.setPreferredLocation(new Point(400, 150)); + */ + + JTable table = new JTable(); + table.setModel(new DefaultTableModel(new Object[][] { { "11", "12" }, { "21", "22" } }, new Object[] { "First", + "Second" })); + ComponentWidget widgetJtable = new ComponentWidget(scene, new JScrollPane(table)) { + public void notifyStateChanged(ObjectState previousState, ObjectState newState) { + + setBorder(BorderFactory.createResizeBorder(10)); + + } + }; + widgetJtable.setBorder(BorderFactory.createResizeBorder(10)); + widgetJtable.setPreferredLocation(new Point(500, 300)); + widgetJtable.getActions().addAction(ActionFactory.createResizeAction()); + // scene.addChild(widgetJtable); + + final JFrame f = new JFrame(); + f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + f.setSize(new Dimension(1024, 768)); + final BuPanel p = new BuPanel(); + p.setLayout(new BuBorderLayout()); + EbliWidgetJXTreeTableModel tree = new EbliWidgetJXTreeTableModel(scene); + + 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()); + t.setSelectionModel(((EGGrapheTreeModel) g.getModel()).getSelectionModel()); + t.setRootVisible(false); + + Box boxEast = Box.createVerticalBox(); + boxEast.add(new BuScrollPane(t)); + p.add(new JScrollPane(boxEast), BuBorderLayout.EAST); + f.setLayout(new BorderLayout()); + + // f.setContentPane(p); + f.add(p, BorderLayout.CENTER); + // fin + p.add(new JScrollPane(scene.createView()), BuBorderLayout.CENTER); + + // ajout de la vue sattelite en bas \xE4 gauche + boxEast.add(scene.createSatelliteView()); + + final JMenu menu = new JMenu(); + menu.setName("essai"); + menu.setText("essai"); + pn.fillSpecificMenu(menu); + final JMenuBar b = new JMenuBar(); + b.add(menu); + f.setJMenuBar(b); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + // f.pack(); + f.setVisible(true); + scene.setFont(CtuluLibSwing.getMiniFont()); + + // -- ajout par la suite --/ + /* + * node = new EbliNodeDefault(); node.setTitle("BOUDOUM"); + * node.setCreator(new EbliWidgetCreatorRectangle("BOUDOUM")); + * + * node.setD(new Dimension(100, 100)); node.setP(new Point(450,20)); + * scene.addNode(node); + */ + + JToolBar bar = new JToolBar(); + f.add(bar, BorderLayout.PAGE_START); + // 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(); + 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.add(new EbliWidgetActionConfigure(scene)); + + /** + * Action qui recupere les noeuds de l arbre selectionnes et indique la + * widget comme target. + */ + /* + * BConfigurePaletteAction action = new + * BConfigurePaletteAction(view.getTreeSelectionModel()) { + * + * protected Object getTarget(final TreeSelectionModel _m) { final + * TreePath[] p = _m.getSelectionPaths(); + * + * if (p != null) { final Object[] targets = new Object[p.length]; // p est + * non null for (int i = p.length - 1; i >= 0; i--) { targets[i] = p[i] == + * null ? null : ((EbliNode) ((EbliWidgetTreeTableNode) + * p[i].getLastPathComponent()) .getUserObject()).getWidget(); + * + * + * FuLog.warning("je suis la target selectionne title: " + + * targets[i].toString()); } + * + * + * + * return targets; } return null; } + * + * }; bar.add(action); + */ + bar = new JToolBar(); + f.add(bar, BorderLayout.PAGE_END); + + bar.add(new EbliWidgetActionDuplicate(scene)); + + bar.add(new EbliWidgetActionForeGround(scene)); + + bar.add(new EbliWidgetActionBackGround(scene)); + + bar.add(new EbliWidgetActionColorForeground(scene)); + + bar.add(new EbliWidgetActionColorBackground.ForScene(scene)); + + 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)); + +// bar.add(new EbliWidgetActiontextEditor(scene)); + + + p.doLayout(); + + // -- creation de l action pour les fonts --// + EbliWidgetActionFont actionFont = new EbliWidgetActionFont(scene); + + // -- ajout de la combo des font dans la toolbar --// + bar.add(actionFont.getFonts()); + + bar.add(actionFont.getSizeFonts()); + + + boxEast.add(new BCalqueLegende()); + + + + } +} \ No newline at end of file Property changes on: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2008-12-10 14:52:25
|
Revision: 4292 http://fudaa.svn.sourceforge.net/fudaa/?rev=4292&view=rev Author: hadouxad Date: 2008-12-10 14:52:21 +0000 (Wed, 10 Dec 2008) Log Message: ----------- - Correction de bugs g?\195?\170nants duplication/couper de l?\195?\169gendes. - Correction des g?\195?\169n?\195?\169rations de frames - Correction du filtre propre - Chargement de projet uniquement r?\195?\169pertoires avec filtre POST - Sauvegarde du projet avec .POST (pris en compte qu'on ajoute .POST manuellement ou non) (toutes les m?\195?\169thodes utiles sont dans TrpostFileFilter) - tentative correction bug lignes de courants: visiblement il y a des valeurs qu'il n'aime pas... - Test des valeurs null pour les legendes: update titres.... - Correction test value non null pour la ligne EfGridDataInterpolator.interpolateFromValue 180 - Compatibilit?\195?\169 maximum entre os via la methode TrPostPersistenceManager.updatePathForOs() Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/actions/EbliWidgetActionForeGround.java 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-12-10 14:52:21 UTC (rev 4292) @@ -0,0 +1,70 @@ +package org.fudaa.ebli.visuallibrary.actions; + +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.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. + * + * @author genesis + */ +public class EbliWidgetActionForeGround extends EbliWidgetActionSimple { + + CtuluCommandContainer cmd_; + + public EbliWidgetActionForeGround(final EbliScene _scene) { + super(_scene, EbliResource.EBLI.getString("Avant plan"), CtuluResource.CTULU.getIcon("crystal_disposerdevant"), + "FOREGROUND"); + + cmd_ = _scene.getCmdMng(); + putValue(NAME, "Avant plan"); + } + + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(final ActionEvent e) { + + // -- recuperation de la liste des nodes de la scene --// + final Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getSelectedObjects(); + + // -- liste des widget selectionnees --// + final java.util.List<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); + + // -- parcours des nodes + for (final Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + + final EbliNode currentNode = it.next(); + if (currentNode != null && currentNode.isMovable()) { + + // -- ajout au premier plan du node --// + // scene_.getVisu().addChild(currentNode.getCreator().getWidget()); + + currentNode.getWidget().bringToFront(); + + listeWidget.add(currentNode.getWidget()); + + // -- rafraichissement de la scene --// + scene_.refresh(); + + } + + } + + // -- enregistrement de la commande undoRedo --// + if (cmd_ != null) { + cmd_.addCmd(new CommandBringToFront(listeWidget)); + } + + } + +} 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-12-10 14:31:18 UTC (rev 4291) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetVueCalque.java 2008-12-10 14:52:21 UTC (rev 4292) @@ -161,6 +161,10 @@ first_ = false; if (initZoom_ != null && initZoom_.getDeltaX() > 0 && initZoom_.getDeltaY() > 0) { calquePanel_.getVueCalque().changeRepere(this, initZoom_); + + //-- tres important!!: le zoom doit prendre la valeur initial du zoom pour conserver le bon angle si on fais le cas suivant: + //-- lros du chargement d un calque avec zoom specifique, suivi d'un agrandissement ou reduction: il faut que le zoom!=null pour ne pas reinitialiser le repere (cf boucle suivante) + zoom_=initZoom_; initZoom_ = null; } else calquePanel_.restaurer(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java 2008-12-10 14:31:18 UTC (rev 4291) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java 2008-12-10 14:52:21 UTC (rev 4292) @@ -58,6 +58,7 @@ 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.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-09 18:36:17
|
Revision: 4448 http://fudaa.svn.sourceforge.net/fudaa/?rev=4448&view=rev Author: hadouxad Date: 2009-02-09 18:36:13 +0000 (Mon, 09 Feb 2009) Log Message: ----------- Correction + connecteurs fleches Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.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/test/org/fudaa/ebli/all/TestVisualLibrary.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeMultiWidget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorConnectionWidget.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-02-08 22:18:41 UTC (rev 4447) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-02-09 18:36:13 UTC (rev 4448) @@ -56,16 +56,16 @@ } public int getRowCount() { - return infos_.keySet().size() + 1; + return infos_.keySet().size() /*+ 1*/; } public Object getValueAt(int row, int column) { - if (row == getRowCount() - 1) { + /* if (row == getRowCount() - 1) { if (column == 0) return EbliResource.EBLI.getString("Editable"); else return EbliResource.EBLI.getString("Double-cliquez pour \xE9diter"); } else - +*/ if (column == 0) return getKey(row); else return getValue(row); @@ -122,7 +122,7 @@ @Override public boolean isCellEditable(int row, int column) { - return true; + return false; } @Override Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeMultiWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeMultiWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliNodeMultiWidget.java 2009-02-09 18:36:13 UTC (rev 4448) @@ -0,0 +1,100 @@ +package org.fudaa.ebli.visuallibrary; + +import java.awt.Dimension; +import java.awt.Point; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreator; + +/** + * EbliNode qui reference plusieurs widgets. + * @author Adrien Hadoux + * + */ +public class EbliNodeMultiWidget implements EbliNode { + + EbliWidgetCreator creator; + Point preferedLocation; + Dimension preferedSize; + String title; + List<EbliWidget> nodeWidget_; + + public String getTitle() { + return title; + } + + /** + * methode qui permet de dupliquer un node + */ + public EbliNode duplicate(final Map options) { + return getCreator().duplicate(this); + } + + public void setTitle(final String title) { + this.title = title; + } + + public void setPreferedLocation(final Point p) { + this.preferedLocation = p; + // repositionnement du widget si existant + if (hasWidget()) + for(EbliWidget nodeWidget:nodeWidget_) + nodeWidget.setPreferredLocation(p); + } + + public void setPreferedSize(final Dimension d) { + this.preferedSize = d; + + // repositionnement du widget si existant + if (hasWidget()) + for(EbliWidget nodeWidget:nodeWidget_) + nodeWidget.setPreferredSize(d); + } + + public void setCreator(final EbliWidgetCreator creator) { + this.creator = creator; + } + + public EbliWidgetCreator getCreator() { + return creator; + } + + public Point getPreferedLocation() { + + return preferedLocation; + } + + public Dimension getPreferedSize() { + return preferedSize; + } + + + + public boolean hasWidget() { + return (getCreator() != null && nodeWidget_ != null); + + } + + /** + * @see hasWidget() + * @return EbliWidget + */ + public EbliWidget getWidget() { + return nodeWidget_.get(0); + } + + public boolean isMovable() { + // TODO Auto-generated method stub + return (hasWidget() && getPreferedLocation() != null && getWidget().getBounds() != null); + } + + public void setWidget(final EbliWidget _widget) { + if(nodeWidget_==null) + nodeWidget_=new ArrayList<EbliWidget>(10); + nodeWidget_.clear(); + nodeWidget_.add(_widget); + } + +} 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 2009-02-08 22:18:41 UTC (rev 4447) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliScene.java 2009-02-09 18:36:13 UTC (rev 4448) @@ -249,8 +249,11 @@ // -- creation de la widget ici --// // if (node.getWidget() == null) - // -- on ne cree la widget que sis necessaire + // -- on ne cree la widget que si necessaire node.setWidget(node.getCreator().create(this)); + + if(node.getWidget()==null) + return null; // else // node.getWidget().setScene(this); // @@ -261,8 +264,8 @@ // -- ajout dans la vue layer --// visu_.addChild(node.getWidget()); - if (node.getWidget().getController().getDescription() == null - || node.getWidget().getController().getDescription().equals("")) node.getWidget().getController() + if (node.getWidget().getController()!=null && (node.getWidget().getController().getDescription() == null + || node.getWidget().getController().getDescription().equals(""))) node.getWidget().getController() .setDescription(node.getTitle()); return node.getWidget(); 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 2009-02-08 22:18:41 UTC (rev 4447) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidget.java 2009-02-09 18:36:13 UTC (rev 4448) @@ -446,7 +446,8 @@ parent.setBorder(lookFeel.getBorder(_newState, parent.getController().canResize_, parent.getController() .isProportional())); } else { - setBorder(lookFeel.getBorder(_newState, getController().canResize_, getController().isProportional())); + if(lookFeel!=null && getController()!=null) + setBorder(lookFeel.getBorder(_newState, getController().canResize_, getController().isProportional())); } } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorConnectionWidget.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorConnectionWidget.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/EbliWidgetCreatorConnectionWidget.java 2009-02-09 18:36:13 UTC (rev 4448) @@ -0,0 +1,88 @@ +package org.fudaa.ebli.visuallibrary.creator; + +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Point; +import java.util.Map; + +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliScene; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetWithBordure; +import org.netbeans.api.visual.anchor.AnchorFactory; +import org.netbeans.api.visual.anchor.AnchorShape; +import org.netbeans.api.visual.widget.ConnectionWidget; +import org.netbeans.api.visual.widget.LayerWidget; + +/** + * Creator pour un widget creator connection. + * + * @author Adrien Hadoux + * + */ +public class EbliWidgetCreatorConnectionWidget implements EbliWidgetCreator{ + + + EbliWidget connection1_; + EbliWidget connection2_; + ConnectionWidget connection_; + EbliWidget conteneurFleche_; + LayerWidget layoutConteneur_; + + public EbliWidgetCreatorConnectionWidget() { + super(); + + } + + public EbliWidget create(EbliScene _scene) { + connection1_=new EbliWidget(_scene,true); + connection2_=new EbliWidget(_scene,true); + conteneurFleche_=new EbliWidget(_scene); + + + connection1_.setPreferredSize(new Dimension(50,50)); + connection2_.setPreferredSize(new Dimension(50,50)); + + connection1_.setPreferredLocation(new Point(10,10)); + connection2_.setPreferredLocation(new Point(600,300)); + + _scene.getVisu().addChild(connection1_); + _scene.getVisu().addChild(connection2_); + + //-- creation de la connection --// + connection_ = new ConnectionWidget (_scene); + connection_.setSourceAnchor(AnchorFactory.createCircularAnchor (connection1_, 32)); + connection_.setTargetAnchor(AnchorFactory.createCircularAnchor (connection2_, 32)); + connection_.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED); + + layoutConteneur_ = new LayerWidget (_scene); + _scene.addChild(layoutConteneur_); + +// layoutConteneur_= new LayerWidget(_scene); +// conteneurFleche_.addChild(layoutConteneur_ ); + layoutConteneur_.addChild(connection_); + + + + return null; + } + + + public EbliNode duplicate(EbliNode adupliquer) { + // TODO Auto-generated method stub + return null; + } + + + public Object getPersistData(Map parameters) { + // TODO Auto-generated method stub + return null; + } + + + public void setPersistData(Object data, Map parameters) { + // TODO Auto-generated method stub + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java 2009-02-08 22:18:41 UTC (rev 4447) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestVisualLibrary.java 2009-02-09 18:36:13 UTC (rev 4448) @@ -63,6 +63,7 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageHorizontal; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionRetaillageVertical; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorConnectionWidget; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorDblFleche; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorFleche; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorShape; @@ -199,6 +200,9 @@ nodeLegende.setPreferedLocation(new Point(4, 270)); scene.addNode(nodeLegende); + + + // -- creation de la vue calque final TestModelLigneBrisee m = TestModelLigneBrisee.buildDefault(); ZCalqueLigneBrisee br = new ZCalqueLigneBrisee(m); @@ -236,7 +240,7 @@ node.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_DIAG1)); node.setPreferedSize(new Dimension(100, 100)); node.setPreferedLocation(new Point(450, 125)); - scene.addNode(node); + //scene.addNode(node); // -- ajout du fleche double sens nord--// final EbliNodeDefault nodeDbl = new EbliNodeDefault(); @@ -244,56 +248,60 @@ nodeDbl.setCreator(new EbliWidgetCreatorDblFleche(EbliWidgetDBLFleche.ORIENTATION_WEST)); nodeDbl.setPreferedSize(new Dimension(100, 100)); nodeDbl.setPreferedLocation(new Point(450, 125)); - scene.addNode(nodeDbl); + //scene.addNode(nodeDbl); // -- ajout du fleche sens unique--// - 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); +// 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); - EbliWidget widget = nodeFleche.getWidget(); - widget.removeFromParent(); - node.getWidget().addChild(widget); +// EbliWidget widget = nodeFleche.getWidget(); +// widget.removeFromParent(); +// node.getWidget().addChild(widget); - EbliNodeDefault nodeShape = new EbliNodeDefault(); - nodeShape.setTitle("Shape fleche"); - nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFleche())); - nodeShape.setPreferedSize(new Dimension(100, 100)); - nodeShape.setPreferedLocation(new Point(250, 225)); - scene.addNode(nodeShape); - - ((EbliWidgetShape) nodeShape.getWidget()).setRotation(Math.PI / 2); - ((EbliWidgetShape) nodeShape.getWidget()).repaint(); - scene.refresh(); - - nodeShape = new EbliNodeDefault(); - nodeShape.setTitle("Shape cercle"); - nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorCircle())); - nodeShape.setPreferedSize(new Dimension(100, 100)); - nodeShape.setPreferedLocation(new Point(270, 225)); - scene.addNode(nodeShape); - scene.refresh(); +// EbliNodeDefault nodeShape = new EbliNodeDefault(); +// nodeShape.setTitle("Shape fleche"); +// nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFleche())); +// nodeShape.setPreferedSize(new Dimension(100, 100)); +// nodeShape.setPreferedLocation(new Point(250, 225)); +// //scene.addNode(nodeShape); +// +// ((EbliWidgetShape) nodeShape.getWidget()).setRotation(Math.PI / 2); +// ((EbliWidgetShape) nodeShape.getWidget()).repaint(); +// scene.refresh(); +// +// nodeShape = new EbliNodeDefault(); +// nodeShape.setTitle("Shape cercle"); +// nodeShape.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorCircle())); +// nodeShape.setPreferedSize(new Dimension(100, 100)); +// nodeShape.setPreferedLocation(new Point(270, 225)); +// // scene.addNode(nodeShape); +// scene.refresh(); +// +// +// nodeShape = new EbliNodeDefault(); +// nodeShape.setTitle("Shape cercle"); +// nodeShape.setCreator(new EbliWidgetCreatorTextEditor(new CtuluHtmlEditorPanel())); +// nodeShape.setPreferedSize(new Dimension(400, 400)); +// nodeShape.setPreferedLocation(new Point(370, 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); - - nodeShape = new EbliNodeDefault(); - nodeShape.setTitle("Shape cercle"); - nodeShape.setCreator(new EbliWidgetCreatorTextEditor(new CtuluHtmlEditorPanel())); - nodeShape.setPreferedSize(new Dimension(400, 400)); - nodeShape.setPreferedLocation(new Point(370, 225)); - scene.addNode(nodeShape); + EbliNodeDefault nodeFleche = new EbliNodeDefault(); + nodeFleche.setTitle("CONNECTOR"); + nodeFleche.setCreator(new EbliWidgetCreatorConnectionWidget()); + scene.addNode(nodeFleche); 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"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |