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 ElementTreeNode} objects to render the value
20: * associated to the tree node.
21: *
22: *
23: * @author Jose Maria Arranz Santamaria
24: * @see ElementTreeNode#setElementTreeNodeRenderer(ElementTreeNodeRenderer)
25: * @see org.itsnat.core.ItsNatDocument#createDefaultElementTreeNodeRenderer()
26: */
27: public interface ElementTreeNodeRenderer {
28: /**
29: * Renders as markup the specified value into the specified tree node.
30: *
31: * <p>Default implementation renders the specified value inside the first text node found below the
32: * label element.</p>
33: *
34: * @param treeNode the target tree node.
35: * @param value the value to render.
36: * @param labelElem the label element to render the value into. Is a hint, if provided should be obtained by calling {@link ElementTreeNode#getLabelElement()}.
37: * @param isNew true if this is the first time the markup is rendered. Default implementation ignores this parameter.
38: */
39: public void renderTreeNode(ElementTreeNode treeNode, Object value,
40: Element labelElem, boolean isNew);
41:
42: /**
43: * Unrenders the markup of the specified tree node. This method is called <i>before</i> the markup
44: * is removed.
45: *
46: * <p>Default implementation does nothing.</p>
47: *
48: * @param treeNode the target tree node.
49: * @param labelElem the label element to render the value into. Is a hint, if provided should be obtained by calling {@link ElementTreeNode#getLabelElement()}.
50: */
51: public void unrenderTreeNode(ElementTreeNode treeNode,
52: Element labelElem);
53: }
|