01: /*
02: * $RCSfile: RenderableCollectionRegistryMode.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:49 $
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 "renderableCollection" registry
21: * (operation) mode.
22: *
23: * @since JAI 1.1
24: */
25: public class RenderableCollectionRegistryMode extends RegistryMode {
26:
27: public static final String MODE_NAME = "renderableCollection";
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.RenderableCollectionImageFactory.class;
39:
40: try {
41: Class[] paramTypes = new Class[] { java.awt.image.renderable.ParameterBlock.class };
42:
43: factoryMethod = factoryClass
44: .getMethod("create", paramTypes);
45:
46: } catch (NoSuchMethodException e) {
47: ImagingListener listener = JAI.getDefaultInstance()
48: .getImagingListener();
49: String message = JaiI18N.getString("RegistryMode0") + " "
50: + factoryClass.getName() + ".";
51: listener.errorOccurred(message, e,
52: RenderableCollectionRegistryMode.class, false);
53: // e.printStackTrace();
54: }
55:
56: return factoryMethod;
57: }
58:
59: /**
60: * Constructor. A <code>RegistryMode</code> that represents a
61: * <code>ContextualRenderedImageFactory</code> keyed in a case
62: * insensitive fashion by the string "renderable". The "renderable"
63: * mode has no preferences but supports properties.
64: */
65: public RenderableCollectionRegistryMode() {
66:
67: super (MODE_NAME, javax.media.jai.OperationDescriptor.class,
68: getThisFactoryMethod().getReturnType(),
69: getThisFactoryMethod(), false, true);
70: }
71: }
|