-
- All Known Implementing Classes:
- AbstractDocument.DefaultDocumentEvent
public interface DocumentEvent
Interface for document change notifications. This provides detailed information to Document observers about how the Document changed. It provides high level information such as type of change and where it occurred, as well as the more detailed structural changes (What Elements were inserted and removed).- See Also:
Document
,DocumentListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interface
DocumentEvent.ElementChange
Describes changes made to a specific element.static class
DocumentEvent.EventType
Enumeration for document event types
-
Method Summary
Methods Modifier and Type Method and Description DocumentEvent.ElementChange
getChange(Element elem)
Gets the change information for the given element.Document
getDocument()
Gets the document that sourced the change event.int
getLength()
Returns the length of the change.int
getOffset()
Returns the offset within the document of the start of the change.DocumentEvent.EventType
getType()
Gets the type of event.
-
-
-
Method Detail
-
getOffset
int getOffset()
Returns the offset within the document of the start of the change.- Returns:
- the offset >= 0
-
getLength
int getLength()
Returns the length of the change.- Returns:
- the length >= 0
-
getDocument
Document getDocument()
Gets the document that sourced the change event.- Returns:
- the document
-
getType
DocumentEvent.EventType getType()
Gets the type of event.- Returns:
- the type
-
getChange
DocumentEvent.ElementChange getChange(Element elem)
Gets the change information for the given element. The change information describes what elements were added and removed and the location. If there were no changes, null is returned.This method is for observers to discover the structural changes that were made. This means that only elements that existed prior to the mutation (and still exist after the mutatino) need to have ElementChange records. The changes made available need not be recursive.
For example, if the an element is removed from it's parent, this method should report that the parent changed and provide an ElementChange implementation that describes the change to the parent. If the child element removed had children, these elements do not need to be reported as removed.
If an child element is insert into a parent element, the parent element should report a change. If the child element also had elements inserted into it (grandchildren to the parent) these elements need not report change.
- Parameters:
elem
- the element- Returns:
- the change information, or null if the element was not modified
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/event/DocumentEvent.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.