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 java.util.ArrayList;
17: import org.itsnat.core.domutil.ListElementInfo;
18: import org.itsnat.impl.core.ItsNatDocumentImpl;
19: import org.itsnat.impl.core.util.*;
20: import org.w3c.dom.Element;
21:
22: /**
23: *
24: * @author jmarranz
25: */
26: public class ElementTableFreeMasterImpl extends ElementTableFreeImpl {
27:
28: /**
29: * Creates a new instance of ElementTableFreeMasterImpl
30: */
31: public ElementTableFreeMasterImpl(ItsNatDocumentImpl itsNatDoc,
32: Element parentElement) {
33: super (itsNatDoc, true, parentElement);
34:
35: this .columnListOfRow = new ArrayList();
36: createAndSyncColumnArrayList();
37: }
38:
39: public Element addRow2(Element rowElem) {
40: rowElem = super .addRow2(rowElem);
41:
42: addColumnListOfRow(rowElem);
43:
44: return rowElem;
45: }
46:
47: public Element insertRowAt2(int row, Element rowElem) {
48: rowElem = super .insertRowAt2(row, rowElem);
49:
50: insertColumnListOfRow(row, rowElem);
51:
52: return rowElem;
53: }
54:
55: public ElementPair setRowAt2(int row, Element rowElem) {
56: ElementPair res = super .setRowAt2(row, rowElem);
57:
58: rowElem = res.getNewElem(); // El verdaderamente insertado
59:
60: updateColumnListOfRow(row, rowElem);
61:
62: return res;
63: }
64:
65: public void updateColumnListOfRow(int row, Element rowElem) {
66: // Hay que crear una nueva lista porque ha cambiado el padre de la lista
67: ElementListBaseImpl columsOfRow = newColumnsOfRowElementList(
68: row, rowElem);
69: columnListOfRow.set(row, columsOfRow);
70: }
71:
72: public ElementListBaseImpl getColumnsOfRowElementList(int row,
73: Element rowElem) {
74: return (ElementListFreeImpl) columnListOfRow.get(row);
75: }
76:
77: public TableCellElementInfoImpl getTableCellElementInfo(
78: ListElementInfo rowInfo, ListElementInfo cellInfo) {
79: return TableCellElementInfoMasterImpl
80: .getTableCellElementInfoMaster(
81: (ListElementInfoMasterImpl) rowInfo,
82: (ListElementInfoMasterImpl) cellInfo, this);
83: }
84: }
|