com.japisoft.xmlpad.bean
Class DefaultXMLDocument

java.lang.Object
  |
  +--javax.swing.text.AbstractDocument
        |
        +--javax.swing.text.PlainDocument
              |
              +--com.japisoft.xmlpad.bean.DefaultXMLDocument
All Implemented Interfaces:
javax.swing.text.Document, java.io.Serializable

public class DefaultXMLDocument
extends javax.swing.text.PlainDocument

Main document for the XMLEditor bean

Version:
1.1
See Also:
Serialized Form

Nested Class Summary
 class DefaultXMLDocument.XMLDocumentListener
          An implementation of DocumentListener that inserts and deletes lines from the token marker's state.remove
 
Field Summary
 
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
DefaultXMLDocument(XMLEditor editor)
          Creates a new DefaultXMLDocument instance.
 
Method Summary
 void enableStructureDamagedSupport(boolean structure)
          Support notification for an XML structure tree change like adding or removing a tag
 java.lang.Integer[] getCommentDelimiters(int offset)
          The starting and stopping comment position or null if no comment is found
 XMLEditor getEditor()
           
 java.lang.String[] getXMLPath(int location)
           
 void insertString(int offset, java.lang.String str, javax.swing.text.AttributeSet a)
           
 boolean isAutoCloseTag()
          by default true
 boolean isEnableStructureDamagedSupport()
          Support notification for an XML structure tree change like adding or removing a tag
 boolean isInsideTag(int offset)
           
 boolean isSyntaxPopup()
          Enable a popup for < and &, by default true
 int nextTag(int from)
          Find the location of the next tag
 boolean parseDTD()
          Search and parse document DTD
 void remove(int offs, int len)
           
 void setAutoCloseTag(boolean autoClose)
          Support for automatically closing the current inserted tag
 void setStructureDamagedListener(StructureDamagedListener listener)
          Listener for XML tree changes
 void setSyntaxPopup(boolean popup)
          Enable a popup while entering < or &
 
Methods inherited from class javax.swing.text.PlainDocument
getDefaultRootElement, getParagraphElement
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultXMLDocument

public DefaultXMLDocument(XMLEditor editor)
Creates a new DefaultXMLDocument instance.

Method Detail

getEditor

public XMLEditor getEditor()
Returns:
the editor using this document

setStructureDamagedListener

public void setStructureDamagedListener(StructureDamagedListener listener)
Listener for XML tree changes


nextTag

public int nextTag(int from)
Find the location of the next tag


getXMLPath

public java.lang.String[] getXMLPath(int location)
Returns:
the XMLPath from the caret location

enableStructureDamagedSupport

public void enableStructureDamagedSupport(boolean structure)
Support notification for an XML structure tree change like adding or removing a tag


isEnableStructureDamagedSupport

public boolean isEnableStructureDamagedSupport()
Support notification for an XML structure tree change like adding or removing a tag


setAutoCloseTag

public void setAutoCloseTag(boolean autoClose)
Support for automatically closing the current inserted tag


isAutoCloseTag

public boolean isAutoCloseTag()
by default true


setSyntaxPopup

public void setSyntaxPopup(boolean popup)
Enable a popup while entering < or &


isSyntaxPopup

public boolean isSyntaxPopup()
Enable a popup for < and &, by default true


isInsideTag

public boolean isInsideTag(int offset)
Returns:
true if the offset is inside a tag

getCommentDelimiters

public java.lang.Integer[] getCommentDelimiters(int offset)
The starting and stopping comment position or null if no comment is found

Parameters:
offset - Current document location
Returns:
start and stop location

insertString

public void insertString(int offset,
                         java.lang.String str,
                         javax.swing.text.AttributeSet a)
                  throws javax.swing.text.BadLocationException
Specified by:
insertString in interface javax.swing.text.Document
Overrides:
insertString in class javax.swing.text.PlainDocument
javax.swing.text.BadLocationException

parseDTD

public boolean parseDTD()
Search and parse document DTD


remove

public void remove(int offs,
                   int len)
            throws javax.swing.text.BadLocationException
Specified by:
remove in interface javax.swing.text.Document
Overrides:
remove in class javax.swing.text.AbstractDocument
javax.swing.text.BadLocationException