001    /* ServiceUIFactory.java --
002       Copyright (C) 2004, 2006 Free Software Foundation, Inc.
003    
004    This file is part of GNU Classpath.
005    
006    GNU Classpath is free software; you can redistribute it and/or modify
007    it under the terms of the GNU General Public License as published by
008    the Free Software Foundation; either version 2, or (at your option)
009    any later version.
010    
011    GNU Classpath is distributed in the hope that it will be useful, but
012    WITHOUT ANY WARRANTY; without even the implied warranty of
013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014    General Public License for more details.
015    
016    You should have received a copy of the GNU General Public License
017    along with GNU Classpath; see the file COPYING.  If not, write to the
018    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019    02110-1301 USA.
020    
021    Linking this library statically or dynamically with other modules is
022    making a combined work based on this library.  Thus, the terms and
023    conditions of the GNU General Public License cover the whole
024    combination.
025    
026    As a special exception, the copyright holders of this library give you
027    permission to link this library with independent modules to produce an
028    executable, regardless of the license terms of these independent
029    modules, and to copy and distribute the resulting executable under
030    terms of your choice, provided that you also meet, for each linked
031    independent module, the terms and conditions of the license of that
032    module.  An independent module is a module which is not derived from
033    or based on this library.  If you modify this library, you may extend
034    this exception to your version of the library, but you are not
035    obligated to do so.  If you do not wish to do so, delete this
036    exception statement from your version. */
037    
038    
039    package javax.print;
040    
041    /**
042     * <code>ServiceUIFactory</code> enables print services to provide additional
043     * user interface dialogs.
044     * <p>
045     * A print service may provide a <code>ServiceUIFactory</code> implementation
046     * if its <code>getServiceUIFactory()</code> method is called. If a factory
047     * object is returned it can be queried for provided user interface dialogs.
048     * Different roles are defined to denote dialogs providing informations about
049     * the print service, dialogs for administration of a print service and for
050     * end-user browsing dialogs.
051     * </p><p>
052     * The factory can support providing these UI roles in different dialog types
053     * (AWT, Swing, JComponent, Panel). The support and use of Swing interfaces is
054     * however preferred.
055     * </p>
056     *
057     * @author Michael Koch
058     */
059    public abstract class ServiceUIFactory
060    {
061      /** A user interface providing informations about the print service. */
062      public static final int ABOUT_UIROLE = 1;
063    
064      /** A user interface to administer the print service. */
065      public static final int ADMIN_UIROLE = 2;
066    
067      /** A user interface for end-user browsing of the print service. */
068      public static final int MAIN_UIROLE = 3;
069    
070      /** Role IDs greater than this may be used for other private roles. */
071      public static final int RESERVED_UIROLE = 99;
072    
073      /** Identifies a UI provided as an AWT dialog. */
074      public static final String DIALOG_UI = "java.awt.Dialog";
075    
076      /** Identifies a UI provided as a Swing JComponent. */
077      public static final String JCOMPONENT_UI = "javax.swing.JComponent";
078    
079      /** Identifies a UI provided as a Swing JDialog. */
080      public static final String JDIALOG_UI = "javax.swing.JDialog";
081    
082      /** Identifies a UI provided as an AWT Panel. */
083      public static final String PANEL_UI = "java.awt.Panel";
084    
085      /**
086       * Constructs a <code>ServiceUIFactory</code> object.
087       */
088      public ServiceUIFactory()
089      {
090            // Do nothing here.
091      }
092    
093      /**
094       * Returns an UI object which may be cast to the requested UI type.
095       *
096       * @param role the role requested. Must be one of the standard roles
097       * or a private role supported by this factory
098       * @param ui type in which the role is requested
099       *
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);
118    }