Source Code Cross Referenced for TreeCellEditorProcessor.java in  » Ajax » ItsNat » org » itsnat » impl » comp » 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.impl.comp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          ItsNat Java Web Application Framework
003:          Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
004:          Author: Jose Maria Arranz Santamaria
005:
006:          This program is free software: you can redistribute it and/or modify
007:          it under the terms of the GNU Affero General Public License as published by
008:          the Free Software Foundation, either version 3 of the License, or
009:          (at your option) any later version. See the GNU Affero General Public 
010:          License for more details. See the copy of the GNU Affero General Public License
011:          included in this program. If not, see <http://www.gnu.org/licenses/>.
012:         */
013:
014:        package org.itsnat.impl.comp;
015:
016:        import org.itsnat.comp.ItsNatTreeCellEditor;
017:        import org.itsnat.comp.ui.ItsNatTreeCellUI;
018:        import org.itsnat.impl.core.domutil.ItsNatDOMUtilInternal;
019:        import javax.swing.event.CellEditorListener;
020:        import javax.swing.tree.TreeModel;
021:        import javax.swing.tree.TreePath;
022:        import org.itsnat.comp.ItsNatComponent;
023:        import org.itsnat.comp.ui.ItsNatTreeUI;
024:        import org.w3c.dom.Element;
025:        import org.w3c.dom.Node;
026:        import org.w3c.dom.events.Event;
027:
028:        /**
029:         *
030:         * @author jmarranz
031:         */
032:        public class TreeCellEditorProcessor extends EditorProcessorBase
033:                implements  CellEditorListener {
034:            protected ItsNatTreeCellUI cellInfo;
035:            protected TreePath path;
036:            protected int row;
037:
038:            public TreeCellEditorProcessor(ItsNatTreeImpl compParent) {
039:                super (compParent);
040:            }
041:
042:            public ItsNatTreeImpl getItsNatTree() {
043:                return (ItsNatTreeImpl) compParent;
044:            }
045:
046:            public ItsNatTreeCellEditor getItsNatTreeCellEditor() {
047:                return (ItsNatTreeCellEditor) cellEditor;
048:            }
049:
050:            public void setItsNatTreeCellEditor(ItsNatTreeCellEditor cellEditor) {
051:                setCellEditor(cellEditor);
052:            }
053:
054:            public void setCurrentContext(ItsNatTreeCellUI cellInfo,
055:                    TreePath path, int row) {
056:                this .cellInfo = cellInfo;
057:                this .path = path;
058:                this .row = row;
059:            }
060:
061:            public TreePath getTreePath() {
062:                return path; // El actualmente editado
063:            }
064:
065:            public int getRow() {
066:                return row; // El actualmente editado
067:            }
068:
069:            public void startEdition(TreePath path) {
070:                if (prepareEdition()) {
071:                    openEditor(path);
072:                }
073:            }
074:
075:            public void startEdition(int row) {
076:                if (prepareEdition()) {
077:                    openEditor(row);
078:                }
079:            }
080:
081:            private void openEditor(TreePath path) {
082:                ItsNatTreeUI compUI = getItsNatTree().getItsNatTreeUI();
083:                ItsNatTreeCellUI cellInfo = (ItsNatTreeCellUI) compUI
084:                        .getItsNatTreeCellUIFromTreePath(path);
085:                openEditor(path, cellInfo.getRow(), cellInfo);
086:            }
087:
088:            private void openEditor(int row) {
089:                ItsNatTreeUI compUI = getItsNatTree().getItsNatTreeUI();
090:                ItsNatTreeCellUI cellInfo = (ItsNatTreeCellUI) compUI
091:                        .getItsNatTreeCellUIFromRow(row);
092:                openEditor(cellInfo.getTreePath(), row, cellInfo);
093:            }
094:
095:            private void openEditor(ItsNatTreeCellUI cellInfo) {
096:                openEditor(cellInfo.getTreePath(), cellInfo.getRow(), cellInfo);
097:            }
098:
099:            private void openEditor(TreePath path, int row,
100:                    ItsNatTreeCellUI cellInfo) {
101:                if (row >= 0) {
102:                    setCurrentContext(cellInfo, path, row);
103:
104:                    ItsNatTreeImpl tree = getItsNatTree();
105:                    TreeModel dataModel = tree.getTreeModel();
106:                    Element labelElem = cellInfo.getLabelElement();
107:                    TreeSelectionModelMgrImpl selModelMgr = tree
108:                            .getTreeSelectionModelMgr();
109:                    boolean isSelected = selModelMgr.isRowSelected(row);
110:                    Object dataNode = path.getLastPathComponent();
111:                    boolean isLeaf = dataModel.isLeaf(dataNode);
112:                    boolean expanded = cellInfo.isExpanded();
113:                    beforeShow(labelElem);
114:                    ItsNatTreeCellEditor cellEditor = getItsNatTreeCellEditor();
115:                    ItsNatComponent compEditor = cellEditor
116:                            .getTreeCellEditorComponent(tree, row, dataNode,
117:                                    isSelected, expanded, isLeaf, labelElem);
118:                    afterShow(compEditor);
119:                }
120:            }
121:
122:            protected void openEditor(Event evt) {
123:                Node nodeClicked = (Node) evt.getTarget(); // Puede ser un nodo interior del elemento pulsado        
124:
125:                ItsNatTreeUI compUI = getItsNatTree().getItsNatTreeUI();
126:                ItsNatTreeCellUI cellInfo = (ItsNatTreeCellUI) compUI
127:                        .getItsNatTreeCellUIFromNode(nodeClicked);
128:                if (cellInfo != null) // Se ha pulsado un elemento verdaderamente
129:                {
130:                    if (ItsNatDOMUtilInternal.isChildOrSame(nodeClicked,
131:                            cellInfo.getLabelElement(), cellInfo
132:                                    .getParentElement())) {
133:                        // Se ha pulsado el nodo contenido (el handle y el icon no valen para editar)
134:                        openEditor(cellInfo);
135:                    }
136:                }
137:            }
138:
139:            public void acceptNewValue(Object value) {
140:                TreeModel dataModel = getItsNatTree().getTreeModel();
141:                dataModel.valueForPathChanged(path, value); // Oportunidad del modelo de actualizarse, ver por ejemplo en DefaultTreeModel        
142:            }
143:
144:            public void clearCurrentContext() {
145:                setCurrentContext(null, null, -1);
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.