net.sourceforge.spedit.core
Class XMLDocument.DocumentEvent

java.lang.Object
  |
  +--net.sourceforge.spedit.core.XMLDocument.DocumentEvent
All Implemented Interfaces:
DocumentEvent
Enclosing class:
XMLDocument

public static class XMLDocument.DocumentEvent
extends Object
implements DocumentEvent

The DocumentEvent class represents a set of modifications that have been done on the document. These modifications are located at a specific offset in the document and have a specific length.

The modifications made can be either addition, removal or replacement of an element or element content. The aggregated ElementEdit contains information on which document nodes are affected by the document event.


Inner classes inherited from class javax.swing.event.DocumentEvent
DocumentEvent.ElementChange, DocumentEvent.EventType
 
Field Summary
static DocumentEvent.EventType CHANGE
           
static DocumentEvent.EventType INSERT
           
static DocumentEvent.EventType REMOVE
           
 
Constructor Summary
XMLDocument.DocumentEvent(XMLDocument doc, int offs, int len)
          Cretes a new document event that represents a removal of len characters starting at offset offs in document doc..
XMLDocument.DocumentEvent(XMLDocument doc, int offs, String value)
          Cretes a new document event that represents an insertion of the value string at starting at offset offs in document doc..
 
Method Summary
 void addEdit(XMLDocument.ElementEdit edit)
          This actually not adds an edit but sets the ElementEdit.
 void fire()
           
 net.sourceforge.spedit.core.XMLDocument.DocumentEvent.ElementChange getChange(Element elem)
           
 Document getDocument()
           
 int getLength()
           
 int getOffset()
           
 net.sourceforge.spedit.core.XMLDocument.DocumentEvent.EventType getType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSERT

public static DocumentEvent.EventType INSERT

CHANGE

public static DocumentEvent.EventType CHANGE

REMOVE

public static DocumentEvent.EventType REMOVE
Constructor Detail

XMLDocument.DocumentEvent

public XMLDocument.DocumentEvent(XMLDocument doc,
                                 int offs,
                                 int len)
Cretes a new document event that represents a removal of len characters starting at offset offs in document doc..

XMLDocument.DocumentEvent

public XMLDocument.DocumentEvent(XMLDocument doc,
                                 int offs,
                                 String value)
Cretes a new document event that represents an insertion of the value string at starting at offset offs in document doc..
Method Detail

addEdit

public void addEdit(XMLDocument.ElementEdit edit)
This actually not adds an edit but sets the ElementEdit. Because a document event occurs at a specific location in the text only one element edit is really useful.
Parameters:
edit - Tells which element have been affected, and how, by this document event.

getChange

public net.sourceforge.spedit.core.XMLDocument.DocumentEvent.ElementChange getChange(Element elem)
Specified by:
getChange in interface DocumentEvent

getDocument

public Document getDocument()
Specified by:
getDocument in interface DocumentEvent

getLength

public int getLength()
Specified by:
getLength in interface DocumentEvent

getOffset

public int getOffset()
Specified by:
getOffset in interface DocumentEvent

getType

public net.sourceforge.spedit.core.XMLDocument.DocumentEvent.EventType getType()
Specified by:
getType in interface DocumentEvent

fire

public void fire()