Source for javax.print.ServiceUIFactory

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