org.netbeans.modules.editor.lib/3 3.23.0 19

org.netbeans.editor
Class BaseDocumentEvent

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.text.AbstractDocument.DefaultDocumentEvent
              extended by org.netbeans.editor.BaseDocumentEvent
All Implemented Interfaces:
Serializable, DocumentEvent, UndoableEdit
Direct Known Subclasses:
GuardedDocumentEvent

public class BaseDocumentEvent
extends AbstractDocument.DefaultDocumentEvent

Document implementation

See Also:
Serialized Form

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
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
BaseDocumentEvent(BaseDocument doc, int offset, int length, DocumentEvent.EventType type)
          Construct document event instance.
 
Method Summary
 boolean addEdit(UndoableEdit anEdit)
           
 boolean canMerge(BaseDocumentEvent evt)
          Returns true if this event can be merged by the previous one (given as parameter) in the undo-manager queue.
 boolean canRedo()
          Returns false if isInProgress or if super does.
 boolean canUndo()
           
 void die()
           
 void end()
           
protected  UndoableEdit findEdit(Class editClass)
           
 DocumentEvent.ElementChange getChange(Element elem)
           
 AttributeSet getChangeAttributes()
          Gets the attributes associated with the change that caused this event.
 char[] getChars()
          Deprecated.  
 int getLFCount()
          Get the count of '\n' (line-feeds) contained in the inserted/removed text.
 int getLine()
          Deprecated.  
 String getRedoPresentationName()
           
 int getSyntaxUpdateOffset()
          Get the offset at which the updating of the syntax stopped so there are no more changes in the tokens after this point.
 String getText()
          Get the text that was inserted/removed or null for change event.
 String getUndoPresentationName()
           
 boolean isInProgress()
           
 boolean isInRedo()
          Whether this event is being fired because it's being redone.
 boolean isInUndo()
          Whether this event is being fired because it's being undone.
 void redo()
           
 boolean replaceEdit(UndoableEdit anEdit)
          Try to determine whether this event can replace the old one.
 String toString()
           
 void undo()
           
 
Methods inherited from class javax.swing.text.AbstractDocument.DefaultDocumentEvent
getDocument, getLength, getOffset, getPresentationName, getType, isSignificant
 
Methods inherited from class javax.swing.undo.CompoundEdit
lastEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseDocumentEvent

public BaseDocumentEvent(BaseDocument doc,
                         int offset,
                         int length,
                         DocumentEvent.EventType type)
Construct document event instance.

Parameters:
offset - position in the document where the insert/remove/change occured
length - number of the characters affected by the event
type - type of the event - INSERT/REMOVE/CHANGE
Method Detail

getChangeAttributes

public final AttributeSet getChangeAttributes()
Gets the attributes associated with the change that caused this event. If no attributes were associated with the document change, this method may return null;

Returns:
The AttributeSet associated with the document change or null.
Since:
1.17

findEdit

protected UndoableEdit findEdit(Class editClass)

getChars

public char[] getChars()
Deprecated. 

Gets the characters that were inserted/removed or null for change event. Characters must be used only in readonly mode as the character array is shared by all listeners and also by modification event itself.


getText

public String getText()
Get the text that was inserted/removed or null for change event.


getLine

public int getLine()
Deprecated. 

Get the line at which the insert/remove occured.


getLFCount

public int getLFCount()
Get the count of '\n' (line-feeds) contained in the inserted/removed text.


getSyntaxUpdateOffset

public int getSyntaxUpdateOffset()
Get the offset at which the updating of the syntax stopped so there are no more changes in the tokens after this point.


isInUndo

public boolean isInUndo()
Whether this event is being fired because it's being undone.


isInRedo

public boolean isInRedo()
Whether this event is being fired because it's being redone.


undo

public void undo()
          throws CannotUndoException
Specified by:
undo in interface UndoableEdit
Overrides:
undo in class AbstractDocument.DefaultDocumentEvent
Throws:
CannotUndoException

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractDocument.DefaultDocumentEvent
Throws:
CannotRedoException

addEdit

public boolean addEdit(UndoableEdit anEdit)
Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class AbstractDocument.DefaultDocumentEvent

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class CompoundEdit

canRedo

public boolean canRedo()
Returns false if isInProgress or if super does.

Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class CompoundEdit
See Also:
isInProgress()

isInProgress

public boolean isInProgress()
Overrides:
isInProgress in class CompoundEdit

getUndoPresentationName

public String getUndoPresentationName()
Specified by:
getUndoPresentationName in interface UndoableEdit
Overrides:
getUndoPresentationName in class AbstractDocument.DefaultDocumentEvent

getRedoPresentationName

public String getRedoPresentationName()
Specified by:
getRedoPresentationName in interface UndoableEdit
Overrides:
getRedoPresentationName in class AbstractDocument.DefaultDocumentEvent

canMerge

public boolean canMerge(BaseDocumentEvent evt)
Returns true if this event can be merged by the previous one (given as parameter) in the undo-manager queue.


replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
Try to determine whether this event can replace the old one. This is used to batch the one-letter modifications into larger parts (words) and undoing/redoing them at once. This method returns true whether

Specified by:
replaceEdit in interface UndoableEdit
Overrides:
replaceEdit in class AbstractUndoableEdit

die

public void die()
Specified by:
die in interface UndoableEdit
Overrides:
die in class CompoundEdit

end

public void end()
Overrides:
end in class CompoundEdit

getChange

public DocumentEvent.ElementChange getChange(Element elem)
Specified by:
getChange in interface DocumentEvent
Overrides:
getChange in class AbstractDocument.DefaultDocumentEvent

toString

public String toString()
Overrides:
toString in class AbstractDocument.DefaultDocumentEvent

org.netbeans.modules.editor.lib/3 3.23.0 19

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.