samples/openfixed/src/org/apidesign/openfixed/ModificationEvent.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sun, 20 Mar 2011 18:52:47 +0100
changeset 374 35da2d439e3d
parent 373 samples/openfixed/src/org/apidesign/openfixed/GrowingEvent.java@c20d1d8ef2ca
permissions -rw-r--r--
Calculator and various ways to deliver changes in its counter to listeners
jtulach@373
     1
package org.apidesign.openfixed;
jtulach@373
     2
jtulach@374
     3
import java.util.Collection;
jtulach@373
     4
import java.util.EventObject;
jtulach@373
     5
jtulach@373
     6
// BEGIN: openfixed.event
jtulach@374
     7
public final class ModificationEvent extends EventObject {
jtulach@374
     8
    private final int delta;
jtulach@374
     9
    ModificationEvent(Object source, int delta) {
jtulach@373
    10
        super(source);
jtulach@374
    11
        this.delta = delta;
jtulach@373
    12
    }
jtulach@374
    13
    
jtulach@374
    14
    public int getChange() {
jtulach@374
    15
        return delta;
jtulach@374
    16
    }
jtulach@374
    17
    
jtulach@373
    18
// FINISH: openfixed.event
jtulach@373
    19
    
jtulach@373
    20
// BEGIN: openfixed.addgetter    
jtulach@374
    21
    int pending;
jtulach@373
    22
    /** @since 2.0 */
jtulach@374
    23
    public int getPending() {
jtulach@374
    24
        return pending;
jtulach@373
    25
    }
jtulach@373
    26
// END: openfixed.addgetter    
jtulach@374
    27
    
jtulach@374
    28
// BEGIN: openfixed.mount
jtulach@374
    29
    Collection<PostModificationListener> posts;
jtulach@374
    30
    /** @since 3.0 */
jtulach@374
    31
    public void postProcess(PostModificationListener p) {
jtulach@374
    32
        posts.add(p);
jtulach@374
    33
    }
jtulach@374
    34
// END: openfixed.mount  
jtulach@373
    35
}