KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > imageio > metadata > IIOMetadataController


1 /*
2  * @(#)IIOMetadataController.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.imageio.metadata;
9
10 /**
11  * An interface to be implemented by objects that can determine the
12  * settings of an <code>IIOMetadata</code> object, either by putting
13  * up a GUI to obtain values from a user, or by other means. This
14  * interface merely specifies a generic <code>activate</code> method
15  * that invokes the controller, without regard for how the controller
16  * obtains values (<i>i.e.</i>, whether the controller puts up a GUI
17  * or merely computes a set of values is irrelevant to this
18  * interface).
19  *
20  * <p> Within the <code>activate</code> method, a controller obtains
21  * initial values by querying the <code>IIOMetadata</code> object's
22  * settings, either using the XML DOM tree or a plug-in specific
23  * interface, modifies values by whatever means, then modifies the
24  * <code>IIOMetadata</code> object's settings, using either the
25  * <code>setFromTree</code> or <code>mergeTree</code> methods, or a
26  * plug-in specific interface. In general, applications may expect
27  * that when the <code>activate</code> method returns
28  * <code>true</code>, the <code>IIOMetadata</code> object is ready for
29  * use in a write operation.
30  *
31  * <p> Vendors may choose to provide GUIs for the
32  * <code>IIOMetadata</code> subclasses they define for a particular
33  * plug-in. These can be set up as default controllers in the
34  * corresponding <code>IIOMetadata</code> subclasses.
35  *
36  * <p> Alternatively, an algorithmic process such as a database lookup
37  * or the parsing of a command line could be used as a controller, in
38  * which case the <code>activate</code> method would simply look up or
39  * compute the settings, call methods on <code>IIOMetadata</code> to
40  * set its state, and return <code>true</code>.
41  *
42  * @see IIOMetadata#setController
43  * @see IIOMetadata#getController
44  * @see IIOMetadata#getDefaultController
45  * @see IIOMetadata#hasController
46  * @see IIOMetadata#activateController
47  *
48  * @version 0.5
49  */

50 public interface IIOMetadataController {
51
52     /**
53      * Activates the controller. If <code>true</code> is returned,
54      * all settings in the <code>IIOMetadata</code> object should be
55      * ready for use in a write operation. If <code>false</code> is
56      * returned, no settings in the <code>IIOMetadata</code> object
57      * will be disturbed (<i>i.e.</i>, the user canceled the
58      * operation).
59      *
60      * @param metadata the <code>IIOMetadata</code> object to be modified.
61      *
62      * @return <code>true</code> if the <code>IIOMetadata</code> has been
63      * modified, <code>false</code> otherwise.
64      *
65      * @exception IllegalArgumentException if <code>metadata</code> is
66      * <code>null</code> or is not an instance of the correct class.
67      */

68     boolean activate(IIOMetadata JavaDoc metadata);
69 }
70
Popular Tags