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 ElementList} objects to obtain the content parent element of
20: * a child element of the list.
21: *
22: * @see ElementList#setElementListStructure(ElementListStructure)
23: * @see org.itsnat.core.ItsNatDocument#createDefaultElementListStructure()
24: * @author Jose Maria Arranz Santamaria
25: */
26: public interface ElementListStructure {
27: /**
28: * Returns the content element of a child element.
29: *
30: * <p>The content element is the parent element containing the markup of the associated
31: * value usually a text node. This element is passed to the renderer method
32: * {@link ElementListRenderer#renderList(ElementList,int,Object,Element,boolean)}.</p>
33: *
34: * <p>Default implementation returns the first <td> child if <code>itemElem</code>
35: * is a <tr> element otherwise returns <code>itemElem</code>.</p>
36: *
37: * @param list the target list, may be used to provide contextual information. Default implementation ignores it.
38: * @param index the child element position.
39: * @param itemElem the direct child element in this position.
40: * This element is a hint, if provided, should be the same as returned by <code>list.getElementAt(index)</code>.
41: * @return the content parent element. Default implementation returns the first cell if itemElem is a table row, otherwise returns the itemElem parameter.
42: */
43: public Element getContentElement(ElementList list, int index,
44: Element itemElem);
45: }
|