Source Code Cross Referenced for CRIFRegistry.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » media » jai » registry » 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 » 6.0 JDK Modules » Java Advanced Imaging » javax.media.jai.registry 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: CRIFRegistry.java,v $
003:         *
004:         * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * Use is subject to license terms.
007:         *
008:         * $Revision: 1.1 $
009:         * $Date: 2005/02/11 04:57:47 $
010:         * $State: Exp $
011:         */
012:        package javax.media.jai.registry;
013:
014:        import java.awt.image.RenderedImage;
015:        import java.awt.image.renderable.ContextualRenderedImageFactory;
016:        import java.awt.image.renderable.ParameterBlock;
017:        import java.awt.image.renderable.RenderContext;
018:        import java.util.Vector;
019:        import javax.media.jai.JAI;
020:        import javax.media.jai.OperationNode;
021:        import javax.media.jai.OperationRegistry;
022:        import javax.media.jai.PropertySource;
023:        import javax.media.jai.RenderableOp;
024:
025:        /**
026:         * Utility class to provide type-safe interaction
027:         * with the <code>OperationRegistry</code> for
028:         * <code>ContextualRenderedImageFactory</code> objects.
029:         *
030:         * If the <code>OperationRegistry</code> is <code>null</code>, then
031:         * <code>JAI.getDefaultInstance().getOperationRegistry()</code> will be used.
032:         *
033:         * @since JAI 1.1
034:         */
035:        public final class CRIFRegistry {
036:
037:            private static final String MODE_NAME = RenderableRegistryMode.MODE_NAME;
038:
039:            /**
040:             * Register a CRIF with a particular operation against
041:             * a specified mode. This is JAI 1.0.x equivalent of
042:             * <code>registry.registerCRIF(...)</code>
043:             *
044:             * @param registry the <code>OperationRegistry</code> to register with.
045:             *         if this is <code>null</code>, then <code>
046:             *         JAI.getDefaultInstance().getOperationRegistry()</code>
047:             *         will be used.
048:             * @param operationName the operation name as a <code>String</code>
049:             * @param crif the <code>ContextualRenderedImageFactory</code> to be registered
050:             *
051:             * @throws IllegalArgumentException if operationName or crif is
052:             *		    <code>null</code>
053:             * @throws IllegalArgumentException if there is no <code>
054:             *             OperationDescriptor</code> registered against
055:             *             the <code>operationName</code>
056:             */
057:            public static void register(OperationRegistry registry,
058:                    String operationName, ContextualRenderedImageFactory crif) {
059:
060:                registry = (registry != null) ? registry : JAI
061:                        .getDefaultInstance().getOperationRegistry();
062:
063:                registry.registerFactory(MODE_NAME, operationName, null, crif);
064:            }
065:
066:            /**
067:             * Unregister a CRIF previously registered with an operation
068:             * against the specified mode.
069:             *
070:             * @param registry the <code>OperationRegistry</code> to unregister from.
071:             *         if this is <code>null</code>, then <code>
072:             *         JAI.getDefaultInstance().getOperationRegistry()</code>
073:             *         will be used.
074:             * @param operationName the operation name as a <code>String</code>
075:             * @param crif the <code>ContextualRenderedImageFactory</code> to be unregistered
076:             *
077:             * @throws IllegalArgumentException if operationName or crif is
078:             *		    <code>null</code>
079:             * @throws IllegalArgumentException if there is no <code>
080:             *             OperationDescriptor</code> registered against
081:             *             the <code>operationName</code>
082:             * @throws IllegalArgumentException if the crif was not previously
083:             *             registered against operationName
084:             */
085:            public static void unregister(OperationRegistry registry,
086:                    String operationName, ContextualRenderedImageFactory crif) {
087:
088:                registry = (registry != null) ? registry : JAI
089:                        .getDefaultInstance().getOperationRegistry();
090:
091:                registry
092:                        .unregisterFactory(MODE_NAME, operationName, null, crif);
093:            }
094:
095:            /**
096:             * Returns the <code>ContextualRenderedImageFactory</code> object
097:             * registered against the operation name.
098:             *
099:             * @param registry the <code>OperationRegistry</code> to use.
100:             *         if this is <code>null</code>, then <code>
101:             *         JAI.getDefaultInstance().getOperationRegistry()</code>
102:             *         will be used.
103:             * @param operationName the operation name as a <code>String</code>
104:             *
105:             * @return a registered <code>ContextualRenderedImageFactory</code> object
106:             *
107:             * @throws IllegalArgumentException if operationName is <code>null</code>
108:             * @throws IllegalArgumentException if there is no <code>
109:             *             OperationDescriptor</code> registered against
110:             *             the <code>operationName</code>
111:             */
112:            public static ContextualRenderedImageFactory get(
113:                    OperationRegistry registry, String operationName) {
114:
115:                registry = (registry != null) ? registry : JAI
116:                        .getDefaultInstance().getOperationRegistry();
117:
118:                return (ContextualRenderedImageFactory) registry.getFactory(
119:                        MODE_NAME, operationName);
120:            }
121:
122:            /**
123:             * Creates a rendering, given a RenderContext and a ParameterBlock
124:             * containing the operation's sources and parameters. The registry
125:             * is used to determine the CRIF to be used to instantiate the
126:             * operation.
127:             *
128:             * @param registry the <code>OperationRegistry</code> to use.
129:             *         if this is <code>null</code>, then <code>
130:             *         JAI.getDefaultInstance().getOperationRegistry()</code>
131:             *         will be used.
132:             * @param operationName the operation name as a <code>String</code>
133:             * @param context a <code>RenderContext</code> object containing
134:             *         the rendering context.
135:             * @param paramBlock the operation's ParameterBlock.
136:             *
137:             * @throws IllegalArgumentException if operationName is <code>null</code>
138:             * @throws IllegalArgumentException if there is no <code>
139:             *             OperationDescriptor</code> registered against
140:             *             the <code>operationName</code>
141:             */
142:            public static RenderedImage create(OperationRegistry registry,
143:                    String operationName, RenderContext context,
144:                    ParameterBlock paramBlock) {
145:
146:                registry = (registry != null) ? registry : JAI
147:                        .getDefaultInstance().getOperationRegistry();
148:
149:                Object args[] = { context, paramBlock };
150:
151:                return (RenderedImage) registry.invokeFactory(MODE_NAME,
152:                        operationName, args);
153:            }
154:
155:            /**
156:             * Constructs and returns a <code>PropertySource</code> suitable for
157:             * use by a given <code>RenderableOp</code>.  The 
158:             * <code>PropertySource</code> includes properties copied from prior
159:             * nodes as well as those generated at the node itself. Additionally, 
160:             * property suppression is taken into account. The actual implementation
161:             * of <code>getPropertySource()</code> may make use of deferred
162:             * execution and caching.
163:             *
164:             * @param op the <code>RenderableOp</code> requesting its 
165:             *        <code>PropertySource</code>.
166:             *
167:             * @throws IllegalArgumentException if <code>op</code> is <code>null</code>
168:             */
169:            public static PropertySource getPropertySource(RenderableOp op) {
170:
171:                if (op == null)
172:                    throw new IllegalArgumentException("op - "
173:                            + JaiI18N.getString("Generic0"));
174:
175:                return op.getRegistry().getPropertySource((OperationNode) op);
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.