samples/javabeans/test/org/apidesign/javabeans/use/toomany/MyHighlightsContainer.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:56:12 +0200
changeset 132 3bc4c54f4bcc
parent 102 461397695234
child 133 50bf1b976c0d
permissions -rw-r--r--
Truncating all examples to 80 characters per line
jtulach@102
     1
package org.apidesign.javabeans.use.toomany;
jtulach@102
     2
jtulach@102
     3
import org.apidesign.javabeans.toomany.*;
jtulach@102
     4
import java.util.TooManyListenersException;
jtulach@102
     5
import org.junit.After;
jtulach@102
     6
import org.junit.Before;
jtulach@102
     7
import org.junit.Test;
jtulach@102
     8
import static org.junit.Assert.*;
jtulach@102
     9
jtulach@102
    10
// BEGIN: javabeans.with.MyHighlightsContainer
jtulach@102
    11
final class MyHighlightsContainer implements HighlightsContainer {
jtulach@102
    12
    private HighlightsChangeListener listener;
jtulach@102
    13
jtulach@132
    14
    public synchronized void addHighlightsChangeListener(
jtulach@132
    15
        HighlightsChangeListener l
jtulach@132
    16
    ) throws TooManyListenersException {
jtulach@102
    17
        if (listener != null) throw new TooManyListenersException();
jtulach@102
    18
        listener = l;
jtulach@102
    19
    }
jtulach@132
    20
    public synchronized void removeHighlightsChangeListener(
jtulach@132
    21
        HighlightsChangeListener l
jtulach@132
    22
    ) {
jtulach@102
    23
        if (listener == l) listener = null;
jtulach@102
    24
    }
jtulach@102
    25
    public HighlightsSequence getHighlights(int startOffset, int endOffset) {
jtulach@102
    26
        return null; // implement
jtulach@102
    27
    }
jtulach@102
    28
// END: javabeans.with.MyHighlightsContainer
jtulach@102
    29
}