Source Code Cross Referenced for PersonRenderer.java in  » Ajax » ItsNat » org » itsnat » feashow » features » components » lists » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » ItsNat » org.itsnat.feashow.features.components.lists 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is not part of the ItsNat framework.
003:         *
004:         * Original source code use and closed source derivatives are authorized
005:         * to third parties with no restriction or fee.
006:         * The original source code is owned by the author.
007:         *
008:         * This program is distributed AS IS in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
011:         *
012:         * Author: Jose Maria Arranz Santamaria
013:         * (C) Innowhere Software Services S.L., Spanish company, year 2007
014:         */
015:
016:        package org.itsnat.feashow.features.components.lists;
017:
018:        import javax.swing.DefaultListModel;
019:        import javax.swing.event.DocumentEvent;
020:        import javax.swing.event.DocumentListener;
021:        import org.itsnat.comp.ItsNatComponentManager;
022:        import org.itsnat.comp.ItsNatList;
023:        import org.itsnat.comp.ItsNatListCellRenderer;
024:        import org.itsnat.comp.ItsNatListMultSel;
025:        import org.itsnat.comp.html.ItsNatHTMLInputText;
026:        import org.itsnat.core.ItsNatDocument;
027:        import org.itsnat.core.domutil.ItsNatDOMUtil;
028:        import org.itsnat.feashow.features.components.shared.Person;
029:        import org.w3c.dom.Element;
030:        import org.w3c.dom.Node;
031:
032:        public class PersonRenderer implements  ItsNatListCellRenderer {
033:            public PersonRenderer() {
034:            }
035:
036:            public static ItsNatHTMLInputText getInputText(String id,
037:                    Node containerNode, ItsNatList list) {
038:                Element firstName = ItsNatDOMUtil.getElementById(id,
039:                        (Element) containerNode);
040:                ItsNatComponentManager componentMgr = list
041:                        .getItsNatComponentManager();
042:                return (ItsNatHTMLInputText) componentMgr
043:                        .findItsNatComponent(firstName);
044:            }
045:
046:            public void renderListCell(ItsNatList list, int index,
047:                    Object value, boolean isSelected, boolean hasFocus,
048:                    Element cellContentElem, boolean isNew) {
049:                ItsNatListMultSel listMult = (ItsNatListMultSel) list;
050:
051:                final DefaultListModel listModel = (DefaultListModel) listMult
052:                        .getListModel();
053:                final Person person = (Person) listModel.getElementAt(index);
054:
055:                if (isNew) {
056:                    ItsNatDocument itsNatDoc = listMult.getItsNatDocument();
057:
058:                    if (!itsNatDoc.getDocumentTemplate()
059:                            .isAutoBuildComponents()) {
060:                        ItsNatComponentManager componentMgr = listMult
061:                                .getItsNatComponentManager();
062:                        componentMgr.buildItsNatComponents(cellContentElem);
063:                    }
064:
065:                    final ItsNatHTMLInputText firstNameComp = getInputText(
066:                            "firstNameId", cellContentElem, listMult);
067:                    final ItsNatHTMLInputText lastNameComp = getInputText(
068:                            "lastNameId", cellContentElem, listMult);
069:
070:                    firstNameComp.setText(person.getFirstName());
071:                    lastNameComp.setText(person.getLastName());
072:
073:                    DocumentListener firstNameListener = new DocumentListener() {
074:                        public void insertUpdate(DocumentEvent e) {
075:                            update();
076:                        }
077:
078:                        public void removeUpdate(DocumentEvent e) {
079:                            update();
080:                        }
081:
082:                        public void changedUpdate(DocumentEvent e) {
083:                            update();
084:                        }
085:
086:                        public void update() {
087:                            person.setFirstName(firstNameComp.getText());
088:                        }
089:                    };
090:
091:                    firstNameComp.getDocument().addDocumentListener(
092:                            firstNameListener);
093:
094:                    DocumentListener lastNameListener = new DocumentListener() {
095:                        public void insertUpdate(DocumentEvent e) {
096:                            update();
097:                        }
098:
099:                        public void removeUpdate(DocumentEvent e) {
100:                            update();
101:                        }
102:
103:                        public void changedUpdate(DocumentEvent e) {
104:                            update();
105:                        }
106:
107:                        public void update() {
108:                            person.setLastName(lastNameComp.getText());
109:                        }
110:
111:                    };
112:
113:                    lastNameComp.getDocument().addDocumentListener(
114:                            lastNameListener);
115:                } else {
116:                    ItsNatHTMLInputText firstNameComp = getInputText(
117:                            "firstNameId", cellContentElem, listMult);
118:                    ItsNatHTMLInputText lastNameComp = getInputText(
119:                            "lastNameId", cellContentElem, listMult);
120:
121:                    firstNameComp.setText(person.getFirstName());
122:                    lastNameComp.setText(person.getLastName());
123:                }
124:            }
125:
126:            public void unrenderListCell(ItsNatList list, int index,
127:                    Element cellContentElem) {
128:                ItsNatDocument itsNatDoc = list.getItsNatDocument();
129:                if (!itsNatDoc.getDocumentTemplate().isAutoBuildComponents()) {
130:                    ItsNatComponentManager componentMgr = list
131:                            .getItsNatComponentManager();
132:                    componentMgr.removeItsNatComponents(cellContentElem, true);
133:                }
134:            }
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.