From: <de...@us...> - 2008-09-25 19:42:28
|
Revision: 3986 http://fudaa.svn.sourceforge.net/fudaa/?rev=3986&view=rev Author: deniger Date: 2008-09-25 19:42:20 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java Deleted: 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-25 16:48:48 UTC (rev 3985) +++ branches/Prepro-0.92-SNAPSHOT/ebli/test/org/fudaa/ebli/all/TestGraphe2.java 2008-09-25 19:42:20 UTC (rev 3986) @@ -1,486 +0,0 @@ -/** - * @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 TestGraphe2 { - - private TestGraphe2() { - 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |