ServiceUIFactory.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* ServiceUIFactory.java --
  2. Copyright (C) 2004, 2006 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.print;
  32. /**
  33. * <code>ServiceUIFactory</code> enables print services to provide additional
  34. * user interface dialogs.
  35. * <p>
  36. * A print service may provide a <code>ServiceUIFactory</code> implementation
  37. * if its <code>getServiceUIFactory()</code> method is called. If a factory
  38. * object is returned it can be queried for provided user interface dialogs.
  39. * Different roles are defined to denote dialogs providing informations about
  40. * the print service, dialogs for administration of a print service and for
  41. * end-user browsing dialogs.
  42. * </p><p>
  43. * The factory can support providing these UI roles in different dialog types
  44. * (AWT, Swing, JComponent, Panel). The support and use of Swing interfaces is
  45. * however preferred.
  46. * </p>
  47. *
  48. * @author Michael Koch
  49. */
  50. public abstract class ServiceUIFactory
  51. {
  52. /** A user interface providing informations about the print service. */
  53. public static final int ABOUT_UIROLE = 1;
  54. /** A user interface to administer the print service. */
  55. public static final int ADMIN_UIROLE = 2;
  56. /** A user interface for end-user browsing of the print service. */
  57. public static final int MAIN_UIROLE = 3;
  58. /** Role IDs greater than this may be used for other private roles. */
  59. public static final int RESERVED_UIROLE = 99;
  60. /** Identifies a UI provided as an AWT dialog. */
  61. public static final String DIALOG_UI = "java.awt.Dialog";
  62. /** Identifies a UI provided as a Swing JComponent. */
  63. public static final String JCOMPONENT_UI = "javax.swing.JComponent";
  64. /** Identifies a UI provided as a Swing JDialog. */
  65. public static final String JDIALOG_UI = "javax.swing.JDialog";
  66. /** Identifies a UI provided as an AWT Panel. */
  67. public static final String PANEL_UI = "java.awt.Panel";
  68. /**
  69. * Constructs a <code>ServiceUIFactory</code> object.
  70. */
  71. public ServiceUIFactory()
  72. {
  73. // Do nothing here.
  74. }
  75. /**
  76. * Returns an UI object which may be cast to the requested UI type.
  77. *
  78. * @param role the role requested. Must be one of the standard roles
  79. * or a private role supported by this factory
  80. * @param ui type in which the role is requested
  81. *
  82. * @return the UI role or null of this role is not supported by this factory
  83. *
  84. * @throws IllegalArgumentException if <code>role</code> is neither one of
  85. * the standard ones nor a private one supported by this factory
  86. */
  87. public abstract Object getUI(int role, String ui);
  88. /**
  89. * Returns the UI types supported by this factory for an UI role.
  90. *
  91. * @param role the role to be looked up
  92. *
  93. * @return an array of UI types
  94. *
  95. * @throws IllegalArgumentException if <code>role</code> is neither one of
  96. * the standard ones nor a private one supported by this factory
  97. */
  98. public abstract String[] getUIClassNamesForRole(int role);
  99. }