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. |