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.core.domutil;
15:
16: import org.w3c.dom.Element;
17:
18: /**
19: * Used by {@link ElementTable} objects to render the values associated
20: * to cell elements.
21: *
22: *
23: * @author Jose Maria Arranz Santamaria
24: * @see ElementTable#setElementTableRenderer(ElementTableRenderer)
25: * @see org.itsnat.core.ItsNatDocument#createDefaultElementTableRenderer()
26: */
27: public interface ElementTableRenderer {
28: /**
29: * Renders as markup the specified value into the specified cell element.
30: *
31: * <p>The cell content element must be used to render below the value, usually
32: * as a text node.</p>
33: *
34: * <p>Default implementation renders the specified value inside the first text node found below the
35: * specified cell content element.</p>
36: *
37: *
38: * @param table the target table.
39: * @param row the row position.
40: * @param col the column position.
41: * @param value the value to render.
42: * @param cellContentElem the cell content element. This element
43: * is a hint, if provided, should be obtained by calling {@link ElementTableStructure#getCellContentElement(ElementTable,int,int,Element)}.
44: * @param isNew true if this is the first time the markup is rendered. Default implementation ignores this parameter.
45: */
46: public void renderTable(ElementTable table, int row, int col,
47: Object value, Element cellContentElem, boolean isNew);
48:
49: /**
50: * Unrenders the markup of the specified table cell. This method is called <i>before</i> the markup
51: * is removed.
52: *
53: * <p>Default implementation does nothing.</p>
54: *
55: * @param table the target table.
56: * @param row the row position.
57: * @param col the column position.
58: * @param cellContentElem the cell content element. This element
59: * is a hint, if provided, should be obtained by calling {@link ElementTableStructure#getCellContentElement(ElementTable,int,int,Element)}.
60: */
61: public void unrenderTable(ElementTable table, int row, int col,
62: Element cellContentElem);
63: }
|