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.ItsNatComponentManager;
19: import org.itsnat.comp.html.ItsNatHTMLInputButton;
20: import org.itsnat.comp.html.ItsNatHTMLInputText;
21: import org.itsnat.feashow.features.components.shared.MyCustomComponentBase;
22: import org.itsnat.feashow.features.components.shared.Person;
23: import org.w3c.dom.Element;
24:
25: public class PersonEditorComponent extends MyCustomComponentBase {
26: protected ItsNatHTMLInputText firstNameComp;
27: protected ItsNatHTMLInputText lastNameComp;
28: protected ItsNatHTMLInputButton okComp;
29: protected ItsNatHTMLInputButton cancelComp;
30: protected Person person;
31:
32: public PersonEditorComponent(Person person, Element parentElement,
33: ItsNatComponentManager compMgr) {
34: super (parentElement, compMgr);
35:
36: this .person = person;
37:
38: this .firstNameComp = (ItsNatHTMLInputText) compMgr
39: .createItsNatComponentById("firstNameId");
40: this .lastNameComp = (ItsNatHTMLInputText) compMgr
41: .createItsNatComponentById("lastNameId");
42: this .okComp = (ItsNatHTMLInputButton) compMgr
43: .createItsNatComponentById("okPersonId");
44: this .cancelComp = (ItsNatHTMLInputButton) compMgr
45: .createItsNatComponentById("cancelPersonId");
46:
47: firstNameComp.setText(person.getFirstName());
48: lastNameComp.setText(person.getLastName());
49: }
50:
51: public void dispose() {
52: firstNameComp.dispose();
53: lastNameComp.dispose();
54: okComp.dispose();
55: cancelComp.dispose();
56: }
57:
58: public Person getPerson() {
59: return person;
60: }
61:
62: public void updatePerson() {
63: person.setFirstName(firstNameComp.getText());
64: person.setLastName(lastNameComp.getText());
65: }
66:
67: public ItsNatHTMLInputButton getOKButton() {
68: return okComp;
69: }
70:
71: public ItsNatHTMLInputButton getCancelButton() {
72: return cancelComp;
73: }
74: }
|