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
     1 /*
     2  * To change this template, choose Tools | Templates
     3  * and open the template in the editor.
     4  */
     5 package org.apidesign.openfixed;
     6 
     7 import java.util.List;
     8 import java.util.concurrent.CopyOnWriteArrayList;
     9 import org.apidesign.openfixed.Calculator.EventSupport;
    10 
    11 /**
    12  *
    13  * @author Jaroslav Tulach <jtulach@netbeans.org>
    14  */
    15 final class TrivialEventSupport implements EventSupport {
    16     List<ModificationListener> listener = new CopyOnWriteArrayList<ModificationListener>();
    17     
    18     TrivialEventSupport() {
    19     }
    20 
    21     // BEGIN: openfixed.trivial
    22     @Override
    23     public void fireModificationEvent(ModificationEvent ev) {
    24         for (ModificationListener l : listener) {
    25             l.modification(ev);
    26         }
    27     }
    28     // END: openfixed.trivial
    29 
    30     @Override
    31     public void add(ModificationListener l) {
    32         listener.add(l);
    33     }
    34 
    35     @Override
    36     public void remove(ModificationListener l) {
    37         listener.remove(l);
    38     }
    39     
    40 }