01: package org.swingml.xml.mapper;
02:
03: import java.awt.*;
04:
05: import org.swingml.*;
06: import org.swingml.model.*;
07: import org.swingml.xml.*;
08: import org.w3c.dom.*;
09:
10: /**
11: * @author ttolle@crosslogic.com
12: */
13: public class JScrollPaneMapper extends MapperUtil implements Mapper {
14:
15: /* (non-Javadoc)
16: * @see org.swingml.xml.Mapper#getModelToMap(org.w3c.dom.Node, java.lang.Object)
17: */
18: public Object getModelToMap(Node node, Object parent,
19: Container aContainer) {
20: JScrollPaneModel m = new JScrollPaneModel();
21: SwingMLModel container = (SwingMLModel) parent;
22: container.addChild(m);
23: m.setParent(container);
24: return m;
25: }
26:
27: /* (non-Javadoc)
28: * @see org.swingml.xml.Mapper#mapModel(org.w3c.dom.Node, java.lang.Object)
29: */
30: public void mapModel(Node node, Object parent, Container aContainer) {
31: JScrollPaneModel m = (JScrollPaneModel) this .getModelToMap(
32: node, parent, aContainer);
33: this .mapModelAttributes(node, m, parent);
34: super .iterate(node, m, aContainer);
35: }
36:
37: /* (non-Javadoc)
38: * @see org.swingml.xml.Mapper#mapModelAttributes(org.w3c.dom.Node, java.lang.Object, java.lang.Object)
39: */
40: public void mapModelAttributes(Node node, Object model,
41: Object parent) {
42: JScrollPaneModel m = (JScrollPaneModel) model;
43: super .mapCommonAttributes(m, node);
44: Node result = super.getAttribute(node, Constants.NAME);
45: if (result != null) {
46: m.setName(result.getNodeValue());
47: }
48: }
49: }
|