01: package org.swingml.treetablebrowser.ext;
02:
03: import java.awt.*;
04:
05: import org.swingml.*;
06: import org.swingml.xml.*;
07: import org.w3c.dom.*;
08:
09: public class TreeTableBrowserDataMapper extends MapperUtil implements
10: Mapper {
11:
12: public Object getModelToMap(Node aNode, Object aParent,
13: Container aContainer) {
14: TreeTableBrowserDataModel theTreeTableDataModel = new TreeTableBrowserDataModel(
15: aContainer);
16: SwingMLModel theContainer = (SwingMLModel) aParent;
17: theContainer.addChild(theTreeTableDataModel);
18: theTreeTableDataModel.setParent(theContainer);
19: return theTreeTableDataModel;
20: }
21:
22: public void mapModel(Node aNode, Object aParent,
23: Container aContainer) {
24: TreeTableBrowserDataModel theTreeTableDataModel = (TreeTableBrowserDataModel) this
25: .getModelToMap(aNode, aParent, aContainer);
26: this .mapModelAttributes(aNode, theTreeTableDataModel, aParent);
27: super .iterate(aNode, theTreeTableDataModel, aContainer);
28: }
29:
30: public void mapModelAttributes(Node aNode, Object aModel,
31: Object aParent) {
32: TreeTableBrowserDataModel theTreeTreeTableDataModel = (TreeTableBrowserDataModel) aModel;
33: super .mapCommonAttributes(theTreeTreeTableDataModel, aNode);
34: Node theResultNode = super .getAttribute(aNode,
35: Constants.EDITABLE);
36: if (theResultNode != null) {
37: theTreeTreeTableDataModel.setEditable(theResultNode
38: .getNodeValue().equalsIgnoreCase(Constants.TRUE));
39: }
40:
41: theResultNode = super .getAttribute(aNode, Constants.ALIGN);
42: if (theResultNode != null) {
43: theTreeTreeTableDataModel.setAlignment(theResultNode
44: .getNodeValue());
45: }
46:
47: theResultNode = getAttribute(aNode, Constants.AUTO_SELECT);
48: if (null != theResultNode) {
49: theTreeTreeTableDataModel.setAutoSelect((new Boolean(
50: theResultNode.getNodeValue())).booleanValue());
51: }
52:
53: }
54: }
|