- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- javax.swing.undo.CompoundEdit
-
- javax.swing.text.AbstractDocument.DefaultDocumentEvent
-
- All Implemented Interfaces:
-
Serializable,DocumentEvent,UndoableEdit
- Enclosing class:
- AbstractDocument
public class AbstractDocument.DefaultDocumentEvent extends CompoundEdit implements DocumentEvent
正在修改文档时存储文档更改。 随后可以在完成文档修改交易时用于更改通知。 AbstractDocument类及其扩展用于向文档侦听器广播更改信息。- 另请参见:
- 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.AbstractUndoableEdit
RedoName, UndoName
-
Fields inherited from class javax.swing.undo.CompoundEdit
edits
-
-
构造方法摘要
构造方法 Constructor 描述 DefaultDocumentEvent(int offs, int len, DocumentEvent.EventType type)构建变更记录。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 booleanaddEdit(UndoableEdit anEdit)添加文档编辑。DocumentEvent.ElementChangegetChange(Element elem)获取元素的更改。DocumentgetDocument()获取来源于更改事件的文档。intgetLength()返回更改的长度。intgetOffset()返回变更开始文档中的偏移量。StringgetPresentationName()提供适用于(例如更改日志)的此编辑的本地化,可读取的描述。StringgetRedoPresentationName()提供本编辑的可重复形式的本地化,可读的描述,例如用作重做菜单项。DocumentEvent.EventTypegetType()返回事件的类型。StringgetUndoPresentationName()提供本编辑的可撤销形式的本地化,可读的描述,例如用作撤消菜单项。booleanisSignificant()DefaultDocument事件很重要。voidredo()重做一个变化。StringtoString()返回更改事件的字符串描述。voidundo()撤消更改。-
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
-
Methods inherited from class javax.swing.undo.CompoundEdit
canRedo, canUndo, die, end, isInProgress, lastEdit
-
-
-
-
构造方法详细信息
-
DefaultDocumentEvent
public DefaultDocumentEvent(int offs, int len, DocumentEvent.EventType type)构建变更记录。- 参数
-
offs- 更改文档中的偏移量> = 0 -
len- 变更的长度> = 0 -
type- 事件的类型(DocumentEvent.EventType) - 从以下版本开始:
- 1.4
-
-
方法详细信息
-
toString
public String toString()
返回更改事件的字符串描述。- 重写:
-
toString在CompoundEdit - 结果
- 一个字符串
-
addEdit
public boolean addEdit(UndoableEdit anEdit)
添加文档编辑。 如果编辑次数超过阈值,则会切换对ElementChange实现的散列表查找,因为这些访问需要相对较快。- Specified by:
-
addEdit接口UndoableEdit - 重写:
-
addEdit在CompoundEdit - 参数
-
anEdit- 文件编辑记录 - 结果
- 如果添加了编辑,则为true
- 另请参见:
-
UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
-
redo
public void redo() throws CannotRedoException重做一个变化。- Specified by:
-
redo在接口UndoableEdit - 重写:
-
redo在CompoundEdit - 异常
-
CannotRedoException- 如果更改无法重做 - 另请参见:
-
AbstractUndoableEdit.canRedo()
-
undo
public void undo() throws CannotUndoException撤消更改。- Specified by:
-
undo在接口UndoableEdit - 重写:
-
undo在CompoundEdit - 异常
-
CannotUndoException- 如果更改无法撤消 - 另请参见:
-
AbstractUndoableEdit.canUndo()
-
isSignificant
public boolean isSignificant()
DefaultDocument事件很重要。 如果您希望聚合DefaultDocumentEvents将它们显示为用户的单个编辑,则将它们复制到CompoundEdit中。- Specified by:
-
isSignificant在接口UndoableEdit - 重写:
-
isSignificant在CompoundEdit - 结果
- 该事件是否对于编辑撤消目的是重要的
- 另请参见:
-
UndoableEdit.isSignificant()
-
getPresentationName
public String getPresentationName()
提供适用于(例如更改日志)的此编辑的本地化,可读取的描述。- Specified by:
-
getPresentationName在接口UndoableEdit - 重写:
-
getPresentationName在CompoundEdit - 结果
- 说明
- 另请参见:
-
AbstractUndoableEdit.getUndoPresentationName(),AbstractUndoableEdit.getRedoPresentationName()
-
getUndoPresentationName
public String getUndoPresentationName()
提供本编辑的可撤销形式的本地化,可读的描述,例如用作撤消菜单项。 通常派生自getDescription();- Specified by:
-
getUndoPresentationName接口UndoableEdit - 重写:
-
getUndoPresentationName在CompoundEdit - 结果
- 说明
- 另请参见:
-
AbstractUndoableEdit.getPresentationName()
-
getRedoPresentationName
public String getRedoPresentationName()
提供本编辑的可重复形式的本地化,可读的描述,例如用作重做菜单项。 通常派生自getPresentationName();- Specified by:
-
getRedoPresentationName在接口UndoableEdit - 重写:
-
getRedoPresentationName在CompoundEdit - 结果
- 说明
- 另请参见:
-
AbstractUndoableEdit.getPresentationName()
-
getType
public DocumentEvent.EventType getType()
返回事件的类型。- Specified by:
-
getType在接口DocumentEvent - 结果
- 事件类型为DocumentEvent.EventType
- 另请参见:
-
DocumentEvent.getType()
-
getOffset
public int getOffset()
返回变更开始文档中的偏移量。- Specified by:
-
getOffset在接口DocumentEvent - 结果
- offset> = 0
- 另请参见:
-
DocumentEvent.getOffset()
-
getLength
public int getLength()
返回更改的长度。- Specified by:
-
getLength在接口DocumentEvent - 结果
- 长度> = 0
- 另请参见:
-
DocumentEvent.getLength()
-
getDocument
public Document getDocument()
获取来源于更改事件的文档。- Specified by:
-
getDocument在接口DocumentEvent - 结果
- 文件
- 另请参见:
-
DocumentEvent.getDocument()
-
getChange
public DocumentEvent.ElementChange getChange(Element elem)
获取元素的更改。- Specified by:
-
getChange在接口DocumentEvent - 参数
-
elem- 元素 - 结果
- 变化
-
-