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.core.domutil;
15:
16: import org.itsnat.core.domutil.ElementTreeNodeRenderer;
17: import org.itsnat.core.domutil.ElementTreeNodeStructure;
18: import org.itsnat.core.domutil.ItsNatTreeWalker;
19: import org.itsnat.impl.core.ItsNatDocumentImpl;
20: import org.itsnat.impl.core.util.*;
21: import org.w3c.dom.Element;
22:
23: /**
24: *
25: * @author jmarranz
26: */
27: public class ElementTreeNodeNormalImpl extends ElementTreeNodeImpl {
28: /**
29: * Creates a new instance of ElementTreeNodeNormalImpl
30: */
31: public ElementTreeNodeNormalImpl(ItsNatDocumentImpl itsNatDoc,
32: ElementTreeNormalNodeListImpl parentList, int index,
33: Element parentElement, Element childPatternElem,
34: boolean clonePattern, boolean removePattern,
35: ElementTreeNodeStructure structure,
36: ElementTreeNodeRenderer renderer) {
37: super (itsNatDoc, parentList, index, parentElement, structure,
38: renderer);
39:
40: // Si tiene algún nodo hijo dicho nodo es usado como patrón
41: // y se impone al posible parámetro childPatternElem
42: Element childListParentElem = getChildListElement();
43: if (childListParentElem != null) // Si es null es que la estructura dice que este nodo no tiene hijos
44: {
45: Element childPatternElemInternal = ItsNatTreeWalker
46: .getFirstChildElement(childListParentElem); // puede ser null, en ese caso el propio parent será el patrón
47: if (childPatternElemInternal != null)
48: childPatternElem = childPatternElemInternal;
49: else {
50: if (childPatternElem == null) {
51: childPatternElem = getParentElement(); // El propio nodo padre es el patrón para los hijos
52: clonePattern = true;
53: }
54: }
55:
56: this .childElemList = new ElementTreeNormalNodeListNormalImpl(
57: itsNatDoc, this , childListParentElem,
58: childPatternElem, clonePattern, removePattern,
59: structure, renderer);
60: }
61: }
62:
63: public ElementTreeNodeListImpl getElementTreeNodeList() {
64: return childElemList; // Puede ser null (no puede tener hijos)
65: }
66:
67: public boolean isTreeTable() {
68: return false;
69: }
70: }
|