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. package javax.imageio.metadata;
  8. /**
  9. * An interface to be implemented by objects that can determine the
  10. * settings of an <code>IIOMetadata</code> object, either by putting
  11. * up a GUI to obtain values from a user, or by other means. This
  12. * interface merely specifies a generic <code>activate</code> method
  13. * that invokes the controller, without regard for how the controller
  14. * obtains values (<i>i.e.</i>, whether the controller puts up a GUI
  15. * or merely computes a set of values is irrelevant to this
  16. * interface).
  17. *
  18. * <p> Within the <code>activate</code> method, a controller obtains
  19. * initial values by querying the <code>IIOMetadata</code> object's
  20. * settings, either using the XML DOM tree or a plug-in specific
  21. * interface, modifies values by whatever means, then modifies the
  22. * <code>IIOMetadata</code> object's settings, using either the
  23. * <code>setFromTree</code> or <code>mergeTree</code> methods, or a
  24. * plug-in specific interface. In general, applications may expect
  25. * that when the <code>activate</code> method returns
  26. * <code>true</code>, the <code>IIOMetadata</code> object is ready for
  27. * use in a write operation.
  28. *
  29. * <p> Vendors may choose to provide GUIs for the
  30. * <code>IIOMetadata</code> subclasses they define for a particular
  31. * plug-in. These can be set up as default controllers in the
  32. * corresponding <code>IIOMetadata</code> subclasses.
  33. *
  34. * <p> Alternatively, an algorithmic process such as a database lookup
  35. * or the parsing of a command line could be used as a controller, in
  36. * which case the <code>activate</code> method would simply look up or
  37. * compute the settings, call methods on <code>IIOMetadata</code> to
  38. * set its state, and return <code>true</code>.
  39. *
  40. * @see IIOMetadata#setController
  41. * @see IIOMetadata#getController
  42. * @see IIOMetadata#getDefaultController
  43. * @see IIOMetadata#hasController
  44. * @see IIOMetadata#activateController
  45. *
  46. * @version 0.5
  47. */
  48. public interface IIOMetadataController {
  49. /**
  50. * Activates the controller. If <code>true</code> is returned,
  51. * all settings in the <code>IIOMetadata</code> object should be
  52. * ready for use in a write operation. If <code>false</code> is
  53. * returned, no settings in the <code>IIOMetadata</code> object
  54. * will be disturbed (<i>i.e.</i>, the user canceled the
  55. * operation).
  56. *
  57. * @param metadata the <code>IIOMetadata</code> object to be modified.
  58. *
  59. * @return <code>true</code> if the <code>IIOMetadata</code> has been
  60. * modified, <code>false</code> otherwise.
  61. *
  62. * @exception IllegalArgumentException if <code>metadata</code> is
  63. * <code>null</code> or is not an instance of the correct class.
  64. */
  65. boolean activate(IIOMetadata metadata);
  66. }