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

    1   /*
    2    * Copyright (c) 2005, Oracle and/or its affiliates. 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.  Oracle designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22    * or visit www.oracle.com if you need additional information or have any
   23    * 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} 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       /**
   45        * Returns whether the given action is supported on the current platform.
   46        * @param action the action type to be tested if it's supported on the
   47        *        current platform.
   48        * @return {@code true} if the given action is supported on
   49        *         the current platform; {@code false} otherwise.
   50        */
   51       boolean isSupported(Action action);
   52   
   53       /**
   54        * Launches the associated application to open the given file. The
   55        * associated application is registered to be the default file viewer for
   56        * the file type of the given file.
   57        *
   58        * @param file the given file.
   59        * @throws IOException If the given file has no associated application,
   60        *         or the associated application fails to be launched.
   61        */
   62       void open(File file) throws IOException;
   63   
   64       /**
   65        * Launches the associated editor and opens the given file for editing. The
   66        * associated editor is registered to be the default editor for the file
   67        * type of the given file.
   68        *
   69        * @param file the given file.
   70        * @throws IOException If the given file has no associated editor, or
   71        *         the associated application fails to be launched.
   72        */
   73       void edit(File file) throws IOException;
   74   
   75       /**
   76        * Prints the given file with the native desktop printing facility, using
   77        * the associated application's print command.
   78        *
   79        * @param file the given file.
   80        * @throws IOException If the given file has no associated application
   81        *         that can be used to print it.
   82        */
   83       void print(File file) throws IOException;
   84   
   85       /**
   86        * Launches the mail composing window of the user default mail client,
   87        * filling the message fields including to, cc, etc, with the values
   88        * specified by the given mailto URL.
   89        *
   90        * @param uri represents a mailto URL with specified values of the message.
   91        *        The syntax of mailto URL is defined by
   92        *        <a href="http://www.ietf.org/rfc/rfc2368.txt">RFC2368: The mailto
   93        *        URL scheme</a>
   94        * @throws IOException If the user default mail client is not found,
   95        *         or it fails to be launched.
   96        */
   97       void mail(URI mailtoURL) throws IOException;
   98   
   99       /**
  100        * Launches the user default browser to display the given URI.
  101        *
  102        * @param uri the given URI.
  103        * @throws IOException If the user default browser is not found,
  104        *         or it fails to be launched.
  105        */
  106       void browse(URI url) throws IOException;
  107   }

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