01: /**
02: * LibreSource
03: * Copyright (C) 2004-2008 Artenum SARL / INRIA
04: * http://www.libresource.org - contact@artenum.com
05: *
06: * This file is part of the LibreSource software,
07: * which can be used and distributed under license conditions.
08: * The license conditions are provided in the LICENSE.TXT file
09: * at the root path of the packaging that enclose this file.
10: * More information can be found at
11: * - http://dev.libresource.org/home/license
12: *
13: * Initial authors :
14: *
15: * Guillaume Bort / INRIA
16: * Francois Charoy / Universite Nancy 2
17: * Julien Forest / Artenum
18: * Claude Godart / Universite Henry Poincare
19: * Florent Jouille / INRIA
20: * Sebastien Jourdain / INRIA / Artenum
21: * Yves Lerumeur / Artenum
22: * Pascal Molli / Universite Henry Poincare
23: * Gerald Oster / INRIA
24: * Mariarosa Penzi / Artenum
25: * Gerard Sookahet / Artenum
26: * Raphael Tani / INRIA
27: *
28: * Contributors :
29: *
30: * Stephane Bagnier / Artenum
31: * Amadou Dia / Artenum-IUP Blois
32: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33: */package org.libresource.so6.core.conflict.editor;
34:
35: import java.io.Writer;
36:
37: import java.util.Iterator;
38:
39: /**
40: * @author smack
41: */
42: public class TextNode extends AbstractNode {
43: public TextNode() {
44: super ();
45: }
46:
47: public String getText() {
48: StringBuffer buffer = new StringBuffer();
49:
50: for (Iterator i = lines.iterator(); i.hasNext();) {
51: buffer.append(i.next());
52:
53: if (i.hasNext()) {
54: buffer.append("\n");
55: }
56: }
57:
58: return buffer.toString();
59: }
60:
61: public String getHTMLText() {
62: StringBuffer buffer = new StringBuffer();
63: buffer.append("<html>");
64:
65: for (Iterator i = lines.iterator(); i.hasNext();) {
66: buffer.append(i.next());
67:
68: if (i.hasNext()) {
69: buffer.append("<br>");
70: }
71: }
72:
73: buffer.append("</html>");
74:
75: return buffer.toString();
76: }
77:
78: public boolean getAllowsChildren() {
79: return false;
80: }
81:
82: public void toDocument(Writer writer, int depth) throws Exception {
83: if (enabled) {
84: for (Iterator i = lines.iterator(); i.hasNext();) {
85: writePadding(writer, depth);
86: writer.write((String) i.next());
87:
88: if (i.hasNext()) {
89: writer.write("\n");
90: }
91: }
92:
93: writer.flush();
94: }
95: }
96:
97: public void compute() {
98: }
99: }
|