Package com.japisoft.editix.plugin
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 intgetCaretLocation()org.w3c.dom.DocumentgetDOMContent()java.lang.StringgetLocation()java.lang.StringgetTextContent()java.lang.StringgetTextSelection()java.lang.StringgetType()javax.swing.text.JTextComponentgetUIComponent()voidinsertTextAt(int location, java.lang.String content)Insert a new content at this locationvoidreplaceTextSelection(java.lang.String content)Replace the selection by this contentbooleansave()Save the current documentvoidsetDomContent(org.w3c.dom.Document content)voidsetLocation(java.lang.String location)voidsetTextContent(java.lang.String content)Replace the text content by this one.
-
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.
nullfor 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,
nullis 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:
trueif the operation is a success
-