01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.impl.comp.ui;
15:
16: import org.itsnat.comp.ItsNatTree;
17: import org.itsnat.comp.ItsNatTreeStructure;
18: import org.itsnat.core.domutil.ElementTreeNode;
19: import org.itsnat.core.domutil.ElementTreeNodeStructure;
20: import org.itsnat.impl.core.domutil.ElementTreeNodeImpl;
21: import org.w3c.dom.Element;
22:
23: /**
24: *
25: * @author jmarranz
26: */
27: public class ItsNatTreeStructureCoreAdapterImpl implements
28: ElementTreeNodeStructure {
29: protected ItsNatTreeStructure structure;
30: protected ItsNatTreeUIImpl treeUI;
31:
32: /**
33: * Creates a new instance of ItsNatTreeStructureCoreAdapterImpl
34: */
35: public ItsNatTreeStructureCoreAdapterImpl(
36: ItsNatTreeStructure structure, ItsNatTreeUIImpl treeUI) {
37: this .structure = structure;
38: this .treeUI = treeUI;
39: }
40:
41: public ItsNatTree getItsNatTree() {
42: return treeUI.getItsNatTree();
43: }
44:
45: public int getLogicRow(ElementTreeNode treeNode) {
46: return treeUI.getRow((ElementTreeNodeImpl) treeNode);
47: }
48:
49: public Element getContentElement(ElementTreeNode treeNode,
50: Element nodeParent) {
51: if (nodeParent == null)
52: nodeParent = treeNode.getParentElement();
53: return structure.getContentElement(getItsNatTree(),
54: getLogicRow(treeNode), nodeParent);
55: }
56:
57: public Element getHandleElement(ElementTreeNode treeNode,
58: Element nodeParent) {
59: if (nodeParent == null)
60: nodeParent = treeNode.getParentElement();
61: return structure.getHandleElement(getItsNatTree(),
62: getLogicRow(treeNode), nodeParent);
63: }
64:
65: public Element getIconElement(ElementTreeNode treeNode,
66: Element nodeParent) {
67: if (nodeParent == null)
68: nodeParent = treeNode.getParentElement();
69: return structure.getIconElement(getItsNatTree(),
70: getLogicRow(treeNode), nodeParent);
71: }
72:
73: public Element getLabelElement(ElementTreeNode treeNode,
74: Element nodeParent) {
75: if (nodeParent == null)
76: nodeParent = treeNode.getParentElement();
77: return structure.getLabelElement(getItsNatTree(),
78: getLogicRow(treeNode), nodeParent);
79: }
80:
81: public Element getChildListElement(ElementTreeNode treeNode,
82: Element nodeParent) {
83: if (nodeParent == null)
84: nodeParent = treeNode.getParentElement();
85: return structure.getChildListElement(getItsNatTree(),
86: getLogicRow(treeNode), nodeParent);
87: }
88:
89: }
|