Subversion Repositories svn.mios

Rev

Rev 628 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 628 Rev 721
Line 24... Line 24...
24
import java.util.Vector;
24
import java.util.Vector;
25
25
26
public class MidiFilterDeviceManager extends Observable {
26
public class MidiFilterDeviceManager extends Observable {
27
27
28
    private Vector midiFilterDevices;
28
    private Vector midiFilterDevices;
29
-
 
30
    private int midiFilterDeviceNo;
-
 
31
29
32
    public MidiFilterDeviceManager() {
30
    public MidiFilterDeviceManager() {
33
        midiFilterDevices = new Vector();
31
        midiFilterDevices = new Vector();
34
    }
32
    }
35
33
36
    public MidiFilterDevice addMidiFilterDevice() {
34
    public MidiFilterDevice addMidiFilterDevice() {
37
        MidiFilterDevice midiFilterDevice = new MidiFilterDevice("Filter "
35
        MidiFilterDevice midiFilterDevice = new MidiFilterDevice("MIDI Filter "
38
                + ++midiFilterDeviceNo);
36
                + (midiFilterDevices.size() + 1));
39
        midiFilterDevices.add(midiFilterDevice);
37
        midiFilterDevices.add(midiFilterDevice);
40
38
41
        setChanged();
39
        setChanged();
42
        notifyObservers(midiFilterDevice);
40
        notifyObservers(midiFilterDevice);
43
        clearChanged();
41
        clearChanged();
44
42
45
        return midiFilterDevice;
43
        return midiFilterDevice;
46
    }
44
    }
47
45
48
    public void removeMidiFilterDevice(MidiFilterDevice midiFilterDevice) {
46
    public void removeMidiFilterDevice(MidiFilterDevice midiFilterDevice) {
-
 
47
49
        midiFilterDevices.remove(midiFilterDevice);
48
        midiFilterDevices.remove(midiFilterDevice);
-
 
49
-
 
50
        for (int i = 0; i < midiFilterDevices.size(); i++) {
-
 
51
-
 
52
            MidiFilterDevice currentMidiFilterDevice = (MidiFilterDevice) midiFilterDevices.elementAt(i);
-
 
53
-
 
54
            currentMidiFilterDevice.setName("MIDI Filter " + (i + 1));
-
 
55
        }
50
56
51
        setChanged();
57
        setChanged();
52
        notifyObservers(midiFilterDevice);
58
        notifyObservers(midiFilterDevice);
53
        clearChanged();
59
        clearChanged();
54
    }
60
    }