Subversion Repositories svn.mios

Rev

Rev 722 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
721 adamjking 1
package org.midibox.mios.xml;
2
 
3
import org.midibox.midi.xml.VirtualMidiDeviceXML;
4
import org.midibox.mios.LCDMessageDevice;
727 adamjking 5
import org.w3c.dom.Element;
721 adamjking 6
import org.w3c.dom.Node;
7
 
8
public class LCDMessageDeviceXML extends VirtualMidiDeviceXML {
9
 
10
    protected LCDMessageDevice lcdMessageDevice;
11
 
722 adamjking 12
    public static final String TAG_ROOT_ELEMENT = "lcdMessageDevice";
721 adamjking 13
 
14
    public LCDMessageDeviceXML(LCDMessageDevice lcdMessageDevice,
15
            String rootElementTag) {
16
 
17
        super(lcdMessageDevice, rootElementTag);
18
 
19
        this.lcdMessageDevice = lcdMessageDevice;
727 adamjking 20
 
21
        tags.add(LCDMessageXML.TAG_ROOT_ELEMENT);
721 adamjking 22
    }
23
 
727 adamjking 24
    protected void parseElement(Element element) {
25
 
26
        super.parseElement(element);
27
 
28
        String name = element.getNodeName();
29
 
30
        if (name == rootElementTag) {
31
 
32
        } else if (name == LCDMessageXML.TAG_ROOT_ELEMENT) {
33
 
34
            LCDMessageXML lcdMessageXML = new LCDMessageXML(lcdMessageDevice
35
                    .getLCDMessage(), LCDMessageXML.TAG_ROOT_ELEMENT);
36
 
37
            lcdMessageXML.loadXML(element);
38
        }
39
    }
40
 
721 adamjking 41
    public void saveXML(Node node) {
42
 
43
        super.saveXML(node);
44
 
45
        LCDMessageXML lcdMessageXML = new LCDMessageXML(lcdMessageDevice
722 adamjking 46
                .getLCDMessage(), LCDMessageXML.TAG_ROOT_ELEMENT);
721 adamjking 47
 
48
        lcdMessageXML.saveXML(rootElement);
49
    }
50
}