Subversion Repositories svn.mios

Rev

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

Rev 808 Rev 850
Line 9... Line 9...
9
import org.w3c.dom.Element;
9
import org.w3c.dom.Element;
10
import org.w3c.dom.Node;
10
import org.w3c.dom.Node;
11
11
12
public class SysexSendReceiveManagerXML extends XMLUtils {
12
public class SysexSendReceiveManagerXML extends XMLUtils {
13
13
14
    public final static String TAG_ROOT_ELEMENT = "hexFileUploadManager";
14
    public final static String TAG_ROOT_ELEMENT = "sysexSendReceiveManager";
15
15
16
    public final static String TAG_HEX_FILE_UPLOADS = "hexFileUploads";
16
    public final static String TAG_SYSEX_SEND_RECEIVES = "sysexSendReceives";
17
17
18
    protected SysexSendReceiveManager sysexSendReceiveManager;
18
    protected SysexSendReceiveManager sysexSendReceiveManager;
19
19
20
    public SysexSendReceiveManagerXML(
20
    public SysexSendReceiveManagerXML(
21
            SysexSendReceiveManager sysexSendReceiveManager,
21
            SysexSendReceiveManager sysexSendReceiveManager,
Line 23... Line 23...
23
23
24
        super(rootElementTag);
24
        super(rootElementTag);
25
25
26
        this.sysexSendReceiveManager = sysexSendReceiveManager;
26
        this.sysexSendReceiveManager = sysexSendReceiveManager;
27
27
28
        addTag(TAG_HEX_FILE_UPLOADS);
28
        addTag(TAG_SYSEX_SEND_RECEIVES);
29
        addTag(SysexSendReceiveXML.TAG_ROOT_ELEMENT);
29
        addTag(SysexSendReceiveXML.TAG_ROOT_ELEMENT);
30
    }
30
    }
31
31
32
    protected void parseElement(Element element) {
32
    protected void parseElement(Element element) {
33
33
Line 35... Line 35...
35
35
36
        String name = element.getNodeName();
36
        String name = element.getNodeName();
37
37
38
        if (name == rootElementTag) {
38
        if (name == rootElementTag) {
39
39
40
        } else if (name == TAG_HEX_FILE_UPLOADS) {
40
        } else if (name == TAG_SYSEX_SEND_RECEIVES) {
41
41
42
            Iterator it = ((Vector) sysexSendReceiveManager
42
            Iterator it = ((Vector) sysexSendReceiveManager
43
                    .getSysexSendReceives().clone()).iterator();
43
                    .getSysexSendReceives().clone()).iterator();
44
44
45
            while (it.hasNext()) {
45
            while (it.hasNext()) {
Line 56... Line 56...
56
            SysexSendReceive sysexSendReceive = new SysexSendReceive(null);
56
            SysexSendReceive sysexSendReceive = new SysexSendReceive(null);
57
57
58
            SysexSendReceiveXML sysexSendReceiveXML = new SysexSendReceiveXML(
58
            SysexSendReceiveXML sysexSendReceiveXML = new SysexSendReceiveXML(
59
                    sysexSendReceive, SysexSendReceiveXML.TAG_ROOT_ELEMENT);
59
                    sysexSendReceive, SysexSendReceiveXML.TAG_ROOT_ELEMENT);
60
60
61
            sysexSendReceiveManager.newSysexSendReceive();
61
            sysexSendReceiveManager.addSysexSendReceive(sysexSendReceive);
62
62
63
            sysexSendReceiveXML.loadXML(element);
63
            sysexSendReceiveXML.loadXML(element);
64
        }
64
        }
65
    }
65
    }
66
66
67
    public void saveXML(Node node) {
67
    public void saveXML(Node node) {
68
68
69
        super.saveXML(node);
69
        super.saveXML(node);
70
70
71
        Element hexFileUploadDevicesElement = document
71
        Element hexFileUploadDevicesElement = document
72
                .createElement(TAG_HEX_FILE_UPLOADS);
72
                .createElement(TAG_SYSEX_SEND_RECEIVES);
73
73
74
        rootElement.appendChild(hexFileUploadDevicesElement);
74
        rootElement.appendChild(hexFileUploadDevicesElement);
75
75
76
        Iterator it = sysexSendReceiveManager.getSysexSendReceives().iterator();
76
        Iterator it = sysexSendReceiveManager.getSysexSendReceives().iterator();
77
77