站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

BaseDocumentEvent (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

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)
           
 char[] getChars()
          Deprecated.  
 String getDrawLayerName()
           
 int getDrawLayerVisibility()
           
 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

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.


getDrawLayerName

public String getDrawLayerName()

getDrawLayerVisibility

public int getDrawLayerVisibility()

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/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.