public static Text getRenderedTextForText(Text text) { // if (text instanceof RaveText) { // return ((RaveText)text).getRendered(); // } // if (text instanceof RaveSourceText) { if (text != null && text.getOwnerDocument() instanceof RaveSourceDocument) { // return ((RaveSourceText)text).getRenderedText(); return getRenderedText(text); // } else if (text instanceof RaveRenderedText) { // XXX } else if (text != null && text.getOwnerDocument() instanceof RaveRenderedDocument) { return text; } return null; }
public static Text getSourceTextForText(Text text) { // if (text instanceof RaveText) { // return ((RaveText)text).getSource(); // } // if (text instanceof RaveRenderedText) { if (text != null && text.getOwnerDocument() instanceof RaveRenderedDocument) { // return ((RaveRenderedText)text).getSourceText(); return getSourceText(text); // } else if (text instanceof RaveSourceText) { // XXX } else if (text != null && text.getOwnerDocument() instanceof RaveSourceDocument) { return text; } return null; }
public static void setSourceTextForText(Text text, Text sourceText) { // if (text instanceof RaveText) { // ((RaveText)text).setSource((RaveText)sourceText); // } // if (text instanceof RaveRenderedText) { if (text != null && text.getOwnerDocument() instanceof RaveRenderedDocument) { // ((RaveRenderedText)text).linkToSourceText((RaveSourceText)sourceText); linkToSourceText(text, sourceText); } }
protected void runTest() throws Throwable { DocumentBuilder builder = dbf.newDocumentBuilder(); Document document1 = builder.newDocument(); Document document2 = builder.newDocument(); Element parent = document1.createElementNS(null, "test"); Text node = document1.createTextNode("test"); parent.appendChild(node); assertSame(node, document2.adoptNode(node)); assertSame(document2, node.getOwnerDocument()); assertNull(node.getParentNode()); assertNull(parent.getFirstChild()); } }
protected void runTest() throws Throwable { DocumentBuilder builder = dbf.newDocumentBuilder(); Document document = builder.newDocument(); Element parent = document.createElementNS(null, "test"); Text node = document.createTextNode("test"); parent.appendChild(node); assertSame(node, document.adoptNode(node)); assertSame(document, node.getOwnerDocument()); assertNull(node.getParentNode()); assertNull(parent.getFirstChild()); } }
public IPropertyDescriptor createTextPropertyDescriptor(Text text) { IPropertyDescriptor result = null; Node parentNode = text.getParentNode(); if ((parentNode != null) && (parentNode.getNodeType() == Node.ELEMENT_NODE)) { Element parentElement = (Element) parentNode; ModelQuery mq = ModelQueryUtil.getModelQuery(text.getOwnerDocument()); CMElementDeclaration ed = null; if (mq != null) { ed = mq.getCMElementDeclaration(parentElement); } if (ed != null) { result = createPropertyDescriptorHelper(HACK, parentElement, ed); } else { result = createDefaultPropertyDescriptor(parentElement.getNodeName()); } } if (result == null) { result = new TextPropertyDescriptor(HACK, HACK); } return result; }