001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.openide.windows;
043:
044: import java.io.IOException;
045: import java.io.PrintWriter;
046: import java.io.Writer;
047:
048: /**
049: * A PrintWriter subclass for writing to a tab in the output window. To
050: * create hyperlinked lines, call <code>println</code>, passing an instance
051: * of {@link org.openide.windows.OutputListener} which should be called when a line is
052: * clicked or the caret in the output window enters it.
053: *
054: * @author Ales Novak
055: * @version 0.13 Feb 24, 1997
056: */
057: public abstract class OutputWriter extends PrintWriter {
058: /** Make an output writer.
059: * @param w the underlying writer
060: */
061: protected OutputWriter(Writer w) {
062: super (w);
063: }
064:
065: /** Print a line which will be displayed as a hyperlink, calling the
066: * passed {@link org.openide.windows.OutputListener} if it is clicked, if the caret
067: * enters it, or if the enter key is pressed over it.
068: *
069: *
070: * @param s a string to print to the tab
071: * @param l a listener that will receive events about this line
072: * @throws IOException if the string could not be printed
073: */
074: public abstract void println(String s, OutputListener l)
075: throws IOException;
076:
077: /** Print a line which will be displayed as a hyperlink, calling the
078: * passed {@link org.openide.windows.OutputListener} if it is clicked, if the caret
079: * enters it, or if the enter key is pressed over it.
080: *
081: * Implementors of this class
082: * are encouraged to override this method, which is not abstract for backward
083: * compatibility reasons only.
084: *
085: * @param s a string to print to the tab
086: * @param l a listener that will receive events about this line
087: * @param important mark the line as important.
088: * Makes the UI respond appropriately, eg. stop the automatic scrolling
089: * or highlight the hyperlink.
090: * @throws IOException if the string could not be printed
091: * @since 1.5
092: */
093: public void println(String s, OutputListener l, boolean important)
094: throws IOException {
095: println(s, l);
096: }
097:
098: /** Clear the output pane.
099: * Expect this method to be deprecated in a future release and an
100: * equivalent created in {@link org.openide.windows.InputOutput}. It is ambiguous what it means
101: * to reset stdout but not stderr, etc. For the current implementation, reset
102: * should be called on the stdout.
103: *
104: * @throws IOException if there is a problem
105: */
106: public abstract void reset() throws IOException;
107: }
|