samples/openfixed/src/org/apidesign/openfixed/TrivialEventSupport.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 21:30:10 +0100
changeset 409 40cabcdcd2be
parent 375 3abae898011d
permissions -rw-r--r--
Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
jtulach@374
     1
/*
jtulach@374
     2
 * To change this template, choose Tools | Templates
jtulach@374
     3
 * and open the template in the editor.
jtulach@374
     4
 */
jtulach@374
     5
package org.apidesign.openfixed;
jtulach@374
     6
jtulach@374
     7
import java.util.List;
jtulach@374
     8
import java.util.concurrent.CopyOnWriteArrayList;
jtulach@395
     9
import org.apidesign.openfixed.Calculator.EventSupport;
jtulach@374
    10
jtulach@374
    11
/**
jtulach@374
    12
 *
jtulach@374
    13
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jtulach@374
    14
 */
jtulach@374
    15
final class TrivialEventSupport implements EventSupport {
jtulach@374
    16
    List<ModificationListener> listener = new CopyOnWriteArrayList<ModificationListener>();
jtulach@374
    17
    
jtulach@374
    18
    TrivialEventSupport() {
jtulach@374
    19
    }
jtulach@374
    20
jtulach@375
    21
    // BEGIN: openfixed.trivial
jtulach@374
    22
    @Override
jtulach@374
    23
    public void fireModificationEvent(ModificationEvent ev) {
jtulach@374
    24
        for (ModificationListener l : listener) {
jtulach@374
    25
            l.modification(ev);
jtulach@374
    26
        }
jtulach@374
    27
    }
jtulach@375
    28
    // END: openfixed.trivial
jtulach@374
    29
jtulach@374
    30
    @Override
jtulach@374
    31
    public void add(ModificationListener l) {
jtulach@374
    32
        listener.add(l);
jtulach@374
    33
    }
jtulach@374
    34
jtulach@374
    35
    @Override
jtulach@374
    36
    public void remove(ModificationListener l) {
jtulach@374
    37
        listener.remove(l);
jtulach@374
    38
    }
jtulach@374
    39
    
jtulach@374
    40
}