Save This Page
Home » openjdk-7 » java » awt » peer » [javadoc | source]
    1   /*
    2    * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package java.awt.peer;
   27   
   28   
   29   import java.io.File;
   30   import java.io.IOException;
   31   import java.net.URI;
   32   import java.awt.Desktop.Action;
   33   
   34   /**
   35    * The <code>DesktopPeer</code> interface provides methods for the operation
   36    * of open, edit, print, browse and mail with the given URL or file, by
   37    * launching the associated application.
   38    * <p>
   39    * Each platform has an implementation class for this interface.
   40    *
   41    */
   42   public interface DesktopPeer {
   43       /**
   44        * Returns whether the given action is supported on the current platform.
   45        * @param action the action type to be tested if it's supported on the
   46        *        current platform.
   47        * @return <code>true</code> if the given action is supported on
   48        *         the current platform; <code>false</code> otherwise.
   49        */
   50       public boolean isSupported(Action action);
   51   
   52       /**
   53        * Launches the associated application to open the given file. The
   54        * associated application is registered to be the default file viewer for
   55        * the file type of the given file.
   56        *
   57        * @param file the given file.
   58        * @throws IOException If the given file has no associated application,
   59        *         or the associated application fails to be launched.
   60        */
   61       public void open(File file) throws IOException;
   62   
   63       /**
   64        * Launches the associated editor and opens the given file for editing. The
   65        * associated editor is registered to be the default editor for the file
   66        * type of the given file.
   67        *
   68        * @param file the given file.
   69        * @throws IOException If the given file has no associated editor, or
   70        *         the associated application fails to be launched.
   71        */
   72       public void edit(File file) throws IOException;
   73   
   74       /**
   75        * Prints the given file with the native desktop printing facility, using
   76        * the associated application's print command.
   77        *
   78        * @param file the given file.
   79        * @throws IOException If the given file has no associated application
   80        *         that can be used to print it.
   81        */
   82       public void print(File file) throws IOException;
   83   
   84       /**
   85        * Launches the mail composing window of the user default mail client,
   86        * filling the message fields including to, cc, etc, with the values
   87        * specified by the given mailto URL.
   88        *
   89        * @param uri represents a mailto URL with specified values of the message.
   90        *        The syntax of mailto URL is defined by
   91        *        <a href="http://www.ietf.org/rfc/rfc2368.txt">RFC2368: The mailto
   92        *        URL scheme</a>
   93        * @throws IOException If the user default mail client is not found,
   94        *         or it fails to be launched.
   95        */
   96       public void mail(URI mailtoURL) throws IOException;
   97   
   98       /**
   99        * Launches the user default browser to display the given URI.
  100        *
  101        * @param uri the given URI.
  102        * @throws IOException If the user default browser is not found,
  103        *         or it fails to be launched.
  104        */
  105       public void browse(URI url) throws IOException;
  106   }

Save This Page
Home » openjdk-7 » java » awt » peer » [javadoc | source]