01: /*
02: * OutputBuffer.java
03: *
04: * Copyright (C) 2000-2003 Peter Graves
05: * $Id: OutputBuffer.java,v 1.4 2003/06/06 14:58:17 piso Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * 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: private OutputBuffer() {
26: supportsUndo = false;
27: type = TYPE_OUTPUT;
28: mode = PlainTextMode.getMode();
29: formatter = new PlainTextFormatter(this );
30: lineSeparator = System.getProperty("line.separator");
31: readOnly = true;
32: setTransient(true);
33: setProperty(Property.VERTICAL_RULE, 0);
34: setProperty(Property.SHOW_LINE_NUMBERS, false);
35: setProperty(Property.HIGHLIGHT_MATCHING_BRACKET, false);
36: setProperty(Property.HIGHLIGHT_BRACKETS, false);
37: setInitialized(true);
38: }
39:
40: public static OutputBuffer getOutputBuffer(String text) {
41: OutputBuffer outputBuffer = new OutputBuffer();
42: outputBuffer.setText(text);
43: return outputBuffer;
44: }
45:
46: public int load() {
47: if (!isLoaded()) {
48: if (getFirstLine() == null) {
49: appendLine("");
50: renumber();
51: }
52: setLoaded(true);
53: }
54: return LOAD_COMPLETED;
55: }
56:
57: public String getFileNameForDisplay() {
58: return title != null ? title : "";
59: }
60: }
|