Java 类javax.swing.event.UndoableEditListener 实例源码
项目:jaer
文件:TowerOnChip6BitVDACControl.java
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();
}
}
}
项目:jaer
文件:SimpleVPotSliderTextControl.java
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();
}
}
}
项目:jaer
文件:SimpleIPotSliderTextControl.java
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();
}
}
}
项目:jaer
文件:AbstractMultiBitRegisterCP.java
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();
}
}
}
项目:jaer
文件:VPotSliderTextControl.java
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();
}
}
}
项目:jaer
文件:AddressedIPotCFGUIControl.java
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();
}
}
}
项目:jaer
文件:ShiftedSourceControlsCF.java
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();
}
}
}
项目:jaer
文件:AddressedIPotSliderTextControl.java
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();
}
}
}
项目:jaer
文件:ConfigurableIPotGUIControl.java
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();
}
}
}
项目:jaer
文件:IPotSliderTextControl.java
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();
}
}
}
项目:jaer
文件:PotTweaker.java
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();
}
}
}
项目:Push2Display
文件:XMLTextEditor.java
/** 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);
}
项目:Generator
文件:SemanticAnnotation.java
/** 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());
}
});
}
项目:sqlpower-library
文件:SPDataSourceTypeTest.java
/**
* 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());
}
项目:Push2Display
文件:XMLTextEditor.java
/** 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);
}
项目:feathers-sdk
文件:XMLTextEditor.java
/** 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);
}
项目:jif
文件:JifTextPane.java
/**
* 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());
}
}
});
}
项目:olca-converter
文件:XMLTextEditor.java
/** 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);
}
项目:basus
文件:Editor.java
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());
}
项目:nextreports-designer
文件:SyntaxDocument.java
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());
}
}
});
}
项目:PIPE
文件:ComponentEditorManager.java
/**
* 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();
}
项目:PIPE
文件:PetriNetController.java
/**
* 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);
}
项目:PIPE
文件:PipeApplicationController.java
/**
* 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);
}
项目:pdfjumbler
文件:UndoableList.java
public UndoableList(List<T> list) {
this.list = list;
this.parent = null;
this.offset = 0;
this.editProtection = new boolean[]{ false };
this.editListeners = new ArrayList<UndoableEditListener>();
this.listDataListeners = new ArrayList<ListDataListener>();
}
项目:pdfjumbler
文件:UndoableList.java
private void addEdit(UndoableEdit edit) {
if (compoundEdits.isEmpty()) {
UndoableEditEvent editEvent = new UndoableEditEvent(getMainList(), edit);
for (UndoableEditListener l : editListeners) {
l.undoableEditHappened(editEvent);
}
} else {
compoundEdits.peek().addEdit(edit);
}
}
项目:pdfjumbler
文件:UndoableList.java
public static void main(String[] args) {
final LinkedList<UndoableEdit> edits = new LinkedList<UndoableEdit>();
UndoableEditListener editListener = new UndoableEditListener() {
@Override
public void undoableEditHappened(UndoableEditEvent e) {
System.out.println(e.getEdit());
edits.addFirst(e.getEdit());
}
};
UndoableList<Integer> list = new UndoableList<Integer>(new LinkedList<Integer>());
list.addUndoableEditListener(editListener);
for (int i = 1; i < 10; i++) {
list.add(2*i);
}
System.out.println(list);
list.add(6, 13);
System.out.println(list);
list.set(3, 7);
System.out.println(list);
List<Integer> subList = list.subList(3, 6);
System.out.println(subList);
subList.set(0, 8);
System.out.println(list);
System.out.println(subList);
subList.remove(1);
System.out.println("----------------------------------");
for (UndoableEdit edit : edits) {
System.out.println("Undo " + edit);
edit.undo();
System.out.println(list);
}
}
项目:incubator-netbeans
文件:BaseDocument.java
@Override
public void addUndoableEditListener(UndoableEditListener listener) {
super.addUndoableEditListener(listener);
if (LOG.isLoggable(Level.FINE)) {
UndoableEditListener[] listeners = getUndoableEditListeners();
if (listeners.length > 1) {
// Having two UE listeners may be dangerous - for example
// having two undo managers attached at once will lead to strange errors
// since only one of the UMs will work normally while processing
// in the other one will be (typically silently) failing.
LOG.log(Level.INFO, "Two or more UndoableEditListeners attached", new Exception()); // NOI18N
}
}
}
项目:incubator-netbeans
文件:BaseDocumentTest.java
public void testRecursiveUndoableEdits() throws Exception {
final BaseDocument doc = new BaseDocument(false, "text/plain");
class UEL implements UndoableEditListener, Runnable {
boolean undo;
@Override
public void undoableEditHappened(UndoableEditEvent e) {
//doc.runAtomic(this);
doc.render(this);
undo = e.getEdit().canUndo();
}
@Override
public void run() {
}
}
UEL uel = new UEL();
doc.addUndoableEditListener(uel);
class Atom implements Runnable {
@Override
public void run() {
try {
doc.insertString(0, "Ahoj", null);
} catch (BadLocationException ex) {
throw new IllegalStateException(ex);
}
}
}
doc.runAtomicAsUser(new Atom());
assertTrue("Can undo now", uel.undo);
}
项目:incubator-netbeans
文件:UndoRedoWrappingCooperationTest.java
void sendUndoableEdit(Document d, UndoableEdit ue) {
if(d instanceof AbstractDocument) {
UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
UndoableEditEvent ev = new UndoableEditEvent(d, ue);
for(UndoableEditListener uel : uels) {
uel.undoableEditHappened(ev);
}
}
}
项目:incubator-netbeans
文件:CompletionImpl.java
static void sendUndoableEdit(Document d, UndoableEdit ue) {
if(d instanceof AbstractDocument) {
UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
UndoableEditEvent ev = new UndoableEditEvent(d, ue);
for(UndoableEditListener uel : uels) {
uel.undoableEditHappened(ev);
}
}
}
项目:incubator-netbeans
文件:InstantRenamePerformer.java
private static void sendUndoableEdit(Document d, UndoableEdit ue) {
if(d instanceof AbstractDocument) {
UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
UndoableEditEvent ev = new UndoableEditEvent(d, ue);
for(UndoableEditListener uel : uels) {
uel.undoableEditHappened(ev);
}
}
}
项目:incubator-netbeans
文件:AbstractModel.java
@Override
public synchronized void addUndoableRefactorListener(UndoableEditListener uel) {
//
savedUndoableEditListeners = ues.getUndoableEditListeners();
if (savedUndoableEditListeners != null) {
for (UndoableEditListener saved : savedUndoableEditListeners) {
if (saved instanceof UndoManager) {
((UndoManager)saved).discardAllEdits();
}
}
}
ues = new ModelUndoableEditSupport();
ues.addUndoableEditListener(uel);
}
项目:incubator-netbeans
文件:AbstractModel.java
@Override
public synchronized void removeUndoableRefactorListener(UndoableEditListener uel) {
//
ues.removeUndoableEditListener(uel);
if (savedUndoableEditListeners != null) {
ues = new ModelUndoableEditSupport();
for (UndoableEditListener saved : savedUndoableEditListeners) {
ues.addUndoableEditListener(saved);
}
savedUndoableEditListeners = null;
}
}
项目:incubator-netbeans
文件:MacroDialogSupport.java
private static void sendUndoableEdit(Document d, UndoableEdit ue) {
if(d instanceof AbstractDocument) {
UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
UndoableEditEvent ev = new UndoableEditEvent(d, ue);
for(UndoableEditListener uel : uels) {
uel.undoableEditHappened(ev);
}
}
}
项目:incubator-netbeans
文件:AbbrevDetection.java
private static void sendUndoableEdit(Document d, UndoableEdit ue) {
if(d instanceof AbstractDocument) {
UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
UndoableEditEvent ev = new UndoableEditEvent(d, ue);
for(UndoableEditListener uel : uels) {
uel.undoableEditHappened(ev);
}
}
}
项目:jmeter-bzm-plugins
文件:UndoableJTextField.java
public void switchDocument(Object container, Object keyObj, String contents) {
this.currentUndoManager = null;
String key = container.getClass().getName() + "_" + container.hashCode() + "_" + keyObj.getClass().getName()
+ keyObj.hashCode();
UndoableJTextField.UndoableDocument ud = (UndoableJTextField.UndoableDocument) this.undoableDocumentMap
.get(key);
if (ud == null) {
ud = new UndoableJTextField.UndoableDocument();
ud.undoManager = new UndoManager();
ud.document = new PlainDocument();
try {
ud.document.insertString(0, contents, (AttributeSet) null);
} catch (BadLocationException var7) {
;
}
this.undoableDocumentMap.put(key, ud);
ud.document.addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent e) {
if (UndoableJTextField.this.currentUndoManager != null) {
UndoableEdit ue = e.getEdit();
UndoableJTextField.this.currentUndoManager.addEdit(ue);
}
}
});
}
this.setDocument(ud.document);
this.currentUndoManager = ud.undoManager;
}
项目:jaer
文件:PotGUIControl.java
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);
// log.info("added undo listener "+anc);
break;
}
anc = anc.getParent();
}
}
}
项目:balloonist
文件:Artwork.java
/**
* @return a List of any missing font families as Strings. Will return an empty List if all
* fonts encountered were available.
*/
public List open(File selectedFile, UndoableEditListener designatedUndoableEditListener) throws SAXException, IOException
{
setFile(selectedFile);
List missingFontFamilies = open(designatedUndoableEditListener);
if (changeListener!=null)
changeListener.stateChanged(CHANGE_EVENT);
return missingFontFamilies;
}
项目:NoteBookApp
文件:EditorGUI.java
private UndoManager undoMan() {
// Listener for undo and redo functions to document
undo = new UndoManager();
textArea.getDocument().addUndoableEditListener(new UndoableEditListener() {
@Override
public void undoableEditHappened(UndoableEditEvent e) {
undo.addEdit(e.getEdit());
}
});
return undo;
}
项目:j2se_for_android
文件:AbstractDocument.java
protected void fireUndoableEditUpdate(UndoableEditEvent e) {
UndoableEditListener[] listeners = getUndoableEditListeners();
if(listeners != null){
for (int i = 0; i < listeners.length; i++) {
listeners[i].undoableEditHappened(e);
}
}
}