diff --git a/JHotDraw/JavaDrawApplet.html b/JHotDraw/JavaDrawApplet.html deleted file mode 100644 index 64fbbd431371444d4d6dda82011bbc63d50b328b..0000000000000000000000000000000000000000 --- a/JHotDraw/JavaDrawApplet.html +++ /dev/null @@ -1,69 +0,0 @@ -<html> - -<head> - <title>JHotDraw Applet</title> -</head> -<body> -<h1>JavaDraw Applet</h1> -<b><a href="CH/ifa/draw/samples/javadraw/JavaDrawAppletHelp.html">Description</a></b> -<hr> - -<!--"CONVERTED_APPLET"--> -<!-- HTML CONVERTER --> -<SCRIPT LANGUAGE="JavaScript"><!-- - var _info = navigator.userAgent; - var _ns = false; - var _ns6 = false; - var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0); -//--></SCRIPT> - <COMMENT> - <SCRIPT LANGUAGE="JavaScript1.1"><!-- - var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0))); - var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0)); -//--></SCRIPT> - </COMMENT> - -<SCRIPT LANGUAGE="JavaScript"><!-- - if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 560 HEIGHT = 370 codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"><NOEMBED><XMP>'); - else if (_ns == true && _ns6 == false) document.writeln('<EMBED - type="application/x-java-applet;version=1.4" - CODE = "CH.ifa.draw.samples.javadraw.JavaDrawApplet.class" - ARCHIVE = "jhotdraw.jar" - WIDTH = 560 - HEIGHT = 370 - DRAWINGS ="Demo Pert" - Demo ="drawings/demo.draw" - Pert ="drawings/pert.draw" - scriptable=false - pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED><XMP>'); -//--></SCRIPT> -<APPLET CODE = "CH.ifa.draw.samples.javadraw.JavaDrawApplet.class" ARCHIVE = "jhotdraw.jar" WIDTH = 560 HEIGHT = 370></XMP> - <PARAM NAME = CODE VALUE = "CH.ifa.draw.samples.javadraw.JavaDrawApplet.class" > - <PARAM NAME = ARCHIVE VALUE = "jhotdraw.jar" > - <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4"> - <PARAM NAME="scriptable" VALUE="false"> - <PARAM NAME = DRAWINGS VALUE ="Demo Pert"> - <PARAM NAME = Demo VALUE ="drawings/demo.draw"> - <PARAM NAME = Pert VALUE ="drawings/pert.draw"> - - -</APPLET> -</NOEMBED> -</EMBED> -</OBJECT> - -<!-- -<APPLET CODE = "CH.ifa.draw.samples.javadraw.JavaDrawApplet.class" ARCHIVE = "jhotdraw.jar" WIDTH = 560 HEIGHT = 370> -<PARAM NAME = DRAWINGS VALUE ="Demo Pert"> -<PARAM NAME = Demo VALUE ="drawings/demo.draw"> -<PARAM NAME = Pert VALUE ="drawings/pert.draw"> - - -</APPLET> ---> -<!--"END_CONVERTED_APPLET"--> - - -</body> -</html> - diff --git a/JHotDraw/JavaDrawViewer.html b/JHotDraw/JavaDrawViewer.html deleted file mode 100644 index 8b08ff902dc94f12a49334bb6342caefedc88385..0000000000000000000000000000000000000000 --- a/JHotDraw/JavaDrawViewer.html +++ /dev/null @@ -1,63 +0,0 @@ -<html> - -<head> - <title>JavaDraw Viewer</title> -</head> -<h1>JavaDraw Viewer</h1> -<hr> - -<body> - -<!--"CONVERTED_APPLET"--> -<!-- HTML CONVERTER --> -<SCRIPT LANGUAGE="JavaScript"><!-- - var _info = navigator.userAgent; - var _ns = false; - var _ns6 = false; - var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0); -//--></SCRIPT> - <COMMENT> - <SCRIPT LANGUAGE="JavaScript1.1"><!-- - var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0))); - var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0)); -//--></SCRIPT> - </COMMENT> - -<SCRIPT LANGUAGE="JavaScript"><!-- - if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 460 HEIGHT = 350 codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"><NOEMBED><XMP>'); - else if (_ns == true && _ns6 == false) document.writeln('<EMBED - type="application/x-java-applet;version=1.4" - CODE = "CH.ifa.draw.samples.javadraw.JavaDrawViewer.class" - ARCHIVE = "jhotdraw.jar" - WIDTH = 460 - HEIGHT = 350 - Drawing ="drawings/demo.draw" - scriptable=false - pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED><XMP>'); -//--></SCRIPT> -<APPLET CODE = "CH.ifa.draw.samples.javadraw.JavaDrawViewer.class" ARCHIVE = "jhotdraw.jar" WIDTH = 460 HEIGHT = 350></XMP> - <PARAM NAME = CODE VALUE = "CH.ifa.draw.samples.javadraw.JavaDrawViewer.class" > - <PARAM NAME = ARCHIVE VALUE = "jhotdraw.jar" > - <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4"> - <PARAM NAME="scriptable" VALUE="false"> - <PARAM NAME = Drawing VALUE ="drawings/demo.draw"> - - -</APPLET> -</NOEMBED> -</EMBED> -</OBJECT> - -<!-- -<APPLET CODE = "CH.ifa.draw.samples.javadraw.JavaDrawViewer.class" ARCHIVE = "jhotdraw.jar" WIDTH = 460 HEIGHT = 350> -<PARAM NAME = Drawing VALUE ="drawings/demo.draw"> - - -</APPLET> ---> -<!--"END_CONVERTED_APPLET"--> - - -</body> -</html> - diff --git a/JHotDraw/NothingApplet.html b/JHotDraw/NothingApplet.html deleted file mode 100644 index ce946c936ce6fa0889f265404de8993ca857a6e0..0000000000000000000000000000000000000000 --- a/JHotDraw/NothingApplet.html +++ /dev/null @@ -1,63 +0,0 @@ -<html> - -<head> - <title>Nothing Applet</title> -</head> -<body> - -<!--"CONVERTED_APPLET"--> -<!-- HTML CONVERTER --> -<SCRIPT LANGUAGE="JavaScript"><!-- - var _info = navigator.userAgent; - var _ns = false; - var _ns6 = false; - var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0); -//--></SCRIPT> - <COMMENT> - <SCRIPT LANGUAGE="JavaScript1.1"><!-- - var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0))); - var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0)); -//--></SCRIPT> - </COMMENT> - -<SCRIPT LANGUAGE="JavaScript"><!-- - if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 560 HEIGHT = 370 codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"><NOEMBED><XMP>'); - else if (_ns == true && _ns6 == false) document.writeln('<EMBED - type="application/x-java-applet;version=1.4" - CODE = "CH.ifa.draw.samples.nothing.NothingApplet.class" - ARCHIVE = "jhotdraw.jar" - WIDTH = 560 - HEIGHT = 370 - DRAWINGS ="Nothing" - Nothing ="drawings/nothing.draw" - scriptable=false - pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED><XMP>'); -//--></SCRIPT> -<APPLET CODE = "CH.ifa.draw.samples.nothing.NothingApplet.class" ARCHIVE = "jhotdraw.jar" WIDTH = 560 HEIGHT = 370></XMP> - <PARAM NAME = CODE VALUE = "CH.ifa.draw.samples.nothing.NothingApplet.class" > - <PARAM NAME = ARCHIVE VALUE = "jhotdraw.jar" > - <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4"> - <PARAM NAME="scriptable" VALUE="false"> - <PARAM NAME = DRAWINGS VALUE ="Nothing"> - <PARAM NAME = Nothing VALUE ="drawings/nothing.draw"> - - -</APPLET> -</NOEMBED> -</EMBED> -</OBJECT> - -<!-- -<APPLET CODE = "CH.ifa.draw.samples.nothing.NothingApplet.class" ARCHIVE = "jhotdraw.jar" WIDTH = 560 HEIGHT = 370> -<PARAM NAME = DRAWINGS VALUE ="Nothing"> -<PARAM NAME = Nothing VALUE ="drawings/nothing.draw"> - - -</APPLET> ---> -<!--"END_CONVERTED_APPLET"--> - - -</body> -</html> - diff --git a/JHotDraw/PertApplet.html b/JHotDraw/PertApplet.html deleted file mode 100644 index bb988927f393e3d27da69e1f509929c7f41935ee..0000000000000000000000000000000000000000 --- a/JHotDraw/PertApplet.html +++ /dev/null @@ -1,66 +0,0 @@ -<html> - -<head> - <title>Draw Applet</title> -</head> -<h1>PERT Applet</h1> -<b><a href="CH/ifa/draw/samples/pert/PertAppletHelp.html">Description</a></b> -<hr> -<body> - -<!--"CONVERTED_APPLET"--> -<!-- HTML CONVERTER --> -<SCRIPT LANGUAGE="JavaScript"><!-- - var _info = navigator.userAgent; - var _ns = false; - var _ns6 = false; - var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0); -//--></SCRIPT> - <COMMENT> - <SCRIPT LANGUAGE="JavaScript1.1"><!-- - var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0))); - var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0)); -//--></SCRIPT> - </COMMENT> - -<SCRIPT LANGUAGE="JavaScript"><!-- - if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 550 HEIGHT = 340 codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"><NOEMBED><XMP>'); - else if (_ns == true && _ns6 == false) document.writeln('<EMBED - type="application/x-java-applet;version=1.4" - CODE = "CH.ifa.draw.samples.pert.PertApplet.class" - ARCHIVE = "jhotdraw.jar" - WIDTH = 550 - HEIGHT = 340 - DRAWINGS ="SAMPLE" - SAMPLE ="drawings/pert.draw" - scriptable=false - pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED><XMP>'); -//--></SCRIPT> -<APPLET CODE = "CH.ifa.draw.samples.pert.PertApplet.class" ARCHIVE = "jhotdraw.jar" WIDTH = 550 HEIGHT = 340></XMP> - <PARAM NAME = CODE VALUE = "CH.ifa.draw.samples.pert.PertApplet.class" > - <PARAM NAME = ARCHIVE VALUE = "jhotdraw.jar" > - <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4"> - <PARAM NAME="scriptable" VALUE="false"> - <PARAM NAME = DRAWINGS VALUE ="SAMPLE"> - <PARAM NAME = SAMPLE VALUE ="drawings/pert.draw"> - - -</APPLET> -</NOEMBED> -</EMBED> -</OBJECT> - -<!-- -<APPLET CODE = "CH.ifa.draw.samples.pert.PertApplet.class" ARCHIVE = "jhotdraw.jar" WIDTH = 550 HEIGHT = 340> -<PARAM NAME = DRAWINGS VALUE ="SAMPLE"> -<PARAM NAME = SAMPLE VALUE ="drawings/pert.draw"> - - -</APPLET> ---> -<!--"END_CONVERTED_APPLET"--> - - -</body> -</html> - diff --git a/JHotDraw/README.html b/JHotDraw/README.html deleted file mode 100644 index 7f6e1c9b57920383a4bad6ec2169156e7e0183a6..0000000000000000000000000000000000000000 --- a/JHotDraw/README.html +++ /dev/null @@ -1,88 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> - <title>JHotDraw 5.4</title> -</head> -<body> - -<h1>JHotDraw 5.4</h1> - -<hr><p> -<b>Preface: This is a beta release [JHotDraw5.4b1]<p> -This beta release contains the latest CVS snapshot and should be considered as progress -in work. It has not been extensively tested but is aimed to give developers access to a -more recent version of JHotDraw that 5.3.<p> -The release includes numereous new features among them: undo/redo support, enhanced MDI support, -many new figures (TextArea and figures with HTML support), zooming, minimap preview, -bug fixes,...<p> -Moreover, it contains a skeleton test suite which has been generated using JUnitDoclet. -The tests are compilable but not functional. Anyway, the excuse for not writing tests -because there weren't any is now not valid anymore ;-) Anyone contributing tests and filling the -test suite with life is welcome!<p> -Finally, developers who require a more stable release or are not willing to bear with some -bugs and exceptions should not use this beta release. Anyone else gets a preview of -the new functionality and compatibility. Any comments are welcome but (timely) response -cannot be guaranteed. -</b> -<p> - -<hr>This document gives an overview of the JHotDraw distribution, describes - how to install it, and offers links for getting started. Please refer to -the <a href="doc/ReleaseNotes.html"> release notes</a> for more information -about the 5.4 release. -<h3>Contents</h3> -<pre>JHotDraw<br> - drawings sample drawings<br> - documentation documentation for JHotDraw<br> - javadoc javadoc generated documentation<br> - pattlets pattern summary slides. They are referred<br> - to from the javadoc documentation.<br><br> - CH the JHotDraw class files<br> - ifa<br> - draw<br> - images image resources<br> - util common utilities that are independent of<br> - JHotDraw<br> - framework JHotDraw framework<br> - standard standard implementations of the JHotDraw<br> - framework abstractions<br> - figures a set of figures and their support classes<br> - applet standard UI for JHotDraw applets<br> - application standard UI for JHotDraw applications<br> - contrib a package with contributions to JHotDraw<br> - samples<br> - nothing Nothing sample<br> - javadraw JHotDraw sample<br> - pert PERT sample<br> - net A simple node and connections editor<br><br> - sources the java source files mirror the<br> - hierarchy of the class files<br><br></pre> -<h3>Installation</h3> -The distribution includes no development environment specificconfiguration -or makefiles. -<p>To run the applets doesn't require any further installation steps.Refer - to the <a href="doc/samples.html">samples</a> to view the sample applets.</p> - -<p>To run the sample applications you should include the JHotDraw directory -in your CLASSPATH. <b>Note</b> using a relative path to refer to JHotDraw -can result in class loading errors. You run into this problem when the application's -working directory is changed with a file dialog.</p> - -<h3>Getting Started</h3> - To get started check out the <a href="doc/samples.html">samples</a> and the -<a href="doc/documentation.html">documentation</a> delivered with JHotDraw. - -<h3>Legal</h3> - These release is distributed under <a href="lgpl-license.html">LGPL</a>.<br> - <br> - The original version of JHotDraw is copyright 1996, 1997 by IFA Informatik -and <a href="mailto:erich_gamma@acm.org">Erich Gamma</a>. -<p>It is hereby granted that this software can be used, copied, modified, -anddistributed without fee provided that this copyright noticeappears in -all copies.</p> - -<hr><br> - <br> - -</body> -</html> diff --git a/JHotDraw/build/build.properties b/JHotDraw/build/build.properties deleted file mode 100644 index 234fe2cb58e346f1516e44632f70a0728829fc31..0000000000000000000000000000000000000000 --- a/JHotDraw/build/build.properties +++ /dev/null @@ -1 +0,0 @@ -dest.dir=.. \ No newline at end of file diff --git a/JHotDraw/build/jhotdraw.mf b/JHotDraw/build/jhotdraw.mf deleted file mode 100644 index c88d5613b3a534da6db641fd38ac24316a1258e3..0000000000000000000000000000000000000000 --- a/JHotDraw/build/jhotdraw.mf +++ /dev/null @@ -1,65 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Ant 1.4 - -Name: CH/ifa/draw/applet/ -Sealed: true -Specification-Title: JHotDraw Default Applet -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.applet -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org - -Name: CH/ifa/draw/application/ -Sealed: true -Specification-Title: JHotDraw Default Application -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.application -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org - -Name: CH/ifa/draw/contrib/ -Sealed: true -Specification-Title: JHotDraw Contributions -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.contrib -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org - -Name: CH/ifa/draw/figures/ -Sealed: true -Specification-Title: JHotDraw Figures -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.figures -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org - -Name: CH/ifa/draw/framework/ -Sealed: true -Specification-Title: JHotDraw Core Framework -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.framework -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org - -Name: CH/ifa/draw/standard/ -Sealed: true -Specification-Title: JHotDraw Standard Implementation -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.standard -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org - -Name: CH/ifa/draw/util/ -Sealed: true -Specification-Title: JHotDraw Utilities -Specification-Version: 5.4 -Specification-Vendor: http://www.jhotdraw.org -Implementation-Title: CH.ifa.draw.util -Implementation-Version: 5.4 -Implementation-Vendor: http://www.jhotdraw.org diff --git a/JHotDraw/compile.bat b/JHotDraw/compile.bat deleted file mode 100644 index abeea0bdbe2ed519b82987c000495f8a34f49d4f..0000000000000000000000000000000000000000 --- a/JHotDraw/compile.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off - -set JHD_DIR=D:\daten\wolfram\jhotdraw -set JDK=C:\Programme\JDK1.2 - -set OLD_CP=%CLASSPATH% -set CLASSPATH=. -set CLASSPATH=%CLASSPATH%;%JHD_DIR% - -javac -d %JHD_DIR% %JHD_DIR%\src\CH\ifa\draw\applet\*.java %JHD_DIR%\src\CH\ifa\draw\application\*.java %JHD_DIR%\src\CH\ifa\draw\contrib\*.java %JHD_DIR%\src\CH\ifa\draw\figures\*.java %JHD_DIR%\src\CH\ifa\draw\framework\*.java %JHD_DIR%\src\CH\ifa\draw\standard\*.java %JHD_DIR%\src\CH\ifa\draw\util\*.java - -set SAMPLES=%JHD_DIR%\src\CH\ifa\draw\samples -javac -d %JHD_DIR% %SAMPLES%\javadraw\*.java %SAMPLES%\net\*.java %SAMPLES%\nothing\*.java %SAMPLES%\pert\*.java - -set CLASSPATH=%OLD_CP% diff --git a/JHotDraw/compile.sh b/JHotDraw/compile.sh deleted file mode 100644 index be489e7608465b1d157fce0126ec12f6f3e5f710..0000000000000000000000000000000000000000 --- a/JHotDraw/compile.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Set up JAVA_HOME and ANT_HOME as environment variables, -# or they will use these hard-coded defaults -export JAVA_HOME=${JAVA_HOME:-/usr/j2sdk/} -export ANT_HOME=${ANT_HOME:-/usr/apache-ant/} - -export PATH=$PATH:$ANT_HOME/bin - -ant -buildfile build/BUILD.XML "$@" diff --git a/JHotDraw/compile_ant.bat b/JHotDraw/compile_ant.bat deleted file mode 100644 index 223e0dc54ce8fb3d0d54151acd6101c2101a1361..0000000000000000000000000000000000000000 --- a/JHotDraw/compile_ant.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off - -call setenv.bat - -%ANT_HOME%\bin\ant -buildfile build\build.xml %1 %2 %3 diff --git a/JHotDraw/doc/Architecture Overview.ppt b/JHotDraw/doc/Architecture Overview.ppt deleted file mode 100644 index 4921b35ced36496ae5569e5dd9e73295ed239188..0000000000000000000000000000000000000000 Binary files a/JHotDraw/doc/Architecture Overview.ppt and /dev/null differ diff --git a/JHotDraw/doc/Changes.html b/JHotDraw/doc/Changes.html deleted file mode 100644 index c8790f9291975ee99b015af87a939e94a338c9c7..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/Changes.html +++ /dev/null @@ -1,203 +0,0 @@ -<html> -<head> -<title>Change Log</title> -</head> -<h1>Change Log</h1> -<hr> -<h2>Version 4.0</h1> -<ul> -<li> -added pattlet slides that are referenced from javadoc. -<li> -restricted visibility of the classes provided by CH.ifa.draw.standard. -<li> -generalized the start and end points of PolyLineFigures to a LineDecoration. -<b>Note:</b>this breaks the loading of pre 4.0 drawings. -<li> -LineFigures are now implemented based on PolyLineFigures -<li> -some UI tweaks related to the look of handles. -</ul> -<hr> -<h2>Version 4.0a</h1> -<ul> -<li> -javadoc documentation. -<li> -features -<ul> -<li> -support for cursor keys to move figures -<li> -support for snap to grid: ToggleGridCommand, DrawingView.setGrid(); -<li> -alignment commands to align (top, centers, bottoms, left, middle, rights) -AlignmentCommand -<li> -resizable ImageFigures. The ImageFigures use the IconKit to share images. -Images are currently stored by saving a reference to their -image file. The file names are relative to the user.dir -property. -</ul> -<li> -CH.ifa.draw.util.Geom: geometrical utilities. -<li> -class RectLocators: useful locators for rectangle locations.<br> -class RectTrackers: useful trackers to manipulate rectangle locations. -<li> -Major rewrite of Connections. -<ul> -<li> -connectivity support is implemented based on an ObserverFigure -interface. -<li> -ConnectionTool supports the creation and manipulation of -connections (splitting/joining segments). ConnectionTool -takes a prototype of the connection to be created. -<li> -eliminated AnchorFigure. Its only purpose was to add -ConnectionHandles. -<li> -Connection support moved from the standard to the framework package -<li> -ConnectionTrackHandle changed to ChangeConnectionStartHandle and -ChangeConnectionEndHandle. These two handles enable to change -the start/end point of a connection. -<li> -ConnectionHandle takes the prototype of the connection to be -created as parameter. -<li> -ConnectionFigure.canConnect(Figure source, Figure target) -to constrain the connection between figures. -See the PertDependency for an example for how to use this. -<li> -fixed naming inconsistencies in all signatures. -<ul> -<li> -anchor was changed to start -<li> -target was changed to end -</ul> -<li> -eliminated Figure.connectionStartPoint, connectionEndPoint -the new connection infrastructure made them obsolete. -</ul> -<li> -Figure is now an interface and no longer an abstract class. -AbstractFigure provides default implementations for the -Figure interface. If you defined your own figures you have to change the base class -from Figure to AbstractFigure. -<li> -eliminated: CH.ifa.draw.applet.AppletIconKit and -CH.ifa.draw.application.StandaloneIconKit -The functionality of these subclasses is now part of -the DrawingEditor interface -<li> -IconKit -<ul> -<li> -simplified the addition of new custom icons for tool buttons -<li> -Applet and Applications load their icons -by overriding registerPreLoadedImages (see PertApplet). -<li> -Icons are now identified by their file name without the -.gif suffix. -<li> -Example: -<pre> - kit.registerImages(tracker, kit.icon("TEXT")); -</pre> -<li> -extended to support the deferred loading of images and to share images. -</ul> -<li> -added FigureContainer.forceUpdate() such that a figure -can force a repair of its image immediatly. -<li> -added transient variable modifier were appropriate -<li> -DrawingView: added support for additional background and -foreground layers. A layer implements the Painter interface. -<li> -Replaced ScribbleFigure with a more general PolyLineFigure. A PolyLineFigure -has an optional LineDecoration at its start and end. -<li> -packaging -<ul> -<li> -moved Animatable from standard to util -<li> -moved BouncingDrawing, Animator, AnimationDecorator from standard to -javadraw -<li> -changed Transformer to Tracker and Transformer.transform() to Tracker.track() -</ul> -</ul> -<h2>Version 3.8</h1> -<ul> -<li> -added Drawing.orphan() to fix grouping bugs related to connectivity -<li> -added Drawing.replace(). -<li> -added FigureDeletedEvent, FigureChangedEvent. Deliver more -specific update notifications. -</ul> - -<h2>Version 3.6</h1> -<ul> -<li> -add Figure.decompose(), Figure.isMoveable() (to fix connection and grouping bugs) -<li> -Figure subclasses now have to implement basicDisplayBox instead of - displayBox. DisplayBox is a template method that factors the - common displaybox logic. -<li> -applet package: provides base infrastructure for applets - Common applets now derive from JavaDrawApplet -<li> -application package: provides base infrastructure for applications - Common applications now derive from JavaDrawApplet -</ul> - -<h2>Version 3.4</h1> -<ul> -<li> -make reverse iterator package private -<li> -introduced an Animatable interface - remove animation methods out of basic Drawing -<li> -GroupFigure propagate setAttribute to figures -<li> -make locators, transformers sharable, don't have to override constructors -<li> -CommandMenu return false if not handled by a command -<li> -Merged DrawWindow & Draw -<li> -Figure.handles() is now an abstract method -<li> -nuked the HandleKit stuff -<li> -Name Changes -<ul> -<li>DrawApplet -> Draw -<li>package framework -> fw -<li>DrawingReader/DrawingWriter -> Reader/Writer -<li>DrawWindow -> Draw -<li>cloneFigure -> clone -<li>readWith/writeWith -> read/write -</ul> -<li> -New -<ul> -<li>PertFigure -<li>Selectiontools support selections with a rubberband -<li>DuplicateCommand -<li>FigureAttributes class -</ul> -</ul> -</body> -</html> diff --git a/JHotDraw/doc/ClassDiagram.html b/JHotDraw/doc/ClassDiagram.html deleted file mode 100644 index a1e6553792324b395b1da4461af7d3801809ee79..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/ClassDiagram.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<head> -<title>Class Diagram</title> -</head> -<h1>Class Diagram</h1> -<hr> -<img src=classdiagram.jpg> -</body> -</html> - diff --git a/JHotDraw/doc/ReleaseNotes.html b/JHotDraw/doc/ReleaseNotes.html deleted file mode 100644 index 90bb6b04253f23e6c041a5a619e87f556d6615ef..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/ReleaseNotes.html +++ /dev/null @@ -1,275 +0,0 @@ -<html> -<head> - <title>Release Notes Version 5.1</title> -</head> -<body> -<h1>Release Notes Version 5.2</h1> -<b>Note: </b>This version requires Swing/JFC 1.1 -<p>The purpose of this release is to:</p> -<ul> - - <li>Use Swing/JFC GUI elements instead of AWT (where possible)</li> - - <li>Support for special Swing/FC features:</li> - - <ul> - - <li>Support for Multiple Document Interface (MDI) applications with several -internal frames has been added. CH.ifa.draw.contrib.MDI_DrawApplicationis -the base class which must be subclasses to takeadvantage of managing internal -frames. All examples are now derived from this class.</li> - - <li>Support for applications with splitted editor windows by deriving -the drawing application from CH.ifa.draw.contrib.SplitPaneDrawApplication<br> - </li> - - <li>Drawing windows have scrollbars</li> - - <li>Popup menus are available for additional functionality and control -over graphical figures when using CH.ifa.draw.contrib.CustomSelectionTool</li> - - <li>Toolbars can have different tools depending on the context of the -currently selected figure and tool</li> - - <li>A new composite figure is available which delegates its graphical -representation and figure attributes to another figure. Moreover, it canbe -configured with an external layout algorithm that contains the logic forhow -to lay out the child elements of the composite figure. The new compositefigure -is CH.ifa.draw.contrib.GraphicalCompositeFigure and can be configuredby a -class implementing CH.ifa.draw.contrib.FigureLayoutStrategy such asCH.ifa.draw.contrib.StandardFigureLayoutStrategy. - </li> - - </ul> - - <li>New CH.ifa.draw.util.StorageFormats that allow to add new file formats -for storing and restoring drawings (e.g. using XML)<br> - </li> - <li>Build configuration for <a href="http://jakarta.apache.org/ant/">Ant</a> -, which can be used to compile all standard JHotDraw classes, to packagethem -into a jar file and to generate javadoc information. Some instruction how -to compile and build JHotDraw can be found <a href="buildProcess.html">here</a> -.<br> - </li> - - <li>Some minor bug fixes<br> - </li> -</ul> -<br> -<h1>Release Notes Version 5.1</h1> -Changes for this release: -<ul> - - <li>the delegation based event model is used to track figure changes.The -FigureChangeListener interface supports to observe figure changes.A FigureChangeListener -receives FigureChangeEvents.The old mechanism based on Observer/Observable -and the notion of a containerwas eliminated. A figure now onlyhas listeners. -There is a new support class FigureChangeEventMulticasterto manage the listeners. -Using listeners is more consistent with the AWT/JFCevent handling style.CompositeFigure, -Decorator, ConnectionFigure, and Drawingare now FigureChangeListeners. </li> - - <li>StandardDrawing is a CompositeFigure. It is possible to inserta StandardDrawing -as a figure into a drawing. This change does notimpact the framework package. -The Drawing interface is independentof CompositeFigure.</li> - - <li>Tools no longer receive the DrawingView as an argument, but storeit -in an instance variable. Existing Tools have to be adapted accordingly.</li> - - <li>SelectionTool is more open for customization. The trackers to be used -for thedifferent selection modes can be overridden by the factory methods -createHandleTracker, createDragTracker, createAreaTracker. The MouseTracker -class was merged into AbstractTool and could be eliminated.<br> -The selection tool to be used in an application can be customizedby overridding -createSelectionTool in DrawApplication/DrawApplet.JavaDrawApp illustrates -how to use a customized selection tool thatcan handle double clicks on figures. - </li> - - <li>DrawApplication supports keyboard short cuts for the common operations. - </li> -</ul> -<h1>Release Notes Version 5.0</h1> -<b>Note:</b>This version requires JDK 1.1. -<p>The purpose of this release is to:</p> -<ul> - - <li>use JDK1.1 features: event model, access to resources, serialization, -scrolling, printing, cursors etc.</li> - - <li>improve the packaging structure.</li> - - <li>improve the support for connectivity.</li> - - <li>implement several minor improvements.</li> -</ul> -<h2>JDK1.1 features</h2> -<h3>Event Model</h3> -All event handling related classes use the JDK1.1 event model.This required -to change some method signatures to refer to morespecific events. Returning -a boolean to indicate the consumptionof an event was removed. -<h3>Serialization</h3> -This version supports to use of serialization to make adrawing persistent. -CH.ifa.draw.applet.DrawApplet andCH.ifa.draw.application.DrawApplicationsupport -both the oldstorable and the serializable format. Support for thestorable -formatwill be removed in the next version. -<p>Serialization is used in the default implementation of Figure.clone().</p> -<p>StandardDrawingView supports serialization.</p> -<h3>Resource Access</h3> -Thanks to 1.1 the access to resources could be drastically simplified.All -the resources are now accessed relative to classes.The images directory with -standard images is therefore part of thepackage hierarchy. -<p>IconKit could be decoupled from DrawingEditor and was moved fromCH.ifa.draw.standard -to CH.ifa.draw.util.Refer to the sample applications for how toload and access -resources like images.</p> -<h3>Various UI Features</h3> -<ul> - - <li>Tools support to use tool specific cursors.</li> - - <li>CH.ifa.draw.application shows the DrawingView by default in a ScrollPane. -There is a new method createContents that can be overridden to customizethe -default arrangement. The default size of the view can be customized byoverriding -getDrawingViewSize().</li> - - <li>CH.ifa.draw.application supports to print a drawing.</li> -</ul> -<h2>Packaging</h2> -The packaging was changed to separate the framework interfacesfrom default -implementations. -<p>The framework package defines the coreinterfaces and leaves default implementations -to the standard package.All key abstractions of the framework are now defined -as interfaces.Ward Cunningham has suggested this some time ago and it ended -upto be natural and logic evolution.</p> -<p>The implementation of the framework interfaces comes in two flavors.Abstract -classes like AbstractFigure, provide default implementationbut still need -to be subclassed. Standard classeslike StandardDrawing implement aframework -interface and can be used as is.</p> -<p>The framework package was renamed to "framework" the old "fw"was due to -a temprorary bug in the used IDE:</p> -<p>A figures package was forked of the standard package. This packageprovides -a kit of standard figures and their related handle andtool classes.</p> -<p>There is a new package contrib that contains classes contributedby others. -</p> -<h2>Connectivity</h2> -Connectors were introduced to define connections between figures.A figure -can have one or more connectors. A figure creates aconnector for a specific -location connectorAt(int x, int y).A connector knows how to findthe connection -point. A connection figure keeps track of aconnector for its start and end -point. -<p>Figure.chop() is no longer needed and was removed. Its functionalityis -subsumed by Connectors.</p> -<p>A set of standard connectors is provided in the standard and figurepackages. -</p> -<ul> - - <li>BoxChopConnector: finds a connection point by chopping the connection -at the figure's bounding box.</li> - - <li>LocatorConnector: uses a locator to find the connection point.Thisenables -to define connections at specific semantic points ona figure. Referto the -NetApp sample for an example of using them.</li> - - <li>ShortestDistanceConnector: finds the connection points based on the -shortest distancebetween figures.</li> - - <li>EllipseChopConnector: finds a connection point by chopping the connection -at the ellipse defined by the figure's bounding box.</li> -</ul> -Connectors are optionally visible and Figure has a method connectorVisibility -to turn their visibility on and off. This is used by the ConnectionToolto -highlight connection points when the mouse moves over a figure. -<p>TextFigures can be attached to other figures. The ConnectedTextToolsupports -to create a connected TextFigure. Try it out in JavaDraw.The text figureis -connected to the Figure that is clicked when thetool is active. To position -a connected TextFigure figures can overridethe method connectedTextLocator -to return a locator.</p> -<h2>Various Changes</h2> -<ul> - - <li>FigureEnumeration extends Enumeration to enable to iterate overfigures -without having to do a down casted in client code. Itprovides an additional -method nextFigure to get the next Figure.</li> - - <li>AbstractFigure was split. AbstractFigure no longer keeps track ofthe -FigureAttributes dictionary. The dictionary is now maintainedin its derived -class AttributeFigure. This change enables tocreate Figure subclasses without -having to use theFigureAttributes implementation.</li> - - <li>Trackers are gone. Trackerfunctionality is implemented in the Handles -themselves. In contrastto Locators they did not turn out to be reusable for -different handles.The class BoxHandleKit hides the different Handle implementation -classesfrom the API.</li> - - <li>BoxHandleKit provides factory methods to create Handles forcommon locations -on a figure.</li> - - <li>DrawingView is now an interface with a standard implementation, i.e., -StandardDrawingView.</li> - - <li>Figure.clone() is implemented in a generic way in AbstractFigure.The -figure is serialized and the clone is created by resurrectingthe serialized -figure.</li> - - <li>Image handling was simplified and the preLoadRegisteredImagesis nolonger -necessary.</li> - - <li>Commands know whether they are executable ornot. They provide an isExecutable -operation to check their state.</li> - - <li>Name changes: ObserverFigure -> ConnectionFigure, LineConnectionFigure -->LineConnection.</li> - - <li>There is support for transparent fill colors for AttributeFigures.</li> - - <li>AttributeFigre.draw() is a now a template method that callsdrawBackground() -and drawFrame(). Subclasses should overridethese methods instead of draw(). - </li> - - <li>The signature of Handle.invokeStep() and Handle.invokeEnd() was changed -to:<pre> public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) {<br> public void invokeEnd (int x, int y, int anchorX, int anchorY, DrawingView view) {<br></pre> -The passed arguments correspond to the current point and the anchor point -of the interaction.<br> -The old signature are still supported but deprecated.</li> - - <li>Doug Lea implemented a nice PolygonFigure with its corresponding Handles -and Tools. Check it out in JavaDrawApp.</li> - - <li>ElbowHandles support to adjust elbow connections.</li> -</ul> -<h2>Samples</h2> -<ul> - - <li>the samples are now located in subpackages of samples.</li> - - <li>there are two new samples: - <ul> - - <li>Nothing implements a minimal application/appletthat can be used -as the starting point for your own applications.</li> - - <li>NetApp is a simple editor with nodes and connections. Itillustrates -LocatorConnectors.</li> - - </ul> - </li> -</ul> -<h2>Converting</h2> -<ul> - - <li>If you derived classes from Handle, Tool, Locator you have to change -them to inherit from their corresponding Abstract class.</li> - - <li>Change your tool classes to no longer return a boolean fromevent handling -methods.</li> - - <li>Change the event handling method to use a specific event, typically -a MouseEvent.</li> - - <li>Import the figures package if you use figures provided by this version. - </li> - - <li>Tools should call editor().toolDone() instead of editor().setDefaultTool. - </li> - - <li>Add the serival version stuff to your figure classes.</li> -</ul> -</body> -</html> diff --git a/JHotDraw/doc/buildProcess.html b/JHotDraw/doc/buildProcess.html deleted file mode 100644 index 2a7c4a0769501b1af18133479dbad98fb6d8622b..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/buildProcess.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> - - <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> - <title>Building JHotDraw</title> -</head> -<body> -<h1>Instructions for Building JHotDraw</h1> -<hr><br> -<br> -A simple <a href="..\build\build.xml">build configuration file</a> for <a href="http://jakarta.apache.org/ant/"> -Ant</a> has been included, which can be used to compile all standard JHotDraw -classes, to packagethem into a jar file and to generate javadoc information. -The command tostart the build process could look like (when invoked in the -<code><JHOTDRAW_DIR></code>\build directory)<br> -<br> -<code>java -classpath "%CLASSPATH%;<ANT_DIR>\lib\ant.jar;<ANT_DIR>\lib\jaxp.jar;<ANT_DIR>\lib\parser.jar" --Djava.home="<JAVA_DIR>" -Dant.home="<ANT_DIR>" org.apache.tools.ant.Main -all -Ddest.dir="<JHOTDRAW_DIR>" -buildfile build.xml</code><br> -<br> -where <code><JHOTDRAW_DIR></code> is the directory path to the JHotDraw -package,<code><ANT_DIR></code> is the directory path to the Ant installation, -<code><JAVA_DIR></code>is the directory path to the Java installation.. -Apart of calling <code>org.apache.tools.ant.Main</code> with the parameter -<code>all</code> you can specify one of the following building targets:<br> -<ul> - - <li><code>clean</code> - to delete all class files first</li> - - <li><code>main</code> - to compile, copy resources and build the jar file</li> - - <li><code>jar</code> - to build the jar file<br> - </li> - - <li><code>compile</code> - to compile only</li> - - <li><code>javadoc</code> - to generate javadoc</li> - - <li><code>all</code> - to clean, compile and javadoc</li> -</ul> -Furthermore, Ant can be generate debug code when the switch <code>-Djavac.debug=on</code> - is provided.<br> -</body> -</html> diff --git a/JHotDraw/doc/change_log.txt b/JHotDraw/doc/change_log.txt deleted file mode 100644 index f37ef15f74498dfcfd721c6d7bfefa7959e35a47..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/change_log.txt +++ /dev/null @@ -1,18 +0,0 @@ -Change log -========== - -JHotDraw 5.2 changes (29.6.2001 by MrFloppy) -- SelectionFigure is now an interface. The default implementation CH.ifa.draw.standard.StandardSelectionFigure -- A FigureSelectionListener interface has been introduced in CH.ifa.draw.framework. An DrawingEditor - is now a FigureSelectionListener and the signature for all selectionChanged() methods has been - changed to figureSelectionChanged(). -- CH.ifa.draw.util.Command is now an interface. A AbstractCommand can be found in CH.ifa.draw.standard. -- All commands used to have a fView field. This has been moved to CH.ifa.draw.standard.AbstactCommand -- A CH.ifa.draw.standard.StandardDrawingView has now a paintComponents() method instead of a paint() - and update() method. This allows the CH.ifa.draw.util.FloatingTextField to be a javax.swing.JTextField - instead of a java.awt.TextField. -- CH.ifa.draw.figures.AbstractLineDecorator has been missing -- DrawApplet, DrawApplication and derived classes are now programmed towards the DrawingView interface - instead of using StandardDrawingView. That leads to occasional cast when some additional StandardDrawingView - functionality is required in some specialized cases. Applications that were derived from DrawApplication - and used to override the createContents() methods should now return a DrawingView as well \ No newline at end of file diff --git a/JHotDraw/doc/classdiagram.jpg b/JHotDraw/doc/classdiagram.jpg deleted file mode 100644 index d73a1e497a0c831c0a48f556bb9c903f6ef5d9ae..0000000000000000000000000000000000000000 Binary files a/JHotDraw/doc/classdiagram.jpg and /dev/null differ diff --git a/JHotDraw/doc/documentation.html b/JHotDraw/doc/documentation.html deleted file mode 100644 index 33b2a9a7fe496ffe2d9c9fd20cda8f5ed9136a4b..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/documentation.html +++ /dev/null @@ -1,24 +0,0 @@ -<html> -<head> - <title>JHotDraw Documentation</title> -</head> -<body> -<h1>Documentation Overview</h1> -<hr> -<ul> - <li>A description of the JHotDraw <a href="packages.html">package organization</a> -.</li> - <li>The javadoc generated <a href="../javadoc/index.html">package index</a> -.</li> - <li>An overview of the <a href="samples.html">samples</a> delivered with -JHotDraw</li> - <li>A short instruction of how to <a href="buildProcess.html">compile</a> - JHotDrawusing Ant with the build configuration provided<br> - </li> - <li>A <a href="classdiagram.html">class diagram</a> showing the mostimportant -classes and their relationships.</li> - <li>The <a href="changes.html">the change log</a> of version 4.0.</li> - <li>Some <a href="drawBackground.html">background </a>about JHotDraw.</li> -</ul> -</body> -</html> diff --git a/JHotDraw/doc/drawBackground.html b/JHotDraw/doc/drawBackground.html deleted file mode 100644 index 18104bd360e396124b07dee35567b52171b1efc7..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/drawBackground.html +++ /dev/null @@ -1,28 +0,0 @@ -<html> - -<head> - <title>JHotDraw Background</title> -</head> - -<body> -<H1>About JHotDraw</H1> -<HR> -The JHotDraw architecture was inspired by two sources: -<UL> -<LI> -<a href="http://st-www.cs.uiuc.edu/users/brant/HotDraw/HotDraw.html">HotDraw</a><br> -HotDraw is a drawing framework for Smalltalk. It was originally developed -by Kent Beck and Ward Cunningham. -<LI> -<a href="ftp://ftp.ifa.ch/pub/ET++/">ET++</a><br> -ET++ is a comprehensive and portable application framework and -class library for C++. ET++ was developed by Andre Weinand and Erich Gamma. -</UL> -<p> -JHotDraw was developed by Thomas Eggenschwiler and Erich Gamma. -It was originally planned to be a trivial case study for an applied -design patterns seminar. But then it was too much fun to just stop there... -<p> -<H2>Acknowledgements</H2> -We have received valuable input from Uwe Steinmueller, Doug Lea, Kent Beck, and Ward Cunningham. -</html> diff --git a/JHotDraw/doc/packages.html b/JHotDraw/doc/packages.html deleted file mode 100644 index 6929647bb89bd8a9672fc810dd84f1fccc061f3b..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/packages.html +++ /dev/null @@ -1,60 +0,0 @@ -<html> -<head> -<title>Packages Overview</title> -</head> -<h1>Packages Overview</h1> -<hr> -JHotDraw is organized into the following packages. -<h2><a href=../javadoc/Package-CH.ifa.draw.util.html>CH.ifa.draw.util</a></h2> -This package provides generally useful utilities that can be used -independent of JHotDraw.<p> - -<h2><a href=../javadoc/Package-CH.ifa.draw.framework.html>CH.ifa.draw.framework</a></h2> -The framework package includes the classes and interfaces that define the -JHotDraw framework. It doesn't provide any concrete implementation classes. - -<h2><a href=../javadoc/Package-CH.ifa.draw.standard.html>CH.ifa.draw.standard</a></h2> -The standard package provides standard implementations of the classes -defined in the framework package. -<p> -It provides abstract classes that implement a -framework interface and provide default implementation. The convention is to -prefix such classes with Abstract, e.g., AbstractFigure, AbstractHandle. -<p> -Classes that implement a framework interface and can be used as is -start with Standard, e.g., StandardDrawing, StandardDrawingView. - -<h2><a href=../javadoc/Package-CH.ifa.draw.figures.html>CH.ifa.draw.figures</a></h2> -A kit of figures together with their associated support classes (tools, -handles). - -<h2><a href=../javadoc/Package-CH.ifa.draw.contrib.html>CH.ifa.draw.contrib</a></h2> -Classes that where contributed by others. - -<h2><a href=../javadoc/Package-CH.ifa.draw.applet.html>CH.ifa.draw.applet</a></h2> -The applet package defines a default applet user interface for a JHotDraw -applet. JHotDraw applets can be developed without using this -package and they can have a different user interface. - -<h2><a href=../javadoc/Package-CH.ifa.draw.application.html>CH.ifa.draw.application</a></h2> -The application package defines a default user interface for standalone -JHotDraw applications. This is only a default -presentation. - -<h2>CH.ifa.draw.samples.javadraw</h2> -The package for the javadraw <a href=samples.html#JavaDrawApp>sample</a> applications. -This includes the javadraw applet, application, and a viewer applet. - -<h2>CH.ifa.draw.samples.pert</h2> -The package for the pert <a href=samples.html#PertApp>sample</a> applet -and application. - -<h2>CH.ifa.draw.samples.nothing</h2> -The package for the nothing <a href=samples.html#Nothing>sample</a> applet -and application. - -<h2>CH.ifa.draw.samples.net</h2> -The package for the net <a href=samples.html#Net>sample</a> application. - -</body> -</html> diff --git a/JHotDraw/doc/samples.html b/JHotDraw/doc/samples.html deleted file mode 100644 index 80a260e0a42361f5d2417732fc0f1b807ace6e93..0000000000000000000000000000000000000000 --- a/JHotDraw/doc/samples.html +++ /dev/null @@ -1,96 +0,0 @@ -<html> -<head> -<title>Samples</title> -</head> -<a name=top></a> -<h1>JHotDraw Samples</h1> - -As part of the JHotDraw framework we include a number of sample applications -and applets that -demonstrate various aspects of JHotDraw. -<ol> -<li><a href=#JavaDrawApp>JavaDrawApp</a></li> -<li><a href=#JavaDrawApplet>JavaDrawApplet</a></li> -<li><a href=#JavaDrawViewer>JavaDrawViewer</a></li> -<li><a href=#PertApp>PertApp/PertApplet</a></li> -<li><a href=#Nothing>Nothing</a></li> -<li><a href=#Net>Net</a></li> -</ol> -<b>Note:</b>To run the sample applets inside a browser requires a -browser with JDK1.1 support. -<hr> -<ol> -<li><h3><a name=JavaDrawApp>JavaDrawApp</a></h3></li> -<p> -This sample illustrates various standard tools and figures provided with JHotDraw. -For a description of its features refer to the <a href="../CH/ifa/draw/samples/javadraw/JavaDrawAppletHelp.html">help document</a>. -<p> -It uses a custom drawing subclass BouncingDrawing to implement a bouncing figures -feature. The animation support is attached to a figure with a AnimationDecorator. -<p> -Support for attaching URLs to figures is implemented by URLTool. -<p> -You can start the application with: -<pre>java CH.ifa.draw.samples.javadraw.JavaDrawApp</pre> -The <i>drawings</i> directory includes some sample drawings. They can be -loaded with the open command from the file menu. <b>Note</b> your CLASSPATH -has to include the absolute path to the JHotDraw directory otherwise you will -run into class loading problems. -<p> -<li><h3><a name=JavaDrawApplet>JavaDrawApplet</a></h3></li> -<p> -The <a href="../JavaDrawApplet.html">JavaDrawApplet</a> is the applet version of JavaDrawApp. -Since it is an applet the drawing can't be saved. -A sample drawing can be loaded from the load choices item. -<p> -<li><h3><a name=JavaDrawViewer>JavaDrawViewer</a></h3></li> -<p> -The <a href="../JavaDrawViewer.html">JavaDrawViewer</a> enables to view a JavaDraw drawing. If a figure has -an attached URL you can follow it by selecting it with the mouse. -<p> -The sample illustrates how to create a minimal presentation without a tool palette and -other user interface adornments. -<p> -<li><h3><a name=PertApp>PertApp/PertApplet</a></h3></li> -<p> -PertApp is simple drawing editor to support the PERT project management -technique. With PertApp you can create tasks and define their dependencies. -PertApp takes care of tracking the end time of each task. -<p> -For a description of its features refer to the <a href="../CH/ifa/draw/samples/pert/PertAppletHelp.html">help document</a>. -<p> -This sample illustrates how to create more complex figures and how to use -connections. Connections can be created either with a ConnectionTool or -ConnectionHandles. -<p> -You can start the application with: -<pre>java CH.ifa.draw.samples.pert.PertApplication</pre> -<li><h3><a name=PertApplet>PertApplet</a></h3></li> -The <i>drawings</i> directory includes some sample drawings. They can be -loaded with the open command from the file menu. <b>Note</b> your CLASSPATH -has to include the absolute path to the JHotDraw directory otherwise you will -run into class loading problems. -<p> -<a href="../PertApplet.html">PertApplet</a> is the applet version of PertApp. -<p> -<li><h3><a name=Nothing>Nothing</a></h3></li> -<p> -This is the <i>hello world</i> sample of JHotDraw. It can be used -as the starting point for developing your own applications. -The samples uses some standard tools to create a simple drawing editor. -It is only about one page of <a href="../CH/ifa/draw/samples/nothing/NothingApp.java">code</a>. -<p> -<li><h3><a name=Net>NetApp</a></h3></li> -<p> -A simple network editor. It enables the creation of nodes. When selected -a node display a set of handles that can be used to connect it with other nodes. -Nodes are connected at specific semantic locations. The potential locations -are highlighted once the mouse moves inside a node. -This sample illustrates the use of LocatorConnectors. -<p> -You can start the application with: -<pre>java CH.ifa.draw.samples.net.NetApp</pre> -A sample net can be found in the <i>drawings</i> directory. - -</body> -</html> diff --git a/JHotDraw/drawings/demo.draw b/JHotDraw/drawings/demo.draw deleted file mode 100644 index f7c5b2a38b2bfb801743468be6a9ce9c9b1167f2..0000000000000000000000000000000000000000 --- a/JHotDraw/drawings/demo.draw +++ /dev/null @@ -1,82 +0,0 @@ - - CH.ifa.draw.samples.javadraw.BouncingDrawing 19 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.ImageFigure "attributes" "attributes" 1 "URL" "String" "http://www.javasoft.com" 220 160 100 116 "/CH/ifa/draw/samples/javadraw/sampleimages/joe.surf.yellow.small.gif" 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.EllipseFigure "no_attributes" 121 16 75 36 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RoundRectangleFigure "no_attributes" 122 125 73 37 8 8 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RoundRectangleFigure "attributes" "attributes" 1 "URL" "String" "" 266 73 77 37 36 20 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 2 "TextColor" "Color" 255 255 255 "FillColor" "Color" 255 199 158 143 135 "Text" "Helvetica" 1 14 0 REF 6 - CH.ifa.draw.standard.OffsetLocator 0 0 - CH.ifa.draw.standard.RelativeLocator 0.5 0.5 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.ElbowConnection 4 195 129 230 129 230 99 266 99 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.figures.ShortestDistanceConnector REF 6 - CH.ifa.draw.figures.ShortestDistanceConnector REF 8 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.EllipseFigure "attributes" "attributes" 1 "FillColor" "Color" 35 142 104 272 18 64 32 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.LineConnection 2 195 34 273 34 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.figures.ChopEllipseConnector REF 4 - CH.ifa.draw.figures.ChopEllipseConnector REF 20 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.BorderDecorator - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 275 159 "Images" "Helvetica" 1 12 0 NULL NULL 4 4 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.BorderDecorator - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 2 "URL" "String" "" "FillColor" "Color" 255 199 158 191 60 "Connections" "Helvetica" 1 12 0 NULL NULL 4 4 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.BorderDecorator - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 108 214 "Connected Text" "Helvetica" 1 12 0 NULL NULL 4 4 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.BorderDecorator - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 222 287 "URL Attachments" "Helvetica" 1 12 0 NULL NULL 4 4 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.BorderDecorator - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 27 111 "Groups" "Helvetica" 1 12 0 NULL NULL 4 4 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.EllipseFigure "attributes" "attributes" 1 "FillColor" "Color" 35 142 104 14 203 70 46 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.LineConnection 2 122 157 72 210 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.figures.ShortestDistanceConnector REF 6 - CH.ifa.draw.figures.ChopEllipseConnector REF 48 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 192 192 192 67 176 "Annotation" "Helvetica" 1 12 0 REF 50 - CH.ifa.draw.standard.OffsetLocator 0 0 - CH.ifa.draw.standard.RelativeLocator 0.5 0.5 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.GroupFigure 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RectangleFigure "attributes" "attributes" 1 "FillColor" "Color" 255 255 255 24 25 47 44 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RectangleFigure "attributes" "attributes" 1 "FillColor" "Color" 0 0 0 34 35 47 44 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RectangleFigure "attributes" "attributes" 1 "FillColor" "Color" 255 255 255 44 45 47 44 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RectangleFigure "attributes" "attributes" 1 "FillColor" "Color" 0 0 0 54 55 47 44 4 4 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.contrib.PolygonFigure "no_attributes" 6 68 283 105 254 111 309 151 261 163 282 160 290 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.LineConnection 2 71 244 97 259 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.figures.ChopEllipseConnector REF 48 - CH.ifa.draw.contrib.ChopPolygonConnector REF 70 4 4 \ No newline at end of file diff --git a/JHotDraw/drawings/demo.ser b/JHotDraw/drawings/demo.ser deleted file mode 100644 index f405068ff8ee0f201d2afc67493b6ce18b8e9aaa..0000000000000000000000000000000000000000 Binary files a/JHotDraw/drawings/demo.ser and /dev/null differ diff --git a/JHotDraw/drawings/net.draw b/JHotDraw/drawings/net.draw deleted file mode 100644 index 166d80dc2ad3ea868a2b0c673b5dd6d09fe96d59..0000000000000000000000000000000000000000 --- a/JHotDraw/drawings/net.draw +++ /dev/null @@ -1,65 +0,0 @@ - - CH.ifa.draw.standard.StandardDrawing 13 - CH.ifa.draw.samples.net.NodeFigure "attributes" "attributes" 3 "TextColor" "Color" 255 255 255 "FrameColor" "Color" 255 255 0 "FillColor" "Color" 255 199 158 135 46 "one" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.samples.net.NodeFigure "attributes" "attributes" 3 "TextColor" "Color" 255 255 255 "FrameColor" "Color" 255 255 0 "FillColor" "Color" 255 199 158 62 102 "two" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.samples.net.NodeFigure "attributes" "attributes" 3 "TextColor" "Color" 255 255 255 "FrameColor" "Color" 255 255 0 "FillColor" "Color" 255 199 158 211 102 "three" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.samples.net.NodeFigure "attributes" "attributes" 3 "TextColor" "Color" 255 255 255 "FrameColor" "Color" 255 255 0 "FillColor" "Color" 255 199 158 134 153 "four" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.samples.net.NodeFigure "attributes" "attributes" 3 "TextColor" "Color" 255 255 255 "FrameColor" "Color" 255 255 0 "FillColor" "Color" 255 199 158 135 219 "five" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.LineConnection 2 145 67 72 96 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.LocatorConnector REF 1 - CH.ifa.draw.standard.RelativeLocator 0.5 1.0 - CH.ifa.draw.standard.LocatorConnector REF 2 - CH.ifa.draw.standard.RelativeLocator 0.5 0.0 - CH.ifa.draw.figures.LineConnection 2 145 67 226 96 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 REF 9 - CH.ifa.draw.standard.LocatorConnector REF 3 - CH.ifa.draw.standard.RelativeLocator 0.5 0.0 - CH.ifa.draw.figures.LineConnection 2 89 109 205 109 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.LocatorConnector REF 2 - CH.ifa.draw.standard.RelativeLocator 1.0 0.5 - CH.ifa.draw.standard.LocatorConnector REF 3 - CH.ifa.draw.standard.RelativeLocator 0.0 0.5 - CH.ifa.draw.figures.LineConnection 2 72 123 128 160 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.LocatorConnector REF 2 - CH.ifa.draw.standard.RelativeLocator 0.5 1.0 - CH.ifa.draw.standard.LocatorConnector REF 4 - CH.ifa.draw.standard.RelativeLocator 0.0 0.5 - CH.ifa.draw.figures.LineConnection 2 226 123 163 160 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.LocatorConnector REF 3 - CH.ifa.draw.standard.RelativeLocator 0.5 1.0 - CH.ifa.draw.standard.LocatorConnector REF 4 - CH.ifa.draw.standard.RelativeLocator 1.0 0.5 - CH.ifa.draw.figures.LineConnection 2 226 123 161 226 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 REF 35 - CH.ifa.draw.standard.LocatorConnector REF 5 - CH.ifa.draw.standard.RelativeLocator 1.0 0.5 - CH.ifa.draw.figures.LineConnection 2 72 123 129 226 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 REF 28 - CH.ifa.draw.standard.LocatorConnector REF 5 - CH.ifa.draw.standard.RelativeLocator 0.0 0.5 - CH.ifa.draw.figures.LineConnection 4 247 109 280 109 280 53 162 53 - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.LocatorConnector REF 3 - CH.ifa.draw.standard.RelativeLocator 1.0 0.5 - CH.ifa.draw.standard.LocatorConnector REF 1 - CH.ifa.draw.standard.RelativeLocator 1.0 0.5 \ No newline at end of file diff --git a/JHotDraw/drawings/net.ser b/JHotDraw/drawings/net.ser deleted file mode 100644 index 0ffdc1a5ad444fa1bb2ec339dc674ddbf26bfb8d..0000000000000000000000000000000000000000 Binary files a/JHotDraw/drawings/net.ser and /dev/null differ diff --git a/JHotDraw/drawings/nothing.draw b/JHotDraw/drawings/nothing.draw deleted file mode 100644 index 38fbe496174f4b305cfa54f642260e2c9dcff7bb..0000000000000000000000000000000000000000 --- a/JHotDraw/drawings/nothing.draw +++ /dev/null @@ -1,10 +0,0 @@ - - CH.ifa.draw.samples.javadraw.BouncingDrawing 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RectangleFigure "attributes" "attributes" 1 "FillColor" "Color" 255 255 255 80 77 196 89 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.RectangleFigure "attributes" "attributes" 1 "FillColor" "Color" 0 0 255 75 72 196 89 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 2 "TextColor" "Color" 255 255 255 "FillColor" "Color" 255 199 158 119 92 "Nothing" "Helvetica" 0 36 0 NULL NULL 4 4 - CH.ifa.draw.samples.javadraw.AnimationDecorator - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 117 90 "Nothing" "Helvetica" 0 36 0 NULL NULL 4 4 \ No newline at end of file diff --git a/JHotDraw/drawings/nothing.ser b/JHotDraw/drawings/nothing.ser deleted file mode 100644 index 4a45ec5b7c9d9488e1d30a282bd975ba2479d4ac..0000000000000000000000000000000000000000 Binary files a/JHotDraw/drawings/nothing.ser and /dev/null differ diff --git a/JHotDraw/drawings/pert.draw b/JHotDraw/drawings/pert.draw deleted file mode 100644 index 3728cc3a8da281ef41cf67abfee96e34ea437c66..0000000000000000000000000000000000000000 --- a/JHotDraw/drawings/pert.draw +++ /dev/null @@ -1,64 +0,0 @@ - - CH.ifa.draw.standard.StandardDrawing 14 - CH.ifa.draw.samples.pert.PertFigure 3 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 29 133 "Design" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 29 148 "5" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 29 163 "5" "Helvetica" 0 12 1 NULL NULL 26 130 45 51 0 1 - CH.ifa.draw.samples.pert.PertFigure 3 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 108 133 "Implement" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 108 148 "6" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 108 163 "11" "Helvetica" 0 12 1 NULL NULL 105 130 66 51 1 REF 1 3 - CH.ifa.draw.samples.pert.PertFigure 3 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 215 133 "JavaDoc" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 215 148 "2" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 215 163 "13" "Helvetica" 0 12 1 NULL NULL 212 130 55 51 1 REF 5 1 - CH.ifa.draw.samples.pert.PertFigure 3 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 314 133 "Ship" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 314 148 "0" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 314 163 "19" "Helvetica" 0 12 1 NULL NULL 311 130 31 51 3 - CH.ifa.draw.samples.pert.PertFigure 3 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 227 206 "S&P" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 227 221 "4" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 227 236 "15" "Helvetica" 0 12 1 NULL NULL 224 203 31 51 1 REF 5 1 REF 13 REF 9 - CH.ifa.draw.samples.pert.PertFigure 3 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 227 46 "Test" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 227 61 "8" "Helvetica" 1 12 0 NULL NULL - CH.ifa.draw.figures.NumberTextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 227 76 "19" "Helvetica" 0 12 1 NULL NULL 224 43 31 51 1 REF 5 1 REF 13 0 REF 17 REF 21 REF 5 REF 21 REF 9 REF 13 REF 17 - CH.ifa.draw.samples.pert.PertDependency 2 71 155 105 155 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 1 - CH.ifa.draw.standard.ChopBoxConnector REF 5 - CH.ifa.draw.samples.pert.PertDependency 2 171 155 212 155 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 5 - CH.ifa.draw.standard.ChopBoxConnector REF 9 - CH.ifa.draw.samples.pert.PertDependency 3 151 130 184 68 224 68 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 5 - CH.ifa.draw.standard.ChopBoxConnector REF 21 - CH.ifa.draw.samples.pert.PertDependency 3 154 181 184 228 224 228 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 5 - CH.ifa.draw.standard.ChopBoxConnector REF 17 - CH.ifa.draw.samples.pert.PertDependency 3 255 228 285 228 312 181 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 17 - CH.ifa.draw.standard.ChopBoxConnector REF 13 - CH.ifa.draw.samples.pert.PertDependency 2 267 155 311 155 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 9 - CH.ifa.draw.standard.ChopBoxConnector REF 13 - CH.ifa.draw.samples.pert.PertDependency 3 255 68 284 68 314 130 NULL - CH.ifa.draw.figures.ArrowTip 0 0 0 noFillColor noBorderColor - 0 0 0 - CH.ifa.draw.standard.ChopBoxConnector REF 21 - CH.ifa.draw.standard.ChopBoxConnector REF 13 - CH.ifa.draw.figures.GroupFigure 2 - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 1 "FillColor" "Color" 255 199 158 26 23 "HotJavaDraw" "Helvetica" 1 18 0 NULL NULL - CH.ifa.draw.figures.TextFigure "attributes" "attributes" 2 "FillColor" "Color" 255 199 158 "TextColor" "Color" 255 255 255 24 21 "HotJavaDraw" "Helvetica" 1 18 0 NULL NULL \ No newline at end of file diff --git a/JHotDraw/drawings/pert.ser b/JHotDraw/drawings/pert.ser deleted file mode 100644 index 774bf8993c1079480d1673f5cfe43961d7e70f9e..0000000000000000000000000000000000000000 Binary files a/JHotDraw/drawings/pert.ser and /dev/null differ diff --git a/JHotDraw/lgpl-license.html b/JHotDraw/lgpl-license.html deleted file mode 100644 index 7106b97b04aac82b1b78e5f298dada80a8ab8bcd..0000000000000000000000000000000000000000 --- a/JHotDraw/lgpl-license.html +++ /dev/null @@ -1,533 +0,0 @@ -<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> - -<html> -<head> - <title>The Open Source Initiative: The GNU Lesser General Public License (LGPL)</title> -</head> - -<body bgcolor="#FFFFFF"> - -<div align=center> - -<p> - -<table width=90% cellpadding=10 cellspacing=10 border=0> - -<tr bgcolor="#FFFFFF"> - - <td colspan=2 align="right"><img src="../graphics/ossmall.png" width="250" height="26" border="0" align="right" alt="opensource.org"> - -</td> - -</tr> - -<tr> - - <td width=75% bgcolor="#C6EFF7" valign="top"> - -<font face="Arial, Helvetica, sans serif" size="3"> - -<h1>The GNU Lesser General Public License (LGPL)</h1> - -<h2>Version 2.1, February 1999</h2> - -<blockquote> - - <p><em>(The master copy of this license lives on the <a -href="http://www.gnu.org/copyleft/lesser.html">GNU website</a>.)</em></p> - -</blockquote> - -<tt> - -<p>Copyright (C) 1991, 1999 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed.</p> - -<p>[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.]</p> - -<p>Preamble</p> - -<p>The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users.</p> - -<p>This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below.</p> - -<p>When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things.</p> - -<p>To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it.</p> - -<p>For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights.</p> - -<p>We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library.</p> - -<p>To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others.</p> - -<p>Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license.</p> - -<p>Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs.</p> - -<p>When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library.</p> - -<p>We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances.</p> - -<p>For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License.</p> - -<p>In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system.</p> - -<p>Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library.</p> - -<p>The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run.</p> - -<p>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</p> - -<p>0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you".</p> - -<p>A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables.</p> - -<p>The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".)</p> - -<p>"Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library.</p> - -<p>Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does.</p> - -<p>1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library.</p> - -<p>You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee.</p> - -<p>2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions:</p> - -<blockquote> - - <p>a) The modified work must itself be a software library.<br /> - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change.<br /> - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License.<br /> - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful.</p> - - <p>(For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.)</p> - - <p>These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Library, - and can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based - on the Library, the distribution of the whole must be on the terms of - this License, whose permissions for other licensees extend to the - entire whole, and thus to each and every part regardless of who wrote - it.</p> - - <p>Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Library.</p> - - <p>In addition, mere aggregation of another work not based on the Library - with the Library (or with a work based on the Library) on a volume of - a storage or distribution medium does not bring the other work under - the scope of this License.</p> - -</blockquote> - -<p>3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices.</p> - -<p>Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy.</p> - -<p>This option is useful when you wish to copy part of the code of -the Library into a program that is not a library.</p> - -<p>4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange.</p> - -<p>If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code.</p> - -<p>5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License.</p> - -<p>However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables.</p> - -<p>When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law.</p> - -<p>If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.)</p> - -<p>Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself.</p> - -<p>6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications.</p> - -<p>You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things:</p> - - <blockquote> - - <p>a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.)</p> - - <p>b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with.</p> - - <p>c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution.</p> - - <p>d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place.</p> - - <p>e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy.</p> - - </blockquote> - -<p>For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable.</p> - -<p>It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute.</p> - -<p>7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things:</p> - -<blockquote> - - <p>a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above.</p> - - <p>b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work.</p> - -</blockquote> - -<p>8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance.</p> - -<p>9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it.</p> - -<p>10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License.</p> - -<p>11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library.</p> - -<p>If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances.</p> - -<p>It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice.</p> - -<p>This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License.</p> - -<p>12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License.</p> - -<p>13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns.</p> - -<p>Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation.</p> - -<p>14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally.</p> - -<p>NO WARRANTY</p> - -<p>15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p> - -<p>16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES.</p> - -<p>END OF TERMS AND CONDITIONS</p> - -</tt> - -</pre> - - </td> - - <td width=25% bgcolor="#BFBFBF" valign="top"> - - <font face="Arial, Helvetica, sans serif" size="2"> - - <p><a href="index.html">Licenses main page</a></p> - - <p /> - - <hr> - - <p><a href="../index.html">opensource.org home page</a></p> - -</tr> - -</table> - -</div> - -</body> - -</html> diff --git a/JHotDraw/run_javadraw.bat b/JHotDraw/run_javadraw.bat deleted file mode 100644 index 01e20b6ccf99d3e55aba7ad7fd296b76f48c7f92..0000000000000000000000000000000000000000 --- a/JHotDraw/run_javadraw.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off - -call compile_ant javadraw diff --git a/JHotDraw/setenv.bat b/JHotDraw/setenv.bat deleted file mode 100644 index ca4a20ba1ec79605148d60fd684ea8dbc4455e75..0000000000000000000000000000000000000000 --- a/JHotDraw/setenv.bat +++ /dev/null @@ -1,2 +0,0 @@ -set JAVA_HOME=C:\progra~1\jdk1.4.0 -set ANT_HOME=C:\ant diff --git a/JHotDraw/src/CH/ifa/draw/applet/DrawApplet.java b/JHotDraw/src/CH/ifa/draw/applet/DrawApplet.java deleted file mode 100644 index 75489a9b0c00b239d2965467a8da91679519fa72..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/applet/DrawApplet.java +++ /dev/null @@ -1,573 +0,0 @@ -/* - * @(#)DrawApplet.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.applet; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import java.io.*; -import java.net.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.util.*; - -/** - * DrawApplication defines a standard presentation for - * a drawing editor that is run as an applet. The presentation is - * customized in subclasses.<p> - * Supported applet parameters: <br> - * <i>DRAWINGS</i>: a blank separated list of drawing names that is - * shown in the drawings choice. - * - * @version <$CURRENT_VERSION$> - */ -public class DrawApplet - extends JApplet - implements DrawingEditor, PaletteListener, VersionRequester { - - private transient Drawing fDrawing; - private transient Tool fTool; - - private transient DrawingView fView; - private transient ToolButton fDefaultToolButton; - private transient ToolButton fSelectedToolButton; - - private transient boolean fSimpleUpdate; - private transient JButton fUpdateButton; - - private transient JComboBox fFrameColor; - private transient JComboBox fFillColor; - private transient JComboBox fTextColor; - private transient JComboBox fArrowChoice; - private transient JComboBox fFontChoice; - - private transient UndoManager myUndoManager; - - static String fgUntitled = "untitled"; - - private static final String fgDrawPath = "/CH/ifa/draw/"; - public static final String IMAGES = fgDrawPath+"images/"; - - /** - * Initializes the applet and creates its contents. - */ - public void init() { - createIconkit(); - getVersionControlStrategy().assertCompatibleVersion(); - setUndoManager(new UndoManager()); - - getContentPane().setLayout(new BorderLayout()); - - fView = createDrawingView(); - - JPanel attributes = createAttributesPanel(); - createAttributeChoices(attributes); - getContentPane().add("North", attributes); - - JPanel toolPanel = createToolPalette(); - createTools(toolPanel); - getContentPane().add("West", toolPanel); - - getContentPane().add("Center", (Component)view()); - JPanel buttonPalette = createButtonPanel(); - createButtons(buttonPalette); - getContentPane().add("South", buttonPalette); - - initDrawing(); - // JFC should have its own internal double buffering... - //setBufferedDisplayUpdate(); - setupAttributes(); - } - - public void addViewChangeListener(ViewChangeListener vsl) { - } - - public void removeViewChangeListener(ViewChangeListener vsl) { - } - - protected Iconkit createIconkit() { - return new Iconkit(this); - } - - /** - * Creates the attributes panel. - */ - protected JPanel createAttributesPanel() { - JPanel panel = new JPanel(); - panel.setLayout(new PaletteLayout(2, new Point(2,2), false)); - return panel; - } - - /** - * Creates the attribute choices. Override to add additional - * choices. - */ - protected void createAttributeChoices(JPanel panel) { - panel.add(new JLabel("Fill")); - fFillColor = createColorChoice(FigureAttributeConstant.FILL_COLOR); - panel.add(fFillColor); - - panel.add(new JLabel("Text")); - fTextColor = createColorChoice(FigureAttributeConstant.TEXT_COLOR); - panel.add(fTextColor); - - panel.add(new JLabel("Pen")); - fFrameColor = createColorChoice(FigureAttributeConstant.FRAME_COLOR); - panel.add(fFrameColor); - - panel.add(new JLabel("Arrow")); - CommandChoice choice = new CommandChoice(); - fArrowChoice = choice; - FigureAttributeConstant arrowMode = FigureAttributeConstant.ARROW_MODE; - choice.addItem(new ChangeAttributeCommand("none", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_NONE), this)); - choice.addItem(new ChangeAttributeCommand("at Start", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_START), this)); - choice.addItem(new ChangeAttributeCommand("at End", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_END), this)); - choice.addItem(new ChangeAttributeCommand("at Both", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_BOTH), this)); - panel.add(fArrowChoice); - - panel.add(new JLabel("Font")); - fFontChoice = createFontChoice(); - panel.add(fFontChoice); - } - - /** - * Creates the color choice for the given attribute. - */ - protected JComboBox createColorChoice(FigureAttributeConstant attribute) { - CommandChoice choice = new CommandChoice(); - for (int i = 0; i < ColorMap.size(); i++) - choice.addItem( - new ChangeAttributeCommand( - ColorMap.name(i), - attribute, - ColorMap.color(i), - this - ) - ); - return choice; - } - - /** - * Creates the font choice. The choice is filled with - * all the fonts supported by the toolkit. - */ - protected JComboBox createFontChoice() { - CommandChoice choice = new CommandChoice(); - String fonts[] = Toolkit.getDefaultToolkit().getFontList(); - for (int i = 0; i < fonts.length; i++) { - choice.addItem(new ChangeAttributeCommand(fonts[i], FigureAttributeConstant.FONT_NAME, fonts[i], this)); - } - return choice; - } - - /** - * Creates the buttons panel. - */ - protected JPanel createButtonPanel() { - JPanel panel = new JPanel(); - panel.setLayout(new PaletteLayout(2, new Point(2,2), false)); - return panel; - } - - /** - * Creates the buttons shown in the buttons panel. Override to - * add additional buttons. - * @param panel the buttons panel. - */ - protected void createButtons(JPanel panel) { - panel.add(new Filler(24,20)); - - JComboBox drawingChoice = new JComboBox(); - drawingChoice.addItem(fgUntitled); - - String param = getParameter("DRAWINGS"); - if (param == null) { - param = ""; - } - StringTokenizer st = new StringTokenizer(param); - while (st.hasMoreTokens()) { - drawingChoice.addItem(st.nextToken()); - } - // offer choice only if more than one - if (drawingChoice.getItemCount() > 1) { - panel.add(drawingChoice); - } - else { - panel.add(new JLabel(fgUntitled)); - } - - drawingChoice.addItemListener( - new ItemListener() { - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - loadDrawing((String)e.getItem()); - } - } - } - ); - - panel.add(new Filler(6,20)); - - JButton button; - button = new CommandButton(new DeleteCommand("Delete", this)); - panel.add(button); - - button = new CommandButton(new DuplicateCommand("Duplicate", this)); - panel.add(button); - - button = new CommandButton(new GroupCommand("Group", this)); - panel.add(button); - - button = new CommandButton(new UngroupCommand("Ungroup", this)); - panel.add(button); - - button = new JButton("Help"); - button.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent event) { - showHelp(); - } - } - ); - panel.add(button); - - fUpdateButton = new JButton("Simple Update"); - fUpdateButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent event) { - if (fSimpleUpdate) { - setBufferedDisplayUpdate(); - } - else { - setSimpleDisplayUpdate(); - } - } - } - ); - - // panel.add(fUpdateButton); // not shown currently - } - - /** - * Creates the tools palette. - */ - protected JPanel createToolPalette() { - JPanel palette = new JPanel(); - palette.setLayout(new PaletteLayout(2,new Point(2,2))); - return palette; - } - - /** - * Creates the tools. By default only the selection tool is added. - * Override this method to add additional tools. - * Call the inherited method to include the selection tool. - * @param palette the palette where the tools are added. - */ - protected void createTools(JPanel palette) { - Tool tool = createSelectionTool(); - - fDefaultToolButton = createToolButton(IMAGES + "SEL", "Selection Tool", tool); - palette.add(fDefaultToolButton); - } - - /** - * Creates the selection tool used in this editor. Override to use - * a custom selection tool. - */ - protected Tool createSelectionTool() { - return new SelectionTool(this); - } - - /** - * Creates a tool button with the given image, tool, and text - */ - protected ToolButton createToolButton(String iconName, String toolName, Tool tool) { - return new ToolButton(this, iconName, toolName, tool); - } - - /** - * Creates the drawing used in this application. - * You need to override this method to use a Drawing - * subclass in your application. By default a standard - * Drawing is returned. - */ - protected Drawing createDrawing() { - return new StandardDrawing(); - } - - /** - * Creates the drawing view used in this application. - * You need to override this method to use a DrawingView - * subclass in your application. By default a standard - * DrawingView is returned. - */ - protected DrawingView createDrawingView() { - return new StandardDrawingView(this, 410, 370); - } - - /** - * Handles a user selection in the palette. - * @see PaletteListener - */ - public void paletteUserSelected(PaletteButton button) { - ToolButton toolButton = (ToolButton) button; - setTool(toolButton.tool(), toolButton.name()); - setSelected(toolButton); - } - - /** - * Handles when the mouse enters or leaves a palette button. - * @see PaletteListener - */ - public void paletteUserOver(PaletteButton button, boolean inside) { - if (inside) { - showStatus(button.name()); - } - else if (fSelectedToolButton != null) { - showStatus(fSelectedToolButton.name()); - } - } - - /** - * Gets the current drawing. - * @see DrawingEditor - */ - public Drawing drawing() { - return fDrawing; - } - - /** - * Gets the current tool. - * @see DrawingEditor - */ - public Tool tool() { - return fTool; - } - - /** - * Gets the current drawing view. - * @see DrawingEditor - */ - public DrawingView view() { - return fView; - } - - public DrawingView[] views() { - return new DrawingView[] { view() } ; - } - - /** - * Sets the default tool of the editor. - * @see DrawingEditor - */ - public void toolDone() { - setTool(fDefaultToolButton.tool(), fDefaultToolButton.name()); - setSelected(fDefaultToolButton); - } - - /** - * Handles a change of the current selection. Updates all - * menu items that are selection sensitive. - * @see DrawingEditor - */ - public void figureSelectionChanged(DrawingView view) { - setupAttributes(); - } - - public void viewSelectionChanged(DrawingView oldView, DrawingView newView) { - } - - private void initDrawing() { - fDrawing = createDrawing(); - view().setDrawing(fDrawing); - toolDone(); - } - - private void setTool(Tool t, String name) { - if (fTool != null) { - fTool.deactivate(); - } - fTool = t; - if (fTool != null) { - showStatus(name); - fTool.activate(); - } - } - - private void setSelected(ToolButton button) { - if (fSelectedToolButton != null) { - fSelectedToolButton.reset(); - } - fSelectedToolButton = button; - if (fSelectedToolButton != null) { - fSelectedToolButton.select(); - } - } - - protected void loadDrawing(String param) { - if (param == fgUntitled) { - fDrawing.release(); - initDrawing(); - return; - } - - String filename = getParameter(param); - if (filename != null) { - readDrawing(filename); - } - } - - private void readDrawing(String filename) { - toolDone(); - String type = guessType(filename); - if (type.equals("storable")) { - readFromStorableInput(filename); - } - else if (type.equals("serialized")) { - readFromObjectInput(filename); - } - else { - showStatus("Unknown file type"); - } - } - - private void readFromStorableInput(String filename) { - try { - URL url = new URL(getCodeBase(), filename); - InputStream stream = url.openStream(); - StorableInput input = new StorableInput(stream); - fDrawing.release(); - - fDrawing = (Drawing)input.readStorable(); - view().setDrawing(fDrawing); - } - catch (IOException e) { - initDrawing(); - showStatus("Error:" + e); - } - } - - private void readFromObjectInput(String filename) { - try { - URL url = new URL(getCodeBase(), filename); - InputStream stream = url.openStream(); - ObjectInput input = new ObjectInputStream(stream); - fDrawing.release(); - fDrawing = (Drawing)input.readObject(); - view().setDrawing(fDrawing); - } - catch (IOException e) { - initDrawing(); - showStatus("Error: " + e); - } - catch (ClassNotFoundException e) { - initDrawing(); - showStatus("Class not found: " + e); - } - } - - private String guessType(String file) { - if (file.endsWith(".draw")) { - return "storable"; - } - if (file.endsWith(".ser")) { - return "serialized"; - } - return "unknown"; - } - - private void setupAttributes() { - Color frameColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR); - Color fillColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR); - //Color textColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.TEXT_COLOR); - Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE); - String fontName = (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME); - - FigureEnumeration fe = view().selection(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR); - fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR); - //textColor = (Color) f.getAttribute(FigureAttributeConstant.TEXT_COLOR); - arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE); - fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME); - } - - fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); - fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); - //fTextColor.select(ColorMap.colorIndex(textColor)); - if (arrowMode != null) { - fArrowChoice.setSelectedIndex(arrowMode.intValue()); - } - if (fontName != null) { - fFontChoice.setSelectedItem(fontName); - } - } - - protected void setSimpleDisplayUpdate() { - view().setDisplayUpdate(new SimpleUpdateStrategy()); - fUpdateButton.setText("Simple Update"); - fSimpleUpdate = true; - } - - protected void setBufferedDisplayUpdate() { - view().setDisplayUpdate(new BufferedUpdateStrategy()); - fUpdateButton.setText("Buffered Update"); - fSimpleUpdate = false; - } - - /** - * Shows a help page for the applet. The URL of the help - * page is derived as follows: codeBase+appletClassname+Help.html" - */ - protected void showHelp() { - try { - String appletPath = getClass().getName().replace('.', '/'); - URL url = new URL(getCodeBase(), appletPath + "Help.html"); - getAppletContext().showDocument(url, "Help"); - } - catch (IOException e) { - showStatus("Help file not found"); - } - - } - - protected void setUndoManager(UndoManager newUndoManager) { - myUndoManager = newUndoManager; - } - - public UndoManager getUndoManager() { - return myUndoManager; - } - - protected VersionControlStrategy getVersionControlStrategy() { - return new StandardVersionControlStrategy(this); - } - - /** - * Subclasses should override this method to specify to which versions of - * JHotDraw they are compatible. A string array is returned so it is possible - * to specify several version numbers of JHotDraw to which the application - * is compatible with. - * - * @return all versions number of JHotDraw the application is compatible with. - */ - public String[] getRequiredVersions() { - String[] requiredVersions = new String[1]; - // return the version of the package we are in - requiredVersions[0] = VersionManagement.getPackageVersion(DrawApplet.class.getPackage()); - return requiredVersions; - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/application/DrawApplication.java b/JHotDraw/src/CH/ifa/draw/application/DrawApplication.java deleted file mode 100644 index b4d0918566c93ab14e74fa14e4cb2267506e819e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/application/DrawApplication.java +++ /dev/null @@ -1,1174 +0,0 @@ -/* - * @(#)DrawApplication.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.application; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.contrib.*; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import java.util.ListIterator; - -/** - * DrawApplication defines a standard presentation for - * standalone drawing editors. The presentation is - * customized in subclasses. - * The application is started as follows: - * <pre> - * public static void main(String[] args) { - * MayDrawApp window = new MyDrawApp(); - * window.open(); - * } - * </pre> - * - * @version <$CURRENT_VERSION$> - */ -public class DrawApplication - extends JFrame - implements DrawingEditor, PaletteListener, VersionRequester { - - private Tool fTool; - private Iconkit fIconkit; - - private JTextField fStatusLine; - private DrawingView fView; - private ToolButton fDefaultToolButton; - private ToolButton fSelectedToolButton; - - private String fApplicationName; - private StorageFormatManager fStorageFormatManager; - private UndoManager myUndoManager; - protected static String fgUntitled = "untitled"; - /** - * List is not thread safe, but should not need to be. If it does we can - * safely synchronize the few methods that use this by synchronizing on - * the List object itself. - */ - private java.util.List listeners; - private DesktopListener fDesktopListener; - - /** - * This component acts as a desktop for the content. - */ - private Desktop fDesktop; - - // the image resource path - private static final String fgDrawPath = "/CH/ifa/draw/"; - public static final String IMAGES = fgDrawPath + "images/"; - protected static int winCount = 0; - - /** - * The index of the file menu in the menu bar. - */ - public static final int FILE_MENU = 0; - /** - * The index of the edit menu in the menu bar. - */ - public static final int EDIT_MENU = 1; - /** - * The index of the alignment menu in the menu bar. - */ - public static final int ALIGNMENT_MENU = 2; - /** - * The index of the attributes menu in the menu bar. - */ - public static final int ATTRIBUTES_MENU = 3; - - /** - * Constructs a drawing window with a default title. - */ - public DrawApplication() { - this("JHotDraw"); - } - - /** - * Constructs a drawing window with the given title. - */ - public DrawApplication(String title) { - super(title); - listeners = CollectionsFactory.current().createList(); - setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - setApplicationName(title); - } - - /** - * Factory method which can be overriden by subclasses to - * create an instance of their type. - * - * @return newly created application - */ - protected DrawApplication createApplication() { - return new DrawApplication(); - } - - /** - * Open a new view for this application containing a - * view of the drawing of the currently activated window. - */ - public void newView() { - if (view() == null) { - return; - } - DrawApplication window = createApplication(); - window.open(view()); - if (view().drawing().getTitle() != null ) { - window.setDrawingTitle(view().drawing().getTitle() + " (View)"); - } - else { - window.setDrawingTitle(getDefaultDrawingTitle() + " (View)"); - } - } - - /** - * Open a new window for this application containing the passed in drawing, - * or a new drawing if the passed in drawing is null. - */ - public void newWindow(Drawing initialDrawing) { - DrawApplication window = createApplication(); - if (initialDrawing == null) { - window.open(); - } - else { - window.open(window.createDrawingView(initialDrawing)); - } - } - - public final void newWindow() { - newWindow(createDrawing()); - } - - /** - * Opens a new window - */ - public void open() { - open(createInitialDrawingView()); - } - - /** - * Opens a new window with a drawing view. - */ - protected void open(final DrawingView newDrawingView) { - getVersionControlStrategy().assertCompatibleVersion(); - setUndoManager(new UndoManager()); - setIconkit(createIconkit()); - getContentPane().setLayout(new BorderLayout()); - - // status line must be created before a tool is set - setStatusLine(createStatusLine()); - getContentPane().add(getStatusLine(), BorderLayout.SOUTH); - - // create dummy tool until the default tool is activated during toolDone() - setTool(new NullTool(this), ""); - setView(newDrawingView); - - JToolBar tools = createToolPalette(); - createTools(tools); - - JPanel activePanel = new JPanel(); - activePanel.setAlignmentX(LEFT_ALIGNMENT); - activePanel.setAlignmentY(TOP_ALIGNMENT); - activePanel.setLayout(new BorderLayout()); - activePanel.add(tools, BorderLayout.NORTH); - setDesktopListener(createDesktopListener()); - setDesktop(createDesktop()); - activePanel.add((Component)getDesktop(), BorderLayout.CENTER); - getContentPane().add(activePanel, BorderLayout.CENTER); - - JMenuBar mb = new JMenuBar(); - createMenus(mb); - setJMenuBar(mb); - - Dimension d = defaultSize(); - if (d.width > mb.getPreferredSize().width) { - setSize(d.width, d.height); - } - else { - setSize(mb.getPreferredSize().width, d.height); - } - addListeners(); - setStorageFormatManager(createStorageFormatManager()); - - //no work allowed to be done on GUI outside of AWT thread once - //setVislble(true) must be called before drawing added to desktop, else - //DND will fail. on drawing added before with a NPE. note however that - //a nulldrawingView will not fail because it is never really added to the desltop - setVisible(true); - Runnable r = new Runnable() { - public void run() { - if (newDrawingView.isInteractive()) { - getDesktop().addToDesktop(newDrawingView , Desktop.PRIMARY); - } - toolDone(); - } - }; - - if (java.awt.EventQueue.isDispatchThread() == false) { - try { - java.awt.EventQueue.invokeAndWait(r); - } - catch(java.lang.InterruptedException ie) { - System.err.println(ie.getMessage()); - exit(); - } - catch(java.lang.reflect.InvocationTargetException ite) { - System.err.println(ite.getMessage()); - exit(); - } - } - else { - r.run(); - } - - toolDone(); - } - - /** - * Registers the listeners for this window - */ - protected void addListeners() { - addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent event) { - endApp(); - } - - public void windowOpened(WindowEvent event) { - winCount++; - } - - public void windowClosed(WindowEvent event) { - if (--winCount == 0) { - System.exit(0); - } - } - } - ); - } - - /** - * Creates the standard menus. Clients override this - * method to add additional menus. - */ - protected void createMenus(JMenuBar mb) { - addMenuIfPossible(mb, createFileMenu()); - addMenuIfPossible(mb, createEditMenu()); - addMenuIfPossible(mb, createAlignmentMenu()); - addMenuIfPossible(mb, createAttributesMenu()); - addMenuIfPossible(mb, createDebugMenu()); - } - - protected void addMenuIfPossible(JMenuBar mb, JMenu newMenu) { - if (newMenu != null) { - mb.add(newMenu); - } - } - - /** - * Creates the file menu. Clients override this - * method to add additional menu items. - */ - protected JMenu createFileMenu() { - CommandMenu menu = new CommandMenu("File"); - Command cmd = new AbstractCommand("New", this, false) { - public void execute() { - promptNew(); - } - }; - menu.add(cmd, new MenuShortcut('n')); - - cmd = new AbstractCommand("Open...", this, false) { - public void execute() { - promptOpen(); - } - }; - menu.add(cmd, new MenuShortcut('o')); - - cmd = new AbstractCommand("Save As...", this, true) { - public void execute() { - promptSaveAs(); - } - }; - menu.add(cmd, new MenuShortcut('s')); - menu.addSeparator(); - - cmd = new AbstractCommand("Print...", this, true) { - public void execute() { - print(); - } - }; - menu.add(cmd, new MenuShortcut('p')); - menu.addSeparator(); - - cmd = new AbstractCommand("Exit", this, true) { - public void execute() { - endApp(); - } - }; - menu.add(cmd); - return menu; - } - - /** - * Creates the edit menu. Clients override this - * method to add additional menu items. - */ - protected JMenu createEditMenu() { - CommandMenu menu = new CommandMenu("Edit"); - menu.add(new UndoableCommand( - new SelectAllCommand("Select All", this)), new MenuShortcut('a')); - menu.addSeparator(); - menu.add(new UndoableCommand( - new CutCommand("Cut", this)), new MenuShortcut('x')); - menu.add(new CopyCommand("Copy", this), new MenuShortcut('c')); - menu.add(new UndoableCommand( - new PasteCommand("Paste", this)), new MenuShortcut('v')); - menu.addSeparator(); - menu.add(new UndoableCommand( - new DuplicateCommand("Duplicate", this)), new MenuShortcut('d')); - menu.add(new UndoableCommand(new DeleteCommand("Delete", this))); - menu.addSeparator(); - menu.add(new UndoableCommand(new GroupCommand("Group", this))); - menu.add(new UndoableCommand(new UngroupCommand("Ungroup", this))); - menu.addSeparator(); - menu.add(new UndoableCommand(new SendToBackCommand("Send to Back", this))); - menu.add(new UndoableCommand(new BringToFrontCommand("Bring to Front", this))); - menu.addSeparator(); - menu.add(new UndoCommand("Undo Command", this)); - menu.add(new RedoCommand("Redo Command", this)); - return menu; - } - - /** - * Creates the alignment menu. Clients override this - * method to add additional menu items. - */ - protected JMenu createAlignmentMenu() { - CommandMenu menu = new CommandMenu("Align"); - menu.addCheckItem(new ToggleGridCommand("Toggle Snap to Grid", this, new Point(4,4))); - menu.addSeparator(); - menu.add(new UndoableCommand( - new AlignCommand(AlignCommand.Alignment.LEFTS, this))); - menu.add(new UndoableCommand( - new AlignCommand(AlignCommand.Alignment.CENTERS, this))); - menu.add(new UndoableCommand( - new AlignCommand(AlignCommand.Alignment.RIGHTS, this))); - menu.addSeparator(); - menu.add(new UndoableCommand( - new AlignCommand(AlignCommand.Alignment.TOPS, this))); - menu.add(new UndoableCommand( - new AlignCommand(AlignCommand.Alignment.MIDDLES, this))); - menu.add(new UndoableCommand( - new AlignCommand(AlignCommand.Alignment.BOTTOMS, this))); - return menu; - } - - /** - * Creates the debug menu. Clients override this - * method to add additional menu items. - */ - protected JMenu createDebugMenu() { - CommandMenu menu = new CommandMenu("Debug"); - - Command cmd = new AbstractCommand("Simple Update", this) { - public void execute() { - this.view().setDisplayUpdate(new SimpleUpdateStrategy()); - } - }; - menu.add(cmd); - - cmd = new AbstractCommand("Buffered Update", this) { - public void execute() { - this.view().setDisplayUpdate(new BufferedUpdateStrategy()); - } - }; - menu.add(cmd); - return menu; - } - - /** - * Creates the attributes menu and its submenus. Clients override this - * method to add additional menu items. - */ - protected JMenu createAttributesMenu() { - JMenu menu = new JMenu("Attributes"); - menu.add(createColorMenu("Fill Color", FigureAttributeConstant.FILL_COLOR)); - menu.add(createColorMenu("Pen Color", FigureAttributeConstant.FRAME_COLOR)); - menu.add(createArrowMenu()); - menu.addSeparator(); - menu.add(createFontMenu()); - menu.add(createFontSizeMenu()); - menu.add(createFontStyleMenu()); - menu.add(createColorMenu("Text Color", FigureAttributeConstant.TEXT_COLOR)); - return menu; - } - - /** - * Creates the color menu. - */ - protected JMenu createColorMenu(String title, FigureAttributeConstant attribute) { - CommandMenu menu = new CommandMenu(title); - for (int i=0; i<ColorMap.size(); i++) - menu.add( - new UndoableCommand( - new ChangeAttributeCommand( - ColorMap.name(i), - attribute, - ColorMap.color(i), - this - ) - ) - ); - return menu; - } - - /** - * Creates the arrows menu. - */ - protected JMenu createArrowMenu() { - FigureAttributeConstant arrowMode = FigureAttributeConstant.ARROW_MODE; - CommandMenu menu = new CommandMenu("Arrow"); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("none", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_NONE), this))); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("at Start", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_START), this))); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("at End", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_END), this))); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("at Both", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_BOTH), this))); - return menu; - } - - /** - * Creates the fonts menus. It installs all available fonts - * supported by the toolkit implementation. - */ - protected JMenu createFontMenu() { - CommandMenu menu = new CommandMenu("Font"); - String fonts[] = Toolkit.getDefaultToolkit().getFontList(); - for (int i = 0; i < fonts.length; i++) { - menu.add(new UndoableCommand( - new ChangeAttributeCommand(fonts[i], FigureAttributeConstant.FONT_NAME, fonts[i], this))); - } - return menu; - } - - /** - * Creates the font style menu with entries (Plain, Italic, Bold). - */ - protected JMenu createFontStyleMenu() { - FigureAttributeConstant fontStyle = FigureAttributeConstant.FONT_STYLE; - CommandMenu menu = new CommandMenu("Font Style"); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("Plain", fontStyle, new Integer(Font.PLAIN), this))); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("Italic", fontStyle, new Integer(Font.ITALIC), this))); - menu.add(new UndoableCommand( - new ChangeAttributeCommand("Bold", fontStyle, new Integer(Font.BOLD), this))); - return menu; - } - - /** - * Creates the font size menu. - */ - protected JMenu createFontSizeMenu() { - CommandMenu menu = new CommandMenu("Font Size"); - int sizes[] = { 9, 10, 12, 14, 18, 24, 36, 48, 72 }; - for (int i = 0; i < sizes.length; i++) { - menu.add( - new UndoableCommand( - new ChangeAttributeCommand( - Integer.toString(sizes[i]), - FigureAttributeConstant.FONT_SIZE, - new Integer(sizes[i]), - this - ) - ) - ); - } - return menu; - } - - /** - * Create a menu which allows the user to select a different look and feel at runtime. - */ - public JMenu createLookAndFeelMenu() { - CommandMenu menu = new CommandMenu("Look'n'Feel"); - - UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); - - for (int i = 0; i < lafs.length; i++) { - final String lnfClassName = lafs[i].getClassName(); - Command cmd = new AbstractCommand(lafs[i].getName(), this) { - public void execute() { - newLookAndFeel(lnfClassName); - } - }; - menu.add(cmd); - } - return menu; - } - - /** - * Creates the tool palette. - */ - protected JToolBar createToolPalette() { - JToolBar palette = new JToolBar(); - palette.setBackground(Color.lightGray); - // use standard FlowLayout for JToolBar - // palette.setLayout(new PaletteLayout(2,new Point(2,2))); - return palette; - } - - /** - * Creates the tools. By default only the selection tool is added. - * Override this method to add additional tools. - * Call the inherited method to include the selection tool. - * @param palette the palette where the tools are added. - */ - protected void createTools(JToolBar palette) { - setDefaultTool(createDefaultTool()); - palette.add(fDefaultToolButton); - } - - /** - * Creates the selection tool used in this editor. Override to use - * a custom selection tool. - */ - protected Tool createSelectionTool() { - return new SelectionTool(this); - } - - protected Tool createDefaultTool() { - return createSelectionTool(); - } - - protected void setDefaultTool(Tool newDefaultTool) { - if (newDefaultTool != null) { - fDefaultToolButton = createToolButton(IMAGES+"SEL", "Selection Tool", newDefaultTool); - } - else { - fDefaultToolButton = null; - } - } - - public Tool getDefaultTool() { - if (fDefaultToolButton != null) { - return fDefaultToolButton.tool(); - } - else { - return null; - } - } - - /** - * Creates a tool button with the given image, tool, and text - */ - protected ToolButton createToolButton(String iconName, String toolName, Tool tool) { - return new ToolButton(this, iconName, toolName, tool); - } - - /** - * Creates the drawing view used in this application. - * You need to override this method to use a DrawingView - * subclass in your application. By default a standard - * DrawingView is returned. - */ - protected DrawingView createDrawingView() { - DrawingView createdDrawingView = createDrawingView(createDrawing()); - createdDrawingView.drawing().setTitle(getDefaultDrawingTitle()); - return createdDrawingView; - } - - protected DrawingView createDrawingView(Drawing newDrawing) { - Dimension d = getDrawingViewSize(); - DrawingView newDrawingView = new StandardDrawingView(this, d.width, d.height); - newDrawingView.setDrawing(newDrawing); - // notify listeners about created view when the view is added to the desktop - //fireViewCreatedEvent(newDrawingView); - return newDrawingView; - } - - /** - * Create the DrawingView that is active when the application is started. - * This initial DrawingView might be different from DrawingView created - * by the application, so subclasses can override this method to provide - * a special drawing view for application startup time, e.g. a NullDrawingView - * which does not display an internal frame in a multiple document interface - * (MDI) application. - * - * @return drawing view that is active at application startup time - */ - protected DrawingView createInitialDrawingView() { - return createDrawingView(); - } - - /** - * Override to define the dimensions of the drawing view. - */ - protected Dimension getDrawingViewSize() { - return new Dimension(800, 800); - } - - /** - * Creates the drawing used in this application. - * You need to override this method to use a Drawing - * subclass in your application. By default a standard - * Drawing is returned. - */ - protected Drawing createDrawing() { - return new StandardDrawing(); - } - - protected Desktop createDesktop() { - return new JPanelDesktop(this); -// return new JScrollPaneDesktop(); - } - - protected void setDesktop(Desktop newDesktop) { - newDesktop.addDesktopListener(getDesktopListener()); - fDesktop = newDesktop; - } - - /** - * Get the component, in which the content is embedded. This component - * acts as a desktop for the content. - */ - public Desktop getDesktop() { - return fDesktop; - } - - /** - * Factory method to create a StorageFormatManager for supported storage formats. - * Different applications might want to use different storage formats and can return - * their own format manager by overriding this method. - */ - public StorageFormatManager createStorageFormatManager() { - StorageFormatManager storageFormatManager = new StorageFormatManager(); - storageFormatManager.setDefaultStorageFormat(new StandardStorageFormat()); - storageFormatManager.addStorageFormat(storageFormatManager.getDefaultStorageFormat()); - storageFormatManager.addStorageFormat(new SerializationStorageFormat()); -// storageFormatManager.addStorageFormat(new JDOStorageFormat()); - return storageFormatManager; - } - - /** - * Set the StorageFormatManager. The StorageFormatManager is used when storing and - * restoring Drawing from the file system. - */ - protected final void setStorageFormatManager(StorageFormatManager newStorageFormatManager) { - fStorageFormatManager = newStorageFormatManager; - } - - /** - * Return the StorageFormatManager for this application.The StorageFormatManager is - * used when storing and restoring Drawing from the file system. - */ - public StorageFormatManager getStorageFormatManager() { - return fStorageFormatManager; - } - - /** - * Gets the default size of the window. - */ - protected Dimension defaultSize() { - return new Dimension(600,450); - } - - /** - * Creates the status line. - */ - protected JTextField createStatusLine() { - JTextField field = new JTextField("No Tool", 40); - field.setBackground(Color.white); - field.setEditable(false); - return field; - } - - private void setStatusLine(JTextField newStatusLine) { - fStatusLine = newStatusLine; - } - - protected JTextField getStatusLine() { - return fStatusLine; - } - - /** - * Handles a user selection in the palette. - * @see PaletteListener - */ - public void paletteUserSelected(PaletteButton paletteButton) { - ToolButton toolButton = (ToolButton)paletteButton; - setTool(toolButton.tool(), toolButton.name()); - setSelected(toolButton); - } - - /** - * Handles when the mouse enters or leaves a palette button. - * @see PaletteListener - */ - public void paletteUserOver(PaletteButton paletteButton, boolean inside) { - ToolButton toolButton = (ToolButton)paletteButton; - if (inside) { - showStatus(toolButton.name()); - } - else if (fSelectedToolButton != null) { - showStatus(fSelectedToolButton.name()); - } - } - - /** - * Gets the current tool. - * @see DrawingEditor - */ - public Tool tool() { - return fTool; - } - - /** - * Retrieve the active view from the window - * Gets the current drawing view. - * @see DrawingEditor - */ - public DrawingView view() { - return fView; - } - - protected void setView(DrawingView newView) { - DrawingView oldView = fView; - fView = newView; - fireViewSelectionChangedEvent(oldView, view()); - } - - public DrawingView[] views() { - return new DrawingView[] { view() }; - } - - /** - * Sets the default tool of the editor. - * @see DrawingEditor - */ - public void toolDone() { - System.out.println("ToolDone"); - if (fDefaultToolButton != null) { - setTool(fDefaultToolButton.tool(), fDefaultToolButton.name()); - setSelected(fDefaultToolButton); - } - } - - /** - * Fired by a view when the figure selection changes. Since Commands and - * Tools may depend on the figure selection they are registered to be notified - * about these events. - * Any selection sensitive GUI component should update its - * own state if the selection has changed, e.g. selection sensitive menuitems - * will update their own states. - * @see DrawingEditor - */ - public void figureSelectionChanged(DrawingView view) { - checkCommandMenus(); - } - - protected void checkCommandMenus() { - JMenuBar mb = getJMenuBar(); - - for (int x = 0; x < mb.getMenuCount(); x++) { - JMenu jm = mb.getMenu(x); - if (CommandMenu.class.isInstance(jm)) { - checkCommandMenu((CommandMenu)jm); - } - } - } - - protected void checkCommandMenu(CommandMenu cm) { - cm.checkEnabled(); - for (int y = 0; y < cm.getItemCount();y++) { - JMenuItem jmi = cm.getItem(y); - if (CommandMenu.class.isInstance(jmi)) { - checkCommandMenu((CommandMenu)jmi); - } - } - } - - /** - * Register to hear when the active view is changed. For Single document - * interface, this will happen when a new drawing is created. - */ - public void addViewChangeListener(ViewChangeListener vsl) { - listeners.add(vsl); - } - - /** - * Remove listener - */ - public void removeViewChangeListener(ViewChangeListener vsl) { - listeners.remove(vsl); - } - - /** - * An appropriate event is triggered and all registered observers - * are notified if the drawing view has been changed, e.g. by - * switching between several internal frames. This method is - * usually not needed in SDI environments. - */ - protected void fireViewSelectionChangedEvent(DrawingView oldView, DrawingView newView) { - ListIterator li= listeners.listIterator(listeners.size()); - while (li.hasPrevious()) { - ViewChangeListener vsl = (ViewChangeListener)li.previous(); - vsl.viewSelectionChanged(oldView, newView); - } - } - - protected void fireViewCreatedEvent(DrawingView view) { - ListIterator li= listeners.listIterator(listeners.size()); - while (li.hasPrevious()) { - ViewChangeListener vsl = (ViewChangeListener)li.previous(); - vsl.viewCreated(view); - } - } - - protected void fireViewDestroyingEvent(DrawingView view) { - ListIterator li= listeners.listIterator(listeners.size()); - while (li.hasPrevious()) { - ViewChangeListener vsl = (ViewChangeListener)li.previous(); - vsl.viewDestroying( view ); - } - } - - /** - * Shows a status message. - * @see DrawingEditor - */ - public void showStatus(String string) { - getStatusLine().setText(string); - } - - /** - * Note: it is inconsistent to directly assign a variable but when using it - * use it from a method. (assignment: fTool = t, usage: tool()) dnoyeB-4/8/02 - * Note: should we check that the tool is inactive before we activate it? - * this would be consistent with how we do deactivate. I think we should do - * this now and not wait till a bug pops up. even if their is no bug, its - * consistent and adds understandability to the code. dnoyeB-4/8/02 - */ - public void setTool(Tool t, String name) { - // SF bug-tracker id: #490665 - - // deactivate only those tools that have been activated before - if ((tool() != null) && (tool().isActive())) { - tool().deactivate(); - } - fTool = t; - if (tool() != null) { - showStatus(name); - tool().activate(); - } - } - - private void setSelected(ToolButton button) { - if (fSelectedToolButton != null) { - fSelectedToolButton.reset(); - } - fSelectedToolButton = button; - if (fSelectedToolButton != null) { - fSelectedToolButton.select(); - } - } - - /** - * Exits the application. You should never override this method - */ - public void exit() { - destroy(); - // tell windowing system to free resources - dispose(); - } - - protected boolean closeQuery(){ - return true; - } - - protected void endApp(){ - if(closeQuery() == true) { - exit(); - } - } - /** - * Handles additional clean up operations. Override to destroy - * or release drawing editor resources. - */ - protected void destroy() { - } - - /** - * Resets the drawing to a new empty drawing. - */ - public void promptNew() { - newWindow(createDrawing()); - //toolDone(); - //view().setDrawing(createDrawing()); - } - - /** - * Shows a file dialog and opens a drawing. - */ - public void promptOpen() { - toolDone(); - JFileChooser openDialog = createOpenFileChooser(); - getStorageFormatManager().registerFileFilters(openDialog); - if (openDialog.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { - StorageFormat foundFormat = getStorageFormatManager().findStorageFormat(openDialog.getFileFilter()); - // ricardo_padilha: if there is no format associated, - // try to find one that supports the file - if (foundFormat == null) { - foundFormat = getStorageFormatManager().findStorageFormat(openDialog.getSelectedFile()); - } - if (foundFormat != null) { - loadDrawing(foundFormat, openDialog.getSelectedFile().getAbsolutePath()); - } - else { - showStatus("Not a valid file format: " + openDialog.getFileFilter().getDescription()); - } - } - } - - /** - * Shows a file dialog and saves drawing. - */ - public void promptSaveAs() { - if (view() != null) { - toolDone(); - JFileChooser saveDialog = createSaveFileChooser(); - getStorageFormatManager().registerFileFilters(saveDialog); - - if (saveDialog.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { - StorageFormat foundFormat = getStorageFormatManager().findStorageFormat(saveDialog.getFileFilter()); - // ricardo_padilha: if there is no format associated, - // try to find one that supports the file - if (foundFormat == null) { - foundFormat = getStorageFormatManager().findStorageFormat(saveDialog.getSelectedFile()); - } - if (foundFormat != null) { - saveDrawing(foundFormat, saveDialog.getSelectedFile().getAbsolutePath()); - } - else { - showStatus("Not a valid file format: " + saveDialog.getFileFilter().getDescription()); - } - } - } - } - - /** - * Create a file chooser for the open file dialog. Subclasses may override this - * method in order to customize the open file dialog. - */ - protected JFileChooser createOpenFileChooser() { - JFileChooser openDialog = new JFileChooser(); - openDialog.setDialogType(JFileChooser.OPEN_DIALOG); - openDialog.setDialogTitle("Open File..."); - return openDialog; - } - - /** - * Create a file chooser for the save file dialog. Subclasses may override this - * method in order to customize the save file dialog. - */ - protected JFileChooser createSaveFileChooser() { - JFileChooser saveDialog = new JFileChooser(); - saveDialog.setDialogType(JFileChooser.SAVE_DIALOG); - saveDialog.setDialogTitle("Save File..."); - return saveDialog; - } - - /** - * Prints the drawing. - */ - public void print() { - tool().deactivate(); - PrintJob printJob = getToolkit().getPrintJob(this, "Print Drawing", null); - - if (printJob != null) { - Graphics pg = printJob.getGraphics(); - - if (pg != null) { - ((StandardDrawingView)view()).printAll(pg); - pg.dispose(); // flush page - } - printJob.end(); - } - tool().activate(); - } - - /** - * Save a Drawing in a file - */ - protected void saveDrawing(StorageFormat storeFormat, String file) { - // Need a better alert than this. - if (view() == null) { - return; - } - try { - String name = storeFormat.store(file, view().drawing()); - view().drawing().setTitle(name); - setDrawingTitle(name); - } - catch (IOException e) { - showStatus(e.toString()); - } - } - - /** - * Load a Drawing from a file - */ - protected void loadDrawing(StorageFormat restoreFormat, String file) { - try { - Drawing restoredDrawing = restoreFormat.restore(file); - if (restoredDrawing != null) { - restoredDrawing.setTitle(file); - newWindow(restoredDrawing); - } - else { - showStatus("Unknown file type: could not open file '" + file + "'"); - } - } - catch (IOException e) { - showStatus("Error: " + e); - } - } - - /** - * Switch to a new Look&Feel - */ - private void newLookAndFeel(String landf) { - try { - UIManager.setLookAndFeel(landf); - SwingUtilities.updateComponentTreeUI(this); - } - catch (Exception e) { - System.err.println(e); - } - } - - /** - * Set the title of the currently selected drawing - */ - protected void setDrawingTitle(String drawingTitle) { - if (getDefaultDrawingTitle().equals(drawingTitle)) { - setTitle(getApplicationName()); - } - else { - setTitle(getApplicationName() + " - " + drawingTitle); - } - } - - /** - * Return the title of the currently selected drawing - */ - protected String getDrawingTitle() { - return view().drawing().getTitle(); - } - - /** - * Set the name of the application build from this skeleton application - */ - public void setApplicationName(String applicationName) { - fApplicationName = applicationName; - } - - /** - * Return the name of the application build from this skeleton application - */ - public String getApplicationName() { - return fApplicationName; - } - - protected void setUndoManager(UndoManager newUndoManager) { - myUndoManager = newUndoManager; - } - - public UndoManager getUndoManager() { - return myUndoManager; - } - - protected VersionControlStrategy getVersionControlStrategy() { - return new StandardVersionControlStrategy(this); - } - - /** - * Subclasses should override this method to specify to which versions of - * JHotDraw they are compatible. A string array is returned so it is possible - * to specify several version numbers of JHotDraw to which the application - * is compatible with. - * - * @return all versions number of JHotDraw the application is compatible with. - */ - public String[] getRequiredVersions() { - String[] requiredVersions = new String[1]; - // return the version of the package we are in - requiredVersions[0] = VersionManagement.getPackageVersion(DrawApplication.class.getPackage()); - return requiredVersions; - } - - public String getDefaultDrawingTitle() { - return fgUntitled; - } - - protected DesktopListener getDesktopListener() { - return fDesktopListener; - } - - protected void setDesktopListener(DesktopListener desktopPaneListener) { - fDesktopListener = desktopPaneListener; - } - - protected DesktopListener createDesktopListener() { - return new DesktopListener() { - public void drawingViewAdded(DesktopEvent dpe) { - DrawingView dv = dpe.getDrawingView(); - fireViewCreatedEvent(dv); - } - public void drawingViewRemoved(DesktopEvent dpe) { - DrawingView dv = dpe.getDrawingView(); - // remove undo/redo activities which operate on this DrawingView - getUndoManager().clearUndos(dv); - getUndoManager().clearRedos(dv); - fireViewDestroyingEvent(dv); - checkCommandMenus(); - } - public void drawingViewSelected(DesktopEvent dpe) { - DrawingView dv = dpe.getDrawingView(); - //get the current selection and freeze it. - if (dv != null) { - if (dv.drawing() != null) - dv.unfreezeView(); - } - setView(dv); - } - }; - } - - protected Iconkit createIconkit() { - return new Iconkit(this); - } - - protected void setIconkit(Iconkit newIconkit) { - fIconkit = newIconkit; - } - - protected Iconkit getIconkit() { - return fIconkit; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib.jdo b/JHotDraw/src/CH/ifa/draw/contrib.jdo deleted file mode 100644 index 78669405dc8194f215cd6378b8861e871055c84e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib.jdo +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jdo SYSTEM "jdo.dtd"> -<jdo> - <package name="CH.ifa.draw.contrib"> -<!-- - <class name="ComponentFigure"> - </class> ---> - <class name="ChopDiamondConnector"> - </class> - <class name="ChopPolygonConnector"> - </class> - <class name="DiamondFigure"> - </class> - <class name="GraphicalCompositeFigure"> - </class> - <class name="PolygonFigure"> - </class> - <class name="TextAreaFigure"> - </class> - <class name="TriangleFigure"> - </class> - <class name="SimpleLayouter"> - <field name="myInsets"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - </class> - <class name="StandardLayouter"> - </class> - </package> -</jdo> diff --git a/JHotDraw/src/CH/ifa/draw/contrib/AutoscrollHelper.java b/JHotDraw/src/CH/ifa/draw/contrib/AutoscrollHelper.java deleted file mode 100644 index 00a433061d1821ba4b9ba45d5a16f28aa979f73b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/AutoscrollHelper.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * @(#)AutoscrollHelper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.*; - -/** - * A helper class for implementing autoscrolling - * - * @author SourceForge(dnoyeb) aka C.L. Gilbert - * @version <$CURRENT_VERSION$> - */ -public abstract class AutoscrollHelper { - private int autoscrollMargin = 20; - private Insets autoscrollInsets = new Insets(0, 0, 0, 0); - public AutoscrollHelper(int margin) { - autoscrollMargin = margin; - } - public void setAutoscrollMargin(int margin) { - autoscrollMargin = margin; - } - public int getAutoscrollMargin() { - return autoscrollMargin; - } - - /** - * Override this method to call getSize() on your Component - * @see Component#getSize - */ - public abstract Dimension getSize(); - - /** - * Override this method to call getVisibleRect() on your JComponent - * @see javax.swing.JComponent#getVisibleRect - */ - public abstract Rectangle getVisibleRect(); - - /** - * Override this method to call scrollRectToVisible(Rectangle aRect) on - * your component - * @see javax.swing.JComponent#scrollRectToVisible - */ - public abstract void scrollRectToVisible(Rectangle aRect); - /** - * Part of the autoscrolls interface - * - */ - public void autoscroll(Point location) { - //System.out.println("mouse at " + location); - int top = 0, left = 0, bottom = 0, right = 0; - Dimension size = getSize(); - Rectangle rect = getVisibleRect(); - int bottomEdge = rect.y + rect.height; - int rightEdge = rect.x + rect.width; - if (location.y - rect.y <= autoscrollMargin && rect.y > 0) - top = autoscrollMargin; - if (location.x - rect.x <= autoscrollMargin && rect.x > 0) - left = autoscrollMargin; - if (bottomEdge - location.y <= autoscrollMargin && bottomEdge < size.height) - bottom = autoscrollMargin; - if (rightEdge - location.x <= autoscrollMargin && rightEdge < size.width) - right = autoscrollMargin; - rect.x += right - left; - rect.y += bottom - top; - scrollRectToVisible(rect); - } - public Insets getAutoscrollInsets() { - Dimension size = getSize(); - Rectangle rect = getVisibleRect(); - autoscrollInsets.top = rect.y + autoscrollMargin; - autoscrollInsets.left = rect.x + autoscrollMargin; - autoscrollInsets.bottom = size.height - (rect.y + rect.height) + autoscrollMargin; - autoscrollInsets.right = size.width - (rect.x + rect.width) + autoscrollMargin; - return autoscrollInsets; - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CTXCommandMenu.java b/JHotDraw/src/CH/ifa/draw/contrib/CTXCommandMenu.java deleted file mode 100644 index f75cc4365d935a15e34035209e88151e99501989..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CTXCommandMenu.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * @(#)CommandMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.*; -import javax.swing.*; - -import CH.ifa.draw.framework.JHotDrawRuntimeException; -import CH.ifa.draw.util.Command; -import CH.ifa.draw.util.CommandListener; -import CH.ifa.draw.util.CommandMenu; - -/** - * A Command enabled menu. Selecting a menu item - * executes the corresponding command. - * - * @author Eduardo Francos (adapted from initial implementation by Wolfram Kaiser) - * @created 2 mai 2002 - * @see Command - * @version <$CURRENT_VERSION$> - */ -public class CTXCommandMenu extends JMenu implements ActionListener, CommandListener { - - public CTXCommandMenu(String name) { - super(name); - } - - /** - * Adds a command to the menu. The item's label is - * the command's name. - */ - public synchronized void add(Command command) { - addMenuItem(new CommandMenuItem(command)); - } - - /** - * Adds a command with the given short cut to the menu. The item's label is - * the command's name. - */ - public synchronized void add(Command command, MenuShortcut shortcut) { - addMenuItem(new CommandMenuItem(command, shortcut.getKey())); - } - - /** - * Adds a command with the given short cut to the menu. The item's label is - * the command's name. - */ - public synchronized void addCheckItem(Command command) { - addMenuItem(new CommandCheckBoxMenuItem(command)); - } - - /** - * Adds a command menu item - * - * @param item the command menu item - */ - public synchronized void add(CommandMenuItem item) { - addMenuItem(item); - } - - /** - * Adds a command checkbox menu item - * - * @param checkItem the checkbox item - */ - public synchronized void add(CommandCheckBoxMenuItem checkItem) { - addMenuItem(checkItem); - } - - /** - * Adds a normal menu item to the menu - * - * @param m The menu item - */ - protected void addMenuItem(JMenuItem m) { - m.addActionListener(this); - add(m); - ((CommandHolder)m).getCommand().addCommandListener(this); - } - - /** - * Removes a command item from the menu - * - * @param command the command tor emove - */ - public synchronized void remove(Command command) { - throw new JHotDrawRuntimeException("not implemented"); - } - - /** - * Removes an item from the menu - * - * @param item the item to remove - */ - public synchronized void remove(MenuItem item) { - throw new JHotDrawRuntimeException("not implemented"); - } - - /** - * Changes the enabling/disabling state of a named menu item. - * - * @param name Description of the Parameter - * @param state Description of the Parameter - */ - public synchronized void enable(String name, boolean state) { - for (int i = 0; i < getItemCount(); i++) { - JMenuItem item = getItem(i); - if (name.equals(item.getText())) { - item.setEnabled(state); - return; - } - } - } - - /** Description of the Method */ - public synchronized void checkEnabled() { - int j = 0; - for (int i = 0; i < getMenuComponentCount(); i++) { - JMenuItem currentItem = getItem(i); - if (currentItem instanceof CommandMenu) { - ((CommandMenu)currentItem).checkEnabled(); - } - else if (currentItem instanceof CTXCommandMenu) { - ((CTXCommandMenu)currentItem).checkEnabled(); - } - else if (currentItem instanceof CommandHolder) { - currentItem.setEnabled(((CommandHolder)currentItem).getCommand().isExecutable()); - } - else if (currentItem instanceof Command) { - currentItem.setEnabled(((Command)currentItem).isExecutable()); - } - j++; - } - } - - /** - * Executes the command. - * - * @param e Description of the Parameter - */ - public void actionPerformed(ActionEvent e) { - int j = 0; - Object source = e.getSource(); - for (int i = 0; i < getItemCount(); i++) { - // ignore separators - // a separator has a hyphen as its label - if (getMenuComponent(i) instanceof JSeparator) { - continue; - } - JMenuItem item = getItem(i); - if (source == item) { - Command cmd = ((CommandHolder)item).getCommand(); - cmd.execute(); - break; - } - j++; - } - } - - /** - * Description of the Method - * - * @param commandEvent Description of the Parameter - */ - public void commandExecuted(EventObject commandEvent) { -// checkEnabled(); - } - - /** - * Description of the Method - * - * @param commandEvent Description of the Parameter - */ - public void commandExecutable(EventObject commandEvent) { -// checkEnabled(); - } - - /** - * Description of the Method - * - * @param commandEvent Description of the Parameter - */ - public void commandNotExecutable(EventObject commandEvent) { -// checkEnabled(); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CTXWindowMenu.java b/JHotDraw/src/CH/ifa/draw/contrib/CTXWindowMenu.java deleted file mode 100644 index b578fc0225c123d1fbc94154842bc60a9806d038..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CTXWindowMenu.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * @(#)CommandMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import java.awt.event.*; -import java.beans.*; -import javax.swing.*; -import javax.swing.event.*; - -import CH.ifa.draw.contrib.CTXCommandMenu; -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.standard.AbstractCommand; - -/** - * Menu component that handles the functionality expected of a standard - * "Windows" menu for MDI applications. - * - * @author Eduardo Francos (adapted from original implementation by Wolfram Kaiser) - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class CTXWindowMenu extends CTXCommandMenu { - - MDIDesktopPane desktop; //increased visibility to avoid compilation errors - private CommandMenuItem cascadeCommand; - private CommandMenuItem tileHCommand; - private CommandMenuItem tileVCommand; - private CommandMenuItem arrangeHCommand; - private CommandMenuItem arrangeVCommand; - private int staticItems; - - /** - *Constructor for the CTXWindowsMenu object - * - * @param newText the menu's text - * @param desktop the MDI desktop - * @param editor the editor - */ - public CTXWindowMenu(String newText, MDIDesktopPane newDesktop, DrawingEditor newEditor) { - super(newText); - this.desktop = newDesktop; - - cascadeCommand = new CommandMenuItem( - new AbstractCommand("Cascade", newEditor) { - public void execute() { - CTXWindowMenu.this.desktop.cascadeFrames(); - } - - public boolean isExecutable() { - return super.isExecutable() && (CTXWindowMenu.this.desktop.getAllFrames().length > 0); - } - }); - - tileHCommand = new CommandMenuItem( - new AbstractCommand("Tile Horizontally", newEditor) { - public void execute() { - CTXWindowMenu.this.desktop.tileFramesHorizontally(); - } - - public boolean isExecutable() { - return super.isExecutable() && (CTXWindowMenu.this.desktop.getAllFrames().length > 0); - } - }); - - tileVCommand = new CommandMenuItem( - new AbstractCommand("Tile Vertically", newEditor) { - public void execute() { - CTXWindowMenu.this.desktop.tileFramesVertically(); - } - - public boolean isExecutable() { - return super.isExecutable() && (CTXWindowMenu.this.desktop.getAllFrames().length > 0); - } - }); - - arrangeHCommand = new CommandMenuItem( - new AbstractCommand("Arrange Horizontally", newEditor) { - public void execute() { - CTXWindowMenu.this.desktop.arrangeFramesHorizontally(); - } - - public boolean isExecutable() { - return super.isExecutable() && (CTXWindowMenu.this.desktop.getAllFrames().length > 0); - } - }); - - arrangeVCommand = new CommandMenuItem( - new AbstractCommand("Arrange Vertically", newEditor) { - public void execute() { - CTXWindowMenu.this.desktop.arrangeFramesVertically(); - } - - public boolean isExecutable() { - return super.isExecutable() && (CTXWindowMenu.this.desktop.getAllFrames().length > 0); - } - }); - - addMenuListener( - new MenuListener() { - public void menuCanceled(MenuEvent e) { } - - public void menuDeselected(MenuEvent e) { - removeWindowsList(); - } - - public void menuSelected(MenuEvent e) { - buildChildMenus(); - } - }); - - add(cascadeCommand); - add(tileHCommand); - add(tileVCommand); - add(arrangeHCommand); - add(arrangeVCommand); - staticItems = 5; - } - - /** removes the windows names */ - protected void removeWindowsList() { - // remove all items above static the items - while (this.getItemCount() > staticItems) { - remove(staticItems); - } - } - - /* - * Sets up the children menus depending on the current desktop state - */ - /** Description of the Method */ - void buildChildMenus() { //increased visibility to avoid compilation errors - JInternalFrame[] array = desktop.getAllFrames(); - - // update window organization commands - cascadeCommand.setEnabled(array.length > 0); - tileHCommand.setEnabled(array.length > 0); - tileVCommand.setEnabled(array.length > 0); - arrangeHCommand.setEnabled(array.length > 0); - arrangeVCommand.setEnabled(array.length > 0); - - if (array.length == 0) { - return; - } - - addSeparator(); - - for (int i = 0; i < array.length; i++) { - ChildMenuItem menu = new ChildMenuItem(array[i]); - menu.setState(i == 0); - menu.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent ae) { - JInternalFrame frame = ((ChildMenuItem)ae.getSource()).getFrame(); - frame.moveToFront(); - try { - frame.setSelected(true); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - } - }); - menu.setIcon(array[i].getFrameIcon()); - add(menu); - } - } - - /* - * This JCheckBoxMenuItem descendant is used to track the child frame that corresponds - * to a give menu. - */ - class ChildMenuItem extends JCheckBoxMenuItem { - private JInternalFrame frame; - - /** - *Constructor for the ChildMenuItem object - * - * @param frame Description of the Parameter - */ - public ChildMenuItem(JInternalFrame newFrame) { - super(newFrame.getTitle()); - frame = newFrame; - } - - /** - * Gets the frame attribute of the ChildMenuItem object - * - * @return The frame value - */ - public JInternalFrame getFrame() { - return frame; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/ChopDiamondConnector.java b/JHotDraw/src/CH/ifa/draw/contrib/ChopDiamondConnector.java deleted file mode 100644 index 13c634080eeb9ccc95a934caa4b380c65b0fc150..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/ChopDiamondConnector.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @(#)ChopDiamondConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.ChopBoxConnector; -import CH.ifa.draw.util.Geom; - -/** - * A ChopDiamondConnector locates connection points by choping the - * connection between the centers of the two figures at the edge of - * a diamond figure. - * - * @see Connector - * - * @author Erich Gamma - * @version <$CURRENT_VERSION$> - */ -public class ChopDiamondConnector extends ChopBoxConnector { - /** - * Serialization support. - * Needs to be fixed. - */ - private static final long serialVersionUID = -1461450322512395462L; - - public ChopDiamondConnector() { - // only used for Storable implementation - } - - public ChopDiamondConnector(Figure owner) { - super(owner); - } - - /** - * Return an appropriate connection point on the edge of a diamond figure - */ - protected Point chop(Figure target, Point from) { - Rectangle r = target.displayBox(); - // Center point - Point c1 = new Point(r.x + r.width/2, r.y + (r.height/2)); - Point p2 = new Point(r.x + r.width/2, r.y + r.height); - Point p4 = new Point(r.x + r.width/2, r.y); - - // If overlapping, just return the opposite corners - if (r.contains(from)) { - if (from.y > r.y && from.y < (r.y +r.height/2)) { - return p2; - } - else { - return p4; - } - } - - // Calculate angle to determine quadrant - double ang = Geom.pointToAngle(r, from); - - // Dermine line points - Point p1 = new Point(r.x + r.width , r.y + (r.height/2)); - Point p3 = new Point(r.x , r.y + (r.height/2)); - Point rp = null; // This will be returned - - // Get the intersection with edges - if (ang > 0 && ang < 1.57) { - rp = Geom.intersect(p1.x, p1.y, p2.x, p2.y, c1.x, c1.y, from.x, from.y); - } - else if (ang > 1.575 && ang < 3.14) { - rp = Geom.intersect(p2.x, p2.y, p3.x, p3.y, c1.x, c1.y, from.x, from.y); - } - else if (ang > -3.14 && ang < -1.575) { - rp = Geom.intersect(p3.x, p3.y, p4.x, p4.y, c1.x, c1.y, from.x, from.y); - } - else if (ang > -1.57 && ang < 0) { - rp = Geom.intersect(p4.x, p4.y, p1.x, p1.y, c1.x, c1.y, from.x, from.y); - } - - // No proper edge found, we should send one of four corners - if (rp == null) { - rp = Geom.angleToPoint(r, ang); - } - - return rp; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/ChopPolygonConnector.java b/JHotDraw/src/CH/ifa/draw/contrib/ChopPolygonConnector.java deleted file mode 100644 index 5a325055e8713c67da33d3294e93553152fb6509..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/ChopPolygonConnector.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * @(#)ChopPolygonConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * A ChopPolygonConnector locates a connection point by - * chopping the connection at the polygon boundary. - * - * @author Erich Gamma - * @version <$CURRENT_VERSION$> - */ -public class ChopPolygonConnector extends ChopBoxConnector { - - /* - * Serialization support. - */ - private static final long serialVersionUID = -156024908227796826L; - - public ChopPolygonConnector() { - } - - public ChopPolygonConnector(Figure owner) { - super(owner); - } - - protected Point chop(Figure target, Point from) { - return ((PolygonFigure)target).chop(from); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/contrib/ClippingUpdateStrategy.java b/JHotDraw/src/CH/ifa/draw/contrib/ClippingUpdateStrategy.java deleted file mode 100644 index bee3b8a0ff655decaaed641967cdc3b10f4abe7d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/ClippingUpdateStrategy.java +++ /dev/null @@ -1,66 +0,0 @@ -package CH.ifa.draw.contrib; - -import java.awt.Graphics; -import java.awt.Rectangle; -import java.util.Vector; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.FigureEnumerator; - -/** - * The ClippingUpdateStrategy will only draw those Figures in the DrawingView - * which intersect the Graphic's clipping rectangle. - * - * @author Aviv Hurvitz - */ -public class ClippingUpdateStrategy implements Painter { - - public ClippingUpdateStrategy() { - super(); - } - - /** - * @see CH.ifa.draw.framework.Painter#draw(Graphics, DrawingView) - */ - public void draw(Graphics g, DrawingView view) { - Rectangle viewClipRectangle = g.getClipBounds(); - - if (viewClipRectangle == null) { - // it seems clip is always set, but nevertheless handle it - view.drawAll(g); - return; - } - - FigureEnumeration fe = view.drawing().figures(); - - // it's better to start big than to do Log(nFigures) reallocations - Vector v = new Vector(1000); - - // create a List of the figures within the clip rectangle - while (fe.hasNextFigure()) { - Figure fig = fe.nextFigure(); - Rectangle r = fig.displayBox(); - - // grow Rectangles that have 0 width or height, since - // Rectangle.intersects() returns false on them. - // These Rectangles are common, as they are the typical bounding - // boxes of horizontal and vertical lines. - // see my (regression) bug report on Sun's site: - // http://developer.java.sun.com/developer/bugParade/bugs/4643428.html - if (r.width <= 0) { - r.width = 1; - } - if (r.height <= 0) { - r.height = 1; - } - - if (r.intersects(viewClipRectangle)) { - v.add(fig); - } - } - - // draw the figures in the clip rectangle - FigureEnumeration clippedFE = new FigureEnumerator(v); - view.draw(g, clippedFE); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CommandCheckBoxMenuItem.java b/JHotDraw/src/CH/ifa/draw/contrib/CommandCheckBoxMenuItem.java deleted file mode 100644 index 4973028f200f52ed3d83ce0ed859b0d55f518dbc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CommandCheckBoxMenuItem.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @(#)CommandMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import javax.swing.JCheckBoxMenuItem; -import CH.ifa.draw.util.Command; -import javax.swing.Icon; - -/** - * CommandCheckBoxMenuItem implements a command that can be added to a menu - * as a checkbox menu item - * - * @author Eduardo Francos - InContext - * @version <$CURRENT_VERSION$> - */ - -public class CommandCheckBoxMenuItem extends JCheckBoxMenuItem - implements CommandHolder -{ - Command fCommand; - - /** - * Creates an initially unselected check box menu item - * with the specified command - */ - public CommandCheckBoxMenuItem(Command command) { - super(command.name()); - setCommand(command); - } - - /** - * Creates an initially unselected check box menu item with an icon and - * the specified command. - * - * @param icon the icon of the CheckBoxMenuItem. - */ - public CommandCheckBoxMenuItem(Command command, Icon icon) { - super(command.name(), icon); - setCommand(command); - } - - /** - * Creates a check box menu item with the specified command and selection state. - * - * @param command the command to be executed upon menu selection - * @param b the selected state of the check box menu item - */ - public CommandCheckBoxMenuItem(Command command, boolean b) { - super(command.name(), b); - setCommand(command); - } - - /** - * Creates a check box menu item with the specified text, icon, and selection state. - * - * @param command the command to be executed upon menu selection - * @param icon the icon of the check box menu item - * @param b the selected state of the check box menu item - */ - public CommandCheckBoxMenuItem(Command command, Icon icon, boolean b) { - super(command.name(), icon, b); - setCommand(command); - } - - - /** - * Gets the command attribute of the CommandMenuItem object - * - * @return The command value - */ - public Command getCommand() { - return fCommand; - } - - - /** - * Sets the command attribute of the CommandMenuItem object - * - * @param newCommand The new command value - */ - public void setCommand(Command newCommand) { - fCommand = newCommand; - } - -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CommandHolder.java b/JHotDraw/src/CH/ifa/draw/contrib/CommandHolder.java deleted file mode 100644 index 2a91895ed74a7d23cdbecd49c63fce7b85314f87..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CommandHolder.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)CommandMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import CH.ifa.draw.util.Command; - -/** - * CommandHolder defines the interface for wrapper objects holding a Command, - * like menu items or toolbar tools. - * - * @author Eduardo Francos - InContext - * @created 8 mai 2002 - * @version <$CURRENT_VERSION$> - */ - -public interface CommandHolder { - /** - * Gets the command of the CommandHolder object - * - * @return The command value - */ - public Command getCommand(); - - - /** - * Sets the command of the CommandHolder object - * - * @param newCommand The new command value - */ - public void setCommand(Command newCommand); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CommandMenuItem.java b/JHotDraw/src/CH/ifa/draw/contrib/CommandMenuItem.java deleted file mode 100644 index d7079ef7ce5c1db247dd3da17d0334c9b58f77e8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CommandMenuItem.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * @(#)CommandMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import CH.ifa.draw.util.Command; -import javax.swing.JMenuItem; -import javax.swing.Icon; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * CommandMenuItem implements a command that can be added to a menu - * as a menu item - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class CommandMenuItem extends JMenuItem implements CommandHolder, ActionListener { - - private Command fCommand; - - /** - * Creates a menuItem with no set text or icon. - */ - public CommandMenuItem(Command command) { - super(command.name()); - setCommand(command); - addActionListener(this); - } - - /** - * Creates a menuItem with an icon. - * - * @param icon the icon of the MenuItem. - */ - public CommandMenuItem(Command command, Icon icon) { - super(command.name(), icon); - setCommand(command); - addActionListener(this); - } - - /** - * Creates a menuItem with the specified text and - * keyboard mnemonic. - * - * @param command the command to be executed upon menu selection - * @param mnemonic the keyboard mnemonic for the MenuItem - */ - public CommandMenuItem(Command command, int mnemonic) { - super(command.name(), mnemonic); - setCommand(command); - } - - /** - * Gets the command attribute of the CommandMenuItem object - * - * @return The command value - */ - public Command getCommand() { - return fCommand; - } - - /** - * Sets the command attribute of the CommandMenuItem object - * - * @param newCommand The new command value - */ - public void setCommand(Command newCommand) { - fCommand = newCommand; - } - - /** - * Executes the command. - */ - public void actionPerformed(ActionEvent e) { - getCommand().execute(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/ComponentFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/ComponentFigure.java deleted file mode 100644 index bc2d974e4d858fff4cedb5a387c6dd34ea4c7053..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/ComponentFigure.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @(#)ComponentFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.figures.AttributeFigure; -import CH.ifa.draw.standard.BoxHandleKit; -import CH.ifa.draw.standard.HandleEnumerator; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; - -import java.awt.Component; -import java.awt.Rectangle; -import java.awt.Point; -import java.awt.Graphics; -import java.util.List; - -/** - * @author Ming Fang - * @version <$CURRENT_VERSION$> - */ -public class ComponentFigure extends AttributeFigure { - private Rectangle bounds; - - /** Holds value of property component. */ - private Component component; - - private ComponentFigure() { - bounds = new Rectangle(); - } - - /** - * @param newComponent a lightweight component - */ - public ComponentFigure(Component newComponent) { - this(); - setComponent(newComponent); - } - - /** - * Changes the display box of a figure. This method is - * always implemented in figure subclasses. - * It only changes - * the displaybox and does not announce any changes. It - * is usually not called by the client. Clients typically call - * displayBox to change the display box. - * - * @param origin the new origin - * @param corner the new corner - * @see #displayBox - */ - public void basicDisplayBox(Point origin, Point corner) { - bounds = new Rectangle(origin); - bounds.add(corner); - } - - /** - * Moves the figure. This is the - * method that subclassers override. Clients usually - * call displayBox. - * @see #moveBy - */ - protected void basicMoveBy(int dx, int dy) { - bounds.translate(dx, dy); - } - - /** - * Gets the display box of a figure - * @see #basicDisplayBox - */ - public Rectangle displayBox() { - return new Rectangle(bounds); - } - - /** - * Returns the handles used to manipulate - * the figure. Handles is a Factory Method for - * creating handle objects. - * - * @return a type-safe iterator of handles - * @see Handle - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - return new HandleEnumerator(handles); - } - - /** - * Getter for property component. - * @return Value of property component. - */ - public Component getComponent() { - return this.component; - } - - /** - * Setter for property component. - * - * @param newComponent New value of property component. - */ - protected void setComponent(Component newComponent) { - this.component = newComponent; - } - - /** - * Draws the figure. - * @param g the Graphics to draw into - */ - public void draw(Graphics g) { - // AWT code - getComponent().setBounds(displayBox()); - //must create a new graphics with a different cordinate - Graphics componentG = g.create(bounds.x, bounds.y, bounds.width, bounds.height); - getComponent().paint(componentG); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CompositeFigureCreationTool.java b/JHotDraw/src/CH/ifa/draw/contrib/CompositeFigureCreationTool.java deleted file mode 100644 index 5cb4a1b3962487ad9a6578bf0537fa9d1ed2ae12..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CompositeFigureCreationTool.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * @(#)CompositeFigureCreationTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.standard.CreationTool; -import CH.ifa.draw.standard.CompositeFigure; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.DrawingView; - -import java.awt.event.MouseEvent; -import java.awt.*; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class CompositeFigureCreationTool extends CreationTool { - private CompositeFigure myContainerFigure; - - public CompositeFigureCreationTool(DrawingEditor newDrawingEditor, Figure prototype) { - super(newDrawingEditor, prototype); - } - - public void mouseDown(MouseEvent e, int x, int y) { - setView((DrawingView)e.getSource()); - Figure figure = drawing().findFigure(e.getX(), e.getY()); - if (figure != null) { - figure = figure.getDecoratedFigure(); - if (figure instanceof CompositeFigure) { - setContainerFigure((CompositeFigure)figure); - setCreatedFigure(createFigure()); - setAddedFigure((getContainerFigure().add(getCreatedFigure()))); - getAddedFigure().displayBox(new Point(x, y), new Point(x, y)); - } - else { - toolDone(); - } - } - else { - toolDone(); - } - } - - public void mouseMove(MouseEvent e, int x, int y) { - if ((getContainerFigure() != null) && !getContainerFigure().containsPoint(e.getX(), e.getY())) { - // here you might want to constrain the mouse movements to the size of the - // container figure: not sure whether this works... - toolDone(); - } - else { - super.mouseMove(e, x, y); - } - } - - protected void setContainerFigure(CompositeFigure newContainerFigure) { - myContainerFigure = newContainerFigure; - } - - public CompositeFigure getContainerFigure() { - return myContainerFigure; - } - - protected void toolDone() { - setCreatedFigure(null); - setAddedFigure(null); - setContainerFigure(null); - editor().toolDone(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CustomSelectionTool.java b/JHotDraw/src/CH/ifa/draw/contrib/CustomSelectionTool.java deleted file mode 100644 index d2cb8e1ea56d4e7de1e3e67e24e7618da6c942e4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CustomSelectionTool.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * @(#)CustomSelectionTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.contrib.zoom.ZoomDrawingView; -import CH.ifa.draw.standard.*; -import javax.swing.JPopupMenu; -import java.awt.*; -import java.awt.event.*; - -/** - * A SelectionTool, which recognizes double clicks and popup menu triggers. - * If a double click or popup trigger is encountered a hook method is called, - * which handles the event. This methods can be overriden in subclasse to - * provide customized behaviour. - * Popup menus must be registered with a Figure using the setAttribute() method. - * The key which associates a popup menu as an attribute is Figure.POPUP_MENU. - * - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class CustomSelectionTool extends SelectionTool { - - /** - * Create an instance of this SelectionTool for the given view - * - * @param editor DrawingEditor for which the SelectionTool gets the active view - */ - public CustomSelectionTool(DrawingEditor editor) { - super( editor ); - } - - /** - * MouseListener method for mouseDown events. If the popup trigger has been - * activated, then the appropriate hook method is called. - * - * @param e MouseEvent which should be interpreted - * @param x x coordinate of the MouseEvent - * @param y y coordinate of the MouseEvent - */ - public void mouseDown(MouseEvent e, int x, int y) { - setView((DrawingView)e.getSource()); - // isPopupTrigger() at mouseDown() is only notified at UNIX systems - if (e.isPopupTrigger()) { - handlePopupMenu(e, x, y); - } - else { - super.mouseDown(e, x, y); - handleMouseDown(e, x, y); - } - } - - /** - * MouseListener method for mouseDrag events. Usually, mouse drags are - * ignored for popup menus or double clicks. - * - * @param e MouseEvent which should be interpreted - * @param x x coordinate of the MouseEvent - * @param y y coordinate of the MouseEvent - */ - public void mouseDrag(MouseEvent e, int x, int y) { - if (!e.isPopupTrigger()) { - super.mouseDrag(e, x, y); - } - } - - /** - * MouseListener method for mouseUp events. Depending on the kind of event - * the appropriate hook method is called (popupMenuUp for popup trigger, - * doubleMouseClick for a double click, and mouseUp() and mouseClick() for - * normal mouse clicks). - * - * @param e MouseEvent which should be interpreted - * @param x x coordinate of the MouseEvent - * @param y y coordinate of the MouseEvent - */ - public void mouseUp(MouseEvent e, int x, int y) { - if (e.isPopupTrigger()) { - handlePopupMenu(e, x, y); - super.mouseUp(e, x, y); - } - else if (e.getClickCount() == 2) { - super.mouseUp(e, x, y); - handleMouseDoubleClick(e, x, y); - } - else { - super.mouseUp(e, x, y); - handleMouseUp(e, x, y); - handleMouseClick(e, x, y); - } - } - - /** - * Hook method which can be overriden by subclasses to provide - * specialised behaviour in the event of a mouse down. - */ - protected void handleMouseDown(MouseEvent e, int x, int y) { - } - - /** - * Hook method which can be overriden by subclasses to provide - * specialised behaviour in the event of a mouse up. - */ - protected void handleMouseUp(MouseEvent e, int x, int y) { - } - - /** - * Hook method which can be overriden by subclasses to provide - * specialised behaviour in the event of a mouse click. - */ - protected void handleMouseClick(MouseEvent e, int x, int y) { - } - - /** - * Hook method which can be overriden by subclasses to provide - * specialised behaviour in the event of a mouse double click. - */ - protected void handleMouseDoubleClick(MouseEvent e, int x, int y) { - } - - /** - * Hook method which can be overriden by subclasses to provide - * specialised behaviour in the event of a popup trigger. - */ - protected void handlePopupMenu(MouseEvent e, int x, int y) { - Figure figure = drawing().findFigure(e.getX(), e.getY()); - if (figure != null) { - Object attribute = figure.getAttribute(FigureAttributeConstant.POPUP_MENU); - if (attribute == null) { - figure = drawing().findFigureInside(e.getX(), e.getY()); - } - if (figure != null) { - showPopupMenu(figure, e.getX(), e.getY(), e.getComponent()); - } - } - } - - /** - * This method displays a popup menu, if there is one registered with the - * Figure (the Figure's attributes are queried for Figure.POPUP_MENU which - * is used to indicate an association of a popup menu with the Figure). - * - * @param figure Figure for which a popup menu should be displayed - * @param x x coordinate where the popup menu should be displayed - * @param y y coordinate where the popup menu should be displayed - * @param comp Component which invoked the popup menu - */ - protected void showPopupMenu(Figure figure, int x, int y, Component comp) { - Object attribute = figure.getAttribute(FigureAttributeConstant.POPUP_MENU); - if ((attribute != null) && (attribute instanceof JPopupMenu)) { - JPopupMenu popup = (JPopupMenu)attribute; - if (popup instanceof PopupMenuFigureSelection) { - ((PopupMenuFigureSelection)popup).setSelectedFigure(figure); - } - // Calculate position on physical screen based - // on x,y coordinates - Point newLocation; - try { - newLocation = comp.getLocationOnScreen(); - } catch (IllegalComponentStateException e) { - // For some reason, the component - // apparently isn't showing on the - // screen (huh?). Never mind - don't - // show the popup.. - return; - } - // If this is a ZoomDrawingView, we'll need to - // compensate here too: - if (comp instanceof ZoomDrawingView) { - double scale = ((ZoomDrawingView) comp).getScale(); - x *= scale; - y *= scale; - } - newLocation.translate(x,y); - popup.setLocation(newLocation); - popup.setInvoker(comp); - popup.setVisible(true); - } - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/CustomToolBar.java b/JHotDraw/src/CH/ifa/draw/contrib/CustomToolBar.java deleted file mode 100644 index 62755cc091692302a7c0d6f83f1940bc6fb733cc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/CustomToolBar.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * @(#)CustomToolBar.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.util.CollectionsFactory; - -import javax.swing.JToolBar; -import javax.swing.JComponent; -import java.util.List; -import java.util.Iterator; -import java.awt.Component; - -/** - * This ToolBar allows to use several panels with tools. It manages each - * panel and enables to swap between them. There can only one panel with - * tools be activated at a time. Currently, only two panels are supported - * (standard tools and edit tools). - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class CustomToolBar extends JToolBar { - - /** - * List containing all tools for the standard ToolBar - */ - private List standardTools; - - /** - * List containing all tools for the edit ToolBar - */ - private List editTools; - - /** - * List containing all tools, which are currently activated - */ - private List currentTools; - - /** - * Flag which determines whether the tool palette must be updated - */ - private boolean needsUpdate; - - /** - * Create a new ToolBar - */ - public CustomToolBar() { - super(); - standardTools = CollectionsFactory.current().createList(); - editTools = CollectionsFactory.current().createList(); - currentTools = standardTools; - needsUpdate = false; - } - - /** - * Switch between the two available palettes with tools - */ - public void switchToolBar() { - if (currentTools == standardTools) { - switchToEditTools(); - } - else { - switchToStandardTools(); - } - } - - /** - * Select the palette with the edit tools - */ - public void switchToEditTools() { - if (currentTools != editTools) { - currentTools = editTools; - needsUpdate = true; - } - } - - /** - * Select the palette with the standard tools - */ - public void switchToStandardTools() { - if (currentTools != standardTools) { - currentTools = standardTools; - needsUpdate = true; - } - } - - /** - * Activate a palette of the ToolBar by setting all Tools - */ - public void activateTools() { - if (!needsUpdate) { - return; - } - else { - removeAll(); - - JComponent currentTool = null; - Iterator iter = currentTools.iterator(); - while (iter.hasNext()) { - currentTool = (JComponent)iter.next(); - super.add(currentTool); - } - validate(); - needsUpdate = false; - } - } - - /** - * Add a new tool the the current palette of the ToolBar - */ - public Component add(Component newTool) { - if (currentTools == editTools) { - editTools.add(newTool); - } - else { - standardTools.add(newTool); - } - needsUpdate = true; - return super.add(newTool); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/Desktop.java b/JHotDraw/src/CH/ifa/draw/contrib/Desktop.java deleted file mode 100644 index 87268b6bef42a9f6b21908ceba0596b21536e2b4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/Desktop.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)Desktop.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingView; - -/** - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface Desktop { - public final static int PRIMARY = 0; - public final static int SECONDARY = 1; - public final static int TERTIARY = 2; - - /** - * For those absent minded components that were not paying attention to the - * listener events. - */ - public DrawingView getActiveDrawingView(); - public void addToDesktop(DrawingView dv, int location); - public void removeFromDesktop(DrawingView dv, int location); - public void removeAllFromDesktop(int location); - public DrawingView[] getAllFromDesktop(int location); - - public void updateTitle(String newDrawingTitle); - - public void addDesktopListener(DesktopListener dpl); - public void removeDesktopListener(DesktopListener dpl); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/DesktopEvent.java b/JHotDraw/src/CH/ifa/draw/contrib/DesktopEvent.java deleted file mode 100644 index f62eadbd9442ed9920fbf14acdb5bd49e824c924..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/DesktopEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @(#)DesktopEvent.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingView; -import java.util.EventObject; - -/** - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class DesktopEvent extends EventObject { - private DrawingView myDrawingView; - - /** - * Some events require the previous DrawingView (e.g. when a new DrawingView - * is selected). - */ - private DrawingView myPreviousDrawingView; - - public DesktopEvent(Desktop newSource, DrawingView newDrawingView) { - this(newSource, newDrawingView, null); - } - - public DesktopEvent(Desktop newSource, DrawingView newDrawingView, DrawingView newPreviousDV) { - super(newSource); - setDrawingView(newDrawingView); - setPreviousDrawingView(newPreviousDV); - } - - private void setDrawingView(DrawingView newDrawingView) { - myDrawingView = newDrawingView; - } - - public DrawingView getDrawingView() { - return myDrawingView; - } - - private void setPreviousDrawingView(DrawingView newPreviousDrawingView) { - myPreviousDrawingView = newPreviousDrawingView; - } - - public DrawingView getPreviousDrawingView() { - return myPreviousDrawingView; - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/DesktopEventService.java b/JHotDraw/src/CH/ifa/draw/contrib/DesktopEventService.java deleted file mode 100644 index d186a56e260768dd2afda0ac924073d0e2718e95..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/DesktopEventService.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * @(#)DesktopEventService.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.standard.NullDrawingView; -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.List; -import java.util.ListIterator; -import java.awt.event.ContainerAdapter; -import java.awt.event.ContainerListener; -import java.awt.event.ContainerEvent; -import java.awt.*; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class DesktopEventService { - - /** - * Current usage of this List is not thread safe, nor should it need to be. - * If it ever does we can synchronize on the List itself to provide safety. - */ - private java.util.List listeners; - private DrawingView mySelectedView; - private Container myContainer; - private Desktop myDesktop; - - public DesktopEventService(Desktop newDesktop, Container newContainer) { - listeners = CollectionsFactory.current().createList(); - setDesktop(newDesktop); - setContainer(newContainer); - getContainer().addContainerListener(createComponentListener()); - } - - private void setDesktop(Desktop newDesktop) { - myDesktop = newDesktop; - } - - protected Desktop getDesktop() { - return myDesktop; - } - - private void setContainer(Container newContainer) { - myContainer = newContainer; - } - - protected Container getContainer() { - return myContainer; - } - - public void addComponent(Component newComponent) { - getContainer().add(newComponent); - } - - public void removeComponent(DrawingView dv) { - Component[] comps = getContainer().getComponents(); - for (int x = 0; x < comps.length; x++) { - if (dv == Helper.getDrawingView(comps[x])) { - getContainer().remove(comps[x]); - break; - } - } - } - - public void removeAllComponents() { - getContainer().removeAll(); - } - - public void addDesktopListener(DesktopListener dpl) { - listeners.add(dpl); - } - - public void removeDesktopListener(DesktopListener dpl) { - listeners.remove(dpl); - } - - protected void fireDrawingViewAddedEvent(final DrawingView dv) { - ListIterator li= listeners.listIterator(listeners.size()); - DesktopEvent dpe = createDesktopEvent(getActiveDrawingView(), dv); - while (li.hasPrevious()) { - DesktopListener dpl = (DesktopListener)li.previous(); - dpl.drawingViewAdded(dpe); - } - } - - protected void fireDrawingViewRemovedEvent(final DrawingView dv) { - ListIterator li= listeners.listIterator(listeners.size()); - DesktopEvent dpe = createDesktopEvent(getActiveDrawingView(), dv); - while (li.hasPrevious()) { - DesktopListener dpl = (DesktopListener)li.previous(); - dpl.drawingViewRemoved(dpe); - } - } - - /** - * This method is only called if the selected drawingView has actually changed - */ - protected void fireDrawingViewSelectedEvent(final DrawingView oldView, final DrawingView newView) { - ListIterator li= listeners.listIterator(listeners.size()); - DesktopEvent dpe = createDesktopEvent(oldView, newView); - while (li.hasPrevious()) { - DesktopListener dpl = (DesktopListener)li.previous(); - dpl.drawingViewSelected(dpe); - } - } - - /** - * @param oldView previous active drawing view (may be null because not all events require this information) - */ - protected DesktopEvent createDesktopEvent(DrawingView oldView, DrawingView newView) { - return new DesktopEvent(getDesktop(), newView, oldView); - } - - public DrawingView[] getDrawingViews(Component[] comps) { - List al = CollectionsFactory.current().createList(); - for (int x = 0; x < comps.length; x++) { - DrawingView dv = Helper.getDrawingView(comps[x]); - if (dv != null) { - al.add(dv); - } - } - DrawingView[] dvs = new DrawingView[al.size()]; - al.toArray(dvs); - return dvs; - } - - public DrawingView getActiveDrawingView() { - return mySelectedView; - } - - protected void setActiveDrawingView(DrawingView newActiveDrawingView) { - mySelectedView = newActiveDrawingView; - } - - protected ContainerListener createComponentListener() { - return new ContainerAdapter() { - /** - * If the dv is null assert - * @todo does adding a component always make it the selected view? - * Yes so far because this is only being used on single view Desktops. - * If it is to work on multipleView desktops, the we need to think further. - */ - public void componentAdded(ContainerEvent e) { - DrawingView dv = Helper.getDrawingView((java.awt.Container)e.getChild()); - DrawingView oldView = getActiveDrawingView(); - if (dv != null) { - fireDrawingViewAddedEvent(dv); - setActiveDrawingView(dv); - fireDrawingViewSelectedEvent(oldView, getActiveDrawingView()); - } - } - - /** - * If dv is null assert - * dv will only be null if something thats not a drawingView was - * added to the desktop. it would be simpler if we forbade that. - */ - public void componentRemoved(ContainerEvent e) { - DrawingView dv = Helper.getDrawingView((java.awt.Container)e.getChild()); - if (dv != null) { - DrawingView oldView = getActiveDrawingView(); - setActiveDrawingView(NullDrawingView.getManagedDrawingView(oldView.editor())); - fireDrawingViewSelectedEvent(oldView, getActiveDrawingView()); - fireDrawingViewRemovedEvent(dv); - } - } - }; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/DesktopListener.java b/JHotDraw/src/CH/ifa/draw/contrib/DesktopListener.java deleted file mode 100644 index 23dabd7093e983ee519fbcaa8ccd2dcc09e59581..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/DesktopListener.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * @(#)DesktopEventService.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -/** - * @author C.L.Gilbert <dnoyeb@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface DesktopListener { - public void drawingViewAdded(DesktopEvent dpe); - public void drawingViewRemoved(DesktopEvent dpe); - public void drawingViewSelected(DesktopEvent dpe); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/DiamondFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/DiamondFigure.java deleted file mode 100644 index 5b4e1b0da5fa99ddbdd335430f261920a267689c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/DiamondFigure.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @(#)DiamondFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.figures.*; -import java.awt.*; - -/** - * A diamond with vertices at the midpoints of its enclosing rectangle - * - * @author Doug Lea (dl at gee, Tue Feb 25 17:39:44 1997) - * @version <$CURRENT_VERSION$> - */ -public class DiamondFigure extends RectangleFigure { - - public DiamondFigure() { - super(new Point(0,0), new Point(0,0)); - } - - public DiamondFigure(Point origin, Point corner) { - super(origin,corner); - } - - /** - * @return the polygon describing the diamond - **/ - protected Polygon getPolygon() { - Rectangle r = displayBox(); - Polygon p = new Polygon(); - p.addPoint(r.x, r.y+r.height/2); - p.addPoint(r.x+r.width/2, r.y); - p.addPoint(r.x+r.width, r.y+r.height/2); - p.addPoint(r.x+r.width/2, r.y+r.height); - return p; - } - - public void draw(Graphics g) { - Polygon p = getPolygon(); - g.setColor(getFillColor()); - g.fillPolygon(p); - g.setColor(getFrameColor()); - g.drawPolygon(p); - } - - public Insets connectionInsets() { - Rectangle r = displayBox(); - return new Insets(r.height/2, r.width/2, r.height/2, r.width/2); - } - - public boolean containsPoint(int x, int y) { - return getPolygon().contains(x, y); - } - - public Point chop(Point p) { - return PolygonFigure.chop(getPolygon(), p); - } - - public Connector connectorAt(int x, int y) { - return new ChopDiamondConnector(this); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/FloatingTextArea.java b/JHotDraw/src/CH/ifa/draw/contrib/FloatingTextArea.java deleted file mode 100644 index f1dff6fb06e71dc200228b25b12a14bf6ffc0e04..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/FloatingTextArea.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * @(#)FloatingTextArea.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import java.awt.Color; - -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Rectangle; -import javax.swing.BorderFactory; -import javax.swing.JEditorPane; -import javax.swing.JScrollPane; - -/** - * A FloatingTextArea overlays an editor on top of an area in a drawing<br> - * @author Eduardo Francos - InContext - * @version <$CURRENT_VERSION$> - * @todo By default JEditorPane uses a tab size of 8. - * I couldn't find how to change this. - * If anybody knows please tell me. - */ -public class FloatingTextArea { - /** - * A scroll pane to allow for vertical scrolling while editing - */ - protected JScrollPane fEditScrollContainer; - /** - * The actual editor - */ - protected JEditorPane fEditWidget; - /** - * The container within which the editor is created - */ - protected Container fContainer; - - - /** - * Constructor for the FloatingTextArea object - */ - public FloatingTextArea() { - fEditWidget = new JEditorPane(); - fEditScrollContainer = new JScrollPane(fEditWidget, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - fEditScrollContainer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - fEditScrollContainer.setBorder(BorderFactory.createLineBorder(Color.black)); - } - - - /** - * Creates the overlay within the given container. - * @param container the container - */ - public void createOverlay(Container container) { - createOverlay(container, null); - } - - - /** - * Creates the overlay for the given Container using a - * specific font. - * @param container the container - * @param font the font - */ - public void createOverlay(Container container, Font font) { - container.add(fEditScrollContainer, 0); - if (font != null) { - fEditWidget.setFont(font); - } - fContainer = container; - } - - - /** - * Positions and sizes the overlay. - * @param r the bounding rectangle for the overlay - * @param text the text to edit - */ - public void setBounds(Rectangle r, String text) { - fEditWidget.setText(text); - fEditScrollContainer.setBounds(r.x, r.y, r.width, r.height); - fEditScrollContainer.setVisible(true); - fEditWidget.setCaretPosition(0); - fEditWidget.requestFocus(); - } - - - /** - * Gets the text contents of the overlay. - * @return The text value - */ - public String getText() { - return fEditWidget.getText(); - } - - - /** - * Gets the preferred size of the overlay. - * @param cols Description of the Parameter - * @return The preferredSize value - */ - public Dimension getPreferredSize(int cols) { - return new Dimension(fEditWidget.getWidth(), fEditWidget.getHeight()); - } - - - /** - * Removes the overlay. - */ - public void endOverlay() { - fContainer.requestFocus(); - if (fEditScrollContainer != null) { - fEditScrollContainer.setVisible(false); - fContainer.remove(fEditScrollContainer); - - Rectangle bounds = fEditScrollContainer.getBounds(); - fContainer.repaint(bounds.x, bounds.y, bounds.width, bounds.height); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/GraphicalCompositeFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/GraphicalCompositeFigure.java deleted file mode 100644 index 6eab9f14d30eacc452fb0fae3d3094e89e11d0e6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/GraphicalCompositeFigure.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * @(#)GraphicalCompositeFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.figures.*; -import java.awt.*; -import java.io.*; -import java.util.List; - -/** - * The GraphicalCompositeFigure fills in the gap between a CompositeFigure - * and other figures which mainly have a presentation purpose. The - * GraphicalCompositeFigure can be configured with any Figure which - * takes over the task for rendering the graphical presentation for - * a CompositeFigure. Therefore, the GraphicalCompositeFigure manages - * contained figures like the CompositeFigure does, but delegates - * its graphical presentation to another (graphical) figure which - * purpose it is to draw the container for all contained figures. - * - * The GraphicalCompositeFigure adds to the {@link CompositeFigure CompositeFigure} - * by containing a presentation figure by default which can not be removed. Normally, - * the {@link CompositeFigure CompositeFigure} can not be seen without containing a figure - * because it has no mechanism to draw itself. It instead relies on its contained - * figures to draw themselves thereby giving the {@link CompositeFigure CompositeFigure} its - * appearance. However, the <b>GraphicalCompositeFigure</b>'s presentation figure - * can draw itself even when the <b>GraphicalCompositeFigure</b> contains no other figures. - * The <b>GraphicalCompositeFigure</b> also uses a {@link Layouter Layouter} or layout - * its contained figures. - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class GraphicalCompositeFigure extends CompositeFigure implements Layoutable { - - /** - * Figure which performs all presentation tasks for this - * CompositeFigure as CompositeFigures usually don't have - * an own presentation but present only the sum of all its - * children. - */ - private Figure myPresentationFigure; - - /** - * A Layouter determines how the CompositeFigure should - * be laid out graphically. - */ - private Layouter myLayouter; - - private static final long serialVersionUID = 1265742491024232713L; - - /** - * Default constructor which uses a RectangleFigure as presentation - * figure. This constructor is needed by the Storable mechanism. - */ - public GraphicalCompositeFigure() { - this(new RectangleFigure()); - } - - /** - * Constructor which creates a GraphicalCompositeFigure with - * a given graphical figure for presenting it. - * - * @param newPresentationFigure figure which renders the container - */ - public GraphicalCompositeFigure(Figure newPresentationFigure) { - super(); - setPresentationFigure(newPresentationFigure); - initialize(); - } - - /** - * This method performs additional initialization operations, - * in this case setting the Layouter. - * It is called from the constructors and the clone() method. - * A StandardLayouter is set. - */ - protected void initialize() { - if (getLayouter() != null) { - // use prototype to create new instance - setLayouter(getLayouter().create(this)); - } - else { - setLayouter(new StandardLayouter(this)); - } - } - - /** - * Clones a figure and initializes it - * - * @see Figure#clone - */ - public Object clone() { - Object cloneObject = super.clone(); - ((GraphicalCompositeFigure)cloneObject).initialize(); - return cloneObject; - } - - /** - * Return the display area. This method is delegated to the encapsulated presentation figure. - */ - public Rectangle displayBox() { - return getPresentationFigure().displayBox(); - } - - /** - * Standard presentation method which is delegated to the encapsulated presentation figure. - */ - public void basicDisplayBox(Point origin, Point corner) { - Rectangle r = getLayouter().layout(origin, corner); - // Fix for bug request IDs 548000 and 548032 - // Previously was - // getPresentationFigure().basicDisplayBox(r.getLocation(), new Point(r.width, r.height)); - // The corner transferred to the presentation figure is wrong as it transfers - // the dimension of the resulting rectangle from the layouter instead of the - // lower right corner - getPresentationFigure().basicDisplayBox(r.getLocation(), - new Point((int)r.getMaxX(), (int)r.getMaxY())); - } - - /** - * Standard presentation method which is delegated to the encapsulated presentation figure. - * The presentation figure is moved as well as all contained figures. - */ - protected void basicMoveBy(int dx, int dy) { - super.basicMoveBy(dx, dy); - getPresentationFigure().moveBy(dx, dy); - } - - /** - * Explicit update: an updated involves a layout for all contained figures. - */ - public void update() { - willChange(); - layout(); - change(); - changed(); - } - - /** - * Draw the figure. This method is delegated to the encapsulated presentation figure. - */ - public void draw(Graphics g) { - getPresentationFigure().draw(g); - super.draw(g); - } - - /** - * Return default handles from the presentation figure. - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - return new HandleEnumerator(handles); - //return getPresentationFigure().handles(); - } - - /** - * Delegate capabilities for storing and retrieving attributes to a - * CompositeFigure if the encapsulated presentation figure. If no - * presentation figure is found then the superclass' getAttribute() - * will be invoked (which currently returns always "null"). - * - * @param name name of the attribute whose value should be returned - * @return value of the attribute with the given name - * - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - if (getPresentationFigure() != null) { - return getPresentationFigure().getAttribute(name); - } - else { - return super.getAttribute(name); - } - } - - /** - * Delegate capabilities for storing and retrieving attributes to a - * CompositeFigure if the encapsulated presentation figure. If no - * presentation figure is found then the superclass' getAttribute() - * will be invoked (which currently returns always "null"). - * - * @param attributeConstant attribute constant whose value should be returned - * @return value of the attribute with the given name - */ - public Object getAttribute(FigureAttributeConstant attributeConstant) { - if (getPresentationFigure() != null) { - return getPresentationFigure().getAttribute(attributeConstant); - } - else { - return super.getAttribute(attributeConstant); - } - } - - /** - * Delegate capabilities for storing and retrieving attributes to a - * CompositeFigure if the encapsulated presentation figure. If no - * presentation figure is found then the superclass' setAttribute() - * will be invoked (which currently does not set an attribute). - * - * @param name name of the attribute - * @param value value associated with this attribute - * - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - if (getPresentationFigure() != null) { - getPresentationFigure().setAttribute(name, value); - } - else { - super.setAttribute(name, value); - } - } - - /** - * Delegate capabilities for storing and retrieving attributes to a - * CompositeFigure if the encapsulated presentation figure. If no - * presentation figure is found then the superclass' setAttribute() - * will be invoked (which currently does not set an attribute). - * - * @param attributeConstant attribute constant - * @param value value associated with this attribute - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - if (getPresentationFigure() != null) { - getPresentationFigure().setAttribute(attributeConstant, value); - } - else { - super.setAttribute(attributeConstant, value); - } - } - - /** - * Set a figure which renders this CompositeFigure. The presentation - * tasks for the CompositeFigure are delegated to this presentation - * figure. - * - * @param newPresentationFigure figure takes over the presentation tasks - */ - public void setPresentationFigure(Figure newPresentationFigure) { - myPresentationFigure = newPresentationFigure; - } - - /** - * Get a figure which renders this CompositeFigure. The presentation - * tasks for the CompositeFigure are delegated to this presentation - * figure. - * - * @return figure takes over the presentation tasks - */ - public Figure getPresentationFigure() { - return myPresentationFigure; - } - - /** - * A layout algorithm is used to define how the child components - * should be laid out in relation to each other. The task for - * layouting the child components for presentation is delegated - * to a Layouter which can be plugged in at runtime. - */ - public void layout() { - if (getLayouter() != null) { - Rectangle r = getLayouter().calculateLayout(displayBox().getLocation(), displayBox().getLocation()); - displayBox(r.getLocation(), new Point(r.x + r.width, r.y + r.height)); - } - } - - /** - * Set a Layouter object which encapsulated a layout - * algorithm for this figure. Typically, a Layouter - * accesses the child components of this figure and arranges - * their graphical presentation. It is a good idea to set - * the Layouter in the protected initialize() method - * so it can be recreated if a GraphicalCompositeFigure is - * read and restored from a StorableInput stream. - * - * @param newLayouter encapsulation of a layout algorithm. - */ - public void setLayouter(Layouter newLayouter) { - myLayouter = newLayouter; - } - - /** - * Get a Layouter object which encapsulated a layout - * algorithm for this figure. Typically, a Layouter - * accesses the child components of this figure and arranges - * their graphical presentation. - * - * @return layout strategy used by this figure - */ - public Layouter getLayouter() { - return myLayouter; - } - - /** - * Notify the registered change listener if an exlicit change - * to the component (or one of its child components has occurred). - */ - protected void change() { - if (listener() != null) { - listener().figureRequestUpdate(new FigureChangeEvent(this)); - } - } - - /** - * Propagates the removeFromDrawing request up to the container. - */ - public void figureRequestRemove(FigureChangeEvent e) { - if (listener() != null) { - if (includes(e.getFigure())) { - Rectangle r = invalidateRectangle(displayBox()); - listener().figureRequestRemove(new FigureChangeEvent(this, r, e)); - } - else { - super.figureRequestRemove(e); - } - } - } - - /** - * Reads the contained figures from StorableInput. The - * figure responsible for graphical presentation is read - * together with all child components. The Layouter - * is not stored and therefore not read. - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - setPresentationFigure((Figure)dr.readStorable()); - setLayouter((Layouter)dr.readStorable()); - } - - /** - * Writes the contained figures to the StorableOutput. The - * figure responsible for graphical presentation is written - * together with all child components. The Layouter - * is not written. - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeStorable(getPresentationFigure()); - dw.writeStorable(getLayouter()); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/Helper.java b/JHotDraw/src/CH/ifa/draw/contrib/Helper.java deleted file mode 100644 index 034af7f804bc1b2bcb7f805da5bfbe495a2c49bf..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/Helper.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#)Helper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingView; -import java.awt.*; - -/** - * @author C.L.Gilbert <dnoyeb@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class Helper { - - static public DrawingView getDrawingView(Container container) { - DrawingView oldDrawingView = null; - Component[] components = container.getComponents(); - for (int i = 0; i < components.length; i++) { - if (components[i] instanceof DrawingView) { - return (DrawingView)components[i]; - } - else if (components[i] instanceof Container) { - oldDrawingView = getDrawingView((Container)components[i]); - if (oldDrawingView != null) { - return oldDrawingView; - } - } - } - return null; - } - - static public DrawingView getDrawingView(Component component) { - if (Container.class.isInstance(component)) { - return getDrawingView((Container)component); - } - else if (DrawingView.class.isInstance(component)) { - return (DrawingView)component; - } - else { - return null; - } - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/JPanelDesktop.java b/JHotDraw/src/CH/ifa/draw/contrib/JPanelDesktop.java deleted file mode 100644 index 1eab78b61343c6100ceb3b32814399711e48fd0a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/JPanelDesktop.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)JPanelDesktop.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import javax.swing.*; -import java.awt.*; -import CH.ifa.draw.application.*; -import CH.ifa.draw.framework.DrawingView; - -/** - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class JPanelDesktop extends JPanel implements Desktop { - - private DesktopEventService myDesktopEventService; - private DrawApplication myDrawApplication; - - public JPanelDesktop(DrawApplication newDrawApplication) { - setDrawApplication(newDrawApplication); - setDesktopEventService(createDesktopEventService()); - setAlignmentX(LEFT_ALIGNMENT); - setLayout(new BorderLayout()); - } - - protected Component createContents(DrawingView dv) { - JScrollPane sp = new JScrollPane((Component)dv); - sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - sp.setAlignmentX(LEFT_ALIGNMENT); - String applicationTitle; - if (dv.drawing().getTitle() == null) { - applicationTitle = getDrawApplication().getApplicationName() - + " - " + getDrawApplication().getDefaultDrawingTitle(); - } - else { - applicationTitle = getDrawApplication().getApplicationName() + " - " + dv.drawing().getTitle(); - } - // should be setTitle but a JPanelDesktop has no own title bar - sp.setName(applicationTitle); - return sp; - } - - public DrawingView getActiveDrawingView() { - return getDesktopEventService().getActiveDrawingView(); - } - - public void addToDesktop(DrawingView dv, int location) { - getDesktopEventService().addComponent(createContents(dv)); - getContainer().validate(); - } - - public void removeFromDesktop(DrawingView dv, int location) { - getDesktopEventService().removeComponent(dv); - getContainer().validate(); - } - - public void removeAllFromDesktop(int location) { - getDesktopEventService().removeAllComponents(); - getContainer().validate(); - } - - public DrawingView[] getAllFromDesktop(int location) { - return getDesktopEventService().getDrawingViews(getComponents()); - } - - public void addDesktopListener(DesktopListener dpl) { - getDesktopEventService().addDesktopListener(dpl); - } - - public void removeDesktopListener(DesktopListener dpl) { - getDesktopEventService().removeDesktopListener(dpl); - } - - private Container getContainer() { - return this; - } - - protected DesktopEventService getDesktopEventService() { - return myDesktopEventService; - } - - private void setDesktopEventService(DesktopEventService newDesktopEventService) { - myDesktopEventService = newDesktopEventService; - } - - protected DesktopEventService createDesktopEventService() { - return new DesktopEventService(this, getContainer()); - } - - private void setDrawApplication(DrawApplication newDrawApplication) { - myDrawApplication = newDrawApplication; - } - - protected DrawApplication getDrawApplication() { - return myDrawApplication; - } - - public void updateTitle(String newDrawingTitle) { - // should be setTitle but a JPanelDesktop has no own title bar - setName(newDrawingTitle); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/JScrollPaneDesktop.java b/JHotDraw/src/CH/ifa/draw/contrib/JScrollPaneDesktop.java deleted file mode 100644 index ca5208f5b2e5e2865369c62ebe22119be94f5b90..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/JScrollPaneDesktop.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * @(#)JScrollPaneDesktop.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.Component; -import java.awt.Container; - -// JUnitDoclet begin import -import javax.swing.JScrollPane; - -import CH.ifa.draw.framework.DrawingView; -// JUnitDoclet end import - -/** - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class JScrollPaneDesktop extends JScrollPane implements Desktop { - - private DesktopEventService myDesktopEventService; - - public JScrollPaneDesktop() { - setDesktopEventService(createDesktopEventService()); - setAlignmentX(LEFT_ALIGNMENT); - setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - } - - protected Component createContents(DrawingView dv) { - return (Component)dv; - } - - public DrawingView getActiveDrawingView() { - return getDesktopEventService().getActiveDrawingView(); - } - - public void addToDesktop(DrawingView dv, int location) { - getContainer().add(createContents(dv)); - } - - public void removeFromDesktop(DrawingView dv, int location) { - getDesktopEventService().removeComponent(dv); - } - - public void removeAllFromDesktop(int location) { - getDesktopEventService().removeAllComponents(); - } - - public DrawingView[] getAllFromDesktop(int location) { - //This is overkill since we know we only have 1 component... - return getDesktopEventService().getDrawingViews(getComponents()); - } - - public void addDesktopListener(DesktopListener dpl) { - getDesktopEventService().addDesktopListener(dpl); - } - - public void removeDesktopListener(DesktopListener dpl) { - getDesktopEventService().removeDesktopListener(dpl); - } - - private Container getContainer() { - return getViewport(); - } - - protected DesktopEventService getDesktopEventService() { - return myDesktopEventService; - } - - private void setDesktopEventService(DesktopEventService newDesktopEventService) { - myDesktopEventService = newDesktopEventService; - } - - protected DesktopEventService createDesktopEventService() { - return new DesktopEventService(this, getContainer()); - } - - public void updateTitle(String newDrawingTitle) { - // should be setTitle but a JPanelDesktop has no own title bar - setName(newDrawingTitle); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/Layoutable.java b/JHotDraw/src/CH/ifa/draw/contrib/Layoutable.java deleted file mode 100644 index 3321abc0239826ce38eafd30f89fcb9075337a18..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/Layoutable.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * @(#)Layouter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.Figure; - -/** - * A Layoutable is a target for a Layouter who lays out the Layoutable - * according to its layout algorithm - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public interface Layoutable extends Figure { - - /** - * Layout the figure - */ - public void layout(); - - /** - * Set the Layouter for this Layoutable - * - * @param newLayouter layouter - */ - public void setLayouter(Layouter newLayouter); - - /** - * Return the Layouter for this Layoutable - * - * @return layouter - */ - public Layouter getLayouter(); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/Layouter.java b/JHotDraw/src/CH/ifa/draw/contrib/Layouter.java deleted file mode 100644 index 79a7ba7a5edffe91f531a9d59974c22e7f8516ab..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/Layouter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * @(#)Layouter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.util.Storable; -import java.io.Serializable; -import java.awt.*; - -/** - * A Layouter encapsulates a algorithm to layout - * a figure. It is passed on to a figure which delegates the - * layout task to the Layouter's layout method. - * The Layouter might need access to some information - * specific to a certain figure in order to layout it out properly. - * - * Note: Currently, only the GraphicalCompositeFigure uses - * such a Layouter to layout its child components. - * - * @see GraphicalCompositeFigure - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public interface Layouter extends Serializable, Storable { - - /** - * Calculate the layout for the figure and all its - * subelements. The layout is not actually performed but just - * its dimensions are calculated. - * - * @param origin start point for the layout - * @param corner minimum corner point for the layout - * @return size including space for insets - */ - public Rectangle calculateLayout(Point origin, Point corner); - - /** - * Method which lays out a figure. It is called by the figure - * if a layout task is to be performed. Implementing classes - * specify a certain layout algorithm in this method. - * - * @param origin start point for the layout - * @param corner minimum corner point for the layout - */ - public Rectangle layout(Point origin, Point corner); - - /** - * Set the insets for spacing between the figure and its subfigures - * - * @param newInsets new spacing dimensions - */ - public void setInsets(Insets newInsets); - - /** - * Get the insets for spacing between the figure and its subfigures - * - * @return spacing dimensions - */ - public Insets getInsets(); - - /** - * Create a new instance of this type and sets the layoutable - */ - public Layouter create(Layoutable newLayoutable); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/MDIDesktopPane.java b/JHotDraw/src/CH/ifa/draw/contrib/MDIDesktopPane.java deleted file mode 100644 index 3d5e8d0e678d649d87b6bb882d64702c33a6e8eb..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/MDIDesktopPane.java +++ /dev/null @@ -1,636 +0,0 @@ -/* - * @(#)MDIDesktopPane.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.standard.NullDrawingView; -import CH.ifa.draw.application.DrawApplication; - -import javax.swing.*; -import javax.swing.event.InternalFrameListener; -import javax.swing.event.InternalFrameAdapter; -import javax.swing.event.InternalFrameEvent; -import java.awt.*; -import java.beans.*; - -/** - * An extension of JDesktopPane that supports often used MDI functionality. This - * class also handles setting scroll bars for when windows move too far to the left or - * bottom, providing the MDIDesktopPane is in a ScrollPane. - * Note by dnoyeb: I dont know why the container does not fire frame close events when the frames - * are removed from the container with remove as opposed to simply closed with the - * "x". so if you say removeAll from container you wont be notified. No biggie. - * - * @author Wolfram Kaiser (adapted from an article in JavaWorld) - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class MDIDesktopPane extends JDesktopPane implements Desktop { - private static int FRAME_OFFSET=20; - private MDIDesktopManager manager; - private DrawApplication myDrawApplication; - private DesktopEventService myDesktopEventService; - - private DrawingView selectedView; - - public MDIDesktopPane(DrawApplication newDrawApplication) { - setDesktopEventService(createDesktopEventService()); - setDrawApplication(newDrawApplication); - manager=new MDIDesktopManager(this); - setDesktopManager(manager); - setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); - setAlignmentX(JComponent.LEFT_ALIGNMENT); - } - - protected InternalFrameListener internalFrameListener = new InternalFrameAdapter() { - /** - * Invoked when a internal frame has been opened. - * @see javax.swing.JInternalFrame#show - * if dv is null assert - */ - public void internalFrameOpened(InternalFrameEvent e) { - DrawingView dv = Helper.getDrawingView(e.getInternalFrame()); - fireDrawingViewAddedEvent(dv); - } - - /** - * Invoked when an internal frame is in the process of being closed. - * The close operation can be overridden at this point. - * @see javax.swing.JInternalFrame#setDefaultCloseOperation - */ - //public void internalFrameClosing(InternalFrameEvent e) { - //} - - /** - * Invoked when an internal frame has been closed. - * if dv is null assert - * if this is the last view set it to null - * @see javax.swing.JInternalFrame#setClosed - */ - public void internalFrameClosed(InternalFrameEvent e) { - DrawingView dv = Helper.getDrawingView(e.getInternalFrame()); - if (getComponentCount() == 0){ - DrawingView oldView = getActiveDrawingView(); - setActiveDrawingView(NullDrawingView.getManagedDrawingView(oldView.editor())); - fireDrawingViewSelectedEvent(oldView, getActiveDrawingView()); - } - fireDrawingViewRemovedEvent(dv); - } - - /** - * Invoked when an internal frame is iconified. - * @see javax.swing.JInternalFrame#setIcon - */ - //public void internalFrameIconified(InternalFrameEvent e) { - //} - - /** - * Invoked when an internal frame is de-iconified. - * @see javax.swing.JInternalFrame#setIcon - */ - //public void internalFrameDeiconified(InternalFrameEvent e) { - //} - - /** - * Invoked when an internal frame is activated. - * @see javax.swing.JInternalFrame#setSelected - * if this frame has a null drawingView then assert - * because their should be no null frames being selected - * this does not include NullDrawingView which is acceptable - */ - public void internalFrameActivated(InternalFrameEvent e) { - DrawingView dv = Helper.getDrawingView(e.getInternalFrame()); - DrawingView oldView = getActiveDrawingView(); - setActiveDrawingView(dv); - fireDrawingViewSelectedEvent(oldView, getActiveDrawingView()); - } - - //public void internalFrameDeactivated(InternalFrameEvent e) { - //} - }; - - - protected void fireDrawingViewAddedEvent(final DrawingView dv) { - getDesktopEventService().fireDrawingViewAddedEvent(dv); - } - - protected void fireDrawingViewRemovedEvent(final DrawingView dv) { - getDesktopEventService().fireDrawingViewRemovedEvent(dv); - } - - protected void fireDrawingViewSelectedEvent(final DrawingView oldView, final DrawingView newView) { - getDesktopEventService().fireDrawingViewSelectedEvent(oldView, newView); - } - -/* public void setBounds(int x, int y, int w, int h) { - super.setBounds(x,y,w,h); - checkDesktopSize(); - } -*/ - - protected Component createContents(DrawingView dv) { - JScrollPane sp = new JScrollPane((Component) dv); - sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - sp.setAlignmentX(LEFT_ALIGNMENT); - - String applicationTitle; - if (dv.drawing().getTitle() == null) { - applicationTitle = getDrawApplication().getApplicationName() + " - " + getDrawApplication().getDefaultDrawingTitle(); - } - else { - applicationTitle = getDrawApplication().getApplicationName() + " - " + dv.drawing().getTitle(); - } - JInternalFrame internalFrame = new JInternalFrame(applicationTitle, true, true, true, true); - internalFrame.setName(applicationTitle); - internalFrame.getContentPane().add(sp); - internalFrame.setSize(200,200); - return internalFrame; - } - - public DrawingView getActiveDrawingView() { - return selectedView; - } - - protected void setActiveDrawingView(DrawingView newSelectedView) { - selectedView = newSelectedView; - } - - public void updateTitle(String newDrawingTitle) { - getSelectedFrame().setTitle(newDrawingTitle); - } - - /** - * This must match the signature of the superclass it is overriding or the - * method invocation may not resolve to this method unless it is called on - * a reference of specifically MDIDesktopPane type. So this must be - * Component add(Component comp) in order to override its super class and - * Component add(JInternalFrame frame) will not properly override the super- - * class, but instead overload it. - * - * Note be sure to call this method and not add() when you want to add to the - * desktop. This allows complex desktops to be created. For instance, you can - * add split panes and scroll panes and such as normal with the add() method - * but then to get to the actual desktop you would still call this method. - */ - public void addToDesktop(DrawingView dv, int location) { - JInternalFrame frame = (JInternalFrame)createContents(dv); - JInternalFrame[] array = getAllFrames(); - Point p = null; - int w; - int h; - - //should be done before added to desktop - frame.addInternalFrameListener(internalFrameListener); - super.add(frame); - - checkDesktopSize(); - if (array.length > 0) { - p = array[0].getLocation(); - p.x = p.x + FRAME_OFFSET; - p.y = p.y + FRAME_OFFSET; - } - else { - p = new Point(0, 0); - } - frame.setLocation(p.x, p.y); - if (frame.isResizable()) { - w = getWidth() - (getWidth() / 3); - h = getHeight() - (getHeight() / 3); - if (w < frame.getMinimumSize().getWidth()) { - w = (int)frame.getMinimumSize().getWidth(); - } - if (h < frame.getMinimumSize().getHeight()) { - h = (int)frame.getMinimumSize().getHeight(); - } - frame.setSize(w, h); - } - moveToFront(frame); - frame.setVisible(true); - try { - frame.setSelected(true); - } - catch (PropertyVetoException e) { - frame.toBack(); - } - } - - public void removeFromDesktop(DrawingView dv, int location) { - Component[] comps = getComponents(); - for (int x=0; x<comps.length; x++) { - if (dv == Helper.getDrawingView(comps[x])) { - ((JInternalFrame)comps[x]).dispose(); - break; - } - } - checkDesktopSize(); - } - - public void removeAllFromDesktop(int location) { - JInternalFrame[] jifs = getAllFrames(); - for (int x=0; x < jifs.length; x++) { - jifs[x].dispose(); - } - } - - public DrawingView[] getAllFromDesktop(int location){ - Component[] comps = getComponents(); - java.util.ArrayList al = new java.util.ArrayList(); - for (int x=0; x<comps.length; x++) { - DrawingView dv = Helper.getDrawingView(comps[x]); - if (dv != null) { - al.add(dv); - } - } - DrawingView[] dvs = new DrawingView[al.size()]; - al.toArray(dvs); - return dvs; - } -/* - public void setSelectedDrawingView(DrawingView dv) { - Component[] comps = getComponents(); - for (int x=0; x < comps.length; x++) { - DrawingView dv2 = Helper.getDrawingView(comps[x]); - if (dv == dv2) { - JInternalFrame frame = (JInternalFrame)comps[x]; - try { - //moveToFront(frame); - frame.setSelected(true); - } - catch(java.beans.PropertyVetoException pve) { - System.out.println(pve); - } - } - } - } -*/ - protected DesktopEventService getDesktopEventService() { - return myDesktopEventService; - } - - private void setDesktopEventService(DesktopEventService newDesktopEventService) { - myDesktopEventService = newDesktopEventService; - } - - protected DesktopEventService createDesktopEventService() { - return new DesktopEventService(this, this); - } - - public void addDesktopListener(DesktopListener dpl) { - getDesktopEventService().addDesktopListener(dpl); - } - - public void removeDesktopListener(DesktopListener dpl) { - getDesktopEventService().removeDesktopListener(dpl); - } - - /** - * Cascade all internal frames - */ - public void cascadeFrames() { - int x = 0; - int y = 0; - JInternalFrame[] allFrames = getAllFrames(); - - // do nothing if no frames to work with - if (allFrames.length == 0) { - return; - } - - manager.setNormalSize(); - - int frameHeight = (getBounds().height - 5) - allFrames.length * FRAME_OFFSET; - int frameWidth = (getBounds().width - 5) - allFrames.length * FRAME_OFFSET; - for (int i = allFrames.length - 1; i >= 0; i--) { - try { - allFrames[i].setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[i].setBounds(x, y, frameWidth, frameHeight); - x = x + FRAME_OFFSET; - y = y + FRAME_OFFSET; - } - - checkDesktopSize(); - } - - /** - * Tile all internal frames<br> - * - * @deprecated use tileFramesHorizontally() instead - * - */ - public void tileFrames() { - tileFramesHorizontally(); - } - - public void tileFramesHorizontally() { - Component[] allFrames = getAllFrames(); - - // do nothing if no frames to work with - if (allFrames.length == 0) { - return; - } - - manager.setNormalSize(); - - int frameHeight = getBounds().height/allFrames.length; - int y = 0; - for (int i = 0; i < allFrames.length; i++) { - try { - ((JInternalFrame)allFrames[i]).setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[i].setBounds(0, y, getBounds().width,frameHeight); - y = y + frameHeight; - } - - checkDesktopSize(); - } - - public void tileFramesVertically() { - Component[] allFrames = getAllFrames(); - - // do nothing if no frames to work with - if (allFrames.length == 0) { - return; - } - manager.setNormalSize(); - - int frameWidth = getBounds().width/allFrames.length; - int x = 0; - for (int i = 0; i < allFrames.length; i++) { - try { - ((JInternalFrame)allFrames[i]).setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[i].setBounds(x, 0, frameWidth, getBounds().height); - x = x + frameWidth; - } - - checkDesktopSize(); - } - - /** - * Arranges the frames as efficiently as possibly with preference for - * keeping vertical size maximal.<br> - * - */ - public void arrangeFramesVertically() { - Component[] allFrames = getAllFrames(); - // do nothing if no frames to work with - if (allFrames.length == 0) { - return; - } - - manager.setNormalSize(); - - int vertFrames = (int)Math.floor(Math.sqrt(allFrames.length)); - int horFrames = (int)Math.ceil(Math.sqrt(allFrames.length)); - - // first arrange the windows that have equal size - int frameWidth = getBounds().width / horFrames; - int frameHeight = getBounds().height / vertFrames; - int x = 0; - int y = 0; - int frameIdx = 0; - for (int horCnt = 0; horCnt < horFrames-1; horCnt++) { - y = 0; - for (int vertCnt = 0; vertCnt < vertFrames; vertCnt++) { - try { - ((JInternalFrame)allFrames[frameIdx]).setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[frameIdx].setBounds(x, y, frameWidth, frameHeight); - frameIdx++; - y = y + frameHeight; - } - x = x + frameWidth; - } - - // the rest of the frames are tiled down on the last column with equal - // height - frameHeight = getBounds().height / (allFrames.length - frameIdx); - y = 0; - for (; frameIdx < allFrames.length; frameIdx++) - { - try { - ((JInternalFrame)allFrames[frameIdx]).setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[frameIdx].setBounds(x, y, frameWidth, frameHeight); - y = y + frameHeight; - } - - checkDesktopSize(); - } - - /** - * Arranges the frames as efficiently as possibly with preference for - * keeping horizontal size maximal.<br> - * - */ - public void arrangeFramesHorizontally() { - Component[] allFrames = getAllFrames(); - // do nothing if no frames to work with - if (allFrames.length == 0) { - return; - } - - manager.setNormalSize(); - - int vertFrames = (int)Math.ceil(Math.sqrt(allFrames.length)); - int horFrames = (int)Math.floor(Math.sqrt(allFrames.length)); - - // first arrange the windows that have equal size - int frameWidth = getBounds().width / horFrames; - int frameHeight = getBounds().height / vertFrames; - int x = 0; - int y = 0; - int frameIdx = 0; - for (int vertCnt = 0; vertCnt < vertFrames-1; vertCnt++) { - x = 0; - for (int horCnt = 0; horCnt < horFrames; horCnt++) { - try { - ((JInternalFrame)allFrames[frameIdx]).setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[frameIdx].setBounds(x, y, frameWidth, frameHeight); - frameIdx++; - x = x + frameWidth; - } - y = y + frameHeight; - } - - // the rest of the frames are tiled down on the last column with equal - // height - frameWidth = getBounds().width / (allFrames.length - frameIdx); - x = 0; - for (; frameIdx < allFrames.length; frameIdx++) { - try { - ((JInternalFrame)allFrames[frameIdx]).setMaximum(false); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - - allFrames[frameIdx].setBounds(x, y, frameWidth, frameHeight); - x = x + frameWidth; - } - - checkDesktopSize(); - } - - /** - * Sets all component size properties ( maximum, minimum, preferred) - * to the given dimension. - */ - public void setAllSize(Dimension d) { - setMinimumSize(d); - setMaximumSize(d); - setPreferredSize(d); - setBounds(0, 0, d.width, d.height); - } - - /** - * Sets all component size properties ( maximum, minimum, preferred) - * to the given width and height. - */ - public void setAllSize(int width, int height) { - setAllSize(new Dimension(width,height)); - } - - private void checkDesktopSize() { - if ((getParent() != null) && isVisible()) { - manager.resizeDesktop(); - } - } - - private void setDrawApplication(DrawApplication newDrawApplication) { - myDrawApplication = newDrawApplication; - } - - protected DrawApplication getDrawApplication() { - return myDrawApplication; - } -} - -/** - * Private class used to replace the standard DesktopManager for JDesktopPane. - * Used to provide scrollbar functionality. - */ -class MDIDesktopManager extends DefaultDesktopManager { - private MDIDesktopPane desktop; - - public MDIDesktopManager(MDIDesktopPane newDesktop) { - this.desktop = newDesktop; - } - - public void endResizingFrame(JComponent f) { - super.endResizingFrame(f); - resizeDesktop(); - } - - public void endDraggingFrame(JComponent f) { - super.endDraggingFrame(f); - resizeDesktop(); - } - - public void setNormalSize() { - JScrollPane scrollPane = getScrollPane(); - Insets scrollInsets = getScrollPaneInsets(); - - if (scrollPane != null) { - Dimension d = scrollPane.getVisibleRect().getSize(); - if (scrollPane.getBorder() != null) { - d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, - d.getHeight() - scrollInsets.top - scrollInsets.bottom); - } - - d.setSize(d.getWidth() - 20, d.getHeight() - 20); - desktop.setAllSize(d); - scrollPane.invalidate(); - scrollPane.validate(); - } - } - - private Insets getScrollPaneInsets() { - JScrollPane scrollPane = getScrollPane(); - if ((scrollPane == null) || (getScrollPane().getBorder() == null)) { - return new Insets(0, 0, 0, 0); - } - else { - return getScrollPane().getBorder().getBorderInsets(scrollPane); - } - } - - public JScrollPane getScrollPane() { - if (desktop.getParent() instanceof JViewport) { - JViewport viewPort = (JViewport)desktop.getParent(); - if (viewPort.getParent() instanceof JScrollPane) - return (JScrollPane)viewPort.getParent(); - } - return null; - } - - protected void resizeDesktop() { - int x = 0; - int y = 0; - JScrollPane scrollPane = getScrollPane(); - Insets scrollInsets = getScrollPaneInsets(); - - if (scrollPane != null) { - JInternalFrame allFrames[] = desktop.getAllFrames(); - for (int i = 0; i < allFrames.length; i++) { - if (allFrames[i].getX() + allFrames[i].getWidth() > x) { - x = allFrames[i].getX() + allFrames[i].getWidth(); - } - if (allFrames[i].getY() + allFrames[i].getHeight() > y) { - y = allFrames[i].getY() + allFrames[i].getHeight(); - } - } - Dimension d=scrollPane.getVisibleRect().getSize(); - if (scrollPane.getBorder() != null) { - d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, - d.getHeight() - scrollInsets.top - scrollInsets.bottom); - } - - if (x <= d.getWidth()) { - x = ((int)d.getWidth()) - 20; - } - if (y <= d.getHeight()) { - y = ((int)d.getHeight()) - 20; - } - desktop.setAllSize(x,y); - scrollPane.invalidate(); - scrollPane.validate(); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/MDI_DrawApplication.java b/JHotDraw/src/CH/ifa/draw/contrib/MDI_DrawApplication.java deleted file mode 100644 index ede1fcd828e06e6100d0a35b4961ba7f4b407c8d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/MDI_DrawApplication.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * @(#)MDI_DrawApplication.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.application.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.contrib.dnd.DragNDropTool; - -import javax.swing.*; - -/** - * Many applications have the ability to deal with multiple internal windows. - * MDI_DrawApplications provides the basic facilities to make use of MDI in - * JHotDraw. Its main tasks are to create a content for DrawApplications, which - * is embedded in internal frames, to maintain a list with all internal frames - * and to manage the switching between them. - * - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class MDI_DrawApplication extends DrawApplication { - - /** - * Constructs a drawing window with a default title. - */ - public MDI_DrawApplication() { - this("JHotDraw"); - } - - /** - * Constructs a drawing window with the given title. - */ - public MDI_DrawApplication(String title) { - super(title); - } - - /** - * Factory method which can be overriden by subclasses to - * create an instance of their type. - * - * @return newly created application - */ - protected DrawApplication createApplication() { - return new MDI_DrawApplication(); - } - - /** - * Creates the tools. By default only the selection tool is added. - * Override this method to add additional tools. - * Call the inherited method to include the selection tool. - * @param palette the palette where the tools are added. - */ - protected void createTools(JToolBar palette) { - super.createTools(palette); - Tool tool = new DragNDropTool(this); - ToolButton tb = createToolButton(IMAGES+"SEL", "Drag N Drop Tool", tool); - palette.add( tb ); - } - - /** - * Opens a new internal frame containing a new drawing. - */ - public void promptNew() { - newWindow(createDrawing()); - } - - /** - * Method to create a new internal frame. Applications that want - * to create a new internal drawing view should call this method. - */ - public void newWindow(Drawing newDrawing) { - DrawingView newView = createDrawingView(newDrawing); - getDesktop().addToDesktop(newView, Desktop.PRIMARY); - toolDone(); - } - - /** - * Create the DrawingView that is active when the application is started. - * This initial DrawingView might be different from DrawingView created - * by the application, so subclasses can override this method to provide - * a special drawing view for application startup time, e.g. a NullDrawingView - * which does not display an internal frame in a multiple document interface - * (MDI) application. - * - * @return drawing view that is active at application startup time - */ - protected DrawingView createInitialDrawingView() { - return NullDrawingView.getManagedDrawingView(this); - } - - /** - * Open a new view for this application containing a - * view of the drawing of the currently activated window. - */ - public void newView() { - if (!view().isInteractive()) { - return; - } - - // create new window with view to an existing drawing - newWindow(view().drawing()); - - String copyTitle = getDrawingTitle(); - if (copyTitle != null) { - setDrawingTitle(copyTitle); - } - else { - setDrawingTitle(getDefaultDrawingTitle()); - } - } - - /** - * Factory method to create a specialized desktop (manager) for MDI applications - */ - protected Desktop createDesktop() { - return new MDIDesktopPane(this); - } - - /** - * Returns all the views in the application - */ - public DrawingView[] views() { - return getDesktop().getAllFromDesktop(Desktop.PRIMARY); - } - - public String getDefaultDrawingTitle() { - return super.getDefaultDrawingTitle() + views().length; - } - - /** - * Set the title of the currently selected drawing - */ - protected void setDrawingTitle(String drawingTitle) { - getDesktop().updateTitle(drawingTitle); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/MiniMapView.java b/JHotDraw/src/CH/ifa/draw/contrib/MiniMapView.java deleted file mode 100644 index 81d38e98af2afaf3094565cdd465305619217825..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/MiniMapView.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * @(#)MiniMapView.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.framework.DrawingChangeEvent; -import CH.ifa.draw.framework.DrawingChangeListener; - -import java.awt.*; -import java.awt.event.*; -import java.awt.geom.*; -import javax.swing.*; -import javax.swing.event.*; - -/** - * Utility component for enhancing component scrolling. It provides a "minature" view of the entire contents of a JScrollPane - * and the means to scroll that JScrollPane by moving a rectangle representing the viewable area of the JScrollPane. If the - * user clicks on an area inside of the MiniMapView, the JScrollPane's view is centered on that area. The user may also drag - * the rectangle representation of the JScrollPane's view around the MiniMap to scroll. - * - * @author S. Ruman (sruman@rogers.com) - * @version <$CURRENT_VERSION$> - */ -public class MiniMapView extends JComponent { -// Instance Variables - private JScrollPane m_subject; - private DrawingView myMappedDrawingView; - private SubjectListener m_subjectListener; - private DrawingChangeListener myDrawingChangeListener; - private Color m_viewBoxColor = Color.red; - -// Constructors - public MiniMapView(DrawingView newMappedDrawingView, JScrollPane subject) { - m_subjectListener = new SubjectListener(); - setSubject(subject); - setMappedDrawingView(newMappedDrawingView); - myDrawingChangeListener = new MappedDrawingChangeListener(); - getMappedDrawingView().drawing().addDrawingChangeListener(myDrawingChangeListener); - MouseListener ml = new MouseListener(); - addMouseListener(new MouseListener()); - addMouseMotionListener(ml); - } - - protected void setMappedDrawingView(DrawingView newMappedDrawingView) { - myMappedDrawingView = newMappedDrawingView; - } - - public DrawingView getMappedDrawingView() { - return myMappedDrawingView; - } - -// accessors - protected void setSubject(JScrollPane subject) { - if (m_subject != null) { - m_subject.getViewport().removeChangeListener(m_subjectListener); - } - - m_subject = subject; - if (m_subject != null) { - m_subject.getViewport().addChangeListener(m_subjectListener); - } - - repaint(); - } - - public JScrollPane getSubject() { - return m_subject; - } - - public Color getViewBowColor() { - return m_viewBoxColor; - } - - public void setViewBoxColor(Color c) { - m_viewBoxColor = c; - repaint(); - } - - /** - * @return The component that is actually being "mini-mapped", that is the component inside the scroll pane - */ - protected Component getMappedComponent() { - return (Component)getMappedDrawingView(); - } - -// Overridden - public void paint(Graphics g) { - Graphics2D g2d = (Graphics2D)g; - - // Paint a small map representation of the subjects contents - Component mappedComponent = getMappedComponent(); - AffineTransform at = getViewToMiniMapTransform(mappedComponent); - g2d.transform(at); - - getMappedDrawingView().drawAll(g2d); - - // Draw a rectangle representing the viewable area - drawViewRectangle(g2d, getViewRectangle()); - } - - // side-effect of setting the transform on g2d to identity - protected void drawViewRectangle(Graphics2D g2d, Rectangle viewPortRectangle) { - AffineTransform at = new AffineTransform(); - at.setToIdentity(); - g2d.setTransform(at); - - g2d.setColor(m_viewBoxColor); - g2d.draw(viewPortRectangle); - } - - protected AffineTransform getViewToMiniMapTransform(Component mappedComponent) { - double scaleX = ((double)getWidth()) / ((double)mappedComponent.getWidth()); - double scaleY = ((double)getHeight()) / ((double)mappedComponent.getHeight()); - - AffineTransform at = getInverseSubjectTransform(); // for subclass flexibility - at.concatenate(AffineTransform.getScaleInstance(scaleX, scaleY)); - return at; - } - - /** - * Allows subclasses to modify the transformation used in creating the mini-map - */ - protected AffineTransform getInverseSubjectTransform() { - AffineTransform at = new AffineTransform(); - at.setToIdentity(); - return at; - } - - /** - * @return The rectangle (in Mini-Map world-coordinates) representing the area being viewed inside of the scroll pane subject - */ - protected Rectangle getViewRectangle() { - Rectangle visiblePortion = m_subject.getViewportBorderBounds(); - Point upperLeftViewPos = m_subject.getViewport().getViewPosition(); - double [] srcRecCorners = new double[4]; - double [] dstRecCorners = new double[4]; - - srcRecCorners[0] = upperLeftViewPos.x + visiblePortion.getX(); srcRecCorners[1] = upperLeftViewPos.y + visiblePortion.getY(); srcRecCorners[2] = upperLeftViewPos.x + visiblePortion.getX() + visiblePortion.getWidth(); srcRecCorners[3] = upperLeftViewPos.y + visiblePortion.getY() + visiblePortion.getHeight(); - getViewToMiniMapTransform(getMappedComponent()).transform(srcRecCorners, 0, dstRecCorners, 0, srcRecCorners.length/2); // transform the coordinates to MiniMapView coordinates - - return new Rectangle((int)dstRecCorners[0], (int)dstRecCorners[1], (int)(dstRecCorners[2] - dstRecCorners[0]), (int)(dstRecCorners[3] - dstRecCorners[1])); - } - - /** - * Scrolls the subject scroll pane to the coordinates specified. - * @param upperLeftX The new upper left corner X-coordinate (in subject world-coordinates) of the subject scroll pane - * @param upperLeftY The new upper left corner Y-coordinate (in subject world-coordinates) of the subject scroll pane - */ - protected void scrollSubjectTo(int upperLeftX, int upperLeftY) { - AffineTransform at = null; - try { - at = getViewToMiniMapTransform(getMappedComponent()).createInverse(); - } - catch (NoninvertibleTransformException nite) { - nite.printStackTrace(); - return; - } - - double [] srcPoints = new double[2]; - double [] destPoints = new double[2]; - srcPoints[0] = upperLeftX; - srcPoints[1] = upperLeftY; - at.transform(srcPoints, 0, destPoints, 0, 1); - - if (destPoints[0] < 0) { - destPoints[0] = 0; - } - if (destPoints[1] < 0) { - destPoints[1] = 0; - } - - m_subject.getViewport().setViewPosition(new Point((int)destPoints[0], (int)destPoints[1])); - } - - protected int [] getUpperLeftPointsFromCenter(int centerX, int centerY) { - int [] upperLeft = new int[2]; - Rectangle oldRectangle = getViewRectangle(); - upperLeft[0] = centerX - oldRectangle.width/2; - upperLeft[1] = centerY - oldRectangle.height/2; - - /* - * JP, 25-May-03: Avoid positioning of the rectangle outside the - * available area. Resulted in very strange artifacts on the screen. - */ - if (upperLeft[0] + oldRectangle.width > getX() + getWidth()) { - upperLeft[0] = getX() + getWidth() - oldRectangle.width; - } - - if (upperLeft[1] + oldRectangle.height > getY() + getHeight()) { - upperLeft[1] = getY() + getHeight() - oldRectangle.height; - } - - return upperLeft; - } - - // Inner Classes - public class MouseListener extends MouseAdapter implements MouseMotionListener { - public void mousePressed(MouseEvent e) { - int [] rectangleUpperLeft = getUpperLeftPointsFromCenter(e.getX(), e.getY()); - scrollSubjectTo(rectangleUpperLeft[0], rectangleUpperLeft[1]); - } - - public void mouseDragged(MouseEvent e) { - int [] rectangleUpperLeft = getUpperLeftPointsFromCenter(e.getX(), e.getY()); - scrollSubjectTo(rectangleUpperLeft[0], rectangleUpperLeft[1]); - } - - public void mouseMoved(MouseEvent e) { - // empty implementation - } - } - - class SubjectListener implements ChangeListener { - public void stateChanged(ChangeEvent e) { - repaint(); - } - } - - class MappedDrawingChangeListener implements DrawingChangeListener { - /** - * Sent when an area is invalid - */ - public void drawingInvalidated(DrawingChangeEvent e) { - repaint(); - } - - /** - * Sent when the drawing wants to be refreshed - */ - public void drawingRequestUpdate(DrawingChangeEvent e) { - repaint(); - } - - /** - * Sent when the drawing Title has changed - */ - public void drawingTitleChanged(DrawingChangeEvent e) { - } - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/NestedCreationTool.java b/JHotDraw/src/CH/ifa/draw/contrib/NestedCreationTool.java deleted file mode 100644 index f55a1ab4662a41666e0a049d14d2ca9d5033c047..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/NestedCreationTool.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * @(#)CreationTool2.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.standard.CreationTool; -import CH.ifa.draw.standard.CompositeFigure; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.DrawingEditor; - -import java.awt.event.MouseEvent; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class NestedCreationTool extends CreationTool { - private CompositeFigure myContainerFigure; - - public NestedCreationTool(DrawingEditor newDrawingEditor, Figure prototype) { - super(newDrawingEditor, prototype); - } - - public void mouseDown(MouseEvent e, int x, int y) { - Figure figure = drawing().findFigure(e.getX(), e.getY()); - if (figure != null) { - figure = figure.getDecoratedFigure(); - if (figure instanceof CompositeFigure) { - setContainerFigure((CompositeFigure)figure); - super.mouseDown(e, x, y); - } - else { - toolDone(); - } - } - else { - toolDone(); - } - } - - public void mouseMove(MouseEvent e, int x, int y) { - if ((getContainerFigure() != null) && !getContainerFigure().containsPoint(e.getX(), e.getY())) { - // here you might want to constrain the mouse movements to the size of the - // container figure: not sure whether this works... - toolDone(); - } - else { - super.mouseMove(e, x, y); - } - } - - public void mouseUp(MouseEvent e, int x, int y) { - if ((getContainerFigure() != null) && (getCreatedFigure() != null) - && getContainerFigure().containsPoint(e.getX(), e.getY())) { - getContainerFigure().add(getCreatedFigure()); - } - toolDone(); - } - - protected void setContainerFigure(CompositeFigure newContainerFigure) { - myContainerFigure = newContainerFigure; - } - - public CompositeFigure getContainerFigure() { - return myContainerFigure; - } - - protected void toolDone() { - setCreatedFigure(null); - setAddedFigure(null); - setContainerFigure(null); - editor().toolDone(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/PolygonFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/PolygonFigure.java deleted file mode 100644 index 107d821ef4f6ef53259dde7c5c64203257bbb1b7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/PolygonFigure.java +++ /dev/null @@ -1,462 +0,0 @@ -/* - * @(#)PolygonFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import java.awt.*; -import java.util.*; -import java.util.List; -import java.io.IOException; - -/** - * A scalable, rotatable polygon with an arbitrary number of points - * Based on PolyLineFigure - * - * @author Doug Lea (dl at gee, Fri Feb 28 07:47:05 1997) - * @version <$CURRENT_VERSION$> - */ -public class PolygonFigure extends AttributeFigure { - - /** - * Distance threshold for smoothing away or locating points - **/ - static final int TOO_CLOSE = 2; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 6254089689239215026L; - private int polygonFigureSerializedDataVersion = 1; - - private Polygon fPoly; - - public PolygonFigure() { - super(); - setInternalPolygon(new Polygon()); - } - - public PolygonFigure(int x, int y) { - this(); - getInternalPolygon().addPoint(x, y); - } - - public PolygonFigure(Polygon p) { - setInternalPolygon(new Polygon(p.xpoints, p.ypoints, p.npoints)); - } - - public Rectangle displayBox() { - return bounds(getInternalPolygon()); - } - - - public boolean isEmpty() { - return ((pointCount() < 3) || - ((size().width < TOO_CLOSE) && (size().height < TOO_CLOSE))); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(pointCount()); - for (int i = 0; i < pointCount(); i++) { - handles.add(new PolygonHandle(this, locator(i), i)); - } - handles.add(new PolygonScaleHandle(this)); - return new HandleEnumerator(handles); - } - - - public void basicDisplayBox(Point origin, Point corner) { - Rectangle r = displayBox(); - int dx = origin.x - r.x; - int dy = origin.y - r.y; - getInternalPolygon().translate(dx, dy); - r = displayBox(); - Point oldCorner = new Point(r.x + r.width, r.y + r.height); - scaleRotate(oldCorner, getInternalPolygon(), corner); - } - - /** - * @return a copy of the internal polygon - **/ - public Polygon getPolygon() { - return new Polygon(fPoly.xpoints, fPoly.ypoints, fPoly.npoints); - } - - protected void setInternalPolygon(Polygon newPolygon) { - fPoly = newPolygon; - } - - public Polygon getInternalPolygon() { - return fPoly; - } - - public Point center() { - return center(getInternalPolygon()); - } - - public Iterator points() { - List pts = CollectionsFactory.current().createList(pointCount()); - for (int i = 0; i < pointCount(); ++i) { - pts.add(new Point(getInternalPolygon().xpoints[i], - getInternalPolygon().ypoints[i])); - } - return pts.iterator(); - } - - public int pointCount() { - return getInternalPolygon().npoints; - } - - public void basicMoveBy(int dx, int dy) { - getInternalPolygon().translate(dx, dy); - } - - public void drawBackground(Graphics g) { - g.fillPolygon(getInternalPolygon()); - } - - public void drawFrame(Graphics g) { - g.drawPolygon(getInternalPolygon()); - } - - public boolean containsPoint(int x, int y) { - return getInternalPolygon().contains(x, y); - } - - public Connector connectorAt(int x, int y) { - return new ChopPolygonConnector(this); - } - - /** - * Adds a node to the list of points. - */ - public void addPoint(int x, int y) { - getInternalPolygon().addPoint(x, y); - changed(); - } - - - /** - * Changes the position of a node. - */ - public void setPointAt(Point p, int i) { - willChange(); - getInternalPolygon().xpoints[i] = p.x; - getInternalPolygon().ypoints[i] = p.y; - changed(); - } - - /** - * Insert a node at the given point. - */ - public void insertPointAt(Point p, int i) { - willChange(); - int n = pointCount() + 1; - int[] xs = new int[n]; - int[] ys = new int[n]; - for (int j = 0; j < i; ++j) { - xs[j] = getInternalPolygon().xpoints[j]; - ys[j] = getInternalPolygon().ypoints[j]; - } - xs[i] = p.x; - ys[i] = p.y; - for (int j = i; j < pointCount(); ++j) { - xs[j + 1] = getInternalPolygon().xpoints[j]; - ys[j + 1] = getInternalPolygon().ypoints[j]; - } - - setInternalPolygon(new Polygon(xs, ys, n)); - changed(); - } - - public void removePointAt(int i) { - willChange(); - int n = pointCount() - 1; - int[] xs = new int[n]; - int[] ys = new int[n]; - for (int j = 0; j < i; ++j) { - xs[j] = getInternalPolygon().xpoints[j]; - ys[j] = getInternalPolygon().ypoints[j]; - } - for (int j = i; j < n; ++j) { - xs[j] = getInternalPolygon().xpoints[j + 1]; - ys[j] = getInternalPolygon().ypoints[j + 1]; - } - setInternalPolygon(new Polygon(xs, ys, n)); - changed(); - } - - /** - * Scale and rotate relative to anchor - **/ - public void scaleRotate(Point anchor, Polygon originalPolygon, Point p) { - willChange(); - - // use center to determine relative angles and lengths - Point ctr = center(originalPolygon); - double anchorLen = Geom.length(ctr.x, ctr.y, anchor.x, anchor.y); - - if (anchorLen > 0.0) { - double newLen = Geom.length(ctr.x, ctr.y, p.x, p.y); - double ratio = newLen / anchorLen; - - double anchorAngle = Math.atan2(anchor.y - ctr.y, anchor.x - ctr.x); - double newAngle = Math.atan2(p.y - ctr.y, p.x - ctr.x); - double rotation = newAngle - anchorAngle; - - int n = originalPolygon.npoints; - int[] xs = new int[n]; - int[] ys = new int[n]; - - for (int i = 0; i < n; ++i) { - int x = originalPolygon.xpoints[i]; - int y = originalPolygon.ypoints[i]; - double l = Geom.length(ctr.x, ctr.y, x, y) * ratio; - double a = Math.atan2(y - ctr.y, x - ctr.x) + rotation; - xs[i] = (int)(ctr.x + l * Math.cos(a) + 0.5); - ys[i] = (int)(ctr.y + l * Math.sin(a) + 0.5); - } - setInternalPolygon(new Polygon(xs, ys, n)); - } - changed(); - } - - - /** - * Remove points that are nearly colinear with others - **/ - public void smoothPoints() { - willChange(); - boolean removed = false; - int n = pointCount(); - do { - removed = false; - int i = 0; - while (i < n && n >= 3) { - int nxt = (i + 1) % n; - int prv = (i - 1 + n) % n; - - if ((Geom.distanceFromLine(getInternalPolygon().xpoints[prv], - getInternalPolygon().ypoints[prv], - getInternalPolygon().xpoints[nxt], - getInternalPolygon().ypoints[nxt], - getInternalPolygon().xpoints[i], - getInternalPolygon().ypoints[i]) < TOO_CLOSE)) { - removed = true; - --n; - for (int j = i; j < n; ++j) { - getInternalPolygon().xpoints[j] = getInternalPolygon().xpoints[j + 1]; - getInternalPolygon().ypoints[j] = getInternalPolygon().ypoints[j + 1]; - } - } - else { - ++i; - } - } - } while(removed); - if (n != pointCount()) { - setInternalPolygon(new Polygon(getInternalPolygon().xpoints, - getInternalPolygon().ypoints, n)); - } - changed(); - } - - /** - * Splits the segment at the given point if a segment was hit. - * @return the index of the segment or -1 if no segment was hit. - */ - public int splitSegment(int x, int y) { - int i = findSegment(x, y); - if (i != -1) { - insertPointAt(new Point(x, y), i+1); - return i + 1; - } - else { - return -1; - } - } - - public Point pointAt(int i) { - return new Point(getInternalPolygon().xpoints[i], - getInternalPolygon().ypoints[i]); - } - - /** - * Return the point on the polygon that is furthest from the center - **/ - public Point outermostPoint() { - Point ctr = center(); - int outer = 0; - long dist = 0; - - for (int i = 0; i < pointCount(); ++i) { - long d = Geom.length2(ctr.x, ctr.y, - getInternalPolygon().xpoints[i], - getInternalPolygon().ypoints[i]); - if (d > dist) { - dist = d; - outer = i; - } - } - - return new Point(getInternalPolygon().xpoints[outer], getInternalPolygon().ypoints[outer]); - } - - - /** - * Gets the segment that is hit by the given point. - * @return the index of the segment or -1 if no segment was hit. - */ - public int findSegment(int x, int y) { - double dist = TOO_CLOSE; - int best = -1; - - for (int i = 0; i < pointCount(); i++) { - int n = (i + 1) % pointCount(); - double d = Geom.distanceFromLine(getInternalPolygon().xpoints[i], - getInternalPolygon().ypoints[i], - getInternalPolygon().xpoints[n], - getInternalPolygon().ypoints[n], x, y); - if (d < dist) { - dist = d; - best = i; - } - } - return best; - } - - public Point chop(Point p) { - return chop(getInternalPolygon(), p); - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(pointCount()); - for (int i = 0; i < pointCount(); ++i) { - dw.writeInt(getInternalPolygon().xpoints[i]); - dw.writeInt(getInternalPolygon().ypoints[i]); - } - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - int size = dr.readInt(); - int[] xs = new int[size]; - int[] ys = new int[size]; - for (int i = 0; i < size; i++) { - xs[i] = dr.readInt(); - ys[i] = dr.readInt(); - } - setInternalPolygon(new Polygon(xs, ys, size)); - } - - /** - * Creates a locator for the point with the given index. - */ - public static Locator locator(final int pointIndex) { - return new AbstractLocator() { - public Point locate(Figure owner) { - PolygonFigure plf = (PolygonFigure)owner; - // guard against changing PolygonFigures -> temporary hack - if (pointIndex < plf.pointCount()) { - return ((PolygonFigure)owner).pointAt(pointIndex); - } - return new Point(-1, -1); - } - }; - } - - /** - * replacement for builtin Polygon.getBounds that doesn't always update? - */ - public static Rectangle bounds(Polygon p) { - int minx = Integer.MAX_VALUE; - int miny = Integer.MAX_VALUE; - int maxx = Integer.MIN_VALUE; - int maxy = Integer.MIN_VALUE; - int n = p.npoints; - for (int i = 0; i < n; i++) { - int x = p.xpoints[i]; - int y = p.ypoints[i]; - if (x > maxx) { - maxx = x; - } - if (x < minx) { - minx = x; - } - if (y > maxy) { - maxy = y; - } - if (y < miny) { - miny = y; - } - } - - return new Rectangle(minx, miny, maxx - minx, maxy - miny); - } - - public static Point center(Polygon p) { - long sx = 0; - long sy = 0; - int n = p.npoints; - for (int i = 0; i < n; i++) { - sx += p.xpoints[i]; - sy += p.ypoints[i]; - } - - return new Point((int)(sx / n), (int)(sy / n)); - } - - public static Point chop(Polygon poly, Point p) { - Point ctr = center(poly); - int cx = -1; - int cy = -1; - long len = Long.MAX_VALUE; - - // Try for points along edge - - for (int i = 0; i < poly.npoints; ++i) { - int nxt = (i + 1) % poly.npoints; - Point chop = Geom.intersect(poly.xpoints[i], - poly.ypoints[i], - poly.xpoints[nxt], - poly.ypoints[nxt], - p.x, - p.y, - ctr.x, - ctr.y); - if (chop != null) { - long cl = Geom.length2(chop.x, chop.y, p.x, p.y); - if (cl < len) { - len = cl; - cx = chop.x; - cy = chop.y; - } - } - } - // if none found, pick closest vertex - //if (len == Long.MAX_VALUE) { - { // try anyway - for (int i = 0; i < poly.npoints; ++i) { - long l = Geom.length2(poly.xpoints[i], poly.ypoints[i], p.x, p.y); - if (l < len) { - len = l; - cx = poly.xpoints[i]; - cy = poly.ypoints[i]; - } - } - } - return new Point(cx, cy); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/PolygonHandle.java b/JHotDraw/src/CH/ifa/draw/contrib/PolygonHandle.java deleted file mode 100644 index 93ce88f1e6acfd1321d47545a527aefe7da10b52..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/PolygonHandle.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * @(#)PolygonHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.PolyLineHandle; -import CH.ifa.draw.util.Undoable; -import java.awt.Point; - -/** - * A handle for a node on the polygon. - * Based on PolyLineHandle - * - * @author Doug Lea (dl at gee, Fri Feb 28 07:47:13 1997) - * @version <$CURRENT_VERSION$> - */ -public class PolygonHandle extends AbstractHandle { - - private Locator fLocator; - private int fIndex; - - /** - * Constructs a polygon handle. - * @param owner the owning polygon figure. - * @param l the locator - * @param index the index of the node associated with this handle. - */ - public PolygonHandle(PolygonFigure owner, Locator l, int index) { - super(owner); - fLocator = l; - fIndex = index; - } - - public void invokeStart(int x, int y, DrawingView view) { - setUndoActivity(createUndoActivity(view, fIndex)); - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(owner())); - ((PolygonHandle.UndoActivity)getUndoActivity()).setOldPoint(new Point(x, y)); - } - - public void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view) { - int index = ((PolyLineHandle.UndoActivity)getUndoActivity()).getPointIndex(); - myOwner().setPointAt(new Point(x, y), index); - } - - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - myOwner().smoothPoints(); - if ((x == anchorX) && (y == anchorY)) { - setUndoActivity(null); - } - } - - public Point locate() { - return fLocator.locate(owner()); - } - - private PolygonFigure myOwner() { - return (PolygonFigure)owner(); - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected Undoable createUndoActivity(DrawingView newView, int newPointIndex) { - return new PolygonHandle.UndoActivity(newView, newPointIndex); - } - - public static class UndoActivity extends PolyLineHandle.UndoActivity { - - public UndoActivity(DrawingView newView, int newPointIndex) { - super(newView, newPointIndex); - } - - protected boolean movePointToOldLocation() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - - PolygonFigure figure = (PolygonFigure)fe.nextFigure(); - Point backupPoint = figure.pointAt(getPointIndex()); - figure.setPointAt(getOldPoint(), getPointIndex()); - figure.smoothPoints(); - setOldPoint(backupPoint); - - return true; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/PolygonScaleHandle.java b/JHotDraw/src/CH/ifa/draw/contrib/PolygonScaleHandle.java deleted file mode 100644 index ffa5ab53f7076389e359f04c030d2f582448abb8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/PolygonScaleHandle.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * @(#)PolygonScaleHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; -import java.awt.*; - -/** - * A Handle to scale and rotate a PolygonFigure - * Based on RadiusHandle - * - * @author Doug Lea (dl at gee, Sat Mar 1 09:06:09 1997) - * @version <$CURRENT_VERSION$> - */ -class PolygonScaleHandle extends AbstractHandle { - - private Point fCurrent; - - public PolygonScaleHandle(PolygonFigure owner) { - super(owner); - } - - /** - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @param view the handles container - */ - public void invokeStart(int x, int y, DrawingView view) { - fCurrent = new Point(x, y); - PolygonScaleHandle.UndoActivity activity = (PolygonScaleHandle.UndoActivity)createUndoActivity(view); - setUndoActivity(activity); - activity.setAffectedFigures(new SingleFigureEnumerator(owner())); - activity.setPolygon(((PolygonFigure)(owner())).getPolygon()); - } - - /** - * Tracks a step of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - */ - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - fCurrent = new Point(x, y); - Polygon polygon = ((PolygonScaleHandle.UndoActivity)getUndoActivity()).getPolygon(); - ((PolygonFigure)(owner())).scaleRotate(new Point(anchorX, anchorY), polygon, fCurrent); - } - - /** - * Tracks the end of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - ((PolygonFigure)(owner())).smoothPoints(); - if ((fCurrent.x == anchorX) && (fCurrent.y == anchorY)) { - // there is nothing to undo - setUndoActivity(null); - } - fCurrent = null; - } - - public Point locate() { - if (fCurrent == null) { - return getOrigin(); - } - else { - return fCurrent; - } - } - - Point getOrigin() { - // find a nice place to put handle - // Need to pick a place that will not overlap with point handle - // and is internal to polygon - - // Try for one HANDLESIZE step away from outermost toward center - - Point outer = ((PolygonFigure)(owner())).outermostPoint(); - Point ctr = ((PolygonFigure)(owner())).center(); - double len = Geom.length(outer.x, outer.y, ctr.x, ctr.y); - if (len == 0) { // best we can do? - return new Point(outer.x - HANDLESIZE/2, outer.y + HANDLESIZE/2); - } - - double u = HANDLESIZE / len; - if (u > 1.0) { // best we can do? - return new Point((outer.x * 3 + ctr.x)/4, (outer.y * 3 + ctr.y)/4); - } - else { - return new Point((int)(outer.x * (1.0 - u) + ctr.x * u), - (int)(outer.y * (1.0 - u) + ctr.y * u)); - } - } - - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.yellow); - g.fillOval(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawOval(r.x, r.y, r.width, r.height); - - /* for debugging ... - Point ctr = ((PolygonFigure)(owner())).center(); - g.setColor(Color.blue); - g.fillOval(ctr.x, ctr.y, r.width, r.height); - - g.setColor(Color.black); - g.drawOval(ctr.x, ctr.y, r.width, r.height); - - */ - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected Undoable createUndoActivity(DrawingView newView) { - return new PolygonScaleHandle.UndoActivity(newView); - } - - public static class UndoActivity extends UndoableAdapter { - private Polygon myPolygon; - - public UndoActivity(DrawingView newView) { - super(newView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - return resetPolygon(); - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - return resetPolygon(); - } - - protected boolean resetPolygon() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - PolygonFigure figure = (PolygonFigure)fe.nextFigure(); - Polygon backupPolygon = figure.getPolygon(); - figure.willChange(); - figure.setInternalPolygon(getPolygon()); - figure.changed(); - setPolygon(backupPolygon); - return true; - } - - protected void setPolygon(Polygon newPolygon) { - myPolygon = newPolygon; - } - - public Polygon getPolygon() { - return myPolygon; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/PolygonTool.java b/JHotDraw/src/CH/ifa/draw/contrib/PolygonTool.java deleted file mode 100644 index 878928b39d680d50fda169829a58f563a756f2fe..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/PolygonTool.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * @(#)PolygonTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Undoable; -import java.awt.*; -import java.awt.event.MouseEvent; - -/** - * Based on ScribbleTool - * - * @author Doug Lea (dl at gee) - Fri Feb 28 07:47:05 1997 - * @version <$CURRENT_VERSION$> - */ -public class PolygonTool extends AbstractTool { - - private PolygonFigure fPolygon; - private int fLastX, fLastY; - - /** - * the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - private Figure myAddedFigure; - - public PolygonTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - public void activate() { - super.activate(); - fPolygon = null; - } - - public void deactivate() { - if (fPolygon != null) { - fPolygon.smoothPoints(); - if (fPolygon.pointCount() < 3 || - fPolygon.size().width < 4 || fPolygon.size().height < 4) { - getActiveView().drawing().remove(fPolygon); - // nothing to undo - setUndoActivity(null); - } - } - fPolygon = null; - super.deactivate(); - } - - private void addPoint(int x, int y) { - if (fPolygon == null) { - fPolygon = new PolygonFigure(x, y); - setAddedFigure(view().add(fPolygon)); - fPolygon.addPoint(x, y); - } - else if (fLastX != x || fLastY != y) { - fPolygon.addPoint(x, y); - } - - fLastX = x; - fLastY = y; - } - - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e,x,y); - // replace pts by actual event pts - x = e.getX(); - y = e.getY(); - - if (e.getClickCount() >= 2) { - if (fPolygon != null) { - fPolygon.smoothPoints(); - - // use undo activity from paste command... - setUndoActivity(createUndoActivity()); - - // put created figure into a figure enumeration - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure())); - - editor().toolDone(); - } - fPolygon = null; - - } - else { - // use original event coordinates to avoid - // supress that the scribble is constrained to - // the grid - addPoint(e.getX(), e.getY()); - } - } - - public void mouseMove(MouseEvent e, int x, int y) { - if (e.getSource() == getActiveView()) { - if (fPolygon != null) { - if (fPolygon.pointCount() > 1) { - fPolygon.setPointAt(new Point(x, y), fPolygon.pointCount()-1); - getActiveView().checkDamage(); - } - } - } - } - - public void mouseDrag(MouseEvent e, int x, int y) { - // replace pts by actual event pts - x = e.getX(); - y = e.getY(); - addPoint(x, y); - } - - public void mouseUp(MouseEvent e, int x, int y) { - } - - /** - * Gets the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - protected Figure getAddedFigure() { - return myAddedFigure; - } - - private void setAddedFigure(Figure newAddedFigure) { - myAddedFigure = newAddedFigure; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new PasteCommand.UndoActivity(view()); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/PopupMenuFigureSelection.java b/JHotDraw/src/CH/ifa/draw/contrib/PopupMenuFigureSelection.java deleted file mode 100644 index 16218a1977a5e3ae205beedab1a0396f3d408300..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/PopupMenuFigureSelection.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * @(#)PopupMenuFigureSelection.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.*; - -/** - * An interface which allows a popup menu to interact with its Figure to - * which it is associated. - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public interface PopupMenuFigureSelection { - - /** - * Set the figure which was selected when the popup menu was invoked. - * - * @param newSelectedFigure figure which is selected (typically be a SelectionTool) - */ - public void setSelectedFigure(Figure newSelectedFigure); - - /** - * Get the figure which was selected when the popup menu was invoked. - * - * @return figure which is selected (typically be a SelectionTool) - */ - public Figure getSelectedFigure(); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/SVGDrawApp.java b/JHotDraw/src/CH/ifa/draw/contrib/SVGDrawApp.java deleted file mode 100644 index 9e484be74650a624991d21bbc0fe56387f4e0765..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/SVGDrawApp.java +++ /dev/null @@ -1,49 +0,0 @@ -package CH.ifa.draw.contrib; - -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.samples.javadraw.JavaDrawApp; -import CH.ifa.draw.util.StorageFormatManager; - -/** - * @author mtnygard - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class SVGDrawApp extends JavaDrawApp { - public static void main(String[] args) { - SVGDrawApp window = new SVGDrawApp(); - window.open(); - } - - public SVGDrawApp() { - super("JHotDraw"); - } - - /** - * Factory method which create a new instance of this - * application. - * - * @return newly created application - */ - protected DrawApplication createApplication() { - return new SVGDrawApp(); - } - - /** - * Factory method to create a StorageFormatManager for supported storage formats. - * Different applications might want to use different storage formats and can return - * their own format manager by overriding this method. - * - * TODO: Read storage formats from a config file. - */ - public StorageFormatManager createStorageFormatManager() { - StorageFormatManager storageFormatManager = new StorageFormatManager(); - SVGStorageFormat format = new SVGStorageFormat(); - storageFormatManager.addStorageFormat(format); - storageFormatManager.setDefaultStorageFormat(format); - return storageFormatManager; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/SVGStorageFormat.java b/JHotDraw/src/CH/ifa/draw/contrib/SVGStorageFormat.java deleted file mode 100644 index 00ab7766be96de74d1ecaf6928386bf6ec96cdfd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/SVGStorageFormat.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)SVGStorageFormat.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; - -import org.apache.batik.dom.GenericDOMImplementation; -import org.apache.batik.svggen.SVGGraphics2D; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; - -import CH.ifa.draw.framework.Drawing; -import CH.ifa.draw.util.StandardStorageFormat; - - -/** - * The SVGStorageFormat can save drawings in SVG 1.0. At this time, it cannot load - * SVG drawings. - * - * TODO: Refactor this and the other storage formats. There is too much duplication. - * - * @version <$CURRENT_VERSION$> - * @author mtnygard - */ -public class SVGStorageFormat extends StandardStorageFormat { - - /** - * Return the file extension recognized by the FileFilter for this - * StandardStorageFormat. - * - * @return the file extension - */ - protected String createFileExtension() { - return "svg"; - } - - /** - * Factory method to create a file description for the file type when displaying the - * associated FileFilter. - * - * @return the file description - */ - public String createFileDescription() { - return "Scalable Vector Graphics (svg)"; - } - - - /** - * @see CH.ifa.draw.util.StorageFormat#isRestoreFormat() - */ - public boolean isRestoreFormat() { - return false; - } - - /** - * @see CH.ifa.draw.util.StorageFormat#isStoreFormat() - */ - public boolean isStoreFormat() { - return true; - } - - /** - * Store a Drawing as SVG under a given name. - * - * @param fileName file name of the Drawing under which it should be stored - * @param saveDrawing drawing to be saved - * @return file name with correct file extension - * @see CH.ifa.draw.util.StorageFormat#store(java.lang.String, CH.ifa.draw.framework.Drawing) - */ - public String store(String fileName, Drawing saveDrawing) throws IOException { - // Get a DOMImplementation - DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); - - // Create an instance of org.w3c.dom.Document - Document document = domImpl.createDocument(null, "svg", null); - - // Create an instance of the SVG Generator - SVGGraphics2D svgGenerator = new SVGGraphics2D(document); - - // Ask the test to render into the SVG Graphics2D implementation - saveDrawing.draw(svgGenerator); - - // Finally, stream out SVG to the standard output using UTF-8 - // character to byte encoding - fileName = adjustFileName(fileName); - FileOutputStream fos = new FileOutputStream(fileName); - Writer out = new OutputStreamWriter(fos, "UTF-8"); - - - svgGenerator.stream(out, true); - return fileName; - } - - /** - * @see CH.ifa.draw.util.StorageFormat#restore(java.lang.String) - */ - public Drawing restore(String fileName) throws IOException { - throw new IOException("Not implemented"); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/SimpleLayouter.java b/JHotDraw/src/CH/ifa/draw/contrib/SimpleLayouter.java deleted file mode 100644 index a4d3513a3c73217ca8c585500ef57877cf6c1a59..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/SimpleLayouter.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * @(#)SimpleLayouter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -import java.awt.*; -import java.io.IOException; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class SimpleLayouter implements Layouter { - - /** - * The Layoutable which should be laid out. - */ - private Layoutable myLayoutable; - - /** - * Insets to calculate a border - */ - private Insets myInsets; - - static final long serialVersionUID = 2928651014089117493L; - - private SimpleLayouter() { - // do nothing: for JDO-compliance only - } - - public SimpleLayouter(Layoutable newLayoutable) { - setLayoutable(newLayoutable); - setInsets(new Insets(0, 0, 0, 0)); - } - - /** - * Get the figure upon which the layout strategy operates. - * - * @return associated figure which should be laid out - */ - public Layoutable getLayoutable() { - return myLayoutable; - } - - /** - * Set the figure upon which the layout strategy operates. - * - * @param newLayoutable Layoutable to be laid out - */ - public void setLayoutable(Layoutable newLayoutable) { - myLayoutable = newLayoutable; - } - - /** - * Set the insets for spacing between the figure and its subfigures - * - * @param newInsets new spacing dimensions - */ - public void setInsets(Insets newInsets) { - myInsets = newInsets; - } - - /** - * Get the insets for spacing between the figure and its subfigures - * - * @return spacing dimensions - */ - public Insets getInsets() { - return myInsets; - } - - /** - * Create a new instance of this type and sets the layoutable - */ - public Layouter create(Layoutable newLayoutable) { - SimpleLayouter newLayouter = new SimpleLayouter(newLayoutable); - newLayouter.setInsets((Insets)getInsets().clone()); - return newLayouter; - } - - public Rectangle calculateLayout(Point origin, Point corner) { - Rectangle maxRect = new Rectangle(origin); - maxRect.add(corner); - FigureEnumeration fe = getLayoutable().figures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - maxRect.union(currentFigure.displayBox()); - } - maxRect.width += getInsets().left + getInsets().right; - maxRect.height += getInsets().top + getInsets().bottom; - return maxRect; - } - - public Rectangle layout(Point origin, Point corner) { - return calculateLayout(origin, corner); - } - - /** - * Reads the contained figures from StorableInput. - */ - public void read(StorableInput dr) throws IOException { - setLayoutable((Layoutable)dr.readStorable()); - setInsets(new Insets(dr.readInt(), dr.readInt(), dr.readInt(), dr.readInt())); - } - - /** - * Writes the contained figures to the StorableOutput. - */ - public void write(StorableOutput dw) { - dw.writeStorable(getLayoutable()); - Insets i = getInsets(); - dw.writeInt(i.top); - dw.writeInt(i.left); - dw.writeInt(i.bottom); - dw.writeInt(i.right); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/SplitConnectionTool.java b/JHotDraw/src/CH/ifa/draw/contrib/SplitConnectionTool.java deleted file mode 100644 index ff0f9ad037fec357479631fd3d4546a784675cb2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/SplitConnectionTool.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @(#)ConnectionTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.standard.ConnectionTool; -import CH.ifa.draw.standard.SingleFigureEnumerator; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.figures.*; - -import java.awt.event.MouseEvent; -import java.awt.*; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class SplitConnectionTool extends ConnectionTool { - public SplitConnectionTool(DrawingEditor newDrawingEditor, ConnectionFigure newPrototype) { - super(newDrawingEditor, newPrototype); - } - - public void mouseDown(MouseEvent e, int x, int y) { - setView((DrawingView)e.getSource()); - int ex = e.getX(); - int ey = e.getY(); - if (getTargetFigure() == null) { - setTargetFigure(findConnectableFigure(ex, ey, drawing())); - } - else { - if (getAddedFigure() == null) { - setConnection(createConnection()); - setStartConnector(findConnector(ex, ey, getTargetFigure())); - getConnection().connectStart(getStartConnector()); - getConnection().startPoint(ex, ey); - setAddedFigure(view().add(getConnection())); - } - Figure c = findTarget(ex, ey, drawing()); - if (c != null) { - // end connection figure found - setEndConnector(findConnector(ex, ex, c)); - getConnection().connectEnd(getEndConnector()); - getConnection().endPoint(ex, ey); - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures( - new SingleFigureEnumerator(getAddedFigure())); - getConnection().updateConnection(); - init(); - editor().toolDone(); - } - else { - // split connection where the mouse click took place - if (getEndConnector() == null) { - Figure tempEndFigure = new NullFigure(); - tempEndFigure.basicDisplayBox(new Point(ex, ey), new Point(ex, ey)); - setEndConnector(new NullConnector(tempEndFigure)); - getConnection().connectEnd(getEndConnector()); - getConnection().endPoint(ex, ey); - getConnection().updateConnection(); - } - else { - ((PolyLineFigure)getConnection()).addPoint(ex, ey); - } - } - } - } - - public void mouseUp(MouseEvent e, int x, int y) { - // usually do nothing: tool is still active - if (e.getClickCount() == 2) { - init(); - editor().toolDone(); - } - } - - public void mouseMove(MouseEvent e, int x, int y) { - // avoid tracking connectors - } - - public void mouseDrag(MouseEvent e, int x, int y) { - // avoid tracking connectors - } - - public void deactivate() { - if (getConnection() != null) { - view().remove(getConnection()); - } - super.deactivate(); - init(); - } - - protected void init() { - setConnection(null); - setStartConnector(null); - setEndConnector(null); - setAddedFigure(null); - setTargetFigure(null); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/SplitPaneDesktop.java b/JHotDraw/src/CH/ifa/draw/contrib/SplitPaneDesktop.java deleted file mode 100644 index bd393e4f69a06c1963626440ab43355b6d63b851..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/SplitPaneDesktop.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * @(#)SplitPaneDesktop.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import javax.swing.*; -import java.awt.*; -import CH.ifa.draw.framework.DrawingView; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; - -/** - * @todo Gotta fix this !!! the selected view changes based on which split pane is selected! - * - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class SplitPaneDesktop extends JSplitPane implements Desktop { - - private DesktopEventService myDesktopEventService; - - public SplitPaneDesktop() { - setDesktopEventService(createDesktopEventService()); - setAlignmentX(JSplitPane.LEFT_ALIGNMENT); - setOneTouchExpandable(true); - - addPropertyChangeListener(createPropertyChangeListener()); - } - - protected PropertyChangeListener createPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (getRightComponent() != null) { - getRightComponent().repaint(); - } - if (getLeftComponent() != null) { - getLeftComponent().repaint(); - } - } - }; - } - - protected Component createContents(DrawingView dv, int location) { - setRightComponent(createRightComponent(dv)); - setLeftComponent(createLeftComponent(dv)); - switch (location) { - case Desktop.PRIMARY: { - return getLeftComponent(); - } - case Desktop.SECONDARY: { - return getRightComponent(); - } - default: { - return null; - } - } - } - - protected Component createRightComponent(DrawingView dv) { - JScrollPane sp = new JScrollPane((Component)dv); - sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - sp.setAlignmentX(LEFT_ALIGNMENT); - return sp; - } - - protected Component createLeftComponent(DrawingView dv) { - return new JScrollPane(new JList()); - } - - public DrawingView getActiveDrawingView() { - return getDesktopEventService().getActiveDrawingView(); - } - - public void addToDesktop(DrawingView dv, int location) { - createContents(dv, Desktop.PRIMARY); -/* switch (location) { - case Desktop.PRIMARY: { - setLeftComponent(createContents(dv, Desktop.PRIMARY)); - break; - } - case Desktop.SECONDARY: { - setRightComponent(createContents(dv, Desktop.SECONDARY)); - break; - } - } -*/ -// validate(); - setDividerLocation(getInitDividerLocation()); - } - - protected int getInitDividerLocation() { - return 150; - } - - public void removeFromDesktop(DrawingView dv, int location) { - Component[] comps = getContainer().getComponents(); - for (int x = 0; x < comps.length; x++) { - if (dv == Helper.getDrawingView(comps[x])) { - getContainer().remove(comps[x]); - break; - } - } - } - - public void removeAllFromDesktop(int location) { - getContainer().removeAll(); - } - - public DrawingView[] getAllFromDesktop(int location) { - return getDesktopEventService().getDrawingViews(getComponents()); - } - - public void addDesktopListener(DesktopListener dpl) { - getDesktopEventService().addDesktopListener(dpl); - } - - public void removeDesktopListener(DesktopListener dpl) { - getDesktopEventService().removeDesktopListener(dpl); - } - - private Container getContainer() { - return this; - } - - protected DesktopEventService getDesktopEventService() { - return myDesktopEventService; - } - - private void setDesktopEventService(DesktopEventService newDesktopEventService) { - myDesktopEventService = newDesktopEventService; - } - - protected DesktopEventService createDesktopEventService() { - return new DesktopEventService(this, getContainer()); - } - - public void updateTitle(String newDrawingTitle) { - // should be setTitle but a JPanelDesktop has no own title bar - setName(newDrawingTitle); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/SplitPaneDrawApplication.java b/JHotDraw/src/CH/ifa/draw/contrib/SplitPaneDrawApplication.java deleted file mode 100644 index 9c7f1af1483539be45eb47717f062b574eaa94e2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/SplitPaneDrawApplication.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * @(#)SplitPaneDrawApplication.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.application.*; - -/** - * A specialised DrawApplication, which offers basic support for a simple - * splitted pane content. - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class SplitPaneDrawApplication extends DrawApplication { - - /** - * Constructs a drawing window with a default title. - */ - public SplitPaneDrawApplication() { - this("JHotDraw"); - } - - /** - * Constructs a drawing window with the given title. - */ - public SplitPaneDrawApplication(String title) { - super(title); - } - - protected Desktop createDesktop() { - return new SplitPaneDesktop(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/StandardLayouter.java b/JHotDraw/src/CH/ifa/draw/contrib/StandardLayouter.java deleted file mode 100644 index 921620d2e53f054dedf3404c6c7d8eff8e07150b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/StandardLayouter.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * @(#)StandardLayouter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.Point; -import java.awt.Rectangle; - -// JUnitDoclet begin import -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.FigureEnumeration; -// JUnitDoclet end import - -/** - * A StandardLayouter contains standard algorithm for - * layouting a Layoutable. As a standard behaviour - * all child components of a Layoutable are laid out - * underneath each other starting from top to bottom while the - * x position of all child components stays the same and the width - * is forced to the width of the maximum width. At the end - * the presentation figure of the Layoutable is - * set to the maximum x and y size to encompass all contained - * child components graphically as well. - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class StandardLayouter extends SimpleLayouter { - - /** - * Default constructor which is needed for the Storable mechanism. - * Usually, the constructor which takes a Layoutable - * should be used as each StandardLayouter is associated - * with exactly one Layoutable. - */ - public StandardLayouter() { - this(null); - } - - /** - * Constructor which associates a StandardLayouter with - * a certain Layoutable. - * - * @param newLayoutable Layoutable to be laid out - */ - public StandardLayouter(Layoutable newLayoutable) { - super(newLayoutable); - } - - /** - * Create a new instance of this type and sets the layoutable - */ - public Layouter create(Layoutable newLayoutable) { - return new StandardLayouter(newLayoutable); - } - - /** - * Calculate the layout for the figure and all its - * subelements. The layout is not actually performed but just - * its dimensions are calculated. The insets for this figure - * are included in the return value. - * - * @param origin start point for the layout - * @param corner minimum corner point for the layout - */ - public Rectangle calculateLayout(Point origin, Point corner) { - int maxWidth = Math.abs(corner.x - origin.x); - int maxHeight = getInsets().top; - - // layout enclosed Layoutable and find maximum width - FigureEnumeration fe = getLayoutable().figures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - Rectangle r = null; - if (currentFigure instanceof Layoutable) { - Layouter layoutStrategy = ((Layoutable)currentFigure).getLayouter(); - r = layoutStrategy.calculateLayout( - new Point(0, 0), new Point(0, 0)); - } - else { - r = new Rectangle(currentFigure.displayBox().getBounds()); - } - maxWidth = Math.max(maxWidth, - r.width + getInsets().left + - getInsets().right); - maxHeight += r.height; - } - maxHeight += getInsets().bottom; - - return new Rectangle(origin.x, origin.y, maxWidth, maxHeight); - } - - /** - * Method which lays out a figure. It is called by the figure - * if a layout task is to be performed. First, the layout dimension for - * the figure is calculated and then the figure is arranged newly. - * All child component are place beneath another. The figure and all - * its children are forced to the minimium width - * - * @param origin start point for the layout - * @param corner minimum corner point for the layout - */ - public Rectangle layout(Point origin, Point corner) { - // calculate the layout of the figure and its sub-figures first - Rectangle r = calculateLayout(origin, corner); - - int maxHeight = getInsets().top; - FigureEnumeration fe = getLayoutable().figures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - - Point partOrigin = new Point(r.x + getInsets().left, r.y + maxHeight); - Point partCorner = new Point - (r.x + r.width - getInsets().right, - r.y + maxHeight + - currentFigure.displayBox().height); - currentFigure.displayBox(partOrigin, partCorner); - - maxHeight += currentFigure.displayBox().height; - } - - return new Rectangle(r.x, r.y, r.width, maxHeight + getInsets().bottom); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/TextAreaFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/TextAreaFigure.java deleted file mode 100644 index bf238ecb1348f0c50c3cd24035ceca9c07f90d47..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/TextAreaFigure.java +++ /dev/null @@ -1,929 +0,0 @@ -/* - * @(#)TextAreaFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: ? by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import java.awt.*; -import java.awt.font.FontRenderContext; -import java.awt.font.LineBreakMeasurer; -import java.awt.font.TextAttribute; -import java.awt.font.TextLayout; -import java.awt.geom.Rectangle2D; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.text.AttributedCharacterIterator; -import java.text.AttributedString; -import java.text.CharacterIterator; -import java.util.*; -import java.util.List; - -import CH.ifa.draw.figures.AttributeFigure; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.FigureChangeEvent; -import CH.ifa.draw.framework.FigureChangeListener; -import CH.ifa.draw.framework.HandleEnumeration; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -/** - * A TextAreaFigure contains formatted text.<br> - * It automatically rearranges the text to fit its allocated display area, - * breaking the lines at word boundaries whenever possible.<br> - * The text can contain either LF or CRLF sequences to separate paragraphs, - * as well as tab characters for table like formatting and alignment.<br> - * Currently the tabs are distributed at regular intervals as determined by - * the TabSize property. Tabs align correctly with either fixed - * or variable fonts.<br> - * If, when resizing, the vertical size of the display box is not enough to - * display all the text, TextAreaFigure displays a dashed red line at the - * bottom of the figure to indicate there is hidden text.<br> - * TextAreFigure uses all standard attributes for the area rectangle, - * ie: FillColor, PenColor for the border, FontSize, FontStyle, and FontName, - * as well as four additional attributes LeftMargin, RightMargin, TopMargin, - * and TabSize.<br> - * - * @author Eduardo Francos - InContext - * @created 26 avril 2002 - * @version <$CURRENT_VERSION$> - */ - -public class TextAreaFigure extends AttributeFigure - implements FigureChangeListener, TextHolder { - - /** True if the paragraph's cache needs to be reconstructed */ - protected boolean fTextIsDirty = true; - /** True if the sizing needs to be recalculated */ - protected transient boolean fSizeIsDirty = true; - - /** The current display box for the figure */ - private Rectangle fDisplayBox; - - /** Paragraph cache resulting from splitting the text */ - protected List fParagraphs; - - /** The text */ - protected String fText; - /** The current font */ - protected Font fFont; - /** - * True if the font has changed and font related calculations need to be remade - */ - protected boolean fFontIsDirty = true; - - /** The width of the current font */ - protected float fFontWidth; - /** - * Map of attributes for the AttributedString used for the figure's text. - * Currently it just uses one single attribute with the figure's current font. - */ - protected Hashtable attributesMap = new Hashtable(); - - /** True if the figure is read only */ - protected boolean fIsReadOnly; - - /** A connected figure */ - protected Figure fObservedFigure = null; - /** Description of the Field */ - protected OffsetLocator fLocator = null; - - final static long serialVersionUID = 4993631445423148845L; - - // make sure required default attributes are set - static { - initDefaultAttribute("LeftMargin", new Float(5)); - initDefaultAttribute("RightMargin", new Float(5)); - initDefaultAttribute("TopMargin", new Float(5)); - initDefaultAttribute("TabSize", new Float(8)); - } - - - /** Constructor for the TextAreaFigure object */ - public TextAreaFigure() { - fParagraphs = CollectionsFactory.current().createList(); - fDisplayBox = new Rectangle(0, 0, 30, 15); - fFont = createFont(); - fText = new String(""); - - fSizeIsDirty = true; - fTextIsDirty = true; - fFontIsDirty = true; - } - - - /** - * Gets the text of the figure - * - * @return The text value - */ - public String getText() { - return fText; - } - - - /** - * Sets the text of the figure - * - * @param newText The new text value - */ - public void setText(String newText) { - if (newText == null || !newText.equals(fText)) { - markTextDirty(); - fText = newText; - changed(); - } - } - - /** - * Returns the display box for the text - * - * @return Description of the Return Value - */ - public Rectangle textDisplayBox() { - return displayBox(); - } - - /** - * Creates the font from current attributes. - * - * @return Description of the Return Value - */ - public Font createFont() { - return new Font( - (String)getAttribute("FontName"), - ((Integer)getAttribute("FontStyle")).intValue(), - ((Integer)getAttribute("FontSize")).intValue()); - } - - public boolean isReadOnly() - { - return fIsReadOnly; - } - - public void setReadOnly(boolean newReadOnly) - { - fIsReadOnly = newReadOnly; - } - - /** - * Tests whether the figure accepts typing. - * - * @return Description of the Return Value - */ - public boolean acceptsTyping() { - return !isReadOnly(); - } - - - /** - * Called whenever the something changes that requires text recomputing - */ - protected void markTextDirty() { - setTextDirty(true); - } - - - /** - * Sets the textDirty attribute of the TextAreaFigure object - * - * @param newTextDirty The new textDirty value - */ - protected void setTextDirty(boolean newTextDirty) { - fTextIsDirty = newTextDirty; - } - - - /** - * Gets the textDirty attribute of the TextAreaFigure object - * - * @return The textDirty value - */ - public boolean isTextDirty() { - return fTextIsDirty; - } - - - /** - * Called whenever the something changes that requires size recomputing - */ - protected void markSizeDirty() { - setSizeDirty(true); - } - - - /** - * Called to set the dirty status of the size - * - * @param newSizeIsDirty The new sizeDirty value - */ - public void setSizeDirty(boolean newSizeIsDirty) { - fSizeIsDirty = newSizeIsDirty; - } - - - /** - * Returns the current size dirty status - * - * @return The sizeDirty value - */ - public boolean isSizeDirty() { - return fSizeIsDirty; - } - - /** - * Gets the font. - * - * @return The font value - */ - public Font getFont() { - return fFont; - } - - /** - * Sets the font. - * - * @param newFont The new font value - */ - public void setFont(Font newFont) { - if(newFont == null) { - throw new IllegalArgumentException(); - } - willChange(); - fFont = newFont; - markSizeDirty(); - markFontDirty(); - attributesMap = new Hashtable(1); - attributesMap.put(TextAttribute.FONT, newFont); - changed(); - } - - /** - * Gets the number of columns to be overlaid when the figure is edited.<br> - * This method is mandatory by the TextHolder interface but is not - * used by the TextAreaFigure/TextAreaTool couple because the overlay always - * covers the text area display box - * - * @return the number of overlay columns - */ - public int overlayColumns() { - return 0; - } - - /** - * Sets the display box for the figure - * - * @param origin origin point - * @param corner corner point - * @see Figure - */ - public void basicDisplayBox(Point origin, Point corner) { - Dimension prevSize = fDisplayBox.getSize(); - fDisplayBox = new Rectangle(origin); - fDisplayBox.add(corner); - if (!fDisplayBox.getSize().equals(prevSize)){ - markSizeDirty(); - } - } - - /** - * Returns an iterator of standard sizing handles to manipulate the figure - * - * @return Description of the Return Value - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - return new HandleEnumerator(handles); - } - - /** - * Returns the current display box for the figure - * - * @return Description of the Return Value - */ - public Rectangle displayBox() { - return new Rectangle( - fDisplayBox.x, - fDisplayBox.y, - fDisplayBox.width, - fDisplayBox.height); - } - - - /** - * Moves the figure the supplied offset - * - * @param x x displacement - * @param y y displacement - */ - public void moveBy(int x, int y) { - willChange(); - basicMoveBy(x, y); - if (fLocator != null) { - fLocator.moveBy(x, y); - } - changed(); - } - - /** - * Moves the figure the supplied offset - * - * @param x x displacement - * @param y y displacement - */ - protected void basicMoveBy(int x, int y) { - fDisplayBox.translate(x, y); - } - - /** - * Draws the background for the figure. Called by the superclass with the colors - * set from the current attribute values - * - * @param g The graphics to use for the drawing - */ - public void drawBackground(Graphics g) { - Rectangle r = displayBox(); - g.fillRect(r.x, r.y, r.width, r.height); - } - - /** - * Draws the figure. Overriden so as to draw the text once everything - * else has been drawn - * - * @param g The graphics to use for the drawing - */ - public void draw(Graphics g) { - super.draw(g); - drawText(g, displayBox()); - } - - /** - * Draws the frame around the text - * - * @param g The graphics to use for the drawing - */ - public void drawFrame(Graphics g) { - Rectangle r = displayBox(); - g.setColor((Color)getAttribute("FrameColor")); - g.drawRect(r.x, r.y, r.width, r.height); - } - - - /** - * Formats and draws the text for the figure - * - * @param g the graphics for the drawing. It can be null when - * called just to compute the size - * @param displayBox the display box within which the text should be formatted and drawn - * @return Description of the Return Value - */ - protected float drawText(Graphics g, Rectangle displayBox) { - Graphics2D g2 = null; - Shape savedClipArea = null; - Color savedFontColor = null; - Rectangle2D clipRect = null; - RenderingHints savedRenderingHints = null; - - if (g != null) { - g2 = (Graphics2D)g; - savedRenderingHints = g2.getRenderingHints(); - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - g2.setRenderingHint(RenderingHints.KEY_RENDERING, - RenderingHints.VALUE_RENDER_QUALITY); - //Font savedFont = g2.getFont(); - savedFontColor = g2.getColor(); - savedClipArea = g2.getClip(); - if(savedClipArea != null) { - clipRect = displayBox.createIntersection((Rectangle2D)savedClipArea); - } - else { - clipRect = displayBox; - } - g2.setClip(clipRect); - Color textColor = getTextColor(); - if (!ColorMap.isTransparent(textColor)) { - g2.setColor(textColor); - } - g2.setFont(getFont()); - } - FontRenderContext fontRenderCtx = new FontRenderContext(null, false, false); - - // split the text into paragraphs - prepareText(); - - float leftMargin = displayBox.x + ((Float)getAttribute("LeftMargin")).floatValue(); - float rightMargin = displayBox.x + displayBox.width - ((Float)getAttribute("RightMargin")).floatValue(); - float topMargin = displayBox.y + ((Float)getAttribute("TopMargin")).floatValue(); - - /** - * @todo we prepare stops for 40 tabs which should be enough to handle - * all normal cases, but a better means should/could be implemented - */ - float[] tabStops = new float[40]; - // tabSize is in pixels - float tabSize = ((Float)getAttribute("TabSize")).floatValue() * getFontWidth(); - float tabPos = tabSize; - for (int tabCnt = 0; tabCnt < 40; tabCnt++) { - tabStops[tabCnt] = tabPos + leftMargin; - tabPos += tabSize; - } - - /** Iterate on the paragraphs displaying each one in turn */ - float verticalPos = topMargin; - Iterator paragraphs = fParagraphs.iterator(); - while (paragraphs.hasNext()) { - String paragraphText = (String)paragraphs.next(); - - // prepare tabs. Here we build an array with the character positions - // of the tabs within the paragraph - AttributedString attrText = new AttributedString(paragraphText); - AttributedCharacterIterator paragraphIter = attrText.getIterator(); - int[] tabLocations = new int[paragraphText.length()]; - int tabCount = 0; - for (char c = paragraphIter.first(); c != CharacterIterator.DONE; c = paragraphIter.next()) { - if (c == '\t') { - tabLocations[tabCount++] = paragraphIter.getIndex(); - } - } - tabLocations[tabCount] = paragraphIter.getEndIndex() - 1; - - // tabs done. Replace tab characters with spaces. This to avoid - // a strange behaviour where the layout is a lot slower and - // the font get's changed. If anybody knows why this so please - // tell me. - paragraphText = paragraphText.replace('\t', ' '); - attrText = new AttributedString(paragraphText, attributesMap); - paragraphIter = attrText.getIterator(); - - // Now tabLocations has an entry for every tab's offset in - // the text. For convenience, the last entry in tabLocations - // is the offset of the last character in the text. - - LineBreakMeasurer measurer = new LineBreakMeasurer(paragraphIter, fontRenderCtx); - int currentTab = 0; - - while (measurer.getPosition() < paragraphIter.getEndIndex()) { - // Lay out and draw each line. All segments on a line - // must be computed before any drawing can occur, since - // we must know the largest ascent on the line. - // TextLayouts are computed and stored in a collection; - // their horizontal positions are stored in a parallel - // collection. - - // lineContainsText is true after first segment is drawn - boolean lineContainsText = false; - boolean lineComplete = false; - float maxAscent = 0; - float maxDescent = 0; - float horizontalPos = leftMargin; - List layouts = CollectionsFactory.current().createList(1); - List penPositions = CollectionsFactory.current().createList(1); - - while (!lineComplete) { - float wrappingWidth = rightMargin - horizontalPos; - // ensure wrappingWidth is at least 1 - wrappingWidth = Math.max(1, wrappingWidth); - TextLayout layout = - measurer.nextLayout(wrappingWidth, - tabLocations[currentTab] + 1, - lineContainsText); - - // layout can be null if lineContainsText is true - if (layout != null) { - layouts.add(layout); - penPositions.add(new Float(horizontalPos)); - horizontalPos += layout.getAdvance(); - maxAscent = Math.max(maxAscent, layout.getAscent()); - maxDescent = Math.max(maxDescent, - layout.getDescent() + layout.getLeading()); - } - else { - lineComplete = true; - } - - lineContainsText = true; - - if (measurer.getPosition() == tabLocations[currentTab] + 1) { - currentTab++; - } - - if (measurer.getPosition() == paragraphIter.getEndIndex()) { - lineComplete = true; - } - else if (horizontalPos >= tabStops[tabStops.length - 1]) { - lineComplete = true; - } - - if (!lineComplete) { - // move to next tab stop - int j; - for (j = 0; horizontalPos >= tabStops[j]; j++) { - } - horizontalPos = tabStops[j]; - } - } - - // set the vertical position for the line - verticalPos += maxAscent; - - // now iterate through layouts and draw them - Iterator layoutEnum = layouts.iterator(); - Iterator positionEnum = penPositions.iterator(); - while (layoutEnum.hasNext()) { - TextLayout nextLayout = (TextLayout)layoutEnum.next(); - Float nextPosition = (Float)positionEnum.next(); - if (g2 != null) { - nextLayout.draw(g2, nextPosition.floatValue(), verticalPos); - } - } - - // keep track of the highest (actually lowest) position for the - // next iteration - verticalPos += maxDescent; - } - } - - // if the last displayed line is not visible because the displayBox is - // too small then draw a dashed red line at the bottom - if (g2 != null && verticalPos > clipRect.getMaxY() && clipRect.getMaxY() == displayBox.getMaxY()) { - Stroke savedStroke = g2.getStroke(); - float[] dash = new float[2]; - dash[0] = 2f; - dash[1] = 4f; - g2.setStroke(new BasicStroke( - 1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, - 1f, dash, 0f)); - g2.setColor(Color.red); - g2.drawLine((int)clipRect.getMinX() + 1, (int)clipRect.getMaxY() - 1, - (int)clipRect.getMaxX() - 1, (int)clipRect.getMaxY() - 1); - g2.setStroke(savedStroke); - } - - // restore saved graphic attributes - if (g2 != null) { - if(savedClipArea != null) { - g2.setClip(savedClipArea); - } - g2.setColor(savedFontColor); - g2.setRenderingHints(savedRenderingHints); - } - - // and return the final text height - return verticalPos; - } - - /** - * Splits the text into paragraphs. A paragraph is delimited by a LF or CRLF. - * If the paragraph is empty it returns a single space so the display logic has - * something to work with - */ - protected void prepareText() { - if (!isTextDirty()) { - return; - } - - fParagraphs = CollectionsFactory.current().createList(); - String paragraphText; - Point pos = new Point(-1, -1); - - while ((paragraphText = getNextParagraph(fText, pos)) != null) { - if (paragraphText.length() == 0) { - paragraphText = " "; - } - fParagraphs.add(paragraphText); - } - setTextDirty(false); - } - - /** - * Gets the next paragraph in the supplied string<br> - * Paragraphs are defined by a LF or CRLF sequence<br> - * Scanning starts from the next characters as given by the pos.y value - * - * @param text the text to break into paragraphs - * @param pos a point where pos.x is the position of the first character of the paragraph in - * the string and pos.y is the last - * @return The text for the paragraph - */ - protected String getNextParagraph(String text, Point pos) { - int start = pos.y + 1; - - if (start >= text.length()) { - return null; - } - pos.x = start; - - int end = text.indexOf('\n', start); - if (end == -1) { - end = text.length(); - } - pos.y = end; - // check for "\r\n" sequence - if (text.charAt(end - 1) == '\r') { - return text.substring(start, end - 1); - } - else { - return text.substring(start, end); - } - } - - /** - * A text area figure uses the "LeftMargin", "RightMargin", "TopMargin", - * "TabSize", "FontSize", "FontStyle", and "FontName" attributes - * - * @param name the attribute's name - * @return the attribute value - * @deprecated use getAttribute(FigureAttributeConstant) - */ - public Object getAttribute(String name) { - return super.getAttribute(name); - } - - - /** - * A text area figure uses the "LeftMargin", "RightMargin", - * "TopMargin", "TabSize", "FontSize", "FontStyle", and "FontName" - * attributes - * - * @param name the new attribute name - * @param value the new attribute value - * @deprecated use setAttribute(FigureAttributeConstant, Object) - */ - public void setAttribute(String name, Object value) { - // we need to create a new font if one of the font attributes - Font font = getFont(); - if (name.equals("FontSize")) { - Integer s = (Integer)value; - setFont(new Font(font.getName(), font.getStyle(), s.intValue())); - // store the attribute - super.setAttribute(name, value); - } - else if (name.equals("FontStyle")) { - Integer s = (Integer)value; - int style = font.getStyle(); - if (s.intValue() == Font.PLAIN) { - style = Font.PLAIN; - } - else { - style = style ^ s.intValue(); - } - setFont(new Font(font.getName(), style, font.getSize())); - // store the attribute - super.setAttribute(name, new Integer(style)); - } - else if (name.equals("FontName")) { - String n = (String)value; - setFont(new Font(n, font.getStyle(), font.getSize())); - // store the attribute - super.setAttribute(name, value); - } - else { - // store the attribute - super.setAttribute(name, value); - } - } - - /** - * Writes the figure to StorableOutput - * - * @param dw the output storable - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fDisplayBox.x); - dw.writeInt(fDisplayBox.y); - dw.writeInt(fDisplayBox.width); - dw.writeInt(fDisplayBox.height); - dw.writeString(fText); - dw.writeBoolean(fIsReadOnly); - dw.writeStorable(fObservedFigure); - dw.writeStorable(fLocator); - } - - /** - * Reads the figure from StorableInput - * - * @param dr Description of the Parameter - * @throws IOException the inout storable - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - - markSizeDirty(); - markTextDirty(); - markFontDirty(); - - fDisplayBox.x = dr.readInt(); - fDisplayBox.y = dr.readInt(); - fDisplayBox.width = dr.readInt(); - fDisplayBox.height = dr.readInt(); - fText = dr.readString(); - fIsReadOnly = dr.readBoolean(); - - fObservedFigure = (Figure)dr.readStorable(); - if (fObservedFigure != null) { - fObservedFigure.addFigureChangeListener(this); - } - fLocator = (OffsetLocator)dr.readStorable(); - - setFont(createFont()); - } - - /** - * Reads the figure from an object stream - * - * @param s the input stream - * @throws ClassNotFoundException thrown by called methods - * @throws IOException thrown by called methods - */ - protected void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - - if (fObservedFigure != null) { - fObservedFigure.addFigureChangeListener(this); - } - markSizeDirty(); - markTextDirty(); - markFontDirty(); - } - - /** - * Connects the figure to another figure - * - * @param figure the connecting figure - */ - public void connect(Figure figure) { - if (fObservedFigure != null) { - fObservedFigure.removeFigureChangeListener(this); - } - - fObservedFigure = figure; - fLocator = new OffsetLocator(figure.connectedTextLocator(this)); - fObservedFigure.addFigureChangeListener(this); - updateLocation(); - } - - /** - * Disconnects a text holder from a connect figure. - * - * @param disconnectFigure the disconnecting figure - */ - public void disconnect(Figure disconnectFigure) { - if (disconnectFigure != null) { - disconnectFigure.removeFigureChangeListener(this); - } - fLocator = null; - } - - /** - * Description of the Method - * @todo Implement this CH.ifa.draw.framework.FigureChangeListener method - * - * @param e Description of the Parameter - */ - public void figureInvalidated(FigureChangeEvent e) { - } - - /** - * A connected figure has changed, update the figure's location - * - * @param e Description of the Parameter - */ - public void figureChanged(FigureChangeEvent e) { - updateLocation(); - } - - /** - * Updates the location relative to the connected figure. - * The TextAreaFigure is centered around the located point. - */ - protected void updateLocation() { - if (fLocator != null) { - Point p = fLocator.locate(fObservedFigure); - - p.x -= size().width / 2 + fDisplayBox.x; - p.y -= size().height / 2 + fDisplayBox.y; - if (p.x != 0 || p.y != 0) { - willChange(); - basicMoveBy(p.x, p.y); - changed(); - } - } - } - - /** - * The figure is about to be removed from another composite figure - * - * @param e Description of the Parameter - */ - public void figureRemoved(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRemoved(new FigureChangeEvent(this)); - } - } - - /** - * A request to remove the figure from another composite figure - * - * @param e Description of the Parameter - */ - public void figureRequestRemove(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRequestRemove(new FigureChangeEvent(this)); - } - } - - /** - * @param e Description of the Parameter - */ - public void figureRequestUpdate(FigureChangeEvent e) { - // @todo: Implement this CH.ifa.draw.framework.FigureChangeListener method - } - - /** - * Gets the font width for the active font. This is by convention the width of - * the 'W' character, the widest one - * - * @return The fontWidth value - */ - protected float getFontWidth() { - updateFontInfo(); - return fFontWidth; - } - - /** Retrieve all Font information needed */ - protected void updateFontInfo() { - if (!isFontDirty()) { - return; - } - fFontWidth = (int) getFont().getMaxCharBounds(new FontRenderContext(null, false, false)).getWidth(); - - setFontDirty(false); - } - - /** - * Gets the text color of a figure. This is a convenience - * method. - * - * @return The textColor value - * @see #getAttribute - */ - public Color getTextColor() { - return (Color)getAttribute("TextColor"); - } - - /** - * Gets the empty attribute of the figure. True if there is no text - * - * @return The empty value - */ - public boolean isEmpty() { - return (fText.length() == 0); - } - - /** - * Called whenever the something changes that requires font recomputing - */ - protected void markFontDirty() { - setFontDirty(true); - } - - /** - * Gets the fontDirty attribute of the TextAreaFigure object - * - * @return The fontDirty value - */ - public boolean isFontDirty() { - return fFontIsDirty; - } - - /** - * Sets the fontDirty attribute of the TextAreaFigure object - * - * @param newFontIsDirty The new fontDirty value - */ - public void setFontDirty(boolean newFontIsDirty) { - fFontIsDirty = newFontIsDirty; - } - - /** - * Usually, a TextHolders is implemented by a Figure subclass. To avoid casting - * a TextHolder to a Figure this method can be used for polymorphism (in this - * case, let the (same) object appear to be of another type). - * Note, that the figure returned is not the figure to which the TextHolder is - * (and its representing figure) connected. - * @return figure responsible for representing the content of this TextHolder - */ - public Figure getRepresentingFigure() { - return this; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/TextAreaTool.java b/JHotDraw/src/CH/ifa/draw/contrib/TextAreaTool.java deleted file mode 100644 index 0517da70998781aa819457a447cf8fb74d00e333..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/TextAreaTool.java +++ /dev/null @@ -1,445 +0,0 @@ -/* - * @(#)TextAreaTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.standard.CreationTool; -import CH.ifa.draw.standard.SingleFigureEnumerator; -import CH.ifa.draw.standard.TextHolder; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; - -import java.awt.Container; -import java.awt.Font; -import java.awt.Rectangle; -import java.awt.event.MouseEvent; - -/** - * A TextAreaTool creates TextAreaFigures.<br> - * To create a new text area, the user drags a rectangle on the drawing on - * a free spot.<br> - * When releasing the mouse the tool calls the area's editor to enter the text.<br> - * If the tool is clicked on an existing area the tool simply calls the - * area's editor.<br> - * When creating a new area, if the user leaves the text empty, the newly created - * area figure is discarded. - * - * @author Eduardo Francos - InContext - * @created 29 april 2002 - * @version 1.0 - */ -public class TextAreaTool extends CreationTool { - /** The field used for editing */ - protected FloatingTextArea fTextField; - - /** The typing target */ - protected TextHolder fTypingTarget; - /** The edited figure */ - protected Figure fEditedFigure; - - /** - * Constructor for the TextAreaTool object - * - * @param newDrawingEditor the managing drawing editor - * @param prototype the prototype for the figure - */ - public TextAreaTool(DrawingEditor newDrawingEditor, Figure prototype) { - super(newDrawingEditor, prototype); - } - - /** - * If the pressed figure is a TextHolder and it accepts editing it can be edited.<br> - * If there is no pressed figure a new text figure is created. - * - * @param e Description of the Parameter - * @param x Description of the Parameter - * @param y Description of the Parameter - */ - public void mouseDown(MouseEvent e, int x, int y) { - setView((DrawingView)e.getSource()); - Figure pressedFigure = drawing().findFigureInside(x, y); - TextHolder textHolder = null; - if (pressedFigure != null) { - textHolder = pressedFigure.getTextHolder(); - } - - if ((textHolder != null) && (textHolder.acceptsTyping())) { - beginEdit(textHolder, pressedFigure); - return; - } - if (getTypingTarget() != null) { - endEdit(); - - if (getCreatedFigure() != null && getCreatedFigure().isEmpty()) { - drawing().remove(getAddedFigure()); - // nothing to undo - setUndoActivity(null); - } - else { -// // use undo activity from paste command... -// setUndoActivity(createUndoActivity()); -// -// // put created figure into a figure enumeration -// getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure())); - } - setTypingTarget(null); - setCreatedFigure(null); - setEditedFigure(null); - setAddedFigure(null); - editor().toolDone(); - } - else { - super.mouseDown(e, x, y); - } - } - - /** - * Drags to set the initial text area display box - * - * @param e Description of the Parameter - * @param x Description of the Parameter - * @param y Description of the Parameter - */ - public void mouseDrag(MouseEvent e, int x, int y) { - // if not creating just ignore - if (getCreatedFigure() == null) { - return; - } - super.mouseDrag(e, x, y); - } - - /** - * If creating a figure it ends the creation process and calls the editor - * - * @param e Description of the Parameter - * @param x Description of the Parameter - * @param y Description of the Parameter - */ - public void mouseUp(MouseEvent e, int x, int y) { - // if not creating just ignore - if (getCreatedFigure() == null) { - return; - } - - // update view so the created figure is drawn before the floating text - // figure is overlaid. (Note, fDamage should be null in StandardDrawingView - // when the overlay figure is drawn because a JTextField cannot be scrolled) - view().checkDamage(); - TextHolder textHolder = (TextHolder)getCreatedFigure(); - if (textHolder.acceptsTyping()) { - beginEdit(textHolder, getCreatedFigure()); - } - else { - editor().toolDone(); - } - } - - /** - * Terminates the editing of a text figure. - */ - public void deactivate() { - endEdit(); - super.deactivate(); - } - - /** - * Activates the figure's editor - */ - public void activate() { - super.activate(); - getActiveView().clearSelection(); - } - - /** - * Test whether the text tool is currently activated and is displaying - * a overlay TextFigure for accepting input. - * - * @return true, if the text tool has a accepting target TextFigure for its input, false otherwise - */ - public boolean isActivated() { - return getTypingTarget() != null; - } - - /** - * Begins editing the figure's text - * - * @param figure the typing target - * @param selectedFigure the edited figure - */ - protected void beginEdit(TextHolder figure, Figure selectedFigure) { - if (fTextField == null) { - fTextField = new FloatingTextArea(); - } - - if (figure != getTypingTarget() && getTypingTarget() != null) { - endEdit(); - } - - fTextField.createOverlay((Container)view(), getFont(figure)); - fTextField.setBounds(fieldBounds(figure), figure.getText()); - - setTypingTarget(figure); - setEditedFigure(selectedFigure); - setUndoActivity(createUndoActivity()); - } - - /** - * Gets the font to be used for editing the figure - * - * @param figure the figure - * @return The font - */ - protected Font getFont(TextHolder figure) { - return figure.getFont(); - } - - /** Ends editing of the figure's text */ - protected void endEdit() { - if ((getTypingTarget() != null) && (fTextField != null)) { - if (fTextField.getText().length() > 0) { - getTypingTarget().setText(fTextField.getText()); - // put created figure into a figure enumeration - getUndoActivity().setAffectedFigures( - new SingleFigureEnumerator(getEditedFigure())); - ((TextAreaTool.UndoActivity)getUndoActivity()).setBackupText( - getTypingTarget().getText()); - } - else { - drawing().orphan(getAddedFigure()); - // nothing to undo -// setUndoActivity(null); - } - - fTextField.endOverlay(); - fTextField = null; -// view().checkDamage(); - } - } - - /** - * Returns the bounds fo the figure - * - * @param figure the edited figure - * @return Description of the Return Value - */ - private Rectangle fieldBounds(TextHolder figure) { - return figure.textDisplayBox(); - } - - /** - * Sets the typingTarget attribute of the TextAreaTool - * - * @param newTypingTarget The new typingTarget value - */ - protected void setTypingTarget(TextHolder newTypingTarget) { - fTypingTarget = newTypingTarget; - } - - /** - * Gets the editedFigure attribute of the TextAreaTool - * - * @return The editedFigure value - */ - protected Figure getEditedFigure() { - return fEditedFigure; - } - - /** - * Sets the editedFigure attribute of the TextAreaTool - * - * @param figure The new editedFigure value - */ - protected void setEditedFigure(Figure figure) { - fEditedFigure = figure; - } - - /** - * Gets the typingTarget attribute of the TextAreaTool - * - * @return The typingTarget value - */ - protected TextHolder getTypingTarget() { - return fTypingTarget; - } - - /** - * Factory method for undo activity - * - * @return Description of the Return Value - */ - protected Undoable createUndoActivity() { - return new TextAreaTool.UndoActivity(view(), getTypingTarget().getText()); - } - - /** - * Handles undo/redo for text areas - * - * @author gualo - */ - public static class UndoActivity extends UndoableAdapter { - /** The original text */ - private String myOriginalText; - /** The backup text */ - private String myBackupText; - - /** - * Constructor for the UndoActivity object - * - * @param newDrawingView Description of the Parameter - * @param newOriginalText Description of the Parameter - */ - public UndoActivity(DrawingView newDrawingView, String newOriginalText) { - super(newDrawingView); - setOriginalText(newOriginalText); - setUndoable(true); - setRedoable(true); - } - - /* - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - /** - * Undo the activity - * - * @return Description of the Return Value - */ - public boolean undo() { - if (!super.undo()) { - return false; - } - - getDrawingView().clearSelection(); - - if (!isValidText(getOriginalText())) { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - getDrawingView().drawing().orphan(fe.nextFigure()); - } - } - // add text figure if it has been removed (no backup text) - else if (!isValidText(getBackupText())) { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - getDrawingView().add(fe.nextFigure()); - } - setText(getOriginalText()); - } - else { - setText(getOriginalText()); - } - - return true; - } - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - /** - * Redo the activity - * - * @return Description of the Return Value - */ - public boolean redo() { - if (!super.redo()) { - return false; - } - - getDrawingView().clearSelection(); - - // the text figure did exist but was remove - if (!isValidText(getBackupText())) { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - getDrawingView().drawing().orphan(fe.nextFigure()); - } - } - // the text figure didn't exist before - else if (!isValidText(getOriginalText())) { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - getDrawingView().drawing().add(fe.nextFigure()); - setText(getBackupText()); - } - } - else { - setText(getBackupText()); - } - - return true; - } - - /** - * Validates the text in the undo activity - * - * @param toBeChecked Description of the Parameter - * @return The validText value - */ - protected boolean isValidText(String toBeChecked) { - return ((toBeChecked != null) && (toBeChecked.length() > 0)); - } - - /** - * Sets the text attribute of the UndoActivity - * - * @param newText The new text value - */ - protected void setText(String newText) { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - if (currentFigure.getTextHolder() != null) { - currentFigure.getTextHolder().setText(newText); - } - } - } - - /** - * Sets the backupText attribute of the UndoActivity - * - * @param newBackupText The new backupText value - */ - public void setBackupText(String newBackupText) { - myBackupText = newBackupText; - } - - /** - * Gets the backupText attribute of the UndoActivity - * - * @return The backupText value - */ - public String getBackupText() { - return myBackupText; - } - - /** - * Sets the originalText attribute of the UndoActivity - * - * @param newOriginalText The new originalText value - */ - public void setOriginalText(String newOriginalText) { - myOriginalText = newOriginalText; - } - - /** - * Gets the originalText attribute of the UndoActivity - * - * @return The originalText value - */ - public String getOriginalText() { - return myOriginalText; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/TriangleFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/TriangleFigure.java deleted file mode 100644 index b56f96bba000cdc0caccbfa0539f59a831e34c0e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/TriangleFigure.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * @(#)TriangleFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.framework.HandleEnumeration; -import CH.ifa.draw.standard.HandleEnumerator; - -import java.awt.*; -import java.util.List; -import java.io.IOException; - -/** - * A triangle with same dimensions as its enclosing rectangle, - * and apex at any of 8 places - * - * @author Doug Lea (dl at gee, Tue Feb 25 17:30:58 1997) - * @version <$CURRENT_VERSION$> - */ -public class TriangleFigure extends RectangleFigure { - - static double[] rotations = { - -Math.PI/2, -Math.PI/4, - 0.0, Math.PI/4, - Math.PI/2, Math.PI * 3/4, - Math.PI, -Math.PI * 3/4 - }; - - private int fRotation = 0; - - public TriangleFigure() { - super(new Point(0,0), new Point(0,0)); - } - - public TriangleFigure(Point origin, Point corner) { - super(origin, corner); - } - - public HandleEnumeration handles() { - List h = super.handles().toList(); - h.add(new TriangleRotationHandle(this)); - return new HandleEnumerator(h); - } - - public void rotate(double angle) { - willChange(); - double dist = Double.MAX_VALUE; - int best = 0; - for (int i = 0; i < rotations.length; ++i) { - double d = Math.abs(angle - rotations[i]); - if (d < dist) { - dist = d; - best = i; - } - } - fRotation = best; - changed(); - } - - /** Return the polygon describing the triangle **/ - public Polygon getPolygon() { - Rectangle r = displayBox(); - Polygon p = new Polygon(); - switch (fRotation) { - case 0: - p.addPoint(r.x + r.width/2, r.y); - p.addPoint(r.x + r.width, r.y + r.height); - p.addPoint(r.x, r.y + r.height); - break; - case 1: - p.addPoint(r.x + r.width, r.y); - p.addPoint(r.x + r.width, r.y + r.height); - p.addPoint(r.x, r.y); - break; - case 2: - p.addPoint(r.x + r.width, r.y + r.height/2); - p.addPoint(r.x, r.y + r.height); - p.addPoint(r.x, r.y); - break; - case 3: - p.addPoint(r.x + r.width, r.y + r.height); - p.addPoint(r.x, r.y + r.height); - p.addPoint(r.x + r.width, r.y); - break; - case 4: - p.addPoint(r.x + r.width/2, r.y + r.height); - p.addPoint(r.x, r.y); - p.addPoint(r.x + r.width, r.y); - break; - case 5: - p.addPoint(r.x, r.y + r.height); - p.addPoint(r.x, r.y); - p.addPoint(r.x + r.width, r.y + r.height); - break; - case 6: - p.addPoint(r.x, r.y + r.height/2); - p.addPoint(r.x + r.width, r.y); - p.addPoint(r.x + r.width, r.y + r.height); - break; - case 7: - p.addPoint(r.x, r.y); - p.addPoint(r.x + r.width, r.y); - p.addPoint(r.x, r.y + r.height); - break; - } - return p; - } - - - public void draw(Graphics g) { - Polygon p = getPolygon(); - g.setColor(getFillColor()); - g.fillPolygon(p); - g.setColor(getFrameColor()); - g.drawPolygon(p); - } - - public Insets connectionInsets() { - Rectangle r = displayBox(); - switch(fRotation) { - case 0: - return new Insets(r.height, r.width/2, 0, r.width/2); - case 1: - return new Insets(0, r.width, r.height, 0); - case 2: - return new Insets(r.height/2, 0, r.height/2, r.width); - case 3: - return new Insets(r.height, r.width, 0, 0); - case 4: - return new Insets(0, r.width/2, r.height, r.width/2); - case 5: - return new Insets(r.height, 0, 0, r.width); - case 6: - return new Insets(r.height/2, r.width, r.height/2, 0); - case 7: - return new Insets(0, 0, r.height, r.width); - default: - return null; - } - } - - public boolean containsPoint(int x, int y) { - return getPolygon().contains(x, y); - } - - public Point center() { - return PolygonFigure.center(getPolygon()); - } - - public Point chop(Point p) { - return PolygonFigure.chop(getPolygon(), p); - } - - public Object clone() { - TriangleFigure figure = (TriangleFigure) super.clone(); - figure.fRotation = fRotation; - return figure; - } - - public double getRotationAngle() { - return rotations[fRotation]; - } - - //-- store / load ---------------------------------------------- - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fRotation); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fRotation = dr.readInt(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/TriangleRotationHandle.java b/JHotDraw/src/CH/ifa/draw/contrib/TriangleRotationHandle.java deleted file mode 100644 index 25b351284118b145e9d2c748b2be5c8a17f54e64..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/TriangleRotationHandle.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * @(#)TriangleRotationHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.standard.*; - - -/** - * A Handle to rotate a TriangleFigure - * Based on RadiusHandle - * - * @author Doug Lea (dl at gee, Sun Mar 2 19:15:28 1997) - * @version <$CURRENT_VERSION$> - */ -class TriangleRotationHandle extends AbstractHandle { - - private Point fOrigin; - - public TriangleRotationHandle(TriangleFigure owner) { - super(owner); - } - - /** - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @param view the handles container - */ - public void invokeStart(int x, int y, DrawingView view) { - fOrigin = getOrigin(); - TriangleRotationHandle.UndoActivity activity = - (TriangleRotationHandle.UndoActivity)createUndoActivity(view); - setUndoActivity(activity); - activity.setAffectedFigures(new SingleFigureEnumerator(owner())); - double rotation = ((TriangleFigure)(owner())).getRotationAngle(); - activity.setRotationAngle(rotation); - } - - /** - * Tracks a step of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - */ - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Point fCenter = owner().center(); - double angle = Math.atan2(fOrigin.y + y - anchorY - fCenter.y, - fOrigin.x + x - anchorX - fCenter.x); - ((TriangleFigure)(owner())).rotate(angle); - } - - /** - * Tracks the end of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - fOrigin = null; - } - - public Point locate() { - return getOrigin(); - } - - Point getOrigin() { - // find a nice place to put handle - // almost same code as PolygonScaleHandle - Polygon p = ((TriangleFigure)(owner())).getPolygon(); - Point first = new Point(p.xpoints[0], p.ypoints[0]); - Point ctr = owner().center(); - double len = Geom.length(first.x, first.y, ctr.x, ctr.y); - if (len == 0) { // best we can do? - return new Point(first.x - HANDLESIZE/2, first.y + HANDLESIZE/2); - } - - double u = HANDLESIZE / len; - if (u > 1.0) { // best we can do? - return new Point((first.x * 3 + ctr.x)/4, (first.y * 3 + ctr.y)/4); - } - else { - return new Point((int)(first.x * (1.0 - u) + ctr.x * u), - (int)(first.y * (1.0 - u) + ctr.y * u)); - } - } - - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.yellow); - g.fillOval(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawOval(r.x, r.y, r.width, r.height); - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected Undoable createUndoActivity(DrawingView newView) { - return new TriangleRotationHandle.UndoActivity(newView); - } - - public static class UndoActivity extends UndoableAdapter { - private double myRotationAngle; - - public UndoActivity(DrawingView newView) { - super(newView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - return resetRotationAngle(); - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - return resetRotationAngle(); - } - - protected boolean resetRotationAngle() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - TriangleFigure figure = (TriangleFigure)fe.nextFigure(); - double backupAngle = figure.getRotationAngle(); - figure.willChange(); - figure.rotate(getRotationAngle()); - figure.changed(); - setRotationAngle(backupAngle); - return true; - } - - protected void setRotationAngle(double newRotationAngle) { - myRotationAngle = newRotationAngle; - } - - public double getRotationAngle() { - return myRotationAngle; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/WindowMenu.java b/JHotDraw/src/CH/ifa/draw/contrib/WindowMenu.java deleted file mode 100644 index 9560bee823b7c4b81e6f85e6744012689a72df33..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/WindowMenu.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @(#)WindowMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyVetoException; - -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JInternalFrame; -import javax.swing.event.MenuEvent; -import javax.swing.event.MenuListener; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.standard.AbstractCommand; -import CH.ifa.draw.util.Command; -import CH.ifa.draw.util.CommandMenu; - -/** - * Menu component that handles the functionality expected of a standard - * "Windows" menu for MDI applications. - * - * @author Wolfram Kaiser (adapted from an article in JavaWorld) - * @version <$CURRENT_VERSION$> - */ -public class WindowMenu extends CommandMenu { - private MDIDesktopPane desktop; - private Command cascadeCommand; - private Command tileCommand; - - public WindowMenu(String newText, MDIDesktopPane newDesktop, DrawingEditor newEditor) { - super(newText); - this.desktop = newDesktop; - cascadeCommand = new AbstractCommand("Cascade", newEditor) { - public void execute() { - WindowMenu.this.desktop.cascadeFrames(); - } - public boolean isExecutable() { - return super.isExecutable() && (WindowMenu.this.desktop.getAllFrames().length > 0); - } - }; - tileCommand = new AbstractCommand("Tile", newEditor) { - public void execute() { - WindowMenu.this.desktop.tileFramesHorizontally(); - } - public boolean isExecutable() { - return super.isExecutable() && (WindowMenu.this.desktop.getAllFrames().length > 0); - } - }; - addMenuListener(new MenuListener() { - public void menuCanceled (MenuEvent e) {} - - public void menuDeselected (MenuEvent e) { - removeAll(); - } - - public void menuSelected (MenuEvent e) { - buildChildMenus(); - } - }); - } - - /* Sets up the children menus depending on the current desktop state */ - private void buildChildMenus() { - ChildMenuItem menu; - JInternalFrame[] array = desktop.getAllFrames(); - - add(new CommandMenuItem(cascadeCommand)); - add(new CommandMenuItem(tileCommand)); - if (array.length > 0) { - addSeparator(); - } -// cascade.setEnabled(array.length > 0); -// tile.setEnabled(array.length > 0); - - for (int i = 0; i < array.length; i++) { - menu = new ChildMenuItem(array[i]); - menu.setState(i == 0); - menu.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - JInternalFrame frame = ((ChildMenuItem)ae.getSource()).getFrame(); - frame.moveToFront(); - try { - frame.setSelected(true); - } - catch (PropertyVetoException e) { - e.printStackTrace(); - } - } - }); - menu.setIcon(array[i].getFrameIcon()); - add(menu); - } - } - - /* This JCheckBoxMenuItem descendant is used to track the child frame that corresponds - to a give menu. */ - class ChildMenuItem extends JCheckBoxMenuItem { - private JInternalFrame frame; - - public ChildMenuItem(JInternalFrame newFrame) { - super(newFrame.getTitle()); - frame=newFrame; - } - - public JInternalFrame getFrame() { - return frame; - } - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDFigures.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDFigures.java deleted file mode 100644 index 8c2a904488345b2c043fc819a01517ca9e6d48de..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDFigures.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * @(#)DNDFigures.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.dnd; - -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.standard.FigureEnumerator; -import CH.ifa.draw.util.CollectionsFactory; - -import java.awt.Point; -import java.util.List; - -/** - * @author C.L.Gilbert <dnoyeb@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class DNDFigures implements java.io.Serializable { - private List figures; - private Point origin; - - public DNDFigures(FigureEnumeration fe, Point newOrigin) { - this.figures = CollectionsFactory.current().createList(); - // copy figure enumeration because enumerations should not be fields - //the drop operation will serialize and deseralize which I believe is a form of copy!? - while (fe.hasNextFigure()) { - figures.add(fe.nextFigure()); - } - origin = newOrigin; - } - - public FigureEnumeration getFigures() { - return new FigureEnumerator(figures); - } - - public Point getOrigin() { - return origin; - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDFiguresTransferable.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDFiguresTransferable.java deleted file mode 100644 index 9ae944a1a00afb0f8acd3a1a0c3712d3feebaf3d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDFiguresTransferable.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * @(#)DNDFiguresTransferable.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.dnd; - -import java.awt.datatransfer.*; -import java.io.*; - -/** - * @author C.L.Gilbert <dnoyeb@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class DNDFiguresTransferable implements Transferable , Serializable { - public static DataFlavor DNDFiguresFlavor = new DataFlavor(DNDFigures.class,"DNDFigures"); - private Object o; - - public DNDFiguresTransferable(Object newObject) { - //if object is not serializable throw exception - o = newObject; - } - public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor [] {DNDFiguresFlavor }; - } - - public boolean isDataFlavorSupported(DataFlavor flavor) { - return flavor.equals(DNDFiguresFlavor); - } - - public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - if ( isDataFlavorSupported(flavor) == false) { - throw new UnsupportedFlavorException( flavor ); - } - return o; - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDHelper.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDHelper.java deleted file mode 100644 index 709778aea1c5041831e0e2b377da54476fda6a54..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDHelper.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * @(#)DNDHelper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.dnd; - -import CH.ifa.draw.framework.*; - -import java.awt.Component; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.datatransfer.Transferable; -import java.awt.dnd.*; -import java.io.*; -import java.util.List; - -/** - * Changes made in hopes of eventually cleaning up the functionality and - * distributing it sensibly. 1/10/02 - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public abstract class DNDHelper { - public static DataFlavor ASCIIFlavor = new DataFlavor("text/plain; charset=ascii", "ASCII text"); - private DragGestureRecognizer dgr; - private DragGestureListener dragGestureListener; - private DropTarget dropTarget; - private DragSourceListener dragSourceListener; - private DropTargetListener dropTargetListener; - private boolean isDragSource = false; - private boolean isDropTarget = false; - - public DNDHelper(boolean newIsDragSource, boolean newIsDropTarget){ - isDragSource = newIsDragSource; - isDropTarget = newIsDropTarget; - } - /** - * Do not call this from the constructor. its methods are overridable. - */ - public void initialize(DragGestureListener dgl) { - if (isDragSource) { - setDragGestureListener(dgl); - setDragSourceListener(createDragSourceListener()); - setDragGestureRecognizer(createDragGestureRecognizer(getDragGestureListener())); - } - if (isDropTarget) { - setDropTargetListener(createDropTargetListener()); - setDropTarget(createDropTarget()); - } - } - - public void deinitialize(){ - if (getDragSourceListener() != null) { - destroyDragGestreRecognizer(); - setDragSourceListener(null); - } - if (getDropTargetListener() != null) { - setDropTarget(null); - setDropTargetListener(null); - } - } -// public void setDragSourceState(boolean state) { -// if(state == false){ -// getDragGestureRecognizer().setSourceActions(DnDConstants.ACTION_NONE); -// } -// else { -// getDragGestureRecognizer().setSourceActions(getDragSourceActions()); -// } -// } - protected abstract DrawingView view(); - protected abstract DrawingEditor editor(); - - protected static Object processReceivedData(DataFlavor flavor, Transferable transferable) { - Object receivedData = null; - if (transferable == null) { - return null; - } - - try { - if (flavor.equals(DataFlavor.stringFlavor)) { - receivedData = transferable.getTransferData(DataFlavor.stringFlavor); - } - else if (flavor.equals(DataFlavor.javaFileListFlavor)) { - List aList = (List)transferable.getTransferData(DataFlavor.javaFileListFlavor); - File fList [] = new File[aList.size()]; - aList.toArray(fList); - receivedData = fList; - } - else if (flavor.equals(ASCIIFlavor)) { - /* this may be too much work for locally received data */ - InputStream is = (InputStream)transferable.getTransferData(ASCIIFlavor); - int length = is.available(); - byte[] bytes = new byte[length]; - int n = is.read(bytes); - if (n > 0) { - /* seems to be a 0 tacked on the end of Windows strings. I - * havent checked other platforms. This does not happen - * with windows socket io. strange? - */ - //for (int i = 0; i < length; i++) { - // if (bytes[i] == 0) { - // length = i; - // break; - // } - //} - receivedData = new String(bytes, 0, n); - } - } - else if (flavor.equals(DNDFiguresTransferable.DNDFiguresFlavor)) { - receivedData = transferable.getTransferData(DNDFiguresTransferable.DNDFiguresFlavor); - } - } - catch (java.io.IOException ioe) { - System.err.println(ioe); - } - catch (UnsupportedFlavorException ufe) { - System.err.println(ufe); - } - catch (ClassCastException cce) { - System.err.println(cce); - } - - return receivedData; - } - - /** - * This must reflect the capabilities of the dragSsource, not your desired - * actions. If you desire limited drag actions, then I suppose you need to - * make a new drag gesture recognizer? I do know that if you put for instance - * ACTION_COPY but your device supports ACTION_COPY_OR_MOVE, then the receiving - * target may show the rejected icon, but will still be forced improperly to - * accept your MOVE since the system is not properly calling your MOVE a MOVE - * because you claimed incorrectly that you were incapable of MOVE. - */ - protected int getDragSourceActions() { - return DnDConstants.ACTION_COPY_OR_MOVE; - } - - protected int getDropTargetActions(){ - return DnDConstants.ACTION_COPY_OR_MOVE; - } - - protected void setDragGestureListener(DragGestureListener dragGestureListener){ - this.dragGestureListener = dragGestureListener; - } - - protected DragGestureListener getDragGestureListener(){ - return dragGestureListener; - } - - protected void setDragGestureRecognizer(DragGestureRecognizer dragGestureRecognizer){ - dgr = dragGestureRecognizer; - } - - protected DragGestureRecognizer getDragGestureRecognizer(){ - return dgr; - } - - protected void setDropTarget(DropTarget newDropTarget){ - if ((newDropTarget == null) && (dropTarget != null)) { - dropTarget.setComponent(null); - dropTarget.removeDropTargetListener(getDropTargetListener()); - } - dropTarget = newDropTarget; - } - - protected DropTarget createDropTarget() { - DropTarget dt = null; - if (Component.class.isInstance(view())) { - try { - dt = new DropTarget((Component)view(), getDropTargetActions(), getDropTargetListener()); - //System.out.println(view().toString() + " Initialized to DND."); - } - catch (NullPointerException npe) { - System.err.println("View Failed to initialize to DND."); - System.err.println("Container likely did not have peer before the DropTarget was added"); - System.err.println(npe); - npe.printStackTrace(); - } - } - return dt; - } - - /** - * Used to create the gesture recognizer which in effect turns on draggability. - */ - protected DragGestureRecognizer createDragGestureRecognizer(DragGestureListener dgl) { - DragGestureRecognizer aDgr = null; - if (Component.class.isInstance(view())) { - Component c = (Component)view(); - aDgr = java.awt.dnd.DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( - c, - getDragSourceActions(), - dgl); - //System.out.println("DragGestureRecognizer created: " + view()); - } - return aDgr; - } - - /** - * Used to destroy the gesture listener which ineffect turns off dragability. - */ - protected void destroyDragGestreRecognizer() { - //System.out.println("Destroying DGR " + view()); - if (getDragGestureRecognizer() != null) { - getDragGestureRecognizer().removeDragGestureListener(getDragGestureListener()); - getDragGestureRecognizer().setComponent(null); - setDragGestureRecognizer(null); - } - } - - protected void setDropTargetListener(DropTargetListener dropTargetListener){ - this.dropTargetListener = dropTargetListener; - } - - protected DropTargetListener getDropTargetListener(){ - return dropTargetListener; - } - - protected DropTargetListener createDropTargetListener(){ - return new JHDDropTargetListener(editor(),view()); - } - - public DragSourceListener getDragSourceListener(){ - return dragSourceListener; - } - - protected void setDragSourceListener(DragSourceListener dragSourceListener){ - this.dragSourceListener = dragSourceListener; - } - - protected DragSourceListener createDragSourceListener(){ - return new JHDDragSourceListener(editor(),view()); - } -} - /** - * These transferable objects are used to package your data when you want - * to initiate a transfer. They are not used when you only want to receive - * data. Formating the data is the responsibility of the sender primarily. - * Untested. Used for dragging ASCII text out of JHotDraw - */ -/* public class ASCIIText implements Transferable - { - String s = new String("This is ASCII text"); - byte[] bytes; - - public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor[] { ASCIIFlavor }; - } - - public boolean isDataFlavorSupported(DataFlavor dataFlavor) { - return dataFlavor.equals(ASCIIFlavor); - } - - public Object getTransferData(DataFlavor dataFlavor) - throws UnsupportedFlavorException, IOException { - if (!isDataFlavorSupported(dataFlavor)) - throw new UnsupportedFlavorException(dataFlavor); - - bytes = new byte[s.length() + 1]; - for (int i = 0; i < s.length(); i++) - bytes = s.getBytes(); - bytes[s.length()] = 0; - return new ByteArrayInputStream(bytes); - } - }*/ \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDInterface.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDInterface.java deleted file mode 100644 index 601c8cca8efd50b31225f3c5ba1e0a7ccacb01e6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DNDInterface.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)DNDInterface.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.dnd; - -import java.awt.dnd.DragGestureListener; -import java.awt.dnd.DragSourceListener; - -/** - * Interface for Components which wish to participate in drag and drop. - * - * A Component which wishes to participate in drag and drop should implement - * this interface. Once done the DragBDropTool will be able to transfer data - * to and from the Component. The Component will also be activated to receive - * drops from extra-JVM sources according to the conditions the Component - * specifies. - * - * @author CL.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface DNDInterface { - public void DNDInitialize(DragGestureListener dgl); - public void DNDDeinitialize(); - - /** - * When the DNDTool starts a drag action, it queries the interface for the - * dragSourceListener of the source view. It uses this listener to create - * the dragGestureEvent. - */ - public DragSourceListener getDragSourceListener(); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DragNDropTool.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/DragNDropTool.java deleted file mode 100644 index eaeaf339bcdc9bee389526951298789c22dd86ff..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/DragNDropTool.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * @(#)DragNDropTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.dnd; - -import java.awt.Component; -import java.awt.Point; -import java.awt.dnd.DragGestureListener; -import java.awt.event.MouseEvent; - -import javax.swing.JComponent; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * This is a tool which handles drag and drop between Components in - * JHotDraw and drags from JHotDraw. It also indirectly - * handles management of Drops from extra-JVM sources. - * - * - * Drag and Drop is about information moving, not images or objects. Its about - * moving a JHD rectangle to another application and that application understanding - * both its shape, color, attributes, and everything about it. not how it looks. - * - * There can be only 1 such tool in an application. A view can be registered - * with only a single DropSource as far as I know (maybe not). - * - * @todo For intra JVM transfers we need to pass Point origin as well, and not - * assume it will be valid which currently will cause a null pointer exception. - * or worse, will be valid with some local value. - * The dropSource will prevent simultaneous drops. - * - * For a Container to be initialized to support Drag and Drop, it must first - * have a connection to a heavyweight component. Or more precisely it must have - * a peer. That means new Component() is not capable of being initiated until - * it has attachment to a top level component i.e. JFrame.add(comp); If you add - * a Component to a Container, that Container must be the child of some - * Container which is added in its heirachy to a topmost Component. I will - * refine this description with more appropriate terms as I think of new ways to - * express this. It won't work until setVisible(true) is called. then you can - * initialize DND. - * - * note: if drop target is same as dragsource then we should draw the object. - * - * - * @author C.L.Gilbert <dnoyeb@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class DragNDropTool extends AbstractTool { - - private Tool fChild; - private DragGestureListener dragGestureListener; - private boolean dragOn; - - public DragNDropTool(DrawingEditor editor) { - super(editor); - setDragGestureListener(createDragGestureListener()); - dragOn = false; - } - - /** - * Sent when a new view is created - */ - protected void viewCreated(DrawingView view) { - super.viewCreated(view); - if (DNDInterface.class.isInstance(view)) { - DNDInterface dndi = (DNDInterface)view; - dndi.DNDInitialize( getDragGestureListener() ); - } - } - - /** - * Send when an existing view is about to be destroyed. - */ - protected void viewDestroying(DrawingView view) { - if (DNDInterface.class.isInstance(view)) { - DNDInterface dndi = (DNDInterface)view; - dndi.DNDDeinitialize(); - } - super.viewDestroying(view); - } - - /** - * Turn on drag by adding a DragGestureRegognizer to all Views which are - * based on Components. - */ - public void activate() { - super.activate(); -// setDragSourceActive(true); - //System.out.println("DNDTool Activation"); - setDragOn(true); - } - - public void deactivate() { - //System.out.println("DNDTool deactivation."); - setDragOn(false); -// setDragSourceActive(false);//if its not turned off other tools will have problems since drag will start - super.deactivate(); - } - -// private void setDragSourceActive(boolean newState) { -// Iterator it = comps.iterator(); -// while (it.hasNext()) { -// DNDInterface dndi = (DNDInterface)it.next(); -// dndi.setDragSourceState(newState); -// } -// } - - /** - * Sets the type of cursor based on what is under the coordinates in the - * active view. - */ - public static void setCursor(int x, int y, DrawingView view) { - if (view == null) { //shouldnt need this - return; - } - Handle handle = view.findHandle(x, y); - Figure figure = view.drawing().findFigure(x, y); - - if (handle != null) { - view.setCursor(handle.getCursor()); - } - else if (figure != null) { - view.setCursor(new AWTCursor(java.awt.Cursor.MOVE_CURSOR)); - } - else { - view.setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); - } - } - - /** - * Handles mouse moves (if the mouse button is up). - * Switches the cursors depending on whats under them. - * Don't use x, y use getX and getY so get the real unlimited position - * Part of the Tool interface. - */ - public void mouseMove(MouseEvent evt, int x, int y) { - if (evt.getSource() == getActiveView()) { - setCursor(x, y, getActiveView()); - } - } - - /** - * Handles mouse up events. The events are forwarded to the - * current tracker. - * Part of the Tool interface. - */ - public void mouseUp(MouseEvent e, int x, int y) { - if (fChild != null) { // JDK1.1 doesn't guarantee mouseDown, mouseDrag, mouseUp - fChild.mouseUp(e, x, y); - fChild = null; - } - setDragOn(true); - view().unfreezeView(); - //get undo actions and push into undo stack? - } - - /** - * Handles mouse down events and starts the corresponding tracker. - * Part of the Tool interface. - */ - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e, x, y); - // on MS-Windows NT: AWT generates additional mouse down events - // when the left button is down && right button is clicked. - // To avoid dead locks we ignore such events - if (fChild != null) { - return; - } - - view().freezeView(); - - Handle handle = view().findHandle(getAnchorX(), getAnchorY()); - if (handle != null) { - //Turn off DND - setDragOn(false); - fChild = createHandleTracker(handle); - } - else { - Figure figure = drawing().findFigure(getAnchorX(), getAnchorY()); - if (figure != null) { - //fChild = createDragTracker(editor(), figure); - //fChild.activate(); - fChild = null; - if (e.isShiftDown()) { - view().toggleSelection(figure); - } - else if (!view().isFigureSelected(figure)) { - view().clearSelection(); - view().addToSelection(figure); - } - } - else { - //Turn off DND - setDragOn(false); - if (!e.isShiftDown()) { - view().clearSelection(); - } - fChild = createAreaTracker(); - } - } - if (fChild != null) { - fChild.mouseDown(e, x, y); - } - } - - /** - * Handles mouse drag events. The events are forwarded to the - * current tracker. - * Part of the Tool interface. - */ - public void mouseDrag(MouseEvent e, int x, int y) { - if (fChild != null) { // JDK1.1 doesn't guarantee mouseDown, mouseDrag, mouseUp - fChild.mouseDrag(e, x, y); - } - } - - /** - * Factory method to create an area tracker. It is used to select an - * area. - */ - protected Tool createAreaTracker() { - return new SelectAreaTracker(editor()); - } - - /** - * Factory method to create a Drag tracker. It is used to drag a figure. - */ - protected Tool createDragTracker(DrawingEditor editor, Figure f) { - return new DragTracker(editor, f); - } - - /** - * Factory method to create a Handle tracker. It is used to track a handle. - */ - protected Tool createHandleTracker(Handle handle) { - return new HandleTracker(editor(), handle); - } - - private DragGestureListener getDragGestureListener(){ - return dragGestureListener; - } - - private void setDragGestureListener(DragGestureListener dragGestureListener){ - this.dragGestureListener = dragGestureListener; - } - - protected boolean isDragOn(){ - return dragOn; - } - - protected void setDragOn(boolean isNewDragOn){ - this.dragOn = isNewDragOn; - } - - private DragGestureListener createDragGestureListener() { - - return new DragGestureListener() { - - public void dragGestureRecognized(final java.awt.dnd.DragGestureEvent dge) { - Component c = dge.getComponent(); - //System.out.println("Drag Gesture Recognized for " + c); - if (isDragOn() == false) { - return; - } - - if (c instanceof DrawingView) { - boolean found = false; - DrawingView dv = (DrawingView)c; - /* Send the drawing view which inspired the action a mouseUp to clean - up its current tool. This is because mouse up will otherwise never - be sent and the tool will be stuck with only mouse down which means - it will likely stay activated. solve later for now just make - but report. */ - /* this is a list of cloned figures */ - FigureEnumeration selectedElements = dv.selection(); - - if (selectedElements.hasNextFigure() == false) { - return; - } - - Point p = dge.getDragOrigin(); - // System.out.println("origin at " + p); - while (selectedElements.hasNextFigure()) { - Figure f = selectedElements.nextFigure(); - if (f.containsPoint(p.x, p.y)) { - /* Rectangle r = figgy.displayBox(); - sx = r.width; - sy = r.height;*/ - //System.out.println("figure is " + figgy); - found = true; - break; - } - } - if (found == true) { - DNDFigures dndff = new DNDFigures(dv.selection(), p); - DNDFiguresTransferable trans = new DNDFiguresTransferable(dndff); - - /* SAVE FOR FUTURE DRAG IMAGE SUPPORT */ - /* drag image support that I need to test on some supporting platform. - windows is not supporting this on NT so far. Ill test 98 and 2K next - - boolean support = dragSource.isDragImageSupported(); - java.awt.image.BufferedImage bi = new BufferedImage(sx,sy,BufferedImage.TYPE_INT_RGB); - Graphics2D g = bi.createGraphics(); - Iterator itr2 = selectedElements.iterator(); - while ( itr2.hasNext() ) { - Figure fig = (Figure) itr2.next(); - fig = (Figure)fig.clone(); - Rectangle rold = fig.displayBox(); - fig.moveBy(-rold.x,-rold.y); - fig.draw(g); - } - g.setBackground(Color.red); - dge.getDragSource().startDrag( - dge, - DragSource.DefaultMoveDrop, - bi, - new Point(0,0), - trans, - this); - */ - if (c instanceof JComponent) { - ((JComponent)c).setAutoscrolls(false); - } - dge.getDragSource().startDrag( - dge, - null, - trans, - ((DNDInterface)dv).getDragSourceListener()); - } - } - } - }; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/JHDDragSourceListener.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/JHDDragSourceListener.java deleted file mode 100644 index 94cca89ef55249ba40d1ff0fa5974cfa3d0151f7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/JHDDragSourceListener.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * JHDDragSource.java - * - * Created on January 28, 2003, 4:49 PM - */ - -package CH.ifa.draw.contrib.dnd; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.DeleteFromDrawingVisitor; -import CH.ifa.draw.util.Undoable; -import java.awt.Component; -import java.awt.dnd.*; -import javax.swing.JComponent; - -/** - * - * @author Administrator - */ -public class JHDDragSourceListener implements java.awt.dnd.DragSourceListener { - private Undoable sourceUndoable; - private Boolean autoscrollState; - private DrawingEditor editor; - - /** Creates a new instance of JHDDragSource */ - public JHDDragSourceListener(DrawingEditor newEditor, DrawingView newView) { - this.editor = newEditor; - } -// protected DrawingView view(){ -// return dv; -// } - protected DrawingEditor editor(){ - return editor; - } - /** - * This method is invoked to signify that the Drag and Drop operation is complete. - * This is the last method called in the process. - */ - public void dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde) { - DrawingView view = (DrawingView) dsde.getDragSourceContext().getComponent(); - log("DragSourceDropEvent-dragDropEnd"); - if (dsde.getDropSuccess() == true) { - if (dsde.getDropAction() == DnDConstants.ACTION_MOVE) { - log("DragSourceDropEvent-ACTION_MOVE"); - //get the flavor in order of ease of use here. - setSourceUndoActivity( createSourceUndoActivity( view ) ); - DNDFigures df = (DNDFigures)DNDHelper.processReceivedData(DNDFiguresTransferable.DNDFiguresFlavor, dsde.getDragSourceContext().getTransferable()); - getSourceUndoActivity().setAffectedFigures( df.getFigures() ); - - //all this visitation needs to be hidden in a view method. - DeleteFromDrawingVisitor deleteVisitor = new DeleteFromDrawingVisitor(view.drawing()); - FigureEnumeration fe = getSourceUndoActivity().getAffectedFigures(); - while (fe.hasNextFigure()) { - fe.nextFigure().visit(deleteVisitor); - } - view.clearSelection(); - view.checkDamage(); - - editor().getUndoManager().pushUndo( getSourceUndoActivity() ); - editor().getUndoManager().clearRedos(); - // update menus - editor().figureSelectionChanged( view ); - } - else if (dsde.getDropAction() == DnDConstants.ACTION_COPY) { - log("DragSourceDropEvent-ACTION_COPY"); - } - } - - if (autoscrollState != null) { - Component c = dsde.getDragSourceContext().getComponent(); - if (JComponent.class.isInstance( c )) { - JComponent jc = (JComponent)c; - jc.setAutoscrolls(autoscrollState.booleanValue()); - autoscrollState= null; - } - } - } - /** - * Called as the hotspot enters a platform dependent drop site. - */ - public void dragEnter(DragSourceDragEvent dsde) { - log("DragSourceDragEvent-dragEnter"); - if (autoscrollState == null) { - Component c = dsde.getDragSourceContext().getComponent(); - if (JComponent.class.isInstance( c )) { - JComponent jc = (JComponent)c; - autoscrollState= new Boolean(jc.getAutoscrolls()); - jc.setAutoscrolls(false);//why turn it off??? - } - } - } - /** - * Called as the hotspot exits a platform dependent drop site. - */ - public void dragExit(java.awt.dnd.DragSourceEvent dse) { - } - /** - * Called as the hotspot moves over a platform dependent drop site. - */ - public void dragOver(DragSourceDragEvent dsde) { - //log("DragSourceDragEvent-dragOver"); - } - /** - * Called when the user has modified the drop gesture. - */ - public void dropActionChanged(DragSourceDragEvent dsde) { - log("DragSourceDragEvent-dropActionChanged"); - } - - - - - - - - - - - - /** - * Factory method for undo activity - */ - protected Undoable createSourceUndoActivity(DrawingView drawingView) { - return new RemoveUndoActivity( drawingView ); - } - protected void setSourceUndoActivity(Undoable undoable){ - sourceUndoable = undoable; - } - protected Undoable getSourceUndoActivity(){ - return sourceUndoable; - } - public static class RemoveUndoActivity extends CH.ifa.draw.util.UndoableAdapter { - private boolean undone = false; - public RemoveUndoActivity(DrawingView view) { - super( view ); - log("RemoveUndoActivity created " + view); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (isUndoable()) { - if(getAffectedFigures().hasNextFigure()) { - log("RemoveUndoActivity undo"); - getDrawingView().clearSelection(); - setAffectedFigures( getDrawingView().insertFigures(getAffectedFigures(), 0, 0,false)); - undone = true; - return true; - } - } - return false; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - log("RemoveUndoActivity redo"); - DeleteFromDrawingVisitor deleteVisitor = new DeleteFromDrawingVisitor( getDrawingView().drawing()); - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - fe.nextFigure().visit(deleteVisitor); //orphans figures - } - getDrawingView().clearSelection(); - setAffectedFigures( deleteVisitor.getDeletedFigures() ); - undone = false; - return true; - } - return false; - } - /** - * Since this is a delete activity, figures can only be released if the - * action has not been undone. - */ - public void release() { - if(undone == false){//we have figures that used to be in the drawing, but were not adding back - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - getDrawingView().drawing().remove(f); - f.release(); - } - } - setAffectedFigures(CH.ifa.draw.standard.FigureEnumerator.getEmptyEnumeration()); - } - } - - - - - - - - private static void log(String message){ - //System.out.println("JHDDragSourceListener: " + message); - } - - - - - - - -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/dnd/JHDDropTargetListener.java b/JHotDraw/src/CH/ifa/draw/contrib/dnd/JHDDropTargetListener.java deleted file mode 100644 index 060cb31beff8bab9114fe4104139e1f2c0897d4f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/dnd/JHDDropTargetListener.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * JHDDropTargetListener.java - * - * Created on January 28, 2003, 4:23 PM - */ - -package CH.ifa.draw.contrib.dnd; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.DeleteFromDrawingVisitor; -import java.io.File; -import CH.ifa.draw.util.Undoable; -import java.awt.Point; -import java.awt.datatransfer.DataFlavor; -import java.awt.dnd.*; - - -/** - * - * @author Administrator - */ -public class JHDDropTargetListener implements java.awt.dnd.DropTargetListener { - private int fLastX=0, fLastY=0; // previous mouse position - private Undoable targetUndoable; - private DrawingView dv; - private DrawingEditor editor; - /** Creates a new instance of JHDDropTargetListener */ - public JHDDropTargetListener(DrawingEditor drawingEditor, DrawingView drawingView) { - dv = drawingView; - editor = drawingEditor; - } - protected DrawingView view(){ - return dv; - } - protected DrawingEditor editor(){ - return editor; - } - - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - /** - * Called when a drag operation has encountered the DropTarget. - */ - public void dragEnter(DropTargetDragEvent dtde) { - log("DropTargetDragEvent-dragEnter"); - supportDropTargetDragEvent(dtde); - if (fLastX == 0) { - fLastX = dtde.getLocation().x; - } - if (fLastY == 0) { - fLastY = dtde.getLocation().y; - } - } - - /** - * The drag operation has departed the DropTarget without dropping. - */ - public void dragExit(java.awt.dnd.DropTargetEvent dte) { - log("DropTargetEvent-dragExit"); - } - - /** - * Called when a drag operation is ongoing on the DropTarget. - */ - public void dragOver(DropTargetDragEvent dtde) { - //log("DropTargetDragEvent-dragOver"); - if (supportDropTargetDragEvent(dtde)==true) { - int x=dtde.getLocation().x; - int y=dtde.getLocation().y; - if ((Math.abs(x - fLastX) > 0) || (Math.abs(y - fLastY) > 0) ) { - //FigureEnumeration fe = view().selectionElements(); - //while (fe.hasNextFigure()) { - // fe.nextFigure().moveBy(x - fLastX, y - fLastY); - // System.out.println("moving Figures " + view()); - //} - //view().drawing().update(); - fLastX = x; - fLastY = y; - } - } - } - - /** - * The drag operation has terminated with a drop on this DropTarget. - * Be nice to somehow incorporate FigureTransferCommand here. - */ - public void drop(java.awt.dnd.DropTargetDropEvent dtde) { - System.out.println("DropTargetDropEvent-drop"); - - if (dtde.isDataFlavorSupported(DNDFiguresTransferable.DNDFiguresFlavor) == true) { - log("DNDFiguresFlavor"); - if ((dtde.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0 ) { - log("copy or move"); - if (dtde.isLocalTransfer() == false) { - System.err.println("Intra-JVM Transfers not implemented for figures yet."); - dtde.rejectDrop(); - return; - } - dtde.acceptDrop(dtde.getDropAction()); - try { /* protection from a malicious dropped object */ - setTargetUndoActivity( createTargetUndoActivity( view() ) ); - DNDFigures ff = (DNDFigures)DNDHelper.processReceivedData(DNDFiguresTransferable.DNDFiguresFlavor, dtde.getTransferable()); - getTargetUndoActivity().setAffectedFigures( ff.getFigures() ); - Point theO = ff.getOrigin(); - view().clearSelection(); - Point newP = dtde.getLocation(); - /** origin is where the figure thinks it is now - * newP is where the mouse is now. - * we move the figure to where the mouse is with this equation - */ - int dx = newP.x - theO.x; /* distance the mouse has moved */ - int dy = newP.y - theO.y; /* distance the mouse has moved */ - log("mouse at " + newP); - FigureEnumeration fe = view().insertFigures( getTargetUndoActivity().getAffectedFigures() , dx, dy, false ); - getTargetUndoActivity().setAffectedFigures( fe ); - - if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) { - view().addToSelectionAll( getTargetUndoActivity().getAffectedFigures() ); - } - - view().checkDamage(); - editor().getUndoManager().pushUndo( getTargetUndoActivity() ); - editor().getUndoManager().clearRedos(); - // update menus - editor().figureSelectionChanged( view() ); - dtde.dropComplete(true); - } - catch (NullPointerException npe) { - npe.printStackTrace(); - dtde.dropComplete(false); - } - } - else { - dtde.rejectDrop(); - } - } - else if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor)) { - log("String flavor dropped."); - dtde.acceptDrop(dtde.getDropAction()); - Object o = DNDHelper.processReceivedData(DataFlavor.stringFlavor, dtde.getTransferable()); - if (o != null) { - log("Received string flavored data."); - dtde.getDropTargetContext().dropComplete(true); - } - else { - dtde.getDropTargetContext().dropComplete(false); - } - } - else if (dtde.isDataFlavorSupported(DNDHelper.ASCIIFlavor) == true) { - log("ASCII Flavor dropped."); - dtde.acceptDrop(DnDConstants.ACTION_COPY); - Object o = DNDHelper.processReceivedData(DNDHelper.ASCIIFlavor, dtde.getTransferable()); - if (o!= null) { - log("Received ASCII Flavored data."); - dtde.getDropTargetContext().dropComplete(true); - //System.out.println(o); - } - else { - dtde.getDropTargetContext().dropComplete(false); - } - } - else if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { - log("Java File List Flavor dropped."); - dtde.acceptDrop(DnDConstants.ACTION_COPY); - File [] fList = (File[]) DNDHelper.processReceivedData(DataFlavor.javaFileListFlavor, dtde.getTransferable()); - if (fList != null) { - log("Got list of files."); - for (int x=0; x< fList.length; x++ ) { - System.out.println(fList[x].getAbsolutePath()); - } - dtde.getDropTargetContext().dropComplete(true); - } - else { - dtde.getDropTargetContext().dropComplete(false); - } - } - fLastX = 0; - fLastY = 0; - } - - /** - * Called if the user has modified the current drop gesture. - */ - public void dropActionChanged(DropTargetDragEvent dtde) { - log("DropTargetDragEvent-dropActionChanged"); - supportDropTargetDragEvent(dtde); - } - - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - /** - * Tests wether the Drag event is of a type that we support handling - * Check the DND interface and support the events it says it supports - * if not a dnd interface comp, then dont support! because we dont even - * really know what kind of view it is. - */ - protected boolean supportDropTargetDragEvent(DropTargetDragEvent dtde) { - if (dtde.isDataFlavorSupported(DNDFiguresTransferable.DNDFiguresFlavor) == true) { - if ((dtde.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0) { - dtde.acceptDrag(dtde.getDropAction()); - return true; - } - else { - dtde.rejectDrag(); - return false; - } - } - else if (dtde.isDataFlavorSupported(DNDHelper.ASCIIFlavor) == true) { - dtde.acceptDrag(dtde.getDropAction());//accept everything because i am too lazy to fix yet - return true; - } - else if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor) == true) { - dtde.acceptDrag(dtde.getDropAction());//accept everything because i am too lazy to fix yet - return true; - } - else if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) == true) { - dtde.acceptDrag(dtde.getDropAction());//accept everything because i am too lazy to fix yet - return true; - } - else { - dtde.rejectDrag(); - return false; - } - } -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - /** - * Factory method for undo activity - */ - protected Undoable createTargetUndoActivity(DrawingView view) { - return new AddUndoActivity( view ); - } - protected void setTargetUndoActivity(Undoable undoable){ - targetUndoable = undoable; - } - protected Undoable getTargetUndoActivity(){ - return targetUndoable; - } - public static class AddUndoActivity extends CH.ifa.draw.util.UndoableAdapter { - private boolean undone=false; - public AddUndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - log("AddUndoActivity created " + newDrawingView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - //undo of add really shouldnt need visitor !?!dnoyeb!?! - log("AddUndoActivity AddUndoActivity undo"); - DeleteFromDrawingVisitor deleteVisitor = new DeleteFromDrawingVisitor(getDrawingView().drawing()); - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - CH.ifa.draw.framework.Figure f = fe.nextFigure(); - f.visit(deleteVisitor); - } - setAffectedFigures( deleteVisitor.getDeletedFigures() ); - getDrawingView().clearSelection(); - undone = true; - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - log("AddUndoActivity redo"); - getDrawingView().clearSelection(); - setAffectedFigures(getDrawingView().insertFigures( - getAffectedFigures(), 0, 0, false)); - undone = false; - return true; - } - /** - * Since this is an add operation, figures can only be released if it - * has been undone. - */ - public void release() { - if(undone == true){ - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - getDrawingView().drawing().remove(f); - f.release(); - } - } - setAffectedFigures(CH.ifa.draw.standard.FigureEnumerator.getEmptyEnumeration()); - } - } - private static void log(String message){ - //System.out.println("JHDDropTargetListener: " + message); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/AbstractContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/AbstractContentProducer.java deleted file mode 100644 index 4bbf4961100b5023b273c815047d0a4c8d24af96..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/AbstractContentProducer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#)AbstractContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.IOException; -import java.io.Serializable; - -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * Base class for the ContentProducers hierarchy<br> - * Doesn't do a thing now, but we may need this one later to add - * generic behaviour. - * - * @author Eduardo Francos - InContext - * @created 7 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractContentProducer implements ContentProducer, Serializable { - - final static long serialVersionUID = -2715253447095419531L; - - /** - * Constructor for the AbstractContentProducer object - */ - public AbstractContentProducer() { } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { } - - /** - * Writes the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/AttributeContentProducerContext.java b/JHotDraw/src/CH/ifa/draw/contrib/html/AttributeContentProducerContext.java deleted file mode 100644 index 6f08da4e33518cd50ecf55ea69bd33cf18058d56..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/AttributeContentProducerContext.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @(#)AttributeContentProducerContext.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * AttributeContentProducerContext defines the interface required of clients - * requesting contents from AttributeFigures oriented ContentProducers.<br> - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public interface AttributeContentProducerContext extends FigureContentProducerContext { - - /** - * Gets an attribute from the ContentProducerContext object - * - * @param name the name of the attribute - * @return The attribute value - */ - public Object getAttribute(String name); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/AttributeFigureContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/AttributeFigureContentProducer.java deleted file mode 100644 index afead880a5091170092ec6aa4a624d43a0a66705..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/AttributeFigureContentProducer.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * @(#)AttributeFigureContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.Serializable; -import CH.ifa.draw.util.StorableOutput; -import CH.ifa.draw.util.StorableInput; -import java.io.IOException; - -/** - * AttributeFigureContentProducer provides content for AttributeFigures.<br> - * It gives priority to base class supplied values, and if none, then it - * gets the value from the supplied AttributeContentProducerContext. - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public class AttributeFigureContentProducer extends FigureDataContentProducer - implements Serializable { - - /**Constructor for the AttributeFigureContentProducer object */ - public AttributeFigureContentProducer() { } - - /** - * Produces the contents for the attribute - * - * @param context the calling client context - * @param ctxAttrName the attribute name - * @param ctxAttrValue the attribute value that led to the call to this - * @return The content value - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - // first chance to basic values - Object attrValue = super.getContent(context, ctxAttrName, ctxAttrValue); - if (attrValue != null) { - return attrValue; - } - - // no, return value from attributes - return ((AttributeContentProducerContext)context).getAttribute(ctxAttrName); - } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - super.write(dw); - } - - /** - * Writes the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ColorContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ColorContentProducer.java deleted file mode 100644 index f311717d9f0a002313ebdd2b36f0d5b50ad04c86..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ColorContentProducer.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)ColorContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Color; -import java.io.IOException; -import java.io.Serializable; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * ColorContentProducer produces RGB color encoded hexadecimal strings.<br> - * Ex: - * <code>Color.blue ==> 0x0000FF</code><br> - * <code>Color.red ==> 0xFF00FF</code><br> - * It can either be specific if set for a specific color, or generic, encoding - * any color passed to the getContents method. - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public class ColorContentProducer extends FigureDataContentProducer - implements Serializable { - - private Color fColor = null; - - /**Constructor for the ColorContentProducer object */ - public ColorContentProducer() { } - - /** - * Constructor for the ColorContentProducer object - * - * @param color the specific color to use - */ - public ColorContentProducer(Color color) { - setColor(color); - } - - /** - * Produces the contents for the color - * - * @param context the calling client context - * @param ctxAttrName the color attribute name (FrameColor, TextColor, etc) - * @param ctxAttrValue the color - * @return The string RBG value for the color - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - // if we have our own color then use it - // otherwise use the one supplied - Color color = (getColor() != null) ? getColor() : (Color)ctxAttrValue; - String colorCode = Integer.toHexString(color.getRGB()); - return "0x" + colorCode.substring(colorCode.length() - 6); - } - - /** - * Sets the color attribute of the ColorContentProducer object - * - * @param color The new color value - */ - public void setColor(Color color) { - fColor = color; - } - - /** - * Gets the color attribute of the ColorContentProducer object - * - * @return The color value - */ - public Color getColor() { - return fColor; - } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeBoolean((getColor() != null)); - if (getColor() != null) { - dw.writeInt(getColor().getRGB()); - } - } - - /** - * Reads the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - boolean hasColor = dr.readBoolean(); - if (hasColor) { - setColor(new Color(dr.readInt())); - } - else{ - setColor(null); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducer.java deleted file mode 100644 index 66e8359d0529e912f42be3265e6dd337a1d1212e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducer.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * @(#)ContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import CH.ifa.draw.util.Storable; - -/** - * ContentProducer defines the interface for objects capable of producing - * contents on behalf of a client context.<br> - * Primarely based on the Strategy pattern, the purpose of ContentProducers - * is twofold:<br> - * <li> Detach the logic for producing generic content from interested parties so - * as to maximize reuse, of special interest for complex content</li> - * <li> Standardize contents by allowing for the automatic decentralization of - * contents source and production logic. Used together with the - * ContentProducerRegistry it is possible to globally modify the behaviour - * required for producing a specific type of contents. For example, - * a FieldContentProducer could be declined to get its contents from variables in - * an in-memory object, a setting from a configuration file, or even a field in - * a database record.</li> - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - * @todo should entity names be merged with the attribute names defined - * in FigureAttributeConstant? - */ -public interface ContentProducer extends Storable { - - /** Entity name for the figure's current x position in pixels */ - public final static String ENTITY_FIGURE_POSX = "FigurePosX"; - - /** Entity name for the figure's current y position in pixels */ - public final static String ENTITY_FIGURE_POSY = "FigurePosY"; - - /** Entity name for the figure's current width in pixels */ - public final static String ENTITY_FIGURE_WIDTH = "FigureWidth"; - - /** Entity name for the figure's current height in pixels */ - public final static String ENTITY_FIGURE_HEIGHT = "FigureHeight"; - - /** Entity name for the figure's current text color */ - public final static String ENTITY_FRAME_COLOR = "FrameColor"; - - /** Entity name for the figure's current fill color */ - public final static String ENTITY_FILL_COLOR = "FillColor"; - - /** Entity name for the figure's current arrow mode */ - public final static String ENTITY_ARROW_MODE = "ArrowMode"; - - /** Entity name for the figure's current font name */ - public final static String ENTITY_FONT_NAME = "FontName"; - - /** Entity name for the figure's current font size */ - public final static String ENTITY_FONT_SIZE = "FontSize"; - - /** Entity name for the figure's current font style */ - public final static String ENTITY_FONT_STYLE = "FontStyle"; - - /** - * Produces the contents - * - * @param context the calling client context - * @param ctxAttrName the attribute name - * @param ctxAttrValue the attribute value that led to the call to this - * @return The content value - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducerContext.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducerContext.java deleted file mode 100644 index 984637a99e7dd018141bcae466db573fe89554b2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducerContext.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * @(#)ContentProducerContext.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * ContentProducerContext defines the base interface required of clients - * of ContentProducers.<br> - * ContentProducers may need to retrieve information from their calling client - * in order to fulfill the contents request - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public interface ContentProducerContext { -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducerRegistry.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducerRegistry.java deleted file mode 100644 index 50b16d851a064f2b6189aa844f1913badb4db24d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ContentProducerRegistry.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * @(#)ContentProducerRegistry.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.IOException; -import java.io.Serializable; -import java.net.URL; - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; -import CH.ifa.draw.util.Storable; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * ContentProducerRegistry acts as a repository for ContentProducers. It allows - * for registries to be organized in a hierarchy, so that a specific producer - * request will travel upwards in the hierarchy until eventually a suitable - * producer is found.<br> - * Producers are registered associated with the class of the object they are suitable - * to produce contents for, but ContentProducerRegistry allows for class hierarchy - * searches. What this means is that for two classes A and B, B being a subclass - * of A, if a producer is registered for class B it will be used, otherwise the - * producer registered for class A will be used instead. ContentProducerRegistry will - * always select the super class closest in the class hierarchy, so if several - * producers are registered for classes in a derivation hierarchy, the producer - * registered for the class closest to the requested class will be selected. - * - * @author Eduardo Francos - InContext - * @created 7 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class ContentProducerRegistry implements Serializable, Storable { - - /** producers registered with this registry */ - private Hashtable fContentProducers = new Hashtable(); - - /** parent registry for hierarchical searches */ - private transient ContentProducerRegistry fParent; - - /** Application global producers */ - private static ContentProducerRegistry fDefaultRegistry = - new ContentProducerRegistry(null); - - // initialize the application wide default content producers - static { - fDefaultRegistry.registerContentProducer(URL.class, new URLContentProducer()); - } - - /**Constructor for the ContentProducerRegistry object */ - public ContentProducerRegistry() { - setParent(fDefaultRegistry); - } - - /** - *Constructor for the ContentProducerRegistry object - * - * @param parent the parent for this producer - */ - public ContentProducerRegistry(ContentProducerRegistry parent) { - setParent(parent); - } - - /** - * Sets the autonomous attribute of the ContentProducerRegistry object. - * Similar to setting the parent to null<br> - * An autonomous registry does not have a parent hierarchy so resolution of - * search requests stop do not propagate. - * - * @see #setParent(ContentProducerRegistry) - */ - public void setAutonomous() { - setParent(null); - } - - /** - * Gets the autonomous status of the ContentProducerRegistry object - * - * @return The autonomous value - */ - public boolean isAutonomous() { - return (getParent() == null); - } - - /** - * Sets the parent attribute of the ContentProducerRegistry object - * - * @param newParent The new parent value - * @see #setAutonomous() - */ - public void setParent(ContentProducerRegistry newParent) { - fParent = newParent; - } - - /** - * Gets the parent attribute of the ContentProducerRegistry object - * - * @return The parent value - */ - public ContentProducerRegistry getParent() { - return fParent; - } - - /** - * Registers an application global producer - * - * @param producer the registered producer - * @param targetClass The class associated with the producer - * @return the previous producer registered for the target class - */ - public static ContentProducer registerDefaultContentProducer(Class targetClass, ContentProducer producer) { - return fDefaultRegistry.registerContentProducer(targetClass, producer); - } - - /** - * Unregisters ie: removes a registered producer for a target class.<br> - * A check is made to ensure the removed producer is the current producer - * for the target class. If not, the request is ignored. - * - * @param producer the producer to unregister - * @param targetClass the target class - */ - public static void unregisterDefaultContentProducer(Class targetClass, ContentProducer producer) { - fDefaultRegistry.unregisterContentProducer(targetClass, producer); - } - - /** - * Gets the ContentProducer attribute of the HTMLTextAreaFigure object - * - * @param targetClass the target class - * @return the previous producer registered for the target class - */ - public static ContentProducer getDefaultContentProducer(Class targetClass) { - return fDefaultRegistry.getContentProducer(targetClass); - } - - /** - * Gets the exact application global Producer for the target class, ie: - * no class hierarchy search - * - * @param targetClass the target class - * @return The producer - */ - public static ContentProducer getExactDefaultContentProducer(Class targetClass) { - return fDefaultRegistry.getExactContentProducer(targetClass); - } - - /** - * Registers a producer - * - * @param producer the producer to register - * @param targetClass the target class - * @return the previous producer registered for the target class - */ - public ContentProducer registerContentProducer(Class targetClass, ContentProducer producer) { - ContentProducer previousProducer = getContentProducer(targetClass); - fContentProducers.put(targetClass, producer); - return previousProducer; - } - - /** - * Unregisters a producer - * - * @param producer the producer to unregister - * @param targetClass the target class - */ - public void unregisterContentProducer(Class targetClass, ContentProducer producer) { - // first check that the producer being removed is the current producer - // for the target class - ContentProducer currentProducer = getContentProducer(targetClass); - if (currentProducer == producer) { - fContentProducers.remove(targetClass); - } - } - - /** - * Finds the most appropriate producer for the target class. Will search - * first for exact producers, ie: no class hierarchy search, then if none found, - * will do a class compatible search - * - * @param targetClass The target class - * @return The producer - */ - public ContentProducer getContentProducer(Class targetClass) { - // first try an exact producer - ContentProducer producer = getExactContentProducer(targetClass); - if (producer != null) { - return producer; - } - - // none defined, try finding one for the nearest super class - // of the target class. Note this shouldn't return null because there is - // a default producer defined for the Object class - return getSuperClassContentProducer(targetClass, null); - } - - /** - * Finds the exact producer for the target class, ie: no class hierarchy search - * - * @param targetClass The target class - * @return The producer - */ - public ContentProducer getExactContentProducer(Class targetClass) { - // first try our own - ContentProducer producer = (ContentProducer)fContentProducers.get(targetClass); - if (producer != null) { - return producer; - } - - // none defined, try our parent's - // unless we are autonomous (ie: we have no parent) - if (!this.isAutonomous()) { - return getParent().getExactContentProducer(targetClass); - } - - // none defined - return null; - } - - /** - * Gets the producers for the closest super class of the target class - * - * @param targetClass The target class - * @return The producer - */ - protected ContentProducer getSuperClassContentProducer(Class targetClass, Class closestClass) { - Map.Entry entry = null; - Class entryClass = null; - ContentProducer closestProducer = null; - - Iterator iter = fContentProducers.entrySet().iterator(); - while (iter.hasNext()) { - entry = (Map.Entry)iter.next(); - entryClass = (Class)entry.getKey(); - if (entryClass.isAssignableFrom(targetClass)) { - if (closestClass != null && closestClass.isAssignableFrom(entryClass)) { - closestClass = entryClass; - closestProducer = (ContentProducer)entry.getValue(); - } - } - } - - // whether we found one or not ask our parent to see if a more - // exact producer is defined - // unless we are autonomous (ie: we have no parent) - if (!this.isAutonomous()) { - ContentProducer parentProducer = - getParent().getSuperClassContentProducer(targetClass, closestClass); - if (parentProducer != null) { - closestProducer = parentProducer; - } - } - - return closestProducer; - } - - /** - * Storable write support - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - dw.writeInt(fContentProducers.size()); - Map.Entry producerEntry; - Iterator iter = fContentProducers.entrySet().iterator(); - while (iter.hasNext()) { - producerEntry = (Map.Entry)iter.next(); - dw.writeString(((Class)producerEntry.getKey()).getName()); - dw.writeStorable((Storable)producerEntry.getKey()); - } - } - - /** - * Storable inoput support - * - * @param dr storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - // read the default content producers, count first - int prodCount = dr.readInt(); - String prodClass; - ContentProducer producer; - for (int cnt = 0; cnt < prodCount; cnt++) { - prodClass = dr.readString(); - producer = (ContentProducer)dr.readStorable(); - try { - registerContentProducer(Class.forName(prodClass), producer); - } - catch (ClassNotFoundException ex) { - // the class does not exist in this application - // cannot do much about it so ignore it, the entities of - // this class will get their toString() value instead - } - } - - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/DiamondFigureGeometricAdapter.java b/JHotDraw/src/CH/ifa/draw/contrib/html/DiamondFigureGeometricAdapter.java deleted file mode 100644 index aa1323572c921b744f9d41602d55679197958b47..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/DiamondFigureGeometricAdapter.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * @(#)DiamondFigureGeometricAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Point; -import java.awt.Shape; - -import CH.ifa.draw.contrib.DiamondFigure; - -/** - * Geometric adapter for the DiamondFigure - * - * @author Eduardo Francos - InContext - * @created 6 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class DiamondFigureGeometricAdapter extends DiamondFigure - implements GeometricFigure { - - /** - * Constructor for the DiamondFigureGeometricAdapter object - */ - public DiamondFigureGeometricAdapter() { - super(); - } - - /** - *Constructor for the DiamondFigureGeometricAdapter object - * - * @param origin Description of the Parameter - * @param corner Description of the Parameter - */ - public DiamondFigureGeometricAdapter(Point origin, Point corner) { - super(origin, corner); - } - - /** - * Gets the shape attribute of the DiamondFigure object - * - * @return The shape value - */ - public Shape getShape() { - return getPolygon(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceHolder.java b/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceHolder.java deleted file mode 100644 index 109e55fb69a764128beb10f10948f3fe17c4d496..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceHolder.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * @(#)DisposableResourceHolder.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * DisposableResourceHolder defines the interface for objects holding - * disposable resources.<br> - * A disposable resource is any kind of object that can be disposed of - * according to a given disposal strategy.<BR> - * DisposableResourceHolder keeps track of the last time the resource is - * accessed to support ellapsed time ResourceDisposabilityStrategies.<br> - * For example, if you are handling large images that you can regenerate - * at will, the DisposableResourceHolder will hold the image, and if not - * accessed for let's say 60 secs then it discards the image - * (sets its reference to null) so that it can be GCed.<br> - * Within the context of JHotDraw, HTMLTextAreaFigure uses - * DisposableResourceHolders to handle the HTML generated image, but if the - * figure is not displayed (out of the display area or in a background view) then - * the image is disposed of after a while and the HTMLTextAreaFigure will regenerate - * it the next time it is displayed.<br> - * A resource may be locked so that its user can be sure it will not be - * disposed of while in use. After finished using it it should be unlocked so as - * to reintegrate it to the disposal strategy. - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - * @see DisposableResourceManager - * @see StandardDisposableResourceManager - * @see ResourceDisposabilityStrategy - * @see DisposableResourceManagerFactory - * @see StandardDisposableResourceHolder - */ -public interface DisposableResourceHolder { - - /** - * Gets the resource - * - * @return The resource value - * @exception NullPointerException If the resource was disposed of - */ - public Object getResource() throws NullPointerException; - - /** - * Makes a clone the this - * - * @return the clone - */ - public Object clone(); - - /** - * Sets the resource - * - * @param resource The new resource value - */ - public void setResource(Object resource); - - /** - * Sets the disposableDelay - * - * @param millis The new disposableDelay value - */ - public void setDisposableDelay(long millis); - - /** - * Gets the disposableDelay - * - * @return The disposableDelay value - */ - public long getDisposableDelay(); - - /** - * Resets the disposing delay so as to restart the time counter - */ - public void resetDelay(); - - /** - * Gets the lastTimeAccessed attribute of the DisposableResourceHolder object - * - * @return The lastTimeAccessed value - */ - public long getLastTimeAccessed(); - - /** Disposes of the resource immediately. */ - public void dispose(); - - /** - * Returns true if the resource is still available - * - * @return The resourceDirty value - */ - public boolean isAvailable(); - - /** - * Locks the resource so it cannot be automatically disposed of until unlock - * is called.<br> - * Explicit disposing by calling dispose() is still possible though. - */ - public void lock(); - - /** - * Unlocks the resource so it can be automatically disposed of again.<br> - * Explicit disposing by calling dispose() is still possible though. - */ - public void unlock(); - - /** - * True if the resource is locked - * - * @return The locked status - */ - public boolean isLocked(); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceManager.java b/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceManager.java deleted file mode 100644 index d4b21b992071bb0b4f1afe90e15ee84da8cc871a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceManager.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * @(#)DisposableResourceManager.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.util.Iterator; - -/** - * DisposableResourceManager defines the interface for managers of disposable - * resources.<br> - * A DisposableResourceManager implements a strategy for efficient disposal - * of seldom used resources. - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public interface DisposableResourceManager { - - /** - * Registers a resource with the manager so as to be disposed - * - * @param resource the resource - */ - public void registerResource(DisposableResourceHolder resource); - - /** - * Unregisters a resource so it is not automatically GCed.<br> - * - * @param resource the resource - */ - public void unregisterResource(DisposableResourceHolder resource); - - /** - * Returns an iterator on the managed resources - * - * @return The resources iterator - */ - public Iterator getResources(); - - /** - * True if the resource is registered with this manager - * - * @param resource The resource - * @return True if the resource is registered with this manager - */ - public boolean managesResource(DisposableResourceHolder resource); - - /** - * Activates the strategy which starts disposing of resources as fitted - * - * @exception ResourceManagerNotSetException Description of the Exception - */ - public void startDisposing() throws ResourceManagerNotSetException; - - /** - * Deactivates the strategy that stops automatic disposal of resource.<br> - * The millis parameters specifies in milliseconds the time to wait for - * the disposal to stop. After this time the method returns whether the - * disposal was stopped or not, but the desactivation request remains active. - * - * @param millis time to wait for disposal to stop - */ - public void stopDisposing(long millis); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceManagerFactory.java b/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceManagerFactory.java deleted file mode 100644 index d89e67903b5689a54c06c86f0828aa44e80abaa9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/DisposableResourceManagerFactory.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * @(#)DisposableResourceManagerFactory.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * DisposableResourceManagerFactory creates DisposableResourceHolders on behalf - * of requesting clients. It automatically registers the holders with its singleton - * standard resource manager - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public abstract class DisposableResourceManagerFactory { - - /** The default periodicity for resource disposal */ - public static long DEFAULT_DISPOSAL_PERIODICITY = 60000; - - /** The singleton current resource manager */ - protected static DisposableResourceManager currentManager = null; - - protected static ResourceDisposabilityStrategy currentStrategy = null; - - protected static DisposableResourceHolder holderPrototype = null; - - /** - * Gets the current manager. - * - * @return The currentManager - */ - public static DisposableResourceManager getManager() { - return currentManager; - } - - /** - * Sets the strategy of the DisposableResourceManagerFactory - * class. This is a one shot thing that should be initialized before using it - * so if there is already a strategy this returns without further notice. - * - * @param strategy The new disposalStrategy - */ - public static void setStrategy(ResourceDisposabilityStrategy strategy) { - currentStrategy = strategy; - } - - /** - * Returns a new standard resource holder already registered with the default - * resource manager - * - * @param resource Description of the Parameter - * @return the newly created resource holder - */ - public static DisposableResourceHolder createStandardHolder(Object resource) { - // ensure the manager is set and running - initManager(); - - // now create the holder and register it - DisposableResourceHolder holder = (DisposableResourceHolder)holderPrototype.clone(); - holder.setResource(resource); - getManager().registerResource(holder); - - return holder; - } - - /** Initializes the standard resource disposal manager */ - protected static void initManager() { - if (currentManager == null) { - // ensure we have a holder prototype - if (holderPrototype == null) { - holderPrototype = new StandardDisposableResourceHolder(); - } - // ensure we have a strategy - if (currentStrategy == null) { - currentStrategy = new ETSLADisposalStrategy(DEFAULT_DISPOSAL_PERIODICITY); - } - // ensure we have a manager - if (currentManager == null) { - currentManager = new StandardDisposableResourceManager(currentStrategy); - } - - // start the whole thing - try { - currentManager.startDisposing(); - } - catch (ResourceManagerNotSetException ex) { - // we set it so we shouldn't get here - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ETSLADisposalStrategy.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ETSLADisposalStrategy.java deleted file mode 100644 index 668692b70154657130c9a2da83fc586f08ef7799..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ETSLADisposalStrategy.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * @(#)ETSLADisposalStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.util.Iterator; - -/** - * ETSLADisposalStrategy implements an Ellapsed Time Since Last Access disposal - * strategy.<bt> - * It checks the last time a resource was accessed and if greater than - * the resource's disposalDelay it disposes of the resource so that it can - * be GCed.<br> - * Disposal activity must be explicitely started using the startDisposing method - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version 1.0 - */ -public class ETSLADisposalStrategy implements ResourceDisposabilityStrategy { - - /** The associated resource manager */ - private DisposableResourceManager manager; - - /** The periodicity at wich disposal is checked */ - private long gcPeriodicity = 60000; - - /** the thread that calls this periodically */ - private DisposalThread disposalThread = null; - - /** True if disposal is active and running */ - private boolean disposingActive = false; - - - /** - * Constructor for the ETSLADisposalStrategy object - */ - public ETSLADisposalStrategy() { } - - /** - *Constructor for the ETSLADisposalStrategy object - * - * @param periodicity the periodicity at which to check for disposable resources - */ - public ETSLADisposalStrategy(long periodicity) { - this(null, periodicity); - } - - /** - *Constructor for the ETSLADisposalStrategy object - * - * @param manager the manager - * @param periodicity the periodicity at which to check for disposable resources - */ - public ETSLADisposalStrategy(DisposableResourceManager newManager, long newPeriodicity) { - setManager(newManager); - setPeriodicity(newPeriodicity); - initDisposalThread(); - } - - /** - * Sets the manager holding the resources for this strategy - * - * @param manager The new manager value - */ - public synchronized void setManager(DisposableResourceManager newManager) { - // if new manager is null the stop disposing - if (getManager() == null) { - stopDisposing(Long.MAX_VALUE); - } - manager = newManager; - } - - /** - * Gets the manager holding the resources for this strategy - * - * @return The manager value - */ - public DisposableResourceManager getManager() { - return manager; - } - - /** - * Activates the strategy which starts disposing of resources as fitted - * - * @exception ResourceManagerNotSetException thrown if the manager has not - * been set, so impossible to run - */ - public void startDisposing() throws ResourceManagerNotSetException { - if (getManager() == null) { - throw new ResourceManagerNotSetException(); - } - - // do nothing if already active - if (disposingActive) { - return; - } - - disposingActive = true; - disposalThread.start(); - } - - /** - * Deactivates the strategy that stops automatic disposal of resources.<br> - * The millis parameters specifies in milliseconds the time to wait for - * the disposal to stop. After this time the method returns, but the - * deactivation request remains active. - * - * @param millis time to wait for disposal to stop - */ - public void stopDisposing(long millis) { - // do nothing if not disposing - if (!disposingActive) { - return; - } - // request the thread to stop and wait for it - try { - disposalThread.interruptDisposalPending = true; - disposalThread.join(millis); - } - catch (InterruptedException ex) { - // ignore - } - finally { - disposingActive = false; - } - } - - /** - * Initializes the disposal thread if not alrady done. - */ - protected void initDisposalThread() { - if (disposalThread != null) { - return; - } - - disposalThread = new DisposalThread(this, getPeriodicity()); - } - - /** - * Dispose of all the resources whose dispose delay has expired and - * are not locked - */ - protected synchronized void dispose() { - synchronized (getManager()) { - long currentTime = System.currentTimeMillis(); - Iterator resourceIter = getManager().getResources(); - DisposableResourceHolder resource; - - while (resourceIter.hasNext()) { - resource = (DisposableResourceHolder)resourceIter.next(); - synchronized (resource) { - if (!resource.isLocked() && (resource.getLastTimeAccessed() + resource.getDisposableDelay()) < currentTime) { - resource.dispose(); - } - } - } - } - } - - /** - * Gets the periodicity attribute of the ETSLADisposalStrategy object - * - * @return The periodicity value - */ - public long getPeriodicity() { - return gcPeriodicity; - } - - /** - * Sets the periodicity attribute of the ETSLADisposalStrategy object - * - * @param newPeriodicity The new periodicity value - */ - public void setPeriodicity(long newPeriodicity) { - gcPeriodicity = newPeriodicity; - if (disposalThread != null) { - disposalThread.setPeriodicity(newPeriodicity); - } - } -} - -/** - * Description of the Class - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - */ -class DisposalThread extends Thread { - - private ETSLADisposalStrategy strategy; - - /** The periodicity at wich disposal is checked */ - private long periodicity = 60000; - - /** Description of the Field */ - boolean interruptDisposalPending = false; - - /** - *Constructor for the DisposalThread object - * - * @param strategy the strategy - * @param periodicity the periodicity at which the strategy should be called - */ - DisposalThread(ETSLADisposalStrategy newStrategy, long newPeriodicity) { - strategy = newStrategy; - periodicity = newPeriodicity; - } - - /** - * Main processing method for the DisposalThread object - */ - public void run() { - interruptDisposalPending = false; - while (!interruptDisposalPending) { - try { - sleep(periodicity); - } - catch (Exception ex) { - // just exit - break; - } - strategy.dispose(); - } - interruptDisposalPending = false; - } - - /** - * Gets the periodicity attribute of the ETSLADisposalStrategy object - * - * @return The periodicity value - */ - public long getPeriodicity() { - return periodicity; - } - - /** - * Sets the periodicity attribute of the ETSLADisposalStrategy object - * - * @param newPeriodicity The new periodicity value - */ - public void setPeriodicity(long newPeriodicity) { - periodicity = newPeriodicity; - } - - /** Description of the Method */ - public void interruptDisposal() { - interruptDisposalPending = true; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/EllipseFigureGeometricAdapter.java b/JHotDraw/src/CH/ifa/draw/contrib/html/EllipseFigureGeometricAdapter.java deleted file mode 100644 index 672e97f9eeb4c4208b77a44ac549b6d5eeca15f2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/EllipseFigureGeometricAdapter.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @(#)EllipseFigureGeometricAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.Ellipse2D; - -import CH.ifa.draw.figures.EllipseFigure; - -/** - * Geometric adapter for the EllipseFigure - * - * @author Eduardo Francos - InContext - * @created 1 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class EllipseFigureGeometricAdapter extends EllipseFigure - implements GeometricFigure { - - /** - * Constructor for the EllipseFigureExt object - */ - public EllipseFigureGeometricAdapter() { - super(); - } - - /** - *Constructor for the EllipseFigureGeometricAdapter object - * - * @param origin Description of the Parameter - * @param corner Description of the Parameter - */ - public EllipseFigureGeometricAdapter(Point origin, Point corner) { - super(origin, corner); - } - - /** - * Gets the shape attribute of the EllipseFigure object - * - * @return The shape value - */ - public Shape getShape() { - Rectangle rect = displayBox(); - Ellipse2D.Float ellipse = new Ellipse2D.Float(rect.x, rect.y, rect.width, rect.height); - return ellipse; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/FigureContentProducerContext.java b/JHotDraw/src/CH/ifa/draw/contrib/html/FigureContentProducerContext.java deleted file mode 100644 index 2606889ccb5839d38366757ae23d71e41170a524..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/FigureContentProducerContext.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @(#)FigureContentProducerContext.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Font; - -import java.awt.Rectangle; - -/** - * FigureContentProducerContext defines the interface required of clients - * requesting contents for Figure oriented ContentProducers.<br> - * - * @author Eduardo Francos - InContext - * @created 7 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public interface FigureContentProducerContext extends ContentProducerContext { - - /** - * Returns the display box of the figure - * - * @return the display box - */ - public Rectangle displayBox(); - - /** - * Gets the font of the figure - * - * @return The font - */ - public Font getFont(); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/FigureDataContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/FigureDataContentProducer.java deleted file mode 100644 index 1e19b83a8b2b7f8747c92d227cc8ecf3145ece78..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/FigureDataContentProducer.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * @(#)FigureDataContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.IOException; - -import java.io.Serializable; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * FigureDataContentProducer produces content on behalf of Figures.<br> - * It supports the basic information common to all figures. - * It can only be used as a generic producer, getting information from any - * figure passed to the getContents method. - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public class FigureDataContentProducer extends AbstractContentProducer - implements Serializable { - - /** - * Constructor for the FigureContentProducer object - */ - public FigureDataContentProducer() { } - - /** - * Produces the contents for the figure - * - * @param context the calling client context - * @param ctxAttrName the attribute name - * @param ctxAttrValue the figure - * @return The string value for the requested entity name - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - if (ctxAttrName.compareTo(ContentProducer.ENTITY_FIGURE_WIDTH) == 0) { - return Integer.toString(((FigureContentProducerContext)context).displayBox().width); - } - - if (ctxAttrName.compareTo(ContentProducer.ENTITY_FIGURE_HEIGHT) == 0) { - return Integer.toString(((FigureContentProducerContext)context).displayBox().height); - } - - if (ctxAttrName.compareTo(ContentProducer.ENTITY_FIGURE_POSX) == 0) { - return Integer.toString(((FigureContentProducerContext)context).displayBox().x); - } - - if (ctxAttrName.compareTo(ContentProducer.ENTITY_FIGURE_POSY) == 0) { - return Integer.toString(((FigureContentProducerContext)context).displayBox().y); - } - - return null; - } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - super.write(dw); - } - - /** - * Writes the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/GeometricFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/html/GeometricFigure.java deleted file mode 100644 index 3a525dbc1de0e219cc4bba6b11fd4f370b5a09d4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/GeometricFigure.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @(#)GeometricFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Shape; - -import CH.ifa.draw.framework.Figure; - -/** - * GeometricFigure defines required of figures that can be used as shape providers - * for other figures. See HTMLTextArea for an example. - * - * @author Eduardo Francos - InContext - * @created 1 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public interface GeometricFigure extends Figure { - - /** - * Returns a shape with the figures area outline - * - * @return The shape - */ - public Shape getShape(); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLColorContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLColorContentProducer.java deleted file mode 100644 index 0805030b35c38cfbc95e5847eae63d15efeafb5b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLColorContentProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * @(#)HTMLColorContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Color; -import java.io.Serializable; - -/** - * HTMLColorContentProducer produces RGB color HTML encoded strings.<br> - * Ex: - * <code>Color.blue ==> #0000FF</code><br> - * <code>Color.red ==> #FF00FF</code><br> - * It can either be specific if set for a specific color, or generic, encoding - * any color passed to the getContents method. - * - * @author Eduardo Francos - InContext - * @created 4 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class HTMLColorContentProducer extends ColorContentProducer implements Serializable { - - /** - * Constructor for the HTMLColorContentProducer object - */ - public HTMLColorContentProducer() { } - - /** - * Produces the contents for the color - * - * @param context the calling client context - * @param ctxAttrName the color attribute name (FrameColor, TextColor, etc) - * @param ctxAttrValue the color - * @return The HTML encoded RBG value for the color - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - // if we have our own color then use it - // otherwise use the one supplied - Color color = (getColor() != null) ? getColor() : (Color)ctxAttrValue; - return getHTMLColorCode(color); - } - - public static String getHTMLColorCode(Color color) { - String colorCode = Integer.toHexString(color.getRGB()); - return "#" + colorCode.substring(colorCode.length() - 6); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLContentProducer.java deleted file mode 100644 index 72ff17fb7d4e4f30184e97e8003a51e7cfc0d048..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLContentProducer.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * @(#)HTMLContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.Serializable; - -/** - * HTMLContentProducer produces HTML suitable values and encoded strings for - * various types of values.<br> - * It can also transform values into their HTML equivalents, like for instance - * a mapping between font sizes in points and the HTML valid font size values.<br> - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public class HTMLContentProducer extends AttributeFigureContentProducer - implements Serializable { - - /** Table of font size equivalents between points and HTML font sizes */ - protected final static int[][] htmlFontSizeEquivalences = - { - // 0 to 9 points ==> size 1 - {1, 0, 9}, - // 10 to 11 points ==> size 2 - {2, 10, 11}, - // 12 to 13 points ==> size 3 - {3, 12, 13}, - // 14 to 17 points ==> size 4 - {4, 14, 17}, - // 18 to 23 points ==> size 5 - {5, 18, 23}, - // 24 to 35 points ==> size 6 - {6, 24, 35}, - // 36 and higher points ==> size 7 - {7, 36, Integer.MAX_VALUE} - }; - - /** - * Constructor for the HTMLContentProducer object - */ - public HTMLContentProducer() { } - - /** - * Gets the HTML content value for the requested attribute - * - * @param context the calling client context - * @param ctxAttrName the attribute name (FontSize, etc...) - * @param ctxAttrValue the attribute value that led to the call to this - * @return The content value - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - HTMLContentProducerContext htmlContext = (HTMLContentProducerContext)context; - - if (ctxAttrName.compareTo(ContentProducer.ENTITY_FONT_SIZE) == 0) { - return Integer.toString(getHTMLFontSizeEquivalent(htmlContext.getFont().getSize())); - } - - return super.getContent(context, ctxAttrName, ctxAttrValue); - } - - /** - * Gets the hTMLFontSizeEquivalent attribute of the HTMLTextAreaFigure object - * - * @param pointSize the font size in points - * @return The hTMLFontSizeEquivalent value - */ - public int getHTMLFontSizeEquivalent(int pointSize) { - for (int i = 0; i < htmlFontSizeEquivalences.length; i++) { - if (pointSize >= htmlFontSizeEquivalences[i][1] && - pointSize <= htmlFontSizeEquivalences[i][2]) { - return htmlFontSizeEquivalences[i][0]; - } - } - // not found?!?!?! return the "normal" font size - return 3; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLContentProducerContext.java b/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLContentProducerContext.java deleted file mode 100644 index c436ec21db57b5e9429a7d093378feab3f688244..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLContentProducerContext.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * @(#)HTMLContentProducerContext.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * HTMLContentProducerContext defines the interface required of clients - * requesting HTML based contents.<br> - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public interface HTMLContentProducerContext extends AttributeContentProducerContext { -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLLayouter.java b/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLLayouter.java deleted file mode 100644 index b27d79e5c7fa64d431dc9e6a68cddd75f944632b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLLayouter.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)HTMLLayouter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Insets; -import java.awt.Point; - -import java.awt.Rectangle; -import java.io.IOException; -import CH.ifa.draw.contrib.Layoutable; -import CH.ifa.draw.contrib.Layouter; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * HTMLLayouter implements the logic for laying out figures based on an - * HTML template. - * - * @author Eduardo Francos - InContext - * @created 4 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class HTMLLayouter implements Layouter { - - /**Constructor for the HTMLLayouter object */ - public HTMLLayouter() { } - - /** - * Constructor which associates a HTMLLayouter with - * a certain Layoutable. - * - * @param newLayoutable Layoutable to be laid out - */ - public HTMLLayouter(Layoutable newLayoutable) { - this(); -// setLayoutable(newLayoutable); - } - - /** - * Description of the Method - * - * @param origin Description of the Parameter - * @param corner Description of the Parameter - * @return Description of the Return Value - */ - public Rectangle calculateLayout(Point origin, Point corner) { - /** - * @todo: Implement this CH.ifa.draw.contrib.Layouter method - */ - throw new UnsupportedOperationException("Method calculateLayout() not yet implemented."); - } - - /** - * Description of the Method - * - * @param origin Description of the Parameter - * @param corner Description of the Parameter - * @return Description of the Return Value - */ - public Rectangle layout(Point origin, Point corner) { - /** - * @todo: Implement this CH.ifa.draw.contrib.Layouter method - */ - throw new UnsupportedOperationException("Method layout() not yet implemented."); - } - - /** - * Sets the insets attribute of the HTMLLayouter object - * - * @param newInsets The new insets value - */ - public void setInsets(Insets newInsets) { - /** - * @todo: Implement this CH.ifa.draw.contrib.Layouter method - */ - throw new UnsupportedOperationException("Method setInsets() not yet implemented."); - } - - /** - * Gets the insets attribute of the HTMLLayouter object - * - * @return The insets value - */ - public Insets getInsets() { - /** - * @todo: Implement this CH.ifa.draw.contrib.Layouter method - */ - throw new UnsupportedOperationException("Method getInsets() not yet implemented."); - } - - /** - * Description of the Method - * - * @param dw Description of the Parameter - */ - public void write(StorableOutput dw) { - /** - * @todo: Implement this CH.ifa.draw.util.Storable method - */ - throw new UnsupportedOperationException("Method write() not yet implemented."); - } - - /** - * Description of the Method - * - * @param dr Description of the Parameter - * @exception IOException Description of the Exception - */ - public void read(StorableInput dr) throws IOException { - /** - * @todo: Implement this CH.ifa.draw.util.Storable method - */ - throw new UnsupportedOperationException("Method read() not yet implemented."); - } - - /** - * Create a new instance of this type and sets the layoutable - * - * @param newLayoutable Description of the Parameter - * @return Description of the Return Value - */ - public Layouter create(Layoutable newLayoutable) { - return new HTMLLayouter(newLayoutable); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLTextAreaFigure.java b/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLTextAreaFigure.java deleted file mode 100644 index f0b0ac157e194f60161f8111bbc1129286944d97..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLTextAreaFigure.java +++ /dev/null @@ -1,1143 +0,0 @@ -/* - * @(#)HTMLTextAreaFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.geom.AffineTransform; -import java.awt.geom.FlatteningPathIterator; -import java.awt.image.BufferedImage; -import java.io.IOException; - -import javax.swing.*; - -import CH.ifa.draw.contrib.TextAreaFigure; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * An HTMLTextAreaFigure contains HTML formatted text.<br> - * Formatting is done internally by a JLabel component, so all display features - * and constrains that apply for a JLabel apply also for an HTMLTextAreaFigure, - * including text and images, as in any Web browser, even allowing for contents - * residing on external Web sources. But don't forget that this is <b>NOT</b> a Web - * browser, so HTML contents cannot be standard Web pages with headers, stylesheets, - * javascript and who knows what else, just plain down to earth HTML code. - * <p> - * In order to automatically integrate "external" attributes like FillColor, - * FontName, etc, HTMLTextAreaFigure encapsulates the text the user types in the - * editor within a table with a single cell occupying the whole area.<br> - * Here is what the HTML code passed to the JLabel looks like:<br> - * <code> - * <html><br> - * <table border='0' width='area.width' height='area.height' - * cellpadding='0' cellspacing='0' bgcolor='&FillColor;'><br> - * <tr><br> - * <td width='100%'><br> - * <font face='&FontName;' color='&TextColor;' size='&FontSize;'><br> - * <!-- add italic and bold attributes if required--><br> - * <i><br> - * <b><br> - * ============>> User's contents go here <============<br> - * <!-- close italic and bold attributes if required --><br> - * </b><br> - * </i><br> - * </font><br> - * </td><br> - * </tr><br> - * </table><br> - * </html><br> - * </code><br> - * It is possible to write <i>raw</i> HTML code by calling - * <code>setRawHTML(true)</code>. In that case no tags are issued.<br> - * The user is then responsible for applying the figure attributes and in - * general is responsible for the whole display. - * This setting can be dynamically toggled as needed.<br> - * Note that JLabel resets the font to its own default whenever it encounters - * an HTML structure, like a table or a header tag. I couldn't find a workaround - * for what can/should be called a bug. Normal browsers do not behave like this.<p> - * - * Internal attributes like FillColor or FontName are exposed as special SGML - * entities using the standard SGML entity notation, ex: <code>&FillColor;</code>.<br> - * Any attribute associated to the figure can be used and will be replaced with - * an appropriate value from a ContentsProducer (see below) or its - * toString() value if no specific ContentProducer is defined.<p> - * - * The HTML display and layouting can be time consuming, quite fast in most cases, - * unless the HTML structure is complicated. This can become a serious penalty - * when working with a large number of complicated figures.<br> - * To help in this issue HTMLTextAreaFigure offers two display modes, DirectDraw, - * where the HTML layout logic is executed every time the figure is displayed, and - * BufferedDraw, where HTMLTextAreaFigure creates an in-memory image of the - * resulting layout and uses the image for fast display until a change requires - * to regenerate the image.<br> - * The BufferedDraw mode is as fast as an image display can be, but it consumes - * more memory than the DirectDraw mode, which in turn is slower.<br> - * The setting is specific to each figure instance and it can be dynamically - * toggled at any time, so it is possible to fine tune when and which figures - * use either one of the drawing modes.<p> - * - * Remember the attributes based SGML entities?<br> - * If you set the figure to be read only, so not allowing the user to directly - * edit the HTML contens, then it is possible to use HTMLTextAreaFigures to - * produce very elaborate and complex information layout.<br> - * You create HTML templates for each figure layout you want to use and set them - * as the text of the figure. Within the template text you place field names - * wherever needed as you would for a Web page, then each figure using the template - * associates the field values as attributes of the figure. The attribute exposure - * feature will substitute the entity names with the current attribute's value.<br> - * Please refer to the accompanying sample program to see in detail the multiple - * ways this feature can enhance your drawings.<p> - * - * <b>ContentProducers</b><br> - * As stated above, entities referenced in the HTML template code are replaced by - * their current value in the drawn figure. The values themselves are provided - * by ContentProducers.<br> - * For a detailed description of ContentProducers please refer to their - * own documentation, but to make it simple, a ContentProducer is an object that - * implements the method <code>getContent</code> and is registered to produce - * content for either specific entities, or entity classes.<br> - * An entity class is the class of the attribute containing its value, ie: an - * attribute containing a URL has class URL (<code>attribute.getClass()</code>), - * and an URLContentProducer can be associated to it so that when the layout - * needs the entity's value, the producer's getContent() method is called and the - * returned value (ex: contents from a Web page, FTP file or disk file) is used - * to replace the entity in the displayed figure.<br> - * The ContentProducer can return either a String, in which case it is used - * <b>as is</b>, or another Object. In the later case HTMLTextAreaFigure will - * continue calling registered ContentProviders depending on the class of the - * returned Object until it either gets a final String, or null. If null then - * the entity is considered as unknown and left as is in the displayed text. To - * make it dissapear alltogether the producer should return an empty String.<p> - * HTMLTextAreaFigure registers default ContentProducers: - * AttributeFigureContentProducer for the intrinsic attributes of the figure - * (height, width, font name, etc.), URLContentProducer for URL attributes, - * HTMLColorContentProducer for HTML color encoding and for embedded - * TextAreaFigure and HTMLTextAreaFigure classes. That's right, you can embed - * a TextAreaFigure or HTMLTextAreaFigure contents inside an HTMLTextAreaFigure - * recursively for as many levels as your CPU and memory will allow.<br> - * For instance, the main figure can consists of an HTML table where each - * cell's contents come from a different HTMLTextAreaFigure. - * - * @author Eduardo Francos - InContext - * @created 7 May 2002 - * @version <$CURRENT_VERSION$> - */ -public class HTMLTextAreaFigure extends TextAreaFigure - implements HTMLContentProducerContext, FigureChangeListener { - - /** Start marker for embedded attribute values */ - public final static char START_ENTITY_CHAR = '&'; - - /** End marker for embedded attribute values */ - public final static char END_ENTITY_CHAR = ';'; - - /** Marker escape character */ - public final static char ESCAPE_CHAR = '\\'; - - /** holder for the image used for the display */ - private transient DisposableResourceHolder fImageHolder; - - /** The label used for in-memory display */ - private transient JLabel fDisplayDelegate; - - /** True if using direct drawing, false if using the memory image */ - private boolean fUseDirectDraw = false; - - /** True if the memory image should be regenerated */ - private boolean fIsImageDirty = true; - - /** Description of the Field */ - private boolean fRawHTML = false; - - /** Supplier for intrinsic data */ - private transient ContentProducer fIntrinsicContentProducer; - - /** Description of the Field */ - private static ContentProducerRegistry fDefaultContentProducers = new ContentProducerRegistry(); - // initialize the default content producers for HTMLTextAreaFigure figures - static { - fDefaultContentProducers.registerContentProducer(TextAreaFigure.class, new TextHolderContentProducer()); - fDefaultContentProducers.registerContentProducer(Color.class, new HTMLColorContentProducer()); - } - - /** Description of the Field */ - private transient ContentProducerRegistry fContentProducers = null; - - /** The figure used to draw the frame of the area */ - private Figure fFrameFigure = null; - - // make sure required default attributes are set - static { - initDefaultAttribute("XAlignment", new Integer(SwingConstants.LEFT)); - initDefaultAttribute("YAlignment", new Integer(SwingConstants.TOP)); - initDefaultAttribute("LeftMargin", new Float(5)); - initDefaultAttribute("RightMargin", new Float(5)); - initDefaultAttribute("TopMargin", new Float(5)); - initDefaultAttribute("BottomMargin", new Float(5)); - initDefaultAttribute("TabSize", new Float(8)); - } - - /** Constructor for the HTMLTextAreaFigure object */ - public HTMLTextAreaFigure() { - initialize(); - } - - /** - * Clones a figure and initializes it - * - * @return Description of the Return Value - * @see Figure#clone - */ - public Object clone() { - Object cloneObject = super.clone(); - ((HTMLTextAreaFigure)cloneObject).initialize(); - return cloneObject; - } - - /** - * Sets the display box for the figure - * - * @param origin origin point - * @param corner corner point - * @see Figure - */ - public void basicDisplayBox(Point origin, Point corner) { - super.basicDisplayBox(origin, corner); - getFrameFigure().displayBox(displayBox()); - } - - /** - * Returns an iterator of standard sizing handles to manipulate the figure - * - * @return Description of the Return Value - */ - public HandleEnumeration handles() { - return getFrameFigure().handles(); -// List handles = CollectionsFactory.current().createList(); -// BoxHandleKit.addHandles(this, handles); -// return new HandleEnumerator(handles); - } - - /** - * True if the figure contains the point. The call is relayed to the frame figure - * - * @param x Description of the Parameter - * @param y Description of the Parameter - * @return Description of the Return Value - */ - public boolean containsPoint(int x, int y) { - return getFrameFigure().containsPoint(x, y); - } - - /** - * Moves the figure by the specified displacement - * - * @param dx Description of the Parameter - * @param dy Description of the Parameter - */ - public void moveBy(int dx, int dy) { - super.moveBy(dx, dy); - getFrameFigure().moveBy(dx, dy); - } - - /** Initializes the figure */ - protected void initialize() { - fImageHolder = DisposableResourceManagerFactory.createStandardHolder(null); - setFrameFigure(new RectangleFigure()); - - // initialize the content producers - setIntrinsicContentProducer(new HTMLContentProducer()); - fContentProducers = new ContentProducerRegistry(fDefaultContentProducers); - - markSizeDirty(); - markImageDirty(); - markTextDirty(); - markFontDirty(); - - setAttribute(FigureAttributeConstant.POPUP_MENU, createPopupMenu()); - } - - /** - * Called whenever the something changes that requires size recomputing - */ - protected void markSizeDirty() { - markImageDirty(); - super.markSizeDirty(); - } - - /** - * Called whenever the something changes that requires text recomputing - */ - protected void markTextDirty() { - markImageDirty(); - super.markTextDirty(); - } - - /** - * Called whenever the something changes that requires font recomputing - */ - protected void markFontDirty() { - markImageDirty(); - super.markFontDirty(); - } - - /** - * Draws the figure in the given graphics. Draw is a template - * method calling drawBackground followed by drawText then drawFrame.<br> - * HTMLTextAreaFigure displays in a different order tahn most figures to avoid - * smearing of the border when enclosed in a weird frame figure.<br> - * Also, there is no such thing as a transparent background so we always draw it. - * - * @param g Description of the Parameter - * @todo check possibility of clipping the contents from the background to have a - * transparent figure - */ - public void draw(Graphics g) { - Color fill = getFillColor(); - g.setColor(fill); - drawBackground(g); - - // we draw the text then the rame to avoid smearing - drawText(g, displayBox()); - - Color frame = getFrameColor(); - g.setColor(frame); - drawFrame(g); - } - - /** - * Draws the frame around the text. It gets the shape of the frame from the - * enclosing figure - * - * @param g The graphics to use for the drawing - */ - public void drawFrame(Graphics g) { - ((Graphics2D)g).draw(getClippingShape()); - } - - /** - * Draws the background for the figure. It gets the shape of the frame from the - * enclosing figure - * - * @param g The graphics to use for the drawing - */ - public void drawBackground(Graphics g) { - ((Graphics2D)g).fill(getClippingShape()); - } - - /** - * Formats and draws the text for the figure - * - * @param g the graphics for the drawing. It can be null when - * called just to compute the size - * @param displayBox the display box within which the text should be formatted and drawn - * @return Description of the Return Value - */ - protected float drawText(Graphics g, Rectangle displayBox) { - Graphics2D g2 = null; - Shape savedClip = null; - - if (g != null) { - g2 = (Graphics2D)g; - savedClip = g2.getClip(); - } - - Rectangle drawingBox = makeDrawingBox(displayBox); - - // drawing an empty displayBox is not possible - if (drawingBox.isEmpty()) { - return drawingBox.height; - } - - if (g != null) { - g2.clip(getClippingShape()); - } - - if (usesDirectDraw()) { - drawTextDirect(g2, drawingBox); - } - else { - fImageHolder.lock(); - if (isImageDirty()) { - generateImage(drawingBox); - setSizeDirty(false); - } - - if (g2 != null) { - g2.drawImage(getImage(), drawingBox.x, drawingBox.y, null); - } - fImageHolder.unlock(); - } - if (g != null) { - g2.setClip(savedClip); - } - - // redraw the border to prevent smearing - drawFrame(g); - return displayBox.height; - } - - /** - * Generates the HTML image to be used for fast BufferedDrawing - * - * @param drawingBox Description of the Parameter - */ - protected void generateImage(Rectangle drawingBox) { - // create the image and get its Graphics - createImage(drawingBox.width, drawingBox.height); - Graphics2D g2 = (Graphics2D)getImage().getGraphics(); - - Rectangle finalBox = new Rectangle(drawingBox); - finalBox.setLocation(0, 0); - renderText(g2, finalBox); - g2.dispose(); - } - - /** - * Draws the text directly onto the drawing, without using the cached figure - * - * @param g2 Description of the Parameter - * @param drawingBox Description of the Parameter - */ - protected void drawTextDirect(Graphics2D g2, Rectangle drawingBox) { - Shape savedClipArea = null; - Color savedFontColor = null; - //Font savedFont = null; - //Rectangle2D clipRect = null; - RenderingHints savedRenderingHints = null; - - if (g2 != null) { - savedRenderingHints = g2.getRenderingHints(); - savedClipArea = g2.getClip(); - //savedFont = g2.getFont(); - savedFontColor = g2.getColor(); - g2.clip(drawingBox); - } - - //float finalHeight = renderText(g2, drawingBox); - - // restore saved graphic attributes - if (g2 != null) { - g2.setClip(savedClipArea); - g2.setColor(savedFontColor); - g2.setRenderingHints(savedRenderingHints); - } - } - - /** - * Renders the HTML formatted text onto the supplied Graphics.<br> - * Rendering involves entity substitution and HTML contents preparation suitable - * for display by a JLabel. - * - * @param g2 Description of the Parameter - * @param drawingBox Description of the Parameter - * @return Description of the Return Value - * @todo look for other HTML display providers as JLabel is kind of - * lousy at it - */ - protected float renderText(Graphics2D g2, Rectangle drawingBox) { - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - g2.setRenderingHint(RenderingHints.KEY_RENDERING, - RenderingHints.VALUE_RENDER_QUALITY); - - // fill with background color - g2.setBackground(getFillColor()); - g2.setColor(getFillColor()); - g2.clearRect(drawingBox.x, drawingBox.y, drawingBox.width, drawingBox.height); - g2.fillRect(drawingBox.x, drawingBox.y, drawingBox.width, drawingBox.height); - - // get the text. Either in raw format or prepared for HTML display - String text; - if (isRawHTML()) { - text = getText(); - } - else { - text = getHTMLText(getText(), getFont(), - (String)getContentProducer(Color.class).getContent(this, FigureAttributeConstant.TEXT_COLOR_STR, getTextColor()), - (String)getContentProducer(Color.class).getContent(this, FigureAttributeConstant.FILL_COLOR_STR, getFillColor()), - drawingBox - ); - } - - // perform entity keyword substitution - text = substituteEntityKeywords(text); - - // create the JLabel used as delegate for drawing - JLabel displayDelegate = getDisplayDelegate(); - displayDelegate.setText(text); - displayDelegate.setBackground(getFillColor()); - - // ensure the label covers the whole area - displayDelegate.setLocation(0, 0); - displayDelegate.setSize(drawingBox.width, drawingBox.height); - displayDelegate.setHorizontalAlignment(((Integer)getAttribute(FigureAttributeConstant.XALIGNMENT)).intValue()); - displayDelegate.setVerticalAlignment(((Integer)getAttribute(FigureAttributeConstant.YALIGNMENT)).intValue()); - - // finally display it - SwingUtilities.paintComponent( - g2, - displayDelegate, - getContainerPanel(displayDelegate, drawingBox), - drawingBox.x, - drawingBox.y, - drawingBox.width, - drawingBox.height); - - return drawingBox.height; - } - - /** - * Builds the drawing box using the margins - * - * @param displayBox Description of the Parameter - * @return The drawing box - */ - protected Rectangle makeDrawingBox(Rectangle displayBox) { - // get alignment information - float leftMargin = ((Float)getAttribute(FigureAttributeConstant.LEFT_MARGIN)).floatValue(); - float rightMargin = ((Float)getAttribute(FigureAttributeConstant.RIGHT_MARGIN)).floatValue(); - float topMargin = ((Float)getAttribute(FigureAttributeConstant.TOP_MARGIN)).floatValue(); - float bottomMargin = ((Float)getAttribute(FigureAttributeConstant.BOTTOM_MARGIN)).floatValue(); - - // inset the drawing box by 1 on every side so as not to overwrite - // the border - Rectangle drawingBox = new Rectangle(displayBox); - drawingBox.grow(-1, -1); - // adjust for margins - drawingBox.x += leftMargin; - drawingBox.width -= (leftMargin + rightMargin); - drawingBox.y += topMargin; - drawingBox.height -= topMargin + bottomMargin; - - return drawingBox; - } - - /** - * Gets the displayDelegate attribute of the HTMLTextAreaFigure object - * - * @return The displayDelegate value - */ - protected JLabel getDisplayDelegate() { - if (fDisplayDelegate == null) { - fDisplayDelegate = new JLabel(); - fDisplayDelegate.setBorder(null); - } - return fDisplayDelegate; - } - - /** - * Creates the cached image, unless there is already one and it is - * compatible with new request, in which case we reuse it - * - * @param width Description of the Parameter - * @param height Description of the Parameter - */ - protected void createImage(int width, int height) { - // if current image is compatible reuse it - fImageHolder.lock(); - if (!fImageHolder.isAvailable() || - ((BufferedImage)fImageHolder.getResource()).getWidth() != width || - ((BufferedImage)fImageHolder.getResource()).getHeight() != height) { - fImageHolder.setResource(new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)); - } - // we don't unlock the image, it's the responsibility of - // the caller to do so, this in oreder to ensure that calling createImage - // will always return with a valid image - } - - /** - * Builds the container for the drawing delegate - * - * @param drawingDelegate The delegate - * @param displayBox The bounding box - * @return The container - */ - protected JPanel getContainerPanel(Component drawingDelegate, Rectangle displayBox) { - JPanel panel = new JPanel(); - return panel; - } - - /** - * Returns a string that is valid HTML contents for a JLabel.<br> - * Valid HTML contents is text enclosed in <html> </html> tags.<br> - * We enclose the supplied text into a table with a single cell so that we - * can also set the external alignment and font attributes - * - * @param text The text - * @param font The font - * @param textColor The text color HTML code - * @param backColor The background's color HTML code - * @param displayBox Description of the Parameter - * @return The final HTML encoded text - */ - protected String getHTMLText(String text, Font font, String textColor, - String backColor, Rectangle displayBox) { - - StringBuffer htmlText = new StringBuffer(); - // add an <HTML> - htmlText.append("<html>"); - - // add a table with width=100%, background color, and no borders with - // a single cell - htmlText.append( - "<table border='0' width='" + - displayBox.width + - "' height='" + displayBox.height + - "' cellpadding='0' cellspacing='0'" + - "bgcolor='&FillColor;'>"); - htmlText.append("<tr><td width='100%'>"); - // set the font - htmlText.append("<font face='&FontName;' color='&TextColor;' size='&FontSize;'>"); - // add alignment if required - if (((Integer)getAttribute(FigureAttributeConstant.XALIGNMENT)).intValue() == SwingConstants.CENTER) { - htmlText.append("<center>"); - } - // add italic and bold attributes if required - if (font.isItalic()) { - htmlText.append("<i>"); - } - if (font.isBold()) { - htmlText.append("<b>"); - } - - // add the text itself - htmlText.append(text); - - // close italic and bold attributes if required - if (font.isBold()) { - htmlText.append("</b>"); - } - if (font.isItalic()) { - htmlText.append("</i>"); - } - // close alignment if required - if (((Integer)getAttribute(FigureAttributeConstant.XALIGNMENT)).intValue() == SwingConstants.CENTER) { - htmlText.append("</center>"); - } - // close the font tag - htmlText.append("</font>"); - // close the cell, row and table - htmlText.append("</td></tr></table>"); - - // close the html tag - htmlText.append("</html>"); - - return htmlText.toString(); - } - - /** - * Returns a new String with the entity keywords replaced by their - * current attribute value.<br> - * The text is scanned for entity keywords delimited by the START_ENTITY_CHAR - * and END_ENTITY_CHAR characters as in<br> - * <code>>font face='&FontName;' color='&FillColor;'<</code><br> - * A keyword is replaced if and only if an attribute with the given name is - * found, otherwise the text is left as is. - * - * @param template The template text - * @return The resulting string with its attributes replaced - */ - protected String substituteEntityKeywords(String template) { - int endPos; - StringBuffer finalText = new StringBuffer(); - - int startPos = 0; - int chunkEnd = startPos; - try { - while ((startPos = template.indexOf(START_ENTITY_CHAR, startPos)) != -1) { - if (startPos != 0 && template.charAt(startPos - 1) == ESCAPE_CHAR) { - // found an escaped parameter starter - startPos++; - continue; - } - - // get the end of the parameter - endPos = startPos + 1; - while ((endPos = template.indexOf(END_ENTITY_CHAR, endPos)) != -1) { - if (endPos == 0 || template.charAt(endPos - 1) != ESCAPE_CHAR) { - // found a valid non escaped group stopper - break; - } - // invalid entity, error? probably not, anyway we consider - // this as not being an attribute replacement - throw new InvalidAttributeMarker(); - } - - // OK, we now have an attribute - String attrName = template.substring(startPos + 1, endPos); - - // replace it if present, otherwise leave as is - String attrValue = getEntityHTMLRepresentation(attrName); - if (attrValue != null) { - finalText.append(template.substring(chunkEnd, startPos)); - // append the entity's value after performing - // entity keyword substitution on its contents - finalText.append(substituteEntityKeywords(attrValue)); - startPos = endPos + 1; - chunkEnd = startPos; - } - else { - startPos++; - } - } - } - catch (InvalidAttributeMarker ex) { - // invalid marker, ignore - } - - // append whatever is left - finalText.append(template.substring(chunkEnd)); - - // and return it - return finalText.toString(); - } - - /** - * Returns a string representation of the attribute according to its type - * - * @param attrName The name of the attribute - * @return The attribute's HTML representation - */ - protected String getEntityHTMLRepresentation(String attrName) { - // get the attribute's raw value - Object attrValue = getIntrinsicContentProducer().getContent(this, attrName, null); - - // no such attribute? - if (attrValue == null) { - return null; - } - - // found something - // keep requesting value expansion until we get a String - while (attrValue != null && !(attrValue instanceof String)) { - // handle explicit ContentProducers - if (attrValue instanceof ContentProducer) { - attrValue = ((ContentProducer)attrValue).getContent(this, attrName, attrValue); - continue; - } - - // not a specific producer, try a default one - ContentProducer defaultProducer = getContentProducer(attrValue.getClass()); - if (defaultProducer != null) { - attrValue = defaultProducer.getContent(this, attrName, attrValue); - continue; - } - - // no specific producer, - // all classes without an explicit default producer - // get their value from their toString() method - attrValue = attrValue.toString(); - } - - return (String)attrValue; - } - - /** - * Gets the image. - * - * @return The image value - */ - protected BufferedImage getImage() { - if (fImageHolder.isAvailable()) { - return (BufferedImage)fImageHolder.getResource(); - } - return null; - } - - /** - * Sets the image attribute of the HTMLTextAreaFigure object - * - * @param newImage The new image value - */ - protected void setImage(BufferedImage newImage) { - fImageHolder.setResource(newImage); - } - - /** - * Factory method to create a popup menu which allows to set options - * - * @return newly created popup menu - */ - protected JPopupMenu createPopupMenu() { - JPopupMenu popupMenu = new JPopupMenu(); - addPopupMenuItems(popupMenu); - popupMenu.setLightWeightPopupEnabled(true); - return popupMenu; - } - - /** - * Adds items to the popup menu - * - * @param popupMenu The popup menu to add items to - */ - protected void addPopupMenuItems(JPopupMenu popupMenu) { - ButtonGroup drawingPopupGroup; - - JRadioButtonMenuItem rbOption; - - drawingPopupGroup = new ButtonGroup(); - rbOption = new JRadioButtonMenuItem( - new AbstractAction("Direct drawing") { - public void actionPerformed(ActionEvent event) { - setUseDirectDraw(true); - } - }); - - drawingPopupGroup.add(rbOption); - if (usesDirectDraw()) { - drawingPopupGroup.setSelected(rbOption.getModel(), true); - } - popupMenu.add(rbOption); - - rbOption = new JRadioButtonMenuItem( - new AbstractAction("Buffered drawing") { - public void actionPerformed(ActionEvent event) { - setUseDirectDraw(false); - } - }); - drawingPopupGroup.add(rbOption); - if (usesBufferedDraw()) { - drawingPopupGroup.setSelected(rbOption.getModel(), true); - } - popupMenu.add(rbOption); - - popupMenu.addSeparator(); - - drawingPopupGroup = new ButtonGroup(); - rbOption = new JRadioButtonMenuItem( - new AbstractAction("Normal HTML") { - public void actionPerformed(ActionEvent event) { - setRawHTML(false); - } - }); - - drawingPopupGroup.add(rbOption); - drawingPopupGroup.setSelected(rbOption.getModel(), true); - popupMenu.add(rbOption); - - rbOption = - new JRadioButtonMenuItem( - new AbstractAction("Raw HTML") { - public void actionPerformed(ActionEvent event) { - setRawHTML(true); - } - }); - drawingPopupGroup.add(rbOption); - popupMenu.add(rbOption); - - } - - /** - * Gets the usesDirectDraw status of the HTMLTextAreaFigure object - * - * @return True if currently doing direct drawing, ie: not using a cached image - */ - public boolean usesDirectDraw() { - return fUseDirectDraw; - } - - /** - * Sets the useDirectDraw attribute of the HTMLTextAreaFigure object - * - * @param newUseDirectDraw The new useDirectDraw value - */ - public void setUseDirectDraw(boolean newUseDirectDraw) { - fUseDirectDraw = newUseDirectDraw; - setAttribute(FigureAttributeConstant.POPUP_MENU, createPopupMenu()); - markSizeDirty(); - } - - /** - * Sets the useBufferedDraw attribute of the HTMLTextAreaFigure object - * - * @param newUseBufferedDraw The new useBufferedDraw value - */ - public void setUseBufferedDraw(boolean newUseBufferedDraw) { - setUseDirectDraw(!newUseBufferedDraw); - } - - /** - * Gets the usesBufferedDraw attribute of the HTMLTextAreaFigure object - * - * @return True if currently using buffered draw, ie: the cached image - */ - public boolean usesBufferedDraw() { - return !usesDirectDraw(); - } - - /** - * Disposes of the image so it will be regenerated next time it is displayed - */ - protected void markImageDirty() { - fImageHolder.dispose(); - } - - /** - * True if the image should be regenerated - * - * @return The imageDirty value - */ - protected boolean isImageDirty() { - return !fImageHolder.isAvailable(); - } - - /** - * Reads the figure from StorableInput - * - * @param dr Description of the Parameter - * @throws IOException the inout storable - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - - setFrameFigure((Figure)dr.readStorable()); - setUseDirectDraw(dr.readBoolean()); - setRawHTML(dr.readBoolean()); -// setIntrinsicContentProducer((ContentProducer)dr.readStorable()); -// fContentProducers.read(dr); - -// // finally add the popup menu -// setAttribute(Figure.POPUP_MENU, createPopupMenu()); - - } - - /** - * Writes the figure to StorableOutput - * - * @param dw the output storable - */ - public void write(StorableOutput dw) { - super.write(dw); - - dw.writeStorable(getFrameFigure()); - dw.writeBoolean(usesDirectDraw()); - dw.writeBoolean(isRawHTML()); -// dw.writeStorable(getIntrinsicContentProducer()); -// fContentProducers.write(dw); - } - - /** - * A text area figure uses the "LeftMargin", "RightMargin", - * "TopMargin", "BottomMargin", "TabSize", "FontSize", "FontStyle", and "FontName" - * attributes - * - * @param name The new attribute name - * @param value The new attribute value - */ - public void setAttribute(FigureAttributeConstant name, Object value) { - super.setAttribute(name, value); - markImageDirty(); - } - - /** - * Gets the rawHTML attribute of the HTMLTextAreaFigure object.<br> - * In RawHTML mode, the figure does not add any HTML formatting information so it's - * the user's responsibility to handle the whole displayed contents - * - * @return The rawHTML value - */ - public boolean isRawHTML() { - return fRawHTML; - } - - /** - * Sets the rawHTML attribute of the HTMLTextAreaFigure object - * - * @param newRawHTML The new rawHTML value - */ - public void setRawHTML(boolean newRawHTML) { - fRawHTML = newRawHTML; - setAttribute(FigureAttributeConstant.POPUP_MENU, createPopupMenu()); - } - - /** - * Gets the IntrinsicContentProducer attribute of the HTMLTextAreaFigure object.<br> - * The intrinsic producer produces contents for the basic figure's attributes - * - * @return The IntrinsicContentProducer value - */ - protected ContentProducer getIntrinsicContentProducer() { - return fIntrinsicContentProducer; - } - - /** - * Sets the IntrinsicContentProducer attribute of the HTMLTextAreaFigure object - * - * @param newIntrinsicContentProducer The new IntrinsicContentProducer value - */ - public void setIntrinsicContentProducer(ContentProducer newIntrinsicContentProducer) { - fIntrinsicContentProducer = newIntrinsicContentProducer; - } - - /** - * Registers a specific content producer for the target class - * - * @param targetClass the target class - * @param producer the producer - * @return the previously registered producer. May be null - */ - public ContentProducer registerContentProducer(Class targetClass, ContentProducer producer) { - return fContentProducers.registerContentProducer(targetClass, producer); - } - - /** - * Unregisters a registered content producer. - * - * @param producer Description of the Parameter - * @param targetClass Description of the Parameter - */ - public void unregisterContentProducer(Class targetClass, ContentProducer producer) { - fContentProducers.unregisterContentProducer(targetClass, producer); - } - - /** - * Retrieves a suitable content producer for the target class - * - * @param targetClass the target class - * @return The ContentProducer - */ - protected ContentProducer getContentProducer(Class targetClass) { - return fContentProducers.getContentProducer(targetClass); - } - - /** - * Makes a polygon with the same shape and dimensions as the current figure - * - * @return Description of the Return Value - */ - public Polygon getPolygon() { - Polygon polygon = new Polygon(); - - // make an AffineTransofmr that does nothing - AffineTransform at = AffineTransform.getScaleInstance(1, 1); - // and get an iterator on the segments - FlatteningPathIterator pIter = new FlatteningPathIterator( - getClippingShape().getPathIterator(at), - 1); - - double[] coords = new double[6]; - //int pointType; - // iterate on the segments adding the points to the polygon - while (!pIter.isDone()) { - //pointType = pIter.currentSegment(coords); - pIter.currentSegment(coords); - polygon.addPoint((int)coords[0], (int)coords[1]); - pIter.next(); - } - - return polygon; - } - - /** - * Gets the frameFigure attribute of the HTMLTextAreaFigure object - * - * @return The frameFigure value - */ - protected Figure getFrameFigure() { - return fFrameFigure; - } - - /** - * Sets the frameFigure attribute of the HTMLTextAreaFigure object - * - * @param newFrameFigure The new frameFigure value - */ - public void setFrameFigure(Figure newFrameFigure) { - if (fFrameFigure != null) { - fFrameFigure.removeFigureChangeListener(this); - } - fFrameFigure = newFrameFigure; - fFrameFigure.addFigureChangeListener(this); - } - - /** - * Gets the clippingShape attribute of the HTMLTextAreaFigure object - * - * @return The clippingShape value - */ - protected Shape getClippingShape() { - Figure frame = getFrameFigure(); - if (frame instanceof GeometricFigure) { - return ((GeometricFigure)frame).getShape(); - } - return frame.displayBox(); - } - - /** - * handles frame figure's invalidated events - * - * @param e Description of the Parameter - */ - public void figureInvalidated(FigureChangeEvent e) { } - - /** - * handles frame figure's changed events.<br> - * It updates the displayBox to match - * the frame figure's - * - * @param e Description of the Parameter - */ - public void figureChanged(FigureChangeEvent e) { - willChange(); - super.basicDisplayBox(e.getFigure().displayBox().getLocation(), Geom.corner(e.getFigure().displayBox())); - changed(); - } - - /** - * handles frame figure's invalidatedremoved events.<br> - * Never happens because the frame figure is not part of the drawing - * - * @param e Description of the Parameter - */ - public void figureRemoved(FigureChangeEvent e) { } - - /** - * handles frame figure's remove requests events.<br> - * Never happens because the frame figure is not part of the drawing - * - * @param e Description of the Parameter - */ - public void figureRequestRemove(FigureChangeEvent e) { } - - /** - * handles frame figure's update requests events.<br> - * Never happens because the frame figure is not part of the drawing - * - * @param e Description of the Parameter - */ - public void figureRequestUpdate(FigureChangeEvent e) { } - - /** - * Thrown when an entity reference is not correctly encoded - * - * @author gualo - * @created 1 mai 2002 - */ - private class InvalidAttributeMarker extends Exception { - } - - /** - * Usually, a TextHolders is implemented by a Figure subclass. To avoid casting - * a TextHolder to a Figure this method can be used for polymorphism (in this - * case, let the (same) object appear to be of another type). - * Note, that the figure returned is not the figure to which the TextHolder is - * (and its representing figure) connected. - * @return figure responsible for representing the content of this TextHolder - */ - public Figure getRepresentingFigure() { - return this; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLTextAreaTool.java b/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLTextAreaTool.java deleted file mode 100644 index 3cca3b77178fb7c89fef0901c3f04e8ee82fa389..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/HTMLTextAreaTool.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#)HTMLTextAreaTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Font; -import CH.ifa.draw.contrib.TextAreaTool; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.standard.TextHolder; - -/** - * HTMLTextAreaTool creates or edits HTMLTextAreaFigures.<br> - * Only diffreence with TextAreaFigure is that this allows to edit HTML code - * using a more suitable font than the one defined by the figure. - * - * @author Eduardo Francos - InContext - * @created 28 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public class HTMLTextAreaTool extends TextAreaTool { - - /** - * Constructor for the TextAreaTool object - * - * @param newDrawingEditor the managing drawing editor - * @param prototype the prototype for the figure - */ - public HTMLTextAreaTool(DrawingEditor newDrawingEditor, Figure prototype) { - super(newDrawingEditor, prototype); - } - - /** - * Gets the font to be used for editing the figure.<br> - * Use a simple editing font, easier for HTML editing - * - * @param figure the figure - * @return The font - */ - protected Font getFont(TextHolder figure) { - return new Font("Helvetica", Font.PLAIN, 12); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/PolygonFigureGeometricAdapter.java b/JHotDraw/src/CH/ifa/draw/contrib/html/PolygonFigureGeometricAdapter.java deleted file mode 100644 index 8bd1b951f0e08c873a7b590e160959672e3704d6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/PolygonFigureGeometricAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @(#)PolygonFigureGeometricAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Polygon; -import java.awt.Shape; - -import CH.ifa.draw.contrib.PolygonFigure; - -/** - * Geometric adapter for the PolygonFigure - * - * @author Eduardo Francos - InContext - * @created 3 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class PolygonFigureGeometricAdapter extends PolygonFigure - implements GeometricFigure { - - /** - * Constructor for the PolyLineFigureGeometricAdapter object - */ - public PolygonFigureGeometricAdapter() { - super(); - } - - /** - *Constructor for the PolyLineFigureGeometricAdapter object - * - * @param x Description of the Parameter - * @param y Description of the Parameter - */ - public PolygonFigureGeometricAdapter(int x, int y) { - super(x, y); - } - - /** - *Constructor for the PolyLineFigureGeometricAdapter object - * - * @param p Description of the Parameter - */ - public PolygonFigureGeometricAdapter(Polygon p) { - super(p); - } - - /** - * Gets the shape attribute of the PolygonFigure object - * - * @return The shape value - */ - public Shape getShape() { - return getInternalPolygon(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceContentProducer.java deleted file mode 100644 index c33422649a246842b6ffae17d6d35bed61f97eb6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceContentProducer.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @(#)ResourceContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.IOException; - -import java.io.InputStream; -import java.io.Serializable; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * ResourceContentProducer produces contents from resource in the application's - * CLASSPATH.<br> - * It takes a resource name and loads the resource as a String. - * - * It can either be specific if set for a specific resource, or generic, retrieving - * any resource passed to the getContents method. - * - * @author Eduardo Francos - InContext - * @created 1 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class ResourceContentProducer extends AbstractContentProducer - implements Serializable { - - /** Description of the Field */ - private String fResourceName; - - /** - * Constructor for the ResourceContentProducer object - */ - public ResourceContentProducer() { } - - /** - * Constructor for the ResourceContentProducer object - * - * @param resourceName Description of the Parameter - */ - public ResourceContentProducer(String resourceName) { - setResourceName(resourceName); - } - - /** - * Gets the content attribute of the ResourceContentProducer object - * - * @param context Description of the Parameter - * @param ctxAttrName Description of the Parameter - * @param ctxAttrValue Description of the Parameter - * @return The content value - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - try { - // if we have our own resource then use it - // otherwise use the one supplied - String resourceName = (getResourceName() != null) ? getResourceName() : (String)ctxAttrValue; - - InputStream reader = this.getClass().getResourceAsStream(resourceName); - int available = reader.available(); - byte contents[] = new byte[available]; - reader.read(contents, 0, available); - reader.close(); - return new String(contents); - } - catch (Exception ex) { - ex.printStackTrace(); - return ex.toString(); - } - } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeString(getResourceName()); - } - - /** - * Writes the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - setResourceName (dr.readString()); - } - - public String getResourceName() { - return fResourceName; - } - - protected void setResourceName(String newResourceName) { - fResourceName = newResourceName; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceDisposabilityStrategy.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceDisposabilityStrategy.java deleted file mode 100644 index efd61fbda14f7282ab8702fb69256ed020259d02..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceDisposabilityStrategy.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @(#)ResourceDisposabilityStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * ResourceDisposabilityStrategy defines the interface for resource disposal - * strategies.<br> - * The strategy defines the logic used to determine which and when a resource can - * be efficiently disposed of. A smarter the strategy leads to few resource - * regeneration. - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public interface ResourceDisposabilityStrategy { - - /** - * Sets the manager holding the resources for this strategy - * - * @param manager The new manager value - */ - public void setManager(DisposableResourceManager manager); - - - /** - * Gets the manager holding the resources for this strategy - * - * @return The manager value - */ - public DisposableResourceManager getManager(); - - /** - * Activates the strategy which starts disposing of resources as fitted - * - * @exception ResourceManagerNotSetException Description of the Exception - */ - public void startDisposing() throws ResourceManagerNotSetException; - - /** - * Deactivates the strategy that stops automatic disposal of resource.<br> - * The millis parameters specifies in milliseconds the time to wait for - * the disposal to stop. After this time the method returns, but the - * deactivation request remain active. - * - * @param millis time to wait for disposal to stop - */ - public void stopDisposing(long millis); -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceManagerNotSetException.java b/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceManagerNotSetException.java deleted file mode 100644 index d85661bdb3105bc2c05c5510e3af4492c8795bc9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/ResourceManagerNotSetException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * @(#)ResourceManagerNotSetException .java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -/** - * - * @author Eduardo Francos - InContext - * @created 4 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class ResourceManagerNotSetException extends Exception { - - /** - * Constructor for the ResourceManagerNotSetException object - */ - public ResourceManagerNotSetException() { } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/RoundRectangleGeometricAdapter.java b/JHotDraw/src/CH/ifa/draw/contrib/html/RoundRectangleGeometricAdapter.java deleted file mode 100644 index 1ceba1f6265b015fcfa1fcb3bf21aa11315a4221..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/RoundRectangleGeometricAdapter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * @(#)RoundRectangleGeometricAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.RoundRectangle2D; -import CH.ifa.draw.figures.RoundRectangleFigure; - -/** - * Geometric adapter for the RoundRectangleFigure - * - * @author Eduardo Francos - InContext - * @created 4 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class RoundRectangleGeometricAdapter extends RoundRectangleFigure - implements GeometricFigure { - - /** - * Constructor for the RoundRectangleGeometricAdapter object - */ - public RoundRectangleGeometricAdapter() { - super(); - } - - /** - *Constructor for the RoundRectangleGeometricAdapter object - * - * @param origin Description of the Parameter - * @param corner Description of the Parameter - */ - public RoundRectangleGeometricAdapter(Point origin, Point corner) { - super(origin, corner); - } - - /** - * Gets the shape attribute of the TriangleFigure object - * - * @return The shape value - */ - public Shape getShape() { - Point arc = getArc(); - Rectangle dspBox = displayBox(); - RoundRectangle2D.Float roundRectangle = new RoundRectangle2D.Float( - dspBox.x, dspBox.y, dspBox.width, dspBox.height, - arc.x, arc.y); - - return roundRectangle; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/StandardDisposableResourceHolder.java b/JHotDraw/src/CH/ifa/draw/contrib/html/StandardDisposableResourceHolder.java deleted file mode 100644 index ff8617e7806b6763cfacf3609b80fc765c55d0fb..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/StandardDisposableResourceHolder.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * @(#)StandardDisposableResourceHolder.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.Serializable; - -/** - * StandardDisposableResourceHolder is a standard implementation of the - * DisposableResourceHolder interface - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class StandardDisposableResourceHolder implements DisposableResourceHolder, Serializable { - - /** The holded resource object */ - private Object resource = null; - - /** The dispose delay, default to 60 seconds */ - private long disposeDelay = 60000; - - /** - * The last time the resource was accessed as returned by - * <code>System.currentTimeMillis()</code> - */ - private long lastTimeAccessed = 0; - - /** True if the resource is locked */ - private boolean isLocked = false; - - /** - * Constructor for the StandardDisposableResourceHolder object - */ - public StandardDisposableResourceHolder() { } - - /** - * Constructor for the StandardDisposableResourceHolder object - * - * @param resource Description of the Parameter - */ - public StandardDisposableResourceHolder(Object newResource) { - resource = newResource; - resetDelay(); - } - - /** - * Makes a clone of this - * - * @return the clone - */ - public Object clone() { - StandardDisposableResourceHolder clone = new StandardDisposableResourceHolder(); - clone.setDisposableDelay(this.getDisposableDelay()); - return clone; - } - - /** - * Gets the resource attribute of the StandardDisposableResourceHolder object - * - * @return The resource value - * @exception NullPointerException Description of the Exception - */ - public Object getResource() throws NullPointerException { - if (resource != null) { - resetDelay(); - return resource; - } - throw new NullPointerException(); - } - - /** - * Sets the resource attribute of the StandardDisposableResourceHolder object - * - * @param resource The new resource value - */ - public void setResource(Object newResource) { - resource = newResource; - resetDelay(); - } - - /** - * Sets the disposableDelay attribute of the StandardDisposableResourceHolder object - * - * @param millis The new disposableDelay value - */ - public void setDisposableDelay(long millis) { - disposeDelay = millis; - } - - /** - * Gets the disposableDelay attribute of the StandardDisposableResourceHolder object - * - * @return The disposableDelay value - */ - public long getDisposableDelay() { - return disposeDelay; - } - - /** Disposes of the resource */ - public void dispose() { - resource = null; - } - - /** - * Gets the available attribute of the StandardDisposableResourceHolder object - * - * @return The available value - */ - public boolean isAvailable() { - return (resource != null); - } - - /** - * Locks the resource so it cannot be automatically disposed of until unlock - * is called.<br> - * Explicit disposing by calling dispose() is still possible though. - */ - public void lock() { - isLocked = true; - } - - /** - * Unlocks the resource so it can be automatically disposed of again.<br> - * Explicit disposing by calling dispose() is still possible though. - */ - public void unlock() { - resetDelay(); - isLocked = false; - } - - /** - * True if the resource is locked - * - * @return The locked status - */ - public boolean isLocked() { - return isLocked; - } - - /** - * Gets the lastTimeAccessed attribute of the DisposableResourceHolder object - * - * @return The lastTimeAccessed value - */ - public long getLastTimeAccessed() { - return lastTimeAccessed; - } - - /** Resets the disposing delay so as to restart the time counter */ - public void resetDelay() { - lastTimeAccessed = System.currentTimeMillis(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/StandardDisposableResourceManager.java b/JHotDraw/src/CH/ifa/draw/contrib/html/StandardDisposableResourceManager.java deleted file mode 100644 index 1b2ef205fb9d8ce29d7839d9168110297c26598f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/StandardDisposableResourceManager.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * @(#)StandardDisposableResourceManager.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.util.Iterator; - -import java.util.WeakHashMap; - -/** - * StandardDisposableResourceManager implements disposable resource management - * using a client supplied strategy.<br> - * - * @author Eduardo Francos - InContext - * @created 2 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class StandardDisposableResourceManager implements DisposableResourceManager { - - /** The registered resources */ - private WeakHashMap resources; - - /** The disposing strategy */ - private ResourceDisposabilityStrategy strategy; - - /** - *Constructor for the StandardDisposableResourceManager object - * - * @param strategy Description of the Parameter - */ - public StandardDisposableResourceManager(ResourceDisposabilityStrategy newStrategy) { - resources = new WeakHashMap(); - setStrategy(newStrategy); - getStrategy().setManager(this); - } - - /** - * Registers a resource to be automatically disposed of - * - * @param resource the resource - */ - public synchronized void registerResource(DisposableResourceHolder resource) { - resources.put(resource, resource); - } - - /** - * Unregisters a resource so it is not automatically GCed.<br> - * If does nothing if the resource was not registered with this manager - * - * @param resource the resource - */ - public synchronized void unregisterResource(DisposableResourceHolder resource) { - resources.remove(resource); - } - - /** - * Gets an iterator on the managed resources - * - * @return The iterator - */ - public Iterator getResources() { - return resources.values().iterator(); - } - - /** - * Description of the Method - * - * @param resource the resource - * @return True if the resource is registered with this manager - */ - public synchronized boolean managesResource(DisposableResourceHolder resource) { - return resources.containsValue(resource); - } - - /** - * Gets the strategy attribute of the StandardDisposableResourceManager object - * - * @return The strategy value - */ - public ResourceDisposabilityStrategy getStrategy() { - return strategy; - } - - /** - * Sets the strategy attribute of the StandardDisposableResourceManager object - * - * @param newStrategy The new strategy value - */ - public void setStrategy(ResourceDisposabilityStrategy newStrategy) { - strategy = newStrategy; - } - - /** - * Activates the strategy which starts disposing of resources as fitted - * - * @exception ResourceManagerNotSetException Description of the Exception - */ - public void startDisposing() throws ResourceManagerNotSetException { - getStrategy().startDisposing(); - } - - /** - * Deactivates the strategy that stops automatic disposal of resource.<br> - * The millis parameters specifies in milliseconds the time to wait for - * the disposal to stop. After this time the method returns, but the - * deactivation request remain active. - * - * @param millis time to wait for disposal to stop - */ - public void stopDisposing(long millis) { - getStrategy().stopDisposing(millis); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/TextHolderContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/TextHolderContentProducer.java deleted file mode 100644 index 1cbc7915e9b4a0cd09a98d1440bc65dc814551e1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/TextHolderContentProducer.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * @(#)TextHolderContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.IOException; - -import java.io.Serializable; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; -import CH.ifa.draw.standard.TextHolder; - -/** - * TextAreaFigureContentProducer produces text contents from an existing - * TextHolder figure<br> - * It can either be specific if set for a specific figure, or generic, encoding - * any color passed to the getContents method.<br> - * The main usage of this producer is to embed a "master" or "shared" drawing - * figure into other figures so that updating the master figure automatically - * changes all dependent figures as well. Kind of a hot text snippet if you like<br> - * - * @author Eduardo Francos - InContext - * @created 30 avril 2002 - * @version <$CURRENT_VERSION$> - */ -public class TextHolderContentProducer extends AbstractContentProducer - implements Serializable { - - private TextHolder myTextHolder; - - /** - * Constructor for the TextAreaFigureContentProducer object - */ - public TextHolderContentProducer() { } - - /** - *Constructor for the TextAreaFigureContentProducer object - * - * @param figure Description of the Parameter - */ - public TextHolderContentProducer(TextHolder figure) { - setTextHolder(figure); - } - - /** - * Gets the text from the text figure - * - * @param context Description of the Parameter - * @param ctxAttrName Description of the Parameter - * @param ctxAttrValue Description of the Parameter - * @return The content value - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - // if we have our own figure then use it - // otherwise use the one supplied - TextHolder figure = (getTextHolder() != null) ? getTextHolder() : (TextHolder)ctxAttrValue; - // return the areas text - return figure.getText(); - } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeStorable(getTextHolder().getRepresentingFigure()); - } - - /** - * Writes the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - setTextHolder((TextHolder)dr.readStorable()); - } - - protected TextHolder getTextHolder() { - return myTextHolder; - } - - public void setTextHolder(TextHolder newFigure) { - myTextHolder = newFigure; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/TriangleFigureGeometricAdapter.java b/JHotDraw/src/CH/ifa/draw/contrib/html/TriangleFigureGeometricAdapter.java deleted file mode 100644 index c95531263beb8b720af283ab5bac819d6a7218eb..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/TriangleFigureGeometricAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * @(#)TriangleFigureGeometricAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.awt.Point; -import java.awt.Shape; -import CH.ifa.draw.contrib.TriangleFigure; - -/** - * Geometric adapter for the TriangleFigure - * - * @author Eduardo Francos - InContext - * @created 4 mai 2002 - * @version <$CURRENT_VERSION$> - */ -public class TriangleFigureGeometricAdapter extends TriangleFigure - implements GeometricFigure { - - /** - * Constructor for the TriangleFigureGeometricAdapter object - */ - public TriangleFigureGeometricAdapter() { - super(); - } - - /** - *Constructor for the TriangleFigureGeometricAdapter object - * - * @param origin Description of the Parameter - * @param corner Description of the Parameter - */ - public TriangleFigureGeometricAdapter(Point origin, Point corner) { - super(origin, corner); - } - - /** - * Gets the shape attribute of the TriangleFigure object - * - * @return The shape value - */ - public Shape getShape() { - return getPolygon(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/html/URLContentProducer.java b/JHotDraw/src/CH/ifa/draw/contrib/html/URLContentProducer.java deleted file mode 100644 index a9cdf2c0202a678ccebc3ea366313c4a3c720363..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/html/URLContentProducer.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * @(#)URLContentProducer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.html; - -import java.io.IOException; - -import java.io.InputStream; -import java.io.Serializable; -import java.net.URL; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -/** - * URLContentProducer produces string contents from URLs.<br> - * Anything the <code>URL.openStream()</code> method can get can be retrieved - * by this producer, that includes resources, local files, web documents, - * web queries, FTP files, and you name it.<br> - * It can either be specific if set for a specific URL, or generic, retrieving - * any URL passed to the getContents method. - * - * @author Eduardo Francos - InContext - * @created 4 mai 2002 - * @version <$CURRENT_VERSION$> - * @todo should we cache the contents for specific URLs? this can - * accelerate things a lot for static documents, but for dynamic ones it - * will complicate things. If cached then if must be in a DisposableResourceHolder - */ -public class URLContentProducer extends FigureDataContentProducer - implements Serializable { - - /** the specific URL */ - private URL fURL; - - /** - * Constructor for the URLContentProducer object - */ - public URLContentProducer() { } - - /** - *Constructor for the URLContentProducer object - * - * @param url the specific URL - */ - public URLContentProducer(URL url) { - setURL(url); - } - - /** - * Retrieves the contents of the URL pointed object - * - * @param context the calling client context - * @param ctxAttrName the attribute name that led to this being called - * @param ctxAttrValue the value of the URL attribute - * @return the contents of the URL pointed object as a string - */ - public Object getContent(ContentProducerContext context, String ctxAttrName, Object ctxAttrValue) { - try { - // if we have our own URL then use it - // otherwise use the one supplied - URL url = (getURL() != null) ? new URL(getURL().toExternalForm()) : new URL(((URL)ctxAttrValue).toExternalForm()); - - InputStream reader = url.openStream(); - int available = reader.available(); - byte contents[] = new byte[available]; - reader.read(contents, 0, available); - reader.close(); - return new String(contents); - } - catch (Exception ex) { - ex.printStackTrace(); - return ex.toString(); - } - } - - /** - * Writes the storable - * - * @param dw the storable output - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeBoolean((getURL() != null)); - if (getURL() != null) { - dw.writeString(getURL().toExternalForm()); - } - } - - /** - * Writes the storable - * - * @param dr the storable input - * @exception IOException thrown by called methods - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - boolean hasURL = dr.readBoolean(); - if (hasURL) { - setURL(new URL(dr.readString())); - } - } - - public URL getURL() { - return fURL; - } - - protected void setURL(URL newURL) { - fURL = newURL; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/AreaTracker.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/AreaTracker.java deleted file mode 100644 index e049ba7b8d6b54bad5e0d38b30fb65322c945a13..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/AreaTracker.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @(#)AreaTracker.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.standard.AbstractTool; - -import java.awt.*; -import java.awt.event.MouseEvent; - -/** - * A rubberband area tracker. It can be extended to do anything with - * the resulting area, e.g. select it or zoom it. This code is - * derived from SelectAreaTracker, which is a bit too specific to - * allow for extension. - * - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public abstract class AreaTracker extends AbstractTool { - - private Rectangle area; - - protected AreaTracker(DrawingEditor editor) { - super(editor); - } - - public Rectangle getArea() { - return new Rectangle(area.x, area.y, area.width, area.height); - } - - public void mouseDown(MouseEvent e, int x, int y) { - // use event coordinates to supress any kind of - // transformations like constraining points to a grid - super.mouseDown(e, e.getX(), e.getY()); - rubberBand(getAnchorX(), getAnchorY(), getAnchorX(), getAnchorY()); - } - - public void mouseDrag(MouseEvent e, int x, int y) { - super.mouseDrag(e, x, y); - eraseRubberBand(); - rubberBand(getAnchorX(), getAnchorY(), x, y); - } - - public void mouseUp(MouseEvent e, int x, int y) { - super.mouseUp(e, x, y); - eraseRubberBand(); - } - - private void rubberBand(int x1, int y1, int x2, int y2) { - area = new Rectangle(new Point(x1, y1)); - area.add(new Point(x2, y2)); - drawXORRect(area); - } - - private void eraseRubberBand() { - drawXORRect(area); - } - - private void drawXORRect(Rectangle r) { - Graphics g = view().getGraphics(); - g.setXORMode(view().getBackground()); - g.setColor(Color.black); - g.drawRect(r.x, r.y, r.width, r.height); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/DoubleBufferImage.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/DoubleBufferImage.java deleted file mode 100644 index 887178c80dab6f66e8c4285ceef03922e68a1b2d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/DoubleBufferImage.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * @(#)DoubleBufferImage.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import java.awt.*; -import java.awt.image.ImageObserver; -import java.awt.image.ImageProducer; - -/** - * A DoubleBufferImage is an image that scaling components, such as a - * ZoomDrawingView, use for double buffering. Drawing into this image - * is scaled, but when the image is written to the screen, no more - * scaling occurs. This is ensured by the implementation here and - * by the corresponding drawImage methods in ScalingGraphics. - * - * Note: this class is only needed for a JDK1.1 compliant implementation - * - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public class DoubleBufferImage extends java.awt.Image { - - private Image real; - private double scale; - - public DoubleBufferImage(Image newReal, double newScale) { - real = newReal; - scale = newScale; - } - - public Image getRealImage() { - return real; - } - - public void flush() { - real.flush(); - } - - public Graphics getGraphics() { - // Return an appropriate scaling graphics context, - // so that all drawing operations into this image - // are scaled. - ScalingGraphics result = new ScalingGraphics(real.getGraphics()); - result.setScale(scale); - return result; - } - - public int getHeight(ImageObserver observer) { - return real.getHeight(observer); - } - - public Object getProperty(String name, ImageObserver observer) { - return real.getProperty(name, observer); - } - - public Image getScaledInstance(int width, int height, int hints) { - return real.getScaledInstance(width, height, hints); - } - - public ImageProducer getSource() { - return real.getSource(); - } - - public int getWidth(ImageObserver observer) { - return real.getWidth(observer); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/MiniMapZoomableView.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/MiniMapZoomableView.java deleted file mode 100644 index 0853bfa728bc453efc69e63b03b5372482250b83..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/MiniMapZoomableView.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#)MiniMapZoomableView.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.contrib.MiniMapView; -import CH.ifa.draw.framework.DrawingView; - -import java.awt.geom.AffineTransform; -import java.awt.geom.NoninvertibleTransformException; -import javax.swing.JScrollPane; - -/** - * Specialized sub-class of MiniMapView to handle the zooming ability of the ZoomDrawingView in JHotDraw. This subclass has been enhanced - * to take into consideration that the scrollpane's content may itself be altered by a transform (namely a scaling transform). - * - * @author S. Ruman (sruman@rogers.com) - * @version <$CURRENT_VERSION$> - */ -public class MiniMapZoomableView extends MiniMapView { - public MiniMapZoomableView(DrawingView newMappedDrawingView, JScrollPane subject) { - super(newMappedDrawingView, subject); - } - -// Overridden - public AffineTransform getInverseSubjectTransform() { - double subjectsScale = ((ZoomDrawingView)getMappedComponent()).getScale(); - - AffineTransform at = null; - try { - at = AffineTransform.getScaleInstance(subjectsScale, subjectsScale).createInverse(); // undo the zoom of the zoomable drawing view - } - catch (NoninvertibleTransformException nte) { - // all scale-only transforms should be invertable - } - - return at; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ScalingGraphics.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/ScalingGraphics.java deleted file mode 100644 index 93215c5ca0370ea41655973760573c54fe065903..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ScalingGraphics.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * @(#)ScalingGraphics.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import java.awt.*; -import java.awt.image.ImageObserver; - -/** - * A graphics context that can scale to an arbitrary factor. - * - * Note: this class is only needed for a JDK1.1 compliant implementation - * - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public class ScalingGraphics extends java.awt.Graphics { - - /** - * The scale used for all drawing operations. - */ - private double scale = 1.0; - - /** - * The actual graphics context to which drawing is delegated. - */ - private Graphics real; - - /** - * The font with which the user thinks he is drawing. - * On the real graphics context, a scaled font is substituted - * for it (which may or may not be precisely to scale). - */ - private Font userFont; - - /** - * The current clipping rectangle, in user coordinates. - * Cached here to avoid unnecessary scaling back and forth. - */ - private Rectangle userClip; - - - public ScalingGraphics(Graphics realGraphics) { - real = realGraphics; - } - - /** - * Sets the scale to be used for any subsequent drawing operations. - * All coordinates are multiplied by this value in both x- and - * y-direction before drawing. Thus, a value of 1.0 means no - * scaling, smaller values shrink the picture, larger ones enlarge - * it. - */ - public void setScale(double newScale) { - scale = newScale; - } - - /** - * Returns the scale factor currently used for drawing operations. - * @see #setScale - */ - public double getScale() { - return scale; - } - - /** - * Returns the font that should be substituted for the - * given font at the given scale. - */ - private static Font scaledFont(Font f, double scale) { - int size = f.getSize(); - int scaledSize = (int) (size * scale); - //if (scaledSize < 6) scaledSize = 6; - return new Font(f.getFamily(), f.getStyle(), scaledSize); - } - - /** - * Scales a shape to the given scale. - */ - private static Shape scaledShape(Shape s, double scale) { - if (s instanceof Rectangle) { - Rectangle r = (Rectangle) s; - return new Rectangle((int) (r.x * scale), (int) (r.y * scale), - (int) (r.width * scale), (int) (r.height * scale)); - } - else { - throw new RuntimeException("Cannot scale shape: " + s.getClass().getName()); - } - } - - // delegating implementations below this line - - public Graphics create() { - Graphics realCopy = real.create(); - ScalingGraphics result = new ScalingGraphics(realCopy); - result.setScale(getScale()); - return result; - } - - public void translate(int x, int y) { - real.translate((int) (x * scale), (int) (y * scale)); - } - - public Color getColor() { - return real.getColor(); - } - - public void setColor(Color c) { - real.setColor(c); - } - - public void setPaintMode() { - real.setPaintMode(); - } - - public void setXORMode(Color c1) { - real.setXORMode(c1); - } - - public Font getFont() { - // returns the font with which the user thinks he is drawing - if (userFont == null) - userFont = real.getFont(); - return userFont; - } - - public void setFont(Font font) { - userFont = font; - real.setFont(scaledFont(font, scale)); - } - - public FontMetrics getFontMetrics() { - return new ScalingFontMetrics(userFont, real.getFontMetrics()); - } - - public FontMetrics getFontMetrics(Font f) { - // returns a ScalingFontMetrics object that measures distances - // on the real font, and scales them back to user coordinates - return new ScalingFontMetrics(f, - real.getFontMetrics(scaledFont(f, scale))); - } - - public Rectangle getClipBounds() { - return userClip; - } - - public void clipRect(int x, int y, int width, int height) { - if (userClip == null) - userClip = new Rectangle(x, y, width, height); - else - userClip = userClip.intersection(new Rectangle(x, y, width, height)); - real.clipRect((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale)); - } - - public void setClip(int x, int y, int width, int height) { - userClip = new Rectangle(x, y, width, height); - real.setClip((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale)); - } - - public Shape getClip() { - return userClip; - } - - public void setClip(Shape clip) { - userClip = (Rectangle) clip; - if (clip != null) - // Scale the Shape before applying it. - real.setClip(scaledShape(clip, scale)); - else - real.setClip(null); - } - - public void copyArea(int x, int y, int width, int height, - int dx, int dy) { - real.copyArea((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - (int) (dx * scale), (int) (dy * scale)); - } - - public void drawLine(int x1, int y1, int x2, int y2) { - real.drawLine((int) (x1 * scale), (int) (y1 * scale), - (int) (x2 * scale), (int) (y2 * scale)); - } - - public void fillRect(int x, int y, int width, int height) { - real.fillRect((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale)); - } - - public void clearRect(int x, int y, int width, int height) { - real.clearRect((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale)); - } - - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) { - real.drawRoundRect((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - (int) (arcWidth * scale), (int) (arcHeight * scale)); - } - - public void fillRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) { - real.fillRoundRect((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - (int) (arcWidth * scale), (int) (arcHeight * scale)); - } - - public void drawOval(int x, int y, int width, int height) { - real.drawOval((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale)); - } - - public void fillOval(int x, int y, int width, int height) { - real.fillOval((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale)); - } - - public void drawArc(int x, int y, int width, int height, - int startAngle, int arcAngle) { - real.drawArc((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - startAngle, arcAngle); - } - - public void fillArc(int x, int y, int width, int height, - int startAngle, int arcAngle) { - real.fillArc((int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - startAngle, arcAngle); - } - - public void drawPolyline(int xPoints[], int yPoints[], - int nPoints) { - int[] realXPoints = new int[nPoints]; - int[] realYPoints = new int[nPoints]; - for (int i = 0; i < nPoints; i++) { - realXPoints[i] = (int) (xPoints[i] * scale); - realYPoints[i] = (int) (yPoints[i] * scale); - } - real.drawPolyline(realXPoints, realYPoints, nPoints); - } - - public void drawPolygon(int xPoints[], int yPoints[], - int nPoints) { - int[] realXPoints = new int[nPoints]; - int[] realYPoints = new int[nPoints]; - for (int i = 0; i < nPoints; i++) { - realXPoints[i] = (int) (xPoints[i] * scale); - realYPoints[i] = (int) (yPoints[i] * scale); - } - real.drawPolygon(realXPoints, realYPoints, nPoints); - } - - public void fillPolygon(int xPoints[], int yPoints[], - int nPoints) { - int[] realXPoints = new int[nPoints]; - int[] realYPoints = new int[nPoints]; - for (int i = 0; i < nPoints; i++) { - realXPoints[i] = (int) (xPoints[i] * scale); - realYPoints[i] = (int) (yPoints[i] * scale); - } - real.fillPolygon(realXPoints, realYPoints, nPoints); - } - - public void drawString(String str, int x, int y) { - real.drawString(str, (int) (x * scale), (int) (y * scale)); - } - - // drop this method if using jdk 1.1 - public void drawString(java.text.AttributedCharacterIterator iterator, - int x, int y) { - real.drawString(iterator, (int) (x * scale), (int) (y * scale)); - } - - public boolean drawImage(Image img, int x, int y, - ImageObserver observer) { - // DoubleBufferImages must not be scaled. - if (img instanceof DoubleBufferImage) - return real.drawImage(((DoubleBufferImage) img).getRealImage(), - x, y, observer); - else - return real.drawImage(img, (int) (x * scale), (int) (y * scale), - (int) (img.getWidth(observer) * scale), - (int) (img.getHeight(observer) * scale), - observer); - } - - public boolean drawImage(Image img, int x, int y, - int width, int height, - ImageObserver observer) { - if (img instanceof DoubleBufferImage) - return real.drawImage(((DoubleBufferImage) img).getRealImage(), - x, y, width, height, observer); - else - return real.drawImage(img, (int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - observer); - } - - public boolean drawImage(Image img, int x, int y, - Color bgcolor, - ImageObserver observer) { - if (img instanceof DoubleBufferImage) - return real.drawImage(((DoubleBufferImage) img).getRealImage(), - x, y, bgcolor, observer); - else - return real.drawImage(img, (int) (x * scale), (int) (y * scale), - (int) (img.getWidth(observer) * scale), - (int) (img.getHeight(observer) * scale), - bgcolor, observer); - } - - public boolean drawImage(Image img, int x, int y, - int width, int height, - Color bgcolor, - ImageObserver observer) { - if (img instanceof DoubleBufferImage) - return real.drawImage(((DoubleBufferImage) img).getRealImage(), - x, y, width, height, bgcolor, observer); - else - return real.drawImage(img, (int) (x * scale), (int) (y * scale), - (int) (width * scale), (int) (height * scale), - bgcolor, observer); - } - - public boolean drawImage(Image img, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - ImageObserver observer) { - if (img instanceof DoubleBufferImage) - return real.drawImage(((DoubleBufferImage) img).getRealImage(), - dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, - observer); - else - return real.drawImage(img, (int) (dx1 * scale), (int) (dy1 * scale), - (int) (dx2 * scale), (int) (dy2 * scale), - (int) (sx1 * scale), (int) (sy1 * scale), - (int) (sx2 * scale), (int) (sy2 * scale), - observer); - } - - public boolean drawImage(Image img, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, - ImageObserver observer) { - if (img instanceof DoubleBufferImage) - return real.drawImage(((DoubleBufferImage) img).getRealImage(), - dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, - bgcolor, observer); - else - return real.drawImage(img, (int) (dx1 * scale), (int) (dy1 * scale), - (int) (dx2 * scale), (int) (dy2 * scale), - (int) (sx1 * scale), (int) (sy1 * scale), - (int) (sx2 * scale), (int) (sy2 * scale), - bgcolor, observer); - } - - public void dispose() { - real.dispose(); - } - - /** - * A scaling extension of the FontMetrics class. Measurements - * are performed on the actual, scaled font used on the screen, - * and then scaled back into user space. The object pretends - * to be measuring the font specified by the user when obtaining - * this FontMetrics object. - */ - private class ScalingFontMetrics extends FontMetrics { - - /** - * A FontMetrics object on the real, scaled font. All queries - * are forwarded to this object, and the results scaled back - * into user space. - */ - private FontMetrics real; - - /** - * The font which the user thinks he is asking about. - */ - private Font userFont; - - public ScalingFontMetrics(Font newUserFont, FontMetrics newReal) { - super(null); - userFont = newUserFont; - real = newReal; - } - - // Delegating methods below this line. Only those methods which - // the man page suggests as a minimal subset are implemented. - - public Font getFont() { - return userFont; - } - - public int getAscent() { - return (int) (real.getAscent() / ScalingGraphics.this.getScale()); - } - - public int getLeading() { - return (int) (real.getLeading() / ScalingGraphics.this.getScale()); - } - - public int getMaxAdvance() { - return (int) (real.getMaxAdvance() / ScalingGraphics.this.getScale()); - } - - public int charWidth(char ch) { - return (int) (real.charWidth(ch) / ScalingGraphics.this.getScale()); - } - - public int charsWidth(char[] data, int off, int len) { - return (int) (real.charsWidth(data, off, len) / - ScalingGraphics.this.getScale()); - } - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomAreaTracker.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomAreaTracker.java deleted file mode 100644 index e4ec88f3a6f465936f3496251c5afbd11d45f230..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomAreaTracker.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)ZoomAreaTracker.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.framework.DrawingEditor; - -import java.awt.*; -import java.awt.event.MouseEvent; - -/** - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public class ZoomAreaTracker extends AreaTracker { - - public ZoomAreaTracker(DrawingEditor editor) { - super(editor); - } - - public void mouseUp(MouseEvent e, int x, int y) { - Rectangle zoomArea = getArea(); - super.mouseUp(e, x, y); - if (zoomArea.width > 4 && zoomArea.height > 4) - ((ZoomDrawingView) view()).zoom(zoomArea.x, zoomArea.y, - zoomArea.width, zoomArea.height); - } - -} - - diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomCommand.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomCommand.java deleted file mode 100644 index 81186e7403191c1df7be373ffa62d734e7b7098c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomCommand.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @(#)ZoomCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.JHotDrawRuntimeException; - -import CH.ifa.draw.standard.AbstractCommand; - -/** - * A ZoomCommand allows for applying a zoom factor to a ZoomDrawingView.<br> - * Several ZoomCommand objects can be created in a menu or toolbar, set to various - * predefined zoom factors - * - * @author Eduardo Francos - * @created 26 april 2002 - * @version <CURRENT_VERSION> - */ -public class ZoomCommand extends AbstractCommand { - /** The scale factor to apply */ - protected float scale = 1.0f; - - /** - * Constructor for the ZoomCommand object - * - * @param name the command name - * @param scale Description of the Parameter - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public ZoomCommand(String newSame, float newScale, DrawingEditor newDrawingEditor) { - super(newSame, newDrawingEditor, true); - scale = newScale; - } - - - /** Executes the command */ - public void execute() { - super.execute(); - zoomView().zoom(scale); - } - - - /** - * Sets the zoom factor of the view - * - * @return ZoomDrawingView currently active in the editor - */ - public ZoomDrawingView zoomView() { - Object view = super.view(); - if (view instanceof ZoomDrawingView) { - return (ZoomDrawingView)view; - } - throw new JHotDrawRuntimeException("execute should NOT be getting called when view not instanceof ZoomDrawingView"); - } - - - /** - * Gets the scale attribute of the ZoomCommand object - * - * @return The scale value - */ - public float getScale() { - return scale; - } - - - /** - * Sets the scale attribute of the ZoomCommand object - * - * @param newScale The new scale value - */ - public void setScale(float newScale) { - scale = newScale; - } - - - /** - * Returns true if the command is executable with the current view - * - * @return true iff the view is a ZoomDrawingView - */ - protected boolean isExecutableWithView() { - return (view() instanceof ZoomDrawingView); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomDrawingView.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomDrawingView.java deleted file mode 100644 index 66b0ccfa6f107ee092c763acf67348952b9c048b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomDrawingView.java +++ /dev/null @@ -1,476 +0,0 @@ -/* - * @(#)ZoomDrawingView.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.framework.Drawing; -import CH.ifa.draw.framework.DrawingChangeEvent; -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.standard.StandardDrawing; -import CH.ifa.draw.standard.StandardDrawingView; -import CH.ifa.draw.util.Geom; - -import javax.swing.JViewport; -import java.awt.*; -import java.awt.event.*; -import java.awt.geom.AffineTransform; - -/** - * A view that can display drawings at an arbitrary scale. - * - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public class ZoomDrawingView extends StandardDrawingView { - - /** - * The current scaling factor - */ - private double scale = 1.0; - - /** - * The zooming speed, meaning the scaling factor change speed when doing - * zoomIn/zoomOut operations.<br> - * Default of 2.0 is increase 100% or decrease 50% the current factor.<br> - * Can be changed dynamically by clients using the setter method - */ - private double zoomSpeed = 2.0; - - public ZoomDrawingView(DrawingEditor editor) { - this(editor, MINIMUM_WIDTH, MINIMUM_HEIGHT); - } - - public ZoomDrawingView(DrawingEditor editor, int width, int height) { - super(editor, width, height); - } - - /** - * @return The current zoom scale of this view. The dimensions of - * figures are multiplied by this number before display. - */ - public final double getScale() { - return scale; - } - - /** - * Sets a new zoom scale for this view. The dimensions of figures - * are multiplied by this number before display. - */ - private void setScale(double newScale) { - // "de"-scale with old scale - Dimension oldSize = getUserSize(); - scale = newScale; - // re-scale with new scale - setUserSize(oldSize.width, oldSize.height); - centralize(drawing()); - forceRedraw(); - } - - private void forceRedraw() { - drawingInvalidated(new DrawingChangeEvent - (drawing(), new Rectangle(getSize()))); - repairDamage(); - } - - /** - * Sets the size of this view in user coordinates. The size of the view - * on the screen will be this size, multiplied by the current scale. - */ - public void setUserSize(int width, int height) { - setSize((int) (width * getScale()), - (int) (height * getScale())); - } - - /** - * Sets the size of this view in user coordinates. The size of the view - * on the screen will be this size, multiplied by the current scale. - */ - public void setUserSize(Dimension d) { - setUserSize(d.width, d.height); - } - - /** - * @return the size of this view, in screen coordinates - */ - public Dimension getSize() { - return super.getSize(); - } - - public Dimension getViewportSize() { - return getParent().getSize(); - } - - protected boolean hasZoomSupport() { - return getParent() instanceof JViewport; - } - - /** - * Sets the coordinates of the left top corner displayed by the view.<br> - */ - public void setOriginPosition(Point newOrigin) { - setViewPosition(newOrigin); - forceRedraw(); - } - - protected void setViewPosition(Point newPosition) { - ((JViewport)getParent()).setViewPosition(newPosition); - } - - /** - * @return The size of this view, in user coordinates. The size - * on the screen is this size, multiplied by the current scale. - */ - public Dimension getUserSize() { - Dimension screenSize = getSize(); - return new Dimension((int) (screenSize.width / getScale()), - (int) (screenSize.height / getScale())); - } - - /** - * Readjusts this view and its containing ScrollPane to display the - * given rectangle, which is given in user coordinates. This method - * only works if this view is contained in a JViewport. It throws - * a RuntimeException otherwise. - */ - public void zoom(int x, int y, int width, int height) { - if (hasZoomSupport()) { - Dimension viewportSize = getViewportSize(); - double xScale = (double) viewportSize.width / (double) width; - double yScale = (double) viewportSize.height / (double) height; - double newScale = Math.min(xScale, yScale); - - // "de"-scale with old scale - Dimension userSize = getUserSize(); - this.scale = newScale; - // re-scale with new scale - setUserSize(userSize); - - revalidate(); - setViewPosition( - new Point((int) (x * getScale()), (int) (y * getScale()))); - forceRedraw(); - } - else { - throw new RuntimeException - ("zooming only works if this view is contained in a ScrollPane"); - } - } - - /** - * Set this view's scale factor - */ - public void zoom(float newScale) { - if (hasZoomSupport()) { - JViewport viewport = (JViewport) getParent(); - Dimension viewportSize = viewport.getSize(); - Dimension userSize = getUserSize(); - scale = newScale; - Point viewOrg = viewport.getViewPosition(); - viewOrg.x = viewOrg.x + (viewportSize.width / 2); - viewOrg.y = viewOrg.y + (viewportSize.height / 2); - int xScreen = (int) (viewOrg.x * scale); - int yScreen = (int) (viewOrg.y * scale); - int xOrigin = xScreen - viewportSize.width / 2; - int yOrigin = yScreen - viewportSize.height / 2; - if (xOrigin < 0) xOrigin = 0; - if (yOrigin < 0) yOrigin = 0; - setUserSize(userSize); - revalidate(); - viewport.setViewPosition(new Point(xOrigin, yOrigin)); - forceRedraw(); - } - else { - throw new RuntimeException - ("zooming only works if this view is contained in a ScrollPane"); - } - } - - /** - * Zooms out by a factor of two, keeping point (x,y), which is given - * in user coordinates, in the center. - */ - public void zoomOut(int x, int y) { - if (hasZoomSupport()) { - Dimension viewportSize = getViewportSize(); - // "de"-scale with old scale - Dimension userSize = getUserSize(); - this.scale = getScale() / getZoomSpeed(); - int xScreen = (int) (x * getScale()); - int yScreen = (int) (y * getScale()); - int xOrigin = xScreen - viewportSize.width / 2; - int yOrigin = yScreen - viewportSize.height / 2; - if (xOrigin < 0) xOrigin = 0; - if (yOrigin < 0) yOrigin = 0; - // re-scale with new scale - setUserSize(userSize); - revalidate(); - setViewPosition(new Point(xOrigin, yOrigin)); - forceRedraw(); - } - else { - throw new RuntimeException - ("zooming only works if this view is contained in a ScrollPane"); - } - } - - /** - * InContext - * Zooms in by a factor of the current scale, keeping point (x,y), which is given - * in user coordinates, in the center. - */ - public void zoomIn(int x, int y) { - if (hasZoomSupport()) { - JViewport viewport = (JViewport) getParent(); - Dimension viewportSize = viewport.getSize(); - Dimension userSize = getUserSize(); - this.scale = getScale() * getZoomSpeed(); - int xScreen = (int) (x * getScale()); - int yScreen = (int) (y * getScale()); - int xOrigin = xScreen - viewportSize.width / 2; - int yOrigin = yScreen - viewportSize.height / 2; - if (xOrigin < 0) xOrigin = 0; - if (yOrigin < 0) yOrigin = 0; - setUserSize(userSize); - revalidate(); - viewport.setViewPosition(new Point(xOrigin, yOrigin)); - forceRedraw(); - } - else { - throw new RuntimeException - ("zooming only works if this view is contained in a ScrollPane"); - } - } - - /** - * Sets the zoom scale to 1.0 and adjusts the scroll pane - * so that point (x, y) is in the center. - */ - public void deZoom(int x, int y) { - if (hasZoomSupport()) { - Dimension viewportSize = getViewportSize(); - Dimension userSize = getUserSize(); - int xOrigin = x - viewportSize.width / 2; - int yOrigin = y - viewportSize.height / 2; - if (xOrigin < 0) xOrigin = 0; - if (yOrigin < 0) yOrigin = 0; - this.scale = 1.0; - setUserSize(userSize); - revalidate(); - setViewPosition(new Point((int) (xOrigin), - (int) (yOrigin))); - forceRedraw(); - } - else { - throw new RuntimeException - ("zooming only works if this view is contained in a ScrollPane"); - } - } - - public void paint(Graphics g) { - super.paint(transformGraphics(g, getScale())); - } - - public Graphics getGraphics() { - return transformGraphics(super.getGraphics(), getScale()); - } - - private final Graphics transformGraphics(Graphics g, double currentScale) { - if (currentScale != 1.0) { - Graphics2D g2 = (Graphics2D) g; - // Don't use setTransform() here because that would destroy - // any transformation that Swing sets for partial redrawing. - // Simply add our own transformation to any existing one. - g2.transform(AffineTransform.getScaleInstance(currentScale, currentScale)); - } - return g; - } - - /** - * Constrain to user coordinates, not screen coordinates. - */ - protected Point constrainPoint(Point p) { - Dimension size = getSize(); - p.x = Geom.range(1, (int) (size.width / getScale()), p.x); - p.y = Geom.range(1, (int) (size.height / getScale()), p.y); - if (getConstrainer() != null) { - return getConstrainer().constrainPoint(p); - } - return p; - } - - public void drawBackground(Graphics g) { - g.setColor(getBackground()); - g.fillRect(0, 0, - (int) (getBounds().width / getScale()), - (int) (getBounds().height / getScale())); - } - - private void centralize(Drawing d, Dimension bounds) { - Point boundsCenter = new Point(bounds.width / 2, bounds.height / 2); - Rectangle r = ((StandardDrawing) d).displayBox(); - Point drawingCenter = new Point(r.x + r.width / 2, r.y + r.height / 2); - int diffX = boundsCenter.x - drawingCenter.x; - int diffY = boundsCenter.y - drawingCenter.y; - if (diffX != 0 || diffY != 0) { - for (FigureEnumeration fe = d.figures(); fe.hasNextFigure();) { - fe.nextFigure().moveBy(diffX, diffY); - } - } - } - - private void centralize(Drawing d) { - centralize(d, getUserSize()); - } - - public void setDrawing(Drawing d) { - super.setDrawing(d); - - Rectangle r = ((StandardDrawing) d).displayBox(); - //Dimension drawingSize = new Dimension(r.width, r.height); - Dimension viewportSize = new Dimension(r.width, r.height); - if (getParent() != null) { - viewportSize = getViewportSize(); - } -/* - Dimension userSize = new Dimension(viewportSize); - this.scale = 1.0; - - while (drawingSize.width > userSize.width || - drawingSize.height > userSize.height) { - this.scale = getScale() / 2.0; - userSize.width = userSize.width * 2; - userSize.height = userSize.height * 2; - } - centralize(d, userSize); -*/ - super.setPreferredSize(viewportSize); - super.setSize(viewportSize); - revalidate(); - } - - public Dimension getMinimumSize() { - return super.getSize(); - } - - public Dimension getPreferredSize() { - return getMinimumSize(); - } - - /** - * Overridden to scale damage to screen coordinates. - */ - public void repairDamage() { - Rectangle damagedArea = getDamage(); - if (damagedArea != null) { - repaint((int) (damagedArea.x * getScale()), - (int) (damagedArea.y * getScale()), - (int) (damagedArea.width * getScale()), - (int) (damagedArea.height * getScale())); - setDamage(null); - } - } - - /** - * Overridden to accumulate damage in an instance variable of this class. - */ - public void drawingInvalidated(DrawingChangeEvent e) { - Rectangle r = e.getInvalidatedRectangle(); - if (getDamage() == null) { - setDamage(r); - } - else { - Rectangle damagedArea = getDamage(); - damagedArea.add(r); - // the returned rectange may be a clone so we better set it again - setDamage(damagedArea); - } - } - - /** - * @return a new MouseEvent, the coordinates of which are transformed - * to compensate for the current zoom factor - */ - private MouseEvent createScaledEvent(MouseEvent e) { - return new MouseEvent(e.getComponent(), - e.getID(), - e.getWhen(), - e.getModifiers(), - (int) (e.getX() / getScale()), - (int) (e.getY() / getScale()), - e.getClickCount(), - e.isPopupTrigger()); - } - - - protected MouseListener createMouseListener() { - return new StandardDrawingView.DrawingViewMouseListener() { - public void mousePressed(MouseEvent e) { - super.mousePressed(createScaledEvent(e)); - } - public void mouseReleased(MouseEvent e) { - super.mouseReleased(createScaledEvent(e)); - } - }; - } - - protected MouseMotionListener createMouseMotionListener() { - return new StandardDrawingView.DrawingViewMouseMotionListener() { - public void mouseDragged(MouseEvent e) { - super.mouseDragged(createScaledEvent(e)); - } - public void mouseMoved(MouseEvent e) { - super.mouseMoved(createScaledEvent(e)); - } - }; - } - - protected KeyListener createKeyListener() { - return new StandardDrawingView.DrawingViewKeyListener() { - public void keyPressed(KeyEvent e) { - super.keyPressed(e); - if (e.getKeyChar() == ' ') { - forceRedraw(); - } - else if (e.getKeyChar() == 'o') { - setScale(getScale() / getZoomSpeed()); - } - else if (e.getKeyChar() == 'i') { - setScale(getScale() * getZoomSpeed()); - } - else if (e.getKeyChar() == 'c') { - centralize(drawing()); - } - else { - super.keyPressed(e); - } - } - }; - } - - /** - * Returns the current zoom speed - */ - public double getZoomSpeed() - { - return zoomSpeed; - } - - /** - * Set the zoom speed. Will be greater than 1. - */ - public void setZoomSpeed(double newZoomSpeed) - { - // check greater than 1. A smaller value would reverse the zooming - // operation, and a zero value would provoque divide by zero exceptions - zoomSpeed = Math.max(1.1, newZoomSpeed); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomTool.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomTool.java deleted file mode 100644 index 2afca768bc0e73984d3118245ef914452aafdf28..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomTool.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @(#)ZoomTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.Tool; -import CH.ifa.draw.standard.AbstractTool; - -import java.awt.event.InputEvent; -import java.awt.event.MouseEvent; - -/** - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public class ZoomTool extends AbstractTool { - - private Tool child; - - public ZoomTool(DrawingEditor editor) { - super(editor); - } - - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e,x,y); - // Added handling for SHIFTed and CTRLed BUTTON3_MASK so that normal - // BUTTON3_MASK does zoomOut, SHIFTed BUTTON3_MASK does zoomIn - // and CTRLed BUTTON3_MASK does deZoom - if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) { - if (child != null) { - return; - } - view().freezeView(); - child = new ZoomAreaTracker(editor()); - child.mouseDown(e, x, y); - } - else if ((e.getModifiers() & InputEvent.BUTTON2_MASK) != 0) { - ((ZoomDrawingView) view()).deZoom(x, y); - } - else if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { - if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) { - ((ZoomDrawingView)view()).zoomIn(x, y); - } - else if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) { - - ((ZoomDrawingView) view()).deZoom(x, y); - } - else { - ((ZoomDrawingView)view()).zoomOut(x, y); - } - } - } - - public void mouseDrag(MouseEvent e, int x, int y) { - if (child != null) { - child.mouseDrag(e, x, y); - } - } - - public void mouseUp(MouseEvent e, int x, int y) { - if (child != null) { - view().unfreezeView(); - child.mouseUp(e, x, y); - } - child = null; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomUpdateStrategy.java b/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomUpdateStrategy.java deleted file mode 100644 index b1a8a40e3c7069bd602c7c312119b01d7ccdce1d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/contrib/zoom/ZoomUpdateStrategy.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * @(#)ZoomUpdateStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.contrib.zoom; - -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.framework.Painter; - -import java.awt.*; - -/** - * A variant of the BufferedUpdateStrategy that handles clipping - * rectangles correctly in the presence of zooming. - * @see CH.ifa.draw.standard.BufferedUpdateStrategy - * - * @author Andre Spiegel <spiegel@gnu.org> - * @version <$CURRENT_VERSION$> - */ -public class ZoomUpdateStrategy implements Painter { - - /** - * The offscreen image - */ - transient private Image fOffscreen; - private int fImagewidth = -1; - private int fImageheight = -1; - - /** - * Draws the view contents. - */ - public void draw(Graphics g, DrawingView view) { - // create the buffer if necessary - Dimension d = view.getSize(); - if ((fOffscreen == null) || (d.width != fImagewidth) - || (d.height != fImageheight)) { - fOffscreen = view.createImage(d.width, d.height); - fImagewidth = d.width; - fImageheight = d.height; - } - - Graphics g2 = fOffscreen.getGraphics(); - Rectangle r = g.getClipBounds(); - - if (g2 instanceof ScalingGraphics) { - ScalingGraphics s2 = (ScalingGraphics) g2; - - // AWT sets clipping rectangles in screen coordinates, not user - // coordinates. Therefore, we scale the clipping rectangle to - // user coordinates here, and then apply it to both buffers, - // which scale it back to screen coordinates. - if (r != null) { - // Make the rectangle slightly larger, to compensate - // for integer rounding errors. - r = new Rectangle((int) ((r.x - 2) / s2.getScale()), - (int) ((r.y - 2) / s2.getScale()), - (int) ((r.width + 4) / s2.getScale()), - (int) ((r.height + 4) / s2.getScale())); - g.setClip(r); - } - } - g2.setClip(r); - - view.drawAll(g2); - g.drawImage(fOffscreen, 0, 0, view); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures.jdo b/JHotDraw/src/CH/ifa/draw/figures.jdo deleted file mode 100644 index 340c305bc4facf6cf0404ae8d6566bbc1d7d8e31..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures.jdo +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jdo SYSTEM "jdo.dtd"> -<jdo> - <package name="CH.ifa.draw.figures"> - <class name="AttributeFigure"> - </class> - <class name="ArrowTip"> - </class> - <class name="ChopEllipseConnector"> - </class> - <class name="ElbowConnection"> - </class> - <class name="EllipseFigure"> - <field name="fDisplayBox"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - <field name="fPoints"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - </class> - <class name="FigureAttributes"> - <field name="fMap"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - </class> - <class name="GroupFigure"> - </class> - <class name="ImageFigure"> - </class> - <class name="LineFigure"> - </class> - <class name="NullConnector"> - </class> - <class name="NullFigure"> - </class> - <class name="NumberTextFigure"> - </class> - <class name="PolyLineConnector"> - </class> - <class name="PolyLineFigure"> - <field name="fFrameColor"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - </class> - <class name="ShortestDistanceConnector"> - </class> - <class name="RectangleFigure"> - <field name="fDisplayBox"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - </class> - <class name="RoundRectangleFigure"> - </class> - <class name="TextFigure"> - <field name="fFont"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> - </class> - </package> -</jdo> diff --git a/JHotDraw/src/CH/ifa/draw/figures/AbstractLineDecoration.java b/JHotDraw/src/CH/ifa/draw/figures/AbstractLineDecoration.java deleted file mode 100644 index 3e50d5f65f7ab57edda85ef04ab7ea28e60005fa..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/AbstractLineDecoration.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * @(#)AbstractLineDecoration.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.io.*; -import java.awt.*; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -/** - * An standard implementation of a line decoration. - * - * @see PolyLineFigure - * - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractLineDecoration implements LineDecoration { - - static final long serialVersionUID = 1577970039258356627L; - - private Color fFillColor; - private Color fBorderColor; - private transient Rectangle myBounds; - - public AbstractLineDecoration() { - } - - /** - * Draws the arrow tip in the direction specified by the given two - * points.. (template method) - */ - public void draw(Graphics g, int x1, int y1, int x2, int y2) { - // TBD: reuse the Polygon object - Polygon p = outline(x1, y1, x2, y2); - myBounds = p.getBounds(); - if (getFillColor() == null) { - g.fillPolygon(p.xpoints, p.ypoints, p.npoints); - } - else { - Color drawColor = g.getColor(); - g.setColor(getFillColor()); - g.fillPolygon(p.xpoints, p.ypoints, p.npoints); - g.setColor(drawColor); - } - - if (getBorderColor() != getFillColor()) { - Color drawColor = g.getColor(); - g.setColor(getBorderColor()); - g.drawPolygon(p.xpoints, p.ypoints, p.npoints); - g.setColor(drawColor); - } - } - - /** - * The LineDecoration has only a displayBox after it has been drawn - * at least once. If it has not yet been drawn then a rectangle of size 0 - * is returned. - * @return the display box of a LineDecoration. - */ - public Rectangle displayBox() { - if (myBounds != null) { - return myBounds; - } - else { - return new Rectangle(0, 0); - } - } - - /** - * Hook method to calculates the outline of an arrow tip. - */ - public abstract Polygon outline(int x1, int y1, int x2, int y2); - - /** - * Stores the arrow tip to a StorableOutput. - */ - public void write(StorableOutput dw) { - if (getFillColor() != null) { - FigureAttributes.writeColor(dw, FigureAttributeConstant.FILL_COLOR.getName(), getFillColor()); - } - else { - dw.writeString("no" + FigureAttributeConstant.FILL_COLOR.getName()); - } - - if (getBorderColor() != null) { - FigureAttributes.writeColor(dw, FigureAttributeConstant.FRAME_COLOR.getName(), getBorderColor()); - } - else { - dw.writeString("no" + FigureAttributeConstant.FRAME_COLOR.getName()); - } - } - - /** - * Reads the arrow tip from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - String fillColorId = dr.readString(); - // read color only if one has been written - if (fillColorId.equals(FigureAttributeConstant.FRAME_COLOR.getName())) { - setFillColor(FigureAttributes.readColor(dr)); - } - String borderColorId = dr.readString(); - // read color only if one has been written - if (borderColorId.equals("BorderColor") - || borderColorId.equals(FigureAttributeConstant.FRAME_COLOR.getName())) { - setBorderColor(FigureAttributes.readColor(dr)); - } - } - - /** - * Sets color with which arrow is filled - */ - public void setFillColor(Color fillColor) { - fFillColor = fillColor; - } - - /** - * Returns color with which arrow is filled - */ - public Color getFillColor() { - return fFillColor; - } - - /** - * Sets color of arrow's border - */ - public void setBorderColor(Color borderColor) { - fBorderColor = borderColor; - } - - /** - * Returns color of arrow's border - */ - public Color getBorderColor() { - return fBorderColor; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/ArrowTip.java b/JHotDraw/src/CH/ifa/draw/figures/ArrowTip.java deleted file mode 100644 index a855314be261665b9005ca34243994261b554fe6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ArrowTip.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * @(#)ArrowTip.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.io.*; -import java.awt.*; - -import CH.ifa.draw.util.*; - -/** - * An arrow tip line decoration. - * - * @see PolyLineFigure - * - * @version <$CURRENT_VERSION$> - */ -public class ArrowTip extends AbstractLineDecoration { - - private double fAngle; // pointiness of arrow - private double fOuterRadius; - private double fInnerRadius; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -3459171428373823638L; - private int arrowTipSerializedDataVersion = 1; - - public ArrowTip() { - this(0.40, 8, 8); // this(0.35, 15, 12); - } - - /** - * Constructs an arrow tip with the given angle and radius. - */ - public ArrowTip(double angle, double outerRadius, double innerRadius) { - setAngle(angle); - setOuterRadius(outerRadius); - setInnerRadius(innerRadius); - } - - /** - * Calculates the outline of an arrow tip. - */ - public Polygon outline(int x1, int y1, int x2, int y2) { - double dir = Math.PI/2 - Math.atan2(x2 - x1, y2 - y1); - return outline(x1, y1, dir); - } - - private Polygon outline(int x, int y, double direction) { - Polygon shape = new Polygon(); - - shape.addPoint(x, y); - addPointRelative(shape, x, y, getOuterRadius(), direction - getAngle()); - addPointRelative(shape, x, y, getInnerRadius(), direction); - addPointRelative(shape, x, y, getOuterRadius(), direction + getAngle()); - shape.addPoint(x,y); // Closing the polygon (TEG 97-04-23) - return shape; - } - - private void addPointRelative(Polygon shape, int x, int y, double radius, double angle) { - shape.addPoint( - x + (int) (radius * Math.cos(angle)), - y + (int) (radius * Math.sin(angle))); - } - - /** - * Stores the arrow tip to a StorableOutput. - */ - public void write(StorableOutput dw) { - dw.writeDouble(getAngle()); - dw.writeDouble(getOuterRadius()); - dw.writeDouble(getInnerRadius()); - super.write(dw); - } - - /** - * Reads the arrow tip from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - setAngle(dr.readDouble()); - setOuterRadius(dr.readDouble()); - setInnerRadius(dr.readDouble()); - super.read(dr); - } - - /** - * Sets point angle of arrow. A smaller angle leads to a pointier arrow. - * The angle is measured between the arrow line and one of the points - * at the side of the arrow. Thus, the total angle at the arrow tip - * is the double of the angle specified. - */ - protected void setAngle(double newAngle) { - fAngle = newAngle; - } - - /** - * Returns point angle of arrow. A smaller angle leads to a pointier arrow. - * The angle is measured between the arrow line and one of the points - * at the side of the arrow. Thus, the total angle at the arrow tip - * is the double of the angle specified. - */ - protected double getAngle() { - return fAngle; - } - - /** - * Sets the inner radius - */ - protected void setInnerRadius(double newInnerRadius) { - fInnerRadius = newInnerRadius; - } - - /** - * Returns the inner radius - */ - protected double getInnerRadius() { - return fInnerRadius; - } - - /** - * Sets the outer radius - */ - protected void setOuterRadius(double newOuterRadius) { - fOuterRadius = newOuterRadius; - } - - /** - * Returns the outer radius - */ - protected double getOuterRadius() { - return fOuterRadius; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/AttributeFigure.java b/JHotDraw/src/CH/ifa/draw/figures/AttributeFigure.java deleted file mode 100644 index dbadb25f4d9c2c651df42cc75a3ed57a9c04abb0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/AttributeFigure.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * @(#)AttributeFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -import java.awt.*; -import java.io.*; - -/** - * A figure that can keep track of an open ended set of attributes. - * The attributes are stored in a dictionary implemented by - * FigureAttributes. - * - * @see Figure - * @see Handle - * @see FigureAttributes - * - * @version <$CURRENT_VERSION$> - */ -public abstract class AttributeFigure extends AbstractFigure { - - /** - * The attributes of a figure. Each figure can have - * an open ended set of attributes. Attributes are - * identified by name. - * @see #getAttribute - * @see #setAttribute - */ - private FigureAttributes fAttributes; - - /** - * The default attributes associated with a figure. - * If a figure doesn't have an attribute set, a default - * value from this shared attribute set is returned. - * @see #getAttribute - * @see #setAttribute - */ - private static FigureAttributes fgDefaultAttributes = null; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -10857585979273442L; - private int attributeFigureSerializedDataVersion = 1; - - protected AttributeFigure() { } - - /** - * Draws the figure in the given graphics. Draw is a template - * method calling drawBackground followed by drawFrame. - */ - public void draw(Graphics g) { - Color fill = getFillColor(); - if (!ColorMap.isTransparent(fill)) { - g.setColor(fill); - drawBackground(g); - } - Color frame = getFrameColor(); - if (!ColorMap.isTransparent(frame)) { - g.setColor(frame); - drawFrame(g); - } - } - - /** - * Draws the background of the figure. - * @see #draw - */ - protected void drawBackground(Graphics g) { - } - - /** - * Draws the frame of the figure. - * @see #draw - */ - protected void drawFrame(Graphics g) { - } - - /** - * Gets the fill color of a figure. This is a convenience - * method. - * @see #getAttribute - */ - public Color getFillColor() { - return (Color) getAttribute(FigureAttributeConstant.FILL_COLOR); - } - - /** - * Gets the frame color of a figure. This is a convenience - * method. - * @see #getAttribute - */ - public Color getFrameColor() { - return (Color) getAttribute(FigureAttributeConstant.FRAME_COLOR); - } - - //---- figure attributes ---------------------------------- - - private static void initializeAttributes() { - fgDefaultAttributes = new FigureAttributes(); - fgDefaultAttributes.set(FigureAttributeConstant.FRAME_COLOR, Color.black); - fgDefaultAttributes.set(FigureAttributeConstant.FILL_COLOR, new Color(0x70DB93)); - fgDefaultAttributes.set(FigureAttributeConstant.TEXT_COLOR, Color.black); - fgDefaultAttributes.set(FigureAttributeConstant.ARROW_MODE, new Integer(0)); - fgDefaultAttributes.set(FigureAttributeConstant.FONT_NAME, "Helvetica"); - fgDefaultAttributes.set(FigureAttributeConstant.FONT_SIZE, new Integer(12)); - fgDefaultAttributes.set(FigureAttributeConstant.FONT_STYLE, new Integer(Font.PLAIN)); - } - - /** - * Sets or adds a default value for a named attribute - * @see #getAttribute - */ - public static Object setDefaultAttribute(String name, Object value) { - // save current value to return it - Object currentValue = getDefaultAttribute(name); - - fgDefaultAttributes.set(FigureAttributeConstant.getConstant(name), value); - return currentValue; - } - - /** - * Initializes a default value for a named attribute - * The difference between this method and setDefaultAttribute is that - * if the attribute is already set then it will not be changed.<BR> - * The purpose is to allow more than one source requiring the attribute - * to initialize it, but only the first initialization will be used. - * - * @see #getAttribute - * @see #setDefaultAttribute - */ - public static Object initDefaultAttribute(String name, Object value) { - // get current value - Object currentValue = getDefaultAttribute(name); - - // if it's already there skip the setting - if (currentValue != null) { - return currentValue; - } - - fgDefaultAttributes.set(FigureAttributeConstant.getConstant(name), value); - return null; - } - - /** - * Gets a the default value for a named attribute - * @see #getAttribute - */ - public static Object getDefaultAttribute(String name) { - if (fgDefaultAttributes == null) { - initializeAttributes(); - } - return fgDefaultAttributes.get(FigureAttributeConstant.getConstant(name)); - } - - public static Object getDefaultAttribute(FigureAttributeConstant attributeConstant) { - if (fgDefaultAttributes == null) { - initializeAttributes(); - } - return fgDefaultAttributes.get(attributeConstant); - } - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * All figures support the attribute names - * FillColor and FrameColor - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - return getAttribute(FigureAttributeConstant.getConstant(name)); - } - - public Object getAttribute(FigureAttributeConstant attributeConstant) { - if (fAttributes != null) { - if (fAttributes.hasDefined(attributeConstant)) { - return fAttributes.get(attributeConstant); - } - } - return getDefaultAttribute(attributeConstant); - } - - /** - * Sets the named attribute to the new value - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - setAttribute(FigureAttributeConstant.getConstant(name), value); - } - - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - if (fAttributes == null) { - fAttributes = new FigureAttributes(); - } - fAttributes.set(attributeConstant, value); - changed(); - } - - /** - * Stores the Figure to a StorableOutput. - */ - public void write(StorableOutput dw) { - super.write(dw); - if (fAttributes == null) { - dw.writeString("no_attributes"); - } - else { - dw.writeString("attributes"); - fAttributes.write(dw); - } - } - - /** - * Reads the Figure from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - String s = dr.readString(); - if (s.toLowerCase().equals("attributes")) { - fAttributes = new FigureAttributes(); - fAttributes.read(dr); - } - } - - private void writeObject(ObjectOutputStream o) throws IOException { - // Filter out Popup menu: cannot serialize any associated action-Listeners - // Work-around for Java-Bug: 4240860 - Object associatedMenu = getAttribute(Figure.POPUP_MENU); - if (associatedMenu != null) { - setAttribute(Figure.POPUP_MENU, null); - } - - o.defaultWriteObject(); - - if (associatedMenu != null) { - setAttribute(Figure.POPUP_MENU, associatedMenu); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/BorderDecorator.java b/JHotDraw/src/CH/ifa/draw/figures/BorderDecorator.java deleted file mode 100644 index 9dd80403e112b5226619838f047e9decf435156e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/BorderDecorator.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * @(#)BorderDecorator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * BorderDecorator decorates an arbitrary Figure with - * a border. - * - * @version <$CURRENT_VERSION$> - */ -public class BorderDecorator extends DecoratorFigure { - - /* - * Serialization support. - */ - private static final long serialVersionUID = 1205601808259084917L; - private int borderDecoratorSerializedDataVersion = 1; - - private Point myBorderOffset; - private Color myBorderColor; - private Color myShadowColor; - - public BorderDecorator() { - } - - public BorderDecorator(Figure figure) { - super(figure); - } - - /** - * Performs additional initialization code before the figure is decorated - * Subclasses may override this method. - */ - protected void initialize() { - setBorderOffset(new Point(3,3)); - } - - public void setBorderOffset(Point newBorderOffset) { - myBorderOffset = newBorderOffset; - } - - public Point getBorderOffset() { - if (myBorderOffset == null) { - return new Point(0,0); - } - else { - return myBorderOffset; - } - } - - /** - * Draws a the figure and decorates it with a border. - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - super.draw(g); - g.setColor(Color.white); - g.drawLine(r.x, r.y, r.x, r.y + r.height); - g.drawLine(r.x, r.y, r.x + r.width, r.y); - g.setColor(Color.gray); - g.drawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height); - g.drawLine(r.x , r.y + r.height, r.x + r.width, r.y + r.height); - } - - /** - * Gets the displaybox including the border. - */ - public Rectangle displayBox() { - Rectangle r = getDecoratedFigure().displayBox(); - r.grow(getBorderOffset().x, getBorderOffset().y); - return r; - } - - /** - * Invalidates the figure extended by its border. - */ - public void figureInvalidated(FigureChangeEvent e) { - Rectangle rect = e.getInvalidatedRectangle(); - rect.grow(getBorderOffset().x, getBorderOffset().y); - super.figureInvalidated(new FigureChangeEvent(this, rect, e)); - } - - public Insets connectionInsets() { - Insets i = super.connectionInsets(); - i.top -= getBorderOffset().y; - i.bottom -= getBorderOffset().y; - i.left -= getBorderOffset().x; - i.right -= getBorderOffset().x; - - return i; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/BorderTool.java b/JHotDraw/src/CH/ifa/draw/figures/BorderTool.java deleted file mode 100644 index 498afb4900d314d8201a6dbda4cd208d732a1b97..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/BorderTool.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * @(#)BorderTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -import java.awt.event.MouseEvent; -import java.awt.event.InputEvent; -import java.util.List; - -/** - * BorderTool decorates the clicked figure with a BorderDecorator. - * - * @see BorderDecorator - * - * @version <$CURRENT_VERSION$> - */ -public class BorderTool extends ActionTool { - - public BorderTool(DrawingEditor editor) { - super(editor); - } - - /** - * Add the touched figure to the selection of an invoke action. - * Overrides ActionTool's mouseDown to allow for peeling the border - * if there is one already. - * This is done by CTRLing the click - * @see #action - */ - public void mouseDown(MouseEvent e, int x, int y) { - setView((DrawingView)e.getSource()); - // if not CTRLed then proceed normally - if ((e.getModifiers() & InputEvent.CTRL_MASK) == 0) { - super.mouseDown(e, x, y); - } - else { - Figure target = drawing().findFigure(x, y); - if ((target != null) && (target != target.getDecoratedFigure())) { - view().addToSelection(target); - reverseAction(target); - } - } - } - - /** - * Decorates the clicked figure with a border. - */ - public void action(Figure figure) { -// Figure replaceFigure = drawing().replace(figure, new BorderDecorator(figure)); - - setUndoActivity(createUndoActivity()); - List l = CollectionsFactory.current().createList(); - l.add(figure); - l.add(new BorderDecorator(figure)); - getUndoActivity().setAffectedFigures(new FigureEnumerator(l)); - ((BorderTool.UndoActivity)getUndoActivity()).replaceAffectedFigures(); - } - - /** - * Peels off the border from the clicked figure. - */ - public void reverseAction(Figure figure) { - setUndoActivity(createUndoActivity()); - List l = CollectionsFactory.current().createList(); - l.add(figure); - l.add(((DecoratorFigure)figure).peelDecoration()); - getUndoActivity().setAffectedFigures(new FigureEnumerator(l)); - ((BorderTool.UndoActivity)getUndoActivity()).replaceAffectedFigures(); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new BorderTool.UndoActivity(view()); - } - - public static class UndoActivity extends UndoableAdapter { - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - getDrawingView().clearSelection(); - return replaceAffectedFigures(); - } - - public boolean redo() { - if (!isRedoable()) { - return false; - } - getDrawingView().clearSelection(); - return replaceAffectedFigures(); - } - - public boolean replaceAffectedFigures() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - Figure oldFigure = fe.nextFigure(); - - if (!fe.hasNextFigure()) { - return false; - } - Figure replaceFigure = fe.nextFigure(); - - replaceFigure = getDrawingView().drawing().replace(oldFigure, replaceFigure); - List l = CollectionsFactory.current().createList(); - l.add(replaceFigure); - l.add(oldFigure); - setAffectedFigures(new FigureEnumerator(l)); - - return true; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/ChopEllipseConnector.java b/JHotDraw/src/CH/ifa/draw/figures/ChopEllipseConnector.java deleted file mode 100644 index f12059c3d5a14ea797a669d27a4b2f603d07339f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ChopEllipseConnector.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * @(#)ChopEllipseConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Geom; - -/** - * A ChopEllipseConnector locates a connection point by - * chopping the connection at the ellipse defined by the - * figure's display box. - * - * @version <$CURRENT_VERSION$> - */ -public class ChopEllipseConnector extends ChopBoxConnector { - - /* - * Serialization support. - */ - private static final long serialVersionUID = -3165091511154766610L; - - public ChopEllipseConnector() { - } - - public ChopEllipseConnector(Figure owner) { - super(owner); - } - - protected Point chop(Figure target, Point from) { - Rectangle r = target.displayBox(); - double angle = Geom.pointToAngle(r, from); - return Geom.ovalAngleToPoint(r, angle); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/figures/ConnectedTextTool.java b/JHotDraw/src/CH/ifa/draw/figures/ConnectedTextTool.java deleted file mode 100644 index 97dbdc75e1c5ba67b2ba26b83625bfebdd3f3766..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ConnectedTextTool.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * @(#)ConnectedTextTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Undoable; -import java.awt.event.MouseEvent; - -/** - * Tool to create new or edit existing text figures. - * A new text figure is connected with the clicked figure. - * - * @see CH.ifa.draw.standard.TextHolder - * - * @version <$CURRENT_VERSION$> - */ -public class ConnectedTextTool extends TextTool { - - private Figure myConnectedFigure; - - public ConnectedTextTool(DrawingEditor editor, Figure prototype) { - super(editor, prototype); - } - - /** - * If the pressed figure is a TextHolder it can be edited otherwise - * a new text figure is created. - */ - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e, x, y); - - if (getTypingTarget() != null) { - TextHolder textHolder = getTypingTarget(); - setConnectedFigure(drawing().findFigureInsideWithout(x, y, textHolder.getRepresentingFigure())); - if ((getConnectedFigure() != null) && (textHolder != null) && (getConnectedFigure().getTextHolder() != textHolder)) { - textHolder.connect(getConnectedFigure().getDecoratedFigure()); - getConnectedFigure().addDependendFigure(getAddedFigure()); - } - } - } - - protected void endEdit() { - super.endEdit(); - if ((getUndoActivity() != null) && (getUndoActivity() instanceof ConnectedTextTool.UndoActivity)) { - ((ConnectedTextTool.UndoActivity)getUndoActivity()).setConnectedFigure(getConnectedFigure()); - } - else if ((getConnectedFigure() != null) && isDeleteTextFigure()) { - getConnectedFigure().removeDependendFigure(getAddedFigure()); - } - } - - protected void setConnectedFigure(Figure pressedFigure) { - myConnectedFigure = pressedFigure; - } - - public Figure getConnectedFigure() { - return myConnectedFigure; - } - - /** - * If the pressed figure is a TextHolder it can be edited otherwise - * a new text figure is created. - */ - public void activate() { - super.activate(); - setConnectedFigure(null); - } - - protected Undoable createDeleteUndoActivity() { - FigureTransferCommand cmd = new DeleteCommand("Delete", editor()); - return new DeleteUndoActivity(cmd, getConnectedFigure()); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new ConnectedTextTool.UndoActivity(view(), getTypingTarget().getText()); - } - - public static class UndoActivity extends TextTool.UndoActivity { - private Figure myConnectedFigure; - - public UndoActivity(DrawingView newDrawingView, String newOriginalText) { - super(newDrawingView, newOriginalText); - } - - /* - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo() { - if (!super.undo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - - if (currentFigure.getTextHolder() != null) { - // the text figure didn't exist before - if (!isValidText(getOriginalText())) { - currentFigure.getTextHolder().disconnect(getConnectedFigure()); - } - // the text figure did exist but was remove - else if (!isValidText(getBackupText())) { - currentFigure.getTextHolder().connect(getConnectedFigure()); - } - } - } - - return true; - } - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo() { - if (!super.redo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - if (currentFigure.getTextHolder() != null) { - // the text figure did exist but was remove - if (!isValidText(getBackupText())) { - currentFigure.getTextHolder().disconnect(getConnectedFigure()); - } - // the text figure didn't exist before - else if (!isValidText(getOriginalText())) { - currentFigure.getTextHolder().connect(getConnectedFigure()); - } - } - } - - return true; - } - - public void setConnectedFigure(Figure newConnectedFigure) { - myConnectedFigure = newConnectedFigure; - } - - public Figure getConnectedFigure() { - return myConnectedFigure; - } - } - - /** - * This class - */ - public static class DeleteUndoActivity extends DeleteCommand.UndoActivity { - private Figure myConnectedFigure; - - public DeleteUndoActivity(FigureTransferCommand cmd, Figure newConnectedFigure) { - super(cmd); - setConnectedFigure(newConnectedFigure); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - if (currentFigure.getTextHolder() != null) { - currentFigure.getTextHolder().connect(getConnectedFigure().getDecoratedFigure()); - } - } - - return true; - } - - public boolean redo() { - if (!super.redo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - if (currentFigure.getTextHolder() != null) { - currentFigure.getTextHolder().disconnect(getConnectedFigure().getDecoratedFigure()); - } - } - - return true; - } - - public void setConnectedFigure(Figure newConnectedFigure) { - myConnectedFigure = newConnectedFigure; - } - - public Figure getConnectedFigure() { - return myConnectedFigure; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/ElbowConnection.java b/JHotDraw/src/CH/ifa/draw/figures/ElbowConnection.java deleted file mode 100644 index 66dfd54b2d9964a9ef73c642c5147f9218f84182..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ElbowConnection.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * @(#)ElbowConnection.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.util.List; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -/** - * A LineConnection that constrains a connection to - * orthogonal lines. - * - * @version <$CURRENT_VERSION$> - */ -public class ElbowConnection extends LineConnection { - - /* - * Serialization support. - */ - private static final long serialVersionUID = 2193968743082078559L; - private int elbowConnectionSerializedDataVersion = 1; - - public ElbowConnection() { - super(); - } - - public void updateConnection() { - super.updateConnection(); - updatePoints(); - } - - public void layoutConnection() { - } - - /** - * Gets the handles of the figure. - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(fPoints.size()*2); - handles.add(new ChangeConnectionStartHandle(this)); - for (int i = 1; i < fPoints.size()-1; i++) { - handles.add(new NullHandle(this, locator(i))); - } - handles.add(new ChangeConnectionEndHandle(this)); - for (int i = 0; i < fPoints.size()-1; i++) { - handles.add(new ElbowHandle(this, i)); - } - return new HandleEnumerator(handles); - } - - public Locator connectedTextLocator(Figure f) { - return new ElbowTextLocator(); - } - - protected void updatePoints() { - willChange(); - Point start = startPoint(); - Point end = endPoint(); - fPoints.clear(); - fPoints.add(start); - - if (start.x == end.x || start.y == end.y) { - fPoints.add(end); - } - else { - - Rectangle r1 = getStartConnector().owner().displayBox(); - Rectangle r2 = getEndConnector().owner().displayBox(); - - int dir = Geom.direction(r1.x + r1.width/2, r1.y + r1.height/2, - r2.x + r2.width/2, r2.y + r2.height/2); - if (dir == Geom.NORTH || dir == Geom.SOUTH) { - fPoints.add(new Point(start.x, (start.y + end.y)/2)); - fPoints.add(new Point(end.x, (start.y + end.y)/2)); - } - else { - fPoints.add(new Point((start.x + end.x)/2, start.y)); - fPoints.add(new Point((start.x + end.x)/2, end.y)); - } - fPoints.add(end); - } - changed(); - } -} - -class ElbowTextLocator extends AbstractLocator { - public Point locate(Figure owner) { - Point p = owner.center(); - return new Point(p.x, p.y-10); // hack - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/figures/ElbowHandle.java b/JHotDraw/src/CH/ifa/draw/figures/ElbowHandle.java deleted file mode 100644 index 90c2ebdb4cfe2e7003e7278424b2a480a3a8100a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ElbowHandle.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * @(#)ElbowHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Geom; -import java.awt.*; - -/** - * A Handle to move an ElbowConnection left/right or up/down. - * - * @version <$CURRENT_VERSION$> - */ -public class ElbowHandle extends AbstractHandle { - - private int fSegment; - private int fLastX, fLastY; // previous mouse position - - public ElbowHandle(LineConnection owner, int segment) { - super(owner); - fSegment = segment; - } - - public void invokeStart(int x, int y, DrawingView view) { - fLastX = x; - fLastY = y; - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - LineConnection line = ownerConnection(); - Point p1 = line.pointAt(fSegment); - Point p2 = line.pointAt(fSegment+1); - int ddx = x - fLastX; - int ddy = y - fLastY; - - Point np1; - Point np2; - if (isVertical(p1, p2)) { - int cx = constrainX(p1.x + ddx); - np1 = new Point(cx, p1.y); - np2 = new Point(cx, p2.y); - } - else { - int cy = constrainY(p1.y + ddy); - np1 = new Point(p1.x, cy); - np2 = new Point(p2.x, cy); - } - line.setPointAt(np1, fSegment); - line.setPointAt(np2, fSegment+1); - fLastX = x; - fLastY = y; - } - - private boolean isVertical(Point p1, Point p2) { - return p1.x == p2.x; - } - - public Point locate() { - LineConnection line = ownerConnection(); - int segment = Math.min(fSegment, line.pointCount()-2); - Point p1 = line.pointAt(segment); - Point p2 = line.pointAt(segment+1); - return new Point((p1.x + p2.x)/2, (p1.y + p2.y)/2); - } - - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.yellow); - g.fillOval(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawOval(r.x, r.y, r.width, r.height); - } - - private int constrainX(int x) { - LineConnection line = ownerConnection(); - Figure startFigure = line.getStartConnector().owner(); - Figure endFigure = line.getEndConnector().owner(); - Rectangle start = startFigure.displayBox(); - Rectangle end = endFigure.displayBox(); - Insets i1 = startFigure.connectionInsets(); - Insets i2 = endFigure.connectionInsets(); - - int r1x, r1width, r2x, r2width; - r1x = start.x + i1.left; - r1width = start.width - i1.left - i1.right-1; - - r2x = end.x + i2.left; - r2width = end.width - i2.left - i2.right-1; - - if (fSegment == 0) { - x = Geom.range(r1x, r1x + r1width, x); - } - if (fSegment == line.pointCount()-2) { - x = Geom.range(r2x, r2x + r2width, x); - } - return x; - } - - private int constrainY(int y) { - LineConnection line = ownerConnection(); - Figure startFigure = line.getStartConnector().owner(); - Figure endFigure = line.getEndConnector().owner(); - Rectangle start = startFigure.displayBox(); - Rectangle end = endFigure.displayBox(); - Insets i1 = startFigure.connectionInsets(); - Insets i2 = endFigure.connectionInsets(); - - int r1y, r1height, r2y, r2height; - r1y = start.y + i1.top; - r1height = start.height - i1.top - i1.bottom-1; - r2y = end.y + i2.top; - r2height = end.height - i2.top - i2.bottom-1; - - if (fSegment == 0) { - y = Geom.range(r1y, r1y + r1height, y); - } - if (fSegment == line.pointCount()-2) { - y = Geom.range(r2y, r2y + r2height, y); - } - return y; - } - - private LineConnection ownerConnection() { - return (LineConnection)owner(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/EllipseFigure.java b/JHotDraw/src/CH/ifa/draw/figures/EllipseFigure.java deleted file mode 100644 index c9f70e6edbc32ddf1a87e6d3bb7b95d5f125921c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/EllipseFigure.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * @(#)EllipseFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.io.IOException; -import java.util.List; -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * An ellipse figure. - * - * @version <$CURRENT_VERSION$> - */ -public class EllipseFigure extends AttributeFigure { - - private Rectangle fDisplayBox; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -6856203289355118951L; - private int ellipseFigureSerializedDataVersion = 1; - - public EllipseFigure() { - this(new Point(0,0), new Point(0,0)); - } - - public EllipseFigure(Point origin, Point corner) { - basicDisplayBox(origin,corner); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - return new HandleEnumerator(handles); - } - - public void basicDisplayBox(Point origin, Point corner) { - fDisplayBox = new Rectangle(origin); - fDisplayBox.add(corner); - } - - public Rectangle displayBox() { - return new Rectangle( - fDisplayBox.x, - fDisplayBox.y, - fDisplayBox.width, - fDisplayBox.height); - } - - protected void basicMoveBy(int x, int y) { - fDisplayBox.translate(x,y); - } - - public void drawBackground(Graphics g) { - Rectangle r = displayBox(); - /* - * JP, 25-May-03: Changed from (width-1, height-1) to (width, height), - * because figures were not filled completely (JDK 1.4.x). Might invalidate - * fix for #661878. If the problem is JDK-dependant, maybe the JDK version - * should be taken into account here? - */ - g.fillOval(r.x, r.y, r.width, r.height); - } - - public void drawFrame(Graphics g) { - Rectangle r = displayBox(); - g.drawOval(r.x, r.y, r.width-1, r.height-1); - } - - public Insets connectionInsets() { - Rectangle r = fDisplayBox; - int cx = r.width/2; - int cy = r.height/2; - return new Insets(cy, cx, cy, cx); - } - - public Connector connectorAt(int x, int y) { - return new ChopEllipseConnector(this); - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fDisplayBox.x); - dw.writeInt(fDisplayBox.y); - dw.writeInt(fDisplayBox.width); - dw.writeInt(fDisplayBox.height); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fDisplayBox = new Rectangle( - dr.readInt(), - dr.readInt(), - dr.readInt(), - dr.readInt()); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/FigureAttributes.java b/JHotDraw/src/CH/ifa/draw/figures/FigureAttributes.java deleted file mode 100644 index 732a374be668734a9cda9f32ce85998a4b1ef6fd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/FigureAttributes.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * @(#)FigureAttributes.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; - -import java.awt.Color; -import java.io.IOException; -import java.io.Serializable; -import java.util.Map; -import java.util.Iterator; - -/** - * A container for a figure's attributes. The attributes are stored - * as key/value pairs. - * - * @see Figure - * - * @version <$CURRENT_VERSION$> - */ -public class FigureAttributes - extends Object - implements Cloneable, Serializable { - - private Map fMap; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -6886355144423666716L; - private int figureAttributesSerializedDataVersion = 1; - - /** - * Constructs the FigureAttributes. - */ - public FigureAttributes() { - fMap = CollectionsFactory.current().createMap(); - } - - /** - * Gets the attribute with the given name. - * @return attribute or null if the key is not defined - */ - public Object get(FigureAttributeConstant attributeConstant) { - return fMap.get(attributeConstant); - } - - /** - * Sets the attribute with the given name and - * overwrites its previous value. - */ - public void set(FigureAttributeConstant attributeConstant, Object value) { - if (value != null) { - fMap.put(attributeConstant, value); - } - else { - fMap.remove(attributeConstant); - } - } - - /** - * Tests if an attribute is defined. - */ - public boolean hasDefined(FigureAttributeConstant attributeConstant) { - return fMap.containsKey(attributeConstant); - } - - /** - * Clones the attributes. - */ - public Object clone() { - try { - FigureAttributes a = (FigureAttributes) super.clone(); - a.fMap = CollectionsFactory.current().createMap(fMap); - return a; - } - catch (CloneNotSupportedException e) { - throw new InternalError(); - } - } - - /** - * Reads the attributes from a StorableInput. - * FigureAttributes store the following types directly: - * Color, Boolean, String, Int. Other attribute types - * have to implement the Storable interface or they - * have to be wrapped by an object that implements Storable. - * @see Storable - * @see #write - */ - public void read(StorableInput dr) throws IOException { - String s = dr.readString(); - if (!s.toLowerCase().equals("attributes")) { - throw new IOException("Attributes expected"); - } - - fMap = CollectionsFactory.current().createMap(); - int size = dr.readInt(); - for (int i=0; i<size; i++) { - String key = dr.readString(); - String valtype = dr.readString(); - Object val = null; - if (valtype.equals("Color")) { - val = new Color(dr.readInt(), dr.readInt(), dr.readInt()); - } - else if (valtype.equals("Boolean")) { - val = new Boolean(dr.readString()); - } - else if (valtype.equals("String")) { - val = dr.readString(); - } - else if (valtype.equals("Int")) { - val = new Integer(dr.readInt()); - } - else if (valtype.equals("Storable")) { - val = dr.readStorable(); - } - else if (valtype.equals(Figure.POPUP_MENU)) { - // read String but don't store it - continue; - } - else if (valtype.equals("UNKNOWN")) { - continue; - } - // try to get defined constant - FigureAttributeConstant attributeConstant = FigureAttributeConstant.getConstant(key); - set(attributeConstant, val); - } - } - - /** - * Writes the attributes to a StorableInput. - * FigureAttributes store the following types directly: - * Color, Boolean, String, Int. Other attribute types - * have to implement the Storable interface or they - * have to be wrapped by an object that implements Storable. - * @see Storable - * @see #write - */ - public void write(StorableOutput dw) { - dw.writeString("attributes"); - - dw.writeInt(fMap.size()); // number of attributes - Iterator iter = fMap.keySet().iterator(); - while (iter.hasNext()) { - FigureAttributeConstant fac = (FigureAttributeConstant)iter.next(); - String attributeName = fac.getName(); - Object attributeValue = fMap.get(fac); - - dw.writeString(attributeName); - - if (attributeValue instanceof String) { - dw.writeString("String"); - dw.writeString((String)attributeValue); - } - else if (attributeValue instanceof Color) { - writeColor(dw, "Color", (Color)attributeValue); - } - else if (attributeValue instanceof Boolean) { - dw.writeString("Boolean"); - if (((Boolean)attributeValue).booleanValue()) { - dw.writeString("TRUE"); - } - else { - dw.writeString("FALSE"); - } - } - else if (attributeValue instanceof Integer) { - dw.writeString("Int"); - dw.writeInt(((Integer)attributeValue).intValue()); - } - else if (attributeValue instanceof Storable) { - dw.writeString("Storable"); - dw.writeStorable((Storable)attributeValue); - } - else if (attributeValue instanceof javax.swing.JPopupMenu) { - dw.writeString(Figure.POPUP_MENU); - } - else { - System.err.println("Unknown attribute: " + attributeValue); - dw.writeString("UNKNOWN"); - } - } - } - - public static void writeColor(StorableOutput dw, String colorName, Color color) { - if (color != null) { - dw.writeString(colorName); - dw.writeInt(color.getRed()); - dw.writeInt(color.getGreen()); - dw.writeInt(color.getBlue()); - } - } - - public static Color readColor(StorableInput dr) throws IOException { - return new Color(dr.readInt(), dr.readInt(), dr.readInt()); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/FontSizeHandle.java b/JHotDraw/src/CH/ifa/draw/figures/FontSizeHandle.java deleted file mode 100644 index 2248b3e099e478ca6b21b3cb0a96313ffe33c299..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/FontSizeHandle.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * @(#)FontSizeHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; -import java.awt.*; - -/** - * A Handle to change the font size by direct manipulation. - * - * @version <$CURRENT_VERSION$> - */ -public class FontSizeHandle extends LocatorHandle { - - public FontSizeHandle(Figure owner, Locator l) { - super(owner, l); - } - - public void invokeStart(int x, int y, DrawingView view) { - setUndoActivity(createUndoActivity(view)); - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(owner())); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - TextFigure textOwner = (TextFigure) owner(); - - FontSizeHandle.UndoActivity activity = (FontSizeHandle.UndoActivity)getUndoActivity(); - int newSize = activity.getFont().getSize() + y-anchorY; - textOwner.setFont(new Font(activity.getFont().getName(), activity.getFont().getStyle(), newSize)); - } - - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - TextFigure textOwner = (TextFigure) owner(); - FontSizeHandle.UndoActivity activity = (FontSizeHandle.UndoActivity)getUndoActivity(); - // there has been no change so there is nothing to undo - if (textOwner.getFont().getSize() == activity.getOldFontSize()) { - setUndoActivity(null); - } - else { - activity.setFont(textOwner.getFont()); - } - } - - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.yellow); - g.fillOval(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawOval(r.x, r.y, r.width, r.height); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity(DrawingView newView) { - TextFigure textOwner = (TextFigure)owner(); - return new FontSizeHandle.UndoActivity(newView, textOwner.getFont()); - } - - public static class UndoActivity extends UndoableAdapter { - private Font myFont; - private int myOldFontSize; - - public UndoActivity(DrawingView newView, Font newFont) { - super(newView); - setFont(newFont); - setOldFontSize(getFont().getSize()); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - swapFont(); - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - swapFont(); - return true; - } - - protected void swapFont() { - setOldFontSize(replaceFontSize()); - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - ((TextFigure)fe.nextFigure()).setFont(getFont()); - } - } - - private int replaceFontSize() { - int tempFontSize = getFont().getSize(); - setFont(new Font(getFont().getName(), getFont().getStyle(), getOldFontSize())); - return tempFontSize; - } - protected void setFont(Font newFont) { - myFont = newFont; - } - - public Font getFont() { - return myFont; - } - - protected void setOldFontSize(int newOldFontSize) { - myOldFontSize = newOldFontSize; - } - - public int getOldFontSize() { - return myOldFontSize; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/GroupCommand.java b/JHotDraw/src/CH/ifa/draw/figures/GroupCommand.java deleted file mode 100644 index 4635759aeaf9a44786aaf9728c72880f7ca62bd7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/GroupCommand.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)GroupCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -import java.util.List; - -/** - * Command to group the selection into a GroupFigure. - * - * @see GroupFigure - * - * @version <$CURRENT_VERSION$> - */ -public class GroupCommand extends AbstractCommand { - - /** - * Constructs a group command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public GroupCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures(view().selection()); - ((GroupCommand.UndoActivity)getUndoActivity()).groupFigures(); - view().checkDamage(); - } - - public boolean isExecutableWithView() { - return view().selectionCount() > 1; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new GroupCommand.UndoActivity(view()); - } - - public static class UndoActivity extends UndoableAdapter { - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - getDrawingView().clearSelection(); - - // orphan group figure(s) - getDrawingView().drawing().orphanAll(getAffectedFigures()); - - // create a new collection with the grouped figures as elements - List affectedFigures = CollectionsFactory.current().createList(); - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - // add contained figures - getDrawingView().drawing().addAll(currentFigure.figures()); - getDrawingView().addToSelectionAll(currentFigure.figures()); - - FigureEnumeration groupedFigures = currentFigure.figures(); - while (groupedFigures.hasNextFigure()) { - affectedFigures.add(groupedFigures.nextFigure()); - } - } - - setAffectedFigures(new FigureEnumerator(affectedFigures)); - - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - groupFigures(); - return true; - } - - return false; - } - - public void groupFigures() { - getDrawingView().drawing().orphanAll(getAffectedFigures()); - getDrawingView().clearSelection(); - - // add new group figure instead - GroupFigure group = new GroupFigure(); - group.addAll(getAffectedFigures()); - - Figure figure = getDrawingView().drawing().add(group); - getDrawingView().addToSelection(figure); - - // create a new collection with the new group figure as element - List affectedFigures = CollectionsFactory.current().createList(); - affectedFigures.add(figure); - setAffectedFigures(new FigureEnumerator(affectedFigures)); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/GroupFigure.java b/JHotDraw/src/CH/ifa/draw/figures/GroupFigure.java deleted file mode 100644 index 12ff7a520711fa4292938b46c946e8e25d722a24..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/GroupFigure.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * @(#)GroupFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.util.List; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.CollectionsFactory; - -/** - * A Figure that groups a collection of figures. - * - * @version <$CURRENT_VERSION$> - */ -public class GroupFigure extends CompositeFigure { - - /* - * Serialization support. - */ - private static final long serialVersionUID = 8311226373023297933L; - private int groupFigureSerializedDataVersion = 1; - - /** - * GroupFigures cannot be connected - */ - public boolean canConnect() { - return false; - } - - /** - * Gets the display box. The display box is defined as the union - * of the contained figures. - */ - public Rectangle displayBox() { - FigureEnumeration fe = figures(); - Rectangle r = fe.nextFigure().displayBox(); - - while (fe.hasNextFigure()) { - r.add(fe.nextFigure().displayBox()); - } - return r; - } - - public void basicDisplayBox(Point origin, Point corner) { - // do nothing - // we could transform all components proportionally - } - - public FigureEnumeration decompose() { - return new FigureEnumerator(fFigures); - } - - /** - * Gets the handles for the GroupFigure. - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - handles.add(new GroupHandle(this, RelativeLocator.northWest())); - handles.add(new GroupHandle(this, RelativeLocator.northEast())); - handles.add(new GroupHandle(this, RelativeLocator.southWest())); - handles.add(new GroupHandle(this, RelativeLocator.southEast())); - return new HandleEnumerator(handles); - } - - /** - * Sets the attribute of all the contained figures. - * @deprecated see setAttribute(FigureAttributeConstant,Object) - */ - public void setAttribute(String name, Object value) { - super.setAttribute(name, value); - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - fe.nextFigure().setAttribute(name, value); - } - } - - /** - * Sets the attribute of the GroupFigure as well as all contained Figures. - */ - public void setAttribute(FigureAttributeConstant fac, Object object){ - super.setAttribute(fac, object); - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - fe.nextFigure().setAttribute(fac, object); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/GroupHandle.java b/JHotDraw/src/CH/ifa/draw/figures/GroupHandle.java deleted file mode 100644 index dfa1ff80444bfcb5fd3a693a28c6d3f386a2e68b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/GroupHandle.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @(#)GroupHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.NullHandle; - -/** - * A Handle for a GroupFigure. - * - * @version <$CURRENT_VERSION$> - */ -final class GroupHandle extends NullHandle { - - public GroupHandle(Figure owner, Locator locator) { - super(owner, locator); - } - - /** - * Draws the Group handle. - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.black); - g.drawRect(r.x, r.y, r.width, r.height); - r.grow(-1, -1); - g.setColor(Color.white); - g.drawRect(r.x, r.y, r.width, r.height); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/ImageFigure.java b/JHotDraw/src/CH/ifa/draw/figures/ImageFigure.java deleted file mode 100644 index 54c586fb27546b578f5ca1f468973fe13e33c4ae..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ImageFigure.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * @(#)ImageFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.io.*; -import java.util.List; -import java.awt.image.ImageObserver; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -/** - * A Figure that shows an Image. - * Images shown by an image figure are shared by using the Iconkit. - * - * @see Iconkit - * - * @version <$CURRENT_VERSION$> - */ -public class ImageFigure - extends AttributeFigure implements ImageObserver { - - private String fFileName; - private transient Image fImage; - private Rectangle fDisplayBox; - /* - * Serialization support. - */ - private static final long serialVersionUID = 148012030121282439L; - private int imageFigureSerializedDataVersion = 1; - - public ImageFigure() { - fFileName = null; - fImage = null; - fDisplayBox = null; - } - - public ImageFigure(Image image, String fileName, Point origin) { - fFileName = fileName; - fImage = image; - // fix for bug-id: 593080 (ImageFigure calculates the image rectangle wrongly) - basicDisplayBox(origin, new Point(origin.x + fImage.getWidth(this), origin.y + fImage.getHeight(this))); - } - - public void basicDisplayBox(Point origin, Point corner) { - fDisplayBox = new Rectangle(origin); - fDisplayBox.add(corner); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - return new HandleEnumerator(handles); - } - - public Rectangle displayBox() { - return new Rectangle( - fDisplayBox.x, - fDisplayBox.y, - fDisplayBox.width, - fDisplayBox.height); - } - - protected void basicMoveBy(int x, int y) { - fDisplayBox.translate(x,y); - } - - public void draw(Graphics g) { - if (fImage == null) { - fImage = Iconkit.instance().getImage(fFileName); - } - if (fImage != null) { - g.drawImage(fImage, fDisplayBox.x, fDisplayBox.y, fDisplayBox.width, fDisplayBox.height, this); - } - else { - drawGhost(g); - } - } - - private void drawGhost(Graphics g) { - g.setColor(Color.gray); - g.fillRect(fDisplayBox.x, fDisplayBox.y, fDisplayBox.width, fDisplayBox.height); - } - - /** - * Handles asynchroneous image updates. - */ - public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) { - if ((flags & (FRAMEBITS|ALLBITS)) != 0) { - invalidate(); - if (listener() != null) { - listener().figureRequestUpdate(new FigureChangeEvent(this)); - } - } - return (flags & (ALLBITS|ABORT)) == 0; - } - - /** - * Releases a figure's resources. Release is called when - * a figure is removed from a drawing. Informs the listeners that - * the figure is removed by calling figureRemoved. - */ - public void release() { - fImage.flush(); - } - - /** - * Writes the ImageFigure to a StorableOutput. Only a reference to the - * image, that is its pathname is saved. - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fDisplayBox.x); - dw.writeInt(fDisplayBox.y); - dw.writeInt(fDisplayBox.width); - dw.writeInt(fDisplayBox.height); - dw.writeString(fFileName); - } - - /** - * Reads the ImageFigure from a StorableInput. It registers the - * referenced figure to be loaded from the Iconkit. - * @see Iconkit#registerImage - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - fDisplayBox = new Rectangle( - dr.readInt(), - dr.readInt(), - dr.readInt(), - dr.readInt()); - fFileName = dr.readString(); - Iconkit.instance().registerImage(fFileName); - } - - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - Iconkit.instance().registerImage(fFileName); - fImage = null; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/InsertImageCommand.java b/JHotDraw/src/CH/ifa/draw/figures/InsertImageCommand.java deleted file mode 100644 index 8f3b3a9c4e52973d53a88a568204ea42715b44c8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/InsertImageCommand.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @(#)InsertImageCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; -import java.awt.*; -import java.lang.ref.WeakReference; - -/** - * Command to insert a named image. - * - * @version <$CURRENT_VERSION$> - */ -public class InsertImageCommand extends AbstractCommand { - - private String myImageName; - - /** - * Constructs an insert image command. - * @param name the command name - * @param newImageName the pathname of the image - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public InsertImageCommand(String name, String newImageName, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - myImageName = newImageName; - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - ((InsertImageCommand.UndoActivity)getUndoActivity()).insertImage(); - view().checkDamage(); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new InsertImageCommand.UndoActivity(view(), myImageName); - } - - public class UndoActivity extends UndoableAdapter { - - /** - * Use weak reference so if the command is the last one which references - * the ImageFigure then it might be garbage collected. Usually, the ImageFigure - * is referenced from the drawing it is inserted and might be only garbage - * collected after an undo operation (which removes the ImageFigure from - * the drawing). If it has been garbage collected but is requested again - * (e.g. during a redo operation) it is restored if possible. - */ - WeakReference myAffectedImageFigure; - private String myAffectedImageName; - - UndoActivity(DrawingView newDrawingView, String newAffectedImageName) { - super(newDrawingView); - myAffectedImageName = newAffectedImageName; - setUndoable(true); - setRedoable(true); - } - - protected void setImageFigure(ImageFigure newImageFigure) { - myAffectedImageFigure = new WeakReference(newImageFigure); - } - - protected ImageFigure getImageFigure() { - // load image if it has not been loaded so far - if ((myAffectedImageFigure == null) || (myAffectedImageFigure.get() == null)) { - // ugly cast to component, but AWT wants a Component instead of an ImageObserver... - Image image = Iconkit.instance().registerAndLoadImage( - (Component)getDrawingView(), myAffectedImageName); - setImageFigure(new ImageFigure( - image, myAffectedImageName, getDrawingView().lastClick())); - } - - return (ImageFigure)myAffectedImageFigure.get(); - } - - public boolean undo() { - if (super.undo()) { - getDrawingView().clearSelection(); - - getDrawingView().drawing().orphan(getImageFigure()); - - return true; - } - - return false; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - insertImage(); - return true; - } - - return false; - } - - protected void insertImage() { - getDrawingView().add(getImageFigure()); - getDrawingView().clearSelection(); - getDrawingView().addToSelection(getImageFigure()); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/LineConnection.java b/JHotDraw/src/CH/ifa/draw/figures/LineConnection.java deleted file mode 100644 index 0364673b9c947f1f26143f5510f24eb992ce0059..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/LineConnection.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * @(#)LineConnection.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.util.List; -import java.io.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -/** - * A LineConnection is a standard implementation of the - * ConnectionFigure interface. The interface is implemented with PolyLineFigure. - * - * @see ConnectionFigure - * - * @version <$CURRENT_VERSION$> - */ -public class LineConnection extends PolyLineFigure implements ConnectionFigure { - - protected Connector myStartConnector; - protected Connector myEndConnector; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 6883731614578414801L; - private int lineConnectionSerializedDataVersion = 1; - - /** - * Constructs a LineConnection. A connection figure has - * an arrow decoration at the start and end. - */ - public LineConnection() { - super(4); - setStartDecoration(new ArrowTip()); - setEndDecoration(new ArrowTip()); - } - - /** - * Tests whether a figure can be a connection target. - * ConnectionFigures cannot be connected and return false. - */ - public boolean canConnect() { - return false; - } - - /** - * Ensures that a connection is updated if the connection - * was moved. - */ - protected void basicMoveBy(int dx, int dy) { - // don't move the start and end point since they are connected - for (int i = 1; i < fPoints.size()-1; i++) { - pointAt(i).translate(dx, dy); - } - - updateConnection(); // make sure that we are still connected - } - - /** - * Sets the start figure of the connection. - */ - public void connectStart(Connector newStartConnector) { - setStartConnector(newStartConnector); - if (newStartConnector != null) { - startFigure().addDependendFigure(this); - startFigure().addFigureChangeListener(this); - } - } - - /** - * Sets the end figure of the connection. - */ - public void connectEnd(Connector newEndConnector) { - setEndConnector(newEndConnector); - if (newEndConnector != null) { - endFigure().addDependendFigure(this); - endFigure().addFigureChangeListener(this); - handleConnect(startFigure(), endFigure()); - } - } - - /** - * Disconnects the start figure. - */ - public void disconnectStart() { - startFigure().removeFigureChangeListener(this); - startFigure().removeDependendFigure(this); - setStartConnector(null); - } - - /** - * Disconnects the end figure. - */ - public void disconnectEnd() { - handleDisconnect(startFigure(), endFigure()); - endFigure().removeFigureChangeListener(this); - endFigure().removeDependendFigure(this); - setEndConnector(null); - } - - /** - * Tests whether a connection connects the same figures - * as another ConnectionFigure. - */ - public boolean connectsSame(ConnectionFigure other) { - return other.getStartConnector() == getStartConnector() - && other.getEndConnector() == getEndConnector(); - } - - /** - * Handles the disconnection of a connection. - * Override this method to handle this event. - */ - protected void handleDisconnect(Figure start, Figure end) {} - - /** - * Handles the connection of a connection. - * Override this method to handle this event. - */ - protected void handleConnect(Figure start, Figure end) {} - - /** - * Gets the start figure of the connection. - */ - public Figure startFigure() { - if (getStartConnector() != null) { - return getStartConnector().owner(); - } - return null; - } - - /** - * Gets the end figure of the connection. - */ - public Figure endFigure() { - if (getEndConnector() != null) { - return getEndConnector().owner(); - } - return null; - } - - protected void setStartConnector(Connector newStartConnector) { - myStartConnector = newStartConnector; - } - - /** - * Gets the start figure of the connection. - */ - public Connector getStartConnector() { - return myStartConnector; - } - - protected void setEndConnector(Connector newEndConnector) { - myEndConnector = newEndConnector; - } - - /** - * Gets the end figure of the connection. - */ - public Connector getEndConnector() { - return myEndConnector; - } - - /** - * Tests whether two figures can be connected. - */ - public boolean canConnect(Figure start, Figure end) { - return true; - } - - /** - * Sets the start point. - */ - public void startPoint(int x, int y) { - willChange(); - if (fPoints.size() == 0) { - fPoints.add(new Point(x, y)); - } - else { - fPoints.set(0, new Point(x, y)); - } - changed(); - } - - /** - * Sets the end point. - */ - public void endPoint(int x, int y) { - willChange(); - if (fPoints.size() < 2) { - fPoints.add(new Point(x, y)); - } - else { - fPoints.set(fPoints.size()-1, new Point(x, y)); - } - changed(); - } - - /** - * Gets the start point. - */ - public Point startPoint() { - Point p = pointAt(0); - return new Point(p.x, p.y); - } - - /** - * Gets the end point. - */ - public Point endPoint() { - if (fPoints.size() > 0) { - Point p = pointAt(fPoints.size()-1); - return new Point(p.x, p.y); - } - else { - return null; - } - } - - /** - * Gets the handles of the figure. It returns the normal - * PolyLineHandles but adds ChangeConnectionHandles at the - * start and end. - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(fPoints.size()); - handles.add(new ChangeConnectionStartHandle(this)); - for (int i = 1; i < fPoints.size()-1; i++) { - handles.add(new PolyLineHandle(this, locator(i), i)); - } - handles.add(new ChangeConnectionEndHandle(this)); - return new HandleEnumerator(handles); - } - - /** - * Sets the point and updates the connection. - */ - public void setPointAt(Point p, int i) { - super.setPointAt(p, i); - layoutConnection(); - } - - /** - * Inserts the point and updates the connection. - */ - public void insertPointAt(Point p, int i) { - super.insertPointAt(p, i); - layoutConnection(); - } - - /** - * Removes the point and updates the connection. - */ - public void removePointAt(int i) { - super.removePointAt(i); - layoutConnection(); - } - - /** - * Updates the connection. - */ - public void updateConnection() { - if (getStartConnector() != null) { - Point start = getStartConnector().findStart(this); - - if (start != null) { - startPoint(start.x, start.y); - } - } - if (getEndConnector() != null) { - Point end = getEndConnector().findEnd(this); - - if (end != null) { - endPoint(end.x, end.y); - } - } - } - - /** - * Lays out the connection. This is called when the connection - * itself changes. By default the connection is recalculated - */ - public void layoutConnection() { - updateConnection(); - } - - public void figureChanged(FigureChangeEvent e) { - updateConnection(); - } - - public void figureRemoved(FigureChangeEvent e) { - } - - public void figureRequestRemove(FigureChangeEvent e) { - } - - public void figureInvalidated(FigureChangeEvent e) { - } - - public void figureRequestUpdate(FigureChangeEvent e) { - } - - public void release() { - super.release(); - handleDisconnect(startFigure(), endFigure()); - if (getStartConnector() != null) { - startFigure().removeFigureChangeListener(this); - startFigure().removeDependendFigure(this); - } - if (getEndConnector() != null) { - endFigure().removeFigureChangeListener(this); - endFigure().removeDependendFigure(this); - } - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeStorable(getStartConnector()); - dw.writeStorable(getEndConnector()); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - Connector start = (Connector)dr.readStorable(); - if (start != null) { - connectStart(start); - } - Connector end = (Connector)dr.readStorable(); - if (end != null) { - connectEnd(end); - } - if ((start != null) && (end != null)) { - updateConnection(); - } - } - - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - - if (getStartConnector() != null) { - connectStart(getStartConnector()); - } - if (getEndConnector() != null) { - connectEnd(getEndConnector()); - } - } - - public void visit(FigureVisitor visitor) { - visitor.visitFigure(this); - } - - /** - * @see CH.ifa.draw.framework.Figure#removeFromContainer(CH.ifa.draw.framework.FigureChangeListener) - */ - public void removeFromContainer(FigureChangeListener c) { - super.removeFromContainer(c); - release(); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/LineDecoration.java b/JHotDraw/src/CH/ifa/draw/figures/LineDecoration.java deleted file mode 100644 index 09567f609b188f80420ae5ca0a800114d86c5593..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/LineDecoration.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * @(#)LineDecoration.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.util.Storable; -import java.awt.*; -import java.io.Serializable; - -/** - * Decorate the start or end point of a line or poly line figure. - * LineDecoration is the base class for the different line decorations. - * - * @see PolyLineFigure - * - * @version <$CURRENT_VERSION$> - */ -public interface LineDecoration - extends Storable, Cloneable, Serializable { - - /** - * Draws the decoration in the direction specified by the two points. - */ - public void draw(Graphics g, int x1, int y1, int x2, int y2); - - /** - * @return the display box of a LineDecoration. - */ - public Rectangle displayBox(); -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/LineFigure.java b/JHotDraw/src/CH/ifa/draw/figures/LineFigure.java deleted file mode 100644 index 335a9c3747b4cd24c13dc351217a69c91c876127..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/LineFigure.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * @(#)LineFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; - -/** - * A line figure. - * - * @version <$CURRENT_VERSION$> - */ -public class LineFigure extends PolyLineFigure { - - /* - * Serialization support. - */ - private static final long serialVersionUID = 511503575249212371L; - private int lineFigureSerializedDataVersion = 1; - - /** - * Constructs a LineFigure with both start and end set to Point(0,0). - */ - public LineFigure() { - addPoint(0, 0); - addPoint(0, 0); - } - - /** - * Gets a copy of the start point. - */ - public Point startPoint() { - return pointAt(0); - } - - /** - * Gets a copy of the end point. - */ - public Point endPoint() { - return pointAt(1); - } - - /** - * Sets the start point. - */ - public void startPoint(int x, int y) { - setPointAt(new Point(x,y), 0); - } - - /** - * Sets the end point. - */ - public void endPoint(int x, int y) { - setPointAt(new Point(x,y), 1); - } - - /** - * Sets the start and end point. - */ - public void setPoints(Point start, Point end) { - setPointAt(start, 0); - setPointAt(end, 1); - } - - public void basicDisplayBox(Point origin, Point corner) { - setPoints(origin, corner); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/NullConnector.java b/JHotDraw/src/CH/ifa/draw/figures/NullConnector.java deleted file mode 100644 index 41f1a998bbad32871162ce8f8099d99b4945da1e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/NullConnector.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @(#)Connector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.standard.AbstractConnector; -import CH.ifa.draw.framework.Figure; - -public class NullConnector extends AbstractConnector { - // AbstractConnector implements already all methods but cannot be instantiated - - private NullConnector() { - // do nothing: for JDO-compliance only - } - - public NullConnector(Figure owner) { - super(owner); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/NullFigure.java b/JHotDraw/src/CH/ifa/draw/figures/NullFigure.java deleted file mode 100644 index 408babdffeba2816079de4cf03bbbb893bcfb776..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/NullFigure.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * @(#)LineConnection.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.FigureEnumerator; -import CH.ifa.draw.standard.SingleFigureEnumerator; -import CH.ifa.draw.standard.AbstractFigure; -import CH.ifa.draw.standard.HandleEnumerator; - -import java.awt.*; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class NullFigure extends AbstractFigure { - - private Rectangle myDisplayBox; - - /** - * Moves the figure. This is the - * method that subclassers override. Clients usually - * call displayBox. - * @see #moveBy - */ - protected void basicMoveBy(int dx, int dy) { - myDisplayBox.translate(dx, dy); - } - - /** - * Changes the display box of a figure. This method is - * always implemented in figure subclasses. - * It only changes - * the displaybox and does not announce any changes. It - * is usually not called by the client. Clients typically call - * displayBox to change the display box. - * @param origin the new origin - * @param corner the new corner - * @see #displayBox - */ - public void basicDisplayBox(Point origin, Point corner) { - myDisplayBox = new Rectangle(origin); - myDisplayBox.add(corner); - } - - /** - * Gets the display box of a figure - * @see #basicDisplayBox - */ - public Rectangle displayBox() { - return new Rectangle(myDisplayBox); - } - - /** - * Draws the figure. - * @param g the Graphics to draw into - */ - public void draw(Graphics g) { - // A NullFigure cannot be drawn: it has no graphical representation - } - - /** - * Returns the handles used to manipulate - * the figure. Handles is a Factory Method for - * creating handle objects. - * - * @return an type-safe iterator of handles - * @see Handle - */ - public HandleEnumeration handles() { - return HandleEnumerator.getEmptyEnumeration(); - } - - /** - * Checks if the Figure should be considered as empty. - */ - public boolean isEmpty() { - return true; - } - - /** - * Returns an Enumeration of the figures contained in this figure - */ - public FigureEnumeration figures() { - return FigureEnumerator.getEmptyEnumeration(); - } - - /** - * Returns the figure that contains the given point. - */ - public Figure findFigureInside(int x, int y) { - // A NullFigure does not contain other figures - return null; - } - - /** - * Returns a Clone of this figure - */ - public Object clone() { - return super.clone(); - } - - /** - * Checks whether the given figure is contained in this figure. - */ - public boolean includes(Figure figure) { - // A NullFigure does not contain another figure - return false; - } - - /** - * Decomposes a figure into its parts. A figure is considered - * as a part of itself. - */ - public FigureEnumeration decompose() { - return new SingleFigureEnumerator(this); - } - - /** - * Releases a figure's resources. Release is called when - * a figure is removed from a drawing. Informs the listeners that - * the figure is removed by calling figureRemoved. - */ - public void release() { - // A NullFigure does not occupy any resources - } - - /** - * Invalidates the figure. This method informs its listeners - * that its current display box is invalid and should be - * refreshed. - */ - public void invalidate() { - // A NullFigure does not have a display box - } - - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * All figures support the attribute names - * FillColor and FrameColor - * - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - // A NullFigure does not have attributes: it cannot do anything with them - return null; - } - - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * All figures support the attribute names - * FillColor and FrameColor - */ - public Object getAttribute(FigureAttributeConstant attributeConstant) { - // A NullFigure does not have attributes: it cannot do anything with them - return null; - } - - /** - * Sets the named attribute to the new value - * - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - // A NullFigure does not have attributes: it cannot do anything with them - } - - /** - * Sets the named attribute to the new value - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - // A NullFigure does not have attributes: it cannot do anything with them - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/NumberTextFigure.java b/JHotDraw/src/CH/ifa/draw/figures/NumberTextFigure.java deleted file mode 100644 index fec1ef8ad04f3f215a6ac9c8464ff60c47e1f5f0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/NumberTextFigure.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * @(#)NumberTextFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.Figure; - -/** - * A TextFigure specialized to edit numbers. - * - * @version <$CURRENT_VERSION$> - */ -public class NumberTextFigure extends TextFigure { - - /* - * Serialization support. - */ - private static final long serialVersionUID = -4056859232918336475L; - private int numberTextFigureSerializedDataVersion = 1; - - /** - * Gets the number of columns to be used by the text overlay. - * @see CH.ifa.draw.util.FloatingTextField - */ - public int overlayColumns() { - return Math.max(4, getText().length()); - } - - /** - * Gets the numerical value of the contained text. - * return the value or 0 in the case of an illegal number format. - */ - public int getValue() { - int value = 0; - try { - value = Integer.parseInt(getText()); - } - catch (NumberFormatException e) { - value = 0; - } - return value; - } - - /** - * Sets the numberical value of the contained text. - */ - public void setValue(int value) { - setText(Integer.toString(value)); - } - - /** - * Usually, a TextHolders is implemented by a Figure subclass. To avoid casting - * a TextHolder to a Figure this method can be used for polymorphism (in this - * case, let the (same) object appear to be of another type). - * Note, that the figure returned is not the figure to which the TextHolder is - * (and its representing figure) connected. - * @return figure responsible for representing the content of this TextHolder - */ - public Figure getRepresentingFigure() { - return this; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/PolyLineConnector.java b/JHotDraw/src/CH/ifa/draw/figures/PolyLineConnector.java deleted file mode 100644 index 47791e1480108a79a7f417d18dc0f3cbb7a199a5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/PolyLineConnector.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * @(#)PolyLineConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -/** - * PolyLineConnector finds connection points on a - * PolyLineFigure. - * - * @see PolyLineFigure - * - * @version <$CURRENT_VERSION$> - */ -public class PolyLineConnector extends ChopBoxConnector { - - /* - * Serialization support. - */ - private static final long serialVersionUID = 6018435940519102865L; - - public PolyLineConnector() { - super(); - } - - /** - * Constructs a connector with the given owner figure. - */ - public PolyLineConnector(Figure owner) { - super(owner); - } - - protected Point chop(Figure target, Point from) { - PolyLineFigure p = (PolyLineFigure)owner(); - // *** based on PolygonFigure's heuristic - Point ctr = p.center(); - int cx = -1; - int cy = -1; - long len = Long.MAX_VALUE; - - // Try for points along edge - - for (int i = 0; i < p.pointCount()-1; i++) { - Point p1 = p.pointAt(i); - Point p2 = p.pointAt(i+1); - Point chop = Geom.intersect(p1.x, - p1.y, - p2.x, - p2.y, - from.x, - from.y, - ctr.x, - ctr.y); - if (chop != null) { - long cl = Geom.length2(chop.x, chop.y, from.x, from.y); - if (cl < len) { - len = cl; - cx = chop.x; - cy = chop.y; - } - } - } - // if none found, pick closest vertex - //if (len == Long.MAX_VALUE) { - { // try anyway - for (int i = 0; i < p.pointCount(); i++) { - Point pp = p.pointAt(i); - long l = Geom.length2(pp.x, pp.y, from.x, from.y); - if (l < len) { - len = l; - cx = pp.x; - cy = pp.y; - } - } - } - return new Point(cx, cy); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/figures/PolyLineFigure.java b/JHotDraw/src/CH/ifa/draw/figures/PolyLineFigure.java deleted file mode 100644 index 1ba24034c4883998ab58ac4347a2015fa51617ed..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/PolyLineFigure.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * @(#)PolyLineFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -// JUnitDoclet begin import -import CH.ifa.draw.framework.Connector; -import CH.ifa.draw.framework.FigureAttributeConstant; -import CH.ifa.draw.framework.HandleEnumeration; -import CH.ifa.draw.framework.Locator; -import CH.ifa.draw.standard.AbstractFigure; -import CH.ifa.draw.standard.HandleEnumerator; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; -// JUnitDoclet end import - -/** - * A poly line figure consists of a list of points. - * It has an optional line decoration at the start and end. - * - * @see LineDecoration - * - * @version <$CURRENT_VERSION$> - */ -public class PolyLineFigure extends AbstractFigure { - - public final static int ARROW_TIP_NONE = 0; - public final static int ARROW_TIP_START = 1; - public final static int ARROW_TIP_END = 2; - public final static int ARROW_TIP_BOTH = 3; - - protected List fPoints; - protected LineDecoration fStartDecoration = null; - protected LineDecoration fEndDecoration = null; - protected Color fFrameColor = Color.black; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -7951352179906577773L; - private int polyLineFigureSerializedDataVersion = 1; - - public PolyLineFigure() { - this(4); - } - - public PolyLineFigure(int size) { - fPoints = CollectionsFactory.current().createList(size); - } - - public PolyLineFigure(int x, int y) { - fPoints = CollectionsFactory.current().createList(); - fPoints.add(new Point(x, y)); - } - - public Rectangle displayBox() { - Iterator iter = points(); - if (iter.hasNext()) { - // avoid starting with origin 0,0 because that would lead to a too large rectangle - Rectangle r = new Rectangle((Point)iter.next()); - - while (iter.hasNext()) { - r.add((Point)iter.next()); - } - - return r; - } - else { - return new Rectangle(); - } - } - - public boolean isEmpty() { - return (size().width < 3) && (size().height < 3); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(fPoints.size()); - for (int i = 0; i < fPoints.size(); i++) { - handles.add(new PolyLineHandle(this, locator(i), i)); - } - return new HandleEnumerator(handles); - } - - public void basicDisplayBox(Point origin, Point corner) { - } - - /** - * Adds a node to the list of points. - */ - public void addPoint(int x, int y) { - fPoints.add(new Point(x, y)); - changed(); - } - - public Iterator points() { - return fPoints.iterator(); - } - - public int pointCount() { - return fPoints.size(); - } - - protected void basicMoveBy(int dx, int dy) { - Iterator iter = points(); - while (iter.hasNext()) { - ((Point)iter.next()).translate(dx, dy); - } - } - - /** - * Changes the position of a node. - */ - public void setPointAt(Point p, int i) { - willChange(); - fPoints.set(i, p); - changed(); - } - - /** - * Insert a node at the given point. - */ - public void insertPointAt(Point p, int i) { - fPoints.add(i, p); - changed(); - } - - public void removePointAt(int i) { - willChange(); - fPoints.remove(i); - changed(); - } - - /** - * Splits the segment at the given point if a segment was hit. - * @return the index of the segment or -1 if no segment was hit. - */ - public int splitSegment(int x, int y) { - int i = findSegment(x, y); - if (i != -1) { - insertPointAt(new Point(x, y), i+1); - } - return i+1; - } - - public Point pointAt(int i) { - return (Point)fPoints.get(i); - } - - /** - * Joins to segments into one if the given point hits a node - * of the polyline. - * @return true if the two segments were joined. - */ - public boolean joinSegments(int x, int y) { - for (int i= 1; i < fPoints.size()-1; i++) { - Point p = pointAt(i); - if (Geom.length(x, y, p.x, p.y) < 3) { - removePointAt(i); - return true; - } - } - return false; - } - - public Connector connectorAt(int x, int y) { - return new PolyLineConnector(this); - } - - /** - * Sets the start decoration. - */ - public void setStartDecoration(LineDecoration l) { - fStartDecoration = l; - } - - /** - * Returns the start decoration. - */ - public LineDecoration getStartDecoration() { - return fStartDecoration; - } - - /** - * Sets the end decoration. - */ - public void setEndDecoration(LineDecoration l) { - fEndDecoration = l; - } - - /** - * Returns the end decoration. - */ - public LineDecoration getEndDecoration() { - return fEndDecoration; - } - - public void draw(Graphics g) { - g.setColor(getFrameColor()); - Point p1, p2; - for (int i = 0; i < fPoints.size()-1; i++) { - p1 = pointAt(i); - p2 = pointAt(i+1); - drawLine(g, p1.x, p1.y, p2.x, p2.y); - } - decorate(g); - } - - /** - * Can be overriden in subclasses to draw different types of lines - * (e.g. dotted lines) - */ - protected void drawLine(Graphics g, int x1, int y1, int x2, int y2) { - g.drawLine(x1, y1, x2, y2); - } - - public boolean containsPoint(int x, int y) { - Rectangle bounds = displayBox(); - bounds.grow(4,4); - if (!bounds.contains(x, y)) { - return false; - } - - for (int i = 0; i < fPoints.size()-1; i++) { - Point p1 = pointAt(i); - Point p2 = pointAt(i+1); - if (Geom.lineContainsPoint(p1.x, p1.y, p2.x, p2.y, x, y)) { - return true; - } - } - return false; - } - - /** - * Gets the segment of the polyline that is hit by - * the given point. - * @return the index of the segment or -1 if no segment was hit. - */ - public int findSegment(int x, int y) { - for (int i = 0; i < fPoints.size()-1; i++) { - Point p1 = pointAt(i); - Point p2 = pointAt(i+1); - if (Geom.lineContainsPoint(p1.x, p1.y, p2.x, p2.y, x, y)) { - return i; - } - } - return -1; - } - - private void decorate(Graphics g) { - if (getStartDecoration() != null) { - Point p1 = pointAt(0); - Point p2 = pointAt(1); - getStartDecoration().draw(g, p1.x, p1.y, p2.x, p2.y); - } - if (getEndDecoration() != null) { - Point p3 = pointAt(fPoints.size()-2); - Point p4 = pointAt(fPoints.size()-1); - getEndDecoration().draw(g, p4.x, p4.y, p3.x, p3.y); - } - } - - /** - * Gets the attribute with the given name. - * PolyLineFigure maps "ArrowMode"to a - * line decoration. - * - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - return getAttribute(FigureAttributeConstant.getConstant(name)); - } - - /** - * Gets the attribute with the given name. - * PolyLineFigure maps "ArrowMode"to a - * line decoration. - */ - public Object getAttribute(FigureAttributeConstant attributeConstant) { - if (attributeConstant.equals(FigureAttributeConstant.FRAME_COLOR)) { - return getFrameColor(); - } - else if (attributeConstant.equals(FigureAttributeConstant.ARROW_MODE)) { - int value = 0; - if (getStartDecoration() != null) { - value |= ARROW_TIP_START; - } - if (getEndDecoration() != null) { - value |= ARROW_TIP_END; - } - return new Integer(value); - } - return super.getAttribute(attributeConstant); - } - - /** - * Sets the attribute with the given name. - * PolyLineFigure interprets "ArrowMode"to set - * the line decoration. - * - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - setAttribute(FigureAttributeConstant.getConstant(name), value); - } - - /** - * Sets the attribute with the given name. - * PolyLineFigure interprets "ArrowMode"to set - * the line decoration. - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - if (attributeConstant.equals(FigureAttributeConstant.FRAME_COLOR)) { - setFrameColor((Color)value); - changed(); - } - else if (attributeConstant.equals(FigureAttributeConstant.ARROW_MODE)) { - Integer intObj = (Integer)value; - if (intObj != null) { - int decoration = intObj.intValue(); - if ((decoration & ARROW_TIP_START) != 0) { - setStartDecoration(new ArrowTip()); - } - else { - setStartDecoration(null); - } - if ((decoration & ARROW_TIP_END) != 0) { - setEndDecoration(new ArrowTip()); - } - else { - setEndDecoration(null); - } - } - changed(); - } - else { - super.setAttribute(attributeConstant, value); - } - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fPoints.size()); - Iterator iter = points(); - while (iter.hasNext()) { - Point p = (Point)iter.next(); - dw.writeInt(p.x); - dw.writeInt(p.y); - } - dw.writeStorable(fStartDecoration); - dw.writeStorable(fEndDecoration); - dw.writeColor(fFrameColor); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - int size = dr.readInt(); - fPoints = CollectionsFactory.current().createList(size); - for (int i=0; i<size; i++) { - int x = dr.readInt(); - int y = dr.readInt(); - fPoints.add(new Point(x,y)); - } - setStartDecoration((LineDecoration)dr.readStorable()); - setEndDecoration((LineDecoration)dr.readStorable()); - fFrameColor = dr.readColor(); - } - - /** - * Creates a locator for the point with the given index. - */ - public static Locator locator(int pointIndex) { - return new PolyLineLocator(pointIndex); - } - - protected Color getFrameColor() { - return fFrameColor; - } - - protected void setFrameColor(Color c) { - fFrameColor = c; - } - - /** - * Hook method to change the rectangle that will be invalidated - */ - protected Rectangle invalidateRectangle(Rectangle r) { - // SF-bug id: 533953: provide this method to customize invalidated rectangle - Rectangle parentR = super.invalidateRectangle(r); - if (getStartDecoration() != null) { - parentR.add(getStartDecoration().displayBox()); - } - if (getEndDecoration() != null) { - parentR.add(getEndDecoration().displayBox()); - } - return parentR; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/PolyLineHandle.java b/JHotDraw/src/CH/ifa/draw/figures/PolyLineHandle.java deleted file mode 100644 index 86e5d2d8546e4caadb067fb8afa184bdd9fef872..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/PolyLineHandle.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)PolyLineHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.LocatorHandle; -import CH.ifa.draw.standard.SingleFigureEnumerator; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; -import java.awt.*; - -/** - * A handle for a node on the polyline. - * - * @version <$CURRENT_VERSION$> - */ -public class PolyLineHandle extends LocatorHandle { - - private int fIndex; - - /** - * Constructs a poly line handle. - * @param owner the owning polyline figure. - * @param l the locator - * @param index the index of the node associated with this handle. - */ - public PolyLineHandle(PolyLineFigure owner, Locator l, int index) { - super(owner, l); - fIndex = index; - } - - public void invokeStart(int x, int y, DrawingView view) { - setUndoActivity(createUndoActivity(view, fIndex)); - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(owner())); - ((PolyLineHandle.UndoActivity)getUndoActivity()).setOldPoint(new Point(x,y)); - } - - public void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view) { - int currentIndex = ((PolyLineHandle.UndoActivity)getUndoActivity()).getPointIndex(); - myOwner().setPointAt(new Point(x, y), currentIndex); - } - - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - if ((x == anchorX) && (y == anchorY)) { - setUndoActivity(null); - } - } - - private PolyLineFigure myOwner() { - return (PolyLineFigure)owner(); - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected Undoable createUndoActivity(DrawingView newView, int newPointIndex) { - return new PolyLineHandle.UndoActivity(newView, newPointIndex); - } - - public static class UndoActivity extends UndoableAdapter { - private Point myOldPoint; - private int myPointIndex; - - public UndoActivity(DrawingView newView, int newPointIndex) { - super(newView); - setUndoable(true); - setRedoable(true); - setPointIndex(newPointIndex); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - return movePointToOldLocation(); - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - return movePointToOldLocation(); - } - - protected boolean movePointToOldLocation() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - - PolyLineFigure figure = (PolyLineFigure)fe.nextFigure(); - Point backupPoint = figure.pointAt(getPointIndex()); - figure.setPointAt(getOldPoint(), getPointIndex()); - setOldPoint(backupPoint); - return true; - } - - public void setOldPoint(Point newOldPoint) { - myOldPoint = newOldPoint; - } - - public Point getOldPoint() { - return myOldPoint; - } - - public void setPointIndex(int newPointIndex) { - myPointIndex = newPointIndex; - } - - public int getPointIndex() { - return myPointIndex; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/PolyLineLocator.java b/JHotDraw/src/CH/ifa/draw/figures/PolyLineLocator.java deleted file mode 100644 index b01e277683cd7af39b03d5a9badf72a1ed35c4e0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/PolyLineLocator.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @(#)PolyLineLocator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * A poly line figure consists of a list of points. - * It has an optional line decoration at the start and end. - * - * @see LineDecoration - * - * @version <$CURRENT_VERSION$> - */ -class PolyLineLocator extends AbstractLocator { - int fIndex; - - public PolyLineLocator(int index) { - fIndex = index; - } - - public Point locate(Figure owner) { - PolyLineFigure plf = (PolyLineFigure)owner; - // guard against changing PolyLineFigures -> temporary hack - if (fIndex < plf.pointCount()) { - return ((PolyLineFigure)owner).pointAt(fIndex); - } - return new Point(0, 0); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/RadiusHandle.java b/JHotDraw/src/CH/ifa/draw/figures/RadiusHandle.java deleted file mode 100644 index 95fc8854bdd765b2038fbb9a8b9200eda572c56f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/RadiusHandle.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * @(#)RadiusHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; -import java.awt.*; - -/** - * A Handle to manipulate the radius of a round corner rectangle. - * - * @version <$CURRENT_VERSION$> - */ -class RadiusHandle extends AbstractHandle { - - private static final int OFFSET = 4; - - public RadiusHandle(RoundRectangleFigure owner) { - super(owner); - } - - public void invokeStart(int x, int y, DrawingView view) { - setUndoActivity(createUndoActivity(view)); - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(owner())); - ((RadiusHandle.UndoActivity)getUndoActivity()). - setOldRadius(((RoundRectangleFigure)owner()).getArc()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - int dx = x-anchorX; - int dy = y-anchorY; - RoundRectangleFigure owner = (RoundRectangleFigure)owner(); - Rectangle r = owner.displayBox(); - Point originalRadius = ((RadiusHandle.UndoActivity)getUndoActivity()).getOldRadius(); - int rx = Geom.range(0, r.width, 2*(originalRadius.x/2 + dx)); - int ry = Geom.range(0, r.height, 2*(originalRadius.y/2 + dy)); - owner.setArc(rx, ry); - } - - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - Point currentRadius = ((RoundRectangleFigure)owner()).getArc(); - Point originalRadius = ((RadiusHandle.UndoActivity)getUndoActivity()).getOldRadius(); - // there has been no change so there is nothing to undo - if ((currentRadius.x == originalRadius.x) && (currentRadius.y == originalRadius.y)) { - setUndoActivity(null); - } - } - - public Point locate() { - RoundRectangleFigure owner = (RoundRectangleFigure)owner(); - Point radius = owner.getArc(); - Rectangle r = owner.displayBox(); - return new Point(r.x+radius.x/2+OFFSET, r.y+radius.y/2+OFFSET); - } - - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.yellow); - g.fillOval(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawOval(r.x, r.y, r.width, r.height); - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected Undoable createUndoActivity(DrawingView newView) { - return new RadiusHandle.UndoActivity(newView); - } - - public static class UndoActivity extends UndoableAdapter { - private Point myOldRadius; - - public UndoActivity(DrawingView newView) { - super(newView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - return resetRadius(); - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - return resetRadius(); - } - - protected boolean resetRadius() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - RoundRectangleFigure currentFigure = (RoundRectangleFigure)fe.nextFigure(); - Point figureRadius = currentFigure.getArc(); - currentFigure.setArc(getOldRadius().x, getOldRadius().y); - setOldRadius(figureRadius); - return true; - } - - protected void setOldRadius(Point newOldRadius) { - myOldRadius = newOldRadius; - } - - public Point getOldRadius() { - return myOldRadius; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/RectangleFigure.java b/JHotDraw/src/CH/ifa/draw/figures/RectangleFigure.java deleted file mode 100644 index f9cecb1d7ab554b3b667ad356f9069141a168abd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/RectangleFigure.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * @(#)RectangleFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.io.IOException; -import java.util.List; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.HandleEnumeration; - - -/** - * A rectangle figure. - * - * @version <$CURRENT_VERSION$> - */ -public class RectangleFigure extends AttributeFigure { - - private Rectangle fDisplayBox; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 184722075881789163L; - private int rectangleFigureSerializedDataVersion = 1; - - public RectangleFigure() { - this(new Point(0,0), new Point(0,0)); - } - - public RectangleFigure(Point origin, Point corner) { - basicDisplayBox(origin,corner); - } - - public void basicDisplayBox(Point origin, Point corner) { - fDisplayBox = new Rectangle(origin); - fDisplayBox.add(corner); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - return new HandleEnumerator(handles); - } - - public Rectangle displayBox() { - return new Rectangle( - fDisplayBox.x, - fDisplayBox.y, - fDisplayBox.width, - fDisplayBox.height); - } - - protected void basicMoveBy(int x, int y) { - fDisplayBox.translate(x,y); - } - - public void drawBackground(Graphics g) { - Rectangle r = displayBox(); - g.fillRect(r.x, r.y, r.width, r.height); - } - - public void drawFrame(Graphics g) { - Rectangle r = displayBox(); - g.drawRect(r.x, r.y, r.width-1, r.height-1); - } - - //-- store / load ---------------------------------------------- - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fDisplayBox.x); - dw.writeInt(fDisplayBox.y); - dw.writeInt(fDisplayBox.width); - dw.writeInt(fDisplayBox.height); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fDisplayBox = new Rectangle( - dr.readInt(), - dr.readInt(), - dr.readInt(), - dr.readInt()); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/RoundRectangleFigure.java b/JHotDraw/src/CH/ifa/draw/figures/RoundRectangleFigure.java deleted file mode 100644 index ef0047bcacc8aa1188befb457d43b13e91aac8e6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/RoundRectangleFigure.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * @(#)RoundRectangleFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import java.awt.*; -import java.io.IOException; -import java.util.List; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - - -/** - * A round rectangle figure. - * - * @see RadiusHandle - * - * @version <$CURRENT_VERSION$> - */ -public class RoundRectangleFigure extends AttributeFigure { - - private Rectangle fDisplayBox; - private int fArcWidth; - private int fArcHeight; - private static final int DEFAULT_ARC = 8; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 7907900248924036885L; - private int roundRectangleSerializedDataVersion = 1; - - public RoundRectangleFigure() { - this(new Point(0,0), new Point(0,0)); - fArcWidth = fArcHeight = DEFAULT_ARC; - } - - public RoundRectangleFigure(Point origin, Point corner) { - basicDisplayBox(origin,corner); - fArcWidth = fArcHeight = DEFAULT_ARC; - } - - public void basicDisplayBox(Point origin, Point corner) { - fDisplayBox = new Rectangle(origin); - fDisplayBox.add(corner); - } - - /** - * Sets the arc's witdh and height. - */ - public void setArc(int width, int height) { - willChange(); - fArcWidth = width; - fArcHeight = height; - changed(); - } - - /** - * Gets the arc's width and height. - */ - public Point getArc() { - return new Point(fArcWidth, fArcHeight); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - BoxHandleKit.addHandles(this, handles); - - handles.add(new RadiusHandle(this)); - - return new HandleEnumerator(handles); - } - - public Rectangle displayBox() { - return new Rectangle( - fDisplayBox.x, - fDisplayBox.y, - fDisplayBox.width, - fDisplayBox.height); - } - - protected void basicMoveBy(int x, int y) { - fDisplayBox.translate(x,y); - } - - public void drawBackground(Graphics g) { - Rectangle r = displayBox(); - /* - * JP, 25-May-03: Changed from (width-1, height-1) to (width, height), - * because figures were not filled completely (JDK 1.4.x). Might invalidate - * fix for #661878. If the problem is JDK-dependant, maybe the JDK version - * should be taken into account here? - */ - g.fillRoundRect(r.x, r.y, r.width, r.height, fArcWidth, fArcHeight); - } - - public void drawFrame(Graphics g) { - Rectangle r = displayBox(); - g.drawRoundRect(r.x, r.y, r.width-1, r.height-1, fArcWidth, fArcHeight); - } - - public Insets connectionInsets() { - return new Insets(fArcHeight/2, fArcWidth/2, fArcHeight/2, fArcWidth/2); - } - - public Connector connectorAt(int x, int y) { - return new ShortestDistanceConnector(this); // just for demo purposes - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fDisplayBox.x); - dw.writeInt(fDisplayBox.y); - dw.writeInt(fDisplayBox.width); - dw.writeInt(fDisplayBox.height); - dw.writeInt(fArcWidth); - dw.writeInt(fArcHeight); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fDisplayBox = new Rectangle( - dr.readInt(), - dr.readInt(), - dr.readInt(), - dr.readInt()); - fArcWidth = dr.readInt(); - fArcHeight = dr.readInt(); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/ScribbleTool.java b/JHotDraw/src/CH/ifa/draw/figures/ScribbleTool.java deleted file mode 100644 index 6a24dc2e738667d2aa593d803448f37b34e023a4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ScribbleTool.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @(#)ScribbleTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Undoable; -import java.awt.event.MouseEvent; - -/** - * Tool to scribble a PolyLineFigure - * - * @see PolyLineFigure - * - * @version <$CURRENT_VERSION$> - */ -public class ScribbleTool extends AbstractTool { - - private PolyLineFigure fScribble; - private int fLastX, fLastY; - - /** - * the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - private Figure myAddedFigure; - - public ScribbleTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - public void activate() { - super.activate(); - } - - public void deactivate() { - super.deactivate(); - if (fScribble != null) { - if (fScribble.size().width < 4 || fScribble.size().height < 4) { - getActiveDrawing().remove(fScribble); - // nothing to undo - setUndoActivity(null); - } - fScribble = null; - } - } - - private void point(int x, int y) { - if (fScribble == null) { - fScribble = new PolyLineFigure(x, y); - setAddedFigure(view().add(fScribble)); - } - else if (fLastX != x || fLastY != y) { - fScribble.addPoint(x, y); - } - - fLastX = x; - fLastY = y; - } - - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e,x,y); - if (e.getClickCount() >= 2) { - // use undo activity from paste command... - setUndoActivity(createUndoActivity()); - - // put created figure into a figure enumeration - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure())); - } - else { - // use original event coordinates to avoid - // supress that the scribble is constrained to - // the grid - point(e.getX(), e.getY()); - } - } - - public void mouseDrag(MouseEvent e, int x, int y) { - if (fScribble != null) { - point(e.getX(), e.getY()); - } - } - - public void mouseUp(MouseEvent e, int x, int y) { - super.mouseUp(e, x, y); - // deactivate tool only when mouseUp was also fired - if (e.getClickCount() >= 2) { - editor().toolDone(); - } - } - - /** - * Gets the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - protected Figure getAddedFigure() { - return myAddedFigure; - } - - private void setAddedFigure(Figure newAddedFigure) { - myAddedFigure = newAddedFigure; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new PasteCommand.UndoActivity(view()); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/ShortestDistanceConnector.java b/JHotDraw/src/CH/ifa/draw/figures/ShortestDistanceConnector.java deleted file mode 100644 index bccea66acf81f6ae1d7932a270cbeaa7bd435ef2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/ShortestDistanceConnector.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * @(#)ShortestDistanceConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Geom; -import java.awt.*; - -/** - * A ShortestDistance locates connection points by - * finding the shortest distance between the start and - * end of the connection. - * It doesn't connect to the areas defined by Figure.connectionInsets() - * - * @see Figure#connectionInsets - * @see Connector - * - * @version <$CURRENT_VERSION$> - */ -public class ShortestDistanceConnector extends AbstractConnector { - - /* - * Serialization support. - */ - private static final long serialVersionUID = -2273446020593433887L; - - public ShortestDistanceConnector() { // only used for Storable implementation - super(); - } - - public ShortestDistanceConnector(Figure owner) { - super(owner); - } - - public Point findStart(ConnectionFigure connection) { - return findPoint(connection, true); - } - - public Point findEnd(ConnectionFigure connection) { - return findPoint(connection, false); - } - - protected Point findPoint(ConnectionFigure connection, boolean getStart) { - Figure startFigure = connection.getStartConnector().owner(); - Figure endFigure = connection.getEndConnector().owner(); - - Rectangle r1 = startFigure.displayBox(); - Rectangle r2 = endFigure.displayBox(); - - Insets i1 = startFigure.connectionInsets(); - Insets i2 = endFigure.connectionInsets(); - - Point p1, p2; - Point start = null, end = null, s = null, e = null; - long len2 = Long.MAX_VALUE, l2; - int x1, x2, y1, y2; // connection points - int xmin, xmax, ymin, ymax; - - // X-dimension - // constrain width connection insets - int r1x, r1width, r2x, r2width, r1y, r1height, r2y, r2height; - r1x = r1.x + i1.left; - r1width = r1.width - i1.left - i1.right-1; - r2x = r2.x + i2.left; - r2width = r2.width - i2.left - i2.right-1; - - // find x connection point - if (r1x + r1width < r2x) { - x1 = r1x + r1width; - x2 = r2x; - } - else if (r1x > r2x + r2width) { - x1 = r1x; - x2 = r2x + r2width; - } - else { - xmax = Math.max(r1x, r2x); - xmin = Math.min(r1x+r1width, r2x+r2width); - x1 = x2 = (xmax + xmin) /2; - } - - // Y-Dimension - // constrain with connection insets - r1y = r1.y + i1.top; - r1height = r1.height - i1.top - i1.bottom-1; - r2y = r2.y + i2.top; - r2height = r2.height - i2.top - i2.bottom-1; - - // y connection point - if (r1y + r1height < r2y) { - y1 = r1y + r1height; - y2 = r2y; - } - else if (r1y > r2y + r2height) { - y1 = r1y; - y2 = r2y + r2height; - } - else { - ymax = Math.max(r1y, r2y); - ymin = Math.min(r1y+r1height, r2y+r2height); - y1 = y2 = (ymax + ymin) /2; - } - // find shortest connection - for (int i = 0; i < 4; i++) { - switch(i) { - case 0: - // EAST-WEST - p1 = Geom.east(r1); - p2 = Geom.west(r2); - s = new Point(p1.x, y1); - e = new Point(p2.x, y2); - break; - case 1: - // WEST-EAST - p1 = Geom.west(r1); - p2 = Geom.east(r2); - s = new Point(p1.x, y1); - e = new Point(p2.x, y2); - break; - case 2: - // NORTH-SOUTH - p1 = Geom.north(r1); - p2 = Geom.south(r2); - s = new Point(x1, p1.y); - e = new Point(x2, p2.y); - break; - case 3: - // SOUTH-NORTH - p1 = Geom.south(r1); - p2 = Geom.north(r2); - s = new Point(x1, p1.y); - e = new Point(x2, p2.y); - break; - } - l2 = Geom.length2(s.x, s.y, e.x, e.y); - if (l2 < len2) { - start = s; - end = e; - len2 = l2; - } - } - if (getStart) { - return start; - } - return end; - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/figures/TextFigure.java b/JHotDraw/src/CH/ifa/draw/figures/TextFigure.java deleted file mode 100644 index 3da10c69e91a027d49cfe7af12a769d06f2a0e3d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/TextFigure.java +++ /dev/null @@ -1,509 +0,0 @@ -/* - * @(#)TextFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.ColorMap; -import CH.ifa.draw.util.StorableInput; -import CH.ifa.draw.util.StorableOutput; - -import java.awt.*; -import java.io.*; -import java.util.List; - -/** - * A text figure. - * - * @see TextTool - * - * @version <$CURRENT_VERSION$> - */ -public class TextFigure - extends AttributeFigure - implements FigureChangeListener, TextHolder { - - private int fOriginX; - private int fOriginY; - - // cache of the TextFigure's size - transient private boolean fSizeIsDirty = true; - transient private int fWidth; - transient private int fHeight; - - private String fText; - private Font fFont; - private boolean fIsReadOnly; - - private Figure fObservedFigure = null; - private OffsetLocator fLocator = null; - - private static String fgCurrentFontName = "Helvetica"; - private static int fgCurrentFontSize = 12; - private static int fgCurrentFontStyle = Font.PLAIN; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 4599820785949456124L; - private int textFigureSerializedDataVersion = 1; - - public TextFigure() { - fOriginX = 0; - fOriginY = 0; - fFont = createCurrentFont(); - setAttribute(FigureAttributeConstant.FILL_COLOR, ColorMap.color("None")); - fText = ""; - fSizeIsDirty = true; - } - - /** - * @see CH.ifa.draw.framework.Figure#moveBy(int, int) - */ - public void moveBy(int x, int y) { - willChange(); - basicMoveBy(x, y); - if (getLocator() != null) { - getLocator().moveBy(x, y); - } - changed(); - } - - protected void basicMoveBy(int x, int y) { - fOriginX += x; - fOriginY += y; - } - - /** - * @see CH.ifa.draw.framework.Figure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - public void basicDisplayBox(Point newOrigin, Point newCorner) { - fOriginX = newOrigin.x; - fOriginY = newOrigin.y; - } - - /** - * @see CH.ifa.draw.framework.Figure#displayBox() - */ - public Rectangle displayBox() { - Dimension extent = textExtent(); - return new Rectangle(fOriginX, fOriginY, extent.width, extent.height); - } - - /** - * @see CH.ifa.draw.standard.TextHolder#textDisplayBox() - */ - public Rectangle textDisplayBox() { - return displayBox(); - } - - /** - * Tests whether this figure is read only. - */ - public boolean readOnly() { - return fIsReadOnly; - } - - /** - * Sets the read only status of the text figure. - */ - public void setReadOnly(boolean isReadOnly) { - fIsReadOnly = isReadOnly; - } - - /** - * Gets the font. - * @see CH.ifa.draw.standard.TextHolder#getFont() - */ - public Font getFont() { - return fFont; - } - - /** - * Usually, a TextHolders is implemented by a Figure subclass. To avoid casting - * a TextHolder to a Figure this method can be used for polymorphism (in this - * case, let the (same) object appear to be of another type). - * Note, that the figure returned is not the figure to which the TextHolder is - * (and its representing figure) connected. - * @return figure responsible for representing the content of this TextHolder - * @see CH.ifa.draw.standard.TextHolder#getRepresentingFigure() - */ - public Figure getRepresentingFigure() { - return this; - } - - /** - * Sets the font. - */ - public void setFont(Font newFont) { - willChange(); - fFont = newFont; - markDirty(); - changed(); - } - - /** - * Updates the location whenever the figure changes itself. - * @see CH.ifa.draw.framework.Figure#changed() - */ - public void changed() { - super.changed(); - //updateLocation(); - } - - /** - * A text figure understands the "FontSize", "FontStyle", and "FontName" - * attributes. - * - * @see CH.ifa.draw.framework.Figure#getAttribute(java.lang.String) - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - return getAttribute(FigureAttributeConstant.getConstant(name)); - } - - /** - * A text figure understands the "FontSize", "FontStyle", and "FontName" - * attributes. - * @see CH.ifa.draw.framework.Figure#getAttribute(CH.ifa.draw.framework.FigureAttributeConstant) - */ - public Object getAttribute(FigureAttributeConstant attributeConstant) { - Font font = getFont(); - if (attributeConstant.equals(FigureAttributeConstant.FONT_SIZE)) { - return new Integer(font.getSize()); - } - if (attributeConstant.equals(FigureAttributeConstant.FONT_STYLE)) { - return new Integer(font.getStyle()); - } - if (attributeConstant.equals(FigureAttributeConstant.FONT_NAME)) { - return font.getName(); - } - return super.getAttribute(attributeConstant); - } - - /** - * A text figure understands the "FontSize", "FontStyle", and "FontName" - * attributes. - * - * @see CH.ifa.draw.framework.Figure#setAttribute(java.lang.String, java.lang.Object) - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - setAttribute(FigureAttributeConstant.getConstant(name), value); - } - - /** - * A text figure understands the "FontSize", "FontStyle", and "FontName" - * attributes. - * @see CH.ifa.draw.framework.Figure#setAttribute(CH.ifa.draw.framework.FigureAttributeConstant, java.lang.Object) - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - Font font = getFont(); - if (attributeConstant.equals(FigureAttributeConstant.FONT_SIZE)) { - Integer s = (Integer) value; - setFont(new Font(font.getName(), font.getStyle(), s.intValue())); - } - else if (attributeConstant.equals(FigureAttributeConstant.FONT_STYLE)) { - Integer s = (Integer) value; - int style = font.getStyle(); - if (s.intValue() == Font.PLAIN) { - style = Font.PLAIN; - } - else { - style = style ^ s.intValue(); - } - setFont(new Font(font.getName(), style, font.getSize())); - } - else if (attributeConstant.equals(FigureAttributeConstant.FONT_NAME)) { - String n = (String) value; - setFont(new Font(n, font.getStyle(), font.getSize())); - } - else { - super.setAttribute(attributeConstant, value); - } - } - - /** - * Gets the text shown by the text figure. - * @see CH.ifa.draw.standard.TextHolder#getText() - */ - public String getText() { - return fText; - } - - /** - * Sets the text shown by the text figure. - * @see CH.ifa.draw.standard.TextHolder#setText(java.lang.String) - */ - public void setText(String newText) { - if (newText == null || !newText.equals(fText)) { - willChange(); - fText = newText; - markDirty(); - changed(); - } - } - - /** - * Tests whether the figure accepts typing. - * @see CH.ifa.draw.standard.TextHolder#acceptsTyping() - */ - public boolean acceptsTyping() { - return !fIsReadOnly; - } - - /** - * @see CH.ifa.draw.figures.AttributeFigure#drawBackground(java.awt.Graphics) - */ - public void drawBackground(Graphics g) { - Rectangle r = displayBox(); - g.fillRect(r.x, r.y, r.width, r.height); - } - - /** - * @see CH.ifa.draw.figures.AttributeFigure#drawFrame(java.awt.Graphics) - */ - public void drawFrame(Graphics g) { - g.setFont(fFont); - g.setColor((Color) getAttribute(FigureAttributeConstant.TEXT_COLOR)); - FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(fFont); - Rectangle r = displayBox(); - g.drawString(getText(), r.x, r.y + metrics.getAscent()); - } - - protected Dimension textExtent() { - if (!fSizeIsDirty) { - return new Dimension(fWidth, fHeight); - } - FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(fFont); - fWidth = metrics.stringWidth(getText()); - fHeight = metrics.getHeight(); - fSizeIsDirty = false; - return new Dimension(fWidth, fHeight); - } - - protected void markDirty() { - fSizeIsDirty = true; - } - - /** - * Gets the number of columns to be overlaid when the figure is edited. - * @see CH.ifa.draw.standard.TextHolder#overlayColumns() - */ - public int overlayColumns() { - int length = getText().length(); - int columns = 20; - if (length != 0) { - columns = getText().length() + 3; - } - return columns; - } - - /** - * @see CH.ifa.draw.framework.Figure#handles() - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - handles.add(new NullHandle(this, RelativeLocator.northWest())); - handles.add(new NullHandle(this, RelativeLocator.northEast())); - handles.add(new NullHandle(this, RelativeLocator.southEast())); - handles.add(new FontSizeHandle(this, RelativeLocator.southWest())); - return new HandleEnumerator(handles); - } - - /** - * @see CH.ifa.draw.util.Storable#write(CH.ifa.draw.util.StorableOutput) - */ - public void write(StorableOutput dw) { - super.write(dw); - Rectangle r = displayBox(); - dw.writeInt(r.x); - dw.writeInt(r.y); - dw.writeString(getText()); - dw.writeString(fFont.getName()); - dw.writeInt(fFont.getStyle()); - dw.writeInt(fFont.getSize()); - dw.writeBoolean(fIsReadOnly); - dw.writeStorable(getObservedFigure()); - dw.writeStorable(getLocator()); - } - - /** - * @see CH.ifa.draw.util.Storable#read(CH.ifa.draw.util.StorableInput) - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - markDirty(); - basicDisplayBox(new Point(dr.readInt(), dr.readInt()), null); - setText(dr.readString()); - fFont = new Font(dr.readString(), dr.readInt(), dr.readInt()); - fIsReadOnly = dr.readBoolean(); - - setObservedFigure((Figure) dr.readStorable()); - if (getObservedFigure() != null) { - getObservedFigure().addFigureChangeListener(this); - } - setLocator((OffsetLocator) dr.readStorable()); - } - - private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { - s.defaultReadObject(); - - if (getObservedFigure() != null) { - getObservedFigure().addFigureChangeListener(this); - } - markDirty(); - } - - /** - * @see CH.ifa.draw.standard.TextHolder#connect(CH.ifa.draw.framework.Figure) - */ - public void connect(Figure figure) { - if (getObservedFigure() != null) { - getObservedFigure().removeFigureChangeListener(this); - } - - setObservedFigure(figure); - setLocator(new OffsetLocator(getObservedFigure().connectedTextLocator(this))); - getObservedFigure().addFigureChangeListener(this); - willChange(); - updateLocation(); - changed(); - } - - /** - * @see CH.ifa.draw.framework.FigureChangeListener#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - public void figureChanged(FigureChangeEvent e) { - willChange(); - updateLocation(); - changed(); - } - - /** - * @see CH.ifa.draw.framework.FigureChangeListener#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - public void figureRemoved(FigureChangeEvent e) { - if (listener() != null) { - Rectangle rect = invalidateRectangle(displayBox()); - listener().figureRemoved(new FigureChangeEvent(this, rect, e)); - } - } - - /** - * @see CH.ifa.draw.framework.FigureChangeListener#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - public void figureRequestRemove(FigureChangeEvent e) { - } - - /** - * @see CH.ifa.draw.framework.FigureChangeListener#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - public void figureInvalidated(FigureChangeEvent e) { - } - - /** - * @see CH.ifa.draw.framework.FigureChangeListener#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - public void figureRequestUpdate(FigureChangeEvent e) { - } - - /** - * Updates the location relative to the connected figure. - * The TextFigure is centered around the located point. - */ - protected void updateLocation() { - if (getLocator() != null) { - Point p = getLocator().locate(getObservedFigure()); - - p.x -= size().width / 2 + fOriginX; - p.y -= size().height / 2 + fOriginY; - if (p.x != 0 || p.y != 0) { - //willChange(); - basicMoveBy(p.x, p.y); - //changed(); - } - } - } - - /** - * @see CH.ifa.draw.framework.Figure#release() - */ - public void release() { - super.release(); - disconnect(getObservedFigure()); - } - - /** - * Disconnects a text holder from a connect figure. - * @see CH.ifa.draw.standard.TextHolder#disconnect(CH.ifa.draw.framework.Figure) - */ - public void disconnect(Figure disconnectFigure) { - if (disconnectFigure != null) { - disconnectFigure.removeFigureChangeListener(this); - } - setLocator(null); - setObservedFigure(null); - } - - protected void setObservedFigure(Figure newObservedFigure) { - fObservedFigure = newObservedFigure; - } - - public Figure getObservedFigure() { - return fObservedFigure; - } - - protected void setLocator(OffsetLocator newLocator) { - fLocator = newLocator; - } - - protected OffsetLocator getLocator() { - return fLocator; - } - - /** - * @see CH.ifa.draw.framework.Figure#getTextHolder() - */ - public TextHolder getTextHolder() { - return this; - } - - /** - * Creates the current font to be used for new text figures. - */ - static public Font createCurrentFont() { - return new Font(fgCurrentFontName, fgCurrentFontStyle, fgCurrentFontSize); - } - - /** - * Sets the current font name - */ - static public void setCurrentFontName(String name) { - fgCurrentFontName = name; - } - - /** - * Sets the current font size. - */ - static public void setCurrentFontSize(int size) { - fgCurrentFontSize = size; - } - - /** - * Sets the current font style. - */ - static public void setCurrentFontStyle(int style) { - fgCurrentFontStyle = style; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/figures/TextTool.java b/JHotDraw/src/CH/ifa/draw/figures/TextTool.java deleted file mode 100644 index af3ede00366eb6f36bdda5b627bca43d1bf83fe6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/TextTool.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * @(#)TextTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.FloatingTextField; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; -import java.awt.*; -import java.awt.event.*; - -/** - * Tool to create new or edit existing text figures. - * The editing behavior is implemented by overlaying the - * Figure providing the text with a FloatingTextField.<p> - * A tool interaction is done once a Figure that is not - * a TextHolder is clicked. - * - * @see TextHolder - * @see FloatingTextField - * - * @version <$CURRENT_VERSION$> - */ -public class TextTool extends CreationTool { - - private FloatingTextField myTextField; - private TextHolder myTypingTarget; - - /** - * The selected figure is different from the TextHolder as the TextHolder - * may be included in a DecoratorFigure. Thus, the DecoratorFigure is selected - * while the TextFigure is edited. - */ - private Figure mySelectedFigure; - - public TextTool(DrawingEditor newDrawingEditor, Figure prototype) { - super(newDrawingEditor, prototype); - } - - /** - * If the pressed figure is a TextHolder it can be edited otherwise - * a new text figure is created. - */ - public void mouseDown(MouseEvent e, int x, int y) - { - setView((DrawingView)e.getSource()); - - if (getTypingTarget() != null) { - editor().toolDone(); - return; - } - - TextHolder textHolder = null; - Figure pressedFigure = drawing().findFigureInside(x, y); - if (pressedFigure != null) { - textHolder = pressedFigure.getTextHolder(); - setSelectedFigure(pressedFigure); - } - - if ((textHolder != null) && textHolder.acceptsTyping()) { - // do not create a new TextFigure but edit existing one - beginEdit(textHolder); - } - else { - super.mouseDown(e, x, y); - // update view so the created figure is drawn before the floating text - // figure is overlaid. (Note, fDamage should be null in StandardDrawingView - // when the overlay figure is drawn because a JTextField cannot be scrolled) - view().checkDamage(); - beginEdit(getCreatedFigure().getTextHolder()); - } - } - - public void mouseDrag(MouseEvent e, int x, int y) { - } - - public void mouseUp(MouseEvent e, int x, int y) { - if (!isActive()) { - editor().toolDone(); - } - } - - /** - * Terminates the editing of a text figure. - */ - public void deactivate() { - endEdit(); - super.deactivate(); - } - - /** - * Sets the text cursor. - */ - public void activate() { - super.activate(); - // JDK1.1 TEXT_CURSOR has an incorrect hot spot - //view().setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); - } - - /** - * Test whether the text tool is currently activated and is displaying - * a overlay TextFigure for accepting input. - * - * @return true, if the text tool has a accepting target TextFigure for its input, false otherwise - */ - public boolean isActive() { - return (getTypingTarget() != null); - } - - protected void beginEdit(TextHolder figure) { - if (getFloatingTextField() == null) { - setFloatingTextField(createFloatingTextField()); - } - - if (figure != getTypingTarget() && getTypingTarget() != null) { - endEdit(); - } - - getFloatingTextField().createOverlay((Container)view(), figure.getFont()); - getFloatingTextField().setBounds(fieldBounds(figure), figure.getText()); - - setTypingTarget(figure); - } - - protected void endEdit() { - if (getTypingTarget() != null) { - if (getAddedFigure() != null) { - if (!isDeleteTextFigure()) { - // figure has been created and not immediately deleted - setUndoActivity(createPasteUndoActivity()); - getUndoActivity().setAffectedFigures( - new SingleFigureEnumerator(getAddedFigure()) - ); - getTypingTarget().setText(getFloatingTextField().getText()); - } - } - else if (isDeleteTextFigure()) { - // delete action - setUndoActivity(createDeleteUndoActivity()); - getUndoActivity().setAffectedFigures( - new SingleFigureEnumerator(getSelectedFigure()) - ); - // perform delete operation of DeleteCommand.UndoActivity - getUndoActivity().redo(); - } - else { - // put affected figure into a figure enumeration - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures( - new SingleFigureEnumerator(getTypingTarget().getRepresentingFigure())); - getTypingTarget().setText(getFloatingTextField().getText()); - ((TextTool.UndoActivity)getUndoActivity()).setBackupText(getTypingTarget().getText()); - } - - setTypingTarget(null); - getFloatingTextField().endOverlay(); - } - else { - setUndoActivity(null); - } - setAddedFigure(null); - setCreatedFigure(null); - setSelectedFigure(null); - } - - protected boolean isDeleteTextFigure() { - return getFloatingTextField().getText().length() == 0; - } - - private Rectangle fieldBounds(TextHolder figure) { - Rectangle box = figure.textDisplayBox(); - int nChars = figure.overlayColumns(); - Dimension d = getFloatingTextField().getPreferredSize(nChars); - return new Rectangle(box.x, box.y, d.width, d.height); - } - - protected void setTypingTarget(TextHolder newTypingTarget) { - myTypingTarget = newTypingTarget; - } - - protected TextHolder getTypingTarget() { - return myTypingTarget; - } - - private void setSelectedFigure(Figure newSelectedFigure) { - mySelectedFigure = newSelectedFigure; - } - - protected Figure getSelectedFigure() { - return mySelectedFigure; - } - - private FloatingTextField createFloatingTextField() { - return new FloatingTextField(); - } - - private void setFloatingTextField(FloatingTextField newFloatingTextField) { - myTextField = newFloatingTextField; - } - - protected FloatingTextField getFloatingTextField() { - return myTextField; - } - - protected Undoable createDeleteUndoActivity() { - FigureTransferCommand cmd = new DeleteCommand("Delete", editor()); - return new DeleteCommand.UndoActivity(cmd); - } - - protected Undoable createPasteUndoActivity() { - return new PasteCommand.UndoActivity(view()); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new TextTool.UndoActivity(view(), getTypingTarget().getText()); - } - - public static class UndoActivity extends UndoableAdapter { - private String myOriginalText; - private String myBackupText; - - public UndoActivity(DrawingView newDrawingView, String newOriginalText) { - super(newDrawingView); - setOriginalText(newOriginalText); - setUndoable(true); - setRedoable(true); - } - - /* - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo() { - if (!super.undo()) { - return false; - } - - getDrawingView().clearSelection(); - setText(getOriginalText()); - - return true; - } - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo() { - if (!super.redo()) { - return false; - } - - getDrawingView().clearSelection(); - setText(getBackupText()); - - return true; - } - - protected boolean isValidText(String toBeChecked) { - return ((toBeChecked != null) && (toBeChecked.length() > 0)); - } - - protected void setText(String newText) { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - if (currentFigure.getTextHolder() != null) { - currentFigure.getTextHolder().setText(newText); - } - } - } - - public void setBackupText(String newBackupText) { - myBackupText = newBackupText; - } - - public String getBackupText() { - return myBackupText; - } - - public void setOriginalText(String newOriginalText) { - myOriginalText = newOriginalText; - } - - public String getOriginalText() { - return myOriginalText; - } - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/figures/UngroupCommand.java b/JHotDraw/src/CH/ifa/draw/figures/UngroupCommand.java deleted file mode 100644 index d204a0d044b17d0004f7341974388cb627e484c4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/figures/UngroupCommand.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * @(#)UngroupCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.figures; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; - -/** - * Command to ungroup the selected figures. - * - * @see GroupCommand - * - * @version <$CURRENT_VERSION$> - */ -public class UngroupCommand extends AbstractCommand { - - /** - * Constructs a group command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public UngroupCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - // selection of group figures - getUndoActivity().setAffectedFigures(view().selection()); - view().clearSelection(); - - ((UngroupCommand.UndoActivity)getUndoActivity()).ungroupFigures(); - view().checkDamage(); - } - - public boolean isExecutableWithView() { - FigureEnumeration fe = view().selection(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - currentFigure = currentFigure.getDecoratedFigure(); - - if (!(currentFigure instanceof GroupFigure)) { - return false; - } - } - - return view().selectionCount() > 0; - - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new UngroupCommand.UndoActivity(view()); - } - - public static class UndoActivity extends UndoableAdapter { - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - getDrawingView().clearSelection(); - - FigureEnumeration groupFigures = getAffectedFigures(); - while (groupFigures.hasNextFigure()) { - Figure groupFigure = groupFigures.nextFigure(); - // orphan individual figures from the group - getDrawingView().drawing().orphanAll(groupFigure.figures()); - - Figure figure = getDrawingView().drawing().add(groupFigure); - getDrawingView().addToSelection(figure); - } - - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - getDrawingView().drawing().orphanAll(getAffectedFigures()); - getDrawingView().clearSelection(); - ungroupFigures(); - return true; - } - return false; - } - - protected void ungroupFigures() { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure selected = fe.nextFigure(); - Figure group = getDrawingView().drawing().orphan(selected); - - getDrawingView().drawing().addAll(group.figures()); - getDrawingView().addToSelectionAll(group.figures()); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/framework.jdo b/JHotDraw/src/CH/ifa/draw/framework.jdo deleted file mode 100644 index 78221389f2ae43221345c5af0c196aa57810e11e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework.jdo +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jdo SYSTEM "jdo.dtd"> -<jdo> - <package name="CH.ifa.draw.framework"> - <class name="Figure"> - </class> - <class name="FigureChangeListener"> - <extension vendor-name="FastObjects" key="implementation" value="java.lang.Object"/> - </class> - </package> -</jdo> diff --git a/JHotDraw/src/CH/ifa/draw/framework/ConnectionFigure.java b/JHotDraw/src/CH/ifa/draw/framework/ConnectionFigure.java deleted file mode 100644 index d85d8c5aa1991e92efc2a29976ad481807ee07cc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/ConnectionFigure.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * @(#)ConnectionFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.Point; - -/** - * Figures to connect Connectors provided by Figures. - * A ConnectionFigure knows its start and end Connector. - * It uses the Connectors to locate its connection points.<p> - * A ConnectionFigure can have multiple segments. It provides - * operations to split and join segments. - * - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld034.htm>Strategy</a></b><br> - * Strategy is used encapsulate the algorithm to locate the connection point. - * ConnectionFigure is the Strategy context and Connector is the Strategy.<br> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld026.htm>Observer</a></b><br> - * Observer is used to track changes of the connected figures. A connection - * figure registers itself as listeners or observers of the source and - * target connector. - * <hr> - * - * @see Connector - * - * @version <$CURRENT_VERSION$> - */ - -public interface ConnectionFigure extends Figure, FigureChangeListener { - - /** - * Sets the start Connector of the connection. - * @param start the start connector of the connection - */ - public void connectStart(Connector start); - - /** - * Sets the end Connector of the connection. - * @param end the end connector of the connection - */ - public void connectEnd(Connector end); - - /** - * Updates the connection - */ - public void updateConnection(); - - /** - * Disconnects the start figure from the dependent figure - */ - public void disconnectStart(); - - /** - * Disconnects the end figure from the dependent figure - */ - public void disconnectEnd(); - - /** - * Gets the start Connector - */ - public Connector getStartConnector(); - - /** - * Gets the end Connector. - */ - public Connector getEndConnector(); - - /** - * Checks if two figures can be connected. Implement this method - * to constrain the allowed connections between figures. - */ - public boolean canConnect(Figure start, Figure end); - - /** - * Checks if the ConnectionFigure connects the same figures. - */ - public boolean connectsSame(ConnectionFigure other); - - /** - * Sets the start point. - */ - public void startPoint(int x, int y); - - /** - * Sets the end point. - */ - public void endPoint(int x, int y); - - /** - * Gets the start point. - */ - public Point startPoint(); - - /** - * Gets the end point. - */ - public Point endPoint(); - - /** - * Sets the position of the point at the given position - */ - public void setPointAt(Point p, int index); - - /** - * Gets the Point at the given position - */ - public Point pointAt(int index); - - /** - * Gets the number of points or nodes of the connection - */ - public int pointCount(); - - /** - * Splits the hit segment. - * @param x the x position where the figure should be split - * @param y the y position where the figure should be split - * @return the index of the splitting point - */ - public int splitSegment(int x, int y); - - - /** - * Joins the hit segments. - * @param x the position where the figure should be joined. - * @param y the position where the figure should be joined. - * @return whether the segment was joined - */ - public boolean joinSegments(int x, int y); - - /** - * Gets the start figure of the connection. - */ - public Figure startFigure(); - - /** - * Gets the end figure of the connection. - */ - public Figure endFigure(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Connector.java b/JHotDraw/src/CH/ifa/draw/framework/Connector.java deleted file mode 100644 index 4c16b18fb8dc8ac235c46a09328f796f56de2734..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Connector.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * @(#)Connector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.*; -import java.io.Serializable; - -import CH.ifa.draw.util.*; - -/** - * Connectors know how to locate a connection point on a figure. - * A Connector knows its owning figure and can determine either - * the start or the endpoint of a given connection figure. A connector - * has a display box that describes the area of a figure it is - * responsible for. A connector can be visible but it doesn't have - * to be.<br> - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld004.htm>Strategy</a></b><br> - * Connector implements the strategy to determine the connections points.<br> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld016.htm>Factory Method</a></b><br> - * Connectors are created by the Figure's factory method connectorAt. - * <hr> - * - * @see Figure#connectorAt - * @see ConnectionFigure - * - * @version <$CURRENT_VERSION$> - */ -public interface Connector extends Serializable, Storable { - - /** - * Finds the start point for the connection. - */ - public abstract Point findStart(ConnectionFigure connection); - - /** - * Finds the end point for the connection. - */ - public abstract Point findEnd(ConnectionFigure connection); - - /** - * Gets the connector's owner. - */ - public abstract Figure owner(); - - /** - * Gets the display box of the connector. - */ - public abstract Rectangle displayBox(); - - /** - * Tests if a point is contained in the connector. - */ - public abstract boolean containsPoint(int x, int y); - - /** - * Draws this connector. Connectors don't have to be visible - * and it is OK leave this method empty. - */ - public abstract void draw(Graphics g); - - /** - * Requests that the connector should show itself or hide itself. The - * ConnectionFigure which desires to connect to this Connector is passed in. - * If a connector should show itself it should do so when draw is called, if - * so desired. - */ - public void connectorVisibility(boolean isVisible, ConnectionFigure courtingConnection); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Cursor.java b/JHotDraw/src/CH/ifa/draw/framework/Cursor.java deleted file mode 100644 index 38500e16f6777ef402e21a496aa8f32a6af89e5d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Cursor.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * @(#)Cursor.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * This interface has the purpose to reduce the dependency of JHotDraw on AWT - * classes and interfaces. - * See {@link CH.ifa.draw.standard.AWTCursor} for an example of implementation - * for this interface. - * - * <p>Created on: 08/05/2003.</p> - * - * @version $Revision$ - * @author <a href="mailto:ricardo_padilha@users.sourceforge.net">Ricardo - * Sangoi Padilha</a> - * @see CH.ifa.draw.standard.AWTCursor - */ -public interface Cursor { - -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Drawing.java b/JHotDraw/src/CH/ifa/draw/framework/Drawing.java deleted file mode 100644 index 97994fdc41e053caac968cb50c0aeb1bc3700be3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Drawing.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * @(#)Drawing.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import CH.ifa.draw.util.*; -import java.awt.*; -import java.util.*; -import java.util.List; -import java.io.Serializable; - -/** - * Drawing is a container for figures. - * <p> - * Drawing sends out DrawingChanged events to DrawingChangeListeners - * whenever a part of its area was invalidated. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld026.htm>Observer</a></b><br> - * The Observer pattern is used to decouple the Drawing from its views and - * to enable multiple views.<hr> - * - * @see Figure - * @see DrawingView - * @see FigureChangeListener - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ - -public interface Drawing - extends Storable, FigureChangeListener, Serializable { - - /** - * Releases the drawing and its contained figures. - */ - public void release(); - - /** - * Returns an enumeration to iterate in - * Z-order back to front over the figures. - */ - public FigureEnumeration figures(); - - /** - * Returns an enumeration to iterate in - * Z-order back to front over the figures - * that lie within the absolute bounds. - */ - public FigureEnumeration figures(Rectangle viewRectangle); - - /** - * Returns an enumeration to iterate in - * Z-order front to back over the figures. - */ - public FigureEnumeration figuresReverse(); - - /** - * Finds a top level Figure. Use this call for hit detection that - * should not descend into the figure's children. - */ - public Figure findFigure(int x, int y); - - /** - * Finds a top level Figure that intersects the given rectangle. - */ - public Figure findFigure(Rectangle r); - - /** - * Finds a top level Figure, but supresses the passed - * in figure. Use this method to ignore a figure - * that is temporarily inserted into the drawing. - * @param x the x coordinate - * @param y the y coordinate - * @param without the figure to be ignored during - * the find. - */ - public Figure findFigureWithout(int x, int y, Figure without); - - /** - * Finds a top level Figure that intersects the given rectangle. - * It supresses the passed - * in figure. Use this method to ignore a figure - * that is temporarily inserted into the drawing. - */ - public Figure findFigure(Rectangle r, Figure without); - - /** - * Finds a figure but descends into a figure's - * children. Use this method to implement <i>click-through</i> - * hit detection, that is, you want to detect the inner most - * figure containing the given point. - */ - public Figure findFigureInside(int x, int y); - - /** - * Finds a figure but descends into a figure's - * children. It supresses the passed - * in figure. Use this method to ignore a figure - * that is temporarily inserted into the drawing. - * @param x the x coordinate - * @param y the y coordinate - * @param without the figure to be ignored during - * the find. - */ - public Figure findFigureInsideWithout(int x, int y, Figure without); - - /** - * Checks if the composite figure has the argument as one of - * its children. - * - * @param figure figure to be searched in all descendants - * @return true if the figure is part of this Drawing, else otherwise - */ - public boolean includes(Figure figure); - - /** - * Check whether a given figure is a (direct) child figure of this CompositeFigure. - * - * @param figure figure to be searched in all direct descendents - * @return true if the figure is a direct child of this Drawing, else otherwise - */ - public boolean containsFigure(Figure figure); - - /** - * Adds a listener for this drawing. - */ - public void addDrawingChangeListener(DrawingChangeListener listener); - - /** - * Removes a listener from this drawing. - */ - public void removeDrawingChangeListener(DrawingChangeListener listener); - - /** - * Gets the listeners of a drawing. - * - * @return new iterator of all registered change listener - */ - public Iterator drawingChangeListeners(); - - /** - * Adds a figure and sets its container to refer to this drawing. - * - * @param figure to be added to the drawing - * @return the figure that was inserted (might be different from the figure specified). - */ - public Figure add(Figure figure); - - /** - * Adds a list of figures. - * - * @deprecated use addAll(FigureEnumeration) instead - */ - public void addAll(List newFigures); - - /** - * Adds a FigureEnumeration of figures. - * - * @param fe (unused) enumeration containing all figures to be added - * @see #add - */ - public void addAll(FigureEnumeration fe); - - /** - * Removes the figure from the drawing and releases it. - * - * @param figure that is part of the drawing and should be removed - * @return the figure that has been removed (might be different from the figure specified) - */ - public Figure remove(Figure figure); - - /** - * Removes a figure from the figure list, but - * doesn't release it. Use this method to temporarily - * manipulate a figure outside of the drawing. - * - * @param figure that is part of the drawing and should be added - */ - public Figure orphan(Figure figure); - - /** - * Removes a list of figures from the figure's list - * without releasing the figures. - * - * @see #orphan - * @deprecated use orphanAll(FigureEnumeration) instead - */ - public void orphanAll(List orphanFigures); - - /** - * Removes a FigureEnumeration of figures from the figure's list - * without releasing the figures. - * @see #orphan - */ - public void orphanAll(FigureEnumeration fe); - - /** - * Removes a list of figures . - * - * @see #remove - * @deprecated use removeAll(FigureEnumeration) instead - */ - public void removeAll(List figures); - - /** - * Removes a FigureEnumeration of figures. - * @see #remove - */ - public void removeAll(FigureEnumeration fe); - - /** - * Replaces a figure in the drawing without removing it from the drawing. - * The figure to be replaced must be part of the drawing. - * - * @param figure figure to be replaced - * @param replacement figure that should replace the specified figure - * @return the figure that has been inserted (might be different from the figure specified) - */ - public Figure replace(Figure figure, Figure replacement); - - /** - * Sends a figure to the back of the drawing. - * - * @param figure that is part of the drawing - */ - public void sendToBack(Figure figure); - - /** - * Brings a figure to the front. - * - * @param figure that is part of the drawing - */ - public void bringToFront(Figure figure); - - /** - * Sends a figure to a certain layer within a drawing. Each figure - * lays in a unique layer and the layering order decides which - * figure is drawn on top of another figure. Figures with a higher - * layer number have usually been added later and may overlay - * figures in lower layers. Layers are counted from to (the number - * of figures - 1). - * The figure is removed from its current layer (if it has been already - * part of this drawing) and is transferred to the specified layers after - * all figures between the original layer and the new layer are shifted to - * one layer below to fill the layer sequence. It is not possible to skip a - * layer number and if the figure is sent to a layer beyond the latest layer - * it will be added as the last figure to the drawing and its layer number - * will be set to the be the one beyond the latest layer so far. - * - * @param figure figure to be sent to a certain layer - * @param layerNr target layer of the figure - */ - public void sendToLayer(Figure figure, int layerNr); - - /** - * Gets the layer for a certain figure (first occurrence). The number - * returned is the number of the layer in which the figure is placed. - * - * @param figure figure to be queried for its layering place - * @return number of the layer in which the figure is placed and -1 if the - * figure could not be found. - * @see #sendToLayer - */ - public int getLayer(Figure figure); - - /** - * Gets the figure from a certain layer. - * - * @param layerNr number of the layer which figure should be returned - * @return figure from the layer specified, null, if the layer nr was outside - * the number of possible layer (0...(number of figures - 1)) - * @see #sendToLayer - */ - public Figure getFigureFromLayer(int layerNr); - - /** - * Draws all the figures back to front. - */ - public void draw(Graphics g); - - /** - * Draws only the given figures. - */ - public void draw(Graphics g, FigureEnumeration fe); - - /** - * Acquires the drawing lock. - */ - public void lock(); - - /** - * Releases the drawing lock. - */ - public void unlock(); - - /** - * Used to optimize rendering. Rendering of many objects may - * be slow until this method is called. The view rectangle - * should at least approximately enclose the CompositeFigure. - * If the view rectangle is too small or too large, performance - * may suffer. - */ - public void init(Rectangle viewRectangle); - - public String getTitle(); - public void setTitle(String name); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/DrawingChangeEvent.java b/JHotDraw/src/CH/ifa/draw/framework/DrawingChangeEvent.java deleted file mode 100644 index d9a68d02080c2dcaf61306ab94c64f3b0df5b9f0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/DrawingChangeEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#)DrawingChangeEvent.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.Rectangle; -import java.util.EventObject; - -/** - * The event passed to DrawingChangeListeners. - * - * @version <$CURRENT_VERSION$> - */ -public class DrawingChangeEvent extends EventObject { - - private Rectangle myRectangle; - - /** - * Constructs a drawing change event. - */ - public DrawingChangeEvent(Drawing newSource, Rectangle newRect) { - super(newSource); - myRectangle = newRect; - } - - /** - * Gets the changed drawing - */ - public Drawing getDrawing() { - return (Drawing)getSource(); - } - - /** - * Gets the changed rectangle - */ - public Rectangle getInvalidatedRectangle() { - return myRectangle; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/DrawingChangeListener.java b/JHotDraw/src/CH/ifa/draw/framework/DrawingChangeListener.java deleted file mode 100644 index cb7facea1507c3e6fec43f10676e9f5a9c4888cb..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/DrawingChangeListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * @(#)DrawingChangeListener.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * Listener interested in Drawing changes. - * - * @version <$CURRENT_VERSION$> - */ -public interface DrawingChangeListener { - - /** - * Sent when an area is invalid - */ - public void drawingInvalidated(DrawingChangeEvent e); - - /** - * Sent when the drawing Title has changed - */ - public void drawingTitleChanged(DrawingChangeEvent e); - /** - * Sent when the drawing wants to be refreshed - */ - public void drawingRequestUpdate(DrawingChangeEvent e); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/DrawingEditor.java b/JHotDraw/src/CH/ifa/draw/framework/DrawingEditor.java deleted file mode 100644 index 4e08605daebe9959050d97e206ffd540547b06d3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/DrawingEditor.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * @(#)DrawingEditor.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import CH.ifa.draw.util.UndoManager; - -/** - * DrawingEditor defines the interface for coordinating - * the different objects that participate in a drawing editor. - * - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld022.htm>Mediator</a></b><br> - * DrawingEditor is the mediator. It decouples the participants - * of a drawing editor. - * - * @see Tool - * @see DrawingView - * @see Drawing - * - * @version <$CURRENT_VERSION$> - */ -public interface DrawingEditor extends FigureSelectionListener { - - /** - * Gets the editor's drawing view. - */ - public DrawingView view(); - - public DrawingView[] views(); - /** - * Gets the editor's drawing. - */ -// public Drawing drawing(); - - /** - * Gets the editor's current tool. - */ - public Tool tool(); - - /** - * Informs the editor that a tool has done its interaction. - * This method can be used to switch back to the default tool. - */ - public void toolDone(); - - /** - * Informs that the current figure selection has changed. - * Override this method to handle selection changes. - */ - public void figureSelectionChanged(DrawingView view); - - public void addViewChangeListener(ViewChangeListener vsl); - public void removeViewChangeListener(ViewChangeListener vsl); - - /** - * Shows a status message in the editor's user interface - */ - public void showStatus(String string); - - public UndoManager getUndoManager(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/DrawingView.java b/JHotDraw/src/CH/ifa/draw/framework/DrawingView.java deleted file mode 100644 index 107c0cace196e7b647c546d37171b65131a77f9d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/DrawingView.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * @(#)DrawingView.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.*; -import java.awt.image.ImageObserver; -import java.util.Collection; - -/** - * DrawingView renders a Drawing and listens to its changes. - * It receives user input and delegates it to the current tool. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld026.htm>Observer</a></b><br> - * DrawingView observes drawing for changes via the DrawingListener interface.<br> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld032.htm>State</a></b><br> - * DrawingView plays the role of the StateContext in - * the State pattern. Tool is the State.<br> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld034.htm>Strategy</a></b><br> - * DrawingView is the StrategyContext in the Strategy pattern - * with regard to the UpdateStrategy. <br> - * DrawingView is the StrategyContext for the PointConstrainer. - * - * @see Drawing - * @see Painter - * @see Tool - * - * @version <$CURRENT_VERSION$> - */ -public interface DrawingView extends ImageObserver, DrawingChangeListener { - - /** - * Sets the view's editor. - */ - public void setEditor(DrawingEditor editor); - - /** - * Gets the current tool. - */ - public Tool tool(); - - /** - * Gets the drawing. - */ - public Drawing drawing(); - - /** - * Sets and installs another drawing in the view. - */ - public void setDrawing(Drawing d); - - /** - * Gets the editor. - */ - public DrawingEditor editor(); - - /** - * Adds a figure to the drawing. - * @return the added figure. - */ - public Figure add(Figure figure); - - /** - * Removes a figure from the drawing. - * @return the removed figure - */ - public Figure remove(Figure figure); - - /** - * Adds a collections of figures to the drawing. - */ - public void addAll(Collection figures); - - /** - * Gets the size of the drawing. - */ - public Dimension getSize(); - - /** - * Gets the minimum dimension of the drawing. - */ - public Dimension getMinimumSize(); - - /** - * Gets the preferred dimension of the drawing.. - */ - public Dimension getPreferredSize(); - - /** - * Sets the current display update strategy. - * @see Painter - */ - public void setDisplayUpdate(Painter updateStrategy); - - /** - * Gets the current display update strategy. - * @see Painter - */ - public Painter getDisplayUpdate(); - - /** - * Gets an enumeration over the currently selected figures. - * The selection is a snapshot of the current selection - * which does not get changed anymore - * - * @return an enumeration with the currently selected figures. - */ - public FigureEnumeration selection(); - - /** - * Gets the currently seleced figures in Z order. - * The selection is a snapshot of the current selection - * which does not get changed anymore - * - * @see #selection - * @return an enumeration with the currently selected figures. - */ - public FigureEnumeration selectionZOrdered(); - - /** - * Gets the number of selected figures. - */ - public int selectionCount(); - - /** - * Test whether a given figure is selected. - */ - public boolean isFigureSelected(Figure checkFigure); - - /** - * Adds a figure to the current selection. - */ - public void addToSelection(Figure figure); - - /** - * Adds a collections of figures to the current selection. - */ - public void addToSelectionAll(Collection figures); - - /** - * Adds a FigureEnumeration to the current selection. - */ - public void addToSelectionAll(FigureEnumeration fe); - - /** - * Removes a figure from the selection. - */ - public void removeFromSelection(Figure figure); - - /** - * If a figure isn't selected it is added to the selection. - * Otherwise it is removed from the selection. - */ - public void toggleSelection(Figure figure); - - /** - * Clears the current selection. - */ - public void clearSelection(); - - /** - * Gets the current selection as a FigureSelection. A FigureSelection - * can be cut, copied, pasted. - */ - public FigureSelection getFigureSelection(); - - /** - * Finds a handle at the given coordinates. - * @return the hit handle, null if no handle is found. - */ - public Handle findHandle(int x, int y); - - /** - * Gets the position of the last click inside the view. - */ - public Point lastClick(); - - /** - * Sets the current point constrainer. - */ - public void setConstrainer(PointConstrainer p); - - /** - * Gets the current grid setting. - */ - public PointConstrainer getConstrainer(); - - /** - * Checks whether the drawing has some accumulated damage - */ - public void checkDamage(); - - /** - * Repair the damaged area - */ - public void repairDamage(); - - /** - * Paints the drawing view. The actual drawing is delegated to - * the current update strategy. - * @see Painter - */ - public void paint(Graphics g); - - /** - * Creates an image with the given dimensions - */ - public Image createImage(int width, int height); - - /** - * Gets a graphic to draw into - */ - public Graphics getGraphics(); - - /** - * Gets the background color of the DrawingView - */ - public Color getBackground(); - - /** - * Sets the background color of the DrawingView - */ - public void setBackground(Color c); - - /** - * Draws the contents of the drawing view. - * The view has three layers: background, drawing, handles. - * The layers are drawn in back to front order. - */ - public void drawAll(Graphics g); - - /** - * Draws the given figures. - * The view has three layers: background, drawing, handles. - * The layers are drawn in back to front order. - */ - public void draw(Graphics g, FigureEnumeration fe); - - /** - * Draws the currently active handles. - */ - public void drawHandles(Graphics g); - - /** - * Draws the drawing. - */ - public void drawDrawing(Graphics g); - - /** - * Draws the background. If a background pattern is set it - * is used to fill the background. Otherwise the background - * is filled in the background color. - */ - public void drawBackground(Graphics g); - - /** - * Sets the cursor of the DrawingView - */ - public void setCursor(Cursor c); - - /** - * Freezes the view by acquiring the drawing lock. - * @see Drawing#lock - */ - public void freezeView(); - - /** - * Unfreezes the view by releasing the drawing lock. - * @see Drawing#unlock - */ - public void unfreezeView(); - - /** - * Add a listener for selection changes in this DrawingView. - * @param fsl jhotdraw.framework.FigureSelectionListener - */ - public void addFigureSelectionListener(FigureSelectionListener fsl); - - /** - * Remove a listener for selection changes in this DrawingView. - * @param fsl jhotdraw.framework.FigureSelectionListener - */ - public void removeFigureSelectionListener(FigureSelectionListener fsl); - - /** - * Returns a FigureEnumeration of connection figures - */ - public FigureEnumeration getConnectionFigures(Figure inFigure); - - /** - * Inserts figures in a drawing at given offset. Optional check for connection figures - * - * @return enumeration which has been added to the drawing. The figures in the enumeration - * can have changed during adding them (e.g. they could have been decorated). - */ - public FigureEnumeration insertFigures(FigureEnumeration inFigures, int dx, int dy, boolean bCheck); - - /** - * Check whether the DrawingView is interactive, i.e. whether it accepts user input - * and whether it can display a drawing. - */ - public boolean isInteractive(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Figure.java b/JHotDraw/src/CH/ifa/draw/framework/Figure.java deleted file mode 100644 index a01a9adee7eb7e08608921336632a96617d66d19..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Figure.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * @(#)Figure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.standard.TextHolder; - -import java.awt.*; -import java.io.Serializable; - -/** - * The interface of a graphical figure. A figure knows - * its display box and can draw itself. A figure can be - * composed of several figures. To interact and manipulate - * with a figure it can provide Handles and Connectors.<p> - * A figure has a set of handles to manipulate its shape or attributes. - * A figure has one or more connectors that define how - * to locate a connection point.<p> - * Figures can have an open ended set of attributes. - * An attribute is identified by a string.<p> - * Default implementations for the Figure interface are provided - * by AbstractFigure.<p> - * - * Figures can have <a name="dependent_figure">dependent figure</a>s. The existence od dependent - * figures depend on another figure. This is the case for figures - * such as ConnectedTextFigures and LineDecoration. Thus, they are - * "externally" dependent on a figure in contrast to (internally) - * contained figures. This means, "normal" figures (figures that - * are not containers) can still have dependent figures. Dependent - * figures are especially important if the figure which the depend - * on is deleted because they should be removed as well (cascading delete). - * - * @see Handle - * @see Connector - * @see CH.ifa.draw.standard.AbstractFigure - * - * @version <$CURRENT_VERSION$> - */ -public interface Figure - extends Storable, Cloneable, Serializable { - - /** - * Constant that allows to identify a popup menu assigned - * as an attribute. - */ - public static String POPUP_MENU = "POPUP_MENU"; - - /** - * Moves the Figure to a new location. - * @param dx the x delta - * @param dy the y delta - */ - public void moveBy(int dx, int dy); - - /** - * Changes the display box of a figure. This method is - * always implemented in figure subclasses. It only changes - * the displaybox and does not announce any changes. It - * is usually not called by the client. Clients typically call - * displayBox to change the display box. - * @param origin the new origin - * @param corner the new corner - * @see #displayBox - */ - public void basicDisplayBox(Point origin, Point corner); - - /** - * Changes the display box of a figure. Clients usually - * invoke this method. It changes the display box - * and announces the corresponding changes. - * @param origin the new origin - * @param corner the new corner - * @see #displayBox - */ - public void displayBox(Point origin, Point corner); - - /** - * Gets the display box of a figure - * @see #basicDisplayBox - */ - public Rectangle displayBox(); - - /** - * Draws the figure. - * @param g the Graphics to draw into - */ - public void draw(Graphics g); - - /** - * Returns the handles used to manipulate - * the figure. Handles is a Factory Method for - * creating handle objects. - * - * @return an type-safe iterator of handles - * @see Handle - */ - public HandleEnumeration handles(); - - /** - * Gets the size of the figure - */ - public Dimension size(); - - /** - * Gets the figure's center - */ - public Point center(); - - /** - * Checks if the Figure should be considered as empty. - */ - public boolean isEmpty(); - - /** - * Returns an Enumeration of the figures contained in this figure - */ - public FigureEnumeration figures(); - - /** - * Returns the figure that contains the given point. - */ - public Figure findFigureInside(int x, int y); - - /** - * Checks if a point is inside the figure. - */ - public boolean containsPoint(int x, int y); - - /** - * Returns a Clone of this figure - */ - public Object clone(); - - /** - * Changes the display box of a figure. This is a - * convenience method. Implementors should only - * have to override basicDisplayBox - * @see #displayBox - */ - public void displayBox(Rectangle r); - - /** - * Checks whether the given figure is contained in this figure. - */ - public boolean includes(Figure figure); - - /** - * Decomposes a figure into its parts. A figure is considered - * as a part of itself. - */ - public FigureEnumeration decompose(); - - /** - * Sets the Figure's container and registers the container - * as a figure change listener. A figure's container can be - * any kind of FigureChangeListener. A figure is not restricted - * to have a single container. - */ - public void addToContainer(FigureChangeListener c); - - /** - * Removes a figure from the given container and unregisters - * it as a change listener. - */ - public void removeFromContainer(FigureChangeListener c); - - /** - * Add a <a href="#dependent_figure">dependent figure</a>. - */ - public void addDependendFigure(Figure newDependendFigure); - - /** - * Remove a <a href="#dependent_figure">dependent figure</a>. - */ - public void removeDependendFigure(Figure oldDependendFigure); - - /** - * Get an enumeration of all <a href="#dependent_figure">dependent figures</a>. - */ - public FigureEnumeration getDependendFigures(); - - /** - * Gets the Figure's listeners. - */ - public FigureChangeListener listener(); - - /** - * Adds a listener for this figure. - */ - public void addFigureChangeListener(FigureChangeListener l); - - /** - * Removes a listener for this figure. - */ - public void removeFigureChangeListener(FigureChangeListener l); - - /** - * Releases a figure's resources. Release is called when - * a figure is removed from a drawing. Informs the listeners that - * the figure is removed by calling figureRemoved. - */ - public void release(); - - /** - * Invalidates the figure. This method informs its listeners - * that its current display box is invalid and should be - * refreshed. - */ - public void invalidate(); - - /** - * Informes that a figure is about to change such that its - * display box is affected. - * Here is an example of how it is used together with changed() - * <pre> - * public void move(int x, int y) { - * willChange(); - * // change the figure's location - * changed(); - * } - * </pre> - * @see #invalidate - * @see #changed - */ - public void willChange(); - - /** - * Informes that a figure has changed its display box. - * This method also triggers an update call for its - * registered observers. - * @see #invalidate - * @see #willChange - * - */ - public void changed(); - - /** - * Checks if this figure can be connected - */ - public boolean canConnect(); - - /** - * Gets a connector for this figure at the given location. - * A figure can have different connectors at different locations. - */ - public Connector connectorAt(int x, int y); - - /** - * Sets whether the connectors should be visible. - * Connectors can be optionally visible. Implement - * this method and react on isVisible to turn the - * connectors on or off. - */ - public void connectorVisibility(boolean isVisible, ConnectionFigure connection); - - /** - * Returns the connection inset. This is only a hint that - * connectors can use to determine the connection location. - * The inset defines the area where the display box of a - * figure should not be connected. - * - */ - public Insets connectionInsets(); - - /** - * Returns the locator used to located connected text. - */ - public Locator connectedTextLocator(Figure text); - - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * All figures support the attribute names - * FillColor and FrameColor - * - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name); - - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * All figures support the attribute names - * FillColor and FrameColor - */ - public Object getAttribute(FigureAttributeConstant attributeConstant); - - /** - * Sets the named attribute to the new value - * - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value); - - /** - * Sets the named attribute to the new value - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value); - - /** - * Gets the z value (back-to-front ordering) of this figure. - * Z values are not guaranteed to not skip numbers. - */ - public int getZValue(); - - /** - * Sets the z value (back-to-front ordering) of this figure. - * Z values are not guaranteed to not skip numbers. - */ - public void setZValue(int z); - - public void visit(FigureVisitor visitor); - - /** - * Some figures have the ability to hold text. This method returns - * the adjunctant TextHolder. - * @return - */ - public TextHolder getTextHolder(); - - /** - * Get the underlying figure in case the figure has been decorated. - * If the figure has not been decorated the figure itself is returned. - * The DecoratorFigure does not release the the decorated figure but - * just returns it (in contrast to {@link CH.ifa.draw.standard.DecoratorFigure.peelDecoration}). - * - * @return underlying, "real" without DecoratorFigure - * @see CH.ifa.draw.standard.DecoratorFigure - */ - public Figure getDecoratedFigure(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureAttributeConstant.java b/JHotDraw/src/CH/ifa/draw/framework/FigureAttributeConstant.java deleted file mode 100644 index e9187866b23318e319ad9578b9e47f0f5fee0ef5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureAttributeConstant.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * @(#)FigureAttributeConstant.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.io.Serializable; - -/** - * A FigureAttribute is a constant for accessing a special figure attribute. It - * does not contain a value but just defines a unique attribute ID. Therefore, - * they provide a type-safe way of defining attribute constants. - * (SourceForge feature request ID: <>) - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class FigureAttributeConstant implements Serializable, Cloneable { - - public static final String FRAME_COLOR_STR = "FrameColor"; - public static final FigureAttributeConstant FRAME_COLOR = new FigureAttributeConstant(FRAME_COLOR_STR, 1); - - public static final String FILL_COLOR_STR = "FillColor"; - public static final FigureAttributeConstant FILL_COLOR = new FigureAttributeConstant(FILL_COLOR_STR, 2); - - public static final String TEXT_COLOR_STR = "TextColor"; - public static final FigureAttributeConstant TEXT_COLOR = new FigureAttributeConstant(TEXT_COLOR_STR, 3); - - public static final String ARROW_MODE_STR = "ArrowMode"; - public static final FigureAttributeConstant ARROW_MODE = new FigureAttributeConstant(ARROW_MODE_STR, 4); - - public static final String FONT_NAME_STR = "FontName"; - public static final FigureAttributeConstant FONT_NAME = new FigureAttributeConstant(FONT_NAME_STR, 5); - - public static final String FONT_SIZE_STR = "FontSize"; - public static final FigureAttributeConstant FONT_SIZE = new FigureAttributeConstant(FONT_SIZE_STR, 6); - - public static final String FONT_STYLE_STR = "FontStyle"; - public static final FigureAttributeConstant FONT_STYLE = new FigureAttributeConstant(FONT_STYLE_STR, 7); - - public static final String URL_STR = "URL"; - public static final FigureAttributeConstant URL = new FigureAttributeConstant(URL_STR, 8); - - public static final String LOCATION_STR = "Location"; - public static final FigureAttributeConstant LOCATION = new FigureAttributeConstant(LOCATION_STR, 9); - - public static final String XALIGNMENT_STR = "XAlignment"; - public static final FigureAttributeConstant XALIGNMENT = new FigureAttributeConstant(XALIGNMENT_STR, 10); - - public static final String YALIGNMENT_STR = "YAlignment"; - public static final FigureAttributeConstant YALIGNMENT = new FigureAttributeConstant(YALIGNMENT_STR, 11); - - public static final String TOP_MARGIN_STR = "TopMargin"; - public static final FigureAttributeConstant TOP_MARGIN = new FigureAttributeConstant(TOP_MARGIN_STR, 12); - - public static final String RIGHT_MARGIN_STR = "RightMargin"; - public static final FigureAttributeConstant RIGHT_MARGIN = new FigureAttributeConstant(RIGHT_MARGIN_STR, 13); - - public static final String BOTTOM_MARGIN_STR = "BottomMargin"; - public static final FigureAttributeConstant BOTTOM_MARGIN = new FigureAttributeConstant(BOTTOM_MARGIN_STR, 14); - - public static final String LEFT_MARGIN_STR = "LeftMargin"; - public static final FigureAttributeConstant LEFT_MARGIN = new FigureAttributeConstant(LEFT_MARGIN_STR, 15); - - public static final String POPUP_MENU_STR = "PopupMenu"; - public static final FigureAttributeConstant POPUP_MENU = new FigureAttributeConstant(POPUP_MENU_STR, 16); - - private static FigureAttributeConstant[] attributeConstants; - - private int myID; - private String myName; - - private FigureAttributeConstant(String newName, int newID) { - setName(newName); - setID(newID); - addConstant(this); - } - - public FigureAttributeConstant(String newName) { - this(newName, attributeConstants.length+1); - } - - private void setName(String newName) { - myName = newName; - } - - public String getName() { - return myName; - } - - private void setID(int newID) { - myID = newID; - } - - public int getID() { - return myID; - } - - public boolean equals(Object compareObject) { - if (compareObject == null) { - return false; - } - if (!(compareObject instanceof FigureAttributeConstant)) { - return false; - } - FigureAttributeConstant compareAttribute = (FigureAttributeConstant)compareObject; - - if (compareAttribute.getID() != getID()) { - return false; - } - - if ((compareAttribute.getName() == null) && (getName() == null)) { - return true; - } - if ((compareAttribute.getName() != null) && (getName() != null)) { - return getName().equals(compareAttribute.getName()); - } - - return false; - } - - public int hashCode() { - return getID(); - } - - /** - * Constants are put into the place according to their ID, thus, it is - * recommended to have subsequent attribute IDs. - */ - private static void addConstant(FigureAttributeConstant newConstant) { - int idPos = newConstant.getID() - 1; - // attribute IDs must be unique, thus no two attributes - // with the same ID can be added - if ((idPos < attributeConstants.length) && (attributeConstants[idPos] != null)) { - throw new JHotDrawRuntimeException("No unique FigureAttribute ID: " + newConstant.getID()); - } - // increase capacity if necessary - if (idPos >= attributeConstants.length) { - FigureAttributeConstant[] tempStrs = new FigureAttributeConstant[idPos + 1]; - System.arraycopy(attributeConstants, 0, tempStrs, 0, attributeConstants.length); - attributeConstants = tempStrs; - } - attributeConstants[idPos] = newConstant; - } - - /** - * @return an existing constant for a given name or create a new one - */ - public static FigureAttributeConstant getConstant(String constantName) { - for (int i = 0; i < attributeConstants.length; i++) { - FigureAttributeConstant currentAttr = getConstant(i); - if ((currentAttr != null) && (currentAttr.getName() != null) && (currentAttr.getName().equals(constantName))) { - return currentAttr; - } - } - return new FigureAttributeConstant(constantName); - } - - public static FigureAttributeConstant getConstant(int constantId) { - return attributeConstants[constantId]; - } - - { - // use static initializer to create List before any constant is created - // initialize List only for the first constant (during debugging it - // appeared that the static initializer is invoked for any constant) - if (attributeConstants == null) { - attributeConstants = new FigureAttributeConstant[64]; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureChangeEvent.java b/JHotDraw/src/CH/ifa/draw/framework/FigureChangeEvent.java deleted file mode 100644 index 63afb950d5dc818db622e10ad252a28135e3bc3b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureChangeEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * @(#)FigureChangeEvent.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.Rectangle; -import java.util.EventObject; - -/** - * FigureChange event passed to FigureChangeListeners. - * - * @version <$CURRENT_VERSION$> - */ -public class FigureChangeEvent extends EventObject { - - private Rectangle myRectangle; - private FigureChangeEvent myNestedEvent; - - private static final Rectangle EMPTY_RECTANGLE = new Rectangle(0, 0, 0, 0); - - /** - * Constructs an event for the given source Figure. The rectangle is the - * area to be invalvidated. - */ - public FigureChangeEvent(Figure newSource, Rectangle newRect) { - super(newSource); - myRectangle = newRect; - } - - public FigureChangeEvent(Figure newSource) { - super(newSource); - myRectangle = EMPTY_RECTANGLE; - } - - public FigureChangeEvent(Figure newSource, Rectangle newRect, FigureChangeEvent nestedEvent) { - this(newSource, newRect); - myNestedEvent = nestedEvent; - } - - /** - * Gets the changed figure - */ - public Figure getFigure() { - return (Figure)getSource(); - } - - /** - * Gets the changed rectangle - */ - public Rectangle getInvalidatedRectangle() { - return myRectangle; - } - - public FigureChangeEvent getNestedEvent() { - return myNestedEvent; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureChangeListener.java b/JHotDraw/src/CH/ifa/draw/framework/FigureChangeListener.java deleted file mode 100644 index a1466bf0f1e28528b81533a9ff908b059a60ff31..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureChangeListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @(#)FigureChangeListener.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.util.EventListener; - -/** - * Listener interested in Figure changes. - * - * @version <$CURRENT_VERSION$> - */ -public interface FigureChangeListener extends EventListener { - - /** - * Sent when an area is invalid - */ - public void figureInvalidated(FigureChangeEvent e); - - /** - * Sent when a figure changed - */ - public void figureChanged(FigureChangeEvent e); - - /** - * Sent when a figure was removed - */ - public void figureRemoved(FigureChangeEvent e); - - /** - * Sent when requesting to remove a figure. - */ - public void figureRequestRemove(FigureChangeEvent e); - - /** - * Sent when an update should happen. - * - */ - public void figureRequestUpdate(FigureChangeEvent e); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureEnumeration.java b/JHotDraw/src/CH/ifa/draw/framework/FigureEnumeration.java deleted file mode 100644 index dc38d53a332e99730b0f7f81145c790f3f8a3638..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureEnumeration.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @(#)FigureEnumeration.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * Interface for Enumerations that access Figures. - * It provides a method nextFigure, that hides the down casting - * from client code. - * - * @version <$CURRENT_VERSION$> - */ -public interface FigureEnumeration { - /** - * Returns the next element of the enumeration. Calls to this - * method will enumerate successive elements. - * @exception java.util.NoSuchElementException If no more elements exist. - */ - public Figure nextFigure(); - public boolean hasNextFigure(); - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureSelection.java b/JHotDraw/src/CH/ifa/draw/framework/FigureSelection.java deleted file mode 100644 index dd95e3d291c28416670e31b58d4f0a32b63a91ab..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureSelection.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)FigureSelection.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * FigureSelection enables to transfer the selected figures - * to a clipboard.<p> - * Will soon be converted to the JDK 1.1 Transferable interface. - * - * @see CH.ifa.draw.util.Clipboard - * - * @version <$CURRENT_VERSION$> - */ - -public interface FigureSelection { - - /** - * Gets the type of the selection. - */ - public String getType(); - - /** - * Gets the data of the selection. The result is returned - * as a FigureEnumeration of Figures. - * - * @return a copy of the figure selection. - */ - public Object getData(String type); -} - diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureSelectionListener.java b/JHotDraw/src/CH/ifa/draw/framework/FigureSelectionListener.java deleted file mode 100644 index f4dbf7ab303490f6c23cc5092eb108d59d7115e5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureSelectionListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * @(#)FigureSelectionListener.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * Listener interested in DrawingView selection changes. - * - * @version <$CURRENT_VERSION$> - */ -public interface FigureSelectionListener { - /** - * Sent when the figure selection has changed. - * @param view DrawingView - */ - public void figureSelectionChanged(DrawingView view); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/FigureVisitor.java b/JHotDraw/src/CH/ifa/draw/framework/FigureVisitor.java deleted file mode 100644 index 9b799d4570bdba0ba6b09a947e047c20bcc127ab..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/FigureVisitor.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * @(#)FigureVisitor.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface FigureVisitor { - public void visitFigure(Figure hostFigure); - public void visitHandle(Handle hostHandle); - public void visitFigureChangeListener(FigureChangeListener hostFigureChangeListener); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Handle.java b/JHotDraw/src/CH/ifa/draw/framework/Handle.java deleted file mode 100644 index 66be2c10366d1e90f4705e58a308cdaea6d6d27a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Handle.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Handle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; - -import CH.ifa.draw.util.Undoable; - -/** - * Handles are used to change a figure by direct manipulation. - * Handles know their owning figure and they provide methods to - * locate the handle on the figure and to track changes. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld004.htm>Adapter</a></b><br> - * Handles adapt the operations to manipulate a figure to a common interface. - * - * @see Figure - * - * @version <$CURRENT_VERSION$> - */ -public interface Handle { - - public static final int HANDLESIZE = 8; - - /** - * Locates the handle on the figure. The handle is drawn - * centered around the returned point. - */ - public Point locate(); - - /** - * Tracks the start of the interaction. The default implementation - * does nothing. - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @param view the handles container - */ - public void invokeStart(int x, int y, DrawingView view); - - /** - * Tracks the start of the interaction. The default implementation - * does nothing. - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @deprecated As of version 4.1, use invokeStart(x, y, drawingView) - */ - public void invokeStart(int x, int y, Drawing drawing); - - /** - * Tracks a step of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - */ - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view); - - /** - * Tracks a step of the interaction. - * @param dx x delta of this step - * @param dy y delta of this step - * @deprecated As of version 4.1, - * use invokeStep(x, y, anchorX, anchorY, drawingView) - */ - public void invokeStep (int dx, int dy, Drawing drawing); - - /** - * Tracks the end of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view); - - /** - * Tracks the end of the interaction. - * @deprecated As of version 4.1, - * use invokeEnd(x, y, anchorX, anchorY, drawingView). - */ - public void invokeEnd(int dx, int dy, Drawing drawing); - - /** - * Gets the handle's owner. - */ - public Figure owner(); - - /** - * Gets the display box of the handle. - */ - public Rectangle displayBox(); - - /** - * Tests if a point is contained in the handle. - */ - public boolean containsPoint(int x, int y); - - /** - * Draws this handle. - */ - public void draw(Graphics g); - - /** - * Returns an Undoable to be used by the Undo/Redo infrastructure. - * @return Undoable - */ - public Undoable getUndoActivity(); - - /** - * Sets an Undoable to be used by the Undo/Redo infrastructure. - * @param newUndoableActivity - */ - public void setUndoActivity(Undoable newUndoableActivity); - - /** - * Returns the preferred Cursor for this Handle. - * @return Cursor - */ - public Cursor getCursor(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/HandleEnumeration.java b/JHotDraw/src/CH/ifa/draw/framework/HandleEnumeration.java deleted file mode 100644 index 0fa17a821130756b62f8912b6cece7fd2cc01054..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/HandleEnumeration.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#)HandleEnumeration.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.util.List; - -/** - * Interface for Enumerations that access Handles. - * It provides a method nextHandle, that hides the down casting - * from client code. - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface HandleEnumeration { - /** - * Returns the next element of the enumeration. Calls to this - * method will enumerate successive elements. - * @exception java.util.NoSuchElementException If no more elements exist. - */ - public Handle nextHandle(); - public boolean hasNextHandle(); - - /** - * Returns a list with all elements currently available in the enumeration. - * That means, elements retrieved already by calling nextHandle() are not - * contained. This method does not change the position of the enumeration. - * Warning: this method is not necessarily synchronized so this enumeration should not - * be modified at the same time! - * - * @return list with all elements currently available in the enumeration. - */ - public List toList(); - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset(); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/JHotDrawException.java b/JHotDraw/src/CH/ifa/draw/framework/JHotDrawException.java deleted file mode 100644 index d86e21d5ccaf86aea1a7af39783901f473a10e47..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/JHotDrawException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @(#)JHotDrawException.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * A JHotDRaw Exception. - * - * @version <$CURRENT_VERSION$> - */ -public class JHotDrawException extends Exception { - - private Exception myNestedException; - - public JHotDrawException(String msg) { - super(msg); - } - - public JHotDrawException(Exception nestedException) { - this(nestedException.getLocalizedMessage()); - setNestedException(nestedException); - nestedException.fillInStackTrace(); - } - - protected void setNestedException(Exception newNestedException) { - myNestedException = newNestedException; - } - - public Exception getNestedException() { - return myNestedException; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/JHotDrawRuntimeException.java b/JHotDraw/src/CH/ifa/draw/framework/JHotDrawRuntimeException.java deleted file mode 100644 index 3821eca33ede41573a12e3ae78c2e4405e06bf38..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/JHotDrawRuntimeException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @(#)JHotDrawRuntimeException.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -/** - * A JHotDraw RuntimeException. - * - * @version <$CURRENT_VERSION$> - */ -public class JHotDrawRuntimeException extends RuntimeException { - - private Exception myNestedException; - - public JHotDrawRuntimeException(String msg) { - super(msg); - } - - public JHotDrawRuntimeException(Exception nestedException) { - this(nestedException.getLocalizedMessage()); - setNestedException(nestedException); - nestedException.fillInStackTrace(); - } - - protected void setNestedException(Exception newNestedException) { - myNestedException = newNestedException; - } - - public Exception getNestedException() { - return myNestedException; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Locator.java b/JHotDraw/src/CH/ifa/draw/framework/Locator.java deleted file mode 100644 index 6e3aa09449cf1e151ddb2e1587bdedb432235abe..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Locator.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @(#)Locator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import CH.ifa.draw.util.Storable; -import java.awt.*; -import java.io.Serializable; - -/** - * Locators can be used to locate a position on a figure.<p> - * - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld034.htm>Strategy</a></b><br> - * Locator encapsulates the strategy to locate a handle on a figure. - * - * @version <$CURRENT_VERSION$> - */ -public interface Locator extends Storable, Serializable, Cloneable { - - /** - * Locates a position on the passed figure. - * @return a point on the figure. - */ - public Point locate(Figure owner); -} - diff --git a/JHotDraw/src/CH/ifa/draw/framework/Painter.java b/JHotDraw/src/CH/ifa/draw/framework/Painter.java deleted file mode 100644 index 417a20df86f66ad5796109342f99393bbc05d04b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Painter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @(#)Painter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.*; -import java.io.Serializable; - -/** - * Painter defines the interface for drawing a layer - * into a DrawingView.<p> - * - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld034.htm>Strategy</a></b><br> - * Painter encapsulates an algorithm to render something in - * the DrawingView. The DrawingView plays the role of the StrategyContext. - * <hr> - * - * @see DrawingView - * - * @version <$CURRENT_VERSION$> - */ -public interface Painter extends Serializable { - - /** - * Draws into the given DrawingView. - */ - public void draw(Graphics g, DrawingView view); - -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/PointConstrainer.java b/JHotDraw/src/CH/ifa/draw/framework/PointConstrainer.java deleted file mode 100644 index e33ec9e2c471e1c250987722845807e66e4fd928..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/PointConstrainer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * @(#)PointConstrainer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.awt.*; - -/** - * Interface to constrain a Point. This can be used to implement - * different kinds of grids. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld034.htm>Strategy</a></b><br> - * DrawingView is the StrategyContext.<br> - * - * @see DrawingView - * - * @version <$CURRENT_VERSION$> - */ -public interface PointConstrainer { - /** - * Constrains the given point. - * @return constrained point. - */ - public Point constrainPoint(Point p); - - /** - * Gets the x offset to move an object. - */ - public int getStepX(); - - /** - * Gets the y offset to move an object. - */ - public int getStepY(); - -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/Tool.java b/JHotDraw/src/CH/ifa/draw/framework/Tool.java deleted file mode 100644 index cfd5ba19e5a5ee1feac5a9c47f1f68011a217200..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/Tool.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * @(#)Tool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import CH.ifa.draw.util.Undoable; -import java.awt.event.MouseEvent; -import java.awt.event.KeyEvent; - -/** - * A tool defines a mode of the drawing view. All input events - * targeted to the drawing view are forwarded to its current tool.<p> - * Tools inform their editor when they are done with an interaction - * by calling the editor's toolDone() method. - * The Tools are created once and reused. They - * are initialized/deinitialized with activate()/deactivate(). - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld032.htm>State</a></b><br> - * Tool plays the role of the State. In encapsulates all state - * specific behavior. DrawingView plays the role of the StateContext. - * - * A tool can be in the following states: <br> - * disabled<->enabled[unusable<->usable[active<->inactive]] - * <->always_usable[active<->inactive]<->disabled - * <br> where each square bracket indicates a state nesting level - * and arrows possible state transitions. - * Unusable tools are always inactive as well and disabled tools - * are always unusable as well. - * State changes are propagated to registered ToolListeners. - * - * @see DrawingView - * - * @version <$CURRENT_VERSION$> - */ -public interface Tool { - - /** - * An active tool is the currently selected tool in the - * DrawingView. A tool can be activated/deactivated - * by calling the activate()/deactivate() method. - * - * @return true if the tool is the selected tool in the DrawingView, false otherwise - * @see #isEnabled - * @see #isUsable - */ - public boolean isActive(); - - /** - * Activates the tool for the given view. This method is called - * whenever the user switches to this tool. Use this method to - * reinitialize a tool. - * Note, a valid view must be present in order for the tool to accept activation - */ - public void activate(); - - /** - * Deactivates the tool. This method is called whenever the user - * switches to another tool. Use this method to do some clean-up - * when the tool is switched. Subclassers should always call - * super.deactivate. - */ - public void deactivate(); - - /** - * Handles mouse down events in the drawing view. - */ - public void mouseDown(MouseEvent e, int x, int y); - - /** - * Handles mouse drag events in the drawing view. - */ - public void mouseDrag(MouseEvent e, int x, int y); - - /** - * Handles mouse up in the drawing view. - */ - public void mouseUp(MouseEvent e, int x, int y); - - /** - * Handles mouse moves (if the mouse button is up). - */ - public void mouseMove(MouseEvent evt, int x, int y); - - /** - * Handles key down events in the drawing view. - */ - public void keyDown(KeyEvent evt, int key); - - /** - * A tool must be enabled in order to use it and to activate/deactivate it. - * Typically, the program enables or disables a tool. - * - * @see #isUsable - * @see #isActive - */ - public boolean isEnabled(); - public void setEnabled(boolean enableUsableCheck); - - /** - * A usable tool is a enabled and either active or inactive. - * Typically, the tool should be able to determine itself whether it is - * usable or not. - * - * @see #isEnabled - * @see #isUsable - */ - public boolean isUsable(); - public void setUsable(boolean newIsUsable); - - public DrawingEditor editor(); - - public Undoable getUndoActivity(); - - public void setUndoActivity(Undoable newUndoableActivity); - - public void addToolListener(ToolListener newToolListener); - public void removeToolListener(ToolListener oldToolListener); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/ToolListener.java b/JHotDraw/src/CH/ifa/draw/framework/ToolListener.java deleted file mode 100644 index bf08b79d55cf43beef813bbcbdf1285cf3a97657..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/ToolListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @(#)ToolListener.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.framework; - -import java.util.EventObject; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public interface ToolListener { - public void toolEnabled(EventObject toolEvent); - public void toolDisabled(EventObject toolEvent); - public void toolUsable(EventObject toolEvent); - public void toolUnusable(EventObject toolEvent); - public void toolActivated(EventObject toolEvent); - public void toolDeactivated(EventObject toolEvent); -} diff --git a/JHotDraw/src/CH/ifa/draw/framework/ViewChangeListener.java b/JHotDraw/src/CH/ifa/draw/framework/ViewChangeListener.java deleted file mode 100644 index 8c375a98669d91fafab0d22279575bb2fda5b07c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/framework/ViewChangeListener.java +++ /dev/null @@ -1,36 +0,0 @@ -package CH.ifa.draw.framework; - -import java.util.EventListener; - -/** - * Title: - * Description: - * Copyright: Copyright (c) 2001 - * Company: - * @author SourceForge(dnoyeb) aka C.L.Gilbert - * @version 1.0 - * @since 10/14/01 - */ -public interface ViewChangeListener extends EventListener { - - /** - * Sent when the active view has changed. - * @param newView view - */ - public void viewSelectionChanged(DrawingView oldView, DrawingView newView); - - /** - * Sent when a new view is created. This should only be fired after the view - * has a peer. I believe that means the view has a component chain all the way - * to a heavyweight container. - * @param view view - */ - public void viewCreated(DrawingView view); - - /** - * Send when an existing view is about to be destroyed. After processing this - * event, the view is not guaranteed to contain any appropriate data. You - * must not use it. - */ - public void viewDestroying(DrawingView view); -} diff --git a/JHotDraw/src/CH/ifa/draw/images/ATEXT1.gif b/JHotDraw/src/CH/ifa/draw/images/ATEXT1.gif deleted file mode 100644 index b14778e95e10b55060a08916082862f666f1cba8..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ATEXT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ATEXT2.gif b/JHotDraw/src/CH/ifa/draw/images/ATEXT2.gif deleted file mode 100644 index 61025ef8ccd944517bf878bf5327b9258155b4dc..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ATEXT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ATEXT3.gif b/JHotDraw/src/CH/ifa/draw/images/ATEXT3.gif deleted file mode 100644 index c44b27069cc020bad96a8ce4660ff5cbeab512ee..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ATEXT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/BORDDEC1.gif b/JHotDraw/src/CH/ifa/draw/images/BORDDEC1.gif deleted file mode 100644 index ef8d3911724b94100918c4f80cb79f716c3a3c95..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/BORDDEC1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/BORDDEC2.gif b/JHotDraw/src/CH/ifa/draw/images/BORDDEC2.gif deleted file mode 100644 index 6c4228539e266d9da591147bc78ab4c4e82b0b2d..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/BORDDEC2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/BORDDEC3.gif b/JHotDraw/src/CH/ifa/draw/images/BORDDEC3.gif deleted file mode 100644 index 206a1d1898bc2274178a3203077e1dee04282ff5..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/BORDDEC3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/CONN1.gif b/JHotDraw/src/CH/ifa/draw/images/CONN1.gif deleted file mode 100644 index f0f6e4d34b8aa9c4e1007066159e167a5fc68286..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/CONN1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/CONN2.gif b/JHotDraw/src/CH/ifa/draw/images/CONN2.gif deleted file mode 100644 index 470fc08f7147fa0435a78b9a7ac266a8accb3916..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/CONN2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/CONN3.gif b/JHotDraw/src/CH/ifa/draw/images/CONN3.gif deleted file mode 100644 index 0fbe78372d9e711df3ad1bac6b1b20dac3b49a40..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/CONN3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/DIAMOND1.gif b/JHotDraw/src/CH/ifa/draw/images/DIAMOND1.gif deleted file mode 100644 index 44440dc3b928a05b8f00f0bb3b6e387bae69ecd4..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/DIAMOND1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/DIAMOND2.gif b/JHotDraw/src/CH/ifa/draw/images/DIAMOND2.gif deleted file mode 100644 index 0c6f48d4c7209ee40e812dd620b754323f7bf823..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/DIAMOND2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/DIAMOND3.gif b/JHotDraw/src/CH/ifa/draw/images/DIAMOND3.gif deleted file mode 100644 index d54e8e69b3b7ff0c70f18a8443a16eee89c40513..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/DIAMOND3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ELLIPSE1.gif b/JHotDraw/src/CH/ifa/draw/images/ELLIPSE1.gif deleted file mode 100644 index 5c51d07a69d156218046418b238df2278e9887ed..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ELLIPSE1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ELLIPSE2.gif b/JHotDraw/src/CH/ifa/draw/images/ELLIPSE2.gif deleted file mode 100644 index 9046010b39eca172d44fd7daea792f92ee183382..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ELLIPSE2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ELLIPSE3.gif b/JHotDraw/src/CH/ifa/draw/images/ELLIPSE3.gif deleted file mode 100644 index 18254b0ce00a8d0418c1b805e09dd901c144f51d..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ELLIPSE3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ERASER1.gif b/JHotDraw/src/CH/ifa/draw/images/ERASER1.gif deleted file mode 100644 index af7b09da732c121e08b1f3c37d8396029c89c4c7..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ERASER1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ERASER2.gif b/JHotDraw/src/CH/ifa/draw/images/ERASER2.gif deleted file mode 100644 index 7432c0cd56ad3ee70669a35d8496feab7a1e17fb..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ERASER2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ERASER3.gif b/JHotDraw/src/CH/ifa/draw/images/ERASER3.gif deleted file mode 100644 index da9b2b7589ed49fa13fdb7591c29210073886828..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ERASER3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/HTMLAREA1.gif b/JHotDraw/src/CH/ifa/draw/images/HTMLAREA1.gif deleted file mode 100644 index 6d9cbc532221767f9b00de02c6f1a421cf165f07..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/HTMLAREA1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/HTMLAREA2.gif b/JHotDraw/src/CH/ifa/draw/images/HTMLAREA2.gif deleted file mode 100644 index 9063e2d7997bea69f0e7dad6b936a6498b0b7502..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/HTMLAREA2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/HTMLAREA3.gif b/JHotDraw/src/CH/ifa/draw/images/HTMLAREA3.gif deleted file mode 100644 index 72dc3096ad38e82696712e5270e4375443bf9b15..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/HTMLAREA3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/LINE1.gif b/JHotDraw/src/CH/ifa/draw/images/LINE1.gif deleted file mode 100644 index a9fbbccb6be1885a78e4c1d52ea310b73032e99e..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/LINE1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/LINE2.gif b/JHotDraw/src/CH/ifa/draw/images/LINE2.gif deleted file mode 100644 index e991acf489dd5f1296d17070922d3903db2600fd..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/LINE2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/LINE3.gif b/JHotDraw/src/CH/ifa/draw/images/LINE3.gif deleted file mode 100644 index 5436bf18983f1419d3d293ea7be69e63a7ea418e..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/LINE3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/OCONN1.gif b/JHotDraw/src/CH/ifa/draw/images/OCONN1.gif deleted file mode 100644 index 14283bbdc772bac4caaeea1efdbdcdafb4b5fa2a..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/OCONN1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/OCONN2.gif b/JHotDraw/src/CH/ifa/draw/images/OCONN2.gif deleted file mode 100644 index 4c8b94a457b036e4d7cdb0f6db780634fc2702b8..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/OCONN2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/OCONN3.gif b/JHotDraw/src/CH/ifa/draw/images/OCONN3.gif deleted file mode 100644 index 3b9e94e4c1f754a248aa1db6e4ee0b0f10ee8a8f..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/OCONN3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/PERT1.gif b/JHotDraw/src/CH/ifa/draw/images/PERT1.gif deleted file mode 100644 index f69744556b8a98b0f903febf45498dd09fcde923..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/PERT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/PERT2.gif b/JHotDraw/src/CH/ifa/draw/images/PERT2.gif deleted file mode 100644 index eb9f10ef03f573d2d7c08a805dee7264cabd6ef1..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/PERT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/PERT3.gif b/JHotDraw/src/CH/ifa/draw/images/PERT3.gif deleted file mode 100644 index aac7c5e3ad403e29fb246df6eb318f71ef45be0c..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/PERT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/POLYGON1.gif b/JHotDraw/src/CH/ifa/draw/images/POLYGON1.gif deleted file mode 100644 index 19a954ae68ce4362ee4baefc4ffe6395b434c22c..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/POLYGON1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/POLYGON2.gif b/JHotDraw/src/CH/ifa/draw/images/POLYGON2.gif deleted file mode 100644 index b7fa7a90265da375f38d14818857eba50678fb29..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/POLYGON2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/POLYGON3.gif b/JHotDraw/src/CH/ifa/draw/images/POLYGON3.gif deleted file mode 100644 index 85b9f2a5b0b7fe9eaf19970060e299763553b1d4..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/POLYGON3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/RECT1.gif b/JHotDraw/src/CH/ifa/draw/images/RECT1.gif deleted file mode 100644 index 2b5701d12e2f0a0eb3cb1b396c5dd777528b18af..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/RECT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/RECT2.gif b/JHotDraw/src/CH/ifa/draw/images/RECT2.gif deleted file mode 100644 index 20468af429a22ff746851f75c49d8241ff34d266..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/RECT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/RECT3.gif b/JHotDraw/src/CH/ifa/draw/images/RECT3.gif deleted file mode 100644 index d94e65cf42c31f8e2ff4448fce603db77788788c..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/RECT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/RRECT1.gif b/JHotDraw/src/CH/ifa/draw/images/RRECT1.gif deleted file mode 100644 index cf2c152cdc40f5a1bb7d7342a84611d86c36d020..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/RRECT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/RRECT2.gif b/JHotDraw/src/CH/ifa/draw/images/RRECT2.gif deleted file mode 100644 index 99f9d8048f9739836626e1fdc79cc47c317aaa8b..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/RRECT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/RRECT3.gif b/JHotDraw/src/CH/ifa/draw/images/RRECT3.gif deleted file mode 100644 index bf5eef360c1390e7719dc9d097974fec2f0224bc..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/RRECT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/SCRIBBL1.gif b/JHotDraw/src/CH/ifa/draw/images/SCRIBBL1.gif deleted file mode 100644 index 48a6d954e4f68001665ca9606774e7010fcde40a..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/SCRIBBL1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/SCRIBBL2.gif b/JHotDraw/src/CH/ifa/draw/images/SCRIBBL2.gif deleted file mode 100644 index fea78ceee88f17051bbd0c81491a683d98839a9e..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/SCRIBBL2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/SCRIBBL3.gif b/JHotDraw/src/CH/ifa/draw/images/SCRIBBL3.gif deleted file mode 100644 index ac467864796f2e16ddaa31120ee541662ac03ab9..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/SCRIBBL3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/SEL1.gif b/JHotDraw/src/CH/ifa/draw/images/SEL1.gif deleted file mode 100644 index 0d0bb054559fb9355ca17b4212a3aa6451bb342d..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/SEL1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/SEL2.gif b/JHotDraw/src/CH/ifa/draw/images/SEL2.gif deleted file mode 100644 index 025ac9c3c10aa410e37cd2be2d4733088b6134ea..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/SEL2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/SEL3.gif b/JHotDraw/src/CH/ifa/draw/images/SEL3.gif deleted file mode 100644 index fcbe6603d7f53d9a49ba0e451de047e2f7d03d53..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/SEL3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEMPLATE.gif b/JHotDraw/src/CH/ifa/draw/images/TEMPLATE.gif deleted file mode 100644 index 4b09907701246543b02aa42d8c2aa26ebd2a5c72..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEMPLATE.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEMPLAT_.gif b/JHotDraw/src/CH/ifa/draw/images/TEMPLAT_.gif deleted file mode 100644 index 223cd29ecaf5a6e2720660fe7d5cde747df69b9e..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEMPLAT_.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEXT1.gif b/JHotDraw/src/CH/ifa/draw/images/TEXT1.gif deleted file mode 100644 index 5ebb27c4c703e4e4b53220d98652727cee9208b6..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEXT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEXT2.gif b/JHotDraw/src/CH/ifa/draw/images/TEXT2.gif deleted file mode 100644 index 7c1fbdee0ede5090c8b4365c8e14f0bad6e43a5c..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEXT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEXT3.gif b/JHotDraw/src/CH/ifa/draw/images/TEXT3.gif deleted file mode 100644 index 5f316eb149e76d2badcfff6069f3ea64a3f76271..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEXT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEXTAREA1.gif b/JHotDraw/src/CH/ifa/draw/images/TEXTAREA1.gif deleted file mode 100644 index 1b210e93658f8b842965f810ef2e905f835280a9..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEXTAREA1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEXTAREA2.gif b/JHotDraw/src/CH/ifa/draw/images/TEXTAREA2.gif deleted file mode 100644 index 5ae72ea0ed2120f1f5a08849cf156adb1e888969..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEXTAREA2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TEXTAREA3.gif b/JHotDraw/src/CH/ifa/draw/images/TEXTAREA3.gif deleted file mode 100644 index 23f4ce93a5fa0be469cd32b9a4825b6bdc40b33b..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TEXTAREA3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TOBACK1.gif b/JHotDraw/src/CH/ifa/draw/images/TOBACK1.gif deleted file mode 100644 index 567e489b72e480d175b2157361e77f34ab9aaf35..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TOBACK1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TOBACK2.gif b/JHotDraw/src/CH/ifa/draw/images/TOBACK2.gif deleted file mode 100644 index 6917725772fb5159a45302490e4007968e91e5f0..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TOBACK2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TOBACK3.gif b/JHotDraw/src/CH/ifa/draw/images/TOBACK3.gif deleted file mode 100644 index 0734a255fa3c12e374155bb0c5effe6db129004b..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TOBACK3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TOFRONT1.gif b/JHotDraw/src/CH/ifa/draw/images/TOFRONT1.gif deleted file mode 100644 index e598010f002f95e097b07407e0dc4ca5290067b4..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TOFRONT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TOFRONT2.gif b/JHotDraw/src/CH/ifa/draw/images/TOFRONT2.gif deleted file mode 100644 index aaa1758c47e6d990f9f4766d43c9a29d76230c75..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TOFRONT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TOFRONT3.gif b/JHotDraw/src/CH/ifa/draw/images/TOFRONT3.gif deleted file mode 100644 index 7420d65229120749ee2d9e1486bdb6c65fb26c1b..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TOFRONT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TRIANGLE1.gif b/JHotDraw/src/CH/ifa/draw/images/TRIANGLE1.gif deleted file mode 100644 index d3e40b57d567538f6daf9e555ea1dcb581595cd4..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TRIANGLE1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TRIANGLE2.gif b/JHotDraw/src/CH/ifa/draw/images/TRIANGLE2.gif deleted file mode 100644 index b6a48fdbe47c51d90395eef9902b26465af45c4b..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TRIANGLE2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/TRIANGLE3.gif b/JHotDraw/src/CH/ifa/draw/images/TRIANGLE3.gif deleted file mode 100644 index 6fbdab7df54ee05e19389064b599f127fa7a21b7..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/TRIANGLE3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/URL1.gif b/JHotDraw/src/CH/ifa/draw/images/URL1.gif deleted file mode 100644 index 18fecf8b5402640df3d39a92367d0d6f0c22d2f5..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/URL1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/URL2.gif b/JHotDraw/src/CH/ifa/draw/images/URL2.gif deleted file mode 100644 index b328f34f69ecd307f0bcd83c4f944fa77108a87f..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/URL2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/URL3.gif b/JHotDraw/src/CH/ifa/draw/images/URL3.gif deleted file mode 100644 index cae0fdfbfda19073ee60e002c714f17fd0a8da03..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/URL3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ZOOM1.gif b/JHotDraw/src/CH/ifa/draw/images/ZOOM1.gif deleted file mode 100644 index 19846a6b4d508c26a6eab125e89211221bcf8337..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ZOOM1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ZOOM2.gif b/JHotDraw/src/CH/ifa/draw/images/ZOOM2.gif deleted file mode 100644 index 6f98416d189b60f397f6dadb8cdf7ee998840895..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ZOOM2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/ZOOM3.gif b/JHotDraw/src/CH/ifa/draw/images/ZOOM3.gif deleted file mode 100644 index c512db3d8d2c620a556c77fbb02cf5e5ed420c0f..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/ZOOM3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/images/pspbrwse.jbf b/JHotDraw/src/CH/ifa/draw/images/pspbrwse.jbf deleted file mode 100644 index 412902ade2fab1b81d220a2717e8c91f2685093e..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/images/pspbrwse.jbf and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw.jdo b/JHotDraw/src/CH/ifa/draw/samples/javadraw.jdo deleted file mode 100644 index aa4500a1fa7f0a3b486aefd5273e1c1d7189f466..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw.jdo +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jdo SYSTEM "jdo.dtd"> -<jdo> - <package name="CH.ifa.draw.samples.javadraw"> - <class name="BouncingDrawing"> - </class> - <class name="AnimationDecorator"> - </class> - </package> -</jdo> diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/AnimationDecorator.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/AnimationDecorator.java deleted file mode 100644 index daf0041fcb60a2e0de1c979ac3c5db8d17416bf1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/AnimationDecorator.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * @(#)AnimationDecorator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: ? by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import java.awt.*; -import java.io.IOException; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class AnimationDecorator extends DecoratorFigure implements Animatable { - - private int fXVelocity; - private int fYVelocity; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 7894632974364110685L; - private int animationDecoratorSerializedDataVersion = 1; - - public AnimationDecorator() { } - - public AnimationDecorator(Figure figure) { - super(figure); - fXVelocity = 4; - fYVelocity = 4; - } - - public void velocity(int xVelocity, int yVelocity) { - fXVelocity = xVelocity; - fYVelocity = yVelocity; - } - - public Point velocity() { - return new Point(fXVelocity, fYVelocity); - } - - public void animationStep() { - int xSpeed = fXVelocity; - int ySpeed = fYVelocity; - Rectangle box = displayBox(); - - if ((box.x + box.width > 300) && (xSpeed > 0)) - xSpeed = -xSpeed; - - if ((box.y + box.height > 300) && (ySpeed > 0)) - ySpeed = -ySpeed; - - if ((box.x < 0) && (xSpeed < 0)) - xSpeed = -xSpeed; - - if ((box.y < 0) && (ySpeed < 0)) - ySpeed = -ySpeed; - - velocity(xSpeed, ySpeed); - moveBy(xSpeed, ySpeed); - } - - // guard concurrent access to display box - - public synchronized void basicMoveBy(int x, int y) { - super.basicMoveBy(x, y); - } - - public synchronized void basicDisplayBox(Point origin, Point corner) { - super.basicDisplayBox(origin, corner); - } - - public synchronized Rectangle displayBox() { - return super.displayBox(); - } - - //-- store / load ---------------------------------------------- - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fXVelocity); - dw.writeInt(fYVelocity); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fXVelocity = dr.readInt(); - fYVelocity = dr.readInt(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/Animator.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/Animator.java deleted file mode 100644 index e9acdfb8ed5dfeb8bb1280d1e78bb5872408ff88..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/Animator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @(#)Animator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Animatable; - -/** - * @version <$CURRENT_VERSION$> - */ -public class Animator extends Thread { - - private DrawingView fView; - private Animatable fAnimatable; - - private volatile boolean fIsRunning; - private static final int DELAY = 1000 / 16; - - public Animator(Animatable animatable, DrawingView view) { - super("Animator"); - fView = view; - fAnimatable = animatable; - } - - public void start() { - super.start(); - fIsRunning = true; - } - - public void end() { - fIsRunning = false; - } - - public void run() { - while (fIsRunning) { - long tm = System.currentTimeMillis(); - fView.freezeView(); - fAnimatable.animationStep(); - fView.checkDamage(); - fView.unfreezeView(); - - // Delay for a while - try { - tm += DELAY; - Thread.sleep(Math.max(0, tm - System.currentTimeMillis())); - } - catch (InterruptedException e) { - break; - } - } - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/BouncingDrawing.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/BouncingDrawing.java deleted file mode 100644 index bfb98f112d23e050b8f233037136a81df11a65f4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/BouncingDrawing.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * @(#)BouncingDrawing.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.Animatable; - -/** - * @version <$CURRENT_VERSION$> - */ -public class BouncingDrawing extends StandardDrawing implements Animatable { - /* - * Serialization support. - */ - private static final long serialVersionUID = -8566272817418441758L; - private int bouncingDrawingSerializedDataVersion = 1; - - public synchronized Figure add(Figure figure) { - if (!(figure instanceof AnimationDecorator) && - !(figure instanceof ConnectionFigure)) { - figure = new AnimationDecorator(figure); - } - return super.add(figure); - } - - public synchronized Figure remove(Figure figure) { - Figure f = super.remove(figure); - if (f instanceof AnimationDecorator) { - return ((AnimationDecorator) f).peelDecoration(); - } - return f; - } - - /** - * @param figure figure to be replaced - * @param replacement figure that should replace the specified figure - * @return the figure that has been inserted (might be different from the figure specified) - */ - public synchronized Figure replace(Figure figure, Figure replacement) { - if (!(replacement instanceof AnimationDecorator) && - !(replacement instanceof ConnectionFigure)) { - replacement = new AnimationDecorator(replacement); - } - return super.replace(figure, replacement); - } - - public void animationStep() { - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - - if(!(f instanceof ConnectionFigure)) { - ((AnimationDecorator) f).animationStep(); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/FollowURLTool.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/FollowURLTool.java deleted file mode 100644 index c582b3d69397b36c00b456bd6e82030bfee0cb39..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/FollowURLTool.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * @(#)FollowURLTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import javax.swing.JApplet; -import java.awt.event.*; -import java.net.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.AbstractTool; - -/** - * @version <$CURRENT_VERSION$> - */ -class FollowURLTool extends AbstractTool { - private JApplet fApplet; - - FollowURLTool(DrawingEditor newDrawingEditor, JApplet applet) { - super(newDrawingEditor); - fApplet = applet; - } - - /** - * Handles mouse move events in the drawing view. - */ - public void mouseMove(MouseEvent e, int x, int y) { - String urlstring = null; - Figure figure = drawing().findFigureInside(x,y); - if (figure != null) { - urlstring = (String) figure.getAttribute(FigureAttributeConstant.URL); - } - if (urlstring != null) { - fApplet.showStatus(urlstring); - } - else { - fApplet.showStatus(""); - } - } - - /** - * Handles mouse up in the drawing view - * assuming mouseUp came from active drawing. - */ - public void mouseUp(MouseEvent e, int x, int y) { - Figure figure = getActiveDrawing().findFigureInside(x, y); - if (figure == null) { - return; - } - String urlstring = (String) figure.getAttribute(FigureAttributeConstant.URL); - if (urlstring == null) { - return; - } - - try { - URL url = new URL(fApplet.getDocumentBase(), urlstring); - fApplet.getAppletContext().showDocument(url); - } - catch (MalformedURLException exception) { - fApplet.showStatus(exception.toString()); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawApp.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawApp.java deleted file mode 100644 index 6ed086d2e7a74b7d35bf30003d7042ab4cb06c6b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawApp.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * @(#)JavaDrawApp.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.application.*; -import CH.ifa.draw.contrib.*; -import CH.ifa.draw.contrib.html.HTMLTextAreaFigure; -import CH.ifa.draw.contrib.html.HTMLTextAreaTool; -import CH.ifa.draw.contrib.zoom.ZoomDrawingView; -import CH.ifa.draw.contrib.zoom.ZoomTool; - -import javax.swing.*; -import java.awt.*; -import java.io.*; -import java.net.URL; - -/** - * @version <$CURRENT_VERSION$> - */ -public class JavaDrawApp extends MDI_DrawApplication { - - private Animator fAnimator; - private static String fgSampleImagesPath = "/CH/ifa/draw/samples/javadraw/sampleimages"; - private static String fgSampleImagesResourcePath = fgSampleImagesPath + "/"; - - JavaDrawApp() { - super("JHotDraw"); - } - - /** - * Expose constructor for benefit of subclasses. - * - * @param title The window title for this application's frame. - */ - public JavaDrawApp(String title) { - super(title); - } - - /** - * Factory method which create a new instance of this - * application. - * - * @return newly created application - */ - protected DrawApplication createApplication() { - return new JavaDrawApp(); - } - - protected DrawingView createDrawingView(Drawing newDrawing) { - Dimension d = getDrawingViewSize(); - DrawingView newDrawingView = new ZoomDrawingView(this, d.width, d.height); - newDrawingView.setDrawing(newDrawing); - // notify listeners about created view when the view is added to the desktop - //fireViewCreatedEvent(newDrawingView); - return newDrawingView; - } - - //-- application life cycle -------------------------------------------- - - public void destroy() { - super.destroy(); - endAnimation(); - } - - //-- DrawApplication overrides ----------------------------------------- - - protected void createTools(JToolBar palette) { - super.createTools(palette); - - Tool tool = new ZoomTool(this); - palette.add(createToolButton(IMAGES + "ZOOM", "Zoom Tool", tool)); - - tool = new UndoableTool(new TextTool(this, new TextFigure())); - palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool)); - - tool = new UndoableTool(new ConnectedTextTool(this, new TextFigure())); - palette.add(createToolButton(IMAGES + "ATEXT", "Connected Text Tool", tool)); - - tool = new URLTool(this); - palette.add(createToolButton(IMAGES + "URL", "URL Tool", tool)); - - tool = new UndoableTool(new CreationTool(this, new RectangleFigure())); - palette.add(createToolButton(IMAGES + "RECT", "Rectangle Tool", tool)); - - tool = new UndoableTool(new CreationTool(this, new RoundRectangleFigure())); - palette.add(createToolButton(IMAGES + "RRECT", "Round Rectangle Tool", tool)); - - tool = new UndoableTool(new CreationTool(this, new EllipseFigure())); - palette.add(createToolButton(IMAGES + "ELLIPSE", "Ellipse Tool", tool)); - - tool = new UndoableTool(new PolygonTool(this)); - palette.add(createToolButton(IMAGES + "POLYGON", "Polygon Tool", tool)); - - tool = new UndoableTool(new CreationTool(this, new TriangleFigure())); - palette.add(createToolButton(IMAGES + "TRIANGLE", "Triangle Tool", tool)); - - tool = new UndoableTool(new CreationTool(this, new DiamondFigure())); - palette.add(createToolButton(IMAGES + "DIAMOND", "Diamond Tool", tool)); - - tool = new UndoableTool(new CreationTool(this, new LineFigure())); - palette.add(createToolButton(IMAGES + "LINE", "Line Tool", tool)); - - tool = new UndoableTool(new ConnectionTool(this, new LineConnection())); - palette.add(createToolButton(IMAGES + "CONN", "Connection Tool", tool)); - - tool = new UndoableTool(new ConnectionTool(this, new ElbowConnection())); - palette.add(createToolButton(IMAGES + "OCONN", "Elbow Connection Tool", tool)); - - tool = new UndoableTool(new ScribbleTool(this)); - palette.add(createToolButton(IMAGES + "SCRIBBL", "Scribble Tool", tool)); - - tool = new UndoableTool(new BorderTool(this)); - palette.add(createToolButton(IMAGES + "BORDDEC", "Border Tool", tool)); - - Component button = new JButton("Hello World"); - tool = new CreationTool(this, new ComponentFigure(button)); - palette.add(createToolButton(IMAGES + "RECT", "Component Tool", tool)); - - tool = new TextAreaTool(this, new TextAreaFigure()); - palette.add(createToolButton(IMAGES + "TEXTAREA", "TextArea Tool", tool)); - - GraphicalCompositeFigure fig = new GraphicalCompositeFigure(); - fig.setLayouter(new SimpleLayouter(fig)); - tool = new CreationTool(this, fig); - palette.add(createToolButton(IMAGES + "RECT", "Container Figure Tool", tool)); - - tool = new CompositeFigureCreationTool(this, new RectangleFigure()); - palette.add(createToolButton(IMAGES + "RECT", "Nested Figure Tool", tool)); - - tool = new HTMLTextAreaTool(this, new HTMLTextAreaFigure()); - palette.add(createToolButton(IMAGES + "TEXTAREA", "HTML TextArea Tool", tool)); - - LineConnection lineConnection = new LineConnection(); - lineConnection.setStartDecoration(null); - tool = new UndoableTool(new SplitConnectionTool(this, lineConnection)); - palette.add(createToolButton(IMAGES + "OCONN", "Split Connection Tool", tool)); - } - - protected Tool createSelectionTool() { - return new MySelectionTool(this); - } - - protected void createMenus(JMenuBar mb) { - super.createMenus(mb); - addMenuIfPossible(mb, createAnimationMenu()); - addMenuIfPossible(mb, createImagesMenu()); - addMenuIfPossible(mb, createWindowMenu()); - } - - protected JMenu createAnimationMenu() { - CommandMenu menu = new CommandMenu("Animation"); - Command cmd = new AbstractCommand("Start Animation", this) { - public void execute() { - startAnimation(); - } - }; - menu.add(cmd); - - cmd = new AbstractCommand("Stop Animation", this) { - public void execute() { - endAnimation(); - } - }; - menu.add(cmd); - return menu; - } - - protected JMenu createWindowMenu() { - CommandMenu menu = new CommandMenu("Window"); - Command cmd = new AbstractCommand("New View", this) { - public void execute() { - newView(); - } - }; - menu.add(cmd); - - cmd = new AbstractCommand("New Window", this, false) { - public void execute() { - newWindow(createDrawing()); - } - }; - menu.add(cmd); - - menu.addSeparator(); - menu.add(new WindowMenu("Window List", (MDIDesktopPane)getDesktop(), this)); - return menu; - } - - protected JMenu createImagesMenu() { - CommandMenu menu = new CommandMenu("Images"); - URL url = getClass().getResource(fgSampleImagesPath); - if (url == null) { - throw new JHotDrawRuntimeException("Could not locate images: " + fgSampleImagesPath); - } - File imagesDirectory = new File(url.getFile()); - - try { - String[] list = imagesDirectory.list(); - for (int i = 0; i < list.length; i++) { - String name = list[i]; - String path = fgSampleImagesResourcePath+name; - menu.add(new UndoableCommand( - new InsertImageCommand(name, path, this))); - } - } - catch (Exception e) { - // do nothing - } - return menu; - } - - protected Drawing createDrawing() { - Drawing dwg = new BouncingDrawing(); - dwg.setTitle(getDefaultDrawingTitle()); - return dwg; - //return new StandardDrawing(); - } - - //---- animation support -------------------------------------------- - - public void startAnimation() { - if (view().drawing() instanceof Animatable && fAnimator == null) { - fAnimator = new Animator((Animatable)view().drawing(), view()); - fAnimator.start(); - } - } - - public void endAnimation() { - if (fAnimator != null) { - fAnimator.end(); - fAnimator = null; - } - } - - protected JMenu createDebugMenu() { - CommandMenu menu = (CommandMenu)super.createDebugMenu(); - - Command cmd = new AbstractCommand("Clipping Update", this) { - public void execute() { - this.view().setDisplayUpdate(new ClippingUpdateStrategy()); - } - }; - menu.add(cmd); - - return menu; - } - - //-- main ----------------------------------------------------------- - - public static void main(String[] args) { - JavaDrawApp window = new JavaDrawApp(); - window.open(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawApplet.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawApplet.java deleted file mode 100644 index 602655c6c9ca1a7d82b9eb0a9b45d3b612421b61..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawApplet.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * @(#)JavaDrawApplet.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.util.*; -import CH.ifa.draw.applet.*; -import CH.ifa.draw.contrib.*; - -import javax.swing.*; -import java.awt.event.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class JavaDrawApplet extends DrawApplet { - - transient private JButton fAnimationButton; - transient private Animator fAnimator; - - //-- applet life cycle -------------------------------------------- - - public void destroy() { - super.destroy(); - endAnimation(); - } - - //-- DrawApplet overrides ----------------------------------------- - - protected void createTools(JPanel palette) { - super.createTools(palette); - - Tool tool = new TextTool(this, new TextFigure()); - palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool)); - - tool = new ConnectedTextTool(this, new TextFigure()); - palette.add(createToolButton(IMAGES + "ATEXT", "Connected Text Tool", tool)); - - tool = new URLTool(this); - palette.add(createToolButton(IMAGES + "URL", "URL Tool", tool)); - - tool = new CreationTool(this, new RectangleFigure()); - palette.add(createToolButton(IMAGES + "RECT", "Rectangle Tool", tool)); - - tool = new CreationTool(this, new RoundRectangleFigure()); - palette.add(createToolButton(IMAGES + "RRECT", "Round Rectangle Tool", tool)); - - tool = new CreationTool(this, new EllipseFigure()); - palette.add(createToolButton(IMAGES + "ELLIPSE", "Ellipse Tool", tool)); - - tool = new PolygonTool(this); - palette.add(createToolButton(IMAGES + "POLYGON", "Polygon Tool", tool)); - - tool = new CreationTool(this, new TriangleFigure()); - palette.add(createToolButton(IMAGES + "TRIANGLE", "Triangle Tool", tool)); - - tool = new CreationTool(this, new DiamondFigure()); - palette.add(createToolButton(IMAGES + "DIAMOND", "Diamond Tool", tool)); - - tool = new CreationTool(this, new LineFigure()); - palette.add(createToolButton(IMAGES + "LINE", "Line Tool", tool)); - - tool = new ConnectionTool(this, new LineConnection()); - palette.add(createToolButton(IMAGES + "CONN", "Connection Tool", tool)); - - tool = new ConnectionTool(this, new ElbowConnection()); - palette.add(createToolButton(IMAGES + "OCONN", "Elbow Connection Tool", tool)); - - tool = new ScribbleTool(this); - palette.add(createToolButton(IMAGES + "SCRIBBL", "Scribble Tool", tool)); - - tool = new PolygonTool(this); - palette.add(createToolButton(IMAGES + "POLYGON", "Polygon Tool", tool)); - - tool = new BorderTool(this); - palette.add(createToolButton(IMAGES + "BORDDEC", "Border Tool", tool)); - } - - protected void createButtons(JPanel panel) { - super.createButtons(panel); - fAnimationButton = new JButton("Start Animation"); - fAnimationButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent event) { - toggleAnimation(); - } - } - ); - panel.add(fAnimationButton); - } - - protected Drawing createDrawing() { - return new BouncingDrawing(); - } - - //-- animation support ---------------------------------------------- - - public void startAnimation() { - if ((drawing() instanceof Animatable) && (fAnimator == null)) { - fAnimator = new Animator((Animatable)drawing(), view()); - fAnimator.start(); - fAnimationButton.setText("End Animation"); - } - } - - public void endAnimation() { - if (fAnimator != null) { - fAnimator.end(); - fAnimator = null; - fAnimationButton.setText("Start Animation"); - } - } - - public void toggleAnimation() { - if (fAnimator != null) - endAnimation(); - else - startAnimation(); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawAppletHelp.html b/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawAppletHelp.html deleted file mode 100644 index 5c0d1c80efc8975dc3b97ef7943722febcc55412..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawAppletHelp.html +++ /dev/null @@ -1,69 +0,0 @@ -<html> - -<head> - <title>JavaDraw Help</title> -</head> - -<body> -<H1>JavaDraw Help</H1> -<HR> -JavaDraw provides <a href=#tools>tools</a>, <a href=#handles>handles</a>, -and <a href=#commands>commands</a> to manipulate a drawing. -<P> -<H3><a name=tools>Tools</a></H3> -The tools on the left create or manipulate figures. -<Table Border=0> -<TR><TD><img src="../../images/SEL1.gif"><TD>selects, moves or resizes a figure; the shift-key -toggles the selection. Dragging the selection tool in the background -selects the figures within the dragged rectangle. -<TR><TD><img src="../../images/TEXT1.gif"><TD>creates a new or edits an existing text figure</TR> -<TR><TD><img src="../../images/ATEXT1.gif"><TD>creates a new text figure and attaches it to the clicked figure. Once -a text figure is attached it remains connected to the figure.</TR> -<TR><TD><img src="../../images/URL1.gif"><TD>edits a figure's URL attribute; the URL thus associated -with a figure is followed when the figure is clicked in -the <a href="../../../../../JavaDrawViewer.html">viewer applet</a></TR> -<TR><TD><img src="../../images/RECT1.gif"><TD>creates a rectangle figure</TR> -<TR><TD><img src="../../images/RRECT1.gif"><TD>creates a round rectangle figure</TR> -<TR><TD><img src="../../images/ELLIPSE1.gif"><TD>creates an ellipse figure</TR> -<TR><TD><img src="../../images/LINE1.gif"><TD>creates a line figure</TR> -<TR><TD><img src="../../images/CONN1.gif"><TD>creates or adjusts connections between figures. A connection -is split into segments by dragging a point on the connection. To join two segments click the end point of a segment</TR> -<TR><TD><img src="../../images/OCONN1.gif"><TD>creates an elbow connection and offers the same features as the ordinary connection tool</TR> -<TR><TD><img src="../../images/SCRIBBL1.gif"><TD>creates a scribble figure; dragging the mouse creates -a smooth line while successive clicks yields a polyline figure</TR> -<TR><TD><img src="../../images/BORDDEC1.gif"><TD>decorates the clicked figure with a border</TR> -</Table> - - -<H3><a name=handles>Handles</a></H3> -When selected figures provide different handles to manipulate them. -<ul> -<li> -the filled red handles enable to manipulate the shape of a figure -<li> -the blue circle handle is a connection handle. It allows to create connections -between figures. -<li> -the framed red handles are null handles. They only show the selection status -of a figure but don't support any manipulation. -<li> -the green handles are shown on connections. They enable to -reconnect them with another figure. -<li> -the yellow handle enables to change the font size of a text figure or the -size of the radius of a rounded rectangle. -</ul> -<H3><a name=commands>Commands</a></H3> -Commands are invoked from the button bar at the bottom (applet) or -from the menu bar at the top (application). -<P> -The standard commands that are provided include, cut, copy, paste, -duplicate, delete, group, ungroup, bring to front, and send to back. -<P> -<H3>Attributes</H3> -Attributes, such as fill color, text color or arrow tip, can be changed -through the attributes menu (stand-alone) or the pop up menues (applet). - -<hr> -Comments or questions to <a href="mailto:erich_gamma@acm.org">Erich Gamma</a> -</html> diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawViewer.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawViewer.java deleted file mode 100644 index c3a3eb078ed6843296e374dc782131e7f0282cf2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/JavaDrawViewer.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * @(#)JavaDrawViewer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.*; - -import javax.swing.JApplet; -import java.awt.*; -import java.io.*; -import java.net.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class JavaDrawViewer extends JApplet implements DrawingEditor { - - private Drawing fDrawing; - private Tool fTool; - private StandardDrawingView fView; - private transient UndoManager myUndoManager; - - public void init() { - setUndoManager(new UndoManager()); - getContentPane().setLayout(new BorderLayout()); - fView = new StandardDrawingView(this, 400, 370); - getContentPane().add("Center", fView); - setTool(new FollowURLTool(this, this)); - - String filename = getParameter("Drawing"); - if (filename != null) { - loadDrawing(filename); - fView.setDrawing(fDrawing); - } - else { - showStatus("Unable to load drawing"); - } - } - - public void addViewChangeListener(ViewChangeListener vsl) { - } - - public void removeViewChangeListener(ViewChangeListener vsl) { - } - - private void loadDrawing(String filename) { - try { - URL url = new URL(getCodeBase(), filename); - InputStream stream = url.openStream(); - StorableInput reader = new StorableInput(stream); - fDrawing = (Drawing)reader.readStorable(); - } - catch (IOException e) { - fDrawing = createDrawing(); - System.err.println("Error when Loading: " + e); - showStatus("Error when Loading: " + e); - } - } - - protected Drawing createDrawing() { - return new StandardDrawing(); - } - - /** - * Gets the editor's drawing view. - */ - public DrawingView view() { - return fView; - } - - public DrawingView[] views() { - return new DrawingView[] { view() }; - } - - /** - * Gets the editor's drawing. - */ - public Drawing drawing() { - return fDrawing; - } - - /** - * Gets the current the tool (there is only one): - */ - public Tool tool() { - return fTool; - } - - /** - * Sets the current the tool - */ - public void setTool(Tool newTool) { - fTool = newTool; - } - - /** - * Sets the editor's default tool. Do nothing since we only have one tool. - */ - public void toolDone() {} - - /** - * Ignore selection changes, we don't show any selection - */ - public void figureSelectionChanged(DrawingView view) {} - - protected void setUndoManager(UndoManager newUndoManager) { - myUndoManager = newUndoManager; - } - - public UndoManager getUndoManager() { - return myUndoManager; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/MySelectionTool.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/MySelectionTool.java deleted file mode 100644 index ed21e927d2ac61a5474bc160785edbf70d4d5705..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/MySelectionTool.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#)MySelectionTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import java.awt.event.MouseEvent; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * A SelectionTool that interprets double clicks to inspect the clicked figure - * - * @version <$CURRENT_VERSION$> - */ -public class MySelectionTool extends SelectionTool { - - public MySelectionTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - /** - * Handles mouse down events and starts the corresponding tracker. - */ - public void mouseDown(MouseEvent e, int x, int y) { - setView((DrawingView)e.getSource()); - if (e.getClickCount() == 2) { - Figure figure = drawing().findFigure(e.getX(), e.getY()); - if (figure != null) { - inspectFigure(figure); - return; - } - } - super.mouseDown(e, x, y); - } - - protected void inspectFigure(Figure f) { - System.out.println("inspect figure"+f); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/PatternPainter.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/PatternPainter.java deleted file mode 100644 index 869db577feaca003a396c0cbf939f5311040b20f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/PatternPainter.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @(#)PatternPainter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import java.awt.*; -import CH.ifa.draw.framework.*; - -/** - * PatternDrawer a background that can be added to a drawing. - * - * @see DrawingView - * @see Painter - * - * @version <$CURRENT_VERSION$> - */ -public class PatternPainter - implements Painter { - - private Image fImage; - - public PatternPainter(Image image) { - fImage = image; - } - - public void draw(Graphics g, DrawingView view) { - drawPattern(g, fImage, view); - } - - /** - * Draws a pattern background pattern by replicating an image. - */ - private void drawPattern(Graphics g, Image image, DrawingView view) { - int iwidth = image.getWidth(view); - int iheight = image.getHeight(view); - Dimension d = view.getSize(); - int x = 0; - int y = 0; - - while (y < d.height) { - while (x < d.width) { - g.drawImage(image, x, y, view); - x += iwidth; - } - y += iheight; - x = 0; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/URLTool.java b/JHotDraw/src/CH/ifa/draw/samples/javadraw/URLTool.java deleted file mode 100644 index 32b078cef38b3c4b014dc6f6e86f85ff7fee0093..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/javadraw/URLTool.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @(#)URLTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.javadraw; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.util.FloatingTextField; -import java.awt.*; -import java.awt.event.*; - -/** - * A tool to attach URLs to figures. - * The URLs are stored in the figure's "URL" attribute. - * The URL text is entered with a FloatingTextField. - * - * @see CH.ifa.draw.util.FloatingTextField - * - * @version <$CURRENT_VERSION$> - */ -public class URLTool extends AbstractTool { - - private FloatingTextField fTextField; - private Figure fURLTarget; - - public URLTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - public void mouseDown(MouseEvent e, int x, int y) - { - super.mouseDown(e,x,y); - Figure pressedFigure = drawing().findFigureInside(x, y); - if (pressedFigure != null) { - beginEdit(pressedFigure); - return; - } - endEdit(); - editor().toolDone(); - } - - public void mouseUp(MouseEvent e, int x, int y) { - } - - public void deactivate(DrawingView view) { - super.deactivate(); - endEdit(); - } - - private void beginEdit(Figure figure) { - if (fTextField == null) { - fTextField = new FloatingTextField(); - fTextField.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent event) { - endEdit(); - } - } - ); - } - - if ((figure != fURLTarget) && (fURLTarget != null)) { - endEdit(); - } - if (figure != fURLTarget) { - fTextField.createOverlay((Container)view()); - fTextField.setBounds(fieldBounds(figure), getURL(figure)); - fURLTarget = figure; - } - } - - private void endEdit() { - if (fURLTarget != null) { - setURL(fURLTarget, fTextField.getText()); - fURLTarget = null; - fTextField.endOverlay(); - } - } - - private Rectangle fieldBounds(Figure figure) { - Rectangle box = figure.displayBox(); - int nChars = Math.max(20, getURL(figure).length()); - Dimension d = fTextField.getPreferredSize(nChars); - box.x = Math.max(0, box.x + (box.width - d.width)/2); - box.y = Math.max(0, box.y + (box.height - d.height)/2); - return new Rectangle(box.x, box.y, d.width, d.height); - } - - private String getURL(Figure figure) { - String url = (String) figure.getAttribute(FigureAttributeConstant.URL); - if (url == null) { - url = ""; - } - return url; - } - - private void setURL(Figure figure, String url) { - figure.setAttribute(FigureAttributeConstant.URL, url); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/DUKE.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/DUKE.gif deleted file mode 100644 index 4f31ce593f3d96d76ebbb515cd98d83fbca46bda..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/DUKE.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/Juggler0.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/Juggler0.gif deleted file mode 100644 index 577f7a9f03200f81d1ed3931620cb0045dca83d0..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/Juggler0.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/backgrnd.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/backgrnd.gif deleted file mode 100644 index 602f909c9784eeaeca9896a78116ea9555007e2d..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/backgrnd.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/beans.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/beans.gif deleted file mode 100644 index 4a0370f09c9a0738190af806989f58e66f882b4d..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/beans.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/bg1.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/bg1.gif deleted file mode 100644 index d54150cd9ed3fb7b1737d16b24dd39950b914af9..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/bg1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/javacentral.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/javacentral.gif deleted file mode 100644 index bbba907bb45e0a98aef00d8fe8444345a2d72e24..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/javacentral.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/joe.surf.yellow.small.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/joe.surf.yellow.small.gif deleted file mode 100644 index 7f255f52f968dda6d4bbdeccd75dacee6a2873e5..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/joe.surf.yellow.small.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/rain.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/rain.gif deleted file mode 100644 index 2fdf8fb88e2908cbd5591dc60e942971c15ebb61..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/rain.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/view.gif b/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/view.gif deleted file mode 100644 index 5d562671099522cc034b6c3b0adf523e7e135d6c..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/javadraw/sampleimages/view.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/minimap/MiniMapApplication.java b/JHotDraw/src/CH/ifa/draw/samples/minimap/MiniMapApplication.java deleted file mode 100644 index 407e18c88c348464128548b34265e0646a4c8f5e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/minimap/MiniMapApplication.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @(#)MiniMapApplication.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.samples.minimap; - -import CH.ifa.draw.contrib.Desktop; -import CH.ifa.draw.contrib.SplitPaneDrawApplication; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class MiniMapApplication extends SplitPaneDrawApplication { - - protected Desktop createDesktop() { - return new MiniMapDesktop(); - } - - public static void main(String[] args) { - MiniMapApplication window = new MiniMapApplication(); - window.open(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/minimap/MiniMapDesktop.java b/JHotDraw/src/CH/ifa/draw/samples/minimap/MiniMapDesktop.java deleted file mode 100644 index 0e6d2a2f744f3ff29a2a0854d5ceadbb7ad3ae16..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/minimap/MiniMapDesktop.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * @(#)MiniMapDesktop.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.samples.minimap; - -import CH.ifa.draw.contrib.SplitPaneDesktop; -import CH.ifa.draw.contrib.MiniMapView; -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.util.Iconkit; -import CH.ifa.draw.figures.ImageFigure; - -import javax.swing.*; -import java.awt.*; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class MiniMapDesktop extends SplitPaneDesktop { - - private String imageName = "/CH/ifa/draw/samples/javadraw/sampleimages/view.gif"; - - protected Component createRightComponent(DrawingView view) { - Image image = Iconkit.instance().registerAndLoadImage( - (Component)view, imageName); - view.add(new ImageFigure(image, imageName, new Point(0,0))); - view.checkDamage(); -// ((CH.ifa.draw.standard.StandardDrawingView)view).checkMinimumSize(); - return super.createRightComponent(view); - } - - protected Component createLeftComponent(DrawingView view) { - JPanel blankPanel = new JPanel(); -// blankPanel.setPreferredSize(new Dimension(200, 200)); - - MiniMapView mmv = new MiniMapView(view, (JScrollPane)getRightComponent()); -// mmv.setPreferredSize(new Dimension(200, 200)); - - JSplitPane leftSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, blankPanel, mmv); - leftSplitPane.setOneTouchExpandable(true); - leftSplitPane.setDividerLocation(200); -// leftSplitPane.setPreferredSize(new Dimension(200, 400)); -// leftSplitPane.resetToPreferredSizes(); - - return leftSplitPane; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/net.jdo b/JHotDraw/src/CH/ifa/draw/samples/net.jdo deleted file mode 100644 index 0872b17d83d7c23dce1431cd9aca6b8cbd8ebf04..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/net.jdo +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jdo SYSTEM "jdo.dtd"> -<jdo> - <package name="CH.ifa.draw.samples.net"> - <class name="NodeFigure"> - </class> - </package> -</jdo> diff --git a/JHotDraw/src/CH/ifa/draw/samples/net/NetApp.java b/JHotDraw/src/CH/ifa/draw/samples/net/NetApp.java deleted file mode 100644 index 466f18daeecfa5552a5dad5245247ddd96c3e8fc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/net/NetApp.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @(#)NetApp.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.net; - -import javax.swing.JToolBar; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.application.DrawApplication; - -/** - * @version <$CURRENT_VERSION$> - */ -public class NetApp extends DrawApplication { - - public NetApp() { - super("Net"); - } - - protected void createTools(JToolBar palette) { - super.createTools(palette); - - Tool tool = new TextTool(this, new NodeFigure()); - palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool)); - - tool = new CreationTool(this, new NodeFigure()); - palette.add(createToolButton(IMAGES + "RECT", "Create Org Unit", tool)); - - tool = new ConnectionTool(this, new LineConnection()); - palette.add(createToolButton(IMAGES + "CONN", "Connection Tool", tool)); - } - - //-- main ----------------------------------------------------------- - - public static void main(String[] args) { - DrawApplication window = new NetApp(); - window.open(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/net/NodeFigure.java b/JHotDraw/src/CH/ifa/draw/samples/net/NodeFigure.java deleted file mode 100644 index e78c111dc233ac992ca9180a1b71b0c90980aa4d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/net/NodeFigure.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)NodeFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.net; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.util.*; - -import java.util.*; -import java.util.List; -import java.awt.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class NodeFigure extends TextFigure { - private static final int BORDER = 6; - private List fConnectors; - private boolean fConnectorsVisible; - - public NodeFigure() { - initialize(); - fConnectors = null; - } - - public Rectangle displayBox() { - Rectangle box = super.displayBox(); - int d = BORDER; - box.grow(d, d); - return box; - } - - public boolean containsPoint(int x, int y) { - // add slop for connectors - if (fConnectorsVisible) { - Rectangle r = displayBox(); - int d = LocatorConnector.SIZE/2; - r.grow(d, d); - return r.contains(x, y); - } - return super.containsPoint(x, y); - } - - private void drawBorder(Graphics g) { - Rectangle r = displayBox(); - g.setColor(getFrameColor()); - g.drawRect(r.x, r.y, r.width-1, r.height-1); - } - - public void draw(Graphics g) { - super.draw(g); - drawBorder(g); - drawConnectors(g); - } - - public HandleEnumeration handles() { - ConnectionFigure prototype = new LineConnection(); - List handles = CollectionsFactory.current().createList(); - handles.add(new ConnectionHandle(this, RelativeLocator.east(), prototype)); - handles.add(new ConnectionHandle(this, RelativeLocator.west(), prototype)); - handles.add(new ConnectionHandle(this, RelativeLocator.south(), prototype)); - handles.add(new ConnectionHandle(this, RelativeLocator.north(), prototype)); - - handles.add(new NullHandle(this, RelativeLocator.southEast())); - handles.add(new NullHandle(this, RelativeLocator.southWest())); - handles.add(new NullHandle(this, RelativeLocator.northEast())); - handles.add(new NullHandle(this, RelativeLocator.northWest())); - return new HandleEnumerator(handles); - } - - private void drawConnectors(Graphics g) { - if (fConnectorsVisible) { - Iterator iter = connectors(); - while (iter.hasNext()) { - ((Connector)iter.next()).draw(g); - } - } - } - - /** - */ - public void connectorVisibility(boolean isVisible, ConnectionFigure courtingConnection) { - fConnectorsVisible = isVisible; - invalidate(); - } - - /** - */ - public Connector connectorAt(int x, int y) { - return findConnector(x, y); - } - - /** - */ - private Iterator connectors() { - if (fConnectors == null) { - createConnectors(); - } - return fConnectors.iterator(); - } - - private void createConnectors() { - fConnectors = CollectionsFactory.current().createList(4); - fConnectors.add(new LocatorConnector(this, RelativeLocator.north()) ); - fConnectors.add(new LocatorConnector(this, RelativeLocator.south()) ); - fConnectors.add(new LocatorConnector(this, RelativeLocator.west()) ); - fConnectors.add(new LocatorConnector(this, RelativeLocator.east()) ); - } - - private Connector findConnector(int x, int y) { - // return closest connector - long min = Long.MAX_VALUE; - Connector closest = null; - Iterator iter = connectors(); - while (iter.hasNext()) { - Connector c = (Connector)iter.next(); - Point p2 = Geom.center(c.displayBox()); - long d = Geom.length2(x, y, p2.x, p2.y); - if (d < min) { - min = d; - closest = c; - } - } - return closest; - } - - private void initialize() { - setText("node"); - Font fb = new Font("Helvetica", Font.BOLD, 12); - setFont(fb); - createConnectors(); - } - - /** - * Usually, a TextHolders is implemented by a Figure subclass. To avoid casting - * a TextHolder to a Figure this method can be used for polymorphism (in this - * case, let the (same) object appear to be of another type). - * Note, that the figure returned is not the figure to which the TextHolder is - * (and its representing figure) connected. - * @return figure responsible for representing the content of this TextHolder - */ - public Figure getRepresentingFigure() { - return this; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/nothing/NothingApp.java b/JHotDraw/src/CH/ifa/draw/samples/nothing/NothingApp.java deleted file mode 100644 index 518c59960456b04b21e9c770233c28ad7b967776..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/nothing/NothingApp.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @(#)NothingApp.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.nothing; - -import javax.swing.JToolBar; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.contrib.*; -import CH.ifa.draw.application.*; - -/** - * A very basic example for demonstraing JHotDraw's capabilities. It contains only - * a few additional tools apart from the selection tool already provided by its superclass. - * It uses only a single document interface (SDI) and not a multiple document interface (MDI) - * because the applicateion frame is derived DrawApplication rather than MDI_DrawApplication. - * To enable MDI for this application, NothingApp must inherit from MDI_DrawApplication - * and be recompiled. - * - * @version <$CURRENT_VERSION$> - */ -public class NothingApp extends DrawApplication { - - public NothingApp() { - super("Nothing"); - } - - protected void createTools(JToolBar palette) { - super.createTools(palette); - - Tool tool = new TextTool(this, new TextFigure()); - palette.add(createToolButton(IMAGES+"TEXT", "Text Tool", tool)); - - tool = new CreationTool(this, new RectangleFigure()); - palette.add(createToolButton(IMAGES+"RECT", "Rectangle Tool", tool)); - - tool = new CreationTool(this, new RoundRectangleFigure()); - palette.add(createToolButton(IMAGES+"RRECT", "Round Rectangle Tool", tool)); - - tool = new CreationTool(this, new EllipseFigure()); - palette.add(createToolButton(IMAGES+"ELLIPSE", "Ellipse Tool", tool)); - - tool = new CreationTool(this, new LineFigure()); - palette.add(createToolButton(IMAGES+"LINE", "Line Tool", tool)); - - tool = new PolygonTool(this); - palette.add(createToolButton(IMAGES+"POLYGON", "Polygon Tool", tool)); - - tool = new ConnectionTool(this, new LineConnection()); - palette.add(createToolButton(IMAGES+"CONN", "Connection Tool", tool)); - - tool = new ConnectionTool(this, new ElbowConnection()); - palette.add(createToolButton(IMAGES+"OCONN", "Elbow Connection Tool", tool)); - } - - //-- main ----------------------------------------------------------- - - public static void main(String[] args) { - DrawApplication window = new NothingApp(); - window.open(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/nothing/NothingApplet.java b/JHotDraw/src/CH/ifa/draw/samples/nothing/NothingApplet.java deleted file mode 100644 index 17e5dad44b9b3173198202c1bbc3c8e73f6f5b8d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/nothing/NothingApplet.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @(#)NothingApplet.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.nothing; - -import javax.swing.JPanel; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.applet.*; -import CH.ifa.draw.contrib.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class NothingApplet extends DrawApplet { - - //-- DrawApplet overrides ----------------------------------------- - - protected void createTools(JPanel palette) { - super.createTools(palette); - - Tool tool = new TextTool(this, new TextFigure()); - palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool)); - - tool = new CreationTool(this, new RectangleFigure()); - palette.add(createToolButton(IMAGES + "RECT", "Rectangle Tool", tool)); - - tool = new CreationTool(this, new RoundRectangleFigure()); - palette.add(createToolButton(IMAGES + "RRECT", "Round Rectangle Tool", tool)); - - tool = new CreationTool(this, new EllipseFigure()); - palette.add(createToolButton(IMAGES + "ELLIPSE", "Ellipse Tool", tool)); - - tool = new CreationTool(this, new LineFigure()); - palette.add(createToolButton(IMAGES + "LINE", "Line Tool", tool)); - - tool = new PolygonTool(this); - palette.add(createToolButton(IMAGES + "POLYGON", "Polygon Tool", tool)); - - tool = new ConnectionTool(this, new LineConnection()); - palette.add(createToolButton(IMAGES + "CONN", "Connection Tool", tool)); - - tool = new ConnectionTool(this, new ElbowConnection()); - palette.add(createToolButton(IMAGES + "OCONN", "Elbow Connection Tool", tool)); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/PertApplet.java b/JHotDraw/src/CH/ifa/draw/samples/pert/PertApplet.java deleted file mode 100644 index cb928c2da3caeadbcc9a02b583813b1646abde7f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/pert/PertApplet.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * @(#)PertApplet.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.pert; - -import javax.swing.JPanel; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.applet.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class PertApplet extends DrawApplet { - - private final static String PERTIMAGES = "/CH/ifa/draw/samples/pert/images/"; - - protected void createTools(JPanel palette) { - super.createTools(palette); - - Tool tool = new TextTool(this, new TextFigure()); - palette.add(createToolButton(IMAGES+"TEXT", "Text Tool", tool)); - - tool = new PertFigureCreationTool(this); - palette.add(createToolButton(PERTIMAGES+"PERT", "Task Tool", tool)); - - tool = new ConnectionTool(this, new PertDependency()); - palette.add(createToolButton(IMAGES+"CONN", "Dependency Tool", tool)); - - tool = new CreationTool(this, new LineFigure()); - palette.add(createToolButton(IMAGES+"LINE", "Line Tool", tool)); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/PertAppletHelp.html b/JHotDraw/src/CH/ifa/draw/samples/pert/PertAppletHelp.html deleted file mode 100644 index 3288502a5891d8636e22ca415bd73cc950170588..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/pert/PertAppletHelp.html +++ /dev/null @@ -1,67 +0,0 @@ -<html> - -<head> - <title>Pert Help</title> -</head> - -<body> -<H1>PERT Help</H1> -<HR> -PERT provides tools, handles, and commands to manipulate a PERT diagram. -<P> -A task is shown as a box with a line for the task's name, a line for -the task's duration, and a line for the task's earliest end time. -Only the task's name and its duration are editable. The end time -is calculated automatically by PERT. -<P> -Circular dependencies are shown in red. -<P> -<H3>Tools</H3> -The tool palette on the left offers several tools that either create -new figures or manipulate existing ones. -<Table Border=0> -<TR><TD><img src="../../images/SEL1.gif"><TD>selects, moves or resizes a figure; the shift-key -toggles the selection. Dragging the selection tool in the background -selects the figures within the dragged rectangle. -<TR><TD><img src="../../images/PERT1.gif"><TD>creates a new task</TR> -<TR><TD><img src="../../images/TEXT1.gif"><TD>creates a new or edits an existing text figure</TR> -<TR><TD><img src="../../images/CONN1.gif"><TD>creates or adjusts connections -between figures. A connection -is split into segments by dragging a point on the connection. To join two -segments click the -end point of a segment</TR> -<TR><TD><img src="../../images/LINE1.gif"><TD>creates a line figure</TR> -</Table> - - -<H3>Handles</H3> -When selected figures offer different handles to manipulate them. -<ul> -<li> -the blue circle handle is a connection handle. It allows to create connections -between figures. -<li> -the framed red handles are null handles. They only show the selection status -of a figure but don't support any manipulation. -<li> -the green handles are shown on connections. They enable to -reconnect them with another figure. -<li> -the yellow handle enables to change the font size of a text figure or the -size of the radius of a rounded rectangle. -</ul> - -<H3>Commands</H3> -Commands are invoked from the button bar at the bottom (applet) or -from the menu bar at the top (application). -<P> -The standard commands that are provided include, cut, copy, paste, -duplicate, delete, group, ungroup, bring to front, and send to back. -<P> -<H3>Attributes</H3> -Attributes, such as fill color, text color or arrow tip, can be changed -through the attributes menu (stand-alone) or the pop up menues (applet). - -<p> - -</html> diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/PertApplication.java b/JHotDraw/src/CH/ifa/draw/samples/pert/PertApplication.java deleted file mode 100644 index 7eb3d524f0c4896638c4ed8ace7e0efbcf763427..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/pert/PertApplication.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @(#)PertApplication.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.pert; - -import javax.swing.JToolBar; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.application.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class PertApplication extends DrawApplication { - - static private final String PERTIMAGES = "/CH/ifa/draw/samples/pert/images/"; - - public PertApplication() { - super("PERT Editor"); - } - - protected void createTools(JToolBar palette) { - super.createTools(palette); - - Tool tool = new TextTool(this, new TextFigure()); - palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool)); - - // the generic but slower version - //tool = new CreationTool(new PertFigure()); - //palette.add(createToolButton(PERTIMAGES + "PERT", "Task Tool", tool)); - - tool = new PertFigureCreationTool(this); - palette.add(createToolButton(PERTIMAGES + "PERT", "Task Tool", tool)); - - tool = new ConnectionTool(this, new PertDependency()); - palette.add(createToolButton(IMAGES + "CONN", "Dependency Tool", tool)); - - tool = new CreationTool(this, new LineFigure()); - palette.add(createToolButton(IMAGES + "Line", "Line Tool", tool)); - } - - //-- main ----------------------------------------------------------- - - public static void main(String[] args) { - PertApplication pert = new PertApplication(); - pert.open(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/PertDependency.java b/JHotDraw/src/CH/ifa/draw/samples/pert/PertDependency.java deleted file mode 100644 index a1bc417e69db804bba93ea80af0585acc60e5b5f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/pert/PertDependency.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @(#)PertDependency.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.pert; - -import java.awt.*; -import java.util.List; - -// JUnitDoclet begin import -import CH.ifa.draw.framework.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.standard.*; -// JUnitDoclet end import - -/** - * @version <$CURRENT_VERSION$> - */ -public class PertDependency extends LineConnection { - /* - * Serialization support. - */ - private static final long serialVersionUID = -7959500008698525009L; - private int pertDependencySerializedDataVersion = 1; - - public PertDependency() { - setEndDecoration(new ArrowTip()); - setStartDecoration(null); - } - - public void handleConnect(Figure start, Figure end) { - PertFigure source = (PertFigure)start; - PertFigure target = (PertFigure)end; - if (source.hasCycle(target)) { - setAttribute(FigureAttributeConstant.FRAME_COLOR, Color.red); - } - else { - target.addPreTask(source); - source.addPostTask(target); - source.notifyPostTasks(); - } - } - - public void handleDisconnect(Figure start, Figure end) { - PertFigure source = (PertFigure)start; - PertFigure target = (PertFigure)end; - if (target != null) { - target.removePreTask(source); - target.updateDurations(); - } - if (source != null) { - source.removePostTask(target); - } - } - - public boolean canConnect(Figure start, Figure end) { - return ((start instanceof PertFigure) && (end instanceof PertFigure)); - } - - public HandleEnumeration handles() { - List handles = super.handles().toList(); - // don't allow to reconnect the starting figure - handles.set(0, new NullHandle(this, PolyLineFigure.locator(0))); - return new HandleEnumerator(handles); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/PertFigure.java b/JHotDraw/src/CH/ifa/draw/samples/pert/PertFigure.java deleted file mode 100644 index 3b006fe9611d61ec95330bb13bd972015af24e16..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/pert/PertFigure.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * @(#)PertFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.pert; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import CH.ifa.draw.figures.*; -import CH.ifa.draw.util.*; - -import java.awt.*; -import java.io.*; -import java.util.Iterator; -import java.util.List; - -/** - * @version <$CURRENT_VERSION$> - */ -public class PertFigure extends CompositeFigure { - private static final int BORDER = 3; - private Rectangle fDisplayBox; - private List fPreTasks; - private List fPostTasks; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -7877776240236946511L; - private int pertFigureSerializedDataVersion = 1; - - public PertFigure() { - initialize(); - } - - public int start() { - int start = 0; - Iterator iter = fPreTasks.iterator(); - while (iter.hasNext()) { - PertFigure f = (PertFigure)iter.next(); - start = Math.max(start, f.end()); - } - return start; - } - - public int end() { - return asInt(2); - } - - public int duration() { - return asInt(1); - } - - public void setEnd(int value) { - setInt(2, value); - } - - public void addPreTask(PertFigure figure) { - if (!fPreTasks.contains(figure)) { - fPreTasks.add(figure); - } - } - - public void addPostTask(PertFigure figure) { - if (!fPostTasks.contains(figure)) { - fPostTasks.add(figure); - } - } - - public void removePreTask(PertFigure figure) { - fPreTasks.remove(figure); - } - - public void removePostTask(PertFigure figure) { - fPostTasks.remove(figure); - } - - private int asInt(int figureIndex) { - NumberTextFigure t = (NumberTextFigure)figureAt(figureIndex); - return t.getValue(); - } - - private String taskName() { - TextFigure t = (TextFigure)figureAt(0); - return t.getText(); - } - - private void setInt(int figureIndex, int value) { - NumberTextFigure t = (NumberTextFigure)figureAt(figureIndex); - t.setValue(value); - } - - protected void basicMoveBy(int x, int y) { - fDisplayBox.translate(x, y); - super.basicMoveBy(x, y); - } - - public Rectangle displayBox() { - return new Rectangle( - fDisplayBox.x, - fDisplayBox.y, - fDisplayBox.width, - fDisplayBox.height); - } - - public void basicDisplayBox(Point origin, Point corner) { - fDisplayBox = new Rectangle(origin); - fDisplayBox.add(corner); - layout(); - } - - private void drawBorder(Graphics g) { - super.draw(g); - - Rectangle r = displayBox(); - - Figure f = figureAt(0); - Rectangle rf = f.displayBox(); - g.setColor(Color.gray); - g.drawLine(r.x, r.y+rf.height+2, r.x+r.width, r.y + rf.height+2); - g.setColor(Color.white); - g.drawLine(r.x, r.y+rf.height+3, r.x+r.width, r.y + rf.height+3); - - g.setColor(Color.white); - g.drawLine(r.x, r.y, r.x, r.y + r.height); - g.drawLine(r.x, r.y, r.x + r.width, r.y); - g.setColor(Color.gray); - g.drawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height); - g.drawLine(r.x , r.y + r.height, r.x + r.width, r.y + r.height); - } - - public void draw(Graphics g) { - drawBorder(g); - super.draw(g); - } - - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - handles.add(new NullHandle(this, RelativeLocator.northWest())); - handles.add(new NullHandle(this, RelativeLocator.northEast())); - handles.add(new NullHandle(this, RelativeLocator.southWest())); - handles.add(new NullHandle(this, RelativeLocator.southEast())); - handles.add(new ConnectionHandle(this, RelativeLocator.east(), - new PertDependency()) - ); - return new HandleEnumerator(handles); - } - - private void initialize() { - fPostTasks = CollectionsFactory.current().createList(); - fPreTasks = CollectionsFactory.current().createList(); - fDisplayBox = new Rectangle(0, 0, 0, 0); - - Font f = new Font("Helvetica", Font.PLAIN, 12); - Font fb = new Font("Helvetica", Font.BOLD, 12); - - TextFigure name = new TextFigure(); - name.setFont(fb); - name.setText("Task"); - //name.setAttribute(FigureAttributeConstant.TEXT_COLOR.getName(), Color.white); - add(name); - - NumberTextFigure duration = new NumberTextFigure(); - duration.setValue(0); - duration.setFont(fb); - add(duration); - - NumberTextFigure end = new NumberTextFigure(); - end.setValue(0); - end.setFont(f); - end.setReadOnly(true); - add(end); - } - - private void layout() { - Point partOrigin = new Point(fDisplayBox.x, fDisplayBox.y); - partOrigin.translate(BORDER, BORDER); - Dimension extent = new Dimension(0, 0); - - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - - Dimension partExtent = f.size(); - Point corner = new Point( - partOrigin.x+partExtent.width, - partOrigin.y+partExtent.height); - f.basicDisplayBox(partOrigin, corner); - - extent.width = Math.max(extent.width, partExtent.width); - extent.height += partExtent.height; - partOrigin.y += partExtent.height; - } - fDisplayBox.width = extent.width + 2*BORDER; - fDisplayBox.height = extent.height + 2*BORDER; - } - - private boolean needsLayout() { - Dimension extent = new Dimension(0, 0); - - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - extent.width = Math.max(extent.width, f.size().width); - } - int newExtent = extent.width + 2*BORDER; - return newExtent != fDisplayBox.width; - } - - public void update(FigureChangeEvent e) { - if (e.getFigure() == figureAt(1)) { - // duration has changed - updateDurations(); - } - if (needsLayout()) { - layout(); - changed(); - } - } - - public void figureChanged(FigureChangeEvent e) { - update(e); - } - - - public void figureRemoved(FigureChangeEvent e) { - update(e); - } - - public void notifyPostTasks() { - Iterator iter = fPostTasks.iterator(); - while (iter.hasNext()) { - ((PertFigure)iter.next()).updateDurations(); - } - } - - public void updateDurations() { - int newEnd = start()+duration(); - if (newEnd != end()) { - setEnd(newEnd); - notifyPostTasks(); - } - } - - public boolean hasCycle(Figure start) { - if (start == this) { - return true; - } - Iterator iter = fPreTasks.iterator(); - while (iter.hasNext()) { - if (((PertFigure)iter.next()).hasCycle(start)) { - return true; - } - } - return false; - } - - //-- store / load ---------------------------------------------- - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fDisplayBox.x); - dw.writeInt(fDisplayBox.y); - dw.writeInt(fDisplayBox.width); - dw.writeInt(fDisplayBox.height); - - writeTasks(dw, fPreTasks); - writeTasks(dw, fPostTasks); - } - - public void writeTasks(StorableOutput dw, List l) { - dw.writeInt(l.size()); - Iterator iter = l.iterator(); - while (iter.hasNext()) { - dw.writeStorable((Storable)iter.next()); - } - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fDisplayBox = new Rectangle( - dr.readInt(), - dr.readInt(), - dr.readInt(), - dr.readInt()); - layout(); - fPreTasks = readTasks(dr); - fPostTasks = readTasks(dr); - } - - public Insets connectionInsets() { - Rectangle r = fDisplayBox; - int cx = r.width/2; - int cy = r.height/2; - return new Insets(cy, cx, cy, cx); - } - - public List readTasks(StorableInput dr) throws IOException { - int size = dr.readInt(); - List l = CollectionsFactory.current().createList(size); - for (int i=0; i<size; i++) { - l.add(dr.readStorable()); - } - return l; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/PertFigureCreationTool.java b/JHotDraw/src/CH/ifa/draw/samples/pert/PertFigureCreationTool.java deleted file mode 100644 index 027351ff5e4a762598cd6c990ff1a8335a465a41..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/samples/pert/PertFigureCreationTool.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * @(#)PertFigureCreationTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.samples.pert; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; - -/** - * A more efficient version of the generic Pert creation - * tool that is not based on cloning. - * - * @version <$CURRENT_VERSION$> - */ -public class PertFigureCreationTool extends CreationTool { - - public PertFigureCreationTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - /** - * Creates a new PertFigure. - */ - protected Figure createFigure() { - return new PertFigure(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT1.gif b/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT1.gif deleted file mode 100644 index f69744556b8a98b0f903febf45498dd09fcde923..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT1.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT2.gif b/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT2.gif deleted file mode 100644 index eb9f10ef03f573d2d7c08a805dee7264cabd6ef1..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT2.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT3.gif b/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT3.gif deleted file mode 100644 index aac7c5e3ad403e29fb246df6eb318f71ef45be0c..0000000000000000000000000000000000000000 Binary files a/JHotDraw/src/CH/ifa/draw/samples/pert/images/PERT3.gif and /dev/null differ diff --git a/JHotDraw/src/CH/ifa/draw/standard.jdo b/JHotDraw/src/CH/ifa/draw/standard.jdo deleted file mode 100644 index 62c33480a35cebe350f6f22f0da0e6b8846260ee..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard.jdo +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jdo SYSTEM "jdo.dtd"> -<jdo> - <package name="CH.ifa.draw.standard"> - <class name="AbstractFigure"> - <field name="fListener" persistence-modifier="persistent"> - </field> - </class> - <class name="CompositeFigure"> -<!-- - <field name="fFigures"> - <extension vendor-name="FastObjects" key="serialized" value="true"/> - </field> ---> - </class> - <class name="ChopBoxConnector"> - </class> - <class name="DecoratorFigure"> - </class> - <class name="LocatorConnector"> - </class> - <class name="PeripheralLocator"> - </class> - <class name="OffsetLocator"> - </class> - <class name="RelativeLocator"> - </class> - <class name="StandardDrawing"> - </class> - </package> -</jdo> diff --git a/JHotDraw/src/CH/ifa/draw/standard/AWTCursor.java b/JHotDraw/src/CH/ifa/draw/standard/AWTCursor.java deleted file mode 100644 index a01ee1129ed6e36bc4dd586a26a1fc29dcf956a0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AWTCursor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * @(#)AWTCursor.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.standard; - -import java.awt.Cursor; - -/** - * Default implementation of the {@link CH.ifa.draw.framework.Cursor} interface - * for AWT/Swing. - * - * <p>Created on: 08/05/2003.</p> - * - * @version $Revision$ - * @author <a href="mailto:ricardo_padilha@users.sourceforge.net">Ricardo - * Sangoi Padilha</a> - * @see CH.ifa.draw.framework.Cursor - */ -public class AWTCursor extends Cursor implements CH.ifa.draw.framework.Cursor { - - /** - * Constructor for <code>AWTCursor</code>. - * @param type - * @see Cursor#Cursor(int) - */ - public AWTCursor(int type) { - super(type); - } - - /** - * Constructor for <code>AWTCursor</code>. - * @param name - * @see Cursor#Cursor(java.lang.String) - */ - public AWTCursor(String newName) { - super(newName); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/AbstractCommand.java b/JHotDraw/src/CH/ifa/draw/standard/AbstractCommand.java deleted file mode 100644 index 45152da2022116462688afaf62f661be06cb3a6c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AbstractCommand.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * @(#)AbstractCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Command; -import CH.ifa.draw.util.CommandListener; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.*; - -/** - * @author Helge Horch - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractCommand implements Command, FigureSelectionListener { - - private String myName; - private Undoable myUndoableActivity; - private boolean myIsViewRequired; - private AbstractCommand.EventDispatcher myEventDispatcher; - - /** - * the DrawingEditor this command applies to - */ - private DrawingEditor myDrawingEditor; - - /** - * Constructs a command with the given name that applies to the given view. - * @param newName java.lang.String - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public AbstractCommand(String newName, DrawingEditor newDrawingEditor) { - this(newName, newDrawingEditor, true); - } - - public AbstractCommand(String newName, DrawingEditor newDrawingEditor, boolean newIsViewRequired) { - setName(newName); - setDrawingEditor(newDrawingEditor); - getDrawingEditor().addViewChangeListener(createViewChangeListener()); - myIsViewRequired = newIsViewRequired; - setEventDispatcher(createEventDispatcher()); - } - - protected void viewSelectionChanged(DrawingView oldView, DrawingView newView) { - if (oldView != null) { - oldView.removeFigureSelectionListener(this); - } - if (newView != null) { - newView.addFigureSelectionListener(this); - } - if (isViewRequired()) { - boolean isOldViewInteractive = (oldView != null) && oldView.isInteractive(); - boolean isNewViewInteractive = (newView != null) && newView.isInteractive(); - // old view was not interactive aware while new view is now interactive aware - if (!isOldViewInteractive && isNewViewInteractive) { - getEventDispatcher().fireCommandExecutableEvent(); - } - // old view was interactive aware while new view is not - else if (isOldViewInteractive && !isNewViewInteractive) { - getEventDispatcher().fireCommandNotExecutableEvent(); - } - } - } - - /** - * Sent when a new view is created - */ - protected void viewCreated(DrawingView view) { - } - - /** - * Send when an existing view is about to be destroyed. - */ - protected void viewDestroying(DrawingView view) { - } - - /** - * @param view a DrawingView - */ - public void figureSelectionChanged(DrawingView view) { - } - - /** - * @return DrawingEditor associated with this command - */ - public DrawingEditor getDrawingEditor() { - return myDrawingEditor; - } - - private void setDrawingEditor(DrawingEditor newDrawingEditor) { - myDrawingEditor = newDrawingEditor; - } - - /** - * Convenience method - * - * @return DrawingView currently active in the editor - */ - public DrawingView view() { - return getDrawingEditor().view(); - } - - /** - * Gets the command name. - */ - public String name() { - return myName; - } - - public void setName(String newName) { - myName = newName; - } - - /** - * Releases resources associated with this command - */ - public void dispose() { - if (view() != null) { - view().removeFigureSelectionListener(this); - } - } - - /** - * Executes the command. - */ - public void execute() { - if (view() == null) { - throw new JHotDrawRuntimeException("execute should NOT be getting called when view() == null"); - } - } - - /** - * Tests if the command can be executed. The view must be valid when this is - * called. Per default, a command is executable if at - * least one figure is selected in the current activated - * view. - */ - public boolean isExecutable() { - // test whether there is a view required and whether an existing view - // accepts user input - if (isViewRequired()) { - if ((view() == null) || !view().isInteractive()) { - return false; - } - } - return isExecutableWithView(); - } - - protected boolean isViewRequired() { - return myIsViewRequired; - } - - protected boolean isExecutableWithView() { - return true; - } - - public Undoable getUndoActivity() { - return myUndoableActivity; - } - - public void setUndoActivity(Undoable newUndoableActivity) { - myUndoableActivity = newUndoableActivity; - } - - public void addCommandListener(CommandListener newCommandListener) { - getEventDispatcher().addCommandListener(newCommandListener); - } - - public void removeCommandListener(CommandListener oldCommandListener) { - getEventDispatcher().removeCommandListener(oldCommandListener); - } - - private void setEventDispatcher(AbstractCommand.EventDispatcher newEventDispatcher) { - myEventDispatcher = newEventDispatcher; - } - - protected AbstractCommand.EventDispatcher getEventDispatcher() { - return myEventDispatcher; - } - - protected AbstractCommand.EventDispatcher createEventDispatcher() { - return new AbstractCommand.EventDispatcher(this); - } - - protected ViewChangeListener createViewChangeListener() { - return new ViewChangeListener() { - public void viewSelectionChanged(DrawingView oldView, DrawingView newView){ - AbstractCommand.this.viewSelectionChanged(oldView, newView); - } - public void viewCreated(DrawingView view){ - AbstractCommand.this.viewCreated(view); - } - public void viewDestroying(DrawingView view){ - AbstractCommand.this.viewDestroying(view); - } - }; - } - - public static class EventDispatcher { - private List myRegisteredListeners; - private Command myObservedCommand; - - public EventDispatcher(Command newObservedCommand) { - myRegisteredListeners = CollectionsFactory.current().createList(); - myObservedCommand = newObservedCommand; - } - - public void fireCommandExecutedEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((CommandListener)iter.next()).commandExecuted(new EventObject(myObservedCommand)); - } - } - - public void fireCommandExecutableEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((CommandListener)iter.next()).commandExecutable(new EventObject(myObservedCommand)); - } - } - - public void fireCommandNotExecutableEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((CommandListener)iter.next()).commandNotExecutable(new EventObject(myObservedCommand)); - } - } - - public void addCommandListener(CommandListener newCommandListener) { - if (!myRegisteredListeners.contains(newCommandListener)) { - myRegisteredListeners.add(newCommandListener); - } - } - - public void removeCommandListener(CommandListener oldCommandListener) { - if (myRegisteredListeners.contains(oldCommandListener)) { - myRegisteredListeners.remove(oldCommandListener); - } - } - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/standard/AbstractConnector.java b/JHotDraw/src/CH/ifa/draw/standard/AbstractConnector.java deleted file mode 100644 index b0c84d8988c04ab40e21e8c4b3f4903f6b9e367e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AbstractConnector.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)AbstractConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.io.IOException; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -/** - * AbstractConnector provides default implementation for - * the Connector interface. - * - * @see Connector - * - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractConnector implements Connector { - /** - * the owner of the connector - */ - private Figure fOwner; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -5170007865562687545L; - private int abstractConnectorSerializedDataVersion = 1; - - /** - * Constructs a connector that has no owner. It is only - * used internally to resurrect a connectors from a - * StorableOutput. It should never be called directly. - */ - public AbstractConnector() { - fOwner = null; - } - - /** - * Constructs a connector with the given owner figure. - */ - public AbstractConnector(Figure owner) { - fOwner = owner; - } - - /** - * Gets the connector's owner. - * Which is the figure this is attached too and NOT the connection it may be - * attached too. - * - */ - public Figure owner() { - return fOwner; - } - - public Point findStart(ConnectionFigure connection) { - return findPoint(connection); - } - - public Point findEnd(ConnectionFigure connection) { - return findPoint(connection); - } - - /** - * Gets the connection point. Override when the connector - * does not need to distinguish between the start and end - * point of a connection. - */ - protected Point findPoint(ConnectionFigure connection) { - return Geom.center(displayBox()); - } - - /** - * Gets the display box of the connector. - */ - public Rectangle displayBox() { - return owner().displayBox(); - } - - /** - * Tests if a point is contained in the connector. - */ - public boolean containsPoint(int x, int y) { - return owner().containsPoint(x, y); - } - - /** - * Draws this connector. By default connectors are invisible. - */ - public void draw(Graphics g) { - // invisible by default - } - - /** - * Stores the connector and its owner to a StorableOutput. - */ - public void write(StorableOutput dw) { - dw.writeStorable(owner()); - } - - /** - * Reads the connector and its owner from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - fOwner = (Figure)dr.readStorable(); - } - - /** - * Requests that the connector should show itself or hide itself. The - * ConnectionFigure which desires to connect to this Connector is passed in. - * It a connector should show itself it should do so when draw is called, if - * so desired. - */ - public void connectorVisibility(boolean isVisible, ConnectionFigure courtingConnection) { - //invisible by default - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/AbstractFigure.java b/JHotDraw/src/CH/ifa/draw/standard/AbstractFigure.java deleted file mode 100644 index ceb9eb2b91e64dd451df32301fd751210ade88ff..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AbstractFigure.java +++ /dev/null @@ -1,482 +0,0 @@ -/* - * @(#)AbstractFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; - -import java.awt.*; -import java.util.List; -import java.io.*; - -/** - * AbstractFigure provides default implementations for - * the Figure interface. - * - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld036.htm>Template Method</a></b><br> - * Template Methods implement default and invariant behavior for - * figure subclasses. - * <hr> - * - * @see Figure - * @see Handle - * - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractFigure implements Figure { - - /** - * The listeners for a figure's changes. - * It is only one listener but this one can be a (chained) MultiCastFigureChangeListener - * @see #invalidate - * @see #changed - * @see #willChange - */ - private transient FigureChangeListener fListener; - - /** - * The dependend figures which have been added to this container. - */ - private List myDependendFigures; - - /* - * Serialization support. - */ - private static final long serialVersionUID = -10857585979273442L; - private int abstractFigureSerializedDataVersion = 1; - private int _nZ; - - protected AbstractFigure() { - myDependendFigures = CollectionsFactory.current().createList(); - } - - /** - * Moves the figure by the given offset. - */ - public void moveBy(int dx, int dy) { - willChange(); - basicMoveBy(dx, dy); - changed(); - } - - /** - * Moves the figure. This is the - * method that subclassers override. Clients usually - * call displayBox. - * @see #moveBy - */ - protected abstract void basicMoveBy(int dx, int dy); - - /** - * Changes the display box of a figure. Clients usually - * call this method. It changes the display box - * and announces the corresponding change. - * @param origin the new origin - * @param corner the new corner - * @see #displayBox - */ - public void displayBox(Point origin, Point corner) { - willChange(); - basicDisplayBox(origin, corner); - changed(); - } - - /** - * Sets the display box of a figure. This is the - * method that subclassers override. Clients usually - * call displayBox. - * @see #displayBox - */ - public abstract void basicDisplayBox(Point origin, Point corner); - - /** - * Gets the display box of a figure. - */ - public abstract Rectangle displayBox(); - - /** - * Returns the handles of a Figure that can be used - * to manipulate some of its attributes. - * @return a type-safe iterator of handles - * @see Handle - */ - public abstract HandleEnumeration handles(); - - /** - * Returns an Enumeration of the figures contained in this figure. - * @see CompositeFigure - */ - public FigureEnumeration figures() { - return FigureEnumerator.getEmptyEnumeration(); - } - - /** - * Gets the size of the figure. A convenience method. - */ - public Dimension size() { - return new Dimension(displayBox().width, displayBox().height); - } - - /** - * Checks if the figure is empty. The default implementation returns - * true if the width or height of its display box is < 3 - * @see Figure#isEmpty - */ - public boolean isEmpty() { - return (size().width < 3) || (size().height < 3); - } - - /** - * Returns the figure that contains the given point. - * In contrast to containsPoint it returns its - * innermost figure that contains the point. - * - * @see #containsPoint - */ - public Figure findFigureInside(int x, int y) { - if (containsPoint(x, y)) { - return this; - } - return null; - } - - /** - * Checks if a point is inside the figure. - */ - public boolean containsPoint(int x, int y) { - return displayBox().contains(x, y); - } - - /** - * Changes the display box of a figure. This is a - * convenience method. Implementors should only - * have to override basicDisplayBox - * @see #displayBox - */ - public void displayBox(Rectangle r) { - displayBox(new Point(r.x, r.y), new Point(r.x+r.width, r.y+r.height)); - } - - /** - * Checks whether the given figure is contained in this figure. - */ - public boolean includes(Figure figure) { - return figure == this; - } - - /** - * Decomposes a figure into its parts. It returns a FigureEnumeration - * that contains itself. - * @return an Enumeration with itself as the only element. - */ - public FigureEnumeration decompose() { - List figures = CollectionsFactory.current().createList(1); - figures.add(this); - return new FigureEnumerator(figures); - } - - /** - * Sets the Figure's container and registers the container - * as a figure change listener. A figure's container can be - * any kind of FigureChangeListener. A figure is not restricted - * to have a single container. - */ - public void addToContainer(FigureChangeListener c) { - addFigureChangeListener(c); - invalidate(); - } - - /** - * Removes a figure from the given container and unregisters - * it as a change listener. - */ - public void removeFromContainer(FigureChangeListener c) { - invalidate(); - removeFigureChangeListener(c); - } - - /** - * Adds a listener for this figure. - */ - public synchronized void addFigureChangeListener(FigureChangeListener l) { - fListener = FigureChangeEventMulticaster.add(listener(), l); - } - - /** - * Removes a listener for this figure. - */ - public synchronized void removeFigureChangeListener(FigureChangeListener l) { - fListener = FigureChangeEventMulticaster.remove(listener(), l); - } - - /** - * Gets the figure's listners. - */ - public synchronized FigureChangeListener listener() { - return fListener; - } - - /** - * A figure is released from the drawing. You never call this - * method directly. Release notifies its listeners. - * @see Figure#release - */ - public void release() { - if (listener() != null) { - listener().figureRemoved(new FigureChangeEvent(this)); - } - } - - /** - * Invalidates the figure. This method informs the listeners - * that the figure's current display box is invalid and should be - * refreshed. - */ - public void invalidate() { - if (listener() != null) { - Rectangle r = invalidateRectangle(displayBox()); - listener().figureInvalidated(new FigureChangeEvent(this, r)); - } - } - - /** - * Hook method to change the rectangle that will be invalidated - */ - protected Rectangle invalidateRectangle(Rectangle r) { - r.grow(Handle.HANDLESIZE, Handle.HANDLESIZE); - return r; - } - - /** - * Informes that a figure is about to change something that - * affects the contents of its display box. - * - * @see Figure#willChange - */ - public void willChange() { - // call invalidate before the change occurs to invalidate the old display area - invalidate(); - } - - /** - * Informs that a figure changed the area of its display box. - * - * @see FigureChangeEvent - * @see Figure#changed - */ - public void changed() { - invalidate(); - if (listener() != null) { - listener().figureChanged(new FigureChangeEvent(this)); - } - } - - /** - * Gets the center of a figure. A convenice - * method that is rarely overridden. - */ - public Point center() { - return Geom.center(displayBox()); - } - - /** - * Checks if this figure can be connected. By default - * AbstractFigures can be connected. - */ - public boolean canConnect() { - return true; - } - - /** - * Returns the connection inset. The connection inset - * defines the area where the display box of a - * figure can't be connected. By default the entire - * display box can be connected. - * - */ - public Insets connectionInsets() { - return new Insets(0, 0, 0, 0); - } - - /** - * Returns the Figures connector for the specified location. - * By default a ChopBoxConnector is returned. - * @see ChopBoxConnector - */ - public Connector connectorAt(int x, int y) { - return new ChopBoxConnector(this); - } - - /** - * Sets whether the connectors should be visible. - * By default they are not visible - */ - public void connectorVisibility(boolean isVisible, ConnectionFigure connector) { - } - - /** - * Returns the locator used to located connected text. - */ - public Locator connectedTextLocator(Figure text) { - return RelativeLocator.center(); - } - - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * By default figures don't have any attributes so getAttribute - * returns null. - * - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - return null; - } - - /** - * Returns the named attribute or null if a - * a figure doesn't have an attribute. - * By default figures don't have any attributes getAttribute - * returns null. - */ - public Object getAttribute(FigureAttributeConstant attributeConstant) { - return null; - } - - /** - * Sets the named attribute to the new value. By default - * figures don't have any attributes and the request is ignored. - * - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - } - - /** - * Sets the named attribute to the new value. By default - * figures don't have any attributes and the request is ignored. - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - } - - /** - * Clones a figure. Creates a clone by using the storable - * mechanism to flatten the Figure to stream followed by - * resurrecting it from the same stream. - * - * @see Figure#clone - */ - public Object clone() { - Object clone = null; - ByteArrayOutputStream output = new ByteArrayOutputStream(200); - try { - ObjectOutput writer = new ObjectOutputStream(output); - writer.writeObject(this); - writer.close(); - } - catch (IOException e) { - System.err.println("Class not found: " + e); - } - - InputStream input = new ByteArrayInputStream(output.toByteArray()); - try { - ObjectInput reader = new ObjectInputStream(input); - clone = reader.readObject(); - } - catch (IOException e) { - System.err.println(e.toString()); - } - catch (ClassNotFoundException e) { - System.err.println("Class not found: " + e); - } - return clone; - } - - /** - * Stores the Figure to a StorableOutput. - */ - public void write(StorableOutput dw) { - } - - /** - * Reads the Figure from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - } - - /** - * Gets the z value (back-to-front ordering) of this figure. - */ - public int getZValue() { - return _nZ; - } - - /** - * Sets the z value (back-to-front ordering) of this figure. - */ - public void setZValue(int z) { - _nZ = z; - } - - public void visit(FigureVisitor visitor) { - // remember original listener as listeners might be changed by a visitor - // (e.g. by calling addToContainer() or removeFromContainer()) - //FigureChangeListener originalListener = listener(); - FigureEnumeration fe = getDependendFigures(); - - visitor.visitFigure(this); - - FigureEnumeration visitFigures = figures(); - while (visitFigures.hasNextFigure()) { - visitFigures.nextFigure().visit(visitor); - } - - HandleEnumeration visitHandles = handles(); - while (visitHandles.hasNextHandle()) { - visitor.visitHandle(visitHandles.nextHandle()); - } -/* - originalListener = listener(); - if (originalListener != null) { - visitor.visitFigureChangeListener(originalListener); - } -*/ - - while (fe.hasNextFigure()) { - fe.nextFigure().visit(visitor); - // or visitor.visitDependendFigure(fe.nextFigure()); - } - } - - public synchronized FigureEnumeration getDependendFigures() { - return new FigureEnumerator(myDependendFigures); - } - - public synchronized void addDependendFigure(Figure newDependendFigure) { - myDependendFigures.add(newDependendFigure); - } - - public synchronized void removeDependendFigure(Figure oldDependendFigure) { - myDependendFigures.remove(oldDependendFigure); - } - - public TextHolder getTextHolder() { - return null; - } - - public Figure getDecoratedFigure() { - return this; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/AbstractHandle.java b/JHotDraw/src/CH/ifa/draw/standard/AbstractHandle.java deleted file mode 100644 index c901ea18fac8d3348b21234750ae51ceac388574..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AbstractHandle.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * @(#)AbstractHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Undoable; - -/** - * AbstractHandle provides defaulf implementation for the Handle interface. - * - * @see CH.ifa.draw.framework.Figure - * @see CH.ifa.draw.framework.Handle - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractHandle implements Handle { - - /** - * The standard size of a handle. - */ - public static final int HANDLESIZE = 8; - - private Figure fOwner; - private Undoable myUndoableActivity; - - /** - * Constructor for <code>AbstractHandle</code>. - * Initializes the owner of the figure. - * @param owner - */ - public AbstractHandle(Figure owner) { - fOwner = owner; - } - - /** - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @param view the handles container - * @see CH.ifa.draw.framework.Handle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - public void invokeStart(int x, int y, DrawingView view) { - invokeStart(x, y, view.drawing()); - } - - - /** - * Tracks the start of the interaction. The default implementation - * does nothing. - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @see CH.ifa.draw.framework.Handle#invokeStart(int, int, CH.ifa.draw.framework.Drawing) - * @deprecated As of version 4.1, - * use invokeStart(x, y, drawingView) - */ - public void invokeStart(int x, int y, Drawing drawing) { } - - /** - * Tracks a step of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - * @see CH.ifa.draw.framework.Handle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - public void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view) { - invokeStep(x-anchorX, y-anchorY, view.drawing()); - } - - /** - * Tracks a step of the interaction. - * @param dx x delta of this step - * @param dy y delta of this step - * @see CH.ifa.draw.framework.Handle#invokeStep(int, int, CH.ifa.draw.framework.Drawing) - * @deprecated As of version 4.1, - * use invokeStep(x, y, anchorX, anchorY, drawingView) - */ - public void invokeStep(int dx, int dy, Drawing drawing) { } - - /** - * Tracks the end of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - * @see CH.ifa.draw.framework.Handle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - invokeEnd(x-anchorX, y-anchorY, view.drawing()); - } - - /** - * Tracks the end of the interaction. - * @see CH.ifa.draw.framework.Handle#invokeEnd(int, int, CH.ifa.draw.framework.Drawing) - * @deprecated As of version 4.1, - * use invokeEnd(x, y, anchorX, anchorY, drawingView). - */ - public void invokeEnd(int dx, int dy, Drawing drawing) { } - - /** - * Gets the handle's owner. - * @see CH.ifa.draw.framework.Handle#owner() - */ - public Figure owner() { - return fOwner; - } - - /** - * Gets the display box of the handle. - * @see CH.ifa.draw.framework.Handle#displayBox() - */ - public Rectangle displayBox() { - Point p = locate(); - return new Rectangle( - p.x - HANDLESIZE / 2, - p.y - HANDLESIZE / 2, - HANDLESIZE, - HANDLESIZE); - } - - /** - * Tests if a point is contained in the handle. - * @see CH.ifa.draw.framework.Handle#containsPoint(int, int) - */ - public boolean containsPoint(int x, int y) { - return displayBox().contains(x, y); - } - - /** - * Draws this handle. - * @see CH.ifa.draw.framework.Handle#draw(java.awt.Graphics) - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.white); - g.fillRect(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawRect(r.x, r.y, r.width, r.height); - } - - /** - * @see CH.ifa.draw.framework.Handle#getUndoActivity() - */ - public Undoable getUndoActivity() { - return myUndoableActivity; - } - - /** - * @see CH.ifa.draw.framework.Handle#setUndoActivity(CH.ifa.draw.util.Undoable) - */ - public void setUndoActivity(Undoable newUndoableActivity) { - myUndoableActivity = newUndoableActivity; - } - - /** - * @see CH.ifa.draw.framework.Handle#getCursor() - */ - public Cursor getCursor() { - return new AWTCursor(AWTCursor.DEFAULT_CURSOR); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/AbstractLocator.java b/JHotDraw/src/CH/ifa/draw/standard/AbstractLocator.java deleted file mode 100644 index b9861b09793a42e40829bad80551fe29d27171bc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AbstractLocator.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)AbstractLocator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; - -import java.io.IOException; - - -/** - * AbstractLocator provides default implementations for - * the Locator interface. - * - * @see Locator - * @see Handle - * - * @version <$CURRENT_VERSION$> - */ -public abstract class AbstractLocator implements Locator, Storable, Cloneable { - - /* - * Serialization support. - */ - private static final long serialVersionUID = -7742023180844048409L; - - protected AbstractLocator() { - } - - public Object clone() { - try { - return super.clone(); - } - catch (CloneNotSupportedException e) { - throw new InternalError(); - } - } - - /** - * Stores the arrow tip to a StorableOutput. - */ - public void write(StorableOutput dw) { - } - - /** - * Reads the arrow tip from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - } -} - - diff --git a/JHotDraw/src/CH/ifa/draw/standard/AbstractTool.java b/JHotDraw/src/CH/ifa/draw/standard/AbstractTool.java deleted file mode 100644 index 362ba84842cc72f8b393acd7a0bb5cd9b20d64b1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AbstractTool.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * @(#)AbstractTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.util.EventObject; -import java.util.Iterator; -import java.util.List; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.Undoable; - -/** - * Default implementation support for Tools. - * - * @see DrawingView - * @see Tool - * - * @version <$CURRENT_VERSION$> - */ - -public abstract class AbstractTool implements Tool { - - private DrawingEditor myDrawingEditor; - - /** - * The position of the initial mouse down. - * The anchor point is usually the first mouse click performed with this tool. - */ - private int myAnchorX; - private int myAnchorY; - - /** - * A tool can have a drawing view on which it operates - * independingly of the currently active drawing view. - * For example, if a tool can be used - */ - private DrawingView myDrawingView; - - private Undoable myUndoActivity; - private AbstractTool.EventDispatcher myEventDispatcher; - - private boolean myIsUsable; - - /** - * Flag to indicate whether to perform usable checks or not - */ - private boolean myIsEnabled; - - /** - * Constructs a tool for the given view. - */ - public AbstractTool(DrawingEditor newDrawingEditor) { - setEditor(newDrawingEditor); - setEventDispatcher(createEventDispatcher()); - setEnabled(true); - checkUsable(); - editor().addViewChangeListener(createViewChangeListener()); - } - - /** - * Activates the tool for use on the given view. This method is called - * whenever the user switches to this tool. Use this method to - * reinitialize a tool. - * Since tools will be disabled unless it is useable, there will always - * be an active view when this is called. based on isUsable() - * Tool should never be activated if the view is null. - * Ideally, the dditor should take care of that. - */ - public void activate() { - if (getActiveView() != null) { - getActiveView().clearSelection(); - getActiveView().checkDamage(); - getEventDispatcher().fireToolActivatedEvent(); - } - } - - /** - * Deactivates the tool. This method is called whenever the user - * switches to another tool. Use this method to do some clean-up - * when the tool is switched. Subclassers should always call - * super.deactivate. - * An inactive tool should never be deactivated - */ - public void deactivate() { - if (isActive()) { - if (getActiveView() != null) { - getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); - } - getEventDispatcher().fireToolDeactivatedEvent(); - } - } - - /** - * Fired when the selected view changes. - * Subclasses should always call super. ViewSelectionChanged() this allows - * the tools state to be updated and referenced to the new view. - */ - protected void viewSelectionChanged(DrawingView oldView, DrawingView newView) { - if (isActive()) { - deactivate(); - activate(); - } - - checkUsable(); - } - - /** - * Sent when a new view is created - */ - protected void viewCreated(DrawingView view) { - } - - /** - * Send when an existing view is about to be destroyed. - */ - protected void viewDestroying(DrawingView view) { - } - - /** - * Handles mouse down events in the drawing view. - */ - public void mouseDown(MouseEvent e, int x, int y) { - setAnchorX(x); - setAnchorY(y); - setView((DrawingView)e.getSource()); - } - - /** - * Handles mouse drag events in the drawing view. - */ - public void mouseDrag(MouseEvent e, int x, int y) { - } - - /** - * Handles mouse up in the drawing view. - */ - public void mouseUp(MouseEvent e, int x, int y) { -// setView(null);//This must be fixed!!! the view should not be held onto after mouse up?? -//unlike super.mousedown which is usually called immediately after a sub classes mouse down -//method starts, super.mouseup should probably be called last before the method ends? -//it must if its going to set the view to null. getting messy. - } - - /** - * Handles mouse moves (if the mouse button is up). - */ - public void mouseMove(MouseEvent evt, int x, int y) { - } - - /** - * Handles key down events in the drawing view. - */ - public void keyDown(KeyEvent evt, int key) { - } - - /** - * Gets the tool's drawing. - */ - public Drawing drawing() { - return view().drawing(); - } - - public Drawing getActiveDrawing() { - return getActiveView().drawing(); - } - - /** - * Gets the tool's editor. - */ - public DrawingEditor editor() { - return myDrawingEditor; - } - - protected void setEditor(DrawingEditor newDrawingEditor) { - myDrawingEditor = newDrawingEditor; - } - - /** - * Gets the tool's view (convienence method). - */ - public DrawingView view() { - return myDrawingView; - } - - protected void setView(DrawingView newDrawingView) { - myDrawingView = newDrawingView; - } - - public DrawingView getActiveView() { - return editor().view(); - } - - /** - * Tests if the tool can be used or "executed." - */ - public boolean isUsable() { - return isEnabled() && myIsUsable; - } - - public void setUsable(boolean newIsUsable) { - // perform notification only if the usable state of the tool has changed - if (isUsable() != newIsUsable) { - myIsUsable = newIsUsable; - if (isUsable()) { - getEventDispatcher().fireToolUsableEvent(); - } - else { - getEventDispatcher().fireToolUnusableEvent(); - } - } - } - - public void setEnabled(boolean newIsEnabled) { - // perform notification only if the usable state of the tool has changed - if (isEnabled() != newIsEnabled) { - myIsEnabled = newIsEnabled; - if (isEnabled()) { - getEventDispatcher().fireToolEnabledEvent(); - } - else { - getEventDispatcher().fireToolDisabledEvent(); - setUsable(false); - deactivate(); - } - } - } - - public boolean isEnabled() { - return myIsEnabled; - } - - /** - * The anchor point is usually the first mouse click performed with this tool. - * @see #mouseDown - */ - protected void setAnchorX(int newAnchorX) { - myAnchorX = newAnchorX; - } - - /** - * The anchor point is usually the first mouse click performed with this tool. - * - * @return the anchor X coordinate for the interaction - * @see #mouseDown - */ - protected int getAnchorX() { - return myAnchorX; - } - - /** - * The anchor point is usually the first mouse click performed with this tool. - * @see #mouseDown - */ - protected void setAnchorY(int newAnchorY) { - myAnchorY = newAnchorY; - } - - /** - * The anchor point is usually the first mouse click performed with this tool. - * - * @return the anchor Y coordinate for the interaction - * @see #mouseDown - */ - protected int getAnchorY() { - return myAnchorY; - } - - public Undoable getUndoActivity() { - return myUndoActivity; - } - - public void setUndoActivity(Undoable newUndoActivity) { - myUndoActivity = newUndoActivity; - } - - public boolean isActive() { - return (editor().tool() == this) && isUsable(); - } - - public void addToolListener(ToolListener newToolListener) { - getEventDispatcher().addToolListener(newToolListener); - } - - public void removeToolListener(ToolListener oldToolListener) { - getEventDispatcher().removeToolListener(oldToolListener); - } - - private void setEventDispatcher(AbstractTool.EventDispatcher newEventDispatcher) { - myEventDispatcher = newEventDispatcher; - } - - protected AbstractTool.EventDispatcher getEventDispatcher() { - return myEventDispatcher; - } - - protected AbstractTool.EventDispatcher createEventDispatcher() { - return new AbstractTool.EventDispatcher(this); - } - - protected ViewChangeListener createViewChangeListener() { - return new ViewChangeListener() { - public void viewSelectionChanged(DrawingView oldView, DrawingView newView){ - AbstractTool.this.viewSelectionChanged(oldView, newView); - } - public void viewCreated(DrawingView view){ - AbstractTool.this.viewCreated(view); - } - public void viewDestroying(DrawingView view){ - AbstractTool.this.viewDestroying(view); - } - }; - } - - protected void checkUsable() { - if (isEnabled()) { - setUsable((getActiveView() != null) && getActiveView().isInteractive()); - } - } - - public static class EventDispatcher { - private List myRegisteredListeners; - private Tool myObservedTool; - - public EventDispatcher(Tool newObservedTool) { - myRegisteredListeners = CollectionsFactory.current().createList(); - myObservedTool = newObservedTool; - } - - public void fireToolUsableEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((ToolListener)iter.next()).toolUsable(new EventObject(myObservedTool)); - } - } - - public void fireToolUnusableEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((ToolListener)iter.next()).toolUnusable(new EventObject(myObservedTool)); - } - } - - public void fireToolActivatedEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((ToolListener)iter.next()).toolActivated(new EventObject(myObservedTool)); - } - } - - public void fireToolDeactivatedEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((ToolListener)iter.next()).toolDeactivated(new EventObject(myObservedTool)); - } - } - - public void fireToolEnabledEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((ToolListener)iter.next()).toolEnabled(new EventObject(myObservedTool)); - } - } - - public void fireToolDisabledEvent() { - Iterator iter = myRegisteredListeners.iterator(); - while (iter.hasNext()) { - ((ToolListener)iter.next()).toolDisabled(new EventObject(myObservedTool)); - } - } - - public void addToolListener(ToolListener newToolListener) { - if (!myRegisteredListeners.contains(newToolListener)) { - myRegisteredListeners.add(newToolListener); - } - } - - public void removeToolListener(ToolListener oldToolListener) { - if (myRegisteredListeners.contains(oldToolListener)) { - myRegisteredListeners.remove(oldToolListener); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ActionTool.java b/JHotDraw/src/CH/ifa/draw/standard/ActionTool.java deleted file mode 100644 index 320ae5a3c9a710119cc1ac0ddf9bb81df58f89f6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ActionTool.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#)ActionTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; - -import java.awt.event.MouseEvent; - -/** - * A tool that performs an action when it is active and - * the mouse is clicked. - * - * @version <$CURRENT_VERSION$> - */ -public abstract class ActionTool extends AbstractTool { - - public ActionTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - /** - * Add the touched figure to the selection an invoke action - * @see #action - */ - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e,x,y); - Figure target = drawing().findFigure(x, y); - if (target != null) { - view().addToSelection(target); - action(target); - } - } - - public void mouseUp(MouseEvent e, int x, int y) { - editor().toolDone(); - } - - /** - * Performs an action with the touched figure. - */ - public abstract void action(Figure figure); -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/AlignCommand.java b/JHotDraw/src/CH/ifa/draw/standard/AlignCommand.java deleted file mode 100644 index 80f39276d27ca42bfea97c5cd6da1885c8464cbe..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/AlignCommand.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * @(#)AlignCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; -import java.util.*; -import java.awt.*; - -/** - * Align a selection of figures relative to each other. - * - * @version <$CURRENT_VERSION$> - */ -public class AlignCommand extends AbstractCommand { - - public static abstract class Alignment { - /** - * align left sides - */ - public final static Alignment LEFTS = new Alignment("Lefts") { - public void moveBy(Figure f, Rectangle anchor) { - Rectangle rr = f.displayBox(); - f.moveBy(anchor.x-rr.x, 0); - } - }; - - /** - * align centers (horizontally) - */ - public final static Alignment CENTERS = new Alignment("Centers") { - public void moveBy(Figure f, Rectangle anchor) { - Rectangle rr = f.displayBox(); - f.moveBy((anchor.x+anchor.width/2) - (rr.x+rr.width/2), 0); - } - }; - - /** - * align right sides - */ - public final static Alignment RIGHTS = new Alignment("Rights") { - public void moveBy(Figure f, Rectangle anchor) { - Rectangle rr = f.displayBox(); - f.moveBy((anchor.x+anchor.width) - (rr.x+rr.width), 0); - } - }; - - /** - * align tops - */ - public final static Alignment TOPS = new Alignment("Tops") { - public void moveBy(Figure f, Rectangle anchor) { - Rectangle rr = f.displayBox(); - f.moveBy(0, anchor.y-rr.y); - } - }; - - /** - * align middles (vertically) - */ - public final static Alignment MIDDLES = new Alignment("Middles") { - public void moveBy(Figure f, Rectangle anchor) { - Rectangle rr = f.displayBox(); - f.moveBy(0, (anchor.y+anchor.height/2) - (rr.y+rr.height/2)); - } - }; - - /** - * align bottoms - */ - public final static Alignment BOTTOMS = new Alignment("Bottoms") { - public void moveBy(Figure f, Rectangle anchor) { - Rectangle rr = f.displayBox(); - f.moveBy(0, (anchor.y+anchor.height) - (rr.y+rr.height)); - } - }; - - private String myDescription; - - private Alignment(String newDescription) { - setDescription(newDescription); - } - - public String toString() { - return getDescription(); - } - - public String getDescription() { - return myDescription; - } - - private void setDescription(String newDescription) { - myDescription = newDescription; - } - - public abstract void moveBy(Figure f, Rectangle anchor); - } - - private Alignment myAlignment; - - /** - * Constructs an alignment command. - * @param newAlignment the alignment operation (LEFTS, CENTERS, RIGHTS, etc.) - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public AlignCommand(Alignment newAlignment, DrawingEditor newDrawingEditor) { - super(newAlignment.getDescription(), newDrawingEditor); - setAlignment(newAlignment); - } - - protected boolean isExecutableWithView() { - return view().selectionCount() > 1; - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - // get selected figures in the order the figures have been selected - getUndoActivity().setAffectedFigures(view().selection()); - ((AlignCommand.UndoActivity)getUndoActivity()).alignAffectedFigures(getAlignment()); - view().checkDamage(); - } - - protected void setAlignment(Alignment newAlignment) { - myAlignment = newAlignment; - } - - public Alignment getAlignment() { - return myAlignment; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new AlignCommand.UndoActivity(view(), getAlignment()); - } - - public static class UndoActivity extends UndoableAdapter { - private Hashtable myOriginalPoints; - private Alignment myAppliedAlignment; - - public UndoActivity(DrawingView newView, Alignment newAlignment) { - super(newView); - myOriginalPoints = new Hashtable(); - setAppliedAlignment(newAlignment); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - Point originalPoint = getOriginalPoint(f); - Point currentPoint = f.displayBox().getLocation(); - // substract current lcoation to get to 0,0 and then move to original location - f.moveBy(-currentPoint.x + originalPoint.x, - -currentPoint.y + originalPoint.y); - } - - return true; - } - - public boolean redo() { - if (!isRedoable()) { - return false; - } - alignAffectedFigures(getAppliedAlignment()); - return true; - } - - protected void setAppliedAlignment(Alignment newAlignment) { - myAppliedAlignment = newAlignment; - } - - public Alignment getAppliedAlignment() { - return myAppliedAlignment; - } - - protected void addOriginalPoint(Figure f) { - myOriginalPoints.put(f, f.displayBox().getLocation()); - } - - public Point getOriginalPoint(Figure f) { - return (Point)myOriginalPoints.get(f); - } - - public void alignAffectedFigures(Alignment applyAlignment) { - FigureEnumeration fe = getAffectedFigures(); - Figure anchorFigure = fe.nextFigure(); - Rectangle r = anchorFigure.displayBox(); - - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - applyAlignment.moveBy(f, r); - } - } - - public void setAffectedFigures(FigureEnumeration fe) { - // first make copy of FigureEnumeration in superclass - super.setAffectedFigures(fe); - // then get new FigureEnumeration of copy to save aligment - FigureEnumeration copyFe = getAffectedFigures(); - while (copyFe.hasNextFigure()) { - addOriginalPoint(copyFe.nextFigure()); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/BoxHandleKit.java b/JHotDraw/src/CH/ifa/draw/standard/BoxHandleKit.java deleted file mode 100644 index d87f69ec59299475508e05cd5576daf3120b7893..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/BoxHandleKit.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * @(#)BoxHandleKit.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; -import java.awt.*; -import java.util.List; - -/** - * A set of utility methods to create Handles for the common - * locations on a figure's display box. - * - * @see Handle - * - * @version <$CURRENT_VERSION$> - */ - - // TBD: use anonymous inner classes (had some problems with JDK 1.1) - -public class BoxHandleKit { - - /** - * Fills the given collection with handles at each corner of a - * figure. - */ - static public void addCornerHandles(Figure f, List handles) { - handles.add(southEast(f)); - handles.add(southWest(f)); - handles.add(northEast(f)); - handles.add(northWest(f)); - } - - /** - * Fills the given collection with handles at each corner - * and the north, south, east, and west of the figure. - */ - static public void addHandles(Figure f, List handles) { - addCornerHandles(f, handles); - handles.add(south(f)); - handles.add(north(f)); - handles.add(east(f)); - handles.add(west(f)); - } - - static public Handle south(Figure owner) { - return new SouthHandle(owner); - } - - static public Handle southEast(Figure owner) { - return new SouthEastHandle(owner); - } - - static public Handle southWest(Figure owner) { - return new SouthWestHandle(owner); - } - - static public Handle north(Figure owner) { - return new NorthHandle(owner); - } - - static public Handle northEast(Figure owner) { - return new NorthEastHandle(owner); - } - - static public Handle northWest(Figure owner) { - return new NorthWestHandle(owner); - } - - static public Handle east(Figure owner) { - return new EastHandle(owner); - } - - static public Handle west(Figure owner) { - return new WestHandle(owner); - } -} - -class ResizeHandle extends LocatorHandle { - ResizeHandle(Figure owner, Locator loc) { - super(owner, loc); - } - - public void invokeStart(int x, int y, DrawingView view) { - setUndoActivity(createUndoActivity(view)); - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(owner())); - ((ResizeHandle.UndoActivity)getUndoActivity()).setOldDisplayBox(owner().displayBox()); - } - - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle oldDisplayBox = ((ResizeHandle.UndoActivity)getUndoActivity()).getOldDisplayBox(); - if (owner().displayBox().equals(oldDisplayBox)) { - // display box hasn't change so there is nothing to undo - setUndoActivity(null); - } - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected Undoable createUndoActivity(DrawingView view) { - return new ResizeHandle.UndoActivity(view); - } - - public static class UndoActivity extends UndoableAdapter { - private Rectangle myOldDisplayBox; - - public UndoActivity(DrawingView newView) { - super(newView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - return resetDisplayBox(); - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - return resetDisplayBox(); - } - - private boolean resetDisplayBox() { - FigureEnumeration fe = getAffectedFigures(); - if (!fe.hasNextFigure()) { - return false; - } - Figure currentFigure = fe.nextFigure(); - - Rectangle figureDisplayBox = currentFigure.displayBox(); - currentFigure.displayBox(getOldDisplayBox()); - setOldDisplayBox(figureDisplayBox); - return true; - } - - protected void setOldDisplayBox(Rectangle newOldDisplayBox) { - myOldDisplayBox = newOldDisplayBox; - } - - public Rectangle getOldDisplayBox() { - return myOldDisplayBox; - } - } -} - -class NorthEastHandle extends ResizeHandle { - NorthEastHandle(Figure owner) { - super(owner, RelativeLocator.northEast()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(r.x, Math.min(r.y + r.height, y)), - new Point(Math.max(r.x, x), r.y + r.height) - ); - } -} - -class EastHandle extends ResizeHandle { - EastHandle(Figure owner) { - super(owner, RelativeLocator.east()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(r.x, r.y), new Point(Math.max(r.x, x), r.y + r.height) - ); - } -} - -class NorthHandle extends ResizeHandle { - NorthHandle(Figure owner) { - super(owner, RelativeLocator.north()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(r.x, Math.min(r.y + r.height, y)), - new Point(r.x + r.width, r.y + r.height) - ); - } -} - -class NorthWestHandle extends ResizeHandle { - NorthWestHandle(Figure owner) { - super(owner, RelativeLocator.northWest()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(Math.min(r.x + r.width, x), Math.min(r.y + r.height, y)), - new Point(r.x + r.width, r.y + r.height) - ); - } -} - -class SouthEastHandle extends ResizeHandle { - SouthEastHandle(Figure owner) { - super(owner, RelativeLocator.southEast()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(r.x, r.y), - new Point(Math.max(r.x, x), Math.max(r.y, y)) - ); - } -} - -class SouthHandle extends ResizeHandle { - SouthHandle(Figure owner) { - super(owner, RelativeLocator.south()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(r.x, r.y), - new Point(r.x + r.width, Math.max(r.y, y)) - ); - } -} - -class SouthWestHandle extends ResizeHandle { - SouthWestHandle(Figure owner) { - super(owner, RelativeLocator.southWest()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(Math.min(r.x + r.width, x), r.y), - new Point(r.x + r.width, Math.max(r.y, y)) - ); - } -} - -class WestHandle extends ResizeHandle { - WestHandle(Figure owner) { - super(owner, RelativeLocator.west()); - } - - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Rectangle r = owner().displayBox(); - owner().displayBox( - new Point(Math.min(r.x + r.width, x), r.y), - new Point(r.x + r.width, r.y + r.height) - ); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/BringToFrontCommand.java b/JHotDraw/src/CH/ifa/draw/standard/BringToFrontCommand.java deleted file mode 100644 index 2b228c4c052c2796ccdc601f2b1cea73d03f1fd4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/BringToFrontCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * @(#)BringToFrontCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Undoable; - -/** - * BringToFrontCommand brings the selected figures in the front of - * the other figures. - * - * @see SendToBackCommand - * @version <$CURRENT_VERSION$> - */ -public class BringToFrontCommand extends AbstractCommand { - - /** - * Constructs a bring to front command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public BringToFrontCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures(view().selection()); - FigureEnumeration fe = getUndoActivity().getAffectedFigures(); - while (fe.hasNextFigure()) { - view().drawing().bringToFront(fe.nextFigure()); - } - view().checkDamage(); - } - - public boolean isExecutableWithView() { - return view().selectionCount() > 0; - } - - protected Undoable createUndoActivity() { - return new BringToFrontCommand.UndoActivity(view()); - } - - public static class UndoActivity extends SendToBackCommand.UndoActivity { - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - } - - protected void sendToCommand(Figure f) { - getDrawingView().drawing().bringToFront(f); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/BufferedUpdateStrategy.java b/JHotDraw/src/CH/ifa/draw/standard/BufferedUpdateStrategy.java deleted file mode 100644 index d5e91a173fb82fe74926e7e5299adbc7f60f7433..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/BufferedUpdateStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * @(#)BufferedUpdateStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import CH.ifa.draw.framework.*; - -/** - * The BufferedUpdateStrategy implements an update - * strategy that first draws a view into a buffer - * followed by copying the buffer to the DrawingView. - * - * @see DrawingView - * - * @version <$CURRENT_VERSION$> - */ -public class BufferedUpdateStrategy implements Painter { - - /** - * The offscreen image - */ - transient private Image fOffscreen; - private int fImagewidth = -1; - private int fImageheight = -1; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 6489532222954612824L; - private int bufferedUpdateSerializedDataVersion = 1; - - /** - * Draws the view contents. - */ - public void draw(Graphics g, DrawingView view) { - // create the buffer if necessary - Dimension d = view.getSize(); - if ((fOffscreen == null) || (d.width != fImagewidth) - || (d.height != fImageheight)) { - fOffscreen = view.createImage(d.width, d.height); - fImagewidth = d.width; - fImageheight = d.height; - } - - // let the view draw on offscreen buffer - Graphics g2 = fOffscreen.getGraphics(); - view.drawAll(g2); - - g.drawImage(fOffscreen, 0, 0, view); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ChangeAttributeCommand.java b/JHotDraw/src/CH/ifa/draw/standard/ChangeAttributeCommand.java deleted file mode 100644 index 050f4b8fa1e501e325de792587211455e637a081..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ChangeAttributeCommand.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @(#)ChangeAttributeCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; -import java.util.Hashtable; - -/** - * Command to change a named figure attribute. - * - * @version <$CURRENT_VERSION$> - */ -public class ChangeAttributeCommand extends AbstractCommand { - - private FigureAttributeConstant fAttribute; - private Object fValue; - - /** - * Constructs a change attribute command. - * @param name the command name - * @param attribute the attribute to be changed - * @param value the new attribute value - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public ChangeAttributeCommand(String name, FigureAttributeConstant attribute, - Object value, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - fAttribute = attribute; - fValue = value; - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures(view().selection()); - FigureEnumeration fe = getUndoActivity().getAffectedFigures(); - while (fe.hasNextFigure()) { - fe.nextFigure().setAttribute(fAttribute, fValue); - } - view().checkDamage(); - } - - public boolean isExecutableWithView() { - return view().selectionCount() > 0; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new ChangeAttributeCommand.UndoActivity(view(), fAttribute, fValue); - } - - public static class UndoActivity extends UndoableAdapter { - private FigureAttributeConstant myUndoAttribute; - private Hashtable myOriginalValues; - private Object myUndoValue; - - public UndoActivity(DrawingView newDrawingView, FigureAttributeConstant newUndoAttribute, Object newUndoValue) { - super(newDrawingView); - myOriginalValues = new Hashtable(); - setAttribute(newUndoAttribute); - setBackupValue(newUndoValue); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - if (getOriginalValue(f) != null) { - f.setAttribute(getAttribute(), getOriginalValue(f)); - } - } - - return true; - } - - public boolean redo() { - if (!isRedoable()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - if (getBackupValue() != null) { - f.setAttribute(getAttribute(), getBackupValue()); - } - } - - return true; - } - - protected void addOriginalValue(Figure affectedFigure, Object newOriginalValue) { - myOriginalValues.put(affectedFigure, newOriginalValue); - } - - protected Object getOriginalValue(Figure lookupAffectedFigure) { - return myOriginalValues.get(lookupAffectedFigure); - } - - protected void setAttribute(FigureAttributeConstant newUndoAttribute) { - myUndoAttribute = newUndoAttribute; - } - - public FigureAttributeConstant getAttribute() { - return myUndoAttribute; - } - - protected void setBackupValue(Object newUndoValue) { - myUndoValue = newUndoValue; - } - - public Object getBackupValue() { - return myUndoValue; - } - - public void release() { - super.release(); - myOriginalValues = null; - } - - public void setAffectedFigures(FigureEnumeration fe) { - // first make copy of FigureEnumeration in superclass - super.setAffectedFigures(fe); - // then get new FigureEnumeration of copy to save attributes - FigureEnumeration copyFe = getAffectedFigures(); - while (copyFe.hasNextFigure()) { - Figure f = copyFe.nextFigure(); - Object attributeValue = f.getAttribute(getAttribute()); - if (attributeValue != null) { - addOriginalValue(f, attributeValue); - } - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionEndHandle.java b/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionEndHandle.java deleted file mode 100644 index 191fe8507fbe524415a1ad926639195c7df0da23..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionEndHandle.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * @(#)ChangeConnectionEndHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Undoable; -import java.awt.Point; - -/** - * A handle to reconnect the end point of - * a connection to another figure. - * - * @version <$CURRENT_VERSION$> - */ -public class ChangeConnectionEndHandle extends ChangeConnectionHandle { - - /** - * Constructs the connection handle. - */ - public ChangeConnectionEndHandle(ConnectionFigure owner) { - super(owner); - } - - /** - * Gets the end figure of a connection. - */ - protected Connector target() { - return getConnection().getEndConnector(); - } - - /** - * Disconnects the end figure. - */ - protected void disconnect() { - getConnection().disconnectEnd(); - } - - /** - * Sets the end of the connection. - */ - protected void connect(Connector c) { - getConnection().connectEnd(c); - } - - /** - * Sets the end point of the connection. - */ - protected void setPoint(int x, int y) { - getConnection().endPoint(x, y); - } - - /** - * Returns the end point of the connection. - */ - public Point locate() { - return getConnection().endPoint(); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity(DrawingView newView) { - return new ChangeConnectionEndHandle.UndoActivity(newView); - } - - public static class UndoActivity extends ChangeConnectionHandle.UndoActivity { - public UndoActivity(DrawingView newView) { - super(newView); - } - - protected Connector replaceConnector(ConnectionFigure connection) { - Connector tempEndConnector = connection.getEndConnector(); - connection.connectEnd(getOldConnector()); - return tempEndConnector; - } - } - - protected boolean canConnectTo(Figure figure) { - return getConnection().canConnect(source().owner(), figure); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionHandle.java b/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionHandle.java deleted file mode 100644 index c3586fd6cb4c350d36d6fcc2b90d440eeed6dff1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionHandle.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * @(#)ChangeConnectionHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; -import java.awt.*; - -/** - * ChangeConnectionHandle factors the common code for handles - * that can be used to reconnect connections. - * - * @see ChangeConnectionEndHandle - * @see ChangeConnectionStartHandle - * - * @version <$CURRENT_VERSION$> - */ -public abstract class ChangeConnectionHandle extends AbstractHandle { - - private Connector fOriginalTarget; - private Figure myTarget; - private ConnectionFigure myConnection; - private Point fStart; - - /** - * Initializes the change connection handle. - */ - protected ChangeConnectionHandle(ConnectionFigure owner) { - super(owner); - setConnection(owner); - setTargetFigure(null); - } - - /** - * Returns the target connector of the change. - */ - protected abstract Connector target(); - - /** - * Disconnects the connection. - */ - protected abstract void disconnect(); - - /** - * Connect the connection with the given figure. - */ - protected abstract void connect(Connector c); - - /** - * Sets the location of the target point. - */ - protected abstract void setPoint(int x, int y); - - /** - * Gets the side of the connection that is unaffected by - * the change. - */ - protected Connector source() { - if (target() == getConnection().getStartConnector()) { - return getConnection().getEndConnector(); - } - return getConnection().getStartConnector(); - } - - /** - * Disconnects the connection. - */ - public void invokeStart(int x, int y, DrawingView view) { - fOriginalTarget = target(); - fStart = new Point(x, y); - - setUndoActivity(createUndoActivity(view)); - ((ChangeConnectionHandle.UndoActivity)getUndoActivity()).setOldConnector(target()); - - disconnect(); - } - - /** - * Finds a new target of the connection. - */ - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Point p = new Point(x, y); - Figure f = findConnectableFigure(x, y, view.drawing()); - // track the figure containing the mouse - if (f != getTargetFigure()) { - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(false, null); - } - setTargetFigure(f); - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(true, getConnection()); - } - } - - Connector target = findConnectionTarget(p.x, p.y, view.drawing()); - if (target != null) { - p = Geom.center(target.displayBox()); - } - setPoint(p.x, p.y); - } - - /** - * Connects the figure to the new target. If there is no - * new target the connection reverts to its original one. - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - Connector target = findConnectionTarget(x, y, view.drawing()); - if (target == null) { - target = fOriginalTarget; - } - - setPoint(x, y); - connect(target); - getConnection().updateConnection(); - - Connector oldConnector = ((ChangeConnectionHandle.UndoActivity) - getUndoActivity()).getOldConnector(); - // there has been no change so there is nothing to undo - if ((oldConnector == null) - || (target() == null) - || (oldConnector.owner() == target().owner())) { - setUndoActivity(null); - } - else { - getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getConnection())); - } - - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(false, null); - setTargetFigure(null); - } - } - - private Connector findConnectionTarget(int x, int y, Drawing drawing) { - Figure target = findConnectableFigure(x, y, drawing); - - if ((target != null) - && target.canConnect() - && target != fOriginalTarget - && !target.includes(owner()) - /* - * JP, 25-May-03: Fix for ignored direction when checking - * connectability. Old version didn't take direction of - * connection into account, which could result in incorrect - * drawing if syntax rules were a concern. - * - * See also new canConnectTo() method below. - * - * Was: - * - * && getConnection().canConnect(source().owner(), target)) { - */ - && canConnectTo(target)) { - return findConnector(x, y, target); - } - return null; - } - - /** - * Called to check whether this end of the connection can connect to the - * given target figure. Needs to be overriden by the start and end changers - * to take the connection's direction into account during the check. JHD 5.4 - * beta and before did not do this. - */ - protected abstract boolean canConnectTo(Figure figure); - - protected Connector findConnector(int x, int y, Figure f) { - return f.connectorAt(x, y); - } - - /** - * Draws this handle. - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.green); - g.fillRect(r.x, r.y, r.width, r.height); - - g.setColor(Color.black); - g.drawRect(r.x, r.y, r.width, r.height); - } - - private Figure findConnectableFigure(int x, int y, Drawing drawing) { - FigureEnumeration fe = drawing.figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (!figure.includes(getConnection()) && figure.canConnect()) { - if (figure.containsPoint(x, y)) { - return figure; - } - } - } - return null; - } - - protected void setConnection(ConnectionFigure newConnection) { - myConnection = newConnection; - } - - protected ConnectionFigure getConnection() { - return myConnection; - } - - protected void setTargetFigure(Figure newTarget) { - myTarget = newTarget; - } - - protected Figure getTargetFigure() { - return myTarget; - } - - /** - * Factory method for undo activity. To be overriden by subclasses. - */ - protected abstract Undoable createUndoActivity(DrawingView newView); - - public static abstract class UndoActivity extends UndoableAdapter { - private Connector myOldConnector; - - public UndoActivity(DrawingView newView) { - super(newView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - swapConnectors(); - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - swapConnectors(); - return true; - } - - private void swapConnectors() { - FigureEnumeration fe = getAffectedFigures(); - if (fe.hasNextFigure()) { - ConnectionFigure connection = (ConnectionFigure)fe.nextFigure(); - setOldConnector(replaceConnector(connection)); - connection.updateConnection(); - } - } - - protected abstract Connector replaceConnector(ConnectionFigure connection); - - public void setOldConnector(Connector newOldConnector) { - myOldConnector = newOldConnector; - } - - public Connector getOldConnector() { - return myOldConnector; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionStartHandle.java b/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionStartHandle.java deleted file mode 100644 index 8b15e185e77cc1e2870bb126af8584b8cfda62d4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ChangeConnectionStartHandle.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * @(#)ChangeConnectionStartHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Undoable; -import java.awt.Point; - -/** - * Handle to reconnect the - * start of a connection to another figure. - * - * @version <$CURRENT_VERSION$> - */ -public class ChangeConnectionStartHandle extends ChangeConnectionHandle { - - /** - * Constructs the connection handle for the given start figure. - */ - public ChangeConnectionStartHandle(ConnectionFigure owner) { - super(owner); - } - - /** - * Gets the start figure of a connection. - */ - protected Connector target() { - return getConnection().getStartConnector(); - } - - /** - * Disconnects the start figure. - */ - protected void disconnect() { - getConnection().disconnectStart(); - } - - /** - * Sets the start of the connection. - */ - protected void connect(Connector c) { - getConnection().connectStart(c); - } - - /** - * Sets the start point of the connection. - */ - protected void setPoint(int x, int y) { - getConnection().startPoint(x, y); - } - - /** - * Returns the start point of the connection. - */ - public Point locate() { - return getConnection().startPoint(); - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity(DrawingView newView) { - return new ChangeConnectionStartHandle.UndoActivity(newView); - } - - public static class UndoActivity extends ChangeConnectionHandle.UndoActivity { - public UndoActivity(DrawingView newView) { - super(newView); - } - - protected Connector replaceConnector(ConnectionFigure connection) { - Connector tempStartConnector = connection.getStartConnector(); - connection.connectStart(getOldConnector()); - return tempStartConnector; - } - } - - protected boolean canConnectTo(Figure figure) { - return getConnection().canConnect(figure, source().owner()); -} -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ChopBoxConnector.java b/JHotDraw/src/CH/ifa/draw/standard/ChopBoxConnector.java deleted file mode 100644 index 2a2312fe287404ceb47aac1f68fc62485d5d1696..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ChopBoxConnector.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @(#)ChopBoxConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Geom; - -/** - * A ChopBoxConnector locates connection points by - * choping the connection between the centers of the - * two figures at the display box. - * - * @see Connector - * - * @version <$CURRENT_VERSION$> - */ -public class ChopBoxConnector extends AbstractConnector { - - /* - * Serialization support. - */ - private static final long serialVersionUID = -1461450322712345462L; - - public ChopBoxConnector() { // only used for Storable implementation - } - - public ChopBoxConnector(Figure owner) { - super(owner); - } - - public Point findStart(ConnectionFigure connection) { - Figure startFigure = connection.getStartConnector().owner(); - Rectangle r2 = connection.getEndConnector().displayBox(); - Point r2c = null; - - if (connection.pointCount() == 2) { - r2c = new Point(r2.x + r2.width/2, r2.y + r2.height/2); - } - else { - r2c = connection.pointAt(1); - } - - return chop(startFigure, r2c); - } - - public Point findEnd(ConnectionFigure connection) { - Figure endFigure = connection.getEndConnector().owner(); - Rectangle r1 = connection.getStartConnector().displayBox(); - Point r1c = null; - - if (connection.pointCount() == 2) { - r1c = new Point(r1.x + r1.width/2, r1.y + r1.height/2); - } - else { - r1c = connection.pointAt(connection.pointCount()-2); - } - - return chop(endFigure, r1c); - } - - protected Point chop(Figure target, Point from) { - Rectangle r = target.displayBox(); - return Geom.angleToPoint(r, (Geom.pointToAngle(r, from))); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/standard/CompositeFigure.java b/JHotDraw/src/CH/ifa/draw/standard/CompositeFigure.java deleted file mode 100644 index f6fca82c8de6ad2edfaac79c9f4870271eba3ec4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/CompositeFigure.java +++ /dev/null @@ -1,734 +0,0 @@ -/* - * @(#)CompositeFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; -import java.awt.*; -import java.util.*; -import java.util.List; -import java.io.*; - -/** - * A Figure that is composed of several figures. A CompositeFigure - * doesn't define any layout behavior. It is up to subclassers to - * arrange the contained figures. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld012.htm>Composite</a></b><br> - * CompositeFigure enables to treat a composition of figures like - * a single figure.<br> - * - * @see Figure - * - * @version <$CURRENT_VERSION$> - */ - -public abstract class CompositeFigure - extends AbstractFigure - implements FigureChangeListener { - - /** - * The figures that this figure is composed of - * @see #add - * @see #remove - */ - protected List fFigures; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 7408153435700021866L; - private int compositeFigureSerializedDataVersion = 1; - private transient QuadTree _theQuadTree; - protected int _nLowestZ; - protected int _nHighestZ; - - protected CompositeFigure() { - fFigures = CollectionsFactory.current().createList(); - _nLowestZ = 0; - _nHighestZ = 0; - } - - /** - * Adds a figure to the list of figures. Initializes the - * the figure's container. - * - * @param figure to be added to the drawing - * @return the figure that was inserted (might be different from the figure specified). - */ - public Figure add(Figure figure) { - if (!containsFigure(figure)) { - figure.setZValue(++_nHighestZ); - fFigures.add(figure); - figure.addToContainer(this); - _addToQuadTree(figure); - } - return figure; - } - - /** - * Adds a list of figures. - * - * @see #add - * @deprecated use addAll(FigureEnumeration) instead - */ - public void addAll(List newFigures) { - addAll(new FigureEnumerator(newFigures)); - } - - /** - * Adds a FigureEnumeration of figures. - * - * @see #add - * @param fe (unused) enumeration containing all figures to be added - */ - public void addAll(FigureEnumeration fe) { - while (fe.hasNextFigure()) { - add(fe.nextFigure()); - } - } - - /** - * Removes a figure from the composite. - * - * @param figure that is part of the drawing and should be removed - * @return the figure that has been removed (might be different from the figure specified) - * @see #removeAll - */ - public Figure remove(Figure figure) { - Figure orphanedFigure = orphan(figure); - if (orphanedFigure != null) { - orphanedFigure.release(); - } - return orphanedFigure; - } - - /** - * Removes a list of figures. - * - * @see #remove - * @deprecated use removeAll(FigureEnumeration) instead - */ - public void removeAll(List figures) { - removeAll(new FigureEnumerator(figures)); - } - - /** - * Removes a FigureEnumeration of figures. - * @see #remove - */ - public void removeAll(FigureEnumeration fe) { - while (fe.hasNextFigure()) { - remove(fe.nextFigure()); - } - } - - /** - * Removes all children. - * @see #remove - */ - public void removeAll() { - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - figure.removeFromContainer(this); - } - fFigures.clear(); - - _clearQuadTree(); - _nLowestZ = 0; - _nHighestZ = 0; - } - - /** - * Removes a figure from the figure list, but - * doesn't release it. Use this method to temporarily - * manipulate a figure outside of the drawing. - * - * @param figure that is part of the drawing and should be added - */ - public synchronized Figure orphan(Figure figure) { - figure.removeFromContainer(this); - fFigures.remove(figure); - _removeFromQuadTree(figure); - return figure; - } - - /** - * Removes a list of figures from the figure's list - * without releasing the figures. - * - * @see #orphan - * @deprecated use orphanAll(FigureEnumeration) instead - */ - public void orphanAll(List newFigures) { - orphanAll(new FigureEnumerator(newFigures)); - } - - public void orphanAll(FigureEnumeration fe) { - while (fe.hasNextFigure()) { - orphan(fe.nextFigure()); - } - } - - /** - * Replaces a figure in the drawing without - * removing it from the drawing. - * - * @param figure figure to be replaced - * @param replacement figure that should replace the specified figure - * @return the figure that has been inserted (might be different from the figure specified) - */ - public synchronized Figure replace(Figure figure, Figure replacement) { - int index = fFigures.indexOf(figure); - if (index != -1) { - replacement.setZValue(figure.getZValue()); - replacement.addToContainer(this); // will invalidate figure - figure.removeFromContainer(this); - fFigures.set(index, replacement); - figure.changed(); - replacement.changed(); - } - return replacement; - } - - /** - * Sends a figure to the back of the drawing. - * - * @param figure that is part of the drawing - */ - public synchronized void sendToBack(Figure figure) { - if (containsFigure(figure)) { - fFigures.remove(figure); - fFigures.add(0, figure); - _nLowestZ--; - figure.setZValue(_nLowestZ); - figure.changed(); - } - } - - /** - * Brings a figure to the front. - * - * @param figure that is part of the drawing - */ - public synchronized void bringToFront(Figure figure) { - if (containsFigure(figure)) { - fFigures.remove(figure); - fFigures.add(figure); - _nHighestZ++; - figure.setZValue(_nHighestZ); - figure.changed(); - } - } - - /** - * Sends a figure to a certain layer within a drawing. Each figure - * lays in a unique layer and the layering order decides which - * figure is drawn on top of another figure. Figures with a higher - * layer number have usually been added later and may overlay - * figures in lower layers. Layers are counted from to (the number - * of figures - 1). - * The figure is removed from its current layer (if it has been already - * part of this drawing) and is transferred to the specified layers after - * all figures between the original layer and the new layer are shifted to - * one layer below to fill the layer sequence. It is not possible to skip a - * layer number and if the figure is sent to a layer beyond the latest layer - * it will be added as the last figure to the drawing and its layer number - * will be set to the be the one beyond the latest layer so far. - * - * @param figure figure to be sent to a certain layer - * @param layerNr target layer of the figure - */ - public void sendToLayer(Figure figure, int layerNr) { - if (containsFigure(figure)) { - if (layerNr >= fFigures.size()) { - layerNr = fFigures.size() - 1; - } - Figure layerFigure = getFigureFromLayer(layerNr); - int layerFigureZValue = layerFigure.getZValue(); - int figureLayer = getLayer(figure); - // move figure forward - if (figureLayer < layerNr) { - assignFiguresToPredecessorZValue(figureLayer + 1, layerNr); - } - else if (figureLayer > layerNr) { - assignFiguresToSuccessorZValue(layerNr, figureLayer - 1); - } - - fFigures.remove(figure); - fFigures.add(layerNr, figure); - figure.setZValue(layerFigureZValue); - figure.changed(); - } - } - - private void assignFiguresToPredecessorZValue(int lowerBound, int upperBound) { - // cannot shift figures to a lower layer if the lower bound is - // already the first layer. - if (upperBound >= fFigures.size()) { - upperBound = fFigures.size() - 1; - } - - for (int i = upperBound; i >= lowerBound; i--) { - Figure currentFigure = (Figure)fFigures.get(i); - Figure predecessorFigure = (Figure)fFigures.get(i - 1); - currentFigure.setZValue(predecessorFigure.getZValue()); - } - } - - private void assignFiguresToSuccessorZValue(int lowerBound, int upperBound) { - if (upperBound >= fFigures.size()) { - upperBound = fFigures.size() - 1; - } - - for (int i = upperBound; i >= lowerBound; i--) { - Figure currentFigure = (Figure)fFigures.get(i); - Figure successorFigure = (Figure)fFigures.get(i + 1); - currentFigure.setZValue(successorFigure.getZValue()); - } - } - - /** - * Gets the layer for a certain figure (first occurrence). The number - * returned is the number of the layer in which the figure is placed. - * - * @param figure figure to be queried for its layering place - * @return number of the layer in which the figure is placed and -1 if the - * figure could not be found. - * @see #sendToLayer - */ - public int getLayer(Figure figure) { - if (!containsFigure(figure)) { - return -1; - } - else { - return fFigures.indexOf(figure); - } - } - - /** - * Gets the figure from a certain layer. - * - * @param layerNr number of the layer which figure should be returned - * @return figure from the layer specified, null, if the layer nr was outside - * the number of possible layer (0...(number of figures - 1)) - * @see #sendToLayer - */ - public Figure getFigureFromLayer(int layerNr) { - if ((layerNr >= 0) && (layerNr < fFigures.size())) { - return (Figure)fFigures.get(layerNr); - } - else { - return null; - } - } - - /** - * Draws all the contained figures - * @see Figure#draw - */ - public void draw(Graphics g) { - draw(g, figures()); - } - - /** - * Draws only the given figures - * @see Figure#draw - */ - public void draw(Graphics g, FigureEnumeration fe) { - while (fe.hasNextFigure()) { - fe.nextFigure().draw(g); - } - } - - /** - * Gets a figure at the given index. - */ - public Figure figureAt(int i) { - return (Figure)fFigures.get(i); - } - - /** - * Returns an Enumeration for accessing the contained figures. - * The enumeration is a snapshot of the current contained figures - * and is not a "live" enumeration and does not take subsequent - * changes of the CompositeFigure into account. - * The figures are returned in the drawing order. - */ - public FigureEnumeration figures() { - return new FigureEnumerator(CollectionsFactory.current().createList(fFigures)); - } - - /** - * Returns an enumeration to iterate in - * Z-order back to front over the figures - * that lie within the given bounds. - */ - public FigureEnumeration figures(Rectangle viewRectangle) { - if (_theQuadTree != null) { - - FigureEnumeration fe = - _theQuadTree.getAllWithin(new Bounds(viewRectangle).asRectangle2D()); - - List l2 = CollectionsFactory.current().createList(); - - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - //int z = fFigures.indexOf(f); - l2.add(new OrderedFigureElement(f, f.getZValue())); - } - - Collections.sort(l2); - - List l3 = CollectionsFactory.current().createList(); - - for (Iterator iter = l2.iterator(); iter.hasNext(); ) { - OrderedFigureElement ofe = (OrderedFigureElement)iter.next(); - l3.add(ofe.getFigure()); - } - - return new FigureEnumerator(l3); - } - - return figures(); - } - - /** - * Gets number of child figures. - */ - public int figureCount() { - return fFigures.size(); - } - - /** - * Check whether a given figure is a child figure of this CompositeFigure. - */ - public boolean containsFigure(Figure checkFigure) { - return fFigures.contains(checkFigure); - } - - /** - * Returns an Enumeration for accessing the contained figures - * in the reverse drawing order. - */ - public final FigureEnumeration figuresReverse() { - return new ReverseFigureEnumerator(CollectionsFactory.current().createList(fFigures)); - } - - /** - * Finds a top level Figure. Use this call for hit detection that - * should not descend into the figure's children. - */ - public Figure findFigure(int x, int y) { - FigureEnumeration fe = figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (figure.containsPoint(x, y)) { - return figure; - } - } - return null; - } - - /** - * Finds a top level Figure that intersects the given rectangle. - */ - public Figure findFigure(Rectangle r) { - FigureEnumeration fe = figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - Rectangle fr = figure.displayBox(); - if (r.intersects(fr)) { - return figure; - } - } - return null; - } - - /** - * Finds a top level Figure, but supresses the passed - * in figure. Use this method to ignore a figure - * that is temporarily inserted into the drawing. - * @param x the x coordinate - * @param y the y coordinate - * @param without the figure to be ignored during - * the find. - */ - public Figure findFigureWithout(int x, int y, Figure without) { - if (without == null) { - return findFigure(x, y); - } - - FigureEnumeration fe = figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (figure.containsPoint(x, y) && !figure.includes(without)) { - return figure; - } - } - return null; - } - - /** - * Finds a top level Figure that intersects the given rectangle. - * It supresses the passed - * in figure. Use this method to ignore a figure - * that is temporarily inserted into the drawing. - */ - public Figure findFigure(Rectangle r, Figure without) { - if (without == null) { - return findFigure(r); - } - - FigureEnumeration fe = figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - Rectangle fr = figure.displayBox(); - if (r.intersects(fr) && !figure.includes(without)) { - return figure; - } - } - return null; - } - - /** - * Finds a figure but descends into a figure's - * children. Use this method to implement <i>click-through</i> - * hit detection, that is, you want to detect the inner most - * figure containing the given point. - */ - public Figure findFigureInside(int x, int y) { - FigureEnumeration fe = figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure().findFigureInside(x, y); - if (figure != null) { - return figure; - } - } - - // bug-fix: 661878 - if (containsPoint(x, y)) { - return this; - } - else { - return null; - } - } - - /** - * Finds a figure but descends into a figure's - * children. It supresses the passed - * in figure. Use this method to ignore a figure - * that is temporarily inserted into the drawing. - */ - public Figure findFigureInsideWithout(int x, int y, Figure without) { - if (without == null) { - return findFigureInside(x, y); - } - - FigureEnumeration fe = figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (figure != without) { - Figure found = figure.findFigureInside(x, y); - if ((found != null) && !figure.includes(without)) { - return found; - } - } - } - - if (containsPoint(x, y)) { - return this; - } - else { - return null; - } - } - - /** - * Checks if the composite figure has the argument as one of - * its children. - * @return true if the figure is part of this CompositeFigure, else otherwise - */ - public boolean includes(Figure figure) { - if (super.includes(figure)) { - return true; - } - - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure f = fe.nextFigure(); - if (f.includes(figure)) { - return true; - } - } - return false; - } - - /** - * Moves all the given figures by x and y. Doesn't announce - * any changes. Subclassers override - * basicMoveBy. Clients usually call moveBy. - * @see #moveBy - */ - protected void basicMoveBy(int x, int y) { - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - fe.nextFigure().moveBy(x,y); - } - } - - /** - * Releases the figure and all its children. - */ - public void release() { - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - figure.release(); - } - // bug-fix: 661879 (CompositeFigure.release releasing itself before containees) - super.release(); - } - - /** - * Propagates the figureInvalidated event to my listener. - * @see FigureChangeListener - */ - public void figureInvalidated(FigureChangeEvent e) { - if (listener() != null) { - listener().figureInvalidated(e); - } - } - - /** - * Propagates the removeFromDrawing request up to the container. - * @see FigureChangeListener - */ - public void figureRequestRemove(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRequestRemove(new FigureChangeEvent(this)); - } - } - - /** - * Propagates the requestUpdate request up to the container. - * @see FigureChangeListener - */ - public void figureRequestUpdate(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRequestUpdate(e); - } - } - - public void figureChanged(FigureChangeEvent e) { - _removeFromQuadTree(e.getFigure()); - _addToQuadTree(e.getFigure()); - } - - public void figureRemoved(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRemoved(e); - } - } - - /** - * Writes the contained figures to the StorableOutput. - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(figureCount()); - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - dw.writeStorable(fe.nextFigure()); - } - } - - /** - * Reads the contained figures from StorableInput. - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - int size = dr.readInt(); - fFigures = CollectionsFactory.current().createList(size); - for (int i=0; i<size; i++) { - add((Figure)dr.readStorable()); - } - init(displayBox()); - } - - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - figure.addToContainer(this); - } - - init(new Rectangle(0, 0)); - } - - /** - * Used to optimize rendering. Rendering of many objects may - * be slow until this method is called. The view rectangle - * should at least approximately enclose the CompositeFigure. - * If the view rectangle is too small or too large, performance - * may suffer. - * - * Don't forget to call this after loading or creating a - * new CompositeFigure. If you forget, drawing performance may - * suffer. - */ - public void init(Rectangle viewRectangle) { - _theQuadTree = new QuadTree(new Bounds(viewRectangle).asRectangle2D()); - - FigureEnumeration fe = figures(); - while (fe.hasNextFigure()) { - _addToQuadTree(fe.nextFigure()); - } - } - - private void _addToQuadTree(Figure f) { - if (_theQuadTree != null) { - // Bugfix: Make sure the rectangle is not zero width or height. - // Otherwise, the quadTree search in this.figures(Rectangle) - // will be incorrect. [John Yu, 2002/05/23] - Rectangle r = f.displayBox(); - if (r.height == 0) { - r.grow(0, 1); - } - if (r.width == 0) { - r.grow(1, 0); - } - - _theQuadTree.add(f, new Bounds(r).asRectangle2D()); - } - } - - private void _removeFromQuadTree(Figure f) { - if (_theQuadTree != null) { - _theQuadTree.remove(f); - } - } - - private void _clearQuadTree() { - if (_theQuadTree != null) { - _theQuadTree.clear(); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ConnectionHandle.java b/JHotDraw/src/CH/ifa/draw/standard/ConnectionHandle.java deleted file mode 100644 index 3cad4360929a34d933501773cffa758cc4e3cd2b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ConnectionHandle.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * @(#)ConnectionHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Vector; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.Undoable; - -/** - * A handle to connect figures. - * The connection object to be created is specified by a prototype. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld029.htm>Prototype</a></b><br> - * ConnectionHandle creates the connection by cloning a prototype. - * <hr> - * - * @see ConnectionFigure - * @see Object#clone - * - * @version <$CURRENT_VERSION$> - */ -public class ConnectionHandle extends LocatorHandle { - - /** - * the currently created connection - */ - private ConnectionFigure myConnection; - - /** - * the prototype of the connection to be created - */ - private ConnectionFigure fPrototype; - - /** - * the current target - */ - private Figure myTargetFigure; - - /** - * Constructs a handle with the given owner, locator, and connection prototype - */ - public ConnectionHandle(Figure owner, Locator l, ConnectionFigure prototype) { - super(owner, l); - fPrototype = prototype; - } - - /** - * Creates the connection - */ - public void invokeStart(int x, int y, DrawingView view) { - setConnection(createConnection()); - - setUndoActivity(createUndoActivity(view)); - Vector v = new Vector(); - v.add(getConnection()); - getUndoActivity().setAffectedFigures(new FigureEnumerator(v)); - - Point p = locate(); - getConnection().startPoint(p.x, p.y); - getConnection().endPoint(p.x, p.y); - view.drawing().add(getConnection()); - } - - /** - * Tracks the connection. - */ - public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { - Point p = new Point(x,y); - Figure f = findConnectableFigure(x, y, view.drawing()); - // track the figure containing the mouse - if (f != getTargetFigure()) { - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(false, null); - } - setTargetFigure(f); - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(true, getConnection()); - } - } - - Connector target = findConnectionTarget(p.x, p.y, view.drawing()); - if (target != null) { - p = Geom.center(target.displayBox()); - } - getConnection().endPoint(p.x, p.y); - } - - /** - * Connects the figures if the mouse is released over another - * figure. - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - Connector target = findConnectionTarget(x, y, view.drawing()); - if (target != null) { - getConnection().connectStart(startConnector()); - getConnection().connectEnd(target); - getConnection().updateConnection(); - } - else { - view.drawing().remove(getConnection()); - setUndoActivity(null); - } - setConnection(null); - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(false, null); - setTargetFigure(null); - } - } - - private Connector startConnector() { - Point p = locate(); - return owner().connectorAt(p.x, p.y); - } - - /** - * Creates the ConnectionFigure. By default the figure prototype is - * cloned. - */ - protected ConnectionFigure createConnection() { - return (ConnectionFigure)fPrototype.clone(); - } - - /** - * Factory method for undo activity. - */ - protected Undoable createUndoActivity(DrawingView view) { - return new PasteCommand.UndoActivity(view); - } - - /** - * Finds a connection end figure. - */ - protected Connector findConnectionTarget(int x, int y, Drawing drawing) { - Figure target = findConnectableFigure(x, y, drawing); - if ((target != null) && target.canConnect() - && !target.includes(owner()) - && getConnection().canConnect(owner(), target)) { - return findConnector(x, y, target); - } - return null; - } - - private Figure findConnectableFigure(int x, int y, Drawing drawing) { - FigureEnumeration fe = drawing.figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (!figure.includes(getConnection()) && figure.canConnect() - && figure.containsPoint(x, y)) { - return figure; - } - } - return null; - } - - protected Connector findConnector(int x, int y, Figure f) { - return f.connectorAt(x, y); - } - - - /** - * Draws the connection handle, by default the outline of a - * blue circle. - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - g.setColor(Color.blue); - g.drawOval(r.x, r.y, r.width, r.height); - } - - protected void setConnection(ConnectionFigure newConnection) { - myConnection = newConnection; - } - - protected ConnectionFigure getConnection() { - return myConnection; - } - - protected Figure getTargetFigure() { - return myTargetFigure; - } - - protected void setTargetFigure(Figure newTargetFigure) { - myTargetFigure = newTargetFigure; - } - - /** - * @see CH.ifa.draw.framework.Handle#getCursor() - */ - public Cursor getCursor() { - return new AWTCursor(java.awt.Cursor.HAND_CURSOR); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ConnectionTool.java b/JHotDraw/src/CH/ifa/draw/standard/ConnectionTool.java deleted file mode 100644 index 78fb73d0489b2bb6c84c2553d0ca28e3a747ea05..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ConnectionTool.java +++ /dev/null @@ -1,448 +0,0 @@ -/* - * @(#)ConnectionTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; -import java.awt.*; -import java.awt.event.MouseEvent; - -/** - * A tool that can be used to connect figures, to split - * connections, and to join two segments of a connection. - * ConnectionTools turns the visibility of the Connectors - * on when it enters a figure. - * The connection object to be created is specified by a prototype. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld029.htm>Prototype</a></b><br> - * ConnectionTools creates the connection by cloning a prototype. - * <hr> - * - * @see ConnectionFigure - * @see Object#clone - * - * @version <$CURRENT_VERSION$> - */ -public class ConnectionTool extends AbstractTool { - - /** - * the anchor point of the interaction - */ - private Connector myStartConnector; - private Connector myEndConnector; - private Connector myTargetConnector; - - private Figure myTarget; - - /** - * the currently created figure - */ - private ConnectionFigure myConnection; - - /** - * the currently manipulated connection point - */ - private int fSplitPoint; - - /** - * the currently edited connection - */ - private ConnectionFigure fEditedConnection; - - /** - * the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - private Figure myAddedFigure; - - /** - * the prototypical figure that is used to create new - * connections. - */ - private ConnectionFigure fPrototype; - - - public ConnectionTool(DrawingEditor newDrawingEditor, ConnectionFigure newPrototype) { - super(newDrawingEditor); - fPrototype = newPrototype; - } - - /** - * Handles mouse move events in the drawing view. - */ - public void mouseMove(MouseEvent e, int x, int y) { - trackConnectors(e, x, y); - } - - /** - * Manipulates connections in a context dependent way. If the - * mouse down hits a figure start a new connection. If the mousedown - * hits a connection split a segment or join two segments. - */ - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e,x,y); - int ex = e.getX(); - int ey = e.getY(); - - /* - * JP, 25-May-03: Swapped checking for underlying figure and - * existing connection. If figure is checked first (old version), - * it is not possible to insert new points into a connection that - * crosses or otherwise goes through an existing figure. New - * version checks for connection first. - */ - ConnectionFigure connection = findConnection(ex, ey, drawing()); - if (connection != null) { - if (!connection.joinSegments(ex, ey)) { - fSplitPoint = connection.splitSegment(ex, ey); - fEditedConnection = connection; - } - else { - fEditedConnection = null; - } - } - else { - setTargetFigure(findConnectionStart(ex, ey, drawing())); - if (getTargetFigure() != null) { - setStartConnector(findConnector(ex, ey, getTargetFigure())); - if (getStartConnector() != null) { - setConnection(createConnection()); - getConnection().startPoint(ex, ey); - getConnection().endPoint(ex, ey); - setAddedFigure(view().add(getConnection())); - } - } - } - } - - /** - * Adjust the created connection or split segment. - */ - public void mouseDrag(MouseEvent e, int x, int y) { - Point p = new Point(e.getX(), e.getY()); - if (getConnection() != null) { - trackConnectors(e, x, y); - if (getTargetConnector() != null) { - p = Geom.center(getTargetConnector().displayBox()); - } - getConnection().endPoint(p.x, p.y); - } - else if (fEditedConnection != null) { - Point pp = new Point(x, y); - fEditedConnection.setPointAt(pp, fSplitPoint); - } - } - - /** - * Connects the figures if the mouse is released over another - * figure. - */ - public void mouseUp(MouseEvent e, int x, int y) { - Figure c = null; - if (getStartConnector() != null) { - c = findTarget(e.getX(), e.getY(), drawing()); - } - - if (c != null) { - setEndConnector(findConnector(e.getX(), e.getY(), c)); - if (getEndConnector() != null) { - getConnection().connectStart(getStartConnector()); - getConnection().connectEnd(getEndConnector()); - getConnection().updateConnection(); - - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures( - new SingleFigureEnumerator(getAddedFigure())); - } - } - else if (getConnection() != null) { - view().remove(getConnection()); - } - - setConnection(null); - setStartConnector(null); - setEndConnector(null); - setAddedFigure(null); - editor().toolDone(); - } - - public void deactivate() { - super.deactivate(); - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(false, null); - } - } - - /** - * Creates the ConnectionFigure. By default the figure prototype is - * cloned. - */ - protected ConnectionFigure createConnection() { - return (ConnectionFigure)fPrototype.clone(); - } - - /** - * Finds a connectable figure target. - */ - protected Figure findSource(int x, int y, Drawing drawing) { - return findConnectableFigure(x, y, drawing); - } - - /** - * Finds a connectable figure target at the current mouse location that can - * 1. Connect to things - * 2. Is not already connected to the current Connection (no self connection) - * 3. The current Connection can make a connection between it and the start - * figure. - */ - protected Figure findTarget(int x, int y, Drawing drawing) { - Figure target = findConnectableFigure(x, y, drawing); - Figure start = getStartConnector().owner(); - - if (target != null - && getConnection() != null - && target.canConnect() - && !target.includes(start) - && getConnection().canConnect(start, target)) { - return target; - } - return null; - } - - /** - * Finds an existing connection figure. - */ - protected ConnectionFigure findConnection(int x, int y, Drawing drawing) { - FigureEnumeration fe = drawing.figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - figure = figure.findFigureInside(x, y); - if (figure != null && (figure instanceof ConnectionFigure)) { - return (ConnectionFigure)figure; - } - } - return null; - } - - protected void setConnection(ConnectionFigure newConnection) { - myConnection = newConnection; - } - - /** - * Gets the connection which is created by this tool - */ - protected ConnectionFigure getConnection() { - return myConnection; - } - - /** - * Attempts to set the Connector to be connected to based on the current - * location of the mouse. - */ - protected void trackConnectors(MouseEvent e, int x, int y) { - Figure c = null; - - // If tool is not actively looking for a target for our current - // Connection, see if there are any connectable figures at at the - // current location(findSource). - if (getStartConnector() == null) { - c = findSource(x, y, getActiveDrawing()); - } - else { - c = findTarget(x, y, getActiveDrawing()); - } - - // track the figure containing the mouse - /** - * If the current target is not the stored target then turn off the - * stored targets connectors visibility and turn on the current targets - * connectors visibility. Then set the stored target to the current target. - * If the targets match then don't do anything. - * Note: the target may have more than one connector. - */ - if (c != getTargetFigure()) { - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(false, null); - } - setTargetFigure(c); - if (getTargetFigure() != null) { - getTargetFigure().connectorVisibility(true, getConnection()); - } - } - - // Since you have a legitimate target, grab its connector and set it as - // the new target connector. - Connector cc = null; - if (c != null) { - cc = findConnector(e.getX(), e.getY(), c); - } - if (cc != getTargetConnector()) { - setTargetConnector(cc); - } - - // Clean up the view. - getActiveView().checkDamage(); - } - - protected Connector findConnector(int x, int y, Figure f) { - return f.connectorAt(x, y); - } - - /** - * Finds a connection start figure. - */ - protected Figure findConnectionStart(int x, int y, Drawing drawing) { - Figure target = findConnectableFigure(x, y, drawing); - if ((target != null) && target.canConnect()) { - return target; - } - return null; - } - - /** - * Returns the topmost? figure that can connect and is at the current mouse - * location. - */ - protected Figure findConnectableFigure(int x, int y, Drawing drawing) { - FigureEnumeration fe = drawing.figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (!figure.includes(getConnection()) && figure.canConnect() - && figure.containsPoint(x, y)) { - return figure; - } - } - return null; - } - - protected void setStartConnector(Connector newStartConnector) { - myStartConnector = newStartConnector; - } - - protected Connector getStartConnector() { - return myStartConnector; - } - - protected void setEndConnector(Connector newEndConnector) { - myEndConnector = newEndConnector; - } - - protected Connector getEndConnector() { - return myEndConnector; - } - - protected void setTargetConnector(Connector newTargetConnector) { - myTargetConnector = newTargetConnector; - } - - protected Connector getTargetConnector() { - return myTargetConnector; - } - - protected void setTargetFigure(Figure newTarget) { - myTarget = newTarget; - } - - protected Figure getTargetFigure() { - return myTarget; - } - - /** - * Gets the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - protected Figure getAddedFigure() { - return myAddedFigure; - } - - protected void setAddedFigure(Figure newAddedFigure) { - myAddedFigure = newAddedFigure; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new ConnectionTool.UndoActivity(view(), getConnection()); - } - - public static class UndoActivity extends UndoableAdapter { - - private ConnectionFigure myConnection; - private Connector myStartConnector; - private Connector myEndConnector; - - public UndoActivity(DrawingView newDrawingView, ConnectionFigure newConnection) { - super(newDrawingView); - setConnection(newConnection); - myStartConnector = getConnection().getStartConnector(); - myEndConnector = getConnection().getEndConnector(); - setUndoable(true); - setRedoable(true); - } - - /* - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo() { - if (!super.undo()) { - return false; - } - - getConnection().disconnectStart(); - getConnection().disconnectEnd(); - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - getDrawingView().drawing().orphan(fe.nextFigure()); - } - - getDrawingView().clearSelection(); - - return true; - } - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo() { - if (!super.redo()) { - return false; - } - - getConnection().connectStart(myStartConnector); - getConnection().connectEnd(myEndConnector); - getConnection().updateConnection(); - - getDrawingView().insertFigures(getAffectedFigures(), 0, 0, false); - - return true; - } - - protected void setConnection(ConnectionFigure newConnection) { - myConnection = newConnection; - } - - /** - * Gets the currently created figure - */ - protected ConnectionFigure getConnection() { - return myConnection; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/CopyCommand.java b/JHotDraw/src/CH/ifa/draw/standard/CopyCommand.java deleted file mode 100644 index 0abff3cb38ed1b88e441bee18b03d9d452d59ab4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/CopyCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * @(#)CopyCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.DrawingEditor; - -/** - * Copy the selection to the clipboard. - * - * @see Clipboard - * - * @version <$CURRENT_VERSION$> - */ -public class CopyCommand extends FigureTransferCommand { - - /** - * Constructs a copy command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public CopyCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - copyFigures(view().selection(), view().selectionCount()); - } - - protected boolean isExecutableWithView() { - return view().selectionCount() > 0; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/CreationTool.java b/JHotDraw/src/CH/ifa/draw/standard/CreationTool.java deleted file mode 100644 index ab81d26e3ce832ad7d680005067f13d70136d7e9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/CreationTool.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * @(#)CreationTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Point; -import java.awt.event.MouseEvent; -import java.util.List; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.JHotDrawRuntimeException; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.Undoable; - -/** - * A tool to create new figures. The figure to be - * created is specified by a prototype. - * - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld029.htm>Prototype</a></b><br> - * CreationTool creates new figures by cloning a prototype. - * <hr> - * - * @see Figure - * @see Object#clone - * - * @version <$CURRENT_VERSION$> - */ -public class CreationTool extends AbstractTool { - - /** - * the list of currently added figures - * by: ricardo_padilha. - * description: This has been added to provide support for creation tools that - * insert more than one figure to the drawing, for example, by - * maintaining SHIFT down and clicking. However, this class still - * maintains its normal behavior of creating only one figure. - */ - private List fAddedFigures; - - /** - * the currently created figure - */ - private Figure fCreatedFigure; - - /** - * the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - private Figure myAddedFigure; - - /** - * the prototypical figure that is used to create new figuresthe prototypical figure that is used to create new figures. - */ - private Figure myPrototypeFigure; - - - /** - * Initializes a CreationTool with the given prototype. - */ - public CreationTool(DrawingEditor newDrawingEditor, Figure prototype) { - super(newDrawingEditor); - setPrototypeFigure(prototype); - } - - /** - * Constructs a CreationTool without a prototype. - * This is for subclassers overriding createFigure. - */ - protected CreationTool(DrawingEditor newDrawingEditor) { - this(newDrawingEditor, null); - } - - /** - * Sets the cross hair cursor. - */ - public void activate() { - super.activate(); - if (isUsable()) { - getActiveView().setCursor(new AWTCursor(java.awt.Cursor.CROSSHAIR_CURSOR)); - } - setAddedFigures(CollectionsFactory.current().createList()); - } - - /** - * @see CH.ifa.draw.framework.Tool#deactivate() - */ - public void deactivate() { - setCreatedFigure(null); - setAddedFigure(null); - setAddedFigures(null); - super.deactivate(); - } - - /** - * Creates a new figure by cloning the prototype. - */ - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e, x, y); - setCreatedFigure(createFigure()); - setAddedFigure(getActiveView().add(getCreatedFigure())); - getAddedFigure().displayBox(new Point(getAnchorX(), getAnchorY()), new Point(getAnchorX(), getAnchorY())); - } - - /** - * Creates a new figure by cloning the prototype. - */ - protected Figure createFigure() { - if (getPrototypeFigure() == null) { - throw new JHotDrawRuntimeException("No protoype defined"); - } - return (Figure)getPrototypeFigure().clone(); - } - - /** - * Adjusts the extent of the created figure - */ - public void mouseDrag(MouseEvent e, int x, int y) { - if (getAddedFigure() != null) { - getAddedFigure().displayBox(new Point(getAnchorX(), getAnchorY()), new Point(x, y)); - } - } - - /** - * Checks if the created figure is empty. If it is, the figure - * is removed from the drawing. - * @see Figure#isEmpty - */ - public void mouseUp(MouseEvent e, int x, int y) { - if (getAddedFigure() != null && !getCreatedFigure().isEmpty()) { - getAddedFigures().add(getAddedFigure()); - } - else { - getActiveView().remove(getAddedFigure()); - } - - if (getAddedFigures().isEmpty()) { - setUndoActivity(null); - } - else { - // use undo activity from paste command... - setUndoActivity(createUndoActivity()); - // put created figure into a figure enumeration - getUndoActivity().setAffectedFigures(new FigureEnumerator(getAddedFigures())); - } - editor().toolDone(); - } - - /** - * As the name suggests this CreationTool uses the Prototype design pattern. - * Thus, the prototype figure which is used to create new figures of the same - * type by cloning the original prototype figure. - * @param newPrototypeFigure figure to be cloned to create new figures - */ - protected void setPrototypeFigure(Figure newPrototypeFigure) { - myPrototypeFigure = newPrototypeFigure; - } - - /** - * As the name suggests this CreationTool uses the Prototype design pattern. - * Thus, the prototype figure which is used to create new figures of the same - * type by cloning the original prototype figure. - * @return figure to be cloned to create new figures - */ - protected Figure getPrototypeFigure() { - return myPrototypeFigure; - } - - /** - * Gets the list of currently added figure - */ - protected List getAddedFigures() { - return fAddedFigures; - } - - /** - * Sets the addedFigures attribute of the CreationTool object - */ - protected void setAddedFigures(List newAddedFigures) { - fAddedFigures = newAddedFigures; - } - - /** - * Gets the currently created figure - */ - protected Figure getCreatedFigure() { - return fCreatedFigure; - } - - /** - * Sets the createdFigure attribute of the CreationTool object - */ - protected void setCreatedFigure(Figure newCreatedFigure) { - fCreatedFigure = newCreatedFigure; - } - - /** - * Gets the figure that was actually added - * Note, this can be a different figure from the one which has been created. - */ - protected Figure getAddedFigure() { - return myAddedFigure; - } - - /** - * Sets the addedFigure attribute of the CreationTool object - */ - protected void setAddedFigure(Figure newAddedFigure) { - myAddedFigure = newAddedFigure; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new PasteCommand.UndoActivity(getActiveView()); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/standard/CutCommand.java b/JHotDraw/src/CH/ifa/draw/standard/CutCommand.java deleted file mode 100644 index 14ae15f8a262ebb115d3967cf73236375a66416a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/CutCommand.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * @(#)CutCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.util.List; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; - -/** - * Delete the selection and move the selected figures to - * the clipboard. - * - * @see CH.ifa.draw.util.Clipboard - * - * @version <$CURRENT_VERSION$> - */ -public class CutCommand extends FigureTransferCommand { - - /** - * Constructs a cut command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public CutCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - /** - * @see CH.ifa.draw.util.Command#execute() - */ - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - /* ricardo_padilha: bugfix for correct delete/undelete behavior - * When enumerating the affected figures we must not forget the dependent - * figures, since they are deleted as well! - */ - FigureEnumeration fe = view().selection(); - List affected = CollectionsFactory.current().createList(); - Figure f; - FigureEnumeration dfe; - while (fe.hasNextFigure()) { - f = fe.nextFigure(); - affected.add(0, f); - dfe = f.getDependendFigures(); - if (dfe != null) { - while (dfe.hasNextFigure()) { - affected.add(0, dfe.nextFigure()); - } - } - } - fe = new FigureEnumerator(affected); - getUndoActivity().setAffectedFigures(fe); - UndoActivity ua = (UndoActivity) getUndoActivity(); - ua.setSelectedFigures(view().selection()); - copyFigures(ua.getSelectedFigures(), ua.getSelectedFiguresCount()); - /* ricardo_padilha: end of bugfix */ - deleteFigures(getUndoActivity().getAffectedFigures()); - view().checkDamage(); - } - - /** - * @see CH.ifa.draw.standard.AbstractCommand#isExecutableWithView() - */ - public boolean isExecutableWithView() { - return view().selectionCount() > 0; - } - - /** - * Factory method for undo activity - * @return Undoable - */ - protected Undoable createUndoActivity() { - return new CutCommand.UndoActivity(this); - } - - public static class UndoActivity extends UndoableAdapter { - - private FigureTransferCommand myCommand; - private List mySelectedFigures; - - /** - * Constructor for <code>UndoActivity</code>. - * @param newCommand - */ - public UndoActivity(FigureTransferCommand newCommand) { - super(newCommand.view()); - myCommand = newCommand; - setUndoable(true); - setRedoable(true); - } - - /** - * @see CH.ifa.draw.util.Undoable#undo() - */ - public boolean undo() { - if (super.undo() && getAffectedFigures().hasNextFigure()) { - getDrawingView().clearSelection(); - myCommand.insertFigures(getAffectedFiguresReversed(), 0, 0); - return true; - } - return false; - } - - /** - * @see CH.ifa.draw.util.Undoable#redo() - */ - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - myCommand.copyFigures(getSelectedFigures(), getSelectedFiguresCount()); - myCommand.deleteFigures(getAffectedFigures()); - return true; - } - - return false; - } - - /** - * Preserve the selection of figures the moment the command was executed. - * @param newSelectedFigures - */ - public void setSelectedFigures(FigureEnumeration newSelectedFigures) { - // the enumeration is not reusable therefore a copy is made - // to be able to undo-redo the command several time - rememberSelectedFigures(newSelectedFigures); - } - - /** - * Preserve a copy of the enumeration in a private list. - * @param toBeRemembered - */ - protected void rememberSelectedFigures(FigureEnumeration toBeRemembered) { - mySelectedFigures = CollectionsFactory.current().createList(); - while (toBeRemembered.hasNextFigure()) { - mySelectedFigures.add(toBeRemembered.nextFigure()); - } - } - - /** - * Returns the selection of figures to perform the command on. - * @return - */ - public FigureEnumeration getSelectedFigures() { - return new FigureEnumerator( - CollectionsFactory.current().createList(mySelectedFigures)); - } - - /** - * Returns the size of the selection. - * @return - */ - public int getSelectedFiguresCount() { - return mySelectedFigures.size(); - } - - /** - * @see CH.ifa.draw.util.UndoableAdapter#release() - */ - public void release() { - super.release(); - FigureEnumeration fe = getSelectedFigures(); - while (fe.hasNextFigure()) { - fe.nextFigure().release(); - } - setSelectedFigures(FigureEnumerator.getEmptyEnumeration()); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/DecoratorFigure.java b/JHotDraw/src/CH/ifa/draw/standard/DecoratorFigure.java deleted file mode 100644 index 51f76e71d12b60591565255d58053e8e6b2a63d8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/DecoratorFigure.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * @(#)DecoratorFigure.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; - -import java.awt.*; -import java.io.*; - -/** - * DecoratorFigure can be used to decorate other figures with - * decorations like borders. Decorator forwards all the - * methods to their contained figure. Subclasses can selectively - * override these methods to extend and filter their behavior. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld014.htm>Decorator</a></b><br> - * DecoratorFigure is a decorator. - * - * @see Figure - * - * @version <$CURRENT_VERSION$> - */ - -public abstract class DecoratorFigure - extends AbstractFigure - implements FigureChangeListener { - - /** - * The decorated figure. - */ - private Figure myDecoratedFigure; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 8993011151564573288L; - private int decoratorFigureSerializedDataVersion = 1; - - public DecoratorFigure() { - initialize(); - } - - /** - * Constructs a DecoratorFigure and decorates the passed in figure. - */ - public DecoratorFigure(Figure figure) { - initialize(); - decorate(figure); - } - - /** - * Performs additional initialization code before the figure is decorated. - * Subclasses may override this method. - */ - protected void initialize() { - } - - /** - * Forwards the connection insets to its contained figure.. - */ - public Insets connectionInsets() { - return getDecoratedFigure().connectionInsets(); - } - - /** - * Forwards the canConnect to its contained figure.. - */ - public boolean canConnect() { - return getDecoratedFigure().canConnect(); - } - - /** - * Forwards containsPoint to its contained figure. - */ - public boolean containsPoint(int x, int y) { - return getDecoratedFigure().containsPoint(x, y); - } - - /** - * Decorates the given figure. - */ - public void decorate(Figure figure) { - setDecoratedFigure(figure); - getDecoratedFigure().addToContainer(this); - //addDependendFigure(getDecoratedFigure()); - } - - /** - * Removes the decoration from the contained figure. - */ - public Figure peelDecoration() { - getDecoratedFigure().removeFromContainer(this); //??? set the container to the listener()? - removeDependendFigure(getDecoratedFigure()); - return getDecoratedFigure(); - } - - public void setDecoratedFigure(Figure newDecoratedFigure) { - myDecoratedFigure = newDecoratedFigure; - } - - public Figure getDecoratedFigure() { - return myDecoratedFigure; - } - - /** - * Forwards displayBox to its contained figure. - */ - public Rectangle displayBox() { - return getDecoratedFigure().displayBox(); - } - - /** - * Forwards basicDisplayBox to its contained figure. - */ - public void basicDisplayBox(Point origin, Point corner) { - getDecoratedFigure().basicDisplayBox(origin, corner); - } - - /** - * Forwards draw to its contained figure. - */ - public void draw(Graphics g) { - getDecoratedFigure().draw(g); - } - - /** - * Forwards findFigureInside to its contained figure. - */ - public Figure findFigureInside(int x, int y) { - Figure foundFigure = getDecoratedFigure().findFigureInside(x, y); - // if the found figure is the same as the one the DecoratorFigure decorates - // then do not peel of the decoration - if ((foundFigure != null) && (foundFigure == getDecoratedFigure())) { - return this; - } - else { - return foundFigure; - } - } - - /** - * Forwards handles to its contained figure. - */ - public HandleEnumeration handles() { - return getDecoratedFigure().handles(); - } - - /** - * Forwards includes to its contained figure. - */ - public boolean includes(Figure figure) { - return (super.includes(figure) || getDecoratedFigure().includes(figure)); - } - - /** - * Forwards moveBy to its contained figure. - */ - public void moveBy(int x, int y) { - getDecoratedFigure().moveBy(x, y); - } - - /** - * Forwards basicMoveBy to its contained figure. - */ - protected void basicMoveBy(int x, int y) { - // this will never be called - } - - /** - * Releases itself and the contained figure. - */ - public void release() { - super.release(); - getDecoratedFigure().removeFromContainer(this); - getDecoratedFigure().release(); - } - - /** - * Propagates invalidate up the container chain. - * @see FigureChangeListener - */ - public void figureInvalidated(FigureChangeEvent e) { - if (listener() != null) { - listener().figureInvalidated(e); - } - } - - public void figureChanged(FigureChangeEvent e) { - } - - public void figureRemoved(FigureChangeEvent e) { - } - - /** - * Propagates figureRequestUpdate up the container chain. - * @see FigureChangeListener - */ - public void figureRequestUpdate(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRequestUpdate(e); - } - } - - /** - * Propagates the removeFromDrawing request up to the container. - * @see FigureChangeListener - */ - public void figureRequestRemove(FigureChangeEvent e) { - if (listener() != null) { - listener().figureRequestRemove(new FigureChangeEvent(this)); - } - } - - /** - * Forwards figures to its contained figure. - */ - public FigureEnumeration figures() { - return getDecoratedFigure().figures(); - } - - /** - * Forwards decompose to its contained figure. - */ - public FigureEnumeration decompose() { - return getDecoratedFigure().decompose(); - } - - /** - * Forwards setAttribute to its contained figure. - * - * @deprecated use setAttribute(FigureAttributeConstant, Object) instead - */ - public void setAttribute(String name, Object value) { - getDecoratedFigure().setAttribute(name, value); - } - - /** - * Forwards setAttribute to its contained figure. - */ - public void setAttribute(FigureAttributeConstant attributeConstant, Object value) { - getDecoratedFigure().setAttribute(attributeConstant, value); - } - - /** - * Forwards getAttribute to its contained figure. - * - * @deprecated use getAttribute(FigureAttributeConstant) instead - */ - public Object getAttribute(String name) { - return getDecoratedFigure().getAttribute(name); - } - - /** - * Forwards getAttribute to its contained figure. - */ - public Object getAttribute(FigureAttributeConstant attributeConstant) { - return getDecoratedFigure().getAttribute(attributeConstant); - } - - /** - * Returns the locator used to located connected text. - */ - public Locator connectedTextLocator(Figure text) { - return getDecoratedFigure().connectedTextLocator(text); - } - - /** - * Returns the Connector for the given location. - */ - public Connector connectorAt(int x, int y) { - return getDecoratedFigure().connectorAt(x, y); - } - - /** - * Forwards the connector visibility request to its component. - */ - public void connectorVisibility(boolean isVisible, ConnectionFigure courtingConnection) { - getDecoratedFigure().connectorVisibility(isVisible, null); - } - - /** - * Writes itself and the contained figure to the StorableOutput. - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeStorable(getDecoratedFigure()); - } - - /** - * Reads itself and the contained figure from the StorableInput. - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - decorate((Figure)dr.readStorable()); - } - - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - - getDecoratedFigure().addToContainer(this); - } -/* - public void visit(FigureVisitor visitor) { - super.visit(visitor); -// getDecoratedFigure().visit(visitor); - } -*/ - public TextHolder getTextHolder() { - return getDecoratedFigure().getTextHolder(); - } - - public synchronized FigureEnumeration getDependendFigures() { - return getDecoratedFigure().getDependendFigures(); - } - - public synchronized void addDependendFigure(Figure newDependendFigure) { - getDecoratedFigure().addDependendFigure(newDependendFigure); - } - - public synchronized void removeDependendFigure(Figure oldDependendFigure) { - getDecoratedFigure().removeDependendFigure(oldDependendFigure); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/DeleteCommand.java b/JHotDraw/src/CH/ifa/draw/standard/DeleteCommand.java deleted file mode 100644 index 37a4c8f9da5dc03d92bd91d473521ae7f8fdd5bd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/DeleteCommand.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)DeleteCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.util.List; - -import CH.ifa.draw.framework.DrawingEditor; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.Undoable; -import CH.ifa.draw.util.UndoableAdapter; - -/** - * Command to delete the selection. - * - * @version <$CURRENT_VERSION$> - */ -public class DeleteCommand extends FigureTransferCommand { - - /** - * Constructs a delete command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public DeleteCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - /** - * @see CH.ifa.draw.util.Command#execute() - */ - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - /* ricardo_padilha: bugfix for correct delete/undelete behavior - * When enumerating the affected figures we must not forget the dependent - * figures, since they are deleted as well! - */ - FigureEnumeration fe = view().selection(); - List affected = CollectionsFactory.current().createList(); - Figure f; - FigureEnumeration dfe; - while (fe.hasNextFigure()) { - f = fe.nextFigure(); - affected.add(0, f); - dfe = f.getDependendFigures(); - if (dfe != null) { - while (dfe.hasNextFigure()) { - affected.add(0, dfe.nextFigure()); - } - } - } - fe = new FigureEnumerator(affected); - getUndoActivity().setAffectedFigures(fe); - /* ricardo_padilha: end of bugfix */ - deleteFigures(getUndoActivity().getAffectedFigures()); - view().checkDamage(); - } - - /** - * @see CH.ifa.draw.standard.AbstractCommand#isExecutableWithView() - */ - protected boolean isExecutableWithView() { - return view().selectionCount() > 0; - } - - /** - * Factory method for undo activity - * @return Undoable - */ - protected Undoable createUndoActivity() { - return new DeleteCommand.UndoActivity(this); - } - - public static class UndoActivity extends UndoableAdapter { - - private FigureTransferCommand myCommand; - - /** - * Constructor for <code>UndoActivity</code>. - * @param newCommand parent command - */ - public UndoActivity(FigureTransferCommand newCommand) { - super(newCommand.view()); - myCommand = newCommand; - setUndoable(true); - setRedoable(true); - } - - /** - * @see CH.ifa.draw.util.Undoable#undo() - */ - public boolean undo() { - if (super.undo() && getAffectedFigures().hasNextFigure()) { - getDrawingView().clearSelection(); - setAffectedFigures( - myCommand.insertFigures(getAffectedFiguresReversed(), 0, 0)); - return true; - } - return false; - } - - /** - * @see CH.ifa.draw.util.Undoable#redo() - */ - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - myCommand.deleteFigures(getAffectedFigures()); - getDrawingView().clearSelection(); - return true; - } - return false; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/DeleteFromDrawingVisitor.java b/JHotDraw/src/CH/ifa/draw/standard/DeleteFromDrawingVisitor.java deleted file mode 100644 index abb71928a2e7b5f9f8530f4293d811bfcbb01bde..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/DeleteFromDrawingVisitor.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * @(#)DeleteFromDrawingVisitor.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.Set; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class DeleteFromDrawingVisitor implements FigureVisitor { - private Set myDeletedFigures; - private Drawing myDrawing; - - public DeleteFromDrawingVisitor(Drawing newDrawing) { - myDeletedFigures = CollectionsFactory.current().createSet(); - setDrawing(newDrawing); - } - - private void setDrawing(Drawing newDrawing) { - myDrawing = newDrawing; - } - - protected Drawing getDrawing() { - return myDrawing; - } - - public void visitFigure(Figure hostFigure) { - if (!myDeletedFigures.contains(hostFigure) && getDrawing().containsFigure(hostFigure)) { - Figure orphanedFigure = getDrawing().orphan(hostFigure); - myDeletedFigures.add(orphanedFigure); - } - } - - public void visitHandle(Handle hostHandle) { - } - - public void visitFigureChangeListener(FigureChangeListener hostFigureChangeListener) { -// System.out.println("visitFigureChangeListener: " + hostFigureChangeListener); -// hostFigureChangeListener.visit(this); - } - - public FigureEnumeration getDeletedFigures() { - return new FigureEnumerator(myDeletedFigures); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/DragTracker.java b/JHotDraw/src/CH/ifa/draw/standard/DragTracker.java deleted file mode 100644 index 82265fef8b1cac80e34aa2812a286a440201acaf..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/DragTracker.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * @(#)DragTracker.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; -import java.awt.*; -import java.awt.event.MouseEvent; - -/** - * DragTracker implements the dragging of the clicked - * figure. - * - * @see SelectionTool - * - * @version <$CURRENT_VERSION$> - */ -public class DragTracker extends AbstractTool { - - private Figure fAnchorFigure; - private int fLastX, fLastY; // previous mouse position - private boolean fMoved = false; - - public DragTracker(DrawingEditor newDrawingEditor, Figure anchor) { - super(newDrawingEditor); - setAnchorFigure(anchor); - } - - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e, x, y); - setLastMouseX(x); - setLastMouseY(y); - - if (e.isShiftDown()) { - getActiveView().toggleSelection(getAnchorFigure()); - setAnchorFigure(null); - } - else if (!getActiveView().isFigureSelected(getAnchorFigure())) { - getActiveView().clearSelection(); - getActiveView().addToSelection(getAnchorFigure()); - } - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures(getActiveView().selection()); -// getUndoActivity().setAffectedFigures(view().selectionElements()); - } - - public void mouseDrag(MouseEvent e, int x, int y) { - super.mouseDrag(e, x, y); - setHasMoved((Math.abs(x - getAnchorX()) > 4) || (Math.abs(y - getAnchorY()) > 4)); - - if (hasMoved()) { - FigureEnumeration figures = getUndoActivity().getAffectedFigures(); - while (figures.hasNextFigure()) { - figures.nextFigure().moveBy(x - getLastMouseX(), y - getLastMouseY()); - } - } - setLastMouseX(x); - setLastMouseY(y); - } - - protected void setAnchorFigure(Figure newAnchorFigure) { - fAnchorFigure = newAnchorFigure; - } - - public Figure getAnchorFigure() { - return fAnchorFigure; - } - - protected void setLastMouseX(int newLastMouseX) { - fLastX = newLastMouseX; - } - - protected int getLastMouseX() { - return fLastX; - } - - protected void setLastMouseY(int newLastMouseY) { - fLastY = newLastMouseY; - } - - protected int getLastMouseY() { - return fLastY; - } - - /** - * Check whether the selected figure has been moved since - * the tool has been activated. - * - * @return true if the selected figure has been moved - */ - public boolean hasMoved() { - return fMoved; - } - - protected void setHasMoved(boolean newMoved) { - fMoved = newMoved; - } - - public void activate() { - // suppress clearSelection() and tool-activation-notification - // in superclass - } - - public void deactivate() { - if (hasMoved()) { - ((DragTracker.UndoActivity)getUndoActivity()).setBackupPoint(new Point(getLastMouseX(), getLastMouseY())); - } - else { - setUndoActivity(null); - } - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new DragTracker.UndoActivity(getActiveView(), new Point(getLastMouseX(), getLastMouseY())); - } - - public static class UndoActivity extends UndoableAdapter { - private Point myOriginalPoint; - private Point myBackupPoint; - - public UndoActivity(DrawingView newDrawingView, Point newOriginalPoint) { - super(newDrawingView); - setOriginalPoint(newOriginalPoint); - setUndoable(true); - setRedoable(true); - } - - /* - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo() { - if (!super.undo()) { - return false; - } - moveAffectedFigures(getBackupPoint(), getOriginalPoint()); - return true; - } - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo() { - if (!super.redo()) { - return false; - } - moveAffectedFigures(getOriginalPoint(), getBackupPoint()); - return true; - } - - public void setBackupPoint(Point newBackupPoint) { - myBackupPoint = newBackupPoint; - } - - public Point getBackupPoint() { - return myBackupPoint; - } - - public void setOriginalPoint(Point newOriginalPoint) { - myOriginalPoint = newOriginalPoint; - } - - public Point getOriginalPoint() { - return myOriginalPoint; - } - - public void moveAffectedFigures(Point startPoint, Point endPoint) { - FigureEnumeration figures = getAffectedFigures(); - while (figures.hasNextFigure()) { - figures.nextFigure().moveBy(endPoint.x - startPoint.x, - endPoint.y - startPoint.y); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/DuplicateCommand.java b/JHotDraw/src/CH/ifa/draw/standard/DuplicateCommand.java deleted file mode 100644 index a5ade44ed28ef9650ec1eaa21f92068e8eab89ff..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/DuplicateCommand.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * @(#)DuplicateCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -/** - * Duplicate the selection and select the duplicates. - * - * @version <$CURRENT_VERSION$> - */ -public class DuplicateCommand extends FigureTransferCommand { - - /** - * Constructs a duplicate command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public DuplicateCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - FigureSelection selection = view().getFigureSelection(); - - // create duplicate figure(s) - FigureEnumeration figures = (FigureEnumeration)selection.getData(StandardFigureSelection.TYPE); - getUndoActivity().setAffectedFigures(figures); - - view().clearSelection(); - getUndoActivity().setAffectedFigures( - insertFigures(getUndoActivity().getAffectedFigures(), 10, 10)); - view().checkDamage(); - } - - protected boolean isExecutableWithView() { - return view().selectionCount() > 0; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new PasteCommand.UndoActivity(view()); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/FastBufferedUpdateStrategy.java b/JHotDraw/src/CH/ifa/draw/standard/FastBufferedUpdateStrategy.java deleted file mode 100644 index 69e6bf71c207ba5fc2088744f29662506f1a116c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/FastBufferedUpdateStrategy.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * @(#)FastBufferedUpdateStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import CH.ifa.draw.framework.Drawing; -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.framework.Painter; - -/** - * @author WMG (INIT Copyright (C) 2000 All rights reserved) - * @version <$CURRENT_VERSION$> - */ -public class FastBufferedUpdateStrategy implements Painter { - - //_________________________________________________________VARIABLES - - private BufferedImage _doubleBufferedImage; - private BufferedImage _scratchPadBufferedImage; - private int _nImageWidth = 0; - private int _nImageHeight = 0; - private boolean _bRedrawAll = true; - - //______________________________________________________CONSTRUCTORS - - public FastBufferedUpdateStrategy() { - } - - //____________________________________________________PUBLIC METHODS - - public void draw(Graphics g, DrawingView view) { - _checkCaches(view); - if (_bRedrawAll == true) { - Graphics imageGraphics = _doubleBufferedImage.getGraphics(); - view.drawAll(imageGraphics); - } - else { - Rectangle viewClipRectangle = g.getClipBounds(); - int nX1 = viewClipRectangle.x; - int nY1 = viewClipRectangle.y; - int nX2 = viewClipRectangle.x + viewClipRectangle.width; - int nY2 = viewClipRectangle.y + viewClipRectangle.height; - - if (nX1 < 0) { - nX1 = 0; - } - if (nY1 < 0) { - nY1 = 0; - } - if (nX2 < 0) { - nX2 = 0; - } - if (nY2 < 0) { - nY2 = 0; - } - - Rectangle viewClipRectangle2 = new Rectangle(nX1, nY1, nX2-nX1, nY2-nY1); - - Drawing theDrawing = view.drawing(); - FigureEnumeration fe = theDrawing.figures(viewClipRectangle2); - - Graphics imageGraphics = _scratchPadBufferedImage.getGraphics(); - imageGraphics.setColor(view.getBackground()); - imageGraphics.fillRect(nX1, nY1, nX2-nX1, nY2-nY1); - view.draw(imageGraphics, fe); - - Graphics dbGraphics = _doubleBufferedImage.getGraphics(); - dbGraphics.drawImage(_scratchPadBufferedImage, nX1, nY1, - nX2, nY2, nX1, nY1, nX2, nY2, view); - - } - - g.drawImage(_doubleBufferedImage, 0, 0, view); - _bRedrawAll = false; - } - - - //___________________________________________________PRIVATE METHODS - - - private void _checkCaches(DrawingView view) { - Dimension d = view.getSize(); - - if ((_doubleBufferedImage == null) - || (_nImageWidth != d.width) - || (_nImageHeight != d.height)) { - _doubleBufferedImage = new BufferedImage(d.width, - d.height, BufferedImage.TYPE_INT_RGB); - _bRedrawAll = true; - } - - if ((_scratchPadBufferedImage == null) - || (_nImageWidth != d.width) - || (_nImageHeight != d.height)) { - _scratchPadBufferedImage = new BufferedImage(d.width, - d.height, BufferedImage.TYPE_INT_RGB); - Graphics imageGraphics = _scratchPadBufferedImage.getGraphics(); - view.drawBackground(imageGraphics); - _bRedrawAll = true; - } - - _nImageWidth = d.width; - _nImageHeight = d.height; - } - - //_______________________________________________________________END - -} //end of class FastBufferedUpdateStrategy diff --git a/JHotDraw/src/CH/ifa/draw/standard/FigureAndEnumerator.java b/JHotDraw/src/CH/ifa/draw/standard/FigureAndEnumerator.java deleted file mode 100644 index 39851c903fce02af83185bde96a65bc19e5b43a7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/FigureAndEnumerator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @(#)FigureAndEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.framework.Figure; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class FigureAndEnumerator implements FigureEnumeration { - private FigureEnumeration myFE1; - private FigureEnumeration myFE2; - - public FigureAndEnumerator(FigureEnumeration newFE1, FigureEnumeration newFE2) { - myFE1 = newFE1; - myFE2 = newFE2; - } - - public Figure nextFigure() { - if (myFE1.hasNextFigure()) { - return myFE1.nextFigure(); - } - else if (myFE2.hasNextFigure()) { - return myFE2.nextFigure(); - } - else { - // todo: throw exception - return null; - } - } - - public boolean hasNextFigure() { - return myFE1.hasNextFigure() || myFE2.hasNextFigure(); - } - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset() { - myFE1.reset(); - myFE2.reset(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/FigureChangeAdapter.java b/JHotDraw/src/CH/ifa/draw/standard/FigureChangeAdapter.java deleted file mode 100644 index 0608c87df8683b59a9e49af9de0a10381adf4a70..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/FigureChangeAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * @(#)FigureChangeAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; - -/** - * Empty implementation of FigureChangeListener. - * - * @version <$CURRENT_VERSION$> - */ -public class FigureChangeAdapter implements FigureChangeListener { - - /** - * Sent when an area is invalid - */ - public void figureInvalidated(FigureChangeEvent e) {} - - /** - * Sent when a figure changed - */ - public void figureChanged(FigureChangeEvent e) {} - - /** - * Sent when a figure was removed - */ - public void figureRemoved(FigureChangeEvent e) {} - - /** - * Sent when requesting to remove a figure. - */ - public void figureRequestRemove(FigureChangeEvent e) {} - - /** - * Sent when an update should happen. - * - */ - public void figureRequestUpdate(FigureChangeEvent e) {} - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/FigureChangeEventMulticaster.java b/JHotDraw/src/CH/ifa/draw/standard/FigureChangeEventMulticaster.java deleted file mode 100644 index a451754235d70693ad98fe14eea2890bea0c2f34..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/FigureChangeEventMulticaster.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * @(#)FigureChangeEventMulticaster.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import java.awt.*; -import java.util.*; - -/** - * Manages a list of FigureChangeListeners to be notified of - * specific FigureChangeEvents. - * - * @version <$CURRENT_VERSION$> - */ -public class FigureChangeEventMulticaster extends - AWTEventMulticaster implements FigureChangeListener { - - public FigureChangeEventMulticaster(EventListener newListenerA, EventListener newListenerB) { - super(newListenerA, newListenerB); - } - - public void figureInvalidated(FigureChangeEvent e) { - ((FigureChangeListener)a).figureInvalidated(e); - ((FigureChangeListener)b).figureInvalidated(e); - } - - public void figureRequestRemove(FigureChangeEvent e) { - ((FigureChangeListener)a).figureRequestRemove(e); - ((FigureChangeListener)b).figureRequestRemove(e); - } - - public void figureRequestUpdate(FigureChangeEvent e) { - ((FigureChangeListener)a).figureRequestUpdate(e); - ((FigureChangeListener)b).figureRequestUpdate(e); - } - - public void figureChanged(FigureChangeEvent e) { - ((FigureChangeListener)a).figureChanged(e); - ((FigureChangeListener)b).figureChanged(e); - } - - public void figureRemoved(FigureChangeEvent e) { - ((FigureChangeListener)a).figureRemoved(e); - ((FigureChangeListener)b).figureRemoved(e); - } - - public static FigureChangeListener add(FigureChangeListener a, FigureChangeListener b) { - return (FigureChangeListener)addInternal(a, b); - } - - - public static FigureChangeListener remove(FigureChangeListener l, FigureChangeListener oldl) { - return (FigureChangeListener) removeInternal(l, oldl); - } - - protected EventListener remove(EventListener oldl) - { - if (oldl == a) { - return b; - } - if (oldl == b) { - return a; - } - EventListener a2 = removeInternal(a, oldl); - EventListener b2 = removeInternal(b, oldl); - if (a2 == a && b2 == b) { - return this; - } - else { - return addInternal((FigureChangeListener)a2, (FigureChangeListener)b2); - } - } - - protected static EventListener addInternal(FigureChangeListener a, FigureChangeListener b) { - if (a == null) { - return b; - } - if (b == null) { - return a; - } - return new FigureChangeEventMulticaster(a, b); - } - - protected static EventListener removeInternal(EventListener l, EventListener oldl) { - if (l == oldl || l == null) { - return null; - } - else if (l instanceof FigureChangeEventMulticaster) { - return ((FigureChangeEventMulticaster)l).remove(oldl); - } - else { - return l; // it's not here - } - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/FigureEnumerator.java b/JHotDraw/src/CH/ifa/draw/standard/FigureEnumerator.java deleted file mode 100644 index dcd13f962d1556f2451a2a46a1d1cc322e7e1ef7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/FigureEnumerator.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * @(#)FigureEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.Iterator; -import java.util.Collection; - - -/** - * An Enumeration for a Collection of Figures. - * - * @version <$CURRENT_VERSION$> - */ -public final class FigureEnumerator implements FigureEnumeration { - private Iterator myIterator; - private Collection myInitialCollection; - - private static FigureEnumerator singletonEmptyEnumerator = - new FigureEnumerator(CollectionsFactory.current().createList()); - - public FigureEnumerator(Collection c) { - myInitialCollection = c; - reset(); - } - - /** - * Returns true if the enumeration contains more elements; false - * if its empty. - */ - public boolean hasNextFigure() { - return myIterator.hasNext(); - } - - /** - * Returns the next element of the enumeration. Calls to this - * method will enumerate successive elements. - * @exception java.util.NoSuchElementException If no more elements exist. - */ - public Figure nextFigure() { - return (Figure)myIterator.next(); - } - - public static FigureEnumeration getEmptyEnumeration() { - return singletonEmptyEnumerator; - } - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset() { - myIterator = myInitialCollection.iterator(); - } - -/* public static FigureEnumeration getClonedFigures(FigureEnumeration toDuplicate) { - List v = CollectionsFactory.current().createList(); - while (toDuplicate.hasMoreElements()) { - try { - v.addElement(toDuplicate.nextFigure().clone()); - } - catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - } - return new FigureEnumerator(v); - } -*/ -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/FigureTransferCommand.java b/JHotDraw/src/CH/ifa/draw/standard/FigureTransferCommand.java deleted file mode 100644 index 48a8277e2549a6bda15de7fa79f72afd16b6a7b6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/FigureTransferCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * @(#)FigureTransferCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; - -/** - * Common base clase for commands that transfer figures - * between a drawing and the clipboard. - * - * @version <$CURRENT_VERSION$> - */ -public abstract class FigureTransferCommand extends AbstractCommand { - - /** - * Constructs a drawing command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - protected FigureTransferCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - /** - * Deletes the selection from the drawing. - */ - protected void deleteFigures(FigureEnumeration fe) { - DeleteFromDrawingVisitor deleteVisitor = new DeleteFromDrawingVisitor(view().drawing()); - while (fe.hasNextFigure()) { - fe.nextFigure().visit(deleteVisitor); - } - - view().clearSelection(); - } - - /** - * Copies the FigureEnumeration to the clipboard. - */ - protected void copyFigures(FigureEnumeration fe, int figureCount) { - Clipboard.getClipboard().setContents(new StandardFigureSelection(fe, figureCount)); - } - - /** - * Inserts an enumeration of figures and translates them by the - * given offset. - * @todo mrfloppy to investigate making this protected. Looks like it would - * be no problem to me. It was package scope. I thought it safer to - * make it less restrictive just incase their was a reason for the - * package scope I didn't know about. dnoyeb. - * Bug - [ 673096 ] FigureTransferCommand has a wrong method - */ - public FigureEnumeration insertFigures(FigureEnumeration fe, int dx, int dy) { - return view().insertFigures(fe, dx, dy, false); - } -} - - diff --git a/JHotDraw/src/CH/ifa/draw/standard/GridConstrainer.java b/JHotDraw/src/CH/ifa/draw/standard/GridConstrainer.java deleted file mode 100644 index f3b7b80d5aec80e0e647692597356045c56c9c7d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/GridConstrainer.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * @(#)GridConstrainer.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.PointConstrainer; -import java.awt.*; -import java.io.Serializable; - -/** - * Constrains a point such that it falls on a grid. - * - * @see CH.ifa.draw.framework.DrawingView - * - * @version <$CURRENT_VERSION$> - */ -public class GridConstrainer implements PointConstrainer, Serializable { - - private int fGridX; - private int fGridY; - - public GridConstrainer(int x, int y) { - fGridX = Math.max(1, x); - fGridY = Math.max(1, y); - } - - /** - * Constrains the given point. - * @return constrained point. - */ - public Point constrainPoint(Point p) { - p.x = ((p.x+fGridX/2) / fGridX) * fGridX; - p.y = ((p.y+fGridY/2) / fGridY) * fGridY; - return p; - } - - /** - * Gets the x offset to move an object. - */ - public int getStepX() { - return fGridX; - } - - /** - * Gets the y offset to move an object. - */ - public int getStepY() { - return fGridY; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/HandleAndEnumerator.java b/JHotDraw/src/CH/ifa/draw/standard/HandleAndEnumerator.java deleted file mode 100644 index d5ed93f16ec24e3a341fd8764cfb3995df7bb5b9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/HandleAndEnumerator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * @(#)HandleAndEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.HandleEnumeration; -import CH.ifa.draw.framework.Handle; - -import java.util.List; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class HandleAndEnumerator implements HandleEnumeration { - private HandleEnumeration myHE1; - private HandleEnumeration myHE2; - - public HandleAndEnumerator(HandleEnumeration newHE1, HandleEnumeration newHE2) { - myHE1 = newHE1; - myHE2 = newHE2; - } - - public Handle nextHandle() { - if (myHE1.hasNextHandle()) { - return myHE1.nextHandle(); - } - else if (myHE2.hasNextHandle()) { - return myHE2.nextHandle(); - } - else { - // todo: throw exception - return null; - } - } - - public boolean hasNextHandle() { - return myHE1.hasNextHandle() || myHE2.hasNextHandle(); - } - - public List toList() { - List joinedList = myHE1.toList(); - joinedList.addAll(myHE2.toList()); - return joinedList; - } - - public void reset() { - myHE1.reset(); - myHE2.reset(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/HandleEnumerator.java b/JHotDraw/src/CH/ifa/draw/standard/HandleEnumerator.java deleted file mode 100644 index 9b0f77c9cc81d40f479e7b47f0bd1233b116d1ae..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/HandleEnumerator.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * @(#)HandleEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.framework.HandleEnumeration; -import CH.ifa.draw.framework.Handle; - -import java.util.Iterator; -import java.util.Collection; -import java.util.List; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class HandleEnumerator implements HandleEnumeration { - private Iterator myIterator; - private Collection myInitialCollection; - - private static HandleEnumerator singletonEmptyEnumerator = - new HandleEnumerator(CollectionsFactory.current().createList()); - - public HandleEnumerator(Collection c) { - myInitialCollection = c; - reset(); - } - - /** - * Returns true if the enumeration contains more elements; false - * if its empty. - */ - public boolean hasNextHandle() { - return myIterator.hasNext(); - } - - /** - * Returns the next element of the enumeration. Calls to this - * method will enumerate successive elements. - * @exception java.util.NoSuchElementException If no more elements exist. - */ - public Handle nextHandle() { - return (Handle)myIterator.next(); - } - - /** - * Returns a list with all elements currently available in the enumeration. - * That means, elements retrieved already by calling nextHandle() are not - * contained. This method does not change the position of the enumeration. - * Warning: this method is not necessarily synchronized so this enumeration should not - * be modified at the same time! - * - * @return list with all elements currently available in the enumeration. - */ - public List toList() { - List handles = CollectionsFactory.current().createList(); - while (hasNextHandle()) { - handles.add(nextHandle()); - } - // copy/reset iterator to original content - myIterator = handles.iterator(); - return handles; - } - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset() { - myIterator = myInitialCollection.iterator(); - } - - public static HandleEnumeration getEmptyEnumeration() { - return singletonEmptyEnumerator; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/HandleTracker.java b/JHotDraw/src/CH/ifa/draw/standard/HandleTracker.java deleted file mode 100644 index 1cc7487ce2ca75ead86857eeccc5a19bd7cb0638..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/HandleTracker.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * @(#)HandleTracker.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.event.MouseEvent; -import CH.ifa.draw.framework.*; - -/** - * HandleTracker implements interactions with the handles of a Figure. - * - * @see SelectionTool - * - * @version <$CURRENT_VERSION$> - */ -public class HandleTracker extends AbstractTool { - - private Handle fAnchorHandle; - - public HandleTracker(DrawingEditor newDrawingEditor, Handle anchorHandle) { - super(newDrawingEditor); - fAnchorHandle = anchorHandle; - } - - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e, x, y); - fAnchorHandle.invokeStart(x, y, view()); - } - - public void mouseDrag(MouseEvent e, int x, int y) { - super.mouseDrag(e, x, y); - fAnchorHandle.invokeStep(x, y, getAnchorX(), getAnchorY(), view()); - } - - public void mouseUp(MouseEvent e, int x, int y) { - super.mouseUp(e, x, y); - fAnchorHandle.invokeEnd(x, y, getAnchorX(), getAnchorY(), view()); - } - - public void activate() { - // suppress clearSelection() and tool-activation-notification - // in superclass by providing an empty implementation - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/InsertIntoDrawingVisitor.java b/JHotDraw/src/CH/ifa/draw/standard/InsertIntoDrawingVisitor.java deleted file mode 100644 index 10b11d75a7c6e9212fd4385e596daa8159abb84f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/InsertIntoDrawingVisitor.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @(#)InsertIntoDrawingVisitor.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.Set; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class InsertIntoDrawingVisitor implements FigureVisitor { - private Set myInsertedFigures; - private Drawing myDrawing; - - public InsertIntoDrawingVisitor(Drawing newDrawing) { - myInsertedFigures = CollectionsFactory.current().createSet(); - setDrawing(newDrawing); - } - - private void setDrawing(Drawing newDrawing) { - myDrawing = newDrawing; - } - - protected Drawing getDrawing() { - return myDrawing; - } - - public void visitFigure(Figure hostFigure) { - if (!myInsertedFigures.contains(hostFigure) && !getDrawing().includes(hostFigure)) { - Figure addedFigure = getDrawing().add(hostFigure); - myInsertedFigures.add(addedFigure); - } - } - - public void visitHandle(Handle hostHandle) { - } - - public void visitFigureChangeListener(FigureChangeListener hostFigureChangeListener) { -// hostFigureChangeListener.visit(this); - } - - public FigureEnumeration getInsertedFigures() { - return new FigureEnumerator(myInsertedFigures); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/LocatorConnector.java b/JHotDraw/src/CH/ifa/draw/standard/LocatorConnector.java deleted file mode 100644 index a2b7ebf17901980ae48cddd09211caf729d03334..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/LocatorConnector.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @(#)LocatorConnector.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.io.IOException; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -/** - * A LocatorConnector locates connection points with - * the help of a Locator. It supports the definition - * of connection points to semantic locations. - * - * @see Locator - * @see Connector - * - * @version <$CURRENT_VERSION$> - */ -public class LocatorConnector extends AbstractConnector { - - /** - * The standard size of the connector. The display box - * is centered around the located point. - */ - public static final int SIZE = 8; - - private Locator myLocator; - - /* - * Serialization support. - */ - private static final long serialVersionUID = 5062833203337604181L; - private int locatorConnectorSerializedDataVersion = 1; - - public LocatorConnector() { // only used for Storable - setLocator(null); - } - - public LocatorConnector(Figure owner, Locator l) { - super(owner); - setLocator(l); - } - - /** - * Tests if a point is contained in the connector. - */ - public boolean containsPoint(int x, int y) { - return displayBox().contains(x, y); - } - - /** - * Gets the display box of the connector. - */ - public Rectangle displayBox() { - Point p = getLocator().locate(owner()); - return new Rectangle( - p.x - SIZE / 2, - p.y - SIZE / 2, - SIZE, - SIZE); - } - - /** - * Draws this connector. - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.blue); - g.fillOval(r.x, r.y, r.width, r.height); - g.setColor(Color.black); - g.drawOval(r.x, r.y, r.width, r.height); - } - - /** - * Stores the arrow tip to a StorableOutput. - */ - public void write(StorableOutput dw) { - super.write(dw); - dw.writeStorable(getLocator()); - } - - /** - * Reads the arrow tip from a StorableInput. - */ - public void read(StorableInput dr) throws IOException { - super.read(dr); - setLocator((Locator)dr.readStorable()); - } - - protected void setLocator(Locator newLocator) { - myLocator = newLocator; - } - - public Locator getLocator() { - return myLocator; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/LocatorHandle.java b/JHotDraw/src/CH/ifa/draw/standard/LocatorHandle.java deleted file mode 100644 index 2d94d9c14e29b96eac47fc43642c33f1335d04fd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/LocatorHandle.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * @(#)LocatorHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Point; - -import CH.ifa.draw.framework.Cursor; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.Locator; - -/** - * A LocatorHandle implements a Handle by delegating the location requests to - * a Locator object. - * - * @see LocatorHandle - * - * @version <$CURRENT_VERSION$> - */ -public class LocatorHandle extends AbstractHandle { - - private Locator fLocator; - - /** - * Initializes the LocatorHandle with the given Locator. - */ - public LocatorHandle(Figure owner, Locator l) { - super(owner); - fLocator = l; - } - /** - * This should be cloned or it gives the receiver the opportunity to alter - * our internal behavior. - */ - public Locator getLocator() { - return fLocator; - } - - /** - * Locates the handle on the figure by forwarding the request - * to its figure. - */ - public Point locate() { - return fLocator.locate(owner()); - } - - /** - * @see CH.ifa.draw.framework.Handle#getCursor() - */ - public Cursor getCursor() { - Cursor c = super.getCursor(); - if (getLocator() instanceof RelativeLocator) { - RelativeLocator rl = (RelativeLocator) getLocator(); - if (rl.equals( RelativeLocator.north())) { - c = new AWTCursor(java.awt.Cursor.N_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.northEast())) { - c = new AWTCursor(java.awt.Cursor.NE_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.east())) { - c = new AWTCursor(java.awt.Cursor.E_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.southEast())) { - c = new AWTCursor(java.awt.Cursor.SE_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.south())) { - c = new AWTCursor(java.awt.Cursor.S_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.southWest())) { - c = new AWTCursor(java.awt.Cursor.SW_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.west())) { - c = new AWTCursor(java.awt.Cursor.W_RESIZE_CURSOR); - } - else if (rl.equals(RelativeLocator.northWest())) { - c = new AWTCursor(java.awt.Cursor.NW_RESIZE_CURSOR); - } - } - return c; - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/NullDrawingView.java b/JHotDraw/src/CH/ifa/draw/standard/NullDrawingView.java deleted file mode 100644 index eab32cfbc28284c9c37e1b0be770fa36d71552d1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/NullDrawingView.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * @(#)NullDrawingView.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.util.Collection; -import java.util.Hashtable; - -import javax.swing.JPanel; - -import CH.ifa.draw.framework.*; - -/** - * This DrawingView provides a very basic implementation. It does not perform any - * functionality apart from keeping track of its state represented by some important - * fields. It is a Null-value object and is used instead of a null reference to - * avoid null pointer exception. This concept is known as the Null-value object - * bug pattern. - * - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class NullDrawingView extends JPanel implements DrawingView { - - private DrawingEditor myDrawingEditor; - private Drawing myDrawing; - private Painter myUpdateStrategy; - private Color myBackgroundColor; - - private static Hashtable drawingViewManager = new Hashtable(); - - protected NullDrawingView(DrawingEditor editor) { - setEditor(editor); - setDrawing(new StandardDrawing()); - } - - /** - * Sets the view's editor. - */ - public void setEditor(DrawingEditor editor) { - myDrawingEditor = editor; - } - - /** - * Gets the current tool. - */ - public Tool tool() { - return editor().tool(); - } - - /** - * Gets the drawing. - */ - public Drawing drawing() { - return myDrawing; - } - - /** - * Sets and installs another drawing in the view. - */ - public void setDrawing(Drawing d) { - myDrawing = d; - } - - /** - * Gets the editor. - */ - public DrawingEditor editor() { - return myDrawingEditor; - } - - /** - * Adds a figure to the drawing. - * @return the added figure. - */ - public Figure add(Figure figure) { - return figure; - } - - /** - * Removes a figure from the drawing. - * @return the removed figure - */ - public Figure remove(Figure figure) { - return figure; - } - - /** - * Adds a collection of figures to the drawing. - */ - public void addAll(Collection figures) { - // ignore: do nothing - } - - /** - * Gets the size of the drawing. - */ - public Dimension getSize() { - return new Dimension(); - } - - /** - * Gets the minimum dimension of the drawing. - */ - public Dimension getMinimumSize() { - return new Dimension(); - } - - /** - * Gets the preferred dimension of the drawing.. - */ - public Dimension getPreferredSize() { - return new Dimension(); - } - - /** - * Sets the current display update strategy. - * @see Painter - */ - public void setDisplayUpdate(Painter newUpdateStrategy) { - myUpdateStrategy = newUpdateStrategy; - } - - /** - * Gets the current display update strategy. - * @see Painter - */ - public Painter getDisplayUpdate() { - return myUpdateStrategy; - } - - /** - * Gets an enumeration over the currently selected figures. - * The selection is a snapshot of the current selection - * which does not get changed anymore - * - * @return an enumeration with the currently selected figures. - */ - public FigureEnumeration selection() { - return FigureEnumerator.getEmptyEnumeration(); - } - - /** - * Gets the currently seleced figures in Z order. - * @see #selection - * @return a FigureEnumeration with the selected figures. This enumeration - * represents a snapshot of the current selection. - */ - public FigureEnumeration selectionZOrdered() { - return FigureEnumerator.getEmptyEnumeration(); - } - - /** - * Gets the number of selected figures. - */ - public int selectionCount() { - return 0; - } - - /** - * Test whether a given figure is selected. - */ - public boolean isFigureSelected(Figure checkFigure) { - return false; - } - - /** - * Adds a figure to the current selection. - */ - public void addToSelection(Figure figure) { - // ignore: do nothing - } - - /** - * Adds a Collection of figures to the current selection. - */ - public void addToSelectionAll(Collection figures) { - // ignore: do nothing - } - - /** - * Adds a FigureEnumeration to the current selection. - */ - public void addToSelectionAll(FigureEnumeration fe) { - // ignore: do nothing - } - - /** - * Removes a figure from the selection. - */ - public void removeFromSelection(Figure figure) { - // ignore: do nothing - } - - /** - * If a figure isn't selected it is added to the selection. - * Otherwise it is removed from the selection. - */ - public void toggleSelection(Figure figure) { - // ignore: do nothing - } - - /** - * Clears the current selection. - */ - public void clearSelection() { - // ignore: do nothing - } - - /** - * Gets the current selection as a FigureSelection. A FigureSelection - * can be cut, copied, pasted. - */ - public FigureSelection getFigureSelection() { - return new StandardFigureSelection(selection(), 0); - } - - /** - * Finds a handle at the given coordinates. - * @return the hit handle, null if no handle is found. - */ - public Handle findHandle(int x, int y) { - return null; - } - - /** - * Gets the position of the last click inside the view. - */ - public Point lastClick() { - return new Point(); - } - - /** - * Sets the current point constrainer. - */ - public void setConstrainer(PointConstrainer p) { - // ignore: do nothing - } - - /** - * Gets the current grid setting. - */ - public PointConstrainer getConstrainer() { - return null; - } - - /** - * Checks whether the drawing has some accumulated damage - */ - public void checkDamage() { - // ignore: do nothing - } - - /** - * Repair the damaged area - */ - public void repairDamage() { - // ignore: do nothing - } - - /** - * Paints the drawing view. The actual drawing is delegated to - * the current update strategy. - * @see Painter - */ - public void paint(Graphics g) { - // ignore: do nothing - } - - /** - * Creates an image with the given dimensions - */ - public Image createImage(int width, int height) { - return null; - } - - /** - * Gets a graphic to draw into - */ - public Graphics getGraphics() { - return null; - } - - /** - * Gets the background color of the DrawingView - */ - public Color getBackground() { - return myBackgroundColor; - } - - /** - * Sets the background color of the DrawingView - */ - public void setBackground(Color c) { - myBackgroundColor = c; - } - - /** - * Draws the contents of the drawing view. - * The view has three layers: background, drawing, handles. - * The layers are drawn in back to front order. - */ - public void drawAll(Graphics g) { - // ignore: do nothing - } - - /** - * Draws the given figures. - * The view has three layers: background, drawing, handles. - * The layers are drawn in back to front order. - */ - public void draw(Graphics g, FigureEnumeration fe) { - // ignore: do nothing - } - - /** - * Draws the currently active handles. - */ - public void drawHandles(Graphics g) { - // ignore: do nothing - } - - /** - * Draws the drawing. - */ - public void drawDrawing(Graphics g) { - // ignore: do nothing - } - - /** - * Draws the background. If a background pattern is set it - * is used to fill the background. Otherwise the background - * is filled in the background color. - */ - public void drawBackground(Graphics g) { - // ignore: do nothing - } - - /** - * Sets the cursor of the DrawingView - */ - public void setCursor(CH.ifa.draw.framework.Cursor c) { - // ignore: do nothing - } - - /** - * Freezes the view by acquiring the drawing lock. - * @see Drawing#lock - */ - public void freezeView() { - // ignore: do nothing - } - - /** - * Unfreezes the view by releasing the drawing lock. - * @see Drawing#unlock - */ - public void unfreezeView() { - // ignore: do nothing - } - - /** - * Add a listener for selection changes in this DrawingView. - * @param fsl jhotdraw.framework.FigureSelectionListener - */ - public void addFigureSelectionListener(FigureSelectionListener fsl) { - // ignore: do nothing - } - - /** - * Remove a listener for selection changes in this DrawingView. - * @param fsl jhotdraw.framework.FigureSelectionListener - */ - public void removeFigureSelectionListener(FigureSelectionListener fsl) { - // ignore: do nothing - } - - /** - * Returns a FigureEnumeration of connection figures - */ - public FigureEnumeration getConnectionFigures(Figure inFigure) { - return FigureEnumerator.getEmptyEnumeration(); - } - - /** - * Inserts figures in a drawing at given offset. Optional check for connection figures - * - * @return enumeration which has been added to the drawing. The figures in the enumeration - * can have changed during adding them (e.g. they could have been decorated). - */ - public FigureEnumeration insertFigures(FigureEnumeration inFigures, int dx, int dy, boolean bCheck) { - return FigureEnumerator.getEmptyEnumeration(); - } - - public void drawingInvalidated(DrawingChangeEvent e) { - // ignore: do nothing - } - - public void drawingRequestUpdate(DrawingChangeEvent e) { - // ignore: do nothing - } - - public void drawingTitleChanged(DrawingChangeEvent e) { - // ignore: do nothing - } - - public boolean isInteractive() { - return false; - } - - public synchronized static DrawingView getManagedDrawingView(DrawingEditor editor) { - if (drawingViewManager.containsKey(editor)) { - return (DrawingView)drawingViewManager.get(editor); - } - else { - DrawingView newDrawingView = new NullDrawingView(editor); - drawingViewManager.put(editor, newDrawingView); - return newDrawingView; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/NullHandle.java b/JHotDraw/src/CH/ifa/draw/standard/NullHandle.java deleted file mode 100644 index 9258e26d16487a9d5a2814653917fd5132fd2d65..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/NullHandle.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * @(#)NullHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import CH.ifa.draw.framework.*; - -/** - * A handle that doesn't change the owned figure. Its only purpose is - * to show feedback that a figure is selected. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b>NullObject</b><br> - * NullObject enables to treat handles that don't do - * anything in the same way as other handles. - * - * @version <$CURRENT_VERSION$> - */ -public class NullHandle extends LocatorHandle { - - /** - * The handle's locator. - */ - protected Locator fLocator; - - public NullHandle(Figure owner, Locator locator) { - super(owner, locator); - } - - /** - * Draws the NullHandle. NullHandles are drawn as a - * red framed rectangle. - */ - public void draw(Graphics g) { - Rectangle r = displayBox(); - - g.setColor(Color.black); - g.drawRect(r.x, r.y, r.width, r.height); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/NullPainter.java b/JHotDraw/src/CH/ifa/draw/standard/NullPainter.java deleted file mode 100644 index 5b739c1e87a533a615006366bb9411a1e95c61b0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/NullPainter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)NullPainter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: \x{FFFD} by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.standard; - -import java.awt.Graphics; - -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.framework.Painter; - -/** - * Default implementation support for a Painter. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b>NullObject</b><br> - * NullObject enables to treat handles that don't do - * anything in the same way as other handles. - * - * @see Painter - * - * @version <$CURRENT_VERSION$> - */ - -public class NullPainter implements Painter { - /* (non-Javadoc) - * @see CH.ifa.draw.framework.Painter#draw(java.awt.Graphics, CH.ifa.draw.framework.DrawingView) - */ - public void draw(Graphics g, DrawingView view) { - // Do nothing in a reasonable way. - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/NullTool.java b/JHotDraw/src/CH/ifa/draw/standard/NullTool.java deleted file mode 100644 index 3afc961fb31889ca1d1f96a0197b67e223d39801..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/NullTool.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @(#)NullTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: ? by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; - -/** - * Default implementation support for Tools. - * - * @see DrawingView - * @see Tool - * - * @version <$CURRENT_VERSION$> - */ - -public class NullTool extends AbstractTool { - public NullTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - public void activate() { - // suppress clearSelection() and tool-activation notification in superclass - } - - public void deactivate() { - // suppress clearSelection() and tool-activation notification in superclass - } - - protected void checkUsable() { - //suppress setUsable(false); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/OffsetLocator.java b/JHotDraw/src/CH/ifa/draw/standard/OffsetLocator.java deleted file mode 100644 index 5298e9af975885139dc8b58449864b7cb329d51e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/OffsetLocator.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * @(#)OffsetLocator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.io.IOException; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -/** - * A locator to offset another Locator. - * @see Locator - * - * @version <$CURRENT_VERSION$> - */ -public class OffsetLocator extends AbstractLocator { - - /* - * Serialization support. - */ - private static final long serialVersionUID = 2679950024611847621L; - private int offsetLocatorSerializedDataVersion = 1; - - private Locator fBase; - private int fOffsetX; - private int fOffsetY; - - public OffsetLocator() { - fBase = null; - fOffsetX = 0; - fOffsetY = 0; - } - - public OffsetLocator(Locator base) { - this(); - fBase = base; - } - - public OffsetLocator(Locator base, int offsetX, int offsetY) { - this(base); - fOffsetX = offsetX; - fOffsetY = offsetY; - } - - public Point locate(Figure owner) { - Point p = fBase.locate(owner); - p.x += fOffsetX; - p.y += fOffsetY; - return p; - } - - public void moveBy(int dx, int dy) { - fOffsetX += dx; - fOffsetY += dy; - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeInt(fOffsetX); - dw.writeInt(fOffsetY); - dw.writeStorable(fBase); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fOffsetX = dr.readInt(); - fOffsetY = dr.readInt(); - fBase = (Locator)dr.readStorable(); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/standard/OrderedFigureElement.java b/JHotDraw/src/CH/ifa/draw/standard/OrderedFigureElement.java deleted file mode 100644 index 3183af5566375ad6a1b2e7ce34b8eb7ee4dfb339..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/OrderedFigureElement.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * @(#)OrderFigureElement.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.Figure; - -/** - * @author WMG (INIT Copyright (C) 2000 All rights reserved) - * @version <$CURRENT_VERSION$> - */ -class OrderedFigureElement implements Comparable { - - //_________________________________________________________VARIABLES - - private Figure _theFigure; - private int _nZ; - - //______________________________________________________CONSTRUCTORS - - public OrderedFigureElement(Figure aFigure, int nZ) { - _theFigure = aFigure; - _nZ = nZ; - } - - //____________________________________________________PUBLIC METHODS - - public Figure getFigure() { - return _theFigure; - } - - public int getZValue() { - return _nZ; - } - - public int compareTo(Object o) { - OrderedFigureElement ofe = (OrderedFigureElement) o; - if (_nZ == ofe.getZValue()) { - return 0; - } - - if (_nZ > ofe.getZValue()) { - return 1; - } - - return -1; - } - - //_______________________________________________________________END - -} //end of class OrderedFigureElement diff --git a/JHotDraw/src/CH/ifa/draw/standard/PasteCommand.java b/JHotDraw/src/CH/ifa/draw/standard/PasteCommand.java deleted file mode 100644 index fb3d278a627228bfde9721b0bf8bdf6c45fca9ea..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/PasteCommand.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * @(#)PasteCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; -import java.awt.*; - -/** - * Command to insert the clipboard into the drawing. - * - * @see Clipboard - * - * @version <$CURRENT_VERSION$> - */ -public class PasteCommand extends FigureTransferCommand { - - /** - * Constructs a paste command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public PasteCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - Point lastClick = view().lastClick(); - FigureSelection selection = (FigureSelection)Clipboard.getClipboard().getContents(); - if (selection != null) { - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures( - (FigureEnumerator)selection.getData(StandardFigureSelection.TYPE)); - - if (!getUndoActivity().getAffectedFigures().hasNextFigure()) { - setUndoActivity(null); - return; - } - - Rectangle r = getBounds(getUndoActivity().getAffectedFigures()); - view().clearSelection(); - - // get an enumeration of inserted figures - FigureEnumeration fe = insertFigures(getUndoActivity().getAffectedFigures(), lastClick.x-r.x, lastClick.y-r.y); - getUndoActivity().setAffectedFigures(fe); - - view().checkDamage(); - } - } - - public boolean isExecutableWithView() { - return Clipboard.getClipboard().getContents() != null; - } - - private Rectangle getBounds(FigureEnumeration fe) { - Rectangle r = fe.nextFigure().displayBox(); - while (fe.hasNextFigure()) { - r.add(fe.nextFigure().displayBox()); - } - return r; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new PasteCommand.UndoActivity(view()); - } - - public static class UndoActivity extends UndoableAdapter { - - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - DeleteFromDrawingVisitor deleteVisitor = new DeleteFromDrawingVisitor(getDrawingView().drawing()); - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - fe.nextFigure().visit(deleteVisitor); - } - - getDrawingView().clearSelection(); - - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - getDrawingView().clearSelection(); - setAffectedFigures(getDrawingView().insertFigures( - getAffectedFigures(), 0, 0, false)); - - return true; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/PeripheralLocator.java b/JHotDraw/src/CH/ifa/draw/standard/PeripheralLocator.java deleted file mode 100644 index 6cc5e86cfeb1f7ee5ce5c90ba14d5b64215a0e66..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/PeripheralLocator.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @(#)PeripheralLocator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Point; -import CH.ifa.draw.framework.Figure; -import java.awt.*; -import java.lang.Math; - -/** - * @author C.L.Gilbert <dnoyeb@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class PeripheralLocator extends AbstractLocator { - private static int CORNERSPACE = 1; - private Figure fOwner; - private int fPPS; - private int fIndex; - - private PeripheralLocator() { - // do nothing: for JDO-compliance only - } - - public PeripheralLocator(int pointsPerSide, int index) { - fPPS = pointsPerSide; - fIndex = index; - if (index >= pointsPerSide *4) { - throw new IllegalArgumentException("Index must be within the range of points starting with index = 0."); - } - } - - public Point locate(Figure parm1) { - Rectangle r = parm1.displayBox(); - /* calculate total length for spacing */ - //int circumference = r.width*2 + r.height*2; - /* subtrace corners spacing */ - //int insets = 2 * 4 * CORNERSPACE; - - //int spacing = circumference/(fPPS*4 +4); - float hSpacing = (float)r.width / (fPPS +1); - float vSpacing = (float)r.height / (fPPS +1); - - int x = 0; - int y = 0; - if (fIndex < fPPS) { - //north - x = Math.round((fIndex + 1.0f ) * hSpacing); - y = 0; - } - else if (fIndex < (fPPS*2)) { - //east - x = Math.round((fPPS + 1 ) * hSpacing) ;//r.width; - y = Math.round((fIndex +1 - fPPS) * vSpacing); //should be negative? - } - else if (fIndex < (fPPS*3)) { - //south - x = Math.round(((fPPS + 1 ) - (fIndex +1 - fPPS*2))* hSpacing); - y = Math.round((fPPS + 1 )* vSpacing) /*r.height*/; - } - else { - //west - x = 0; - y = Math.round(((fPPS +1) - (fIndex +1 - fPPS*3))*vSpacing); - } - x = x+r.x; - y = y+r.y; - return new Point((int)x, (int)y); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/standard/QuadTree.java b/JHotDraw/src/CH/ifa/draw/standard/QuadTree.java deleted file mode 100644 index 035b0d56d492de6f6343ec282e496304054551a7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/QuadTree.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * @(#)QuadTree.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.util.CollectionsFactory; - -import java.awt.geom.Rectangle2D; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.io.Serializable; - -/** - * @author WMG (INIT Copyright (C) 2000 All rights reserved) - * @version <$CURRENT_VERSION$> - */ -class QuadTree implements Serializable { - - //_________________________________________________________VARIABLES - - private Rectangle2D _absoluteBoundingRectangle2D = new Rectangle2D.Double(); - private int _nMaxTreeDepth; - private Hashtable _theHashtable = new Hashtable(); - private Hashtable _outsideHashtable = new Hashtable(); - private QuadTree _nwQuadTree; - private QuadTree _neQuadTree; - private QuadTree _swQuadTree; - private QuadTree _seQuadTree; - - //______________________________________________________CONSTRUCTORS - - public QuadTree(Rectangle2D absoluteBoundingRectangle2D) { - this(2, absoluteBoundingRectangle2D); - } - - public QuadTree(int nMaxTreeDepth, Rectangle2D - absoluteBoundingRectangle2D) { - _init(nMaxTreeDepth, absoluteBoundingRectangle2D); - } - - //____________________________________________________PUBLIC METHODS - - public void add(Object anObject, Rectangle2D absoluteBoundingRectangle2D) { - if (_nMaxTreeDepth == 1) { - if (absoluteBoundingRectangle2D.intersects(_absoluteBoundingRectangle2D)) { - _theHashtable.put(anObject, absoluteBoundingRectangle2D); - } - else { - _outsideHashtable.put(anObject, absoluteBoundingRectangle2D); - } - return; - } - - boolean bNW = absoluteBoundingRectangle2D.intersects( - _nwQuadTree.getAbsoluteBoundingRectangle2D()); - - boolean bNE = absoluteBoundingRectangle2D.intersects( - _neQuadTree.getAbsoluteBoundingRectangle2D()); - - boolean bSW = absoluteBoundingRectangle2D.intersects( - _swQuadTree.getAbsoluteBoundingRectangle2D()); - - boolean bSE = absoluteBoundingRectangle2D.intersects( - _seQuadTree.getAbsoluteBoundingRectangle2D()); - - int nCount = 0; - - if (bNW == true) { - nCount++; - } - if (bNE == true) { - nCount++; - } - if (bSW == true) { - nCount++; - } - if (bSE == true) { - nCount++; - } - - if (nCount > 1) { - _theHashtable.put(anObject, absoluteBoundingRectangle2D); - return; - } - if (nCount == 0) { - _outsideHashtable.put(anObject, absoluteBoundingRectangle2D); - return; - } - - if (bNW == true) { - _nwQuadTree.add(anObject, absoluteBoundingRectangle2D); - } - if (bNE == true) { - _neQuadTree.add(anObject, absoluteBoundingRectangle2D); - } - if (bSW == true) { - _swQuadTree.add(anObject, absoluteBoundingRectangle2D); - } - if (bSE == true) { - _seQuadTree.add(anObject, absoluteBoundingRectangle2D); - } - } - - public Object remove(Object anObject) { - Object returnObject = _theHashtable.remove(anObject); - if (returnObject != null) { - return returnObject; - } - - if (_nMaxTreeDepth > 1) { - returnObject = _nwQuadTree.remove(anObject); - if (returnObject != null) { - return returnObject; - } - - returnObject = _neQuadTree.remove(anObject); - if (returnObject != null) { - return returnObject; - } - - returnObject = _swQuadTree.remove(anObject); - if (returnObject != null) { - return returnObject; - } - - returnObject = _seQuadTree.remove(anObject); - if (returnObject != null) { - return returnObject; - } - } - - returnObject = _outsideHashtable.remove(anObject); - if (returnObject != null) { - return returnObject; - } - - return null; - } - - - public void clear() { - _theHashtable.clear(); - _outsideHashtable.clear(); - if (_nMaxTreeDepth > 1) { - _nwQuadTree.clear(); - _neQuadTree.clear(); - _swQuadTree.clear(); - _seQuadTree.clear(); - } - } - - public int getMaxTreeDepth() { - return _nMaxTreeDepth; - } -/* - public FigureEnumeration getAll() { - List l = CollectionsFactory.current().createList(); - l.add(_theHashtable.keySet()); - l.add(_outsideHashtable.keySet()); - - if (_nMaxTreeDepth > 1) { - l.add(_nwQuadTree.getAll().toList()); - l.add(_neQuadTree.getAll().toList()); - l.add(_swQuadTree.getAll().toList()); - l.add(_seQuadTree.getAll().toList()); - } - - return new FigureEnumerator(l); - } -*/ - public FigureEnumeration getAllWithin(Rectangle2D r) { - List l = CollectionsFactory.current().createList(); - for (Iterator ii = _outsideHashtable.keySet().iterator(); ii.hasNext(); ) { - Object anObject = ii.next(); - Rectangle2D itsAbsoluteBoundingRectangle2D = (Rectangle2D) - _outsideHashtable.get(anObject); - - if (itsAbsoluteBoundingRectangle2D.intersects(r)) { - l.add(anObject); - } - } - - if (_absoluteBoundingRectangle2D.intersects(r)) { - for(Iterator i = _theHashtable.keySet().iterator(); i.hasNext(); ) { - Object anObject = i.next(); - Rectangle2D itsAbsoluteBoundingRectangle2D = (Rectangle2D) - _theHashtable.get(anObject); - - if (itsAbsoluteBoundingRectangle2D.intersects(r)) { - l.add(anObject); - } - } - - if (_nMaxTreeDepth > 1) { - l.add(_nwQuadTree.getAllWithin(r)); - l.add(_neQuadTree.getAllWithin(r)); - l.add(_swQuadTree.getAllWithin(r)); - l.add(_seQuadTree.getAllWithin(r)); - } - } - - return new FigureEnumerator(l); - } - - public Rectangle2D getAbsoluteBoundingRectangle2D() { - return _absoluteBoundingRectangle2D; - } - - //___________________________________________________PRIVATE METHODS - - private void _init(int nMaxTreeDepth, Rectangle2D absoluteBoundingRectangle2D) { - _absoluteBoundingRectangle2D.setRect(absoluteBoundingRectangle2D); - _nMaxTreeDepth = nMaxTreeDepth; - - if (_nMaxTreeDepth > 1) { - _nwQuadTree = new QuadTree(_nMaxTreeDepth-1, - _makeNorthwest(absoluteBoundingRectangle2D)); - _neQuadTree = new QuadTree(_nMaxTreeDepth-1, - _makeNortheast(absoluteBoundingRectangle2D)); - _swQuadTree = new QuadTree(_nMaxTreeDepth-1, - _makeSouthwest(absoluteBoundingRectangle2D)); - _seQuadTree = new QuadTree(_nMaxTreeDepth-1, - _makeSoutheast(absoluteBoundingRectangle2D)); - } - } - - private Rectangle2D _makeNorthwest(Rectangle2D r) { - return new Rectangle2D.Double(r.getX(), r.getY(), r.getWidth() / 2.0, r.getHeight() / 2.0); - } - - private Rectangle2D _makeNortheast(Rectangle2D r) { - return new Rectangle2D.Double(r.getX() + r.getWidth() / 2.0, - r.getY(), r.getWidth() / 2.0, r.getHeight() / 2.0); - } - - private Rectangle2D _makeSouthwest(Rectangle2D r) { - return new Rectangle2D.Double(r.getX(), r.getY() + r.getHeight() / 2.0, - r.getWidth() / 2.0, r.getHeight() / 2.0); - } - - private Rectangle2D _makeSoutheast(Rectangle2D r) { - return new Rectangle2D.Double(r.getX() + r.getWidth() / 2.0, - r.getY() + r.getHeight() / 2.0, r.getWidth() / 2.0, - r.getHeight() / 2.0); - } - -//_______________________________________________________________END - -} //end of class QuadTree diff --git a/JHotDraw/src/CH/ifa/draw/standard/RelativeLocator.java b/JHotDraw/src/CH/ifa/draw/standard/RelativeLocator.java deleted file mode 100644 index 29ccc9f599db13c1f4aa84bf18c0655ba5a77d73..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/RelativeLocator.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * @(#)RelativeLocator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.io.IOException; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -/** - * A locator that specfies a point that is relative to the bounds - * of a figure. - * - * @see Locator - * - * @version <$CURRENT_VERSION$> - */ -public class RelativeLocator extends AbstractLocator { - /* - * Serialization support. - */ - private static final long serialVersionUID = 2619148876087898602L; - private int relativeLocatorSerializedDataVersion = 1; - - double fRelativeX; - double fRelativeY; - - public RelativeLocator() { - fRelativeX = 0.0; - fRelativeY = 0.0; - } - - public boolean equals(Object o) { - if (RelativeLocator.class.isInstance(o)) { - RelativeLocator rl = (RelativeLocator) o; - if ((rl.fRelativeX) == fRelativeX && (rl.fRelativeY == fRelativeY)) { - return true; - } - } - return false; - } - - public RelativeLocator(double relativeX, double relativeY) { - fRelativeX = relativeX; - fRelativeY = relativeY; - } - - public Point locate(Figure owner) { - Rectangle r = owner.displayBox(); - return new Point( - r.x + (int)(r.width * fRelativeX), - r.y + (int)(r.height * fRelativeY) - ); - } - - public void write(StorableOutput dw) { - super.write(dw); - dw.writeDouble(fRelativeX); - dw.writeDouble(fRelativeY); - } - - public void read(StorableInput dr) throws IOException { - super.read(dr); - fRelativeX = dr.readDouble(); - fRelativeY = dr.readDouble(); - } - - static public Locator east() { - return new RelativeLocator(1.0, 0.5); - } - - /** - * North. - */ - static public Locator north() { - return new RelativeLocator(0.5, 0.0); - } - - /** - * West. - */ - static public Locator west() { - return new RelativeLocator(0.0, 0.5); - } - - /** - * North east. - */ - static public Locator northEast() { - return new RelativeLocator(1.0, 0.0); - } - - /** - * North west. - */ - static public Locator northWest() { - return new RelativeLocator(0.0, 0.0); - } - - /** - * South. - */ - static public Locator south() { - return new RelativeLocator(0.5, 1.0); - } - - /** - * South east. - */ - static public Locator southEast() { - return new RelativeLocator(1.0, 1.0); - } - - /** - * South west. - */ - static public Locator southWest() { - return new RelativeLocator(0.0, 1.0); - } - - /** - * Center. - */ - static public Locator center() { - return new RelativeLocator(0.5, 0.5); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ReverseFigureEnumerator.java b/JHotDraw/src/CH/ifa/draw/standard/ReverseFigureEnumerator.java deleted file mode 100644 index 4ee5f317a8bf8c2f7ec13248b80345cc2a23a30b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ReverseFigureEnumerator.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * @(#)ReverseFigureEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.ReverseListEnumerator; -import CH.ifa.draw.framework.*; - -import java.util.Iterator; -import java.util.List; - -/** - * An Enumeration that enumerates a Collection of figures back (size-1) to front (0). - * - * @version <$CURRENT_VERSION$> - */ -public final class ReverseFigureEnumerator implements FigureEnumeration { - private Iterator myIterator; - private List myInitialList; - - public ReverseFigureEnumerator(List l) { - myInitialList = l; - reset(); - } - - /** - * Returns true if the enumeration contains more elements; false - * if its empty. - */ - public boolean hasNextFigure() { - return myIterator.hasNext(); - } - - /** - * Returns the next element casted as a figure of the enumeration. Calls to this - * method will enumerate successive elements. - * @exception java.util.NoSuchElementException If no more elements exist. - */ - public Figure nextFigure() { - return (Figure)myIterator.next(); - } - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset() { - myIterator = new ReverseListEnumerator(myInitialList); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/SelectAllCommand.java b/JHotDraw/src/CH/ifa/draw/standard/SelectAllCommand.java deleted file mode 100644 index 2763202dbf97f4f29a7abeea32db1a7abeef2f84..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/SelectAllCommand.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * @(#)SelectAllCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; - -/** - * Command to select all figures in a view. - * - * @version <$CURRENT_VERSION$> - */ -public class SelectAllCommand extends AbstractCommand { - - /** - * Constructs a select all command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public SelectAllCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures(view().selection()); - view().addToSelectionAll(view().drawing().figures()); - view().checkDamage(); - } - - /** - * Used in enabling the properties menu item. - * SelectAll menu item will be enabled only when there ia atleast one figure - * in the selected drawing view. - */ - public boolean isExecutableWithView() { - FigureEnumeration fe = view().drawing().figures(); - if (fe.hasNextFigure() && (fe.nextFigure() != null)) { - return true; - } - - return false; - } - - /** - * Factory method for undo activity - */ - protected Undoable createUndoActivity() { - return new SelectAllCommand.UndoActivity(view()); - } - - public static class UndoActivity extends UndoableAdapter { - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - getDrawingView().clearSelection(); - getDrawingView().addToSelectionAll(getAffectedFigures()); - - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (isRedoable()) { - getDrawingView().addToSelectionAll(getDrawingView().drawing().figures()); - return true; - } - - return false; - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/SelectAreaTracker.java b/JHotDraw/src/CH/ifa/draw/standard/SelectAreaTracker.java deleted file mode 100644 index 8b06eca506d3ac329b287a036eb07b6415ac2548..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/SelectAreaTracker.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @(#)SelectAreaTracker.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.awt.event.MouseEvent; -import CH.ifa.draw.framework.*; - -/** - * SelectAreaTracker implements a rubberband selection of an area. - * - * @version <$CURRENT_VERSION$> - */ -public class SelectAreaTracker extends AbstractTool { - /** Selected rectangle in physical coordinates space */ - private Rectangle fSelectGroup; - private Color fRubberBandColor; - - public SelectAreaTracker(DrawingEditor newDrawingEditor) { - this(newDrawingEditor, Color.black); - } - - public SelectAreaTracker(DrawingEditor newDrawingEditor, Color rubberBandColor) { - super(newDrawingEditor); - fRubberBandColor = rubberBandColor; - } - - public void mouseDown(MouseEvent e, int x, int y) { - // use event coordinates to supress any kind of - // transformations like constraining points to a grid - super.mouseDown(e, e.getX(), e.getY()); - rubberBand(getAnchorX(), getAnchorY(), getAnchorX(), getAnchorY()); - } - - public void mouseDrag(MouseEvent e, int x, int y) { - super.mouseDrag(e, x, y); - eraseRubberBand(); - rubberBand(getAnchorX(), getAnchorY(), x, y); - } - - public void mouseUp(MouseEvent e, int x, int y) { - eraseRubberBand(); - selectGroup(e.isShiftDown()); - super.mouseUp(e, x, y); - } - - private void rubberBand(int x1, int y1, int x2, int y2) { - fSelectGroup = new Rectangle(new Point(x1, y1)); - fSelectGroup.add(new Point(x2, y2)); - drawXORRect(fSelectGroup); - } - - private void eraseRubberBand() { - drawXORRect(fSelectGroup); - } - - private void drawXORRect(Rectangle r) { - Graphics g = view().getGraphics(); - if ( g != null ) { - try { - if (g instanceof Graphics2D) { - // Do dotted-line in Java2 - Stroke dashedStroke = new BasicStroke(1.0f, - BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, - 10.0f, new float[] {5f, 5f, 5f, 5f}, 5.0f); - ((Graphics2D) g).setStroke(dashedStroke); - } - - g.setXORMode(view().getBackground()); - g.setColor(fRubberBandColor); - g.drawRect(r.x, r.y, r.width, r.height); - } - finally { - g.dispose(); // SF bugtracker id: #490663 - } - } - } - - private void selectGroup(boolean toggle) { - FigureEnumeration fe = drawing().figuresReverse(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - Rectangle r2 = figure.displayBox(); - if (fSelectGroup.contains(r2.x, r2.y) && fSelectGroup.contains(r2.x+r2.width, r2.y+r2.height)) { - if (toggle) { - view().toggleSelection(figure); - } - else { - view().addToSelection(figure); - } - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/SelectionTool.java b/JHotDraw/src/CH/ifa/draw/standard/SelectionTool.java deleted file mode 100644 index cb8e7aacce571010701d7148e1a6ebdd012e9b1f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/SelectionTool.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)SelectionTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.UndoableTool; -import CH.ifa.draw.util.UndoableHandle; -import CH.ifa.draw.contrib.dnd.DragNDropTool; -import java.awt.event.MouseEvent; - -/** - * Tool to select and manipulate figures. - * A selection tool is in one of three states, e.g., background - * selection, figure selection, handle manipulation. The different - * states are handled by different child tools. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld032.htm>State</a></b><br> - * SelectionTool is the StateContext and child is the State. - * The SelectionTool delegates state specific - * behavior to its current child tool. - * <hr> - * - * @version <$CURRENT_VERSION$> - */ - -public class SelectionTool extends AbstractTool { - - private Tool myDelegationTool = null; - - public SelectionTool(DrawingEditor newDrawingEditor) { - super(newDrawingEditor); - } - - /** - * Handles mouse down events and starts the corresponding tracker. - */ - public void mouseDown(MouseEvent e, int x, int y) { - super.mouseDown(e, x, y); - // on MS-Windows NT: AWT generates additional mouse down events - // when the left button is down && right button is clicked. - // To avoid dead locks we ignore such events - if (getDelegateTool() != null) { - return; - } - - view().freezeView(); - - Handle handle = view().findHandle(e.getX(), e.getY()); - if (handle != null) { - setDelegateTool(createHandleTracker(view(), handle)); - } - else { - Figure figure = drawing().findFigure(e.getX(), e.getY()); - if (figure != null) { - setDelegateTool(createDragTracker(figure)); - } - else { - if (!e.isShiftDown()) { - view().clearSelection(); - } - setDelegateTool(createAreaTracker()); - } - } - getDelegateTool().activate(); - getDelegateTool().mouseDown(e, x, y); - } - - /** - * Handles mouse moves (if the mouse button is up). - * Switches the cursors depending on whats under them. - */ - public void mouseMove(MouseEvent evt, int x, int y) { - if (evt.getSource() == getActiveView() ) { - DragNDropTool.setCursor(evt.getX(), evt.getY(), getActiveView()); - } - } - - /** - * Handles mouse drag events. The events are forwarded to the - * current tracker. - */ - public void mouseDrag(MouseEvent e, int x, int y) { - if (getDelegateTool() != null) { // JDK1.1 doesn't guarantee mouseDown, mouseDrag, mouseUp - getDelegateTool().mouseDrag(e, x, y); - } - } - - /** - * Handles mouse up events. The events are forwarded to the - * current tracker. - */ - public void mouseUp(MouseEvent e, int x, int y) { - if (getDelegateTool() != null) { // JDK1.1 doesn't guarantee mouseDown, mouseDrag, mouseUp - getDelegateTool().mouseUp(e, x, y); - getDelegateTool().deactivate(); - setDelegateTool(null); - } - if (view() != null) { - view().unfreezeView(); - editor().figureSelectionChanged(view()); - } - } - - /** - * Factory method to create a Handle tracker. It is used to track a handle. - */ - protected Tool createHandleTracker(DrawingView view, Handle handle) { - return new HandleTracker(editor(), new UndoableHandle(handle)); - } - - /** - * Factory method to create a Drag tracker. It is used to drag a figure. - */ - protected Tool createDragTracker(Figure f) { - return new UndoableTool(new DragTracker(editor(), f)); - } - - /** - * Factory method to create an area tracker. It is used to select an - * area. - */ - protected Tool createAreaTracker() { - return new SelectAreaTracker(editor()); - } - - protected Tool getDelegateTool() { - return myDelegationTool; - } - - protected final void setDelegateTool(Tool newDelegateTool) { - myDelegationTool = newDelegateTool; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/SendToBackCommand.java b/JHotDraw/src/CH/ifa/draw/standard/SendToBackCommand.java deleted file mode 100644 index 0fc2b8c9caa401e649de9deb561c49e71df10b5b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/SendToBackCommand.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * @(#)SendToBackCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.util.Undoable; -import java.util.*; - -/** - * A command to send the selection to the back of the drawing. - * - * @version <$CURRENT_VERSION$> - */ -public class SendToBackCommand extends AbstractCommand { - - /** - * Constructs a send to back command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public SendToBackCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - setUndoActivity(createUndoActivity()); - getUndoActivity().setAffectedFigures(view().selectionZOrdered()); - FigureEnumeration fe = getUndoActivity().getAffectedFigures(); - while (fe.hasNextFigure()) { - view().drawing().sendToBack(fe.nextFigure()); - } - view().checkDamage(); - } - - protected boolean isExecutableWithView() { - return view().selectionCount() > 0; - } - - protected Undoable createUndoActivity() { - return new SendToBackCommand.UndoActivity(view()); - } - - public static class UndoActivity extends UndoableAdapter { - private Hashtable myOriginalLayers; - - public UndoActivity(DrawingView newDrawingView) { - super(newDrawingView); - myOriginalLayers = new Hashtable(); - setUndoable(true); - setRedoable(true); - } - - public boolean undo() { - if (!super.undo()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - Figure currentFigure = fe.nextFigure(); - int currentFigureLayer = getOriginalLayer(currentFigure); - getDrawingView().drawing().sendToLayer(currentFigure, currentFigureLayer); - } - - return true; - } - - public boolean redo() { - // do not call execute directly as the selection might has changed - if (!isRedoable()) { - return false; - } - - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - sendToCommand(fe.nextFigure()); - } - - return true; - } - - protected void sendToCommand(Figure f) { - getDrawingView().drawing().sendToBack(f); - } - - protected void addOriginalLayer(Figure affectedFigure, int newOriginalLayer) { - myOriginalLayers.put(affectedFigure, new Integer(newOriginalLayer)); - } - - protected int getOriginalLayer(Figure lookupAffectedFigure) { - return ((Integer)myOriginalLayers.get(lookupAffectedFigure)).intValue(); - } - - public void setAffectedFigures(FigureEnumeration fe) { - // first make copy of FigureEnumeration in superclass - super.setAffectedFigures(fe); - // then get new FigureEnumeration of copy to save attributes - FigureEnumeration copyFe = getAffectedFigures(); - while (copyFe.hasNextFigure()) { - Figure f = copyFe.nextFigure(); - int originalLayer = getDrawingView().drawing().getLayer(f); - addOriginalLayer(f, originalLayer); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/SimpleUpdateStrategy.java b/JHotDraw/src/CH/ifa/draw/standard/SimpleUpdateStrategy.java deleted file mode 100644 index 3a5304ac7255265adb996cb0418c6e2db49a8807..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/SimpleUpdateStrategy.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @(#)SimpleUpdateStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import CH.ifa.draw.framework.*; - -/** - * The SimpleUpdateStrategy implements an update - * strategy that directly redraws a DrawingView. - * - * @see DrawingView - * - * @version <$CURRENT_VERSION$> - */ -public class SimpleUpdateStrategy implements Painter { - - /* - * Serialization support. In JavaDraw only the Drawing is serialized. - * However, for beans support SimpleUpdateStrategy supports - * serialization - */ - private static final long serialVersionUID = -7539925820692134566L; - - /** - * Draws the view contents. - */ - public void draw(Graphics g, DrawingView view) { - view.drawAll(g); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/SingleFigureEnumerator.java b/JHotDraw/src/CH/ifa/draw/standard/SingleFigureEnumerator.java deleted file mode 100644 index 9bffd0d7429200a7a7d4f2592f4195d6cf7a2fef..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/SingleFigureEnumerator.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)SingleFigureEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; - -/** - * An Enumeration that contains only a single Figures. An instance of this - * enumeration can be used only once to retrieve the figure as the figure - * is forgotten after the first retrieval. - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public final class SingleFigureEnumerator implements FigureEnumeration { - private Figure mySingleFigure; - private Figure myInitialFigure; - - public SingleFigureEnumerator(Figure newSingleFigure) { - myInitialFigure = newSingleFigure; - reset(); - } - - /** - * Returns true if the enumeration contains more elements; false - * if its empty. - */ - public boolean hasNextFigure() { - return mySingleFigure != null; - } - - /** - * Returns the next element of the enumeration. Calls to this - * method will enumerate successive elements. - * @exception java.util.NoSuchElementException If no more elements exist. - */ - public Figure nextFigure() { - Figure returnFigure = mySingleFigure; - mySingleFigure = null; - return returnFigure; - } - - /** - * Reset the enumeration so it can be reused again. However, the - * underlying collection might have changed since the last usage - * so the elements and the order may vary when using an enumeration - * which has been reset. - */ - public void reset() { - mySingleFigure = myInitialFigure; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/StandardDrawing.java b/JHotDraw/src/CH/ifa/draw/standard/StandardDrawing.java deleted file mode 100644 index 8730e2630b113168421e2f886645cff484e19841..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/StandardDrawing.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * @(#)StandardDrawing.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.CollectionsFactory; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.io.*; - -/** - * The standard implementation of the Drawing interface. - * - * @see Drawing - * - * @version <$CURRENT_VERSION$> - */ - -public class StandardDrawing extends CompositeFigure implements Drawing { - - - /** - * the registered listeners - */ - private transient List fListeners; - - /** - * boolean that serves as a condition variable - * to lock the access to the drawing. - * The lock is recursive and we keep track of the current - * lock holder. - */ - private transient Thread fDrawingLockHolder = null; - private String myTitle; - - /* - * Serialization support - */ - private static final long serialVersionUID = -2602151437447962046L; - private int drawingSerializedDataVersion = 1; - - /** - * Constructs the Drawing. - */ - public StandardDrawing() { - super(); - fListeners = CollectionsFactory.current().createList(2); - init(new Rectangle(-500, -500, 2000, 2000)); - } - - /** - * Adds a listener for this drawing. - */ - public void addDrawingChangeListener(DrawingChangeListener listener) { - if (fListeners == null) { - fListeners = CollectionsFactory.current().createList(2); - } - fListeners.add(listener); - } - - /** - * Removes a listener from this drawing. - */ - public void removeDrawingChangeListener(DrawingChangeListener listener) { - fListeners.remove(listener); - } - - /** - * Gets an enumeration with all listener for this drawing. - */ - public Iterator drawingChangeListeners() { - return fListeners.iterator(); - } - - /** - * Removes a figure from the figure list, but - * doesn't release it. Use this method to temporarily - * manipulate a figure outside of the drawing. - * - * @param figure that is part of the drawing and should be added - */ - public synchronized Figure orphan(Figure figure) { - Figure orphanedFigure = super.orphan(figure); - // ensure that we remove the top level figure in a drawing - if (orphanedFigure.listener() != null) { - Rectangle rect = invalidateRectangle(displayBox()); - orphanedFigure.listener().figureRequestRemove(new FigureChangeEvent(orphanedFigure, rect)); - } - return orphanedFigure; - } - - public synchronized Figure add(Figure figure) { - Figure addedFigure = super.add(figure); - if (addedFigure.listener() != null) { - Rectangle rect = invalidateRectangle(displayBox()); - addedFigure.listener().figureRequestUpdate(new FigureChangeEvent(figure, rect)); - return addedFigure; - } - return addedFigure; - } - - /** - * Invalidates a rectangle and merges it with the - * existing damaged area. - * @see FigureChangeListener - */ - public void figureInvalidated(FigureChangeEvent e) { - if (fListeners != null) { - for (int i = 0; i < fListeners.size(); i++) { - DrawingChangeListener l = (DrawingChangeListener)fListeners.get(i); - l.drawingInvalidated(new DrawingChangeEvent(this, e.getInvalidatedRectangle())); - } - } - } - - /** - * Forces an update of the drawing change listeners. - */ - public void fireDrawingTitleChanged() { - if (fListeners != null) { - for (int i = 0; i < fListeners.size(); i++) { - DrawingChangeListener l = (DrawingChangeListener)fListeners.get(i); - l.drawingTitleChanged(new DrawingChangeEvent(this, null)); - } - } - } - - /** - * Forces an update of the drawing change listeners. - */ - public void figureRequestUpdate(FigureChangeEvent e) { - if (fListeners != null) { - for (int i = 0; i < fListeners.size(); i++) { - DrawingChangeListener l = (DrawingChangeListener)fListeners.get(i); - l.drawingRequestUpdate(new DrawingChangeEvent(this, null)); - } - } - } - - /** - * Return's the figure's handles. This is only used when a drawing - * is nested inside another drawing. - */ - public HandleEnumeration handles() { - List handles = CollectionsFactory.current().createList(); - handles.add(new NullHandle(this, RelativeLocator.northWest())); - handles.add(new NullHandle(this, RelativeLocator.northEast())); - handles.add(new NullHandle(this, RelativeLocator.southWest())); - handles.add(new NullHandle(this, RelativeLocator.southEast())); - return new HandleEnumerator(handles); - } - - /** - * Gets the display box. This is the union of all figures. - */ - public Rectangle displayBox() { - if (fFigures.size() > 0) { - FigureEnumeration fe = figures(); - - Rectangle r = fe.nextFigure().displayBox(); - - while (fe.hasNextFigure()) { - r.add(fe.nextFigure().displayBox()); - } - return r; - } - return new Rectangle(0, 0, 0, 0); - } - - public void basicDisplayBox(Point p1, Point p2) { - } - - /** - * Acquires the drawing lock. - */ - public synchronized void lock() { - // recursive lock - Thread current = Thread.currentThread(); - if (fDrawingLockHolder == current) { - return; - } - while (fDrawingLockHolder != null) { - try { - wait(); - } - catch (InterruptedException ex) { } - } - fDrawingLockHolder = current; - } - - /** - * Releases the drawing lock. - */ - public synchronized void unlock() { - if (fDrawingLockHolder != null) { - fDrawingLockHolder = null; - notify(); - } - } - - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - - fListeners = CollectionsFactory.current().createList(2); - } - - public String getTitle() { - return myTitle; - } - - public void setTitle(String newTitle) { - myTitle = newTitle; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/StandardDrawingView.java b/JHotDraw/src/CH/ifa/draw/standard/StandardDrawingView.java deleted file mode 100644 index ceb8da31ce1c9903b71c0824239a55a3905a65ab..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/StandardDrawingView.java +++ /dev/null @@ -1,1183 +0,0 @@ -/* - * @(#)StandardDrawingView.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: ? by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import java.awt.dnd.DragGestureListener; -import java.awt.dnd.DragSourceListener; -import java.awt.event.*; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -import CH.ifa.draw.contrib.AutoscrollHelper; -import CH.ifa.draw.contrib.dnd.DNDHelper; -import CH.ifa.draw.contrib.dnd.DNDInterface; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.framework.Cursor; -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.Command; -import CH.ifa.draw.util.Geom; -import CH.ifa.draw.util.UndoableCommand; - -/** - * The standard implementation of DrawingView. - * - * @see DrawingView - * @see Painter - * @see Tool - * - * @version <$CURRENT_VERSION$> - */ -public class StandardDrawingView - extends JPanel - implements DrawingView, DNDInterface, java.awt.dnd.Autoscroll { - - /** - * The DrawingEditor of the view. - * @see #tool - */ - transient private DrawingEditor fEditor; - - /** - * the registered listeners for selection changes - */ - private transient List fSelectionListeners; - - /** - * The shown drawing. - */ - private Drawing fDrawing; - - /** - * the accumulated damaged area - */ - private transient Rectangle fDamage; - - /** - * The list of currently selected figures. - */ - transient private List fSelection; - - /** - * The shown selection handles. - */ - transient private List fSelectionHandles; - - /** - * The preferred size of the view - */ - - /** - * The position of the last mouse click - * inside the view. - */ - private Point fLastClick; - - /** - * A List of optional backgrounds. The list contains - * view painters that are drawn before the contents, - * that is in the background. - */ - private List fBackgrounds; - - /** - * A List of optional foregrounds. The list contains - * view painters that are drawn after the contents, - * that is in the foreground. - */ - private List fForegrounds; - - /** - * The update strategy used to repair the view. - */ - private Painter fUpdateStrategy; - - /** - * The grid used to constrain points for snap to - * grid functionality. - */ - private PointConstrainer fConstrainer; - - /** - * Scrolling increment - */ - public static final int MINIMUM_WIDTH = 400; - public static final int MINIMUM_HEIGHT = 300; - public static final int SCROLL_INCR = 100; - public static final int SCROLL_OFFSET = 10; - - private static int counter; - private int myCounter = counter; - - private DNDHelper dndh; - - /** - * Listener for mouse clicks. - */ - private MouseListener mouseListener; - - /** - * Listener for mouse movements. - */ - private MouseMotionListener motionListener; - - /** - * Listener for the keyboard. - */ - private KeyListener keyListener; - - /** - * Reflects whether the drawing view is in read-only mode (from a user's - * perspective). - */ - private boolean myIsReadOnly; - - /* - * Serialization support. In JavaDraw only the Drawing is serialized. - * However, for beans support StandardDrawingView supports - * serialization - */ - private static final long serialVersionUID = -3878153366174603336L; - private int drawingViewSerializedDataVersion = 1; - - /** - * Constructs the view. - */ - public StandardDrawingView(DrawingEditor editor) { - this(editor, MINIMUM_WIDTH, MINIMUM_HEIGHT); - } - - public StandardDrawingView(DrawingEditor editor, int width, int height) { - setAutoscrolls(true); - counter++; - fEditor = editor; - // ricardo_padilha: changed from setSize(int, int) because it is not - // JScrollPane-friendly. - setPreferredSize(new Dimension(width, height)); - fSelectionListeners = CollectionsFactory.current().createList(); - addFigureSelectionListener(editor()); - setLastClick(new Point(0, 0)); - fConstrainer = null; - fSelection = CollectionsFactory.current().createList(); - // JFC/Swing uses double buffering automatically as default - setDisplayUpdate(createDisplayUpdate()); - // TODO: Test FastBufferedUpdateStrategy with JFC/Swing double buffering - //setDisplayUpdate(new FastBufferedUpdateStrategy()); - setBackground(Color.lightGray); - - addMouseListener(createMouseListener()); - addMouseMotionListener(createMouseMotionListener()); - addKeyListener(createKeyListener()); - } - - protected MouseListener createMouseListener() { - mouseListener = new DrawingViewMouseListener(); - return mouseListener; - } - - protected MouseMotionListener createMouseMotionListener() { - motionListener = new DrawingViewMouseMotionListener(); - return motionListener; - } - - protected KeyListener createKeyListener() { - keyListener = new DrawingViewKeyListener(); - return keyListener; - } - - /** - * Factory method which can be overriden by subclasses - */ - protected Painter createDisplayUpdate() { - return new SimpleUpdateStrategy(); - //return new ClippingUpdateStrategy(); - } - - /** - * Sets the view's editor. - */ - public void setEditor(DrawingEditor editor) { - fEditor = editor; - } - - /** - * Gets the current tool. - */ - public Tool tool() { - return editor().tool(); - } - - /** - * Gets the drawing. - */ - public Drawing drawing() { - return fDrawing; - } - - /** - * Sets and installs another drawing in the view. - */ - public void setDrawing(Drawing d) { - if (drawing() != null) { - clearSelection(); - drawing().removeDrawingChangeListener(this); - } - - fDrawing = d; - if (drawing() != null) { - drawing().addDrawingChangeListener(this); - } - - checkMinimumSize(); - repaint(); - } - - /** - * Gets the editor. - */ - public DrawingEditor editor() { - return fEditor; - } - - /** - * Adds a figure to the drawing. - * @return the added figure. - */ - public Figure add(Figure figure) { - return drawing().add(figure); - } - - /** - * Removes a figure from the drawing. - * @return the removed figure - */ - public Figure remove(Figure figure) { - return drawing().remove(figure); - } - - /** - * Adds a Collection of figures to the drawing. - */ - public void addAll(Collection figures) { - FigureEnumeration fe = new FigureEnumerator(figures); - while (fe.hasNextFigure()) { - add(fe.nextFigure()); - } - } - - /** - * Check existance of figure in the drawing - */ - public boolean figureExists(Figure inf, FigureEnumeration fe) { - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - - if (figure.includes(inf)) { - return true; - } - } - - return false; - } - - /** - * Inserts a FigureEnumeration of figures and translates them by the - * given offset. This function is used to insert figures from clipboards (cut/copy) - * - * @return enumeration which has been added to the drawing. The figures in the enumeration - * can have changed during adding them (e.g. they could have been decorated). - */ - public FigureEnumeration insertFigures(FigureEnumeration fe, int dx, int dy, boolean bCheck) { - if (fe == null) { - return FigureEnumerator.getEmptyEnumeration(); - } - - List vCF = CollectionsFactory.current().createList(10); - InsertIntoDrawingVisitor visitor = new InsertIntoDrawingVisitor(drawing()); - - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - if (figure instanceof ConnectionFigure) { - vCF.add(figure); - } - else if (figure != null) { - figure.moveBy(dx, dy); - figure.visit(visitor); - } - } - - FigureEnumeration ecf = new FigureEnumerator(vCF); - - while (ecf.hasNextFigure()) { - ConnectionFigure cf = (ConnectionFigure) ecf.nextFigure(); - Figure sf = cf.startFigure(); - Figure ef = cf.endFigure(); - - if (figureExists(sf, drawing().figures()) - && figureExists(ef, drawing().figures()) - && (!bCheck || cf.canConnect(sf, ef))) { - - if (bCheck) { - Point sp = sf.center(); - Point ep = ef.center(); - Connector fStartConnector = cf.startFigure().connectorAt(ep.x, ep.y); - Connector fEndConnector = cf.endFigure().connectorAt(sp.x, sp.y); - - if (fEndConnector != null && fStartConnector != null) { - cf.connectStart(fStartConnector); - cf.connectEnd(fEndConnector); - cf.updateConnection(); - } - } - - cf.visit(visitor); - } - } - - addToSelectionAll(visitor.getInsertedFigures()); - return visitor.getInsertedFigures(); - } - - /** - * Returns a FigureEnumeration of connectionfigures attached to this figure - */ - public FigureEnumeration getConnectionFigures(Figure inFigure) { - // If no figure or figure is non connectable, just return null - if (inFigure == null || !inFigure.canConnect()) { - return null; - } - - // if (inFigure instanceof ConnectionFigure) - // return null; - - List result = CollectionsFactory.current().createList(5); - FigureEnumeration figures = drawing().figures(); - - // Find all connection figures - while (figures.hasNextFigure()) { - Figure f= figures.nextFigure(); - - if ((f instanceof ConnectionFigure) && !(isFigureSelected(f))) { - ConnectionFigure cf = (ConnectionFigure) f; - - if (cf.startFigure().includes(inFigure) || cf.endFigure().includes(inFigure)) { - result.add(f); - } - } - } - - return new FigureEnumerator(result); - } - - /** - * Sets the current display update strategy. - * @see Painter - */ - public void setDisplayUpdate(Painter updateStrategy) { - fUpdateStrategy = updateStrategy; - } - - /** - * Sets the current display update strategy. - * @see Painter - */ - public Painter getDisplayUpdate() { - return fUpdateStrategy; - } - - /** - * Gets an enumeration over the currently selected figures. - * The selection is a snapshot of the current selection - * which does not get changed anymore - * - * @return an enumeration with the currently selected figures. - */ - public FigureEnumeration selection() { - return selectionZOrdered(); - } - - /** - * Gets the currently selected figures in Z order. - * @see #selection - * @return a FigureEnumeration with the selected figures. The enumeration - * represents a snapshot of the current selection. - */ - public FigureEnumeration selectionZOrdered() { - List result = CollectionsFactory.current().createList(selectionCount()); - - result.addAll(fSelection); - return new ReverseFigureEnumerator(result); - } - - /** - * Gets the number of selected figures. - */ - public int selectionCount() { - return fSelection.size(); - } - - /** - * Test whether a given figure is selected. - */ - public boolean isFigureSelected(Figure checkFigure) { - return fSelection.contains(checkFigure); - } - - /** - * Adds a figure to the current selection. The figure is only selected if - * it is also contained in the Drawing associated with this DrawingView. - */ - public void addToSelection(Figure figure) { - if(addToSelectionImpl(figure) == true){ - fireSelectionChanged(); - } - } - protected boolean addToSelectionImpl(Figure figure){ - boolean changed = false; - if (!isFigureSelected(figure) && drawing().includes(figure)) { - fSelection.add(figure); - fSelectionHandles = null; - figure.invalidate(); - changed = true; - } - return changed; - } - /** - * Adds a Collection of figures to the current selection. - */ - public void addToSelectionAll(Collection figures) { - addToSelectionAll(new FigureEnumerator(figures)); - } - - /** - * Adds a FigureEnumeration to the current selection. - */ - public void addToSelectionAll(FigureEnumeration fe) { - boolean changed = false; - while (fe.hasNextFigure()) { - changed |= addToSelectionImpl(fe.nextFigure()); - } - if(changed == true){ - fireSelectionChanged(); - } - } - - /** - * Removes a figure from the selection. - */ - public void removeFromSelection(Figure figure) { - if (isFigureSelected(figure)) { - fSelection.remove(figure); - fSelectionHandles = null; - figure.invalidate(); - fireSelectionChanged(); - } - } - - /** - * If a figure isn't selected it is added to the selection. - * Otherwise it is removed from the selection. - */ - public void toggleSelection(Figure figure) { - if (isFigureSelected(figure)) { - removeFromSelection(figure); - } - else { - addToSelection(figure); - } - fireSelectionChanged(); - } - - /** - * Clears the current selection. - */ - public void clearSelection() { - // there is nothing selected - bug fix ID 628818 - if (selectionCount() == 0) { - // avoid unnecessary selection changed event when nothing has to be cleared - return; - } - - FigureEnumeration fe = selection(); - while (fe.hasNextFigure()) { - fe.nextFigure().invalidate(); - } - fSelection = CollectionsFactory.current().createList(); - fSelectionHandles = null; - fireSelectionChanged(); - } - - /** - * Gets an enumeration of the currently active handles. - */ - protected HandleEnumeration selectionHandles() { - if (fSelectionHandles == null) { - fSelectionHandles = CollectionsFactory.current().createList(); - FigureEnumeration fe = selection(); - while (fe.hasNextFigure()) { - Figure figure = fe.nextFigure(); - HandleEnumeration kk = figure.handles(); - while (kk.hasNextHandle()) { - fSelectionHandles.add(kk.nextHandle()); - } - } - } - return new HandleEnumerator(fSelectionHandles); - } - - /** - * Gets the current selection as a FigureSelection. A FigureSelection - * can be cut, copied, pasted. - */ - public FigureSelection getFigureSelection() { - return new StandardFigureSelection(selectionZOrdered(), selectionCount()); - } - - /** - * Finds a handle at the given coordinates. - * @return the hit handle, null if no handle is found. - */ - public Handle findHandle(int x, int y) { - Handle handle; - - HandleEnumeration he = selectionHandles(); - while (he.hasNextHandle()) { - handle = he.nextHandle(); - if (handle.containsPoint(x, y)) { - return handle; - } - } - return null; - } - - /** - * Informs that the current selection changed. - * By default this event is forwarded to the - * drawing editor. - */ - protected void fireSelectionChanged() { - if (fSelectionListeners != null) { - for (int i = 0; i < fSelectionListeners.size(); i++) { - FigureSelectionListener l = (FigureSelectionListener)fSelectionListeners.get(i); - l.figureSelectionChanged(this); - } - } - } - - protected Rectangle getDamage() { - return fDamage; // clone? - } - - protected void setDamage(Rectangle r) { - fDamage = r; - } - - /** - * Gets the position of the last click inside the view. - */ - public Point lastClick() { - return fLastClick; - } - - protected void setLastClick(Point newLastClick) { - fLastClick = newLastClick; - } - - /** - * Sets the grid spacing that is used to constrain points. - */ - public void setConstrainer(PointConstrainer c) { - fConstrainer = c; - } - - /** - * Gets the current constrainer. - */ - public PointConstrainer getConstrainer() { - return fConstrainer; - } - - /** - * Constrains a point to the current grid. - */ - protected Point constrainPoint(Point p) { - // constrain to view size - Dimension size = getSize(); - //p.x = Math.min(size.width, Math.max(1, p.x)); - //p.y = Math.min(size.height, Math.max(1, p.y)); - p.x = Geom.range(1, size.width, p.x); - p.y = Geom.range(1, size.height, p.y); - - if (fConstrainer != null ) { - return fConstrainer.constrainPoint(p); - } - return p; - } - - private void moveSelection(int dx, int dy) { - FigureEnumeration figures = selection(); - while (figures.hasNextFigure()) { - figures.nextFigure().moveBy(dx, dy); - } - checkDamage(); - } - - /** - * Refreshes the drawing if there is some accumulated damage - */ - public synchronized void checkDamage() { - Iterator each = drawing().drawingChangeListeners(); - while (each.hasNext()) { - Object l = each.next(); - if (l instanceof DrawingView) { - ((DrawingView)l).repairDamage(); - } - } - } - - public void repairDamage() { - if (getDamage() != null) { - repaint(getDamage().x, getDamage().y, getDamage().width, getDamage().height); - setDamage(null); - } - } - - public void drawingInvalidated(DrawingChangeEvent e) { - Rectangle r = e.getInvalidatedRectangle(); - if (getDamage() == null) { - setDamage(r); - } - else { - // don't manipulate rectangle returned by getDamage() directly - // because it could be a cloned rectangle. - Rectangle damagedR = getDamage(); - damagedR.add(r); - setDamage(damagedR); - } - } - - public void drawingRequestUpdate(DrawingChangeEvent e) { - repairDamage(); - } - - public void drawingTitleChanged(DrawingChangeEvent e){ - } - - /** - * Paints the drawing view. The actual drawing is delegated to - * the current update strategy. - * @see Painter - */ - protected void paintComponent(Graphics g) { - if(getDisplayUpdate() != null) { - getDisplayUpdate().draw(g, this); - } - } - - /** - * Draws the contents of the drawing view. - * The view has three layers: background, drawing, handles. - * The layers are drawn in back to front order. - */ - public void drawAll(Graphics g) { - boolean isPrinting = g instanceof PrintGraphics; - drawBackground(g); - if ((fBackgrounds != null) && !isPrinting) { - drawPainters(g, fBackgrounds); - } - drawDrawing(g); - if ((fForegrounds != null) && !isPrinting) { - drawPainters(g, fForegrounds); - } - if (!isPrinting) { - drawHandles(g); - } - } - - /** - * Draws the given figures. - * The view has three layers: background, drawing, handles. - * The layers are drawn in back to front order. - * No background is drawn. - */ - public void draw(Graphics g, FigureEnumeration fe) { - boolean isPrinting = g instanceof PrintGraphics; - //drawBackground(g); - if ((fBackgrounds != null) && !isPrinting) { - drawPainters(g, fBackgrounds); - } - drawing().draw(g, fe); - if ((fForegrounds != null) && !isPrinting) { - drawPainters(g, fForegrounds); - } - if (!isPrinting) { - drawHandles(g); - } - } - - /** - * Draws the currently active handles. - */ - public void drawHandles(Graphics g) { - HandleEnumeration he = selectionHandles(); - while (he.hasNextHandle()) { - (he.nextHandle()).draw(g); - } - } - - /** - * Draws the drawing. - */ - public void drawDrawing(Graphics g) { - drawing().draw(g); - } - - /** - * Draws the background. If a background pattern is set it - * is used to fill the background. Otherwise the background - * is filled in the background color. - */ - public void drawBackground(Graphics g) { - g.setColor(getBackground()); - g.fillRect(0, 0, getBounds().width, getBounds().height); - } - - protected void drawPainters(Graphics g, List v) { - for (int i = 0; i < v.size(); i++) { - ((Painter)v.get(i)).draw(g, this); - } - } - - /** - * Adds a background. - */ - public void addBackground(Painter painter) { - if (fBackgrounds == null) { - fBackgrounds = CollectionsFactory.current().createList(3); - } - fBackgrounds.add(painter); - repaint(); - } - - /** - * Removes a background. - */ - public void removeBackground(Painter painter) { - if (fBackgrounds != null) { - fBackgrounds.remove(painter); - } - repaint(); - } - - protected List getBackgrounds() { - return fBackgrounds; - } - - /** - * Removes a foreground. - */ - public void removeForeground(Painter painter) { - if (fForegrounds != null) { - fForegrounds.remove(painter); - } - repaint(); - } - - /** - * Adds a foreground. - */ - public void addForeground(Painter painter) { - if (fForegrounds == null) { - fForegrounds = CollectionsFactory.current().createList(3); - } - fForegrounds.add(painter); - repaint(); - } - - protected List getForegrounds() { - return fForegrounds; - } - - /** - * Freezes the view by acquiring the drawing lock. - * @see Drawing#lock - */ - public void freezeView() { - drawing().lock(); - } - - /** - * Unfreezes the view by releasing the drawing lock. - * @see Drawing#unlock - */ - public void unfreezeView() { - drawing().unlock(); - } - - private void readObject(ObjectInputStream s) - throws ClassNotFoundException, IOException { - - s.defaultReadObject(); - - fSelection = CollectionsFactory.current().createList(); // could use lazy initialization instead - // could use lazy initialization instead - if (drawing() != null) { - drawing().addDrawingChangeListener(this); - } - fSelectionListeners= CollectionsFactory.current().createList(); - } - - protected void checkMinimumSize() { - Dimension d = getDrawingSize(); - Dimension v = getPreferredSize(); - - if (v.height < d.height || v.width < d.width) { - v.height = d.height + SCROLL_OFFSET; - v.width = d.width + SCROLL_OFFSET; - setPreferredSize(v); - } - } - - /** - * Return the size of the area occupied by the contained figures inside - * the drawing. This method is called by checkMinimumSize(). - */ - protected Dimension getDrawingSize() { - Dimension d = new Dimension(0, 0); - // ricardo_padilha: this test had to be introduced because a drawing view - // can be assigned a null drawing (see setDrawing() ). - if (drawing() != null) { - FigureEnumeration fe = drawing().figures(); - while (fe.hasNextFigure()) { - Rectangle r = fe.nextFigure().displayBox(); - d.width = Math.max(d.width, r.x+r.width); - d.height = Math.max(d.height, r.y+r.height); - } - } - return d; - } - - /** - * @see java.awt.Component#isFocusTraversable() - * @deprecated see super class - */ - public boolean isFocusTraversable() { - return true; - } - - public boolean isInteractive() { - return true; - } - - public void keyTyped(KeyEvent e) {} - public void keyReleased(KeyEvent e) {} - - /** - * Add a listener for selection changes. - * @param fsl jhotdraw.framework.FigureSelectionListener - */ - public void addFigureSelectionListener(FigureSelectionListener fsl) { - fSelectionListeners.add(fsl); - } - - /** - * Remove a listener for selection changes. - * @param fsl jhotdraw.framework.FigureSelectionListener - */ - public void removeFigureSelectionListener(FigureSelectionListener fsl) { - fSelectionListeners.remove(fsl); - } - - public int getDefaultDNDActions() { - return java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE; - } - - /***** Autoscroll support *****/ - private ASH ash = new ASH(10); - - public void autoscroll(java.awt.Point p) { - ash.autoscroll(p); - } - public Insets getAutoscrollInsets() { - return ash.getAutoscrollInsets(); - } - class ASH extends AutoscrollHelper { - public ASH(int margin) { - super(margin); - } - public Dimension getSize() { - return StandardDrawingView.this.getSize(); - } - public Rectangle getVisibleRect() { - return StandardDrawingView.this.getVisibleRect(); - } - public void scrollRectToVisible(Rectangle aRect) { - StandardDrawingView.this.scrollRectToVisible(aRect); - } - } - - public String toString() { - return "DrawingView Nr: " + myCounter; - } - - /** - * Default action when any uncaught exception bubbled from - * the mouse event handlers of the tools. Subclass may override it - * to provide other action. - */ - protected void handleMouseEventException(Throwable t) { - JOptionPane.showMessageDialog( - this, - t.getClass().getName() + " - " + t.getMessage(), - "Error", - JOptionPane.ERROR_MESSAGE); - t.printStackTrace(); - } - - public class DrawingViewMouseListener extends MouseAdapter { - /** - * Handles mouse down events. The event is delegated to the - * currently active tool. - */ - public void mousePressed(MouseEvent e) { - try { - requestFocus(); // JDK1.1 - Point p = constrainPoint(new Point(e.getX(), e.getY())); - setLastClick(new Point(e.getX(), e.getY())); - tool().mouseDown(e, p.x, p.y); - checkDamage(); - } - catch (Throwable t) { - handleMouseEventException(t); - } - } - - /** - * Handles mouse up events. The event is delegated to the - * currently active tool. - */ - public void mouseReleased(MouseEvent e) { - try { - Point p = constrainPoint(new Point(e.getX(), e.getY())); - tool().mouseUp(e, p.x, p.y); - checkDamage(); - } - catch (Throwable t) { - handleMouseEventException(t); - } - } - } - - public class DrawingViewMouseMotionListener implements MouseMotionListener { - /** - * Handles mouse drag events. The event is delegated to the - * currently active tool. - */ - public void mouseDragged(MouseEvent e) { - try { - Point p = constrainPoint(new Point(e.getX(), e.getY())); - tool().mouseDrag(e, p.x, p.y); - checkDamage(); - } - catch (Throwable t) { - handleMouseEventException(t); - } - } - - /** - * Handles mouse move events. The event is delegated to the - * currently active tool. - */ - public void mouseMoved(MouseEvent e) { - try { - tool().mouseMove(e, e.getX(), e.getY()); - } - catch (Throwable t) { - handleMouseEventException(t); - } - } - } - - public class DrawingViewKeyListener implements KeyListener { - private Command deleteCmd; - - public DrawingViewKeyListener() { - deleteCmd = createDeleteCommand(); - } - - /** - * Handles key down events. Cursor keys are handled - * by the view the other key events are delegated to the - * currently active tool. - */ - public void keyPressed(KeyEvent e) { - int code = e.getKeyCode(); - // Only act on nonModified keys... - int modifiers = e.getModifiers(); - if (modifiers == 0 && - ((code == KeyEvent.VK_BACK_SPACE) || - (code == KeyEvent.VK_DELETE))) { - if (deleteCmd.isExecutable()) { - deleteCmd.execute(); - //deleteCmd.viewSelectionChanged(this); - } - } - else if (modifiers == 0 && - ((code == KeyEvent.VK_DOWN) - || (code == KeyEvent.VK_UP) - || (code == KeyEvent.VK_RIGHT) - || (code == KeyEvent.VK_LEFT))) { - handleCursorKey(code); - } - else { - tool().keyDown(e, code); - } - checkDamage(); - } - - /** - * Handles cursor keys by moving all the selected figures - * one grid point in the cursor direction. - */ - protected void handleCursorKey(int key) { - int dx = 0, dy = 0; - int stepX = 1, stepY = 1; - // should consider Null Object. - if (fConstrainer != null) { - stepX = fConstrainer.getStepX(); - stepY = fConstrainer.getStepY(); - } - - switch (key) { - case KeyEvent.VK_DOWN: - dy = stepY; - break; - case KeyEvent.VK_UP: - dy = -stepY; - break; - case KeyEvent.VK_RIGHT: - dx = stepX; - break; - case KeyEvent.VK_LEFT: - dx = -stepX; - break; - } - moveSelection(dx, dy); - } - - public void keyTyped(KeyEvent event) { - // do nothing - } - - public void keyReleased(KeyEvent event) { - // do nothing - } - - protected Command createDeleteCommand() { - return new UndoableCommand(new DeleteCommand("Delete", editor())); - } - } - - protected DNDHelper createDNDHelper() { - return new DNDHelper(true, true) { - protected DrawingView view() { - return StandardDrawingView.this; - } - protected DrawingEditor editor() { - return StandardDrawingView.this.editor(); - } - }; - } - - protected DNDHelper getDNDHelper() { - if (dndh == null) { - dndh = createDNDHelper(); - } - return dndh; - } - - public DragSourceListener getDragSourceListener(){ - return getDNDHelper().getDragSourceListener(); - } - - public void DNDInitialize(DragGestureListener dgl){ - getDNDHelper().initialize(dgl); - } - - public void DNDDeinitialize() { - getDNDHelper().deinitialize(); - } - - /** - * Asks whether the drawing view is in read-only mode. If so, the user can't - * modify it using mouse or keyboard actions. Yet, it can still be modified - * from inside the program. - */ - public boolean isReadOnly() { - return myIsReadOnly; - } - - /** - * Determines whether the drawing view is in read-only mode. If so, the user can't - * modify it using mouse or keyboard actions. Yet, it can still be modified - * from inside the program. - */ - public void setReadOnly(boolean newIsReadOnly) { - if (newIsReadOnly != isReadOnly()) { - if (newIsReadOnly) { - removeMouseListener(mouseListener); - removeMouseMotionListener(motionListener); - removeKeyListener(keyListener); - } - else { - addMouseListener(mouseListener); - addMouseMotionListener(motionListener); - addKeyListener(keyListener); - } - - myIsReadOnly = newIsReadOnly; - } - } - - /** - * @see DrawingView#setCursor(Cursor) - * @see java.awt.Component#setCursor(java.awt.Cursor) - */ - public void setCursor(Cursor cursor) { - if (cursor instanceof java.awt.Cursor) { - super.setCursor((java.awt.Cursor) cursor); - } - } - - /** - * Gets the minimum dimension of the drawing.<br /> - * Fixed version (JHotDraw version has a bug). - * @see StandardDrawingView#getMinimumSize() - * @see java.awt.Component#getMinimumSize() - */ - public Dimension getMinimumSize() { - Rectangle r = new Rectangle(); - FigureEnumeration k = drawing().figures(); - while (k.hasNextFigure()) { - r.add(k.nextFigure().displayBox()); - } - return new Dimension(r.width, r.height); - } - - -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/StandardFigureSelection.java b/JHotDraw/src/CH/ifa/draw/standard/StandardFigureSelection.java deleted file mode 100644 index 53c9f5e555828f8662f0201e14c26aa9d74d953f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/StandardFigureSelection.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @(#)FigureSelection.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.util.*; - -import java.util.*; -import java.io.*; - -/** - * FigureSelection enables to transfer the selected figures - * to a clipboard.<p> - * Will soon be converted to the JDK 1.1 Transferable interface. - * - * @see Clipboard - * - * @version <$CURRENT_VERSION$> - */ - -public class StandardFigureSelection implements FigureSelection, Serializable { - - private byte[] fData; // flattend figures, ready to be resurrected - - /** - * The type identifier of the selection. - */ - public final static String TYPE = "CH.ifa.draw.Figures"; - - /** - * Constructes the Figure selection for the FigureEnumeration. - */ - public StandardFigureSelection(FigureEnumeration fe, int figureCount) { - // a FigureSelection is represented as a flattened ByteStream - // of figures. - ByteArrayOutputStream output = new ByteArrayOutputStream(200); - StorableOutput writer = new StorableOutput(output); - writer.writeInt(figureCount); - while (fe.hasNextFigure()) { - writer.writeStorable(fe.nextFigure()); - } - writer.close(); - fData = output.toByteArray(); - } - - /** - * Gets the type of the selection. - */ - public String getType() { - return TYPE; - } - - /** - * Gets the data of the selection. The result is returned - * as a FigureEnumeration of Figures. - * - * @return a copy of the figure selection. - */ - public Object getData(String type) { - if (type.equals(TYPE)) { - InputStream input = new ByteArrayInputStream(fData); - List result = CollectionsFactory.current().createList(10); - StorableInput reader = new StorableInput(input); - int numRead = 0; - try { - int count = reader.readInt(); - while (numRead < count) { - Figure newFigure = (Figure) reader.readStorable(); - result.add(newFigure); - numRead++; - } - } - catch (IOException e) { - System.err.println(e.toString()); - } - return new FigureEnumerator(result); - } - return null; - } - - public static FigureEnumeration duplicateFigures(FigureEnumeration toBeCloned, int figureCount) { - StandardFigureSelection duplicater = new StandardFigureSelection(toBeCloned, figureCount); - return (FigureEnumeration)duplicater.getData(duplicater.getType()); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/standard/TextHolder.java b/JHotDraw/src/CH/ifa/draw/standard/TextHolder.java deleted file mode 100644 index b307c069d4dc66ce09bd902f25166ee15119cc3e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/TextHolder.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @(#)TextHolder.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.*; -import CH.ifa.draw.framework.*; - -/** - * The interface of a figure that has some editable text contents. - * - * @see Figure - * - * @version <$CURRENT_VERSION$> - */ - -public interface TextHolder { - - public Rectangle textDisplayBox(); - - /** - * Gets the text shown by the text figure. - */ - public String getText(); - - /** - * Sets the text shown by the text figure. - */ - public void setText(String newText); - - /** - * Tests whether the figure accepts typing. - */ - public boolean acceptsTyping(); - - /** - * Gets the number of columns to be overlaid when the figure is edited. - */ - public int overlayColumns(); - - /** - * Connects a text holder to another figure. - */ - public void connect(Figure connectedFigure); - - /** - * Disconnects a text holder from a connect figure. - */ - public void disconnect(Figure disconnectFigure); - - /** - * Gets the font. - */ - public Font getFont(); - - /** - * Usually, a TextHolders is implemented by a Figure subclass. To avoid casting - * a TextHolder to a Figure this method can be used for polymorphism (in this - * case, let the (same) object appear to be of another type). - * Note, that the figure returned is not the figure to which the TextHolder is - * (and its representing figure) connected. - * @return figure responsible for representing the content of this TextHolder - */ - public Figure getRepresentingFigure(); -} diff --git a/JHotDraw/src/CH/ifa/draw/standard/ToggleGridCommand.java b/JHotDraw/src/CH/ifa/draw/standard/ToggleGridCommand.java deleted file mode 100644 index 72ee3f0382c7445212141d401e17c27967e0404b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ToggleGridCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * @(#)ToggleGridCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import java.awt.Point; -import CH.ifa.draw.framework.*; - -/** - * A command to toggle the snap to grid behavior. - * - * @version <$CURRENT_VERSION$> - */ -public class ToggleGridCommand extends AbstractCommand { - - private Point fGrid; - - /** - * Constructs a toggle grid command. - * @param name the command name - * @param newDrawingEditor editor - * @param grid the grid size. A grid size of 1,1 turns grid snapping off. - */ - public ToggleGridCommand(String name, DrawingEditor newDrawingEditor, Point grid) { - super(name, newDrawingEditor); - fGrid = new Point(grid.x, grid.y); - } - - public void execute() { - super.execute(); - PointConstrainer grid = view().getConstrainer(); - if (grid != null) { - view().setConstrainer(null); - } - else { - view().setConstrainer(new GridConstrainer(fGrid.x, fGrid.y)); - } - } -} - - diff --git a/JHotDraw/src/CH/ifa/draw/standard/ToolButton.java b/JHotDraw/src/CH/ifa/draw/standard/ToolButton.java deleted file mode 100644 index 3c22f4586cfc395836bc47314e4b516ea7ffed51..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/standard/ToolButton.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * @(#)ToolButton.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.standard; - -import CH.ifa.draw.util.*; -import CH.ifa.draw.framework.*; -import javax.swing.*; -import java.awt.*; -import java.util.EventObject; - -/** - * A PaletteButton that is associated with a tool. - * - * @see Tool - * - * @version <$CURRENT_VERSION$> - */ -public class ToolButton extends PaletteButton implements ToolListener { - - private Tool myTool; - private PaletteIcon myIcon; - - public ToolButton(PaletteListener listener, String iconName, String name, Tool tool) { - super(listener); - tool.addToolListener(this); - setEnabled(tool.isUsable()); - - // use a Mediatracker to ensure that all the images are initially loaded - Iconkit kit = Iconkit.instance(); - if (kit == null) { - throw new JHotDrawRuntimeException("Iconkit instance isn't set"); - } - - Image im[] = new Image[3]; - im[0] = kit.loadImageResource(iconName+"1.gif"); - im[1] = kit.loadImageResource(iconName+"2.gif"); - im[2] = kit.loadImageResource(iconName+"3.gif"); - - MediaTracker tracker = new MediaTracker(this); - for (int i = 0; i < 3; i++) { - tracker.addImage(im[i], i); - } - try { - tracker.waitForAll(); - } - catch (Exception e) { - // ignore exception - } - - setPaletteIcon(new PaletteIcon(new Dimension(24,24), im[0], im[1], im[2])); - setTool(tool); - setName(name); - - // avoid null pointer exception if image could not be loaded - if (im[0] != null) { - setIcon(new ImageIcon(im[0])); - } - if (im[1] != null) { - setPressedIcon(new ImageIcon(im[1])); - } - if (im[2] != null) { - setSelectedIcon(new ImageIcon(im[2])); - } - setToolTipText(name); - } - - public Tool tool() { - return myTool; - } - - public String name() { - return getName(); - } - - public Object attributeValue() { - return tool(); - } - - public Dimension getMinimumSize() { - return new Dimension(getPaletteIcon().getWidth(), getPaletteIcon().getHeight()); - } - - public Dimension getPreferredSize() { - return new Dimension(getPaletteIcon().getWidth(), getPaletteIcon().getHeight()); - } - - public Dimension getMaximumSize() { - return new Dimension(getPaletteIcon().getWidth(), getPaletteIcon().getHeight()); - } - -// Not necessary anymore in JFC due to the support of Icons in JButton -/* - public void paintBackground(Graphics g) { } - - public void paintNormal(Graphics g) { - if (fIcon.normal() != null) - g.drawImage(fIcon.normal(), 0, 0, this); - } - - public void paintPressed(Graphics g) { - if (fIcon.pressed() != null) - g.drawImage(fIcon.pressed(), 0, 0, this); - } -*/ - public void paintSelected(Graphics g) { - if (getPaletteIcon().selected() != null) { - g.drawImage(getPaletteIcon().selected(), 0, 0, this); - } - } - - public void paint(Graphics g) { - // selecting does not work as expected with JFC1.1 - // see JavaBug: 4228035, 4233965 - if (isSelected()) { - paintSelected(g); - } - else { - super.paint(g); - } - } - - public void toolUsable(EventObject toolEvent) { - setEnabled(true); - } - - public void toolUnusable(EventObject toolEvent) { - setEnabled(false); - setSelected(false); - } - - public void toolActivated(EventObject toolEvent) { - } - - public void toolDeactivated(EventObject toolEvent) { - } - - public void toolEnabled(EventObject toolEvent) { - setEnabled(true); - } - - public void toolDisabled(EventObject toolEvent) { - setEnabled(false); - } - - protected PaletteIcon getPaletteIcon() { - return myIcon; - } - - private void setPaletteIcon(PaletteIcon newIcon) { - myIcon = newIcon; - } - - private void setTool(Tool newTool) { - myTool = newTool; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/AllTests.java deleted file mode 100644 index 499dcf8b95508c0d979f42ca4d451e2b0007e6d1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/AllTests.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test"); - //$JUnit-BEGIN$ - - suite.addTest(CH.ifa.draw.test.contrib.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.figures.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.framework.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.samples.javadraw.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.samples.minimap.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.samples.net.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.samples.nothing.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.samples.pert.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.standard.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.util.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.util.collections.jdk11.AllTests.suite()); - suite.addTest(CH.ifa.draw.test.util.collections.jdk12.AllTests.suite()); - - - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/JHDTestCase.java b/JHotDraw/src/CH/ifa/draw/test/JHDTestCase.java deleted file mode 100644 index b138469cc586ee18449a59dd6898ab71c3a32219..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/JHDTestCase.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test; - -import junit.framework.TestCase; -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.samples.javadraw.JavaDrawApp; - -public class JHDTestCase extends TestCase { - public JavaDrawApp myDrawingEditor; - - public JHDTestCase(String name) { - super(name); - } - - protected void setUp() throws Exception { - myDrawingEditor = new JavaDrawApp("TestApplication"); - } - - protected void tearDown() throws Exception { - myDrawingEditor.setVisible(false); - myDrawingEditor = null; - } - - public DrawApplication getDrawingEditor() { - return myDrawingEditor; - } - - /** - * Some tests might want start from scratch with a new DrawingEditor - * (to avoid side-effects from previous test) - */ - public JavaDrawApp createNewDrawingEditor() { - return new JavaDrawApp("TestApplication"); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/contrib/AllTests.java deleted file mode 100644 index 39647f86a8badaea9a9b7a3771edac0c562280a8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/AllTests.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @(#)AllTests.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.contrib"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(CTXCommandMenuTest.class)); - suite.addTest(new TestSuite(CTXWindowMenuTest.class)); - suite.addTest(new TestSuite(ChopDiamondConnectorTest.class)); - suite.addTest(new TestSuite(ChopPolygonConnectorTest.class)); - suite.addTest(new TestSuite(ClippingUpdateStrategyTest.class)); - suite.addTest(new TestSuite(CommandCheckBoxMenuItemTest.class)); - suite.addTest(new TestSuite(CommandMenuItemTest.class)); - suite.addTest(new TestSuite(ComponentFigureTest.class)); - suite.addTest(new TestSuite(CompositeFigureCreationToolTest.class)); - suite.addTest(new TestSuite(CustomSelectionToolTest.class)); - suite.addTest(new TestSuite(CustomToolBarTest.class)); - suite.addTest(new TestSuite(DesktopEventServiceTest.class)); - suite.addTest(new TestSuite(DiamondFigureTest.class)); - suite.addTest(new TestSuite(FloatingTextAreaTest.class)); - suite.addTest(new TestSuite(GraphicalCompositeFigureTest.class)); - suite.addTest(new TestSuite(HelperTest.class)); - suite.addTest(new TestSuite(JPanelDesktopTest.class)); - suite.addTest(new TestSuite(JScrollPaneDesktopTest.class)); - suite.addTest(new TestSuite(MDIDesktopPaneTest.class)); - suite.addTest(new TestSuite(MDI_DrawApplicationTest.class)); - suite.addTest(new TestSuite(MiniMapViewTest.class)); - suite.addTest(new TestSuite(NestedCreationToolTest.class)); - suite.addTest(new TestSuite(PolygonFigureTest.class)); - suite.addTest(new TestSuite(PolygonHandleTest.class)); - suite.addTest(new TestSuite(PolygonToolTest.class)); - suite.addTest(new TestSuite(SVGDrawAppTest.class)); - suite.addTest(new TestSuite(SVGStorageFormatTest.class)); - suite.addTest(new TestSuite(SimpleLayouterTest.class)); - suite.addTest(new TestSuite(SplitConnectionToolTest.class)); - suite.addTest(new TestSuite(StandardLayouterTest.class)); - suite.addTest(new TestSuite(TextAreaFigureTest.class)); - suite.addTest(new TestSuite(TextAreaToolTest.class)); - suite.addTest(new TestSuite(TriangleFigureTest.class)); - suite.addTest(new TestSuite(WindowMenuTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CTXCommandMenuTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CTXCommandMenuTest.java deleted file mode 100644 index 037be8faa885df137a22a315ad0ddd424112d619..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CTXCommandMenuTest.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.CTXCommandMenu; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CTXCommandMenuTest is generated by - * JUnitDoclet to hold the tests for CTXCommandMenu. - * @see CH.ifa.draw.contrib.CTXCommandMenu - */ -// JUnitDoclet end javadoc_class -public class CTXCommandMenuTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CTXCommandMenu ctxcommandmenu; - // JUnitDoclet end class - - /** - * Constructor CTXCommandMenuTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CTXCommandMenuTest(String name) { - // JUnitDoclet begin method CTXCommandMenuTest - super(name); - // JUnitDoclet end method CTXCommandMenuTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CTXCommandMenu createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.CTXCommandMenu("TestCTXCommandMenu"); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - ctxcommandmenu = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - ctxcommandmenu = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.contrib.CTXCommandMenu#add(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method addCheckItem() - /** - * Method testAddCheckItem is testing addCheckItem - * @see CH.ifa.draw.contrib.CTXCommandMenu#addCheckItem(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method addCheckItem() - public void testAddCheckItem() throws Exception { - // JUnitDoclet begin method addCheckItem - // JUnitDoclet end method addCheckItem - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.contrib.CTXCommandMenu#remove(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method enable() - /** - * Method testEnable is testing enable - * @see CH.ifa.draw.contrib.CTXCommandMenu#enable(java.lang.String, boolean) - */ - // JUnitDoclet end javadoc_method enable() - public void testEnable() throws Exception { - // JUnitDoclet begin method enable - // JUnitDoclet end method enable - } - - // JUnitDoclet begin javadoc_method checkEnabled() - /** - * Method testCheckEnabled is testing checkEnabled - * @see CH.ifa.draw.contrib.CTXCommandMenu#checkEnabled() - */ - // JUnitDoclet end javadoc_method checkEnabled() - public void testCheckEnabled() throws Exception { - // JUnitDoclet begin method checkEnabled - // JUnitDoclet end method checkEnabled - } - - // JUnitDoclet begin javadoc_method actionPerformed() - /** - * Method testActionPerformed is testing actionPerformed - * @see CH.ifa.draw.contrib.CTXCommandMenu#actionPerformed(java.awt.event.ActionEvent) - */ - // JUnitDoclet end javadoc_method actionPerformed() - public void testActionPerformed() throws Exception { - // JUnitDoclet begin method actionPerformed - // JUnitDoclet end method actionPerformed - } - - // JUnitDoclet begin javadoc_method commandExecuted() - /** - * Method testCommandExecuted is testing commandExecuted - * @see CH.ifa.draw.contrib.CTXCommandMenu#commandExecuted(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandExecuted() - public void testCommandExecuted() throws Exception { - // JUnitDoclet begin method commandExecuted - // JUnitDoclet end method commandExecuted - } - - // JUnitDoclet begin javadoc_method commandExecutable() - /** - * Method testCommandExecutable is testing commandExecutable - * @see CH.ifa.draw.contrib.CTXCommandMenu#commandExecutable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandExecutable() - public void testCommandExecutable() throws Exception { - // JUnitDoclet begin method commandExecutable - // JUnitDoclet end method commandExecutable - } - - // JUnitDoclet begin javadoc_method commandNotExecutable() - /** - * Method testCommandNotExecutable is testing commandNotExecutable - * @see CH.ifa.draw.contrib.CTXCommandMenu#commandNotExecutable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandNotExecutable() - public void testCommandNotExecutable() throws Exception { - // JUnitDoclet begin method commandNotExecutable - // JUnitDoclet end method commandNotExecutable - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CTXWindowMenuTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CTXWindowMenuTest.java deleted file mode 100644 index 48a1cab613730e968d3725ef4553a4296191db16..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CTXWindowMenuTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.contrib.CTXWindowMenu; -import CH.ifa.draw.contrib.MDIDesktopPane; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CTXWindowMenuTest is generated by - * JUnitDoclet to hold the tests for CTXWindowMenu. - * @see CH.ifa.draw.contrib.CTXWindowMenu - */ -// JUnitDoclet end javadoc_class -public class CTXWindowMenuTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CTXWindowMenu ctxwindowmenu; - // JUnitDoclet end class - - /** - * Constructor CTXWindowMenuTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CTXWindowMenuTest(String name) { - // JUnitDoclet begin method CTXWindowMenuTest - super(name); - // JUnitDoclet end method CTXWindowMenuTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CTXWindowMenu createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - MDIDesktopPane desktop = (MDIDesktopPane) (((DrawApplication)getDrawingEditor()).getDesktop()); - return new CH.ifa.draw.contrib.CTXWindowMenu("TestCTXWindowMenu", desktop, getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - ctxwindowmenu = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - ctxwindowmenu = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/ChopDiamondConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/ChopDiamondConnectorTest.java deleted file mode 100644 index 7eca319746ac6294bd3f749d7275929f3a3ae5d2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/ChopDiamondConnectorTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.ChopDiamondConnector; -import junit.framework.TestCase; - -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChopDiamondConnectorTest is generated by - * JUnitDoclet to hold the tests for ChopDiamondConnector. - * @see CH.ifa.draw.contrib.ChopDiamondConnector - */ -// JUnitDoclet end javadoc_class -public class ChopDiamondConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChopDiamondConnector chopdiamondconnector; - // JUnitDoclet end class - - /** - * Constructor ChopDiamondConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChopDiamondConnectorTest(String name) { - // JUnitDoclet begin method ChopDiamondConnectorTest - super(name); - // JUnitDoclet end method ChopDiamondConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.ChopDiamondConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.ChopDiamondConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - chopdiamondconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - chopdiamondconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/ChopPolygonConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/ChopPolygonConnectorTest.java deleted file mode 100644 index 8d62df16f7a5d4a5756bf19007abd805d9dda64e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/ChopPolygonConnectorTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.ChopPolygonConnector; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChopPolygonConnectorTest is generated by - * JUnitDoclet to hold the tests for ChopPolygonConnector. - * @see CH.ifa.draw.contrib.ChopPolygonConnector - */ -// JUnitDoclet end javadoc_class -public class ChopPolygonConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChopPolygonConnector choppolygonconnector; - // JUnitDoclet end class - - /** - * Constructor ChopPolygonConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChopPolygonConnectorTest(String name) { - // JUnitDoclet begin method ChopPolygonConnectorTest - super(name); - // JUnitDoclet end method ChopPolygonConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.ChopPolygonConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.ChopPolygonConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - choppolygonconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - choppolygonconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/ClippingUpdateStrategyTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/ClippingUpdateStrategyTest.java deleted file mode 100644 index 27d06c5e2430db810a27b252bcfcc691f2c2272a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/ClippingUpdateStrategyTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.ClippingUpdateStrategy; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ClippingUpdateStrategyTest is generated by - * JUnitDoclet to hold the tests for ClippingUpdateStrategy. - * @see CH.ifa.draw.contrib.ClippingUpdateStrategy - */ -// JUnitDoclet end javadoc_class -public class ClippingUpdateStrategyTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ClippingUpdateStrategy clippingupdatestrategy; - // JUnitDoclet end class - - /** - * Constructor ClippingUpdateStrategyTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ClippingUpdateStrategyTest(String name) { - // JUnitDoclet begin method ClippingUpdateStrategyTest - super(name); - // JUnitDoclet end method ClippingUpdateStrategyTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.ClippingUpdateStrategy createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.ClippingUpdateStrategy(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - clippingupdatestrategy = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - clippingupdatestrategy = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.contrib.ClippingUpdateStrategy#draw(java.awt.Graphics, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CommandCheckBoxMenuItemTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CommandCheckBoxMenuItemTest.java deleted file mode 100644 index 216ac4fedf36cb935d1743b8dee694c098f717b2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CommandCheckBoxMenuItemTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.CommandCheckBoxMenuItem; -import CH.ifa.draw.standard.DeleteCommand; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.Command; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CommandCheckBoxMenuItemTest is generated by - * JUnitDoclet to hold the tests for CommandCheckBoxMenuItem. - * @see CH.ifa.draw.contrib.CommandCheckBoxMenuItem - */ -// JUnitDoclet end javadoc_class -public class CommandCheckBoxMenuItemTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CommandCheckBoxMenuItem commandcheckboxmenuitem; - // JUnitDoclet end class - - /** - * Constructor CommandCheckBoxMenuItemTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CommandCheckBoxMenuItemTest(String name) { - // JUnitDoclet begin method CommandCheckBoxMenuItemTest - super(name); - // JUnitDoclet end method CommandCheckBoxMenuItemTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CommandCheckBoxMenuItem createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Command cmd = new DeleteCommand("TestDelete", getDrawingEditor()); - return new CH.ifa.draw.contrib.CommandCheckBoxMenuItem(cmd); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - commandcheckboxmenuitem = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - commandcheckboxmenuitem = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setCommand() - /** - * Method testSetGetCommand is testing setCommand - * and getCommand together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.CommandCheckBoxMenuItem#setCommand(CH.ifa.draw.util.Command) - * @see CH.ifa.draw.contrib.CommandCheckBoxMenuItem#getCommand() - */ - // JUnitDoclet end javadoc_method setCommand() - public void testSetGetCommand() throws Exception { - // JUnitDoclet begin method setCommand getCommand - CH.ifa.draw.util.Command[] tests = { new DeleteCommand("TestDelete", getDrawingEditor()), null }; - - for (int i = 0; i < tests.length; i++) { - commandcheckboxmenuitem.setCommand(tests[i]); - assertEquals(tests[i], commandcheckboxmenuitem.getCommand()); - } - // JUnitDoclet end method setCommand getCommand - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CommandMenuItemTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CommandMenuItemTest.java deleted file mode 100644 index a16e691f1fb8b6ad6378e5913738a22b125542a8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CommandMenuItemTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.CommandMenuItem; -import CH.ifa.draw.standard.DeleteCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CommandMenuItemTest is generated by - * JUnitDoclet to hold the tests for CommandMenuItem. - * @see CH.ifa.draw.contrib.CommandMenuItem - */ -// JUnitDoclet end javadoc_class -public class CommandMenuItemTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CommandMenuItem commandmenuitem; - // JUnitDoclet end class - - /** - * Constructor CommandMenuItemTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CommandMenuItemTest(String name) { - // JUnitDoclet begin method CommandMenuItemTest - super(name); - // JUnitDoclet end method CommandMenuItemTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CommandMenuItem createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.CommandMenuItem(new DeleteCommand("TestDelete", getDrawingEditor())); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - commandmenuitem = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - commandmenuitem = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setCommand() - /** - * Method testSetGetCommand is testing setCommand - * and getCommand together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.CommandMenuItem#setCommand(CH.ifa.draw.util.Command) - * @see CH.ifa.draw.contrib.CommandMenuItem#getCommand() - */ - // JUnitDoclet end javadoc_method setCommand() - public void testSetGetCommand() throws Exception { - // JUnitDoclet begin method setCommand getCommand - CH.ifa.draw.util.Command[] tests = { new CH.ifa.draw.standard.DeleteCommand("TestDelete", getDrawingEditor()), null }; - - for (int i = 0; i < tests.length; i++) { - commandmenuitem.setCommand(tests[i]); - assertEquals(tests[i], commandmenuitem.getCommand()); - } - // JUnitDoclet end method setCommand getCommand - } - - // JUnitDoclet begin javadoc_method actionPerformed() - /** - * Method testActionPerformed is testing actionPerformed - * @see CH.ifa.draw.contrib.CommandMenuItem#actionPerformed(java.awt.event.ActionEvent) - */ - // JUnitDoclet end javadoc_method actionPerformed() - public void testActionPerformed() throws Exception { - // JUnitDoclet begin method actionPerformed - // JUnitDoclet end method actionPerformed - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/ComponentFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/ComponentFigureTest.java deleted file mode 100644 index c1bd415a10ea4e01990475e23e1c575b92d449e3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/ComponentFigureTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import javax.swing.JButton; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.ComponentFigure; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ComponentFigureTest is generated by - * JUnitDoclet to hold the tests for ComponentFigure. - * @see CH.ifa.draw.contrib.ComponentFigure - */ -// JUnitDoclet end javadoc_class -public class ComponentFigureTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ComponentFigure componentfigure; - // JUnitDoclet end class - - /** - * Constructor ComponentFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ComponentFigureTest(String name) { - // JUnitDoclet begin method ComponentFigureTest - super(name); - // JUnitDoclet end method ComponentFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.ComponentFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.ComponentFigure(new JButton("TestComponent")); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - componentfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - componentfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.contrib.ComponentFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.contrib.ComponentFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.contrib.ComponentFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method getComponent() - /** - * Method testGetComponent is testing getComponent - * @see CH.ifa.draw.contrib.ComponentFigure#getComponent() - */ - // JUnitDoclet end javadoc_method getComponent() - public void testGetComponent() throws Exception { - // JUnitDoclet begin method getComponent - // JUnitDoclet end method getComponent - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.contrib.ComponentFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CompositeFigureCreationToolTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CompositeFigureCreationToolTest.java deleted file mode 100644 index dd59526ab791ee262d7aeea64ff08a1f5fc561d9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CompositeFigureCreationToolTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.CompositeFigureCreationTool; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CompositeFigureCreationToolTest is generated by - * JUnitDoclet to hold the tests for CompositeFigureCreationTool. - * @see CH.ifa.draw.contrib.CompositeFigureCreationTool - */ -// JUnitDoclet end javadoc_class -public class CompositeFigureCreationToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CompositeFigureCreationTool compositefigurecreationtool; - // JUnitDoclet end class - - /** - * Constructor CompositeFigureCreationToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CompositeFigureCreationToolTest(String name) { - // JUnitDoclet begin method CompositeFigureCreationToolTest - super(name); - // JUnitDoclet end method CompositeFigureCreationToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CompositeFigureCreationTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.CompositeFigureCreationTool(getDrawingEditor(), new RectangleFigure()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - compositefigurecreationtool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - compositefigurecreationtool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.contrib.CompositeFigureCreationTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.contrib.CompositeFigureCreationTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.contrib.CompositeFigureCreationTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method getContainerFigure() - /** - * Method testGetContainerFigure is testing getContainerFigure - * @see CH.ifa.draw.contrib.CompositeFigureCreationTool#getContainerFigure() - */ - // JUnitDoclet end javadoc_method getContainerFigure() - public void testGetContainerFigure() throws Exception { - // JUnitDoclet begin method getContainerFigure - // JUnitDoclet end method getContainerFigure - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CustomSelectionToolTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CustomSelectionToolTest.java deleted file mode 100644 index ea39b2ea11ae7658d60d1790e9e02ef3e8ce9389..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CustomSelectionToolTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.CustomSelectionTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CustomSelectionToolTest is generated by - * JUnitDoclet to hold the tests for CustomSelectionTool. - * @see CH.ifa.draw.contrib.CustomSelectionTool - */ -// JUnitDoclet end javadoc_class -public class CustomSelectionToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CustomSelectionTool customselectiontool; - // JUnitDoclet end class - - /** - * Constructor CustomSelectionToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CustomSelectionToolTest(String name) { - // JUnitDoclet begin method CustomSelectionToolTest - super(name); - // JUnitDoclet end method CustomSelectionToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CustomSelectionTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.CustomSelectionTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - customselectiontool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - customselectiontool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.contrib.CustomSelectionTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.contrib.CustomSelectionTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.contrib.CustomSelectionTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/CustomToolBarTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/CustomToolBarTest.java deleted file mode 100644 index cfc303015228668dd8361437fb02288facfa442b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/CustomToolBarTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.CustomToolBar; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CustomToolBarTest is generated by - * JUnitDoclet to hold the tests for CustomToolBar. - * @see CH.ifa.draw.contrib.CustomToolBar - */ -// JUnitDoclet end javadoc_class -public class CustomToolBarTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CustomToolBar customtoolbar; - // JUnitDoclet end class - - /** - * Constructor CustomToolBarTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CustomToolBarTest(String name) { - // JUnitDoclet begin method CustomToolBarTest - super(name); - // JUnitDoclet end method CustomToolBarTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.CustomToolBar createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.CustomToolBar(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - customtoolbar = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - customtoolbar = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method switchToolBar() - /** - * Method testSwitchToolBar is testing switchToolBar - * @see CH.ifa.draw.contrib.CustomToolBar#switchToolBar() - */ - // JUnitDoclet end javadoc_method switchToolBar() - public void testSwitchToolBar() throws Exception { - // JUnitDoclet begin method switchToolBar - // JUnitDoclet end method switchToolBar - } - - // JUnitDoclet begin javadoc_method switchToEditTools() - /** - * Method testSwitchToEditTools is testing switchToEditTools - * @see CH.ifa.draw.contrib.CustomToolBar#switchToEditTools() - */ - // JUnitDoclet end javadoc_method switchToEditTools() - public void testSwitchToEditTools() throws Exception { - // JUnitDoclet begin method switchToEditTools - // JUnitDoclet end method switchToEditTools - } - - // JUnitDoclet begin javadoc_method switchToStandardTools() - /** - * Method testSwitchToStandardTools is testing switchToStandardTools - * @see CH.ifa.draw.contrib.CustomToolBar#switchToStandardTools() - */ - // JUnitDoclet end javadoc_method switchToStandardTools() - public void testSwitchToStandardTools() throws Exception { - // JUnitDoclet begin method switchToStandardTools - // JUnitDoclet end method switchToStandardTools - } - - // JUnitDoclet begin javadoc_method activateTools() - /** - * Method testActivateTools is testing activateTools - * @see CH.ifa.draw.contrib.CustomToolBar#activateTools() - */ - // JUnitDoclet end javadoc_method activateTools() - public void testActivateTools() throws Exception { - // JUnitDoclet begin method activateTools - // JUnitDoclet end method activateTools - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.contrib.CustomToolBar#add(java.awt.Component) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/DesktopEventServiceTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/DesktopEventServiceTest.java deleted file mode 100644 index 033f0437e74e364fe052b2c337148007db0b365c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/DesktopEventServiceTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import java.awt.Container; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.Desktop; -import CH.ifa.draw.contrib.DesktopEventService; -import CH.ifa.draw.contrib.JPanelDesktop; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - - -// JUnitDoclet begin javadoc_class -/** - * TestCase DesktopEventServiceTest is generated by - * JUnitDoclet to hold the tests for DesktopEventService. - * @see CH.ifa.draw.contrib.DesktopEventService - */ -// JUnitDoclet end javadoc_class -public class DesktopEventServiceTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DesktopEventService desktopeventservice; - // JUnitDoclet end class - - /** - * Constructor DesktopEventServiceTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DesktopEventServiceTest(String name) { - // JUnitDoclet begin method DesktopEventServiceTest - super(name); - // JUnitDoclet end method DesktopEventServiceTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.DesktopEventService createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Desktop desktop = new JPanelDesktop(getDrawingEditor()); - return new CH.ifa.draw.contrib.DesktopEventService(desktop, ((Container)desktop)); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - desktopeventservice = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - desktopeventservice = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addComponent() - /** - * Method testAddComponent is testing addComponent - * @see CH.ifa.draw.contrib.DesktopEventService#addComponent(java.awt.Component) - */ - // JUnitDoclet end javadoc_method addComponent() - public void testAddComponent() throws Exception { - // JUnitDoclet begin method addComponent - // JUnitDoclet end method addComponent - } - - // JUnitDoclet begin javadoc_method removeComponent() - /** - * Method testRemoveComponent is testing removeComponent - * @see CH.ifa.draw.contrib.DesktopEventService#removeComponent(CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method removeComponent() - public void testRemoveComponent() throws Exception { - // JUnitDoclet begin method removeComponent - // JUnitDoclet end method removeComponent - } - - // JUnitDoclet begin javadoc_method removeAllComponents() - /** - * Method testRemoveAllComponents is testing removeAllComponents - * @see CH.ifa.draw.contrib.DesktopEventService#removeAllComponents() - */ - // JUnitDoclet end javadoc_method removeAllComponents() - public void testRemoveAllComponents() throws Exception { - // JUnitDoclet begin method removeAllComponents - // JUnitDoclet end method removeAllComponents - } - - // JUnitDoclet begin javadoc_method addDesktopListener() - /** - * Method testAddDesktopListener is testing addDesktopListener - * @see CH.ifa.draw.contrib.DesktopEventService#addDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method addDesktopListener() - public void testAddDesktopListener() throws Exception { - // JUnitDoclet begin method addDesktopListener - // JUnitDoclet end method addDesktopListener - } - - // JUnitDoclet begin javadoc_method removeDesktopListener() - /** - * Method testRemoveDesktopListener is testing removeDesktopListener - * @see CH.ifa.draw.contrib.DesktopEventService#removeDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method removeDesktopListener() - public void testRemoveDesktopListener() throws Exception { - // JUnitDoclet begin method removeDesktopListener - // JUnitDoclet end method removeDesktopListener - } - - // JUnitDoclet begin javadoc_method getDrawingViews() - /** - * Method testGetDrawingViews is testing getDrawingViews - * @see CH.ifa.draw.contrib.DesktopEventService#getDrawingViews(java.awt.Component[]) - */ - // JUnitDoclet end javadoc_method getDrawingViews() - public void testGetDrawingViews() throws Exception { - // JUnitDoclet begin method getDrawingViews - // JUnitDoclet end method getDrawingViews - } - - // JUnitDoclet begin javadoc_method getActiveDrawingView() - /** - * Method testGetActiveDrawingView is testing getActiveDrawingView - * @see CH.ifa.draw.contrib.DesktopEventService#getActiveDrawingView() - */ - // JUnitDoclet end javadoc_method getActiveDrawingView() - public void testGetActiveDrawingView() throws Exception { - // JUnitDoclet begin method getActiveDrawingView - // JUnitDoclet end method getActiveDrawingView - } - - - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/DiamondFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/DiamondFigureTest.java deleted file mode 100644 index b02ca7552e2a9c9dfefbe1cbb891936b24a01ac0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/DiamondFigureTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.DiamondFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase DiamondFigureTest is generated by - * JUnitDoclet to hold the tests for DiamondFigure. - * @see CH.ifa.draw.contrib.DiamondFigure - */ -// JUnitDoclet end javadoc_class -public class DiamondFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DiamondFigure diamondfigure; - // JUnitDoclet end class - - /** - * Constructor DiamondFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DiamondFigureTest(String name) { - // JUnitDoclet begin method DiamondFigureTest - super(name); - // JUnitDoclet end method DiamondFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.DiamondFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.DiamondFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - diamondfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - diamondfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.contrib.DiamondFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method connectionInsets() - /** - * Method testConnectionInsets is testing connectionInsets - * @see CH.ifa.draw.contrib.DiamondFigure#connectionInsets() - */ - // JUnitDoclet end javadoc_method connectionInsets() - public void testConnectionInsets() throws Exception { - // JUnitDoclet begin method connectionInsets - // JUnitDoclet end method connectionInsets - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.contrib.DiamondFigure#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method chop() - /** - * Method testChop is testing chop - * @see CH.ifa.draw.contrib.DiamondFigure#chop(java.awt.Point) - */ - // JUnitDoclet end javadoc_method chop() - public void testChop() throws Exception { - // JUnitDoclet begin method chop - // JUnitDoclet end method chop - } - - // JUnitDoclet begin javadoc_method connectorAt() - /** - * Method testConnectorAt is testing connectorAt - * @see CH.ifa.draw.contrib.DiamondFigure#connectorAt(int, int) - */ - // JUnitDoclet end javadoc_method connectorAt() - public void testConnectorAt() throws Exception { - // JUnitDoclet begin method connectorAt - // JUnitDoclet end method connectorAt - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/FloatingTextAreaTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/FloatingTextAreaTest.java deleted file mode 100644 index 785dde0af561b800044b4df24219e628ed6cac8f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/FloatingTextAreaTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.FloatingTextArea; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FloatingTextAreaTest is generated by - * JUnitDoclet to hold the tests for FloatingTextArea. - * @see CH.ifa.draw.contrib.FloatingTextArea - */ -// JUnitDoclet end javadoc_class -public class FloatingTextAreaTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FloatingTextArea floatingtextarea; - // JUnitDoclet end class - - /** - * Constructor FloatingTextAreaTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FloatingTextAreaTest(String name) { - // JUnitDoclet begin method FloatingTextAreaTest - super(name); - // JUnitDoclet end method FloatingTextAreaTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.FloatingTextArea createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.FloatingTextArea(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - floatingtextarea = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - floatingtextarea = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createOverlay() - /** - * Method testCreateOverlay is testing createOverlay - * @see CH.ifa.draw.contrib.FloatingTextArea#createOverlay(java.awt.Container) - */ - // JUnitDoclet end javadoc_method createOverlay() - public void testCreateOverlay() throws Exception { - // JUnitDoclet begin method createOverlay - // JUnitDoclet end method createOverlay - } - - // JUnitDoclet begin javadoc_method setBounds() - /** - * Method testSetBounds is testing setBounds - * @see CH.ifa.draw.contrib.FloatingTextArea#setBounds(java.awt.Rectangle, java.lang.String) - */ - // JUnitDoclet end javadoc_method setBounds() - public void testSetBounds() throws Exception { - // JUnitDoclet begin method setBounds - // JUnitDoclet end method setBounds - } - - // JUnitDoclet begin javadoc_method getText() - /** - * Method testGetText is testing getText - * @see CH.ifa.draw.contrib.FloatingTextArea#getText() - */ - // JUnitDoclet end javadoc_method getText() - public void testGetText() throws Exception { - // JUnitDoclet begin method getText - // JUnitDoclet end method getText - } - - // JUnitDoclet begin javadoc_method getPreferredSize() - /** - * Method testGetPreferredSize is testing getPreferredSize - * @see CH.ifa.draw.contrib.FloatingTextArea#getPreferredSize(int) - */ - // JUnitDoclet end javadoc_method getPreferredSize() - public void testGetPreferredSize() throws Exception { - // JUnitDoclet begin method getPreferredSize - // JUnitDoclet end method getPreferredSize - } - - // JUnitDoclet begin javadoc_method endOverlay() - /** - * Method testEndOverlay is testing endOverlay - * @see CH.ifa.draw.contrib.FloatingTextArea#endOverlay() - */ - // JUnitDoclet end javadoc_method endOverlay() - public void testEndOverlay() throws Exception { - // JUnitDoclet begin method endOverlay - // JUnitDoclet end method endOverlay - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/GraphicalCompositeFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/GraphicalCompositeFigureTest.java deleted file mode 100644 index 6afc1ef65482e6665f274187d447626c48a7b981..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/GraphicalCompositeFigureTest.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import java.awt.Point; - -import junit.framework.TestCase; -// JUnitDoclet begin import -import CH.ifa.draw.contrib.GraphicalCompositeFigure; -import CH.ifa.draw.contrib.SimpleLayouter; -import CH.ifa.draw.figures.RectangleFigure; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase GraphicalCompositeFigureTest is generated by - * JUnitDoclet to hold the tests for GraphicalCompositeFigure. - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure - */ -// JUnitDoclet end javadoc_class -public class GraphicalCompositeFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private GraphicalCompositeFigure graphicalcompositefigure; - // JUnitDoclet end class - - /** - * Constructor GraphicalCompositeFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public GraphicalCompositeFigureTest(String name) { - // JUnitDoclet begin method GraphicalCompositeFigureTest - super(name); - // JUnitDoclet end method GraphicalCompositeFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.GraphicalCompositeFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.GraphicalCompositeFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - graphicalcompositefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - graphicalcompositefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method clone() - /** - * Method testClone is testing clone - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#clone() - */ - // JUnitDoclet end javadoc_method clone() - public void testClone() throws Exception { - // JUnitDoclet begin method clone - // JUnitDoclet end method clone - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method update() - /** - * Method testUpdate is testing update - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#update() - */ - // JUnitDoclet end javadoc_method update() - public void testUpdate() throws Exception { - // JUnitDoclet begin method update - // JUnitDoclet end method update - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method getAttribute() - /** - * Method testGetAttribute is testing getAttribute - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#getAttribute(java.lang.String) - */ - // JUnitDoclet end javadoc_method getAttribute() - public void testGetAttribute() throws Exception { - // JUnitDoclet begin method getAttribute - // JUnitDoclet end method getAttribute - } - - // JUnitDoclet begin javadoc_method setAttribute() - /** - * Method testSetAttribute is testing setAttribute - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#setAttribute(java.lang.String, java.lang.Object) - */ - // JUnitDoclet end javadoc_method setAttribute() - public void testSetAttribute() throws Exception { - // JUnitDoclet begin method setAttribute - // JUnitDoclet end method setAttribute - } - - // JUnitDoclet begin javadoc_method setPresentationFigure() - /** - * Method testSetGetPresentationFigure is testing setPresentationFigure - * and getPresentationFigure together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#setPresentationFigure(CH.ifa.draw.framework.Figure) - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#getPresentationFigure() - */ - // JUnitDoclet end javadoc_method setPresentationFigure() - public void testSetGetPresentationFigure() throws Exception { - // JUnitDoclet begin method setPresentationFigure getPresentationFigure - CH.ifa.draw.framework.Figure[] tests = { new RectangleFigure(new Point(10, 10), new Point(100, 100)), null }; - - for (int i = 0; i < tests.length; i++) { - graphicalcompositefigure.setPresentationFigure(tests[i]); - assertEquals(tests[i], graphicalcompositefigure.getPresentationFigure()); - } - // JUnitDoclet end method setPresentationFigure getPresentationFigure - } - - // JUnitDoclet begin javadoc_method layout() - /** - * Method testLayout is testing layout - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#layout() - */ - // JUnitDoclet end javadoc_method layout() - public void testLayout() throws Exception { - // JUnitDoclet begin method layout - // JUnitDoclet end method layout - } - - // JUnitDoclet begin javadoc_method setLayouter() - /** - * Method testSetGetLayouter is testing setLayouter - * and getLayouter together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#setLayouter(CH.ifa.draw.contrib.Layouter) - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#getLayouter() - */ - // JUnitDoclet end javadoc_method setLayouter() - public void testSetGetLayouter() throws Exception { - // JUnitDoclet begin method setLayouter getLayouter - CH.ifa.draw.contrib.Layouter[] tests = { new SimpleLayouter(graphicalcompositefigure), null }; - - for (int i = 0; i < tests.length; i++) { - graphicalcompositefigure.setLayouter(tests[i]); - assertEquals(tests[i], graphicalcompositefigure.getLayouter()); - } - // JUnitDoclet end method setLayouter getLayouter - } - - // JUnitDoclet begin javadoc_method figureRequestRemove() - /** - * Method testFigureRequestRemove is testing figureRequestRemove - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestRemove() - public void testFigureRequestRemove() throws Exception { - // JUnitDoclet begin method figureRequestRemove - // JUnitDoclet end method figureRequestRemove - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.contrib.GraphicalCompositeFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/HelperTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/HelperTest.java deleted file mode 100644 index 1517c28eab11f18ab6af0b984a78d02c38d975ae..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/HelperTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.Helper; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase HelperTest is generated by - * JUnitDoclet to hold the tests for Helper. - * @see CH.ifa.draw.contrib.Helper - */ -// JUnitDoclet end javadoc_class -public class HelperTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Helper helper; - // JUnitDoclet end class - - /** - * Constructor HelperTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public HelperTest(String name) { - // JUnitDoclet begin method HelperTest - super(name); - // JUnitDoclet end method HelperTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.Helper createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.Helper(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - helper = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - helper = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getDrawingView() - /** - * Method testGetDrawingView is testing getDrawingView - * @see CH.ifa.draw.contrib.Helper#getDrawingView(java.awt.Container) - */ - // JUnitDoclet end javadoc_method getDrawingView() - public void testGetDrawingView() throws Exception { - // JUnitDoclet begin method getDrawingView - // JUnitDoclet end method getDrawingView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/JPanelDesktopTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/JPanelDesktopTest.java deleted file mode 100644 index 78949a96839d136ec5d696e8937e3d5b6732cc17..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/JPanelDesktopTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.JPanelDesktop; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase JPanelDesktopTest is generated by - * JUnitDoclet to hold the tests for JPanelDesktop. - * @see CH.ifa.draw.contrib.JPanelDesktop - */ -// JUnitDoclet end javadoc_class -public class JPanelDesktopTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private JPanelDesktop jpaneldesktop; - // JUnitDoclet end class - - /** - * Constructor JPanelDesktopTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public JPanelDesktopTest(String name) { - // JUnitDoclet begin method JPanelDesktopTest - super(name); - // JUnitDoclet end method JPanelDesktopTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.JPanelDesktop createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.JPanelDesktop(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - jpaneldesktop = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - jpaneldesktop = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getActiveDrawingView() - /** - * Method testGetActiveDrawingView is testing getActiveDrawingView - * @see CH.ifa.draw.contrib.JPanelDesktop#getActiveDrawingView() - */ - // JUnitDoclet end javadoc_method getActiveDrawingView() - public void testGetActiveDrawingView() throws Exception { - // JUnitDoclet begin method getActiveDrawingView - // JUnitDoclet end method getActiveDrawingView - } - - // JUnitDoclet begin javadoc_method addToDesktop() - /** - * Method testAddToDesktop is testing addToDesktop - * @see CH.ifa.draw.contrib.JPanelDesktop#addToDesktop(CH.ifa.draw.framework.DrawingView, int) - */ - // JUnitDoclet end javadoc_method addToDesktop() - public void testAddToDesktop() throws Exception { - // JUnitDoclet begin method addToDesktop - // JUnitDoclet end method addToDesktop - } - - // JUnitDoclet begin javadoc_method removeFromDesktop() - /** - * Method testRemoveFromDesktop is testing removeFromDesktop - * @see CH.ifa.draw.contrib.JPanelDesktop#removeFromDesktop(CH.ifa.draw.framework.DrawingView, int) - */ - // JUnitDoclet end javadoc_method removeFromDesktop() - public void testRemoveFromDesktop() throws Exception { - // JUnitDoclet begin method removeFromDesktop - // JUnitDoclet end method removeFromDesktop - } - - // JUnitDoclet begin javadoc_method removeAllFromDesktop() - /** - * Method testRemoveAllFromDesktop is testing removeAllFromDesktop - * @see CH.ifa.draw.contrib.JPanelDesktop#removeAllFromDesktop(int) - */ - // JUnitDoclet end javadoc_method removeAllFromDesktop() - public void testRemoveAllFromDesktop() throws Exception { - // JUnitDoclet begin method removeAllFromDesktop - // JUnitDoclet end method removeAllFromDesktop - } - - // JUnitDoclet begin javadoc_method getAllFromDesktop() - /** - * Method testGetAllFromDesktop is testing getAllFromDesktop - * @see CH.ifa.draw.contrib.JPanelDesktop#getAllFromDesktop(int) - */ - // JUnitDoclet end javadoc_method getAllFromDesktop() - public void testGetAllFromDesktop() throws Exception { - // JUnitDoclet begin method getAllFromDesktop - // JUnitDoclet end method getAllFromDesktop - } - - // JUnitDoclet begin javadoc_method addDesktopListener() - /** - * Method testAddDesktopListener is testing addDesktopListener - * @see CH.ifa.draw.contrib.JPanelDesktop#addDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method addDesktopListener() - public void testAddDesktopListener() throws Exception { - // JUnitDoclet begin method addDesktopListener - // JUnitDoclet end method addDesktopListener - } - - // JUnitDoclet begin javadoc_method removeDesktopListener() - /** - * Method testRemoveDesktopListener is testing removeDesktopListener - * @see CH.ifa.draw.contrib.JPanelDesktop#removeDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method removeDesktopListener() - public void testRemoveDesktopListener() throws Exception { - // JUnitDoclet begin method removeDesktopListener - // JUnitDoclet end method removeDesktopListener - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/JScrollPaneDesktopTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/JScrollPaneDesktopTest.java deleted file mode 100644 index c33930173fc2c3713bb01e9ce69edf2563707323..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/JScrollPaneDesktopTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.JScrollPaneDesktop; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase JScrollPaneDesktopTest is generated by - * JUnitDoclet to hold the tests for JScrollPaneDesktop. - * @see CH.ifa.draw.contrib.JScrollPaneDesktop - */ -// JUnitDoclet end javadoc_class -public class JScrollPaneDesktopTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private JScrollPaneDesktop jscrollpanedesktop; - // JUnitDoclet end class - - /** - * Constructor JScrollPaneDesktopTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public JScrollPaneDesktopTest(String name) { - // JUnitDoclet begin method JScrollPaneDesktopTest - super(name); - // JUnitDoclet end method JScrollPaneDesktopTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.JScrollPaneDesktop createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.JScrollPaneDesktop(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - jscrollpanedesktop = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - jscrollpanedesktop = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getActiveDrawingView() - /** - * Method testGetActiveDrawingView is testing getActiveDrawingView - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#getActiveDrawingView() - */ - // JUnitDoclet end javadoc_method getActiveDrawingView() - public void testGetActiveDrawingView() throws Exception { - // JUnitDoclet begin method getActiveDrawingView - // JUnitDoclet end method getActiveDrawingView - } - - // JUnitDoclet begin javadoc_method addToDesktop() - /** - * Method testAddToDesktop is testing addToDesktop - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#addToDesktop(CH.ifa.draw.framework.DrawingView, int) - */ - // JUnitDoclet end javadoc_method addToDesktop() - public void testAddToDesktop() throws Exception { - // JUnitDoclet begin method addToDesktop - // JUnitDoclet end method addToDesktop - } - - // JUnitDoclet begin javadoc_method removeFromDesktop() - /** - * Method testRemoveFromDesktop is testing removeFromDesktop - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#removeFromDesktop(CH.ifa.draw.framework.DrawingView, int) - */ - // JUnitDoclet end javadoc_method removeFromDesktop() - public void testRemoveFromDesktop() throws Exception { - // JUnitDoclet begin method removeFromDesktop - // JUnitDoclet end method removeFromDesktop - } - - // JUnitDoclet begin javadoc_method removeAllFromDesktop() - /** - * Method testRemoveAllFromDesktop is testing removeAllFromDesktop - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#removeAllFromDesktop(int) - */ - // JUnitDoclet end javadoc_method removeAllFromDesktop() - public void testRemoveAllFromDesktop() throws Exception { - // JUnitDoclet begin method removeAllFromDesktop - // JUnitDoclet end method removeAllFromDesktop - } - - // JUnitDoclet begin javadoc_method getAllFromDesktop() - /** - * Method testGetAllFromDesktop is testing getAllFromDesktop - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#getAllFromDesktop(int) - */ - // JUnitDoclet end javadoc_method getAllFromDesktop() - public void testGetAllFromDesktop() throws Exception { - // JUnitDoclet begin method getAllFromDesktop - // JUnitDoclet end method getAllFromDesktop - } - - // JUnitDoclet begin javadoc_method addDesktopListener() - /** - * Method testAddDesktopListener is testing addDesktopListener - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#addDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method addDesktopListener() - public void testAddDesktopListener() throws Exception { - // JUnitDoclet begin method addDesktopListener - // JUnitDoclet end method addDesktopListener - } - - // JUnitDoclet begin javadoc_method removeDesktopListener() - /** - * Method testRemoveDesktopListener is testing removeDesktopListener - * @see CH.ifa.draw.contrib.JScrollPaneDesktop#removeDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method removeDesktopListener() - public void testRemoveDesktopListener() throws Exception { - // JUnitDoclet begin method removeDesktopListener - // JUnitDoclet end method removeDesktopListener - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/MDIDesktopPaneTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/MDIDesktopPaneTest.java deleted file mode 100644 index 3ddc140de46890698cfb82b891187981818480d3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/MDIDesktopPaneTest.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.MDIDesktopPane; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MDIDesktopPaneTest is generated by - * JUnitDoclet to hold the tests for MDIDesktopPane. - * @see CH.ifa.draw.contrib.MDIDesktopPane - */ -// JUnitDoclet end javadoc_class -public class MDIDesktopPaneTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MDIDesktopPane mdidesktoppane; - // JUnitDoclet end class - - /** - * Constructor MDIDesktopPaneTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MDIDesktopPaneTest(String name) { - // JUnitDoclet begin method MDIDesktopPaneTest - super(name); - // JUnitDoclet end method MDIDesktopPaneTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.MDIDesktopPane createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.MDIDesktopPane(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - mdidesktoppane = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - mdidesktoppane = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getActiveDrawingView() - /** - * Method testGetActiveDrawingView is testing getActiveDrawingView - * @see CH.ifa.draw.contrib.MDIDesktopPane#getActiveDrawingView() - */ - // JUnitDoclet end javadoc_method getActiveDrawingView() - public void testGetActiveDrawingView() throws Exception { - // JUnitDoclet begin method getActiveDrawingView - // JUnitDoclet end method getActiveDrawingView - } - - // JUnitDoclet begin javadoc_method addToDesktop() - /** - * Method testAddToDesktop is testing addToDesktop - * @see CH.ifa.draw.contrib.MDIDesktopPane#addToDesktop(CH.ifa.draw.framework.DrawingView, int) - */ - // JUnitDoclet end javadoc_method addToDesktop() - public void testAddToDesktop() throws Exception { - // JUnitDoclet begin method addToDesktop - // JUnitDoclet end method addToDesktop - } - - // JUnitDoclet begin javadoc_method removeFromDesktop() - /** - * Method testRemoveFromDesktop is testing removeFromDesktop - * @see CH.ifa.draw.contrib.MDIDesktopPane#removeFromDesktop(CH.ifa.draw.framework.DrawingView, int) - */ - // JUnitDoclet end javadoc_method removeFromDesktop() - public void testRemoveFromDesktop() throws Exception { - // JUnitDoclet begin method removeFromDesktop - // JUnitDoclet end method removeFromDesktop - } - - // JUnitDoclet begin javadoc_method removeAllFromDesktop() - /** - * Method testRemoveAllFromDesktop is testing removeAllFromDesktop - * @see CH.ifa.draw.contrib.MDIDesktopPane#removeAllFromDesktop(int) - */ - // JUnitDoclet end javadoc_method removeAllFromDesktop() - public void testRemoveAllFromDesktop() throws Exception { - // JUnitDoclet begin method removeAllFromDesktop - // JUnitDoclet end method removeAllFromDesktop - } - - // JUnitDoclet begin javadoc_method getAllFromDesktop() - /** - * Method testGetAllFromDesktop is testing getAllFromDesktop - * @see CH.ifa.draw.contrib.MDIDesktopPane#getAllFromDesktop(int) - */ - // JUnitDoclet end javadoc_method getAllFromDesktop() - public void testGetAllFromDesktop() throws Exception { - // JUnitDoclet begin method getAllFromDesktop - // JUnitDoclet end method getAllFromDesktop - } - - // JUnitDoclet begin javadoc_method addDesktopListener() - /** - * Method testAddDesktopListener is testing addDesktopListener - * @see CH.ifa.draw.contrib.MDIDesktopPane#addDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method addDesktopListener() - public void testAddDesktopListener() throws Exception { - // JUnitDoclet begin method addDesktopListener - // JUnitDoclet end method addDesktopListener - } - - // JUnitDoclet begin javadoc_method removeDesktopListener() - /** - * Method testRemoveDesktopListener is testing removeDesktopListener - * @see CH.ifa.draw.contrib.MDIDesktopPane#removeDesktopListener(CH.ifa.draw.contrib.DesktopListener) - */ - // JUnitDoclet end javadoc_method removeDesktopListener() - public void testRemoveDesktopListener() throws Exception { - // JUnitDoclet begin method removeDesktopListener - // JUnitDoclet end method removeDesktopListener - } - - // JUnitDoclet begin javadoc_method cascadeFrames() - /** - * Method testCascadeFrames is testing cascadeFrames - * @see CH.ifa.draw.contrib.MDIDesktopPane#cascadeFrames() - */ - // JUnitDoclet end javadoc_method cascadeFrames() - public void testCascadeFrames() throws Exception { - // JUnitDoclet begin method cascadeFrames - // JUnitDoclet end method cascadeFrames - } - - // JUnitDoclet begin javadoc_method tileFrames() - /** - * Method testTileFrames is testing tileFrames - * @see CH.ifa.draw.contrib.MDIDesktopPane#tileFrames() - */ - // JUnitDoclet end javadoc_method tileFrames() - public void testTileFrames() throws Exception { - // JUnitDoclet begin method tileFrames - // JUnitDoclet end method tileFrames - } - - // JUnitDoclet begin javadoc_method tileFramesHorizontally() - /** - * Method testTileFramesHorizontally is testing tileFramesHorizontally - * @see CH.ifa.draw.contrib.MDIDesktopPane#tileFramesHorizontally() - */ - // JUnitDoclet end javadoc_method tileFramesHorizontally() - public void testTileFramesHorizontally() throws Exception { - // JUnitDoclet begin method tileFramesHorizontally - // JUnitDoclet end method tileFramesHorizontally - } - - // JUnitDoclet begin javadoc_method tileFramesVertically() - /** - * Method testTileFramesVertically is testing tileFramesVertically - * @see CH.ifa.draw.contrib.MDIDesktopPane#tileFramesVertically() - */ - // JUnitDoclet end javadoc_method tileFramesVertically() - public void testTileFramesVertically() throws Exception { - // JUnitDoclet begin method tileFramesVertically - // JUnitDoclet end method tileFramesVertically - } - - // JUnitDoclet begin javadoc_method arrangeFramesVertically() - /** - * Method testArrangeFramesVertically is testing arrangeFramesVertically - * @see CH.ifa.draw.contrib.MDIDesktopPane#arrangeFramesVertically() - */ - // JUnitDoclet end javadoc_method arrangeFramesVertically() - public void testArrangeFramesVertically() throws Exception { - // JUnitDoclet begin method arrangeFramesVertically - // JUnitDoclet end method arrangeFramesVertically - } - - // JUnitDoclet begin javadoc_method arrangeFramesHorizontally() - /** - * Method testArrangeFramesHorizontally is testing arrangeFramesHorizontally - * @see CH.ifa.draw.contrib.MDIDesktopPane#arrangeFramesHorizontally() - */ - // JUnitDoclet end javadoc_method arrangeFramesHorizontally() - public void testArrangeFramesHorizontally() throws Exception { - // JUnitDoclet begin method arrangeFramesHorizontally - // JUnitDoclet end method arrangeFramesHorizontally - } - - // JUnitDoclet begin javadoc_method setAllSize() - /** - * Method testSetAllSize is testing setAllSize - * @see CH.ifa.draw.contrib.MDIDesktopPane#setAllSize(java.awt.Dimension) - */ - // JUnitDoclet end javadoc_method setAllSize() - public void testSetAllSize() throws Exception { - // JUnitDoclet begin method setAllSize - // JUnitDoclet end method setAllSize - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/MDI_DrawApplicationTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/MDI_DrawApplicationTest.java deleted file mode 100644 index 7d799e5f40fd5e843993679ec2fcac3e82faecde..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/MDI_DrawApplicationTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.MDI_DrawApplication; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MDI_DrawApplicationTest is generated by - * JUnitDoclet to hold the tests for MDI_DrawApplication. - * @see CH.ifa.draw.contrib.MDI_DrawApplication - */ -// JUnitDoclet end javadoc_class -public class MDI_DrawApplicationTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MDI_DrawApplication mdi_drawapplication; - // JUnitDoclet end class - - /** - * Constructor MDI_DrawApplicationTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MDI_DrawApplicationTest(String name) { - // JUnitDoclet begin method MDI_DrawApplicationTest - super(name); - // JUnitDoclet end method MDI_DrawApplicationTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.MDI_DrawApplication createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.MDI_DrawApplication(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - mdi_drawapplication = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - mdi_drawapplication = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method promptNew() - /** - * Method testPromptNew is testing promptNew - * @see CH.ifa.draw.contrib.MDI_DrawApplication#promptNew() - */ - // JUnitDoclet end javadoc_method promptNew() - public void testPromptNew() throws Exception { - // JUnitDoclet begin method promptNew - // JUnitDoclet end method promptNew - } - - // JUnitDoclet begin javadoc_method newWindow() - /** - * Method testNewWindow is testing newWindow - * @see CH.ifa.draw.contrib.MDI_DrawApplication#newWindow(CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method newWindow() - public void testNewWindow() throws Exception { - // JUnitDoclet begin method newWindow - // JUnitDoclet end method newWindow - } - - // JUnitDoclet begin javadoc_method newView() - /** - * Method testNewView is testing newView - * @see CH.ifa.draw.contrib.MDI_DrawApplication#newView() - */ - // JUnitDoclet end javadoc_method newView() - public void testNewView() throws Exception { - // JUnitDoclet begin method newView - // JUnitDoclet end method newView - } - - // JUnitDoclet begin javadoc_method views() - /** - * Method testViews is testing views - * @see CH.ifa.draw.contrib.MDI_DrawApplication#views() - */ - // JUnitDoclet end javadoc_method views() - public void testViews() throws Exception { - // JUnitDoclet begin method views - // JUnitDoclet end method views - } - - // JUnitDoclet begin javadoc_method getDefaultDrawingTitle() - /** - * Method testGetDefaultDrawingTitle is testing getDefaultDrawingTitle - * @see CH.ifa.draw.contrib.MDI_DrawApplication#getDefaultDrawingTitle() - */ - // JUnitDoclet end javadoc_method getDefaultDrawingTitle() - public void testGetDefaultDrawingTitle() throws Exception { - // JUnitDoclet begin method getDefaultDrawingTitle - // JUnitDoclet end method getDefaultDrawingTitle - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/MiniMapViewTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/MiniMapViewTest.java deleted file mode 100644 index 2b780445b5d0b2217278b94db5a34b7d15ce951e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/MiniMapViewTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; -import java.awt.Component; - -import javax.swing.JScrollPane; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.MiniMapView; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MiniMapViewTest is generated by - * JUnitDoclet to hold the tests for MiniMapView. - * @see CH.ifa.draw.contrib.MiniMapView - */ -// JUnitDoclet end javadoc_class -public class MiniMapViewTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MiniMapView minimapview; - // JUnitDoclet end class - - /** - * Constructor MiniMapViewTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MiniMapViewTest(String name) { - // JUnitDoclet begin method MiniMapViewTest - super(name); - // JUnitDoclet end method MiniMapViewTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.MiniMapView createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - JScrollPane sp = new JScrollPane((Component)getDrawingEditor().view()); - sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - sp.setAlignmentX(Component.LEFT_ALIGNMENT); - return new CH.ifa.draw.contrib.MiniMapView(getDrawingEditor().view(), sp); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - getDrawingEditor().open(); - minimapview = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - minimapview = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getMappedDrawingView() - /** - * Method testGetMappedDrawingView is testing getMappedDrawingView - * @see CH.ifa.draw.contrib.MiniMapView#getMappedDrawingView() - */ - // JUnitDoclet end javadoc_method getMappedDrawingView() - public void testGetMappedDrawingView() throws Exception { - // JUnitDoclet begin method getMappedDrawingView - // JUnitDoclet end method getMappedDrawingView - } - - // JUnitDoclet begin javadoc_method getSubject() - /** - * Method testGetSubject is testing getSubject - * @see CH.ifa.draw.contrib.MiniMapView#getSubject() - */ - // JUnitDoclet end javadoc_method getSubject() - public void testGetSubject() throws Exception { - // JUnitDoclet begin method getSubject - // JUnitDoclet end method getSubject - } - - // JUnitDoclet begin javadoc_method getViewBowColor() - /** - * Method testGetViewBowColor is testing getViewBowColor - * @see CH.ifa.draw.contrib.MiniMapView#getViewBowColor() - */ - // JUnitDoclet end javadoc_method getViewBowColor() - public void testGetViewBowColor() throws Exception { - // JUnitDoclet begin method getViewBowColor - // JUnitDoclet end method getViewBowColor - } - - // JUnitDoclet begin javadoc_method setViewBoxColor() - /** - * Method testSetViewBoxColor is testing setViewBoxColor - * @see CH.ifa.draw.contrib.MiniMapView#setViewBoxColor(java.awt.Color) - */ - // JUnitDoclet end javadoc_method setViewBoxColor() - public void testSetViewBoxColor() throws Exception { - // JUnitDoclet begin method setViewBoxColor - // JUnitDoclet end method setViewBoxColor - } - - // JUnitDoclet begin javadoc_method paint() - /** - * Method testPaint is testing paint - * @see CH.ifa.draw.contrib.MiniMapView#paint(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method paint() - public void testPaint() throws Exception { - // JUnitDoclet begin method paint - // JUnitDoclet end method paint - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/NestedCreationToolTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/NestedCreationToolTest.java deleted file mode 100644 index 7c64c0d662eab727326e6b8f5512518e96711241..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/NestedCreationToolTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.NestedCreationTool; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NestedCreationToolTest is generated by - * JUnitDoclet to hold the tests for NestedCreationTool. - * @see CH.ifa.draw.contrib.NestedCreationTool - */ -// JUnitDoclet end javadoc_class -public class NestedCreationToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NestedCreationTool nestedcreationtool; - // JUnitDoclet end class - - /** - * Constructor NestedCreationToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NestedCreationToolTest(String name) { - // JUnitDoclet begin method NestedCreationToolTest - super(name); - // JUnitDoclet end method NestedCreationToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.NestedCreationTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.NestedCreationTool(getDrawingEditor(), new RectangleFigure(new Point(20, 20), new Point(90, 90))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nestedcreationtool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nestedcreationtool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.contrib.NestedCreationTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.contrib.NestedCreationTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.contrib.NestedCreationTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method getContainerFigure() - /** - * Method testGetContainerFigure is testing getContainerFigure - * @see CH.ifa.draw.contrib.NestedCreationTool#getContainerFigure() - */ - // JUnitDoclet end javadoc_method getContainerFigure() - public void testGetContainerFigure() throws Exception { - // JUnitDoclet begin method getContainerFigure - // JUnitDoclet end method getContainerFigure - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonFigureTest.java deleted file mode 100644 index a4cf0d434100f330c42ea085530aa57920eab1df..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonFigureTest.java +++ /dev/null @@ -1,419 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.PolygonFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PolygonFigureTest is generated by - * JUnitDoclet to hold the tests for PolygonFigure. - * @see CH.ifa.draw.contrib.PolygonFigure - */ -// JUnitDoclet end javadoc_class -public class PolygonFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PolygonFigure polygonfigure; - // JUnitDoclet end class - - /** - * Constructor PolygonFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PolygonFigureTest(String name) { - // JUnitDoclet begin method PolygonFigureTest - super(name); - // JUnitDoclet end method PolygonFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.PolygonFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.PolygonFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - polygonfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - polygonfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.contrib.PolygonFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.contrib.PolygonFigure#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.contrib.PolygonFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.contrib.PolygonFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method getPolygon() - /** - * Method testGetPolygon is testing getPolygon - * @see CH.ifa.draw.contrib.PolygonFigure#getPolygon() - */ - // JUnitDoclet end javadoc_method getPolygon() - public void testGetPolygon() throws Exception { - // JUnitDoclet begin method getPolygon - // JUnitDoclet end method getPolygon - } - - // JUnitDoclet begin javadoc_method getInternalPolygon() - /** - * Method testGetInternalPolygon is testing getInternalPolygon - * @see CH.ifa.draw.contrib.PolygonFigure#getInternalPolygon() - */ - // JUnitDoclet end javadoc_method getInternalPolygon() - public void testGetInternalPolygon() throws Exception { - // JUnitDoclet begin method getInternalPolygon - // JUnitDoclet end method getInternalPolygon - } - - // JUnitDoclet begin javadoc_method center() - /** - * Method testCenter is testing center - * @see CH.ifa.draw.contrib.PolygonFigure#center() - */ - // JUnitDoclet end javadoc_method center() - public void testCenter() throws Exception { - // JUnitDoclet begin method center - // JUnitDoclet end method center - } - - // JUnitDoclet begin javadoc_method points() - /** - * Method testPoints is testing points - * @see CH.ifa.draw.contrib.PolygonFigure#points() - */ - // JUnitDoclet end javadoc_method points() - public void testPoints() throws Exception { - // JUnitDoclet begin method points - // JUnitDoclet end method points - } - - // JUnitDoclet begin javadoc_method pointCount() - /** - * Method testPointCount is testing pointCount - * @see CH.ifa.draw.contrib.PolygonFigure#pointCount() - */ - // JUnitDoclet end javadoc_method pointCount() - public void testPointCount() throws Exception { - // JUnitDoclet begin method pointCount - // JUnitDoclet end method pointCount - } - - // JUnitDoclet begin javadoc_method basicMoveBy() - /** - * Method testBasicMoveBy is testing basicMoveBy - * @see CH.ifa.draw.contrib.PolygonFigure#basicMoveBy(int, int) - */ - // JUnitDoclet end javadoc_method basicMoveBy() - public void testBasicMoveBy() throws Exception { - // JUnitDoclet begin method basicMoveBy - // JUnitDoclet end method basicMoveBy - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.contrib.PolygonFigure#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method drawFrame() - /** - * Method testDrawFrame is testing drawFrame - * @see CH.ifa.draw.contrib.PolygonFigure#drawFrame(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawFrame() - public void testDrawFrame() throws Exception { - // JUnitDoclet begin method drawFrame - // JUnitDoclet end method drawFrame - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.contrib.PolygonFigure#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method connectorAt() - /** - * Method testConnectorAt is testing connectorAt - * @see CH.ifa.draw.contrib.PolygonFigure#connectorAt(int, int) - */ - // JUnitDoclet end javadoc_method connectorAt() - public void testConnectorAt() throws Exception { - // JUnitDoclet begin method connectorAt - // JUnitDoclet end method connectorAt - } - - // JUnitDoclet begin javadoc_method addPoint() - /** - * Method testAddPoint is testing addPoint - * @see CH.ifa.draw.contrib.PolygonFigure#addPoint(int, int) - */ - // JUnitDoclet end javadoc_method addPoint() - public void testAddPoint() throws Exception { - // JUnitDoclet begin method addPoint - // JUnitDoclet end method addPoint - } - - // JUnitDoclet begin javadoc_method setPointAt() - /** - * Method testSetPointAt is testing setPointAt - * @see CH.ifa.draw.contrib.PolygonFigure#setPointAt(java.awt.Point, int) - */ - // JUnitDoclet end javadoc_method setPointAt() - public void testSetPointAt() throws Exception { - // JUnitDoclet begin method setPointAt - // JUnitDoclet end method setPointAt - } - - // JUnitDoclet begin javadoc_method insertPointAt() - /** - * Method testInsertPointAt is testing insertPointAt - * @see CH.ifa.draw.contrib.PolygonFigure#insertPointAt(java.awt.Point, int) - */ - // JUnitDoclet end javadoc_method insertPointAt() - public void testInsertPointAt() throws Exception { - // JUnitDoclet begin method insertPointAt - // JUnitDoclet end method insertPointAt - } - - // JUnitDoclet begin javadoc_method removePointAt() - /** - * Method testRemovePointAt is testing removePointAt - * @see CH.ifa.draw.contrib.PolygonFigure#removePointAt(int) - */ - // JUnitDoclet end javadoc_method removePointAt() - public void testRemovePointAt() throws Exception { - // JUnitDoclet begin method removePointAt - // JUnitDoclet end method removePointAt - } - - // JUnitDoclet begin javadoc_method scaleRotate() - /** - * Method testScaleRotate is testing scaleRotate - * @see CH.ifa.draw.contrib.PolygonFigure#scaleRotate(java.awt.Point, java.awt.Polygon, java.awt.Point) - */ - // JUnitDoclet end javadoc_method scaleRotate() - public void testScaleRotate() throws Exception { - // JUnitDoclet begin method scaleRotate - // JUnitDoclet end method scaleRotate - } - - // JUnitDoclet begin javadoc_method smoothPoints() - /** - * Method testSmoothPoints is testing smoothPoints - * @see CH.ifa.draw.contrib.PolygonFigure#smoothPoints() - */ - // JUnitDoclet end javadoc_method smoothPoints() - public void testSmoothPoints() throws Exception { - // JUnitDoclet begin method smoothPoints - // JUnitDoclet end method smoothPoints - } - - // JUnitDoclet begin javadoc_method splitSegment() - /** - * Method testSplitSegment is testing splitSegment - * @see CH.ifa.draw.contrib.PolygonFigure#splitSegment(int, int) - */ - // JUnitDoclet end javadoc_method splitSegment() - public void testSplitSegment() throws Exception { - // JUnitDoclet begin method splitSegment - // JUnitDoclet end method splitSegment - } - - // JUnitDoclet begin javadoc_method pointAt() - /** - * Method testPointAt is testing pointAt - * @see CH.ifa.draw.contrib.PolygonFigure#pointAt(int) - */ - // JUnitDoclet end javadoc_method pointAt() - public void testPointAt() throws Exception { - // JUnitDoclet begin method pointAt - // JUnitDoclet end method pointAt - } - - // JUnitDoclet begin javadoc_method outermostPoint() - /** - * Method testOutermostPoint is testing outermostPoint - * @see CH.ifa.draw.contrib.PolygonFigure#outermostPoint() - */ - // JUnitDoclet end javadoc_method outermostPoint() - public void testOutermostPoint() throws Exception { - // JUnitDoclet begin method outermostPoint - // JUnitDoclet end method outermostPoint - } - - // JUnitDoclet begin javadoc_method findSegment() - /** - * Method testFindSegment is testing findSegment - * @see CH.ifa.draw.contrib.PolygonFigure#findSegment(int, int) - */ - // JUnitDoclet end javadoc_method findSegment() - public void testFindSegment() throws Exception { - // JUnitDoclet begin method findSegment - // JUnitDoclet end method findSegment - } - - // JUnitDoclet begin javadoc_method chop() - /** - * Method testChop is testing chop - * @see CH.ifa.draw.contrib.PolygonFigure#chop(java.awt.Point) - */ - // JUnitDoclet end javadoc_method chop() - public void testChop() throws Exception { - // JUnitDoclet begin method chop - // JUnitDoclet end method chop - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.contrib.PolygonFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.contrib.PolygonFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method locator() - /** - * Method testLocator is testing locator - * @see CH.ifa.draw.contrib.PolygonFigure#locator(int) - */ - // JUnitDoclet end javadoc_method locator() - public void testLocator() throws Exception { - // JUnitDoclet begin method locator - // JUnitDoclet end method locator - } - - // JUnitDoclet begin javadoc_method bounds() - /** - * Method testBounds is testing bounds - * @see CH.ifa.draw.contrib.PolygonFigure#bounds(java.awt.Polygon) - */ - // JUnitDoclet end javadoc_method bounds() - public void testBounds() throws Exception { - // JUnitDoclet begin method bounds - // JUnitDoclet end method bounds - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonHandleTest.java deleted file mode 100644 index 0bc94bdb6b8408796baca7fa4c4ed7684bf2a2cf..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonHandleTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.PolygonFigure; -import CH.ifa.draw.contrib.PolygonHandle; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PolygonHandleTest is generated by - * JUnitDoclet to hold the tests for PolygonHandle. - * @see CH.ifa.draw.contrib.PolygonHandle - */ -// JUnitDoclet end javadoc_class -public class PolygonHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PolygonHandle polygonhandle; - // JUnitDoclet end class - - /** - * Constructor PolygonHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PolygonHandleTest(String name) { - // JUnitDoclet begin method PolygonHandleTest - super(name); - // JUnitDoclet end method PolygonHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.PolygonHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - PolygonFigure figure = new PolygonFigure(20, 20); - figure.addPoint(30, 30); - figure.addPoint(40, 40); - return new CH.ifa.draw.contrib.PolygonHandle(figure, PolygonFigure.locator(2), 2); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - polygonhandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - polygonhandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method invokeStart() - /** - * Method testInvokeStart is testing invokeStart - * @see CH.ifa.draw.contrib.PolygonHandle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStart() - public void testInvokeStart() throws Exception { - // JUnitDoclet begin method invokeStart - // JUnitDoclet end method invokeStart - } - - // JUnitDoclet begin javadoc_method invokeStep() - /** - * Method testInvokeStep is testing invokeStep - * @see CH.ifa.draw.contrib.PolygonHandle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStep() - public void testInvokeStep() throws Exception { - // JUnitDoclet begin method invokeStep - // JUnitDoclet end method invokeStep - } - - // JUnitDoclet begin javadoc_method invokeEnd() - /** - * Method testInvokeEnd is testing invokeEnd - * @see CH.ifa.draw.contrib.PolygonHandle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeEnd() - public void testInvokeEnd() throws Exception { - // JUnitDoclet begin method invokeEnd - // JUnitDoclet end method invokeEnd - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.contrib.PolygonHandle#locate() - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonToolTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonToolTest.java deleted file mode 100644 index 40c3c486d6d193a94742ab8eae5bbdee8d00e900..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/PolygonToolTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.PolygonTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PolygonToolTest is generated by - * JUnitDoclet to hold the tests for PolygonTool. - * @see CH.ifa.draw.contrib.PolygonTool - */ -// JUnitDoclet end javadoc_class -public class PolygonToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PolygonTool polygontool; - // JUnitDoclet end class - - /** - * Constructor PolygonToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PolygonToolTest(String name) { - // JUnitDoclet begin method PolygonToolTest - super(name); - // JUnitDoclet end method PolygonToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.PolygonTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.PolygonTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - polygontool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - polygontool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.contrib.PolygonTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.contrib.PolygonTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.contrib.PolygonTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.contrib.PolygonTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.contrib.PolygonTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.contrib.PolygonTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/SVGDrawAppTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/SVGDrawAppTest.java deleted file mode 100644 index 62caff8a24c2cb7c3eb9700995a06eda246ac593..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/SVGDrawAppTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.SVGDrawApp; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SVGDrawAppTest is generated by - * JUnitDoclet to hold the tests for SVGDrawApp. - * @see CH.ifa.draw.contrib.SVGDrawApp - */ -// JUnitDoclet end javadoc_class -public class SVGDrawAppTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SVGDrawApp svgdrawapp; - // JUnitDoclet end class - - /** - * Constructor SVGDrawAppTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SVGDrawAppTest(String name) { - // JUnitDoclet begin method SVGDrawAppTest - super(name); - // JUnitDoclet end method SVGDrawAppTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.SVGDrawApp createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.SVGDrawApp(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - svgdrawapp = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - svgdrawapp = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.contrib.SVGDrawApp#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method createStorageFormatManager() - /** - * Method testCreateStorageFormatManager is testing createStorageFormatManager - * @see CH.ifa.draw.contrib.SVGDrawApp#createStorageFormatManager() - */ - // JUnitDoclet end javadoc_method createStorageFormatManager() - public void testCreateStorageFormatManager() throws Exception { - // JUnitDoclet begin method createStorageFormatManager - // JUnitDoclet end method createStorageFormatManager - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/SVGStorageFormatTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/SVGStorageFormatTest.java deleted file mode 100644 index a6f0cf1645452d89b74fd7c2a90225893b38ffda..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/SVGStorageFormatTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.SVGStorageFormat; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SVGStorageFormatTest is generated by - * JUnitDoclet to hold the tests for SVGStorageFormat. - * @see CH.ifa.draw.contrib.SVGStorageFormat - */ -// JUnitDoclet end javadoc_class -public class SVGStorageFormatTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SVGStorageFormat svgstorageformat; - // JUnitDoclet end class - - /** - * Constructor SVGStorageFormatTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SVGStorageFormatTest(String name) { - // JUnitDoclet begin method SVGStorageFormatTest - super(name); - // JUnitDoclet end method SVGStorageFormatTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.SVGStorageFormat createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.SVGStorageFormat(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - svgstorageformat = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - svgstorageformat = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createFileDescription() - /** - * Method testCreateFileDescription is testing createFileDescription - * @see CH.ifa.draw.contrib.SVGStorageFormat#createFileDescription() - */ - // JUnitDoclet end javadoc_method createFileDescription() - public void testCreateFileDescription() throws Exception { - // JUnitDoclet begin method createFileDescription - // JUnitDoclet end method createFileDescription - } - - // JUnitDoclet begin javadoc_method store() - /** - * Method testStore is testing store - * @see CH.ifa.draw.contrib.SVGStorageFormat#store(java.lang.String, CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method store() - public void testStore() throws Exception { - // JUnitDoclet begin method store - // JUnitDoclet end method store - } - - // JUnitDoclet begin javadoc_method restore() - /** - * Method testRestore is testing restore - * @see CH.ifa.draw.contrib.SVGStorageFormat#restore(java.lang.String) - */ - // JUnitDoclet end javadoc_method restore() - public void testRestore() throws Exception { - // JUnitDoclet begin method restore - // JUnitDoclet end method restore - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/SimpleLayouterTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/SimpleLayouterTest.java deleted file mode 100644 index 3ae9d379438d2f7bd9d5d59b1de9e45d7f894f95..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/SimpleLayouterTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import java.awt.Point; - -import junit.framework.TestCase; -// JUnitDoclet begin import -import CH.ifa.draw.contrib.GraphicalCompositeFigure; -import CH.ifa.draw.contrib.Layoutable; -import CH.ifa.draw.contrib.SimpleLayouter; -import CH.ifa.draw.figures.RectangleFigure; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SimpleLayouterTest is generated by - * JUnitDoclet to hold the tests for SimpleLayouter. - * @see CH.ifa.draw.contrib.SimpleLayouter - */ -// JUnitDoclet end javadoc_class -public class SimpleLayouterTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SimpleLayouter simplelayouter; - // JUnitDoclet end class - - /** - * Constructor SimpleLayouterTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SimpleLayouterTest(String name) { - // JUnitDoclet begin method SimpleLayouterTest - super(name); - // JUnitDoclet end method SimpleLayouterTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.SimpleLayouter createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Layoutable fig = new GraphicalCompositeFigure(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - return new CH.ifa.draw.contrib.SimpleLayouter(fig); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - simplelayouter = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - simplelayouter = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setLayoutable() - /** - * Method testSetGetLayoutable is testing setLayoutable - * and getLayoutable together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.SimpleLayouter#setLayoutable(CH.ifa.draw.contrib.Layoutable) - * @see CH.ifa.draw.contrib.SimpleLayouter#getLayoutable() - */ - // JUnitDoclet end javadoc_method setLayoutable() - public void testSetGetLayoutable() throws Exception { - // JUnitDoclet begin method setLayoutable getLayoutable - CH.ifa.draw.contrib.Layoutable[] tests = { new GraphicalCompositeFigure(), null }; - - for (int i = 0; i < tests.length; i++) { - simplelayouter.setLayoutable(tests[i]); - assertEquals(tests[i], simplelayouter.getLayoutable()); - } - // JUnitDoclet end method setLayoutable getLayoutable - } - - // JUnitDoclet begin javadoc_method setInsets() - /** - * Method testSetGetInsets is testing setInsets - * and getInsets together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.SimpleLayouter#setInsets(java.awt.Insets) - * @see CH.ifa.draw.contrib.SimpleLayouter#getInsets() - */ - // JUnitDoclet end javadoc_method setInsets() - public void testSetGetInsets() throws Exception { - // JUnitDoclet begin method setInsets getInsets - java.awt.Insets[] tests = { new java.awt.Insets(5, 5, 5, 5), null }; - - for (int i = 0; i < tests.length; i++) { - simplelayouter.setInsets(tests[i]); - assertEquals(tests[i], simplelayouter.getInsets()); - } - // JUnitDoclet end method setInsets getInsets - } - - // JUnitDoclet begin javadoc_method create() - /** - * Method testCreate is testing create - * @see CH.ifa.draw.contrib.SimpleLayouter#create(CH.ifa.draw.contrib.Layoutable) - */ - // JUnitDoclet end javadoc_method create() - public void testCreate() throws Exception { - // JUnitDoclet begin method create - // JUnitDoclet end method create - } - - // JUnitDoclet begin javadoc_method calculateLayout() - /** - * Method testCalculateLayout is testing calculateLayout - * @see CH.ifa.draw.contrib.SimpleLayouter#calculateLayout(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method calculateLayout() - public void testCalculateLayout() throws Exception { - // JUnitDoclet begin method calculateLayout - // JUnitDoclet end method calculateLayout - } - - // JUnitDoclet begin javadoc_method layout() - /** - * Method testLayout is testing layout - * @see CH.ifa.draw.contrib.SimpleLayouter#layout(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method layout() - public void testLayout() throws Exception { - // JUnitDoclet begin method layout - // JUnitDoclet end method layout - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.contrib.SimpleLayouter#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.contrib.SimpleLayouter#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/SplitConnectionToolTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/SplitConnectionToolTest.java deleted file mode 100644 index 3a8422194b86d5f7fb712e2663527bfa6ad192ef..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/SplitConnectionToolTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.SplitConnectionTool; -import CH.ifa.draw.figures.LineConnection; -import CH.ifa.draw.framework.ConnectionFigure; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SplitConnectionToolTest is generated by - * JUnitDoclet to hold the tests for SplitConnectionTool. - * @see CH.ifa.draw.contrib.SplitConnectionTool - */ -// JUnitDoclet end javadoc_class -public class SplitConnectionToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SplitConnectionTool splitconnectiontool; - // JUnitDoclet end class - - /** - * Constructor SplitConnectionToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SplitConnectionToolTest(String name) { - // JUnitDoclet begin method SplitConnectionToolTest - super(name); - // JUnitDoclet end method SplitConnectionToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.SplitConnectionTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - ConnectionFigure lineConnection = new LineConnection(); - return new CH.ifa.draw.contrib.SplitConnectionTool(getDrawingEditor(), lineConnection); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - splitconnectiontool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - splitconnectiontool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.contrib.SplitConnectionTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.contrib.SplitConnectionTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.contrib.SplitConnectionTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.contrib.SplitConnectionTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.contrib.SplitConnectionTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/StandardLayouterTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/StandardLayouterTest.java deleted file mode 100644 index 2a8b5c326b4235e031005d5146b607019e87321e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/StandardLayouterTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.StandardLayouter; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StandardLayouterTest is generated by - * JUnitDoclet to hold the tests for StandardLayouter. - * @see CH.ifa.draw.contrib.StandardLayouter - */ -// JUnitDoclet end javadoc_class -public class StandardLayouterTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StandardLayouter standardlayouter; - // JUnitDoclet end class - - /** - * Constructor StandardLayouterTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StandardLayouterTest(String name) { - // JUnitDoclet begin method StandardLayouterTest - super(name); - // JUnitDoclet end method StandardLayouterTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.StandardLayouter createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.StandardLayouter(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - standardlayouter = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - standardlayouter = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method create() - /** - * Method testCreate is testing create - * @see CH.ifa.draw.contrib.StandardLayouter#create(CH.ifa.draw.contrib.Layoutable) - */ - // JUnitDoclet end javadoc_method create() - public void testCreate() throws Exception { - // JUnitDoclet begin method create - // JUnitDoclet end method create - } - - // JUnitDoclet begin javadoc_method calculateLayout() - /** - * Method testCalculateLayout is testing calculateLayout - * @see CH.ifa.draw.contrib.StandardLayouter#calculateLayout(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method calculateLayout() - public void testCalculateLayout() throws Exception { - // JUnitDoclet begin method calculateLayout - // JUnitDoclet end method calculateLayout - } - - // JUnitDoclet begin javadoc_method layout() - /** - * Method testLayout is testing layout - * @see CH.ifa.draw.contrib.StandardLayouter#layout(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method layout() - public void testLayout() throws Exception { - // JUnitDoclet begin method layout - // JUnitDoclet end method layout - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/TextAreaFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/TextAreaFigureTest.java deleted file mode 100644 index 554123b2be800fbaaff5fca0a24c3b4853f42f60..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/TextAreaFigureTest.java +++ /dev/null @@ -1,508 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import java.awt.Font; - -import CH.ifa.draw.contrib.TextAreaFigure; - -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase TextAreaFigureTest is generated by - * JUnitDoclet to hold the tests for TextAreaFigure. - * @see CH.ifa.draw.contrib.TextAreaFigure - */ -// JUnitDoclet end javadoc_class -public class TextAreaFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private TextAreaFigure textareafigure; - // JUnitDoclet end class - - /** - * Constructor TextAreaFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public TextAreaFigureTest(String name) { - // JUnitDoclet begin method TextAreaFigureTest - super(name); - // JUnitDoclet end method TextAreaFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.TextAreaFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.TextAreaFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - textareafigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - textareafigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setText() - /** - * Method testSetGetText is testing setText - * and getText together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.TextAreaFigure#setText(java.lang.String) - * @see CH.ifa.draw.contrib.TextAreaFigure#getText() - */ - // JUnitDoclet end javadoc_method setText() - public void testSetGetText() throws Exception { - // JUnitDoclet begin method setText getText - java.lang.String[] tests = { "", " ", "a", "A", "?", "?", "0123456789", "012345678901234567890", "\n", null }; - - for (int i = 0; i < tests.length; i++) { - textareafigure.setText(tests[i]); - assertEquals(tests[i], textareafigure.getText()); - } - // JUnitDoclet end method setText getText - } - - // JUnitDoclet begin javadoc_method textDisplayBox() - /** - * Method testTextDisplayBox is testing textDisplayBox - * @see CH.ifa.draw.contrib.TextAreaFigure#textDisplayBox() - */ - // JUnitDoclet end javadoc_method textDisplayBox() - public void testTextDisplayBox() throws Exception { - // JUnitDoclet begin method textDisplayBox - // JUnitDoclet end method textDisplayBox - } - - // JUnitDoclet begin javadoc_method createFont() - /** - * Method testCreateFont is testing createFont - * @see CH.ifa.draw.contrib.TextAreaFigure#createFont() - */ - // JUnitDoclet end javadoc_method createFont() - public void testCreateFont() throws Exception { - // JUnitDoclet begin method createFont - // JUnitDoclet end method createFont - } - - // JUnitDoclet begin javadoc_method setReadOnly() - /** - * Method testSetIsReadOnly is testing setReadOnly - * and isReadOnly together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.TextAreaFigure#setReadOnly(boolean) - * @see CH.ifa.draw.contrib.TextAreaFigure#isReadOnly() - */ - // JUnitDoclet end javadoc_method setReadOnly() - public void testSetIsReadOnly() throws Exception { - // JUnitDoclet begin method setReadOnly isReadOnly - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - textareafigure.setReadOnly(tests[i]); - assertEquals(tests[i], textareafigure.isReadOnly()); - } - // JUnitDoclet end method setReadOnly isReadOnly - } - - // JUnitDoclet begin javadoc_method acceptsTyping() - /** - * Method testAcceptsTyping is testing acceptsTyping - * @see CH.ifa.draw.contrib.TextAreaFigure#acceptsTyping() - */ - // JUnitDoclet end javadoc_method acceptsTyping() - public void testAcceptsTyping() throws Exception { - // JUnitDoclet begin method acceptsTyping - // JUnitDoclet end method acceptsTyping - } - - // JUnitDoclet begin javadoc_method isTextDirty() - /** - * Method testIsTextDirty is testing isTextDirty - * @see CH.ifa.draw.contrib.TextAreaFigure#isTextDirty() - */ - // JUnitDoclet end javadoc_method isTextDirty() - public void testIsTextDirty() throws Exception { - // JUnitDoclet begin method isTextDirty - // JUnitDoclet end method isTextDirty - } - - // JUnitDoclet begin javadoc_method setSizeDirty() - /** - * Method testSetIsSizeDirty is testing setSizeDirty - * and isSizeDirty together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.TextAreaFigure#setSizeDirty(boolean) - * @see CH.ifa.draw.contrib.TextAreaFigure#isSizeDirty() - */ - // JUnitDoclet end javadoc_method setSizeDirty() - public void testSetIsSizeDirty() throws Exception { - // JUnitDoclet begin method setSizeDirty isSizeDirty - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - textareafigure.setSizeDirty(tests[i]); - assertEquals(tests[i], textareafigure.isSizeDirty()); - } - // JUnitDoclet end method setSizeDirty isSizeDirty - } - - // JUnitDoclet begin javadoc_method setFont() - /** - * Method testSetGetFont is testing setFont - * and getFont together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.TextAreaFigure#setFont(java.awt.Font) - * @see CH.ifa.draw.contrib.TextAreaFigure#getFont() - */ - // JUnitDoclet end javadoc_method setFont() - public void testSetGetFont() throws Exception { - // JUnitDoclet begin method setFont getFont - Font[] tests = { new Font("Helvetica", Font.PLAIN, 12)}; - - for (int i = 0; i < tests.length; i++) { - textareafigure.setFont(tests[i]); - assertEquals(tests[i], textareafigure.getFont()); - } - // JUnitDoclet end method setFont getFont - } - - // JUnitDoclet begin method setNullFont() - /** - * Test a null argument to setFont. Expect an IllegalArgumentException - * - * @see CH.ifa.draw.contrib.TextAreaFigure#setFont(java.awt.Font) - */ - public void testSetNullFont() throws Exception { - Font original = textareafigure.getFont(); - - try { - textareafigure.setFont(null); - fail("IllegalArgumentException expected"); - } - catch (IllegalArgumentException ok) { - assertEquals("setFont(null) altered property value", original, textareafigure.getFont()); - } - } - // JUnitDoclet end method - - // JUnitDoclet begin javadoc_method overlayColumns() - /** - * Method testOverlayColumns is testing overlayColumns - * @see CH.ifa.draw.contrib.TextAreaFigure#overlayColumns() - */ - // JUnitDoclet end javadoc_method overlayColumns() - public void testOverlayColumns() throws Exception { - // JUnitDoclet begin method overlayColumns - // JUnitDoclet end method overlayColumns - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.contrib.TextAreaFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.contrib.TextAreaFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.contrib.TextAreaFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method moveBy() - /** - * Method testMoveBy is testing moveBy - * @see CH.ifa.draw.contrib.TextAreaFigure#moveBy(int, int) - */ - // JUnitDoclet end javadoc_method moveBy() - public void testMoveBy() throws Exception { - // JUnitDoclet begin method moveBy - // JUnitDoclet end method moveBy - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.contrib.TextAreaFigure#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.contrib.TextAreaFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method drawFrame() - /** - * Method testDrawFrame is testing drawFrame - * @see CH.ifa.draw.contrib.TextAreaFigure#drawFrame(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawFrame() - public void testDrawFrame() throws Exception { - // JUnitDoclet begin method drawFrame - // JUnitDoclet end method drawFrame - } - - // JUnitDoclet begin javadoc_method getAttribute() - /** - * Method testGetAttribute is testing getAttribute - * @see CH.ifa.draw.contrib.TextAreaFigure#getAttribute(java.lang.String) - */ - // JUnitDoclet end javadoc_method getAttribute() - public void testGetAttribute() throws Exception { - // JUnitDoclet begin method getAttribute - // JUnitDoclet end method getAttribute - } - - // JUnitDoclet begin javadoc_method setAttribute() - /** - * Method testSetAttribute is testing setAttribute - * @see CH.ifa.draw.contrib.TextAreaFigure#setAttribute(java.lang.String, java.lang.Object) - */ - // JUnitDoclet end javadoc_method setAttribute() - public void testSetAttribute() throws Exception { - // JUnitDoclet begin method setAttribute - // JUnitDoclet end method setAttribute - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.contrib.TextAreaFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.contrib.TextAreaFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method connect() - /** - * Method testConnect is testing connect - * @see CH.ifa.draw.contrib.TextAreaFigure#connect(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method connect() - public void testConnect() throws Exception { - // JUnitDoclet begin method connect - // JUnitDoclet end method connect - } - - // JUnitDoclet begin javadoc_method disconnect() - /** - * Method testDisconnect is testing disconnect - * @see CH.ifa.draw.contrib.TextAreaFigure#disconnect(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method disconnect() - public void testDisconnect() throws Exception { - // JUnitDoclet begin method disconnect - // JUnitDoclet end method disconnect - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.contrib.TextAreaFigure#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.contrib.TextAreaFigure#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method figureRemoved() - /** - * Method testFigureRemoved is testing figureRemoved - * @see CH.ifa.draw.contrib.TextAreaFigure#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRemoved() - public void testFigureRemoved() throws Exception { - // JUnitDoclet begin method figureRemoved - // JUnitDoclet end method figureRemoved - } - - // JUnitDoclet begin javadoc_method figureRequestRemove() - /** - * Method testFigureRequestRemove is testing figureRequestRemove - * @see CH.ifa.draw.contrib.TextAreaFigure#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestRemove() - public void testFigureRequestRemove() throws Exception { - // JUnitDoclet begin method figureRequestRemove - // JUnitDoclet end method figureRequestRemove - } - - // JUnitDoclet begin javadoc_method figureRequestUpdate() - /** - * Method testFigureRequestUpdate is testing figureRequestUpdate - * @see CH.ifa.draw.contrib.TextAreaFigure#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestUpdate() - public void testFigureRequestUpdate() throws Exception { - // JUnitDoclet begin method figureRequestUpdate - // JUnitDoclet end method figureRequestUpdate - } - - // JUnitDoclet begin javadoc_method getTextColor() - /** - * Method testGetTextColor is testing getTextColor - * @see CH.ifa.draw.contrib.TextAreaFigure#getTextColor() - */ - // JUnitDoclet end javadoc_method getTextColor() - public void testGetTextColor() throws Exception { - // JUnitDoclet begin method getTextColor - // JUnitDoclet end method getTextColor - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.contrib.TextAreaFigure#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method setFontDirty() - /** - * Method testSetIsFontDirty is testing setFontDirty - * and isFontDirty together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.contrib.TextAreaFigure#setFontDirty(boolean) - * @see CH.ifa.draw.contrib.TextAreaFigure#isFontDirty() - */ - // JUnitDoclet end javadoc_method setFontDirty() - public void testSetIsFontDirty() throws Exception { - // JUnitDoclet begin method setFontDirty isFontDirty - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - textareafigure.setFontDirty(tests[i]); - assertEquals(tests[i], textareafigure.isFontDirty()); - } - // JUnitDoclet end method setFontDirty isFontDirty - } - - // JUnitDoclet begin javadoc_method getRepresentingFigure() - /** - * Method testGetRepresentingFigure is testing getRepresentingFigure - * @see CH.ifa.draw.contrib.TextAreaFigure#getRepresentingFigure() - */ - // JUnitDoclet end javadoc_method getRepresentingFigure() - public void testGetRepresentingFigure() throws Exception { - // JUnitDoclet begin method getRepresentingFigure - // JUnitDoclet end method getRepresentingFigure - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/TextAreaToolTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/TextAreaToolTest.java deleted file mode 100644 index 49972766f4d6dae7b4c79ab31378535142dd25ee..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/TextAreaToolTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.TextAreaTool; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase TextAreaToolTest is generated by - * JUnitDoclet to hold the tests for TextAreaTool. - * @see CH.ifa.draw.contrib.TextAreaTool - */ -// JUnitDoclet end javadoc_class -public class TextAreaToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private TextAreaTool textareatool; - // JUnitDoclet end class - - /** - * Constructor TextAreaToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public TextAreaToolTest(String name) { - // JUnitDoclet begin method TextAreaToolTest - super(name); - // JUnitDoclet end method TextAreaToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.TextAreaTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.TextAreaTool(getDrawingEditor(), new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - textareatool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - textareatool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.contrib.TextAreaTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.contrib.TextAreaTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.contrib.TextAreaTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.contrib.TextAreaTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.contrib.TextAreaTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method isActivated() - /** - * Method testIsActivated is testing isActivated - * @see CH.ifa.draw.contrib.TextAreaTool#isActivated() - */ - // JUnitDoclet end javadoc_method isActivated() - public void testIsActivated() throws Exception { - // JUnitDoclet begin method isActivated - // JUnitDoclet end method isActivated - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/TriangleFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/TriangleFigureTest.java deleted file mode 100644 index 0849cbe1688097e02d4f095c0c73f79f905b915b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/TriangleFigureTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -import CH.ifa.draw.contrib.TriangleFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase TriangleFigureTest is generated by - * JUnitDoclet to hold the tests for TriangleFigure. - * @see CH.ifa.draw.contrib.TriangleFigure - */ -// JUnitDoclet end javadoc_class -public class TriangleFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private TriangleFigure trianglefigure; - // JUnitDoclet end class - - /** - * Constructor TriangleFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public TriangleFigureTest(String name) { - // JUnitDoclet begin method TriangleFigureTest - super(name); - // JUnitDoclet end method TriangleFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.TriangleFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.contrib.TriangleFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - trianglefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - trianglefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.contrib.TriangleFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method rotate() - /** - * Method testRotate is testing rotate - * @see CH.ifa.draw.contrib.TriangleFigure#rotate(double) - */ - // JUnitDoclet end javadoc_method rotate() - public void testRotate() throws Exception { - // JUnitDoclet begin method rotate - // JUnitDoclet end method rotate - } - - // JUnitDoclet begin javadoc_method getPolygon() - /** - * Method testGetPolygon is testing getPolygon - * @see CH.ifa.draw.contrib.TriangleFigure#getPolygon() - */ - // JUnitDoclet end javadoc_method getPolygon() - public void testGetPolygon() throws Exception { - // JUnitDoclet begin method getPolygon - // JUnitDoclet end method getPolygon - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.contrib.TriangleFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method connectionInsets() - /** - * Method testConnectionInsets is testing connectionInsets - * @see CH.ifa.draw.contrib.TriangleFigure#connectionInsets() - */ - // JUnitDoclet end javadoc_method connectionInsets() - public void testConnectionInsets() throws Exception { - // JUnitDoclet begin method connectionInsets - // JUnitDoclet end method connectionInsets - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.contrib.TriangleFigure#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method center() - /** - * Method testCenter is testing center - * @see CH.ifa.draw.contrib.TriangleFigure#center() - */ - // JUnitDoclet end javadoc_method center() - public void testCenter() throws Exception { - // JUnitDoclet begin method center - // JUnitDoclet end method center - } - - // JUnitDoclet begin javadoc_method chop() - /** - * Method testChop is testing chop - * @see CH.ifa.draw.contrib.TriangleFigure#chop(java.awt.Point) - */ - // JUnitDoclet end javadoc_method chop() - public void testChop() throws Exception { - // JUnitDoclet begin method chop - // JUnitDoclet end method chop - } - - // JUnitDoclet begin javadoc_method clone() - /** - * Method testClone is testing clone - * @see CH.ifa.draw.contrib.TriangleFigure#clone() - */ - // JUnitDoclet end javadoc_method clone() - public void testClone() throws Exception { - // JUnitDoclet begin method clone - // JUnitDoclet end method clone - } - - // JUnitDoclet begin javadoc_method getRotationAngle() - /** - * Method testGetRotationAngle is testing getRotationAngle - * @see CH.ifa.draw.contrib.TriangleFigure#getRotationAngle() - */ - // JUnitDoclet end javadoc_method getRotationAngle() - public void testGetRotationAngle() throws Exception { - // JUnitDoclet begin method getRotationAngle - // JUnitDoclet end method getRotationAngle - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.contrib.TriangleFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.contrib.TriangleFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/contrib/WindowMenuTest.java b/JHotDraw/src/CH/ifa/draw/test/contrib/WindowMenuTest.java deleted file mode 100644 index f2b18d4731f2b272ec70dbc4421dccc4867b99a6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/contrib/WindowMenuTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.contrib; - -// JUnitDoclet begin import -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.contrib.MDIDesktopPane; -import CH.ifa.draw.contrib.WindowMenu; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase WindowMenuTest is generated by - * JUnitDoclet to hold the tests for WindowMenu. - * @see CH.ifa.draw.contrib.WindowMenu - */ -// JUnitDoclet end javadoc_class -public class WindowMenuTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private WindowMenu windowmenu; - // JUnitDoclet end class - - /** - * Constructor WindowMenuTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public WindowMenuTest(String name) { - // JUnitDoclet begin method WindowMenuTest - super(name); - // JUnitDoclet end method WindowMenuTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.contrib.WindowMenu createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - MDIDesktopPane desktop = (MDIDesktopPane) ((DrawApplication)getDrawingEditor()).getDesktop(); - return new CH.ifa.draw.contrib.WindowMenu("TestWindowMenu", desktop, getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - windowmenu = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - windowmenu = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/figures/AllTests.java deleted file mode 100644 index c29c385ad17084ce5986c9728e931ead0b458b77..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/AllTests.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.figures"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(ArrowTipTest.class)); - suite.addTest(new TestSuite(BorderDecoratorTest.class)); - suite.addTest(new TestSuite(BorderToolTest.class)); - suite.addTest(new TestSuite(ChopEllipseConnectorTest.class)); - suite.addTest(new TestSuite(ConnectedTextToolTest.class)); - suite.addTest(new TestSuite(ElbowConnectionTest.class)); - suite.addTest(new TestSuite(ElbowHandleTest.class)); - suite.addTest(new TestSuite(EllipseFigureTest.class)); - suite.addTest(new TestSuite(FigureAttributesTest.class)); - suite.addTest(new TestSuite(FontSizeHandleTest.class)); - suite.addTest(new TestSuite(GroupCommandTest.class)); - suite.addTest(new TestSuite(GroupFigureTest.class)); - suite.addTest(new TestSuite(ImageFigureTest.class)); - suite.addTest(new TestSuite(InsertImageCommandTest.class)); - suite.addTest(new TestSuite(LineConnectionTest.class)); - suite.addTest(new TestSuite(LineFigureTest.class)); - suite.addTest(new TestSuite(NullConnectorTest.class)); - suite.addTest(new TestSuite(NullFigureTest.class)); - suite.addTest(new TestSuite(NumberTextFigureTest.class)); - suite.addTest(new TestSuite(PolyLineConnectorTest.class)); - suite.addTest(new TestSuite(PolyLineFigureTest.class)); - suite.addTest(new TestSuite(PolyLineHandleTest.class)); - suite.addTest(new TestSuite(RectangleFigureTest.class)); - suite.addTest(new TestSuite(RoundRectangleFigureTest.class)); - suite.addTest(new TestSuite(ScribbleToolTest.class)); - suite.addTest(new TestSuite(ShortestDistanceConnectorTest.class)); - suite.addTest(new TestSuite(TextFigureTest.class)); - suite.addTest(new TestSuite(TextToolTest.class)); - suite.addTest(new TestSuite(UngroupCommandTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ArrowTipTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ArrowTipTest.java deleted file mode 100644 index 7d4097e6afc671e4bb9620650ed6418c74d52bdd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ArrowTipTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.ArrowTip; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - - -// JUnitDoclet begin javadoc_class -/** - * TestCase ArrowTipTest is generated by - * JUnitDoclet to hold the tests for ArrowTip. - * @see CH.ifa.draw.figures.ArrowTip - */ -// JUnitDoclet end javadoc_class -public class ArrowTipTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ArrowTip arrowtip; - // JUnitDoclet end class - - /** - * Constructor ArrowTipTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ArrowTipTest(String name) { - // JUnitDoclet begin method ArrowTipTest - super(name); - // JUnitDoclet end method ArrowTipTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ArrowTip createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ArrowTip(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - arrowtip = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - arrowtip = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method outline() - /** - * Method testOutline is testing outline - * @see CH.ifa.draw.figures.ArrowTip#outline(int, int, int, int) - */ - // JUnitDoclet end javadoc_method outline() - public void testOutline() throws Exception { - // JUnitDoclet begin method outline - // JUnitDoclet end method outline - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.ArrowTip#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.ArrowTip#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/BorderDecoratorTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/BorderDecoratorTest.java deleted file mode 100644 index fc41556591a55df44840f4270f18cc49d66add1d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/BorderDecoratorTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import java.awt.Point; - -import CH.ifa.draw.figures.BorderDecorator; - -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BorderDecoratorTest is generated by - * JUnitDoclet to hold the tests for BorderDecorator. - * @see CH.ifa.draw.figures.BorderDecorator - */ -// JUnitDoclet end javadoc_class -public class BorderDecoratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private BorderDecorator borderdecorator; - // JUnitDoclet end class - - /** - * Constructor BorderDecoratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BorderDecoratorTest(String name) { - // JUnitDoclet begin method BorderDecoratorTest - super(name); - // JUnitDoclet end method BorderDecoratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.BorderDecorator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.BorderDecorator(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - borderdecorator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - borderdecorator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setBorderOffset() - /** - * Method testSetGetBorderOffset is testing setBorderOffset - * and getBorderOffset together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.figures.BorderDecorator#setBorderOffset(java.awt.Point) - * @see CH.ifa.draw.figures.BorderDecorator#getBorderOffset() - */ - // JUnitDoclet end javadoc_method setBorderOffset() - public void testSetGetBorderOffset() throws Exception { - // JUnitDoclet begin method setBorderOffset getBorderOffset - Point[] tests = { new java.awt.Point()}; - - for (int i = 0; i < tests.length; i++) { - borderdecorator.setBorderOffset(tests[i]); - assertEquals(tests[i], borderdecorator.getBorderOffset()); - } - // JUnitDoclet end method setBorderOffset getBorderOffset - } - - // JUnitDoclet begin method setNullBorderOffset() - /** - * Test a null argument to setBorderOffset. Expect an Point(0, 0) to come back - * - * @see CH.ifa.draw.figures.BorderDecorator#setBorderOffset(java.awt.Point) - */ - public void setNullBorderOffset() throws Exception { - Point original = borderdecorator.getBorderOffset(); - - borderdecorator.setBorderOffset(null); - assertEquals(new Point(0, 0), borderdecorator.getBorderOffset()); - } - // JUnitDoclet end method - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.figures.BorderDecorator#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.BorderDecorator#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.figures.BorderDecorator#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method connectionInsets() - /** - * Method testConnectionInsets is testing connectionInsets - * @see CH.ifa.draw.figures.BorderDecorator#connectionInsets() - */ - // JUnitDoclet end javadoc_method connectionInsets() - public void testConnectionInsets() throws Exception { - // JUnitDoclet begin method connectionInsets - // JUnitDoclet end method connectionInsets - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/BorderToolTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/BorderToolTest.java deleted file mode 100644 index 65c4935eed43e2b38564494f9bf831064fde6962..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/BorderToolTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.BorderTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BorderToolTest is generated by - * JUnitDoclet to hold the tests for BorderTool. - * @see CH.ifa.draw.figures.BorderTool - */ -// JUnitDoclet end javadoc_class -public class BorderToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private BorderTool bordertool; - // JUnitDoclet end class - - /** - * Constructor BorderToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BorderToolTest(String name) { - // JUnitDoclet begin method BorderToolTest - super(name); - // JUnitDoclet end method BorderToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.BorderTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.BorderTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - bordertool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - bordertool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.figures.BorderTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method action() - /** - * Method testAction is testing action - * @see CH.ifa.draw.figures.BorderTool#action(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method action() - public void testAction() throws Exception { - // JUnitDoclet begin method action - // JUnitDoclet end method action - } - - // JUnitDoclet begin javadoc_method reverseAction() - /** - * Method testReverseAction is testing reverseAction - * @see CH.ifa.draw.figures.BorderTool#reverseAction(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method reverseAction() - public void testReverseAction() throws Exception { - // JUnitDoclet begin method reverseAction - // JUnitDoclet end method reverseAction - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ChopEllipseConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ChopEllipseConnectorTest.java deleted file mode 100644 index fe3190f352b7e13f3bf0466a7a0ee7f334046b33..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ChopEllipseConnectorTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.ChopEllipseConnector; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChopEllipseConnectorTest is generated by - * JUnitDoclet to hold the tests for ChopEllipseConnector. - * @see CH.ifa.draw.figures.ChopEllipseConnector - */ -// JUnitDoclet end javadoc_class -public class ChopEllipseConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChopEllipseConnector chopellipseconnector; - // JUnitDoclet end class - - /** - * Constructor ChopEllipseConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChopEllipseConnectorTest(String name) { - // JUnitDoclet begin method ChopEllipseConnectorTest - super(name); - // JUnitDoclet end method ChopEllipseConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ChopEllipseConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ChopEllipseConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - chopellipseconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - chopellipseconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ConnectedTextToolTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ConnectedTextToolTest.java deleted file mode 100644 index 0f327d70d451b707f9d0c95ce3bc8d2f434af407..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ConnectedTextToolTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.ConnectedTextTool; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ConnectedTextToolTest is generated by - * JUnitDoclet to hold the tests for ConnectedTextTool. - * @see CH.ifa.draw.figures.ConnectedTextTool - */ -// JUnitDoclet end javadoc_class -public class ConnectedTextToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ConnectedTextTool connectedtexttool; - // JUnitDoclet end class - - /** - * Constructor ConnectedTextToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ConnectedTextToolTest(String name) { - // JUnitDoclet begin method ConnectedTextToolTest - super(name); - // JUnitDoclet end method ConnectedTextToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ConnectedTextTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ConnectedTextTool(getDrawingEditor(), new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - connectedtexttool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - connectedtexttool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.figures.ConnectedTextTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method getConnectedFigure() - /** - * Method testGetConnectedFigure is testing getConnectedFigure - * @see CH.ifa.draw.figures.ConnectedTextTool#getConnectedFigure() - */ - // JUnitDoclet end javadoc_method getConnectedFigure() - public void testGetConnectedFigure() throws Exception { - // JUnitDoclet begin method getConnectedFigure - // JUnitDoclet end method getConnectedFigure - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.figures.ConnectedTextTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ElbowConnectionTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ElbowConnectionTest.java deleted file mode 100644 index 0199f0334ac581d9fe4086fe36639894af06c443..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ElbowConnectionTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.ElbowConnection; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ElbowConnectionTest is generated by - * JUnitDoclet to hold the tests for ElbowConnection. - * @see CH.ifa.draw.figures.ElbowConnection - */ -// JUnitDoclet end javadoc_class -public class ElbowConnectionTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ElbowConnection elbowconnection; - // JUnitDoclet end class - - /** - * Constructor ElbowConnectionTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ElbowConnectionTest(String name) { - // JUnitDoclet begin method ElbowConnectionTest - super(name); - // JUnitDoclet end method ElbowConnectionTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ElbowConnection createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ElbowConnection(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - elbowconnection = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - elbowconnection = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method updateConnection() - /** - * Method testUpdateConnection is testing updateConnection - * @see CH.ifa.draw.figures.ElbowConnection#updateConnection() - */ - // JUnitDoclet end javadoc_method updateConnection() - public void testUpdateConnection() throws Exception { - // JUnitDoclet begin method updateConnection - // JUnitDoclet end method updateConnection - } - - // JUnitDoclet begin javadoc_method layoutConnection() - /** - * Method testLayoutConnection is testing layoutConnection - * @see CH.ifa.draw.figures.ElbowConnection#layoutConnection() - */ - // JUnitDoclet end javadoc_method layoutConnection() - public void testLayoutConnection() throws Exception { - // JUnitDoclet begin method layoutConnection - // JUnitDoclet end method layoutConnection - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.ElbowConnection#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method connectedTextLocator() - /** - * Method testConnectedTextLocator is testing connectedTextLocator - * @see CH.ifa.draw.figures.ElbowConnection#connectedTextLocator(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method connectedTextLocator() - public void testConnectedTextLocator() throws Exception { - // JUnitDoclet begin method connectedTextLocator - // JUnitDoclet end method connectedTextLocator - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ElbowHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ElbowHandleTest.java deleted file mode 100644 index 546e99751ffe91381af40c52d10c514b7bbc07a1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ElbowHandleTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.ElbowHandle; -import CH.ifa.draw.figures.LineConnection; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ElbowHandleTest is generated by - * JUnitDoclet to hold the tests for ElbowHandle. - * @see CH.ifa.draw.figures.ElbowHandle - */ -// JUnitDoclet end javadoc_class -public class ElbowHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ElbowHandle elbowhandle; - // JUnitDoclet end class - - /** - * Constructor ElbowHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ElbowHandleTest(String name) { - // JUnitDoclet begin method ElbowHandleTest - super(name); - // JUnitDoclet end method ElbowHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ElbowHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - LineConnection lineConn = new LineConnection(); - //lineConn.connectStart(); - //lineConn.connectEnd(); - return new CH.ifa.draw.figures.ElbowHandle(lineConn, 1); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - elbowhandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - elbowhandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method invokeStart() - /** - * Method testInvokeStart is testing invokeStart - * @see CH.ifa.draw.figures.ElbowHandle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStart() - public void testInvokeStart() throws Exception { - // JUnitDoclet begin method invokeStart - // JUnitDoclet end method invokeStart - } - - // JUnitDoclet begin javadoc_method invokeStep() - /** - * Method testInvokeStep is testing invokeStep - * @see CH.ifa.draw.figures.ElbowHandle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStep() - public void testInvokeStep() throws Exception { - // JUnitDoclet begin method invokeStep - // JUnitDoclet end method invokeStep - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.figures.ElbowHandle#locate() - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.figures.ElbowHandle#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/EllipseFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/EllipseFigureTest.java deleted file mode 100644 index 3b29b28d42e4b3a2b11c79f6a3b9e3530c68a6fc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/EllipseFigureTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.EllipseFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase EllipseFigureTest is generated by - * JUnitDoclet to hold the tests for EllipseFigure. - * @see CH.ifa.draw.figures.EllipseFigure - */ -// JUnitDoclet end javadoc_class -public class EllipseFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private EllipseFigure ellipsefigure; - // JUnitDoclet end class - - /** - * Constructor EllipseFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public EllipseFigureTest(String name) { - // JUnitDoclet begin method EllipseFigureTest - super(name); - // JUnitDoclet end method EllipseFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.EllipseFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.EllipseFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - ellipsefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - ellipsefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.EllipseFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.EllipseFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.EllipseFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.figures.EllipseFigure#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method drawFrame() - /** - * Method testDrawFrame is testing drawFrame - * @see CH.ifa.draw.figures.EllipseFigure#drawFrame(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawFrame() - public void testDrawFrame() throws Exception { - // JUnitDoclet begin method drawFrame - // JUnitDoclet end method drawFrame - } - - // JUnitDoclet begin javadoc_method connectionInsets() - /** - * Method testConnectionInsets is testing connectionInsets - * @see CH.ifa.draw.figures.EllipseFigure#connectionInsets() - */ - // JUnitDoclet end javadoc_method connectionInsets() - public void testConnectionInsets() throws Exception { - // JUnitDoclet begin method connectionInsets - // JUnitDoclet end method connectionInsets - } - - // JUnitDoclet begin javadoc_method connectorAt() - /** - * Method testConnectorAt is testing connectorAt - * @see CH.ifa.draw.figures.EllipseFigure#connectorAt(int, int) - */ - // JUnitDoclet end javadoc_method connectorAt() - public void testConnectorAt() throws Exception { - // JUnitDoclet begin method connectorAt - // JUnitDoclet end method connectorAt - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.EllipseFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.EllipseFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/FigureAttributesTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/FigureAttributesTest.java deleted file mode 100644 index d785ce4658027e327fd5a78363a9a6912d1bdbe0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/FigureAttributesTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.FigureAttributes; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureAttributesTest is generated by - * JUnitDoclet to hold the tests for FigureAttributes. - * @see CH.ifa.draw.figures.FigureAttributes - */ -// JUnitDoclet end javadoc_class -public class FigureAttributesTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureAttributes figureattributes; - // JUnitDoclet end class - - /** - * Constructor FigureAttributesTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureAttributesTest(String name) { - // JUnitDoclet begin method FigureAttributesTest - super(name); - // JUnitDoclet end method FigureAttributesTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.FigureAttributes createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.FigureAttributes(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - figureattributes = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figureattributes = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method get() - /** - * Method testGet is testing get - * @see CH.ifa.draw.figures.FigureAttributes#get(CH.ifa.draw.framework.FigureAttributeConstant) - */ - // JUnitDoclet end javadoc_method get() - public void testGet() throws Exception { - // JUnitDoclet begin method get - // JUnitDoclet end method get - } - - // JUnitDoclet begin javadoc_method set() - /** - * Method testSet is testing set - * @see CH.ifa.draw.figures.FigureAttributes#set(CH.ifa.draw.framework.FigureAttributeConstant, java.lang.Object) - */ - // JUnitDoclet end javadoc_method set() - public void testSet() throws Exception { - // JUnitDoclet begin method set - // JUnitDoclet end method set - } - - // JUnitDoclet begin javadoc_method hasDefined() - /** - * Method testHasDefined is testing hasDefined - * @see CH.ifa.draw.figures.FigureAttributes#hasDefined(CH.ifa.draw.framework.FigureAttributeConstant) - */ - // JUnitDoclet end javadoc_method hasDefined() - public void testHasDefined() throws Exception { - // JUnitDoclet begin method hasDefined - // JUnitDoclet end method hasDefined - } - - // JUnitDoclet begin javadoc_method clone() - /** - * Method testClone is testing clone - * @see CH.ifa.draw.figures.FigureAttributes#clone() - */ - // JUnitDoclet end javadoc_method clone() - public void testClone() throws Exception { - // JUnitDoclet begin method clone - // JUnitDoclet end method clone - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.FigureAttributes#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.FigureAttributes#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method writeColor() - /** - * Method testWriteColor is testing writeColor - * @see CH.ifa.draw.figures.FigureAttributes#writeColor(CH.ifa.draw.util.StorableOutput, java.lang.String, java.awt.Color) - */ - // JUnitDoclet end javadoc_method writeColor() - public void testWriteColor() throws Exception { - // JUnitDoclet begin method writeColor - // JUnitDoclet end method writeColor - } - - // JUnitDoclet begin javadoc_method readColor() - /** - * Method testReadColor is testing readColor - * @see CH.ifa.draw.figures.FigureAttributes#readColor(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method readColor() - public void testReadColor() throws Exception { - // JUnitDoclet begin method readColor - // JUnitDoclet end method readColor - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/FiguresSuite.java b/JHotDraw/src/CH/ifa/draw/test/figures/FiguresSuite.java deleted file mode 100644 index 0af77d5467cb380415ada72d5329348d7576a563..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/FiguresSuite.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * @(#)FiguresSuite.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite FiguresSuite -*/ -// JUnitDoclet end javadoc_class -public class FiguresSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.figures"); - - suite.addTestSuite(CH.ifa.draw.test.figures.NullConnectorTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.NullFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.UngroupCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ShortestDistanceConnectorTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ScribbleToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.RectangleFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.RoundRectangleFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.PolyLineHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.PolyLineConnectorTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.NumberTextFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.LineFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.InsertImageCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ImageFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.GroupFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.GroupCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.FontSizeHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.EllipseFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ElbowHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ElbowConnectionTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.TextToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ConnectedTextToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ChopEllipseConnectorTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.BorderToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.BorderDecoratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.ArrowTipTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.FigureAttributesTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.TextFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.PolyLineFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.figures.LineConnectionTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/FontSizeHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/FontSizeHandleTest.java deleted file mode 100644 index 2419836acb881c499aef8b8bbf012293fd83d09d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/FontSizeHandleTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.FontSizeHandle; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.RelativeLocator; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FontSizeHandleTest is generated by - * JUnitDoclet to hold the tests for FontSizeHandle. - * @see CH.ifa.draw.figures.FontSizeHandle - */ -// JUnitDoclet end javadoc_class -public class FontSizeHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FontSizeHandle fontsizehandle; - // JUnitDoclet end class - - /** - * Constructor FontSizeHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FontSizeHandleTest(String name) { - // JUnitDoclet begin method FontSizeHandleTest - super(name); - // JUnitDoclet end method FontSizeHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.FontSizeHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.FontSizeHandle(new RectangleFigure(new Point(10, 10), new Point(100, 100)), new RelativeLocator()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - fontsizehandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - fontsizehandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method invokeStart() - /** - * Method testInvokeStart is testing invokeStart - * @see CH.ifa.draw.figures.FontSizeHandle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStart() - public void testInvokeStart() throws Exception { - // JUnitDoclet begin method invokeStart - // JUnitDoclet end method invokeStart - } - - // JUnitDoclet begin javadoc_method invokeStep() - /** - * Method testInvokeStep is testing invokeStep - * @see CH.ifa.draw.figures.FontSizeHandle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStep() - public void testInvokeStep() throws Exception { - // JUnitDoclet begin method invokeStep - // JUnitDoclet end method invokeStep - } - - // JUnitDoclet begin javadoc_method invokeEnd() - /** - * Method testInvokeEnd is testing invokeEnd - * @see CH.ifa.draw.figures.FontSizeHandle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeEnd() - public void testInvokeEnd() throws Exception { - // JUnitDoclet begin method invokeEnd - // JUnitDoclet end method invokeEnd - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.figures.FontSizeHandle#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/GroupCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/GroupCommandTest.java deleted file mode 100644 index 8557994c76253443b586ee6cc99c3ce6b272bb80..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/GroupCommandTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.GroupCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - - -// JUnitDoclet begin javadoc_class -/** - * TestCase GroupCommandTest is generated by - * JUnitDoclet to hold the tests for GroupCommand. - * @see CH.ifa.draw.figures.GroupCommand - */ -// JUnitDoclet end javadoc_class -public class GroupCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private GroupCommand groupcommand; - // JUnitDoclet end class - - /** - * Constructor GroupCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public GroupCommandTest(String name) { - // JUnitDoclet begin method GroupCommandTest - super(name); - // JUnitDoclet end method GroupCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.GroupCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.GroupCommand("TestGroup", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - groupcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - groupcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.figures.GroupCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.figures.GroupCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/GroupFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/GroupFigureTest.java deleted file mode 100644 index 3ba920d35a2328a82577009c98d8ed1ba5dab1e0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/GroupFigureTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.GroupFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - - -// JUnitDoclet begin javadoc_class -/** - * TestCase GroupFigureTest is generated by - * JUnitDoclet to hold the tests for GroupFigure. - * @see CH.ifa.draw.figures.GroupFigure - */ -// JUnitDoclet end javadoc_class -public class GroupFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private GroupFigure groupfigure; - // JUnitDoclet end class - - /** - * Constructor GroupFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public GroupFigureTest(String name) { - // JUnitDoclet begin method GroupFigureTest - super(name); - // JUnitDoclet end method GroupFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.GroupFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.GroupFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - groupfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - groupfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method canConnect() - /** - * Method testCanConnect is testing canConnect - * @see CH.ifa.draw.figures.GroupFigure#canConnect() - */ - // JUnitDoclet end javadoc_method canConnect() - public void testCanConnect() throws Exception { - // JUnitDoclet begin method canConnect - // JUnitDoclet end method canConnect - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.GroupFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.GroupFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method decompose() - /** - * Method testDecompose is testing decompose - * @see CH.ifa.draw.figures.GroupFigure#decompose() - */ - // JUnitDoclet end javadoc_method decompose() - public void testDecompose() throws Exception { - // JUnitDoclet begin method decompose - // JUnitDoclet end method decompose - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.GroupFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method setAttribute() - /** - * Method testSetAttribute is testing setAttribute - * @see CH.ifa.draw.figures.GroupFigure#setAttribute(java.lang.String, java.lang.Object) - */ - // JUnitDoclet end javadoc_method setAttribute() - public void testSetAttribute() throws Exception { - // JUnitDoclet begin method setAttribute - // JUnitDoclet end method setAttribute - } - - - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ImageFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ImageFigureTest.java deleted file mode 100644 index 3ed6a9954604502e67c4bea2aeba86edcf277624..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ImageFigureTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.ImageFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ImageFigureTest is generated by - * JUnitDoclet to hold the tests for ImageFigure. - * @see CH.ifa.draw.figures.ImageFigure - */ -// JUnitDoclet end javadoc_class -public class ImageFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ImageFigure imagefigure; - // JUnitDoclet end class - - /** - * Constructor ImageFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ImageFigureTest(String name) { - // JUnitDoclet begin method ImageFigureTest - super(name); - // JUnitDoclet end method ImageFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ImageFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ImageFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - imagefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - imagefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.ImageFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.ImageFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.ImageFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.figures.ImageFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method imageUpdate() - /** - * Method testImageUpdate is testing imageUpdate - * @see CH.ifa.draw.figures.ImageFigure#imageUpdate(java.awt.Image, int, int, int, int, int) - */ - // JUnitDoclet end javadoc_method imageUpdate() - public void testImageUpdate() throws Exception { - // JUnitDoclet begin method imageUpdate - // JUnitDoclet end method imageUpdate - } - - // JUnitDoclet begin javadoc_method release() - /** - * Method testRelease is testing release - * @see CH.ifa.draw.figures.ImageFigure#release() - */ - // JUnitDoclet end javadoc_method release() - public void testRelease() throws Exception { - // JUnitDoclet begin method release - // JUnitDoclet end method release - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.ImageFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.ImageFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/InsertImageCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/InsertImageCommandTest.java deleted file mode 100644 index 629fc0ffd6d3f9c332f17cc5fa7a875d51e8a1ea..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/InsertImageCommandTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.InsertImageCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase InsertImageCommandTest is generated by - * JUnitDoclet to hold the tests for InsertImageCommand. - * @see CH.ifa.draw.figures.InsertImageCommand - */ -// JUnitDoclet end javadoc_class -public class InsertImageCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private InsertImageCommand insertimagecommand; - private static String fgSampleImagesPath = "/CH/ifa/draw/samples/javadraw/sampleimages/DUKE.gif"; - // JUnitDoclet end class - - /** - * Constructor InsertImageCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public InsertImageCommandTest(String name) { - // JUnitDoclet begin method InsertImageCommandTest - super(name); - // JUnitDoclet end method InsertImageCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.InsertImageCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.InsertImageCommand("TestImage", fgSampleImagesPath, getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - insertimagecommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - insertimagecommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.figures.InsertImageCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/LineConnectionTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/LineConnectionTest.java deleted file mode 100644 index 89e888bc216626a8255e0e6b58de995f9b0d5b1e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/LineConnectionTest.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.LineConnection; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase LineConnectionTest is generated by - * JUnitDoclet to hold the tests for LineConnection. - * @see CH.ifa.draw.figures.LineConnection - */ -// JUnitDoclet end javadoc_class -public class LineConnectionTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private LineConnection lineconnection; - // JUnitDoclet end class - - /** - * Constructor LineConnectionTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public LineConnectionTest(String name) { - // JUnitDoclet begin method LineConnectionTest - super(name); - // JUnitDoclet end method LineConnectionTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.LineConnection createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.LineConnection(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - lineconnection = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - lineconnection = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method canConnect() - /** - * Method testCanConnect is testing canConnect - * @see CH.ifa.draw.figures.LineConnection#canConnect() - */ - // JUnitDoclet end javadoc_method canConnect() - public void testCanConnect() throws Exception { - // JUnitDoclet begin method canConnect - // JUnitDoclet end method canConnect - } - - // JUnitDoclet begin javadoc_method connectStart() - /** - * Method testConnectStart is testing connectStart - * @see CH.ifa.draw.figures.LineConnection#connectStart(CH.ifa.draw.framework.Connector) - */ - // JUnitDoclet end javadoc_method connectStart() - public void testConnectStart() throws Exception { - // JUnitDoclet begin method connectStart - // JUnitDoclet end method connectStart - } - - // JUnitDoclet begin javadoc_method connectEnd() - /** - * Method testConnectEnd is testing connectEnd - * @see CH.ifa.draw.figures.LineConnection#connectEnd(CH.ifa.draw.framework.Connector) - */ - // JUnitDoclet end javadoc_method connectEnd() - public void testConnectEnd() throws Exception { - // JUnitDoclet begin method connectEnd - // JUnitDoclet end method connectEnd - } - - // JUnitDoclet begin javadoc_method disconnectStart() - /** - * Method testDisconnectStart is testing disconnectStart - * @see CH.ifa.draw.figures.LineConnection#disconnectStart() - */ - // JUnitDoclet end javadoc_method disconnectStart() - public void testDisconnectStart() throws Exception { - // JUnitDoclet begin method disconnectStart - // JUnitDoclet end method disconnectStart - } - - // JUnitDoclet begin javadoc_method disconnectEnd() - /** - * Method testDisconnectEnd is testing disconnectEnd - * @see CH.ifa.draw.figures.LineConnection#disconnectEnd() - */ - // JUnitDoclet end javadoc_method disconnectEnd() - public void testDisconnectEnd() throws Exception { - // JUnitDoclet begin method disconnectEnd - // JUnitDoclet end method disconnectEnd - } - - // JUnitDoclet begin javadoc_method connectsSame() - /** - * Method testConnectsSame is testing connectsSame - * @see CH.ifa.draw.figures.LineConnection#connectsSame(CH.ifa.draw.framework.ConnectionFigure) - */ - // JUnitDoclet end javadoc_method connectsSame() - public void testConnectsSame() throws Exception { - // JUnitDoclet begin method connectsSame - // JUnitDoclet end method connectsSame - } - - // JUnitDoclet begin javadoc_method startFigure() - /** - * Method testStartFigure is testing startFigure - * @see CH.ifa.draw.figures.LineConnection#startFigure() - */ - // JUnitDoclet end javadoc_method startFigure() - public void testStartFigure() throws Exception { - // JUnitDoclet begin method startFigure - // JUnitDoclet end method startFigure - } - - // JUnitDoclet begin javadoc_method endFigure() - /** - * Method testEndFigure is testing endFigure - * @see CH.ifa.draw.figures.LineConnection#endFigure() - */ - // JUnitDoclet end javadoc_method endFigure() - public void testEndFigure() throws Exception { - // JUnitDoclet begin method endFigure - // JUnitDoclet end method endFigure - } - - // JUnitDoclet begin javadoc_method getStartConnector() - /** - * Method testGetStartConnector is testing getStartConnector - * @see CH.ifa.draw.figures.LineConnection#getStartConnector() - */ - // JUnitDoclet end javadoc_method getStartConnector() - public void testGetStartConnector() throws Exception { - // JUnitDoclet begin method getStartConnector - // JUnitDoclet end method getStartConnector - } - - // JUnitDoclet begin javadoc_method getEndConnector() - /** - * Method testGetEndConnector is testing getEndConnector - * @see CH.ifa.draw.figures.LineConnection#getEndConnector() - */ - // JUnitDoclet end javadoc_method getEndConnector() - public void testGetEndConnector() throws Exception { - // JUnitDoclet begin method getEndConnector - // JUnitDoclet end method getEndConnector - } - - // JUnitDoclet begin javadoc_method startPoint() - /** - * Method testStartPoint is testing startPoint - * @see CH.ifa.draw.figures.LineConnection#startPoint(int, int) - */ - // JUnitDoclet end javadoc_method startPoint() - public void testStartPoint() throws Exception { - // JUnitDoclet begin method startPoint - // JUnitDoclet end method startPoint - } - - // JUnitDoclet begin javadoc_method endPoint() - /** - * Method testEndPoint is testing endPoint - * @see CH.ifa.draw.figures.LineConnection#endPoint(int, int) - */ - // JUnitDoclet end javadoc_method endPoint() - public void testEndPoint() throws Exception { - // JUnitDoclet begin method endPoint - // JUnitDoclet end method endPoint - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.LineConnection#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method setPointAt() - /** - * Method testSetPointAt is testing setPointAt - * @see CH.ifa.draw.figures.LineConnection#setPointAt(java.awt.Point, int) - */ - // JUnitDoclet end javadoc_method setPointAt() - public void testSetPointAt() throws Exception { - // JUnitDoclet begin method setPointAt - // JUnitDoclet end method setPointAt - } - - // JUnitDoclet begin javadoc_method insertPointAt() - /** - * Method testInsertPointAt is testing insertPointAt - * @see CH.ifa.draw.figures.LineConnection#insertPointAt(java.awt.Point, int) - */ - // JUnitDoclet end javadoc_method insertPointAt() - public void testInsertPointAt() throws Exception { - // JUnitDoclet begin method insertPointAt - // JUnitDoclet end method insertPointAt - } - - // JUnitDoclet begin javadoc_method removePointAt() - /** - * Method testRemovePointAt is testing removePointAt - * @see CH.ifa.draw.figures.LineConnection#removePointAt(int) - */ - // JUnitDoclet end javadoc_method removePointAt() - public void testRemovePointAt() throws Exception { - // JUnitDoclet begin method removePointAt - // JUnitDoclet end method removePointAt - } - - // JUnitDoclet begin javadoc_method updateConnection() - /** - * Method testUpdateConnection is testing updateConnection - * @see CH.ifa.draw.figures.LineConnection#updateConnection() - */ - // JUnitDoclet end javadoc_method updateConnection() - public void testUpdateConnection() throws Exception { - // JUnitDoclet begin method updateConnection - // JUnitDoclet end method updateConnection - } - - // JUnitDoclet begin javadoc_method layoutConnection() - /** - * Method testLayoutConnection is testing layoutConnection - * @see CH.ifa.draw.figures.LineConnection#layoutConnection() - */ - // JUnitDoclet end javadoc_method layoutConnection() - public void testLayoutConnection() throws Exception { - // JUnitDoclet begin method layoutConnection - // JUnitDoclet end method layoutConnection - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.figures.LineConnection#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method figureRemoved() - /** - * Method testFigureRemoved is testing figureRemoved - * @see CH.ifa.draw.figures.LineConnection#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRemoved() - public void testFigureRemoved() throws Exception { - // JUnitDoclet begin method figureRemoved - // JUnitDoclet end method figureRemoved - } - - // JUnitDoclet begin javadoc_method figureRequestRemove() - /** - * Method testFigureRequestRemove is testing figureRequestRemove - * @see CH.ifa.draw.figures.LineConnection#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestRemove() - public void testFigureRequestRemove() throws Exception { - // JUnitDoclet begin method figureRequestRemove - // JUnitDoclet end method figureRequestRemove - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.figures.LineConnection#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method figureRequestUpdate() - /** - * Method testFigureRequestUpdate is testing figureRequestUpdate - * @see CH.ifa.draw.figures.LineConnection#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestUpdate() - public void testFigureRequestUpdate() throws Exception { - // JUnitDoclet begin method figureRequestUpdate - // JUnitDoclet end method figureRequestUpdate - } - - // JUnitDoclet begin javadoc_method release() - /** - * Method testRelease is testing release - * @see CH.ifa.draw.figures.LineConnection#release() - */ - // JUnitDoclet end javadoc_method release() - public void testRelease() throws Exception { - // JUnitDoclet begin method release - // JUnitDoclet end method release - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.LineConnection#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.LineConnection#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method visit() - /** - * Method testVisit is testing visit - * @see CH.ifa.draw.figures.LineConnection#visit(CH.ifa.draw.framework.FigureVisitor) - */ - // JUnitDoclet end javadoc_method visit() - public void testVisit() throws Exception { - // JUnitDoclet begin method visit - // JUnitDoclet end method visit - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/LineFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/LineFigureTest.java deleted file mode 100644 index d3197e846e2afb81314435c3d5453fe78947aec7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/LineFigureTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.LineFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase LineFigureTest is generated by - * JUnitDoclet to hold the tests for LineFigure. - * @see CH.ifa.draw.figures.LineFigure - */ -// JUnitDoclet end javadoc_class -public class LineFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private LineFigure linefigure; - // JUnitDoclet end class - - /** - * Constructor LineFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public LineFigureTest(String name) { - // JUnitDoclet begin method LineFigureTest - super(name); - // JUnitDoclet end method LineFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.LineFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.LineFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - linefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - linefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method startPoint() - /** - * Method testStartPoint is testing startPoint - * @see CH.ifa.draw.figures.LineFigure#startPoint() - */ - // JUnitDoclet end javadoc_method startPoint() - public void testStartPoint() throws Exception { - // JUnitDoclet begin method startPoint - // JUnitDoclet end method startPoint - } - - // JUnitDoclet begin javadoc_method endPoint() - /** - * Method testEndPoint is testing endPoint - * @see CH.ifa.draw.figures.LineFigure#endPoint() - */ - // JUnitDoclet end javadoc_method endPoint() - public void testEndPoint() throws Exception { - // JUnitDoclet begin method endPoint - // JUnitDoclet end method endPoint - } - - // JUnitDoclet begin javadoc_method setPoints() - /** - * Method testSetPoints is testing setPoints - * @see CH.ifa.draw.figures.LineFigure#setPoints(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method setPoints() - public void testSetPoints() throws Exception { - // JUnitDoclet begin method setPoints - // JUnitDoclet end method setPoints - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.LineFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/NullConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/NullConnectorTest.java deleted file mode 100644 index 59fe77d02d276cf9481cfb027392acbcc2bd1c4d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/NullConnectorTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import java.awt.Point; - -import junit.framework.TestCase; -// JUnitDoclet begin import -import CH.ifa.draw.figures.NullConnector; -import CH.ifa.draw.figures.RectangleFigure; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NullConnectorTest is generated by - * JUnitDoclet to hold the tests for NullConnector. - * @see CH.ifa.draw.figures.NullConnector - */ -// JUnitDoclet end javadoc_class -public class NullConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NullConnector nullconnector; - // JUnitDoclet end class - - /** - * Constructor NullConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NullConnectorTest(String name) { - // JUnitDoclet begin method NullConnectorTest - super(name); - // JUnitDoclet end method NullConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.NullConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.NullConnector(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nullconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nullconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/NullFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/NullFigureTest.java deleted file mode 100644 index 5a0a03ba2685db98934055981b1eb5439f3e121a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/NullFigureTest.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.NullFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NullFigureTest is generated by - * JUnitDoclet to hold the tests for NullFigure. - * @see CH.ifa.draw.figures.NullFigure - */ -// JUnitDoclet end javadoc_class -public class NullFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NullFigure nullfigure; - // JUnitDoclet end class - - /** - * Constructor NullFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NullFigureTest(String name) { - // JUnitDoclet begin method NullFigureTest - super(name); - // JUnitDoclet end method NullFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.NullFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.NullFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nullfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nullfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.NullFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.NullFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.figures.NullFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.NullFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.figures.NullFigure#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method figures() - /** - * Method testFigures is testing figures - * @see CH.ifa.draw.figures.NullFigure#figures() - */ - // JUnitDoclet end javadoc_method figures() - public void testFigures() throws Exception { - // JUnitDoclet begin method figures - // JUnitDoclet end method figures - } - - // JUnitDoclet begin javadoc_method findFigureInside() - /** - * Method testFindFigureInside is testing findFigureInside - * @see CH.ifa.draw.figures.NullFigure#findFigureInside(int, int) - */ - // JUnitDoclet end javadoc_method findFigureInside() - public void testFindFigureInside() throws Exception { - // JUnitDoclet begin method findFigureInside - // JUnitDoclet end method findFigureInside - } - - // JUnitDoclet begin javadoc_method clone() - /** - * Method testClone is testing clone - * @see CH.ifa.draw.figures.NullFigure#clone() - */ - // JUnitDoclet end javadoc_method clone() - public void testClone() throws Exception { - // JUnitDoclet begin method clone - // JUnitDoclet end method clone - } - - // JUnitDoclet begin javadoc_method includes() - /** - * Method testIncludes is testing includes - * @see CH.ifa.draw.figures.NullFigure#includes(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method includes() - public void testIncludes() throws Exception { - // JUnitDoclet begin method includes - // JUnitDoclet end method includes - } - - // JUnitDoclet begin javadoc_method decompose() - /** - * Method testDecompose is testing decompose - * @see CH.ifa.draw.figures.NullFigure#decompose() - */ - // JUnitDoclet end javadoc_method decompose() - public void testDecompose() throws Exception { - // JUnitDoclet begin method decompose - // JUnitDoclet end method decompose - } - - // JUnitDoclet begin javadoc_method release() - /** - * Method testRelease is testing release - * @see CH.ifa.draw.figures.NullFigure#release() - */ - // JUnitDoclet end javadoc_method release() - public void testRelease() throws Exception { - // JUnitDoclet begin method release - // JUnitDoclet end method release - } - - // JUnitDoclet begin javadoc_method invalidate() - /** - * Method testInvalidate is testing invalidate - * @see CH.ifa.draw.figures.NullFigure#invalidate() - */ - // JUnitDoclet end javadoc_method invalidate() - public void testInvalidate() throws Exception { - // JUnitDoclet begin method invalidate - // JUnitDoclet end method invalidate - } - - // JUnitDoclet begin javadoc_method getAttribute() - /** - * Method testGetAttribute is testing getAttribute - * @see CH.ifa.draw.figures.NullFigure#getAttribute(java.lang.String) - */ - // JUnitDoclet end javadoc_method getAttribute() - public void testGetAttribute() throws Exception { - // JUnitDoclet begin method getAttribute - // JUnitDoclet end method getAttribute - } - - // JUnitDoclet begin javadoc_method setAttribute() - /** - * Method testSetAttribute is testing setAttribute - * @see CH.ifa.draw.figures.NullFigure#setAttribute(java.lang.String, java.lang.Object) - */ - // JUnitDoclet end javadoc_method setAttribute() - public void testSetAttribute() throws Exception { - // JUnitDoclet begin method setAttribute - // JUnitDoclet end method setAttribute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/NumberTextFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/NumberTextFigureTest.java deleted file mode 100644 index cb7f0f2fa477e424db06eb55fb26899f98604db0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/NumberTextFigureTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.NumberTextFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NumberTextFigureTest is generated by - * JUnitDoclet to hold the tests for NumberTextFigure. - * @see CH.ifa.draw.figures.NumberTextFigure - */ -// JUnitDoclet end javadoc_class -public class NumberTextFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NumberTextFigure numbertextfigure; - // JUnitDoclet end class - - /** - * Constructor NumberTextFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NumberTextFigureTest(String name) { - // JUnitDoclet begin method NumberTextFigureTest - super(name); - // JUnitDoclet end method NumberTextFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.NumberTextFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.NumberTextFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - numbertextfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - numbertextfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method overlayColumns() - /** - * Method testOverlayColumns is testing overlayColumns - * @see CH.ifa.draw.figures.NumberTextFigure#overlayColumns() - */ - // JUnitDoclet end javadoc_method overlayColumns() - public void testOverlayColumns() throws Exception { - // JUnitDoclet begin method overlayColumns - // JUnitDoclet end method overlayColumns - } - - // JUnitDoclet begin javadoc_method setValue() - /** - * Method testSetGetValue is testing setValue - * and getValue together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.figures.NumberTextFigure#setValue(int) - * @see CH.ifa.draw.figures.NumberTextFigure#getValue() - */ - // JUnitDoclet end javadoc_method setValue() - public void testSetGetValue() throws Exception { - // JUnitDoclet begin method setValue getValue - int[] tests = { Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE }; - - for (int i = 0; i < tests.length; i++) { - numbertextfigure.setValue(tests[i]); - assertEquals(tests[i], numbertextfigure.getValue()); - } - // JUnitDoclet end method setValue getValue - } - - // JUnitDoclet begin javadoc_method getRepresentingFigure() - /** - * Method testGetRepresentingFigure is testing getRepresentingFigure - * @see CH.ifa.draw.figures.NumberTextFigure#getRepresentingFigure() - */ - // JUnitDoclet end javadoc_method getRepresentingFigure() - public void testGetRepresentingFigure() throws Exception { - // JUnitDoclet begin method getRepresentingFigure - // JUnitDoclet end method getRepresentingFigure - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineConnectorTest.java deleted file mode 100644 index b8f32cba672217df8898186387abfa9961b04388..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineConnectorTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.PolyLineConnector; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PolyLineConnectorTest is generated by - * JUnitDoclet to hold the tests for PolyLineConnector. - * @see CH.ifa.draw.figures.PolyLineConnector - */ -// JUnitDoclet end javadoc_class -public class PolyLineConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PolyLineConnector polylineconnector; - // JUnitDoclet end class - - /** - * Constructor PolyLineConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PolyLineConnectorTest(String name) { - // JUnitDoclet begin method PolyLineConnectorTest - super(name); - // JUnitDoclet end method PolyLineConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.PolyLineConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.PolyLineConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - polylineconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - polylineconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineFigureTest.java deleted file mode 100644 index afa791ab93cae859ea2aa3fd0fc6af685d4ff278..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineFigureTest.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import junit.framework.TestCase; -// JUnitDoclet begin import -import CH.ifa.draw.figures.ArrowTip; -import CH.ifa.draw.figures.PolyLineFigure; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PolyLineFigureTest is generated by - * JUnitDoclet to hold the tests for PolyLineFigure. - * @see CH.ifa.draw.figures.PolyLineFigure - */ -// JUnitDoclet end javadoc_class -public class PolyLineFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PolyLineFigure polylinefigure; - // JUnitDoclet end class - - /** - * Constructor PolyLineFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PolyLineFigureTest(String name) { - // JUnitDoclet begin method PolyLineFigureTest - super(name); - // JUnitDoclet end method PolyLineFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.PolyLineFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.PolyLineFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - polylinefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - polylinefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.PolyLineFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.figures.PolyLineFigure#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.PolyLineFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.PolyLineFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method addPoint() - /** - * Method testAddPoint is testing addPoint - * @see CH.ifa.draw.figures.PolyLineFigure#addPoint(int, int) - */ - // JUnitDoclet end javadoc_method addPoint() - public void testAddPoint() throws Exception { - // JUnitDoclet begin method addPoint - // JUnitDoclet end method addPoint - } - - // JUnitDoclet begin javadoc_method points() - /** - * Method testPoints is testing points - * @see CH.ifa.draw.figures.PolyLineFigure#points() - */ - // JUnitDoclet end javadoc_method points() - public void testPoints() throws Exception { - // JUnitDoclet begin method points - // JUnitDoclet end method points - } - - // JUnitDoclet begin javadoc_method pointCount() - /** - * Method testPointCount is testing pointCount - * @see CH.ifa.draw.figures.PolyLineFigure#pointCount() - */ - // JUnitDoclet end javadoc_method pointCount() - public void testPointCount() throws Exception { - // JUnitDoclet begin method pointCount - // JUnitDoclet end method pointCount - } - - // JUnitDoclet begin javadoc_method setPointAt() - /** - * Method testSetPointAt is testing setPointAt - * @see CH.ifa.draw.figures.PolyLineFigure#setPointAt(java.awt.Point, int) - */ - // JUnitDoclet end javadoc_method setPointAt() - public void testSetPointAt() throws Exception { - // JUnitDoclet begin method setPointAt - // JUnitDoclet end method setPointAt - } - - // JUnitDoclet begin javadoc_method insertPointAt() - /** - * Method testInsertPointAt is testing insertPointAt - * @see CH.ifa.draw.figures.PolyLineFigure#insertPointAt(java.awt.Point, int) - */ - // JUnitDoclet end javadoc_method insertPointAt() - public void testInsertPointAt() throws Exception { - // JUnitDoclet begin method insertPointAt - // JUnitDoclet end method insertPointAt - } - - // JUnitDoclet begin javadoc_method removePointAt() - /** - * Method testRemovePointAt is testing removePointAt - * @see CH.ifa.draw.figures.PolyLineFigure#removePointAt(int) - */ - // JUnitDoclet end javadoc_method removePointAt() - public void testRemovePointAt() throws Exception { - // JUnitDoclet begin method removePointAt - // JUnitDoclet end method removePointAt - } - - // JUnitDoclet begin javadoc_method splitSegment() - /** - * Method testSplitSegment is testing splitSegment - * @see CH.ifa.draw.figures.PolyLineFigure#splitSegment(int, int) - */ - // JUnitDoclet end javadoc_method splitSegment() - public void testSplitSegment() throws Exception { - // JUnitDoclet begin method splitSegment - // JUnitDoclet end method splitSegment - } - - // JUnitDoclet begin javadoc_method pointAt() - /** - * Method testPointAt is testing pointAt - * @see CH.ifa.draw.figures.PolyLineFigure#pointAt(int) - */ - // JUnitDoclet end javadoc_method pointAt() - public void testPointAt() throws Exception { - // JUnitDoclet begin method pointAt - // JUnitDoclet end method pointAt - } - - // JUnitDoclet begin javadoc_method joinSegments() - /** - * Method testJoinSegments is testing joinSegments - * @see CH.ifa.draw.figures.PolyLineFigure#joinSegments(int, int) - */ - // JUnitDoclet end javadoc_method joinSegments() - public void testJoinSegments() throws Exception { - // JUnitDoclet begin method joinSegments - // JUnitDoclet end method joinSegments - } - - // JUnitDoclet begin javadoc_method connectorAt() - /** - * Method testConnectorAt is testing connectorAt - * @see CH.ifa.draw.figures.PolyLineFigure#connectorAt(int, int) - */ - // JUnitDoclet end javadoc_method connectorAt() - public void testConnectorAt() throws Exception { - // JUnitDoclet begin method connectorAt - // JUnitDoclet end method connectorAt - } - - // JUnitDoclet begin javadoc_method setStartDecoration() - /** - * Method testSetGetStartDecoration is testing setStartDecoration - * and getStartDecoration together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.figures.PolyLineFigure#setStartDecoration(CH.ifa.draw.figures.LineDecoration) - * @see CH.ifa.draw.figures.PolyLineFigure#getStartDecoration() - */ - // JUnitDoclet end javadoc_method setStartDecoration() - public void testSetGetStartDecoration() throws Exception { - // JUnitDoclet begin method setStartDecoration getStartDecoration - CH.ifa.draw.figures.LineDecoration[] tests = { new ArrowTip(), null }; - - for (int i = 0; i < tests.length; i++) { - polylinefigure.setStartDecoration(tests[i]); - assertEquals(tests[i], polylinefigure.getStartDecoration()); - } - // JUnitDoclet end method setStartDecoration getStartDecoration - } - - // JUnitDoclet begin javadoc_method setEndDecoration() - /** - * Method testSetGetEndDecoration is testing setEndDecoration - * and getEndDecoration together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.figures.PolyLineFigure#setEndDecoration(CH.ifa.draw.figures.LineDecoration) - * @see CH.ifa.draw.figures.PolyLineFigure#getEndDecoration() - */ - // JUnitDoclet end javadoc_method setEndDecoration() - public void testSetGetEndDecoration() throws Exception { - // JUnitDoclet begin method setEndDecoration getEndDecoration - CH.ifa.draw.figures.LineDecoration[] tests = { new ArrowTip(), null }; - - for (int i = 0; i < tests.length; i++) { - polylinefigure.setEndDecoration(tests[i]); - assertEquals(tests[i], polylinefigure.getEndDecoration()); - } - // JUnitDoclet end method setEndDecoration getEndDecoration - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.figures.PolyLineFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.figures.PolyLineFigure#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method findSegment() - /** - * Method testFindSegment is testing findSegment - * @see CH.ifa.draw.figures.PolyLineFigure#findSegment(int, int) - */ - // JUnitDoclet end javadoc_method findSegment() - public void testFindSegment() throws Exception { - // JUnitDoclet begin method findSegment - // JUnitDoclet end method findSegment - } - - // JUnitDoclet begin javadoc_method getAttribute() - /** - * Method testGetAttribute is testing getAttribute - * @see CH.ifa.draw.figures.PolyLineFigure#getAttribute(java.lang.String) - */ - // JUnitDoclet end javadoc_method getAttribute() - public void testGetAttribute() throws Exception { - // JUnitDoclet begin method getAttribute - // JUnitDoclet end method getAttribute - } - - // JUnitDoclet begin javadoc_method setAttribute() - /** - * Method testSetAttribute is testing setAttribute - * @see CH.ifa.draw.figures.PolyLineFigure#setAttribute(java.lang.String, java.lang.Object) - */ - // JUnitDoclet end javadoc_method setAttribute() - public void testSetAttribute() throws Exception { - // JUnitDoclet begin method setAttribute - // JUnitDoclet end method setAttribute - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.PolyLineFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.PolyLineFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method locator() - /** - * Method testLocator is testing locator - * @see CH.ifa.draw.figures.PolyLineFigure#locator(int) - */ - // JUnitDoclet end javadoc_method locator() - public void testLocator() throws Exception { - // JUnitDoclet begin method locator - // JUnitDoclet end method locator - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineHandleTest.java deleted file mode 100644 index 07654beaa005a95594b2c6a91ab04e4967e82957..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/PolyLineHandleTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.PolyLineFigure; -import CH.ifa.draw.figures.PolyLineHandle; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PolyLineHandleTest is generated by - * JUnitDoclet to hold the tests for PolyLineHandle. - * @see CH.ifa.draw.figures.PolyLineHandle - */ -// JUnitDoclet end javadoc_class -public class PolyLineHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PolyLineHandle polylinehandle; - // JUnitDoclet end class - - /** - * Constructor PolyLineHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PolyLineHandleTest(String name) { - // JUnitDoclet begin method PolyLineHandleTest - super(name); - // JUnitDoclet end method PolyLineHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.PolyLineHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - PolyLineFigure figure = new PolyLineFigure(20, 20); - figure.addPoint(30, 30); - figure.addPoint(40, 40); - return new CH.ifa.draw.figures.PolyLineHandle(figure, PolyLineFigure.locator(2), 2); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - polylinehandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - polylinehandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method invokeStart() - /** - * Method testInvokeStart is testing invokeStart - * @see CH.ifa.draw.figures.PolyLineHandle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStart() - public void testInvokeStart() throws Exception { - // JUnitDoclet begin method invokeStart - // JUnitDoclet end method invokeStart - } - - // JUnitDoclet begin javadoc_method invokeStep() - /** - * Method testInvokeStep is testing invokeStep - * @see CH.ifa.draw.figures.PolyLineHandle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStep() - public void testInvokeStep() throws Exception { - // JUnitDoclet begin method invokeStep - // JUnitDoclet end method invokeStep - } - - // JUnitDoclet begin javadoc_method invokeEnd() - /** - * Method testInvokeEnd is testing invokeEnd - * @see CH.ifa.draw.figures.PolyLineHandle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeEnd() - public void testInvokeEnd() throws Exception { - // JUnitDoclet begin method invokeEnd - // JUnitDoclet end method invokeEnd - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/RectangleFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/RectangleFigureTest.java deleted file mode 100644 index 539f7940d9e87384de12792f82e6440df4992f61..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/RectangleFigureTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.RectangleFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase RectangleFigureTest is generated by - * JUnitDoclet to hold the tests for RectangleFigure. - * @see CH.ifa.draw.figures.RectangleFigure - */ -// JUnitDoclet end javadoc_class -public class RectangleFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private RectangleFigure rectanglefigure; - // JUnitDoclet end class - - /** - * Constructor RectangleFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public RectangleFigureTest(String name) { - // JUnitDoclet begin method RectangleFigureTest - super(name); - // JUnitDoclet end method RectangleFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.RectangleFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.RectangleFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - rectanglefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - rectanglefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.RectangleFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.RectangleFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.RectangleFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.figures.RectangleFigure#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method drawFrame() - /** - * Method testDrawFrame is testing drawFrame - * @see CH.ifa.draw.figures.RectangleFigure#drawFrame(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawFrame() - public void testDrawFrame() throws Exception { - // JUnitDoclet begin method drawFrame - // JUnitDoclet end method drawFrame - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.RectangleFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.RectangleFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/RoundRectangleFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/RoundRectangleFigureTest.java deleted file mode 100644 index 0aca998f5ed939f219fd92e1a3ca0e0aa7594918..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/RoundRectangleFigureTest.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.RoundRectangleFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase RoundRectangleFigureTest is generated by - * JUnitDoclet to hold the tests for RoundRectangleFigure. - * @see CH.ifa.draw.figures.RoundRectangleFigure - */ -// JUnitDoclet end javadoc_class -public class RoundRectangleFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private RoundRectangleFigure roundrectanglefigure; - // JUnitDoclet end class - - /** - * Constructor RoundRectangleFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public RoundRectangleFigureTest(String name) { - // JUnitDoclet begin method RoundRectangleFigureTest - super(name); - // JUnitDoclet end method RoundRectangleFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.RoundRectangleFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.RoundRectangleFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - roundrectanglefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - roundrectanglefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.RoundRectangleFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method setArc() - /** - * Method testSetArc is testing setArc - * @see CH.ifa.draw.figures.RoundRectangleFigure#setArc(int, int) - */ - // JUnitDoclet end javadoc_method setArc() - public void testSetArc() throws Exception { - // JUnitDoclet begin method setArc - // JUnitDoclet end method setArc - } - - // JUnitDoclet begin javadoc_method getArc() - /** - * Method testGetArc is testing getArc - * @see CH.ifa.draw.figures.RoundRectangleFigure#getArc() - */ - // JUnitDoclet end javadoc_method getArc() - public void testGetArc() throws Exception { - // JUnitDoclet begin method getArc - // JUnitDoclet end method getArc - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.RoundRectangleFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.RoundRectangleFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.figures.RoundRectangleFigure#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method drawFrame() - /** - * Method testDrawFrame is testing drawFrame - * @see CH.ifa.draw.figures.RoundRectangleFigure#drawFrame(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawFrame() - public void testDrawFrame() throws Exception { - // JUnitDoclet begin method drawFrame - // JUnitDoclet end method drawFrame - } - - // JUnitDoclet begin javadoc_method connectionInsets() - /** - * Method testConnectionInsets is testing connectionInsets - * @see CH.ifa.draw.figures.RoundRectangleFigure#connectionInsets() - */ - // JUnitDoclet end javadoc_method connectionInsets() - public void testConnectionInsets() throws Exception { - // JUnitDoclet begin method connectionInsets - // JUnitDoclet end method connectionInsets - } - - // JUnitDoclet begin javadoc_method connectorAt() - /** - * Method testConnectorAt is testing connectorAt - * @see CH.ifa.draw.figures.RoundRectangleFigure#connectorAt(int, int) - */ - // JUnitDoclet end javadoc_method connectorAt() - public void testConnectorAt() throws Exception { - // JUnitDoclet begin method connectorAt - // JUnitDoclet end method connectorAt - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.RoundRectangleFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.RoundRectangleFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ScribbleToolTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ScribbleToolTest.java deleted file mode 100644 index 9fb958f3f95ed3c537b543da2f2475dd7c70f987..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ScribbleToolTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.ScribbleTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ScribbleToolTest is generated by - * JUnitDoclet to hold the tests for ScribbleTool. - * @see CH.ifa.draw.figures.ScribbleTool - */ -// JUnitDoclet end javadoc_class -public class ScribbleToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ScribbleTool scribbletool; - // JUnitDoclet end class - - /** - * Constructor ScribbleToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ScribbleToolTest(String name) { - // JUnitDoclet begin method ScribbleToolTest - super(name); - // JUnitDoclet end method ScribbleToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ScribbleTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ScribbleTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - scribbletool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - scribbletool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.figures.ScribbleTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.figures.ScribbleTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.figures.ScribbleTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.figures.ScribbleTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.figures.ScribbleTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/ShortestDistanceConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/ShortestDistanceConnectorTest.java deleted file mode 100644 index 423d518823c759b107ca6f7e4ba438922858cc5a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/ShortestDistanceConnectorTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import CH.ifa.draw.figures.ShortestDistanceConnector; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ShortestDistanceConnectorTest is generated by - * JUnitDoclet to hold the tests for ShortestDistanceConnector. - * @see CH.ifa.draw.figures.ShortestDistanceConnector - */ -// JUnitDoclet end javadoc_class -public class ShortestDistanceConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ShortestDistanceConnector shortestdistanceconnector; - // JUnitDoclet end class - - /** - * Constructor ShortestDistanceConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ShortestDistanceConnectorTest(String name) { - // JUnitDoclet begin method ShortestDistanceConnectorTest - super(name); - // JUnitDoclet end method ShortestDistanceConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.ShortestDistanceConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.ShortestDistanceConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - shortestdistanceconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - shortestdistanceconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method findStart() - /** - * Method testFindStart is testing findStart - * @see CH.ifa.draw.figures.ShortestDistanceConnector#findStart(CH.ifa.draw.framework.ConnectionFigure) - */ - // JUnitDoclet end javadoc_method findStart() - public void testFindStart() throws Exception { - // JUnitDoclet begin method findStart - // JUnitDoclet end method findStart - } - - // JUnitDoclet begin javadoc_method findEnd() - /** - * Method testFindEnd is testing findEnd - * @see CH.ifa.draw.figures.ShortestDistanceConnector#findEnd(CH.ifa.draw.framework.ConnectionFigure) - */ - // JUnitDoclet end javadoc_method findEnd() - public void testFindEnd() throws Exception { - // JUnitDoclet begin method findEnd - // JUnitDoclet end method findEnd - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/TextFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/TextFigureTest.java deleted file mode 100644 index c9e36517df4b639cc99a0473a0ab639985cedace..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/TextFigureTest.java +++ /dev/null @@ -1,473 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import java.awt.Font; - -import CH.ifa.draw.figures.TextFigure; - -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase TextFigureTest is generated by - * JUnitDoclet to hold the tests for TextFigure. - * @see CH.ifa.draw.figures.TextFigure - */ -// JUnitDoclet end javadoc_class -public class TextFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private TextFigure textfigure; - // JUnitDoclet end class - - /** - * Constructor TextFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public TextFigureTest(String name) { - // JUnitDoclet begin method TextFigureTest - super(name); - // JUnitDoclet end method TextFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.TextFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.TextFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - textfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - textfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method moveBy() - /** - * Method testMoveBy is testing moveBy - * @see CH.ifa.draw.figures.TextFigure#moveBy(int, int) - */ - // JUnitDoclet end javadoc_method moveBy() - public void testMoveBy() throws Exception { - // JUnitDoclet begin method moveBy - // JUnitDoclet end method moveBy - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.figures.TextFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.figures.TextFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method textDisplayBox() - /** - * Method testTextDisplayBox is testing textDisplayBox - * @see CH.ifa.draw.figures.TextFigure#textDisplayBox() - */ - // JUnitDoclet end javadoc_method textDisplayBox() - public void testTextDisplayBox() throws Exception { - // JUnitDoclet begin method textDisplayBox - // JUnitDoclet end method textDisplayBox - } - - // JUnitDoclet begin javadoc_method readOnly() - /** - * Method testReadOnly is testing readOnly - * @see CH.ifa.draw.figures.TextFigure#readOnly() - */ - // JUnitDoclet end javadoc_method readOnly() - public void testReadOnly() throws Exception { - // JUnitDoclet begin method readOnly - // JUnitDoclet end method readOnly - } - - // JUnitDoclet begin javadoc_method setReadOnly() - /** - * Method testSetReadOnly is testing setReadOnly - * @see CH.ifa.draw.figures.TextFigure#setReadOnly(boolean) - */ - // JUnitDoclet end javadoc_method setReadOnly() - public void testSetReadOnly() throws Exception { - // JUnitDoclet begin method setReadOnly - // JUnitDoclet end method setReadOnly - } - - // JUnitDoclet begin javadoc_method getRepresentingFigure() - /** - * Method testGetRepresentingFigure is testing getRepresentingFigure - * @see CH.ifa.draw.figures.TextFigure#getRepresentingFigure() - */ - // JUnitDoclet end javadoc_method getRepresentingFigure() - public void testGetRepresentingFigure() throws Exception { - // JUnitDoclet begin method getRepresentingFigure - // JUnitDoclet end method getRepresentingFigure - } - - // JUnitDoclet begin javadoc_method setFont() - /** - * Method testSetGetFont is testing setFont - * and getFont together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.figures.TextFigure#setFont(java.awt.Font) - * @see CH.ifa.draw.figures.TextFigure#getFont() - */ - // JUnitDoclet end javadoc_method setFont() - public void testSetGetFont() throws Exception { - // JUnitDoclet begin method setFont getFont - java.awt.Font[] tests = { new Font("Helvetica", Font.PLAIN, 12), null }; - - for (int i = 0; i < tests.length; i++) { - textfigure.setFont(tests[i]); - assertEquals(tests[i], textfigure.getFont()); - } - // JUnitDoclet end method setFont getFont - } - - // JUnitDoclet begin javadoc_method changed() - /** - * Method testChanged is testing changed - * @see CH.ifa.draw.figures.TextFigure#changed() - */ - // JUnitDoclet end javadoc_method changed() - public void testChanged() throws Exception { - // JUnitDoclet begin method changed - // JUnitDoclet end method changed - } - - // JUnitDoclet begin javadoc_method getAttribute() - /** - * Method testGetAttribute is testing getAttribute - * @see CH.ifa.draw.figures.TextFigure#getAttribute(java.lang.String) - */ - // JUnitDoclet end javadoc_method getAttribute() - public void testGetAttribute() throws Exception { - // JUnitDoclet begin method getAttribute - // JUnitDoclet end method getAttribute - } - - // JUnitDoclet begin javadoc_method setAttribute() - /** - * Method testSetAttribute is testing setAttribute - * @see CH.ifa.draw.figures.TextFigure#setAttribute(java.lang.String, java.lang.Object) - */ - // JUnitDoclet end javadoc_method setAttribute() - public void testSetAttribute() throws Exception { - // JUnitDoclet begin method setAttribute - // JUnitDoclet end method setAttribute - } - - // JUnitDoclet begin javadoc_method setText() - /** - * Method testSetGetText is testing setText - * and getText together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.figures.TextFigure#setText(java.lang.String) - * @see CH.ifa.draw.figures.TextFigure#getText() - */ - // JUnitDoclet end javadoc_method setText() - public void testSetGetText() throws Exception { - // JUnitDoclet begin method setText getText - java.lang.String[] tests = { "", " ", "a", "A", "�", "�", "0123456789", "012345678901234567890", "\n", null }; - - for (int i = 0; i < tests.length; i++) { - textfigure.setText(tests[i]); - assertEquals(tests[i], textfigure.getText()); - } - // JUnitDoclet end method setText getText - } - - // JUnitDoclet begin javadoc_method acceptsTyping() - /** - * Method testAcceptsTyping is testing acceptsTyping - * @see CH.ifa.draw.figures.TextFigure#acceptsTyping() - */ - // JUnitDoclet end javadoc_method acceptsTyping() - public void testAcceptsTyping() throws Exception { - // JUnitDoclet begin method acceptsTyping - // JUnitDoclet end method acceptsTyping - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.figures.TextFigure#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method drawFrame() - /** - * Method testDrawFrame is testing drawFrame - * @see CH.ifa.draw.figures.TextFigure#drawFrame(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawFrame() - public void testDrawFrame() throws Exception { - // JUnitDoclet begin method drawFrame - // JUnitDoclet end method drawFrame - } - - // JUnitDoclet begin javadoc_method overlayColumns() - /** - * Method testOverlayColumns is testing overlayColumns - * @see CH.ifa.draw.figures.TextFigure#overlayColumns() - */ - // JUnitDoclet end javadoc_method overlayColumns() - public void testOverlayColumns() throws Exception { - // JUnitDoclet begin method overlayColumns - // JUnitDoclet end method overlayColumns - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.figures.TextFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.figures.TextFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.figures.TextFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method connect() - /** - * Method testConnect is testing connect - * @see CH.ifa.draw.figures.TextFigure#connect(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method connect() - public void testConnect() throws Exception { - // JUnitDoclet begin method connect - // JUnitDoclet end method connect - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.figures.TextFigure#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method figureRemoved() - /** - * Method testFigureRemoved is testing figureRemoved - * @see CH.ifa.draw.figures.TextFigure#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRemoved() - public void testFigureRemoved() throws Exception { - // JUnitDoclet begin method figureRemoved - // JUnitDoclet end method figureRemoved - } - - // JUnitDoclet begin javadoc_method figureRequestRemove() - /** - * Method testFigureRequestRemove is testing figureRequestRemove - * @see CH.ifa.draw.figures.TextFigure#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestRemove() - public void testFigureRequestRemove() throws Exception { - // JUnitDoclet begin method figureRequestRemove - // JUnitDoclet end method figureRequestRemove - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.figures.TextFigure#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method figureRequestUpdate() - /** - * Method testFigureRequestUpdate is testing figureRequestUpdate - * @see CH.ifa.draw.figures.TextFigure#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestUpdate() - public void testFigureRequestUpdate() throws Exception { - // JUnitDoclet begin method figureRequestUpdate - // JUnitDoclet end method figureRequestUpdate - } - - // JUnitDoclet begin javadoc_method release() - /** - * Method testRelease is testing release - * @see CH.ifa.draw.figures.TextFigure#release() - */ - // JUnitDoclet end javadoc_method release() - public void testRelease() throws Exception { - // JUnitDoclet begin method release - // JUnitDoclet end method release - } - - // JUnitDoclet begin javadoc_method disconnect() - /** - * Method testDisconnect is testing disconnect - * @see CH.ifa.draw.figures.TextFigure#disconnect(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method disconnect() - public void testDisconnect() throws Exception { - // JUnitDoclet begin method disconnect - // JUnitDoclet end method disconnect - } - - // JUnitDoclet begin javadoc_method getTextHolder() - /** - * Method testGetTextHolder is testing getTextHolder - * @see CH.ifa.draw.figures.TextFigure#getTextHolder() - */ - // JUnitDoclet end javadoc_method getTextHolder() - public void testGetTextHolder() throws Exception { - // JUnitDoclet begin method getTextHolder - // JUnitDoclet end method getTextHolder - } - - // JUnitDoclet begin javadoc_method createCurrentFont() - /** - * Method testCreateCurrentFont is testing createCurrentFont - * @see CH.ifa.draw.figures.TextFigure#createCurrentFont() - */ - // JUnitDoclet end javadoc_method createCurrentFont() - public void testCreateCurrentFont() throws Exception { - // JUnitDoclet begin method createCurrentFont - // JUnitDoclet end method createCurrentFont - } - - // JUnitDoclet begin javadoc_method setCurrentFontName() - /** - * Method testSetCurrentFontName is testing setCurrentFontName - * @see CH.ifa.draw.figures.TextFigure#setCurrentFontName(java.lang.String) - */ - // JUnitDoclet end javadoc_method setCurrentFontName() - public void testSetCurrentFontName() throws Exception { - // JUnitDoclet begin method setCurrentFontName - // JUnitDoclet end method setCurrentFontName - } - - // JUnitDoclet begin javadoc_method setCurrentFontSize() - /** - * Method testSetCurrentFontSize is testing setCurrentFontSize - * @see CH.ifa.draw.figures.TextFigure#setCurrentFontSize(int) - */ - // JUnitDoclet end javadoc_method setCurrentFontSize() - public void testSetCurrentFontSize() throws Exception { - // JUnitDoclet begin method setCurrentFontSize - // JUnitDoclet end method setCurrentFontSize - } - - // JUnitDoclet begin javadoc_method setCurrentFontStyle() - /** - * Method testSetCurrentFontStyle is testing setCurrentFontStyle - * @see CH.ifa.draw.figures.TextFigure#setCurrentFontStyle(int) - */ - // JUnitDoclet end javadoc_method setCurrentFontStyle() - public void testSetCurrentFontStyle() throws Exception { - // JUnitDoclet begin method setCurrentFontStyle - // JUnitDoclet end method setCurrentFontStyle - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/TextToolTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/TextToolTest.java deleted file mode 100644 index 5759f8d8262fe49a1a36ba8d5c3cb2fe1fcbc9e4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/TextToolTest.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.figures.TextTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - - -// JUnitDoclet begin javadoc_class -/** - * TestCase TextToolTest is generated by - * JUnitDoclet to hold the tests for TextTool. - * @see CH.ifa.draw.figures.TextTool - */ -// JUnitDoclet end javadoc_class -public class TextToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private TextTool texttool; - // JUnitDoclet end class - - /** - * Constructor TextToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public TextToolTest(String name) { - // JUnitDoclet begin method TextToolTest - super(name); - // JUnitDoclet end method TextToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.TextTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.TextTool(getDrawingEditor(), new RectangleFigure(new Point(10,10), new Point(100,100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - texttool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - texttool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.figures.TextTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.figures.TextTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.figures.TextTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.figures.TextTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.figures.TextTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method isActive() - /** - * Method testIsActive is testing isActive - * @see CH.ifa.draw.figures.TextTool#isActive() - */ - // JUnitDoclet end javadoc_method isActive() - public void testIsActive() throws Exception { - // JUnitDoclet begin method isActive - // JUnitDoclet end method isActive - } - - - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/figures/UngroupCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/figures/UngroupCommandTest.java deleted file mode 100644 index 5b3e76a693c0f06126fee65ca8ff8f2f2549f87f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/figures/UngroupCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.figures; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.UngroupCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UngroupCommandTest is generated by - * JUnitDoclet to hold the tests for UngroupCommand. - * @see CH.ifa.draw.figures.UngroupCommand - */ -// JUnitDoclet end javadoc_class -public class UngroupCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UngroupCommand ungroupcommand; - // JUnitDoclet end class - - /** - * Constructor UngroupCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UngroupCommandTest(String name) { - // JUnitDoclet begin method UngroupCommandTest - super(name); - // JUnitDoclet end method UngroupCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.figures.UngroupCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.figures.UngroupCommand("UngroupTest", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - ungroupcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - ungroupcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.figures.UngroupCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.figures.UngroupCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/framework/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/framework/AllTests.java deleted file mode 100644 index cb7c9e7e7673e104e313e2e28bc221eb966c1783..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/framework/AllTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.framework; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.framework"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(DrawingChangeEventTest.class)); - suite.addTest(new TestSuite(FigureAttributeConstantTest.class)); - suite.addTest(new TestSuite(FigureChangeEventTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/framework/DrawingChangeEventTest.java b/JHotDraw/src/CH/ifa/draw/test/framework/DrawingChangeEventTest.java deleted file mode 100644 index 3744458c2202af6ae1bccaa4e8a4da81c3bd65e1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/framework/DrawingChangeEventTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.framework; - -import java.awt.Rectangle; - -import junit.framework.TestCase; -// JUnitDoclet begin import -import CH.ifa.draw.framework.DrawingChangeEvent; -import CH.ifa.draw.standard.StandardDrawing; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase DrawingChangeEventTest is generated by - * JUnitDoclet to hold the tests for DrawingChangeEvent. - * @see CH.ifa.draw.framework.DrawingChangeEvent - */ -// JUnitDoclet end javadoc_class -public class DrawingChangeEventTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DrawingChangeEvent drawingchangeevent; - // JUnitDoclet end class - - /** - * Constructor DrawingChangeEventTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DrawingChangeEventTest(String name) { - // JUnitDoclet begin method DrawingChangeEventTest - super(name); - // JUnitDoclet end method DrawingChangeEventTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.framework.DrawingChangeEvent createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.framework.DrawingChangeEvent(new StandardDrawing(), new Rectangle(10, 10, 100, 100)); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - drawingchangeevent = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - drawingchangeevent = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getDrawing() - /** - * Method testGetDrawing is testing getDrawing - * @see CH.ifa.draw.framework.DrawingChangeEvent#getDrawing() - */ - // JUnitDoclet end javadoc_method getDrawing() - public void testGetDrawing() throws Exception { - // JUnitDoclet begin method getDrawing - // JUnitDoclet end method getDrawing - } - - // JUnitDoclet begin javadoc_method getInvalidatedRectangle() - /** - * Method testGetInvalidatedRectangle is testing getInvalidatedRectangle - * @see CH.ifa.draw.framework.DrawingChangeEvent#getInvalidatedRectangle() - */ - // JUnitDoclet end javadoc_method getInvalidatedRectangle() - public void testGetInvalidatedRectangle() throws Exception { - // JUnitDoclet begin method getInvalidatedRectangle - // JUnitDoclet end method getInvalidatedRectangle - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/framework/FigureAttributeConstantTest.java b/JHotDraw/src/CH/ifa/draw/test/framework/FigureAttributeConstantTest.java deleted file mode 100644 index c33b3f04a5b451570e190142749adb3dea5a7531..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/framework/FigureAttributeConstantTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.framework; - -import CH.ifa.draw.framework.FigureAttributeConstant; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureAttributeConstantTest is generated by - * JUnitDoclet to hold the tests for FigureAttributeConstant. - * @see CH.ifa.draw.framework.FigureAttributeConstant - */ -// JUnitDoclet end javadoc_class -public class FigureAttributeConstantTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureAttributeConstant figureattributeconstant; - // JUnitDoclet end class - - /** - * Constructor FigureAttributeConstantTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureAttributeConstantTest(String name) { - // JUnitDoclet begin method FigureAttributeConstantTest - super(name); - // JUnitDoclet end method FigureAttributeConstantTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.framework.FigureAttributeConstant createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.framework.FigureAttributeConstant("test_property"); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - figureattributeconstant = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figureattributeconstant = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getName() - /** - * Method testGetName is testing getName - * @see CH.ifa.draw.framework.FigureAttributeConstant#getName() - */ - // JUnitDoclet end javadoc_method getName() - public void testGetName() throws Exception { - // JUnitDoclet begin method getName - // JUnitDoclet end method getName - } - - // JUnitDoclet begin javadoc_method getID() - /** - * Method testGetID is testing getID - * @see CH.ifa.draw.framework.FigureAttributeConstant#getID() - */ - // JUnitDoclet end javadoc_method getID() - public void testGetID() throws Exception { - // JUnitDoclet begin method getID - // JUnitDoclet end method getID - } - - // JUnitDoclet begin javadoc_method equals() - /** - * Method testEquals is testing equals - * @see CH.ifa.draw.framework.FigureAttributeConstant#equals(java.lang.Object) - */ - // JUnitDoclet end javadoc_method equals() - public void testEquals() throws Exception { - // JUnitDoclet begin method equals - // JUnitDoclet end method equals - } - - // JUnitDoclet begin javadoc_method hashCode() - /** - * Method testHashCode is testing hashCode - * @see CH.ifa.draw.framework.FigureAttributeConstant#hashCode() - */ - // JUnitDoclet end javadoc_method hashCode() - public void testHashCode() throws Exception { - // JUnitDoclet begin method hashCode - // JUnitDoclet end method hashCode - } - - // JUnitDoclet begin javadoc_method getConstant() - /** - * Method testGetConstant is testing getConstant - * @see CH.ifa.draw.framework.FigureAttributeConstant#getConstant(java.lang.String) - */ - // JUnitDoclet end javadoc_method getConstant() - public void testGetConstant() throws Exception { - // JUnitDoclet begin method getConstant - // JUnitDoclet end method getConstant - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/framework/FigureChangeEventTest.java b/JHotDraw/src/CH/ifa/draw/test/framework/FigureChangeEventTest.java deleted file mode 100644 index 559f6eef31630bbba6a551d5d92c7c52971f47a9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/framework/FigureChangeEventTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.framework; - -import java.awt.Point; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.FigureChangeEvent; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureChangeEventTest is generated by - * JUnitDoclet to hold the tests for FigureChangeEvent. - * @see CH.ifa.draw.framework.FigureChangeEvent - */ -// JUnitDoclet end javadoc_class -public class FigureChangeEventTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureChangeEvent figurechangeevent; - // JUnitDoclet end class - - /** - * Constructor FigureChangeEventTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureChangeEventTest(String name) { - // JUnitDoclet begin method FigureChangeEventTest - super(name); - // JUnitDoclet end method FigureChangeEventTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.framework.FigureChangeEvent createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.framework.FigureChangeEvent(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - figurechangeevent = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figurechangeevent = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getFigure() - /** - * Method testGetFigure is testing getFigure - * @see CH.ifa.draw.framework.FigureChangeEvent#getFigure() - */ - // JUnitDoclet end javadoc_method getFigure() - public void testGetFigure() throws Exception { - // JUnitDoclet begin method getFigure - // JUnitDoclet end method getFigure - } - - // JUnitDoclet begin javadoc_method getInvalidatedRectangle() - /** - * Method testGetInvalidatedRectangle is testing getInvalidatedRectangle - * @see CH.ifa.draw.framework.FigureChangeEvent#getInvalidatedRectangle() - */ - // JUnitDoclet end javadoc_method getInvalidatedRectangle() - public void testGetInvalidatedRectangle() throws Exception { - // JUnitDoclet begin method getInvalidatedRectangle - // JUnitDoclet end method getInvalidatedRectangle - } - - // JUnitDoclet begin javadoc_method getNestedEvent() - /** - * Method testGetNestedEvent is testing getNestedEvent - * @see CH.ifa.draw.framework.FigureChangeEvent#getNestedEvent() - */ - // JUnitDoclet end javadoc_method getNestedEvent() - public void testGetNestedEvent() throws Exception { - // JUnitDoclet begin method getNestedEvent - // JUnitDoclet end method getNestedEvent - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/framework/FrameworkSuite.java b/JHotDraw/src/CH/ifa/draw/test/framework/FrameworkSuite.java deleted file mode 100644 index ebb358a6dc7cc0cd4a93f5da6575d27bd3371a8c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/framework/FrameworkSuite.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @(#)FrameworkSuite - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.framework; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite FrameworkSuite -*/ -// JUnitDoclet end javadoc_class -public class FrameworkSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.framework"); - - suite.addTestSuite(CH.ifa.draw.test.framework.FigureAttributeConstantTest.class); - suite.addTestSuite(CH.ifa.draw.test.framework.FigureChangeEventTest.class); - suite.addTestSuite(CH.ifa.draw.test.framework.DrawingChangeEventTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AllTests.java deleted file mode 100644 index ae41248884b288e63969c369d9125e2a97593454..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AllTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.samples.javadraw"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(AnimationDecoratorTest.class)); - suite.addTest(new TestSuite(AnimatorTest.class)); - suite.addTest(new TestSuite(BouncingDrawingTest.class)); - suite.addTest(new TestSuite(JavaDrawAppTest.class)); - suite.addTest(new TestSuite(JavaDrawAppletTest.class)); - suite.addTest(new TestSuite(JavaDrawViewerTest.class)); - suite.addTest(new TestSuite(MySelectionToolTest.class)); - suite.addTest(new TestSuite(PatternPainterTest.class)); - suite.addTest(new TestSuite(URLToolTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AnimationDecoratorTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AnimationDecoratorTest.java deleted file mode 100644 index 2f20865a447aa42da3d9b2149f59ef82acc173f3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AnimationDecoratorTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import CH.ifa.draw.samples.javadraw.AnimationDecorator; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase AnimationDecoratorTest is generated by - * JUnitDoclet to hold the tests for AnimationDecorator. - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator - */ -// JUnitDoclet end javadoc_class -public class AnimationDecoratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private AnimationDecorator animationdecorator; - // JUnitDoclet end class - - /** - * Constructor AnimationDecoratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public AnimationDecoratorTest(String name) { - // JUnitDoclet begin method AnimationDecoratorTest - super(name); - // JUnitDoclet end method AnimationDecoratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.AnimationDecorator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.javadraw.AnimationDecorator(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - animationdecorator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - animationdecorator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method velocity() - /** - * Method testVelocity is testing velocity - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#velocity(int, int) - */ - // JUnitDoclet end javadoc_method velocity() - public void testVelocity() throws Exception { - // JUnitDoclet begin method velocity - // JUnitDoclet end method velocity - } - - // JUnitDoclet begin javadoc_method animationStep() - /** - * Method testAnimationStep is testing animationStep - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#animationStep() - */ - // JUnitDoclet end javadoc_method animationStep() - public void testAnimationStep() throws Exception { - // JUnitDoclet begin method animationStep - // JUnitDoclet end method animationStep - } - - // JUnitDoclet begin javadoc_method basicMoveBy() - /** - * Method testBasicMoveBy is testing basicMoveBy - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#basicMoveBy(int, int) - */ - // JUnitDoclet end javadoc_method basicMoveBy() - public void testBasicMoveBy() throws Exception { - // JUnitDoclet begin method basicMoveBy - // JUnitDoclet end method basicMoveBy - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.samples.javadraw.AnimationDecorator#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AnimatorTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AnimatorTest.java deleted file mode 100644 index 35451d0ae0a27dbff06073c47e280a857bf2d23d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/AnimatorTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.Drawing; -import CH.ifa.draw.samples.javadraw.Animator; -import CH.ifa.draw.samples.javadraw.BouncingDrawing; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.Animatable; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase AnimatorTest is generated by - * JUnitDoclet to hold the tests for Animator. - * @see CH.ifa.draw.samples.javadraw.Animator - */ -// JUnitDoclet end javadoc_class -public class AnimatorTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Animator animator; - // JUnitDoclet end class - - /** - * Constructor AnimatorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public AnimatorTest(String name) { - // JUnitDoclet begin method AnimatorTest - super(name); - // JUnitDoclet end method AnimatorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.Animator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Drawing drawing = new BouncingDrawing(); - Animatable animatable = (Animatable)drawing.add(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - return new CH.ifa.draw.samples.javadraw.Animator(animatable, getDrawingEditor().view()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - animator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - animator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method start() - /** - * Method testStart is testing start - * @see CH.ifa.draw.samples.javadraw.Animator#start() - */ - // JUnitDoclet end javadoc_method start() - public void testStart() throws Exception { - // JUnitDoclet begin method start - // JUnitDoclet end method start - } - - // JUnitDoclet begin javadoc_method end() - /** - * Method testEnd is testing end - * @see CH.ifa.draw.samples.javadraw.Animator#end() - */ - // JUnitDoclet end javadoc_method end() - public void testEnd() throws Exception { - // JUnitDoclet begin method end - // JUnitDoclet end method end - } - - // JUnitDoclet begin javadoc_method run() - /** - * Method testRun is testing run - * @see CH.ifa.draw.samples.javadraw.Animator#run() - */ - // JUnitDoclet end javadoc_method run() - public void testRun() throws Exception { - // JUnitDoclet begin method run - // JUnitDoclet end method run - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/BouncingDrawingTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/BouncingDrawingTest.java deleted file mode 100644 index 5b381e74d76ac82fec6ee2249e043bf676ac05b1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/BouncingDrawingTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import CH.ifa.draw.samples.javadraw.BouncingDrawing; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BouncingDrawingTest is generated by - * JUnitDoclet to hold the tests for BouncingDrawing. - * @see CH.ifa.draw.samples.javadraw.BouncingDrawing - */ -// JUnitDoclet end javadoc_class -public class BouncingDrawingTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private BouncingDrawing bouncingdrawing; - // JUnitDoclet end class - - /** - * Constructor BouncingDrawingTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BouncingDrawingTest(String name) { - // JUnitDoclet begin method BouncingDrawingTest - super(name); - // JUnitDoclet end method BouncingDrawingTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.BouncingDrawing createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.javadraw.BouncingDrawing(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - bouncingdrawing = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - bouncingdrawing = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.samples.javadraw.BouncingDrawing#add(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.samples.javadraw.BouncingDrawing#remove(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method replace() - /** - * Method testReplace is testing replace - * @see CH.ifa.draw.samples.javadraw.BouncingDrawing#replace(CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method replace() - public void testReplace() throws Exception { - // JUnitDoclet begin method replace - // JUnitDoclet end method replace - } - - // JUnitDoclet begin javadoc_method animationStep() - /** - * Method testAnimationStep is testing animationStep - * @see CH.ifa.draw.samples.javadraw.BouncingDrawing#animationStep() - */ - // JUnitDoclet end javadoc_method animationStep() - public void testAnimationStep() throws Exception { - // JUnitDoclet begin method animationStep - // JUnitDoclet end method animationStep - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawAppTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawAppTest.java deleted file mode 100644 index a7f5cced7d2728da53067afc0a21d7c1a16c9eb6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawAppTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -// JUnitDoclet begin import -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase JavaDrawAppTest is generated by - * JUnitDoclet to hold the tests for JavaDrawApp. - * @see CH.ifa.draw.samples.javadraw.JavaDrawApp - */ -// JUnitDoclet end javadoc_class -public class JavaDrawAppTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DrawApplication myDrawApplication; - // JUnitDoclet end class - - /** - * Constructor JavaDrawAppTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public JavaDrawAppTest(String name) { - // JUnitDoclet begin method JavaDrawAppTest - super(name); - // JUnitDoclet end method JavaDrawAppTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public DrawApplication createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return getDrawingEditor(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - myDrawApplication = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - myDrawApplication = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method destroy() - /** - * Method testDestroy is testing destroy - * @see CH.ifa.draw.samples.javadraw.JavaDrawApp#destroy() - */ - // JUnitDoclet end javadoc_method destroy() - public void testDestroy() throws Exception { - // JUnitDoclet begin method destroy - // JUnitDoclet end method destroy - } - - // JUnitDoclet begin javadoc_method startAnimation() - /** - * Method testStartAnimation is testing startAnimation - * @see CH.ifa.draw.samples.javadraw.JavaDrawApp#startAnimation() - */ - // JUnitDoclet end javadoc_method startAnimation() - public void testStartAnimation() throws Exception { - // JUnitDoclet begin method startAnimation - // JUnitDoclet end method startAnimation - } - - // JUnitDoclet begin javadoc_method endAnimation() - /** - * Method testEndAnimation is testing endAnimation - * @see CH.ifa.draw.samples.javadraw.JavaDrawApp#endAnimation() - */ - // JUnitDoclet end javadoc_method endAnimation() - public void testEndAnimation() throws Exception { - // JUnitDoclet begin method endAnimation - // JUnitDoclet end method endAnimation - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.samples.javadraw.JavaDrawApp#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawAppletTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawAppletTest.java deleted file mode 100644 index 96c3ee0809883fbb07d74c46aad2ae3a231fe6ea..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawAppletTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import CH.ifa.draw.samples.javadraw.JavaDrawApplet; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase JavaDrawAppletTest is generated by - * JUnitDoclet to hold the tests for JavaDrawApplet. - * @see CH.ifa.draw.samples.javadraw.JavaDrawApplet - */ -// JUnitDoclet end javadoc_class -public class JavaDrawAppletTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private JavaDrawApplet javadrawapplet; - // JUnitDoclet end class - - /** - * Constructor JavaDrawAppletTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public JavaDrawAppletTest(String name) { - // JUnitDoclet begin method JavaDrawAppletTest - super(name); - // JUnitDoclet end method JavaDrawAppletTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.JavaDrawApplet createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.javadraw.JavaDrawApplet(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - javadrawapplet = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - javadrawapplet = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method destroy() - /** - * Method testDestroy is testing destroy - * @see CH.ifa.draw.samples.javadraw.JavaDrawApplet#destroy() - */ - // JUnitDoclet end javadoc_method destroy() - public void testDestroy() throws Exception { - // JUnitDoclet begin method destroy - // JUnitDoclet end method destroy - } - - // JUnitDoclet begin javadoc_method startAnimation() - /** - * Method testStartAnimation is testing startAnimation - * @see CH.ifa.draw.samples.javadraw.JavaDrawApplet#startAnimation() - */ - // JUnitDoclet end javadoc_method startAnimation() - public void testStartAnimation() throws Exception { - // JUnitDoclet begin method startAnimation - // JUnitDoclet end method startAnimation - } - - // JUnitDoclet begin javadoc_method endAnimation() - /** - * Method testEndAnimation is testing endAnimation - * @see CH.ifa.draw.samples.javadraw.JavaDrawApplet#endAnimation() - */ - // JUnitDoclet end javadoc_method endAnimation() - public void testEndAnimation() throws Exception { - // JUnitDoclet begin method endAnimation - // JUnitDoclet end method endAnimation - } - - // JUnitDoclet begin javadoc_method toggleAnimation() - /** - * Method testToggleAnimation is testing toggleAnimation - * @see CH.ifa.draw.samples.javadraw.JavaDrawApplet#toggleAnimation() - */ - // JUnitDoclet end javadoc_method toggleAnimation() - public void testToggleAnimation() throws Exception { - // JUnitDoclet begin method toggleAnimation - // JUnitDoclet end method toggleAnimation - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawViewerTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawViewerTest.java deleted file mode 100644 index 16a9486fa8b83a84f19dde3effbcde2812daf77b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavaDrawViewerTest.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import CH.ifa.draw.samples.javadraw.JavaDrawViewer; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase JavaDrawViewerTest is generated by - * JUnitDoclet to hold the tests for JavaDrawViewer. - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer - */ -// JUnitDoclet end javadoc_class -public class JavaDrawViewerTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private JavaDrawViewer javadrawviewer; - // JUnitDoclet end class - - /** - * Constructor JavaDrawViewerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public JavaDrawViewerTest(String name) { - // JUnitDoclet begin method JavaDrawViewerTest - super(name); - // JUnitDoclet end method JavaDrawViewerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.JavaDrawViewer createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.javadraw.JavaDrawViewer(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - javadrawviewer = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - javadrawviewer = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method init() - /** - * Method testInit is testing init - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#init() - */ - // JUnitDoclet end javadoc_method init() - public void testInit() throws Exception { - // JUnitDoclet begin method init - // JUnitDoclet end method init - } - - // JUnitDoclet begin javadoc_method addViewChangeListener() - /** - * Method testAddViewChangeListener is testing addViewChangeListener - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#addViewChangeListener(CH.ifa.draw.framework.ViewChangeListener) - */ - // JUnitDoclet end javadoc_method addViewChangeListener() - public void testAddViewChangeListener() throws Exception { - // JUnitDoclet begin method addViewChangeListener - // JUnitDoclet end method addViewChangeListener - } - - // JUnitDoclet begin javadoc_method removeViewChangeListener() - /** - * Method testRemoveViewChangeListener is testing removeViewChangeListener - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#removeViewChangeListener(CH.ifa.draw.framework.ViewChangeListener) - */ - // JUnitDoclet end javadoc_method removeViewChangeListener() - public void testRemoveViewChangeListener() throws Exception { - // JUnitDoclet begin method removeViewChangeListener - // JUnitDoclet end method removeViewChangeListener - } - - // JUnitDoclet begin javadoc_method view() - /** - * Method testView is testing view - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#view() - */ - // JUnitDoclet end javadoc_method view() - public void testView() throws Exception { - // JUnitDoclet begin method view - // JUnitDoclet end method view - } - - // JUnitDoclet begin javadoc_method views() - /** - * Method testViews is testing views - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#views() - */ - // JUnitDoclet end javadoc_method views() - public void testViews() throws Exception { - // JUnitDoclet begin method views - // JUnitDoclet end method views - } - - // JUnitDoclet begin javadoc_method drawing() - /** - * Method testDrawing is testing drawing - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#drawing() - */ - // JUnitDoclet end javadoc_method drawing() - public void testDrawing() throws Exception { - // JUnitDoclet begin method drawing - // JUnitDoclet end method drawing - } - - // JUnitDoclet begin javadoc_method tool() - /** - * Method testTool is testing tool - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#tool() - */ - // JUnitDoclet end javadoc_method tool() - public void testTool() throws Exception { - // JUnitDoclet begin method tool - // JUnitDoclet end method tool - } - - // JUnitDoclet begin javadoc_method setTool() - /** - * Method testSetTool is testing setTool - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#setTool(CH.ifa.draw.framework.Tool) - */ - // JUnitDoclet end javadoc_method setTool() - public void testSetTool() throws Exception { - // JUnitDoclet begin method setTool - // JUnitDoclet end method setTool - } - - // JUnitDoclet begin javadoc_method toolDone() - /** - * Method testToolDone is testing toolDone - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#toolDone() - */ - // JUnitDoclet end javadoc_method toolDone() - public void testToolDone() throws Exception { - // JUnitDoclet begin method toolDone - // JUnitDoclet end method toolDone - } - - // JUnitDoclet begin javadoc_method figureSelectionChanged() - /** - * Method testFigureSelectionChanged is testing figureSelectionChanged - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#figureSelectionChanged(CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method figureSelectionChanged() - public void testFigureSelectionChanged() throws Exception { - // JUnitDoclet begin method figureSelectionChanged - // JUnitDoclet end method figureSelectionChanged - } - - // JUnitDoclet begin javadoc_method getUndoManager() - /** - * Method testGetUndoManager is testing getUndoManager - * @see CH.ifa.draw.samples.javadraw.JavaDrawViewer#getUndoManager() - */ - // JUnitDoclet end javadoc_method getUndoManager() - public void testGetUndoManager() throws Exception { - // JUnitDoclet begin method getUndoManager - // JUnitDoclet end method getUndoManager - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavadrawSuite.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavadrawSuite.java deleted file mode 100644 index ec659fb1929f81fdf3a56f12fed853a8131c5406..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/JavadrawSuite.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite JavadrawSuite -*/ -// JUnitDoclet end javadoc_class -public class JavadrawSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.samples.javadraw"); - - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.URLToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.PatternPainterTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.MySelectionToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.JavaDrawViewerTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.JavaDrawAppletTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.JavaDrawAppTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.BouncingDrawingTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.AnimatorTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.javadraw.AnimationDecoratorTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/MySelectionToolTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/MySelectionToolTest.java deleted file mode 100644 index 40c38320d9ba6d7138b8da69c6b9ea506a74adbe..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/MySelectionToolTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -// JUnitDoclet begin import -import CH.ifa.draw.samples.javadraw.MySelectionTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MySelectionToolTest is generated by - * JUnitDoclet to hold the tests for MySelectionTool. - * @see CH.ifa.draw.samples.javadraw.MySelectionTool - */ -// JUnitDoclet end javadoc_class -public class MySelectionToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MySelectionTool myselectiontool; - // JUnitDoclet end class - - /** - * Constructor MySelectionToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MySelectionToolTest(String name) { - // JUnitDoclet begin method MySelectionToolTest - super(name); - // JUnitDoclet end method MySelectionToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.MySelectionTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.javadraw.MySelectionTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - myselectiontool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - myselectiontool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.samples.javadraw.MySelectionTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/PatternPainterTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/PatternPainterTest.java deleted file mode 100644 index 28627d609b58e0619774793d0f7e8db107002def..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/PatternPainterTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -import java.awt.Image; - -// JUnitDoclet begin import -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.samples.javadraw.PatternPainter; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.Iconkit; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PatternPainterTest is generated by - * JUnitDoclet to hold the tests for PatternPainter. - * @see CH.ifa.draw.samples.javadraw.PatternPainter - */ -// JUnitDoclet end javadoc_class -public class PatternPainterTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PatternPainter patternpainter; - // JUnitDoclet end class - - /** - * Constructor PatternPainterTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PatternPainterTest(String name) { - // JUnitDoclet begin method PatternPainterTest - super(name); - // JUnitDoclet end method PatternPainterTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.PatternPainter createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Image img = Iconkit.instance().loadImage(DrawApplication.IMAGES + "SEL1.gif", true); - return new CH.ifa.draw.samples.javadraw.PatternPainter(img); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - patternpainter = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - patternpainter = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.samples.javadraw.PatternPainter#draw(java.awt.Graphics, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/URLToolTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/URLToolTest.java deleted file mode 100644 index 78e612ed2d1779369de8f3b4ab940993316b10b7..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/javadraw/URLToolTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.javadraw; - -// JUnitDoclet begin import -import CH.ifa.draw.samples.javadraw.URLTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase URLToolTest is generated by - * JUnitDoclet to hold the tests for URLTool. - * @see CH.ifa.draw.samples.javadraw.URLTool - */ -// JUnitDoclet end javadoc_class -public class URLToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private URLTool urltool; - // JUnitDoclet end class - - /** - * Constructor URLToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public URLToolTest(String name) { - // JUnitDoclet begin method URLToolTest - super(name); - // JUnitDoclet end method URLToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.javadraw.URLTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.javadraw.URLTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - urltool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - urltool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.samples.javadraw.URLTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.samples.javadraw.URLTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.samples.javadraw.URLTool#deactivate(CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/samples/minimap/AllTests.java deleted file mode 100644 index 4ab07796c131ef146794b31795f3609a9210ce9d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/AllTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.minimap; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.samples.minimap"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(MiniMapApplicationTest.class)); - suite.addTest(new TestSuite(MiniMapDesktopTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MiniMapApplicationTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MiniMapApplicationTest.java deleted file mode 100644 index 6105d916bb3ff30f817b47ecedef40d695b183d1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MiniMapApplicationTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.minimap; - -import CH.ifa.draw.samples.minimap.MiniMapApplication; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MiniMapApplicationTest is generated by - * JUnitDoclet to hold the tests for MiniMapApplication. - * @see CH.ifa.draw.samples.minimap.MiniMapApplication - */ -// JUnitDoclet end javadoc_class -public class MiniMapApplicationTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MiniMapApplication minimapapplication; - // JUnitDoclet end class - - /** - * Constructor MiniMapApplicationTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MiniMapApplicationTest(String name) { - // JUnitDoclet begin method MiniMapApplicationTest - super(name); - // JUnitDoclet end method MiniMapApplicationTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.minimap.MiniMapApplication createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.minimap.MiniMapApplication(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - minimapapplication = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - minimapapplication = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.samples.minimap.MiniMapApplication#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MiniMapDesktopTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MiniMapDesktopTest.java deleted file mode 100644 index ddb2f8f9f4e41fc05b0137d24092775163ad3227..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MiniMapDesktopTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.minimap; - -import CH.ifa.draw.samples.minimap.MiniMapDesktop; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MiniMapDesktopTest is generated by - * JUnitDoclet to hold the tests for MiniMapDesktop. - * @see CH.ifa.draw.samples.minimap.MiniMapDesktop - */ -// JUnitDoclet end javadoc_class -public class MiniMapDesktopTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MiniMapDesktop minimapdesktop; - // JUnitDoclet end class - - /** - * Constructor MiniMapDesktopTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MiniMapDesktopTest(String name) { - // JUnitDoclet begin method MiniMapDesktopTest - super(name); - // JUnitDoclet end method MiniMapDesktopTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.minimap.MiniMapDesktop createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.minimap.MiniMapDesktop(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - minimapdesktop = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - minimapdesktop = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MinimapSuite.java b/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MinimapSuite.java deleted file mode 100644 index a5dc5191b9e6b3f650843a957eb4c6198855bff4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/minimap/MinimapSuite.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.minimap; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite MinimapSuite -*/ -// JUnitDoclet end javadoc_class -public class MinimapSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.samples.minimap"); - - suite.addTestSuite(CH.ifa.draw.test.samples.minimap.MiniMapDesktopTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.minimap.MiniMapApplicationTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/net/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/samples/net/AllTests.java deleted file mode 100644 index 8a7c325df8368c726fd81a962322f0149f47e7a6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/net/AllTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.net; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.samples.net"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(NetAppTest.class)); - suite.addTest(new TestSuite(NodeFigureTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/net/NetAppTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/net/NetAppTest.java deleted file mode 100644 index 48bc22b4cef6cb39b0f29bbda53eeec05a1e7da0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/net/NetAppTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.net; - -import CH.ifa.draw.samples.net.NetApp; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NetAppTest is generated by - * JUnitDoclet to hold the tests for NetApp. - * @see CH.ifa.draw.samples.net.NetApp - */ -// JUnitDoclet end javadoc_class -public class NetAppTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NetApp netapp; - // JUnitDoclet end class - - /** - * Constructor NetAppTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NetAppTest(String name) { - // JUnitDoclet begin method NetAppTest - super(name); - // JUnitDoclet end method NetAppTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.net.NetApp createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.net.NetApp(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - netapp = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - netapp = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.samples.net.NetApp#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/net/NetSuite.java b/JHotDraw/src/CH/ifa/draw/test/samples/net/NetSuite.java deleted file mode 100644 index 5a2ce5fd5cd0f219cc17b38e9dcd804ddf26162c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/net/NetSuite.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)NetSuite - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.net; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite NetSuite -*/ -// JUnitDoclet end javadoc_class -public class NetSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.samples.net"); - - suite.addTestSuite(CH.ifa.draw.test.samples.net.NodeFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.net.NetAppTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/net/NodeFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/net/NodeFigureTest.java deleted file mode 100644 index 459cbc14b4aff300bedfab7ad02a140b54376453..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/net/NodeFigureTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.net; - -import CH.ifa.draw.samples.net.NodeFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NodeFigureTest is generated by - * JUnitDoclet to hold the tests for NodeFigure. - * @see CH.ifa.draw.samples.net.NodeFigure - */ -// JUnitDoclet end javadoc_class -public class NodeFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NodeFigure nodefigure; - // JUnitDoclet end class - - /** - * Constructor NodeFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NodeFigureTest(String name) { - // JUnitDoclet begin method NodeFigureTest - super(name); - // JUnitDoclet end method NodeFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.net.NodeFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.net.NodeFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nodefigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nodefigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.samples.net.NodeFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.samples.net.NodeFigure#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.samples.net.NodeFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.samples.net.NodeFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method connectorVisibility() - /** - * Method testConnectorVisibility is testing connectorVisibility - * @see CH.ifa.draw.samples.net.NodeFigure#connectorVisibility(boolean, CH.ifa.draw.framework.ConnectionFigure) - */ - // JUnitDoclet end javadoc_method connectorVisibility() - public void testConnectorVisibility() throws Exception { - // JUnitDoclet begin method connectorVisibility - // JUnitDoclet end method connectorVisibility - } - - // JUnitDoclet begin javadoc_method connectorAt() - /** - * Method testConnectorAt is testing connectorAt - * @see CH.ifa.draw.samples.net.NodeFigure#connectorAt(int, int) - */ - // JUnitDoclet end javadoc_method connectorAt() - public void testConnectorAt() throws Exception { - // JUnitDoclet begin method connectorAt - // JUnitDoclet end method connectorAt - } - - // JUnitDoclet begin javadoc_method getRepresentingFigure() - /** - * Method testGetRepresentingFigure is testing getRepresentingFigure - * @see CH.ifa.draw.samples.net.NodeFigure#getRepresentingFigure() - */ - // JUnitDoclet end javadoc_method getRepresentingFigure() - public void testGetRepresentingFigure() throws Exception { - // JUnitDoclet begin method getRepresentingFigure - // JUnitDoclet end method getRepresentingFigure - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/samples/nothing/AllTests.java deleted file mode 100644 index f4d2195c22fca7a56bb62ec07b4785c1fc681e3a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/AllTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.nothing; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.samples.nothing"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(NothingAppTest.class)); - suite.addTest(new TestSuite(NothingAppletTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingAppTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingAppTest.java deleted file mode 100644 index 0b28456f6130ff879cd34c4b438294534c8ba6fe..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingAppTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.nothing; - -import CH.ifa.draw.samples.nothing.NothingApp; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NothingAppTest is generated by - * JUnitDoclet to hold the tests for NothingApp. - * @see CH.ifa.draw.samples.nothing.NothingApp - */ -// JUnitDoclet end javadoc_class -public class NothingAppTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NothingApp nothingapp; - // JUnitDoclet end class - - /** - * Constructor NothingAppTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NothingAppTest(String name) { - // JUnitDoclet begin method NothingAppTest - super(name); - // JUnitDoclet end method NothingAppTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.nothing.NothingApp createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.nothing.NothingApp(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nothingapp = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nothingapp = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.samples.nothing.NothingApp#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingAppletTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingAppletTest.java deleted file mode 100644 index 3c3ba38294d8d6d46b7c9b7321d41ac0129f6f4a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingAppletTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.nothing; - -import CH.ifa.draw.samples.nothing.NothingApplet; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NothingAppletTest is generated by - * JUnitDoclet to hold the tests for NothingApplet. - * @see CH.ifa.draw.samples.nothing.NothingApplet - */ -// JUnitDoclet end javadoc_class -public class NothingAppletTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NothingApplet nothingapplet; - // JUnitDoclet end class - - /** - * Constructor NothingAppletTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NothingAppletTest(String name) { - // JUnitDoclet begin method NothingAppletTest - super(name); - // JUnitDoclet end method NothingAppletTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.nothing.NothingApplet createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.nothing.NothingApplet(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nothingapplet = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nothingapplet = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingSuite.java b/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingSuite.java deleted file mode 100644 index 72688f524d27cf2fdc74d6a358cf7abca61ea51a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/nothing/NothingSuite.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.nothing; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite NothingSuite -*/ -// JUnitDoclet end javadoc_class -public class NothingSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.samples.nothing"); - - suite.addTestSuite(CH.ifa.draw.test.samples.nothing.NothingAppletTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.nothing.NothingAppTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/AllTests.java deleted file mode 100644 index e03d0e0d8ea232192d9cb74496b8f04441fc1613..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/AllTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.samples.pert"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(PertAppletTest.class)); - suite.addTest(new TestSuite(PertApplicationTest.class)); - suite.addTest(new TestSuite(PertDependencyTest.class)); - suite.addTest(new TestSuite(PertFigureCreationToolTest.class)); - suite.addTest(new TestSuite(PertFigureTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertAppletTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertAppletTest.java deleted file mode 100644 index 163dfd968fe1c2f96a1eec8dfa08276edc6b4caf..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertAppletTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -import CH.ifa.draw.samples.pert.PertApplet; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PertAppletTest is generated by - * JUnitDoclet to hold the tests for PertApplet. - * @see CH.ifa.draw.samples.pert.PertApplet - */ -// JUnitDoclet end javadoc_class -public class PertAppletTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PertApplet pertapplet; - // JUnitDoclet end class - - /** - * Constructor PertAppletTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PertAppletTest(String name) { - // JUnitDoclet begin method PertAppletTest - super(name); - // JUnitDoclet end method PertAppletTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.pert.PertApplet createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.pert.PertApplet(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - pertapplet = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - pertapplet = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertApplicationTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertApplicationTest.java deleted file mode 100644 index 34d41e6b0789ee81ddf5e3b3a97cca7bb5681c4f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertApplicationTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -import CH.ifa.draw.samples.pert.PertApplication; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PertApplicationTest is generated by - * JUnitDoclet to hold the tests for PertApplication. - * @see CH.ifa.draw.samples.pert.PertApplication - */ -// JUnitDoclet end javadoc_class -public class PertApplicationTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PertApplication pertapplication; - // JUnitDoclet end class - - /** - * Constructor PertApplicationTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PertApplicationTest(String name) { - // JUnitDoclet begin method PertApplicationTest - super(name); - // JUnitDoclet end method PertApplicationTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.pert.PertApplication createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.pert.PertApplication(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - pertapplication = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - pertapplication = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.samples.pert.PertApplication#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertDependencyTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertDependencyTest.java deleted file mode 100644 index da2af1117ed4842da5585a3375f272af61b95001..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertDependencyTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -import CH.ifa.draw.samples.pert.PertDependency; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PertDependencyTest is generated by - * JUnitDoclet to hold the tests for PertDependency. - * @see CH.ifa.draw.samples.pert.PertDependency - */ -// JUnitDoclet end javadoc_class -public class PertDependencyTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PertDependency pertdependency; - // JUnitDoclet end class - - /** - * Constructor PertDependencyTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PertDependencyTest(String name) { - // JUnitDoclet begin method PertDependencyTest - super(name); - // JUnitDoclet end method PertDependencyTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.pert.PertDependency createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.pert.PertDependency(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - pertdependency = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - pertdependency = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method handleConnect() - /** - * Method testHandleConnect is testing handleConnect - * @see CH.ifa.draw.samples.pert.PertDependency#handleConnect(CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method handleConnect() - public void testHandleConnect() throws Exception { - // JUnitDoclet begin method handleConnect - // JUnitDoclet end method handleConnect - } - - // JUnitDoclet begin javadoc_method handleDisconnect() - /** - * Method testHandleDisconnect is testing handleDisconnect - * @see CH.ifa.draw.samples.pert.PertDependency#handleDisconnect(CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method handleDisconnect() - public void testHandleDisconnect() throws Exception { - // JUnitDoclet begin method handleDisconnect - // JUnitDoclet end method handleDisconnect - } - - // JUnitDoclet begin javadoc_method canConnect() - /** - * Method testCanConnect is testing canConnect - * @see CH.ifa.draw.samples.pert.PertDependency#canConnect(CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method canConnect() - public void testCanConnect() throws Exception { - // JUnitDoclet begin method canConnect - // JUnitDoclet end method canConnect - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.samples.pert.PertDependency#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertFigureCreationToolTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertFigureCreationToolTest.java deleted file mode 100644 index 483babf2be7da07ee257f291b8c9aa2cc8244da1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertFigureCreationToolTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -// JUnitDoclet begin import -import CH.ifa.draw.samples.pert.PertFigureCreationTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PertFigureCreationToolTest is generated by - * JUnitDoclet to hold the tests for PertFigureCreationTool. - * @see CH.ifa.draw.samples.pert.PertFigureCreationTool - */ -// JUnitDoclet end javadoc_class -public class PertFigureCreationToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PertFigureCreationTool pertfigurecreationtool; - // JUnitDoclet end class - - /** - * Constructor PertFigureCreationToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PertFigureCreationToolTest(String name) { - // JUnitDoclet begin method PertFigureCreationToolTest - super(name); - // JUnitDoclet end method PertFigureCreationToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.pert.PertFigureCreationTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.pert.PertFigureCreationTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - pertfigurecreationtool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - pertfigurecreationtool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertFigureTest.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertFigureTest.java deleted file mode 100644 index f07040f04d53cd7bf789b3b32447b6c6b6bb87da..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertFigureTest.java +++ /dev/null @@ -1,357 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -import CH.ifa.draw.samples.pert.PertFigure; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - - -// JUnitDoclet begin javadoc_class -/** - * TestCase PertFigureTest is generated by - * JUnitDoclet to hold the tests for PertFigure. - * @see CH.ifa.draw.samples.pert.PertFigure - */ -// JUnitDoclet end javadoc_class -public class PertFigureTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PertFigure pertfigure; - // JUnitDoclet end class - - /** - * Constructor PertFigureTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PertFigureTest(String name) { - // JUnitDoclet begin method PertFigureTest - super(name); - // JUnitDoclet end method PertFigureTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.samples.pert.PertFigure createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.samples.pert.PertFigure(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - pertfigure = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - pertfigure = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method start() - /** - * Method testStart is testing start - * @see CH.ifa.draw.samples.pert.PertFigure#start() - */ - // JUnitDoclet end javadoc_method start() - public void testStart() throws Exception { - // JUnitDoclet begin method start - // JUnitDoclet end method start - } - - // JUnitDoclet begin javadoc_method end() - /** - * Method testEnd is testing end - * @see CH.ifa.draw.samples.pert.PertFigure#end() - */ - // JUnitDoclet end javadoc_method end() - public void testEnd() throws Exception { - // JUnitDoclet begin method end - // JUnitDoclet end method end - } - - // JUnitDoclet begin javadoc_method duration() - /** - * Method testDuration is testing duration - * @see CH.ifa.draw.samples.pert.PertFigure#duration() - */ - // JUnitDoclet end javadoc_method duration() - public void testDuration() throws Exception { - // JUnitDoclet begin method duration - // JUnitDoclet end method duration - } - - // JUnitDoclet begin javadoc_method setEnd() - /** - * Method testSetEnd is testing setEnd - * @see CH.ifa.draw.samples.pert.PertFigure#setEnd(int) - */ - // JUnitDoclet end javadoc_method setEnd() - public void testSetEnd() throws Exception { - // JUnitDoclet begin method setEnd - // JUnitDoclet end method setEnd - } - - // JUnitDoclet begin javadoc_method addPreTask() - /** - * Method testAddPreTask is testing addPreTask - * @see CH.ifa.draw.samples.pert.PertFigure#addPreTask(CH.ifa.draw.samples.pert.PertFigure) - */ - // JUnitDoclet end javadoc_method addPreTask() - public void testAddPreTask() throws Exception { - // JUnitDoclet begin method addPreTask - // JUnitDoclet end method addPreTask - } - - // JUnitDoclet begin javadoc_method addPostTask() - /** - * Method testAddPostTask is testing addPostTask - * @see CH.ifa.draw.samples.pert.PertFigure#addPostTask(CH.ifa.draw.samples.pert.PertFigure) - */ - // JUnitDoclet end javadoc_method addPostTask() - public void testAddPostTask() throws Exception { - // JUnitDoclet begin method addPostTask - // JUnitDoclet end method addPostTask - } - - // JUnitDoclet begin javadoc_method removePreTask() - /** - * Method testRemovePreTask is testing removePreTask - * @see CH.ifa.draw.samples.pert.PertFigure#removePreTask(CH.ifa.draw.samples.pert.PertFigure) - */ - // JUnitDoclet end javadoc_method removePreTask() - public void testRemovePreTask() throws Exception { - // JUnitDoclet begin method removePreTask - // JUnitDoclet end method removePreTask - } - - // JUnitDoclet begin javadoc_method removePostTask() - /** - * Method testRemovePostTask is testing removePostTask - * @see CH.ifa.draw.samples.pert.PertFigure#removePostTask(CH.ifa.draw.samples.pert.PertFigure) - */ - // JUnitDoclet end javadoc_method removePostTask() - public void testRemovePostTask() throws Exception { - // JUnitDoclet begin method removePostTask - // JUnitDoclet end method removePostTask - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.samples.pert.PertFigure#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.samples.pert.PertFigure#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.samples.pert.PertFigure#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.samples.pert.PertFigure#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method update() - /** - * Method testUpdate is testing update - * @see CH.ifa.draw.samples.pert.PertFigure#update(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method update() - public void testUpdate() throws Exception { - // JUnitDoclet begin method update - // JUnitDoclet end method update - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.samples.pert.PertFigure#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method figureRemoved() - /** - * Method testFigureRemoved is testing figureRemoved - * @see CH.ifa.draw.samples.pert.PertFigure#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRemoved() - public void testFigureRemoved() throws Exception { - // JUnitDoclet begin method figureRemoved - // JUnitDoclet end method figureRemoved - } - - // JUnitDoclet begin javadoc_method notifyPostTasks() - /** - * Method testNotifyPostTasks is testing notifyPostTasks - * @see CH.ifa.draw.samples.pert.PertFigure#notifyPostTasks() - */ - // JUnitDoclet end javadoc_method notifyPostTasks() - public void testNotifyPostTasks() throws Exception { - // JUnitDoclet begin method notifyPostTasks - // JUnitDoclet end method notifyPostTasks - } - - // JUnitDoclet begin javadoc_method updateDurations() - /** - * Method testUpdateDurations is testing updateDurations - * @see CH.ifa.draw.samples.pert.PertFigure#updateDurations() - */ - // JUnitDoclet end javadoc_method updateDurations() - public void testUpdateDurations() throws Exception { - // JUnitDoclet begin method updateDurations - // JUnitDoclet end method updateDurations - } - - // JUnitDoclet begin javadoc_method hasCycle() - /** - * Method testHasCycle is testing hasCycle - * @see CH.ifa.draw.samples.pert.PertFigure#hasCycle(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method hasCycle() - public void testHasCycle() throws Exception { - // JUnitDoclet begin method hasCycle - // JUnitDoclet end method hasCycle - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.samples.pert.PertFigure#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method writeTasks() - /** - * Method testWriteTasks is testing writeTasks - * @see CH.ifa.draw.samples.pert.PertFigure#writeTasks(CH.ifa.draw.util.StorableOutput, java.util.List) - */ - // JUnitDoclet end javadoc_method writeTasks() - public void testWriteTasks() throws Exception { - // JUnitDoclet begin method writeTasks - // JUnitDoclet end method writeTasks - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.samples.pert.PertFigure#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method connectionInsets() - /** - * Method testConnectionInsets is testing connectionInsets - * @see CH.ifa.draw.samples.pert.PertFigure#connectionInsets() - */ - // JUnitDoclet end javadoc_method connectionInsets() - public void testConnectionInsets() throws Exception { - // JUnitDoclet begin method connectionInsets - // JUnitDoclet end method connectionInsets - } - - // JUnitDoclet begin javadoc_method readTasks() - /** - * Method testReadTasks is testing readTasks - * @see CH.ifa.draw.samples.pert.PertFigure#readTasks(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method readTasks() - public void testReadTasks() throws Exception { - // JUnitDoclet begin method readTasks - // JUnitDoclet end method readTasks - } - - - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertSuite.java b/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertSuite.java deleted file mode 100644 index 8f753120a14945f751aef7f8f645236d44d66a59..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/samples/pert/PertSuite.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.samples.pert; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite PertSuite -*/ -// JUnitDoclet end javadoc_class -public class PertSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.samples.pert"); - - suite.addTestSuite(CH.ifa.draw.test.samples.pert.PertFigureCreationToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.pert.PertFigureTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.pert.PertDependencyTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.pert.PertApplicationTest.class); - suite.addTestSuite(CH.ifa.draw.test.samples.pert.PertAppletTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/AlignCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/AlignCommandTest.java deleted file mode 100644 index 8e732be7728b4dc92853dba06e7695c32083a511..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/AlignCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.AlignCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase AlignCommandTest is generated by - * JUnitDoclet to hold the tests for AlignCommand. - * @see CH.ifa.draw.standard.AlignCommand - */ -// JUnitDoclet end javadoc_class -public class AlignCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private AlignCommand aligncommand; - // JUnitDoclet end class - - /** - * Constructor AlignCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public AlignCommandTest(String name) { - // JUnitDoclet begin method AlignCommandTest - super(name); - // JUnitDoclet end method AlignCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.AlignCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.AlignCommand(AlignCommand.Alignment.TOPS, getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - aligncommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - aligncommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.AlignCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method getAlignment() - /** - * Method testGetAlignment is testing getAlignment - * @see CH.ifa.draw.standard.AlignCommand#getAlignment() - */ - // JUnitDoclet end javadoc_method getAlignment() - public void testGetAlignment() throws Exception { - // JUnitDoclet begin method getAlignment - // JUnitDoclet end method getAlignment - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/standard/AllTests.java deleted file mode 100644 index 7c27662f4cde6abedaa59a1a3a4c746b2bdf217e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/AllTests.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.standard"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(AlignCommandTest.class)); - suite.addTest(new TestSuite(BoxHandleKitTest.class)); - suite.addTest(new TestSuite(BringToFrontCommandTest.class)); - suite.addTest(new TestSuite(BufferedUpdateStrategyTest.class)); - suite.addTest(new TestSuite(ChangeAttributeCommandTest.class)); - suite.addTest(new TestSuite(ChangeConnectionEndHandleTest.class)); - suite.addTest(new TestSuite(ChangeConnectionStartHandleTest.class)); - suite.addTest(new TestSuite(ChopBoxConnectorTest.class)); - suite.addTest(new TestSuite(ConnectionHandleTest.class)); - suite.addTest(new TestSuite(ConnectionToolTest.class)); - suite.addTest(new TestSuite(CopyCommandTest.class)); - suite.addTest(new TestSuite(CreationToolTest.class)); - suite.addTest(new TestSuite(CutCommandTest.class)); - suite.addTest(new TestSuite(DeleteCommandTest.class)); - suite.addTest(new TestSuite(DeleteFromDrawingVisitorTest.class)); - suite.addTest(new TestSuite(DragTrackerTest.class)); - suite.addTest(new TestSuite(DuplicateCommandTest.class)); - suite.addTest(new TestSuite(FastBufferedUpdateStrategyTest.class)); - suite.addTest(new TestSuite(FigureAndEnumeratorTest.class)); - suite.addTest(new TestSuite(FigureChangeAdapterTest.class)); - suite.addTest(new TestSuite(FigureChangeEventMulticasterTest.class)); - suite.addTest(new TestSuite(FigureEnumeratorTest.class)); - suite.addTest(new TestSuite(GridConstrainerTest.class)); - suite.addTest(new TestSuite(HandleAndEnumeratorTest.class)); - suite.addTest(new TestSuite(HandleEnumeratorTest.class)); - suite.addTest(new TestSuite(HandleTrackerTest.class)); - suite.addTest(new TestSuite(InsertIntoDrawingVisitorTest.class)); - suite.addTest(new TestSuite(LocatorConnectorTest.class)); - suite.addTest(new TestSuite(LocatorHandleTest.class)); - suite.addTest(new TestSuite(NullDrawingViewTest.class)); - suite.addTest(new TestSuite(NullHandleTest.class)); - suite.addTest(new TestSuite(NullToolTest.class)); - suite.addTest(new TestSuite(OffsetLocatorTest.class)); - suite.addTest(new TestSuite(PasteCommandTest.class)); - suite.addTest(new TestSuite(PeripheralLocatorTest.class)); - suite.addTest(new TestSuite(RelativeLocatorTest.class)); - suite.addTest(new TestSuite(ReverseFigureEnumeratorTest.class)); - suite.addTest(new TestSuite(SelectAllCommandTest.class)); - suite.addTest(new TestSuite(SelectAreaTrackerTest.class)); - suite.addTest(new TestSuite(SelectionToolTest.class)); - suite.addTest(new TestSuite(SendToBackCommandTest.class)); - suite.addTest(new TestSuite(SimpleUpdateStrategyTest.class)); - suite.addTest(new TestSuite(SingleFigureEnumeratorTest.class)); - suite.addTest(new TestSuite(StandardDrawingTest.class)); - suite.addTest(new TestSuite(StandardDrawingViewTest.class)); - suite.addTest(new TestSuite(StandardFigureSelectionTest.class)); - suite.addTest(new TestSuite(ToggleGridCommandTest.class)); - suite.addTest(new TestSuite(ToolButtonTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/BoxHandleKitTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/BoxHandleKitTest.java deleted file mode 100644 index 0e66976ba458619177dd29a5f9db402f8448df02..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/BoxHandleKitTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.BoxHandleKit; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BoxHandleKitTest is generated by - * JUnitDoclet to hold the tests for BoxHandleKit. - * @see CH.ifa.draw.standard.BoxHandleKit - */ -// JUnitDoclet end javadoc_class -public class BoxHandleKitTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private BoxHandleKit boxhandlekit; - // JUnitDoclet end class - - /** - * Constructor BoxHandleKitTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BoxHandleKitTest(String name) { - // JUnitDoclet begin method BoxHandleKitTest - super(name); - // JUnitDoclet end method BoxHandleKitTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.BoxHandleKit createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.BoxHandleKit(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - boxhandlekit = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - boxhandlekit = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addCornerHandles() - /** - * Method testAddCornerHandles is testing addCornerHandles - * @see CH.ifa.draw.standard.BoxHandleKit#addCornerHandles(CH.ifa.draw.framework.Figure, java.util.List) - */ - // JUnitDoclet end javadoc_method addCornerHandles() - public void testAddCornerHandles() throws Exception { - // JUnitDoclet begin method addCornerHandles - // JUnitDoclet end method addCornerHandles - } - - // JUnitDoclet begin javadoc_method addHandles() - /** - * Method testAddHandles is testing addHandles - * @see CH.ifa.draw.standard.BoxHandleKit#addHandles(CH.ifa.draw.framework.Figure, java.util.List) - */ - // JUnitDoclet end javadoc_method addHandles() - public void testAddHandles() throws Exception { - // JUnitDoclet begin method addHandles - // JUnitDoclet end method addHandles - } - - // JUnitDoclet begin javadoc_method south() - /** - * Method testSouth is testing south - * @see CH.ifa.draw.standard.BoxHandleKit#south(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method south() - public void testSouth() throws Exception { - // JUnitDoclet begin method south - // JUnitDoclet end method south - } - - // JUnitDoclet begin javadoc_method southEast() - /** - * Method testSouthEast is testing southEast - * @see CH.ifa.draw.standard.BoxHandleKit#southEast(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method southEast() - public void testSouthEast() throws Exception { - // JUnitDoclet begin method southEast - // JUnitDoclet end method southEast - } - - // JUnitDoclet begin javadoc_method southWest() - /** - * Method testSouthWest is testing southWest - * @see CH.ifa.draw.standard.BoxHandleKit#southWest(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method southWest() - public void testSouthWest() throws Exception { - // JUnitDoclet begin method southWest - // JUnitDoclet end method southWest - } - - // JUnitDoclet begin javadoc_method north() - /** - * Method testNorth is testing north - * @see CH.ifa.draw.standard.BoxHandleKit#north(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method north() - public void testNorth() throws Exception { - // JUnitDoclet begin method north - // JUnitDoclet end method north - } - - // JUnitDoclet begin javadoc_method northEast() - /** - * Method testNorthEast is testing northEast - * @see CH.ifa.draw.standard.BoxHandleKit#northEast(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method northEast() - public void testNorthEast() throws Exception { - // JUnitDoclet begin method northEast - // JUnitDoclet end method northEast - } - - // JUnitDoclet begin javadoc_method northWest() - /** - * Method testNorthWest is testing northWest - * @see CH.ifa.draw.standard.BoxHandleKit#northWest(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method northWest() - public void testNorthWest() throws Exception { - // JUnitDoclet begin method northWest - // JUnitDoclet end method northWest - } - - // JUnitDoclet begin javadoc_method east() - /** - * Method testEast is testing east - * @see CH.ifa.draw.standard.BoxHandleKit#east(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method east() - public void testEast() throws Exception { - // JUnitDoclet begin method east - // JUnitDoclet end method east - } - - // JUnitDoclet begin javadoc_method west() - /** - * Method testWest is testing west - * @see CH.ifa.draw.standard.BoxHandleKit#west(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method west() - public void testWest() throws Exception { - // JUnitDoclet begin method west - // JUnitDoclet end method west - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/BringToFrontCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/BringToFrontCommandTest.java deleted file mode 100644 index 1e1b06f1b373c4c0289b66cfc0c88a128a925ce1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/BringToFrontCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.BringToFrontCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BringToFrontCommandTest is generated by - * JUnitDoclet to hold the tests for BringToFrontCommand. - * @see CH.ifa.draw.standard.BringToFrontCommand - */ -// JUnitDoclet end javadoc_class -public class BringToFrontCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private BringToFrontCommand bringtofrontcommand; - // JUnitDoclet end class - - /** - * Constructor BringToFrontCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BringToFrontCommandTest(String name) { - // JUnitDoclet begin method BringToFrontCommandTest - super(name); - // JUnitDoclet end method BringToFrontCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.BringToFrontCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.BringToFrontCommand("TestBringToFront", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - bringtofrontcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - bringtofrontcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.BringToFrontCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.standard.BringToFrontCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/BufferedUpdateStrategyTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/BufferedUpdateStrategyTest.java deleted file mode 100644 index a5c90ed8963e230aa91e8401c2f01cb617596de0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/BufferedUpdateStrategyTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.BufferedUpdateStrategy; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BufferedUpdateStrategyTest is generated by - * JUnitDoclet to hold the tests for BufferedUpdateStrategy. - * @see CH.ifa.draw.standard.BufferedUpdateStrategy - */ -// JUnitDoclet end javadoc_class -public class BufferedUpdateStrategyTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private BufferedUpdateStrategy bufferedupdatestrategy; - // JUnitDoclet end class - - /** - * Constructor BufferedUpdateStrategyTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BufferedUpdateStrategyTest(String name) { - // JUnitDoclet begin method BufferedUpdateStrategyTest - super(name); - // JUnitDoclet end method BufferedUpdateStrategyTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.BufferedUpdateStrategy createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.BufferedUpdateStrategy(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - bufferedupdatestrategy = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - bufferedupdatestrategy = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.BufferedUpdateStrategy#draw(java.awt.Graphics, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ChangeAttributeCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ChangeAttributeCommandTest.java deleted file mode 100644 index 494a5b121f543a5a330c3e0fb941720363b886ad..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ChangeAttributeCommandTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Font; - -// JUnitDoclet begin import -import CH.ifa.draw.framework.FigureAttributeConstant; -import CH.ifa.draw.standard.ChangeAttributeCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChangeAttributeCommandTest is generated by - * JUnitDoclet to hold the tests for ChangeAttributeCommand. - * @see CH.ifa.draw.standard.ChangeAttributeCommand - */ -// JUnitDoclet end javadoc_class -public class ChangeAttributeCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChangeAttributeCommand changeattributecommand; - // JUnitDoclet end class - - /** - * Constructor ChangeAttributeCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChangeAttributeCommandTest(String name) { - // JUnitDoclet begin method ChangeAttributeCommandTest - super(name); - // JUnitDoclet end method ChangeAttributeCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ChangeAttributeCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - FigureAttributeConstant fontStyle = FigureAttributeConstant.FONT_STYLE; - return new ChangeAttributeCommand("Bold", fontStyle, new Integer(Font.BOLD), getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - changeattributecommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - changeattributecommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.ChangeAttributeCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.standard.ChangeAttributeCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ChangeConnectionEndHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ChangeConnectionEndHandleTest.java deleted file mode 100644 index 4731bffb882dedbe169d6512370cc7179135e63a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ChangeConnectionEndHandleTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import junit.framework.TestCase; -import CH.ifa.draw.figures.LineConnection; -import CH.ifa.draw.standard.ChangeConnectionEndHandle; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChangeConnectionEndHandleTest is generated by - * JUnitDoclet to hold the tests for ChangeConnectionEndHandle. - * @see CH.ifa.draw.standard.ChangeConnectionEndHandle - */ -// JUnitDoclet end javadoc_class -public class ChangeConnectionEndHandleTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChangeConnectionEndHandle changeconnectionendhandle; - // JUnitDoclet end class - - /** - * Constructor ChangeConnectionEndHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChangeConnectionEndHandleTest(String name) { - // JUnitDoclet begin method ChangeConnectionEndHandleTest - super(name); - // JUnitDoclet end method ChangeConnectionEndHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ChangeConnectionEndHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.ChangeConnectionEndHandle(new LineConnection()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - changeconnectionendhandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - changeconnectionendhandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.standard.ChangeConnectionEndHandle#locate() - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ChangeConnectionStartHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ChangeConnectionStartHandleTest.java deleted file mode 100644 index f7a4642f34a3eda8568c53e2614c08e81ba8ffb2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ChangeConnectionStartHandleTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import junit.framework.TestCase; -import CH.ifa.draw.figures.LineConnection; -import CH.ifa.draw.standard.ChangeConnectionStartHandle; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChangeConnectionStartHandleTest is generated by - * JUnitDoclet to hold the tests for ChangeConnectionStartHandle. - * @see CH.ifa.draw.standard.ChangeConnectionStartHandle - */ -// JUnitDoclet end javadoc_class -public class ChangeConnectionStartHandleTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChangeConnectionStartHandle changeconnectionstarthandle; - // JUnitDoclet end class - - /** - * Constructor ChangeConnectionStartHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChangeConnectionStartHandleTest(String name) { - // JUnitDoclet begin method ChangeConnectionStartHandleTest - super(name); - // JUnitDoclet end method ChangeConnectionStartHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ChangeConnectionStartHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.ChangeConnectionStartHandle(new LineConnection()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - changeconnectionstarthandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - changeconnectionstarthandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.standard.ChangeConnectionStartHandle#locate() - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ChopBoxConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ChopBoxConnectorTest.java deleted file mode 100644 index 72bcef235d485600800097a0767c5cbec199882d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ChopBoxConnectorTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.ChopBoxConnector; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ChopBoxConnectorTest is generated by - * JUnitDoclet to hold the tests for ChopBoxConnector. - * @see CH.ifa.draw.standard.ChopBoxConnector - */ -// JUnitDoclet end javadoc_class -public class ChopBoxConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ChopBoxConnector chopboxconnector; - // JUnitDoclet end class - - /** - * Constructor ChopBoxConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ChopBoxConnectorTest(String name) { - // JUnitDoclet begin method ChopBoxConnectorTest - super(name); - // JUnitDoclet end method ChopBoxConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ChopBoxConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.ChopBoxConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - chopboxconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - chopboxconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method findStart() - /** - * Method testFindStart is testing findStart - * @see CH.ifa.draw.standard.ChopBoxConnector#findStart(CH.ifa.draw.framework.ConnectionFigure) - */ - // JUnitDoclet end javadoc_method findStart() - public void testFindStart() throws Exception { - // JUnitDoclet begin method findStart - // JUnitDoclet end method findStart - } - - // JUnitDoclet begin javadoc_method findEnd() - /** - * Method testFindEnd is testing findEnd - * @see CH.ifa.draw.standard.ChopBoxConnector#findEnd(CH.ifa.draw.framework.ConnectionFigure) - */ - // JUnitDoclet end javadoc_method findEnd() - public void testFindEnd() throws Exception { - // JUnitDoclet begin method findEnd - // JUnitDoclet end method findEnd - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ConnectionHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ConnectionHandleTest.java deleted file mode 100644 index d4bf74916822d2cb480efeb8bf7dcdb6a6cd8bf1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ConnectionHandleTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.LineConnection; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.ConnectionHandle; -import CH.ifa.draw.standard.RelativeLocator; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ConnectionHandleTest is generated by - * JUnitDoclet to hold the tests for ConnectionHandle. - * @see CH.ifa.draw.standard.ConnectionHandle - */ -// JUnitDoclet end javadoc_class -public class ConnectionHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ConnectionHandle connectionhandle; - // JUnitDoclet end class - - /** - * Constructor ConnectionHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ConnectionHandleTest(String name) { - // JUnitDoclet begin method ConnectionHandleTest - super(name); - // JUnitDoclet end method ConnectionHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ConnectionHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.ConnectionHandle(new RectangleFigure(new Point(10, 10), new Point(100, 100)), RelativeLocator.east(), new LineConnection()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - connectionhandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - connectionhandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method invokeStart() - /** - * Method testInvokeStart is testing invokeStart - * @see CH.ifa.draw.standard.ConnectionHandle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStart() - public void testInvokeStart() throws Exception { - // JUnitDoclet begin method invokeStart - // JUnitDoclet end method invokeStart - } - - // JUnitDoclet begin javadoc_method invokeStep() - /** - * Method testInvokeStep is testing invokeStep - * @see CH.ifa.draw.standard.ConnectionHandle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeStep() - public void testInvokeStep() throws Exception { - // JUnitDoclet begin method invokeStep - // JUnitDoclet end method invokeStep - } - - // JUnitDoclet begin javadoc_method invokeEnd() - /** - * Method testInvokeEnd is testing invokeEnd - * @see CH.ifa.draw.standard.ConnectionHandle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeEnd() - public void testInvokeEnd() throws Exception { - // JUnitDoclet begin method invokeEnd - // JUnitDoclet end method invokeEnd - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.ConnectionHandle#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ConnectionToolTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ConnectionToolTest.java deleted file mode 100644 index 6a20812285941b3f4e471f22967c58dd70ac7137..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ConnectionToolTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.LineConnection; -import CH.ifa.draw.standard.ConnectionTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ConnectionToolTest is generated by - * JUnitDoclet to hold the tests for ConnectionTool. - * @see CH.ifa.draw.standard.ConnectionTool - */ -// JUnitDoclet end javadoc_class -public class ConnectionToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ConnectionTool connectiontool; - // JUnitDoclet end class - - /** - * Constructor ConnectionToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ConnectionToolTest(String name) { - // JUnitDoclet begin method ConnectionToolTest - super(name); - // JUnitDoclet end method ConnectionToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ConnectionTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - LineConnection lineConn = new LineConnection(); - // todo: lineConn.connectStart(); - // todo: lineConn.connectEnd(); - return new CH.ifa.draw.standard.ConnectionTool(getDrawingEditor(), lineConn); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - connectiontool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - connectiontool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.standard.ConnectionTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.standard.ConnectionTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.standard.ConnectionTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.standard.ConnectionTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.standard.ConnectionTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/CopyCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/CopyCommandTest.java deleted file mode 100644 index 9760f35a64257d42b9798a36c7da8735c81cc564..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/CopyCommandTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.CopyCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CopyCommandTest is generated by - * JUnitDoclet to hold the tests for CopyCommand. - * @see CH.ifa.draw.standard.CopyCommand - */ -// JUnitDoclet end javadoc_class -public class CopyCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CopyCommand copycommand; - // JUnitDoclet end class - - /** - * Constructor CopyCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CopyCommandTest(String name) { - // JUnitDoclet begin method CopyCommandTest - super(name); - // JUnitDoclet end method CopyCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.CopyCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.CopyCommand("TestCopy", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - copycommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - copycommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.CopyCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/CreationToolTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/CreationToolTest.java deleted file mode 100644 index 214bbf108a8aa4d01616dffece3e58db959c2b6e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/CreationToolTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.CreationTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CreationToolTest is generated by - * JUnitDoclet to hold the tests for CreationTool. - * @see CH.ifa.draw.standard.CreationTool - */ -// JUnitDoclet end javadoc_class -public class CreationToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CreationTool creationtool; - // JUnitDoclet end class - - /** - * Constructor CreationToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CreationToolTest(String name) { - // JUnitDoclet begin method CreationToolTest - super(name); - // JUnitDoclet end method CreationToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.CreationTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.CreationTool(getDrawingEditor(), new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - creationtool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - creationtool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.standard.CreationTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.standard.CreationTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.standard.CreationTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.standard.CreationTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/CutCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/CutCommandTest.java deleted file mode 100644 index 77354fcab05caa0e9efd14bf1d94ae8eba1f809b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/CutCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.CutCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CutCommandTest is generated by - * JUnitDoclet to hold the tests for CutCommand. - * @see CH.ifa.draw.standard.CutCommand - */ -// JUnitDoclet end javadoc_class -public class CutCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CutCommand cutcommand; - // JUnitDoclet end class - - /** - * Constructor CutCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CutCommandTest(String name) { - // JUnitDoclet begin method CutCommandTest - super(name); - // JUnitDoclet end method CutCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.CutCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.CutCommand("TestCut", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - cutcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - cutcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.CutCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.standard.CutCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/DeleteCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/DeleteCommandTest.java deleted file mode 100644 index 1ae9d186c9916f10c6dfba4b7ba992054de5db71..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/DeleteCommandTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.DeleteCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase DeleteCommandTest is generated by - * JUnitDoclet to hold the tests for DeleteCommand. - * @see CH.ifa.draw.standard.DeleteCommand - */ -// JUnitDoclet end javadoc_class -public class DeleteCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DeleteCommand deletecommand; - // JUnitDoclet end class - - /** - * Constructor DeleteCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DeleteCommandTest(String name) { - // JUnitDoclet begin method DeleteCommandTest - super(name); - // JUnitDoclet end method DeleteCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.DeleteCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.DeleteCommand("TestDelete", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - deletecommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - deletecommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.DeleteCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/DeleteFromDrawingVisitorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/DeleteFromDrawingVisitorTest.java deleted file mode 100644 index 731dab901cb65ded4e350ea3a653ecf4ae8f00b3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/DeleteFromDrawingVisitorTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.DeleteFromDrawingVisitor; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase DeleteFromDrawingVisitorTest is generated by - * JUnitDoclet to hold the tests for DeleteFromDrawingVisitor. - * @see CH.ifa.draw.standard.DeleteFromDrawingVisitor - */ -// JUnitDoclet end javadoc_class -public class DeleteFromDrawingVisitorTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DeleteFromDrawingVisitor deletefromdrawingvisitor; - // JUnitDoclet end class - - /** - * Constructor DeleteFromDrawingVisitorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DeleteFromDrawingVisitorTest(String name) { - // JUnitDoclet begin method DeleteFromDrawingVisitorTest - super(name); - // JUnitDoclet end method DeleteFromDrawingVisitorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.DeleteFromDrawingVisitor createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.DeleteFromDrawingVisitor(getDrawingEditor().view().drawing()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - getDrawingEditor().open(); - deletefromdrawingvisitor = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - deletefromdrawingvisitor = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method visitFigure() - /** - * Method testVisitFigure is testing visitFigure - * @see CH.ifa.draw.standard.DeleteFromDrawingVisitor#visitFigure(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method visitFigure() - public void testVisitFigure() throws Exception { - // JUnitDoclet begin method visitFigure - // JUnitDoclet end method visitFigure - } - - // JUnitDoclet begin javadoc_method visitHandle() - /** - * Method testVisitHandle is testing visitHandle - * @see CH.ifa.draw.standard.DeleteFromDrawingVisitor#visitHandle(CH.ifa.draw.framework.Handle) - */ - // JUnitDoclet end javadoc_method visitHandle() - public void testVisitHandle() throws Exception { - // JUnitDoclet begin method visitHandle - // JUnitDoclet end method visitHandle - } - - // JUnitDoclet begin javadoc_method visitFigureChangeListener() - /** - * Method testVisitFigureChangeListener is testing visitFigureChangeListener - * @see CH.ifa.draw.standard.DeleteFromDrawingVisitor#visitFigureChangeListener(CH.ifa.draw.framework.FigureChangeListener) - */ - // JUnitDoclet end javadoc_method visitFigureChangeListener() - public void testVisitFigureChangeListener() throws Exception { - // JUnitDoclet begin method visitFigureChangeListener - // JUnitDoclet end method visitFigureChangeListener - } - - // JUnitDoclet begin javadoc_method getDeletedFigures() - /** - * Method testGetDeletedFigures is testing getDeletedFigures - * @see CH.ifa.draw.standard.DeleteFromDrawingVisitor#getDeletedFigures() - */ - // JUnitDoclet end javadoc_method getDeletedFigures() - public void testGetDeletedFigures() throws Exception { - // JUnitDoclet begin method getDeletedFigures - // JUnitDoclet end method getDeletedFigures - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/DragTrackerTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/DragTrackerTest.java deleted file mode 100644 index 1043b1371df0b80729126782f8e6da421ed8b67c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/DragTrackerTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.DragTracker; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase DragTrackerTest is generated by - * JUnitDoclet to hold the tests for DragTracker. - * @see CH.ifa.draw.standard.DragTracker - */ -// JUnitDoclet end javadoc_class -public class DragTrackerTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DragTracker dragtracker; - // JUnitDoclet end class - - /** - * Constructor DragTrackerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DragTrackerTest(String name) { - // JUnitDoclet begin method DragTrackerTest - super(name); - // JUnitDoclet end method DragTrackerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.DragTracker createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.DragTracker(getDrawingEditor(), new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - dragtracker = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - dragtracker = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.standard.DragTracker#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.standard.DragTracker#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.standard.DragTracker#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.standard.DragTracker#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/DuplicateCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/DuplicateCommandTest.java deleted file mode 100644 index a72fd561cbde377f6efbc3c2cb5aedda39308437..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/DuplicateCommandTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.DuplicateCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase DuplicateCommandTest is generated by - * JUnitDoclet to hold the tests for DuplicateCommand. - * @see CH.ifa.draw.standard.DuplicateCommand - */ -// JUnitDoclet end javadoc_class -public class DuplicateCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private DuplicateCommand duplicatecommand; - // JUnitDoclet end class - - /** - * Constructor DuplicateCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public DuplicateCommandTest(String name) { - // JUnitDoclet begin method DuplicateCommandTest - super(name); - // JUnitDoclet end method DuplicateCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.DuplicateCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.DuplicateCommand("TestDuplicate", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - duplicatecommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - duplicatecommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.DuplicateCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/FastBufferedUpdateStrategyTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/FastBufferedUpdateStrategyTest.java deleted file mode 100644 index 425e6ec5a9f028ce699efd36f2330045a4f80137..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/FastBufferedUpdateStrategyTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.FastBufferedUpdateStrategy; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FastBufferedUpdateStrategyTest is generated by - * JUnitDoclet to hold the tests for FastBufferedUpdateStrategy. - * @see CH.ifa.draw.standard.FastBufferedUpdateStrategy - */ -// JUnitDoclet end javadoc_class -public class FastBufferedUpdateStrategyTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FastBufferedUpdateStrategy fastbufferedupdatestrategy; - // JUnitDoclet end class - - /** - * Constructor FastBufferedUpdateStrategyTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FastBufferedUpdateStrategyTest(String name) { - // JUnitDoclet begin method FastBufferedUpdateStrategyTest - super(name); - // JUnitDoclet end method FastBufferedUpdateStrategyTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.FastBufferedUpdateStrategy createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.FastBufferedUpdateStrategy(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - fastbufferedupdatestrategy = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - fastbufferedupdatestrategy = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.FastBufferedUpdateStrategy#draw(java.awt.Graphics, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/FigureAndEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/FigureAndEnumeratorTest.java deleted file mode 100644 index 21cdb5c0f258523b251260f5b2cc8ccd0013d78d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/FigureAndEnumeratorTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; -import java.util.List; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.PolyLineFigure; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.FigureAndEnumerator; -import CH.ifa.draw.standard.FigureEnumerator; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.CollectionsFactory; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureAndEnumeratorTest is generated by - * JUnitDoclet to hold the tests for FigureAndEnumerator. - * @see CH.ifa.draw.standard.FigureAndEnumerator - */ -// JUnitDoclet end javadoc_class -public class FigureAndEnumeratorTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureAndEnumerator figureandenumerator; - // JUnitDoclet end class - - /** - * Constructor FigureAndEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureAndEnumeratorTest(String name) { - // JUnitDoclet begin method FigureAndEnumeratorTest - super(name); - // JUnitDoclet end method FigureAndEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.FigureAndEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - List l1 = CollectionsFactory.current().createList(); - l1.add(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - l1.add(new PolyLineFigure(20, 20)); - FigureEnumerator enum1 = new FigureEnumerator(l1); - - List l2 = CollectionsFactory.current().createList(); - l2.add(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - l2.add(new PolyLineFigure(20, 20)); - FigureEnumerator enum2 = new FigureEnumerator(l2); - return new CH.ifa.draw.standard.FigureAndEnumerator(enum1, enum2); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - figureandenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figureandenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method nextFigure() - /** - * Method testNextFigure is testing nextFigure - * @see CH.ifa.draw.standard.FigureAndEnumerator#nextFigure() - */ - // JUnitDoclet end javadoc_method nextFigure() - public void testNextFigure() throws Exception { - // JUnitDoclet begin method nextFigure - // JUnitDoclet end method nextFigure - } - - // JUnitDoclet begin javadoc_method hasNextFigure() - /** - * Method testHasNextFigure is testing hasNextFigure - * @see CH.ifa.draw.standard.FigureAndEnumerator#hasNextFigure() - */ - // JUnitDoclet end javadoc_method hasNextFigure() - public void testHasNextFigure() throws Exception { - // JUnitDoclet begin method hasNextFigure - // JUnitDoclet end method hasNextFigure - } - - // JUnitDoclet begin javadoc_method reset() - /** - * Method testReset is testing reset - * @see CH.ifa.draw.standard.FigureAndEnumerator#reset() - */ - // JUnitDoclet end javadoc_method reset() - public void testReset() throws Exception { - // JUnitDoclet begin method reset - // JUnitDoclet end method reset - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/FigureChangeAdapterTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/FigureChangeAdapterTest.java deleted file mode 100644 index 5520b8684489c2eac0e648d9d86b1b564db0858c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/FigureChangeAdapterTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.FigureChangeAdapter; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureChangeAdapterTest is generated by - * JUnitDoclet to hold the tests for FigureChangeAdapter. - * @see CH.ifa.draw.standard.FigureChangeAdapter - */ -// JUnitDoclet end javadoc_class -public class FigureChangeAdapterTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureChangeAdapter figurechangeadapter; - // JUnitDoclet end class - - /** - * Constructor FigureChangeAdapterTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureChangeAdapterTest(String name) { - // JUnitDoclet begin method FigureChangeAdapterTest - super(name); - // JUnitDoclet end method FigureChangeAdapterTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.FigureChangeAdapter createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.FigureChangeAdapter(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - figurechangeadapter = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figurechangeadapter = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.standard.FigureChangeAdapter#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.standard.FigureChangeAdapter#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method figureRemoved() - /** - * Method testFigureRemoved is testing figureRemoved - * @see CH.ifa.draw.standard.FigureChangeAdapter#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRemoved() - public void testFigureRemoved() throws Exception { - // JUnitDoclet begin method figureRemoved - // JUnitDoclet end method figureRemoved - } - - // JUnitDoclet begin javadoc_method figureRequestRemove() - /** - * Method testFigureRequestRemove is testing figureRequestRemove - * @see CH.ifa.draw.standard.FigureChangeAdapter#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestRemove() - public void testFigureRequestRemove() throws Exception { - // JUnitDoclet begin method figureRequestRemove - // JUnitDoclet end method figureRequestRemove - } - - // JUnitDoclet begin javadoc_method figureRequestUpdate() - /** - * Method testFigureRequestUpdate is testing figureRequestUpdate - * @see CH.ifa.draw.standard.FigureChangeAdapter#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestUpdate() - public void testFigureRequestUpdate() throws Exception { - // JUnitDoclet begin method figureRequestUpdate - // JUnitDoclet end method figureRequestUpdate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/FigureChangeEventMulticasterTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/FigureChangeEventMulticasterTest.java deleted file mode 100644 index 065cc88f71adcb2913fc201006ac510942fad3f5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/FigureChangeEventMulticasterTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.util.EventListener; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.TextFigure; -import CH.ifa.draw.framework.Drawing; -import CH.ifa.draw.standard.FigureChangeEventMulticaster; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureChangeEventMulticasterTest is generated by - * JUnitDoclet to hold the tests for FigureChangeEventMulticaster. - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster - */ -// JUnitDoclet end javadoc_class -public class FigureChangeEventMulticasterTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureChangeEventMulticaster figurechangeeventmulticaster; - // JUnitDoclet end class - - /** - * Constructor FigureChangeEventMulticasterTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureChangeEventMulticasterTest(String name) { - // JUnitDoclet begin method FigureChangeEventMulticasterTest - super(name); - // JUnitDoclet end method FigureChangeEventMulticasterTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.FigureChangeEventMulticaster createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - EventListener l1 = new TextFigure(); - Drawing l2 = getDrawingEditor().view().drawing(); - return new CH.ifa.draw.standard.FigureChangeEventMulticaster(l1, l2); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - getDrawingEditor().open(); - figurechangeeventmulticaster = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figurechangeeventmulticaster = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method figureRequestRemove() - /** - * Method testFigureRequestRemove is testing figureRequestRemove - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestRemove() - public void testFigureRequestRemove() throws Exception { - // JUnitDoclet begin method figureRequestRemove - // JUnitDoclet end method figureRequestRemove - } - - // JUnitDoclet begin javadoc_method figureRequestUpdate() - /** - * Method testFigureRequestUpdate is testing figureRequestUpdate - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestUpdate() - public void testFigureRequestUpdate() throws Exception { - // JUnitDoclet begin method figureRequestUpdate - // JUnitDoclet end method figureRequestUpdate - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method figureRemoved() - /** - * Method testFigureRemoved is testing figureRemoved - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#figureRemoved(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRemoved() - public void testFigureRemoved() throws Exception { - // JUnitDoclet begin method figureRemoved - // JUnitDoclet end method figureRemoved - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#add(CH.ifa.draw.framework.FigureChangeListener, CH.ifa.draw.framework.FigureChangeListener) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.standard.FigureChangeEventMulticaster#remove(CH.ifa.draw.framework.FigureChangeListener, CH.ifa.draw.framework.FigureChangeListener) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/FigureEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/FigureEnumeratorTest.java deleted file mode 100644 index 0e84222cf1820f0ff67704126ddb0f067860f487..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/FigureEnumeratorTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; -import java.util.List; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.PolyLineFigure; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.FigureEnumerator; -import CH.ifa.draw.util.CollectionsFactory; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FigureEnumeratorTest is generated by - * JUnitDoclet to hold the tests for FigureEnumerator. - * @see CH.ifa.draw.standard.FigureEnumerator - */ -// JUnitDoclet end javadoc_class -public class FigureEnumeratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FigureEnumerator figureenumerator; - // JUnitDoclet end class - - /** - * Constructor FigureEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FigureEnumeratorTest(String name) { - // JUnitDoclet begin method FigureEnumeratorTest - super(name); - // JUnitDoclet end method FigureEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.FigureEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - List l = CollectionsFactory.current().createList(); - l.add(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - l.add(new PolyLineFigure(20, 20)); - return new CH.ifa.draw.standard.FigureEnumerator(l); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - figureenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - figureenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method hasNextFigure() - /** - * Method testHasNextFigure is testing hasNextFigure - * @see CH.ifa.draw.standard.FigureEnumerator#hasNextFigure() - */ - // JUnitDoclet end javadoc_method hasNextFigure() - public void testHasNextFigure() throws Exception { - // JUnitDoclet begin method hasNextFigure - // JUnitDoclet end method hasNextFigure - } - - // JUnitDoclet begin javadoc_method nextFigure() - /** - * Method testNextFigure is testing nextFigure - * @see CH.ifa.draw.standard.FigureEnumerator#nextFigure() - */ - // JUnitDoclet end javadoc_method nextFigure() - public void testNextFigure() throws Exception { - // JUnitDoclet begin method nextFigure - // JUnitDoclet end method nextFigure - } - - // JUnitDoclet begin javadoc_method getEmptyEnumeration() - /** - * Method testGetEmptyEnumeration is testing getEmptyEnumeration - * @see CH.ifa.draw.standard.FigureEnumerator#getEmptyEnumeration() - */ - // JUnitDoclet end javadoc_method getEmptyEnumeration() - public void testGetEmptyEnumeration() throws Exception { - // JUnitDoclet begin method getEmptyEnumeration - // JUnitDoclet end method getEmptyEnumeration - } - - // JUnitDoclet begin javadoc_method reset() - /** - * Method testReset is testing reset - * @see CH.ifa.draw.standard.FigureEnumerator#reset() - */ - // JUnitDoclet end javadoc_method reset() - public void testReset() throws Exception { - // JUnitDoclet begin method reset - // JUnitDoclet end method reset - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/GridConstrainerTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/GridConstrainerTest.java deleted file mode 100644 index 0305c113ee11a6bae8ec9db8841ba653dcc78c5a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/GridConstrainerTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.GridConstrainer; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase GridConstrainerTest is generated by - * JUnitDoclet to hold the tests for GridConstrainer. - * @see CH.ifa.draw.standard.GridConstrainer - */ -// JUnitDoclet end javadoc_class -public class GridConstrainerTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private GridConstrainer gridconstrainer; - // JUnitDoclet end class - - /** - * Constructor GridConstrainerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public GridConstrainerTest(String name) { - // JUnitDoclet begin method GridConstrainerTest - super(name); - // JUnitDoclet end method GridConstrainerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.GridConstrainer createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.GridConstrainer(5, 5); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - gridconstrainer = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - gridconstrainer = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method constrainPoint() - /** - * Method testConstrainPoint is testing constrainPoint - * @see CH.ifa.draw.standard.GridConstrainer#constrainPoint(java.awt.Point) - */ - // JUnitDoclet end javadoc_method constrainPoint() - public void testConstrainPoint() throws Exception { - // JUnitDoclet begin method constrainPoint - // JUnitDoclet end method constrainPoint - } - - // JUnitDoclet begin javadoc_method getStepX() - /** - * Method testGetStepX is testing getStepX - * @see CH.ifa.draw.standard.GridConstrainer#getStepX() - */ - // JUnitDoclet end javadoc_method getStepX() - public void testGetStepX() throws Exception { - // JUnitDoclet begin method getStepX - // JUnitDoclet end method getStepX - } - - // JUnitDoclet begin javadoc_method getStepY() - /** - * Method testGetStepY is testing getStepY - * @see CH.ifa.draw.standard.GridConstrainer#getStepY() - */ - // JUnitDoclet end javadoc_method getStepY() - public void testGetStepY() throws Exception { - // JUnitDoclet begin method getStepY - // JUnitDoclet end method getStepY - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/HandleAndEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/HandleAndEnumeratorTest.java deleted file mode 100644 index b8df844b421260645a7d09ee99c96b3a79e2f9e2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/HandleAndEnumeratorTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; -import java.util.List; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.HandleAndEnumerator; -import CH.ifa.draw.standard.HandleEnumerator; -import CH.ifa.draw.standard.NullHandle; -import CH.ifa.draw.standard.RelativeLocator; -import CH.ifa.draw.util.CollectionsFactory; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase HandleAndEnumeratorTest is generated by - * JUnitDoclet to hold the tests for HandleAndEnumerator. - * @see CH.ifa.draw.standard.HandleAndEnumerator - */ -// JUnitDoclet end javadoc_class -public class HandleAndEnumeratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private HandleAndEnumerator handleandenumerator; - // JUnitDoclet end class - - /** - * Constructor HandleAndEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public HandleAndEnumeratorTest(String name) { - // JUnitDoclet begin method HandleAndEnumeratorTest - super(name); - // JUnitDoclet end method HandleAndEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.HandleAndEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - RectangleFigure figure1 = new RectangleFigure(new Point(15, 15), new Point(20, 20)); - List l1 = CollectionsFactory.current().createList(); - l1.add(new NullHandle(figure1, RelativeLocator.north())); - l1.add(new NullHandle(figure1, RelativeLocator.north())); - HandleEnumerator handleEnum1 = new HandleEnumerator(l1); - - RectangleFigure figure2 = new RectangleFigure(new Point(55, 55), new Point(70, 70)); - List l2 = CollectionsFactory.current().createList(); - l2.add(new NullHandle(figure2, RelativeLocator.north())); - l2.add(new NullHandle(figure2, RelativeLocator.north())); - HandleEnumerator handleEnum2 = new HandleEnumerator(l2); - return new CH.ifa.draw.standard.HandleAndEnumerator(handleEnum1, handleEnum2); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - handleandenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - handleandenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method nextHandle() - /** - * Method testNextHandle is testing nextHandle - * @see CH.ifa.draw.standard.HandleAndEnumerator#nextHandle() - */ - // JUnitDoclet end javadoc_method nextHandle() - public void testNextHandle() throws Exception { - // JUnitDoclet begin method nextHandle - // JUnitDoclet end method nextHandle - } - - // JUnitDoclet begin javadoc_method hasNextHandle() - /** - * Method testHasNextHandle is testing hasNextHandle - * @see CH.ifa.draw.standard.HandleAndEnumerator#hasNextHandle() - */ - // JUnitDoclet end javadoc_method hasNextHandle() - public void testHasNextHandle() throws Exception { - // JUnitDoclet begin method hasNextHandle - // JUnitDoclet end method hasNextHandle - } - - // JUnitDoclet begin javadoc_method toList() - /** - * Method testToList is testing toList - * @see CH.ifa.draw.standard.HandleAndEnumerator#toList() - */ - // JUnitDoclet end javadoc_method toList() - public void testToList() throws Exception { - // JUnitDoclet begin method toList - // JUnitDoclet end method toList - } - - // JUnitDoclet begin javadoc_method reset() - /** - * Method testReset is testing reset - * @see CH.ifa.draw.standard.HandleAndEnumerator#reset() - */ - // JUnitDoclet end javadoc_method reset() - public void testReset() throws Exception { - // JUnitDoclet begin method reset - // JUnitDoclet end method reset - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/HandleEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/HandleEnumeratorTest.java deleted file mode 100644 index 63242924719df460407f666f21a36a89b748c7e5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/HandleEnumeratorTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; -import java.util.List; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.HandleEnumerator; -import CH.ifa.draw.standard.NullHandle; -import CH.ifa.draw.standard.RelativeLocator; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.CollectionsFactory; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase HandleEnumeratorTest is generated by - * JUnitDoclet to hold the tests for HandleEnumerator. - * @see CH.ifa.draw.standard.HandleEnumerator - */ -// JUnitDoclet end javadoc_class -public class HandleEnumeratorTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private HandleEnumerator handleenumerator; - // JUnitDoclet end class - - /** - * Constructor HandleEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public HandleEnumeratorTest(String name) { - // JUnitDoclet begin method HandleEnumeratorTest - super(name); - // JUnitDoclet end method HandleEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.HandleEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - RectangleFigure figure = new RectangleFigure(new Point(15, 15), new Point(20, 20)); - List l = CollectionsFactory.current().createList(); - l.add(new NullHandle(figure, RelativeLocator.north())); - l.add(new NullHandle(figure, RelativeLocator.north())); - return new CH.ifa.draw.standard.HandleEnumerator(l); - //return (HandleEnumerator)figure.handles(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - handleenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - handleenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method hasNextHandle() - /** - * Method testHasNextHandle is testing hasNextHandle - * @see CH.ifa.draw.standard.HandleEnumerator#hasNextHandle() - */ - // JUnitDoclet end javadoc_method hasNextHandle() - public void testHasNextHandle() throws Exception { - // JUnitDoclet begin method hasNextHandle - // JUnitDoclet end method hasNextHandle - } - - // JUnitDoclet begin javadoc_method nextHandle() - /** - * Method testNextHandle is testing nextHandle - * @see CH.ifa.draw.standard.HandleEnumerator#nextHandle() - */ - // JUnitDoclet end javadoc_method nextHandle() - public void testNextHandle() throws Exception { - // JUnitDoclet begin method nextHandle - // JUnitDoclet end method nextHandle - } - - // JUnitDoclet begin javadoc_method toList() - /** - * Method testToList is testing toList - * @see CH.ifa.draw.standard.HandleEnumerator#toList() - */ - // JUnitDoclet end javadoc_method toList() - public void testToList() throws Exception { - // JUnitDoclet begin method toList - // JUnitDoclet end method toList - } - - // JUnitDoclet begin javadoc_method reset() - /** - * Method testReset is testing reset - * @see CH.ifa.draw.standard.HandleEnumerator#reset() - */ - // JUnitDoclet end javadoc_method reset() - public void testReset() throws Exception { - // JUnitDoclet begin method reset - // JUnitDoclet end method reset - } - - // JUnitDoclet begin javadoc_method getEmptyEnumeration() - /** - * Method testGetEmptyEnumeration is testing getEmptyEnumeration - * @see CH.ifa.draw.standard.HandleEnumerator#getEmptyEnumeration() - */ - // JUnitDoclet end javadoc_method getEmptyEnumeration() - public void testGetEmptyEnumeration() throws Exception { - // JUnitDoclet begin method getEmptyEnumeration - // JUnitDoclet end method getEmptyEnumeration - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/HandleTrackerTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/HandleTrackerTest.java deleted file mode 100644 index b523d86520ffe8d61ef614d841d96d4ee3948765..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/HandleTrackerTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.Handle; -import CH.ifa.draw.standard.HandleTracker; -import CH.ifa.draw.standard.NullHandle; -import CH.ifa.draw.standard.RelativeLocator; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase HandleTrackerTest is generated by - * JUnitDoclet to hold the tests for HandleTracker. - * @see CH.ifa.draw.standard.HandleTracker - */ -// JUnitDoclet end javadoc_class -public class HandleTrackerTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private HandleTracker handletracker; - // JUnitDoclet end class - - /** - * Constructor HandleTrackerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public HandleTrackerTest(String name) { - // JUnitDoclet begin method HandleTrackerTest - super(name); - // JUnitDoclet end method HandleTrackerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.HandleTracker createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Handle handle = new NullHandle(new RectangleFigure(new Point(10, 10), new Point(40, 40)), RelativeLocator.north()); - return new CH.ifa.draw.standard.HandleTracker(getDrawingEditor(), handle); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - handletracker = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - handletracker = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.standard.HandleTracker#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.standard.HandleTracker#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.standard.HandleTracker#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.standard.HandleTracker#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/InsertIntoDrawingVisitorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/InsertIntoDrawingVisitorTest.java deleted file mode 100644 index c5a24a94cce76f8a3fa00ff3eeda4af314b9d318..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/InsertIntoDrawingVisitorTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.InsertIntoDrawingVisitor; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase InsertIntoDrawingVisitorTest is generated by - * JUnitDoclet to hold the tests for InsertIntoDrawingVisitor. - * @see CH.ifa.draw.standard.InsertIntoDrawingVisitor - */ -// JUnitDoclet end javadoc_class -public class InsertIntoDrawingVisitorTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private InsertIntoDrawingVisitor insertintodrawingvisitor; - // JUnitDoclet end class - - /** - * Constructor InsertIntoDrawingVisitorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public InsertIntoDrawingVisitorTest(String name) { - // JUnitDoclet begin method InsertIntoDrawingVisitorTest - super(name); - // JUnitDoclet end method InsertIntoDrawingVisitorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.InsertIntoDrawingVisitor createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.InsertIntoDrawingVisitor(getDrawingEditor().view().drawing()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - getDrawingEditor().open(); - insertintodrawingvisitor = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - insertintodrawingvisitor = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method visitFigure() - /** - * Method testVisitFigure is testing visitFigure - * @see CH.ifa.draw.standard.InsertIntoDrawingVisitor#visitFigure(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method visitFigure() - public void testVisitFigure() throws Exception { - // JUnitDoclet begin method visitFigure - // JUnitDoclet end method visitFigure - } - - // JUnitDoclet begin javadoc_method visitHandle() - /** - * Method testVisitHandle is testing visitHandle - * @see CH.ifa.draw.standard.InsertIntoDrawingVisitor#visitHandle(CH.ifa.draw.framework.Handle) - */ - // JUnitDoclet end javadoc_method visitHandle() - public void testVisitHandle() throws Exception { - // JUnitDoclet begin method visitHandle - // JUnitDoclet end method visitHandle - } - - // JUnitDoclet begin javadoc_method visitFigureChangeListener() - /** - * Method testVisitFigureChangeListener is testing visitFigureChangeListener - * @see CH.ifa.draw.standard.InsertIntoDrawingVisitor#visitFigureChangeListener(CH.ifa.draw.framework.FigureChangeListener) - */ - // JUnitDoclet end javadoc_method visitFigureChangeListener() - public void testVisitFigureChangeListener() throws Exception { - // JUnitDoclet begin method visitFigureChangeListener - // JUnitDoclet end method visitFigureChangeListener - } - - // JUnitDoclet begin javadoc_method getInsertedFigures() - /** - * Method testGetInsertedFigures is testing getInsertedFigures - * @see CH.ifa.draw.standard.InsertIntoDrawingVisitor#getInsertedFigures() - */ - // JUnitDoclet end javadoc_method getInsertedFigures() - public void testGetInsertedFigures() throws Exception { - // JUnitDoclet begin method getInsertedFigures - // JUnitDoclet end method getInsertedFigures - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/LocatorConnectorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/LocatorConnectorTest.java deleted file mode 100644 index 348b5bc2a6fe4986c0e452279f4aa48838212420..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/LocatorConnectorTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.LocatorConnector; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase LocatorConnectorTest is generated by - * JUnitDoclet to hold the tests for LocatorConnector. - * @see CH.ifa.draw.standard.LocatorConnector - */ -// JUnitDoclet end javadoc_class -public class LocatorConnectorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private LocatorConnector locatorconnector; - // JUnitDoclet end class - - /** - * Constructor LocatorConnectorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public LocatorConnectorTest(String name) { - // JUnitDoclet begin method LocatorConnectorTest - super(name); - // JUnitDoclet end method LocatorConnectorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.LocatorConnector createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.LocatorConnector(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - locatorconnector = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - locatorconnector = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.standard.LocatorConnector#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.standard.LocatorConnector#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.LocatorConnector#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.standard.LocatorConnector#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.standard.LocatorConnector#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method getLocator() - /** - * Method testGetLocator is testing getLocator - * @see CH.ifa.draw.standard.LocatorConnector#getLocator() - */ - // JUnitDoclet end javadoc_method getLocator() - public void testGetLocator() throws Exception { - // JUnitDoclet begin method getLocator - // JUnitDoclet end method getLocator - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/LocatorHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/LocatorHandleTest.java deleted file mode 100644 index 128aa9eb42476729344ab0499f042133f78159f0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/LocatorHandleTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.LocatorHandle; -import CH.ifa.draw.standard.RelativeLocator; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase LocatorHandleTest is generated by - * JUnitDoclet to hold the tests for LocatorHandle. - * @see CH.ifa.draw.standard.LocatorHandle - */ -// JUnitDoclet end javadoc_class -public class LocatorHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private LocatorHandle locatorhandle; - // JUnitDoclet end class - - /** - * Constructor LocatorHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public LocatorHandleTest(String name) { - // JUnitDoclet begin method LocatorHandleTest - super(name); - // JUnitDoclet end method LocatorHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.LocatorHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.LocatorHandle(new RectangleFigure(new Point(), new Point()), new RelativeLocator(1.0, 2.0)); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - locatorhandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - locatorhandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getLocator() - /** - * Method testGetLocator is testing getLocator - * @see CH.ifa.draw.standard.LocatorHandle#getLocator() - */ - // JUnitDoclet end javadoc_method getLocator() - public void testGetLocator() throws Exception { - // JUnitDoclet begin method getLocator - // JUnitDoclet end method getLocator - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.standard.LocatorHandle#locate() - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/NullDrawingViewTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/NullDrawingViewTest.java deleted file mode 100644 index ce208c43b4f7d1346d8aedb41a6f12991972b1ed..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/NullDrawingViewTest.java +++ /dev/null @@ -1,650 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.NullDrawingView; -import CH.ifa.draw.standard.SimpleUpdateStrategy; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NullDrawingViewTest is generated by - * JUnitDoclet to hold the tests for NullDrawingView. - * @see CH.ifa.draw.standard.NullDrawingView - */ -// JUnitDoclet end javadoc_class -public class NullDrawingViewTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NullDrawingView nulldrawingview; - // JUnitDoclet end class - - /** - * Constructor NullDrawingViewTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NullDrawingViewTest(String name) { - // JUnitDoclet begin method NullDrawingViewTest - super(name); - // JUnitDoclet end method NullDrawingViewTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.NullDrawingView createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return (NullDrawingView)NullDrawingView.getManagedDrawingView(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nulldrawingview = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nulldrawingview = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setEditor() - /** - * Method testSetEditor is testing setEditor - * @see CH.ifa.draw.standard.NullDrawingView#setEditor(CH.ifa.draw.framework.DrawingEditor) - */ - // JUnitDoclet end javadoc_method setEditor() - public void testSetEditor() throws Exception { - // JUnitDoclet begin method setEditor - // JUnitDoclet end method setEditor - } - - // JUnitDoclet begin javadoc_method tool() - /** - * Method testTool is testing tool - * @see CH.ifa.draw.standard.NullDrawingView#tool() - */ - // JUnitDoclet end javadoc_method tool() - public void testTool() throws Exception { - // JUnitDoclet begin method tool - // JUnitDoclet end method tool - } - - // JUnitDoclet begin javadoc_method drawing() - /** - * Method testDrawing is testing drawing - * @see CH.ifa.draw.standard.NullDrawingView#drawing() - */ - // JUnitDoclet end javadoc_method drawing() - public void testDrawing() throws Exception { - // JUnitDoclet begin method drawing - // JUnitDoclet end method drawing - } - - // JUnitDoclet begin javadoc_method setDrawing() - /** - * Method testSetDrawing is testing setDrawing - * @see CH.ifa.draw.standard.NullDrawingView#setDrawing(CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method setDrawing() - public void testSetDrawing() throws Exception { - // JUnitDoclet begin method setDrawing - // JUnitDoclet end method setDrawing - } - - // JUnitDoclet begin javadoc_method editor() - /** - * Method testEditor is testing editor - * @see CH.ifa.draw.standard.NullDrawingView#editor() - */ - // JUnitDoclet end javadoc_method editor() - public void testEditor() throws Exception { - // JUnitDoclet begin method editor - // JUnitDoclet end method editor - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.standard.NullDrawingView#add(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.standard.NullDrawingView#remove(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method addAll() - /** - * Method testAddAll is testing addAll - * @see CH.ifa.draw.standard.NullDrawingView#addAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method addAll() - public void testAddAll() throws Exception { - // JUnitDoclet begin method addAll - // JUnitDoclet end method addAll - } - - // JUnitDoclet begin javadoc_method getSize() - /** - * Method testGetSize is testing getSize - * @see CH.ifa.draw.standard.NullDrawingView#getSize() - */ - // JUnitDoclet end javadoc_method getSize() - public void testGetSize() throws Exception { - // JUnitDoclet begin method getSize - // JUnitDoclet end method getSize - } - - // JUnitDoclet begin javadoc_method getMinimumSize() - /** - * Method testGetMinimumSize is testing getMinimumSize - * @see CH.ifa.draw.standard.NullDrawingView#getMinimumSize() - */ - // JUnitDoclet end javadoc_method getMinimumSize() - public void testGetMinimumSize() throws Exception { - // JUnitDoclet begin method getMinimumSize - // JUnitDoclet end method getMinimumSize - } - - // JUnitDoclet begin javadoc_method getPreferredSize() - /** - * Method testGetPreferredSize is testing getPreferredSize - * @see CH.ifa.draw.standard.NullDrawingView#getPreferredSize() - */ - // JUnitDoclet end javadoc_method getPreferredSize() - public void testGetPreferredSize() throws Exception { - // JUnitDoclet begin method getPreferredSize - // JUnitDoclet end method getPreferredSize - } - - // JUnitDoclet begin javadoc_method setDisplayUpdate() - /** - * Method testSetGetDisplayUpdate is testing setDisplayUpdate - * and getDisplayUpdate together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.standard.NullDrawingView#setDisplayUpdate(CH.ifa.draw.framework.Painter) - * @see CH.ifa.draw.standard.NullDrawingView#getDisplayUpdate() - */ - // JUnitDoclet end javadoc_method setDisplayUpdate() - public void testSetGetDisplayUpdate() throws Exception { - // JUnitDoclet begin method setDisplayUpdate getDisplayUpdate - CH.ifa.draw.framework.Painter[] tests = { new SimpleUpdateStrategy(), null }; - - for (int i = 0; i < tests.length; i++) { - nulldrawingview.setDisplayUpdate(tests[i]); - assertEquals(tests[i], nulldrawingview.getDisplayUpdate()); - } - // JUnitDoclet end method setDisplayUpdate getDisplayUpdate - } - - // JUnitDoclet begin javadoc_method selection() - /** - * Method testSelection is testing selection - * @see CH.ifa.draw.standard.NullDrawingView#selection() - */ - // JUnitDoclet end javadoc_method selection() - public void testSelection() throws Exception { - // JUnitDoclet begin method selection - // JUnitDoclet end method selection - } - - // JUnitDoclet begin javadoc_method selectionZOrdered() - /** - * Method testSelectionZOrdered is testing selectionZOrdered - * @see CH.ifa.draw.standard.NullDrawingView#selectionZOrdered() - */ - // JUnitDoclet end javadoc_method selectionZOrdered() - public void testSelectionZOrdered() throws Exception { - // JUnitDoclet begin method selectionZOrdered - // JUnitDoclet end method selectionZOrdered - } - - // JUnitDoclet begin javadoc_method selectionCount() - /** - * Method testSelectionCount is testing selectionCount - * @see CH.ifa.draw.standard.NullDrawingView#selectionCount() - */ - // JUnitDoclet end javadoc_method selectionCount() - public void testSelectionCount() throws Exception { - // JUnitDoclet begin method selectionCount - // JUnitDoclet end method selectionCount - } - - // JUnitDoclet begin javadoc_method isFigureSelected() - /** - * Method testIsFigureSelected is testing isFigureSelected - * @see CH.ifa.draw.standard.NullDrawingView#isFigureSelected(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method isFigureSelected() - public void testIsFigureSelected() throws Exception { - // JUnitDoclet begin method isFigureSelected - // JUnitDoclet end method isFigureSelected - } - - // JUnitDoclet begin javadoc_method addToSelection() - /** - * Method testAddToSelection is testing addToSelection - * @see CH.ifa.draw.standard.NullDrawingView#addToSelection(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method addToSelection() - public void testAddToSelection() throws Exception { - // JUnitDoclet begin method addToSelection - // JUnitDoclet end method addToSelection - } - - // JUnitDoclet begin javadoc_method addToSelectionAll() - /** - * Method testAddToSelectionAll is testing addToSelectionAll - * @see CH.ifa.draw.standard.NullDrawingView#addToSelectionAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method addToSelectionAll() - public void testAddToSelectionAll() throws Exception { - // JUnitDoclet begin method addToSelectionAll - // JUnitDoclet end method addToSelectionAll - } - - // JUnitDoclet begin javadoc_method removeFromSelection() - /** - * Method testRemoveFromSelection is testing removeFromSelection - * @see CH.ifa.draw.standard.NullDrawingView#removeFromSelection(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method removeFromSelection() - public void testRemoveFromSelection() throws Exception { - // JUnitDoclet begin method removeFromSelection - // JUnitDoclet end method removeFromSelection - } - - // JUnitDoclet begin javadoc_method toggleSelection() - /** - * Method testToggleSelection is testing toggleSelection - * @see CH.ifa.draw.standard.NullDrawingView#toggleSelection(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method toggleSelection() - public void testToggleSelection() throws Exception { - // JUnitDoclet begin method toggleSelection - // JUnitDoclet end method toggleSelection - } - - // JUnitDoclet begin javadoc_method clearSelection() - /** - * Method testClearSelection is testing clearSelection - * @see CH.ifa.draw.standard.NullDrawingView#clearSelection() - */ - // JUnitDoclet end javadoc_method clearSelection() - public void testClearSelection() throws Exception { - // JUnitDoclet begin method clearSelection - // JUnitDoclet end method clearSelection - } - - // JUnitDoclet begin javadoc_method getFigureSelection() - /** - * Method testGetFigureSelection is testing getFigureSelection - * @see CH.ifa.draw.standard.NullDrawingView#getFigureSelection() - */ - // JUnitDoclet end javadoc_method getFigureSelection() - public void testGetFigureSelection() throws Exception { - // JUnitDoclet begin method getFigureSelection - // JUnitDoclet end method getFigureSelection - } - - // JUnitDoclet begin javadoc_method findHandle() - /** - * Method testFindHandle is testing findHandle - * @see CH.ifa.draw.standard.NullDrawingView#findHandle(int, int) - */ - // JUnitDoclet end javadoc_method findHandle() - public void testFindHandle() throws Exception { - // JUnitDoclet begin method findHandle - // JUnitDoclet end method findHandle - } - - // JUnitDoclet begin javadoc_method lastClick() - /** - * Method testLastClick is testing lastClick - * @see CH.ifa.draw.standard.NullDrawingView#lastClick() - */ - // JUnitDoclet end javadoc_method lastClick() - public void testLastClick() throws Exception { - // JUnitDoclet begin method lastClick - // JUnitDoclet end method lastClick - } - - // JUnitDoclet begin javadoc_method setConstrainer() - /** - * NullDrawingView.setConstrainer is a no-op. - * - * @see CH.ifa.draw.standard.NullDrawingView#setConstrainer(CH.ifa.draw.framework.PointConstrainer) - * @see CH.ifa.draw.standard.NullDrawingView#getConstrainer() - */ - // JUnitDoclet end javadoc_method setConstrainer() - public void testSetGetConstrainer() throws Exception { - // JUnitDoclet begin method setConstrainer getConstrainer - // Do nothing: NullDrawingView.setConstrainer is a no-op. - // JUnitDoclet end method setConstrainer getConstrainer - } - - // JUnitDoclet begin javadoc_method checkDamage() - /** - * Method testCheckDamage is testing checkDamage - * @see CH.ifa.draw.standard.NullDrawingView#checkDamage() - */ - // JUnitDoclet end javadoc_method checkDamage() - public void testCheckDamage() throws Exception { - // JUnitDoclet begin method checkDamage - // JUnitDoclet end method checkDamage - } - - // JUnitDoclet begin javadoc_method repairDamage() - /** - * Method testRepairDamage is testing repairDamage - * @see CH.ifa.draw.standard.NullDrawingView#repairDamage() - */ - // JUnitDoclet end javadoc_method repairDamage() - public void testRepairDamage() throws Exception { - // JUnitDoclet begin method repairDamage - // JUnitDoclet end method repairDamage - } - - // JUnitDoclet begin javadoc_method paint() - /** - * Method testPaint is testing paint - * @see CH.ifa.draw.standard.NullDrawingView#paint(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method paint() - public void testPaint() throws Exception { - // JUnitDoclet begin method paint - // JUnitDoclet end method paint - } - - // JUnitDoclet begin javadoc_method createImage() - /** - * Method testCreateImage is testing createImage - * @see CH.ifa.draw.standard.NullDrawingView#createImage(int, int) - */ - // JUnitDoclet end javadoc_method createImage() - public void testCreateImage() throws Exception { - // JUnitDoclet begin method createImage - // JUnitDoclet end method createImage - } - - // JUnitDoclet begin javadoc_method getGraphics() - /** - * Method testGetGraphics is testing getGraphics - * @see CH.ifa.draw.standard.NullDrawingView#getGraphics() - */ - // JUnitDoclet end javadoc_method getGraphics() - public void testGetGraphics() throws Exception { - // JUnitDoclet begin method getGraphics - // JUnitDoclet end method getGraphics - } - - // JUnitDoclet begin javadoc_method setBackground() - /** - * Method testSetGetBackground is testing setBackground - * and getBackground together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.standard.NullDrawingView#setBackground(java.awt.Color) - * @see CH.ifa.draw.standard.NullDrawingView#getBackground() - */ - // JUnitDoclet end javadoc_method setBackground() - public void testSetGetBackground() throws Exception { - // JUnitDoclet begin method setBackground getBackground - java.awt.Color[] tests = { java.awt.Color.BLACK, null }; - - for (int i = 0; i < tests.length; i++) { - nulldrawingview.setBackground(tests[i]); - assertEquals(tests[i], nulldrawingview.getBackground()); - } - // JUnitDoclet end method setBackground getBackground - } - - // JUnitDoclet begin javadoc_method drawAll() - /** - * Method testDrawAll is testing drawAll - * @see CH.ifa.draw.standard.NullDrawingView#drawAll(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawAll() - public void testDrawAll() throws Exception { - // JUnitDoclet begin method drawAll - // JUnitDoclet end method drawAll - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.NullDrawingView#draw(java.awt.Graphics, CH.ifa.draw.framework.FigureEnumeration) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method drawHandles() - /** - * Method testDrawHandles is testing drawHandles - * @see CH.ifa.draw.standard.NullDrawingView#drawHandles(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawHandles() - public void testDrawHandles() throws Exception { - // JUnitDoclet begin method drawHandles - // JUnitDoclet end method drawHandles - } - - // JUnitDoclet begin javadoc_method drawDrawing() - /** - * Method testDrawDrawing is testing drawDrawing - * @see CH.ifa.draw.standard.NullDrawingView#drawDrawing(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawDrawing() - public void testDrawDrawing() throws Exception { - // JUnitDoclet begin method drawDrawing - // JUnitDoclet end method drawDrawing - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.standard.NullDrawingView#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method setCursor() - /** - * Method testSetCursor is testing setCursor - * @see CH.ifa.draw.standard.NullDrawingView#setCursor(java.awt.Cursor) - */ - // JUnitDoclet end javadoc_method setCursor() - public void testSetCursor() throws Exception { - // JUnitDoclet begin method setCursor - // JUnitDoclet end method setCursor - } - - // JUnitDoclet begin javadoc_method freezeView() - /** - * Method testFreezeView is testing freezeView - * @see CH.ifa.draw.standard.NullDrawingView#freezeView() - */ - // JUnitDoclet end javadoc_method freezeView() - public void testFreezeView() throws Exception { - // JUnitDoclet begin method freezeView - // JUnitDoclet end method freezeView - } - - // JUnitDoclet begin javadoc_method unfreezeView() - /** - * Method testUnfreezeView is testing unfreezeView - * @see CH.ifa.draw.standard.NullDrawingView#unfreezeView() - */ - // JUnitDoclet end javadoc_method unfreezeView() - public void testUnfreezeView() throws Exception { - // JUnitDoclet begin method unfreezeView - // JUnitDoclet end method unfreezeView - } - - // JUnitDoclet begin javadoc_method addFigureSelectionListener() - /** - * Method testAddFigureSelectionListener is testing addFigureSelectionListener - * @see CH.ifa.draw.standard.NullDrawingView#addFigureSelectionListener(CH.ifa.draw.framework.FigureSelectionListener) - */ - // JUnitDoclet end javadoc_method addFigureSelectionListener() - public void testAddFigureSelectionListener() throws Exception { - // JUnitDoclet begin method addFigureSelectionListener - // JUnitDoclet end method addFigureSelectionListener - } - - // JUnitDoclet begin javadoc_method removeFigureSelectionListener() - /** - * Method testRemoveFigureSelectionListener is testing removeFigureSelectionListener - * @see CH.ifa.draw.standard.NullDrawingView#removeFigureSelectionListener(CH.ifa.draw.framework.FigureSelectionListener) - */ - // JUnitDoclet end javadoc_method removeFigureSelectionListener() - public void testRemoveFigureSelectionListener() throws Exception { - // JUnitDoclet begin method removeFigureSelectionListener - // JUnitDoclet end method removeFigureSelectionListener - } - - // JUnitDoclet begin javadoc_method getConnectionFigures() - /** - * Method testGetConnectionFigures is testing getConnectionFigures - * @see CH.ifa.draw.standard.NullDrawingView#getConnectionFigures(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method getConnectionFigures() - public void testGetConnectionFigures() throws Exception { - // JUnitDoclet begin method getConnectionFigures - // JUnitDoclet end method getConnectionFigures - } - - // JUnitDoclet begin javadoc_method insertFigures() - /** - * Method testInsertFigures is testing insertFigures - * @see CH.ifa.draw.standard.NullDrawingView#insertFigures(CH.ifa.draw.framework.FigureEnumeration, int, int, boolean) - */ - // JUnitDoclet end javadoc_method insertFigures() - public void testInsertFigures() throws Exception { - // JUnitDoclet begin method insertFigures - // JUnitDoclet end method insertFigures - } - - // JUnitDoclet begin javadoc_method drawingInvalidated() - /** - * Method testDrawingInvalidated is testing drawingInvalidated - * @see CH.ifa.draw.standard.NullDrawingView#drawingInvalidated(CH.ifa.draw.framework.DrawingChangeEvent) - */ - // JUnitDoclet end javadoc_method drawingInvalidated() - public void testDrawingInvalidated() throws Exception { - // JUnitDoclet begin method drawingInvalidated - // JUnitDoclet end method drawingInvalidated - } - - // JUnitDoclet begin javadoc_method drawingRequestUpdate() - /** - * Method testDrawingRequestUpdate is testing drawingRequestUpdate - * @see CH.ifa.draw.standard.NullDrawingView#drawingRequestUpdate(CH.ifa.draw.framework.DrawingChangeEvent) - */ - // JUnitDoclet end javadoc_method drawingRequestUpdate() - public void testDrawingRequestUpdate() throws Exception { - // JUnitDoclet begin method drawingRequestUpdate - // JUnitDoclet end method drawingRequestUpdate - } - - // JUnitDoclet begin javadoc_method drawingTitleChanged() - /** - * Method testDrawingTitleChanged is testing drawingTitleChanged - * @see CH.ifa.draw.standard.NullDrawingView#drawingTitleChanged(CH.ifa.draw.framework.DrawingChangeEvent) - */ - // JUnitDoclet end javadoc_method drawingTitleChanged() - public void testDrawingTitleChanged() throws Exception { - // JUnitDoclet begin method drawingTitleChanged - // JUnitDoclet end method drawingTitleChanged - } - - // JUnitDoclet begin javadoc_method isInteractive() - /** - * Method testIsInteractive is testing isInteractive - * @see CH.ifa.draw.standard.NullDrawingView#isInteractive() - */ - // JUnitDoclet end javadoc_method isInteractive() - public void testIsInteractive() throws Exception { - // JUnitDoclet begin method isInteractive - // JUnitDoclet end method isInteractive - } - - // JUnitDoclet begin javadoc_method getManagedDrawingView() - /** - * Method testGetManagedDrawingView is testing getManagedDrawingView - * @see CH.ifa.draw.standard.NullDrawingView#getManagedDrawingView(CH.ifa.draw.framework.DrawingEditor) - */ - // JUnitDoclet end javadoc_method getManagedDrawingView() - public void testGetManagedDrawingView() throws Exception { - // JUnitDoclet begin method getManagedDrawingView - // JUnitDoclet end method getManagedDrawingView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/NullHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/NullHandleTest.java deleted file mode 100644 index 99d104fd72438a58a079ef7fd29bc4ffa47224a6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/NullHandleTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.NullHandle; -import CH.ifa.draw.standard.RelativeLocator; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NullHandleTest is generated by - * JUnitDoclet to hold the tests for NullHandle. - * @see CH.ifa.draw.standard.NullHandle - */ -// JUnitDoclet end javadoc_class -public class NullHandleTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NullHandle nullhandle; - // JUnitDoclet end class - - /** - * Constructor NullHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NullHandleTest(String name) { - // JUnitDoclet begin method NullHandleTest - super(name); - // JUnitDoclet end method NullHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.NullHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.NullHandle(new RectangleFigure(new Point(5, 5), new Point(100, 100)), new RelativeLocator()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nullhandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nullhandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.NullHandle#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/NullToolTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/NullToolTest.java deleted file mode 100644 index 04cbfd9b376b3e63deaa1779d19683e35d5918c9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/NullToolTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.NullTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase NullToolTest is generated by - * JUnitDoclet to hold the tests for NullTool. - * @see CH.ifa.draw.standard.NullTool - */ -// JUnitDoclet end javadoc_class -public class NullToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private NullTool nulltool; - // JUnitDoclet end class - - /** - * Constructor NullToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public NullToolTest(String name) { - // JUnitDoclet begin method NullToolTest - super(name); - // JUnitDoclet end method NullToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.NullTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.NullTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - nulltool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - nulltool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.standard.NullTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.standard.NullTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/OffsetLocatorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/OffsetLocatorTest.java deleted file mode 100644 index a3a4eca2db0434c8cc37dc10d772e0992cecabbe..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/OffsetLocatorTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.OffsetLocator; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase OffsetLocatorTest is generated by - * JUnitDoclet to hold the tests for OffsetLocator. - * @see CH.ifa.draw.standard.OffsetLocator - */ -// JUnitDoclet end javadoc_class -public class OffsetLocatorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private OffsetLocator offsetlocator; - // JUnitDoclet end class - - /** - * Constructor OffsetLocatorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public OffsetLocatorTest(String name) { - // JUnitDoclet begin method OffsetLocatorTest - super(name); - // JUnitDoclet end method OffsetLocatorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.OffsetLocator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.OffsetLocator(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - offsetlocator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - offsetlocator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.standard.OffsetLocator#locate(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method moveBy() - /** - * Method testMoveBy is testing moveBy - * @see CH.ifa.draw.standard.OffsetLocator#moveBy(int, int) - */ - // JUnitDoclet end javadoc_method moveBy() - public void testMoveBy() throws Exception { - // JUnitDoclet begin method moveBy - // JUnitDoclet end method moveBy - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.standard.OffsetLocator#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.standard.OffsetLocator#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/PasteCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/PasteCommandTest.java deleted file mode 100644 index 96f12690adf49da0da6af1447db95b2d8f53ee83..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/PasteCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.PasteCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PasteCommandTest is generated by - * JUnitDoclet to hold the tests for PasteCommand. - * @see CH.ifa.draw.standard.PasteCommand - */ -// JUnitDoclet end javadoc_class -public class PasteCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PasteCommand pastecommand; - // JUnitDoclet end class - - /** - * Constructor PasteCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PasteCommandTest(String name) { - // JUnitDoclet begin method PasteCommandTest - super(name); - // JUnitDoclet end method PasteCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.PasteCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.PasteCommand("TestPaste", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - pastecommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - pastecommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.PasteCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.standard.PasteCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/PeripheralLocatorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/PeripheralLocatorTest.java deleted file mode 100644 index 0fe9ec0e17c689f79f44d08efdffffeae57afe50..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/PeripheralLocatorTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.PeripheralLocator; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PeripheralLocatorTest is generated by - * JUnitDoclet to hold the tests for PeripheralLocator. - * @see CH.ifa.draw.standard.PeripheralLocator - */ -// JUnitDoclet end javadoc_class -public class PeripheralLocatorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PeripheralLocator peripherallocator; - // JUnitDoclet end class - - /** - * Constructor PeripheralLocatorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PeripheralLocatorTest(String name) { - // JUnitDoclet begin method PeripheralLocatorTest - super(name); - // JUnitDoclet end method PeripheralLocatorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.PeripheralLocator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.PeripheralLocator(5, 10); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - peripherallocator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - peripherallocator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.standard.PeripheralLocator#locate(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/RelativeLocatorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/RelativeLocatorTest.java deleted file mode 100644 index 3b823d8fde285c1dd95a2a9d4c0f4f3fcb29ee9b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/RelativeLocatorTest.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.RelativeLocator; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase RelativeLocatorTest is generated by - * JUnitDoclet to hold the tests for RelativeLocator. - * @see CH.ifa.draw.standard.RelativeLocator - */ -// JUnitDoclet end javadoc_class -public class RelativeLocatorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private RelativeLocator relativelocator; - // JUnitDoclet end class - - /** - * Constructor RelativeLocatorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public RelativeLocatorTest(String name) { - // JUnitDoclet begin method RelativeLocatorTest - super(name); - // JUnitDoclet end method RelativeLocatorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.RelativeLocator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.RelativeLocator(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - relativelocator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - relativelocator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method equals() - /** - * Method testEquals is testing equals - * @see CH.ifa.draw.standard.RelativeLocator#equals(java.lang.Object) - */ - // JUnitDoclet end javadoc_method equals() - public void testEquals() throws Exception { - // JUnitDoclet begin method equals - // JUnitDoclet end method equals - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.standard.RelativeLocator#locate(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method write() - /** - * Method testWrite is testing write - * @see CH.ifa.draw.standard.RelativeLocator#write(CH.ifa.draw.util.StorableOutput) - */ - // JUnitDoclet end javadoc_method write() - public void testWrite() throws Exception { - // JUnitDoclet begin method write - // JUnitDoclet end method write - } - - // JUnitDoclet begin javadoc_method read() - /** - * Method testRead is testing read - * @see CH.ifa.draw.standard.RelativeLocator#read(CH.ifa.draw.util.StorableInput) - */ - // JUnitDoclet end javadoc_method read() - public void testRead() throws Exception { - // JUnitDoclet begin method read - // JUnitDoclet end method read - } - - // JUnitDoclet begin javadoc_method east() - /** - * Method testEast is testing east - * @see CH.ifa.draw.standard.RelativeLocator#east() - */ - // JUnitDoclet end javadoc_method east() - public void testEast() throws Exception { - // JUnitDoclet begin method east - // JUnitDoclet end method east - } - - // JUnitDoclet begin javadoc_method north() - /** - * Method testNorth is testing north - * @see CH.ifa.draw.standard.RelativeLocator#north() - */ - // JUnitDoclet end javadoc_method north() - public void testNorth() throws Exception { - // JUnitDoclet begin method north - // JUnitDoclet end method north - } - - // JUnitDoclet begin javadoc_method west() - /** - * Method testWest is testing west - * @see CH.ifa.draw.standard.RelativeLocator#west() - */ - // JUnitDoclet end javadoc_method west() - public void testWest() throws Exception { - // JUnitDoclet begin method west - // JUnitDoclet end method west - } - - // JUnitDoclet begin javadoc_method northEast() - /** - * Method testNorthEast is testing northEast - * @see CH.ifa.draw.standard.RelativeLocator#northEast() - */ - // JUnitDoclet end javadoc_method northEast() - public void testNorthEast() throws Exception { - // JUnitDoclet begin method northEast - // JUnitDoclet end method northEast - } - - // JUnitDoclet begin javadoc_method northWest() - /** - * Method testNorthWest is testing northWest - * @see CH.ifa.draw.standard.RelativeLocator#northWest() - */ - // JUnitDoclet end javadoc_method northWest() - public void testNorthWest() throws Exception { - // JUnitDoclet begin method northWest - // JUnitDoclet end method northWest - } - - // JUnitDoclet begin javadoc_method south() - /** - * Method testSouth is testing south - * @see CH.ifa.draw.standard.RelativeLocator#south() - */ - // JUnitDoclet end javadoc_method south() - public void testSouth() throws Exception { - // JUnitDoclet begin method south - // JUnitDoclet end method south - } - - // JUnitDoclet begin javadoc_method southEast() - /** - * Method testSouthEast is testing southEast - * @see CH.ifa.draw.standard.RelativeLocator#southEast() - */ - // JUnitDoclet end javadoc_method southEast() - public void testSouthEast() throws Exception { - // JUnitDoclet begin method southEast - // JUnitDoclet end method southEast - } - - // JUnitDoclet begin javadoc_method southWest() - /** - * Method testSouthWest is testing southWest - * @see CH.ifa.draw.standard.RelativeLocator#southWest() - */ - // JUnitDoclet end javadoc_method southWest() - public void testSouthWest() throws Exception { - // JUnitDoclet begin method southWest - // JUnitDoclet end method southWest - } - - // JUnitDoclet begin javadoc_method center() - /** - * Method testCenter is testing center - * @see CH.ifa.draw.standard.RelativeLocator#center() - */ - // JUnitDoclet end javadoc_method center() - public void testCenter() throws Exception { - // JUnitDoclet begin method center - // JUnitDoclet end method center - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ReverseFigureEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ReverseFigureEnumeratorTest.java deleted file mode 100644 index 35dbdc58d8dc0ed1187cff022f46d05c97d5d6c8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ReverseFigureEnumeratorTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; -import java.util.List; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.PolyLineFigure; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.ReverseFigureEnumerator; -import CH.ifa.draw.util.CollectionsFactory; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ReverseFigureEnumeratorTest is generated by - * JUnitDoclet to hold the tests for ReverseFigureEnumerator. - * @see CH.ifa.draw.standard.ReverseFigureEnumerator - */ -// JUnitDoclet end javadoc_class -public class ReverseFigureEnumeratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ReverseFigureEnumerator reversefigureenumerator; - // JUnitDoclet end class - - /** - * Constructor ReverseFigureEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ReverseFigureEnumeratorTest(String name) { - // JUnitDoclet begin method ReverseFigureEnumeratorTest - super(name); - // JUnitDoclet end method ReverseFigureEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ReverseFigureEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - List l = CollectionsFactory.current().createList(); - l.add(new RectangleFigure(new Point(10, 10), new Point(50, 50))); - l.add(new PolyLineFigure()); - return new CH.ifa.draw.standard.ReverseFigureEnumerator(l); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - reversefigureenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - reversefigureenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method hasNextFigure() - /** - * Method testHasNextFigure is testing hasNextFigure - * @see CH.ifa.draw.standard.ReverseFigureEnumerator#hasNextFigure() - */ - // JUnitDoclet end javadoc_method hasNextFigure() - public void testHasNextFigure() throws Exception { - // JUnitDoclet begin method hasNextFigure - // JUnitDoclet end method hasNextFigure - } - - // JUnitDoclet begin javadoc_method nextFigure() - /** - * Method testNextFigure is testing nextFigure - * @see CH.ifa.draw.standard.ReverseFigureEnumerator#nextFigure() - */ - // JUnitDoclet end javadoc_method nextFigure() - public void testNextFigure() throws Exception { - // JUnitDoclet begin method nextFigure - // JUnitDoclet end method nextFigure - } - - // JUnitDoclet begin javadoc_method reset() - /** - * Method testReset is testing reset - * @see CH.ifa.draw.standard.ReverseFigureEnumerator#reset() - */ - // JUnitDoclet end javadoc_method reset() - public void testReset() throws Exception { - // JUnitDoclet begin method reset - // JUnitDoclet end method reset - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/SelectAllCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/SelectAllCommandTest.java deleted file mode 100644 index b601eb5669981a1a462621bd07272dbdb6c7f6a2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/SelectAllCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.SelectAllCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SelectAllCommandTest is generated by - * JUnitDoclet to hold the tests for SelectAllCommand. - * @see CH.ifa.draw.standard.SelectAllCommand - */ -// JUnitDoclet end javadoc_class -public class SelectAllCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SelectAllCommand selectallcommand; - // JUnitDoclet end class - - /** - * Constructor SelectAllCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SelectAllCommandTest(String name) { - // JUnitDoclet begin method SelectAllCommandTest - super(name); - // JUnitDoclet end method SelectAllCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.SelectAllCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.SelectAllCommand("TestSelectAll", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - selectallcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - selectallcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.SelectAllCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.standard.SelectAllCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/SelectAreaTrackerTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/SelectAreaTrackerTest.java deleted file mode 100644 index 412bef6549f8961343341a15eb66322b04e528b6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/SelectAreaTrackerTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.SelectAreaTracker; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SelectAreaTrackerTest is generated by - * JUnitDoclet to hold the tests for SelectAreaTracker. - * @see CH.ifa.draw.standard.SelectAreaTracker - */ -// JUnitDoclet end javadoc_class -public class SelectAreaTrackerTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SelectAreaTracker selectareatracker; - // JUnitDoclet end class - - /** - * Constructor SelectAreaTrackerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SelectAreaTrackerTest(String name) { - // JUnitDoclet begin method SelectAreaTrackerTest - super(name); - // JUnitDoclet end method SelectAreaTrackerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.SelectAreaTracker createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.SelectAreaTracker(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - selectareatracker = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - selectareatracker = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.standard.SelectAreaTracker#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.standard.SelectAreaTracker#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.standard.SelectAreaTracker#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/SelectionToolTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/SelectionToolTest.java deleted file mode 100644 index cbd639694818dd72333aad53232f2e7b3154c948..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/SelectionToolTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.SelectionTool; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SelectionToolTest is generated by - * JUnitDoclet to hold the tests for SelectionTool. - * @see CH.ifa.draw.standard.SelectionTool - */ -// JUnitDoclet end javadoc_class -public class SelectionToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SelectionTool selectiontool; - // JUnitDoclet end class - - /** - * Constructor SelectionToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SelectionToolTest(String name) { - // JUnitDoclet begin method SelectionToolTest - super(name); - // JUnitDoclet end method SelectionToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.SelectionTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.SelectionTool(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - selectiontool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - selectiontool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.standard.SelectionTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.standard.SelectionTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.standard.SelectionTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.standard.SelectionTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/SendToBackCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/SendToBackCommandTest.java deleted file mode 100644 index b871b15fb95496fa3420d7c488d63a0ca863dacf..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/SendToBackCommandTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.SendToBackCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SendToBackCommandTest is generated by - * JUnitDoclet to hold the tests for SendToBackCommand. - * @see CH.ifa.draw.standard.SendToBackCommand - */ -// JUnitDoclet end javadoc_class -public class SendToBackCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SendToBackCommand sendtobackcommand; - // JUnitDoclet end class - - /** - * Constructor SendToBackCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SendToBackCommandTest(String name) { - // JUnitDoclet begin method SendToBackCommandTest - super(name); - // JUnitDoclet end method SendToBackCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.SendToBackCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.SendToBackCommand("TestSendToBack", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - sendtobackcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - sendtobackcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.SendToBackCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/SimpleUpdateStrategyTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/SimpleUpdateStrategyTest.java deleted file mode 100644 index f1a3a6e5e36c3eadd2c26215fa4e3170a9aee270..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/SimpleUpdateStrategyTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.SimpleUpdateStrategy; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SimpleUpdateStrategyTest is generated by - * JUnitDoclet to hold the tests for SimpleUpdateStrategy. - * @see CH.ifa.draw.standard.SimpleUpdateStrategy - */ -// JUnitDoclet end javadoc_class -public class SimpleUpdateStrategyTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SimpleUpdateStrategy simpleupdatestrategy; - // JUnitDoclet end class - - /** - * Constructor SimpleUpdateStrategyTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SimpleUpdateStrategyTest(String name) { - // JUnitDoclet begin method SimpleUpdateStrategyTest - super(name); - // JUnitDoclet end method SimpleUpdateStrategyTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.SimpleUpdateStrategy createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.SimpleUpdateStrategy(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - simpleupdatestrategy = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - simpleupdatestrategy = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.SimpleUpdateStrategy#draw(java.awt.Graphics, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/SingleFigureEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/SingleFigureEnumeratorTest.java deleted file mode 100644 index c6ce4ef83329e650d8ee8759af65741d21b1b1a5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/SingleFigureEnumeratorTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.SingleFigureEnumerator; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SingleFigureEnumeratorTest is generated by - * JUnitDoclet to hold the tests for SingleFigureEnumerator. - * @see CH.ifa.draw.standard.SingleFigureEnumerator - */ -// JUnitDoclet end javadoc_class -public class SingleFigureEnumeratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SingleFigureEnumerator singlefigureenumerator; - // JUnitDoclet end class - - /** - * Constructor SingleFigureEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SingleFigureEnumeratorTest(String name) { - // JUnitDoclet begin method SingleFigureEnumeratorTest - super(name); - // JUnitDoclet end method SingleFigureEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.SingleFigureEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.SingleFigureEnumerator(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - singlefigureenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - singlefigureenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method hasNextFigure() - /** - * Method testHasNextFigure is testing hasNextFigure - * @see CH.ifa.draw.standard.SingleFigureEnumerator#hasNextFigure() - */ - // JUnitDoclet end javadoc_method hasNextFigure() - public void testHasNextFigure() throws Exception { - // JUnitDoclet begin method hasNextFigure - // JUnitDoclet end method hasNextFigure - } - - // JUnitDoclet begin javadoc_method nextFigure() - /** - * Method testNextFigure is testing nextFigure - * @see CH.ifa.draw.standard.SingleFigureEnumerator#nextFigure() - */ - // JUnitDoclet end javadoc_method nextFigure() - public void testNextFigure() throws Exception { - // JUnitDoclet begin method nextFigure - // JUnitDoclet end method nextFigure - } - - // JUnitDoclet begin javadoc_method reset() - /** - * Method testReset is testing reset - * @see CH.ifa.draw.standard.SingleFigureEnumerator#reset() - */ - // JUnitDoclet end javadoc_method reset() - public void testReset() throws Exception { - // JUnitDoclet begin method reset - // JUnitDoclet end method reset - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/StandardDrawingTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/StandardDrawingTest.java deleted file mode 100644 index 26b9e140712ce282e3e1dac178855e39dd23618e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/StandardDrawingTest.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import CH.ifa.draw.standard.StandardDrawing; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StandardDrawingTest is generated by - * JUnitDoclet to hold the tests for StandardDrawing. - * @see CH.ifa.draw.standard.StandardDrawing - */ -// JUnitDoclet end javadoc_class -public class StandardDrawingTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StandardDrawing standarddrawing; - // JUnitDoclet end class - - /** - * Constructor StandardDrawingTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StandardDrawingTest(String name) { - // JUnitDoclet begin method StandardDrawingTest - super(name); - // JUnitDoclet end method StandardDrawingTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.StandardDrawing createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.StandardDrawing(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - standarddrawing = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - standarddrawing = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addDrawingChangeListener() - /** - * Method testAddDrawingChangeListener is testing addDrawingChangeListener - * @see CH.ifa.draw.standard.StandardDrawing#addDrawingChangeListener(CH.ifa.draw.framework.DrawingChangeListener) - */ - // JUnitDoclet end javadoc_method addDrawingChangeListener() - public void testAddDrawingChangeListener() throws Exception { - // JUnitDoclet begin method addDrawingChangeListener - // JUnitDoclet end method addDrawingChangeListener - } - - // JUnitDoclet begin javadoc_method removeDrawingChangeListener() - /** - * Method testRemoveDrawingChangeListener is testing removeDrawingChangeListener - * @see CH.ifa.draw.standard.StandardDrawing#removeDrawingChangeListener(CH.ifa.draw.framework.DrawingChangeListener) - */ - // JUnitDoclet end javadoc_method removeDrawingChangeListener() - public void testRemoveDrawingChangeListener() throws Exception { - // JUnitDoclet begin method removeDrawingChangeListener - // JUnitDoclet end method removeDrawingChangeListener - } - - // JUnitDoclet begin javadoc_method drawingChangeListeners() - /** - * Method testDrawingChangeListeners is testing drawingChangeListeners - * @see CH.ifa.draw.standard.StandardDrawing#drawingChangeListeners() - */ - // JUnitDoclet end javadoc_method drawingChangeListeners() - public void testDrawingChangeListeners() throws Exception { - // JUnitDoclet begin method drawingChangeListeners - // JUnitDoclet end method drawingChangeListeners - } - - // JUnitDoclet begin javadoc_method orphan() - /** - * Method testOrphan is testing orphan - * @see CH.ifa.draw.standard.StandardDrawing#orphan(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method orphan() - public void testOrphan() throws Exception { - // JUnitDoclet begin method orphan - // JUnitDoclet end method orphan - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.standard.StandardDrawing#add(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method figureInvalidated() - /** - * Method testFigureInvalidated is testing figureInvalidated - * @see CH.ifa.draw.standard.StandardDrawing#figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureInvalidated() - public void testFigureInvalidated() throws Exception { - // JUnitDoclet begin method figureInvalidated - // JUnitDoclet end method figureInvalidated - } - - // JUnitDoclet begin javadoc_method fireDrawingTitleChanged() - /** - * Method testFireDrawingTitleChanged is testing fireDrawingTitleChanged - * @see CH.ifa.draw.standard.StandardDrawing#fireDrawingTitleChanged() - */ - // JUnitDoclet end javadoc_method fireDrawingTitleChanged() - public void testFireDrawingTitleChanged() throws Exception { - // JUnitDoclet begin method fireDrawingTitleChanged - // JUnitDoclet end method fireDrawingTitleChanged - } - - // JUnitDoclet begin javadoc_method figureRequestUpdate() - /** - * Method testFigureRequestUpdate is testing figureRequestUpdate - * @see CH.ifa.draw.standard.StandardDrawing#figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureRequestUpdate() - public void testFigureRequestUpdate() throws Exception { - // JUnitDoclet begin method figureRequestUpdate - // JUnitDoclet end method figureRequestUpdate - } - - // JUnitDoclet begin javadoc_method handles() - /** - * Method testHandles is testing handles - * @see CH.ifa.draw.standard.StandardDrawing#handles() - */ - // JUnitDoclet end javadoc_method handles() - public void testHandles() throws Exception { - // JUnitDoclet begin method handles - // JUnitDoclet end method handles - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.standard.StandardDrawing#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method basicDisplayBox() - /** - * Method testBasicDisplayBox is testing basicDisplayBox - * @see CH.ifa.draw.standard.StandardDrawing#basicDisplayBox(java.awt.Point, java.awt.Point) - */ - // JUnitDoclet end javadoc_method basicDisplayBox() - public void testBasicDisplayBox() throws Exception { - // JUnitDoclet begin method basicDisplayBox - // JUnitDoclet end method basicDisplayBox - } - - // JUnitDoclet begin javadoc_method lock() - /** - * Method testLock is testing lock - * @see CH.ifa.draw.standard.StandardDrawing#lock() - */ - // JUnitDoclet end javadoc_method lock() - public void testLock() throws Exception { - // JUnitDoclet begin method lock - // JUnitDoclet end method lock - } - - // JUnitDoclet begin javadoc_method unlock() - /** - * Method testUnlock is testing unlock - * @see CH.ifa.draw.standard.StandardDrawing#unlock() - */ - // JUnitDoclet end javadoc_method unlock() - public void testUnlock() throws Exception { - // JUnitDoclet begin method unlock - // JUnitDoclet end method unlock - } - - // JUnitDoclet begin javadoc_method setTitle() - /** - * Method testSetGetTitle is testing setTitle - * and getTitle together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.standard.StandardDrawing#setTitle(java.lang.String) - * @see CH.ifa.draw.standard.StandardDrawing#getTitle() - */ - // JUnitDoclet end javadoc_method setTitle() - public void testSetGetTitle() throws Exception { - // JUnitDoclet begin method setTitle getTitle - java.lang.String[] tests = { "", " ", "a", "A", "�", "�", "0123456789", "012345678901234567890", "\n", null }; - - for (int i = 0; i < tests.length; i++) { - standarddrawing.setTitle(tests[i]); - assertEquals(tests[i], standarddrawing.getTitle()); - } - // JUnitDoclet end method setTitle getTitle - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/StandardDrawingViewTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/StandardDrawingViewTest.java deleted file mode 100644 index fdb54df0f2614587a5c62e2fe4ebffc5823d47c4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/StandardDrawingViewTest.java +++ /dev/null @@ -1,728 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.*; -import CH.ifa.draw.standard.GridConstrainer; -import CH.ifa.draw.standard.SimpleUpdateStrategy; -import CH.ifa.draw.standard.StandardDrawingView; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StandardDrawingViewTest is generated by - * JUnitDoclet to hold the tests for StandardDrawingView. - * @see CH.ifa.draw.standard.StandardDrawingView - */ -// JUnitDoclet end javadoc_class -public class StandardDrawingViewTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StandardDrawingView standarddrawingview; - // JUnitDoclet end class - - /** - * Constructor StandardDrawingViewTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StandardDrawingViewTest(String name) { - // JUnitDoclet begin method StandardDrawingViewTest - super(name); - // JUnitDoclet end method StandardDrawingViewTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.StandardDrawingView createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return (StandardDrawingView)getDrawingEditor().view(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - getDrawingEditor().open(); - getDrawingEditor().newWindow(new StandardDrawing()); - standarddrawingview = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - standarddrawingview = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setEditor() - /** - * Method testSetEditor is testing setEditor - * @see CH.ifa.draw.standard.StandardDrawingView#setEditor(CH.ifa.draw.framework.DrawingEditor) - */ - // JUnitDoclet end javadoc_method setEditor() - public void testSetEditor() throws Exception { - // JUnitDoclet begin method setEditor - // JUnitDoclet end method setEditor - } - - // JUnitDoclet begin javadoc_method tool() - /** - * Method testTool is testing tool - * @see CH.ifa.draw.standard.StandardDrawingView#tool() - */ - // JUnitDoclet end javadoc_method tool() - public void testTool() throws Exception { - // JUnitDoclet begin method tool - // JUnitDoclet end method tool - } - - // JUnitDoclet begin javadoc_method drawing() - /** - * Method testDrawing is testing drawing - * @see CH.ifa.draw.standard.StandardDrawingView#drawing() - */ - // JUnitDoclet end javadoc_method drawing() - public void testDrawing() throws Exception { - // JUnitDoclet begin method drawing - // JUnitDoclet end method drawing - } - - // JUnitDoclet begin javadoc_method setDrawing() - /** - * Method testSetDrawing is testing setDrawing - * @see CH.ifa.draw.standard.StandardDrawingView#setDrawing(CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method setDrawing() - public void testSetDrawing() throws Exception { - // JUnitDoclet begin method setDrawing - // JUnitDoclet end method setDrawing - } - - // JUnitDoclet begin javadoc_method editor() - /** - * Method testEditor is testing editor - * @see CH.ifa.draw.standard.StandardDrawingView#editor() - */ - // JUnitDoclet end javadoc_method editor() - public void testEditor() throws Exception { - // JUnitDoclet begin method editor - // JUnitDoclet end method editor - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.standard.StandardDrawingView#add(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.standard.StandardDrawingView#remove(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method addAll() - /** - * Method testAddAll is testing addAll - * @see CH.ifa.draw.standard.StandardDrawingView#addAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method addAll() - public void testAddAll() throws Exception { - // JUnitDoclet begin method addAll - // JUnitDoclet end method addAll - } - - // JUnitDoclet begin javadoc_method figureExists() - /** - * Method testFigureExists is testing figureExists - * @see CH.ifa.draw.standard.StandardDrawingView#figureExists(CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.FigureEnumeration) - */ - // JUnitDoclet end javadoc_method figureExists() - public void testFigureExists() throws Exception { - // JUnitDoclet begin method figureExists - // JUnitDoclet end method figureExists - } - - // JUnitDoclet begin javadoc_method insertFigures() - /** - * Method testInsertFigures is testing insertFigures - * @see CH.ifa.draw.standard.StandardDrawingView#insertFigures(CH.ifa.draw.framework.FigureEnumeration, int, int, boolean) - */ - // JUnitDoclet end javadoc_method insertFigures() - public void testInsertFigures() throws Exception { - // JUnitDoclet begin method insertFigures - // JUnitDoclet end method insertFigures - } - - // JUnitDoclet begin javadoc_method getConnectionFigures() - /** - * Method testGetConnectionFigures is testing getConnectionFigures - * @see CH.ifa.draw.standard.StandardDrawingView#getConnectionFigures(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method getConnectionFigures() - public void testGetConnectionFigures() throws Exception { - // JUnitDoclet begin method getConnectionFigures - // JUnitDoclet end method getConnectionFigures - } - - // JUnitDoclet begin javadoc_method getMinimumSize() - /** - * Method testGetMinimumSize is testing getMinimumSize - * @see CH.ifa.draw.standard.StandardDrawingView#getMinimumSize() - */ - // JUnitDoclet end javadoc_method getMinimumSize() - public void testGetMinimumSize() throws Exception { - // JUnitDoclet begin method getMinimumSize - // JUnitDoclet end method getMinimumSize - } - - // JUnitDoclet begin javadoc_method getPreferredSize() - /** - * Method testGetPreferredSize is testing getPreferredSize - * @see CH.ifa.draw.standard.StandardDrawingView#getPreferredSize() - */ - // JUnitDoclet end javadoc_method getPreferredSize() - public void testGetPreferredSize() throws Exception { - // JUnitDoclet begin method getPreferredSize - // JUnitDoclet end method getPreferredSize - } - - // JUnitDoclet begin javadoc_method setDisplayUpdate() - /** - * Method testSetGetDisplayUpdate is testing setDisplayUpdate - * and getDisplayUpdate together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.standard.StandardDrawingView#setDisplayUpdate(CH.ifa.draw.framework.Painter) - * @see CH.ifa.draw.standard.StandardDrawingView#getDisplayUpdate() - */ - // JUnitDoclet end javadoc_method setDisplayUpdate() - public void testSetGetDisplayUpdate() throws Exception { - // JUnitDoclet begin method setDisplayUpdate getDisplayUpdate - CH.ifa.draw.framework.Painter[] tests = { new SimpleUpdateStrategy(), null }; - - for (int i = 0; i < tests.length; i++) { - standarddrawingview.setDisplayUpdate(tests[i]); - assertEquals(tests[i], standarddrawingview.getDisplayUpdate()); - } - // JUnitDoclet end method setDisplayUpdate getDisplayUpdate - } - - // JUnitDoclet begin javadoc_method selection() - /** - * Method testSelection is testing selection - * @see CH.ifa.draw.standard.StandardDrawingView#selection() - */ - // JUnitDoclet end javadoc_method selection() - public void testSelection() throws Exception { - // JUnitDoclet begin method selection - // JUnitDoclet end method selection - } - - // JUnitDoclet begin javadoc_method selectionZOrdered() - /** - * Method testSelectionZOrdered is testing selectionZOrdered - * @see CH.ifa.draw.standard.StandardDrawingView#selectionZOrdered() - */ - // JUnitDoclet end javadoc_method selectionZOrdered() - public void testSelectionZOrdered() throws Exception { - // JUnitDoclet begin method selectionZOrdered - // JUnitDoclet end method selectionZOrdered - } - - // JUnitDoclet begin javadoc_method selectionCount() - /** - * Method testSelectionCount is testing selectionCount - * @see CH.ifa.draw.standard.StandardDrawingView#selectionCount() - */ - // JUnitDoclet end javadoc_method selectionCount() - public void testSelectionCount() throws Exception { - // JUnitDoclet begin method selectionCount - // JUnitDoclet end method selectionCount - } - - // JUnitDoclet begin javadoc_method isFigureSelected() - /** - * Method testIsFigureSelected is testing isFigureSelected - * @see CH.ifa.draw.standard.StandardDrawingView#isFigureSelected(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method isFigureSelected() - public void testIsFigureSelected() throws Exception { - // JUnitDoclet begin method isFigureSelected - // JUnitDoclet end method isFigureSelected - } - - // JUnitDoclet begin javadoc_method addToSelection() - /** - * Method testAddToSelection is testing addToSelection - * @see CH.ifa.draw.standard.StandardDrawingView#addToSelection(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method addToSelection() - public void testAddToSelection() throws Exception { - // JUnitDoclet begin method addToSelection - // JUnitDoclet end method addToSelection - } - - // JUnitDoclet begin javadoc_method addToSelectionAll() - /** - * Method testAddToSelectionAll is testing addToSelectionAll - * @see CH.ifa.draw.standard.StandardDrawingView#addToSelectionAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method addToSelectionAll() - public void testAddToSelectionAll() throws Exception { - // JUnitDoclet begin method addToSelectionAll - // JUnitDoclet end method addToSelectionAll - } - - // JUnitDoclet begin javadoc_method removeFromSelection() - /** - * Method testRemoveFromSelection is testing removeFromSelection - * @see CH.ifa.draw.standard.StandardDrawingView#removeFromSelection(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method removeFromSelection() - public void testRemoveFromSelection() throws Exception { - // JUnitDoclet begin method removeFromSelection - // JUnitDoclet end method removeFromSelection - } - - // JUnitDoclet begin javadoc_method toggleSelection() - /** - * Method testToggleSelection is testing toggleSelection - * @see CH.ifa.draw.standard.StandardDrawingView#toggleSelection(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method toggleSelection() - public void testToggleSelection() throws Exception { - // JUnitDoclet begin method toggleSelection - // JUnitDoclet end method toggleSelection - } - - // JUnitDoclet begin javadoc_method clearSelection() - /** - * Method testClearSelection is testing clearSelection - * @see CH.ifa.draw.standard.StandardDrawingView#clearSelection() - */ - // JUnitDoclet end javadoc_method clearSelection() - public void testClearSelection() throws Exception { - // JUnitDoclet begin method clearSelection - // JUnitDoclet end method clearSelection - } - - // JUnitDoclet begin javadoc_method getFigureSelection() - /** - * Method testGetFigureSelection is testing getFigureSelection - * @see CH.ifa.draw.standard.StandardDrawingView#getFigureSelection() - */ - // JUnitDoclet end javadoc_method getFigureSelection() - public void testGetFigureSelection() throws Exception { - // JUnitDoclet begin method getFigureSelection - // JUnitDoclet end method getFigureSelection - } - - // JUnitDoclet begin javadoc_method findHandle() - /** - * Method testFindHandle is testing findHandle - * @see CH.ifa.draw.standard.StandardDrawingView#findHandle(int, int) - */ - // JUnitDoclet end javadoc_method findHandle() - public void testFindHandle() throws Exception { - // JUnitDoclet begin method findHandle - // JUnitDoclet end method findHandle - } - - // JUnitDoclet begin javadoc_method lastClick() - /** - * Method testLastClick is testing lastClick - * @see CH.ifa.draw.standard.StandardDrawingView#lastClick() - */ - // JUnitDoclet end javadoc_method lastClick() - public void testLastClick() throws Exception { - // JUnitDoclet begin method lastClick - // JUnitDoclet end method lastClick - } - - // JUnitDoclet begin javadoc_method setConstrainer() - /** - * Method testSetGetConstrainer is testing setConstrainer - * and getConstrainer together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.standard.StandardDrawingView#setConstrainer(CH.ifa.draw.framework.PointConstrainer) - * @see CH.ifa.draw.standard.StandardDrawingView#getConstrainer() - */ - // JUnitDoclet end javadoc_method setConstrainer() - public void testSetGetConstrainer() throws Exception { - // JUnitDoclet begin method setConstrainer getConstrainer - CH.ifa.draw.framework.PointConstrainer[] tests = { new GridConstrainer(5, 5), null }; - - for (int i = 0; i < tests.length; i++) { - standarddrawingview.setConstrainer(tests[i]); - assertEquals(tests[i], standarddrawingview.getConstrainer()); - } - // JUnitDoclet end method setConstrainer getConstrainer - } - - // JUnitDoclet begin javadoc_method checkDamage() - /** - * Method testCheckDamage is testing checkDamage - * @see CH.ifa.draw.standard.StandardDrawingView#checkDamage() - */ - // JUnitDoclet end javadoc_method checkDamage() - public void testCheckDamage() throws Exception { - // JUnitDoclet begin method checkDamage - // JUnitDoclet end method checkDamage - } - - // JUnitDoclet begin javadoc_method repairDamage() - /** - * Method testRepairDamage is testing repairDamage - * @see CH.ifa.draw.standard.StandardDrawingView#repairDamage() - */ - // JUnitDoclet end javadoc_method repairDamage() - public void testRepairDamage() throws Exception { - // JUnitDoclet begin method repairDamage - // JUnitDoclet end method repairDamage - } - - // JUnitDoclet begin javadoc_method drawingInvalidated() - /** - * Method testDrawingInvalidated is testing drawingInvalidated - * @see CH.ifa.draw.standard.StandardDrawingView#drawingInvalidated(CH.ifa.draw.framework.DrawingChangeEvent) - */ - // JUnitDoclet end javadoc_method drawingInvalidated() - public void testDrawingInvalidated() throws Exception { - // JUnitDoclet begin method drawingInvalidated - // JUnitDoclet end method drawingInvalidated - } - - // JUnitDoclet begin javadoc_method drawingRequestUpdate() - /** - * Method testDrawingRequestUpdate is testing drawingRequestUpdate - * @see CH.ifa.draw.standard.StandardDrawingView#drawingRequestUpdate(CH.ifa.draw.framework.DrawingChangeEvent) - */ - // JUnitDoclet end javadoc_method drawingRequestUpdate() - public void testDrawingRequestUpdate() throws Exception { - // JUnitDoclet begin method drawingRequestUpdate - // JUnitDoclet end method drawingRequestUpdate - } - - // JUnitDoclet begin javadoc_method drawingTitleChanged() - /** - * Method testDrawingTitleChanged is testing drawingTitleChanged - * @see CH.ifa.draw.standard.StandardDrawingView#drawingTitleChanged(CH.ifa.draw.framework.DrawingChangeEvent) - */ - // JUnitDoclet end javadoc_method drawingTitleChanged() - public void testDrawingTitleChanged() throws Exception { - // JUnitDoclet begin method drawingTitleChanged - // JUnitDoclet end method drawingTitleChanged - } - - // JUnitDoclet begin javadoc_method drawAll() - /** - * Method testDrawAll is testing drawAll - * @see CH.ifa.draw.standard.StandardDrawingView#drawAll(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawAll() - public void testDrawAll() throws Exception { - // JUnitDoclet begin method drawAll - // JUnitDoclet end method drawAll - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.standard.StandardDrawingView#draw(java.awt.Graphics, CH.ifa.draw.framework.FigureEnumeration) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method drawHandles() - /** - * Method testDrawHandles is testing drawHandles - * @see CH.ifa.draw.standard.StandardDrawingView#drawHandles(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawHandles() - public void testDrawHandles() throws Exception { - // JUnitDoclet begin method drawHandles - // JUnitDoclet end method drawHandles - } - - // JUnitDoclet begin javadoc_method drawDrawing() - /** - * Method testDrawDrawing is testing drawDrawing - * @see CH.ifa.draw.standard.StandardDrawingView#drawDrawing(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawDrawing() - public void testDrawDrawing() throws Exception { - // JUnitDoclet begin method drawDrawing - // JUnitDoclet end method drawDrawing - } - - // JUnitDoclet begin javadoc_method drawBackground() - /** - * Method testDrawBackground is testing drawBackground - * @see CH.ifa.draw.standard.StandardDrawingView#drawBackground(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method drawBackground() - public void testDrawBackground() throws Exception { - // JUnitDoclet begin method drawBackground - // JUnitDoclet end method drawBackground - } - - // JUnitDoclet begin javadoc_method addBackground() - /** - * Method testAddBackground is testing addBackground - * @see CH.ifa.draw.standard.StandardDrawingView#addBackground(CH.ifa.draw.framework.Painter) - */ - // JUnitDoclet end javadoc_method addBackground() - public void testAddBackground() throws Exception { - // JUnitDoclet begin method addBackground - // JUnitDoclet end method addBackground - } - - // JUnitDoclet begin javadoc_method removeBackground() - /** - * Method testRemoveBackground is testing removeBackground - * @see CH.ifa.draw.standard.StandardDrawingView#removeBackground(CH.ifa.draw.framework.Painter) - */ - // JUnitDoclet end javadoc_method removeBackground() - public void testRemoveBackground() throws Exception { - // JUnitDoclet begin method removeBackground - // JUnitDoclet end method removeBackground - } - - // JUnitDoclet begin javadoc_method removeForeground() - /** - * Method testRemoveForeground is testing removeForeground - * @see CH.ifa.draw.standard.StandardDrawingView#removeForeground(CH.ifa.draw.framework.Painter) - */ - // JUnitDoclet end javadoc_method removeForeground() - public void testRemoveForeground() throws Exception { - // JUnitDoclet begin method removeForeground - // JUnitDoclet end method removeForeground - } - - // JUnitDoclet begin javadoc_method addForeground() - /** - * Method testAddForeground is testing addForeground - * @see CH.ifa.draw.standard.StandardDrawingView#addForeground(CH.ifa.draw.framework.Painter) - */ - // JUnitDoclet end javadoc_method addForeground() - public void testAddForeground() throws Exception { - // JUnitDoclet begin method addForeground - // JUnitDoclet end method addForeground - } - - // JUnitDoclet begin javadoc_method freezeView() - /** - * Method testFreezeView is testing freezeView - * @see CH.ifa.draw.standard.StandardDrawingView#freezeView() - */ - // JUnitDoclet end javadoc_method freezeView() - public void testFreezeView() throws Exception { - // JUnitDoclet begin method freezeView - // JUnitDoclet end method freezeView - } - - // JUnitDoclet begin javadoc_method unfreezeView() - /** - * Method testUnfreezeView is testing unfreezeView - * @see CH.ifa.draw.standard.StandardDrawingView#unfreezeView() - */ - // JUnitDoclet end javadoc_method unfreezeView() - public void testUnfreezeView() throws Exception { - // JUnitDoclet begin method unfreezeView - // JUnitDoclet end method unfreezeView - } - - // JUnitDoclet begin javadoc_method isFocusTraversable() - /** - * Method testIsFocusTraversable is testing isFocusTraversable - * @see CH.ifa.draw.standard.StandardDrawingView#isFocusTraversable() - */ - // JUnitDoclet end javadoc_method isFocusTraversable() - public void testIsFocusTraversable() throws Exception { - // JUnitDoclet begin method isFocusTraversable - // JUnitDoclet end method isFocusTraversable - } - - // JUnitDoclet begin javadoc_method isInteractive() - /** - * Method testIsInteractive is testing isInteractive - * @see CH.ifa.draw.standard.StandardDrawingView#isInteractive() - */ - // JUnitDoclet end javadoc_method isInteractive() - public void testIsInteractive() throws Exception { - // JUnitDoclet begin method isInteractive - // JUnitDoclet end method isInteractive - } - - // JUnitDoclet begin javadoc_method keyTyped() - /** - * Method testKeyTyped is testing keyTyped - * @see CH.ifa.draw.standard.StandardDrawingView#keyTyped(java.awt.event.KeyEvent) - */ - // JUnitDoclet end javadoc_method keyTyped() - public void testKeyTyped() throws Exception { - // JUnitDoclet begin method keyTyped - // JUnitDoclet end method keyTyped - } - - // JUnitDoclet begin javadoc_method keyReleased() - /** - * Method testKeyReleased is testing keyReleased - * @see CH.ifa.draw.standard.StandardDrawingView#keyReleased(java.awt.event.KeyEvent) - */ - // JUnitDoclet end javadoc_method keyReleased() - public void testKeyReleased() throws Exception { - // JUnitDoclet begin method keyReleased - // JUnitDoclet end method keyReleased - } - - // JUnitDoclet begin javadoc_method addFigureSelectionListener() - /** - * Method testAddFigureSelectionListener is testing addFigureSelectionListener - * @see CH.ifa.draw.standard.StandardDrawingView#addFigureSelectionListener(CH.ifa.draw.framework.FigureSelectionListener) - */ - // JUnitDoclet end javadoc_method addFigureSelectionListener() - public void testAddFigureSelectionListener() throws Exception { - // JUnitDoclet begin method addFigureSelectionListener - // JUnitDoclet end method addFigureSelectionListener - } - - // JUnitDoclet begin javadoc_method removeFigureSelectionListener() - /** - * Method testRemoveFigureSelectionListener is testing removeFigureSelectionListener - * @see CH.ifa.draw.standard.StandardDrawingView#removeFigureSelectionListener(CH.ifa.draw.framework.FigureSelectionListener) - */ - // JUnitDoclet end javadoc_method removeFigureSelectionListener() - public void testRemoveFigureSelectionListener() throws Exception { - // JUnitDoclet begin method removeFigureSelectionListener - // JUnitDoclet end method removeFigureSelectionListener - } - - // JUnitDoclet begin javadoc_method getDefaultDNDActions() - /** - * Method testGetDefaultDNDActions is testing getDefaultDNDActions - * @see CH.ifa.draw.standard.StandardDrawingView#getDefaultDNDActions() - */ - // JUnitDoclet end javadoc_method getDefaultDNDActions() - public void testGetDefaultDNDActions() throws Exception { - // JUnitDoclet begin method getDefaultDNDActions - // JUnitDoclet end method getDefaultDNDActions - } - - // JUnitDoclet begin javadoc_method autoscroll() - /** - * Method testAutoscroll is testing autoscroll - * @see CH.ifa.draw.standard.StandardDrawingView#autoscroll(java.awt.Point) - */ - // JUnitDoclet end javadoc_method autoscroll() - public void testAutoscroll() throws Exception { - // JUnitDoclet begin method autoscroll - // JUnitDoclet end method autoscroll - } - - // JUnitDoclet begin javadoc_method getAutoscrollInsets() - /** - * Method testGetAutoscrollInsets is testing getAutoscrollInsets - * @see CH.ifa.draw.standard.StandardDrawingView#getAutoscrollInsets() - */ - // JUnitDoclet end javadoc_method getAutoscrollInsets() - public void testGetAutoscrollInsets() throws Exception { - // JUnitDoclet begin method getAutoscrollInsets - // JUnitDoclet end method getAutoscrollInsets - } - - // JUnitDoclet begin javadoc_method toString() - /** - * Method testToString is testing toString - * @see CH.ifa.draw.standard.StandardDrawingView#toString() - */ - // JUnitDoclet end javadoc_method toString() - public void testToString() throws Exception { - // JUnitDoclet begin method toString - // JUnitDoclet end method toString - } - - // JUnitDoclet begin javadoc_method setDragSourceActive() - /** - * Method testSetDragSourceActive is testing setDragSourceActive - * @see CH.ifa.draw.standard.StandardDrawingView#setDragSourceActive(boolean) - */ - // JUnitDoclet end javadoc_method setDragSourceActive() - public void testSetDragSourceActive() throws Exception { - // JUnitDoclet begin method setDragSourceActive - // JUnitDoclet end method setDragSourceActive - } - - // JUnitDoclet begin javadoc_method setDropTargetActive() - /** - * Method testSetDropTargetActive is testing setDropTargetActive - * @see CH.ifa.draw.standard.StandardDrawingView#setDropTargetActive(boolean) - */ - // JUnitDoclet end javadoc_method setDropTargetActive() - public void testSetDropTargetActive() throws Exception { - // JUnitDoclet begin method setDropTargetActive - // JUnitDoclet end method setDropTargetActive - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/StandardFigureSelectionTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/StandardFigureSelectionTest.java deleted file mode 100644 index 7153b9a3767c850db69f66499744baa556721624..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/StandardFigureSelectionTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; -import java.util.List; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.PolyLineFigure; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.standard.FigureEnumerator; -import CH.ifa.draw.standard.StandardFigureSelection; -import CH.ifa.draw.util.CollectionsFactory; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StandardFigureSelectionTest is generated by - * JUnitDoclet to hold the tests for StandardFigureSelection. - * @see CH.ifa.draw.standard.StandardFigureSelection - */ -// JUnitDoclet end javadoc_class -public class StandardFigureSelectionTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StandardFigureSelection standardfigureselection; - // JUnitDoclet end class - - /** - * Constructor StandardFigureSelectionTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StandardFigureSelectionTest(String name) { - // JUnitDoclet begin method StandardFigureSelectionTest - super(name); - // JUnitDoclet end method StandardFigureSelectionTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.StandardFigureSelection createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - List l = CollectionsFactory.current().createList(); - l.add(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - l.add(new PolyLineFigure(20, 20)); - FigureEnumeration fenum = new FigureEnumerator(l); - return new CH.ifa.draw.standard.StandardFigureSelection(fenum, l.size()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - standardfigureselection = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - standardfigureselection = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getType() - /** - * Method testGetType is testing getType - * @see CH.ifa.draw.standard.StandardFigureSelection#getType() - */ - // JUnitDoclet end javadoc_method getType() - public void testGetType() throws Exception { - // JUnitDoclet begin method getType - // JUnitDoclet end method getType - } - - // JUnitDoclet begin javadoc_method getData() - /** - * Method testGetData is testing getData - * @see CH.ifa.draw.standard.StandardFigureSelection#getData(java.lang.String) - */ - // JUnitDoclet end javadoc_method getData() - public void testGetData() throws Exception { - // JUnitDoclet begin method getData - // JUnitDoclet end method getData - } - - // JUnitDoclet begin javadoc_method duplicateFigures() - /** - * Method testDuplicateFigures is testing duplicateFigures - * @see CH.ifa.draw.standard.StandardFigureSelection#duplicateFigures(CH.ifa.draw.framework.FigureEnumeration, int) - */ - // JUnitDoclet end javadoc_method duplicateFigures() - public void testDuplicateFigures() throws Exception { - // JUnitDoclet begin method duplicateFigures - // JUnitDoclet end method duplicateFigures - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/StandardSuite.java b/JHotDraw/src/CH/ifa/draw/test/standard/StandardSuite.java deleted file mode 100644 index de964215117f1e7550bd50afb94970813552eef9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/StandardSuite.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite StandardSuite -*/ -// JUnitDoclet end javadoc_class -public class StandardSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.standard"); - - suite.addTestSuite(CH.ifa.draw.test.standard.PeripheralLocatorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.SingleFigureEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.NullDrawingViewTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.NullToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.HandleAndEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.InsertIntoDrawingVisitorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.DeleteFromDrawingVisitorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.SelectAllCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.FigureAndEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.HandleEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.StandardFigureSelectionTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.FastBufferedUpdateStrategyTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ToolButtonTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ToggleGridCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.StandardDrawingViewTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.StandardDrawingTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.SimpleUpdateStrategyTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.SelectionToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.SelectAreaTrackerTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ReverseFigureEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.RelativeLocatorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.PasteCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.OffsetLocatorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.NullHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.LocatorConnectorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.HandleTrackerTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.GridConstrainerTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.FigureEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.FigureChangeEventMulticasterTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.DuplicateCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.DragTrackerTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.DeleteCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.CutCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.CreationToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.CopyCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ConnectionToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ConnectionHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ChopBoxConnectorTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ChangeConnectionStartHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ChangeConnectionEndHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.ChangeAttributeCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.BufferedUpdateStrategyTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.SendToBackCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.BringToFrontCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.LocatorHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.BoxHandleKitTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.AlignCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.standard.FigureChangeAdapterTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ToggleGridCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ToggleGridCommandTest.java deleted file mode 100644 index f688fcfa31195da8785cc704fae283c1c8302cbd..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ToggleGridCommandTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.ToggleGridCommand; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ToggleGridCommandTest is generated by - * JUnitDoclet to hold the tests for ToggleGridCommand. - * @see CH.ifa.draw.standard.ToggleGridCommand - */ -// JUnitDoclet end javadoc_class -public class ToggleGridCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ToggleGridCommand togglegridcommand; - // JUnitDoclet end class - - /** - * Constructor ToggleGridCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ToggleGridCommandTest(String name) { - // JUnitDoclet begin method ToggleGridCommandTest - super(name); - // JUnitDoclet end method ToggleGridCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ToggleGridCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.standard.ToggleGridCommand("TestToggle", getDrawingEditor(), new Point(5, 5)); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - togglegridcommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - togglegridcommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.standard.ToggleGridCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/standard/ToolButtonTest.java b/JHotDraw/src/CH/ifa/draw/test/standard/ToolButtonTest.java deleted file mode 100644 index 7eacaf69e03b748e52726c04bcbc866088e50f72..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/standard/ToolButtonTest.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.standard; - -// JUnitDoclet begin import -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.framework.Tool; -import CH.ifa.draw.standard.SelectionTool; -import CH.ifa.draw.standard.ToolButton; -import CH.ifa.draw.test.JHDTestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ToolButtonTest is generated by - * JUnitDoclet to hold the tests for ToolButton. - * @see CH.ifa.draw.standard.ToolButton - */ -// JUnitDoclet end javadoc_class -public class ToolButtonTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ToolButton toolbutton; - // JUnitDoclet end class - - /** - * Constructor ToolButtonTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ToolButtonTest(String name) { - // JUnitDoclet begin method ToolButtonTest - super(name); - // JUnitDoclet end method ToolButtonTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.standard.ToolButton createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Tool tool = new SelectionTool(getDrawingEditor()); - return new CH.ifa.draw.standard.ToolButton(getDrawingEditor(), DrawApplication.IMAGES + "SEL", "Selection Tool", tool); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - toolbutton = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - toolbutton = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method tool() - /** - * Method testTool is testing tool - * @see CH.ifa.draw.standard.ToolButton#tool() - */ - // JUnitDoclet end javadoc_method tool() - public void testTool() throws Exception { - // JUnitDoclet begin method tool - // JUnitDoclet end method tool - } - - // JUnitDoclet begin javadoc_method name() - /** - * Method testName is testing name - * @see CH.ifa.draw.standard.ToolButton#name() - */ - // JUnitDoclet end javadoc_method name() - public void testName() throws Exception { - // JUnitDoclet begin method name - // JUnitDoclet end method name - } - - // JUnitDoclet begin javadoc_method attributeValue() - /** - * Method testAttributeValue is testing attributeValue - * @see CH.ifa.draw.standard.ToolButton#attributeValue() - */ - // JUnitDoclet end javadoc_method attributeValue() - public void testAttributeValue() throws Exception { - // JUnitDoclet begin method attributeValue - // JUnitDoclet end method attributeValue - } - - // JUnitDoclet begin javadoc_method getMinimumSize() - /** - * Method testGetMinimumSize is testing getMinimumSize - * @see CH.ifa.draw.standard.ToolButton#getMinimumSize() - */ - // JUnitDoclet end javadoc_method getMinimumSize() - public void testGetMinimumSize() throws Exception { - // JUnitDoclet begin method getMinimumSize - // JUnitDoclet end method getMinimumSize - } - - // JUnitDoclet begin javadoc_method getPreferredSize() - /** - * Method testGetPreferredSize is testing getPreferredSize - * @see CH.ifa.draw.standard.ToolButton#getPreferredSize() - */ - // JUnitDoclet end javadoc_method getPreferredSize() - public void testGetPreferredSize() throws Exception { - // JUnitDoclet begin method getPreferredSize - // JUnitDoclet end method getPreferredSize - } - - // JUnitDoclet begin javadoc_method getMaximumSize() - /** - * Method testGetMaximumSize is testing getMaximumSize - * @see CH.ifa.draw.standard.ToolButton#getMaximumSize() - */ - // JUnitDoclet end javadoc_method getMaximumSize() - public void testGetMaximumSize() throws Exception { - // JUnitDoclet begin method getMaximumSize - // JUnitDoclet end method getMaximumSize - } - - // JUnitDoclet begin javadoc_method paintSelected() - /** - * Method testPaintSelected is testing paintSelected - * @see CH.ifa.draw.standard.ToolButton#paintSelected(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method paintSelected() - public void testPaintSelected() throws Exception { - // JUnitDoclet begin method paintSelected - // JUnitDoclet end method paintSelected - } - - // JUnitDoclet begin javadoc_method paint() - /** - * Method testPaint is testing paint - * @see CH.ifa.draw.standard.ToolButton#paint(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method paint() - public void testPaint() throws Exception { - // JUnitDoclet begin method paint - // JUnitDoclet end method paint - } - - // JUnitDoclet begin javadoc_method toolUsable() - /** - * Method testToolUsable is testing toolUsable - * @see CH.ifa.draw.standard.ToolButton#toolUsable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolUsable() - public void testToolUsable() throws Exception { - // JUnitDoclet begin method toolUsable - // JUnitDoclet end method toolUsable - } - - // JUnitDoclet begin javadoc_method toolUnusable() - /** - * Method testToolUnusable is testing toolUnusable - * @see CH.ifa.draw.standard.ToolButton#toolUnusable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolUnusable() - public void testToolUnusable() throws Exception { - // JUnitDoclet begin method toolUnusable - // JUnitDoclet end method toolUnusable - } - - // JUnitDoclet begin javadoc_method toolActivated() - /** - * Method testToolActivated is testing toolActivated - * @see CH.ifa.draw.standard.ToolButton#toolActivated(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolActivated() - public void testToolActivated() throws Exception { - // JUnitDoclet begin method toolActivated - // JUnitDoclet end method toolActivated - } - - // JUnitDoclet begin javadoc_method toolDeactivated() - /** - * Method testToolDeactivated is testing toolDeactivated - * @see CH.ifa.draw.standard.ToolButton#toolDeactivated(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolDeactivated() - public void testToolDeactivated() throws Exception { - // JUnitDoclet begin method toolDeactivated - // JUnitDoclet end method toolDeactivated - } - - // JUnitDoclet begin javadoc_method toolEnabled() - /** - * Method testToolEnabled is testing toolEnabled - * @see CH.ifa.draw.standard.ToolButton#toolEnabled(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolEnabled() - public void testToolEnabled() throws Exception { - // JUnitDoclet begin method toolEnabled - // JUnitDoclet end method toolEnabled - } - - // JUnitDoclet begin javadoc_method toolDisabled() - /** - * Method testToolDisabled is testing toolDisabled - * @see CH.ifa.draw.standard.ToolButton#toolDisabled(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolDisabled() - public void testToolDisabled() throws Exception { - // JUnitDoclet begin method toolDisabled - // JUnitDoclet end method toolDisabled - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/util/AllTests.java deleted file mode 100644 index 5658b7ff16c99d2dc550b4f11e8f69af4c199f12..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/AllTests.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.util"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(BoundsTest.class)); - suite.addTest(new TestSuite(ClipboardTest.class)); - suite.addTest(new TestSuite(ColorMapTest.class)); - suite.addTest(new TestSuite(CommandButtonTest.class)); - suite.addTest(new TestSuite(CommandChoiceTest.class)); - suite.addTest(new TestSuite(CommandMenuTest.class)); - suite.addTest(new TestSuite(FillerTest.class)); - suite.addTest(new TestSuite(FloatingTextFieldTest.class)); - suite.addTest(new TestSuite(GeomTest.class)); - suite.addTest(new TestSuite(GraphLayoutTest.class)); - suite.addTest(new TestSuite(IconkitTest.class)); - suite.addTest(new TestSuite(PaletteIconTest.class)); - suite.addTest(new TestSuite(PaletteLayoutTest.class)); - suite.addTest(new TestSuite(RedoCommandTest.class)); - suite.addTest(new TestSuite(ReverseListEnumeratorTest.class)); - suite.addTest(new TestSuite(SerializationStorageFormatTest.class)); - suite.addTest(new TestSuite(StandardStorageFormatTest.class)); - suite.addTest(new TestSuite(StandardVersionControlStrategyTest.class)); - suite.addTest(new TestSuite(StorableInputTest.class)); - suite.addTest(new TestSuite(StorableOutputTest.class)); - suite.addTest(new TestSuite(StorageFormatManagerTest.class)); - suite.addTest(new TestSuite(UndoCommandTest.class)); - suite.addTest(new TestSuite(UndoManagerTest.class)); - suite.addTest(new TestSuite(UndoRedoActivityTest.class)); - suite.addTest(new TestSuite(UndoableAdapterTest.class)); - suite.addTest(new TestSuite(UndoableCommandTest.class)); - suite.addTest(new TestSuite(UndoableHandleTest.class)); - suite.addTest(new TestSuite(UndoableToolTest.class)); - suite.addTest(new TestSuite(VersionManagementTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/BoundsTest.java b/JHotDraw/src/CH/ifa/draw/test/util/BoundsTest.java deleted file mode 100644 index af4aa819f40efade4563f089330048933e87a315..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/BoundsTest.java +++ /dev/null @@ -1,484 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.awt.Dimension; -import java.awt.geom.Point2D; - -import CH.ifa.draw.util.Bounds; - -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase BoundsTest is generated by - * JUnitDoclet to hold the tests for Bounds. - * @see CH.ifa.draw.util.Bounds - */ -// JUnitDoclet end javadoc_class -public class BoundsTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Bounds bounds; - // JUnitDoclet end class - - /** - * Constructor BoundsTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public BoundsTest(String name) { - // JUnitDoclet begin method BoundsTest - super(name); - // JUnitDoclet end method BoundsTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.Bounds createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.Bounds(new Dimension(100, 100)); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - bounds = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - bounds = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getLesserX() - /** - * Method testGetLesserX is testing getLesserX - * @see CH.ifa.draw.util.Bounds#getLesserX() - */ - // JUnitDoclet end javadoc_method getLesserX() - public void testGetLesserX() throws Exception { - // JUnitDoclet begin method getLesserX - // JUnitDoclet end method getLesserX - } - - // JUnitDoclet begin javadoc_method getGreaterX() - /** - * Method testGetGreaterX is testing getGreaterX - * @see CH.ifa.draw.util.Bounds#getGreaterX() - */ - // JUnitDoclet end javadoc_method getGreaterX() - public void testGetGreaterX() throws Exception { - // JUnitDoclet begin method getGreaterX - // JUnitDoclet end method getGreaterX - } - - // JUnitDoclet begin javadoc_method getLesserY() - /** - * Method testGetLesserY is testing getLesserY - * @see CH.ifa.draw.util.Bounds#getLesserY() - */ - // JUnitDoclet end javadoc_method getLesserY() - public void testGetLesserY() throws Exception { - // JUnitDoclet begin method getLesserY - // JUnitDoclet end method getLesserY - } - - // JUnitDoclet begin javadoc_method getGreaterY() - /** - * Method testGetGreaterY is testing getGreaterY - * @see CH.ifa.draw.util.Bounds#getGreaterY() - */ - // JUnitDoclet end javadoc_method getGreaterY() - public void testGetGreaterY() throws Exception { - // JUnitDoclet begin method getGreaterY - // JUnitDoclet end method getGreaterY - } - - // JUnitDoclet begin javadoc_method getWest() - /** - * Method testGetWest is testing getWest - * @see CH.ifa.draw.util.Bounds#getWest() - */ - // JUnitDoclet end javadoc_method getWest() - public void testGetWest() throws Exception { - // JUnitDoclet begin method getWest - // JUnitDoclet end method getWest - } - - // JUnitDoclet begin javadoc_method getEast() - /** - * Method testGetEast is testing getEast - * @see CH.ifa.draw.util.Bounds#getEast() - */ - // JUnitDoclet end javadoc_method getEast() - public void testGetEast() throws Exception { - // JUnitDoclet begin method getEast - // JUnitDoclet end method getEast - } - - // JUnitDoclet begin javadoc_method getSouth() - /** - * Method testGetSouth is testing getSouth - * @see CH.ifa.draw.util.Bounds#getSouth() - */ - // JUnitDoclet end javadoc_method getSouth() - public void testGetSouth() throws Exception { - // JUnitDoclet begin method getSouth - // JUnitDoclet end method getSouth - } - - // JUnitDoclet begin javadoc_method getNorth() - /** - * Method testGetNorth is testing getNorth - * @see CH.ifa.draw.util.Bounds#getNorth() - */ - // JUnitDoclet end javadoc_method getNorth() - public void testGetNorth() throws Exception { - // JUnitDoclet begin method getNorth - // JUnitDoclet end method getNorth - } - - // JUnitDoclet begin javadoc_method getWidth() - /** - * Method testGetWidth is testing getWidth - * @see CH.ifa.draw.util.Bounds#getWidth() - */ - // JUnitDoclet end javadoc_method getWidth() - public void testGetWidth() throws Exception { - // JUnitDoclet begin method getWidth - // JUnitDoclet end method getWidth - } - - // JUnitDoclet begin javadoc_method getHeight() - /** - * Method testGetHeight is testing getHeight - * @see CH.ifa.draw.util.Bounds#getHeight() - */ - // JUnitDoclet end javadoc_method getHeight() - public void testGetHeight() throws Exception { - // JUnitDoclet begin method getHeight - // JUnitDoclet end method getHeight - } - - // JUnitDoclet begin javadoc_method asRectangle2D() - /** - * Method testAsRectangle2D is testing asRectangle2D - * @see CH.ifa.draw.util.Bounds#asRectangle2D() - */ - // JUnitDoclet end javadoc_method asRectangle2D() - public void testAsRectangle2D() throws Exception { - // JUnitDoclet begin method asRectangle2D - // JUnitDoclet end method asRectangle2D - } - - // JUnitDoclet begin javadoc_method setCenter() - /** - * Method testSetGetCenter is testing setCenter - * and getCenter together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.Bounds#setCenter(java.awt.geom.Point2D) - * @see CH.ifa.draw.util.Bounds#getCenter() - */ - // JUnitDoclet end javadoc_method setCenter() - public void testSetGetCenter() throws Exception { - // JUnitDoclet begin method setCenter getCenter - Point2D[] tests = { new Point2D.Double(2.0, 3.0)}; - - for (int i = 0; i < tests.length; i++) { - bounds.setCenter(tests[i]); - assertEquals(tests[i], bounds.getCenter()); - } - // JUnitDoclet end method setCenter getCenter - } - - // JUnitDoclet begin method setNullCenter() - /** - * Test a null argument to setCenter. Expect an IllegalArgumentException - * - * @see CH.ifa.draw.util.Bounds#setCenter(java.awt.geom.Point2D) - */ - public void testSetNullCenter() throws Exception { - Point2D original = bounds.getCenter(); - - try { - bounds.setCenter(null); - fail("IllegalArgumentException expected"); - } - catch (IllegalArgumentException ok) { - assertEquals("setCenter(null) altered property value", original, bounds.getCenter()); - } - } - // JUnitDoclet end method - - // JUnitDoclet begin javadoc_method zoomBy() - /** - * Method testZoomBy is testing zoomBy - * @see CH.ifa.draw.util.Bounds#zoomBy(double) - */ - // JUnitDoclet end javadoc_method zoomBy() - public void testZoomBy() throws Exception { - // JUnitDoclet begin method zoomBy - // JUnitDoclet end method zoomBy - } - - // JUnitDoclet begin javadoc_method shiftBy() - /** - * Method testShiftBy is testing shiftBy - * @see CH.ifa.draw.util.Bounds#shiftBy(int, int) - */ - // JUnitDoclet end javadoc_method shiftBy() - public void testShiftBy() throws Exception { - // JUnitDoclet begin method shiftBy - // JUnitDoclet end method shiftBy - } - - // JUnitDoclet begin javadoc_method offset() - /** - * Method testOffset is testing offset - * @see CH.ifa.draw.util.Bounds#offset(double, double) - */ - // JUnitDoclet end javadoc_method offset() - public void testOffset() throws Exception { - // JUnitDoclet begin method offset - // JUnitDoclet end method offset - } - - // JUnitDoclet begin javadoc_method expandToRatio() - /** - * Method testExpandToRatio is testing expandToRatio - * @see CH.ifa.draw.util.Bounds#expandToRatio(double) - */ - // JUnitDoclet end javadoc_method expandToRatio() - public void testExpandToRatio() throws Exception { - // JUnitDoclet begin method expandToRatio - // JUnitDoclet end method expandToRatio - } - - // JUnitDoclet begin javadoc_method includeXCoordinate() - /** - * Method testIncludeXCoordinate is testing includeXCoordinate - * @see CH.ifa.draw.util.Bounds#includeXCoordinate(double) - */ - // JUnitDoclet end javadoc_method includeXCoordinate() - public void testIncludeXCoordinate() throws Exception { - // JUnitDoclet begin method includeXCoordinate - // JUnitDoclet end method includeXCoordinate - } - - // JUnitDoclet begin javadoc_method includeYCoordinate() - /** - * Method testIncludeYCoordinate is testing includeYCoordinate - * @see CH.ifa.draw.util.Bounds#includeYCoordinate(double) - */ - // JUnitDoclet end javadoc_method includeYCoordinate() - public void testIncludeYCoordinate() throws Exception { - // JUnitDoclet begin method includeYCoordinate - // JUnitDoclet end method includeYCoordinate - } - - // JUnitDoclet begin javadoc_method includePoint() - /** - * Method testIncludePoint is testing includePoint - * @see CH.ifa.draw.util.Bounds#includePoint(double, double) - */ - // JUnitDoclet end javadoc_method includePoint() - public void testIncludePoint() throws Exception { - // JUnitDoclet begin method includePoint - // JUnitDoclet end method includePoint - } - - // JUnitDoclet begin javadoc_method includeLine() - /** - * Method testIncludeLine is testing includeLine - * @see CH.ifa.draw.util.Bounds#includeLine(double, double, double, double) - */ - // JUnitDoclet end javadoc_method includeLine() - public void testIncludeLine() throws Exception { - // JUnitDoclet begin method includeLine - // JUnitDoclet end method includeLine - } - - // JUnitDoclet begin javadoc_method includeBounds() - /** - * Method testIncludeBounds is testing includeBounds - * @see CH.ifa.draw.util.Bounds#includeBounds(CH.ifa.draw.util.Bounds) - */ - // JUnitDoclet end javadoc_method includeBounds() - public void testIncludeBounds() throws Exception { - // JUnitDoclet begin method includeBounds - // JUnitDoclet end method includeBounds - } - - // JUnitDoclet begin javadoc_method includeRectangle2D() - /** - * Method testIncludeRectangle2D is testing includeRectangle2D - * @see CH.ifa.draw.util.Bounds#includeRectangle2D(java.awt.geom.Rectangle2D) - */ - // JUnitDoclet end javadoc_method includeRectangle2D() - public void testIncludeRectangle2D() throws Exception { - // JUnitDoclet begin method includeRectangle2D - // JUnitDoclet end method includeRectangle2D - } - - // JUnitDoclet begin javadoc_method intersect() - /** - * Method testIntersect is testing intersect - * @see CH.ifa.draw.util.Bounds#intersect(CH.ifa.draw.util.Bounds) - */ - // JUnitDoclet end javadoc_method intersect() - public void testIntersect() throws Exception { - // JUnitDoclet begin method intersect - // JUnitDoclet end method intersect - } - - // JUnitDoclet begin javadoc_method intersectsPoint() - /** - * Method testIntersectsPoint is testing intersectsPoint - * @see CH.ifa.draw.util.Bounds#intersectsPoint(double, double) - */ - // JUnitDoclet end javadoc_method intersectsPoint() - public void testIntersectsPoint() throws Exception { - // JUnitDoclet begin method intersectsPoint - // JUnitDoclet end method intersectsPoint - } - - // JUnitDoclet begin javadoc_method intersectsLine() - /** - * Method testIntersectsLine is testing intersectsLine - * @see CH.ifa.draw.util.Bounds#intersectsLine(double, double, double, double) - */ - // JUnitDoclet end javadoc_method intersectsLine() - public void testIntersectsLine() throws Exception { - // JUnitDoclet begin method intersectsLine - // JUnitDoclet end method intersectsLine - } - - // JUnitDoclet begin javadoc_method intersectsBounds() - /** - * Method testIntersectsBounds is testing intersectsBounds - * @see CH.ifa.draw.util.Bounds#intersectsBounds(CH.ifa.draw.util.Bounds) - */ - // JUnitDoclet end javadoc_method intersectsBounds() - public void testIntersectsBounds() throws Exception { - // JUnitDoclet begin method intersectsBounds - // JUnitDoclet end method intersectsBounds - } - - // JUnitDoclet begin javadoc_method completelyContainsLine() - /** - * Method testCompletelyContainsLine is testing completelyContainsLine - * @see CH.ifa.draw.util.Bounds#completelyContainsLine(double, double, double, double) - */ - // JUnitDoclet end javadoc_method completelyContainsLine() - public void testCompletelyContainsLine() throws Exception { - // JUnitDoclet begin method completelyContainsLine - // JUnitDoclet end method completelyContainsLine - } - - // JUnitDoclet begin javadoc_method isCompletelyInside() - /** - * Method testIsCompletelyInside is testing isCompletelyInside - * @see CH.ifa.draw.util.Bounds#isCompletelyInside(CH.ifa.draw.util.Bounds) - */ - // JUnitDoclet end javadoc_method isCompletelyInside() - public void testIsCompletelyInside() throws Exception { - // JUnitDoclet begin method isCompletelyInside - // JUnitDoclet end method isCompletelyInside - } - - // JUnitDoclet begin javadoc_method cropLine() - /** - * Method testCropLine is testing cropLine - * @see CH.ifa.draw.util.Bounds#cropLine(double, double, double, double) - */ - // JUnitDoclet end javadoc_method cropLine() - public void testCropLine() throws Exception { - // JUnitDoclet begin method cropLine - // JUnitDoclet end method cropLine - } - - // JUnitDoclet begin javadoc_method equals() - /** - * Method testEquals is testing equals - * @see CH.ifa.draw.util.Bounds#equals(java.lang.Object) - */ - // JUnitDoclet end javadoc_method equals() - public void testEquals() throws Exception { - // JUnitDoclet begin method equals - // JUnitDoclet end method equals - } - - // JUnitDoclet begin javadoc_method hashCode() - /** - * Method testHashCode is testing hashCode - * @see CH.ifa.draw.util.Bounds#hashCode() - */ - // JUnitDoclet end javadoc_method hashCode() - public void testHashCode() throws Exception { - // JUnitDoclet begin method hashCode - // JUnitDoclet end method hashCode - } - - // JUnitDoclet begin javadoc_method toString() - /** - * Method testToString is testing toString - * @see CH.ifa.draw.util.Bounds#toString() - */ - // JUnitDoclet end javadoc_method toString() - public void testToString() throws Exception { - // JUnitDoclet begin method toString - // JUnitDoclet end method toString - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/ClipboardTest.java b/JHotDraw/src/CH/ifa/draw/test/util/ClipboardTest.java deleted file mode 100644 index 4cdcc7f0dd594c65f5973715542d0177b180c6f0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/ClipboardTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.Clipboard; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ClipboardTest is generated by - * JUnitDoclet to hold the tests for Clipboard. - * @see CH.ifa.draw.util.Clipboard - */ -// JUnitDoclet end javadoc_class -public class ClipboardTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Clipboard clipboard; - // JUnitDoclet end class - - /** - * Constructor ClipboardTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ClipboardTest(String name) { - // JUnitDoclet begin method ClipboardTest - super(name); - // JUnitDoclet end method ClipboardTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.Clipboard createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return CH.ifa.draw.util.Clipboard.getClipboard(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - clipboard = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - clipboard = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getClipboard() - /** - * Method testGetClipboard is testing getClipboard - * @see CH.ifa.draw.util.Clipboard#getClipboard() - */ - // JUnitDoclet end javadoc_method getClipboard() - public void testGetClipboard() throws Exception { - // JUnitDoclet begin method getClipboard - // JUnitDoclet end method getClipboard - } - - // JUnitDoclet begin javadoc_method setContents() - /** - * Method testSetGetContents is testing setContents - * and getContents together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.Clipboard#setContents(java.lang.Object) - * @see CH.ifa.draw.util.Clipboard#getContents() - */ - // JUnitDoclet end javadoc_method setContents() - public void testSetGetContents() throws Exception { - // JUnitDoclet begin method setContents getContents - java.lang.Object[] tests = { new java.lang.Object(), null }; - - for (int i = 0; i < tests.length; i++) { - clipboard.setContents(tests[i]); - assertEquals(tests[i], clipboard.getContents()); - } - // JUnitDoclet end method setContents getContents - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/ColorMapTest.java b/JHotDraw/src/CH/ifa/draw/test/util/ColorMapTest.java deleted file mode 100644 index 67151b4a2b1f75f52f38036ae267bfcfefb37381..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/ColorMapTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.util.ColorMap; -import junit.framework.TestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ColorMapTest is generated by - * JUnitDoclet to hold the tests for ColorMap. - * @see CH.ifa.draw.util.ColorMap - */ -// JUnitDoclet end javadoc_class -public class ColorMapTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ColorMap colormap; - // JUnitDoclet end class - - /** - * Constructor ColorMapTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ColorMapTest(String name) { - // JUnitDoclet begin method ColorMapTest - super(name); - // JUnitDoclet end method ColorMapTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.ColorMap createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.ColorMap(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - colormap = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - colormap = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method size() - /** - * Method testSize is testing size - * @see CH.ifa.draw.util.ColorMap#size() - */ - // JUnitDoclet end javadoc_method size() - public void testSize() throws Exception { - // JUnitDoclet begin method size - // JUnitDoclet end method size - } - - // JUnitDoclet begin javadoc_method color() - /** - * Method testColor is testing color - * @see CH.ifa.draw.util.ColorMap#color(int) - */ - // JUnitDoclet end javadoc_method color() - public void testColor() throws Exception { - // JUnitDoclet begin method color - // JUnitDoclet end method color - } - - // JUnitDoclet begin javadoc_method name() - /** - * Method testName is testing name - * @see CH.ifa.draw.util.ColorMap#name(int) - */ - // JUnitDoclet end javadoc_method name() - public void testName() throws Exception { - // JUnitDoclet begin method name - // JUnitDoclet end method name - } - - // JUnitDoclet begin javadoc_method colorIndex() - /** - * Method testColorIndex is testing colorIndex - * @see CH.ifa.draw.util.ColorMap#colorIndex(java.awt.Color) - */ - // JUnitDoclet end javadoc_method colorIndex() - public void testColorIndex() throws Exception { - // JUnitDoclet begin method colorIndex - // JUnitDoclet end method colorIndex - } - - // JUnitDoclet begin javadoc_method isTransparent() - /** - * Method testIsTransparent is testing isTransparent - * @see CH.ifa.draw.util.ColorMap#isTransparent(java.awt.Color) - */ - // JUnitDoclet end javadoc_method isTransparent() - public void testIsTransparent() throws Exception { - // JUnitDoclet begin method isTransparent - // JUnitDoclet end method isTransparent - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/CommandButtonTest.java b/JHotDraw/src/CH/ifa/draw/test/util/CommandButtonTest.java deleted file mode 100644 index f8066452623eda3b60c077055f5032cdaba7176c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/CommandButtonTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.DuplicateCommand; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.CommandButton; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CommandButtonTest is generated by - * JUnitDoclet to hold the tests for CommandButton. - * @see CH.ifa.draw.util.CommandButton - */ -// JUnitDoclet end javadoc_class -public class CommandButtonTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CommandButton commandbutton; - // JUnitDoclet end class - - /** - * Constructor CommandButtonTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CommandButtonTest(String name) { - // JUnitDoclet begin method CommandButtonTest - super(name); - // JUnitDoclet end method CommandButtonTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.CommandButton createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.CommandButton(new DuplicateCommand("Duplicate", getDrawingEditor())); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - commandbutton = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - commandbutton = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method actionPerformed() - /** - * Method testActionPerformed is testing actionPerformed - * @see CH.ifa.draw.util.CommandButton#actionPerformed(java.awt.event.ActionEvent) - */ - // JUnitDoclet end javadoc_method actionPerformed() - public void testActionPerformed() throws Exception { - // JUnitDoclet begin method actionPerformed - // JUnitDoclet end method actionPerformed - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/CommandChoiceTest.java b/JHotDraw/src/CH/ifa/draw/test/util/CommandChoiceTest.java deleted file mode 100644 index 3ccddfa6e625b0f67573f9223596eea238344b7d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/CommandChoiceTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.CommandChoice; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CommandChoiceTest is generated by - * JUnitDoclet to hold the tests for CommandChoice. - * @see CH.ifa.draw.util.CommandChoice - */ -// JUnitDoclet end javadoc_class -public class CommandChoiceTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CommandChoice commandchoice; - // JUnitDoclet end class - - /** - * Constructor CommandChoiceTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CommandChoiceTest(String name) { - // JUnitDoclet begin method CommandChoiceTest - super(name); - // JUnitDoclet end method CommandChoiceTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.CommandChoice createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.CommandChoice(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - commandchoice = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - commandchoice = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addItem() - /** - * Method testAddItem is testing addItem - * @see CH.ifa.draw.util.CommandChoice#addItem(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method addItem() - public void testAddItem() throws Exception { - // JUnitDoclet begin method addItem - // JUnitDoclet end method addItem - } - - // JUnitDoclet begin javadoc_method itemStateChanged() - /** - * Method testItemStateChanged is testing itemStateChanged - * @see CH.ifa.draw.util.CommandChoice#itemStateChanged(java.awt.event.ItemEvent) - */ - // JUnitDoclet end javadoc_method itemStateChanged() - public void testItemStateChanged() throws Exception { - // JUnitDoclet begin method itemStateChanged - // JUnitDoclet end method itemStateChanged - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/CommandMenuTest.java b/JHotDraw/src/CH/ifa/draw/test/util/CommandMenuTest.java deleted file mode 100644 index 81344b3930887a730dcbf3163a326d4561353762..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/CommandMenuTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.CommandMenu; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CommandMenuTest is generated by - * JUnitDoclet to hold the tests for CommandMenu. - * @see CH.ifa.draw.util.CommandMenu - */ -// JUnitDoclet end javadoc_class -public class CommandMenuTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CommandMenu commandmenu; - // JUnitDoclet end class - - /** - * Constructor CommandMenuTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CommandMenuTest(String name) { - // JUnitDoclet begin method CommandMenuTest - super(name); - // JUnitDoclet end method CommandMenuTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.CommandMenu createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.CommandMenu("TestCommandMenu"); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - commandmenu = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - commandmenu = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.util.CommandMenu#add(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method addCheckItem() - /** - * Method testAddCheckItem is testing addCheckItem - * @see CH.ifa.draw.util.CommandMenu#addCheckItem(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method addCheckItem() - public void testAddCheckItem() throws Exception { - // JUnitDoclet begin method addCheckItem - // JUnitDoclet end method addCheckItem - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.CommandMenu#remove(CH.ifa.draw.util.Command) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method enable() - /** - * Method testEnable is testing enable - * @see CH.ifa.draw.util.CommandMenu#enable(java.lang.String, boolean) - */ - // JUnitDoclet end javadoc_method enable() - public void testEnable() throws Exception { - // JUnitDoclet begin method enable - // JUnitDoclet end method enable - } - - // JUnitDoclet begin javadoc_method checkEnabled() - /** - * Method testCheckEnabled is testing checkEnabled - * @see CH.ifa.draw.util.CommandMenu#checkEnabled() - */ - // JUnitDoclet end javadoc_method checkEnabled() - public void testCheckEnabled() throws Exception { - // JUnitDoclet begin method checkEnabled - // JUnitDoclet end method checkEnabled - } - - // JUnitDoclet begin javadoc_method actionPerformed() - /** - * Method testActionPerformed is testing actionPerformed - * @see CH.ifa.draw.util.CommandMenu#actionPerformed(java.awt.event.ActionEvent) - */ - // JUnitDoclet end javadoc_method actionPerformed() - public void testActionPerformed() throws Exception { - // JUnitDoclet begin method actionPerformed - // JUnitDoclet end method actionPerformed - } - - // JUnitDoclet begin javadoc_method commandExecuted() - /** - * Method testCommandExecuted is testing commandExecuted - * @see CH.ifa.draw.util.CommandMenu#commandExecuted(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandExecuted() - public void testCommandExecuted() throws Exception { - // JUnitDoclet begin method commandExecuted - // JUnitDoclet end method commandExecuted - } - - // JUnitDoclet begin javadoc_method commandExecutable() - /** - * Method testCommandExecutable is testing commandExecutable - * @see CH.ifa.draw.util.CommandMenu#commandExecutable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandExecutable() - public void testCommandExecutable() throws Exception { - // JUnitDoclet begin method commandExecutable - // JUnitDoclet end method commandExecutable - } - - // JUnitDoclet begin javadoc_method commandNotExecutable() - /** - * Method testCommandNotExecutable is testing commandNotExecutable - * @see CH.ifa.draw.util.CommandMenu#commandNotExecutable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandNotExecutable() - public void testCommandNotExecutable() throws Exception { - // JUnitDoclet begin method commandNotExecutable - // JUnitDoclet end method commandNotExecutable - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/FillerTest.java b/JHotDraw/src/CH/ifa/draw/test/util/FillerTest.java deleted file mode 100644 index e5f58e17e9a75d4ab1027ca3d4023e655b9c2c5e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/FillerTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.Filler; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FillerTest is generated by - * JUnitDoclet to hold the tests for Filler. - * @see CH.ifa.draw.util.Filler - */ -// JUnitDoclet end javadoc_class -public class FillerTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Filler filler; - // JUnitDoclet end class - - /** - * Constructor FillerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FillerTest(String name) { - // JUnitDoclet begin method FillerTest - super(name); - // JUnitDoclet end method FillerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.Filler createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.Filler(10, 10); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - filler = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - filler = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getMinimumSize() - /** - * Method testGetMinimumSize is testing getMinimumSize - * @see CH.ifa.draw.util.Filler#getMinimumSize() - */ - // JUnitDoclet end javadoc_method getMinimumSize() - public void testGetMinimumSize() throws Exception { - // JUnitDoclet begin method getMinimumSize - // JUnitDoclet end method getMinimumSize - } - - // JUnitDoclet begin javadoc_method getPreferredSize() - /** - * Method testGetPreferredSize is testing getPreferredSize - * @see CH.ifa.draw.util.Filler#getPreferredSize() - */ - // JUnitDoclet end javadoc_method getPreferredSize() - public void testGetPreferredSize() throws Exception { - // JUnitDoclet begin method getPreferredSize - // JUnitDoclet end method getPreferredSize - } - - // JUnitDoclet begin javadoc_method getBackground() - /** - * Method testGetBackground is testing getBackground - * @see CH.ifa.draw.util.Filler#getBackground() - */ - // JUnitDoclet end javadoc_method getBackground() - public void testGetBackground() throws Exception { - // JUnitDoclet begin method getBackground - // JUnitDoclet end method getBackground - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/FloatingTextFieldTest.java b/JHotDraw/src/CH/ifa/draw/test/util/FloatingTextFieldTest.java deleted file mode 100644 index 3925b386edc11a0b95ff2890d204995a4f9d4b68..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/FloatingTextFieldTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.FloatingTextField; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase FloatingTextFieldTest is generated by - * JUnitDoclet to hold the tests for FloatingTextField. - * @see CH.ifa.draw.util.FloatingTextField - */ -// JUnitDoclet end javadoc_class -public class FloatingTextFieldTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private FloatingTextField floatingtextfield; - // JUnitDoclet end class - - /** - * Constructor FloatingTextFieldTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public FloatingTextFieldTest(String name) { - // JUnitDoclet begin method FloatingTextFieldTest - super(name); - // JUnitDoclet end method FloatingTextFieldTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.FloatingTextField createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.FloatingTextField(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - floatingtextfield = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - floatingtextfield = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createOverlay() - /** - * Method testCreateOverlay is testing createOverlay - * @see CH.ifa.draw.util.FloatingTextField#createOverlay(java.awt.Container) - */ - // JUnitDoclet end javadoc_method createOverlay() - public void testCreateOverlay() throws Exception { - // JUnitDoclet begin method createOverlay - // JUnitDoclet end method createOverlay - } - - // JUnitDoclet begin javadoc_method addActionListener() - /** - * Method testAddActionListener is testing addActionListener - * @see CH.ifa.draw.util.FloatingTextField#addActionListener(java.awt.event.ActionListener) - */ - // JUnitDoclet end javadoc_method addActionListener() - public void testAddActionListener() throws Exception { - // JUnitDoclet begin method addActionListener - // JUnitDoclet end method addActionListener - } - - // JUnitDoclet begin javadoc_method removeActionListener() - /** - * Method testRemoveActionListener is testing removeActionListener - * @see CH.ifa.draw.util.FloatingTextField#removeActionListener(java.awt.event.ActionListener) - */ - // JUnitDoclet end javadoc_method removeActionListener() - public void testRemoveActionListener() throws Exception { - // JUnitDoclet begin method removeActionListener - // JUnitDoclet end method removeActionListener - } - - // JUnitDoclet begin javadoc_method setBounds() - /** - * Method testSetBounds is testing setBounds - * @see CH.ifa.draw.util.FloatingTextField#setBounds(java.awt.Rectangle, java.lang.String) - */ - // JUnitDoclet end javadoc_method setBounds() - public void testSetBounds() throws Exception { - // JUnitDoclet begin method setBounds - // JUnitDoclet end method setBounds - } - - // JUnitDoclet begin javadoc_method getText() - /** - * Method testGetText is testing getText - * @see CH.ifa.draw.util.FloatingTextField#getText() - */ - // JUnitDoclet end javadoc_method getText() - public void testGetText() throws Exception { - // JUnitDoclet begin method getText - // JUnitDoclet end method getText - } - - // JUnitDoclet begin javadoc_method getPreferredSize() - /** - * Method testGetPreferredSize is testing getPreferredSize - * @see CH.ifa.draw.util.FloatingTextField#getPreferredSize(int) - */ - // JUnitDoclet end javadoc_method getPreferredSize() - public void testGetPreferredSize() throws Exception { - // JUnitDoclet begin method getPreferredSize - // JUnitDoclet end method getPreferredSize - } - - // JUnitDoclet begin javadoc_method endOverlay() - /** - * Method testEndOverlay is testing endOverlay - * @see CH.ifa.draw.util.FloatingTextField#endOverlay() - */ - // JUnitDoclet end javadoc_method endOverlay() - public void testEndOverlay() throws Exception { - // JUnitDoclet begin method endOverlay - // JUnitDoclet end method endOverlay - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/GeomTest.java b/JHotDraw/src/CH/ifa/draw/test/util/GeomTest.java deleted file mode 100644 index 529ce70fd61e3edf18e4169e12ae47ca8530ac4a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/GeomTest.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.Geom; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase GeomTest is generated by - * JUnitDoclet to hold the tests for Geom. - * @see CH.ifa.draw.util.Geom - */ -// JUnitDoclet end javadoc_class -public class GeomTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Geom geom; - // JUnitDoclet end class - - /** - * Constructor GeomTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public GeomTest(String name) { - // JUnitDoclet begin method GeomTest - super(name); - // JUnitDoclet end method GeomTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.Geom createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - // Geom has static methods and cannot be instantiated. - return null; - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - geom = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - geom = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method lineContainsPoint() - /** - * Method testLineContainsPoint is testing lineContainsPoint - * @see CH.ifa.draw.util.Geom#lineContainsPoint(int, int, int, int, int, int) - */ - // JUnitDoclet end javadoc_method lineContainsPoint() - public void testLineContainsPoint() throws Exception { - // JUnitDoclet begin method lineContainsPoint - // JUnitDoclet end method lineContainsPoint - } - - // JUnitDoclet begin javadoc_method direction() - /** - * Method testDirection is testing direction - * @see CH.ifa.draw.util.Geom#direction(int, int, int, int) - */ - // JUnitDoclet end javadoc_method direction() - public void testDirection() throws Exception { - // JUnitDoclet begin method direction - // JUnitDoclet end method direction - } - - // JUnitDoclet begin javadoc_method south() - /** - * Method testSouth is testing south - * @see CH.ifa.draw.util.Geom#south(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method south() - public void testSouth() throws Exception { - // JUnitDoclet begin method south - // JUnitDoclet end method south - } - - // JUnitDoclet begin javadoc_method center() - /** - * Method testCenter is testing center - * @see CH.ifa.draw.util.Geom#center(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method center() - public void testCenter() throws Exception { - // JUnitDoclet begin method center - // JUnitDoclet end method center - } - - // JUnitDoclet begin javadoc_method west() - /** - * Method testWest is testing west - * @see CH.ifa.draw.util.Geom#west(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method west() - public void testWest() throws Exception { - // JUnitDoclet begin method west - // JUnitDoclet end method west - } - - // JUnitDoclet begin javadoc_method east() - /** - * Method testEast is testing east - * @see CH.ifa.draw.util.Geom#east(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method east() - public void testEast() throws Exception { - // JUnitDoclet begin method east - // JUnitDoclet end method east - } - - // JUnitDoclet begin javadoc_method north() - /** - * Method testNorth is testing north - * @see CH.ifa.draw.util.Geom#north(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method north() - public void testNorth() throws Exception { - // JUnitDoclet begin method north - // JUnitDoclet end method north - } - - // JUnitDoclet begin javadoc_method corner() - /** - * Method testCorner is testing corner - * @see CH.ifa.draw.util.Geom#corner(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method corner() - public void testCorner() throws Exception { - // JUnitDoclet begin method corner - // JUnitDoclet end method corner - } - - // JUnitDoclet begin javadoc_method topLeftCorner() - /** - * Method testTopLeftCorner is testing topLeftCorner - * @see CH.ifa.draw.util.Geom#topLeftCorner(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method topLeftCorner() - public void testTopLeftCorner() throws Exception { - // JUnitDoclet begin method topLeftCorner - // JUnitDoclet end method topLeftCorner - } - - // JUnitDoclet begin javadoc_method topRightCorner() - /** - * Method testTopRightCorner is testing topRightCorner - * @see CH.ifa.draw.util.Geom#topRightCorner(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method topRightCorner() - public void testTopRightCorner() throws Exception { - // JUnitDoclet begin method topRightCorner - // JUnitDoclet end method topRightCorner - } - - // JUnitDoclet begin javadoc_method bottomLeftCorner() - /** - * Method testBottomLeftCorner is testing bottomLeftCorner - * @see CH.ifa.draw.util.Geom#bottomLeftCorner(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method bottomLeftCorner() - public void testBottomLeftCorner() throws Exception { - // JUnitDoclet begin method bottomLeftCorner - // JUnitDoclet end method bottomLeftCorner - } - - // JUnitDoclet begin javadoc_method bottomRightCorner() - /** - * Method testBottomRightCorner is testing bottomRightCorner - * @see CH.ifa.draw.util.Geom#bottomRightCorner(java.awt.Rectangle) - */ - // JUnitDoclet end javadoc_method bottomRightCorner() - public void testBottomRightCorner() throws Exception { - // JUnitDoclet begin method bottomRightCorner - // JUnitDoclet end method bottomRightCorner - } - - // JUnitDoclet begin javadoc_method range() - /** - * Method testRange is testing range - * @see CH.ifa.draw.util.Geom#range(int, int, int) - */ - // JUnitDoclet end javadoc_method range() - public void testRange() throws Exception { - // JUnitDoclet begin method range - // JUnitDoclet end method range - } - - // JUnitDoclet begin javadoc_method length2() - /** - * Method testLength2 is testing length2 - * @see CH.ifa.draw.util.Geom#length2(int, int, int, int) - */ - // JUnitDoclet end javadoc_method length2() - public void testLength2() throws Exception { - // JUnitDoclet begin method length2 - // JUnitDoclet end method length2 - } - - // JUnitDoclet begin javadoc_method length() - /** - * Method testLength is testing length - * @see CH.ifa.draw.util.Geom#length(int, int, int, int) - */ - // JUnitDoclet end javadoc_method length() - public void testLength() throws Exception { - // JUnitDoclet begin method length - // JUnitDoclet end method length - } - - // JUnitDoclet begin javadoc_method pointToAngle() - /** - * Method testPointToAngle is testing pointToAngle - * @see CH.ifa.draw.util.Geom#pointToAngle(java.awt.Rectangle, java.awt.Point) - */ - // JUnitDoclet end javadoc_method pointToAngle() - public void testPointToAngle() throws Exception { - // JUnitDoclet begin method pointToAngle - // JUnitDoclet end method pointToAngle - } - - // JUnitDoclet begin javadoc_method angleToPoint() - /** - * Method testAngleToPoint is testing angleToPoint - * @see CH.ifa.draw.util.Geom#angleToPoint(java.awt.Rectangle, double) - */ - // JUnitDoclet end javadoc_method angleToPoint() - public void testAngleToPoint() throws Exception { - // JUnitDoclet begin method angleToPoint - // JUnitDoclet end method angleToPoint - } - - // JUnitDoclet begin javadoc_method polarToPoint() - /** - * Method testPolarToPoint is testing polarToPoint - * @see CH.ifa.draw.util.Geom#polarToPoint(double, double, double) - */ - // JUnitDoclet end javadoc_method polarToPoint() - public void testPolarToPoint() throws Exception { - // JUnitDoclet begin method polarToPoint - // JUnitDoclet end method polarToPoint - } - - // JUnitDoclet begin javadoc_method ovalAngleToPoint() - /** - * Method testOvalAngleToPoint is testing ovalAngleToPoint - * @see CH.ifa.draw.util.Geom#ovalAngleToPoint(java.awt.Rectangle, double) - */ - // JUnitDoclet end javadoc_method ovalAngleToPoint() - public void testOvalAngleToPoint() throws Exception { - // JUnitDoclet begin method ovalAngleToPoint - // JUnitDoclet end method ovalAngleToPoint - } - - // JUnitDoclet begin javadoc_method intersect() - /** - * Method testIntersect is testing intersect - * @see CH.ifa.draw.util.Geom#intersect(int, int, int, int, int, int, int, int) - */ - // JUnitDoclet end javadoc_method intersect() - public void testIntersect() throws Exception { - // JUnitDoclet begin method intersect - // JUnitDoclet end method intersect - } - - // JUnitDoclet begin javadoc_method distanceFromLine() - /** - * Method testDistanceFromLine is testing distanceFromLine - * @see CH.ifa.draw.util.Geom#distanceFromLine(int, int, int, int, int, int) - */ - // JUnitDoclet end javadoc_method distanceFromLine() - public void testDistanceFromLine() throws Exception { - // JUnitDoclet begin method distanceFromLine - // JUnitDoclet end method distanceFromLine - } - - // JUnitDoclet begin javadoc_method distanceFromLine2D() - /** - * Method testDistanceFromLine2D is testing distanceFromLine2D - * @see CH.ifa.draw.util.Geom#distanceFromLine2D(int, int, int, int, int, int) - */ - // JUnitDoclet end javadoc_method distanceFromLine2D() - public void testDistanceFromLine2D() throws Exception { - // JUnitDoclet begin method distanceFromLine2D - // JUnitDoclet end method distanceFromLine2D - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/GraphLayoutTest.java b/JHotDraw/src/CH/ifa/draw/test/util/GraphLayoutTest.java deleted file mode 100644 index d96ee3d406e8a245465e203f2cc96cb833766744..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/GraphLayoutTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.GraphLayout; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase GraphLayoutTest is generated by - * JUnitDoclet to hold the tests for GraphLayout. - * @see CH.ifa.draw.util.GraphLayout - */ -// JUnitDoclet end javadoc_class -public class GraphLayoutTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private GraphLayout graphlayout; - // JUnitDoclet end class - - /** - * Constructor GraphLayoutTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public GraphLayoutTest(String name) { - // JUnitDoclet begin method GraphLayoutTest - super(name); - // JUnitDoclet end method GraphLayoutTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.GraphLayout createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.GraphLayout(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - graphlayout = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - graphlayout = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addNode() - /** - * Method testAddNode is testing addNode - * @see CH.ifa.draw.util.GraphLayout#addNode(CH.ifa.draw.framework.Figure) - */ - // JUnitDoclet end javadoc_method addNode() - public void testAddNode() throws Exception { - // JUnitDoclet begin method addNode - // JUnitDoclet end method addNode - } - - // JUnitDoclet begin javadoc_method addEdge() - /** - * Method testAddEdge is testing addEdge - * @see CH.ifa.draw.util.GraphLayout#addEdge(CH.ifa.draw.framework.ConnectionFigure, int) - */ - // JUnitDoclet end javadoc_method addEdge() - public void testAddEdge() throws Exception { - // JUnitDoclet begin method addEdge - // JUnitDoclet end method addEdge - } - - // JUnitDoclet begin javadoc_method relax() - /** - * Method testRelax is testing relax - * @see CH.ifa.draw.util.GraphLayout#relax() - */ - // JUnitDoclet end javadoc_method relax() - public void testRelax() throws Exception { - // JUnitDoclet begin method relax - // JUnitDoclet end method relax - } - - // JUnitDoclet begin javadoc_method figureChanged() - /** - * Method testFigureChanged is testing figureChanged - * @see CH.ifa.draw.util.GraphLayout#figureChanged(CH.ifa.draw.framework.FigureChangeEvent) - */ - // JUnitDoclet end javadoc_method figureChanged() - public void testFigureChanged() throws Exception { - // JUnitDoclet begin method figureChanged - // JUnitDoclet end method figureChanged - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.GraphLayout#remove() - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/IconkitTest.java b/JHotDraw/src/CH/ifa/draw/test/util/IconkitTest.java deleted file mode 100644 index ad58f53a9bed5bb16d87cf9a417ebebbc9aee0f9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/IconkitTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.Iconkit; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase IconkitTest is generated by - * JUnitDoclet to hold the tests for Iconkit. - * @see CH.ifa.draw.util.Iconkit - */ -// JUnitDoclet end javadoc_class -public class IconkitTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private Iconkit iconkit; - // JUnitDoclet end class - - /** - * Constructor IconkitTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public IconkitTest(String name) { - // JUnitDoclet begin method IconkitTest - super(name); - // JUnitDoclet end method IconkitTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.Iconkit createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.Iconkit(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - iconkit = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - iconkit = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method instance() - /** - * Method testInstance is testing instance - * @see CH.ifa.draw.util.Iconkit#instance() - */ - // JUnitDoclet end javadoc_method instance() - public void testInstance() throws Exception { - // JUnitDoclet begin method instance - // JUnitDoclet end method instance - } - - // JUnitDoclet begin javadoc_method loadRegisteredImages() - /** - * Method testLoadRegisteredImages is testing loadRegisteredImages - * @see CH.ifa.draw.util.Iconkit#loadRegisteredImages(java.awt.Component) - */ - // JUnitDoclet end javadoc_method loadRegisteredImages() - public void testLoadRegisteredImages() throws Exception { - // JUnitDoclet begin method loadRegisteredImages - // JUnitDoclet end method loadRegisteredImages - } - - // JUnitDoclet begin javadoc_method registerImage() - /** - * Method testRegisterImage is testing registerImage - * @see CH.ifa.draw.util.Iconkit#registerImage(java.lang.String) - */ - // JUnitDoclet end javadoc_method registerImage() - public void testRegisterImage() throws Exception { - // JUnitDoclet begin method registerImage - // JUnitDoclet end method registerImage - } - - // JUnitDoclet begin javadoc_method registerAndLoadImage() - /** - * Method testRegisterAndLoadImage is testing registerAndLoadImage - * @see CH.ifa.draw.util.Iconkit#registerAndLoadImage(java.awt.Component, java.lang.String) - */ - // JUnitDoclet end javadoc_method registerAndLoadImage() - public void testRegisterAndLoadImage() throws Exception { - // JUnitDoclet begin method registerAndLoadImage - // JUnitDoclet end method registerAndLoadImage - } - - // JUnitDoclet begin javadoc_method loadImage() - /** - * Method testLoadImage is testing loadImage - * @see CH.ifa.draw.util.Iconkit#loadImage(java.lang.String) - */ - // JUnitDoclet end javadoc_method loadImage() - public void testLoadImage() throws Exception { - // JUnitDoclet begin method loadImage - // JUnitDoclet end method loadImage - } - - // JUnitDoclet begin javadoc_method loadImageResource() - /** - * Method testLoadImageResource is testing loadImageResource - * @see CH.ifa.draw.util.Iconkit#loadImageResource(java.lang.String) - */ - // JUnitDoclet end javadoc_method loadImageResource() - public void testLoadImageResource() throws Exception { - // JUnitDoclet begin method loadImageResource - // JUnitDoclet end method loadImageResource - } - - // JUnitDoclet begin javadoc_method getImage() - /** - * Method testGetImage is testing getImage - * @see CH.ifa.draw.util.Iconkit#getImage(java.lang.String) - */ - // JUnitDoclet end javadoc_method getImage() - public void testGetImage() throws Exception { - // JUnitDoclet begin method getImage - // JUnitDoclet end method getImage - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/JDOStorageFormatTest.java b/JHotDraw/src/CH/ifa/draw/test/util/JDOStorageFormatTest.java deleted file mode 100644 index 692a796b414b43593d21b1e4d5a67103642e7c4b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/JDOStorageFormatTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.JDOStorageFormat; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestCase JDOStorageFormatTest is generated by -* JUnitDoclet to hold the tests for JDOStorageFormat. -* @see CH.ifa.draw.util.JDOStorageFormat -*/ -// JUnitDoclet end javadoc_class -public class JDOStorageFormatTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private JDOStorageFormat jdostorageformat; - // JUnitDoclet end class - - /** - * Constructor JDOStorageFormatTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public JDOStorageFormatTest(String name) { - // JUnitDoclet begin method JDOStorageFormatTest - super(name); - // JUnitDoclet end method JDOStorageFormatTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.JDOStorageFormat createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.JDOStorageFormat(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - jdostorageformat = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - jdostorageformat = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createFileDescription() - /** - * Method testCreateFileDescription is testing createFileDescription - * @see CH.ifa.draw.util.JDOStorageFormat#createFileDescription() - */ - // JUnitDoclet end javadoc_method createFileDescription() - public void testCreateFileDescription() throws Exception { - // JUnitDoclet begin method createFileDescription - // JUnitDoclet end method createFileDescription - } - - // JUnitDoclet begin javadoc_method store() - /** - * Method testStore is testing store - * @see CH.ifa.draw.util.JDOStorageFormat#store(java.lang.String, CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method store() - public void testStore() throws Exception { - // JUnitDoclet begin method store - // JUnitDoclet end method store - } - - // JUnitDoclet begin javadoc_method restore() - /** - * Method testRestore is testing restore - * @see CH.ifa.draw.util.JDOStorageFormat#restore(java.lang.String) - */ - // JUnitDoclet end javadoc_method restore() - public void testRestore() throws Exception { - // JUnitDoclet begin method restore - // JUnitDoclet end method restore - } - - // JUnitDoclet begin javadoc_method main() - /** - * Method testMain is testing main - * @see CH.ifa.draw.util.JDOStorageFormat#main(java.lang.String[]) - */ - // JUnitDoclet end javadoc_method main() - public void testMain() throws Exception { - // JUnitDoclet begin method main - // JUnitDoclet end method main - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/PaletteIconTest.java b/JHotDraw/src/CH/ifa/draw/test/util/PaletteIconTest.java deleted file mode 100644 index b10546310d1c4dcd645f493782e894702918f5e6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/PaletteIconTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.util.PaletteIcon; -import CH.ifa.draw.util.Iconkit; -import CH.ifa.draw.application.DrawApplication; -import CH.ifa.draw.framework.JHotDrawRuntimeException; -import CH.ifa.draw.test.JHDTestCase; - -import java.awt.*; -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestCase PaletteIconTest is generated by -* JUnitDoclet to hold the tests for PaletteIcon. -* @see CH.ifa.draw.util.PaletteIcon -*/ -// JUnitDoclet end javadoc_class -public class PaletteIconTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PaletteIcon paletteicon; - // JUnitDoclet end class - - /** - * Constructor PaletteIconTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PaletteIconTest(String name) { - // JUnitDoclet begin method PaletteIconTest - super(name); - // JUnitDoclet end method PaletteIconTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.PaletteIcon createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Iconkit kit = Iconkit.instance(); - if (kit == null) { - throw new JHotDrawRuntimeException("Iconkit instance isn't set"); - } - - String iconName = DrawApplication.IMAGES + "SEL"; - Image im[] = new Image[3]; - im[0] = kit.loadImageResource(iconName + "1.gif"); - im[1] = kit.loadImageResource(iconName + "2.gif"); - im[2] = kit.loadImageResource(iconName + "3.gif"); - - MediaTracker tracker = new MediaTracker(getDrawingEditor()); - for (int i = 0; i < 3; i++) { - tracker.addImage(im[i], i); - } - try { - tracker.waitForAll(); - } - catch (Exception e) { - // ignore exception - } - - return new PaletteIcon(new Dimension(24, 24), im[0], im[1], im[2]); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - paletteicon = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - paletteicon = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method normal() - /** - * Method testNormal is testing normal - * @see CH.ifa.draw.util.PaletteIcon#normal() - */ - // JUnitDoclet end javadoc_method normal() - public void testNormal() throws Exception { - // JUnitDoclet begin method normal - // JUnitDoclet end method normal - } - - // JUnitDoclet begin javadoc_method pressed() - /** - * Method testPressed is testing pressed - * @see CH.ifa.draw.util.PaletteIcon#pressed() - */ - // JUnitDoclet end javadoc_method pressed() - public void testPressed() throws Exception { - // JUnitDoclet begin method pressed - // JUnitDoclet end method pressed - } - - // JUnitDoclet begin javadoc_method selected() - /** - * Method testSelected is testing selected - * @see CH.ifa.draw.util.PaletteIcon#selected() - */ - // JUnitDoclet end javadoc_method selected() - public void testSelected() throws Exception { - // JUnitDoclet begin method selected - // JUnitDoclet end method selected - } - - // JUnitDoclet begin javadoc_method getWidth() - /** - * Method testGetWidth is testing getWidth - * @see CH.ifa.draw.util.PaletteIcon#getWidth() - */ - // JUnitDoclet end javadoc_method getWidth() - public void testGetWidth() throws Exception { - // JUnitDoclet begin method getWidth - // JUnitDoclet end method getWidth - } - - // JUnitDoclet begin javadoc_method getHeight() - /** - * Method testGetHeight is testing getHeight - * @see CH.ifa.draw.util.PaletteIcon#getHeight() - */ - // JUnitDoclet end javadoc_method getHeight() - public void testGetHeight() throws Exception { - // JUnitDoclet begin method getHeight - // JUnitDoclet end method getHeight - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/PaletteLayoutTest.java b/JHotDraw/src/CH/ifa/draw/test/util/PaletteLayoutTest.java deleted file mode 100644 index f55d6fe5b030f6e617eb1d935a277518928ff7e3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/PaletteLayoutTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.awt.Point; - -import CH.ifa.draw.util.PaletteLayout; - -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase PaletteLayoutTest is generated by - * JUnitDoclet to hold the tests for PaletteLayout. - * @see CH.ifa.draw.util.PaletteLayout - */ -// JUnitDoclet end javadoc_class -public class PaletteLayoutTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private PaletteLayout palettelayout; - // JUnitDoclet end class - - /** - * Constructor PaletteLayoutTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public PaletteLayoutTest(String name) { - // JUnitDoclet begin method PaletteLayoutTest - super(name); - // JUnitDoclet end method PaletteLayoutTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.PaletteLayout createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.PaletteLayout(10, new Point(5, 5)); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - palettelayout = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - palettelayout = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addLayoutComponent() - /** - * Method testAddLayoutComponent is testing addLayoutComponent - * @see CH.ifa.draw.util.PaletteLayout#addLayoutComponent(java.lang.String, java.awt.Component) - */ - // JUnitDoclet end javadoc_method addLayoutComponent() - public void testAddLayoutComponent() throws Exception { - // JUnitDoclet begin method addLayoutComponent - // JUnitDoclet end method addLayoutComponent - } - - // JUnitDoclet begin javadoc_method removeLayoutComponent() - /** - * Method testRemoveLayoutComponent is testing removeLayoutComponent - * @see CH.ifa.draw.util.PaletteLayout#removeLayoutComponent(java.awt.Component) - */ - // JUnitDoclet end javadoc_method removeLayoutComponent() - public void testRemoveLayoutComponent() throws Exception { - // JUnitDoclet begin method removeLayoutComponent - // JUnitDoclet end method removeLayoutComponent - } - - // JUnitDoclet begin javadoc_method preferredLayoutSize() - /** - * Method testPreferredLayoutSize is testing preferredLayoutSize - * @see CH.ifa.draw.util.PaletteLayout#preferredLayoutSize(java.awt.Container) - */ - // JUnitDoclet end javadoc_method preferredLayoutSize() - public void testPreferredLayoutSize() throws Exception { - // JUnitDoclet begin method preferredLayoutSize - // JUnitDoclet end method preferredLayoutSize - } - - // JUnitDoclet begin javadoc_method minimumLayoutSize() - /** - * Method testMinimumLayoutSize is testing minimumLayoutSize - * @see CH.ifa.draw.util.PaletteLayout#minimumLayoutSize(java.awt.Container) - */ - // JUnitDoclet end javadoc_method minimumLayoutSize() - public void testMinimumLayoutSize() throws Exception { - // JUnitDoclet begin method minimumLayoutSize - // JUnitDoclet end method minimumLayoutSize - } - - // JUnitDoclet begin javadoc_method layoutContainer() - /** - * Method testLayoutContainer is testing layoutContainer - * @see CH.ifa.draw.util.PaletteLayout#layoutContainer(java.awt.Container) - */ - // JUnitDoclet end javadoc_method layoutContainer() - public void testLayoutContainer() throws Exception { - // JUnitDoclet begin method layoutContainer - // JUnitDoclet end method layoutContainer - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/RedoCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/util/RedoCommandTest.java deleted file mode 100644 index 7913327d7380da6084f49010f352248c739d8ed8..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/RedoCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.RedoCommand; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase RedoCommandTest is generated by - * JUnitDoclet to hold the tests for RedoCommand. - * @see CH.ifa.draw.util.RedoCommand - */ -// JUnitDoclet end javadoc_class -public class RedoCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private RedoCommand redocommand; - // JUnitDoclet end class - - /** - * Constructor RedoCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public RedoCommandTest(String name) { - // JUnitDoclet begin method RedoCommandTest - super(name); - // JUnitDoclet end method RedoCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.RedoCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.RedoCommand("TestRedo", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - redocommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - redocommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.util.RedoCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.util.RedoCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/ReverseListEnumeratorTest.java b/JHotDraw/src/CH/ifa/draw/test/util/ReverseListEnumeratorTest.java deleted file mode 100644 index 7bb4b929df5deb298cdaa8ea2f0aeb5533e3f406..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/ReverseListEnumeratorTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.util.List; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.util.CollectionsFactory; -import CH.ifa.draw.util.ReverseListEnumerator; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ReverseListEnumeratorTest is generated by - * JUnitDoclet to hold the tests for ReverseListEnumerator. - * @see CH.ifa.draw.util.ReverseListEnumerator - */ -// JUnitDoclet end javadoc_class -public class ReverseListEnumeratorTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ReverseListEnumerator reverselistenumerator; - // JUnitDoclet end class - - /** - * Constructor ReverseListEnumeratorTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ReverseListEnumeratorTest(String name) { - // JUnitDoclet begin method ReverseListEnumeratorTest - super(name); - // JUnitDoclet end method ReverseListEnumeratorTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.ReverseListEnumerator createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - List l = CollectionsFactory.current().createList(); - l.add("TestString1"); - l.add("TestString2"); - return new CH.ifa.draw.util.ReverseListEnumerator(l); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - reverselistenumerator = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - reverselistenumerator = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method hasNext() - /** - * Method testHasNext is testing hasNext - * @see CH.ifa.draw.util.ReverseListEnumerator#hasNext() - */ - // JUnitDoclet end javadoc_method hasNext() - public void testHasNext() throws Exception { - // JUnitDoclet begin method hasNext - // JUnitDoclet end method hasNext - } - - // JUnitDoclet begin javadoc_method next() - /** - * Method testNext is testing next - * @see CH.ifa.draw.util.ReverseListEnumerator#next() - */ - // JUnitDoclet end javadoc_method next() - public void testNext() throws Exception { - // JUnitDoclet begin method next - // JUnitDoclet end method next - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.ReverseListEnumerator#remove() - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/SerializationStorageFormatTest.java b/JHotDraw/src/CH/ifa/draw/test/util/SerializationStorageFormatTest.java deleted file mode 100644 index 9cae000dbc3cd3a6458413800a68e6eca67cae86..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/SerializationStorageFormatTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import CH.ifa.draw.util.SerializationStorageFormat; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SerializationStorageFormatTest is generated by - * JUnitDoclet to hold the tests for SerializationStorageFormat. - * @see CH.ifa.draw.util.SerializationStorageFormat - */ -// JUnitDoclet end javadoc_class -public class SerializationStorageFormatTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SerializationStorageFormat serializationstorageformat; - // JUnitDoclet end class - - /** - * Constructor SerializationStorageFormatTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SerializationStorageFormatTest(String name) { - // JUnitDoclet begin method SerializationStorageFormatTest - super(name); - // JUnitDoclet end method SerializationStorageFormatTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.SerializationStorageFormat createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.SerializationStorageFormat(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - serializationstorageformat = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - serializationstorageformat = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createFileDescription() - /** - * Method testCreateFileDescription is testing createFileDescription - * @see CH.ifa.draw.util.SerializationStorageFormat#createFileDescription() - */ - // JUnitDoclet end javadoc_method createFileDescription() - public void testCreateFileDescription() throws Exception { - // JUnitDoclet begin method createFileDescription - // JUnitDoclet end method createFileDescription - } - - // JUnitDoclet begin javadoc_method store() - /** - * Method testStore is testing store - * @see CH.ifa.draw.util.SerializationStorageFormat#store(java.lang.String, CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method store() - public void testStore() throws Exception { - // JUnitDoclet begin method store - // JUnitDoclet end method store - } - - // JUnitDoclet begin javadoc_method restore() - /** - * Method testRestore is testing restore - * @see CH.ifa.draw.util.SerializationStorageFormat#restore(java.lang.String) - */ - // JUnitDoclet end javadoc_method restore() - public void testRestore() throws Exception { - // JUnitDoclet begin method restore - // JUnitDoclet end method restore - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/StandardStorageFormatTest.java b/JHotDraw/src/CH/ifa/draw/test/util/StandardStorageFormatTest.java deleted file mode 100644 index 591141cdb69087fe040251f499c2915526917792..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/StandardStorageFormatTest.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.util.StandardStorageFormat; -import junit.framework.TestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StandardStorageFormatTest is generated by - * JUnitDoclet to hold the tests for StandardStorageFormat. - * @see CH.ifa.draw.util.StandardStorageFormat - */ -// JUnitDoclet end javadoc_class -public class StandardStorageFormatTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StandardStorageFormat standardstorageformat; - // JUnitDoclet end class - - /** - * Constructor StandardStorageFormatTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StandardStorageFormatTest(String name) { - // JUnitDoclet begin method StandardStorageFormatTest - super(name); - // JUnitDoclet end method StandardStorageFormatTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.StandardStorageFormat createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.StandardStorageFormat(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - standardstorageformat = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - standardstorageformat = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method setFileExtension() - /** - * Method testSetGetFileExtension is testing setFileExtension - * and getFileExtension together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.StandardStorageFormat#setFileExtension(java.lang.String) - * @see CH.ifa.draw.util.StandardStorageFormat#getFileExtension() - */ - // JUnitDoclet end javadoc_method setFileExtension() - public void testSetGetFileExtension() throws Exception { - // JUnitDoclet begin method setFileExtension getFileExtension - java.lang.String[] tests = { "", " ", "a", "A", "�", "�", "0123456789", "012345678901234567890", "\n", null }; - - for (int i = 0; i < tests.length; i++) { - standardstorageformat.setFileExtension(tests[i]); - assertEquals(tests[i], standardstorageformat.getFileExtension()); - } - // JUnitDoclet end method setFileExtension getFileExtension - } - - // JUnitDoclet begin javadoc_method createFileDescription() - /** - * Method testCreateFileDescription is testing createFileDescription - * @see CH.ifa.draw.util.StandardStorageFormat#createFileDescription() - */ - // JUnitDoclet end javadoc_method createFileDescription() - public void testCreateFileDescription() throws Exception { - // JUnitDoclet begin method createFileDescription - // JUnitDoclet end method createFileDescription - } - - // JUnitDoclet begin javadoc_method setFileDescription() - /** - * Method testSetGetFileDescription is testing setFileDescription - * and getFileDescription together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.StandardStorageFormat#setFileDescription(java.lang.String) - * @see CH.ifa.draw.util.StandardStorageFormat#getFileDescription() - */ - // JUnitDoclet end javadoc_method setFileDescription() - public void testSetGetFileDescription() throws Exception { - // JUnitDoclet begin method setFileDescription getFileDescription - java.lang.String[] tests = { "", " ", "a", "A", "�", "�", "0123456789", "012345678901234567890", "\n", null }; - - for (int i = 0; i < tests.length; i++) { - standardstorageformat.setFileDescription(tests[i]); - assertEquals(tests[i], standardstorageformat.getFileDescription()); - } - // JUnitDoclet end method setFileDescription getFileDescription - } - - // JUnitDoclet begin javadoc_method setFileFilter() - /** - * Method testSetGetFileFilter is testing setFileFilter - * and getFileFilter together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.StandardStorageFormat#setFileFilter(javax.swing.filechooser.FileFilter) - * @see CH.ifa.draw.util.StandardStorageFormat#getFileFilter() - */ - // JUnitDoclet end javadoc_method setFileFilter() - public void testSetGetFileFilter() throws Exception { - // JUnitDoclet begin method setFileFilter getFileFilter - javax.swing.filechooser.FileFilter[] tests = { null, null }; - - for (int i = 0; i < tests.length; i++) { - standardstorageformat.setFileFilter(tests[i]); - assertEquals(tests[i], standardstorageformat.getFileFilter()); - } - // JUnitDoclet end method setFileFilter getFileFilter - } - - // JUnitDoclet begin javadoc_method store() - /** - * Method testStore is testing store - * @see CH.ifa.draw.util.StandardStorageFormat#store(java.lang.String, CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method store() - public void testStore() throws Exception { - // JUnitDoclet begin method store - // JUnitDoclet end method store - } - - // JUnitDoclet begin javadoc_method restore() - /** - * Method testRestore is testing restore - * @see CH.ifa.draw.util.StandardStorageFormat#restore(java.lang.String) - */ - // JUnitDoclet end javadoc_method restore() - public void testRestore() throws Exception { - // JUnitDoclet begin method restore - // JUnitDoclet end method restore - } - - // JUnitDoclet begin javadoc_method equals() - /** - * Method testEquals is testing equals - * @see CH.ifa.draw.util.StandardStorageFormat#equals(java.lang.Object) - */ - // JUnitDoclet end javadoc_method equals() - public void testEquals() throws Exception { - // JUnitDoclet begin method equals - // JUnitDoclet end method equals - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/StandardVersionControlStrategyTest.java b/JHotDraw/src/CH/ifa/draw/test/util/StandardVersionControlStrategyTest.java deleted file mode 100644 index 0352cfc3477986ca5f075238ec5a96e6afde3117..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/StandardVersionControlStrategyTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.StandardVersionControlStrategy; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StandardVersionControlStrategyTest is generated by - * JUnitDoclet to hold the tests for StandardVersionControlStrategy. - * @see CH.ifa.draw.util.StandardVersionControlStrategy - */ -// JUnitDoclet end javadoc_class -public class StandardVersionControlStrategyTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StandardVersionControlStrategy standardversioncontrolstrategy; - // JUnitDoclet end class - /** - * Constructor StandardVersionControlStrategyTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StandardVersionControlStrategyTest(String name) { - // JUnitDoclet begin method StandardVersionControlStrategyTest - super(name); - // JUnitDoclet end method StandardVersionControlStrategyTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.StandardVersionControlStrategy createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.StandardVersionControlStrategy(getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - standardversioncontrolstrategy = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - standardversioncontrolstrategy = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method assertCompatibleVersion() - /** - * Method testAssertCompatibleVersion is testing assertCompatibleVersion - * @see CH.ifa.draw.util.StandardVersionControlStrategy#assertCompatibleVersion() - */ - // JUnitDoclet end javadoc_method assertCompatibleVersion() - public void testAssertCompatibleVersion() throws Exception { - // JUnitDoclet begin method assertCompatibleVersion - // JUnitDoclet end method assertCompatibleVersion - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/StorableInputTest.java b/JHotDraw/src/CH/ifa/draw/test/util/StorableInputTest.java deleted file mode 100644 index 772b78e4f9a43d48ee685db5c69078d527a7ceca..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/StorableInputTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.io.File; -import java.io.FileInputStream; - -import CH.ifa.draw.util.StorableInput; - -// JUnitDoclet begin import -import junit.framework.TestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StorableInputTest is generated by - * JUnitDoclet to hold the tests for StorableInput. - * @see CH.ifa.draw.util.StorableInput - */ -// JUnitDoclet end javadoc_class -public class StorableInputTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StorableInput storableinput; - // JUnitDoclet end class - - /** - * Constructor StorableInputTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StorableInputTest(String name) { - // JUnitDoclet begin method StorableInputTest - super(name); - // JUnitDoclet end method StorableInputTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.StorableInput createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - File tempFile = File.createTempFile("StorableInputTest", "dat"); - FileInputStream stream = new FileInputStream(tempFile); - tempFile.deleteOnExit(); - return new CH.ifa.draw.util.StorableInput(stream); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - storableinput = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - storableinput = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method readStorable() - /** - * Method testReadStorable is testing readStorable - * @see CH.ifa.draw.util.StorableInput#readStorable() - */ - // JUnitDoclet end javadoc_method readStorable() - public void testReadStorable() throws Exception { - // JUnitDoclet begin method readStorable - // JUnitDoclet end method readStorable - } - - // JUnitDoclet begin javadoc_method readString() - /** - * Method testReadString is testing readString - * @see CH.ifa.draw.util.StorableInput#readString() - */ - // JUnitDoclet end javadoc_method readString() - public void testReadString() throws Exception { - // JUnitDoclet begin method readString - // JUnitDoclet end method readString - } - - // JUnitDoclet begin javadoc_method readInt() - /** - * Method testReadInt is testing readInt - * @see CH.ifa.draw.util.StorableInput#readInt() - */ - // JUnitDoclet end javadoc_method readInt() - public void testReadInt() throws Exception { - // JUnitDoclet begin method readInt - // JUnitDoclet end method readInt - } - - // JUnitDoclet begin javadoc_method readLong() - /** - * Method testReadLong is testing readLong - * @see CH.ifa.draw.util.StorableInput#readLong() - */ - // JUnitDoclet end javadoc_method readLong() - public void testReadLong() throws Exception { - // JUnitDoclet begin method readLong - // JUnitDoclet end method readLong - } - - // JUnitDoclet begin javadoc_method readColor() - /** - * Method testReadColor is testing readColor - * @see CH.ifa.draw.util.StorableInput#readColor() - */ - // JUnitDoclet end javadoc_method readColor() - public void testReadColor() throws Exception { - // JUnitDoclet begin method readColor - // JUnitDoclet end method readColor - } - - // JUnitDoclet begin javadoc_method readDouble() - /** - * Method testReadDouble is testing readDouble - * @see CH.ifa.draw.util.StorableInput#readDouble() - */ - // JUnitDoclet end javadoc_method readDouble() - public void testReadDouble() throws Exception { - // JUnitDoclet begin method readDouble - // JUnitDoclet end method readDouble - } - - // JUnitDoclet begin javadoc_method readBoolean() - /** - * Method testReadBoolean is testing readBoolean - * @see CH.ifa.draw.util.StorableInput#readBoolean() - */ - // JUnitDoclet end javadoc_method readBoolean() - public void testReadBoolean() throws Exception { - // JUnitDoclet begin method readBoolean - // JUnitDoclet end method readBoolean - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/StorableOutputTest.java b/JHotDraw/src/CH/ifa/draw/test/util/StorableOutputTest.java deleted file mode 100644 index e80317dcdb2b0fbba1ea229c8e4b743d2db9d573..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/StorableOutputTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.io.File; -import java.io.FileOutputStream; - -import CH.ifa.draw.util.StorableOutput; - -// JUnitDoclet begin import -import junit.framework.TestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StorableOutputTest is generated by - * JUnitDoclet to hold the tests for StorableOutput. - * @see CH.ifa.draw.util.StorableOutput - */ -// JUnitDoclet end javadoc_class -public class StorableOutputTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StorableOutput storableoutput; - // JUnitDoclet end class - - /** - * Constructor StorableOutputTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StorableOutputTest(String name) { - // JUnitDoclet begin method StorableOutputTest - super(name); - // JUnitDoclet end method StorableOutputTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.StorableOutput createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - File tempFile = File.createTempFile("StorableOutputTest", "dat"); - FileOutputStream stream = new FileOutputStream(tempFile); - tempFile.deleteOnExit(); - return new CH.ifa.draw.util.StorableOutput(stream); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - storableoutput = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - storableoutput = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method writeStorable() - /** - * Method testWriteStorable is testing writeStorable - * @see CH.ifa.draw.util.StorableOutput#writeStorable(CH.ifa.draw.util.Storable) - */ - // JUnitDoclet end javadoc_method writeStorable() - public void testWriteStorable() throws Exception { - // JUnitDoclet begin method writeStorable - // JUnitDoclet end method writeStorable - } - - // JUnitDoclet begin javadoc_method writeInt() - /** - * Method testWriteInt is testing writeInt - * @see CH.ifa.draw.util.StorableOutput#writeInt(int) - */ - // JUnitDoclet end javadoc_method writeInt() - public void testWriteInt() throws Exception { - // JUnitDoclet begin method writeInt - // JUnitDoclet end method writeInt - } - - // JUnitDoclet begin javadoc_method writeLong() - /** - * Method testWriteLong is testing writeLong - * @see CH.ifa.draw.util.StorableOutput#writeLong(long) - */ - // JUnitDoclet end javadoc_method writeLong() - public void testWriteLong() throws Exception { - // JUnitDoclet begin method writeLong - // JUnitDoclet end method writeLong - } - - // JUnitDoclet begin javadoc_method writeColor() - /** - * Method testWriteColor is testing writeColor - * @see CH.ifa.draw.util.StorableOutput#writeColor(java.awt.Color) - */ - // JUnitDoclet end javadoc_method writeColor() - public void testWriteColor() throws Exception { - // JUnitDoclet begin method writeColor - // JUnitDoclet end method writeColor - } - - // JUnitDoclet begin javadoc_method writeDouble() - /** - * Method testWriteDouble is testing writeDouble - * @see CH.ifa.draw.util.StorableOutput#writeDouble(double) - */ - // JUnitDoclet end javadoc_method writeDouble() - public void testWriteDouble() throws Exception { - // JUnitDoclet begin method writeDouble - // JUnitDoclet end method writeDouble - } - - // JUnitDoclet begin javadoc_method writeBoolean() - /** - * Method testWriteBoolean is testing writeBoolean - * @see CH.ifa.draw.util.StorableOutput#writeBoolean(boolean) - */ - // JUnitDoclet end javadoc_method writeBoolean() - public void testWriteBoolean() throws Exception { - // JUnitDoclet begin method writeBoolean - // JUnitDoclet end method writeBoolean - } - - // JUnitDoclet begin javadoc_method writeString() - /** - * Method testWriteString is testing writeString - * @see CH.ifa.draw.util.StorableOutput#writeString(java.lang.String) - */ - // JUnitDoclet end javadoc_method writeString() - public void testWriteString() throws Exception { - // JUnitDoclet begin method writeString - // JUnitDoclet end method writeString - } - - // JUnitDoclet begin javadoc_method close() - /** - * Method testClose is testing close - * @see CH.ifa.draw.util.StorableOutput#close() - */ - // JUnitDoclet end javadoc_method close() - public void testClose() throws Exception { - // JUnitDoclet begin method close - // JUnitDoclet end method close - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/StorageFormatManagerTest.java b/JHotDraw/src/CH/ifa/draw/test/util/StorageFormatManagerTest.java deleted file mode 100644 index f692f587f2a0aff397aa0e19b223a71152b9394e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/StorageFormatManagerTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import junit.framework.TestCase; - -// JUnitDoclet begin import -import CH.ifa.draw.util.StandardStorageFormat; -import CH.ifa.draw.util.StorageFormatManager; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase StorageFormatManagerTest is generated by - * JUnitDoclet to hold the tests for StorageFormatManager. - * @see CH.ifa.draw.util.StorageFormatManager - */ -// JUnitDoclet end javadoc_class -public class StorageFormatManagerTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private StorageFormatManager storageformatmanager; - // JUnitDoclet end class - - /** - * Constructor StorageFormatManagerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public StorageFormatManagerTest(String name) { - // JUnitDoclet begin method StorageFormatManagerTest - super(name); - // JUnitDoclet end method StorageFormatManagerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.StorageFormatManager createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.StorageFormatManager(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - storageformatmanager = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - storageformatmanager = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method addStorageFormat() - /** - * Method testAddStorageFormat is testing addStorageFormat - * @see CH.ifa.draw.util.StorageFormatManager#addStorageFormat(CH.ifa.draw.util.StorageFormat) - */ - // JUnitDoclet end javadoc_method addStorageFormat() - public void testAddStorageFormat() throws Exception { - // JUnitDoclet begin method addStorageFormat - // JUnitDoclet end method addStorageFormat - } - - // JUnitDoclet begin javadoc_method removeStorageFormat() - /** - * Method testRemoveStorageFormat is testing removeStorageFormat - * @see CH.ifa.draw.util.StorageFormatManager#removeStorageFormat(CH.ifa.draw.util.StorageFormat) - */ - // JUnitDoclet end javadoc_method removeStorageFormat() - public void testRemoveStorageFormat() throws Exception { - // JUnitDoclet begin method removeStorageFormat - // JUnitDoclet end method removeStorageFormat - } - - // JUnitDoclet begin javadoc_method containsStorageFormat() - /** - * Method testContainsStorageFormat is testing containsStorageFormat - * @see CH.ifa.draw.util.StorageFormatManager#containsStorageFormat(CH.ifa.draw.util.StorageFormat) - */ - // JUnitDoclet end javadoc_method containsStorageFormat() - public void testContainsStorageFormat() throws Exception { - // JUnitDoclet begin method containsStorageFormat - // JUnitDoclet end method containsStorageFormat - } - - // JUnitDoclet begin javadoc_method setDefaultStorageFormat() - /** - * Method testSetGetDefaultStorageFormat is testing setDefaultStorageFormat - * and getDefaultStorageFormat together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.StorageFormatManager#setDefaultStorageFormat(CH.ifa.draw.util.StorageFormat) - * @see CH.ifa.draw.util.StorageFormatManager#getDefaultStorageFormat() - */ - // JUnitDoclet end javadoc_method setDefaultStorageFormat() - public void testSetGetDefaultStorageFormat() throws Exception { - // JUnitDoclet begin method setDefaultStorageFormat getDefaultStorageFormat - CH.ifa.draw.util.StorageFormat[] tests = { new StandardStorageFormat(), null }; - - for (int i = 0; i < tests.length; i++) { - storageformatmanager.setDefaultStorageFormat(tests[i]); - assertEquals(tests[i], storageformatmanager.getDefaultStorageFormat()); - } - // JUnitDoclet end method setDefaultStorageFormat getDefaultStorageFormat - } - - // JUnitDoclet begin javadoc_method registerFileFilters() - /** - * Method testRegisterFileFilters is testing registerFileFilters - * @see CH.ifa.draw.util.StorageFormatManager#registerFileFilters(javax.swing.JFileChooser) - */ - // JUnitDoclet end javadoc_method registerFileFilters() - public void testRegisterFileFilters() throws Exception { - // JUnitDoclet begin method registerFileFilters - // JUnitDoclet end method registerFileFilters - } - - // JUnitDoclet begin javadoc_method findStorageFormat() - /** - * Method testFindStorageFormat is testing findStorageFormat - * @see CH.ifa.draw.util.StorageFormatManager#findStorageFormat(javax.swing.filechooser.FileFilter) - */ - // JUnitDoclet end javadoc_method findStorageFormat() - public void testFindStorageFormat() throws Exception { - // JUnitDoclet begin method findStorageFormat - // JUnitDoclet end method findStorageFormat - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoCommandTest.java deleted file mode 100644 index 70e41ccc54f06a0993e9d3b974f8ff53196659dc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoCommandTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.UndoCommand; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoCommandTest is generated by - * JUnitDoclet to hold the tests for UndoCommand. - * @see CH.ifa.draw.util.UndoCommand - */ -// JUnitDoclet end javadoc_class -public class UndoCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoCommand undocommand; - // JUnitDoclet end class - - /** - * Constructor UndoCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoCommandTest(String name) { - // JUnitDoclet begin method UndoCommandTest - super(name); - // JUnitDoclet end method UndoCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.UndoCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.UndoCommand("TestUndo", getDrawingEditor()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undocommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undocommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.util.UndoCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutableWithView() - /** - * Method testIsExecutableWithView is testing isExecutableWithView - * @see CH.ifa.draw.util.UndoCommand#isExecutableWithView() - */ - // JUnitDoclet end javadoc_method isExecutableWithView() - public void testIsExecutableWithView() throws Exception { - // JUnitDoclet begin method isExecutableWithView - // JUnitDoclet end method isExecutableWithView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoManagerTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoManagerTest.java deleted file mode 100644 index e165cea148e893d946bbc65c219bf864d435bd33..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoManagerTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.util.UndoManager; -import junit.framework.TestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoManagerTest is generated by - * JUnitDoclet to hold the tests for UndoManager. - * @see CH.ifa.draw.util.UndoManager - */ -// JUnitDoclet end javadoc_class -public class UndoManagerTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoManager undomanager; - // JUnitDoclet end class - - /** - * Constructor UndoManagerTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoManagerTest(String name) { - // JUnitDoclet begin method UndoManagerTest - super(name); - // JUnitDoclet end method UndoManagerTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.UndoManager createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.UndoManager(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undomanager = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undomanager = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method pushUndo() - /** - * Method testPushUndo is testing pushUndo - * @see CH.ifa.draw.util.UndoManager#pushUndo(CH.ifa.draw.util.Undoable) - */ - // JUnitDoclet end javadoc_method pushUndo() - public void testPushUndo() throws Exception { - // JUnitDoclet begin method pushUndo - // JUnitDoclet end method pushUndo - } - - // JUnitDoclet begin javadoc_method pushRedo() - /** - * Method testPushRedo is testing pushRedo - * @see CH.ifa.draw.util.UndoManager#pushRedo(CH.ifa.draw.util.Undoable) - */ - // JUnitDoclet end javadoc_method pushRedo() - public void testPushRedo() throws Exception { - // JUnitDoclet begin method pushRedo - // JUnitDoclet end method pushRedo - } - - // JUnitDoclet begin javadoc_method isUndoable() - /** - * Method testIsUndoable is testing isUndoable - * @see CH.ifa.draw.util.UndoManager#isUndoable() - */ - // JUnitDoclet end javadoc_method isUndoable() - public void testIsUndoable() throws Exception { - // JUnitDoclet begin method isUndoable - // JUnitDoclet end method isUndoable - } - - // JUnitDoclet begin javadoc_method isRedoable() - /** - * Method testIsRedoable is testing isRedoable - * @see CH.ifa.draw.util.UndoManager#isRedoable() - */ - // JUnitDoclet end javadoc_method isRedoable() - public void testIsRedoable() throws Exception { - // JUnitDoclet begin method isRedoable - // JUnitDoclet end method isRedoable - } - - // JUnitDoclet begin javadoc_method getUndoSize() - /** - * Method testGetUndoSize is testing getUndoSize - * @see CH.ifa.draw.util.UndoManager#getUndoSize() - */ - // JUnitDoclet end javadoc_method getUndoSize() - public void testGetUndoSize() throws Exception { - // JUnitDoclet begin method getUndoSize - // JUnitDoclet end method getUndoSize - } - - // JUnitDoclet begin javadoc_method getRedoSize() - /** - * Method testGetRedoSize is testing getRedoSize - * @see CH.ifa.draw.util.UndoManager#getRedoSize() - */ - // JUnitDoclet end javadoc_method getRedoSize() - public void testGetRedoSize() throws Exception { - // JUnitDoclet begin method getRedoSize - // JUnitDoclet end method getRedoSize - } - - // JUnitDoclet begin javadoc_method popUndo() - /** - * Method testPopUndo is testing popUndo - * @see CH.ifa.draw.util.UndoManager#popUndo() - */ - // JUnitDoclet end javadoc_method popUndo() - public void testPopUndo() throws Exception { - // JUnitDoclet begin method popUndo - // JUnitDoclet end method popUndo - } - - // JUnitDoclet begin javadoc_method popRedo() - /** - * Method testPopRedo is testing popRedo - * @see CH.ifa.draw.util.UndoManager#popRedo() - */ - // JUnitDoclet end javadoc_method popRedo() - public void testPopRedo() throws Exception { - // JUnitDoclet begin method popRedo - // JUnitDoclet end method popRedo - } - - // JUnitDoclet begin javadoc_method clearUndos() - /** - * Method testClearUndos is testing clearUndos - * @see CH.ifa.draw.util.UndoManager#clearUndos() - */ - // JUnitDoclet end javadoc_method clearUndos() - public void testClearUndos() throws Exception { - // JUnitDoclet begin method clearUndos - // JUnitDoclet end method clearUndos - } - - // JUnitDoclet begin javadoc_method clearRedos() - /** - * Method testClearRedos is testing clearRedos - * @see CH.ifa.draw.util.UndoManager#clearRedos() - */ - // JUnitDoclet end javadoc_method clearRedos() - public void testClearRedos() throws Exception { - // JUnitDoclet begin method clearRedos - // JUnitDoclet end method clearRedos - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoRedoActivityTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoRedoActivityTest.java deleted file mode 100644 index 9faabc5157403e93279d19d63357efa6ea2727ee..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoRedoActivityTest.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.awt.Point; -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.standard.PasteCommand; -import CH.ifa.draw.standard.SingleFigureEnumerator; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.UndoRedoActivity; -import CH.ifa.draw.util.Undoable; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoRedoActivityTest is generated by - * JUnitDoclet to hold the tests for UndoRedoActivity. - * @see CH.ifa.draw.util.UndoRedoActivity - */ -// JUnitDoclet end javadoc_class -public class UndoRedoActivityTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoRedoActivity undoredoactivity; - // JUnitDoclet end class - - /** - * Constructor UndoRedoActivityTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoRedoActivityTest(String name) { - // JUnitDoclet begin method UndoRedoActivityTest - super(name); - // JUnitDoclet end method UndoRedoActivityTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.UndoRedoActivity createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Undoable undoActivity = new PasteCommand.UndoActivity(getDrawingEditor().view()); - undoActivity.setAffectedFigures(new SingleFigureEnumerator(new RectangleFigure(new Point(33, 33), new Point(44, 44)))); - return (UndoRedoActivity)UndoRedoActivity.createUndoRedoActivity(undoActivity); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undoredoactivity = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undoredoactivity = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method undo() - /** - * Method testUndo is testing undo - * @see CH.ifa.draw.util.UndoRedoActivity#undo() - */ - // JUnitDoclet end javadoc_method undo() - public void testUndo() throws Exception { - // JUnitDoclet begin method undo - // JUnitDoclet end method undo - } - - // JUnitDoclet begin javadoc_method redo() - /** - * Method testRedo is testing redo - * @see CH.ifa.draw.util.UndoRedoActivity#redo() - */ - // JUnitDoclet end javadoc_method redo() - public void testRedo() throws Exception { - // JUnitDoclet begin method redo - // JUnitDoclet end method redo - } - - // JUnitDoclet begin javadoc_method setUndoable() - /** - * Method testSetIsUndoable is testing setUndoable - * and isUndoable together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoRedoActivity#setUndoable(boolean) - * @see CH.ifa.draw.util.UndoRedoActivity#isUndoable() - */ - // JUnitDoclet end javadoc_method setUndoable() - public void testSetIsUndoable() throws Exception { - // JUnitDoclet begin method setUndoable isUndoable - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - undoredoactivity.setUndoable(tests[i]); - assertEquals(tests[i], undoredoactivity.isUndoable()); - } - // JUnitDoclet end method setUndoable isUndoable - } - - // JUnitDoclet begin javadoc_method setRedoable() - /** - * Method testSetIsRedoable is testing setRedoable - * and isRedoable together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoRedoActivity#setRedoable(boolean) - * @see CH.ifa.draw.util.UndoRedoActivity#isRedoable() - */ - // JUnitDoclet end javadoc_method setRedoable() - public void testSetIsRedoable() throws Exception { - // JUnitDoclet begin method setRedoable isRedoable - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - undoredoactivity.setRedoable(tests[i]); - assertEquals(tests[i], undoredoactivity.isRedoable()); - } - // JUnitDoclet end method setRedoable isRedoable - } - - // JUnitDoclet begin javadoc_method setAffectedFigures() - /** - * Method testSetGetAffectedFigures is testing setAffectedFigures - * and getAffectedFigures together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoRedoActivity#setAffectedFigures(CH.ifa.draw.framework.FigureEnumeration) - * @see CH.ifa.draw.util.UndoRedoActivity#getAffectedFigures() - */ - // JUnitDoclet end javadoc_method setAffectedFigures() - public void testSetGetAffectedFigures() throws Exception { - // JUnitDoclet begin method setAffectedFigures getAffectedFigures - FigureEnumeration[] tests = { new SingleFigureEnumerator(new RectangleFigure(new Point(44, 44), new Point(55, 55)))}; - - for (int i = 0; i < tests.length; i++) { - undoredoactivity.setAffectedFigures(tests[i]); - FigureEnumeration returned = undoredoactivity.getAffectedFigures(); - tests[i].reset(); - while (returned.hasNextFigure()) { - assertTrue(tests[i].hasNextFigure()); - assertEquals(tests[i].nextFigure(), returned.nextFigure()); - } - assertFalse(tests[i].hasNextFigure()); - } - // JUnitDoclet end method setAffectedFigures getAffectedFigures - } - - // JUnitDoclet begin method testSetNullAffectedFigures() - /** - * Test a null argument to setAffectedFigures. Expect an IllegalArgumentException - * - * @see CH.ifa.draw.util.UndoRedoActivity#setAffectedFigures(CH.ifa.draw.framework.PointConstrainer) - */ - public void testSetNullAffectedFigures() throws Exception { - FigureEnumeration original = undoredoactivity.getAffectedFigures(); - - try { - undoredoactivity.setAffectedFigures(null); - fail("IllegalArgumentException expected"); - } - catch (IllegalArgumentException ok) { - } - } - // JUnitDoclet end method - - // JUnitDoclet begin javadoc_method getAffectedFiguresCount() - /** - * Method testGetAffectedFiguresCount is testing getAffectedFiguresCount - * @see CH.ifa.draw.util.UndoRedoActivity#getAffectedFiguresCount() - */ - // JUnitDoclet end javadoc_method getAffectedFiguresCount() - public void testGetAffectedFiguresCount() throws Exception { - // JUnitDoclet begin method getAffectedFiguresCount - // JUnitDoclet end method getAffectedFiguresCount - } - - // JUnitDoclet begin javadoc_method getDrawingView() - /** - * Method testGetDrawingView is testing getDrawingView - * @see CH.ifa.draw.util.UndoRedoActivity#getDrawingView() - */ - // JUnitDoclet end javadoc_method getDrawingView() - public void testGetDrawingView() throws Exception { - // JUnitDoclet begin method getDrawingView - // JUnitDoclet end method getDrawingView - } - - // JUnitDoclet begin javadoc_method release() - /** - * Method testRelease is testing release - * @see CH.ifa.draw.util.UndoRedoActivity#release() - */ - // JUnitDoclet end javadoc_method release() - public void testRelease() throws Exception { - // JUnitDoclet begin method release - // JUnitDoclet end method release - } - - // JUnitDoclet begin javadoc_method getReversedActivity() - /** - * Method testGetReversedActivity is testing getReversedActivity - * @see CH.ifa.draw.util.UndoRedoActivity#getReversedActivity() - */ - // JUnitDoclet end javadoc_method getReversedActivity() - public void testGetReversedActivity() throws Exception { - // JUnitDoclet begin method getReversedActivity - // JUnitDoclet end method getReversedActivity - } - - // JUnitDoclet begin javadoc_method createUndoRedoActivity() - /** - * Method testCreateUndoRedoActivity is testing createUndoRedoActivity - * @see CH.ifa.draw.util.UndoRedoActivity#createUndoRedoActivity(CH.ifa.draw.util.Undoable) - */ - // JUnitDoclet end javadoc_method createUndoRedoActivity() - public void testCreateUndoRedoActivity() throws Exception { - // JUnitDoclet begin method createUndoRedoActivity - // JUnitDoclet end method createUndoRedoActivity - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoableAdapterTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoableAdapterTest.java deleted file mode 100644 index b91fcbb888eaa492f57327a7741a49c85c75ca86..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoableAdapterTest.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.UndoableAdapter; -import CH.ifa.draw.standard.SingleFigureEnumerator; -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.framework.FigureEnumeration; - -import java.awt.*; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoableAdapterTest is generated by - * JUnitDoclet to hold the tests for UndoableAdapter. - * @see CH.ifa.draw.util.UndoableAdapter - */ -// JUnitDoclet end javadoc_class -public class UndoableAdapterTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoableAdapter undoableadapter; - // JUnitDoclet end class - - /** - * Constructor UndoableAdapterTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoableAdapterTest(String name) { - // JUnitDoclet begin method UndoableAdapterTest - super(name); - // JUnitDoclet end method UndoableAdapterTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.UndoableAdapter createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.UndoableAdapter(getDrawingEditor().view()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undoableadapter = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undoableadapter = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method undo() - /** - * Method testUndo is testing undo - * @see CH.ifa.draw.util.UndoableAdapter#undo() - */ - // JUnitDoclet end javadoc_method undo() - public void testUndo() throws Exception { - // JUnitDoclet begin method undo - // JUnitDoclet end method undo - } - - // JUnitDoclet begin javadoc_method redo() - /** - * Method testRedo is testing redo - * @see CH.ifa.draw.util.UndoableAdapter#redo() - */ - // JUnitDoclet end javadoc_method redo() - public void testRedo() throws Exception { - // JUnitDoclet begin method redo - // JUnitDoclet end method redo - } - - // JUnitDoclet begin javadoc_method setUndoable() - /** - * Method testSetIsUndoable is testing setUndoable - * and isUndoable together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableAdapter#setUndoable(boolean) - * @see CH.ifa.draw.util.UndoableAdapter#isUndoable() - */ - // JUnitDoclet end javadoc_method setUndoable() - public void testSetIsUndoable() throws Exception { - // JUnitDoclet begin method setUndoable isUndoable - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - undoableadapter.setUndoable(tests[i]); - assertEquals(tests[i], undoableadapter.isUndoable()); - } - // JUnitDoclet end method setUndoable isUndoable - } - - // JUnitDoclet begin javadoc_method setRedoable() - /** - * Method testSetIsRedoable is testing setRedoable - * and isRedoable together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableAdapter#setRedoable(boolean) - * @see CH.ifa.draw.util.UndoableAdapter#isRedoable() - */ - // JUnitDoclet end javadoc_method setRedoable() - public void testSetIsRedoable() throws Exception { - // JUnitDoclet begin method setRedoable isRedoable - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - undoableadapter.setRedoable(tests[i]); - assertEquals(tests[i], undoableadapter.isRedoable()); - } - // JUnitDoclet end method setRedoable isRedoable - } - - // JUnitDoclet begin javadoc_method setAffectedFigures() - /** - * Method testSetGetAffectedFigures is testing setAffectedFigures - * and getAffectedFigures together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableAdapter#setAffectedFigures(CH.ifa.draw.framework.FigureEnumeration) - * @see CH.ifa.draw.util.UndoableAdapter#getAffectedFigures() - */ - // JUnitDoclet end javadoc_method setAffectedFigures() - public void testSetGetAffectedFigures() throws Exception { - // JUnitDoclet begin method setAffectedFigures getAffectedFigures - FigureEnumeration[] tests = { new SingleFigureEnumerator(new RectangleFigure(new Point(30, 30), new Point(60, 60)))}; - - for (int i = 0; i < tests.length; i++) { - undoableadapter.setAffectedFigures(tests[i]); - FigureEnumeration returned = undoableadapter.getAffectedFigures(); - tests[i].reset(); - while (returned.hasNextFigure()) { - assertTrue(tests[i].hasNextFigure()); - assertEquals(tests[i].nextFigure(), returned.nextFigure()); - } - assertFalse(tests[i].hasNextFigure()); - } - // JUnitDoclet end method setAffectedFigures getAffectedFigures - } - - // JUnitDoclet begin method testSetNullAffectedFigures() - /** - * Test a null argument to setAffectedFigures. Expect an IllegalArgumentException - * - * @see CH.ifa.draw.util.UndoRedoActivity#setAffectedFigures(CH.ifa.draw.framework.PointConstrainer) - */ - public void testSetNullAffectedFigures() throws Exception { - FigureEnumeration original = undoableadapter.getAffectedFigures(); - - try { - undoableadapter.setAffectedFigures(null); - fail("IllegalArgumentException expected"); - } - catch (IllegalArgumentException ok) { - } - } - // JUnitDoclet end method - - // JUnitDoclet begin javadoc_method getAffectedFiguresCount() - /** - * Method testGetAffectedFiguresCount is testing getAffectedFiguresCount - * @see CH.ifa.draw.util.UndoableAdapter#getAffectedFiguresCount() - */ - // JUnitDoclet end javadoc_method getAffectedFiguresCount() - public void testGetAffectedFiguresCount() throws Exception { - // JUnitDoclet begin method getAffectedFiguresCount - // JUnitDoclet end method getAffectedFiguresCount - } - - // JUnitDoclet begin javadoc_method release() - /** - * Method testRelease is testing release - * @see CH.ifa.draw.util.UndoableAdapter#release() - */ - // JUnitDoclet end javadoc_method release() - public void testRelease() throws Exception { - // JUnitDoclet begin method release - // JUnitDoclet end method release - } - - // JUnitDoclet begin javadoc_method getDrawingView() - /** - * Method testGetDrawingView is testing getDrawingView - * @see CH.ifa.draw.util.UndoableAdapter#getDrawingView() - */ - // JUnitDoclet end javadoc_method getDrawingView() - public void testGetDrawingView() throws Exception { - // JUnitDoclet begin method getDrawingView - // JUnitDoclet end method getDrawingView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoableCommandTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoableCommandTest.java deleted file mode 100644 index b0d213ab015affa03e2561fe08b165c9f146dbc5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoableCommandTest.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.standard.DeleteCommand; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.UndoableCommand; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoableCommandTest is generated by - * JUnitDoclet to hold the tests for UndoableCommand. - * @see CH.ifa.draw.util.UndoableCommand - */ -// JUnitDoclet end javadoc_class -public class UndoableCommandTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoableCommand undoablecommand; - // JUnitDoclet end class - - /** - * Constructor UndoableCommandTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoableCommandTest(String name) { - // JUnitDoclet begin method UndoableCommandTest - super(name); - // JUnitDoclet end method UndoableCommandTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.UndoableCommand createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.UndoableCommand(new DeleteCommand("Delete", getDrawingEditor())); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undoablecommand = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undoablecommand = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method execute() - /** - * Method testExecute is testing execute - * @see CH.ifa.draw.util.UndoableCommand#execute() - */ - // JUnitDoclet end javadoc_method execute() - public void testExecute() throws Exception { - // JUnitDoclet begin method execute - // JUnitDoclet end method execute - } - - // JUnitDoclet begin javadoc_method isExecutable() - /** - * Method testIsExecutable is testing isExecutable - * @see CH.ifa.draw.util.UndoableCommand#isExecutable() - */ - // JUnitDoclet end javadoc_method isExecutable() - public void testIsExecutable() throws Exception { - // JUnitDoclet begin method isExecutable - // JUnitDoclet end method isExecutable - } - - // JUnitDoclet begin javadoc_method name() - /** - * Method testName is testing name - * @see CH.ifa.draw.util.UndoableCommand#name() - */ - // JUnitDoclet end javadoc_method name() - public void testName() throws Exception { - // JUnitDoclet begin method name - // JUnitDoclet end method name - } - - // JUnitDoclet begin javadoc_method getDrawingEditor() - /** - * Method testGetDrawingEditor is testing getDrawingEditor - * @see CH.ifa.draw.util.UndoableCommand#getDrawingEditor() - */ - // JUnitDoclet end javadoc_method getDrawingEditor() - public void testGetDrawingEditor() throws Exception { - // JUnitDoclet begin method getDrawingEditor - // JUnitDoclet end method getDrawingEditor - } - - // JUnitDoclet begin javadoc_method view() - /** - * Method testView is testing view - * @see CH.ifa.draw.util.UndoableCommand#view() - */ - // JUnitDoclet end javadoc_method view() - public void testView() throws Exception { - // JUnitDoclet begin method view - // JUnitDoclet end method view - } - - // JUnitDoclet begin javadoc_method figureSelectionChanged() - /** - * Method testFigureSelectionChanged is testing figureSelectionChanged - * @see CH.ifa.draw.util.UndoableCommand#figureSelectionChanged(CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method figureSelectionChanged() - public void testFigureSelectionChanged() throws Exception { - // JUnitDoclet begin method figureSelectionChanged - // JUnitDoclet end method figureSelectionChanged - } - - // JUnitDoclet begin javadoc_method setUndoActivity() - /** - * Method testSetGetUndoActivity is testing setUndoActivity - * and getUndoActivity together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableCommand#setUndoActivity(CH.ifa.draw.util.Undoable) - * @see CH.ifa.draw.util.UndoableCommand#getUndoActivity() - */ - // JUnitDoclet end javadoc_method setUndoActivity() - public void testSetGetUndoActivity() throws Exception { - // JUnitDoclet begin method setUndoActivity getUndoActivity - // Do nothing: UndoCommand.setUndoActivity() is a no-op - // JUnitDoclet end method setUndoActivity getUndoActivity - } - - // JUnitDoclet begin javadoc_method addCommandListener() - /** - * Method testAddCommandListener is testing addCommandListener - * @see CH.ifa.draw.util.UndoableCommand#addCommandListener(CH.ifa.draw.util.CommandListener) - */ - // JUnitDoclet end javadoc_method addCommandListener() - public void testAddCommandListener() throws Exception { - // JUnitDoclet begin method addCommandListener - // JUnitDoclet end method addCommandListener - } - - // JUnitDoclet begin javadoc_method removeCommandListener() - /** - * Method testRemoveCommandListener is testing removeCommandListener - * @see CH.ifa.draw.util.UndoableCommand#removeCommandListener(CH.ifa.draw.util.CommandListener) - */ - // JUnitDoclet end javadoc_method removeCommandListener() - public void testRemoveCommandListener() throws Exception { - // JUnitDoclet begin method removeCommandListener - // JUnitDoclet end method removeCommandListener - } - - // JUnitDoclet begin javadoc_method createEventDispatcher() - /** - * Method testCreateEventDispatcher is testing createEventDispatcher - * @see CH.ifa.draw.util.UndoableCommand#createEventDispatcher() - */ - // JUnitDoclet end javadoc_method createEventDispatcher() - public void testCreateEventDispatcher() throws Exception { - // JUnitDoclet begin method createEventDispatcher - // JUnitDoclet end method createEventDispatcher - } - - // JUnitDoclet begin javadoc_method commandExecuted() - /** - * Method testCommandExecuted is testing commandExecuted - * @see CH.ifa.draw.util.UndoableCommand#commandExecuted(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandExecuted() - public void testCommandExecuted() throws Exception { - // JUnitDoclet begin method commandExecuted - // JUnitDoclet end method commandExecuted - } - - // JUnitDoclet begin javadoc_method commandExecutable() - /** - * Method testCommandExecutable is testing commandExecutable - * @see CH.ifa.draw.util.UndoableCommand#commandExecutable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandExecutable() - public void testCommandExecutable() throws Exception { - // JUnitDoclet begin method commandExecutable - // JUnitDoclet end method commandExecutable - } - - // JUnitDoclet begin javadoc_method commandNotExecutable() - /** - * Method testCommandNotExecutable is testing commandNotExecutable - * @see CH.ifa.draw.util.UndoableCommand#commandNotExecutable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method commandNotExecutable() - public void testCommandNotExecutable() throws Exception { - // JUnitDoclet begin method commandNotExecutable - // JUnitDoclet end method commandNotExecutable - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoableHandleTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoableHandleTest.java deleted file mode 100644 index fae47d73f73c7069e79709846de1be6be3345eea..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoableHandleTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import java.awt.Point; - -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.standard.BoxHandleKit; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.UndoableHandle; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoableHandleTest is generated by - * JUnitDoclet to hold the tests for UndoableHandle. - * @see CH.ifa.draw.util.UndoableHandle - */ -// JUnitDoclet end javadoc_class -public class UndoableHandleTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoableHandle undoablehandle; - // JUnitDoclet end class - - /** - * Constructor UndoableHandleTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoableHandleTest(String name) { - // JUnitDoclet begin method UndoableHandleTest - super(name); - // JUnitDoclet end method UndoableHandleTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public UndoableHandle createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new UndoableHandle(BoxHandleKit.south(new RectangleFigure(new Point(44, 44), new Point(88, 88)))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undoablehandle = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undoablehandle = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method locate() - /** - * Method testLocate is testing locate - * @see CH.ifa.draw.util.UndoableHandle#locate() - */ - // JUnitDoclet end javadoc_method locate() - public void testLocate() throws Exception { - // JUnitDoclet begin method locate - // JUnitDoclet end method locate - } - - // JUnitDoclet begin javadoc_method invokeStart() - /** - * Method testInvokeStart is testing invokeStart - * @see CH.ifa.draw.util.UndoableHandle#invokeStart(int, int, CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method invokeStart() - public void testInvokeStart() throws Exception { - // JUnitDoclet begin method invokeStart - // JUnitDoclet end method invokeStart - } - - // JUnitDoclet begin javadoc_method invokeStep() - /** - * Method testInvokeStep is testing invokeStep - * @see CH.ifa.draw.util.UndoableHandle#invokeStep(int, int, CH.ifa.draw.framework.Drawing) - */ - // JUnitDoclet end javadoc_method invokeStep() - public void testInvokeStep() throws Exception { - // JUnitDoclet begin method invokeStep - // JUnitDoclet end method invokeStep - } - - // JUnitDoclet begin javadoc_method invokeEnd() - /** - * Method testInvokeEnd is testing invokeEnd - * @see CH.ifa.draw.util.UndoableHandle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - // JUnitDoclet end javadoc_method invokeEnd() - public void testInvokeEnd() throws Exception { - // JUnitDoclet begin method invokeEnd - // JUnitDoclet end method invokeEnd - } - - // JUnitDoclet begin javadoc_method owner() - /** - * Method testOwner is testing owner - * @see CH.ifa.draw.util.UndoableHandle#owner() - */ - // JUnitDoclet end javadoc_method owner() - public void testOwner() throws Exception { - // JUnitDoclet begin method owner - // JUnitDoclet end method owner - } - - // JUnitDoclet begin javadoc_method displayBox() - /** - * Method testDisplayBox is testing displayBox - * @see CH.ifa.draw.util.UndoableHandle#displayBox() - */ - // JUnitDoclet end javadoc_method displayBox() - public void testDisplayBox() throws Exception { - // JUnitDoclet begin method displayBox - // JUnitDoclet end method displayBox - } - - // JUnitDoclet begin javadoc_method containsPoint() - /** - * Method testContainsPoint is testing containsPoint - * @see CH.ifa.draw.util.UndoableHandle#containsPoint(int, int) - */ - // JUnitDoclet end javadoc_method containsPoint() - public void testContainsPoint() throws Exception { - // JUnitDoclet begin method containsPoint - // JUnitDoclet end method containsPoint - } - - // JUnitDoclet begin javadoc_method draw() - /** - * Method testDraw is testing draw - * @see CH.ifa.draw.util.UndoableHandle#draw(java.awt.Graphics) - */ - // JUnitDoclet end javadoc_method draw() - public void testDraw() throws Exception { - // JUnitDoclet begin method draw - // JUnitDoclet end method draw - } - - // JUnitDoclet begin javadoc_method getDrawingView() - /** - * Method testGetDrawingView is testing getDrawingView - * @see CH.ifa.draw.util.UndoableHandle#getDrawingView() - */ - // JUnitDoclet end javadoc_method getDrawingView() - public void testGetDrawingView() throws Exception { - // JUnitDoclet begin method getDrawingView - // JUnitDoclet end method getDrawingView - } - - // JUnitDoclet begin javadoc_method setUndoActivity() - /** - * Method testSetGetUndoActivity is testing setUndoActivity - * and getUndoActivity together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableHandle#setUndoActivity(CH.ifa.draw.util.Undoable) - * @see CH.ifa.draw.util.UndoableHandle#getUndoActivity() - */ - // JUnitDoclet end javadoc_method setUndoActivity() - public void testSetGetUndoActivity() throws Exception { - // JUnitDoclet begin method setUndoActivity getUndoActivity - // Do nothing: UndoableHandle.setUndoActivity() is a no-op. - // JUnitDoclet end method setUndoActivity getUndoActivity - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UndoableToolTest.java b/JHotDraw/src/CH/ifa/draw/test/util/UndoableToolTest.java deleted file mode 100644 index 2f2a7925908ae3766b50de050eccbc70d4ff5cda..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UndoableToolTest.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.contrib.DiamondFigure; -import CH.ifa.draw.standard.CreationTool; -import CH.ifa.draw.test.JHDTestCase; -import CH.ifa.draw.util.UndoableTool; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase UndoableToolTest is generated by - * JUnitDoclet to hold the tests for UndoableTool. - * @see CH.ifa.draw.util.UndoableTool - */ -// JUnitDoclet end javadoc_class -public class UndoableToolTest -// JUnitDoclet begin extends_implements -extends JHDTestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private UndoableTool undoabletool; - // JUnitDoclet end class - - /** - * Constructor UndoableToolTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public UndoableToolTest(String name) { - // JUnitDoclet begin method UndoableToolTest - super(name); - // JUnitDoclet end method UndoableToolTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.UndoableTool createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.UndoableTool(new UndoableTool(new CreationTool(getDrawingEditor(), new DiamondFigure()))); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - undoabletool = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - undoabletool = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method activate() - /** - * Method testActivate is testing activate - * @see CH.ifa.draw.util.UndoableTool#activate() - */ - // JUnitDoclet end javadoc_method activate() - public void testActivate() throws Exception { - // JUnitDoclet begin method activate - // JUnitDoclet end method activate - } - - // JUnitDoclet begin javadoc_method deactivate() - /** - * Method testDeactivate is testing deactivate - * @see CH.ifa.draw.util.UndoableTool#deactivate() - */ - // JUnitDoclet end javadoc_method deactivate() - public void testDeactivate() throws Exception { - // JUnitDoclet begin method deactivate - // JUnitDoclet end method deactivate - } - - // JUnitDoclet begin javadoc_method mouseDown() - /** - * Method testMouseDown is testing mouseDown - * @see CH.ifa.draw.util.UndoableTool#mouseDown(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDown() - public void testMouseDown() throws Exception { - // JUnitDoclet begin method mouseDown - // JUnitDoclet end method mouseDown - } - - // JUnitDoclet begin javadoc_method mouseDrag() - /** - * Method testMouseDrag is testing mouseDrag - * @see CH.ifa.draw.util.UndoableTool#mouseDrag(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseDrag() - public void testMouseDrag() throws Exception { - // JUnitDoclet begin method mouseDrag - // JUnitDoclet end method mouseDrag - } - - // JUnitDoclet begin javadoc_method mouseUp() - /** - * Method testMouseUp is testing mouseUp - * @see CH.ifa.draw.util.UndoableTool#mouseUp(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseUp() - public void testMouseUp() throws Exception { - // JUnitDoclet begin method mouseUp - // JUnitDoclet end method mouseUp - } - - // JUnitDoclet begin javadoc_method mouseMove() - /** - * Method testMouseMove is testing mouseMove - * @see CH.ifa.draw.util.UndoableTool#mouseMove(java.awt.event.MouseEvent, int, int) - */ - // JUnitDoclet end javadoc_method mouseMove() - public void testMouseMove() throws Exception { - // JUnitDoclet begin method mouseMove - // JUnitDoclet end method mouseMove - } - - // JUnitDoclet begin javadoc_method keyDown() - /** - * Method testKeyDown is testing keyDown - * @see CH.ifa.draw.util.UndoableTool#keyDown(java.awt.event.KeyEvent, int) - */ - // JUnitDoclet end javadoc_method keyDown() - public void testKeyDown() throws Exception { - // JUnitDoclet begin method keyDown - // JUnitDoclet end method keyDown - } - - // JUnitDoclet begin javadoc_method isActive() - /** - * Method testIsActive is testing isActive - * @see CH.ifa.draw.util.UndoableTool#isActive() - */ - // JUnitDoclet end javadoc_method isActive() - public void testIsActive() throws Exception { - // JUnitDoclet begin method isActive - // JUnitDoclet end method isActive - } - - // JUnitDoclet begin javadoc_method setUsable() - /** - * Method testSetIsUsable is testing setUsable - * and isUsable together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableTool#setUsable(boolean) - * @see CH.ifa.draw.util.UndoableTool#isUsable() - */ - // JUnitDoclet end javadoc_method setUsable() - public void testSetIsUsable() throws Exception { - // JUnitDoclet begin method setUsable isUsable - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - undoabletool.setUsable(tests[i]); - assertEquals(tests[i], undoabletool.isUsable()); - } - // JUnitDoclet end method setUsable isUsable - } - - // JUnitDoclet begin javadoc_method setEnabled() - /** - * Method testSetIsEnabled is testing setEnabled - * and isEnabled together by setting some value - * and verifying it by reading. - * @see CH.ifa.draw.util.UndoableTool#setEnabled(boolean) - * @see CH.ifa.draw.util.UndoableTool#isEnabled() - */ - // JUnitDoclet end javadoc_method setEnabled() - public void testSetIsEnabled() throws Exception { - // JUnitDoclet begin method setEnabled isEnabled - boolean[] tests = { true, false }; - - for (int i = 0; i < tests.length; i++) { - undoabletool.setEnabled(tests[i]); - assertEquals(tests[i], undoabletool.isEnabled()); - } - // JUnitDoclet end method setEnabled isEnabled - } - - // JUnitDoclet begin javadoc_method editor() - /** - * Method testEditor is testing editor - * @see CH.ifa.draw.util.UndoableTool#editor() - */ - // JUnitDoclet end javadoc_method editor() - public void testEditor() throws Exception { - // JUnitDoclet begin method editor - // JUnitDoclet end method editor - } - - // JUnitDoclet begin javadoc_method view() - /** - * Method testView is testing view - * @see CH.ifa.draw.util.UndoableTool#view() - */ - // JUnitDoclet end javadoc_method view() - public void testView() throws Exception { - // JUnitDoclet begin method view - // JUnitDoclet end method view - } - - // JUnitDoclet begin javadoc_method setUndoActivity() - /** - * @see CH.ifa.draw.util.UndoableTool#setUndoActivity(CH.ifa.draw.util.Undoable) - * @see CH.ifa.draw.util.UndoableTool#getUndoActivity() - */ - // JUnitDoclet end javadoc_method setUndoActivity() - public void testSetGetUndoActivity() throws Exception { - // JUnitDoclet begin method setUndoActivity getUndoActivity - // Do nothing: UndoableTool.setUndoActivity is a no-op - // JUnitDoclet end method setUndoActivity getUndoActivity - } - - // JUnitDoclet begin javadoc_method toolUsable() - /** - * Method testToolUsable is testing toolUsable - * @see CH.ifa.draw.util.UndoableTool#toolUsable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolUsable() - public void testToolUsable() throws Exception { - // JUnitDoclet begin method toolUsable - // JUnitDoclet end method toolUsable - } - - // JUnitDoclet begin javadoc_method toolUnusable() - /** - * Method testToolUnusable is testing toolUnusable - * @see CH.ifa.draw.util.UndoableTool#toolUnusable(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolUnusable() - public void testToolUnusable() throws Exception { - // JUnitDoclet begin method toolUnusable - // JUnitDoclet end method toolUnusable - } - - // JUnitDoclet begin javadoc_method toolActivated() - /** - * Method testToolActivated is testing toolActivated - * @see CH.ifa.draw.util.UndoableTool#toolActivated(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolActivated() - public void testToolActivated() throws Exception { - // JUnitDoclet begin method toolActivated - // JUnitDoclet end method toolActivated - } - - // JUnitDoclet begin javadoc_method toolDeactivated() - /** - * Method testToolDeactivated is testing toolDeactivated - * @see CH.ifa.draw.util.UndoableTool#toolDeactivated(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolDeactivated() - public void testToolDeactivated() throws Exception { - // JUnitDoclet begin method toolDeactivated - // JUnitDoclet end method toolDeactivated - } - - // JUnitDoclet begin javadoc_method toolEnabled() - /** - * Method testToolEnabled is testing toolEnabled - * @see CH.ifa.draw.util.UndoableTool#toolEnabled(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolEnabled() - public void testToolEnabled() throws Exception { - // JUnitDoclet begin method toolEnabled - // JUnitDoclet end method toolEnabled - } - - // JUnitDoclet begin javadoc_method toolDisabled() - /** - * Method testToolDisabled is testing toolDisabled - * @see CH.ifa.draw.util.UndoableTool#toolDisabled(java.util.EventObject) - */ - // JUnitDoclet end javadoc_method toolDisabled() - public void testToolDisabled() throws Exception { - // JUnitDoclet begin method toolDisabled - // JUnitDoclet end method toolDisabled - } - - // JUnitDoclet begin javadoc_method addToolListener() - /** - * Method testAddToolListener is testing addToolListener - * @see CH.ifa.draw.util.UndoableTool#addToolListener(CH.ifa.draw.framework.ToolListener) - */ - // JUnitDoclet end javadoc_method addToolListener() - public void testAddToolListener() throws Exception { - // JUnitDoclet begin method addToolListener - // JUnitDoclet end method addToolListener - } - - // JUnitDoclet begin javadoc_method removeToolListener() - /** - * Method testRemoveToolListener is testing removeToolListener - * @see CH.ifa.draw.util.UndoableTool#removeToolListener(CH.ifa.draw.framework.ToolListener) - */ - // JUnitDoclet end javadoc_method removeToolListener() - public void testRemoveToolListener() throws Exception { - // JUnitDoclet begin method removeToolListener - // JUnitDoclet end method removeToolListener - } - - // JUnitDoclet begin javadoc_method createEventDispatcher() - /** - * Method testCreateEventDispatcher is testing createEventDispatcher - * @see CH.ifa.draw.util.UndoableTool#createEventDispatcher() - */ - // JUnitDoclet end javadoc_method createEventDispatcher() - public void testCreateEventDispatcher() throws Exception { - // JUnitDoclet begin method createEventDispatcher - // JUnitDoclet end method createEventDispatcher - } - - // JUnitDoclet begin javadoc_method getActiveView() - /** - * Method testGetActiveView is testing getActiveView - * @see CH.ifa.draw.util.UndoableTool#getActiveView() - */ - // JUnitDoclet end javadoc_method getActiveView() - public void testGetActiveView() throws Exception { - // JUnitDoclet begin method getActiveView - // JUnitDoclet end method getActiveView - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/UtilSuite.java b/JHotDraw/src/CH/ifa/draw/test/util/UtilSuite.java deleted file mode 100644 index 99890543b9b4c4f9483b316aa5d4c29e3603559d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/UtilSuite.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite UtilSuite -*/ -// JUnitDoclet end javadoc_class -public class UtilSuite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.util"); - - suite.addTestSuite(CH.ifa.draw.test.util.ReverseListEnumeratorTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.StandardVersionControlStrategyTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.VersionManagementTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoableHandleTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoRedoActivityTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoableAdapterTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoableToolTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.RedoCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoableCommandTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.GraphLayoutTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.BoundsTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.StorageFormatManagerTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.SerializationStorageFormatTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.StandardStorageFormatTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.PaletteLayoutTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.PaletteIconTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.IconkitTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.GeomTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.FloatingTextFieldTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.FillerTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.CommandMenuTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.CommandChoiceTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.CommandButtonTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.StorableInputTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.StorableOutputTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.UndoManagerTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.ColorMapTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.ClipboardTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/VersionManagementTest.java b/JHotDraw/src/CH/ifa/draw/test/util/VersionManagementTest.java deleted file mode 100644 index 13adbf9e46d50818cfd382855a031a494aa87797..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/VersionManagementTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util; - -// JUnitDoclet begin import -import CH.ifa.draw.util.VersionManagement; -import junit.framework.TestCase; -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase VersionManagementTest is generated by - * JUnitDoclet to hold the tests for VersionManagement. - * @see CH.ifa.draw.util.VersionManagement - */ -// JUnitDoclet end javadoc_class -public class VersionManagementTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private VersionManagement versionmanagement; - // JUnitDoclet end class - - /** - * Constructor VersionManagementTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public VersionManagementTest(String name) { - // JUnitDoclet begin method VersionManagementTest - super(name); - // JUnitDoclet end method VersionManagementTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.VersionManagement createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.VersionManagement(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - versionmanagement = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - versionmanagement = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method getJHotDrawVersion() - /** - * Method testGetJHotDrawVersion is testing getJHotDrawVersion - * @see CH.ifa.draw.util.VersionManagement#getJHotDrawVersion() - */ - // JUnitDoclet end javadoc_method getJHotDrawVersion() - public void testGetJHotDrawVersion() throws Exception { - // JUnitDoclet begin method getJHotDrawVersion - // JUnitDoclet end method getJHotDrawVersion - } - - // JUnitDoclet begin javadoc_method getPackageVersion() - /** - * Method testGetPackageVersion is testing getPackageVersion - * @see CH.ifa.draw.util.VersionManagement#getPackageVersion(java.lang.Package) - */ - // JUnitDoclet end javadoc_method getPackageVersion() - public void testGetPackageVersion() throws Exception { - // JUnitDoclet begin method getPackageVersion - // JUnitDoclet end method getPackageVersion - } - - // JUnitDoclet begin javadoc_method isCompatibleVersion() - /** - * Method testIsCompatibleVersion is testing isCompatibleVersion - * @see CH.ifa.draw.util.VersionManagement#isCompatibleVersion(java.lang.String) - */ - // JUnitDoclet end javadoc_method isCompatibleVersion() - public void testIsCompatibleVersion() throws Exception { - // JUnitDoclet begin method isCompatibleVersion - // JUnitDoclet end method isCompatibleVersion - } - - // JUnitDoclet begin javadoc_method readVersionFromFile() - /** - * Method testReadVersionFromFile is testing readVersionFromFile - * @see CH.ifa.draw.util.VersionManagement#readVersionFromFile(java.lang.String, java.lang.String) - */ - // JUnitDoclet end javadoc_method readVersionFromFile() - public void testReadVersionFromFile() throws Exception { - // JUnitDoclet begin method readVersionFromFile - // JUnitDoclet end method readVersionFromFile - } - - // JUnitDoclet begin javadoc_method normalizePackageName() - /** - * Method testNormalizePackageName is testing normalizePackageName - * @see CH.ifa.draw.util.VersionManagement#normalizePackageName(java.lang.String) - */ - // JUnitDoclet end javadoc_method normalizePackageName() - public void testNormalizePackageName() throws Exception { - // JUnitDoclet begin method normalizePackageName - // JUnitDoclet end method normalizePackageName - } - - // JUnitDoclet begin javadoc_method extractVersionInfo() - /** - * Method testExtractVersionInfo is testing extractVersionInfo - * @see CH.ifa.draw.util.VersionManagement#extractVersionInfo(java.lang.String) - */ - // JUnitDoclet end javadoc_method extractVersionInfo() - public void testExtractVersionInfo() throws Exception { - // JUnitDoclet begin method extractVersionInfo - // JUnitDoclet end method extractVersionInfo - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/AllTests.java deleted file mode 100644 index 61039dd7c3de387f10f6ca0b648577dd9ed6d265..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/AllTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.util.collections.jdk11"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(CollectionsFactoryJDK11Test.class)); - suite.addTest(new TestSuite(IteratorWrapperTest.class)); - suite.addTest(new TestSuite(ListWrapperTest.class)); - suite.addTest(new TestSuite(MapWrapperTest.class)); - suite.addTest(new TestSuite(SetWrapperTest.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/CollectionsFactoryJDK11Test.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/CollectionsFactoryJDK11Test.java deleted file mode 100644 index da8811290d7e79fe4fe1369b97160d7b4e3e4dc0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/CollectionsFactoryJDK11Test.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CollectionsFactoryJDK11Test is generated by - * JUnitDoclet to hold the tests for CollectionsFactoryJDK11. - * @see CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11 - */ -// JUnitDoclet end javadoc_class -public class CollectionsFactoryJDK11Test -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CollectionsFactoryJDK11 collectionsfactoryjdk11; - // JUnitDoclet end class - - /** - * Constructor CollectionsFactoryJDK11Test is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CollectionsFactoryJDK11Test(String name) { - // JUnitDoclet begin method CollectionsFactoryJDK11Test - super(name); - // JUnitDoclet end method CollectionsFactoryJDK11Test - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11 createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - collectionsfactoryjdk11 = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - collectionsfactoryjdk11 = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createList() - /** - * Method testCreateList is testing createList - * @see CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11#createList() - */ - // JUnitDoclet end javadoc_method createList() - public void testCreateList() throws Exception { - // JUnitDoclet begin method createList - // JUnitDoclet end method createList - } - - // JUnitDoclet begin javadoc_method createMap() - /** - * Method testCreateMap is testing createMap - * @see CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11#createMap() - */ - // JUnitDoclet end javadoc_method createMap() - public void testCreateMap() throws Exception { - // JUnitDoclet begin method createMap - // JUnitDoclet end method createMap - } - - // JUnitDoclet begin javadoc_method createSet() - /** - * Method testCreateSet is testing createSet - * @see CH.ifa.draw.util.collections.jdk11.CollectionsFactoryJDK11#createSet() - */ - // JUnitDoclet end javadoc_method createSet() - public void testCreateSet() throws Exception { - // JUnitDoclet begin method createSet - // JUnitDoclet end method createSet - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/IteratorWrapperTest.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/IteratorWrapperTest.java deleted file mode 100644 index 90492ef319a28581eb413c7d7c33f19a7b28d015..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/IteratorWrapperTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import junit.framework.TestCase; -// JUnitDoclet begin import -import CH.ifa.draw.figures.RectangleFigure; -import CH.ifa.draw.figures.PolyLineFigure; -import CH.ifa.draw.util.collections.jdk11.IteratorWrapper; - -import java.util.Vector; -import java.awt.*; -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestCase IteratorWrapperTest is generated by -* JUnitDoclet to hold the tests for IteratorWrapper. -* @see CH.ifa.draw.util.collections.jdk11.IteratorWrapper -*/ -// JUnitDoclet end javadoc_class -public class IteratorWrapperTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private IteratorWrapper iteratorwrapper; - // JUnitDoclet end class - - /** - * Constructor IteratorWrapperTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public IteratorWrapperTest(String name) { - // JUnitDoclet begin method IteratorWrapperTest - super(name); - // JUnitDoclet end method IteratorWrapperTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.collections.jdk11.IteratorWrapper createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - Vector v = new Vector(); - v.add(new RectangleFigure(new Point(10, 10), new Point(100, 100))); - v.add(new PolyLineFigure(20, 20)); - v.add(new RectangleFigure(new Point(100, 10), new Point(150, 100))); - return new CH.ifa.draw.util.collections.jdk11.IteratorWrapper(v.elements()); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - iteratorwrapper = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - iteratorwrapper = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method hasNext() - /** - * Method testHasNext is testing hasNext - * @see CH.ifa.draw.util.collections.jdk11.IteratorWrapper#hasNext() - */ - // JUnitDoclet end javadoc_method hasNext() - public void testHasNext() throws Exception { - // JUnitDoclet begin method hasNext - // JUnitDoclet end method hasNext - } - - // JUnitDoclet begin javadoc_method next() - /** - * Method testNext is testing next - * @see CH.ifa.draw.util.collections.jdk11.IteratorWrapper#next() - */ - // JUnitDoclet end javadoc_method next() - public void testNext() throws Exception { - // JUnitDoclet begin method next - // JUnitDoclet end method next - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.collections.jdk11.IteratorWrapper#remove() - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/Jdk11Suite.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/Jdk11Suite.java deleted file mode 100644 index b08da45e301131e2aaced7f95dc0827d97bb1862..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/Jdk11Suite.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - -// JUnitDoclet begin javadoc_class -/** -* TestSuite Jdk11Suite -*/ -// JUnitDoclet end javadoc_class -public class Jdk11Suite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.util.collections.jdk11"); - - suite.addTestSuite(CH.ifa.draw.test.util.collections.jdk11.SetWrapperTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.collections.jdk11.CollectionsFactoryJDK11Test.class); - suite.addTestSuite(CH.ifa.draw.test.util.collections.jdk11.MapWrapperTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.collections.jdk11.ListWrapperTest.class); - suite.addTestSuite(CH.ifa.draw.test.util.collections.jdk11.IteratorWrapperTest.class); - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/ListWrapperTest.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/ListWrapperTest.java deleted file mode 100644 index 00ba968ded1a55e59781866a5ac37e03fb95a30a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/ListWrapperTest.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import CH.ifa.draw.util.collections.jdk11.ListWrapper; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase ListWrapperTest is generated by - * JUnitDoclet to hold the tests for ListWrapper. - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper - */ -// JUnitDoclet end javadoc_class -public class ListWrapperTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private ListWrapper listwrapper; - // JUnitDoclet end class - - /** - * Constructor ListWrapperTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public ListWrapperTest(String name) { - // JUnitDoclet begin method ListWrapperTest - super(name); - // JUnitDoclet end method ListWrapperTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.collections.jdk11.ListWrapper createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.collections.jdk11.ListWrapper(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - listwrapper = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - listwrapper = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method size() - /** - * Method testSize is testing size - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#size() - */ - // JUnitDoclet end javadoc_method size() - public void testSize() throws Exception { - // JUnitDoclet begin method size - // JUnitDoclet end method size - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method contains() - /** - * Method testContains is testing contains - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#contains(java.lang.Object) - */ - // JUnitDoclet end javadoc_method contains() - public void testContains() throws Exception { - // JUnitDoclet begin method contains - // JUnitDoclet end method contains - } - - // JUnitDoclet begin javadoc_method iterator() - /** - * Method testIterator is testing iterator - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#iterator() - */ - // JUnitDoclet end javadoc_method iterator() - public void testIterator() throws Exception { - // JUnitDoclet begin method iterator - // JUnitDoclet end method iterator - } - - // JUnitDoclet begin javadoc_method toArray() - /** - * Method testToArray is testing toArray - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#toArray() - */ - // JUnitDoclet end javadoc_method toArray() - public void testToArray() throws Exception { - // JUnitDoclet begin method toArray - // JUnitDoclet end method toArray - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#add(java.lang.Object) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#remove(java.lang.Object) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method containsAll() - /** - * Method testContainsAll is testing containsAll - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#containsAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method containsAll() - public void testContainsAll() throws Exception { - // JUnitDoclet begin method containsAll - // JUnitDoclet end method containsAll - } - - // JUnitDoclet begin javadoc_method addAll() - /** - * Method testAddAll is testing addAll - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#addAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method addAll() - public void testAddAll() throws Exception { - // JUnitDoclet begin method addAll - // JUnitDoclet end method addAll - } - - // JUnitDoclet begin javadoc_method removeAll() - /** - * Method testRemoveAll is testing removeAll - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#removeAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method removeAll() - public void testRemoveAll() throws Exception { - // JUnitDoclet begin method removeAll - // JUnitDoclet end method removeAll - } - - // JUnitDoclet begin javadoc_method retainAll() - /** - * Method testRetainAll is testing retainAll - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#retainAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method retainAll() - public void testRetainAll() throws Exception { - // JUnitDoclet begin method retainAll - // JUnitDoclet end method retainAll - } - - // JUnitDoclet begin javadoc_method clear() - /** - * Method testClear is testing clear - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#clear() - */ - // JUnitDoclet end javadoc_method clear() - public void testClear() throws Exception { - // JUnitDoclet begin method clear - // JUnitDoclet end method clear - } - - // JUnitDoclet begin javadoc_method get() - /** - * Method testGet is testing get - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#get(int) - */ - // JUnitDoclet end javadoc_method get() - public void testGet() throws Exception { - // JUnitDoclet begin method get - // JUnitDoclet end method get - } - - // JUnitDoclet begin javadoc_method set() - /** - * Method testSet is testing set - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#set(int, java.lang.Object) - */ - // JUnitDoclet end javadoc_method set() - public void testSet() throws Exception { - // JUnitDoclet begin method set - // JUnitDoclet end method set - } - - // JUnitDoclet begin javadoc_method indexOf() - /** - * Method testIndexOf is testing indexOf - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#indexOf(java.lang.Object) - */ - // JUnitDoclet end javadoc_method indexOf() - public void testIndexOf() throws Exception { - // JUnitDoclet begin method indexOf - // JUnitDoclet end method indexOf - } - - // JUnitDoclet begin javadoc_method lastIndexOf() - /** - * Method testLastIndexOf is testing lastIndexOf - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#lastIndexOf(java.lang.Object) - */ - // JUnitDoclet end javadoc_method lastIndexOf() - public void testLastIndexOf() throws Exception { - // JUnitDoclet begin method lastIndexOf - // JUnitDoclet end method lastIndexOf - } - - // JUnitDoclet begin javadoc_method listIterator() - /** - * Method testListIterator is testing listIterator - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#listIterator() - */ - // JUnitDoclet end javadoc_method listIterator() - public void testListIterator() throws Exception { - // JUnitDoclet begin method listIterator - // JUnitDoclet end method listIterator - } - - // JUnitDoclet begin javadoc_method subList() - /** - * Method testSubList is testing subList - * @see CH.ifa.draw.util.collections.jdk11.ListWrapper#subList(int, int) - */ - // JUnitDoclet end javadoc_method subList() - public void testSubList() throws Exception { - // JUnitDoclet begin method subList - // JUnitDoclet end method subList - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/MapWrapperTest.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/MapWrapperTest.java deleted file mode 100644 index a71f6f31ed58ca825a1bfac886d77e8d0010eb00..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/MapWrapperTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import CH.ifa.draw.util.collections.jdk11.MapWrapper; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase MapWrapperTest is generated by - * JUnitDoclet to hold the tests for MapWrapper. - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper - */ -// JUnitDoclet end javadoc_class -public class MapWrapperTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private MapWrapper mapwrapper; - // JUnitDoclet end class - - /** - * Constructor MapWrapperTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public MapWrapperTest(String name) { - // JUnitDoclet begin method MapWrapperTest - super(name); - // JUnitDoclet end method MapWrapperTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.collections.jdk11.MapWrapper createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.collections.jdk11.MapWrapper(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - mapwrapper = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - mapwrapper = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method size() - /** - * Method testSize is testing size - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#size() - */ - // JUnitDoclet end javadoc_method size() - public void testSize() throws Exception { - // JUnitDoclet begin method size - // JUnitDoclet end method size - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method containsKey() - /** - * Method testContainsKey is testing containsKey - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#containsKey(java.lang.Object) - */ - // JUnitDoclet end javadoc_method containsKey() - public void testContainsKey() throws Exception { - // JUnitDoclet begin method containsKey - // JUnitDoclet end method containsKey - } - - // JUnitDoclet begin javadoc_method containsValue() - /** - * Method testContainsValue is testing containsValue - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#containsValue(java.lang.Object) - */ - // JUnitDoclet end javadoc_method containsValue() - public void testContainsValue() throws Exception { - // JUnitDoclet begin method containsValue - // JUnitDoclet end method containsValue - } - - // JUnitDoclet begin javadoc_method get() - /** - * Method testGet is testing get - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#get(java.lang.Object) - */ - // JUnitDoclet end javadoc_method get() - public void testGet() throws Exception { - // JUnitDoclet begin method get - // JUnitDoclet end method get - } - - // JUnitDoclet begin javadoc_method put() - /** - * Method testPut is testing put - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#put(java.lang.Object, java.lang.Object) - */ - // JUnitDoclet end javadoc_method put() - public void testPut() throws Exception { - // JUnitDoclet begin method put - // JUnitDoclet end method put - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#remove(java.lang.Object) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method putAll() - /** - * Method testPutAll is testing putAll - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#putAll(java.util.Map) - */ - // JUnitDoclet end javadoc_method putAll() - public void testPutAll() throws Exception { - // JUnitDoclet begin method putAll - // JUnitDoclet end method putAll - } - - // JUnitDoclet begin javadoc_method clear() - /** - * Method testClear is testing clear - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#clear() - */ - // JUnitDoclet end javadoc_method clear() - public void testClear() throws Exception { - // JUnitDoclet begin method clear - // JUnitDoclet end method clear - } - - // JUnitDoclet begin javadoc_method keySet() - /** - * Method testKeySet is testing keySet - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#keySet() - */ - // JUnitDoclet end javadoc_method keySet() - public void testKeySet() throws Exception { - // JUnitDoclet begin method keySet - // JUnitDoclet end method keySet - } - - // JUnitDoclet begin javadoc_method values() - /** - * Method testValues is testing values - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#values() - */ - // JUnitDoclet end javadoc_method values() - public void testValues() throws Exception { - // JUnitDoclet begin method values - // JUnitDoclet end method values - } - - // JUnitDoclet begin javadoc_method entrySet() - /** - * Method testEntrySet is testing entrySet - * @see CH.ifa.draw.util.collections.jdk11.MapWrapper#entrySet() - */ - // JUnitDoclet end javadoc_method entrySet() - public void testEntrySet() throws Exception { - // JUnitDoclet begin method entrySet - // JUnitDoclet end method entrySet - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/SetWrapperTest.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/SetWrapperTest.java deleted file mode 100644 index 6dfa752036854a8964184300b4a4805b9a4b7645..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk11/SetWrapperTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk11; - -import CH.ifa.draw.util.collections.jdk11.SetWrapper; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase SetWrapperTest is generated by - * JUnitDoclet to hold the tests for SetWrapper. - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper - */ -// JUnitDoclet end javadoc_class -public class SetWrapperTest -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private SetWrapper setwrapper; - // JUnitDoclet end class - - /** - * Constructor SetWrapperTest is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public SetWrapperTest(String name) { - // JUnitDoclet begin method SetWrapperTest - super(name); - // JUnitDoclet end method SetWrapperTest - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.collections.jdk11.SetWrapper createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.collections.jdk11.SetWrapper(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - setwrapper = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - setwrapper = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method size() - /** - * Method testSize is testing size - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#size() - */ - // JUnitDoclet end javadoc_method size() - public void testSize() throws Exception { - // JUnitDoclet begin method size - // JUnitDoclet end method size - } - - // JUnitDoclet begin javadoc_method isEmpty() - /** - * Method testIsEmpty is testing isEmpty - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#isEmpty() - */ - // JUnitDoclet end javadoc_method isEmpty() - public void testIsEmpty() throws Exception { - // JUnitDoclet begin method isEmpty - // JUnitDoclet end method isEmpty - } - - // JUnitDoclet begin javadoc_method contains() - /** - * Method testContains is testing contains - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#contains(java.lang.Object) - */ - // JUnitDoclet end javadoc_method contains() - public void testContains() throws Exception { - // JUnitDoclet begin method contains - // JUnitDoclet end method contains - } - - // JUnitDoclet begin javadoc_method iterator() - /** - * Method testIterator is testing iterator - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#iterator() - */ - // JUnitDoclet end javadoc_method iterator() - public void testIterator() throws Exception { - // JUnitDoclet begin method iterator - // JUnitDoclet end method iterator - } - - // JUnitDoclet begin javadoc_method toArray() - /** - * Method testToArray is testing toArray - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#toArray() - */ - // JUnitDoclet end javadoc_method toArray() - public void testToArray() throws Exception { - // JUnitDoclet begin method toArray - // JUnitDoclet end method toArray - } - - // JUnitDoclet begin javadoc_method add() - /** - * Method testAdd is testing add - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#add(java.lang.Object) - */ - // JUnitDoclet end javadoc_method add() - public void testAdd() throws Exception { - // JUnitDoclet begin method add - // JUnitDoclet end method add - } - - // JUnitDoclet begin javadoc_method remove() - /** - * Method testRemove is testing remove - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#remove(java.lang.Object) - */ - // JUnitDoclet end javadoc_method remove() - public void testRemove() throws Exception { - // JUnitDoclet begin method remove - // JUnitDoclet end method remove - } - - // JUnitDoclet begin javadoc_method containsAll() - /** - * Method testContainsAll is testing containsAll - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#containsAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method containsAll() - public void testContainsAll() throws Exception { - // JUnitDoclet begin method containsAll - // JUnitDoclet end method containsAll - } - - // JUnitDoclet begin javadoc_method addAll() - /** - * Method testAddAll is testing addAll - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#addAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method addAll() - public void testAddAll() throws Exception { - // JUnitDoclet begin method addAll - // JUnitDoclet end method addAll - } - - // JUnitDoclet begin javadoc_method retainAll() - /** - * Method testRetainAll is testing retainAll - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#retainAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method retainAll() - public void testRetainAll() throws Exception { - // JUnitDoclet begin method retainAll - // JUnitDoclet end method retainAll - } - - // JUnitDoclet begin javadoc_method removeAll() - /** - * Method testRemoveAll is testing removeAll - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#removeAll(java.util.Collection) - */ - // JUnitDoclet end javadoc_method removeAll() - public void testRemoveAll() throws Exception { - // JUnitDoclet begin method removeAll - // JUnitDoclet end method removeAll - } - - // JUnitDoclet begin javadoc_method clear() - /** - * Method testClear is testing clear - * @see CH.ifa.draw.util.collections.jdk11.SetWrapper#clear() - */ - // JUnitDoclet end javadoc_method clear() - public void testClear() throws Exception { - // JUnitDoclet begin method clear - // JUnitDoclet end method clear - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/AllTests.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/AllTests.java deleted file mode 100644 index 1220398a4c47df708e31b369d03f08ffe6f1eaf0..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/AllTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk12; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:mtnygard@charter.net">Michael T. Nygard</a> - * @version $Revision$ - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.class); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for CH.ifa.draw.test.util.collections.jdk12"); - //$JUnit-BEGIN$ - suite.addTest(new TestSuite(CollectionsFactoryJDK12Test.class)); - //$JUnit-END$ - return suite; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/CollectionsFactoryJDK12Test.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/CollectionsFactoryJDK12Test.java deleted file mode 100644 index 1b723004d39108fb49f55af322d253d97075cf52..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/CollectionsFactoryJDK12Test.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * @(#)Test.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.test.util.collections.jdk12; - -import CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12; -import junit.framework.TestCase; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* - * Generated by JUnitDoclet, a tool provided by - * ObjectFab GmbH under LGPL. - * Please see www.junitdoclet.org, www.gnu.org - * and www.objectfab.de for informations about - * the tool, the licence and the authors. - */ - -// JUnitDoclet begin javadoc_class -/** - * TestCase CollectionsFactoryJDK12Test is generated by - * JUnitDoclet to hold the tests for CollectionsFactoryJDK12. - * @see CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12 - */ -// JUnitDoclet end javadoc_class -public class CollectionsFactoryJDK12Test -// JUnitDoclet begin extends_implements -extends TestCase -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // instance variables, helper methods, ... put them in this marker - private CollectionsFactoryJDK12 collectionsfactoryjdk12; - // JUnitDoclet end class - - /** - * Constructor CollectionsFactoryJDK12Test is - * basically calling the inherited constructor to - * initiate the TestCase for use by the Framework. - */ - public CollectionsFactoryJDK12Test(String name) { - // JUnitDoclet begin method CollectionsFactoryJDK12Test - super(name); - // JUnitDoclet end method CollectionsFactoryJDK12Test - } - - /** - * Factory method for instances of the class to be tested. - */ - public CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12 createInstance() throws Exception { - // JUnitDoclet begin method testcase.createInstance - return new CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12(); - // JUnitDoclet end method testcase.createInstance - } - - /** - * Method setUp is overwriting the framework method to - * prepare an instance of this TestCase for a single test. - * It's called from the JUnit framework only. - */ - protected void setUp() throws Exception { - // JUnitDoclet begin method testcase.setUp - super.setUp(); - collectionsfactoryjdk12 = createInstance(); - // JUnitDoclet end method testcase.setUp - } - - /** - * Method tearDown is overwriting the framework method to - * clean up after each single test of this TestCase. - * It's called from the JUnit framework only. - */ - protected void tearDown() throws Exception { - // JUnitDoclet begin method testcase.tearDown - collectionsfactoryjdk12 = null; - super.tearDown(); - // JUnitDoclet end method testcase.tearDown - } - - // JUnitDoclet begin javadoc_method createList() - /** - * Method testCreateList is testing createList - * @see CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12#createList() - */ - // JUnitDoclet end javadoc_method createList() - public void testCreateList() throws Exception { - // JUnitDoclet begin method createList - // JUnitDoclet end method createList - } - - // JUnitDoclet begin javadoc_method createMap() - /** - * Method testCreateMap is testing createMap - * @see CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12#createMap() - */ - // JUnitDoclet end javadoc_method createMap() - public void testCreateMap() throws Exception { - // JUnitDoclet begin method createMap - // JUnitDoclet end method createMap - } - - // JUnitDoclet begin javadoc_method createSet() - /** - * Method testCreateSet is testing createSet - * @see CH.ifa.draw.util.collections.jdk12.CollectionsFactoryJDK12#createSet() - */ - // JUnitDoclet end javadoc_method createSet() - public void testCreateSet() throws Exception { - // JUnitDoclet begin method createSet - // JUnitDoclet end method createSet - } - - // JUnitDoclet begin javadoc_method testVault - /** - * JUnitDoclet moves marker to this method, if there is not match - * for them in the regenerated code and if the marker is not empty. - * This way, no test gets lost when regenerating after renaming. - * <b>Method testVault is supposed to be empty.</b> - */ - // JUnitDoclet end javadoc_method testVault - public void testVault() throws Exception { - // JUnitDoclet begin method testcase.testVault - // JUnitDoclet end method testcase.testVault - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/Jdk12Suite.java b/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/Jdk12Suite.java deleted file mode 100644 index 37620007645943811ca6f741358bd3c5b3fad75b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/test/util/collections/jdk12/Jdk12Suite.java +++ /dev/null @@ -1,55 +0,0 @@ -package CH.ifa.draw.test.util.collections.jdk12; - - - -import junit.framework.TestSuite; -// JUnitDoclet begin import -// JUnitDoclet end import - -/* -* Generated by JUnitDoclet, a tool provided by -* ObjectFab GmbH under LGPL. -* Please see www.junitdoclet.org, www.gnu.org -* and www.objectfab.de for informations about -* the tool, the licence and the authors. -*/ - - -// JUnitDoclet begin javadoc_class -/** -* TestSuite Jdk12Suite -*/ -// JUnitDoclet end javadoc_class -public class Jdk12Suite -// JUnitDoclet begin extends_implements -// JUnitDoclet end extends_implements -{ - // JUnitDoclet begin class - // JUnitDoclet end class - - public static TestSuite suite() { - - TestSuite suite; - - suite = new TestSuite("CH.ifa.draw.test.util.collections.jdk12"); - - suite.addTestSuite(CH.ifa.draw.test.util.collections.jdk12.CollectionsFactoryJDK12Test.class); - - - - // JUnitDoclet begin method suite() - // JUnitDoclet end method suite() - - return suite; - } - - /** - * Method to execute the TestSuite from command line - * using JUnit's textui.TestRunner . - */ - public static void main(String[] args) { - // JUnitDoclet begin method testsuite.main - junit.textui.TestRunner.run(suite()); - // JUnitDoclet end method testsuite.main - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Animatable.java b/JHotDraw/src/CH/ifa/draw/util/Animatable.java deleted file mode 100644 index 0d4b452ade470772d97565d5ef8ef48a8e140f17..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Animatable.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * @(#)Animatable.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -/** - * Animatable defines a simple animation interface - * - * @version <$CURRENT_VERSION$> - */ -public interface Animatable { - /** - * Perform a step of the animation. - */ - void animationStep(); -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Bounds.java b/JHotDraw/src/CH/ifa/draw/util/Bounds.java deleted file mode 100644 index 0e670bf502feafa156591d190fae68419da1a6cf..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Bounds.java +++ /dev/null @@ -1,496 +0,0 @@ -/* - * @(#)Bounds.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.awt.Dimension; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; -import java.io.Serializable; - -/** - * This class is a rectangle with floating point - * dimensions and location. This class provides - * many convenient geometrical methods related to - * rectangles. Basically, this class is like - * java.awt.geom.Rectangle2D with some extra - * functionality. - * - * @author WMG (28.02.1999) - * @version <$CURRENT_VERSION$> - */ -public class Bounds implements Serializable { - - //_________________________________________________________VARIABLES - - protected double _dX1 = 0; - protected double _dY1 = 0; - protected double _dX2 = 0; - protected double _dY2 = 0; - - //______________________________________________________CONSTRUCTORS - - public Bounds(double x, double y) { - _dX1 = x; - _dX2 = x; - _dY1 = y; - _dY2 = y; - } - - public Bounds(double x1, double y1, double x2, double y2) { - _dX1 = Math.min(x1, x2); - _dX2 = Math.max(x1, x2); - _dY1 = Math.min(y1, y2); - _dY2 = Math.max(y1, y2); - } - - public Bounds(Point2D aPoint2D) { - this(aPoint2D.getX(), aPoint2D.getY()); - } - - public Bounds(Point2D firstPoint2D, Point2D secondPoint2D) { - this(firstPoint2D.getX(), firstPoint2D.getY(), - secondPoint2D.getX(), secondPoint2D.getY()); - } - - public Bounds(Bounds aBounds) { - this(aBounds.getLesserX(), aBounds.getLesserY(), - aBounds.getGreaterX(), aBounds.getGreaterY()); - } - - public Bounds(Rectangle2D aRectangle2D) { - _dX1 = aRectangle2D.getMinX(); - _dX2 = aRectangle2D.getMaxX(); - _dY1 = aRectangle2D.getMinY(); - _dY2 = aRectangle2D.getMaxY(); - } - - public Bounds(Point2D centerPoint2D, double dWidth, double dHeight) { - _dX1 = centerPoint2D.getX() - (dWidth / 2.0); - _dX2 = centerPoint2D.getX() + (dWidth / 2.0); - _dY1 = centerPoint2D.getY() - (dHeight / 2.0); - _dY2 = centerPoint2D.getY() + (dHeight / 2.0); - } - - public Bounds(Dimension aDimension) { - this(0, 0, aDimension.width, aDimension.height); - } - - protected Bounds() { - // empty constructor - } - - //____________________________________________________PUBLIC METHODS - - public double getLesserX() { - return _dX1; - } - - public double getGreaterX() { - return _dX2; - } - - public double getLesserY() { - return _dY1; - } - - public double getGreaterY() { - return _dY2; - } - - public double getWest() { - return _dX1; - } - - public double getEast() { - return _dX2; - } - - public double getSouth() { - return _dY1; - } - - public double getNorth() { - return _dY2; - } - - public double getWidth() { - return _dX2 - _dX1; - } - - public double getHeight() { - return _dY2 - _dY1; - } - - public Rectangle2D asRectangle2D() { - return new Rectangle2D.Double(getLesserX(), getLesserY(), - getWidth(), getHeight()); - } - - public void setCenter(Point2D centerPoint2D) { - if(centerPoint2D == null) { - throw new IllegalArgumentException(); - } - Point2D currentCenterPoint2D = getCenter(); - double dDeltaX = centerPoint2D.getX() - currentCenterPoint2D.getX(); - double dDeltaY = centerPoint2D.getY() - currentCenterPoint2D.getY(); - offset(dDeltaX, dDeltaY); - } - - public Point2D getCenter() { - return new Point2D.Double((_dX1 + _dX2) / 2.0, (_dY1 + _dY2) / 2.0); - } - - public void zoomBy(double dRatio) { - double dWidth = _dX2 - _dX1; - double dHeight = _dY2 - _dY1; - double dNewWidth = (dWidth * dRatio); - double dNewHeight = (dHeight * dRatio); - Point2D centerPoint2D = getCenter(); - _dX1 = centerPoint2D.getX() - (dNewWidth / 2.0); - _dY1 = centerPoint2D.getY() - (dNewHeight / 2.0); - _dX2 = centerPoint2D.getX() + (dNewWidth / 2.0); - _dY2 = centerPoint2D.getY() + (dNewHeight / 2.0); - } - - public void shiftBy(int nXPercentage, int nYPercentage) { - double dWidth = _dX2 - _dX1; - double dHeight = _dY2 - _dY1; - double dDeltaX = (dWidth * nXPercentage) / 100.0; - double dDeltaY = (dHeight * nYPercentage) / 100.0; - offset(dDeltaX, dDeltaY); - } - - public void offset(double dDeltaX, double dDeltaY) { - _dX1 += dDeltaX; - _dX2 += dDeltaX; - _dY1 += dDeltaY; - _dY2 += dDeltaY; - } - - /** - * This will cause the bounds to grow until the given ratio - * is satisfied. The Ration is calculated by - * <code> getWidth() / getHeight() </code> - **/ - public void expandToRatio(double dRatio) { - double dCurrentRatio = getWidth() / getHeight(); - if (dCurrentRatio < dRatio) { - double dNewWidth = dRatio * getHeight(); - double dCenterX = (_dX1 + _dX2) / 2.0; - double dDelta = dNewWidth / 2.0; - _dX1 = dCenterX - dDelta; - _dX2 = dCenterX + dDelta; - } - if (dCurrentRatio > dRatio) { - double dNewHeight = getWidth() / dRatio; - double dCenterY = (_dY1 + _dY2) / 2.0; - double dDelta = dNewHeight / 2.0; - _dY1 = dCenterY - dDelta; - _dY2 = dCenterY + dDelta; - } - } - - public void includeXCoordinate(double x) { - _dX1 = min(_dX1, _dX2, x); - _dX2 = max(_dX1, _dX2, x); - } - - public void includeYCoordinate(double y) { - _dY1 = min(_dY1, _dY2, y); - _dY2 = max(_dY1, _dY2, y); - } - - public void includePoint(double x, double y) { - includeXCoordinate(x); - includeYCoordinate(y); - } - - public void includePoint(Point2D aPoint2D) { - includePoint(aPoint2D.getX(), aPoint2D.getY()); - } - - public void includeLine(double x1, double y1, double x2, double y2) { - includePoint(x1, y1); - includePoint(x2, y2); - } - - public void includeLine(Point2D onePoint2D, Point2D twoPoint2D) { - includeLine(onePoint2D.getX(), onePoint2D.getY(), - twoPoint2D.getX(), twoPoint2D.getY()); - } - - public void includeBounds(Bounds aBounds) { - includeXCoordinate(aBounds.getLesserX()); - includeXCoordinate(aBounds.getGreaterX()); - includeYCoordinate(aBounds.getLesserY()); - includeYCoordinate(aBounds.getGreaterY()); - } - - public void includeRectangle2D(Rectangle2D aRectangle2D) { - includeXCoordinate(aRectangle2D.getMinX()); - includeXCoordinate(aRectangle2D.getMaxX()); - includeYCoordinate(aRectangle2D.getMinY()); - includeYCoordinate(aRectangle2D.getMaxY()); - } - - public void intersect(Bounds aBounds) { - _dX1 = Math.max(_dX1, aBounds.getLesserX()); - _dY1 = Math.max(_dY1, aBounds.getLesserY()); - _dX2 = Math.min(_dX2, aBounds.getGreaterX()); - _dY2 = Math.min(_dY2, aBounds.getGreaterY()); - - if (_dX1 > _dX2) { - _dX1 = _dX2; - } - if (_dY1 > _dY2) { - _dY1 = _dY2; - } - } - - public boolean intersectsPoint(double x, double y) { - return ((_dX1 <= x) && (x <= _dX2) && (_dY1 <= y) && (y <= _dY2)); - } - - public boolean intersectsPoint(Point2D aPoint2D) { - return intersectsPoint(aPoint2D.getX(), aPoint2D.getY()); - } - - - public boolean intersectsLine(double x1, double y1, double x2, double y2) { - if (intersectsPoint(x1, y1)) { - return true; - } - if (intersectsPoint(x2, y2)) { - return true; - } - if ((x1 < _dX1) && (x2 < _dX1)) { - return false; - } - if ((x1 > _dX2) && (x2 > _dX2)) { - return false; - } - if ((y1 < _dY1) && (y2 < _dY1)) { - return false; - } - if ((y1 > _dY2) && (y2 > _dY2)) { - return false; - } - if (((_dX1 <= x1) && (x1 <= _dX2)) && ((_dX1 <= x2) && (x2 <= _dX2))) { - return true; - } - if (((_dY1 <= y1) && (y1 <= _dY2)) && ((_dY1 <= y2) && (y2 <= _dY2))) { - return true; - } - - double dSlope = (y2-y1) / (x2-x1); - double _dYIntersectionAtX1 = dSlope * (_dX1 - x1) + y1; - double _dYIntersectionAtX2 = dSlope * (_dX2 - x1) + y1; - double _dXIntersectionAtY1 = (_dY1 - y1) / dSlope + x1; - double _dXIntersectionAtY2 = (_dY2 - y1) / dSlope + x1; - - return (intersectsPoint(_dX1, _dYIntersectionAtX1)) || - (intersectsPoint(_dX2, _dYIntersectionAtX2)) || - (intersectsPoint(_dXIntersectionAtY1, _dY1)) || - (intersectsPoint(_dXIntersectionAtY2, _dY2)); - } - - public boolean intersectsLine(Point2D onePoint2D, Point2D twoPoint2D) { - return intersectsLine(onePoint2D.getX(), onePoint2D.getY(), - twoPoint2D.getX(), twoPoint2D.getY()); - } - - //use K-map to simplify - public boolean intersectsBounds(Bounds aBounds) { - double dLesserX = aBounds.getLesserX(); - double dGreaterX = aBounds.getGreaterX(); - double dLesserY = aBounds.getLesserY(); - double dGreaterY = aBounds.getGreaterY(); - - if (dLesserX < _dX1) { - if (dLesserY < _dY1) { - return ((dGreaterX >= _dX1) && (dGreaterY >= _dY1)); - } - else { - return ((dGreaterX >= _dX1) && (dLesserY <= _dY2)); - } - } - else { - if (dLesserY < _dY1) { - return ((dLesserX <= _dX2) && (dGreaterY >= _dY1)); - } - else { - return ((dLesserX <= _dX2) && (dLesserY <= _dY2)); - } - } - } - - public boolean completelyContainsLine(double x1, double y1, double x2, double y2) { - return (_dX1 > Math.min(x1, x2)) && - (_dX2 < Math.max(x1, x2)) && - (_dY1 > Math.min(y1, y2)) && - (_dY2 < Math.max(y1, y2)); - } - - public boolean isCompletelyInside(Bounds aBounds) { - return (_dX1 > aBounds.getLesserX()) && - (_dX2 < aBounds.getGreaterX()) && - (_dY1 > aBounds.getLesserY()) && - (_dY2 < aBounds.getGreaterY()); - } - - public Point2D[] cropLine(double x1, double y1, double x2, double y2) { - if (!intersectsLine(x1, y1, x2, y2)) { - return null; - } - - Point2D[] resultLine = new Point2D[2]; - Point2D beginPoint2D = new Point2D.Double(x1, y1); - Point2D endPoint2D = new Point2D.Double(x2, y2); - - if (beginPoint2D.getX() == endPoint2D.getX()) { - if (beginPoint2D.getY() > _dY2) { - beginPoint2D.setLocation(beginPoint2D.getX(), _dY2); - } - if (endPoint2D.getY() > _dY2) { - endPoint2D.setLocation(endPoint2D.getX(), _dY2); - } - if (beginPoint2D.getY() < _dY1) { - beginPoint2D.setLocation(beginPoint2D.getX(), _dY1); - } - if (endPoint2D.getY() < _dY1) { - endPoint2D.setLocation(endPoint2D.getX(), _dY1); - } - } - else if (beginPoint2D.getY() == endPoint2D.getY()) { - if (beginPoint2D.getX() > _dX2) { - beginPoint2D.setLocation(_dX2, beginPoint2D.getY()); - } - if (endPoint2D.getX() > _dX2) { - endPoint2D.setLocation(_dX2, endPoint2D.getY()); - } - if (beginPoint2D.getX() < _dX1) { - beginPoint2D.setLocation(_dX1, beginPoint2D.getY()); - } - if (endPoint2D.getX() < _dX1) { - endPoint2D.setLocation(_dX1, endPoint2D.getY()); - } - } - else { - double dSlope = (beginPoint2D.getY() - endPoint2D.getY()) - / (beginPoint2D.getX() - endPoint2D.getX()); - - if (!intersectsPoint(beginPoint2D)) { - if (beginPoint2D.getY() > _dY2) { - double x = ((_dY2 - beginPoint2D.getY()) / dSlope) + beginPoint2D.getX(); - if ((x >= _dX1) && (x <= _dX2)) { - beginPoint2D.setLocation(x, beginPoint2D.getY()); - beginPoint2D.setLocation(beginPoint2D.getX(), _dY2); - } - } - if (beginPoint2D.getY() < _dY1) { - double x = ((_dY1 - beginPoint2D.getY()) / dSlope) + beginPoint2D.getX(); - if ((x >= _dX1) && (x <= _dX2)) { - beginPoint2D.setLocation(x, beginPoint2D.getY()); - beginPoint2D.setLocation(beginPoint2D.getX(), _dY1); - } - } - if (beginPoint2D.getX() > _dX2) { - double y = dSlope*(_dX2 - beginPoint2D.getX()) + beginPoint2D.getY(); - if ((y >= _dY1) && (y <= _dY2)) { - beginPoint2D.setLocation(_dX2, beginPoint2D.getY()); - beginPoint2D.setLocation(beginPoint2D.getX(), y); - } - } - if (beginPoint2D.getX() < _dX1) { - double y = dSlope*(_dX1 - beginPoint2D.getX()) + beginPoint2D.getY(); - if ((y >= _dY1) && (y <= _dY2)) { - beginPoint2D.setLocation(_dX1, beginPoint2D.getY()); - beginPoint2D.setLocation(beginPoint2D.getX(), y); - } - } - } - if (!intersectsPoint(endPoint2D)) { - if (endPoint2D.getY() > _dY2) { - double x = ((_dY2 - beginPoint2D.getY()) / dSlope) + beginPoint2D.getX(); - if ((x >= _dX1) && (x <= _dX2)) { - endPoint2D.setLocation(x, endPoint2D.getY()); - endPoint2D.setLocation(endPoint2D.getX(), _dY2); - } - } - if (endPoint2D.getY() < _dY1) { - double x = ((_dY1 - beginPoint2D.getY()) / dSlope) + beginPoint2D.getX(); - if ((x >= _dX1) && (x <= _dX2)) { - endPoint2D.setLocation(x, endPoint2D.getY()); - endPoint2D.setLocation(endPoint2D.getX(), _dY1); - } - } - if (endPoint2D.getX() > _dX2) { - double y = dSlope*(_dX2 - beginPoint2D.getX()) + beginPoint2D.getY(); - if ((y >= _dY1) && (y <= _dY2)) { - endPoint2D.setLocation(_dX2, endPoint2D.getY()); - endPoint2D.setLocation(endPoint2D.getX(), y); - } - } - if (endPoint2D.getX() < _dX1) { - double y = dSlope*(_dX1 - beginPoint2D.getX()) + beginPoint2D.getY(); - if ((y >= _dY1) && (y <= _dY2)) { - endPoint2D.setLocation(_dX1, endPoint2D.getY()); - endPoint2D.setLocation(endPoint2D.getX(), y); - } - } - } - } - - resultLine[0] = beginPoint2D; - resultLine[1] = endPoint2D; - - return resultLine; - } - - public boolean equals(Object anObject) { - if ((anObject == null) || (!(anObject instanceof Bounds))) { - return false; - } - Bounds aBounds = (Bounds) anObject; - - if ((_dX1 == aBounds.getLesserX()) && - (_dX2 == aBounds.getGreaterX()) && - (_dY1 == aBounds.getLesserY()) && - (_dY2 == aBounds.getGreaterY())) { - return true; - } - - return false; - } - - public int hashCode() { - double temp = Math.abs(_dX1 + _dX2 +_dY1 + _dY2); - while ((temp != 0) && (temp < 1)) { - temp *= 4; - } - - return (int) temp; - } - - public String toString() { - return Double.toString(_dX1) + " " + Double.toString(_dY1) - + " " + Double.toString(_dX2) + " " + Double.toString(_dY2); - } - - private double min( double x1, double x2, double x3 ) { - return Math.min( Math.min( x1, x2 ), x3 ); - } - - private double max( double x1, double x2, double x3 ) { - return Math.max( Math.max( x1, x2 ), x3 ); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Clipboard.java b/JHotDraw/src/CH/ifa/draw/util/Clipboard.java deleted file mode 100644 index f48b905969e79823ddd4a8380f7165c1adb37c7b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Clipboard.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * @(#)Clipboard.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -/** - * A temporary replacement for a global clipboard. - * It is a singleton that can be used to store and - * get the contents of the clipboard. - * - * @version <$CURRENT_VERSION$> - */ -public class Clipboard { - static Clipboard fgClipboard = new Clipboard(); - - /** - * Gets the clipboard. - */ - static public Clipboard getClipboard() { - return fgClipboard; - } - - private Object fContents; - - private Clipboard() { - } - - /** - * Sets the contents of the clipboard. - */ - public void setContents(Object contents) { - fContents = contents; - } - - /** - * Gets the contents of the clipboard. - */ - public Object getContents() { - return fContents; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/CollectionsFactory.java b/JHotDraw/src/CH/ifa/draw/util/CollectionsFactory.java deleted file mode 100644 index d5b31baf5194848263f05833fdec8116ad60265a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/CollectionsFactory.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * @(#)CollectionsFactory.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.JHotDrawRuntimeException; - -import java.util.*; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public abstract class CollectionsFactory { - private static String JAVA_UTIL_LIST = "java.util.List"; - private static String COLLECTIONS_FACTORY_PACKAGE = "CH.ifa.draw.util.collections.jdk"; - - private static final CollectionsFactory factory = determineCollectionsFactory(); - - public abstract List createList(); - - public abstract List createList(Collection initList); - - public abstract List createList(int initSize); - - public abstract Map createMap(); - - public abstract Map createMap(Map initMap); - - public abstract Set createSet(); - - public abstract Set createSet(Set initSet); - - public static CollectionsFactory current() { - return factory; - } - - protected static CollectionsFactory determineCollectionsFactory() { - String jdkVersion = null; - if (isJDK12()) { - jdkVersion = "12"; - } - else { - jdkVersion = "11"; - } - return createCollectionsFactory(jdkVersion); - } - - protected static boolean isJDK12() { - try { - Class.forName(JAVA_UTIL_LIST); - return true; - } - catch (ClassNotFoundException e) { - // ignore - } - return false; - } - - protected static CollectionsFactory createCollectionsFactory(String jdkVersion) { - try { - Class factoryClass = Class.forName(COLLECTIONS_FACTORY_PACKAGE + jdkVersion + ".CollectionsFactoryJDK" + jdkVersion); - return (CollectionsFactory)factoryClass.newInstance(); - } - catch (ClassNotFoundException e) { - throw new JHotDrawRuntimeException(e); - } - catch (InstantiationException e) { - throw new JHotDrawRuntimeException(e); - } - catch (IllegalAccessException e) { - throw new JHotDrawRuntimeException(e); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/ColorMap.java b/JHotDraw/src/CH/ifa/draw/util/ColorMap.java deleted file mode 100644 index 31a1db302a516bea4eabe805c027ec41cb36a47d..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/ColorMap.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * @(#)ColorMap.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.awt.Color; - -class ColorEntry { - public String fName; - public Color fColor; - - ColorEntry(String name, Color color) { - fColor = color; - fName = name; - } -} - -/** - * A map that is filled with some standard colors. The colors - * can be looked up by name or index. - * - * @version <$CURRENT_VERSION$> - */ -public class ColorMap { - - static ColorEntry fMap[] = { - new ColorEntry("Black", Color.black), - new ColorEntry("Blue", Color.blue), - new ColorEntry("Green", Color.green), - new ColorEntry("Red", Color.red), - new ColorEntry("Pink", Color.pink), - new ColorEntry("Magenta", Color.magenta), - new ColorEntry("Orange", Color.orange), - new ColorEntry("Yellow", Color.yellow), - new ColorEntry("New Tan", new Color(0xEBC79E)), - new ColorEntry("Aquamarine", new Color(0x70DB93)), - new ColorEntry("Sea Green", new Color(0x238E68)), - new ColorEntry("Dark Gray", Color.darkGray), - new ColorEntry("Light Gray", Color.lightGray), - new ColorEntry("White", Color.white), - // there is no support for alpha values so we use a special value - // to represent a transparent color - new ColorEntry("None", new Color(0xFFC79E)) - }; - - public static int size() { - return fMap.length; - } - - public static Color color(int index) { - if (index < size() && index >= 0) { - return fMap[index].fColor; - } - - throw new ArrayIndexOutOfBoundsException("Color index: " + index); - } - - public static Color color(String name) { - for (int i = 0; i < fMap.length; i++) { - if (fMap[i].fName.equals(name)) { - return fMap[i].fColor; - } - } - - return Color.black; - } - - public static String name(int index) { - if (index < size() && index >= 0) { - return fMap[index].fName; - } - - throw new ArrayIndexOutOfBoundsException("Color index: " + index); - } - - public static int colorIndex(Color color) { - for (int i=0; i<fMap.length; i++) { - if (fMap[i].fColor.equals(color)) { - return i; - } - } - - return 0; - } - - public static boolean isTransparent(Color color) { - return color.equals(color("None")); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Command.java b/JHotDraw/src/CH/ifa/draw/util/Command.java deleted file mode 100644 index 3b661b7314aa0edf589a407add7892f93c005d6b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Command.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * @(#)Command.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.DrawingEditor; - -/** - * Commands encapsulate an action to be executed. Commands have - * a name and can be used in conjunction with <i>Command enabled</i> - * ui components. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld010.htm>Command</a></b><br> - * Command is a simple instance of the command pattern without undo - * support. - * <hr> - * - * @see CommandButton - * @see CommandMenu - * @see CommandChoice - * - * @version <$CURRENT_VERSION$> - */ -public interface Command { - - /** - * Executes the command. - */ - public void execute(); - - /** - * Tests if the command can be executed. - */ - public boolean isExecutable(); - - /** - * Gets the command name. - */ - public String name(); - - public DrawingEditor getDrawingEditor(); - - public Undoable getUndoActivity(); - - public void setUndoActivity(Undoable newUndoableActivity); - - public void addCommandListener(CommandListener newCommandListener); - public void removeCommandListener(CommandListener oldCommandListener); -} diff --git a/JHotDraw/src/CH/ifa/draw/util/CommandButton.java b/JHotDraw/src/CH/ifa/draw/util/CommandButton.java deleted file mode 100644 index 36659fa572af959d53be7036659a6c65dc788286..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/CommandButton.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * @(#)CommandButton.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * A Command enabled button. Clicking the button executes the command. - * - * @see Command - * - * @version <$CURRENT_VERSION$> - */ -public class CommandButton - extends JButton implements ActionListener { - - private Command fCommand; - - /** - * Initializes the button with the given command. - * The command's name is used as the label. - */ - public CommandButton(Command command) { - super(command.name()); - fCommand = command; - addActionListener(this); - } - - /** - * Executes the command. If the command's name was changed - * as a result of the command the button's label is updated - * accordingly. - */ - public void actionPerformed(ActionEvent e) { - fCommand.execute(); - if (!getText().equals(fCommand.name()) ) { - setText(fCommand.name()); - } - } -} - - diff --git a/JHotDraw/src/CH/ifa/draw/util/CommandChoice.java b/JHotDraw/src/CH/ifa/draw/util/CommandChoice.java deleted file mode 100644 index 45eb57f1c97699efa61e939130ab55a873d3cdb1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/CommandChoice.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @(#)CommandChoice.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.List; - -/** - * A Command enabled choice. Selecting a choice executes the - * corresponding command. - * - * @see Command - * - * @version <$CURRENT_VERSION$> - */ -public class CommandChoice extends JComboBox implements ItemListener { - - private List fCommands; - - public CommandChoice() { - super(); - fCommands = CollectionsFactory.current().createList(10); - addItemListener(this); - } - - /** - * Adds a command to the menu. - */ - public synchronized void addItem(Command command) { - addItem(command.name()); - fCommands.add(command); - } - - /** - * Executes the command. - */ - public void itemStateChanged(ItemEvent e) { - if ((getSelectedIndex() >= 0) && (getSelectedIndex() < fCommands.size())) { - Command command = (Command)fCommands.get(getSelectedIndex()); - if (command.isExecutable()) { - command.execute(); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/CommandListener.java b/JHotDraw/src/CH/ifa/draw/util/CommandListener.java deleted file mode 100644 index 13205ae430e09f00f445285a7d3709c6addb739e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/CommandListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * @(#)CommandListener.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.util.EventObject; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public interface CommandListener { - public void commandExecuted(EventObject commandEvent); - public void commandExecutable(EventObject commandEvent); - public void commandNotExecutable(EventObject commandEvent); -} diff --git a/JHotDraw/src/CH/ifa/draw/util/CommandMenu.java b/JHotDraw/src/CH/ifa/draw/util/CommandMenu.java deleted file mode 100644 index 2e5bf8c5904f3f022303f6aca98a1cd9900f8928..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/CommandMenu.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * @(#)CommandMenu.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.JHotDrawRuntimeException; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.util.*; - -/** - * A Command enabled menu. Selecting a menu item - * executes the corresponding command. - * - * @see Command - * - * @version <$CURRENT_VERSION$> - */ -public class CommandMenu extends JMenu implements ActionListener, CommandListener { - - private HashMap hm; - - public CommandMenu(String name) { - super(name); - hm = new HashMap(); - } - - /** - * Adds a command to the menu. The item's label is - * the command's name. - */ - public synchronized void add(Command command) { - addMenuItem(command, new JMenuItem(command.name())); - } - - /** - * Adds a command with the given short cut to the menu. The item's label is - * the command's name. - */ - public synchronized void add(Command command, MenuShortcut shortcut) { - addMenuItem(command, new JMenuItem(command.name(), shortcut.getKey())); - } - - /** - * Adds a command with the given short cut to the menu. The item's label is - * the command's name. - */ - public synchronized void addCheckItem(Command command) { - addMenuItem(command, new JCheckBoxMenuItem(command.name())); - } - - protected void addMenuItem(Command command, JMenuItem m) { - m.setName(command.name()); - m.addActionListener(this); - add(m); - command.addCommandListener(this); - hm.put(m, command); -// checkEnabled(); - } - - public synchronized void remove(Command command) { - throw new JHotDrawRuntimeException("not implemented"); - } - - public synchronized void remove(MenuItem item) { - throw new JHotDrawRuntimeException("not implemented"); - } - - /** - * Changes the enabling/disabling state of a named menu item. - */ - public synchronized void enable(String name, boolean state) { - for (int i = 0; i < getItemCount(); i++) { - JMenuItem item = getItem(i); - if (name.equals(item.getText())) { - item.setEnabled(state); - return; - } - } - } - - public synchronized void checkEnabled() { - // ignore separators (a separator has a hyphen as its label) - for (int i = 0; i < getMenuComponentCount(); i++) { - Component c = getMenuComponent(i); - Command cmd = (Command) hm.get(c); - if (cmd != null) { - c.setEnabled(cmd.isExecutable()); - } - } - } - - /** - * Executes the command. - */ - public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - for (int i = 0; i < getItemCount(); i++) { - JMenuItem item = getItem(i); - // ignore separators (a separator has a hyphen as its label) - if (source == item) { - Command cmd = (Command) hm.get(item); - if (cmd != null) { - cmd.execute(); - } - break; - } - } - } - - public void commandExecuted(EventObject commandEvent) { -// checkEnabled(); - } - - public void commandExecutable(EventObject commandEvent) { -// checkEnabled(); - } - - public void commandNotExecutable(EventObject commandEvent) { -// checkEnabled(); - } -} - - diff --git a/JHotDraw/src/CH/ifa/draw/util/Filler.java b/JHotDraw/src/CH/ifa/draw/util/Filler.java deleted file mode 100644 index 2dbbef5e34fd6b5e4a17deefc24ecd8817011dcc..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Filler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @(#)Filler.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.JPanel; -import java.awt.*; - -/** - * A component that can be used to reserve white space in a layout. - * - * @version <$CURRENT_VERSION$> - */ -public class Filler - extends JPanel { - - private int fWidth; - private int fHeight; - private Color fBackground; - - - public Filler(int width, int height) { - this(width, height, null); - } - - public Filler(int width, int height, Color background) { - fWidth = width; - fHeight = height; - fBackground = background; - } - - public Dimension getMinimumSize() { - return new Dimension(fWidth, fHeight); - } - - public Dimension getPreferredSize() { - return getMinimumSize(); - } - - public Color getBackground() { - if (fBackground != null) { - return fBackground; - } - return super.getBackground(); - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/util/FloatingTextField.java b/JHotDraw/src/CH/ifa/draw/util/FloatingTextField.java deleted file mode 100644 index d2c1eb8934086d11a5d0134e9c7828c8d1df44c9..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/FloatingTextField.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @(#)FloatingTextField.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -/** - * A text field overlay that is used to edit a TextFigure. - * A FloatingTextField requires a two step initialization: - * In a first step the overlay is created and in a - * second step it can be positioned. - * - * @see CH.ifa.draw.figures.TextFigure - * - * @version <$CURRENT_VERSION$> - */ -public class FloatingTextField { - - private JTextField fEditWidget; - private Container fContainer; - - public FloatingTextField() { - fEditWidget = new JTextField(20); - } - - /** - * Creates the overlay for the given Component. - */ - public void createOverlay(Container container) { - createOverlay(container, null); - } - - /** - * Creates the overlay for the given Container using a - * specific font. - */ - public void createOverlay(Container container, Font font) { - container.add(fEditWidget, 0); - if (font != null) { - fEditWidget.setFont(font); - } - fContainer = container; - } - - /** - * Adds an action listener - */ - public void addActionListener(ActionListener listener) { - fEditWidget.addActionListener(listener); - } - - /** - * Remove an action listener - */ - public void removeActionListener(ActionListener listener) { - fEditWidget.removeActionListener(listener); - } - - /** - * Positions the overlay. - */ - public void setBounds(Rectangle r, String text) { - fEditWidget.setText(text); - fEditWidget.setLocation(r.x, r.y); - fEditWidget.setSize(r.width, r.height); - fEditWidget.setVisible(true); - fEditWidget.selectAll(); - fEditWidget.requestFocus(); - } - - /** - * Gets the text contents of the overlay. - */ - public String getText() { - return fEditWidget.getText(); - } - - /** - * Gets the preferred size of the overlay. - */ - public Dimension getPreferredSize(int cols) { - fEditWidget.setColumns(cols); - return fEditWidget.getPreferredSize(); - } - - /** - * Removes the overlay. - */ - public void endOverlay() { - fContainer.requestFocus(); - if (fEditWidget != null) { - fEditWidget.setVisible(false); - fContainer.remove(fEditWidget); - - Rectangle bounds = fEditWidget.getBounds(); - fContainer.repaint(bounds.x, bounds.y, bounds.width, bounds.height); - } - } -} - diff --git a/JHotDraw/src/CH/ifa/draw/util/Geom.java b/JHotDraw/src/CH/ifa/draw/util/Geom.java deleted file mode 100644 index 5c3f50488c5e80cbda18f9cefcf6bbc82bb8dbba..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Geom.java +++ /dev/null @@ -1,394 +0,0 @@ -/* - * @(#)Geom.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.awt.Rectangle; -import java.awt.Point; -import java.awt.geom.Line2D; - -/** - * Some geometric utilities. - * - * @version <$CURRENT_VERSION$> - */ -public class Geom { - - private Geom() {} // never instantiated - - /** - * Tests if a point is on a line. - */ - static public boolean lineContainsPoint(int x1, int y1, - int x2, int y2, - int px, int py) { - - Rectangle r = new Rectangle(new Point(x1, y1)); - r.add(x2, y2); - r.grow(2, 2); - if (! r.contains(px,py)) { - return false; - } - - double a, b, x, y; - - if (x1 == x2) { - return (Math.abs(px - x1) < 3); - } - if (y1 == y2) { - return (Math.abs(py - y1) < 3); - } - - a = (y1 - y2) / (x1 - x2); - b = y1 - a * x1; - x = (py - b) / a; - y = a * px + b; - - return (Math.min(Math.abs(x - px), Math.abs(y - py)) < 4); - } - - static public final int NORTH = 1; - static public final int SOUTH = 2; - static public final int WEST = 3; - static public final int EAST = 4; - - /** - * Returns the direction NORTH, SOUTH, WEST, EAST from - * one point to another one. - */ - static public int direction(int x1, int y1, int x2, int y2) { - int direction = 0; - int vx = x2 - x1; - int vy = y2 - y1; - - if (vy < vx && vx > -vy) { - direction = EAST; - } - else if (vy > vx && vy > -vx) { - direction = NORTH; - } - else if (vx < vy && vx < -vy) { - direction = WEST; - } - else { - direction = SOUTH; - } - return direction; - } - - static public Point south(Rectangle r) { - return new Point(r.x + r.width /2, r.y + r.height); - } - - static public Point center(Rectangle r) { - return new Point(r.x + r.width /2, r.y + r.height/2); - } - - static public Point west(Rectangle r) { - return new Point(r.x, r.y + r.height/ 2); - } - - static public Point east(Rectangle r) { - return new Point(r.x+r.width, r.y + r.height/ 2); - } - - static public Point north(Rectangle r) { - return new Point(r.x+r.width/2, r.y); - } - - /** - * Returns the corner (bottom right) of the rectangle - * - * @param r the rectangle - * @return the corner - */ - public static Point corner(Rectangle r) - { - return new Point((int)r.getMaxX(), (int)r.getMaxY()); - } - - - /** - * Returns the top left corner of the rectangle - * - * @param r the rectangle - * @return the corner - */ - public static Point topLeftCorner(Rectangle r) - { - return r.getLocation(); - } - - - /** - * Returns the top right corner of the rectangle - * - * @param r the rectangle - * @return the corner - */ - public static Point topRightCorner(Rectangle r) - { - return new Point((int)r.getMaxX(), (int)r.getMinY()); - } - - - /** - * Returns the bottom left corner of the rectangle - * - * @param r the rectangle - * @return the corner - */ - public static Point bottomLeftCorner(Rectangle r) - { - return new Point((int)r.getMinX(), (int)r.getMaxY()); - } - - - /** - * Returns the bottom right corner of the rectangle. - * Same as corner, added for naming coherence with the other - * corner extracting methods - * - * @param r the rectangle - * @return the corner - */ - public static Point bottomRightCorner(Rectangle r) - { - return corner(r); - } - - /** - * Constains a value to the given range. - * @return the constrained value - */ - static public int range(int min, int max, int value) { - if (value < min) { - value = min; - } - if (value > max) { - value = max; - } - return value; - } - - /** - * Gets the square distance between two points. - */ - static public long length2(int x1, int y1, int x2, int y2) { - return (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1); - } - - /** - * Gets the distance between to points - */ - static public long length(int x1, int y1, int x2, int y2) { - return (long)Math.sqrt(length2(x1, y1, x2, y2)); - } - - /** - * Gets the angle of a point relative to a rectangle. - */ - static public double pointToAngle(Rectangle r, Point p) { - int px = p.x - (r.x + r.width/2); - int py = p.y - (r.y + r.height/2); - return Math.atan2(py*r.width, px*r.height); - } - - /** - * Gets the point on a rectangle that corresponds to the given angle. - */ - static public Point angleToPoint(Rectangle r, double angle) { - double si = Math.sin(angle); - double co = Math.cos(angle); - double e = 0.0001; - - int x= 0, y= 0; - if (Math.abs(si) > e) { - x= (int) ((1.0 + co/Math.abs(si))/2.0 * r.width); - x= range(0, r.width, x); - } - else if (co >= 0.0) { - x= r.width; - } - if (Math.abs(co) > e) { - y= (int) ((1.0 + si/Math.abs(co))/2.0 * r.height); - y= range(0, r.height, y); - } - else if (si >= 0.0) { - y= r.height; - } - return new Point(r.x + x, r.y + y); - } - - /** - * Converts a polar to a point - */ - static public Point polarToPoint(double angle, double fx, double fy) { - double si = Math.sin(angle); - double co = Math.cos(angle); - return new Point((int)(fx*co+0.5), (int)(fy*si+0.5)); - } - - /** - * Gets the point on an oval that corresponds to the given angle. - */ - static public Point ovalAngleToPoint(Rectangle r, double angle) { - Point center = Geom.center(r); - Point p = Geom.polarToPoint(angle, r.width/2, r.height/2); - return new Point(center.x + p.x, center.y + p.y); - } - - /** - * Standard line intersection algorithm - * Return the point of intersection if it exists, else null - **/ - // from Doug Lea's PolygonFigure - static public Point intersect(int xa, // line 1 point 1 x - int ya, // line 1 point 1 y - int xb, // line 1 point 2 x - int yb, // line 1 point 2 y - int xc, // line 2 point 1 x - int yc, // line 2 point 1 y - int xd, // line 2 point 2 x - int yd) { // line 2 point 2 y - - // source: http://vision.dai.ed.ac.uk/andrewfg/c-g-a-faq.html - // eq: for lines AB and CD - // (YA-YC)(XD-XC)-(XA-XC)(YD-YC) - // r = ----------------------------- (eqn 1) - // (XB-XA)(YD-YC)-(YB-YA)(XD-XC) - // - // (YA-YC)(XB-XA)-(XA-XC)(YB-YA) - // s = ----------------------------- (eqn 2) - // (XB-XA)(YD-YC)-(YB-YA)(XD-XC) - // XI = XA + r(XB-XA) - // YI = YA + r(YB-YA) - - double denom = ((xb - xa) * (yd - yc) - (yb - ya) * (xd - xc)); - - double rnum = ((ya - yc) * (xd - xc) - (xa - xc) * (yd - yc)); - - if (denom == 0.0) { // parallel - if (rnum == 0.0) { // coincident; pick one end of first line - if ((xa < xb && (xb < xc || xb < xd)) || - (xa > xb && (xb > xc || xb > xd))) { - return new Point(xb, yb); - } - else { - return new Point(xa, ya); - } - } - else { - return null; - } - } - - double r = rnum / denom; - double snum = ((ya - yc) * (xb - xa) - (xa - xc) * (yb - ya)); - double s = snum / denom; - - if (0.0 <= r && r <= 1.0 && 0.0 <= s && s <= 1.0) { - int px = (int)(xa + (xb - xa) * r); - int py = (int)(ya + (yb - ya) * r); - return new Point(px, py); - } - else { - return null; - } - } - - /** - * compute distance of point from line segment, or - * Double.MAX_VALUE if perpendicular projection is outside segment; or - * If pts on line are same, return distance from point - **/ - // from Doug Lea's PolygonFigure - public static double distanceFromLine(int xa, int ya, - int xb, int yb, - int xc, int yc) { - - - // source:http://vision.dai.ed.ac.uk/andrewfg/c-g-a-faq.html#q7 - //Let the point be C (XC,YC) and the line be AB (XA,YA) to (XB,YB). - //The length of the - // line segment AB is L: - // - // ___________________ - // | 2 2 - // L = \| (XB-XA) + (YB-YA) - //and - // - // (YA-YC)(YA-YB)-(XA-XC)(XB-XA) - // r = ----------------------------- - // L**2 - // - // (YA-YC)(XB-XA)-(XA-XC)(YB-YA) - // s = ----------------------------- - // L**2 - // - // Let I be the point of perpendicular projection of C onto AB, the - // - // XI=XA+r(XB-XA) - // YI=YA+r(YB-YA) - // - // Distance from A to I = r*L - // Distance from C to I = s*L - // - // If r < 0 I is on backward extension of AB - // If r>1 I is on ahead extension of AB - // If 0<=r<=1 I is on AB - // - // If s < 0 C is left of AB (you can just check the numerator) - // If s>0 C is right of AB - // If s=0 C is on AB - - int xdiff = xb - xa; - int ydiff = yb - ya; - long l2 = xdiff * xdiff + ydiff * ydiff; - - if (l2 == 0) { - return Geom.length(xa, ya, xc, yc); - } - - double rnum = (ya - yc) * (ya - yb) - (xa - xc) * (xb - xa); - double r = rnum / l2; - - if (r < 0.0 || r > 1.0) { - return Double.MAX_VALUE; - } - - double xi = xa + r * xdiff; - double yi = ya + r * ydiff; - double xd = xc - xi; - double yd = yc - yi; - return Math.sqrt(xd * xd + yd * yd); - - /* - for directional version, instead use - double snum = (ya-yc) * (xb-xa) - (xa-xc) * (yb-ya); - double s = snum / l2; - - double l = Math.sqrt((double)l2); - return = s * l; - */ - } - - /** - * compute distance of point from line segment.<br> - * Uses AWT Line2D utility methods - */ - public static double distanceFromLine2D(int xa, int ya, - int xb, int yb, - int xc, int yc) { - Line2D.Double line = new Line2D.Double(xa, xb, ya, yb); - return line.ptSegDist(xc, yc); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/GraphLayout.java b/JHotDraw/src/CH/ifa/draw/util/GraphLayout.java deleted file mode 100644 index 34d8128d4a1ce45b7ba05ed3d1c17ad0d3508491..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/GraphLayout.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * @(#)GraphLayout.java - * - * The original file Graph.java (1.5 99/11/29) is - * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. - * Adapted by F. Wienberg, 1999 - * - * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, - * modify and redistribute this software in source and binary code form, - * provided that i) this copyright notice and license appear on all copies of - * the software; and ii) Licensee does not utilize the software in a manner - * which is disparaging to Sun. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY - * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR - * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE - * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS - * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, - * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER - * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF - * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This software is not designed or intended for use in on-line control of - * aircraft, air traffic, aircraft navigation or aircraft communications; or in - * the design, construction, operation or maintenance of any nuclear - * facility. Licensee represents and warrants that it will not use or - * redistribute the Software for such purposes. - */ - -package CH.ifa.draw.util; - -import java.util.*; -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.*; -import java.awt.*; - -/** - * @version <$CURRENT_VERSION$> - */ -public class GraphLayout extends FigureChangeAdapter { - public double LENGTH_FACTOR=1.0; - public double REPULSION_STRENGTH=0.5; - public double REPULSION_LIMIT=200.0; - int REPULSION_TYPE=0; // 0: (1-r)/r 1: 1-r 2: (1-r)^2 - public double SPRING_STRENGTH=0.1; - public double TORQUE_STRENGTH=0.25; - public double FRICTION_FACTOR=0.75; - - private Hashtable nodes = new Hashtable(), - edges = new Hashtable(); - - public GraphLayout() {} - - private GraphNode getGraphNode(Figure node) { - return (GraphNode)nodes.get(node); - } - - private double len(Figure edge) { - return ((Double)edges.get(edge)).doubleValue()*LENGTH_FACTOR; - } - - public void addNode(Figure node) { - nodes.put(node, new GraphNode(node)); - node.addFigureChangeListener(this); - } - - public void addEdge(ConnectionFigure edge, int addlen) { - Dimension d1 = edge.getStartConnector().owner().size(); - Dimension d2 = edge.getEndConnector().owner().size(); - int len = Math.max(d1.width,d1.height)/2 + - Math.max(d2.width,d2.height)/2 + addlen; - edges.put(edge, new Double(len)); - } - - public synchronized void relax() { - if (nodes == null) - return; - Enumeration edgeEnum = edges.keys(); - while (edgeEnum.hasMoreElements()) { - ConnectionFigure e = (ConnectionFigure)edgeEnum.nextElement(); - double targetlen = len(e); - GraphNode from = getGraphNode(e.getStartConnector().owner()); - GraphNode to = getGraphNode(e.getEndConnector().owner()); - double vx = to.x - from.x; - double vy = to.y - from.y; - double len = Math.sqrt(vx * vx + vy * vy); - - if (len>0) { - double f = SPRING_STRENGTH * (targetlen - len) / len; - double dx = f * vx; - double dy = f * vy; - - double phi=Math.atan2(vx,vy); - double dir=-Math.sin(4*phi); - dx += TORQUE_STRENGTH*vy*dir/len; - dy += -TORQUE_STRENGTH*vx*dir/len; - - to.dx += dx; - to.dy += dy; - from.dx += -dx; - from.dy += -dy; - } - } - - Enumeration nodeEnum1 = nodes.elements(); - while (nodeEnum1.hasMoreElements()) { - GraphNode n1 = (GraphNode)nodeEnum1.nextElement(); - double dx = 0; - double dy = 0; - - Enumeration nodeEnum2 = nodes.elements(); - while (nodeEnum2.hasMoreElements()) { - GraphNode n2 = (GraphNode)nodeEnum2.nextElement(); - if (n1 == n2) { - continue; - } - double vx = n1.x - n2.x; - double vy = n1.y - n2.y; - double lensqr = vx * vx + vy * vy; - double len = Math.sqrt(lensqr); - if (len == 0) { - dx += REPULSION_STRENGTH * Math.random(); - dy += REPULSION_STRENGTH * Math.random(); - } - else if (len < REPULSION_LIMIT) { - // Normalize length. - vx=vx/REPULSION_LIMIT; - vy=vy/REPULSION_LIMIT; - len=len/REPULSION_LIMIT; - // Compute force. - double f=0; - - switch (REPULSION_TYPE) { - case 0: - f = 0.5 * (1 - len) / len; - break; - case 1: - f = 1 - len; - break; - case 2: - f = 2 * (1 - len) * (1 - len); - break; - } - - f *= REPULSION_STRENGTH; - dx += f * vx; - dy += f * vy; - } - } - - n1.dx += dx; - n1.dy += dy; - } - - Enumeration nodeEnum = nodes.keys(); - while (nodeEnum.hasMoreElements()) { - Figure node = (Figure)nodeEnum.nextElement(); - GraphNode n = getGraphNode(node); - if (!Boolean.TRUE.equals(node.getAttribute(FigureAttributeConstant.LOCATION))) { - n.x += Math.max(-5, Math.min(5, n.dx)); - n.y += Math.max(-5, Math.min(5, n.dy)); - Point c = node.center(); - node.moveBy((int)Math.round(n.x)-c.x, - (int)Math.round(n.y)-c.y); - - //System.out.println("v= " + n.dx + "," + n.dy); - if (n.x < 0) { - n.x = 0; - } - if (n.y < 0) { - n.y = 0; - } - } - n.dx *= FRICTION_FACTOR; - n.dy *= FRICTION_FACTOR; - } - } - - /** - * Sent when a figure changed - */ - synchronized public void figureChanged(FigureChangeEvent e) { - if (nodes!=null) { - Figure node = e.getFigure(); - if (nodes.containsKey(node)) { - getGraphNode(node).update(); - } - } - } - - public void remove() { - if (nodes!=null) { - Enumeration nodeEnum = nodes.keys(); - while (nodeEnum.hasMoreElements()) { - Figure node = (Figure)nodeEnum.nextElement(); - node.removeFigureChangeListener(this); - } - nodes = null; - edges = null; - } - } -} - -class GraphNode { - double x=0.0, y=0.0; - double dx=0.0; - double dy=0.0; - final Figure node; - - GraphNode(Figure newNode) { - node = newNode; - update(); - } - - void update() { - Point p = node.center(); - if (Math.abs(p.x - Math.round(x))>1 || - Math.abs(p.y - Math.round(y))>1) { - x = p.x; - y = p.y; - //System.out.println(this+" has new coords: "+x+","+y+"\n"); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Iconkit.java b/JHotDraw/src/CH/ifa/draw/util/Iconkit.java deleted file mode 100644 index 91189ec5f0199dfe15cc5a262539b84527498a67..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Iconkit.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * @(#)Iconkit.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.*; -import java.awt.*; -import java.awt.image.ImageProducer; -import java.net.URL; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Hashtable; - -/** - * The Iconkit class supports the sharing of images. It maintains - * a map of image names and their corresponding images. - * - * Iconkit also supports to load a collection of images in - * synchronized way. - * The resolution of a path name to an image is delegated to the DrawingEditor. - * <hr> - * <b>Design Patterns</b><P> - * <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> - * <b><a href=../pattlets/sld031.htm>Singleton</a></b><br> - * The Iconkit is a singleton. - * <hr> - * - * @version <$CURRENT_VERSION$> - */ -public class Iconkit { - private Map fMap; - private List fRegisteredImages; - private Component fComponent; - private final static int ID = 123; - private static Iconkit fgIconkit = null; - private static boolean fgDebug = false; - - /** - * Constructs an Iconkit that uses the given editor to - * resolve image path names. - */ - public Iconkit(Component component) { - fMap = new Hashtable(53); - fRegisteredImages = CollectionsFactory.current().createList(10); - fComponent = component; - fgIconkit = this; - } - - /** - * Gets the single instance - */ - public static Iconkit instance() { - return fgIconkit; - } - - /** - * Loads all registered images. - * @see #registerImage - */ - public void loadRegisteredImages(Component component) { - if (fRegisteredImages.size() == 0) - return; - - MediaTracker tracker = new MediaTracker(component); - - // register images with MediaTracker - Iterator iter = fRegisteredImages.iterator(); - while (iter.hasNext()) { - String fileName = (String)iter.next(); - if (basicGetImage(fileName) == null) { - tracker.addImage(loadImage(fileName), ID); - } - } - fRegisteredImages.clear(); - - // block until all images are loaded - try { - tracker.waitForAll(); - } - catch (Exception e) { - // ignore: do nothing - } - } - - /** - * Registers an image that is then loaded together with - * the other registered images by loadRegisteredImages. - * @see #loadRegisteredImages - */ - public void registerImage(String fileName) { - fRegisteredImages.add(fileName); - } - - /** - * Registers and loads an image. - */ - public Image registerAndLoadImage(Component component, String fileName) { - registerImage(fileName); - loadRegisteredImages(component); - return getImage(fileName); - } - - /** - * Loads an image with the given name. - */ - public Image loadImage(String filename) { - if (fMap.containsKey(filename)) { - return (Image) fMap.get(filename); - } - Image image = loadImageResource(filename); - if (image != null) { - fMap.put(filename, image); - } - return image; - } - - public Image loadImage(String filename, boolean waitForLoad) { - Image image = loadImage(filename); - if (image!=null && waitForLoad) { - ImageIcon icon = new ImageIcon(image); - image = icon.getImage(); //this forces the wait to happen - } - return image; - } - - public Image loadImageResource(String resourcename) { - Toolkit toolkit = Toolkit.getDefaultToolkit(); - try { - URL url = getClass().getResource(resourcename); - if (fgDebug) { - System.out.println(resourcename); - } - return toolkit.createImage((ImageProducer) url.getContent()); - } - catch (Exception ex) { - return null; - } - } - - /** - * Gets the image with the given name. If the image - * can't be found it tries it again after loading - * all the registered images. - */ - public Image getImage(String filename) { - Image image = basicGetImage(filename); - if (image != null) { - return image; - } - // load registered images and try again - loadRegisteredImages(fComponent); - // try again - return basicGetImage(filename); - } - - private Image basicGetImage(String filename) { - if (fMap.containsKey(filename)) { - return (Image) fMap.get(filename); - } - return null; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/JDOStorageFormat.java b/JHotDraw/src/CH/ifa/draw/util/JDOStorageFormat.java deleted file mode 100644 index 6ed15f1e930a838f60924ccdc662cdb3f97e28e6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/JDOStorageFormat.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * @(#)SerializationStorageFormat.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.StandardDrawing; - -import java.io.*; -import java.util.*; -import java.util.List; -import java.awt.*; - -import javax.jdo.*; -import javax.swing.*; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.ListSelectionEvent; - - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class JDOStorageFormat extends StandardStorageFormat { - - private Map pms; - - /** - * Create a SerialzationStorageFormat for storing and restoring Drawings. - */ - public JDOStorageFormat() { - super(); - pms = CollectionsFactory.current().createMap(); - // close database connection when application exits - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - Iterator iter = pms.values().iterator(); -// while (iter.hasNext()) { -// ((PersistenceManager)iter.next()).close(); -// } - } - }); - } - - /** - * Factory method to create the file extension recognized by the FileFilter for this - * SerializationStorageFormat. The SerializationStorageFormat has the file extension "ser" - * (e.g. my_picasso.ser). - * - * @return new file extension - */ - protected String createFileExtension() { - return "j2"; - } - - /** - * Factory method to create a file description for the file type when displaying the - * associated FileFilter. - * - * @return new file description - */ - public String createFileDescription() { - return "Database (" + getFileExtension() + ")"; - } - - /** - * @see CH.ifa.draw.util.StorageFormat#isRestoreFormat() - */ - public boolean isRestoreFormat() { - return true; - } - - /** - * @see CH.ifa.draw.util.StorageFormat#isStoreFormat() - */ - public boolean isStoreFormat() { - return true; - } - - /** - * Store a Drawing under a given name. The name should be valid with regard to the FileFilter - * that means, it should already contain the appropriate file extension. - * - * @param fileName file name of the Drawing under which it should be stored - * @param storeDrawing drawing to be saved - */ - public String store(String fileName, Drawing storeDrawing) throws IOException { - PersistenceManager pm = getPersistenceManager(fileName); - String drawingName = null; - - Drawing txnDrawing = crossTxnBoundaries(storeDrawing); - endTransaction(pm, false); - - startTransaction(pm); - try { - Extent extent = pm.getExtent(StandardDrawing.class, true); - DrawingListModel listModel = new DrawingListModel(extent.iterator()); - drawingName = showStoreDialog(listModel, storeDrawing); - if (drawingName != null) { - storeDrawing.setTitle(drawingName); - txnDrawing.setTitle(drawingName); - pm.makePersistent(txnDrawing); - } - } - finally { - endTransaction(pm, (drawingName != null)); - } - - // there must be always a transaction running - startTransaction(pm); - return drawingName; - } - - /** - * Restore a Drawing from a file with a given name. The name must be should with regard to the - * FileFilter that means, it should have the appropriate file extension. - * - * @param fileName of the file in which the Drawing has been saved - * @return restored Drawing - */ - public synchronized Drawing restore(String fileName) throws IOException { - PersistenceManager pm = getPersistenceManager(fileName); - - endTransaction(pm, false); - startTransaction(pm); - Drawing restoredDrawing = null; - - try { - Extent extent = pm.getExtent(StandardDrawing.class, true); - DrawingListModel listModel = new DrawingListModel(extent.iterator()); - Drawing txnDrawing = showRestoreDialog(listModel); - if (txnDrawing != null) { -// pm.retrieve(txnDrawing); -// retrieveAll(pm, (StandardDrawing)txnDrawing); -// restoredDrawing = crossTxnBoundaries(txnDrawing); - restoredDrawing = txnDrawing; - } - } - finally { - endTransaction(pm, false); - } - - // there must be always a transaction running - startTransaction(pm); - return restoredDrawing; - } - - private void retrieveAll(PersistenceManager pm, Figure figure) { - pm.retrieve(figure); - FigureEnumeration fe = figure.figures(); - while (fe.hasNextFigure()) { - retrieveAll(pm, fe.nextFigure()); - } - } - - private Drawing crossTxnBoundaries(Drawing originalDrawing) { - return (Drawing)((StandardDrawing)originalDrawing).clone(); -// return originalDrawing; - } - - private synchronized PersistenceManager getPersistenceManager(String fileName) { - PersistenceManager pm = (PersistenceManager)pms.get(fileName); - if (pm == null) { - pm = createPersistenceManagerFactory(fileName).getPersistenceManager(); - pms.put(fileName, pm); - } - return pm; - } - - private PersistenceManagerFactory createPersistenceManagerFactory(String dbFileName) { - Properties pmfProps = new Properties(); - - pmfProps.put( - "javax.jdo.PersistenceManagerFactoryClass", - "com.poet.jdo.PersistenceManagerFactories" ); - pmfProps.put( - "javax.jdo.option.ConnectionURL", - "fastobjects://LOCAL/MyBase.j1" ); - final PersistenceManagerFactory pmf = - JDOHelper.getPersistenceManagerFactory( pmfProps ); - - return pmf; - } - - private static void startTransaction(PersistenceManager pm) { - if (!pm.currentTransaction().isActive()) { - pm.currentTransaction().begin(); - } - } - - private static void endTransaction(PersistenceManager pm, boolean doCommit) { - if (pm.currentTransaction().isActive()) { - if (doCommit) { - pm.currentTransaction().commit(); - } - else { - pm.currentTransaction().rollback(); - } - } - } - - private String showStoreDialog(ListModel listModel, Drawing storeDrawing) { - final String msgString = "Specify a name for the drawing"; - - final JTextField nameTextField = new JTextField(storeDrawing.getTitle()); - final JList dataList = new JList(listModel); - final JScrollPane dbContentScrollPane = new JScrollPane(dataList); - Object[] guiComponents = {msgString, dbContentScrollPane, nameTextField}; - - dataList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - dataList.setValueIsAdjusting(true); - dataList.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - nameTextField.setText(dataList.getSelectedValue().toString()); - } - }); - - final JOptionPane optionPane = new JOptionPane( - guiComponents, - JOptionPane.PLAIN_MESSAGE, - JOptionPane.OK_CANCEL_OPTION); - - final JDialog dialog = optionPane.createDialog(null, "Restore a drawing from the database"); -// dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); -// dialog.addWindowListener(new WindowAdapter() { -// public void windowClosing(WindowEvent we) { -// System.exit(0); -// } -// }); - dialog.setVisible(true); - if ((optionPane.getValue() != null) && (optionPane.getValue().equals(new Integer(JOptionPane.OK_OPTION)))) { - return nameTextField.getText(); - } - else { - return null; - } - } - - private Drawing showRestoreDialog(DrawingListModel listModel) { - final String msgString = "Select a drawing"; - - final JList dataList = new JList(listModel); - final JScrollPane dbContentScrollPane = new JScrollPane(dataList); - Object[] guiComponents = {msgString, dbContentScrollPane}; - - dataList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - dataList.setValueIsAdjusting(true); - - final JOptionPane optionPane = new JOptionPane( - guiComponents, - JOptionPane.PLAIN_MESSAGE, - JOptionPane.OK_CANCEL_OPTION); - - final JDialog dialog = optionPane.createDialog(null, "Restore a drawing from the database"); - dialog.setVisible(true); - if ((optionPane.getValue() != null) - && (optionPane.getValue().equals(new Integer(JOptionPane.OK_OPTION))) - && (dataList.getSelectedIndex() >= 0) - && (dataList.getSelectedIndex() < dataList.getModel().getSize())) { - return listModel.getDrawingAt(dataList.getSelectedIndex()); - } - else { - return null; - } - } - - static class DrawingListModel extends AbstractListModel { - private List myList; - - DrawingListModel(Iterator iter) { - myList = CollectionsFactory.current().createList(); - while (iter.hasNext()) { - Object o = iter.next(); - System.out.println("extent: " + o + " .. " + ((Drawing)o).getTitle()); - myList.add(o); - } - } - - public Object getElementAt(int index) { - return getDrawingAt(index).getTitle(); - } - - protected Drawing getDrawingAt(int index) { - return ((Drawing)myList.get(index)); - } - - public int getSize() { - return myList.size(); - } - } - - static class DrawingSelector extends JDialog { - DrawingSelector() { - init(); - } - - private void init() { - setTitle("Select Drawing"); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(new JLabel("Database content"), BorderLayout.NORTH); - setSize(200, 200); - } - } - - public static void main(String[] args) { - DrawingSelector frame = new DrawingSelector(); - try { - Drawing newDrawing = new StandardDrawing(); - newDrawing.setTitle("TestDrawingName" + new Random(System.currentTimeMillis()).nextLong()); - new JDOStorageFormat().store("base.j2", newDrawing); - System.exit(0); - } - catch (IOException e) { - e.printStackTrace(); - } -// frame.setVisible(true); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/PaletteButton.java b/JHotDraw/src/CH/ifa/draw/util/PaletteButton.java deleted file mode 100644 index eb7281772fc4c0bf7d8ee7c0397e53b375280564..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/PaletteButton.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * @(#)PaletteButton.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.*; -import java.awt.event.*; - -/** - * A palette button is a three state button. The states are normal - * pressed and selected. It uses to the palette listener interface - * to notify about state changes. - * - * @see PaletteListener - * @see PaletteLayout - * - * @version <$CURRENT_VERSION$> -*/ -public abstract class PaletteButton - extends JButton - implements MouseListener, MouseMotionListener { - - protected static final int NORMAL = 1; - protected static final int PRESSED = 2; - protected static final int SELECTED = 3; - - private int fState; - private int fOldState; - - private PaletteListener fListener; - - /** - * Constructs a PaletteButton. - * @param listener the listener to be notified. - */ - public PaletteButton(PaletteListener listener) { - fListener = listener; - fState = fOldState = NORMAL; - addMouseListener(this); - addMouseMotionListener(this); - } - - public Object value() { - return null; - } - - public String name() { - return ""; - } - - public void reset() { - if (isEnabled()) { - fState = NORMAL; - setSelected(false); - repaint(); - } - } - - public void select() { - if (isEnabled()) { - fState = SELECTED; - setSelected(true); - repaint(); - } - } - - public void mousePressed(MouseEvent e) { - if (isEnabled()) { - fOldState = fState; - fState = PRESSED; - repaint(); - } - } - - public void mouseDragged(MouseEvent e) { - if (isEnabled()) { - if (contains(e.getX(),e.getY())) { - fState = PRESSED; - } - else { - fState = fOldState; - } - repaint(); - } - } - - public void mouseReleased(MouseEvent e) { - if (isEnabled()) { - fState = fOldState; - repaint(); - if (contains(e.getX(),e.getY())) { - fListener.paletteUserSelected(this); - } - } - } - - public void mouseMoved(MouseEvent e) { - fListener.paletteUserOver(this, true); - } - - public void mouseExited(MouseEvent e) { - if (fState == PRESSED) { - // JDK1.1 on MS-Windows sometimes looses mouse released - mouseDragged(e); - } - fListener.paletteUserOver(this, false); - } - - public void mouseClicked(MouseEvent e) {} - public void mouseEntered(MouseEvent e) {} - -// Not necessary anymore in JFC due to the support of Icons in JButton -/* - public abstract void paintBackground(Graphics g); - public abstract void paintNormal(Graphics g); - public abstract void paintPressed(Graphics g); - public abstract void paintSelected(Graphics g); - - public void update(Graphics g) { - paint(g); - } - - public void paint(Graphics g) { - paintBackground(g); - - switch (fState) { - case PRESSED: - paintPressed(g); - break; - case SELECTED: - paintSelected(g); - break; - case NORMAL: - default: - paintNormal(g); - break; - } - } -*/ -} diff --git a/JHotDraw/src/CH/ifa/draw/util/PaletteIcon.java b/JHotDraw/src/CH/ifa/draw/util/PaletteIcon.java deleted file mode 100644 index 90f4e821beb4c33914fe425d48b76c4f5991cf0f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/PaletteIcon.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * @(#)PaletteIcon.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.awt.*; - -/** - * A three state icon that can be used in Palettes. - * - * @see PaletteButton - * - * @version <$CURRENT_VERSION$> - */ -public class PaletteIcon extends Object { - - Image fNormal; - Image fPressed; - Image fSelected; - Dimension fSize; - - public PaletteIcon(Dimension size, Image normal, Image pressed, Image selected) { - fSize = size; - fNormal = normal; - fPressed = pressed; - fSelected = selected; - } - - public Image normal() { return fNormal; } - public Image pressed() { return fPressed; } - public Image selected() { return fSelected; } - - public int getWidth() { return fSize.width; } - public int getHeight() { return fSize.height; } - -} diff --git a/JHotDraw/src/CH/ifa/draw/util/PaletteLayout.java b/JHotDraw/src/CH/ifa/draw/util/PaletteLayout.java deleted file mode 100644 index 63b1d84cdecc9cf29c8dfff722407c08f9d06516..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/PaletteLayout.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @(#)PaletteLayout.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.awt.*; - -/** - * A custom layout manager for the palette. - * - * @see PaletteButton - * - * @version <$CURRENT_VERSION$> - */ -public class PaletteLayout implements LayoutManager { - - private int fGap; - private Point fBorder; - private boolean fVerticalLayout; - - /** - * Initializes the palette layout. - * @param gap the gap between palette entries. - */ - public PaletteLayout(int gap) { - this(gap, new Point(0,0), true); - } - - public PaletteLayout(int gap, Point border) { - this(gap, border, true); - } - - public PaletteLayout(int gap, Point border, boolean vertical) { - fGap = gap; - fBorder = border; - fVerticalLayout = vertical; - } - - public void addLayoutComponent(String name, Component comp) { - } - - public void removeLayoutComponent(Component comp) { - } - - public Dimension preferredLayoutSize(Container target) { - return minimumLayoutSize(target); - } - - public Dimension minimumLayoutSize(Container target) { - Dimension dim = new Dimension(0, 0); - int nmembers = target.getComponentCount(); - - for (int i = 0 ; i < nmembers ; i++) { - Component m = target.getComponent(i); - if (m.isVisible()) { - Dimension d = m.getMinimumSize(); - if (fVerticalLayout) { - dim.width = Math.max(dim.width, d.width); - if (i > 0) { - dim.height += fGap; - } - dim.height += d.height; - } - else { - dim.height = Math.max(dim.height, d.height); - if (i > 0) { - dim.width += fGap; - } - dim.width += d.width; - } - } - } - - Insets insets = target.getInsets(); - dim.width += insets.left + insets.right; - dim.width += 2 * fBorder.x; - dim.height += insets.top + insets.bottom; - dim.height += 2 * fBorder.y; - return dim; - } - - public void layoutContainer(Container target) { - Insets insets = target.getInsets(); - int nmembers = target.getComponentCount(); - int x = insets.left + fBorder.x; - int y = insets.top + fBorder.y; - - for (int i = 0 ; i < nmembers ; i++) { - Component m = target.getComponent(i); - if (m.isVisible()) { - Dimension d = m.getMinimumSize(); - m.setBounds(x, y, d.width, d.height); - if (fVerticalLayout) { - y += d.height; - y += fGap; - } - else { - x += d.width; - x += fGap; - } - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/PaletteListener.java b/JHotDraw/src/CH/ifa/draw/util/PaletteListener.java deleted file mode 100644 index 19274cad4a511262ba280b9d74ed913b0f7eb305..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/PaletteListener.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * @(#)PaletteListener.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -/** - * Interface for handling palette events. - * - * @see PaletteButton - * - * @version <$CURRENT_VERSION$> - */ -public interface PaletteListener { - /** - * The user selected a palette entry. The selected button is - * passed as an argument. - */ - public void paletteUserSelected(PaletteButton button); - - /** - * The user moved the mouse over the palette entry. - */ - public void paletteUserOver(PaletteButton button, boolean inside); -} diff --git a/JHotDraw/src/CH/ifa/draw/util/RedoCommand.java b/JHotDraw/src/CH/ifa/draw/util/RedoCommand.java deleted file mode 100644 index 6bf082779b320393b6088d929a64b4c811d776da..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/RedoCommand.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * @(#)RedoCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.standard.*; -import CH.ifa.draw.framework.*; - -/** - * Command to redo the latest undone change in the drawing. - * - * @version <$CURRENT_VERSION$> - */ -public class RedoCommand extends AbstractCommand { - - /** - * Constructs a properties command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public RedoCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - UndoManager um = getDrawingEditor().getUndoManager(); - if ((um == null) || !um.isRedoable()) { - return; - } - - Undoable lastRedoable = um.popRedo(); - // Execute redo - boolean hasBeenUndone = lastRedoable.redo(); - // Add to undo stack - if (hasBeenUndone && lastRedoable.isUndoable()) { - um.pushUndo(lastRedoable); - } - - lastRedoable.getDrawingView().checkDamage(); - - getDrawingEditor().figureSelectionChanged(lastRedoable.getDrawingView()); - } - - /** - * Used in enabling the redo menu item. - * Redo menu item will be enabled only when there is at least one redoable - * activity in the UndoManager. - */ - public boolean isExecutableWithView() { - UndoManager um = getDrawingEditor().getUndoManager(); - if ((um != null) && (um.getRedoSize() > 0)) { - return true; - } - - return false; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/ReverseListEnumerator.java b/JHotDraw/src/CH/ifa/draw/util/ReverseListEnumerator.java deleted file mode 100644 index cf17a13df4d544f987bc23aeb2c000731095bee6..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/ReverseListEnumerator.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @(#)ReverseListEnumerator.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Iterator; - -/** - * An Enumeration that enumerates a list back (size-1) to front (0). - * - * @version <$CURRENT_VERSION$> - */ -public class ReverseListEnumerator implements Iterator { - - private List myList; - private int count; - - public ReverseListEnumerator(List l) { - myList = l; - count = myList.size() - 1; - } - - public boolean hasNext() { - return count >= 0; - } - - public Object next() { - if (count >= 0) { - return myList.get(count--); - } - throw new NoSuchElementException("ReverseListEnumerator"); - } - - public void remove() { - myList.remove(count); - count--; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/SerializationStorageFormat.java b/JHotDraw/src/CH/ifa/draw/util/SerializationStorageFormat.java deleted file mode 100644 index dbc10edc3b38ea7c39be38dec14d01f5fbdc438c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/SerializationStorageFormat.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * @(#)SerializationStorageFormat.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.io.*; -import CH.ifa.draw.framework.Drawing; - -/** - * A SerializationStorageFormat is a straight-forward file format to store and restore - * Drawings. It uses Java's serialization mechanism to store Drawings. The SerializationStorageFormat - * has the file extension "ser" (e.g. my_picasso.ser). - * - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class SerializationStorageFormat extends StandardStorageFormat { - - /** - * Create a SerialzationStorageFormat for storing and restoring Drawings. - */ - public SerializationStorageFormat() { - super(); - } - - /** - * Factory method to create the file extension recognized by the FileFilter for this - * SerializationStorageFormat. The SerializationStorageFormat has the file extension "ser" - * (e.g. my_picasso.ser). - * - * @return new file extension - */ - protected String createFileExtension() { - return "ser"; - } - - /** - * Factory method to create a file description for the file type when displaying the - * associated FileFilter. - * - * @return new file description - */ - public String createFileDescription() { - return "Serialization (" + getFileExtension() + ")"; - } - - /** - * Store a Drawing under a given name. The name should be valid with regard to the FileFilter - * that means, it should already contain the appropriate file extension. - * - * @param fileName file name of the Drawing under which it should be stored - * @param saveDrawing drawing to be saved - */ - public String store(String fileName, Drawing saveDrawing) throws IOException { - FileOutputStream stream = new FileOutputStream(adjustFileName(fileName)); - ObjectOutput output = new ObjectOutputStream(stream); - output.writeObject(saveDrawing); - output.close(); - return adjustFileName(fileName); - } - - /** - * Restore a Drawing from a file with a given name. The name must be should with regard to the - * FileFilter that means, it should have the appropriate file extension. - * - * @param fileName of the file in which the Drawing has been saved - * @return restored Drawing - */ - public Drawing restore(String fileName) throws IOException { - try { - FileInputStream stream = new FileInputStream(fileName); - ObjectInput input = new ObjectInputStream(stream); - return (Drawing)input.readObject(); - } - catch (ClassNotFoundException exception) { - throw new IOException("Could not restore drawing '" + fileName +"': class not found!"); - } - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/StandardStorageFormat.java b/JHotDraw/src/CH/ifa/draw/util/StandardStorageFormat.java deleted file mode 100644 index 6ffc64debe15786395a1842ef54187cb53b1f623..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/StandardStorageFormat.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * @(#)StandardStorageFormat.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.filechooser.FileFilter; -import java.io.IOException; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.File; -import CH.ifa.draw.framework.Drawing; - -/** - * A StandardStorageFormat is an internal file format to store and restore - * Drawings. It uses its own descriptive syntax ands write classes and attributes - * as plain text in a text file. The StandardStorageFormat has the file extension - * "draw" (e.g. my_picasso.draw). - * - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class StandardStorageFormat implements StorageFormat { - - /** - * FileFilter for a javax.swing.JFileChooser which recognizes files with the - * extension "draw" - */ - private FileFilter myFileFilter; - - /** - * File extension - */ - private String myFileExtension; - - /** - * Description of the file type when displaying the FileFilter - */ - private String myFileDescription; - - /** - * Create a StandardStorageFormat for storing and restoring Drawings. - */ - public StandardStorageFormat() { - setFileExtension(createFileExtension()); - setFileDescription(createFileDescription()); - setFileFilter(createFileFilter()); - } - - /** - * Factory method to create the file extension recognized by the FileFilter for this - * StandardStorageFormat. The StandardStorageFormat has the file extension "draw" - * (e.g. my_picasso.draw). - * - * @return new file extension - */ - protected String createFileExtension() { - return myFileExtension = "draw"; - } - - /** - * Set the file extension for the storage format - * - * @param newFileExtension extension - */ - public void setFileExtension(String newFileExtension) { - myFileExtension = newFileExtension; - } - - /** - * Return the file extension for the storage format - * - * @return file extension - */ - public String getFileExtension() { - return myFileExtension; - } - - /** - * Factory method to create a file description for the file type when displaying the - * associated FileFilter. - * - * @return new file description - */ - public String createFileDescription() { - return "Internal Format (" + getFileExtension() + ")"; - } - - /** - * Set the file description for the file type of the storage format - * - * @param newFileDescription description of the file type - */ - public void setFileDescription(String newFileDescription) { - myFileDescription = newFileDescription; - } - - /** - * Return the file description for the file type of the storage format - * - * @return description of the file type - */ - public String getFileDescription() { - return myFileDescription; - } - - /** - * Factory method to create a FileFilter that accepts file with the appropriate - * file exention used by a javax.swing.JFileChooser. Subclasses can override this - * method to provide their own file filters. - * - * @return FileFilter for this StorageFormat - */ - protected FileFilter createFileFilter() { - return new FileFilter() { - public boolean accept(File checkFile) { - // still display directories for navigation - if (checkFile.isDirectory()) { - return true; - } - else { - return checkFile.getName().endsWith("." + getFileExtension()); - } - } - - public String getDescription() { - return getFileDescription(); - } - }; - } - - /** - * Set the FileFilter used to identify Drawing files with the correct file - * extension for this StorageFormat. - * - * @param newFileFilter FileFilter for this StorageFormat - */ - public void setFileFilter(FileFilter newFileFilter) { - myFileFilter = newFileFilter; - } - - /** - * Return the FileFilter used to identify Drawing files with the correct file - * extension for this StorageFormat. - * - * @return FileFilter for this StorageFormat - */ - public FileFilter getFileFilter() { - return myFileFilter; - } - - /** - * @see CH.ifa.draw.util.StorageFormat#isRestoreFormat() - */ - public boolean isRestoreFormat() { - return true; - } - - /** - * @see CH.ifa.draw.util.StorageFormat#isStoreFormat() - */ - public boolean isStoreFormat() { - return true; - } - - /** - * Store a Drawing under a given name. If the file name does not have the correct - * file extension, then the file extension is added. - * - * @param fileName file name of the Drawing under which it should be stored - * @param saveDrawing drawing to be saved - * @return file name with correct file extension - */ - public String store(String fileName, Drawing saveDrawing) throws IOException { - FileOutputStream stream = new FileOutputStream(adjustFileName(fileName)); - StorableOutput output = new StorableOutput(stream); - output.writeStorable(saveDrawing); - output.close(); - return adjustFileName(fileName); - } - - /** - * Restore a Drawing from a file with a given name. - * - * @param fileName of the file in which the Drawing has been saved - * @return restored Drawing - */ - public Drawing restore(String fileName) throws IOException { - if (!hasCorrectFileExtension(fileName)) { - return null; - } - else { - FileInputStream stream = new FileInputStream(fileName); - StorableInput input = new StorableInput(stream); - return (Drawing)input.readStorable(); - } - } - - /** - * Test, whether two StorageFormats are the same. They are the same if they both support the - * same file extension. - * - * @return true, if both StorageFormats have the same file extension, false otherwise - */ - public boolean equals(Object compareObject) { - if (compareObject instanceof StandardStorageFormat) { - return getFileExtension().equals(((StandardStorageFormat)compareObject).getFileExtension()); - } - else { - return false; - } - } - - /** - * Adjust a file name to have the correct file extension. - * - * @param testFileName file name to be tested for a correct file extension - * @return testFileName + file extension if necessary - */ - protected String adjustFileName(String testFileName) { - if (!hasCorrectFileExtension(testFileName)) { - return testFileName + "." + getFileExtension(); - } - else { - return testFileName; - } - } - - /** - * Test whether the file name has the correct file extension - * - * @return true, if the file has the correct extension, false otherwise - */ - protected boolean hasCorrectFileExtension(String testFileName) { - return testFileName.endsWith("." + getFileExtension()); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/StandardVersionControlStrategy.java b/JHotDraw/src/CH/ifa/draw/util/StandardVersionControlStrategy.java deleted file mode 100644 index 3968b3416e71413f0cb71e18435ef7051434391e..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/StandardVersionControlStrategy.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * @(#)StandardVersionControlStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.*; - -/** - * @author Wolfram Kaiser - * @version <$CURRENT_VERSION$> - */ -public class StandardVersionControlStrategy implements VersionControlStrategy { - private VersionRequester myVersionRequester; - - public StandardVersionControlStrategy(VersionRequester newVersionRequester) { - setVersionRequester(newVersionRequester); - } - - /** - * Define a strategy how to select those versions of JHotDraw - * with which they are compatible. - */ - public void assertCompatibleVersion() { - String[] requiredVersions = getVersionRequester().getRequiredVersions(); - // version is compatible if no version was specified - if (requiredVersions.length == 0) { - return; - } - for (int i = 0; i < requiredVersions.length; i++) { - if (isCompatibleVersion(requiredVersions[i])) { - // a compatible version has been found - return; - } - } - // no matching version was found - handleIncompatibleVersions(); - } - - /** - * This method is called in open() if an incompatible version has been - * encountered. Applications can override this method to provide customized - * exception handling for this case. In the default implementation, a - * JHotDrawRuntimeException is thrown. - */ - protected void handleIncompatibleVersions() { - // collect version info - String[] requiredVersions = getVersionRequester().getRequiredVersions(); - StringBuffer expectedVersions = new StringBuffer("["); - for (int i = 0; i < requiredVersions.length - 1; i++) { - expectedVersions.append(requiredVersions[i] + ", "); - } - if (requiredVersions.length > 0) { - expectedVersions.append(requiredVersions[requiredVersions.length - 1]); - } - expectedVersions.append("]"); - - // no compatible version has been found - throw new JHotDrawRuntimeException("Incompatible version of JHotDraw found: " - + VersionManagement.getJHotDrawVersion() - + " (expected: " + expectedVersions + ")"); - } - - /** - * Subclasses can override this method to specify an algorithms that determines - * how version strings are compared and which version strings can be regarded - * as compatible. For example, a subclass may choose that all versions 5.x of - * JHotDraw are compatible with the application, so only the first digit in - * the version number is considered significant. In the default implementation, - * all versions that are equal or greater than the expected version are compatible. - * - * @param compareVersionString application version to compare with JHotDraw's version - */ - protected boolean isCompatibleVersion(String compareVersionString) { - return VersionManagement.isCompatibleVersion(compareVersionString); - } - - private void setVersionRequester(VersionRequester newVersionRequester) { - myVersionRequester = newVersionRequester; - } - - protected VersionRequester getVersionRequester() { - return myVersionRequester; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Storable.java b/JHotDraw/src/CH/ifa/draw/util/Storable.java deleted file mode 100644 index 3c04ca3df586f001949ea4f237175e71a22b508f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Storable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @(#)Storable.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.io.*; - -/** - * Interface that is used by StorableInput and StorableOutput - * to flatten and resurrect objects. Objects that implement - * this interface and that are resurrected by StorableInput - * have to provide a default constructor with no arguments. - * - * @see StorableInput - * @see StorableOutput - * - * @version <$CURRENT_VERSION$> - */ -public interface Storable { - /** - * Writes the object to the StorableOutput. - */ - public void write(StorableOutput dw); - - /** - * Reads the object from the StorableInput. - */ - public void read(StorableInput dr) throws IOException; -} diff --git a/JHotDraw/src/CH/ifa/draw/util/StorableInput.java b/JHotDraw/src/CH/ifa/draw/util/StorableInput.java deleted file mode 100644 index 8af25ca618a339dc6301ff9c0e027f2ff4dd014b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/StorableInput.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * @(#)StorableInput.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.io.*; -import java.awt.Color; -import java.util.List; - -/** - * An input stream that can be used to resurrect Storable objects. - * StorableInput preserves the object identity of the stored objects. - * - * @see Storable - * @see StorableOutput - * - * @version <$CURRENT_VERSION$>s - */ -public class StorableInput { - - private StreamTokenizer fTokenizer; - private List fMap; - - /** - * Initializes a Storable input with the given input stream. - */ - public StorableInput(InputStream stream) { - Reader r = new BufferedReader(new InputStreamReader(stream)); - fTokenizer = new StreamTokenizer(r); - // include inner class separate in class names - fTokenizer.wordChars('$', '$'); - fMap = CollectionsFactory.current().createList(); - } - - /** - * Reads and resurrects a Storable object from the input stream. - */ - public Storable readStorable() throws IOException { - Storable storable; - String s = readString(); - - if (s.equals("NULL")) { - return null; - } - - if (s.equals("REF")) { - int ref = readInt(); - return retrieve(ref); - } - - storable = (Storable) makeInstance(s); - map(storable); - storable.read(this); - return storable; - } - - /** - * Reads a string from the input stream. - */ - public String readString() throws IOException { - int token = fTokenizer.nextToken(); - if (token == StreamTokenizer.TT_WORD || token == '"') { - return fTokenizer.sval; - } - - String msg = "String expected in line: " + fTokenizer.lineno(); - throw new IOException(msg); - } - - /** - * Reads an int from the input stream. - */ - public int readInt() throws IOException { - int token = fTokenizer.nextToken(); - if (token == StreamTokenizer.TT_NUMBER) { - return (int) fTokenizer.nval; - } - - String msg = "Integer expected in line: " + fTokenizer.lineno(); - IOException exception = new IOException(msg); - exception.printStackTrace(); - throw new IOException(msg); - } - - /** - * Reads an int from the input stream. - */ - public long readLong() throws IOException { - long token = fTokenizer.nextToken(); - if (token == StreamTokenizer.TT_NUMBER) { - return (long)fTokenizer.nval; - } - String msg = "Long expected in line: " + fTokenizer.lineno(); - IOException exception = new IOException(msg); - //exception.printStackTrace(); - throw exception; - } - - /** - * Reads a color from the input stream. - */ - public Color readColor() throws IOException { - return new Color(readInt(), readInt(), readInt()); - } - - /** - * Reads a double from the input stream. - */ - public double readDouble() throws IOException { - int token = fTokenizer.nextToken(); - if (token == StreamTokenizer.TT_NUMBER) { - return fTokenizer.nval; - } - - String msg = "Double expected in line: " + fTokenizer.lineno(); - throw new IOException(msg); - } - - /** - * Reads a boolean from the input stream. - */ - public boolean readBoolean() throws IOException { - int token = fTokenizer.nextToken(); - if (token == StreamTokenizer.TT_NUMBER) { - return ((int) fTokenizer.nval) == 1; - } - - String msg = "Integer expected in line: " + fTokenizer.lineno(); - throw new IOException(msg); - } - - private Object makeInstance(String className) throws IOException { - try { - Class cl = Class.forName(className); - return cl.newInstance(); - } - catch (NoSuchMethodError e) { - throw new IOException("Class " + className - + " does not seem to have a no-arg constructor"); - } - catch (ClassNotFoundException e) { - throw new IOException("No class: " + className); - } - catch (InstantiationException e) { - throw new IOException("Cannot instantiate: " + className); - } - catch (IllegalAccessException e) { - throw new IOException("Class (" + className + ") not accessible"); - } - } - - private void map(Storable storable) { - if (!fMap.contains(storable)) { - fMap.add(storable); - } - } - - private Storable retrieve(int ref) { - return (Storable)fMap.get(ref); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/StorableOutput.java b/JHotDraw/src/CH/ifa/draw/util/StorableOutput.java deleted file mode 100644 index 2c1e5c3e69a5c9ee0c475b61ac3997921313bc8b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/StorableOutput.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * @(#)StorableOutput.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.io.*; -import java.awt.Color; -import java.util.List; - -/** - * An output stream that can be used to flatten Storable objects. - * StorableOutput preserves the object identity of the stored objects. - * - * @see Storable - * @see StorableInput - * - * @version <$CURRENT_VERSION$> - */ -public class StorableOutput extends Object { - - private PrintWriter fStream; - private List fMap; - private int fIndent; - - /** - * Initializes the StorableOutput with the given output stream. - */ - public StorableOutput(OutputStream stream) { - fStream = new PrintWriter(stream); - fMap = CollectionsFactory.current().createList(); - fIndent = 0; - } - - /** - * Writes a storable object to the output stream. - */ - public void writeStorable(Storable storable) { - if (storable == null) { - fStream.print("NULL"); - space(); - return; - } - - if (mapped(storable)) { - writeRef(storable); - return; - } - - incrementIndent(); - startNewLine(); - map(storable); - fStream.print(storable.getClass().getName()); - space(); - storable.write(this); - space(); - decrementIndent(); - } - - /** - * Writes an int to the output stream. - */ - public void writeInt(int i) { - fStream.print(i); - space(); - } - - /** - * Writes a long to the output stream. - */ - public void writeLong(long l) { - fStream.print(l); - space(); - } - - public void writeColor(Color c) { - writeInt(c.getRed()); - writeInt(c.getGreen()); - writeInt(c.getBlue()); - } - - /** - * Writes an int to the output stream. - */ - public void writeDouble(double d) { - fStream.print(d); - space(); - } - - /** - * Writes an int to the output stream. - */ - public void writeBoolean(boolean b) { - if (b) { - fStream.print(1); - } - else { - fStream.print(0); - } - space(); - } - - /** - * Writes a string to the output stream. Special characters - * are quoted. - */ - public void writeString(String s) { - fStream.print('"'); - for(int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - switch(c) { - case '\n': fStream.print('\\'); fStream.print('n'); break; - case '"' : fStream.print('\\'); fStream.print('"'); break; - case '\\': fStream.print('\\'); fStream.print('\\'); break; - case '\t': fStream.print('\\'); fStream.print('\t'); break; - default: fStream.print(c); - } - - } - fStream.print('"'); - space(); - } - - /** - * Closes a storable output stream. - */ - public void close() { - fStream.close(); - } - - private boolean mapped(Storable storable) { - return fMap.contains(storable); - } - - private void map(Storable storable) { - if (!fMap.contains(storable)) { - fMap.add(storable); - } - } - - private void writeRef(Storable storable) { - int ref = fMap.indexOf(storable); - - fStream.print("REF"); - space(); - fStream.print(ref); - space(); - } - - private void incrementIndent() { - fIndent += 4; - } - - private void decrementIndent() { - fIndent -= 4; - if (fIndent < 0) fIndent = 0; - } - - private void startNewLine() { - fStream.println(); - for (int i=0; i<fIndent; i++) { - space(); - } - } - - private void space() { - fStream.print(' '); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/StorageFormat.java b/JHotDraw/src/CH/ifa/draw/util/StorageFormat.java deleted file mode 100644 index 1cc1adae30a78650d40a2197615c60270510fb7c..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/StorageFormat.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @(#)StorageFormat.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.filechooser.FileFilter; -import java.io.IOException; -import CH.ifa.draw.framework.Drawing; - -/** - * Interface to define a storage format. A StorageFormat is a strategy that knows how to store - * and restore a Drawing according to a specific encoding. Typically it can be recognized by - * a file extension. To identify a valid file format for a Drawing an appropriate FileFilter - * for a javax.swing.JFileChooser component can be requested. - * - * @see Drawing - * @see StorageFormatManager - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface StorageFormat { - - /** - * Return a FileFilter that can be used to identify files which can be stored and restored - * with this Storage Format. Typically, each storage format has its own recognizable file - * extension. - * - * @return FileFilter to be used with a javax.swing.JFileChooser - */ - public FileFilter getFileFilter(); - - /** - * Every format has to identify itself as able to store and/or restore from - * the format it represents. If the storage format can save to the format, it - * should return true in this method. - * @return boolean <code>true</code> if the format can save - */ - public boolean isStoreFormat(); - - /** - * Every format has to identify itself as able to store and/or restore from - * the format it represents. If the storage format can load from the format, - * it should return true in this method. - * @return boolean <code>true</code> if the format can load - */ - public boolean isRestoreFormat(); - - /** - * Store a Drawing under a given name. - * - * @param fileName file name of the Drawing under which it should be stored - * @param saveDrawing drawing to be saved - * @return file name with correct file extension - */ - public String store(String fileName, Drawing saveDrawing) throws IOException; - - /** - * Restore a Drawing from a file with a given name. - * - * @param fileName of the file in which the Drawing has been saved - * @return restored Drawing - */ - public Drawing restore(String fileName) throws IOException; -} diff --git a/JHotDraw/src/CH/ifa/draw/util/StorageFormatManager.java b/JHotDraw/src/CH/ifa/draw/util/StorageFormatManager.java deleted file mode 100644 index 4ca1441d3e40c0009ac5bb88ebc045e1a27c9222..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/StorageFormatManager.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * @(#)StorageFormatManager.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import javax.swing.JFileChooser; -import javax.swing.filechooser.FileFilter; - -import java.io.File; -import java.util.List; -import java.util.Iterator; - -/** - * The StorageFormatManager is a contains StorageFormats. - * It is not a Singleton because it could be necessary to deal with different - * format managers, e.g. one for importing Drawings, one for exporting Drawings. - * If one StorageFormat matches the file extension of the Drawing file, then this - * StorageFormat can be used to store or restore the Drawing. - * - * @see StorageFormat - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class StorageFormatManager { - - /** - * List containing all registered storage formats - */ - private List myStorageFormats; - - /** - * Default storage format that should be selected in a javax.swing.JFileChooser - */ - private StorageFormat myDefaultStorageFormat; - - /** - * Create a new StorageFormatManager. - */ - public StorageFormatManager() { - myStorageFormats = CollectionsFactory.current().createList(); - } - - /** - * Add a StorageFormat that should be supported by this StorageFormatManager. - * - * @param newStorageFormat new StorageFormat to be supported - */ - public void addStorageFormat(StorageFormat newStorageFormat) { - myStorageFormats.add(newStorageFormat); - } - - /** - * Remove a StorageFormat that should no longer be supported by this StorageFormatManager. - * The StorageFormat is excluded in when search for a StorageFormat. - * - * @param oldStorageFormat old StorageFormat no longer to be supported - */ - public void removeStorageFormat(StorageFormat oldStorageFormat) { - myStorageFormats.remove(oldStorageFormat); - } - - /** - * Test, whether a StorageFormat is supported by this StorageFormat - */ - public boolean containsStorageFormat(StorageFormat checkStorageFormat){ - return myStorageFormats.contains(checkStorageFormat); - } - - /** - * Set a StorageFormat as the default storage format which is selected in a - * javax.swing.JFileChooser. The default storage format must be already - * added with addStorageFormat. Setting the default storage format to null - * does not automatically remove the StorageFormat from the list of - * supported StorageFormats. - * - * @param newDefaultStorageFormat StorageFormat that should be selected in a JFileChooser - */ - public void setDefaultStorageFormat(StorageFormat newDefaultStorageFormat) { - myDefaultStorageFormat = newDefaultStorageFormat; - } - - /** - * Return the StorageFormat which is used as selected file format in a javax.swing.JFileChooser - * - * @return default storage format - */ - public StorageFormat getDefaultStorageFormat() { - return myDefaultStorageFormat; - } - - /** - * Register all FileFilters supported by StorageFormats - * - * @param fileChooser javax.swing.JFileChooser to which FileFilters are added - */ - public void registerFileFilters(JFileChooser fileChooser) { - if (fileChooser.getDialogType() == JFileChooser.OPEN_DIALOG) { - // behavior for open dialogs - StorageFormat sf; - for (Iterator e = myStorageFormats.iterator(); e.hasNext();) { - sf = (StorageFormat) e.next(); - if (sf.isRestoreFormat()) { - fileChooser.addChoosableFileFilter(sf.getFileFilter()); - } - } - - // set a current activated file filter if a default storage Format has been defined - sf = getDefaultStorageFormat(); - if (sf != null && sf.isRestoreFormat()) { - fileChooser.setFileFilter(sf.getFileFilter()); - } - } - else if (fileChooser.getDialogType() == JFileChooser.SAVE_DIALOG) { - // behavior for save dialogs - StorageFormat sf; - for (Iterator e = myStorageFormats.iterator(); e.hasNext();) { - sf = (StorageFormat) e.next(); - if (sf.isStoreFormat()) { - fileChooser.addChoosableFileFilter(sf.getFileFilter()); - } - } - - // set a current activated file filter if a default storage Format has been defined - sf = getDefaultStorageFormat(); - if (sf != null && sf.isStoreFormat()) { - fileChooser.setFileFilter(sf.getFileFilter()); - } - } - else { - // old behavior - StorageFormat sf; - for (Iterator e = myStorageFormats.iterator(); e.hasNext();) { - sf = (StorageFormat) e.next(); - fileChooser.addChoosableFileFilter(sf.getFileFilter()); - } - - // set a current activated file filter if a default storage Format has been defined - sf = getDefaultStorageFormat(); - if (sf != null) { - fileChooser.setFileFilter(sf.getFileFilter()); - } - } - } - - /** - * Find a StorageFormat that can be used according to a FileFilter to store a Drawing - * in a file or restore it from a file respectively. - * - * @param findFileFilter FileFilter used to identify a StorageFormat - * @return StorageFormat, if a matching file extension could be found, false otherwise - */ - public StorageFormat findStorageFormat(FileFilter findFileFilter) { - Iterator formatsIterator = myStorageFormats.iterator(); - StorageFormat currentStorageFormat = null; - while (formatsIterator.hasNext()) { - currentStorageFormat = (StorageFormat)formatsIterator.next(); - if (currentStorageFormat.getFileFilter().equals(findFileFilter)) { - return currentStorageFormat; - } - } - - return null; - } - - /** - * Find a StorageFormat that can be used according to a file object to store a - * Drawing in a file or restore it from a file respectively. - * - * @param file a File object to be matched - * @return StorageFormat, if a matching file extension could be found, <code>null</code> - * otherwise - */ - public StorageFormat findStorageFormat(File file) { - Iterator formatsIterator = myStorageFormats.iterator(); - StorageFormat currentStorageFormat; - while (formatsIterator.hasNext()) { - currentStorageFormat = (StorageFormat) formatsIterator.next(); - if (currentStorageFormat.getFileFilter().accept(file)) { - return currentStorageFormat; - } - } - return null; - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoCommand.java b/JHotDraw/src/CH/ifa/draw/util/UndoCommand.java deleted file mode 100644 index 315b5f677a4a318ad5445f54bce4f7f93b2791ce..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoCommand.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * @(#)UndoCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.standard.*; -import CH.ifa.draw.framework.*; - -/** - * Command to undo the latest change in the drawing. - * Undo activities can be undone only once, therefore they - * are not added to the undo stack again (redo activities - * can be added to the redo stack again, because they can - * be redone several times, every time pushing a corresponding - * undo activity as well). - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoCommand extends AbstractCommand { - - /** - * Constructs a properties command. - * @param name the command name - * @param newDrawingEditor the DrawingEditor which manages the views - */ - public UndoCommand(String name, DrawingEditor newDrawingEditor) { - super(name, newDrawingEditor); - } - - public void execute() { - super.execute(); - UndoManager um = getDrawingEditor().getUndoManager(); - - if ((um == null) || !um.isUndoable()) { - return; - } - - Undoable lastUndoable = um.popUndo(); - // Execute undo - boolean hasBeenUndone = lastUndoable.undo(); - - // Add to redo stack - if (hasBeenUndone && lastUndoable.isRedoable()) { - um.pushRedo(lastUndoable); - } - lastUndoable.getDrawingView().checkDamage(); - - getDrawingEditor().figureSelectionChanged(lastUndoable.getDrawingView()); - } - - /** - * Used in enabling the undo menu item. - * Undo menu item will be enabled only when there is atleast one undoable - * activity registered with UndoManager. - */ - public boolean isExecutableWithView() { - UndoManager um = getDrawingEditor().getUndoManager(); - - if ((um != null) && (um.getUndoSize() > 0)) { - return true; - } - - return false; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoManager.java b/JHotDraw/src/CH/ifa/draw/util/UndoManager.java deleted file mode 100644 index 842f8684ab7b7e14d88659f026bda8af129520e1..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoManager.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * @(#)UndoManager.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.DrawingView; - -import java.util.List; -import java.util.Iterator; - -/** - * This class manages all the undoable commands. It keeps track of all - * the modifications done through user interactions. - * - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoManager { - /** - * Maximum default buffer size for undo and redo stack - */ - public static final int DEFAULT_BUFFER_SIZE = 20; - - /** - * Collection of undo activities - */ - private List redoStack; - - /** - * Collection of undo activities - */ - private List undoStack; - private int maxStackCapacity; - - public UndoManager() { - this(DEFAULT_BUFFER_SIZE); - } - - public UndoManager(int newUndoStackSize) { - maxStackCapacity = newUndoStackSize; - undoStack = CollectionsFactory.current().createList(maxStackCapacity); - redoStack = CollectionsFactory.current().createList(maxStackCapacity); - } - - public void pushUndo(Undoable undoActivity) { - if (undoActivity.isUndoable()) { - removeFirstElementInFullList(undoStack); - undoStack.add(undoActivity); - } - else { - // a not undoable activity clears the stack because - // the last activity does not correspond with the - // last undo activity - undoStack = CollectionsFactory.current().createList(maxStackCapacity); - } - } - - public void pushRedo(Undoable redoActivity) { - if (redoActivity.isRedoable()) { - - removeFirstElementInFullList(redoStack); - - // add redo activity only if it is not already the last - // one in the buffer - if ((getRedoSize() == 0) || (peekRedo() != redoActivity)) { - redoStack.add(redoActivity); - } - } - else { - // a not undoable activity clears the tack because - // the last activity does not correspond with the - // last undo activity - redoStack = CollectionsFactory.current().createList(maxStackCapacity); - } - } - - /** - * If buffersize exceeds, remove the oldest command - */ - private void removeFirstElementInFullList(List l) { - if (l.size() >= maxStackCapacity) { - Undoable removedActivity = (Undoable)l.remove(0); - removedActivity.release(); - } - } - - private Undoable getLastElement(List l) { - if (l.size() > 0) { - return (Undoable)l.get(l.size() - 1); - } - else { - return null; - } - } - public boolean isUndoable() { - if (getUndoSize() > 0) { - return getLastElement(undoStack).isUndoable(); - } - else { - return false; - } - } - - public boolean isRedoable() { - if (getRedoSize() > 0) { - return getLastElement(redoStack).isRedoable(); - } - else { - return false; - } - } - - protected Undoable peekUndo() { - if (getUndoSize() > 0) { - return getLastElement(undoStack); - } - else { - return null; - } - } - - protected Undoable peekRedo() { - if (getRedoSize() > 0) { - return getLastElement(redoStack); - } - else { - return null; - } - } - - /** - * Returns the current size of undo buffer. - */ - public int getUndoSize() { - return undoStack.size(); - } - - /** - * Returns the current size of redo buffer. - */ - public int getRedoSize() { - return redoStack.size(); - } - - /** - * Throw NoSuchElementException if there is none - */ - public Undoable popUndo() { - // Get the last element - throw NoSuchElementException if there is none - Undoable lastUndoable = peekUndo(); - - // Remove it from undo collection - undoStack.remove(getUndoSize() - 1); - - return lastUndoable; - } - - /** - * Throw NoSuchElementException if there is none - */ - public Undoable popRedo() { - // Get the last element - throw NoSuchElementException if there is none - Undoable lastUndoable = peekRedo(); - - // Remove it from undo collection - redoStack.remove(getRedoSize() - 1); - - return lastUndoable; - } - - public void clearUndos() { - clearStack(undoStack); - } - - public void clearRedos() { - clearStack(redoStack); - } - - protected void clearStack(List clearStack) { - clearStack.clear(); - } - - /** - * Removes all undo activities that operate on the given DrawingView. - * @param checkDV DrawingView which is compared undo's DrawingView - */ - public void clearUndos(DrawingView checkDV) { - Iterator iter = undoStack.iterator(); - while (iter.hasNext()) { - Undoable currentUndo = (Undoable)iter.next(); - if (currentUndo.getDrawingView() == checkDV) { - iter.remove(); - } - } - } - - /** - * Removes all redo activities that operate on the given DrawingView. - * @param checkDV DrawingView which is compared redo's DrawingView - */ - public void clearRedos(DrawingView checkDV) { - Iterator iter = redoStack.iterator(); - while (iter.hasNext()) { - Undoable currentRedo = (Undoable)iter.next(); - if (currentRedo.getDrawingView() == checkDV) { - iter.remove(); - } - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoRedoActivity.java b/JHotDraw/src/CH/ifa/draw/util/UndoRedoActivity.java deleted file mode 100644 index a6964468f58bd13aaaf9ca33f0f791d62bbfae31..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoRedoActivity.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * @(#)DragTracker.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.*; - -/** - * An UndoRedoActivity can be used to turn a UndoActivity into a RedoActivity. - * In this case, the redo() method of an encapsulated activity is called when - * the undo() is executed, and undo() when redo() is executed. - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoRedoActivity implements Undoable { - private Undoable myReversedActivity; - - protected UndoRedoActivity(Undoable newReversedActivity) { - setReversedActivity(newReversedActivity); - } - - /** - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo() { - if (isRedoable()) { - return getReversedActivity().redo(); - } - - return false; - } - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo() { - if (isUndoable()) { - return getReversedActivity().undo(); - } - - return false; - } - - /** - * Dispatch to isRedoable of the activity to be reversed. - */ - public boolean isUndoable() { - return getReversedActivity().isRedoable(); - } - - /** - * Dispatch to setRedoable of the activity to be reversed. - */ - public void setUndoable(boolean newIsUndoable) { - getReversedActivity().setRedoable(newIsUndoable); - } - - /** - * Dispatch to isUndoable of the activity to be reversed. - */ - public boolean isRedoable() { - return getReversedActivity().isUndoable(); - } - - /** - * Dispatch to setUndoable of the activity to be reversed. - */ - public void setRedoable(boolean newIsRedoable) { - getReversedActivity().setUndoable(newIsRedoable); - } - - public void setAffectedFigures(FigureEnumeration newAffectedFigures) { - getReversedActivity().setAffectedFigures(newAffectedFigures); - } - - public FigureEnumeration getAffectedFigures() { - return getReversedActivity().getAffectedFigures(); - } - - public int getAffectedFiguresCount() { - return getReversedActivity().getAffectedFiguresCount(); - } - - public DrawingView getDrawingView() { - return getReversedActivity().getDrawingView(); - } - - public void release() { - getReversedActivity().release(); - } - - protected void setReversedActivity(Undoable newReversedActivity) { - myReversedActivity = newReversedActivity; - } - - public Undoable getReversedActivity() { - return myReversedActivity; - } - - public static Undoable createUndoRedoActivity(Undoable toBeReversed) { - // instead of reversing the reversed activity just return the original activity - if (toBeReversed instanceof UndoRedoActivity) { - return ((UndoRedoActivity)toBeReversed).getReversedActivity(); - } - else { - return new UndoRedoActivity(toBeReversed); - } - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/Undoable.java b/JHotDraw/src/CH/ifa/draw/util/Undoable.java deleted file mode 100644 index 13c6f170088abeca4235539bd60cc4cf120460d5..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/Undoable.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @(#)Undoable.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.FigureEnumeration; -import CH.ifa.draw.framework.DrawingView; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface Undoable { - /** - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo(); - - /* - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo(); - - public boolean isUndoable(); - - public void setUndoable(boolean newIsUndoable); - - public boolean isRedoable(); - - public void setRedoable(boolean newIsRedoable); - - /** - * Releases all resources related to an undoable activity - */ - public void release(); - - public DrawingView getDrawingView(); - - public void setAffectedFigures(FigureEnumeration newAffectedFigures); - - public FigureEnumeration getAffectedFigures(); - - public int getAffectedFiguresCount(); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoableAdapter.java b/JHotDraw/src/CH/ifa/draw/util/UndoableAdapter.java deleted file mode 100644 index 1f283fe032d857800d283d2e5a4bc10dfb0c16c3..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoableAdapter.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * @(#)UndoableAdapter.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: ? by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.FigureEnumerator; -import CH.ifa.draw.standard.ReverseFigureEnumerator; -import CH.ifa.draw.standard.StandardFigureSelection; - -import java.util.Collections; -import java.util.List; - -/** - * Most basic implementation for an Undoable activity. Subclasses should override - * methods to provide specialized behaviour when necessary. - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoableAdapter implements Undoable { - - private List myAffectedFigures; - private boolean myIsUndoable; - private boolean myIsRedoable; - private DrawingView myDrawingView; - - public UndoableAdapter(DrawingView newDrawingView) { - setDrawingView(newDrawingView); - } - - /** - * Undo the activity - * @return true if the activity could be undone, false otherwise - */ - public boolean undo() { - return isUndoable(); - } - - /** - * Redo the activity - * @return true if the activity could be redone, false otherwise - */ - public boolean redo() { - return isRedoable(); - } - - public boolean isUndoable() { - return myIsUndoable; - } - - public void setUndoable(boolean newIsUndoable) { - myIsUndoable = newIsUndoable; - } - - public boolean isRedoable() { - return myIsRedoable; - } - - public void setRedoable(boolean newIsRedoable) { - myIsRedoable = newIsRedoable; - } - - public void setAffectedFigures(FigureEnumeration newAffectedFigures) { - // the enumeration is not reusable therefore a copy is made - // to be able to undo-redo the command several time - if(newAffectedFigures == null) { - throw new IllegalArgumentException(); - } - rememberFigures(newAffectedFigures); - } - - public FigureEnumeration getAffectedFigures() { - if(myAffectedFigures == null) { - return new FigureEnumerator(Collections.EMPTY_LIST); - } - else { - return new FigureEnumerator(CollectionsFactory.current().createList(myAffectedFigures)); - } - } - - public FigureEnumeration getAffectedFiguresReversed() { - return new ReverseFigureEnumerator(CollectionsFactory.current().createList(myAffectedFigures)); - } - - public int getAffectedFiguresCount() { - return myAffectedFigures.size(); - } - - protected void rememberFigures(FigureEnumeration toBeRemembered) { - myAffectedFigures = CollectionsFactory.current().createList(); - while (toBeRemembered.hasNextFigure()) { - myAffectedFigures.add(toBeRemembered.nextFigure()); - } - } - - /** - * Releases all resources related to an undoable activity - */ - public void release() { - FigureEnumeration fe = getAffectedFigures(); - while (fe.hasNextFigure()) { - fe.nextFigure().release(); - } - setAffectedFigures(FigureEnumerator.getEmptyEnumeration()); - } - - /** - * Create new set of affected figures for redo operation because - * deleting figures in an undo operation makes them unusable - * Especially contained figures have been removed from their - * observing container like CompositeFigure or DecoratorFigure. - * Duplicating these figures re-establishes the dependencies. - */ - protected void duplicateAffectedFigures() { - setAffectedFigures(StandardFigureSelection.duplicateFigures( - getAffectedFigures(), getAffectedFiguresCount())); - } - - public DrawingView getDrawingView() { - return myDrawingView; - } - - protected void setDrawingView(DrawingView newDrawingView) { - myDrawingView = newDrawingView; - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoableCommand.java b/JHotDraw/src/CH/ifa/draw/util/UndoableCommand.java deleted file mode 100644 index f579321f334fb99a595e5ff134860e85413f0c63..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoableCommand.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * @(#)UndoableCommand.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.AbstractCommand; -import java.util.EventObject; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoableCommand implements Command, FigureSelectionListener, CommandListener { - - private Command myWrappedCommand; - private boolean hasSelectionChanged; - private AbstractCommand.EventDispatcher myEventDispatcher; - - public UndoableCommand(Command newWrappedCommand) { - setWrappedCommand(newWrappedCommand); - getWrappedCommand().addCommandListener(this); - setEventDispatcher(createEventDispatcher()); - } - - /** - * Executes the command. - */ - public void execute() { - hasSelectionChanged = false; - // listen for selection change events during executing the wrapped command - view().addFigureSelectionListener(this); - - getWrappedCommand().execute(); - - Undoable undoableCommand = getWrappedCommand().getUndoActivity(); - if ((undoableCommand != null) && (undoableCommand.isUndoable())) { - getDrawingEditor().getUndoManager().pushUndo(undoableCommand); - getDrawingEditor().getUndoManager().clearRedos(); - } - - // initiate manual update of undo/redo menu states if it has not - // been done automatically during executing the wrapped command - if (!hasSelectionChanged || (getDrawingEditor().getUndoManager().getUndoSize() == 1)) { - getDrawingEditor().figureSelectionChanged(view()); - } - - // remove because not all commands are listeners that have to be notified - // all the time (bug-id 595461) - view().removeFigureSelectionListener(this); - } - - /** - * Tests if the command can be executed. - */ - public boolean isExecutable() { - return getWrappedCommand().isExecutable(); - } - - protected void setWrappedCommand(Command newWrappedCommand) { - myWrappedCommand = newWrappedCommand; - } - - protected Command getWrappedCommand() { - return myWrappedCommand; - } - - /** - * Gets the command name. - */ - public String name() { - return getWrappedCommand().name(); - } - - public DrawingEditor getDrawingEditor() { - return getWrappedCommand().getDrawingEditor(); - } - - public DrawingView view() { - return getDrawingEditor().view(); - } - - public void figureSelectionChanged(DrawingView view) { - hasSelectionChanged = true; - } - - public Undoable getUndoActivity() { - return new UndoableAdapter(view()); - } - - public void setUndoActivity(Undoable newUndoableActivity) { - // do nothing: always return default UndoableAdapter - } - - public void addCommandListener(CommandListener newCommandListener) { - getEventDispatcher().addCommandListener(newCommandListener); - } - - public void removeCommandListener(CommandListener oldCommandListener) { - getEventDispatcher().removeCommandListener(oldCommandListener); - } - - private void setEventDispatcher(AbstractCommand.EventDispatcher newEventDispatcher) { - myEventDispatcher = newEventDispatcher; - } - - protected AbstractCommand.EventDispatcher getEventDispatcher() { - return myEventDispatcher; - } - - public AbstractCommand.EventDispatcher createEventDispatcher() { - return new AbstractCommand.EventDispatcher(this); - } - - public void commandExecuted(EventObject commandEvent) { - getEventDispatcher().fireCommandExecutedEvent(); - } - - public void commandExecutable(EventObject commandEvent) { - getEventDispatcher().fireCommandExecutableEvent(); - } - - public void commandNotExecutable(EventObject commandEvent) { - getEventDispatcher().fireCommandNotExecutableEvent(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoableHandle.java b/JHotDraw/src/CH/ifa/draw/util/UndoableHandle.java deleted file mode 100644 index 84cf89ab821165659c6cae189e260935a0d00d5f..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoableHandle.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * @(#)UndoableHandle.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.framework.Drawing; -import CH.ifa.draw.framework.DrawingView; -import CH.ifa.draw.framework.Figure; -import CH.ifa.draw.framework.Handle; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoableHandle implements Handle { - - private Handle myWrappedHandle; - private DrawingView myDrawingView; - - /** - * Constructor for <code>UndoableHandle</code>. - * @param newWrappedHandle - */ - public UndoableHandle(Handle newWrappedHandle) { - setWrappedHandle(newWrappedHandle); - } - - /** - * Constructor for <code>UndoableHandle</code>. - * @param newWrappedHandle - * @param newDrawingView - * @deprecated use the constructor without the DrawingView instead - */ - public UndoableHandle(Handle newWrappedHandle, DrawingView newDrawingView) { - setWrappedHandle(newWrappedHandle); - setDrawingView(newDrawingView); - } - - /** - * Locates the handle on the figure. The handle is drawn - * centered around the returned point. - * @see CH.ifa.draw.framework.Handle#locate() - */ - public Point locate() { - return getWrappedHandle().locate(); - } - - /** - * Tracks the start of the interaction. The default implementation - * does nothing. - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @param view the handles container - * @see CH.ifa.draw.framework.Handle#invokeStart(int, int, CH.ifa.draw.framework.DrawingView) - */ - public void invokeStart(int x, int y, DrawingView view) { - getWrappedHandle().invokeStart(x, y, view); - } - - /** - * Tracks the start of the interaction. The default implementation - * does nothing. - * @param x the x position where the interaction started - * @param y the y position where the interaction started - * @see CH.ifa.draw.framework.Handle#invokeStart(int, int, CH.ifa.draw.framework.Drawing) - * @deprecated As of version 4.1, - * use invokeStart(x, y, drawingView) - */ - public void invokeStart(int x, int y, Drawing drawing) { - getWrappedHandle().invokeStart(x, y, drawing); - } - - /** - * Tracks a step of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - * @see CH.ifa.draw.framework.Handle#invokeStep(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - public void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view) { - getWrappedHandle().invokeStep(x, y, anchorX, anchorY, view); - } - - /** - * Tracks a step of the interaction. - * @param dx x delta of this step - * @param dy y delta of this step - * @see CH.ifa.draw.framework.Handle#invokeStep(int, int, CH.ifa.draw.framework.Drawing) - * @deprecated As of version 4.1, - * use invokeStep(x, y, anchorX, anchorY, drawingView) - */ - public void invokeStep(int dx, int dy, Drawing drawing) { - getWrappedHandle().invokeStep(dx, dy, drawing); - } - - /** - * Tracks the end of the interaction. - * @param x the current x position - * @param y the current y position - * @param anchorX the x position where the interaction started - * @param anchorY the y position where the interaction started - * @see CH.ifa.draw.framework.Handle#invokeEnd(int, int, int, int, CH.ifa.draw.framework.DrawingView) - */ - public void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view) { - getWrappedHandle().invokeEnd(x, y, anchorX, anchorY, view); - - Undoable undoableActivity = getWrappedHandle().getUndoActivity(); - if ((undoableActivity != null) && (undoableActivity.isUndoable())) { - view.editor().getUndoManager().pushUndo(undoableActivity); - view.editor().getUndoManager().clearRedos(); - } - } - - /** - * Tracks the end of the interaction. - * @see CH.ifa.draw.framework.Handle#invokeEnd(int, int, CH.ifa.draw.framework.Drawing) - * @deprecated As of version 4.1, - * use invokeEnd(x, y, anchorX, anchorY, drawingView). - */ - public void invokeEnd(int dx, int dy, Drawing drawing) { - getWrappedHandle().invokeEnd(dx, dy, drawing); - } - - /** - * Gets the handle's owner. - * @see CH.ifa.draw.framework.Handle#owner() - */ - public Figure owner() { - return getWrappedHandle().owner(); - } - - /** - * Gets the display box of the handle. - * @see CH.ifa.draw.framework.Handle#displayBox() - */ - public Rectangle displayBox() { - return getWrappedHandle().displayBox(); - } - - /** - * Tests if a point is contained in the handle. - * @see CH.ifa.draw.framework.Handle#containsPoint(int, int) - */ - public boolean containsPoint(int x, int y) { - return getWrappedHandle().containsPoint(x, y); - } - - /** - * Draws this handle. - * @see CH.ifa.draw.framework.Handle#draw(java.awt.Graphics) - */ - public void draw(Graphics g) { - getWrappedHandle().draw(g); - } - - protected void setWrappedHandle(Handle newWrappedHandle) { - myWrappedHandle = newWrappedHandle; - } - - protected Handle getWrappedHandle() { - return myWrappedHandle; - } - - /** - * @deprecated attribute not required anymore - */ - public DrawingView getDrawingView() { - return myDrawingView; - } - - /** - * @deprecated attribute not required anymore - */ - protected void setDrawingView(DrawingView newDrawingView) { - myDrawingView = newDrawingView; - } - - /** - * @see CH.ifa.draw.framework.Handle#getUndoActivity() - */ - public Undoable getUndoActivity() { - return new UndoableAdapter(getDrawingView()); - } - - /** - * @see CH.ifa.draw.framework.Handle#setUndoActivity(CH.ifa.draw.util.Undoable) - */ - public void setUndoActivity(Undoable newUndoableActivity) { - // do nothing: always return default UndoableAdapter - } - - /** - * @see CH.ifa.draw.framework.Handle#getCursor() - */ - public Cursor getCursor() { - return getWrappedHandle().getCursor(); - } - -} diff --git a/JHotDraw/src/CH/ifa/draw/util/UndoableTool.java b/JHotDraw/src/CH/ifa/draw/util/UndoableTool.java deleted file mode 100644 index 1075dbce6a4b513a7d5d3c63bf3b9a18089d37e4..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/UndoableTool.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * @(#)UndoableTool.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import CH.ifa.draw.framework.*; -import CH.ifa.draw.standard.AbstractTool; -import java.awt.event.MouseEvent; -import java.awt.event.KeyEvent; -import java.util.EventObject; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class UndoableTool implements Tool, ToolListener { - - private Tool myWrappedTool; - private AbstractTool.EventDispatcher myEventDispatcher; - - public UndoableTool(Tool newWrappedTool) { - setEventDispatcher(createEventDispatcher()); - setWrappedTool(newWrappedTool); - getWrappedTool().addToolListener(this); - } - - /** - * Activates the tool for the given view. This method is called - * whenever the user switches to this tool. Use this method to - * reinitialize a tool. - */ - public void activate() { - getWrappedTool().activate(); - } - - /** - * Deactivates the tool. This method is called whenever the user - * switches to another tool. Use this method to do some clean-up - * when the tool is switched. Subclassers should always call - * super.deactivate. - */ - public void deactivate() { - getWrappedTool().deactivate(); - Undoable undoActivity = getWrappedTool().getUndoActivity(); - if ((undoActivity != null) && (undoActivity.isUndoable())) { - editor().getUndoManager().pushUndo(undoActivity); - editor().getUndoManager().clearRedos(); - // update menus - editor().figureSelectionChanged(getActiveView()); - } - } - - /** - * Handles mouse down events in the drawing view. - */ - public void mouseDown(MouseEvent e, int x, int y) { - getWrappedTool().mouseDown(e, x, y); - } - - /** - * Handles mouse drag events in the drawing view. - */ - public void mouseDrag(MouseEvent e, int x, int y) { - getWrappedTool().mouseDrag(e, x, y); - } - - /** - * Handles mouse up in the drawing view. After the mouse button - * has been released, the associated tool activity can be undone - * if the associated tool supports the undo operation from the Undoable interface. - * - * @see CH.ifa.draw.util.Undoable - */ - public void mouseUp(MouseEvent e, int x, int y) { - getWrappedTool().mouseUp(e, x, y); - } - - /** - * Handles mouse moves (if the mouse button is up). - */ - public void mouseMove(MouseEvent evt, int x, int y) { - getWrappedTool().mouseMove(evt, x, y); - } - - /** - * Handles key down events in the drawing view. - */ - public void keyDown(KeyEvent evt, int key) { - getWrappedTool().keyDown(evt, key); - } - - public boolean isUsable() { - return getWrappedTool().isUsable(); - } - - public boolean isActive() { - // do not delegate but test whether this undoable tool is active - return editor().tool() == this; - } - - public boolean isEnabled() { - return getWrappedTool().isEnabled(); - } - - public void setUsable(boolean newIsUsable) { - getWrappedTool().setUsable(newIsUsable); - } - - public void setEnabled(boolean newIsEnabled) { - getWrappedTool().setEnabled(newIsEnabled); - } - - protected void setWrappedTool(Tool newWrappedTool) { - myWrappedTool = newWrappedTool; - } - - protected Tool getWrappedTool() { - return myWrappedTool; - } - - public DrawingEditor editor() { - return getWrappedTool().editor(); - } - - public DrawingView view() { - return editor().view(); - } - - public Undoable getUndoActivity() { - return new UndoableAdapter(view()); - } - - public void setUndoActivity(Undoable newUndoableActivity) { - // do nothing: always return default UndoableAdapter - } - - public void toolUsable(EventObject toolEvent) { - getEventDispatcher().fireToolUsableEvent(); - } - - public void toolUnusable(EventObject toolEvent) { - getEventDispatcher().fireToolUnusableEvent(); - } - - public void toolActivated(EventObject toolEvent) { - getEventDispatcher().fireToolActivatedEvent(); - } - - public void toolDeactivated(EventObject toolEvent) { - getEventDispatcher().fireToolDeactivatedEvent(); - } - - public void toolEnabled(EventObject toolEvent) { - getEventDispatcher().fireToolEnabledEvent(); - } - - public void toolDisabled(EventObject toolEvent) { - getEventDispatcher().fireToolDisabledEvent(); - } - - public void addToolListener(ToolListener newToolListener) { - getEventDispatcher().addToolListener(newToolListener); - } - - public void removeToolListener(ToolListener oldToolListener) { - getEventDispatcher().removeToolListener(oldToolListener); - } - - private void setEventDispatcher(AbstractTool.EventDispatcher newEventDispatcher) { - myEventDispatcher = newEventDispatcher; - } - - protected AbstractTool.EventDispatcher getEventDispatcher() { - return myEventDispatcher; - } - - public AbstractTool.EventDispatcher createEventDispatcher() { - return new AbstractTool.EventDispatcher(this); - } - - public DrawingView getActiveView() { - return editor().view(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/VersionControlStrategy.java b/JHotDraw/src/CH/ifa/draw/util/VersionControlStrategy.java deleted file mode 100644 index e59852c1e26aac4c2c4e04abb59930a45b9c5a36..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/VersionControlStrategy.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * @(#)VersionControlStrategy.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface VersionControlStrategy { - /** - * Define a strategy how to select those versions of JHotDraw - * with which they are compatible. - */ - public void assertCompatibleVersion(); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/VersionManagement.java b/JHotDraw/src/CH/ifa/draw/util/VersionManagement.java deleted file mode 100644 index 65853c46db094966211338328530852d387b024a..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/VersionManagement.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * @(#)VersionManagement.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -import java.io.*; -import java.util.*; -import java.util.jar.*; - -/** - * Collection of utility methods that are useful for dealing with version information - * retrieved from reading jar files or package loaded by the class manager. Some - * methods also help comparing version information. The method getJHotDrawVersion() - * can be used to retrieve the current version of JHotDraw as loaded by the class manager. - * - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class VersionManagement { - public static String JHOTDRAW_COMPONENT = "CH.ifa.draw/"; - public static String JHOTDRAW_JAR = "jhotdraw.jar"; - - public static Package[] packages = { - Package.getPackage("CH.ifa.draw.applet"), - Package.getPackage("CH.ifa.draw.application"), - Package.getPackage("CH.ifa.draw.contrib"), - Package.getPackage("CH.ifa.draw.figures"), - Package.getPackage("CH.ifa.draw.framework"), - Package.getPackage("CH.ifa.draw.standard"), - Package.getPackage("CH.ifa.draw.util") - }; - - /** - * Return the version of the main package of the framework. A version number is - * available if there is a corresponding version entry in the JHotDraw jar file - * for the framework package. - */ - public static String getJHotDrawVersion() { - // look for the framework main package - Package pack = packages[4]; - return pack.getSpecificationVersion(); - } - - /** - * - */ - public static String getPackageVersion(final Package lookupPackage) { - if (lookupPackage == null) { - return null; - } - - String specVersion = lookupPackage.getSpecificationVersion(); - if (specVersion != null) { - return specVersion; - } - else { - // search in parent package - String normalizedPackageName = normalizePackageName(lookupPackage.getName()); - String nextPackageName = getNextPackage(normalizedPackageName); - return getPackageVersion(Package.getPackage(nextPackageName)); - } - } - - /** - * Check whether a given application version is compatible with the version - * of JHotDraw currently loaded in the Java VM. A version number is - * available if there is a corresponding version entry in the JHotDraw jar file - * for the framework package. - */ - public static boolean isCompatibleVersion(String compareVersionString) { -// Package pack = VersionManagement.class.getPackage(); - Package pack = packages[4]; - if (compareVersionString == null) { - return pack.getSpecificationVersion() == null; - } - else { - return pack.isCompatibleWith(compareVersionString); - } - } - - /** - * Read the version information from a file with a given file name. The file - * must be a jar manifest file and all its entries are searched for package names - * and their specification version information. All information is collected - * in a map for later lookup of package names and their versions. - * - * @param versionFileName name of the jar file containing version information - */ - public static String readVersionFromFile(String applicationName, String versionFileName) { - try { - FileInputStream fileInput = new FileInputStream(versionFileName); - Manifest manifest = new Manifest(); - manifest.read(fileInput); - - Map entries = manifest.getEntries(); - // Now write out the pre-entry attributes - Iterator entryIterator = entries.entrySet().iterator(); - while (entryIterator.hasNext()) { - Map.Entry currentEntry = (Map.Entry)entryIterator.next(); - String packageName = currentEntry.getKey().toString(); - packageName = normalizePackageName(packageName); - Attributes attributes = (Attributes)currentEntry.getValue(); - String packageSpecVersion = attributes.getValue(Attributes.Name.SPECIFICATION_VERSION); - packageSpecVersion = extractVersionInfo(packageSpecVersion); - return packageSpecVersion; - } - } - catch (IOException exception) { - exception.printStackTrace(); - } - - // no version found - return null; - } - - /** - * Get the super package of a package specifier. The super package is the package - * specifier without the latest package name, e.g. the next package for "org.jhotdraw.tools" - * would be "org.jhotdraw". - * - * @param searchPackage package specifier - * @return next package if one is available, null otherwise - */ - protected static String getNextPackage(String searchPackage) { - if (searchPackage == null) { - return null; - } - - int foundNextPackage = searchPackage.lastIndexOf('.'); - if (foundNextPackage > 0) { - return searchPackage.substring(0, foundNextPackage); - } - else { - return null; - } - } - - /** - * A package name is normalized by replacing all path delimiters by "." to retrieve - * a valid standardized package specifier used in package declarations in Java source - * files. - * - * @param toBeNormalized package name to be normalized - * @return normalized package name - */ - public static String normalizePackageName(String toBeNormalized) { - // first, replace the standard package delimiter used in jars - String replaced = toBeNormalized.replace('/', '.'); - // then, replace the default path separator in case this one was used as well - replaced = replaced.replace(File.pathSeparatorChar, '.'); - if (replaced.endsWith(".")) { - int lastSeparator = replaced.lastIndexOf('.'); - return replaced.substring(0, lastSeparator); - } - else { - return replaced; - } - } - - /** - * Get the version information specified in a jar manifest file without - * any leading or trailing "\"". - * - * @param versionString a version string with possibly leading or trailing "\"" - * @return stripped version information - */ - public static String extractVersionInfo(String versionString) { - // guarding conditions - if (versionString == null) { - return null; - } - if (versionString.length() == 0) { - return ""; - } - - int startIndex = versionString.indexOf("\""); - if (startIndex < 0) { - startIndex = 0; - } - else { - // start from next character - startIndex++; - } - - int endIndex = versionString.lastIndexOf("\""); - if (endIndex < 0) { - endIndex = versionString.length(); - } - - return versionString.substring(startIndex, endIndex); - } -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/VersionRequester.java b/JHotDraw/src/CH/ifa/draw/util/VersionRequester.java deleted file mode 100644 index 9b6a737b073030dca92199b00826753acc71d6be..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/VersionRequester.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * @(#)VersionRequester.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util; - -/** - * @author Wolfram Kaiser <mrfloppy@sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public interface VersionRequester { - /** - * Subclasses should override this method to specify to which versions of - * JHotDraw they are compatible. A string array is returned so it is possible - * to specify several version numbers of JHotDraw to which the application - * is compatible with. - * - * @return all versions number of JHotDraw the application is compatible with. - */ - public abstract String[] getRequiredVersions(); -} \ No newline at end of file diff --git a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/CollectionsFactoryJDK11.java b/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/CollectionsFactoryJDK11.java deleted file mode 100644 index e6d5d6b6aae29f9465c8c7c70dfee923ec2e9c00..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/CollectionsFactoryJDK11.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * @(#)CollectionsFactoryJDK11.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.util.collections.jdk11; - -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.*; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class CollectionsFactoryJDK11 extends CollectionsFactory { - public CollectionsFactoryJDK11() { - // required in order to create instances of this class via reflection - } - - public List createList() { - return new ListWrapper(); - } - - public List createList(Collection initList) { - return new ListWrapper(initList); - } - - public List createList(int initSize) { - return new ListWrapper(initSize); - } - - public Map createMap() { - return new MapWrapper(); - } - - public Map createMap(Map initMap) { - return new MapWrapper(initMap); - } - - public Set createSet() { - return new SetWrapper(); - } - - public Set createSet(Set initSet) { - return new SetWrapper(initSet); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/IteratorWrapper.java b/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/IteratorWrapper.java deleted file mode 100644 index 1ba77d67de17d2db7b36e8d2185d8e7387d8e738..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/IteratorWrapper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * @(#)IteratorWrapper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util.collections.jdk11; - -import java.util.Iterator; -import java.util.Enumeration; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class IteratorWrapper implements Iterator { - private Enumeration myEnumeration; - public IteratorWrapper(Enumeration enumeration) { - myEnumeration = enumeration; - } - - public boolean hasNext() { - return myEnumeration.hasMoreElements(); - } - - public Object next() { - return myEnumeration.nextElement(); - } - - public void remove() { - // do nothing or throw exception - //throw new UnsupportedOperationException(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/ListWrapper.java b/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/ListWrapper.java deleted file mode 100644 index 8c3ca086c26fc34eeaa3837e2d1b869ba43ce7a2..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/ListWrapper.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @(#)ListWrapper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util.collections.jdk11; - -import java.util.*; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class ListWrapper implements List { - private Vector myDelegee; - - public ListWrapper() { - myDelegee = new Vector(); - } - - public ListWrapper(int initialSize) { - myDelegee = new Vector(initialSize); - } - - public ListWrapper(Collection copyCollection) { - myDelegee = new Vector(copyCollection); - } - - public int size() { - return myDelegee.size(); - } - - public boolean isEmpty() { - return myDelegee.isEmpty(); - } - - public boolean contains(Object o) { - return myDelegee.contains(o); - } - - public Iterator iterator() { - return new IteratorWrapper(myDelegee.elements()); - } - - public Object[] toArray() { - return myDelegee.toArray(); - } - - public Object[] toArray(Object a[]) { - return myDelegee.toArray(a); - } - - public boolean add(Object o) { - return myDelegee.add(o); - } - - public boolean remove(Object o) { - return myDelegee.removeElement(o); - } - - public boolean containsAll(Collection c) { - return myDelegee.containsAll(c); - } - - public boolean addAll(Collection c) { - return myDelegee.addAll(c); - } - - public boolean addAll(int index, Collection c) { - return myDelegee.addAll(index, c); - } - - public boolean removeAll(Collection c) { - return myDelegee.removeAll(c); - } - - public boolean retainAll(Collection c) { - return myDelegee.retainAll(c); - } - - public void clear() { - myDelegee.clear(); - } - - public Object get(int index) { - return myDelegee.elementAt(index); - } - - public Object set(int index, Object element) { - return myDelegee.set(index, element) ; - } - - public void add(int index, Object element) { - myDelegee.add(index, element); - } - - public Object remove(int index) { - return myDelegee.remove(index); - } - - public int indexOf(Object o) { - return myDelegee.indexOf(o); - } - - public int lastIndexOf(Object o) { - return myDelegee.lastIndexOf(o); - } - - public ListIterator listIterator() { - return myDelegee.listIterator(); - } - - public ListIterator listIterator(int index) { - return myDelegee.listIterator(index); - } - - public List subList(int fromIndex, int toIndex) { - return null; - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/MapWrapper.java b/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/MapWrapper.java deleted file mode 100644 index 0aa4022c3fe67d800a938d0d15772e17345bfd61..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/MapWrapper.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @(#)MapWrapper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ - -package CH.ifa.draw.util.collections.jdk11; - -import java.util.*; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class MapWrapper implements Map { - private Map myDelegee; - - public MapWrapper() { - myDelegee = new Hashtable(); - } - - public MapWrapper(Map copyMap) { - myDelegee = new Hashtable(copyMap); - } - - public int size() { - return myDelegee.size(); - } - - public boolean isEmpty() { - return myDelegee.isEmpty(); - } - - public boolean containsKey(Object key) { - return myDelegee.containsKey(key); - } - - public boolean containsValue(Object value) { - return myDelegee.containsKey(value); - } - - public Object get(Object key) { - return myDelegee.get(key); - } - - public Object put(Object key, Object value) { - return myDelegee.put(key, value); - } - - public Object remove(Object key) { - return myDelegee.remove(key); - } - - public void putAll(Map t) { - myDelegee.putAll(t); - } - - public void clear() { - myDelegee.clear(); - } - - public Set keySet() { - return myDelegee.keySet(); - } - - public Collection values() { - return myDelegee.values(); - } - - public Set entrySet() { - return myDelegee.entrySet(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/SetWrapper.java b/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/SetWrapper.java deleted file mode 100644 index a2bbbb6c613b40faa6c7e92d5a0e77c07ca6e7ef..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/collections/jdk11/SetWrapper.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * @(#)SetWrapper.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.util.collections.jdk11; - -import java.util.*; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class SetWrapper implements Set { - private Hashtable myDelegee; - - public SetWrapper() { - myDelegee = new Hashtable(); - } - - public SetWrapper(Set initSet) { - myDelegee = new Hashtable(); - Iterator iter = initSet.iterator(); - while (iter.hasNext()) { - add(iter.next()); - } - } - - public int size() { - return myDelegee.size(); - } - - public boolean isEmpty() { - return myDelegee.isEmpty(); - } - - public boolean contains(Object o) { - return myDelegee.containsKey(o); - } - - public Iterator iterator() { - return new IteratorWrapper(myDelegee.elements()); - } - - public Object[] toArray() { - return new Object[0]; - } - - public Object[] toArray(Object a[]) { - return new Object[0]; - } - - public boolean add(Object o) { - return myDelegee.put(o, o) == null; - } - - public boolean remove(Object o) { - return myDelegee.remove(o) != null; - } - - public boolean containsAll(Collection c) { - return false; - } - - public boolean addAll(Collection c) { - return false; - } - - public boolean retainAll(Collection c) { - return false; - } - - public boolean removeAll(Collection c) { - return false; - } - - public void clear() { - myDelegee.clear(); - } -} diff --git a/JHotDraw/src/CH/ifa/draw/util/collections/jdk12/CollectionsFactoryJDK12.java b/JHotDraw/src/CH/ifa/draw/util/collections/jdk12/CollectionsFactoryJDK12.java deleted file mode 100644 index e29d84ab69e0a7d987404d1c9479dc5aefc0d56b..0000000000000000000000000000000000000000 --- a/JHotDraw/src/CH/ifa/draw/util/collections/jdk12/CollectionsFactoryJDK12.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * @(#)CollectionsFactoryJDK12.java - * - * Project: JHotdraw - a GUI framework for technical drawings - * http://www.jhotdraw.org - * http://jhotdraw.sourceforge.net - * Copyright: � by the original author(s) and all contributors - * License: Lesser GNU Public License (LGPL) - * http://www.opensource.org/licenses/lgpl-license.html - */ -package CH.ifa.draw.util.collections.jdk12; - -import CH.ifa.draw.util.CollectionsFactory; - -import java.util.*; - -/** - * @author Wolfram Kaiser <mrfloppy@users.sourceforge.net> - * @version <$CURRENT_VERSION$> - */ -public class CollectionsFactoryJDK12 extends CollectionsFactory { - public CollectionsFactoryJDK12() { - // required in order to create instances of this class via reflection - } - - public List createList() { - return new ArrayList(); - } - - public List createList(Collection initList) { - return new ArrayList(initList); - } - - public List createList(int initSize) { - return new ArrayList(initSize); - } - - public Map createMap() { - return new Hashtable(); - } - - public Map createMap(Map initMap) { - return new Hashtable(initMap); - } - - public Set createSet() { - return new HashSet(); - } - - public Set createSet(Set initSet) { - return new HashSet(initSet); - } -}