Package com.inet.html
Class InetHtmlDocument.ExtendedDocuementEvent
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
javax.swing.text.AbstractDocument.DefaultDocumentEvent
com.inet.html.InetHtmlDocument.ExtendedDocuementEvent
- All Implemented Interfaces:
Serializable,DocumentEvent,UndoableEdit
- Enclosing class:
- InetHtmlDocument
Extends the DefaultDocumentEvent to support the update events by grouping the changes by paragraph element. This
is required to avoid problems with the different structure of view and model.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.swing.event.DocumentEvent
DocumentEvent.ElementChange, DocumentEvent.EventType -
Field Summary
Fields inherited from class javax.swing.undo.CompoundEdit
editsFields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName -
Constructor Summary
ConstructorsConstructorDescriptionExtendedDocuementEvent(int offs, int len, int contentChangeStart, int contentChangeLen, DocumentEvent.EventType type, InetHtmlDocument document) Generates a Document event for a complex change.ExtendedDocuementEvent(int offs, int len, int contentChangeLen, DocumentEvent.EventType type, InetHtmlDocument document) Generates a Document event.ExtendedDocuementEvent(int offs, int len, DocumentEvent.EventType type, InetHtmlDocument document) Generates a Document event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEdit(UndoableEdit anEdit) Returns a list of all changes registered to this eventgetEditsFor(Element paragraph) Returns all edits forparagraphintReturns the length of the structural change.intReturns the start of the structural change.getType()booleanhasEditsFor(Element paragraph) voidredo()voidundo()Methods inherited from class javax.swing.text.AbstractDocument.DefaultDocumentEvent
getChange, getDocument, getLength, getOffset, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, toStringMethods inherited from class javax.swing.undo.CompoundEdit
canRedo, canUndo, die, end, isInProgress, lastEditMethods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
-
Constructor Details
-
ExtendedDocuementEvent
public ExtendedDocuementEvent(int offs, int len, DocumentEvent.EventType type, InetHtmlDocument document) Generates a Document event.- Parameters:
offs- the offset into the document of the change >= 0len- the length of the change >= 0type- the type of event (DocumentEvent.EventType)document- The enclosing document
-
ExtendedDocuementEvent
public ExtendedDocuementEvent(int offs, int len, int contentChangeLen, DocumentEvent.EventType type, InetHtmlDocument document) Generates a Document event.- Parameters:
offs- the offset within the document where the structural change startslen- the length of the change structural >= 0contentChangeLen- the length of content added/removedtype- the type of event (DocumentEvent.EventType)document- The enclosing document
-
ExtendedDocuementEvent
public ExtendedDocuementEvent(int offs, int len, int contentChangeStart, int contentChangeLen, DocumentEvent.EventType type, InetHtmlDocument document) Generates a Document event for a complex change. The difference between the user and the change length is due to the required structural changes. E.g. a simple removal a the end of a line- Parameters:
offs- the original start offset as defined by the user/caretlen- original length of the change as defined by the user/caretcontentChangeStart- the first position where something is different now, must be <= offsetcontentChangeLen- the length of the actual change, must be >= lentype- the type of event (DocumentEvent.EventType)document- The enclosing document
-
-
Method Details
-
getStructureChangeLen
public int getStructureChangeLen()Returns the length of the structural change. If the content change length is not explicitly set, it returns the normal getLength()- Returns:
- the structure or content change length
-
getStructureChangeStart
public int getStructureChangeStart()Returns the start of the structural change. If the content start length is not explicitly set, it returns the normal getOffset()- Returns:
- the structure or content change start
-
addEdit
- Specified by:
addEditin interfaceUndoableEdit- Overrides:
addEditin classAbstractDocument.DefaultDocumentEvent
-
getAllChanges
Returns a list of all changes registered to this event- Returns:
- a list of all changes registered to this event
-
hasEditsFor
- Parameters:
paragraph- The paragraph to get the edits for- Returns:
- true, if any element edits are registered for this paragraph
-
getEditsFor
Returns all edits forparagraph- Parameters:
paragraph- The paragraph to get the edits for- Returns:
- all edits for
paragraphor null if none were registered
-
getType
- Specified by:
getTypein interfaceDocumentEvent- Overrides:
getTypein classAbstractDocument.DefaultDocumentEvent
-
undo
- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin classAbstractDocument.DefaultDocumentEvent- Throws:
CannotUndoException
-
redo
- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classAbstractDocument.DefaultDocumentEvent- Throws:
CannotUndoException
-