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 18... Line 18...
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
19
 */
20
20
21
package org.midibox.mios;
21
package org.midibox.mios;
22
22
23
import java.util.Iterator;
-
 
24
import java.util.Observable;
23
import java.util.Observable;
25
import java.util.Observer;
24
import java.util.Observer;
26
import java.util.Vector;
25
import java.util.Vector;
-
 
26
-
 
27
import org.midibox.midi.MidiFilterDevice;
27
28
28
public class HexFileUploadDeviceManager extends Observable implements Observer {
29
public class HexFileUploadDeviceManager extends Observable implements Observer {
29
30
30
    private Vector hexFileUploadDevices;
31
    private Vector hexFileUploadDevices;
31
32
32
    private int hexFileUploadDeviceNo;
-
 
33
-
 
34
    private boolean MIOS32_Mode;
33
    private boolean mios32Mode;
35
34
36
    public HexFileUploadDeviceManager() {
35
    public HexFileUploadDeviceManager() {
37
        hexFileUploadDevices = new Vector();
36
        hexFileUploadDevices = new Vector();
38
37
39
        MIOS32_Mode = false;
38
        mios32Mode = false;
40
    }
39
    }
41
40
42
    public int getHexFileUploadDeviceNo() {
41
    public boolean isMIOS32Mode() {
43
        return hexFileUploadDeviceNo;
42
        return mios32Mode;
44
    }
43
    }
45
44
46
    public boolean isMIOS32_Mode() {
-
 
47
        return MIOS32_Mode;
-
 
48
    }
-
 
49
-
 
50
    public void setMIOS32_Mode(boolean mode) {
45
    public void setMIOS32Mode(boolean mode) {
51
46
52
        MIOS32_Mode = mode;
47
        mios32Mode = mode;
53
-
 
54
        Iterator it = hexFileUploadDevices.iterator();
-
 
55
-
 
56
        while (it.hasNext()) {
-
 
57
            HexFileUploadDevice hexFileUploadDevice = (HexFileUploadDevice) it
-
 
58
                    .next();
-
 
59
-
 
60
            hexFileUploadDevice.getHexFileUpload().setMIOS32_Mode(MIOS32_Mode);
-
 
61
        }
-
 
62
    }
48
    }
63
49
64
    public HexFileUploadDevice newHexFileUploadDevice() {
50
    public HexFileUploadDevice newHexFileUploadDevice() {
65
51
66
        HexFileUploadDevice hexFileUploadDevice = new HexFileUploadDevice(
52
        HexFileUploadDevice hexFileUploadDevice = new HexFileUploadDevice(
67
                "MIOS Hex File Upload " + ++hexFileUploadDeviceNo);
53
                "MIOS Hex File Upload " + (hexFileUploadDevices.size() + 1));
68
54
69
        hexFileUploadDevice.getHexFileUpload().setMIOS32_Mode(MIOS32_Mode);
55
        hexFileUploadDevice.getHexFileUpload().setMIOS32Mode(mios32Mode);
70
        hexFileUploadDevice.getHexFileUpload().addObserver(this);
56
        hexFileUploadDevice.getHexFileUpload().addObserver(this);
71
57
72
        hexFileUploadDevices.add(hexFileUploadDevice);
58
        hexFileUploadDevices.add(hexFileUploadDevice);
73
59
74
        setChanged();
60
        setChanged();
Line 80... Line 66...
80
66
81
    public void removeHexFileUploadDevice(
67
    public void removeHexFileUploadDevice(
82
            HexFileUploadDevice hexFileUploadDevice) {
68
            HexFileUploadDevice hexFileUploadDevice) {
83
        hexFileUploadDevices.remove(hexFileUploadDevice);
69
        hexFileUploadDevices.remove(hexFileUploadDevice);
84
        hexFileUploadDevice.getHexFileUpload().deleteObserver(this);
70
        hexFileUploadDevice.getHexFileUpload().deleteObserver(this);
-
 
71
       
-
 
72
        hexFileUploadDevices.remove(hexFileUploadDevice);
-
 
73
-
 
74
        for (int i = 0; i < hexFileUploadDevices.size(); i++) {
-
 
75
-
 
76
            HexFileUploadDevice currentHexFileUploadDevice = (HexFileUploadDevice) hexFileUploadDevices.elementAt(i);
-
 
77
-
 
78
            currentHexFileUploadDevice.setName("MIOS Hex File Upload " + (i + 1));
-
 
79
        }
85
80
86
        setChanged();
81
        setChanged();
87
        notifyObservers(hexFileUploadDevice);
82
        notifyObservers(hexFileUploadDevice);
88
        clearChanged();
83
        clearChanged();
89
    }
84
    }
Line 92... Line 87...
92
        return hexFileUploadDevices;
87
        return hexFileUploadDevices;
93
    }
88
    }
94
89
95
    public void update(Observable observable, Object object) {
90
    public void update(Observable observable, Object object) {
96
        if (object == HexFileUpload.MIOS32_MODE) {
91
        if (object == HexFileUpload.MIOS32_MODE) {
97
            MIOS32_Mode = ((HexFileUpload) observable).getMIOS32_Mode();
92
            mios32Mode = ((HexFileUpload) observable).isMIOS32Mode();
98
        }
93
        }
99
    }
94
    }
100
}
95
}