Subversion Repositories svn.mios

Rev

Rev 709 | Rev 722 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
709 adamjking 1
package org.midibox.mios.xml;
2
 
721 adamjking 3
import org.midibox.mios.LCDMessage;
4
import org.w3c.dom.Element;
5
import org.w3c.dom.Node;
709 adamjking 6
 
721 adamjking 7
public class LCDMessageXML extends MIOSSysexSendReceiveXML {
8
 
9
    protected LCDMessage lcdMessage;
10
 
11
    protected String lcdWidthAttr = "lcdWidth";
12
 
13
    protected String lcdHeightAttr = "lcdHeight";
14
 
15
    protected String modeAttr = "mode";
16
 
17
    protected String posXAttr = "posX";
18
 
19
    protected String posYAttr = "posY";
20
 
21
    protected String loopAttr = "loop";
22
 
23
    protected String messageTextTag = "messageText";
24
 
25
    public LCDMessageXML(LCDMessage lcdMessage, String rootElementTag) {
26
 
27
        super(lcdMessage, rootElementTag);
28
 
29
        this.lcdMessage = lcdMessage;
30
    }
31
 
32
    public void saveXML(Node node) {
33
 
34
        super.saveXML(node);
35
 
36
        rootElement.setAttribute(lcdWidthAttr, "" + lcdMessage.getLcdWidth());
37
 
38
        rootElement.setAttribute(lcdHeightAttr, "" + lcdMessage.getLcdHeight());
39
 
40
        rootElement.setAttribute(modeAttr, "" + lcdMessage.getMode());
41
 
42
        rootElement.setAttribute(posXAttr, "" + lcdMessage.getPosX());
43
 
44
        rootElement.setAttribute(posYAttr, "" + lcdMessage.getPosY());
45
 
46
        rootElement.setAttribute(loopAttr, lcdMessage.isLoop() ? "true"
47
                : "false");
48
 
49
        Element messageTextElement = document.createElement(messageTextTag);
50
 
51
        rootElement.appendChild(messageTextElement);
52
 
53
        messageTextElement.setTextContent(lcdMessage.getMessageText());
54
    }
709 adamjking 55
}