01: /*
02: * $RCSfile: CollectionRegistryMode.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:57:47 $
10: * $State: Exp $
11: */
12: package javax.media.jai.registry;
13:
14: import java.lang.reflect.Method;
15: import javax.media.jai.JAI;
16: import javax.media.jai.RegistryMode;
17: import javax.media.jai.util.ImagingListener;
18:
19: /**
20: * A class that provides information about the "rendered" registry
21: * (operation) mode.
22: *
23: * @since JAI 1.1
24: */
25: public class CollectionRegistryMode extends RegistryMode {
26:
27: public static final String MODE_NAME = "collection";
28:
29: // The Method used to "create" objects from this factory.
30: private static Method factoryMethod = null;
31:
32: private static Method getThisFactoryMethod() {
33:
34: if (factoryMethod != null)
35: return factoryMethod;
36:
37: // The factory Class that this registry mode represents.
38: Class factoryClass = javax.media.jai.CollectionImageFactory.class;
39:
40: try {
41: Class[] paramTypes = new Class[] {
42: java.awt.image.renderable.ParameterBlock.class,
43: java.awt.RenderingHints.class };
44:
45: factoryMethod = factoryClass
46: .getMethod("create", paramTypes);
47:
48: } catch (NoSuchMethodException e) {
49: ImagingListener listener = JAI.getDefaultInstance()
50: .getImagingListener();
51: String message = JaiI18N.getString("RegistryMode0") + " "
52: + factoryClass.getName() + ".";
53: listener.errorOccurred(message, e,
54: CollectionRegistryMode.class, false);
55: // e.printStackTrace();
56: }
57:
58: return factoryMethod;
59: }
60:
61: /**
62: * Constructor. A <code>RegistryMode</code> that represents
63: * a <code>CollectionImageFactory</code> keyed by "collection"
64: */
65: public CollectionRegistryMode() {
66:
67: super (MODE_NAME, javax.media.jai.OperationDescriptor.class,
68: getThisFactoryMethod().getReturnType(),
69: getThisFactoryMethod(), true, true);
70: }
71: }
|