Source Code Cross Referenced for LocationStyleContent.java in  » GIS » udig-1.1 » net » refractions » udig » printing » ui » 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 » udig 1.1 » net.refractions.udig.printing.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    uDig - User Friendly Desktop Internet GIS client
003:         *    http://udig.refractions.net
004:         *    (C) 2004, Refractions Research Inc.
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package net.refractions.udig.printing.ui;
018:
019:        import java.awt.Color;
020:        import java.awt.Rectangle;
021:        import java.io.IOException;
022:        import java.net.URL;
023:
024:        import net.refractions.udig.catalog.IGeoResource;
025:        import net.refractions.udig.project.StyleContent;
026:
027:        import org.eclipse.core.runtime.IProgressMonitor;
028:        import org.eclipse.ui.IMemento;
029:
030:        /**
031:         * Rectangle indicating Location in device coordinates, w & h in 1/72 of an inch.
032:         * <p>
033:         * <b>Screen Coordinates</b> are used. This naturally changes to Page
034:         * Coordinates when printed.
035:         * </p>
036:         * <p>
037:         * The x,y position are considered in a realtive fashion.
038:         * <ul>
039:         * <li>x positive: measured from the left edge of the screen or paper
040:         * <li>y positive: measured from the top edge of the screen or paper
041:         * <li>x negative: measured from the bottom edge of the screen or paper
042:         * <li>z negative: measured from the right edge of the screen or paper
043:         * </ul>
044:         * This allows a map graphic to be specified relative to any edge.
045:         * </p>
046:         * <p>
047:         * The width and height of the Rectangle indicate the requested size in terms
048:         * of Java's usual one pixel indicates 1/72 of an inch. Appropriate scaling
049:         * will be needed when page output is requested.
050:         * </p>
051:         * @author Richard Gould
052:         * @since 0.6.0
053:         */
054:        public class LocationStyleContent extends StyleContent {
055:            /** extension id */
056:            public static final String ID = "net.refractions.udig.printing.ui.locationStyle"; //$NON-NLS-1$
057:
058:            /** padding constants */
059:            public static final int YPAD_BOTTOM = 5;
060:            public static final int YPAD_TOP = 15;
061:            public static final int XPAD_LEFT = 5;
062:            public static final int XPAD_RIGHT = 50;
063:
064:            /**
065:             * Location style holding a rectangle.
066:             */
067:            public LocationStyleContent() {
068:                super (ID);
069:            }
070:
071:            public Class getStyleClass() {
072:                return Rectangle.class;
073:            }
074:
075:            public Object load(IMemento memento) {
076:                int x = memento.getInteger("x"); //$NON-NLS-1$
077:                int y = memento.getInteger("y"); //$NON-NLS-1$
078:                int width = memento.getInteger("w"); //$NON-NLS-1$
079:                int height = memento.getInteger("h"); //$NON-NLS-1$
080:
081:                return new Rectangle(x, y, width, height);
082:            }
083:
084:            public void save(IMemento memento, Object style) {
085:                Rectangle rectangle = (Rectangle) style;
086:                memento.putInteger("x", rectangle.x); //$NON-NLS-1$
087:                memento.putInteger("y", rectangle.y); //$NON-NLS-1$
088:                memento.putInteger("w", rectangle.width); //$NON-NLS-1$
089:                memento.putInteger("h", rectangle.height); //$NON-NLS-1$
090:            }
091:
092:            /* (non-Javadoc)
093:             * @see net.refractions.udig.project.StyleContent#createDefaultStyle(net.refractions.udig.catalog.IGeoResource)
094:             */
095:            public Object createDefaultStyle(IGeoResource resource,
096:                    Color colour, IProgressMonitor monitor) throws IOException {
097:                if (!resource.canResolve(ScalebarMapGraphic.class))
098:                    return null;
099:
100:                return createDefaultStyle();
101:            }
102:
103:            /*
104:             * @see net.refractions.udig.project.StyleContent#load(java.net.URL)
105:             */
106:            public Object load(URL url, IProgressMonitor monitor)
107:                    throws IOException {
108:                return null;
109:            }
110:
111:            /**
112:             * TODO summary sentence for createDefaultStyle ...
113:             * 
114:             * @return
115:             */
116:            public static Rectangle createDefaultStyle() {
117:                return new Rectangle(XPAD_LEFT, YPAD_TOP, 100, 10);
118:            }
119:
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.