Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 124   Methods: 17
NCLOC: 86   Classes: 1
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
DomText.java 0% 0% 0% 0%
 1   
 /*
 2   
  * JBind
 3   
  *
 4   
  * Copyright (c) by Stefan Wachter. All rights reserved.
 5   
  *
 6   
  * Usage, modification, and redistribution is subject to license terms that are
 7   
  * available at 'http://www.jbind.org'. The JBind license is like the
 8   
  * 'Apache Software License V 1.1'.
 9   
  */
 10   
 package org.jbind.xml.dom3.core;
 11   
 
 12   
 import java.util.Collections;
 13   
 import java.util.ListIterator;
 14   
 
 15   
 import org.jbind.util.other.StrBuffer;
 16   
 import org.jbind.xml.core.base.ITextContentProvider;
 17   
 import org.jbind.xml.core.bridge.IDataImplVisitor;
 18   
 import org.jbind.xml.core.data.IAnyTypeData;
 19   
 import org.jbind.xml.dom3.types.IDomDocument;
 20   
 import org.jbind.xml.dom3.types.IDomText;
 21   
 import org.jbind.xml.dom3.types.IDomVisitor;
 22   
 import org.jbind.xml.msg.XmlException;
 23   
 import org.w3c.dom.Node;
 24   
 import org.w3c.dom.Text;
 25   
 
 26   
 public class DomText extends DomCharacterData implements IDomText {
 27   
 
 28   
   private ITextContentProvider myTextContentProvider = null;
 29   
 
 30  0
   public DomText(IDomDocument aDomDocument, ITextContentProvider aTextContentProvider) {
 31  0
     super(aDomDocument);
 32  0
     myTextContentProvider = aTextContentProvider;
 33   
   }
 34   
 
 35   
   /**
 36   
    * Creates the data buffer on demand.
 37   
    *
 38   
    * @return <i>(required)</i>.
 39   
    */
 40  0
   protected StrBuffer getDataBuffer() {
 41  0
     StrBuffer res = super.getDataBuffer();
 42  0
     if (null == res) {
 43  0
       res = new StrBuffer(myTextContentProvider.getTextContent_());
 44  0
       setDataBuffer(res);
 45   
     }
 46  0
     return res;
 47   
   }
 48   
 
 49  0
   public DomText(IDomDocument aDomDocument, String aData) {
 50  0
     super(aDomDocument, aData);
 51   
   }
 52   
 
 53  0
   protected DomText(IDomText aDomText, boolean aDeep) {
 54  0
     super(aDomText, aDeep);
 55   
   }
 56   
 
 57  0
   public String getNodeName() {
 58  0
     return "#text";
 59   
   }
 60   
 
 61  0
   public short getNodeType() {
 62  0
     return TEXT_NODE;
 63   
   }
 64   
 
 65  0
   public Node cloneNode(boolean aDeep) {
 66  0
     return new DomText(this, aDeep);
 67   
   }
 68   
 
 69  0
   public org.w3c.dom.Text splitText(int offset) throws org.w3c.dom.DOMException {
 70  0
     checkMutability();
 71  0
     if ((offset < 0) || (offset > getLength())) {
 72  0
       throw new DomException(DomException.INDEX_SIZE_ERR);
 73   
     }
 74  0
     String s = substringData(offset);
 75  0
     deleteData(offset);
 76  0
     DomText text = new DomText(myOwnerDocument, s);
 77  0
     if (null != myParentNode) {
 78  0
       myParentNode.insertAfter(this, text);
 79   
     }
 80  0
     return text;
 81   
   }
 82   
 
 83  0
   public String getWholeText() {
 84   
     // TODO
 85   
     assert false : "nyi";
 86  0
     return null;
 87   
   }
 88   
 
 89  0
   public Text replaceWholeText(String aString) {
 90   
     // TODO
 91   
     assert false : "nyi";
 92  0
     return null;
 93   
   }
 94   
 
 95  0
   public boolean getIsWhitespaceInElementContent() {
 96   
     // TODO
 97   
     assert false : "nyi";
 98  0
     return false;
 99   
   }
 100   
 
 101  0
   protected void doBeforeAccept(IDomVisitor aDomVisitor) {
 102  0
     aDomVisitor.visitTextStart(this);
 103   
   }
 104  0
   protected void doAfterAccept(IDomVisitor aDomVisitor) {
 105  0
     aDomVisitor.visitTextEnd(this);
 106   
   }
 107   
 
 108  0
   public IAnyTypeData getAttributeData(String aNamespace, String aLocalName) {
 109  0
     return null;
 110   
   }
 111   
 
 112  0
   public ListIterator iterElementData(String aNamespace, String aLocalName) {
 113  0
     return Collections.EMPTY_LIST.listIterator();
 114   
   }
 115   
 
 116  0
   public boolean hasTextContent() {
 117  0
     return (null != myTextContentProvider) || (getDataBuffer().length() > 0);
 118   
   }
 119   
 
 120  0
   public void accept(IDataImplVisitor aVisitor) throws XmlException {
 121  0
     aVisitor.visitTextImpl(this);
 122   
   }
 123   
 }
 124