Source Code Cross Referenced for Images.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » channels » jsp » tree » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.channels.jsp.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jasig.portal.channels.jsp.tree;
002:
003:        import java.io.IOException;
004:        import java.net.URL;
005:        import java.util.HashMap;
006:        import java.util.Map;
007:        import java.util.Properties;
008:
009:        import org.jasig.portal.PortalException;
010:
011:        /**
012:         * Represents a set of well known keys and the default URL paths for images used
013:         * in rendering the tree. These are loaded from configuration using the values
014:         * of the constants defined in this class having names of XXX_IMG. The matching
015:         * constants having just the XXX names hold the values of the keys into the
016:         * table. These keys are used in the tree control's renderer.jsp to embed the
017:         * URL from the map for that key into the rendered html tree.
018:         * 
019:         * Applications that use the tree control can provide their own maps of image
020:         * names to image URLs using the XXX constant names for the keys and providing
021:         * their own URL values in their map objects. These customized maps can then be
022:         * passed to the Config object for use by the renderer. If only a portion of the
023:         * images are to be overridden they can obtain the default URLs from the
024:         * configuration system for the unchanged images using the XXX_IMG constants.
025:         * 
026:         * <pre>
027:         *    FOLDER_OPEN             = &quot;folderOpen&quot;
028:         *    FOLDER_CLOSED           = &quot;folderClosed&quot;
029:         *    START_OF_CONTAINER      = &quot;startOfContainer&quot;
030:         *    END_OF_CONTAINER        = &quot;endOfContainer&quot;
031:         *    MIDDLE_BRANCH_COLLAPSED = &quot;middleBranchCollapsed&quot;
032:         *    MIDDLE_BRANCH_EXPANDED  = &quot;middleBranchExpanded&quot;
033:         *    LAST_BRANCH_COLLAPSED   = &quot;lastBranchCollapsed&quot;
034:         *    LAST_BRANCH_EXPANDED    = &quot;lastBranchExpanded&quot;
035:         *    NO_BRANCH               = &quot;noBranch&quot;
036:         *    TRANSPARENT_POINT       = &quot;transparentPoint&quot;
037:         *    MIDDLE_CHILD            = &quot;middleChild&quot;
038:         *    SKIPPED_CHILD_RPT       = &quot;skippedChildRpt&quot;
039:         *    SKIPPED_CHILD           = &quot;skippedChild&quot;
040:         *    LAST_CHILD              = &quot;lastChild&quot;
041:         *    SHOW_ASPECTS            = &quot;showAspects&quot;
042:         *    HIDE_ASPECTS            = &quot;hideAspects&quot;
043:         * </pre>
044:         * 
045:         * @author Mark Boyd
046:         */
047:        public class Images {
048:            private static final Properties cCfg = loadConfiguration();
049:            // restore i18n piece made available 
050:            //Configuration.lookup(Images.class);
051:            private static final String cfgPrefix = Images.class.getName()
052:                    + ".";
053:
054:            /**
055:             * Represents the key used by the renderer to obtain the URL for the
056:             * open container node in the tree. A typical default image for containers 
057:             * is a folder.
058:             */
059:            public static final String FOLDER_OPEN = "folderOpen";
060:
061:            /**
062:             * Defines the property name used within the configuration system to obtain
063:             * the URL for the tree's default {@link #FOLDER_OPEN} image.
064:             */
065:            public static final String FOLDER_OPEN_IMG = cfgPrefix
066:                    + FOLDER_OPEN;
067:
068:            /**
069:             * Represents the key used by the renderer to obtain the URL for the
070:             * closed container node in the tree.
071:             */
072:            public static final String FOLDER_CLOSED = "folderClosed";
073:
074:            /**
075:             * Defines the property name used within the configuration system to obtain
076:             * the URL for the tree's default {@link #FOLDER_CLOSED} image.
077:             */
078:            public static final String FOLDER_CLOSED_IMG = cfgPrefix
079:                    + FOLDER_CLOSED;
080:
081:            /**
082:             * Represents the key used by the renderer to obtain the URL for the
083:             * containment start image in the tree when containment is being used. Such 
084:             * an image implies containment. A typical default is an open paren. These
085:             * images can be used to render logical expressions via the tree renderer.
086:             */
087:            public static final String START_OF_CONTAINER = "startOfContainer";
088:
089:            /**
090:             * Defines the property name used within the configuration system to obtain
091:             * the URL for the tree's default {@link #START_OF_CONTAINER} image.
092:             */
093:            public static final String START_OF_CONTAINER_IMG = cfgPrefix
094:                    + START_OF_CONTAINER;
095:            /**
096:             * Represents the key used by the renderer to obtain the URL for the
097:             * containment end image in the tree when containment is being used. A 
098:             * typical default is a close paren.
099:             */
100:            public static final String END_OF_CONTAINER = "endOfContainer";
101:
102:            /**
103:             * Defines the property name used within the configuration system to obtain
104:             * the URL for the tree's default {@link #END_OF_CONTAINER} image.
105:             */
106:            public static final String END_OF_CONTAINER_IMG = cfgPrefix
107:                    + END_OF_CONTAINER;
108:
109:            /**
110:             * Represents the key used by the renderer to obtain the URL for the
111:             * image depicting a collapsed branch point in the tree where there are 
112:             * additional following sibling nodes. For example:
113:             * 
114:             * <pre>
115:             *    middleBranchCollapsed
116:             *        |            
117:             *      +---+
118:             *      | + |--- node image and label
119:             *      +---+
120:             *        |                           
121:             *        |   
122:             * </pre>
123:             */
124:            public static final String MIDDLE_BRANCH_COLLAPSED = "middleBranchCollapsed";
125:
126:            /**
127:             * Defines the property name used within the configuration system to obtain
128:             * the URL for the tree's default {@link #MIDDLE_BRANCH_COLLAPSED} image.
129:             */
130:            public static final String MIDDLE_BRANCH_COLLAPSED_IMG = cfgPrefix
131:                    + MIDDLE_BRANCH_COLLAPSED;
132:
133:            /**
134:             * Represents the key used by the renderer to obtain the URL for the
135:             * image depicting an expanded branch point in the tree where there are 
136:             * additional following sibling nodes. For example:
137:             * 
138:             * <pre>
139:             *    middleBranchExpanded
140:             *        | 
141:             *      +---+
142:             *      | - +--- node image and label
143:             *      +---+     |
144:             *        |       +-- child 
145:             *        |       |
146:             * </pre>
147:             */
148:            public static final String MIDDLE_BRANCH_EXPANDED = "middleBranchExpanded";
149:
150:            /**
151:             * Defines the property name used within the configuration system to obtain
152:             * the URL for the tree's default {@link #MIDDLE_BRANCH_EXPANDED} image.
153:             */
154:            public static final String MIDDLE_BRANCH_EXPANDED_IMG = cfgPrefix
155:                    + MIDDLE_BRANCH_EXPANDED;
156:
157:            /**
158:             * Represents the key used by the renderer to obtain the URL for the
159:             * image depicting a collapsed branch point in the tree where there are no
160:             * additional following sibling nodes. For example:
161:             * 
162:             * <pre>
163:             *   lastBranchCollapsed
164:             *       |  
165:             *     +---+
166:             *     | + |--- node image and label
167:             *     +---+ 
168:             *    
169:             * </pre>
170:             */
171:            public static final String LAST_BRANCH_COLLAPSED = "lastBranchCollapsed";
172:
173:            /**
174:             * Defines the property name used within the configuration system to obtain
175:             * the URL for the tree's default {@link #LAST_BRANCH_COLLAPSED} image.
176:             */
177:            public static final String LAST_BRANCH_COLLAPSED_IMG = cfgPrefix
178:                    + LAST_BRANCH_COLLAPSED;
179:
180:            /**
181:             * Represents the key used by the renderer to obtain the URL for the
182:             * image depicting an expanded branch point in the tree where there are no
183:             * additional following sibling nodes. For example:
184:             * 
185:             * <pre>
186:             *   lastBranchExpanded
187:             *       | 
188:             *     +---+
189:             *     | - +--- node image and label
190:             *     +---+     |
191:             *               +--- child 
192:             *               |
193:             * </pre>
194:             */
195:            public static final String LAST_BRANCH_EXPANDED = "lastBranchExpanded";
196:
197:            /**
198:             * Defines the property name used within the configuration system to obtain
199:             * the URL for the tree's default {@link #LAST_BRANCH_EXPANDED} image.
200:             */
201:            public static final String LAST_BRANCH_EXPANDED_IMG = cfgPrefix
202:                    + LAST_BRANCH_EXPANDED;
203:
204:            /**
205:             * Represents the key used by the renderer to obtain the URL for the
206:             * image depicting an area of the tree not containing a branch. For example
207:             * the lastBranchExpanded example has been included again below but with 
208:             * an empty representation of this image below the lastBranchExpanded image.
209:             * 
210:             * <pre>
211:             *   lastBranchExpanded
212:             *       | 
213:             *     +---+
214:             *     | - +-- node image and label
215:             *     +---+     |
216:             *     +---+     +-- child
217:             *     |   |     |
218:             *     +---+     |
219:             * </pre>
220:             */
221:            public static final String NO_BRANCH = "noBranch";
222:
223:            /**
224:             * Defines the property name used within the configuration system to obtain
225:             * the URL for the tree's default {@link #NO_BRANCH} image.
226:             */
227:            public static final String NO_BRANCH_IMG = cfgPrefix + NO_BRANCH;
228:
229:            /**
230:             * Represents the key used by the renderer to obtain the URL for a single 
231:             * pixel transparent image suitable for stretching to fill areas of labels 
232:             * for spacing.
233:             * 
234:             * </pre>
235:             */
236:            public static final String TRANSPARENT_POINT = "transparentPoint";
237:
238:            /**
239:             * Defines the property name used within the configuration system to obtain
240:             * the URL for the tree's default {@link #TRANSPARENT_POINT} image.
241:             */
242:            public static final String TRANSPARENT_POINT_IMG = cfgPrefix
243:                    + TRANSPARENT_POINT;
244:
245:            /**
246:             * Represents the key used by the renderer to obtain the URL for the image 
247:             * representing the non expandable branch of a child node with additional 
248:             * following sibling nodes.
249:             * 
250:             * <pre>
251:             *   middleBranch
252:             *     |        
253:             *     +-- child image and label
254:             *     |
255:             * </pre>
256:             */
257:            public static final String MIDDLE_CHILD = "middleChild";
258:
259:            /**
260:             * Defines the property name used within the configuration system to obtain
261:             * the URL for the tree's default {@link #MIDDLE_CHILD} image.
262:             */
263:            public static final String MIDDLE_CHILD_IMG = cfgPrefix
264:                    + MIDDLE_CHILD;
265:
266:            /**
267:             * Represents the key used by the renderer to obtain the URL for a 
268:             * vertically repeatable version of an image representing the branch 
269:             * leading from the parent of an exposed child to the parent's following 
270:             * sibling. By using this repeatable version as a repeated background image
271:             * the text in rows can wrap and the tree branches will accomodate the 
272:             * expansion by appearing to expand and collapse vertically as needed.
273:             * 
274:             * <pre>
275:             *   skippedChild
276:             *     |   |
277:             *     |   +-- child of parallel branch skipped by parent's sibling branch
278:             *     |    
279:             *     +-- child's parent's following sibling
280:             *     
281:             * </pre>
282:             */
283:            public static final String SKIPPED_CHILD_RPT = "skippedChildRpt";
284:
285:            /**
286:             * Defines the property name used within the configuration system to obtain
287:             * the URL for the tree's default {@link #SKIPPED_CHILD_RPT} image.
288:             */
289:            public static final String SKIPPED_CHILD_RPT_IMG = cfgPrefix
290:                    + SKIPPED_CHILD_RPT;
291:
292:            /**
293:             * Represents the key used by the renderer to obtain the URL for an image 
294:             * representing the branch leading from the parent of an exposed child to 
295:             * the parent's following sibling. This may be the same as the repeatable
296:             * version or may differ if needed. 
297:             * 
298:             * <pre>
299:             *   skippedChild
300:             *     |   |
301:             *     |   +-- child of parallel branch skipped by parent's sibling branch
302:             *     |    
303:             *     +-- child's parent's following sibling
304:             *     
305:             * </pre>
306:             */
307:            public static final String SKIPPED_CHILD = "skippedChild";
308:
309:            /**
310:             * Defines the property name used within the configuration system to obtain
311:             * the URL for the tree's default {@link #SKIPPED_CHILD} image.
312:             */
313:            public static final String SKIPPED_CHILD_IMG = cfgPrefix
314:                    + SKIPPED_CHILD;
315:
316:            /**
317:             * Represents the key used by the renderer to obtain the URL for the branch
318:             * of a non-expandable child node with no additional following sibling 
319:             * nodes.
320:             * 
321:             * <pre>
322:             *   lastBranch
323:             *     |        
324:             *     +-- child image and label
325:             *     
326:             * </pre>
327:             */
328:            public static final String LAST_CHILD = "lastChild";
329:
330:            /**
331:             * Defines the property name used within the configuration system to obtain
332:             * the URL for the tree's default {@link #LAST_CHILD} image.
333:             */
334:            public static final String LAST_CHILD_IMG = cfgPrefix + LAST_CHILD;
335:
336:            /**
337:             * Represents the key used by the renderer to obtain the URL for an image 
338:             * used to show aspects of a node in the tree. Aspects do not receive a 
339:             * horizontal branch connected to the vertical child branch of a parent 
340:             * node thus implying that they are aspects of the parent node and not 
341:             * child nodes.
342:             * 
343:             * <pre>
344:             *   an expanded middle branch
345:             *     | 
346:             *   +---+                         +------------------+
347:             *   | - +-- node image and label  | showAspectsImage |
348:             *   +---+     |                   +------------------+
349:             *     |       +-- child 
350:             *     |       |
351:             *   
352:             * </pre>
353:             */
354:            public static final String SHOW_ASPECTS = "showAspects";
355:
356:            /**
357:             * Defines the property name used within the configuration system to obtain
358:             * the URL for the tree's default {@link #SHOW_ASPECTS} image.
359:             */
360:            public static final String SHOW_ASPECTS_IMG = cfgPrefix
361:                    + SHOW_ASPECTS;
362:
363:            /**
364:             * Represents the key used by the renderer to obtain the URL for an image 
365:             * used to hide aspects of a node in the tree. Aspects do not receive a 
366:             * horizontal branch connected to the vertical child branch of a parent 
367:             * node thus implying that they are aspects of the parent node and not 
368:             * child nodes.
369:             * 
370:             * <pre>
371:             *   an expanded middle branch
372:             *     | 
373:             *   +---+                         +------------------+
374:             *   | - +-- node image and label  | hideAspectsImage |
375:             *   +---+     | aspect 1          +------------------+
376:             *     |       | aspect 2
377:             *     |       | aspect 3
378:             *     |       +-- child 
379:             *     |       |
380:             *   
381:             * </pre>
382:             */
383:            public static final String HIDE_ASPECTS = "hideAspects";
384:
385:            /**
386:             * Defines the property name used within the configuration system to obtain
387:             * the URL for the tree's default {@link #HIDE_ASPECTS} image.
388:             */
389:            public static final String HIDE_ASPECTS_IMG = cfgPrefix
390:                    + HIDE_ASPECTS;
391:
392:            /**
393:             * Builds a Map of the default images used in the tree control that can then
394:             * be customized by an application to override some or all of the URLs for
395:             * the images.
396:             * 
397:             * @return
398:             */
399:            public static Map getDefaultSet() {
400:                Map<String, String> map = new HashMap<String, String>();
401:
402:                map.put(FOLDER_OPEN, cCfg.getProperty(FOLDER_OPEN_IMG));
403:                map.put(FOLDER_CLOSED, cCfg.getProperty(FOLDER_CLOSED_IMG));
404:                map.put(START_OF_CONTAINER, cCfg
405:                        .getProperty(START_OF_CONTAINER_IMG));
406:                map.put(END_OF_CONTAINER, cCfg
407:                        .getProperty(END_OF_CONTAINER_IMG));
408:                map.put(MIDDLE_BRANCH_COLLAPSED, cCfg
409:                        .getProperty(MIDDLE_BRANCH_COLLAPSED_IMG));
410:                map.put(MIDDLE_BRANCH_EXPANDED, cCfg
411:                        .getProperty(MIDDLE_BRANCH_EXPANDED_IMG));
412:                map.put(LAST_BRANCH_COLLAPSED, cCfg
413:                        .getProperty(LAST_BRANCH_COLLAPSED_IMG));
414:                map.put(LAST_BRANCH_EXPANDED, cCfg
415:                        .getProperty(LAST_BRANCH_EXPANDED_IMG));
416:                map.put(MIDDLE_CHILD, cCfg.getProperty(MIDDLE_CHILD_IMG));
417:                map.put(SKIPPED_CHILD, cCfg.getProperty(SKIPPED_CHILD_IMG));
418:                map.put(SKIPPED_CHILD_RPT, cCfg
419:                        .getProperty(SKIPPED_CHILD_RPT_IMG));
420:                map.put(LAST_CHILD, cCfg.getProperty(LAST_CHILD_IMG));
421:                map.put(NO_BRANCH, cCfg.getProperty(NO_BRANCH_IMG));
422:                map.put(SHOW_ASPECTS, cCfg.getProperty(SHOW_ASPECTS_IMG));
423:                map.put(HIDE_ASPECTS, cCfg.getProperty(HIDE_ASPECTS_IMG));
424:                map.put(TRANSPARENT_POINT, cCfg
425:                        .getProperty(TRANSPARENT_POINT_IMG));
426:                return map;
427:            }
428:
429:            /*
430:             * Remove after i18n config tools are made available.
431:             */
432:            private static Properties loadConfiguration() {
433:                URL config = Images.class
434:                        .getResource("org/jasig/portal/channels/jsp/tree/Images.properties");
435:                if (config == null)
436:                    throw new PortalException(
437:                            "Unable to locate default images list file.");
438:                Properties defaults = new Properties();
439:                try {
440:                    defaults.load(config.openStream());
441:                } catch (IOException e) {
442:                    throw new PortalException(
443:                            "Unable to load default images list file.", e);
444:                }
445:                return defaults;
446:            }
447:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.