~ubuntu-branches/ubuntu/vivid/herold/vivid

« back to all changes in this revision

Viewing changes to java/org/dbdoclet/xiphias/dom/TextImpl.java

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2012-09-20 10:00:14 UTC
  • Revision ID: package-import@ubuntu.com-20120920100014-5pcwbw2err6on8yg
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (C) 2001-2012 Michael Fuchs
 
3
 *
 
4
 * This file is part of herold.
 
5
 * 
 
6
 * herold is free software: you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation, either version 3 of the License, or
 
9
 * (at your option) any later version.
 
10
 * 
 
11
 * herold is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 * 
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with herold.  If not, see <http://www.gnu.org/licenses/>.  
 
18
 */
 
19
package org.dbdoclet.xiphias.dom;
 
20
 
 
21
import org.dbdoclet.log.Logger;
 
22
import org.w3c.dom.DOMException;
 
23
import org.w3c.dom.Text;
 
24
 
 
25
 
 
26
public class TextImpl extends CharacterDataImpl implements Text {
 
27
 
 
28
    private static Logger logger = Logger.getLogger(TextImpl.class);
 
29
 
 
30
    public TextImpl(String text, NodeImpl parent) {
 
31
 
 
32
        super();
 
33
 
 
34
        setNodeType(TEXT_NODE);
 
35
        setNodeName("#text");
 
36
        setParentNode(parent);
 
37
        setData(text);
 
38
 
 
39
        logger.debug("Text text=[" + text + "]");
 
40
    }
 
41
 
 
42
    public TextImpl(String text) {
 
43
        this(text, null);
 
44
    }
 
45
 
 
46
    /**
 
47
     * The method <code>toString</code> returns the first 24
 
48
     * characters of the text of this node.
 
49
     *
 
50
     * If the length of the text is greater than 24 characters, the
 
51
     * text is truncated and three digits are appended.
 
52
     *
 
53
     * @return a <code>String</code> value
 
54
     */
 
55
    @Override
 
56
    public String toString() {
 
57
 
 
58
        String data = getData();
 
59
        
 
60
        if ((data == null) || (data.length() == 0)) {
 
61
            return "";
 
62
        }
 
63
 
 
64
        if (data.length() < 24) {
 
65
            return data.trim();
 
66
        } else {
 
67
            return data.substring(0, 23) + "...";
 
68
        }
 
69
    }
 
70
 
 
71
    public String getWholeText() {
 
72
        // TODO Auto-generated method stub
 
73
        return null;
 
74
    }
 
75
 
 
76
    public boolean isElementContentWhitespace() {
 
77
        // TODO Auto-generated method stub
 
78
        return false;
 
79
    }
 
80
 
 
81
    public Text replaceWholeText(String content) throws DOMException {
 
82
        // TODO Auto-generated method stub
 
83
        return null;
 
84
    }
 
85
 
 
86
    public Text splitText(int offset) throws DOMException {
 
87
        // TODO Auto-generated method stub
 
88
        return null;
 
89
    }
 
90
 
 
91
}
 
92
/*
 
93
 * $Log$
 
94
 */