Example usage for javax.swing.text Document removeDocumentListener

List of usage examples for javax.swing.text Document removeDocumentListener

Introduction

In this page you can find the example usage for javax.swing.text Document removeDocumentListener.

Prototype

public void removeDocumentListener(DocumentListener listener);

Source Link

Document

Unregisters the given observer from the notification list so it will no longer receive change updates.

Usage

From source file:de.unentscheidbar.validation.swing.trigger.DocumentChangeTrigger.java

private void forgetDocument(Document doc, JComponent component) {

    if (doc == null) {
        return;/*w w  w.  j  a va2  s  .  c om*/
    }
    Wrapper<Document> docIdentity = Beans.identity(doc);
    documentMap.remove(docIdentity, Beans.identity(component));
    if (!documentMap.containsKey(docIdentity)) {
        doc.removeDocumentListener(this);
    }
}

From source file:de.unentscheidbar.validation.swing.trigger.DocumentChangeTrigger.java

private void observeDocument(JComponent component) {

    Document doc = DocumentGetter.INSTANCE.apply(component);
    Wrapper<Document> docIdentity = Beans.identity(doc);
    Wrapper<JComponent> componentIdentity = Beans.identity(component);

    /* Don't listen more than once to each document */
    documentMap.remove(docIdentity, componentIdentity);
    if (!documentMap.containsKey(docIdentity)) {
        doc.removeDocumentListener(this);
        doc.addDocumentListener(this);
    }//from  w  w w . ja v a  2 s .  co m
    documentMap.put(docIdentity, componentIdentity);
}

From source file:org.nuclos.client.ui.collect.component.CollectableComboBox.java

public void removeDocumentListenerForEditor() {
    if (doclistener != null) {
        final Document document = getEditorDocument();
        if (document != null) {
            document.removeDocumentListener(getDocumentListener());
        }// ww w. j av a  2 s . c  o m
    }
}