1 23 24 package org.enhydra.xml.lazydom; 25 26 import org.enhydra.apache.xerces.dom.CommentImpl; 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Node ; 29 30 33 public class LazyComment extends CommentImpl implements LazyNode { 34 40 public LazyComment(LazyDocument ownerDoc, 41 LazyComment template, 42 String data) { 43 super(ownerDoc, 44 (template != null) ? template.getData() : data); 45 if (template != null) { 46 fTemplateNode = template; 47 fNodeId = template.getNodeId(); 48 } 49 } 50 51 55 58 private LazyComment fTemplateNode = null; 59 60 64 public LazyComment getTemplateComment() { 65 return fTemplateNode; 66 } 67 68 71 public LazyNode templateClone(Document ownerDocument) { 72 return new LazyComment((LazyDocument)ownerDocument, this, null); 73 } 74 75 78 public Node cloneNode(boolean deep) { 79 return super.cloneNode(deep); 81 } 82 83 87 90 private int fNodeId = NULL_NODE_ID; 91 92 95 private boolean fIsTemplateNode; 96 97 100 public void makeTemplateNode(int nodeId) { 101 fNodeId = nodeId; 102 fIsTemplateNode = true; 103 } 104 105 108 public int getNodeId() { 109 return fNodeId; 110 } 111 112 115 public boolean isTemplateNode() { 116 return fIsTemplateNode; 117 } 118 119 122 public LazyNode getTemplateNode() { 123 return fTemplateNode; 124 } 125 126 131 public void setNodeValue(String value) { 132 fNodeId = NULL_NODE_ID; 133 super.setNodeValue(value); 134 } 135 136 } 137 | Popular Tags |