ejtools-cvs Mailing List for EJTools (Page 14)
Brought to you by:
letiemble
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
(471) |
May
(303) |
Jun
(176) |
Jul
(67) |
Aug
(64) |
Sep
(84) |
Oct
(148) |
Nov
(57) |
Dec
(272) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(356) |
Feb
(304) |
Mar
(214) |
Apr
(22) |
May
(7) |
Jun
(25) |
Jul
|
Aug
(5) |
Sep
(106) |
Oct
|
Nov
(95) |
Dec
(193) |
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: <let...@us...> - 2003-09-15 22:23:51
|
Update of /cvsroot/ejtools/libraries/common/src/test/test/util In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/test/test/util Modified Files: ClassToolsTest.java KeyLimitedStackTest.java LimitedStackTest.java Added Files: PlatformTest.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG --- NEW FILE: PlatformTest.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package test.util; import org.ejtools.util.Platform; import junit.framework.TestCase; /** * @author letiemble * @version $Revision: 1.1 $ */ public class PlatformTest extends TestCase { /**Constructor for the ClassToolsTest object */ public PlatformTest() { super(); } /** *Constructor for the ClassToolsTest object * * @param name Description of the Parameter */ public PlatformTest(String name) { super(name); } /** A unit test for JUnit */ public void testJavaVersion() { System.setProperty("java.version", "1.4.1_b1"); assertFalse("Version is not 1.1", Platform.IS_JAVA_1_1); assertFalse("Version is not 1.2", Platform.IS_JAVA_1_2); assertFalse("Version is not 1.3", Platform.IS_JAVA_1_3); assertTrue("Version is not 1.4", Platform.IS_JAVA_1_4); assertFalse("Version is not 1.5", Platform.IS_JAVA_1_5); assertTrue("Version is compatible with 1.1", Platform.isJavaVersionCompatible(Platform.JAVA_1_1)); assertTrue("Version is compatible with 1.2", Platform.isJavaVersionCompatible(Platform.JAVA_1_2)); assertTrue("Version is compatible with 1.3", Platform.isJavaVersionCompatible(Platform.JAVA_1_3)); assertTrue("Version is compatible with 1.4", Platform.isJavaVersionCompatible(Platform.JAVA_1_4)); assertFalse("Version is compatible with 1.5", Platform.isJavaVersionCompatible(Platform.JAVA_1_5)); } } Index: ClassToolsTest.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/test/test/util/ClassToolsTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassToolsTest.java 21 Feb 2003 22:37:52 -0000 1.1 --- ClassToolsTest.java 15 Sep 2003 22:23:46 -0000 1.2 *************** *** 1,104 **** ! /* ! * Created on 19 févr. 2003 ! * ! * To change this generated comment go to ! * Window>Preferences>Java>Code Generation>Code Template ! */ ! package test.util; ! ! import org.ejtools.util.ClassTools; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 19 février 2003 ! * @version $Revision$ ! */ ! public class ClassToolsTest extends TestCase ! { ! /**Constructor for the ClassToolsTest object */ ! public ClassToolsTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the ClassToolsTest object ! * ! * @param name Description of the Parameter ! */ ! public ClassToolsTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testClassDisplay() ! { ! assertEquals("Displays must be the same", ClassTools.classDisplay((new boolean[0]).getClass().getName()), "boolean[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new double[0]).getClass().getName()), "double[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new char[0]).getClass().getName()), "char[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new float[0]).getClass().getName()), "float[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new int[0]).getClass().getName()), "int[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new short[0]).getClass().getName()), "short[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new long[0]).getClass().getName()), "long[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new byte[0]).getClass().getName()), "byte[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new String[0]).getClass().getName()), "java.lang.String[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new Thread[0]).getClass().getName()), "java.lang.Thread[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new ClassTools[0]).getClass().getName()), "org.ejtools.util.ClassTools[]"); ! } ! ! ! /** A unit test for JUnit */ ! public void testGetClass() ! { ! assertEquals("Classes must be equal", ClassTools.getClass("void"), Void.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("int"), Integer.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("short"), Short.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("long"), Long.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("byte"), Byte.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("char"), Character.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("float"), Float.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("double"), Double.TYPE); ! ! assertEquals("Classes must be equal", ClassTools.getClass("java.lang.String"), String.class); ! assertEquals("Classes must be equal", ClassTools.getClass("java.lang.Thread"), Thread.class); ! assertEquals("Classes must be equal", ClassTools.getClass("org.ejtools.util.ClassTools"), ClassTools.class); ! ! assertNull("Class must be null", ClassTools.getClass("org.foo.bar")); ! } ! ! ! /** A unit test for JUnit */ ! public void testGetValue() ! { ! assertEquals("Values must be equal", ClassTools.getValue(new Double(0)), 0d, 0.0000000001); ! assertEquals("Values must be equal", ClassTools.getValue(new Double(1)), 1d, 0.0000000001); ! assertEquals("Values must be equal", ClassTools.getValue(new Double(3.33)), 3.33d, 0.0000000001); ! ! assertEquals("Value must be 0", ClassTools.getValue(new String("dummy")), 0d, 0.0000000001); ! } ! ! ! /** A unit test for JUnit */ ! public void testIsNumeric() ! { ! assertTrue("This class must be numeric", ClassTools.isNumeric(Byte.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Double.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Float.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Integer.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Long.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Short.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Byte.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Double.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Float.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Integer.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Long.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Short.TYPE)); ! ! assertFalse("This class must not be numeric", ClassTools.isNumeric(String.class)); ! } ! } --- 1,104 ---- ! /* ! * Created on 19 févr. 2003 ! * ! * To change this generated comment go to ! * Window>Preferences>Java>Code Generation>Code Template ! */ ! package test.util; ! ! import org.ejtools.util.ClassTools; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 19 février 2003 ! * @version $Revision$ ! */ ! public class ClassToolsTest extends TestCase ! { ! /**Constructor for the ClassToolsTest object */ ! public ClassToolsTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the ClassToolsTest object ! * ! * @param name Description of the Parameter ! */ ! public ClassToolsTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testClassDisplay() ! { ! assertEquals("Displays must be the same", ClassTools.classDisplay((new boolean[0]).getClass().getName()), "boolean[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new double[0]).getClass().getName()), "double[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new char[0]).getClass().getName()), "char[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new float[0]).getClass().getName()), "float[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new int[0]).getClass().getName()), "int[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new short[0]).getClass().getName()), "short[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new long[0]).getClass().getName()), "long[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new byte[0]).getClass().getName()), "byte[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new String[0]).getClass().getName()), "java.lang.String[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new Thread[0]).getClass().getName()), "java.lang.Thread[]"); ! assertEquals("Displays must be the same", ClassTools.classDisplay((new ClassTools[0]).getClass().getName()), "org.ejtools.util.ClassTools[]"); ! } ! ! ! /** A unit test for JUnit */ ! public void testGetClass() ! { ! assertEquals("Classes must be equal", ClassTools.getClass("void"), Void.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("int"), Integer.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("short"), Short.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("long"), Long.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("byte"), Byte.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("char"), Character.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("float"), Float.TYPE); ! assertEquals("Classes must be equal", ClassTools.getClass("double"), Double.TYPE); ! ! assertEquals("Classes must be equal", ClassTools.getClass("java.lang.String"), String.class); ! assertEquals("Classes must be equal", ClassTools.getClass("java.lang.Thread"), Thread.class); ! assertEquals("Classes must be equal", ClassTools.getClass("org.ejtools.util.ClassTools"), ClassTools.class); ! ! assertNull("Class must be null", ClassTools.getClass("org.foo.bar")); ! } ! ! ! /** A unit test for JUnit */ ! public void testGetValue() ! { ! assertEquals("Values must be equal", ClassTools.getValue(new Double(0)), 0d, 0.0000000001); ! assertEquals("Values must be equal", ClassTools.getValue(new Double(1)), 1d, 0.0000000001); ! assertEquals("Values must be equal", ClassTools.getValue(new Double(3.33)), 3.33d, 0.0000000001); ! ! assertEquals("Value must be 0", ClassTools.getValue(new String("dummy")), 0d, 0.0000000001); ! } ! ! ! /** A unit test for JUnit */ ! public void testIsNumeric() ! { ! assertTrue("This class must be numeric", ClassTools.isNumeric(Byte.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Double.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Float.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Integer.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Long.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Short.class)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Byte.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Double.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Float.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Integer.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Long.TYPE)); ! assertTrue("This class must be numeric", ClassTools.isNumeric(Short.TYPE)); ! ! assertFalse("This class must not be numeric", ClassTools.isNumeric(String.class)); ! } ! } Index: KeyLimitedStackTest.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/test/test/util/KeyLimitedStackTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** KeyLimitedStackTest.java 21 Feb 2003 22:37:52 -0000 1.1 --- KeyLimitedStackTest.java 15 Sep 2003 22:23:46 -0000 1.2 *************** *** 1,111 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package test.util; ! ! import org.ejtools.util.KeyLimitedStack; ! import org.ejtools.util.LimitedStack; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 21 février 2003 ! * @version $Revision$ ! */ ! public class KeyLimitedStackTest extends TestCase ! { ! ! /**Constructor for the LimitedStackTest object */ ! public KeyLimitedStackTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the LimitedStackTest object ! * ! * @param name Description of the Parameter ! */ ! public KeyLimitedStackTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testPop() ! { ! LimitedStack stack = new KeyLimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.pop(); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.pop(); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.pop(); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.pop(); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! } ! ! ! /** A unit test for JUnit */ ! public void testPush() ! { ! LimitedStack stack = new KeyLimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! } ! } --- 1,111 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package test.util; ! ! import org.ejtools.util.KeyLimitedStack; ! import org.ejtools.util.LimitedStack; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 21 février 2003 ! * @version $Revision$ ! */ ! public class KeyLimitedStackTest extends TestCase ! { ! ! /**Constructor for the LimitedStackTest object */ ! public KeyLimitedStackTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the LimitedStackTest object ! * ! * @param name Description of the Parameter ! */ ! public KeyLimitedStackTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testPop() ! { ! LimitedStack stack = new KeyLimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.pop(); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.pop(); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.pop(); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.pop(); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! } ! ! ! /** A unit test for JUnit */ ! public void testPush() ! { ! LimitedStack stack = new KeyLimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! } ! } Index: LimitedStackTest.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/test/test/util/LimitedStackTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LimitedStackTest.java 21 Feb 2003 22:37:52 -0000 1.1 --- LimitedStackTest.java 15 Sep 2003 22:23:46 -0000 1.2 *************** *** 1,101 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package test.util; ! ! import org.ejtools.util.LimitedStack; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 21 février 2003 ! * @version $Revision$ ! */ ! public class LimitedStackTest extends TestCase ! { ! ! /**Constructor for the LimitedStackTest object */ ! public LimitedStackTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the LimitedStackTest object ! * ! * @param name Description of the Parameter ! */ ! public LimitedStackTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testPop() ! { ! LimitedStack stack = new LimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.pop(); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.pop(); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.pop(); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.pop(); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! } ! ! ! /** A unit test for JUnit */ ! public void testPush() ! { ! LimitedStack stack = new LimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! } ! } --- 1,101 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package test.util; ! ! import org.ejtools.util.LimitedStack; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 21 février 2003 ! * @version $Revision$ ! */ ! public class LimitedStackTest extends TestCase ! { ! ! /**Constructor for the LimitedStackTest object */ ! public LimitedStackTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the LimitedStackTest object ! * ! * @param name Description of the Parameter ! */ ! public LimitedStackTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testPop() ! { ! LimitedStack stack = new LimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.pop(); ! assertEquals("Stack size must be 4", stack.size(), 4); ! stack.pop(); ! assertEquals("Stack size must be 3", stack.size(), 3); ! stack.pop(); ! assertEquals("Stack size must be 2", stack.size(), 2); ! stack.pop(); ! assertEquals("Stack size must be 1", stack.size(), 1); ! stack.pop(); ! assertEquals("Stack must be empty", stack.size(), 0); ! } ! ! ! /** A unit test for JUnit */ ! public void testPush() ! { ! LimitedStack stack = new LimitedStack(5); ! assertEquals("Stack must be empty", stack.size(), 0); ! ! stack.push("key1"); ! assertEquals("Stack size must be 1", stack.size(), 1); ! ! stack.push("key2"); ! assertEquals("Stack size must be 2", stack.size(), 2); ! ! stack.push("key3"); ! assertEquals("Stack size must be 3", stack.size(), 3); ! ! stack.push("key4"); ! assertEquals("Stack size must be 4", stack.size(), 4); ! ! stack.push("key5"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! ! stack.push("key6"); ! assertEquals("Stack size must be 5", stack.size(), 5); ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:23:51
|
Update of /cvsroot/ejtools/libraries/common/src/test/test/beans In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/test/test/beans Modified Files: SortTest.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG Index: SortTest.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/test/test/beans/SortTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SortTest.java 21 Feb 2003 22:37:51 -0000 1.1 --- SortTest.java 15 Sep 2003 22:23:46 -0000 1.2 *************** *** 1,40 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package test.beans; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 21 février 2003 ! * @version $Revision$ ! */ ! public class SortTest extends TestCase ! { ! /**Constructor for the SortTest object */ ! public SortTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the SortTest object ! * ! * @param name Description of the Parameter ! */ ! public SortTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testSortByClass() ! { ! } ! } --- 1,40 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package test.beans; ! ! import junit.framework.TestCase; ! ! /** ! * @author letiemble ! * @created 21 février 2003 ! * @version $Revision$ ! */ ! public class SortTest extends TestCase ! { ! /**Constructor for the SortTest object */ ! public SortTest() ! { ! super(); ! } ! ! ! /** ! *Constructor for the SortTest object ! * ! * @param name Description of the Parameter ! */ ! public SortTest(String name) ! { ! super(name); ! } ! ! ! /** A unit test for JUnit */ ! public void testSortByClass() ! { ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:23:51
|
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/export In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/util/export Added Files: PNGTools.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG --- NEW FILE: PNGTools.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.export; import java.awt.Component; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.File; import java.io.IOException; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import org.apache.log4j.Logger; import org.ejtools.util.Platform; /** * Description of the Class * * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class PNGTools { /** Description of the Field */ private static FileFilter PNG_FILE_FILTER = new FileFilter() { public boolean accept(File file) { return file.getName().endsWith(".png"); } public String getDescription() { return "PNG image (*.png)"; } }; /** Description of the Field */ private static Logger logger = Logger.getLogger(PNGTools.class); /**Constructor for the PNGCreator object */ private PNGTools() { super(); } /** * Description of the Method * * @param image Description of the Parameter * @param output Description of the Parameter */ public static void exportAsPNG(RenderedImage image, File output) { if (Platform.isJavaVersionCompatible(Platform.JAVA_1_4)) { try { // Qualified name is mandatory javax.imageio.ImageIO.write(image, "PNG", output); } catch (IOException ioe) { logger.error("Can't export image as PNG", ioe); } } } /** * Description of the Method * * @param component Description of the Parameter * @param output Description of the Parameter */ public static void exportAsPNG(Component component, File output) { if (Platform.isJavaVersionCompatible(Platform.JAVA_1_4)) { try { BufferedImage image = new BufferedImage(component.getWidth(), component.getHeight(), BufferedImage.TYPE_INT_ARGB); component.paint(image.getGraphics()); // Qualified name is mandatory javax.imageio.ImageIO.write(image, "PNG", output); } catch (IOException ioe) { logger.error("Can't export image as PNG", ioe); } } } /** * Description of the Method * * @return Description of the Return Value */ public static File selectPNGFile() { // Fix for JFileChooser/SecurityManager bug (#4264750) SecurityManager s = System.getSecurityManager(); System.setSecurityManager(null); // Choose file JFileChooser chooser = new JFileChooser(System.getProperty("user.dir")); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileFilter(PNG_FILE_FILTER); int returnVal = chooser.showSaveDialog(null); System.setSecurityManager(s); if (returnVal != JFileChooser.APPROVE_OPTION) { return null; } return chooser.getSelectedFile(); } } |
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/util/state Added Files: DefaultRule.java DefaultStoreVisitor.java LoadHandler.java Rule.java Storable.java StoreVisitor.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG --- NEW FILE: DefaultRule.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; import java.util.Map; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class DefaultRule implements Rule { /** * Description of the Method * * @param context Description of the Parameter */ public void loadBody(Map context) { } /** * Description of the Method * * @param context Description of the Parameter */ public void loadEnter(Map context) { } /** * Description of the Method * * @param context Description of the Parameter */ public void loadExit(Map context) { } } --- NEW FILE: DefaultStoreVisitor.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Stack; import org.w3c.dom.Node; import org.apache.log4j.Logger; import org.ejtools.beans.Sort; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class DefaultStoreVisitor implements StoreVisitor { /** Description of the Field */ private Stack nodes = new Stack(); /** Description of the Field */ private Map persistMappings = new HashMap(); /** Description of the Field */ private static Logger logger = Logger.getLogger(DefaultStoreVisitor.class); /**Constructor for the ReflectivePersistenceStore object */ public DefaultStoreVisitor() { } /** * Description of the Method * * @param iterator Description of the Parameter */ public void persist(Iterator iterator) { Iterator it = Sort.getChildrenByClass(iterator, Storable.class); for (; it.hasNext(); ) { Storable p = (Storable) it.next(); p.accept(this); } } /** * Description of the Method * * @param o Description of the Parameter */ public void persist(Object o) { Class clazz = o.getClass(); Method m = (Method) this.persistMappings.get(clazz); try { m.invoke(this, new Object[]{o}); } catch (Exception e) { logger.debug("Object of type " + o.getClass().getName() + " will not be persist"); } } /** * Description of the Method * * @return Description of the Return Value */ protected Node peekCurrentNode() { return (Node) this.nodes.peek(); } /** * Description of the Method * * @return Description of the Return Value */ protected Node popCurrentNode() { return (Node) this.nodes.pop(); } /** * Description of the Method * * @param node Description of the Parameter */ protected void pushCurrentNode(Node node) { this.nodes.push(node); } /** * Description of the Method * * @param clazz Description of the Parameter */ public final void registerForPersistence(Class clazz) { try { Method m = this.getClass().getMethod("persist", new Class[]{clazz}); this.persistMappings.put(clazz, m); } catch (NoSuchMethodException nsme) { logger.warn("Can't register for persistence class " + clazz.getName()); } } } --- NEW FILE: LoadHandler.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class LoadHandler extends DefaultHandler { /** Description of the Field */ private Map context = new HashMap(); /** Description of the Field */ private String path = ""; /** Description of the Field */ private Map rules = new Hashtable(); /** Description of the Field */ public final static String ATTRIBUTES = "ATTRIBUTES"; /** Description of the Field */ public final static String ELEMENT = "ELEMENT"; /** Description of the Field */ public final static String TEXT = "TEXT"; /**Constructor for the WorkbenchHandler object */ public LoadHandler() { } /** * Adds a feature to the Rule attribute of the WorkbenchHandler object * * @param path The feature to be added to the Rule attribute * @param rule The feature to be added to the Rule attribute */ public void addRule(String path, Rule rule) { this.rules.put(path, rule); } /** * Description of the Method * * @param ch Description of the Parameter * @param start Description of the Parameter * @param length Description of the Parameter * @exception SAXException Description of the Exception */ public void characters(char[] ch, int start, int length) throws SAXException { String text = new String(ch, start, length); this.context.put("TEXT", text); Rule rule = (Rule) this.rules.get(this.path); if (rule != null) { rule.loadBody(this.context); } } /** * Description of the Method * * @param uri Description of the Parameter * @param localName Description of the Parameter * @param qName Description of the Parameter * @exception SAXException Description of the Exception */ public void endElement(String uri, String localName, String qName) throws SAXException { this.context.put("ELEMENT", qName); Rule rule = (Rule) this.rules.get(this.path); if (rule != null) { rule.loadExit(this.context); } this.path = this.path.substring(0, this.path.length() - qName.length() - 1); } /** * Gets the context attribute of the LoadHandler object * * @return The context value */ public Map getContext() { return this.context; } /** * Description of the Method * * @param uri Description of the Parameter * @param localName Description of the Parameter * @param qName Description of the Parameter * @param attributes Description of the Parameter * @exception SAXException Description of the Exception */ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.context.put("ELEMENT", qName); this.context.put("ATTRIBUTES", attributes); this.path = path + "/" + qName; Rule rule = (Rule) this.rules.get(this.path); if (rule != null) { rule.loadEnter(this.context); } } } --- NEW FILE: Rule.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; import java.util.Map; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public interface Rule { /** * Description of the Method * * @param context Description of the Parameter */ public void loadEnter(Map context); /** * Description of the Method * * @param context Description of the Parameter */ public void loadBody(Map context); /** * Description of the Method * * @param context Description of the Parameter */ public void loadExit(Map context); } --- NEW FILE: Storable.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public interface Storable { /** * Description of the Method * * @param visitor Description of the Parameter */ void accept(StoreVisitor visitor); } --- NEW FILE: StoreVisitor.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; import java.util.Iterator; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public interface StoreVisitor { /** * Description of the Method * * @param iterator Description of the Parameter */ void persist(Iterator iterator); /** * Description of the Method * * @param o Description of the Parameter */ void persist(Object o); /** * Description of the Method * * @param clazz Description of the Parameter */ void registerForPersistence(Class clazz); } |
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/service In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/util/service Modified Files: Profile.java ProfileMetaData.java ProfileService.java ProfileServiceProvider.java Added Files: ProfileHolder.java ProfileRule.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG --- NEW FILE: ProfileHolder.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.service; /** * Description of the Interface * * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public interface ProfileHolder { /** * Sets the profile attribute of the ProfileHolder object * * @param profile The new profile value */ void setProfile(Profile profile); } --- NEW FILE: ProfileRule.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.service; import java.util.Map; import org.ejtools.util.state.DefaultRule; import org.xml.sax.Attributes; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class ProfileRule extends DefaultRule { /** * Description of the Method * * @param context Description of the Parameter */ public void loadEnter(Map context) { ProfileHolder holder = (ProfileHolder) context.get("HOLDER"); Profile profile = new Profile(); holder.setProfile(profile); context.put("PROFILE", profile); } /** * Description of the Class * * @author letiembl * @version $Revision: 1.1 $ * @created 18 juillet 2003 */ public static class ProfilePropertyRule extends DefaultRule { /** Description of the Field */ private String key; /** * Description of the Method * * @param context Description of the Parameter */ public void loadBody(Map context) { Profile profile = (Profile) context.get("PROFILE"); String text = (String) context.get("TEXT"); profile.put(this.key, text); } /** * Description of the Method * * @param context Description of the Parameter */ public void loadEnter(Map context) { Attributes attrs = (Attributes) context.get("ATTRIBUTES"); this.key = attrs.getValue("key"); } /** * Description of the Method * * @param context Description of the Parameter */ public void loadExit(Map context) { Profile profile = (Profile) context.get("PROFILE"); String text = profile.getProperty(this.key); if (text == null) { profile.setProperty(this.key, ""); } } } } Index: Profile.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/service/Profile.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Profile.java 8 Jan 2003 21:18:02 -0000 1.1 --- Profile.java 15 Sep 2003 22:23:45 -0000 1.2 *************** *** 11,16 **** /** ! * @author letiembl ! * @created 24 septembre 2002 * @version $Revision$ */ --- 11,15 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: ProfileMetaData.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/service/ProfileMetaData.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProfileMetaData.java 8 Jan 2003 21:17:55 -0000 1.1 --- ProfileMetaData.java 15 Sep 2003 22:23:45 -0000 1.2 *************** *** 10,15 **** /** ! * @author letiembl ! * @created 14 novembre 2002 * @version $Revision$ */ --- 10,14 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: ProfileService.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/service/ProfileService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProfileService.java 8 Jan 2003 21:18:03 -0000 1.1 --- ProfileService.java 15 Sep 2003 22:23:45 -0000 1.2 *************** *** 10,15 **** /** ! * @author letiembl ! * @created 4 septembre 2002 * @version $Revision$ */ --- 10,14 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: ProfileServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/service/ProfileServiceProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProfileServiceProvider.java 21 Feb 2003 22:41:00 -0000 1.2 --- ProfileServiceProvider.java 15 Sep 2003 22:23:45 -0000 1.3 *************** *** 16,25 **** import java.util.Vector; ! import org.apache.log4j.Category; import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; /** ! * @author letiembl ! * @created 4 septembre 2002 * @version $Revision$ */ --- 16,24 ---- import java.util.Vector; ! import org.apache.log4j.Logger; import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; /** ! * @author Laurent Etiemble * @version $Revision$ */ *************** *** 33,37 **** protected ProfileService service = null; /** Description of the Field */ ! private static Category logger = Category.getInstance(ProfileServiceProvider.class); --- 32,36 ---- protected ProfileService service = null; /** Description of the Field */ ! private static Logger logger = Logger.getLogger(ProfileServiceProvider.class); *************** *** 149,152 **** --- 148,152 ---- { String key = orderedKeys[i]; + logger.debug("Loading key " + key); Profile data = new Profile(); *************** *** 164,167 **** --- 164,168 ---- catch (IOException e) { + logger.error("Error while loading profiles", e); } } |
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/util Modified Files: ClassTools.java JNDI.java KeyLimitedStack.java LimitedStack.java Added Files: Platform.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG --- NEW FILE: Platform.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util; /** * Description of the Class * * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class Platform { /** Description of the Field */ private static String JAVA_VERSION; /** Description of the Field */ public final static boolean IS_JAVA_1_1 = Platform.getJavaVersionMatches(Platform.JAVA_1_1); /** Description of the Field */ public final static boolean IS_JAVA_1_2 = Platform.getJavaVersionMatches(Platform.JAVA_1_2); /** Description of the Field */ public final static boolean IS_JAVA_1_3 = Platform.getJavaVersionMatches(Platform.JAVA_1_3); /** Description of the Field */ public final static boolean IS_JAVA_1_4 = Platform.getJavaVersionMatches(Platform.JAVA_1_4); /** Description of the Field */ public final static boolean IS_JAVA_1_5 = Platform.getJavaVersionMatches(Platform.JAVA_1_5); /** Description of the Field */ public final static String JAVA_1_1 = "1.1"; /** Description of the Field */ public final static String JAVA_1_2 = "1.2"; /** Description of the Field */ public final static String JAVA_1_3 = "1.3"; /** Description of the Field */ public final static String JAVA_1_4 = "1.4"; /** Description of the Field */ public final static String JAVA_1_5 = "1.5"; /** Avoid instantiation */ private Platform() { } /** * Gets the javaVersion attribute of the Platform class * * @return The javaVersion value */ public static String getJavaVersion() { if (JAVA_VERSION == null) { JAVA_VERSION = System.getProperty("java.version"); } return JAVA_VERSION; } /** * Gets the javaVersionCompatible attribute of the Platform class * * @param version Description of the Parameter * @return The javaVersionCompatible value */ public static boolean isJavaVersionCompatible(String version) { if (getJavaVersion() == null) { return false; } return (JAVA_VERSION.compareTo(version) >= 0); } /** * Gets the javaVersionMatches attribute of the Platform class * * @param versionPrefix Description of the Parameter * @return The javaVersionMatches value */ private static boolean getJavaVersionMatches(String versionPrefix) { if (getJavaVersion() == null) { return false; } return JAVA_VERSION.startsWith(versionPrefix); } } Index: ClassTools.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/ClassTools.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassTools.java 21 Dec 2002 22:09:07 -0000 1.5 --- ClassTools.java 15 Sep 2003 22:23:45 -0000 1.6 *************** *** 13,18 **** * Utility class to handle Class realted stuff. * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 25 avril 2002 * @version $Revision$ */ --- 13,17 ---- * Utility class to handle Class realted stuff. * ! * @author Laurent Etiemble * @version $Revision$ */ Index: JNDI.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/JNDI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JNDI.java 8 Jan 2003 21:18:03 -0000 1.6 --- JNDI.java 15 Sep 2003 22:23:45 -0000 1.7 *************** *** 18,23 **** * Utility class to access environment properties for JNDI. * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 12 novembre 2001 * @version $Revision$ */ --- 18,22 ---- * Utility class to access environment properties for JNDI. * ! * @author Laurent Etiemble * @version $Revision$ */ Index: KeyLimitedStack.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/KeyLimitedStack.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** KeyLimitedStack.java 21 Dec 2002 22:09:07 -0000 1.5 --- KeyLimitedStack.java 15 Sep 2003 22:23:45 -0000 1.6 *************** *** 11,16 **** * Extension of the Limited Stack class, which doesn't allow duplicates. * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 14 novembre 2002 * @version $Revision$ */ --- 11,15 ---- * Extension of the Limited Stack class, which doesn't allow duplicates. * ! * @author Laurent Etiemble * @version $Revision$ */ Index: LimitedStack.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/LimitedStack.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LimitedStack.java 21 Dec 2002 22:09:07 -0000 1.5 --- LimitedStack.java 15 Sep 2003 22:23:45 -0000 1.6 *************** *** 12,17 **** * Extension of the Stack class, which has a limited depth (FIFO stack). This class doesn't allow duplicates. * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 24 décembre 2001 * @version $Revision$ */ --- 12,16 ---- * Extension of the Stack class, which has a limited depth (FIFO stack). This class doesn't allow duplicates. * ! * @author Laurent Etiemble * @version $Revision$ */ |
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/swing/table In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/swing/table Modified Files: TableModelDecorator.java TableModelFilter.java TableModelIndexed.java TableModelMatchFilter.java TableModelSorter.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG Index: TableModelDecorator.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/swing/table/TableModelDecorator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TableModelDecorator.java 8 Jan 2003 21:17:53 -0000 1.7 --- TableModelDecorator.java 15 Sep 2003 22:23:45 -0000 1.8 *************** *** 1,2 **** --- 1,8 ---- + /* + * EJTools, the Enterprise Java Tools + * + * Distributable under LGPL license. + * See terms of license at www.gnu.org. + */ package org.ejtools.swing.table; *************** *** 7,12 **** /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 28 septembre 2002 * @version $Revision$ */ --- 13,17 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: TableModelFilter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/swing/table/TableModelFilter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TableModelFilter.java 21 Dec 2002 22:09:07 -0000 1.5 --- TableModelFilter.java 15 Sep 2003 22:23:45 -0000 1.6 *************** *** 1,2 **** --- 1,8 ---- + /* + * EJTools, the Enterprise Java Tools + * + * Distributable under LGPL license. + * See terms of license at www.gnu.org. + */ package org.ejtools.swing.table; *************** *** 5,10 **** /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 * @version $Revision$ */ --- 11,15 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: TableModelIndexed.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/swing/table/TableModelIndexed.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TableModelIndexed.java 8 Jan 2003 21:17:51 -0000 1.6 --- TableModelIndexed.java 15 Sep 2003 22:23:45 -0000 1.7 *************** *** 1,2 **** --- 1,8 ---- + /* + * EJTools, the Enterprise Java Tools + * + * Distributable under LGPL license. + * See terms of license at www.gnu.org. + */ package org.ejtools.swing.table; *************** *** 4,9 **** /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 28 septembre 2002 * @version $Revision$ */ --- 10,14 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: TableModelMatchFilter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/swing/table/TableModelMatchFilter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TableModelMatchFilter.java 21 Feb 2003 22:40:59 -0000 1.6 --- TableModelMatchFilter.java 15 Sep 2003 22:23:45 -0000 1.7 *************** *** 1,2 **** --- 1,8 ---- + /* + * EJTools, the Enterprise Java Tools + * + * Distributable under LGPL license. + * See terms of license at www.gnu.org. + */ package org.ejtools.swing.table; *************** *** 6,11 **** /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 * @version $Revision$ */ --- 12,16 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: TableModelSorter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/swing/table/TableModelSorter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TableModelSorter.java 25 Dec 2002 22:03:55 -0000 1.6 --- TableModelSorter.java 15 Sep 2003 22:23:45 -0000 1.7 *************** *** 1,2 **** --- 1,8 ---- + /* + * EJTools, the Enterprise Java Tools + * + * Distributable under LGPL license. + * See terms of license at www.gnu.org. + */ package org.ejtools.swing.table; *************** *** 14,19 **** /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 * @version $Revision$ */ --- 20,24 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ *************** *** 43,50 **** /** ! * Add a mouse listener to the Table to trigger a table sort ! * when a column heading is clicked in the JTable. * ! * @param table The feature to be added to the MouseListenerToHeaderInTable attribute */ public void addMouseListenerToHeaderInTable(JTable table) --- 48,56 ---- /** ! * Add a mouse listener to the Table to trigger a table sort when a column ! * heading is clicked in the JTable. * ! * @param table The feature to be added to the MouseListenerToHeaderInTable ! * attribute */ public void addMouseListenerToHeaderInTable(JTable table) *************** *** 354,364 **** /** ! * This is a home-grown implementation which we have not had time ! * to research - it may perform poorly in some circumstances. It ! * requires twice the space of an in-place algorithm and makes ! * NlogN assigments shuttling the values between the two ! * arrays. The number of compares appears to vary between N-1 and ! * NlogN depending on the initial order but the main reason for ! * using it here is that, unlike qsort, it is stable. * * @param from Description of the Parameter --- 360,369 ---- /** ! * This is a home-grown implementation which we have not had time to research ! * - it may perform poorly in some circumstances. It requires twice the space ! * of an in-place algorithm and makes NlogN assigments shuttling the values ! * between the two arrays. The number of compares appears to vary between N-1 ! * and NlogN depending on the initial order but the main reason for using it ! * here is that, unlike qsort, it is stable. * * @param from Description of the Parameter *************** *** 428,437 **** public void sort(Object sender) { ! checkModel(); ! compares = 0; // n2sort(); // qsort(0, indexes.length-1); ! shuttlesort((int[]) indexes.clone(), indexes, 0, indexes.length); //System.out.println("Compares: "+compares); } --- 433,442 ---- public void sort(Object sender) { ! this.checkModel(); ! this.compares = 0; // n2sort(); // qsort(0, indexes.length-1); ! this.shuttlesort((int[]) indexes.clone(), indexes, 0, indexes.length); //System.out.println("Compares: "+compares); } |
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/jmx Modified Files: MBeanAccessor.java MBeanInvokeAccessor.java MBeanServerProxy.java ObjectNameFinder.java Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG Index: MBeanAccessor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/MBeanAccessor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MBeanAccessor.java 21 Feb 2003 22:41:00 -0000 1.6 --- MBeanAccessor.java 15 Sep 2003 22:23:45 -0000 1.7 *************** *** 17,21 **** * * @author Laurent Etiemble - * @created 11 avril 2002 * @version $Revision$ * @todo JavaDoc to complete --- 17,20 ---- Index: MBeanInvokeAccessor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/MBeanInvokeAccessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MBeanInvokeAccessor.java 21 Feb 2003 22:41:00 -0000 1.1 --- MBeanInvokeAccessor.java 15 Sep 2003 22:23:45 -0000 1.2 *************** *** 3,7 **** * * Distributable under LGPL license. ! * See terms of license at gnu.org. */ package org.ejtools.jmx; --- 3,7 ---- * * Distributable under LGPL license. ! * See terms of license at www.gnu.org. */ package org.ejtools.jmx; *************** *** 12,16 **** * * @author Laurent Etiemble - * @created 11 avril 2002 * @version $Revision$ * @todo JavaDoc to complete --- 12,15 ---- Index: MBeanServerProxy.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/MBeanServerProxy.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MBeanServerProxy.java 8 Jan 2003 21:18:04 -0000 1.6 --- MBeanServerProxy.java 15 Sep 2003 22:23:45 -0000 1.7 *************** *** 16,21 **** * A proxy for object that provides MBeanServer fonctionnality * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 4 septembre 2002 * @version $Revision$ */ --- 16,20 ---- * A proxy for object that provides MBeanServer fonctionnality * ! * @author Laurent Etiemble * @version $Revision$ */ *************** *** 58,62 **** if (m != null) { ! return m.invoke(this.object, args); } return null; --- 57,71 ---- if (m != null) { ! ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); ! ! try ! { ! Thread.currentThread().setContextClassLoader(this.clazz.getClassLoader()); ! return m.invoke(this.object, args); ! } ! finally ! { ! Thread.currentThread().setContextClassLoader(ctxLoader); ! } } return null; Index: ObjectNameFinder.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/ObjectNameFinder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ObjectNameFinder.java 21 Dec 2002 22:09:07 -0000 1.5 --- ObjectNameFinder.java 15 Sep 2003 22:23:45 -0000 1.6 *************** *** 3,7 **** * * Distributable under LGPL license. ! * See terms of license at gnu.org. */ package org.ejtools.jmx; --- 3,7 ---- * * Distributable under LGPL license. ! * See terms of license at www.gnu.org. */ package org.ejtools.jmx; *************** *** 11,16 **** * Interface implemented by structure that allows ObjectName search by canonical string. * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 11 avril 2002 * @version $Revision$ */ --- 11,15 ---- * Interface implemented by structure that allows ObjectName search by canonical string. * ! * @author Laurent Etiemble * @version $Revision$ */ |
|
From: <let...@us...> - 2003-09-15 22:23:48
|
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/beans/beancontext
In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/beans/beancontext
Modified Files:
CustomBeanContextServiceProvider.java
CustomBeanContextServicesSupport.java
Log Message:
Adjust Eclipse build files
Adjust some Javadoc
Integrate Persistence framework
Integrate Image export as PNG
Index: CustomBeanContextServiceProvider.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/beans/beancontext/CustomBeanContextServiceProvider.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** CustomBeanContextServiceProvider.java 21 Feb 2003 22:41:00 -0000 1.8
--- CustomBeanContextServiceProvider.java 15 Sep 2003 22:23:45 -0000 1.9
***************
*** 15,20 ****
* Super class that aggregates the Service support role, and the service provider role.
*
! * @author <a href="mailto:let...@us...">Laurent Etiemble</a>
! * @created 2 septembre 2002
* @version $Revision$
*/
--- 15,19 ----
* Super class that aggregates the Service support role, and the service provider role.
*
! * @author Laurent Etiemble
* @version $Revision$
*/
Index: CustomBeanContextServicesSupport.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/beans/beancontext/CustomBeanContextServicesSupport.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CustomBeanContextServicesSupport.java 21 Feb 2003 22:41:00 -0000 1.7
--- CustomBeanContextServicesSupport.java 15 Sep 2003 22:23:45 -0000 1.8
***************
*** 15,29 ****
import java.util.TooManyListenersException;
/**
* Enhancement of the {@link BeanContextServicesSupport} to provide an implementation
* for the <code>clear</code> method, and a recursive search for a particular service.
*
! * @author <a href="mailto:let...@us...">Laurent Etiemble</a>
! * @created 2 septembre 2002
* @version $Revision$
- * @todo remove the logger
*/
! public abstract class CustomBeanContextServicesSupport extends BeanContextServicesSupport
{
/** Implementation of the <code>clear</code> method */
public void clear()
--- 15,41 ----
import java.util.TooManyListenersException;
+ import org.ejtools.util.state.Storable;
+ import org.ejtools.util.state.StoreVisitor;
+
/**
* Enhancement of the {@link BeanContextServicesSupport} to provide an implementation
* for the <code>clear</code> method, and a recursive search for a particular service.
*
! * @author Laurent Etiemble
* @version $Revision$
*/
! public abstract class CustomBeanContextServicesSupport extends BeanContextServicesSupport implements Storable
{
+ /**
+ * Description of the Method
+ *
+ * @param visitor Description of the Parameter
+ */
+ public void accept(StoreVisitor visitor)
+ {
+ visitor.persist(this);
+ }
+
+
/** Implementation of the <code>clear</code> method */
public void clear()
|
|
From: <let...@us...> - 2003-09-15 22:23:48
|
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/beans
In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/main/org/ejtools/beans
Modified Files:
CustomPropertyEditorManager.java Sort.java
Log Message:
Adjust Eclipse build files
Adjust some Javadoc
Integrate Persistence framework
Integrate Image export as PNG
Index: CustomPropertyEditorManager.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/beans/CustomPropertyEditorManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CustomPropertyEditorManager.java 8 Jan 2003 21:18:07 -0000 1.6
--- CustomPropertyEditorManager.java 15 Sep 2003 22:23:44 -0000 1.7
***************
*** 17,22 ****
* is searched.
*
! * @author <a href="mailto:let...@us...">Laurent Etiemble</a>
! * @created 15 juillet 2002
* @version $Revision$
*/
--- 17,21 ----
* is searched.
*
! * @author Laurent Etiemble
* @version $Revision$
*/
***************
*** 41,46 ****
if (result == null)
{
- Class found = null;
-
// Search among the interfaces if there is one that has a PropertyEditor
Class[] interfaces = clazz.getInterfaces();
--- 40,43 ----
Index: Sort.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/beans/Sort.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Sort.java 21 Dec 2002 22:09:07 -0000 1.5
--- Sort.java 15 Sep 2003 22:23:45 -0000 1.6
***************
*** 17,22 ****
* Utility class that provides different kind of sort strategies for Iterator.
*
! * @author <a href="mailto:let...@us...">Laurent Etiemble</a>
! * @created 24 décembre 2001
* @version $Revision$
*/
--- 17,21 ----
* Utility class that provides different kind of sort strategies for Iterator.
*
! * @author Laurent Etiemble
* @version $Revision$
*/
|
|
From: <let...@us...> - 2003-09-15 22:23:47
|
Update of /cvsroot/ejtools/libraries/common/src/etc In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common/src/etc Removed Files: default.mf Log Message: Adjust Eclipse build files Adjust some Javadoc Integrate Persistence framework Integrate Image export as PNG --- default.mf DELETED --- |
|
From: <let...@us...> - 2003-09-15 22:23:47
|
Update of /cvsroot/ejtools/libraries/common
In directory sc8-pr-cvs1:/tmp/cvs-serv20661/common
Modified Files:
.cvsignore
Added Files:
.classpath .project
Removed Files:
module.properties
Log Message:
Adjust Eclipse build files
Adjust some Javadoc
Integrate Persistence framework
Integrate Image export as PNG
--- NEW FILE: .classpath ---
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="src" path="/ejtools-thirdparty"/>
<classpathentry kind="var" path="JRE_LIB" sourcepath="JDK_SRC"/>
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/mx4j/jars/mx4j-jmx-1.1.1.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/xalan/jars/xalan-2.4.1.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/xerces/jars/xerces-2.4.0.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/xml-apis/jars/xml-apis-1.0.b2.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/sun/jars/j2ee-1.4.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
--- NEW FILE: .project ---
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ejtools-libraries-common</name>
<comment></comment>
<projects>
<project>ejtools-thirdparty</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Index: .cvsignore
===================================================================
RCS file: /cvsroot/ejtools/libraries/common/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** .cvsignore 3 Mar 2003 21:35:57 -0000 1.2
--- .cvsignore 15 Sep 2003 22:23:44 -0000 1.3
***************
*** 1,3 ****
! dist
! output
! target
--- 1,4 ----
! bin
! dist
! output
! target
--- module.properties DELETED ---
|
|
From: <let...@us...> - 2003-09-15 22:11:30
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph/renderer Modified Files: AbstractGraphRenderer.java BorderLayoutRenderer.java DefaultGraphRenderer.java GridBagLayoutRenderer.java GridGraphRenderer.java HorizontalAxis.java JPanelGraphRenderer.java TriAxisLayoutRenderer.java VerticalAxis.java Log Message: Adjust some Javadoc. Index: AbstractGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/AbstractGraphRenderer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.5 --- AbstractGraphRenderer.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,89 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class AbstractGraphRenderer extends JComponent implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected double horizontalScale = 1.0d; ! /** Description of the Field */ ! protected int horizontalScaling = ALIGN_RIGHT; ! /** Description of the Field */ ! protected double verticalScale = 1.0d; ! /** Description of the Field */ ! protected int verticalScaling = BOUNDED; ! ! ! /** Constructor for TrackRenderer. */ ! public AbstractGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! this.horizontalScale = multiplier; ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! this.horizontalScaling = type; ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! this.verticalScale = multiplier; ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) { } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected abstract void paintComponent(Graphics graphics); ! } --- 1,88 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class AbstractGraphRenderer extends JComponent implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected double horizontalScale = 1.0d; ! /** Description of the Field */ ! protected int horizontalScaling = ALIGN_RIGHT; ! /** Description of the Field */ ! protected double verticalScale = 1.0d; ! /** Description of the Field */ ! protected int verticalScaling = BOUNDED; ! ! ! /** Constructor for TrackRenderer. */ ! public AbstractGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! this.horizontalScale = multiplier; ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! this.horizontalScaling = type; ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! this.verticalScale = multiplier; ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) { } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected abstract void paintComponent(Graphics graphics); ! } Index: BorderLayoutRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/BorderLayoutRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BorderLayoutRenderer.java 15 Sep 2003 22:02:50 -0000 1.4 --- BorderLayoutRenderer.java 15 Sep 2003 22:11:22 -0000 1.5 *************** *** 1,45 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BorderLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public BorderLayoutRenderer() ! { ! super(new BorderLayout()); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param position The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, String position) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, position); ! } ! ! } --- 1,44 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BorderLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public BorderLayoutRenderer() ! { ! super(new BorderLayout()); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param position The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, String position) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, position); ! } ! ! } Index: DefaultGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/DefaultGraphRenderer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DefaultGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.6 --- DefaultGraphRenderer.java 15 Sep 2003 22:11:22 -0000 1.7 *************** *** 1,63 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! import java.awt.Insets; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphRenderer extends AbstractGraphRenderer ! { ! /** Constructor for TrackRenderer. */ ! public DefaultGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d; ! offsetX = width - maxX; ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } --- 1,62 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! import java.awt.Insets; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphRenderer extends AbstractGraphRenderer ! { ! /** Constructor for TrackRenderer. */ ! public DefaultGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d; ! offsetX = width - maxX; ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } Index: GridBagLayoutRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/GridBagLayoutRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GridBagLayoutRenderer.java 15 Sep 2003 22:02:50 -0000 1.4 --- GridBagLayoutRenderer.java 15 Sep 2003 22:11:22 -0000 1.5 *************** *** 1,44 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridBagLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public GridBagLayoutRenderer() ! { ! super(new GridBagLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param constraints The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, GridBagConstraints constraints) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, constraints); ! } ! ! } --- 1,43 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridBagLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public GridBagLayoutRenderer() ! { ! super(new GridBagLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param constraints The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, GridBagConstraints constraints) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, constraints); ! } ! ! } Index: GridGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/GridGraphRenderer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GridGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.5 --- GridGraphRenderer.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,138 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridGraphRenderer extends Axis ! { ! /** Description of the Field */ ! protected Format horizontalFormat = null; ! /** Description of the Field */ ! protected Format verticalFormat = null; ! ! ! /** ! *Constructor for the GridRenderer object ! * ! * @param horizontalFormat Description of the Parameter ! * @param verticalFormat Description of the Parameter ! */ ! public GridGraphRenderer(Format horizontalFormat, Format verticalFormat) ! { ! this.format = horizontalFormat; ! this.horizontalFormat = horizontalFormat; ! this.verticalFormat = verticalFormat; ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! graphics.setColor(Color.lightGray); ! ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - maxX * this.horizontalScale; ! } ! ! // Render horizontal lines ! minX = (x - offsetX) / scaleX; ! this.format = this.horizontalFormat; ! ! String minText = this.getFormated(minX); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(maxX); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of lines ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine((int) (i * multiplier), 0, (int) (i * multiplier), (int) height); ! } ! ! // Render horizontal lines ! this.format = this.verticalFormat; ! ! minText = this.getFormated(minY); ! minBounds = metrics.getStringBounds(minText, graphics); ! maxText = this.getFormated(maxY); ! maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Vertical drawing ! bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(0, (int) (i * multiplier), (int) width, (int) (i * multiplier)); ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } --- 1,137 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridGraphRenderer extends Axis ! { ! /** Description of the Field */ ! protected Format horizontalFormat = null; ! /** Description of the Field */ ! protected Format verticalFormat = null; ! ! ! /** ! *Constructor for the GridRenderer object ! * ! * @param horizontalFormat Description of the Parameter ! * @param verticalFormat Description of the Parameter ! */ ! public GridGraphRenderer(Format horizontalFormat, Format verticalFormat) ! { ! this.format = horizontalFormat; ! this.horizontalFormat = horizontalFormat; ! this.verticalFormat = verticalFormat; ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! graphics.setColor(Color.lightGray); ! ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - maxX * this.horizontalScale; ! } ! ! // Render horizontal lines ! minX = (x - offsetX) / scaleX; ! this.format = this.horizontalFormat; ! ! String minText = this.getFormated(minX); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(maxX); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of lines ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine((int) (i * multiplier), 0, (int) (i * multiplier), (int) height); ! } ! ! // Render horizontal lines ! this.format = this.verticalFormat; ! ! minText = this.getFormated(minY); ! minBounds = metrics.getStringBounds(minText, graphics); ! maxText = this.getFormated(maxY); ! maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Vertical drawing ! bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(0, (int) (i * multiplier), (int) width, (int) (i * multiplier)); ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } Index: HorizontalAxis.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/HorizontalAxis.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HorizontalAxis.java 15 Sep 2003 22:02:50 -0000 1.5 --- HorizontalAxis.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,131 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class HorizontalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public HorizontalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = HORIZONTAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! // int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getXRange().getMin(); ! double max = element.getXRange().getMax(); ! ! double scaleX = width / (max - min); ! double offsetX = x - scaleX * min; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -min; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - max * this.horizontalScale; ! } ! ! min = (x - offsetX) / scaleX; ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the baseline ! graphics.drawLine(0, 0, (int) width, 0); ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() / 2); ! } ! ! // Draw the ticks ! multiplier = width / ticks; ! ! // Draw first tick ! graphics.drawLine(0, 0, 0, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(minText, 0, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() - metrics.getDescent()); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j - (int) (middleBounds.getWidth() / 2); ! ! graphics.drawString(display, j, (int) (height - metrics.getDescent())); ! } ! ! // Draw last tick ! graphics.drawLine((int) width, 0, (int) width, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(maxText, (int) (width - maxBounds.getWidth()), (int) (height - metrics.getDescent())); ! } ! } --- 1,130 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class HorizontalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public HorizontalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = HORIZONTAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! // int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getXRange().getMin(); ! double max = element.getXRange().getMax(); ! ! double scaleX = width / (max - min); ! double offsetX = x - scaleX * min; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -min; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - max * this.horizontalScale; ! } ! ! min = (x - offsetX) / scaleX; ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the baseline ! graphics.drawLine(0, 0, (int) width, 0); ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() / 2); ! } ! ! // Draw the ticks ! multiplier = width / ticks; ! ! // Draw first tick ! graphics.drawLine(0, 0, 0, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(minText, 0, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() - metrics.getDescent()); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j - (int) (middleBounds.getWidth() / 2); ! ! graphics.drawString(display, j, (int) (height - metrics.getDescent())); ! } ! ! // Draw last tick ! graphics.drawLine((int) width, 0, (int) width, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(maxText, (int) (width - maxBounds.getWidth()), (int) (height - metrics.getDescent())); ! } ! } Index: JPanelGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/JPanelGraphRenderer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JPanelGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.5 --- JPanelGraphRenderer.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,126 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! import java.awt.LayoutManager; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JComponent; ! import javax.swing.JPanel; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class JPanelGraphRenderer extends JPanel implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected Vector renderers = new Vector(); ! ! ! /** ! * Constructor for JPanelGraph. ! * ! * @param layout ! */ ! public JPanelGraphRenderer(LayoutManager layout) ! { ! super(layout); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** Constructor for Graph. */ ! public JPanelGraphRenderer() ! { ! this(new BorderLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! */ ! public void addRenderer(GraphRenderer renderer) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setGraphElement(this.element); ! } ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScaling(type); ! } ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScaling(type); ! } ! } ! } --- 1,125 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! import java.awt.LayoutManager; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JComponent; ! import javax.swing.JPanel; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class JPanelGraphRenderer extends JPanel implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected Vector renderers = new Vector(); ! ! ! /** ! * Constructor for JPanelGraph. ! * ! * @param layout ! */ ! public JPanelGraphRenderer(LayoutManager layout) ! { ! super(layout); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** Constructor for Graph. */ ! public JPanelGraphRenderer() ! { ! this(new BorderLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! */ ! public void addRenderer(GraphRenderer renderer) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setGraphElement(this.element); ! } ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScaling(type); ! } ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScaling(type); ! } ! } ! } Index: TriAxisLayoutRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/TriAxisLayoutRenderer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TriAxisLayoutRenderer.java 15 Sep 2003 22:02:50 -0000 1.6 --- TriAxisLayoutRenderer.java 15 Sep 2003 22:11:22 -0000 1.7 *************** *** 1,90 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.text.DecimalFormat; ! import java.text.SimpleDateFormat; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! import org.ejtools.graph.LabelElement; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 13 novembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class TriAxisLayoutRenderer extends GridBagLayoutRenderer ! { ! /** Constructor for TriAxisGraph. */ ! public TriAxisLayoutRenderer() ! { ! super(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! ! GraphRenderer rd = new GridGraphRenderer(new SimpleDateFormat("HH:mm:ss"), new DecimalFormat("0")); ! constraints.gridx = 1; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.BOTH; ! constraints.weightx = 1.0; ! constraints.weighty = 1.0; ! this.addRenderer(rd, constraints); ! ! Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss"), Axis.BOTTOM); ! constraints.gridx = 1; ! constraints.gridy = 2; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! constraints.gridx = 0; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! constraints.gridx = 2; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! super.setGraphElement(element); ! ! if (element instanceof LabelElement) ! { ! JComponent component = ((LabelElement) this.element).getComponent(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! constraints.gridx = 0; ! constraints.gridy = 0; ! constraints.gridwidth = 3; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.add(component, constraints); ! } ! } ! } --- 1,89 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.text.DecimalFormat; ! import java.text.SimpleDateFormat; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! import org.ejtools.graph.LabelElement; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class TriAxisLayoutRenderer extends GridBagLayoutRenderer ! { ! /** Constructor for TriAxisGraph. */ ! public TriAxisLayoutRenderer() ! { ! super(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! ! GraphRenderer rd = new GridGraphRenderer(new SimpleDateFormat("HH:mm:ss"), new DecimalFormat("0")); ! constraints.gridx = 1; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.BOTH; ! constraints.weightx = 1.0; ! constraints.weighty = 1.0; ! this.addRenderer(rd, constraints); ! ! Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss"), Axis.BOTTOM); ! constraints.gridx = 1; ! constraints.gridy = 2; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! constraints.gridx = 0; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! constraints.gridx = 2; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! super.setGraphElement(element); ! ! if (element instanceof LabelElement) ! { ! JComponent component = ((LabelElement) this.element).getComponent(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! constraints.gridx = 0; ! constraints.gridy = 0; ! constraints.gridwidth = 3; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.add(component, constraints); ! } ! } ! } Index: VerticalAxis.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/VerticalAxis.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VerticalAxis.java 15 Sep 2003 22:02:50 -0000 1.5 --- VerticalAxis.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,160 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.Dimension; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class VerticalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public VerticalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = VERTICAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! int base; ! int small; ! int middle; ! int correction; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! // int x = this.getX() + insets.left; ! // int y = this.getY() + insets.top; ! // double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getYRange().getMin(); ! double max = element.getYRange().getMax(); ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // New dimension ! double newBound = Math.max(minBounds.getWidth(), maxBounds.getWidth()); ! this.dimension = new Dimension((int) (newBound + FONT.getSize()), this.getHeight()); ! this.revalidate(); ! ! // Vertical drawing ! double bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Set parameters ! if (this.position == LEFT) ! { ! middle = (int) (newBound); ! small = middle + FONT.getSize() / 2 - 1; ! base = middle + FONT.getSize() - 1; ! } ! else ! { ! middle = FONT.getSize() - 2; ! small = FONT.getSize() / 2 - 1; ! base = 0; ! } ! ! // Draw the baseline ! graphics.drawLine(base, 0, base, (int) height); ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(base, (int) (i * multiplier), small, (int) (i * multiplier)); ! } ! ! // draw ticks ! multiplier = height / ticks; ! ! // Draw first tick ! graphics.drawLine(base, (int) height, middle, (int) height); ! if (this.position == LEFT) ! { ! correction = -(int) minBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(minText, middle + correction, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (height - i * multiplier); ! graphics.drawLine(base, j, middle, j); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j + (int) (middleBounds.getHeight() / 2); ! if (this.position == LEFT) ! { ! correction = -(int) middleBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(display, middle + correction, j); ! } ! ! // Draw last tick ! graphics.drawLine(base, 0, middle, 0); ! if (this.position == LEFT) ! { ! correction = -(int) maxBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(maxText, middle + correction, metrics.getAscent()); ! } ! } --- 1,159 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.Dimension; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class VerticalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public VerticalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = VERTICAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! int base; ! int small; ! int middle; ! int correction; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! // int x = this.getX() + insets.left; ! // int y = this.getY() + insets.top; ! // double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getYRange().getMin(); ! double max = element.getYRange().getMax(); ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // New dimension ! double newBound = Math.max(minBounds.getWidth(), maxBounds.getWidth()); ! this.dimension = new Dimension((int) (newBound + FONT.getSize()), this.getHeight()); ! this.revalidate(); ! ! // Vertical drawing ! double bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Set parameters ! if (this.position == LEFT) ! { ! middle = (int) (newBound); ! small = middle + FONT.getSize() / 2 - 1; ! base = middle + FONT.getSize() - 1; ! } ! else ! { ! middle = FONT.getSize() - 2; ! small = FONT.getSize() / 2 - 1; ! base = 0; ! } ! ! // Draw the baseline ! graphics.drawLine(base, 0, base, (int) height); ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(base, (int) (i * multiplier), small, (int) (i * multiplier)); ! } ! ! // draw ticks ! multiplier = height / ticks; ! ! // Draw first tick ! graphics.drawLine(base, (int) height, middle, (int) height); ! if (this.position == LEFT) ! { ! correction = -(int) minBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(minText, middle + correction, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (height - i * multiplier); ! graphics.drawLine(base, j, middle, j); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j + (int) (middleBounds.getHeight() / 2); ! if (this.position == LEFT) ! { ! correction = -(int) middleBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(display, middle + correction, j); ! } ! ! // Draw last tick ! graphics.drawLine(base, 0, middle, 0); ! if (this.position == LEFT) ! { ! correction = -(int) maxBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(maxText, middle + correction, metrics.getAscent()); ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:11:28
|
Update of /cvsroot/ejtools/libraries/graph/src/resources/org/ejtools/graph/frame In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/resources/org/ejtools/graph/frame Modified Files: GraphInternalFrameBeanInfo_fr_FR.properties Log Message: Adjust some Javadoc. Index: GraphInternalFrameBeanInfo_fr_FR.properties =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/resources/org/ejtools/graph/frame/GraphInternalFrameBeanInfo_fr_FR.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GraphInternalFrameBeanInfo_fr_FR.properties 15 Sep 2003 22:02:50 -0000 1.2 --- GraphInternalFrameBeanInfo_fr_FR.properties 15 Sep 2003 22:11:23 -0000 1.3 *************** *** 1,15 **** # ! # Fichier généré - Ne pas éditer! # # Fichier properties de messages pour GraphInternalFrame. # bean.displayName=Graphique ! bean.shortDescription=Fenête de graphique property.name.displayName=Nom property.name.shortDescription=Nom du graphique ! property.delay.displayName=Délai de rafaîchissement ! property.delay.shortDescription=Temps entre deux rafaîchissements property.scale.displayName=Echelle horizontale --- 1,15 ---- # ! # Fichier généré - Ne pas éditer! # # Fichier properties de messages pour GraphInternalFrame. # bean.displayName=Graphique ! bean.shortDescription=Fenêtre de graphique property.name.displayName=Nom property.name.shortDescription=Nom du graphique ! property.delay.displayName=Délai de rafaîchissement ! property.delay.shortDescription=Temps entre deux rafaîchissements property.scale.displayName=Echelle horizontale |
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph/service Modified Files: GraphConsumer.java GraphConsumerMediator.java GraphConsumerSelector.java GraphProducer.java GraphService.java GraphServiceProvider.java Log Message: Adjust some Javadoc. Index: GraphConsumer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service/GraphConsumer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GraphConsumer.java 15 Sep 2003 22:02:50 -0000 1.3 --- GraphConsumer.java 15 Sep 2003 22:11:22 -0000 1.4 *************** *** 9,14 **** /** ! * @author letiemble ! * @created 27 novembre 2002 * @version $Revision$ */ --- 9,13 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ Index: GraphConsumerMediator.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service/GraphConsumerMediator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GraphConsumerMediator.java 15 Sep 2003 22:02:50 -0000 1.2 --- GraphConsumerMediator.java 15 Sep 2003 22:11:22 -0000 1.3 *************** *** 1,23 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.service; ! ! ! /** ! * @author letiemble ! * @created 17 février 2003 ! * @version $Revision$ ! */ ! public interface GraphConsumerMediator ! { ! /** ! * Gets the graphConsumers attribute of the GraphMediator object ! * ! * @return The graphConsumers value ! */ ! public GraphConsumer[] getGraphConsumers(); ! } --- 1,22 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.service; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface GraphConsumerMediator ! { ! /** ! * Gets the graphConsumers attribute of the GraphMediator object ! * ! * @return The graphConsumers value ! */ ! public GraphConsumer[] getGraphConsumers(); ! } Index: GraphConsumerSelector.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service/GraphConsumerSelector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GraphConsumerSelector.java 15 Sep 2003 22:02:50 -0000 1.3 --- GraphConsumerSelector.java 15 Sep 2003 22:11:22 -0000 1.4 *************** *** 17,22 **** * Description of the Class * ! * @author letiemble ! * @created 8 avril 2002 * @version $Revision$ */ --- 17,21 ---- * Description of the Class * ! * @author Laurent Etiemble * @version $Revision$ */ Index: GraphProducer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service/GraphProducer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GraphProducer.java 15 Sep 2003 22:02:50 -0000 1.3 --- GraphProducer.java 15 Sep 2003 22:11:22 -0000 1.4 *************** *** 1,31 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.service; ! ! ! /** ! * @author letiemble ! * @created 27 novembre 2002 ! * @version $Revision$ ! */ ! public interface GraphProducer ! { ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public double produce(); ! ! ! /** ! * Gets the graphProducerId attribute of the GraphProducer object ! * ! * @return The graphProducerId value ! */ ! public String getGraphProducerId(); ! } --- 1,30 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.service; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface GraphProducer ! { ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public double produce(); ! ! ! /** ! * Gets the graphProducerId attribute of the GraphProducer object ! * ! * @return The graphProducerId value ! */ ! public String getGraphProducerId(); ! } Index: GraphService.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service/GraphService.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GraphService.java 15 Sep 2003 22:02:50 -0000 1.3 --- GraphService.java 15 Sep 2003 22:11:22 -0000 1.4 *************** *** 1,48 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.service; ! ! ! /** ! * @author letiemble ! * @created 27 novembre 2002 ! * @version $Revision$ ! */ ! public interface GraphService extends GraphConsumerMediator ! { ! /** ! * Adds a feature to the GraphProducer attribute of the GraphService object ! * ! * @param producer The feature to be added to the GraphProducer attribute ! * @param consumer The feature to be added to the GraphProducer attribute ! */ ! public void addGraphProducer(GraphConsumer consumer, GraphProducer producer); ! ! ! /** ! * Description of the Method ! * ! * @param producer Description of the Parameter ! */ ! public void removeGraphProducer(GraphProducer producer); ! ! ! /** ! * Adds a feature to the GraphConsumer attribute of the GraphService object ! * ! * @param consumer The feature to be added to the GraphConsumer attribute ! */ ! public void addGraphConsumer(GraphConsumer consumer); ! ! ! /** ! * Description of the Method ! * ! * @param consumer Description of the Parameter ! */ ! public void removeGraphConsumer(GraphConsumer consumer); ! } --- 1,47 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.service; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface GraphService extends GraphConsumerMediator ! { ! /** ! * Adds a feature to the GraphProducer attribute of the GraphService object ! * ! * @param producer The feature to be added to the GraphProducer attribute ! * @param consumer The feature to be added to the GraphProducer attribute ! */ ! public void addGraphProducer(GraphConsumer consumer, GraphProducer producer); ! ! ! /** ! * Description of the Method ! * ! * @param producer Description of the Parameter ! */ ! public void removeGraphProducer(GraphProducer producer); ! ! ! /** ! * Adds a feature to the GraphConsumer attribute of the GraphService object ! * ! * @param consumer The feature to be added to the GraphConsumer attribute ! */ ! public void addGraphConsumer(GraphConsumer consumer); ! ! ! /** ! * Description of the Method ! * ! * @param consumer Description of the Parameter ! */ ! public void removeGraphConsumer(GraphConsumer consumer); ! } Index: GraphServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/service/GraphServiceProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GraphServiceProvider.java 15 Sep 2003 22:02:50 -0000 1.3 --- GraphServiceProvider.java 15 Sep 2003 22:11:22 -0000 1.4 *************** *** 17,22 **** /** ! * @author letiemble ! * @created 27 novembre 2002 * @version $Revision$ */ --- 17,21 ---- /** ! * @author Laurent Etiemble * @version $Revision$ */ *************** *** 141,145 **** { parent.remove(consumer); ! logger.debug("GraphConsumer removed"); } } --- 140,144 ---- { parent.remove(consumer); ! logger.debug("GraphConsumer removed"); } } |
|
From: <let...@us...> - 2003-09-15 22:11:28
|
Update of /cvsroot/ejtools/libraries/graph/src/resources/org/ejtools/graph In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/resources/org/ejtools/graph Modified Files: GraphService_fr_FR.properties Log Message: Adjust some Javadoc. Index: GraphService_fr_FR.properties =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/resources/org/ejtools/graph/GraphService_fr_FR.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GraphService_fr_FR.properties 15 Sep 2003 22:02:50 -0000 1.2 --- GraphService_fr_FR.properties 15 Sep 2003 22:11:23 -0000 1.3 *************** *** 11,16 **** # Graph related text ! graph.dialog.title=Ajouter à un graphique ! graph.dialog.text.description=Choisissez un graphique existant ou créez-en un nouveau graph.dialog.button.select=Utiliser graph.dialog.button.cancel=Annuler --- 11,16 ---- # Graph related text ! graph.dialog.title=Ajouter à un graphique ! graph.dialog.text.description=Choisissez un graphique existant ou créez-en un nouveau graph.dialog.button.select=Utiliser graph.dialog.button.cancel=Annuler *************** *** 19,20 **** --- 19,26 ---- graph.text.prefix=Graphique graph.button.remove=Retirer + + action.tools=Outils + action.tools.export.as.text=Exporter en données texte + action.tools.export.as.text.tooltip=Exporter en données texte CSV + action.tools.export.as.image=Exporter en image + action.tools.export.as.image.tooltip=Exporter en image PNG |
|
From: <let...@us...> - 2003-09-15 22:11:28
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph Modified Files: Axis.java CompositeTrack.java DefaultGraphElement.java GraphElement.java GraphRenderer.java LabelElement.java Range.java Test.java Track.java Log Message: Adjust some Javadoc. Index: Axis.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Axis.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Axis.java 15 Sep 2003 22:02:49 -0000 1.6 --- Axis.java 15 Sep 2003 22:11:22 -0000 1.7 *************** *** 1,174 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Dimension; ! import java.awt.Font; ! import java.text.DateFormat; ! import java.text.DecimalFormat; ! import java.text.Format; ! import java.text.NumberFormat; ! import java.util.Date; ! ! import org.ejtools.graph.renderer.AbstractGraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class Axis extends AbstractGraphRenderer ! { ! /** Description of the Field */ ! protected Dimension dimension = null; ! /** Description of the Field */ ! protected Format format = new DecimalFormat("0"); ! /** Description of the Field */ ! protected int orientation; ! /** Description of the Field */ ! protected int position; ! /** Description of the Field */ ! protected Range range = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected static Font FONT = new Font("Courrier", Font.PLAIN, 10); ! /** Description of the Field */ ! public final static int BOTTOM = 4; ! /** Description of the Field */ ! public final static int HORIZONTAL = 0; ! /** Description of the Field */ ! public final static int LEFT = 2; ! /** Description of the Field */ ! public final static int RIGHT = 3; ! /** Description of the Field */ ! public final static int TOP = 5; ! /** Description of the Field */ ! public final static int VERTICAL = 1; ! ! ! /** Constructor for Axis. */ ! public Axis() { } ! ! ! /** ! * Returns the format. ! * ! * @return Format ! */ ! public Format getFormat() ! { ! return format; ! } ! ! ! /** ! * Gets the formated attribute of the Axis object ! * ! * @param value Description of the Parameter ! * @return The formated value ! */ ! public String getFormated(double value) ! { ! if (this.format instanceof NumberFormat) ! { ! return ((NumberFormat) this.format).format(value); ! } ! if (this.format instanceof DateFormat) ! { ! return ((DateFormat) this.format).format(new Date((long) value)); ! } ! return null; ! } ! ! ! /** ! * @return The minimumSize value ! */ ! public Dimension getMinimumSize() ! { ! if (this.dimension == null) ! { ! this.dimension = new Dimension(FONT.getSize() * 2, FONT.getSize() * 2); ! } ! return dimension; ! } ! ! ! /** ! * Returns the orientation. ! * ! * @return int ! */ ! public int getOrientation() ! { ! return orientation; ! } ! ! ! /** ! * Returns the position. ! * ! * @return int ! */ ! public int getPosition() ! { ! return position; ! } ! ! ! /** ! * @return The preferredSize value ! */ ! public Dimension getPreferredSize() ! { ! return this.getMinimumSize(); ! } ! ! ! /** ! * Returns the range. ! * ! * @return Range ! */ ! public Range getRange() ! { ! return range; ! } ! ! ! /** ! * Sets the format. ! * ! * @param format The format to set ! */ ! public void setFormat(Format format) ! { ! this.format = format; ! } ! ! ! /** ! * Sets the position. ! * ! * @param position The position to set ! */ ! public void setPosition(int position) ! { ! this.position = position; ! } ! ! ! /** ! * Sets the range. ! * ! * @param range The new range value ! */ ! public void setRange(Range range) ! { ! this.range = range; ! } ! } --- 1,173 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Dimension; ! import java.awt.Font; ! import java.text.DateFormat; ! import java.text.DecimalFormat; ! import java.text.Format; ! import java.text.NumberFormat; ! import java.util.Date; ! ! import org.ejtools.graph.renderer.AbstractGraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class Axis extends AbstractGraphRenderer ! { ! /** Description of the Field */ ! protected Dimension dimension = null; ! /** Description of the Field */ ! protected Format format = new DecimalFormat("0"); ! /** Description of the Field */ ! protected int orientation; ! /** Description of the Field */ ! protected int position; ! /** Description of the Field */ ! protected Range range = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected static Font FONT = new Font("Courrier", Font.PLAIN, 10); ! /** Description of the Field */ ! public final static int BOTTOM = 4; ! /** Description of the Field */ ! public final static int HORIZONTAL = 0; ! /** Description of the Field */ ! public final static int LEFT = 2; ! /** Description of the Field */ ! public final static int RIGHT = 3; ! /** Description of the Field */ ! public final static int TOP = 5; ! /** Description of the Field */ ! public final static int VERTICAL = 1; ! ! ! /** Constructor for Axis. */ ! public Axis() { } ! ! ! /** ! * Returns the format. ! * ! * @return Format ! */ ! public Format getFormat() ! { ! return format; ! } ! ! ! /** ! * Gets the formated attribute of the Axis object ! * ! * @param value Description of the Parameter ! * @return The formated value ! */ ! public String getFormated(double value) ! { ! if (this.format instanceof NumberFormat) ! { ! return ((NumberFormat) this.format).format(value); ! } ! if (this.format instanceof DateFormat) ! { ! return ((DateFormat) this.format).format(new Date((long) value)); ! } ! return null; ! } ! ! ! /** ! * @return The minimumSize value ! */ ! public Dimension getMinimumSize() ! { ! if (this.dimension == null) ! { ! this.dimension = new Dimension(FONT.getSize() * 2, FONT.getSize() * 2); ! } ! return dimension; ! } ! ! ! /** ! * Returns the orientation. ! * ! * @return int ! */ ! public int getOrientation() ! { ! return orientation; ! } ! ! ! /** ! * Returns the position. ! * ! * @return int ! */ ! public int getPosition() ! { ! return position; ! } ! ! ! /** ! * @return The preferredSize value ! */ ! public Dimension getPreferredSize() ! { ! return this.getMinimumSize(); ! } ! ! ! /** ! * Returns the range. ! * ! * @return Range ! */ ! public Range getRange() ! { ! return range; ! } ! ! ! /** ! * Sets the format. ! * ! * @param format The format to set ! */ ! public void setFormat(Format format) ! { ! this.format = format; ! } ! ! ! /** ! * Sets the position. ! * ! * @param position The position to set ! */ ! public void setPosition(int position) ! { ! this.position = position; ! } ! ! ! /** ! * Sets the range. ! * ! * @param range The new range value ! */ ! public void setRange(Range range) ! { ! this.range = range; ! } ! } Index: CompositeTrack.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/CompositeTrack.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CompositeTrack.java 15 Sep 2003 22:02:49 -0000 1.6 --- CompositeTrack.java 15 Sep 2003 22:11:22 -0000 1.7 *************** *** 20,26 **** * Description of the Class * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> * @version $Revision$ - * @created 4 septembre 2002 * @todo Javadoc to complete */ --- 20,25 ---- * Description of the Class * ! * @author Laurent Etiemble * @version $Revision$ * @todo Javadoc to complete */ Index: DefaultGraphElement.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/DefaultGraphElement.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DefaultGraphElement.java 15 Sep 2003 22:02:49 -0000 1.6 --- DefaultGraphElement.java 15 Sep 2003 22:11:22 -0000 1.7 *************** *** 1,65 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 5 novembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphElement implements GraphElement ! { ! /** Description of the Field */ ! protected Range xr = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected Range yr = new Range(0.0d, 1.0d); ! ! ! /** Constructor for DefaultElement. */ ! public DefaultGraphElement() { } ! ! ! /** ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY) { } ! ! ! /** ! * @return The color value ! */ ! public Color getColor() ! { ! return Color.black; ! } ! ! ! /** ! * @return The xRange value ! */ ! public Range getXRange() ! { ! return this.xr; ! } ! ! ! /** ! * @return The yRange value ! */ ! public Range getYRange() ! { ! return this.yr; ! } ! } --- 1,64 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphElement implements GraphElement ! { ! /** Description of the Field */ ! protected Range xr = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected Range yr = new Range(0.0d, 1.0d); ! ! ! /** Constructor for DefaultElement. */ ! public DefaultGraphElement() { } ! ! ! /** ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY) { } ! ! ! /** ! * @return The color value ! */ ! public Color getColor() ! { ! return Color.black; ! } ! ! ! /** ! * @return The xRange value ! */ ! public Range getXRange() ! { ! return this.xr; ! } ! ! ! /** ! * @return The yRange value ! */ ! public Range getYRange() ! { ! return this.yr; ! } ! } Index: GraphElement.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/GraphElement.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GraphElement.java 15 Sep 2003 22:02:49 -0000 1.5 --- GraphElement.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,54 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphElement ! { ! /** ! * Gets the xRange attribute of the GraphModel object ! * ! * @return The xRange value ! */ ! public Range getXRange(); ! ! ! /** ! * Gets the color attribute of the Element object ! * ! * @return The color value ! */ ! public Color getColor(); ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY); ! ! ! /** ! * Gets the yRange attribute of the GraphModel object ! * ! * @return The yRange value ! */ ! public Range getYRange(); ! } --- 1,53 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphElement ! { ! /** ! * Gets the xRange attribute of the GraphModel object ! * ! * @return The xRange value ! */ ! public Range getXRange(); ! ! ! /** ! * Gets the color attribute of the Element object ! * ! * @return The color value ! */ ! public Color getColor(); ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY); ! ! ! /** ! * Gets the yRange attribute of the GraphModel object ! * ! * @return The yRange value ! */ ! public Range getYRange(); ! } Index: GraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/GraphRenderer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GraphRenderer.java 15 Sep 2003 22:02:49 -0000 1.5 --- GraphRenderer.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,70 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Interface ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 4 septembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphRenderer ! { ! /** Description of the Field */ ! public final static int ALIGN_LEFT = 0; ! /** Description of the Field */ ! public final static int ALIGN_RIGHT = 1; ! /** Description of the Field */ ! public final static int JUSTIFIED = 3; ! /** Description of the Field */ ! public final static int SMOOTH = 10; ! /** Description of the Field */ ! public final static int BOUNDED = 11; ! ! ! /** ! * Sets the graphElement attribute of the GraphRenderer object ! * ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element); ! ! ! /** ! * Sets the display attribute of the GraphRenderer object ! * ! * @param type The new display value ! */ ! public void setHorizontalScaling(int type); ! ! ! /** ! * Sets the horizontalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier); ! ! ! /** ! * Sets the verticalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier); ! ! ! /** ! * Sets the verticalDisplay attribute of the GraphRenderer object ! * ! * @param type The new verticalDisplay value ! */ ! public void setVerticalScaling(int type); ! } --- 1,69 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Interface ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphRenderer ! { ! /** Description of the Field */ ! public final static int ALIGN_LEFT = 0; ! /** Description of the Field */ ! public final static int ALIGN_RIGHT = 1; ! /** Description of the Field */ ! public final static int JUSTIFIED = 3; ! /** Description of the Field */ ! public final static int SMOOTH = 10; ! /** Description of the Field */ ! public final static int BOUNDED = 11; ! ! ! /** ! * Sets the graphElement attribute of the GraphRenderer object ! * ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element); ! ! ! /** ! * Sets the display attribute of the GraphRenderer object ! * ! * @param type The new display value ! */ ! public void setHorizontalScaling(int type); ! ! ! /** ! * Sets the horizontalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier); ! ! ! /** ! * Sets the verticalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier); ! ! ! /** ! * Sets the verticalDisplay attribute of the GraphRenderer object ! * ! * @param type The new verticalDisplay value ! */ ! public void setVerticalScaling(int type); ! } Index: LabelElement.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/LabelElement.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LabelElement.java 15 Sep 2003 22:02:49 -0000 1.5 --- LabelElement.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,25 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import javax.swing.JComponent; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface LabelElement ! { ! /** ! * Gets the component attribute of the LabelElement object ! * ! * @return The component value ! */ ! public JComponent getComponent(); ! } --- 1,24 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import javax.swing.JComponent; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface LabelElement ! { ! /** ! * Gets the component attribute of the LabelElement object ! * ! * @return The component value ! */ ! public JComponent getComponent(); ! } Index: Range.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Range.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Range.java 15 Sep 2003 22:02:49 -0000 1.5 --- Range.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,123 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Class ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 4 septembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Range ! { ! /** Description of the Field */ ! protected double max = 0.0f; ! /** Description of the Field */ ! protected double min = 0.0f; ! /** Description of the Field */ ! public final static int X_AXIS = 0; ! /** Description of the Field */ ! public final static int Y_AXIS = 1; ! ! ! /** ! *Constructor for the Range object ! * ! * @param min Description of the Parameter ! * @param max Description of the Parameter ! */ ! public Range(double min, double max) ! { ! this.min = (double) min; ! this.max = (double) max; ! } ! ! ! /** ! * Description of the Method ! * ! * @param range Description of the Parameter ! * @return Description of the Return Value ! */ ! public Range compose(Range range) ! { ! double nmin = Math.min(this.min, range.min); ! double nmax = Math.max(this.max, range.max); ! ! return new Range(nmin, nmax); ! } ! ! ! /** ! * Gets the max attribute of the Range object ! * ! * @return The max value ! */ ! public double getMax() ! { ! return this.max; ! } ! ! ! /** ! * Gets the min attribute of the Range object ! * ! * @return The min value ! */ ! public double getMin() ! { ! return this.min; ! } ! ! ! /** ! * Description of the Method ! * ! * @param value Description of the Parameter ! */ ! public synchronized void put(double value) ! { ! this.min = Math.min(this.min, value); ! this.max = Math.max(this.max, value); ! } ! ! ! /** ! * Sets the max. ! * ! * @param max The max to set ! */ ! public void setMax(double max) ! { ! this.max = max; ! } ! ! ! /** ! * Sets the min. ! * ! * @param min The min to set ! */ ! public void setMin(double min) ! { ! this.min = min; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return "[" + getMin() + " to " + getMax() + "]"; ! } ! } --- 1,122 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Range ! { ! /** Description of the Field */ ! protected double max = 0.0f; ! /** Description of the Field */ ! protected double min = 0.0f; ! /** Description of the Field */ ! public final static int X_AXIS = 0; ! /** Description of the Field */ ! public final static int Y_AXIS = 1; ! ! ! /** ! *Constructor for the Range object ! * ! * @param min Description of the Parameter ! * @param max Description of the Parameter ! */ ! public Range(double min, double max) ! { ! this.min = (double) min; ! this.max = (double) max; ! } ! ! ! /** ! * Description of the Method ! * ! * @param range Description of the Parameter ! * @return Description of the Return Value ! */ ! public Range compose(Range range) ! { ! double nmin = Math.min(this.min, range.min); ! double nmax = Math.max(this.max, range.max); ! ! return new Range(nmin, nmax); ! } ! ! ! /** ! * Gets the max attribute of the Range object ! * ! * @return The max value ! */ ! public double getMax() ! { ! return this.max; ! } ! ! ! /** ! * Gets the min attribute of the Range object ! * ! * @return The min value ! */ ! public double getMin() ! { ! return this.min; ! } ! ! ! /** ! * Description of the Method ! * ! * @param value Description of the Parameter ! */ ! public synchronized void put(double value) ! { ! this.min = Math.min(this.min, value); ! this.max = Math.max(this.max, value); ! } ! ! ! /** ! * Sets the max. ! * ! * @param max The max to set ! */ ! public void setMax(double max) ! { ! this.max = max; ! } ! ! ! /** ! * Sets the min. ! * ! * @param min The min to set ! */ ! public void setMin(double min) ! { ! this.min = min; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return "[" + getMin() + " to " + getMax() + "]"; ! } ! } Index: Test.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Test.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Test.java 15 Sep 2003 22:02:49 -0000 1.5 --- Test.java 15 Sep 2003 22:11:22 -0000 1.6 *************** *** 1,129 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! ! import javax.swing.JFrame; ! ! import org.ejtools.graph.renderer.TriAxisLayoutRenderer; ! ! /** ! * Description of the Class ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 5 septembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Test ! { ! /** Constructor for Test. */ ! public Test() ! { ! super(); ! } ! ! ! /** ! * The main program for the Test class ! * ! * @param args The command line arguments ! * @exception Exception Description of the Exception ! */ ! public static void main(String[] args) ! throws Exception ! { ! Track t1 = new Track("Toto"); ! t1.setColor(Color.blue); ! Track t2 = new Track("Tata"); ! t2.setColor(Color.red); ! ! CompositeTrack ct = new CompositeTrack(); ! ct.addTrack(t1); ! ct.addTrack(t2); ! ! TriAxisLayoutRenderer cg = new TriAxisLayoutRenderer(); ! cg.setGraphElement(ct); ! ! // BorderGraph cg = new BorderGraph(); ! // cg.setGraphElement(t1); ! ! // Renderer rd = new DefaultRenderer(); ! // Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! // cg.addRenderer(rd, BorderLayout.CENTER); ! // Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! // cg.addRenderer(axis, BorderLayout.SOUTH); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! // cg.addRenderer(axis, BorderLayout.WEST); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! // cg.addRenderer(axis, BorderLayout.EAST); ! ! /* ! * GridBagGraph cg = new GridBagGraph(); ! * cg.setGraphElement(ct); ! * GridBagConstraints constraints = new GridBagConstraints(); ! * / Renderer rd = new DefaultRenderer(); ! * Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! * constraints.gridx = 1; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.BOTH; ! * constraints.weightx = 1.0; ! * constraints.weighty = 1.0; ! * cg.addRenderer(rd, constraints); ! * Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! * constraints.gridx = 1; ! * constraints.gridy = 1; ! * constraints.fill = GridBagConstraints.HORIZONTAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! * constraints.gridx = 0; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! * constraints.gridx = 2; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! */ ! cg.setVisible(true); ! ! JFrame frame = new JFrame("Test"); ! frame.getContentPane().setLayout(new BorderLayout()); ! frame.getContentPane().add(cg, BorderLayout.CENTER); ! frame.setSize(600, 400); ! ! frame.show(); ! ! double i = 0; ! double scale = 1.0d; ! while (i < 50) ! { ! System.out.println(i); ! t1.addValue(Math.cos(i * 10 * Math.PI / 180) * 20); ! t2.addValue(Math.sin(i * 10 * Math.PI / 180) * 20); ! Thread.sleep(200); ! cg.repaint(); ! i++; ! if ((i % 20) == 0) ! { ! scale = scale / 1.5; ! cg.setHorizontalScale(scale); ! } ! } ! ! System.exit(0); ! } ! } --- 1,128 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! ! import javax.swing.JFrame; ! ! import org.ejtools.graph.renderer.TriAxisLayoutRenderer; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Test ! { ! /** Constructor for Test. */ ! public Test() ! { ! super(); ! } ! ! ! /** ! * The main program for the Test class ! * ! * @param args The command line arguments ! * @exception Exception Description of the Exception ! */ ! public static void main(String[] args) ! throws Exception ! { ! Track t1 = new Track("Toto"); ! t1.setColor(Color.blue); ! Track t2 = new Track("Tata"); ! t2.setColor(Color.red); ! ! CompositeTrack ct = new CompositeTrack(); ! ct.addTrack(t1); ! ct.addTrack(t2); ! ! TriAxisLayoutRenderer cg = new TriAxisLayoutRenderer(); ! cg.setGraphElement(ct); ! ! // BorderGraph cg = new BorderGraph(); ! // cg.setGraphElement(t1); ! ! // Renderer rd = new DefaultRenderer(); ! // Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! // cg.addRenderer(rd, BorderLayout.CENTER); ! // Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! // cg.addRenderer(axis, BorderLayout.SOUTH); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! // cg.addRenderer(axis, BorderLayout.WEST); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! // cg.addRenderer(axis, BorderLayout.EAST); ! ! /* ! * GridBagGraph cg = new GridBagGraph(); ! * cg.setGraphElement(ct); ! * GridBagConstraints constraints = new GridBagConstraints(); ! * / Renderer rd = new DefaultRenderer(); ! * Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! * constraints.gridx = 1; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.BOTH; ! * constraints.weightx = 1.0; ! * constraints.weighty = 1.0; ! * cg.addRenderer(rd, constraints); ! * Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! * constraints.gridx = 1; ! * constraints.gridy = 1; ! * constraints.fill = GridBagConstraints.HORIZONTAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! * constraints.gridx = 0; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! * constraints.gridx = 2; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! */ ! cg.setVisible(true); ! ! JFrame frame = new JFrame("Test"); ! frame.getContentPane().setLayout(new BorderLayout()); ! frame.getContentPane().add(cg, BorderLayout.CENTER); ! frame.setSize(600, 400); ! ! frame.show(); ! ! double i = 0; ! double scale = 1.0d; ! while (i < 50) ! { ! System.out.println(i); ! t1.addValue(Math.cos(i * 10 * Math.PI / 180) * 20); ! t2.addValue(Math.sin(i * 10 * Math.PI / 180) * 20); ! Thread.sleep(200); ! cg.repaint(); ! i++; ! if ((i % 20) == 0) ! { ! scale = scale / 1.5; ! cg.setHorizontalScale(scale); ! } ! } ! ! System.exit(0); ! } ! } Index: Track.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Track.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Track.java 15 Sep 2003 22:02:49 -0000 1.9 --- Track.java 15 Sep 2003 22:11:22 -0000 1.10 *************** *** 30,36 **** * Description of the Class * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> * @version $Revision$ - * @created 4 septembre 2002 * @todo Javadoc to complete */ --- 30,35 ---- * Description of the Class * ! * @author Laurent Etiemble * @version $Revision$ * @todo Javadoc to complete */ *************** *** 219,224 **** * * @author Administrator - * @version $Revision$ * @created 13 novembre 2002 */ private class TrackLabel extends JPanel implements PropertyChangeListener --- 218,223 ---- * * @author Administrator * @created 13 novembre 2002 + * @version $Revision$ */ private class TrackLabel extends JPanel implements PropertyChangeListener |
|
From: <let...@us...> - 2003-09-15 22:11:28
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/dialog In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph/dialog Modified Files: SelectGraphDialog.java Log Message: Adjust some Javadoc. Index: SelectGraphDialog.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/dialog/SelectGraphDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SelectGraphDialog.java 15 Sep 2003 22:02:49 -0000 1.3 --- SelectGraphDialog.java 15 Sep 2003 22:11:22 -0000 1.4 *************** *** 1,155 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.dialog; ! ! import java.awt.Component; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.GridLayout; ! import java.awt.Insets; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.util.ResourceBundle; ! ! import javax.swing.JButton; ! import javax.swing.JComboBox; ! import javax.swing.JDialog; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! ! /** ! * @author letiemble ! * @created 11 décembre 2002 ! * @version $Revision$ ! */ ! public class SelectGraphDialog extends JDialog ! { ! /** Description of the Field */ ! protected JComboBox choices; ! /** Description of the Field */ ! protected Object initialSelectionValue; ! /** Description of the Field */ ! protected Object selectedValue = null; ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.graph.GraphService"); ! ! ! /** ! *Constructor for the CustomJOptionPane object ! * ! * @param parentComponent Description of the Parameter ! * @param selectionValues Description of the Parameter ! * @param initialSelectionValue Description of the Parameter ! */ ! public SelectGraphDialog(Component parentComponent, Object[] selectionValues, Object initialSelectionValue) ! { ! super(); ! this.setModal(true); ! this.setTitle(resources.getString("graph.dialog.title")); ! ! JPanel main = new JPanel(new GridBagLayout()); ! GridBagConstraints constraints = new GridBagConstraints(); ! constraints.insets = new Insets(5, 5, 5, 5); ! ! constraints.gridwidth = GridBagConstraints.REMAINDER; ! constraints.weightx = 1.0; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.anchor = GridBagConstraints.WEST; ! JLabel messageLabel = new JLabel(resources.getString("graph.dialog.text.description")); ! main.add(messageLabel, constraints); ! ! this.initialSelectionValue = initialSelectionValue; ! ! this.choices = new JComboBox(selectionValues); ! this.choices.setSelectedItem(this.initialSelectionValue); ! this.choices.setEditable(true); ! if (selectionValues.length == 0) ! { ! choices.getEditor().setItem(this.initialSelectionValue); ! } ! ! main.add(choices, constraints); ! ! JPanel buttons = new JPanel(new GridLayout(1, 2, 2, 2)); ! ! JButton buttonSelect = new JButton(resources.getString("graph.dialog.button.select")); ! buttons.add(buttonSelect); ! buttonSelect.addActionListener( ! new ActionListener() ! { ! /** ! * @param e Description of the Parameter ! */ ! public void actionPerformed(ActionEvent e) ! { ! select(); ! dispose(); ! } ! }); ! ! JButton buttonCancel = new JButton(resources.getString("graph.dialog.button.cancel")); ! buttons.add(buttonCancel); ! buttonCancel.addActionListener( ! new ActionListener() ! { ! /** ! * @param e Description of the Parameter ! */ ! public void actionPerformed(ActionEvent e) ! { ! selectedValue = null; ! dispose(); ! } ! }); ! ! constraints.fill = GridBagConstraints.NONE; ! constraints.anchor = GridBagConstraints.SOUTH; ! main.add(buttons, constraints); ! ! this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); ! this.getContentPane().add(main); ! this.pack(); ! this.setLocationRelativeTo(parentComponent); ! } ! ! ! /** ! * Returns the selectedValue. ! * ! * @return Object ! */ ! public Object getSelectedValue() ! { ! return selectedValue; ! } ! ! ! /** Description of the Method */ ! private void select() ! { ! boolean found = false; ! ! Object choice = this.choices.getSelectedItem(); ! Object text = this.choices.getEditor().getItem(); ! ! for (int i = 0; i < this.choices.getModel().getSize(); i++) ! { ! choice = this.choices.getModel().getElementAt(i); ! if (choice.toString().equals(text.toString())) ! { ! found = true; ! break; ! } ! } ! if (!found) ! { ! choice = text; ! } ! ! this.selectedValue = choice; ! } ! } --- 1,154 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.dialog; ! ! import java.awt.Component; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.GridLayout; ! import java.awt.Insets; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.util.ResourceBundle; ! ! import javax.swing.JButton; ! import javax.swing.JComboBox; ! import javax.swing.JDialog; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class SelectGraphDialog extends JDialog ! { ! /** Description of the Field */ ! protected JComboBox choices; ! /** Description of the Field */ ! protected Object initialSelectionValue; ! /** Description of the Field */ ! protected Object selectedValue = null; ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.graph.GraphService"); ! ! ! /** ! *Constructor for the CustomJOptionPane object ! * ! * @param parentComponent Description of the Parameter ! * @param selectionValues Description of the Parameter ! * @param initialSelectionValue Description of the Parameter ! */ ! public SelectGraphDialog(Component parentComponent, Object[] selectionValues, Object initialSelectionValue) ! { ! super(); ! this.setModal(true); ! this.setTitle(resources.getString("graph.dialog.title")); ! ! JPanel main = new JPanel(new GridBagLayout()); ! GridBagConstraints constraints = new GridBagConstraints(); ! constraints.insets = new Insets(5, 5, 5, 5); ! ! constraints.gridwidth = GridBagConstraints.REMAINDER; ! constraints.weightx = 1.0; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.anchor = GridBagConstraints.WEST; ! JLabel messageLabel = new JLabel(resources.getString("graph.dialog.text.description")); ! main.add(messageLabel, constraints); ! ! this.initialSelectionValue = initialSelectionValue; ! ! this.choices = new JComboBox(selectionValues); ! this.choices.setSelectedItem(this.initialSelectionValue); ! this.choices.setEditable(true); ! if (selectionValues.length == 0) ! { ! choices.getEditor().setItem(this.initialSelectionValue); ! } ! ! main.add(choices, constraints); ! ! JPanel buttons = new JPanel(new GridLayout(1, 2, 2, 2)); ! ! JButton buttonSelect = new JButton(resources.getString("graph.dialog.button.select")); ! buttons.add(buttonSelect); ! buttonSelect.addActionListener( ! new ActionListener() ! { ! /** ! * @param e Description of the Parameter ! */ ! public void actionPerformed(ActionEvent e) ! { ! select(); ! dispose(); ! } ! }); ! ! JButton buttonCancel = new JButton(resources.getString("graph.dialog.button.cancel")); ! buttons.add(buttonCancel); ! buttonCancel.addActionListener( ! new ActionListener() ! { ! /** ! * @param e Description of the Parameter ! */ ! public void actionPerformed(ActionEvent e) ! { ! selectedValue = null; ! dispose(); ! } ! }); ! ! constraints.fill = GridBagConstraints.NONE; ! constraints.anchor = GridBagConstraints.SOUTH; ! main.add(buttons, constraints); ! ! this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); ! this.getContentPane().add(main); ! this.pack(); ! this.setLocationRelativeTo(parentComponent); ! } ! ! ! /** ! * Returns the selectedValue. ! * ! * @return Object ! */ ! public Object getSelectedValue() ! { ! return selectedValue; ! } ! ! ! /** Description of the Method */ ! private void select() ! { ! boolean found = false; ! ! Object choice = this.choices.getSelectedItem(); ! Object text = this.choices.getEditor().getItem(); ! ! for (int i = 0; i < this.choices.getModel().getSize(); i++) ! { ! choice = this.choices.getModel().getElementAt(i); ! if (choice.toString().equals(text.toString())) ! { ! found = true; ! break; ! } ! } ! if (!found) ! { ! choice = text; ! } ! ! this.selectedValue = choice; ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:11:27
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/frame
In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph/frame
Modified Files:
ControlCompositeTrack.java GraphInternalFrame.java
Log Message:
Adjust some Javadoc.
Index: ControlCompositeTrack.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/frame/ControlCompositeTrack.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ControlCompositeTrack.java 15 Sep 2003 22:02:50 -0000 1.3
--- ControlCompositeTrack.java 15 Sep 2003 22:11:22 -0000 1.4
***************
*** 41,47 ****
/**
! * @author letiemble
* @version $Revision$
- * @created 17 d?cembre 2002
*/
public class ControlCompositeTrack implements GraphElement, LabelElement
--- 41,46 ----
/**
! * @author Laurent Etiemble
* @version $Revision$
*/
public class ControlCompositeTrack implements GraphElement, LabelElement
***************
*** 295,300 ****
*
* @author letiembl
- * @version $Revision$
* @created 17 d?cembre 2002
*/
private class ControlTrack extends JPanel implements ActionListener
--- 294,299 ----
*
* @author letiembl
* @created 17 d?cembre 2002
+ * @version $Revision$
*/
private class ControlTrack extends JPanel implements ActionListener
Index: GraphInternalFrame.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/frame/GraphInternalFrame.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GraphInternalFrame.java 15 Sep 2003 22:02:50 -0000 1.3
--- GraphInternalFrame.java 15 Sep 2003 22:11:22 -0000 1.4
***************
*** 40,44 ****
* @author Laurent Etiemble
* @version $Revision$
- * @created 5 septembre 2002
* @javabean:class displayName="Graph Frame"
* shortDescription="Graph Internal Frame"
--- 40,43 ----
|
|
From: <let...@us...> - 2003-09-15 22:11:27
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/action In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph/action Modified Files: ExportAsImageAction.java ExportAsTextAction.java Log Message: Adjust some Javadoc. Index: ExportAsImageAction.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/action/ExportAsImageAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExportAsImageAction.java 15 Sep 2003 22:02:49 -0000 1.1 --- ExportAsImageAction.java 15 Sep 2003 22:11:22 -0000 1.2 *************** *** 16,22 **** * Description of the Class * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> * @version $Revision$ - * @created 29 d?cembre 2001 * @todo Javadoc to complete */ --- 16,21 ---- * Description of the Class * ! * @author Laurent Etiemble * @version $Revision$ * @todo Javadoc to complete */ Index: ExportAsTextAction.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/action/ExportAsTextAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExportAsTextAction.java 15 Sep 2003 22:02:49 -0000 1.1 --- ExportAsTextAction.java 15 Sep 2003 22:11:22 -0000 1.2 *************** *** 1,41 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.action; ! ! import java.util.ResourceBundle; ! ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.CommandAction; ! ! /** ! * Description of the Class ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 29 d?cembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ExportAsTextAction extends CommandAction ! { ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.graph.GraphService"); ! ! ! /** ! * Constructor for the NewAction object ! * ! * @param command Description of Parameter ! */ ! public ExportAsTextAction(Command command) ! { ! super(command, resources, "action.tools.export.as.text"); ! this.setMenu("action.tools"); ! this.setToolBar(true); ! this.setSmallIcon("/toolbarButtonGraphics/general/Export16.gif"); ! this.setIcon("/toolbarButtonGraphics/general/Export24.gif"); ! } ! } --- 1,40 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.action; ! ! import java.util.ResourceBundle; ! ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.CommandAction; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ExportAsTextAction extends CommandAction ! { ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.graph.GraphService"); ! ! ! /** ! * Constructor for the NewAction object ! * ! * @param command Description of Parameter ! */ ! public ExportAsTextAction(Command command) ! { ! super(command, resources, "action.tools.export.as.text"); ! this.setMenu("action.tools"); ! this.setToolBar(true); ! this.setSmallIcon("/toolbarButtonGraphics/general/Export16.gif"); ! this.setIcon("/toolbarButtonGraphics/general/Export24.gif"); ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:11:26
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/editor
In directory sc8-pr-cvs1:/tmp/cvs-serv17417/graph/src/main/org/ejtools/graph/editor
Modified Files:
GraphDelayEditor.java GraphScaleEditor.java
Log Message:
Adjust some Javadoc.
Index: GraphDelayEditor.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/editor/GraphDelayEditor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GraphDelayEditor.java 15 Sep 2003 22:02:50 -0000 1.3
--- GraphDelayEditor.java 15 Sep 2003 22:11:22 -0000 1.4
***************
*** 12,17 ****
* Custom editor for the graph refresh rate.
*
! * @author letiemble
! * @created 2 janvier 2002
* @version $Revision$
*/
--- 12,16 ----
* Custom editor for the graph refresh rate.
*
! * @author Laurent Etiemble
* @version $Revision$
*/
***************
*** 22,39 ****
{
super(new String[]{
! "1.0 sec",
! "2.5 sec",
! "5 sec",
! "10 sec",
! "1 min",
! "5 min"},
! new Object[]{
! new Long(1000),
! new Long(2500),
! new Long(5000),
! new Long(10000),
! new Long(60000),
! new Long(300000)
! });
}
}
--- 21,38 ----
{
super(new String[]{
! "1.0 sec",
! "2.5 sec",
! "5 sec",
! "10 sec",
! "1 min",
! "5 min"},
! new Object[]{
! new Long(1000),
! new Long(2500),
! new Long(5000),
! new Long(10000),
! new Long(60000),
! new Long(300000)
! });
}
}
Index: GraphScaleEditor.java
===================================================================
RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/editor/GraphScaleEditor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GraphScaleEditor.java 15 Sep 2003 22:02:50 -0000 1.3
--- GraphScaleEditor.java 15 Sep 2003 22:11:22 -0000 1.4
***************
*** 1,42 ****
! /*
! * EJTools, the Enterprise Java Tools
! *
! * Distributable under LGPL license.
! * See terms of license at www.gnu.org.
! */
! package org.ejtools.graph.editor;
!
! import com.dreambean.awt.editors.TagsEditor;
!
! /**
! * Custom editor for the graph scale.
! *
! * @author letiemble
! * @created 2 janvier 2002
! * @version $Revision$
! */
! public class GraphScaleEditor extends TagsEditor
! {
! /** Constructor for the SearchTypeEditor object */
! public GraphScaleEditor()
! {
! super(new String[]{
! "0.1 sec/pixel",
! "0.5 sec/pixel",
! "1.0 sec/pixel",
! "5.0 sec/pixel",
! "10 sec/pixel",
! "1 min/pixel",
! "5 min/pixel"},
! new Object[]{
! new Double(1.0d / 100),
! new Double(1.0d / 500),
! new Double(1.0d / 1000),
! new Double(1.0d / 5000),
! new Double(1.0d / 10000),
! new Double(1.0d / 60000),
! new Double(1.0d / 300000)
! });
! }
! }
!
--- 1,41 ----
! /*
! * EJTools, the Enterprise Java Tools
! *
! * Distributable under LGPL license.
! * See terms of license at www.gnu.org.
! */
! package org.ejtools.graph.editor;
!
! import com.dreambean.awt.editors.TagsEditor;
!
! /**
! * Custom editor for the graph scale.
! *
! * @author Laurent Etiemble
! * @version $Revision$
! */
! public class GraphScaleEditor extends TagsEditor
! {
! /** Constructor for the SearchTypeEditor object */
! public GraphScaleEditor()
! {
! super(new String[]{
! "0.1 sec/pixel",
! "0.5 sec/pixel",
! "1.0 sec/pixel",
! "5.0 sec/pixel",
! "10 sec/pixel",
! "1 min/pixel",
! "5 min/pixel"},
! new Object[]{
! new Double(1.0d / 100),
! new Double(1.0d / 500),
! new Double(1.0d / 1000),
! new Double(1.0d / 5000),
! new Double(1.0d / 10000),
! new Double(1.0d / 60000),
! new Double(1.0d / 300000)
! });
! }
! }
!
|
|
From: <let...@us...> - 2003-09-15 22:04:46
|
Update of /cvsroot/ejtools/libraries/servlet/src/main/org/ejtools/servlet/http In directory sc8-pr-cvs1:/tmp/cvs-serv15741/servlet/src/main/org/ejtools/servlet/http Modified Files: CharResponseWrapper.java StringResponseWrapper.java XSLFilter.java Log Message: Change Eclipse project and classpath definition Index: CharResponseWrapper.java =================================================================== RCS file: /cvsroot/ejtools/libraries/servlet/src/main/org/ejtools/servlet/http/CharResponseWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CharResponseWrapper.java 15 Sep 2003 22:00:14 -0000 1.1 --- CharResponseWrapper.java 15 Sep 2003 22:04:41 -0000 1.2 *************** *** 1,60 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at gnu.org. ! */ ! package org.ejtools.servlet.http; ! ! import java.io.CharArrayWriter; ! import java.io.PrintWriter; ! ! import javax.servlet.http.HttpServletResponse; ! import javax.servlet.http.HttpServletResponseWrapper; ! ! /** ! * A Response wrapper that allows the manipulation of the Servlet Response. Create a buffer based on a Char array. ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 11 avril 2002 ! * @version $Revision$ ! */ ! public class CharResponseWrapper extends HttpServletResponseWrapper ! { ! /** Buffer used to store content */ ! protected CharArrayWriter output = null; ! ! ! /** ! * Constructor for the CharResponseWrapper object ! * ! * @param response Response stream to wrap ! */ ! public CharResponseWrapper(HttpServletResponse response) ! { ! super(response); ! output = new CharArrayWriter(); ! } ! ! ! /** ! * Return a writer that wraps the buffered content ! * ! * @return The writer of the wrapper ! */ ! public PrintWriter getWriter() ! { ! return new PrintWriter(output); ! } ! ! ! /** ! * Return the content of the buffer ! * ! * @return The content as String ! */ ! public String toString() ! { ! return output.toString(); ! } ! } --- 1,59 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.servlet.http; ! ! import java.io.CharArrayWriter; ! import java.io.PrintWriter; ! ! import javax.servlet.http.HttpServletResponse; ! import javax.servlet.http.HttpServletResponseWrapper; ! ! /** ! * A Response wrapper that allows the manipulation of the Servlet Response. Create a buffer based on a Char array. ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class CharResponseWrapper extends HttpServletResponseWrapper ! { ! /** Buffer used to store content */ ! protected CharArrayWriter output = null; ! ! ! /** ! * Constructor for the CharResponseWrapper object ! * ! * @param response Response stream to wrap ! */ ! public CharResponseWrapper(HttpServletResponse response) ! { ! super(response); ! output = new CharArrayWriter(); ! } ! ! ! /** ! * Return a writer that wraps the buffered content ! * ! * @return The writer of the wrapper ! */ ! public PrintWriter getWriter() ! { ! return new PrintWriter(output); ! } ! ! ! /** ! * Return the content of the buffer ! * ! * @return The content as String ! */ ! public String toString() ! { ! return output.toString(); ! } ! } Index: StringResponseWrapper.java =================================================================== RCS file: /cvsroot/ejtools/libraries/servlet/src/main/org/ejtools/servlet/http/StringResponseWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StringResponseWrapper.java 15 Sep 2003 22:00:14 -0000 1.1 --- StringResponseWrapper.java 15 Sep 2003 22:04:41 -0000 1.2 *************** *** 1,60 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at gnu.org. ! */ ! package org.ejtools.servlet.http; ! ! import java.io.PrintWriter; ! import java.io.StringWriter; ! ! import javax.servlet.http.HttpServletResponse; ! import javax.servlet.http.HttpServletResponseWrapper; ! ! /** ! * A Response wrapper that allows the manipulation of the Servlet Response. Create a buffer based on a String. ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 11 avril 2002 ! * @version $Revision$ ! */ ! public class StringResponseWrapper extends HttpServletResponseWrapper ! { ! /** Buffer used to store content */ ! protected StringWriter output = null; ! ! ! /** ! * Constructor for the StringResponseWrapper object ! * ! * @param response Response stream to wrap ! */ ! public StringResponseWrapper(HttpServletResponse response) ! { ! super(response); ! output = new StringWriter(); ! } ! ! ! /** ! * Return a writer that wraps the buffered content ! * ! * @return The writer of the wrapper ! */ ! public PrintWriter getWriter() ! { ! return new PrintWriter(output); ! } ! ! ! /** ! * Return the content of the buffer ! * ! * @return The content as String ! */ ! public String toString() ! { ! return output.toString(); ! } ! } --- 1,59 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.servlet.http; ! ! import java.io.PrintWriter; ! import java.io.StringWriter; ! ! import javax.servlet.http.HttpServletResponse; ! import javax.servlet.http.HttpServletResponseWrapper; ! ! /** ! * A Response wrapper that allows the manipulation of the Servlet Response. Create a buffer based on a String. ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class StringResponseWrapper extends HttpServletResponseWrapper ! { ! /** Buffer used to store content */ ! protected StringWriter output = null; ! ! ! /** ! * Constructor for the StringResponseWrapper object ! * ! * @param response Response stream to wrap ! */ ! public StringResponseWrapper(HttpServletResponse response) ! { ! super(response); ! output = new StringWriter(); ! } ! ! ! /** ! * Return a writer that wraps the buffered content ! * ! * @return The writer of the wrapper ! */ ! public PrintWriter getWriter() ! { ! return new PrintWriter(output); ! } ! ! ! /** ! * Return the content of the buffer ! * ! * @return The content as String ! */ ! public String toString() ! { ! return output.toString(); ! } ! } Index: XSLFilter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/servlet/src/main/org/ejtools/servlet/http/XSLFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XSLFilter.java 15 Sep 2003 22:00:14 -0000 1.1 --- XSLFilter.java 15 Sep 2003 22:04:41 -0000 1.2 *************** *** 1,140 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at gnu.org. ! */ ! package org.ejtools.servlet.http; ! ! import java.io.IOException; ! import java.io.PrintWriter; ! import java.io.StringReader; ! import java.io.StringWriter; ! ! import javax.servlet.Filter; ! import javax.servlet.FilterChain; ! import javax.servlet.FilterConfig; ! import javax.servlet.ServletException; ! import javax.servlet.ServletRequest; ! import javax.servlet.ServletResponse; ! import javax.servlet.http.HttpServletResponse; ! import javax.xml.transform.Source; ! import javax.xml.transform.Transformer; ! import javax.xml.transform.TransformerFactory; ! import javax.xml.transform.stream.StreamResult; ! import javax.xml.transform.stream.StreamSource; ! ! import org.apache.log4j.Logger; ! ! /** ! * HTTP Servlet filter that applies a XSL stylesheet on a XML stream. ! * ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 11 avril 2002 ! * @version $Revision$ ! */ ! public class XSLFilter implements Filter ! { ! /** Filter configuration */ ! protected FilterConfig config = null; ! /** Content type of the output */ ! protected String contentType = null; ! /** Absolute path the stylesheet */ ! protected String stylePath = null; ! /** XSL transformer */ ! protected Transformer transformer = null; ! /** Log4j Logger */ ! protected static Logger logger = Logger.getLogger(XSLFilter.class); ! ! ! /** Destroy the filter */ ! public void destroy() ! { ! this.config = null; ! } ! ! ! /** ! * Main method of the filter ! * ! * @param request Incoming request ! * @param response Outgoing response ! * @param chain Filter chain to forward the request and the response ! * @exception IOException In case of error ! * @exception ServletException In case of error ! */ ! public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) ! throws IOException, ServletException ! { ! // Set content type and get the original response ! response.setContentType(contentType); ! PrintWriter out = response.getWriter(); ! ! // Wrap the response with a buffer and follow the chain ! StringResponseWrapper wrapper = new StringResponseWrapper((HttpServletResponse) response); ! chain.doFilter(request, wrapper); ! ! // Create a reader with the result ! StringReader reader = new StringReader(wrapper.toString()); ! Source source = new StreamSource(reader); ! ! try ! { ! // Create the final response writer ! logger.debug("Creating Writer..."); ! StringWriter writer = new StringWriter(); ! StreamResult result = new StreamResult(writer); ! ! // Transform according to XSL stylesheet ! logger.debug("Applying stylesheet..."); ! transformer.transform(source, result); ! ! // Print out the result ! logger.debug("Ouputing..."); ! response.setContentLength(writer.toString().length()); ! out.println(writer.toString()); ! } ! catch (Exception e) ! { ! logger.error("Error during transformation " + e.getMessage()); ! out.println(wrapper.toString()); ! } ! } ! ! ! /** ! * Performs the initialization of the filter ! * ! * @param config The filter configuration ! * @exception ServletException Exception thrown if the filter was not properly configured ! */ ! public void init(FilterConfig config) ! throws ServletException ! { ! this.config = config; ! ! // Get the content type ! this.contentType = config.getInitParameter("mime-type"); ! logger.debug("Acquiring parameter mime-type=" + contentType); ! ! // Get the stylesheet ! String styleSheet = config.getInitParameter("stylesheet"); ! logger.debug("Acquiring parameter stylesheet=" + styleSheet); ! ! // Set the absolute position of the stylesheet ! String stylePath = config.getServletContext().getRealPath(styleSheet); ! ! try ! { ! // Prepare the XSL transformer ! logger.debug("Compiling stylesheet..."); ! TransformerFactory tFactory = TransformerFactory.newInstance(); ! transformer = tFactory.newTransformer(new StreamSource(stylePath)); ! } ! catch (Exception e) ! { ! logger.fatal("Failed to init the filter " + e.getMessage()); ! throw new ServletException(e.getMessage()); ! } ! } ! } --- 1,139 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.servlet.http; ! ! import java.io.IOException; ! import java.io.PrintWriter; ! import java.io.StringReader; ! import java.io.StringWriter; ! ! import javax.servlet.Filter; ! import javax.servlet.FilterChain; ! import javax.servlet.FilterConfig; ! import javax.servlet.ServletException; ! import javax.servlet.ServletRequest; ! import javax.servlet.ServletResponse; ! import javax.servlet.http.HttpServletResponse; ! import javax.xml.transform.Source; ! import javax.xml.transform.Transformer; ! import javax.xml.transform.TransformerFactory; ! import javax.xml.transform.stream.StreamResult; ! import javax.xml.transform.stream.StreamSource; ! ! import org.apache.log4j.Logger; ! ! /** ! * HTTP Servlet filter that applies a XSL stylesheet on a XML stream. ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class XSLFilter implements Filter ! { ! /** Filter configuration */ ! protected FilterConfig config = null; ! /** Content type of the output */ ! protected String contentType = null; ! /** Absolute path the stylesheet */ ! protected String stylePath = null; ! /** XSL transformer */ ! protected Transformer transformer = null; ! /** Log4j Logger */ ! protected static Logger logger = Logger.getLogger(XSLFilter.class); ! ! ! /** Destroy the filter */ ! public void destroy() ! { ! this.config = null; ! } ! ! ! /** ! * Main method of the filter ! * ! * @param request Incoming request ! * @param response Outgoing response ! * @param chain Filter chain to forward the request and the response ! * @exception IOException In case of error ! * @exception ServletException In case of error ! */ ! public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) ! throws IOException, ServletException ! { ! // Set content type and get the original response ! response.setContentType(contentType); ! PrintWriter out = response.getWriter(); ! ! // Wrap the response with a buffer and follow the chain ! StringResponseWrapper wrapper = new StringResponseWrapper((HttpServletResponse) response); ! chain.doFilter(request, wrapper); ! ! // Create a reader with the result ! StringReader reader = new StringReader(wrapper.toString()); ! Source source = new StreamSource(reader); ! ! try ! { ! // Create the final response writer ! logger.debug("Creating Writer..."); ! StringWriter writer = new StringWriter(); ! StreamResult result = new StreamResult(writer); ! ! // Transform according to XSL stylesheet ! logger.debug("Applying stylesheet..."); ! transformer.transform(source, result); ! ! // Print out the result ! logger.debug("Ouputing..."); ! response.setContentLength(writer.toString().length()); ! out.println(writer.toString()); ! } ! catch (Exception e) ! { ! logger.error("Error during transformation " + e.getMessage()); ! out.println(wrapper.toString()); ! } ! } ! ! ! /** ! * Performs the initialization of the filter ! * ! * @param config The filter configuration ! * @exception ServletException Exception thrown if the filter was not properly configured ! */ ! public void init(FilterConfig config) ! throws ServletException ! { ! this.config = config; ! ! // Get the content type ! this.contentType = config.getInitParameter("mime-type"); ! logger.debug("Acquiring parameter mime-type=" + contentType); ! ! // Get the stylesheet ! String styleSheet = config.getInitParameter("stylesheet"); ! logger.debug("Acquiring parameter stylesheet=" + styleSheet); ! ! // Set the absolute position of the stylesheet ! String stylePath = config.getServletContext().getRealPath(styleSheet); ! ! try ! { ! // Prepare the XSL transformer ! logger.debug("Compiling stylesheet..."); ! TransformerFactory tFactory = TransformerFactory.newInstance(); ! transformer = tFactory.newTransformer(new StreamSource(stylePath)); ! } ! catch (Exception e) ! { ! logger.fatal("Failed to init the filter " + e.getMessage()); ! throw new ServletException(e.getMessage()); ! } ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:04:45
|
Update of /cvsroot/ejtools/libraries/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv15741/servlet
Modified Files:
.classpath
Log Message:
Change Eclipse project and classpath definition
Index: .classpath
===================================================================
RCS file: /cvsroot/ejtools/libraries/servlet/.classpath,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** .classpath 15 Sep 2003 22:00:14 -0000 1.1
--- .classpath 15 Sep 2003 22:04:41 -0000 1.2
***************
*** 2,6 ****
<classpath>
<classpathentry kind="src" path="src/main"/>
- <classpathentry kind="src" path="src/test"/>
<classpathentry kind="src" path="/ejtools-libraries-common"/>
<classpathentry kind="src" path="/ejtools-thirdparty"/>
--- 2,5 ----
|
|
From: <let...@us...> - 2003-09-15 22:02:57
|
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer In directory sc8-pr-cvs1:/tmp/cvs-serv15147/graph/src/main/org/ejtools/graph/renderer Modified Files: AbstractGraphRenderer.java BorderLayoutRenderer.java DefaultGraphRenderer.java GridBagLayoutRenderer.java GridGraphRenderer.java HorizontalAxis.java JPanelGraphRenderer.java TriAxisLayoutRenderer.java VerticalAxis.java Log Message: Change Eclipse project and classpath definition Add export as Image and Text functions Index: AbstractGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/AbstractGraphRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractGraphRenderer.java 8 Jan 2003 21:14:28 -0000 1.4 --- AbstractGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.5 *************** *** 1,89 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class AbstractGraphRenderer extends JComponent implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected double horizontalScale = 1.0d; ! /** Description of the Field */ ! protected int horizontalScaling = ALIGN_RIGHT; ! /** Description of the Field */ ! protected double verticalScale = 1.0d; ! /** Description of the Field */ ! protected int verticalScaling = BOUNDED; ! ! ! /** Constructor for TrackRenderer. */ ! public AbstractGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! this.horizontalScale = multiplier; ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! this.horizontalScaling = type; ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! this.verticalScale = multiplier; ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) { } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected abstract void paintComponent(Graphics graphics); ! } --- 1,89 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class AbstractGraphRenderer extends JComponent implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected double horizontalScale = 1.0d; ! /** Description of the Field */ ! protected int horizontalScaling = ALIGN_RIGHT; ! /** Description of the Field */ ! protected double verticalScale = 1.0d; ! /** Description of the Field */ ! protected int verticalScaling = BOUNDED; ! ! ! /** Constructor for TrackRenderer. */ ! public AbstractGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! this.horizontalScale = multiplier; ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! this.horizontalScaling = type; ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! this.verticalScale = multiplier; ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) { } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected abstract void paintComponent(Graphics graphics); ! } Index: BorderLayoutRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/BorderLayoutRenderer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BorderLayoutRenderer.java 21 Dec 2002 22:07:45 -0000 1.3 --- BorderLayoutRenderer.java 15 Sep 2003 22:02:50 -0000 1.4 *************** *** 1,45 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BorderLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public BorderLayoutRenderer() ! { ! super(new BorderLayout()); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param position The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, String position) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, position); ! } ! ! } --- 1,45 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BorderLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public BorderLayoutRenderer() ! { ! super(new BorderLayout()); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param position The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, String position) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, position); ! } ! ! } Index: DefaultGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/DefaultGraphRenderer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DefaultGraphRenderer.java 8 Jan 2003 21:14:26 -0000 1.5 --- DefaultGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.6 *************** *** 1,63 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! import java.awt.Insets; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphRenderer extends AbstractGraphRenderer ! { ! /** Constructor for TrackRenderer. */ ! public DefaultGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d; ! offsetX = width - maxX; ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } --- 1,63 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Graphics; ! import java.awt.Insets; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphRenderer extends AbstractGraphRenderer ! { ! /** Constructor for TrackRenderer. */ ! public DefaultGraphRenderer() ! { ! super(); ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d; ! offsetX = width - maxX; ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } Index: GridBagLayoutRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/GridBagLayoutRenderer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GridBagLayoutRenderer.java 21 Dec 2002 22:07:45 -0000 1.3 --- GridBagLayoutRenderer.java 15 Sep 2003 22:02:50 -0000 1.4 *************** *** 1,44 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridBagLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public GridBagLayoutRenderer() ! { ! super(new GridBagLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param constraints The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, GridBagConstraints constraints) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, constraints); ! } ! ! } --- 1,44 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridBagLayoutRenderer extends JPanelGraphRenderer ! { ! /** Constructor for Graph. */ ! public GridBagLayoutRenderer() ! { ! super(new GridBagLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! * @param constraints The feature to be added to the Renderer attribute ! */ ! public void addRenderer(GraphRenderer renderer, GridBagConstraints constraints) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer, constraints); ! } ! ! } Index: GridGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/GridGraphRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GridGraphRenderer.java 8 Jan 2003 21:14:26 -0000 1.4 --- GridGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.5 *************** *** 1,138 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridGraphRenderer extends Axis ! { ! /** Description of the Field */ ! protected Format horizontalFormat = null; ! /** Description of the Field */ ! protected Format verticalFormat = null; ! ! ! /** ! *Constructor for the GridRenderer object ! * ! * @param horizontalFormat Description of the Parameter ! * @param verticalFormat Description of the Parameter ! */ ! public GridGraphRenderer(Format horizontalFormat, Format verticalFormat) ! { ! this.format = horizontalFormat; ! this.horizontalFormat = horizontalFormat; ! this.verticalFormat = verticalFormat; ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! graphics.setColor(Color.lightGray); ! ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - maxX * this.horizontalScale; ! } ! ! // Render horizontal lines ! minX = (x - offsetX) / scaleX; ! this.format = this.horizontalFormat; ! ! String minText = this.getFormated(minX); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(maxX); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of lines ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine((int) (i * multiplier), 0, (int) (i * multiplier), (int) height); ! } ! ! // Render horizontal lines ! this.format = this.verticalFormat; ! ! minText = this.getFormated(minY); ! minBounds = metrics.getStringBounds(minText, graphics); ! maxText = this.getFormated(maxY); ! maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Vertical drawing ! bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(0, (int) (i * multiplier), (int) width, (int) (i * multiplier)); ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } --- 1,138 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class GridGraphRenderer extends Axis ! { ! /** Description of the Field */ ! protected Format horizontalFormat = null; ! /** Description of the Field */ ! protected Format verticalFormat = null; ! ! ! /** ! *Constructor for the GridRenderer object ! * ! * @param horizontalFormat Description of the Parameter ! * @param verticalFormat Description of the Parameter ! */ ! public GridGraphRenderer(Format horizontalFormat, Format verticalFormat) ! { ! this.format = horizontalFormat; ! this.horizontalFormat = horizontalFormat; ! this.verticalFormat = verticalFormat; ! } ! ! ! /** ! * @param graphics Description of the Parameter ! */ ! protected void paintComponent(Graphics graphics) ! { ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! graphics.setColor(Color.lightGray); ! ! double minX = element.getXRange().getMin(); ! double maxX = element.getXRange().getMax(); ! double minY = element.getYRange().getMin(); ! double maxY = element.getYRange().getMax(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double scaleX = width / (maxX - minX); ! double scaleY = -height / (maxY - minY); ! double offsetX = x - scaleX * minX; ! double offsetY = y - scaleY * maxY; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -minX; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - maxX * this.horizontalScale; ! } ! ! // Render horizontal lines ! minX = (x - offsetX) / scaleX; ! this.format = this.horizontalFormat; ! ! String minText = this.getFormated(minX); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(maxX); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of lines ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine((int) (i * multiplier), 0, (int) (i * multiplier), (int) height); ! } ! ! // Render horizontal lines ! this.format = this.verticalFormat; ! ! minText = this.getFormated(minY); ! minBounds = metrics.getStringBounds(minText, graphics); ! maxText = this.getFormated(maxY); ! maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Vertical drawing ! bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(0, (int) (i * multiplier), (int) width, (int) (i * multiplier)); ! } ! ! this.element.draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } Index: HorizontalAxis.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/HorizontalAxis.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HorizontalAxis.java 21 Dec 2002 22:07:45 -0000 1.4 --- HorizontalAxis.java 15 Sep 2003 22:02:50 -0000 1.5 *************** *** 1,131 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class HorizontalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public HorizontalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = HORIZONTAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getXRange().getMin(); ! double max = element.getXRange().getMax(); ! ! double scaleX = width / (max - min); ! double offsetX = x - scaleX * min; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -min; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - max * this.horizontalScale; ! } ! ! min = (x - offsetX) / scaleX; ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the baseline ! graphics.drawLine(0, 0, (int) width, 0); ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() / 2); ! } ! ! // Draw the ticks ! multiplier = width / ticks; ! ! // Draw first tick ! graphics.drawLine(0, 0, 0, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(minText, 0, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() - metrics.getDescent()); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j - (int) (middleBounds.getWidth() / 2); ! ! graphics.drawString(display, j, (int) (height - metrics.getDescent())); ! } ! ! // Draw last tick ! graphics.drawLine((int) width, 0, (int) width, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(maxText, (int) (width - maxBounds.getWidth()), (int) (height - metrics.getDescent())); ! } ! } --- 1,131 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class HorizontalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public HorizontalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = HORIZONTAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! int x = insets.left; ! // int y = insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getXRange().getMin(); ! double max = element.getXRange().getMax(); ! ! double scaleX = width / (max - min); ! double offsetX = x - scaleX * min; ! ! if (this.horizontalScaling == GraphRenderer.ALIGN_LEFT) ! { ! scaleX = 1.0d; ! offsetX = -min; ! } ! if (this.horizontalScaling == GraphRenderer.ALIGN_RIGHT) ! { ! scaleX = 1.0d * this.horizontalScale; ! offsetX = width - max * this.horizontalScale; ! } ! ! min = (x - offsetX) / scaleX; ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // Horizontal drawing ! double bound = Math.max(minBounds.getWidth() * 4.0d, maxBounds.getWidth() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((width / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Draw the baseline ! graphics.drawLine(0, 0, (int) width, 0); ! ! // Draw the divisions ! multiplier = width / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() / 2); ! } ! ! // Draw the ticks ! multiplier = width / ticks; ! ! // Draw first tick ! graphics.drawLine(0, 0, 0, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(minText, 0, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (i * multiplier); ! graphics.drawLine(j, 0, j, FONT.getSize() - metrics.getDescent()); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j - (int) (middleBounds.getWidth() / 2); ! ! graphics.drawString(display, j, (int) (height - metrics.getDescent())); ! } ! ! // Draw last tick ! graphics.drawLine((int) width, 0, (int) width, FONT.getSize() - metrics.getDescent()); ! graphics.drawString(maxText, (int) (width - maxBounds.getWidth()), (int) (height - metrics.getDescent())); ! } ! } Index: JPanelGraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/JPanelGraphRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JPanelGraphRenderer.java 8 Jan 2003 21:14:27 -0000 1.4 --- JPanelGraphRenderer.java 15 Sep 2003 22:02:50 -0000 1.5 *************** *** 1,126 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! import java.awt.LayoutManager; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JComponent; ! import javax.swing.JPanel; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class JPanelGraphRenderer extends JPanel implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected Vector renderers = new Vector(); ! ! ! /** ! * Constructor for JPanelGraph. ! * ! * @param layout ! */ ! public JPanelGraphRenderer(LayoutManager layout) ! { ! super(layout); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** Constructor for Graph. */ ! public JPanelGraphRenderer() ! { ! this(new BorderLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! */ ! public void addRenderer(GraphRenderer renderer) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setGraphElement(this.element); ! } ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScaling(type); ! } ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScaling(type); ! } ! } ! } --- 1,126 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.BorderLayout; ! import java.awt.LayoutManager; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JComponent; ! import javax.swing.JPanel; ! ! import org.ejtools.graph.DefaultGraphElement; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class JPanelGraphRenderer extends JPanel implements GraphRenderer ! { ! /** Description of the Field */ ! protected GraphElement element = null; ! /** Description of the Field */ ! protected Vector renderers = new Vector(); ! ! ! /** ! * Constructor for JPanelGraph. ! * ! * @param layout ! */ ! public JPanelGraphRenderer(LayoutManager layout) ! { ! super(layout); ! this.element = new DefaultGraphElement(); ! } ! ! ! /** Constructor for Graph. */ ! public JPanelGraphRenderer() ! { ! this(new BorderLayout()); ! } ! ! ! /** ! * Sets the renderer attribute of the Graph object ! * ! * @param renderer The new renderer value ! */ ! public void addRenderer(GraphRenderer renderer) ! { ! renderer.setGraphElement(this.element); ! this.renderers.add(renderer); ! this.add((JComponent) renderer); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! this.element = element; ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setGraphElement(this.element); ! } ! } ! ! ! /** ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new horizontalScaling value ! */ ! public void setHorizontalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setHorizontalScaling(type); ! } ! } ! ! ! /** ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScale(multiplier); ! } ! } ! ! ! /** ! * @param type The new verticalScaling value ! */ ! public void setVerticalScaling(int type) ! { ! for (Iterator it = this.renderers.iterator(); it.hasNext(); ) ! { ! ((GraphRenderer) it.next()).setVerticalScaling(type); ! } ! } ! } Index: TriAxisLayoutRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/TriAxisLayoutRenderer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TriAxisLayoutRenderer.java 8 Jan 2003 21:14:25 -0000 1.5 --- TriAxisLayoutRenderer.java 15 Sep 2003 22:02:50 -0000 1.6 *************** *** 1,90 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.text.DecimalFormat; ! import java.text.SimpleDateFormat; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! import org.ejtools.graph.LabelElement; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 13 novembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class TriAxisLayoutRenderer extends GridBagLayoutRenderer ! { ! /** Constructor for TriAxisGraph. */ ! public TriAxisLayoutRenderer() ! { ! super(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! ! GraphRenderer rd = new GridGraphRenderer(new SimpleDateFormat("HH:mm:ss"), new DecimalFormat("0")); ! constraints.gridx = 1; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.BOTH; ! constraints.weightx = 1.0; ! constraints.weighty = 1.0; ! this.addRenderer(rd, constraints); ! ! Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss"), Axis.BOTTOM); ! constraints.gridx = 1; ! constraints.gridy = 2; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! constraints.gridx = 0; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! constraints.gridx = 2; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! super.setGraphElement(element); ! ! if (element instanceof LabelElement) ! { ! JComponent component = ((LabelElement) this.element).getComponent(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! constraints.gridx = 0; ! constraints.gridy = 0; ! constraints.gridwidth = 3; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.add(component, constraints); ! } ! } ! } --- 1,90 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.GridBagConstraints; ! import java.text.DecimalFormat; ! import java.text.SimpleDateFormat; ! ! import javax.swing.JComponent; ! ! import org.ejtools.graph.Axis; ! import org.ejtools.graph.GraphElement; ! import org.ejtools.graph.GraphRenderer; ! import org.ejtools.graph.LabelElement; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 13 novembre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class TriAxisLayoutRenderer extends GridBagLayoutRenderer ! { ! /** Constructor for TriAxisGraph. */ ! public TriAxisLayoutRenderer() ! { ! super(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! ! GraphRenderer rd = new GridGraphRenderer(new SimpleDateFormat("HH:mm:ss"), new DecimalFormat("0")); ! constraints.gridx = 1; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.BOTH; ! constraints.weightx = 1.0; ! constraints.weighty = 1.0; ! this.addRenderer(rd, constraints); ! ! Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss"), Axis.BOTTOM); ! constraints.gridx = 1; ! constraints.gridy = 2; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! constraints.gridx = 0; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! ! axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! constraints.gridx = 2; ! constraints.gridy = 1; ! constraints.fill = GridBagConstraints.VERTICAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.addRenderer(axis, constraints); ! } ! ! ! /** ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element) ! { ! super.setGraphElement(element); ! ! if (element instanceof LabelElement) ! { ! JComponent component = ((LabelElement) this.element).getComponent(); ! ! GridBagConstraints constraints = new GridBagConstraints(); ! constraints.gridx = 0; ! constraints.gridy = 0; ! constraints.gridwidth = 3; ! constraints.fill = GridBagConstraints.HORIZONTAL; ! constraints.weightx = 0.0; ! constraints.weighty = 0.0; ! this.add(component, constraints); ! } ! } ! } Index: VerticalAxis.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/renderer/VerticalAxis.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VerticalAxis.java 21 Dec 2002 22:07:45 -0000 1.4 --- VerticalAxis.java 15 Sep 2003 22:02:50 -0000 1.5 *************** *** 1,160 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.Dimension; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class VerticalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public VerticalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = VERTICAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! int base; ! int small; ! int middle; ! int correction; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! int x = this.getX() + insets.left; ! int y = this.getY() + insets.top; ! double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getYRange().getMin(); ! double max = element.getYRange().getMax(); ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // New dimension ! double newBound = Math.max(minBounds.getWidth(), maxBounds.getWidth()); ! this.dimension = new Dimension((int) (newBound + FONT.getSize()), this.getHeight()); ! this.revalidate(); ! ! // Vertical drawing ! double bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Set parameters ! if (this.position == LEFT) ! { ! middle = (int) (newBound); ! small = middle + FONT.getSize() / 2 - 1; ! base = middle + FONT.getSize() - 1; ! } ! else ! { ! middle = FONT.getSize() - 2; ! small = FONT.getSize() / 2 - 1; ! base = 0; ! } ! ! // Draw the baseline ! graphics.drawLine(base, 0, base, (int) height); ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(base, (int) (i * multiplier), small, (int) (i * multiplier)); ! } ! ! // draw ticks ! multiplier = height / ticks; ! ! // Draw first tick ! graphics.drawLine(base, (int) height, middle, (int) height); ! if (this.position == LEFT) ! { ! correction = -(int) minBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(minText, middle + correction, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (height - i * multiplier); ! graphics.drawLine(base, j, middle, j); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j + (int) (middleBounds.getHeight() / 2); ! if (this.position == LEFT) ! { ! correction = -(int) middleBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(display, middle + correction, j); ! } ! ! // Draw last tick ! graphics.drawLine(base, 0, middle, 0); ! if (this.position == LEFT) ! { ! correction = -(int) maxBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(maxText, middle + correction, metrics.getAscent()); ! } ! } --- 1,160 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph.renderer; ! ! import java.awt.Color; ! import java.awt.Dimension; ! import java.awt.FontMetrics; ! import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.geom.Rectangle2D; ! import java.text.Format; ! ! import org.ejtools.graph.Axis; ! ! /** ! * @author <a href="mailto:let...@us...">Laurent Etiemble</a> ! * @created 31 octobre 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class VerticalAxis extends Axis ! { ! /** ! * Constructor for VerticalAxis. ! * ! * @param format Description of the Parameter ! * @param position Description of the Parameter ! */ ! public VerticalAxis(Format format, int position) ! { ! this.format = format; ! this.orientation = VERTICAL; ! this.position = position; ! } ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! */ ! public void paintComponent(Graphics graphics) ! { ! String display; ! double multiplier = 0.0d; ! int base; ! int small; ! int middle; ! int correction; ! ! graphics.setFont(FONT); ! FontMetrics metrics = graphics.getFontMetrics(); ! ! Insets insets = this.getInsets(); ! // int x = this.getX() + insets.left; ! // int y = this.getY() + insets.top; ! // double width = (double) this.getWidth() - 1 - insets.left - insets.right; ! double height = (double) this.getHeight() - 1 - insets.top - insets.bottom; ! ! double min = element.getYRange().getMin(); ! double max = element.getYRange().getMax(); ! ! String minText = this.getFormated(min); ! Rectangle2D minBounds = metrics.getStringBounds(minText, graphics); ! String maxText = this.getFormated(max); ! Rectangle2D maxBounds = metrics.getStringBounds(maxText, graphics); ! ! // New dimension ! double newBound = Math.max(minBounds.getWidth(), maxBounds.getWidth()); ! this.dimension = new Dimension((int) (newBound + FONT.getSize()), this.getHeight()); ! this.revalidate(); ! ! // Vertical drawing ! double bound = Math.max(minBounds.getHeight() * 4.0d, maxBounds.getHeight() * 4.0d); ! ! // Specified the number of texts ! int ticks = 1; ! while ((height / ticks) > bound) ! { ! ticks = ticks * 2; ! } ! ! // Set parameters ! if (this.position == LEFT) ! { ! middle = (int) (newBound); ! small = middle + FONT.getSize() / 2 - 1; ! base = middle + FONT.getSize() - 1; ! } ! else ! { ! middle = FONT.getSize() - 2; ! small = FONT.getSize() / 2 - 1; ! base = 0; ! } ! ! // Draw the baseline ! graphics.drawLine(base, 0, base, (int) height); ! ! // Draw the divisions ! multiplier = height / ticks / 2; ! graphics.setColor(Color.black); ! for (int i = 0; i <= (2 * ticks); i++) ! { ! graphics.drawLine(base, (int) (i * multiplier), small, (int) (i * multiplier)); ! } ! ! // draw ticks ! multiplier = height / ticks; ! ! // Draw first tick ! graphics.drawLine(base, (int) height, middle, (int) height); ! if (this.position == LEFT) ! { ! correction = -(int) minBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(minText, middle + correction, (int) (height - metrics.getDescent())); ! ! // Draw others ticks ! for (int i = 1; i < ticks; i++) ! { ! int j = (int) (height - i * multiplier); ! graphics.drawLine(base, j, middle, j); ! ! display = this.getFormated(min + i * (max - min) / ticks); ! Rectangle2D middleBounds = metrics.getStringBounds(display, graphics); ! ! j = j + (int) (middleBounds.getHeight() / 2); ! if (this.position == LEFT) ! { ! correction = -(int) middleBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(display, middle + correction, j); ! } ! ! // Draw last tick ! graphics.drawLine(base, 0, middle, 0); ! if (this.position == LEFT) ! { ! correction = -(int) maxBounds.getWidth(); ! } ! else ! { ! correction = 2; ! } ! graphics.drawString(maxText, middle + correction, metrics.getAscent()); ! } ! } |
|
From: <let...@us...> - 2003-09-15 22:02:56
|
Update of /cvsroot/ejtools/libraries/graph/xdocs In directory sc8-pr-cvs1:/tmp/cvs-serv15147/graph/xdocs Modified Files: index.xml Log Message: Change Eclipse project and classpath definition Add export as Image and Text functions Index: index.xml =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/xdocs/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.xml 8 Mar 2003 20:52:13 -0000 1.2 --- index.xml 15 Sep 2003 22:02:50 -0000 1.3 *************** *** 1,24 **** ! <?xml version="1.0" encoding="ISO-8859-1"?> ! <!-- ! # ================================================================================ ! # EJTools, the Enterprise Java Tools ! # ! # Distributable under LGPL license. ! # See terms of license at gnu.org. ! # ! # $Revision$ ! # ================================================================================ ! --> ! <document> ! <properties> ! <title>Graph Tools</title> ! </properties> ! <body> ! <section name="Graph Tools"> ! <subsection name="Overview"> ! <p>This library has for primary goal to provide graph services and classes for use in a Swing application.</p> ! <p>This focuses is laid on one of the most searched feature with graph : the tracking graph. After several unsuccessful search on the Web, this library was written.</p> ! </subsection> ! </section> ! </body> ! </document> --- 1,24 ---- ! <?xml version="1.0" encoding="ISO-8859-1"?> ! <!-- ! # ================================================================================ ! # EJTools, the Enterprise Java Tools ! # ! # Distributable under LGPL license. ! # See terms of license at gnu.org. ! # ! # $Revision$ ! # ================================================================================ ! --> ! <document> ! <properties> ! <title>Graph Tools</title> ! </properties> ! <body> ! <section name="Graph Tools"> ! <subsection name="Overview"> ! <p>This library has for primary goal to provide graph services and classes for use in a Swing application.</p> ! <p>This focuses is laid on one of the most searched feature with graph : the tracking graph. After several unsuccessful search on the Web, this library was written.</p> ! </subsection> ! </section> ! </body> ! </document> |