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 render the values associated
20: * to child elements.
21: *
22: * @author Jose Maria Arranz Santamaria
23: * @see ElementList#setElementListRenderer(ElementListRenderer)
24: * @see org.itsnat.core.ItsNatDocument#createDefaultElementListRenderer()
25: */
26: public interface ElementListRenderer {
27: /**
28: * Renders as markup the specified value into the specified child element of the list.
29: *
30: * <p>The content element must be used to render below the value, usually
31: * as a text node.</p>
32: *
33: * <p>Default implementation renders the specified value inside the first text node found below the
34: * specified content element.</p>
35: *
36: * @param list the target list.
37: * @param index the child element position.
38: * @param value the value to render.
39: * @param contentElem the content element. This element
40: * is a hint, if provided, should be obtained by calling {@link ElementListStructure#getContentElement(ElementList,int,Element)}.
41: * @param isNew true if this is the first time the markup is rendered. Default implementation ignores this parameter.
42: */
43: public void renderList(ElementList list, int index, Object value,
44: Element contentElem, boolean isNew);
45:
46: /**
47: * Unrenders the markup of the specified list item. This method is called <i>before</i> the markup
48: * is removed.
49: *
50: * <p>Default implementation does nothing.</p>
51: *
52: * @param list the target list.
53: * @param index the child element position.
54: * @param contentElem the content element. This element
55: * is a hint, if provided, should be obtained by calling {@link ElementListStructure#getContentElement(ElementList,int,Element)}.
56: */
57: public void unrenderList(ElementList list, int index,
58: Element contentElem);
59:
60: }
|