01: package org.swingml.xml.mapper;
02:
03: import java.awt.*;
04:
05: import org.swingml.*;
06: import org.swingml.xml.*;
07: import org.w3c.dom.*;
08:
09: /**
10: * @author ttolle@crosslogic.com
11: */
12: public class PropertyMapper extends MapperUtil implements Mapper {
13:
14: /**
15: * @see org.swingml.xml.Mapper#getModelToMap(org.w3c.dom.Node, java.lang.Object)
16: */
17: public Object getModelToMap(Node aNode, Object aParent,
18: Container aContainer) {
19: /* NO-OP */
20: return null;
21: }
22:
23: /* (non-Javadoc)
24: * @see org.swingml.xml.Mapper#mapModel(org.w3c.dom.Node, java.lang.Object)
25: */
26: public void mapModel(Node aNode, Object aParent,
27: Container aContainer) {
28: NodeList nl = aNode.getChildNodes();
29: if (nl.getLength() > 0) {
30: Node n = null;
31: String k = null;
32: String v = null;
33: for (int i = 0; i < nl.getLength(); i++) {
34: n = nl.item(i);
35: if (n.getNodeName().compareTo(Constants.PROPERTY_ENTRY) == 0) {
36: k = super .getAttribute(n, Constants.NAME)
37: .getNodeValue();
38: v = super .getAttribute(n, Constants.VALUE)
39: .getNodeValue();
40: SwingMLProperties.sole().put(k, v);
41: }
42: }
43: }
44: }
45:
46: /**
47: * @see org.swingml.xml.Mapper#mapModelAttributes(org.w3c.dom.Node, java.lang.Object, java.lang.Object)
48: */
49: public void mapModelAttributes(Node aNode, Object aModel,
50: Object aParent) { /* NO-OP */
51: }
52: }
|