Class DomText

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.w3c.dom.CharacterData, org.w3c.dom.Node, org.w3c.dom.Text
    Direct Known Subclasses:
    DomCDataSection

    public class DomText
    extends DomCharacterData
    implements org.w3c.dom.Text
    Representation of a text node in the HTML DOM.
    See Also:
    Serialized Form
    • Field Detail

      • NODE_NAME

        public static final java.lang.String NODE_NAME
        The symbolic node name.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DomText

        public DomText​(SgmlPage page,
                       java.lang.String data)
        Creates an instance of DomText.
        Parameters:
        page - the Page that contains this element
        data - the string data held by this node
    • Method Detail

      • splitText

        public DomText splitText​(int offset)
        Specified by:
        splitText in interface org.w3c.dom.Text
      • createSplitTextNode

        protected DomText createSplitTextNode​(int offset)
        Creates a new text node split from another text node. This method allows the derived type of the new text node to match the original node type.
        Parameters:
        offset - the character position at which to split the DomText node
        Returns:
        the newly created Text node
      • isElementContentWhitespace

        public boolean isElementContentWhitespace()
        Not yet implemented.
        Specified by:
        isElementContentWhitespace in interface org.w3c.dom.Text
      • getWholeText

        public java.lang.String getWholeText()
        Specified by:
        getWholeText in interface org.w3c.dom.Text
      • replaceWholeText

        public org.w3c.dom.Text replaceWholeText​(java.lang.String content)
                                          throws org.w3c.dom.DOMException
        Not yet implemented.
        Specified by:
        replaceWholeText in interface org.w3c.dom.Text
        Throws:
        org.w3c.dom.DOMException
      • getNodeType

        public short getNodeType()
        Description copied from class: DomNode
        Returns this node's node type.
        Specified by:
        getNodeType in interface org.w3c.dom.Node
        Specified by:
        getNodeType in class DomNode
        Returns:
        the node type constant, in this case Node.TEXT_NODE
      • getNodeName

        public java.lang.String getNodeName()
        Description copied from class: DomNode
        Returns this node's node name.
        Specified by:
        getNodeName in interface org.w3c.dom.Node
        Specified by:
        getNodeName in class DomNode
        Returns:
        the node name, in this case NODE_NAME
      • printXml

        protected void printXml​(java.lang.String indent,
                                java.io.PrintWriter printWriter)
        Recursively writes the XML data for the node tree starting at node.
        Overrides:
        printXml in class DomNode
        Parameters:
        indent - white space to indent child nodes
        printWriter - writer where child nodes are written
      • toString

        public java.lang.String toString()
        Gives a simple representation to facilitate debugging.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a simple representation
      • isTrimmedText

        protected boolean isTrimmedText()
        Returns a flag indicating whether or not this node should have any leading and trailing whitespace removed when DomNode.asText() is called. This method should usually return true, but must return false for such things as text formatting tags.
        Overrides:
        isTrimmedText in class DomNode
        Returns:
        a flag indicating whether or not this node should have any leading and trailing whitespace removed when DomNode.asText() is called
      • doType

        protected void doType​(char c,
                              HtmlElement htmlElement,
                              boolean lastType)
        Performs the effective type action, called after the keyPress event and before the keyUp event.
        Parameters:
        c - the character you with to simulate typing
        htmlElement - the element in which typing occurs
        lastType - is this the last character to type
      • doType

        protected void doType​(int keyCode,
                              HtmlElement htmlElement,
                              boolean lastType)
        Performs the effective type action, called after the keyPress event and before the keyUp event.
        Parameters:
        keyCode - the key code wish to simulate typing
        htmlElement - the element in which typing occurs
        lastType - is this the last character to type
      • acceptChar

        protected boolean acceptChar​(char c)
        Indicates if the provided character can by "typed" in the element.
        Parameters:
        c - the character
        Returns:
        true if it is accepted
      • cloneNode

        public DomNode cloneNode​(boolean deep)
        Specified by:
        cloneNode in interface org.w3c.dom.Node
        Overrides:
        cloneNode in class DomNode
      • moveSelectionToEnd

        public void moveSelectionToEnd()
        Moves the selection to the end.
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        Specified by:
        setPrefix in interface org.w3c.dom.Node