Class EditixDocument

java.lang.Object
com.japisoft.editix.plugin.EditixDocument

public class EditixDocument
extends java.lang.Object
Here a facility class for working with one document.
Author:
Alexandre Brillant (http://www.editix.com)
  • Method Summary

    Modifier and Type Method Description
    int getCaretLocation()  
    org.w3c.dom.Document getDOMContent()  
    java.lang.String getLocation()  
    java.lang.String getTextContent()  
    java.lang.String getTextSelection()  
    java.lang.String getType()  
    javax.swing.text.JTextComponent getUIComponent()  
    void insertTextAt​(int location, java.lang.String content)
    Insert a new content at this location
    void replaceTextSelection​(java.lang.String content)
    Replace the selection by this content
    boolean save()
    Save the current document
    void setDomContent​(org.w3c.dom.Document content)  
    void setLocation​(java.lang.String location)  
    void setTextContent​(java.lang.String content)
    Replace the text content by this one.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getType

      public java.lang.String getType()
      Returns:
      The document type (DTD, CSS, XML, XSD...)
    • getLocation

      public java.lang.String getLocation()
      Returns:
      The document path
    • getCaretLocation

      public int getCaretLocation()
      Returns:
      the caret position from 0
    • setLocation

      public void setLocation​(java.lang.String location)
      Parameters:
      location - Set a default location
    • getTextContent

      public java.lang.String getTextContent()
      Returns:
      The document content as a simple text. null for no current document
    • setTextContent

      public void setTextContent​(java.lang.String content)
      Replace the text content by this one.
      Parameters:
      content - New text content.
    • getTextSelection

      public java.lang.String getTextSelection()
      Returns:
      The current selection
    • replaceTextSelection

      public void replaceTextSelection​(java.lang.String content)
      Replace the selection by this content
    • insertTextAt

      public void insertTextAt​(int location, java.lang.String content)
      Insert a new content at this location
    • getDOMContent

      public org.w3c.dom.Document getDOMContent() throws java.lang.Exception
      Returns:
      The document content as a DOM object, null is returned for no current document
      Throws:
      java.lang.Exception - if the document can't be parsed to DOM
    • setDomContent

      public void setDomContent​(org.w3c.dom.Document content) throws java.lang.Exception
      Parameters:
      content - The new document content as a DOM object
      Throws:
      java.lang.Exception - if the document can't be serialized to a text
    • getUIComponent

      public javax.swing.text.JTextComponent getUIComponent()
      Returns:
      the Swing editor used by editix, this is useful for particular UI effect
    • save

      public boolean save()
      Save the current document
      Returns:
      true if the operation is a success