[jboss-cvs] JBossAS SVN: r91008 - in projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render: support and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 9 11:23:25 EDT 2009


Author: alesj
Date: 2009-07-09 11:23:25 -0400 (Thu, 09 Jul 2009)
New Revision: 91008

Added:
   projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/support/
   projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/support/JGraphView.java
   projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/test/swing/
   projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/test/swing/ManualSwingExample.java
Log:
Add swing view example.

Added: projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/support/JGraphView.java
===================================================================
--- projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/support/JGraphView.java	                        (rev 0)
+++ projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/support/JGraphView.java	2009-07-09 15:23:25 UTC (rev 91008)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.mctools.grapher.render.support;
+
+import javax.swing.*;
+
+import org.jgraph.JGraph;
+
+/**
+ * Expose JGraph as a swing view.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JGraphView
+{
+   private JGraph graph;
+
+   public JGraphView(JGraph graph)
+   {
+      this.graph = graph;
+   }
+
+   public void view()
+   {
+      JFrame frame = new JFrame();
+      frame.getContentPane().add(new JScrollPane(graph));
+      frame.pack();
+      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+      frame.setVisible(true);
+   }
+}

Added: projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/test/swing/ManualSwingExample.java
===================================================================
--- projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/test/swing/ManualSwingExample.java	                        (rev 0)
+++ projects/mc-tools/grapher/trunk/src/test/java/org/jboss/test/mctools/grapher/render/test/swing/ManualSwingExample.java	2009-07-09 15:23:25 UTC (rev 91008)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.mctools.grapher.render.test.swing;
+
+import org.jboss.test.mctools.grapher.render.test.ManualGraphWrite2FileTestCase;
+import org.jboss.test.mctools.grapher.render.support.JGraphView;
+import org.jgraph.JGraph;
+
+/**
+ * Run tests via swing example.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ManualSwingExample extends ManualGraphWrite2FileTestCase
+{
+   public ManualSwingExample(String name)
+   {
+      super(name);
+   }
+
+   public static void main(String[] args)
+   {
+      ManualSwingExample example = new ManualSwingExample("Manual Swing Example");
+      JGraph graph = example.createGraph();
+      JGraphView view = new JGraphView(graph);
+      view.view();
+   }
+}




More information about the jboss-cvs-commits mailing list