KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > peer > DesktopPeer


1 /*
2  * @(#)DesktopPeer.java
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.peer;
9
10
11 import java.io.File JavaDoc;
12 import java.io.IOException JavaDoc;
13 import java.net.URI JavaDoc;
14 import java.awt.Desktop.Action JavaDoc;
15
16 /**
17  * The <code>DesktopPeer</code> interface provides methods for the operation
18  * of open, edit, print, browse and mail with the given URL or file, by
19  * launching the associated application.
20  * <p>
21  * Each platform has an implementation class for this interface.
22  *
23  */

24 public interface DesktopPeer {
25     /**
26      * Returns whether the given action is supported on the current platform.
27      * @param action the action type to be tested if it's supported on the
28      * current platform.
29      * @return <code>true</code> if the given action is supported on
30      * the current platform; <code>false</code> otherwise.
31      */

32     public boolean isSupported(Action action);
33
34     /**
35      * Launches the associated application to open the given file. The
36      * associated application is registered to be the default file viewer for
37      * the file type of the given file.
38      *
39      * @param file the given file.
40      * @throws IOException If the given file has no associated application,
41      * or the associated application fails to be launched.
42      */

43     public void open(File JavaDoc file) throws IOException JavaDoc;
44     
45     /**
46      * Launches the associated editor and opens the given file for editing. The
47      * associated editor is registered to be the default editor for the file
48      * type of the given file.
49      *
50      * @param file the given file.
51      * @throws IOException If the given file has no associated editor, or
52      * the associated application fails to be launched.
53      */

54     public void edit(File JavaDoc file) throws IOException JavaDoc;
55     
56     /**
57      * Prints the given file with the native desktop printing facility, using
58      * the associated application's print command.
59      *
60      * @param file the given file.
61      * @throws IOException If the given file has no associated application
62      * that can be used to print it.
63      */

64     public void print(File JavaDoc file) throws IOException JavaDoc;
65     
66     /**
67      * Launches the mail composing window of the user default mail client,
68      * filling the message fields including to, cc, etc, with the values
69      * specified by the given mailto URL.
70      *
71      * @param uri represents a mailto URL with specified values of the message.
72      * The syntax of mailto URL is defined by
73      * <a HREF="http://www.ietf.org/rfc/rfc2368.txt">RFC2368: The mailto
74      * URL scheme</a>
75      * @throws IOException If the user default mail client is not found,
76      * or it fails to be launched.
77      */

78     public void mail(URI JavaDoc mailtoURL) throws IOException JavaDoc;
79     
80     /**
81      * Launches the user default browser to display the given URI.
82      *
83      * @param uri the given URI.
84      * @throws IOException If the user default browser is not found,
85      * or it fails to be launched.
86      */

87     public void browse(URI JavaDoc url) throws IOException JavaDoc;
88 }
89
Popular Tags