Source Code Cross Referenced for MiscellaneousWidgetTest.java in  » GIS » GeoTools-2.4.1 » org » geotools » gui » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.gui.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
005:         *    (C) 2003, Institut de Recherche pour le Développement
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation; either
010:         *    version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.gui.swing;
018:
019:        // J2SE dependencies
020:        import java.awt.Color;
021:        import java.awt.Component;
022:        import java.awt.Graphics2D;
023:        import java.awt.Polygon;
024:        import java.awt.Rectangle;
025:        import java.awt.geom.Rectangle2D;
026:        import java.awt.image.RenderedImage;
027:        import java.util.Locale;
028:        import javax.swing.JFrame;
029:
030:        // JAI dependencies
031:        import javax.media.jai.operator.AddConstDescriptor;
032:        import javax.media.jai.operator.ConstantDescriptor;
033:        import javax.media.jai.operator.GradientMagnitudeDescriptor;
034:        import javax.media.jai.operator.MultiplyConstDescriptor;
035:
036:        // JUnit dependencies
037:        import junit.framework.Test;
038:        import junit.framework.TestCase;
039:        import junit.framework.TestSuite;
040:
041:        // Geotools dependencies
042:        import org.geotools.measure.AngleFormat;
043:        import org.geotools.resources.Arguments;
044:        import org.geotools.resources.image.ColorUtilities;
045:        import org.geotools.gui.swing.referencing.CoordinateChooser;
046:        import org.geotools.gui.swing.image.OperationTreeBrowser;
047:        import org.geotools.gui.swing.image.GradientKernelEditor;
048:        import org.geotools.gui.swing.image.KernelEditor;
049:        import org.geotools.gui.swing.image.ColorRamp;
050:
051:        /**
052:         * Tests a set of widgets. Widgets will be displayed only if the test is run from the main
053:         * method. Otherwise (i.e. if run from Maven), widgets are invisibles.
054:         *
055:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/widgets-swing/src/test/java/org/geotools/gui/swing/MiscellaneousWidgetTest.java $
056:         * @version $Id: MiscellaneousWidgetTest.java 20883 2006-08-07 13:48:09Z jgarnett $
057:         * @author Martin Desruisseaux
058:         */
059:        public class MiscellaneousWidgetTest extends TestBase {
060:            /**
061:             * Constructs the test case.
062:             */
063:            public MiscellaneousWidgetTest(final String name) {
064:                super (name);
065:            }
066:
067:            /**
068:             * Run the test case from the command line.
069:             */
070:            public static void main(final String[] args) {
071:                main(args, suite());
072:            }
073:
074:            /**
075:             * Returns the suite of tests.
076:             */
077:            public static Test suite() {
078:                return new TestSuite(MiscellaneousWidgetTest.class);
079:            }
080:
081:            /**
082:             * Tests the {@link About} dialog.
083:             */
084:            public void testAbout() {
085:                show(new About());
086:            }
087:
088:            /**
089:             * Tests the {@link DisjointLists}.
090:             */
091:            public void testDisjointLists() {
092:                final DisjointLists test = new DisjointLists();
093:                test.addElements(Locale.getAvailableLocales());
094:                show(test);
095:            }
096:
097:            /**
098:             * Tests the {@link FormatChooser}.
099:             */
100:            public void testFormatChooser() {
101:                FormatChooser test = new FormatChooser(new AngleFormat());
102:                show(test);
103:            }
104:
105:            /**
106:             * Tests the {@link CoordinateChooser}.
107:             */
108:            public void testCoordinateChooser() {
109:                CoordinateChooser test = new CoordinateChooser();
110:                show(test);
111:            }
112:
113:            /**
114:             * Tests the {@link KernelEditor}.
115:             */
116:            public void testKernelEditor() {
117:                KernelEditor test = new KernelEditor();
118:                test.addDefaultKernels();
119:                show(test);
120:            }
121:
122:            /**
123:             * Tests the {@link GradientKernelEditor}.
124:             */
125:            public void testGradientKernelEditor() {
126:                GradientKernelEditor test = new GradientKernelEditor();
127:                test.addDefaultKernels();
128:                show(test);
129:            }
130:
131:            /**
132:             * Tests the {@link ColorRamp}.
133:             */
134:            public void testColorRamp() {
135:                ColorRamp test = new ColorRamp();
136:                final int[] ARGB = new int[256];
137:                ColorUtilities.expand(new Color[] { Color.RED, Color.ORANGE,
138:                        Color.YELLOW, Color.CYAN }, ARGB, 0, ARGB.length);
139:                test.setColors(ColorUtilities.getIndexColorModel(ARGB));
140:                show(test);
141:            }
142:
143:            /**
144:             * Tests the {@link Plot2D}.
145:             */
146:            //    public void testPlot2D() {
147:            //        final Random random = new Random();
148:            //        Plot2D test = new Plot2D(true, false);
149:            //        test.newAxis(0, "Some x values");
150:            //        test.newAxis(1, "Some y values");
151:            //        for (int j=0; j<2; j++) {
152:            //            final float[] x = new float[800];
153:            //            final float[] y = new float[800];
154:            //            for (int i=0; i<x.length; i++) {
155:            //                x[i] = i/10f;
156:            //                y[i] = (float)random.nextGaussian();
157:            //                if (i!=0) {
158:            //                    y[i] += y[i-1];
159:            //                }
160:            //            }
161:            //            test.addSeries("Random values", x, y);
162:            //        }
163:            //        test.setPaintingWhileAdjusting(true);
164:            //        show(test.createScrollPane());
165:            //    }
166:            /**
167:             * Tests the {@link ZoomPane}.
168:             */
169:            public void testZoomPane() {
170:                final Rectangle rect = new Rectangle(100, 200, 100, 93);
171:                final Polygon poly = new Polygon(new int[] { 125, 175, 150 },
172:                        new int[] { 225, 225, 268 }, 3);
173:                final ZoomPane pane = new ZoomPane(ZoomPane.UNIFORM_SCALE
174:                        | ZoomPane.TRANSLATE_X | ZoomPane.TRANSLATE_Y
175:                        | ZoomPane.ROTATE | ZoomPane.RESET
176:                        | ZoomPane.DEFAULT_ZOOM) {
177:                    public Rectangle2D getArea() {
178:                        return rect;
179:                    }
180:
181:                    protected void paintComponent(final Graphics2D graphics) {
182:                        graphics.transform(zoom);
183:                        graphics.setColor(Color.RED);
184:                        graphics.fill(poly);
185:                        graphics.setColor(Color.BLUE);
186:                        graphics.draw(poly);
187:                        graphics.draw(rect);
188:                    }
189:                };
190:                pane.setPaintingWhileAdjusting(true);
191:                show(pane, "ZoomPane");
192:            }
193:
194:            /**
195:             * Tests the {@link OperationTreeBrowser}.
196:             */
197:            public void testOperationTree() {
198:                RenderedImage image;
199:                final Float size = new Float(200);
200:                final Byte value = new Byte((byte) 10);
201:                image = ConstantDescriptor.create(size, size,
202:                        new Byte[] { value }, null);
203:                image = MultiplyConstDescriptor.create(image,
204:                        new double[] { 2 }, null);
205:                image = GradientMagnitudeDescriptor.create(image, null, null,
206:                        null);
207:                image = AddConstDescriptor.create(image, new double[] { 35 },
208:                        null);
209:                show(new OperationTreeBrowser(image));
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.