001/* 002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved. 003 * 004 * This software is open source. 005 * See the bottom of this file for the licence. 006 * 007 * $Id: DefaultText.java,v 1.6 2001/06/20 18:59:23 jstrachan Exp $ 008 */ 009 010package org.dom4j.tree; 011 012import org.dom4j.Element; 013 014/** <p><code>DefaultText</code> is the default Text implementation. 015 * It is a doubly linked node which supports the parent relationship 016 * and can be modified in place.</p> 017 * 018 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> 019 * @version $Revision: 1.6 $ 020 */ 021public class DefaultText extends FlyweightText { 022 023 /** The parent of this node */ 024 private Element parent; 025 026 /** @param text is the Text text 027 */ 028 public DefaultText(String text) { 029 super(text); 030 } 031 032 /** @param parent is the parent element 033 * @param text is the Text text 034 */ 035 public DefaultText(Element parent,String text) { 036 super(text); 037 this.parent = parent; 038 } 039 040 public void setText(String text) { 041 this.text = text; 042 } 043 044 public Element getParent() { 045 return parent; 046 } 047 048 public void setParent(Element parent) { 049 this.parent = parent; 050 } 051 052 public boolean supportsParent() { 053 return true; 054 } 055 056 public boolean isReadOnly() { 057 return false; 058 } 059 060} 061 062 063 064 065/* 066 * Redistribution and use of this software and associated documentation 067 * ("Software"), with or without modification, are permitted provided 068 * that the following conditions are met: 069 * 070 * 1. Redistributions of source code must retain copyright 071 * statements and notices. Redistributions must also contain a 072 * copy of this document. 073 * 074 * 2. Redistributions in binary form must reproduce the 075 * above copyright notice, this list of conditions and the 076 * following disclaimer in the documentation and/or other 077 * materials provided with the distribution. 078 * 079 * 3. The name "DOM4J" must not be used to endorse or promote 080 * products derived from this Software without prior written 081 * permission of MetaStuff, Ltd. For written permission, 082 * please contact dom4j-info@metastuff.com. 083 * 084 * 4. Products derived from this Software may not be called "DOM4J" 085 * nor may "DOM4J" appear in their names without prior written 086 * permission of MetaStuff, Ltd. DOM4J is a registered 087 * trademark of MetaStuff, Ltd. 088 * 089 * 5. Due credit should be given to the DOM4J Project 090 * (http://dom4j.org/). 091 * 092 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS 093 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 094 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 095 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 096 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 097 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 098 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 099 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 103 * OF THE POSSIBILITY OF SUCH DAMAGE. 104 * 105 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved. 106 * 107 * $Id: DefaultText.java,v 1.6 2001/06/20 18:59:23 jstrachan Exp $ 108 */