samples/openfixed/src/org/apidesign/openfixed/TrivialEventSupport.java
changeset 374 35da2d439e3d
child 375 3abae898011d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/openfixed/src/org/apidesign/openfixed/TrivialEventSupport.java	Sun Mar 20 18:52:47 2011 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/*
     1.5 + * To change this template, choose Tools | Templates
     1.6 + * and open the template in the editor.
     1.7 + */
     1.8 +package org.apidesign.openfixed;
     1.9 +
    1.10 +import java.util.List;
    1.11 +import java.util.concurrent.CopyOnWriteArrayList;
    1.12 +
    1.13 +/**
    1.14 + *
    1.15 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.16 + */
    1.17 +final class TrivialEventSupport implements EventSupport {
    1.18 +    List<ModificationListener> listener = new CopyOnWriteArrayList<ModificationListener>();
    1.19 +    
    1.20 +    TrivialEventSupport() {
    1.21 +    }
    1.22 +
    1.23 +    @Override
    1.24 +    public void fireModificationEvent(ModificationEvent ev) {
    1.25 +        for (ModificationListener l : listener) {
    1.26 +            l.modification(ev);
    1.27 +        }
    1.28 +    }
    1.29 +
    1.30 +    @Override
    1.31 +    public void add(ModificationListener l) {
    1.32 +        listener.add(l);
    1.33 +    }
    1.34 +
    1.35 +    @Override
    1.36 +    public void remove(ModificationListener l) {
    1.37 +        listener.remove(l);
    1.38 +    }
    1.39 +    
    1.40 +}