KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > windows > OutputWriter


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.openide.windows;
21
22 import java.io.IOException JavaDoc;
23 import java.io.PrintWriter JavaDoc;
24 import java.io.Writer JavaDoc;
25
26 /**
27 * A PrintWriter subclass for writing to a tab in the output window. To
28 * create hyperlinked lines, call <code>println</code>, passing an instance
29 * of {@link org.openide.windows.OutputListener} which should be called when a line is
30 * clicked or the caret in the output window enters it.
31 *
32 * @author Ales Novak
33 * @version 0.13 Feb 24, 1997
34 */

35 public abstract class OutputWriter extends PrintWriter JavaDoc {
36     /** Make an output writer.
37     * @param w the underlying writer
38     */

39     protected OutputWriter (Writer JavaDoc w) {
40         super(w);
41     }
42
43     /** Print a line which will be displayed as a hyperlink, calling the
44     * passed {@link org.openide.windows.OutputListener} if it is clicked, if the caret
45     * enters it, or if the enter key is pressed over it.
46     *
47     *
48     * @param s a string to print to the tab
49     * @param l a listener that will receive events about this line
50     * @throws IOException if the string could not be printed
51     */

52     public abstract void println(String JavaDoc s, OutputListener l) throws IOException JavaDoc;
53
54     /** Print a line which will be displayed as a hyperlink, calling the
55      * passed {@link org.openide.windows.OutputListener} if it is clicked, if the caret
56      * enters it, or if the enter key is pressed over it.
57      *
58      * Implementors of this class
59      * are encouraged to override this method, which is not abstract for backward
60      * compatibility reasons only.
61      *
62      * @param s a string to print to the tab
63      * @param l a listener that will receive events about this line
64      * @param important mark the line as important.
65      * Makes the UI respond appropriately, eg. stop the automatic scrolling
66      * or highlight the hyperlink.
67      * @throws IOException if the string could not be printed
68      * @since 1.5
69      */

70     public void println(String JavaDoc s, OutputListener l, boolean important) throws IOException JavaDoc {
71         println(s, l);
72     }
73     
74     /** Clear the output pane.
75     * Expect this method to be deprecated in a future release and an
76     * equivalent created in {@link org.openide.windows.InputOutput}. It is ambiguous what it means
77     * to reset stdout but not stderr, etc. For the current implementation, reset
78     * should be called on the stdout.
79     *
80     * @throws IOException if there is a problem
81     */

82     public abstract void reset() throws IOException JavaDoc;
83 }
84
Popular Tags