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;
15:
16: import org.itsnat.comp.ItsNatTree;
17: import org.itsnat.comp.ItsNatTreeStructure;
18: import org.itsnat.impl.core.domutil.ElementTreeNodeStructureDefaultImpl;
19: import org.w3c.dom.Element;
20:
21: /**
22: *
23: * @author jmarranz
24: */
25: public class ItsNatTreeStructureDefaultImpl implements
26: ItsNatTreeStructure {
27: protected final static ItsNatTreeStructureDefaultImpl SINGLETON = new ItsNatTreeStructureDefaultImpl();
28:
29: /** Creates a new instance of ItsNatTreeStructureDefaultImpl */
30: private ItsNatTreeStructureDefaultImpl() {
31: }
32:
33: public static ItsNatTreeStructureDefaultImpl newItsNatTreeStructureDefault() {
34: // No se guarda estado, usamos el SINGLETON en este falso método factoría
35: return SINGLETON;
36: }
37:
38: public Element getContentElement(ItsNatTree tree, int row,
39: Element nodeParent) {
40: if (nodeParent == null)
41: nodeParent = tree.getItsNatTreeUI()
42: .getParentElementFromRow(row);
43: return ElementTreeNodeStructureDefaultImpl.getContentElement(
44: tree.isTreeTable(), nodeParent);
45: }
46:
47: public Element getHandleElement(ItsNatTree tree, int row,
48: Element nodeParent) {
49: if (nodeParent == null)
50: nodeParent = tree.getItsNatTreeUI()
51: .getParentElementFromRow(row);
52: return ElementTreeNodeStructureDefaultImpl.getHandleElement(
53: tree.isTreeTable(), nodeParent);
54: }
55:
56: public Element getIconElement(ItsNatTree tree, int row,
57: Element nodeParent) {
58: if (nodeParent == null)
59: nodeParent = tree.getItsNatTreeUI()
60: .getParentElementFromRow(row);
61: return ElementTreeNodeStructureDefaultImpl.getIconElement(tree
62: .isTreeTable(), nodeParent);
63: }
64:
65: public Element getLabelElement(ItsNatTree tree, int row,
66: Element nodeParent) {
67: if (nodeParent == null)
68: nodeParent = tree.getItsNatTreeUI()
69: .getParentElementFromRow(row);
70: return ElementTreeNodeStructureDefaultImpl.getLabelElement(tree
71: .isTreeTable(), nodeParent);
72: }
73:
74: public Element getChildListElement(ItsNatTree tree, int row,
75: Element nodeParent) {
76: if (nodeParent == null)
77: nodeParent = tree.getItsNatTreeUI()
78: .getParentElementFromRow(row);
79: return ElementTreeNodeStructureDefaultImpl.getChildListElement(
80: tree.isTreeTable(), nodeParent);
81: }
82: }
|