01: /*
02: * This file is not part of the ItsNat framework.
03: *
04: * Original source code use and closed source derivatives are authorized
05: * to third parties with no restriction or fee.
06: * The original source code is owned by the author.
07: *
08: * This program is distributed AS IS in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * Author: Jose Maria Arranz Santamaria
13: * (C) Innowhere Software Services S.L., Spanish company, year 2007
14: */
15:
16: package org.itsnat.feashow.features.components.labels;
17:
18: import org.itsnat.comp.ItsNatComponent;
19: import org.itsnat.comp.ItsNatLabel;
20: import org.itsnat.comp.ItsNatLabelRenderer;
21: import org.itsnat.core.ItsNatDocument;
22: import org.itsnat.core.domutil.ItsNatDOMUtil;
23: import org.itsnat.feashow.features.components.shared.Person;
24: import org.w3c.dom.Document;
25: import org.w3c.dom.Element;
26:
27: public class PersonCustomLabelRenderer implements ItsNatLabelRenderer {
28:
29: public PersonCustomLabelRenderer() {
30: }
31:
32: public void renderLabel(ItsNatLabel label, Object value,
33: Element labelElem, boolean isNew) {
34: Person person = (Person) value;
35:
36: ItsNatDocument itsNatDoc = label.getItsNatDocument();
37: Document doc = itsNatDoc.getDocument();
38: Element firstNameElem = doc.getElementById("firstNameId");
39: ItsNatDOMUtil.setTextContent(firstNameElem, person
40: .getFirstName());
41: Element lastNameElem = doc.getElementById("lastNameId");
42: ItsNatDOMUtil
43: .setTextContent(lastNameElem, person.getLastName());
44: }
45:
46: public void unrenderLabel(ItsNatLabel label, Element labelElem) {
47: }
48: }
|