Path: blob/master/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadataController.java
41153 views
/*1* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.imageio.metadata;2627/**28* An interface to be implemented by objects that can determine the29* settings of an {@code IIOMetadata} object, either by putting30* up a GUI to obtain values from a user, or by other means. This31* interface merely specifies a generic {@code activate} method32* that invokes the controller, without regard for how the controller33* obtains values (<i>i.e.</i>, whether the controller puts up a GUI34* or merely computes a set of values is irrelevant to this35* interface).36*37* <p> Within the {@code activate} method, a controller obtains38* initial values by querying the {@code IIOMetadata} object's39* settings, either using the XML DOM tree or a plug-in specific40* interface, modifies values by whatever means, then modifies the41* {@code IIOMetadata} object's settings, using either the42* {@code setFromTree} or {@code mergeTree} methods, or a43* plug-in specific interface. In general, applications may expect44* that when the {@code activate} method returns45* {@code true}, the {@code IIOMetadata} object is ready for46* use in a write operation.47*48* <p> Vendors may choose to provide GUIs for the49* {@code IIOMetadata} subclasses they define for a particular50* plug-in. These can be set up as default controllers in the51* corresponding {@code IIOMetadata} subclasses.52*53* <p> Alternatively, an algorithmic process such as a database lookup54* or the parsing of a command line could be used as a controller, in55* which case the {@code activate} method would simply look up or56* compute the settings, call methods on {@code IIOMetadata} to57* set its state, and return {@code true}.58*59* @see IIOMetadata#setController60* @see IIOMetadata#getController61* @see IIOMetadata#getDefaultController62* @see IIOMetadata#hasController63* @see IIOMetadata#activateController64*65*/66public interface IIOMetadataController {6768/**69* Activates the controller. If {@code true} is returned,70* all settings in the {@code IIOMetadata} object should be71* ready for use in a write operation. If {@code false} is72* returned, no settings in the {@code IIOMetadata} object73* will be disturbed (<i>i.e.</i>, the user canceled the74* operation).75*76* @param metadata the {@code IIOMetadata} object to be modified.77*78* @return {@code true} if the {@code IIOMetadata} has been79* modified, {@code false} otherwise.80*81* @exception IllegalArgumentException if {@code metadata} is82* {@code null} or is not an instance of the correct class.83*/84boolean activate(IIOMetadata metadata);85}868788