本文整理汇总了Java中javax.swing.event.UndoableEditListener类的典型用法代码示例。如果您正苦于以下问题:Java UndoableEditListener类的具体用法?Java UndoableEditListener怎么用?Java UndoableEditListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UndoableEditListener类属于javax.swing.event包,在下文中一共展示了UndoableEditListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formAncestorAdded
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
if (addedUndoListener) {
return;
}
addedUndoListener = true;
if (evt.getComponent() instanceof Container) {
Container anc = (Container) evt.getComponent();
while (anc != null && anc instanceof Container) {
if (anc instanceof UndoableEditListener) {
editSupport.addUndoableEditListener((UndoableEditListener) anc);
break;
}
anc = anc.getParent();
}
}
}
示例2: formAncestorAdded
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void formAncestorAdded(final javax.swing.event.AncestorEvent evt) {// GEN-FIRST:event_formAncestorAdded
if (addedUndoListener) {
return;
}
addedUndoListener = true;
if (evt.getComponent() instanceof Container) {
Container anc = evt.getComponent();
while ((anc != null) && (anc instanceof Container)) {
if (anc instanceof UndoableEditListener) {
editSupport.addUndoableEditListener((UndoableEditListener) anc);
break;
}
anc = anc.getParent();
}
}
}
示例3: formAncestorAdded
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {// GEN-FIRST:event_formAncestorAdded
if (addedUndoListener) {
return;
}
addedUndoListener = true;
if (evt.getComponent() instanceof Container) {
Container anc = evt.getComponent();
while ((anc != null) && (anc instanceof Container)) {
if (anc instanceof UndoableEditListener) {
editSupport.addUndoableEditListener((UndoableEditListener) anc);
break;
}
anc = anc.getParent();
}
}
}
示例4: formAncestorAdded
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void formAncestorAdded(final javax.swing.event.AncestorEvent evt) {// GEN-FIRST:event_formAncestorAdded
if (addedUndoListener) {
return;
}
addedUndoListener = true;
if (evt.getComponent() instanceof Container) {
Container anc = evt.getComponent();
while ((anc != null) && (anc instanceof Container)) {
if (anc instanceof UndoableEditListener) {
editSupport.addUndoableEditListener((UndoableEditListener) anc);
break;
}
anc = anc.getParent();
}
}
}
示例5: formAncestorAdded
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
if (addedUndoListener) {
return;
}
addedUndoListener = true;
if (evt.getComponent() instanceof Container) {
Container anc = (Container) evt.getComponent();
while (anc != null && anc instanceof Container) {
if (anc instanceof UndoableEditListener) {
editSupport.addUndoableEditListener((UndoableEditListener) anc);
break;
}
anc = anc.getParent();
}
}
}
示例6: formAncestorAdded
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
if ( addedUndoListener ){
return;
}
addedUndoListener = true;
if ( evt.getComponent() instanceof Container ){
Container anc = (Container)evt.getComponent();
while ( anc != null && anc instanceof Container ){
if ( anc instanceof UndoableEditListener ){
editSupport.addUndoableEditListener((UndoableEditListener)anc);
break;
}
anc = anc.getParent();
}
}
}
示例7: XMLTextEditor
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/** Creates a new instance of XMLEditorPane */
public XMLTextEditor() {
super();
XMLEditorKit kit = new XMLEditorKit();
setEditorKitForContentType(XMLEditorKit.XML_MIME_TYPE, kit);
setContentType(XMLEditorKit.XML_MIME_TYPE);
setBackground(Color.white);
//setFont(new Font("Monospaced", Font.PLAIN, 12));
// add undoable edit
undoManager = new UndoManager();
UndoableEditListener undoableEditHandler = new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent e) {
undoManager.addEdit(e.getEdit());
}
};
getDocument().addUndoableEditListener(undoableEditHandler);
}
示例8: SemanticAnnotation
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/** Creates new form SemanticAnnotation */
public SemanticAnnotation(String inputFile) {
this.inputFile = inputFile;
initComponents();
readInputFile();
spinner.setValue(0);
selectButton.doClick();
splitPane.setDividerLocation(0.5);
outText.getDocument().addUndoableEditListener(
new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent e) {
undoManager.addEdit(e.getEdit());
}
});
}
示例9: testUndoOnSetters
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/**
* The setters on the DSType uses a different method to set properties than the
* one used in testUndoAndRedo. This confirms that the setters do create undo and
* redo edits.
*/
public void testUndoOnSetters() throws Exception {
final JDBCDataSourceType dsType = new JDBCDataSourceType();
class TestUndoableEditListener implements UndoableEditListener {
private int editCount = 0;
public void undoableEditHappened(UndoableEditEvent e) {
editCount++;
}
public int getEditCount() {
return editCount;
}
}
TestUndoableEditListener undoableEditListener = new TestUndoableEditListener();
dsType.addUndoableEditListener(undoableEditListener);
dsType.setComment("comment");
dsType.setDDLGeneratorClass("class");
dsType.setName("name");
assertEquals(3, undoableEditListener.getEditCount());
}
示例10: initUndoManager
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/**
* This method is called from within the constructor to initialise the undo
* manager for the text pane.
*/
private void initUndoManager() {
undoF = new UndoManager();
undoF.setLimit(5000);
doc.addUndoableEditListener(new UndoableEditListener() {
@Override
public void undoableEditHappened(UndoableEditEvent evt) {
undoF.addEdit(evt.getEdit());
// adding a "*" to the file name, when the file has changed but not saved
if (jframe.getFileTabCount() != 0 && jframe.getSelectedPath().indexOf("*") == -1) {
jframe.setSelectedTitle(subPath + "*");
jframe.setTitle(jframe.getJifVersion() + " - " + jframe.getSelectedPath());
}
}
});
}
示例11: init
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
private void init() {
basusSyntaxDocument = new BasusSyntaxDocument();
setStyledDocument(basusSyntaxDocument);
undoManager = new UndoManager();
getDocument().addUndoableEditListener(new UndoableEditListener() {
@Override
public void undoableEditHappened(final UndoableEditEvent e) {
if (!basusSyntaxDocument.isHighlighting()) {
undoManager.addEdit(e.getEdit());
notifyProvider();
}
}
});
getDocument().addDocumentListener(this);
addKeyListener(this);
final ActionMap am = getActionMap();
am.put(DefaultEditorKit.insertBreakAction, new AutoIndentAction());
}
示例12: SyntaxDocument
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
public SyntaxDocument(Lexer lexer) {
super();
putProperty(PlainDocument.tabSizeAttribute, 4); // outside ?!
this.lexer = lexer;
// Listen for undo and redo events
addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent event) {
if (event.getEdit().isSignificant()) {
undo.addEdit(event.getEdit());
}
}
});
}
示例13: ComponentEditorManager
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/**
* Creates actions for editing the petri net
*
* @param controller PIPE application controller
*/
public ComponentEditorManager(PipeApplicationController controller) {
copyAction = new CopyAction(controller);
pasteAction = new PasteAction(controller);
cutAction = new CutAction(controller);
deleteAction = new DeleteAction(controller);
undoAction = new UndoAction(controller);
redoAction = new RedoAction(controller, undoAction);
undoAction.registerRedoAction(redoAction);
undoAction.setEnabled(false);
redoAction.setEnabled(false);
UndoableEditListener listener = new SimpleUndoListener(redoAction, undoAction, controller);
deleteAction.addUndoableEditListener(listener);
copyAction.addUndoableEditListener(listener);
cutAction.addUndoableEditListener(listener);
pasteAction.addUndoableEditListener(listener);
storeEnabledStatus();
}
示例14: PetriNetController
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/**
* Constructor
* @param model underlying Petri net
* @param undoListener undo listener for tool bar buttons undo actions
* @param animator Petri net animator
* @param copyPasteManager copy paste manager for the Petri net
* @param zoomController zoom controller for the Petri net
* @param petriNetTab tab this Petri net is displayed on
*/
public PetriNetController(PetriNet model, UndoableEditListener undoListener, GUIAnimator animator,
CopyPasteManager copyPasteManager, ZoomController zoomController,
PetriNetTab petriNetTab) {
petriNet = model;
this.undoListener = undoListener;
this.petriNetTab = petriNetTab;
selectionManager = new SelectionManager(this);
lastSavedNet = ClonePetriNet.clone(model);
this.zoomController = zoomController;
this.animator = animator;
this.copyPasteManager = copyPasteManager;
if (model.getTokens().size() > 0) {
selectedToken = model.getTokens().iterator().next().getId();
}
placeNamer = new PlaceNamer(model);
transitionNamer = new TransitionNamer(model);
}
示例15: registerTab
import javax.swing.event.UndoableEditListener; //导入依赖的package包/类
/**
* Register the tab to the Petri net
* @param net Petri net
* @param tab tab which houses the graphical petri net components
* @param historyObserver listener for stepback/forward events in animation
* @param undoListener listener for undo/redo events
* @param zoomListener listener for zoom events
*/
//TODO: THIS IS RATHER UGLY, too many params but better than what was here before
public void registerTab(PetriNet net, PetriNetTab tab, Observer historyObserver, UndoableEditListener undoListener,
PropertyChangeListener zoomListener) {
AnimationHistoryImpl animationHistory = new AnimationHistoryImpl();
animationHistory.addObserver(historyObserver);
GUIAnimator animator = new GUIAnimator(new PetriNetAnimator(net), animationHistory, this);
CopyPasteManager copyPasteManager = new CopyPasteManager(undoListener, tab, net, this);
ZoomController zoomController = new ZoomController(100);
tab.addZoomListener(zoomController);
PetriNetController petriNetController =
new PetriNetController(net, undoListener, animator, copyPasteManager, zoomController, tab);
netControllers.put(tab, petriNetController);
tab.updatePreferredSize();
PropertyChangeListener changeListener =
new PetriNetChangeListener(applicationModel, tab, petriNetController);
net.addPropertyChangeListener(changeListener);
setActiveTab(tab);
initialiseNet(net, changeListener);
}