KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > armedbear > j > OutputBuffer


1 /*
2  * OutputBuffer.java
3  *
4  * Copyright (C) 2000-2003 Peter Graves
5  * $Id: OutputBuffer.java,v 1.4 2003/06/06 14:58:17 piso Exp $
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */

21
22 package org.armedbear.j;
23
24 public final class OutputBuffer extends Buffer
25 {
26     private OutputBuffer()
27     {
28         supportsUndo = false;
29         type = TYPE_OUTPUT;
30         mode = PlainTextMode.getMode();
31         formatter = new PlainTextFormatter(this);
32         lineSeparator = System.getProperty("line.separator");
33         readOnly = true;
34         setTransient(true);
35         setProperty(Property.VERTICAL_RULE, 0);
36         setProperty(Property.SHOW_LINE_NUMBERS, false);
37         setProperty(Property.HIGHLIGHT_MATCHING_BRACKET, false);
38         setProperty(Property.HIGHLIGHT_BRACKETS, false);
39         setInitialized(true);
40     }
41
42     public static OutputBuffer getOutputBuffer(String JavaDoc text)
43     {
44         OutputBuffer outputBuffer = new OutputBuffer();
45         outputBuffer.setText(text);
46         return outputBuffer;
47     }
48
49     public int load()
50     {
51         if (!isLoaded()) {
52             if (getFirstLine() == null) {
53                 appendLine("");
54                 renumber();
55             }
56             setLoaded(true);
57         }
58         return LOAD_COMPLETED;
59     }
60
61     public String JavaDoc getFileNameForDisplay()
62     {
63         return title != null ? title : "";
64     }
65 }
66
Popular Tags