Source Code Cross Referenced for FormResourceTree.java in  » Content-Management-System » harmonise » org » openharmonise » him » swing » resourcetree » formresourcetree » 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 » Content Management System » harmonise » org.openharmonise.him.swing.resourcetree.formresourcetree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.him.swing.resourcetree.formresourcetree;
020:
021:        import java.util.*;
022:
023:        import org.openharmonise.him.swing.resourcetree.*;
024:        import org.openharmonise.vfs.*;
025:
026:        /**
027:         * A resource tree that can be used as a form component. Each node in the
028:         * tree can have either a checkbox or a radio button as part of the cell.
029:         * 
030:         * @author Matthew Large
031:         * @version $Revision: 1.1 $
032:         *
033:         */
034:        public class FormResourceTree extends ResourceTree {
035:
036:            /**
037:             * True if multiple resources can be selected. If true checkboxes are used, if false radion buttons.
038:             */
039:            private boolean m_bIsMultiSelect = true;
040:
041:            /**
042:             * List of full paths to selected resources.
043:             */
044:            private List m_pathValues = new ArrayList();
045:
046:            /**
047:             * Ordered map of full paths to cell objects.
048:             */
049:            private Map m_cells = new TreeMap();
050:
051:            /**
052:             * List of {@link FormResourceTreeListener} listeners.
053:             */
054:            private List m_formResoruceTreeListeners = new ArrayList();
055:
056:            /**
057:             * True if virtual collections are allowed to be selected.
058:             */
059:            private boolean m_bAllowVirtualDirectorySelect = false;
060:
061:            /**
062:             * Constructs a new form resource tree.
063:             * 
064:             * @param pathValues list of full paths of already selected values.
065:             */
066:            public FormResourceTree(List pathValues) {
067:                super ();
068:                this .m_pathValues.addAll(pathValues);
069:            }
070:
071:            /**
072:             * Constructs a new form resource tree.
073:             * 
074:             * @param bUseScrollPane true if the tree is to be enclosed in a scroll pane.
075:             * @param pathValues list of full paths of already selected values.
076:             */
077:            public FormResourceTree(boolean bUseScrollPane, List pathValues) {
078:                super (bUseScrollPane);
079:                this .m_pathValues.addAll(pathValues);
080:            }
081:
082:            /**
083:             * Initialises this component.
084:             */
085:            protected void setup() {
086:                super .setup();
087:
088:                super .m_tree.setCellRenderer(new FormTreeCellRenderer(this ));
089:
090:                FormTreeMouseListener listener = new FormTreeMouseListener(this );
091:                super .m_tree.addTreeSelectionListener(listener);
092:                super .m_tree.setSelectionModel(listener);
093:            }
094:
095:            /**
096:             * Checks if multiple resources can be selected.
097:             * 
098:             * @return true if multiple resources can be selected.
099:             */
100:            public boolean isMultiSelect() {
101:                return this .m_bIsMultiSelect;
102:            }
103:
104:            /**
105:             * Sets whether multiple resources can be selected.
106:             * 
107:             * @param bIsMultiSelect true if multiple resources can be selected.
108:             */
109:            public void setIsMultiSelect(boolean bIsMultiSelect) {
110:                this .m_bIsMultiSelect = bIsMultiSelect;
111:                super .m_tree.setCellRenderer(new FormTreeCellRenderer(this ));
112:            }
113:
114:            /**
115:             * Gets a list of full paths to selected resources.
116:             * 
117:             * @return list of full paths to selected resources.
118:             */
119:            public List getPathValues() {
120:                return this .m_pathValues;
121:            }
122:
123:            /**
124:             * Adds a selected resource.
125:             * 
126:             * @param sFullPath full path to selected resource to add.
127:             */
128:            public void addPathValue(String sFullPath) {
129:                this .m_pathValues.add(sFullPath);
130:                this .repaint();
131:            }
132:
133:            /**
134:             * Removes a selected resource.
135:             * 
136:             * @param sFullPath full path to selected resource to remove.
137:             */
138:            public void removePathValue(String sFullPath) {
139:                this .m_pathValues.remove(sFullPath);
140:                this .repaint();
141:            }
142:
143:            /**
144:             * Adds a cell to the fuall path to cell map.
145:             * 
146:             * @param cell cell to add.
147:             */
148:            protected void addCell(FormTreeCell cell) {
149:                this .m_cells.put(cell.getFullPath(), cell);
150:            }
151:
152:            /**
153:             * Gets a list of ordered full paths to all the cells.
154:             * 
155:             * @return ordered list of full paths.
156:             */
157:            protected List getCellPaths() {
158:                return new ArrayList(this .m_cells.keySet());
159:            }
160:
161:            /**
162:             * Selects a cell.
163:             * 
164:             * @param sFullPath full path to cell to selected.
165:             */
166:            protected void cellSelected(String sFullPath) {
167:
168:                Iterator itorTemp = this .m_cells.keySet().iterator();
169:                while (itorTemp.hasNext()) {
170:                    String sPath = (String) itorTemp.next();
171:                }
172:
173:                if (!this .isMultiSelect()) {
174:                    this .m_pathValues.clear();
175:                }
176:                if (!this .m_pathValues.contains(sFullPath)) {
177:                    this .m_pathValues.add(sFullPath);
178:                    this .firePathValuesChanged();
179:                }
180:
181:                this .m_tree.revalidate();
182:                this .m_tree.repaint();
183:            }
184:
185:            /**
186:             * Deselects a cell.
187:             * 
188:             * @param sFullPath full path to cell to deselect.
189:             */
190:            protected void cellUnSelected(String sFullPath) {
191:                if (this .m_pathValues.contains(sFullPath)) {
192:                    this .m_pathValues.remove(sFullPath);
193:                    this .firePathValuesChanged();
194:                }
195:            }
196:
197:            /**
198:             * Gets a cell for a given full path.
199:             * 
200:             * @param sFullPath full path of cell to get.
201:             * @return cell for given full path.
202:             */
203:            protected FormTreeCell getCellForPath(String sFullPath) {
204:                return (FormTreeCell) this .m_cells.get(sFullPath);
205:            }
206:
207:            /**
208:             * Adds a form resource tree listener.
209:             * 
210:             * @param listener listener to add.
211:             */
212:            public void addFormResourceTreeListener(
213:                    FormResourceTreeListener listener) {
214:                this .m_formResoruceTreeListeners.add(listener);
215:            }
216:
217:            /**
218:             * Removes a form resource tree listener.
219:             * 
220:             * @param listener listener to remove.
221:             */
222:            public void removeFormResourceTreeListener(
223:                    FormResourceTreeListener listener) {
224:                this .m_formResoruceTreeListeners.remove(listener);
225:            }
226:
227:            /**
228:             * Fires a path values changed event to all the {@link FormResourceTreeListener}
229:             * listeners.
230:             *
231:             */
232:            private void firePathValuesChanged() {
233:                Iterator itor = this .m_formResoruceTreeListeners.iterator();
234:                while (itor.hasNext()) {
235:                    FormResourceTreeListener listener = (FormResourceTreeListener) itor
236:                            .next();
237:                    listener
238:                            .pathValuesChanged(new ArrayList(this .m_pathValues));
239:                }
240:            }
241:
242:            /**
243:             * Sets whether virtual collections can be selected.
244:             * 
245:             * @param bAllow true to allow virtual collections to be selected.
246:             */
247:            public void setAllowVirtualDirectorySelect(boolean bAllow) {
248:                this .m_bAllowVirtualDirectorySelect = bAllow;
249:            }
250:
251:            /**
252:             * Checks if virtual collections can be selected.
253:             * 
254:             * @return true if virtual collections can be selected.
255:             */
256:            public boolean isAllowVirtualDirectorySelect() {
257:                return this .m_bAllowVirtualDirectorySelect;
258:            }
259:
260:            /* (non-Javadoc)
261:             * @see com.simulacramedia.contentmanager.swing.resourcetree.ResourceTree#getVFS()
262:             */
263:            protected AbstractVirtualFileSystem getVFS() {
264:                return super.getVFS();
265:            }
266:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.