Class DomText

All Implemented Interfaces:
Serializable, Cloneable, CharacterData, Node, Text
Direct Known Subclasses:
DomCDataSection

public class DomText extends DomCharacterData implements Text
Representation of a text node in the HTML DOM.
See Also:
  • Field Details

  • Constructor Details

    • DomText

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

    • splitText

      public DomText splitText(int offset)
      Specified by:
      splitText in interface 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 Text
    • getWholeText

      public String getWholeText()
      Specified by:
      getWholeText in interface Text
    • replaceWholeText

      public Text replaceWholeText(String content) throws DOMException
      Not yet implemented.
      Specified by:
      replaceWholeText in interface Text
      Throws:
      DOMException
    • getNodeType

      public short getNodeType()
      Specified by:
      getNodeType in interface Node
      Returns:
      the node type constant, in this case Node.TEXT_NODE
    • getNodeName

      public String getNodeName()
      Specified by:
      getNodeName in interface Node
      Returns:
      the node name, in this case NODE_NAME
    • printXml

      protected void printXml(String indent, 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 String toString()
      Gives a simple representation to facilitate debugging.
      Overrides:
      toString in class Object
      Returns:
      a simple representation
    • 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 Node
      Overrides:
      cloneNode in class DomNode
    • moveSelectionToEnd

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

      public void setPrefix(String prefix)
      Specified by:
      setPrefix in interface Node