Source Code Cross Referenced for StandardNavigationsMenuDefinition.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » portalsite » menu » 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 » jetspeed 2.1.3 » org.apache.jetspeed.portalsite.menu 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.jetspeed.portalsite.menu;
018:
019:        import java.util.ArrayList;
020:        import java.util.List;
021:        import java.util.Locale;
022:        import java.util.MissingResourceException;
023:        import java.util.ResourceBundle;
024:
025:        import org.apache.jetspeed.om.folder.Folder;
026:        import org.apache.jetspeed.om.folder.impl.StandardMenuDefinitionImpl;
027:        import org.apache.jetspeed.om.folder.impl.StandardMenuIncludeDefinitionImpl;
028:        import org.apache.jetspeed.om.folder.impl.StandardMenuOptionsDefinitionImpl;
029:        import org.apache.jetspeed.om.folder.impl.StandardMenuSeparatorDefinitionImpl;
030:        import org.apache.jetspeed.om.page.Link;
031:        import org.apache.jetspeed.portalsite.view.SiteView;
032:
033:        /**
034:         * This class provides a menu definition for the standard
035:         * navigations menu.
036:         * 
037:         * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
038:         * @version $Id: StandardNavigationsMenuDefinition.java 568811 2007-08-23 03:00:37Z woonsan $
039:         */
040:        public class StandardNavigationsMenuDefinition extends
041:                StandardMenuDefinitionImpl {
042:            /**
043:             * menuElements - ordered polymorphic list of menu option, nested
044:             *                menu, separator, include, and exclude definitions
045:             */
046:            private List menuElements;
047:
048:            /**
049:             * StandardNavigationsMenuDefinition - constructor
050:             */
051:            public StandardNavigationsMenuDefinition() {
052:                super ();
053:            }
054:
055:            /**
056:             * getName - get menu name
057:             *
058:             * @return menu name
059:             */
060:            public String getName() {
061:                return SiteView.STANDARD_NAVIGATIONS_MENU_NAME;
062:            }
063:
064:            /**
065:             * getMenuElements - get ordered list of menu options,
066:             *                   nested menus, separators, included
067:             *                   menu, and excluded menu elements
068:             *
069:             * @return element list
070:             */
071:            public synchronized List getMenuElements() {
072:                // instantiate menu elements if necessary
073:                if (menuElements == null) {
074:                    menuElements = new ArrayList(4);
075:                    menuElements.add(new StandardMenuSeparatorDefinitionImpl() {
076:                        /**
077:                         * getText - get default text for separator
078:                         *
079:                         * @return text
080:                         */
081:                        public String getText() {
082:                            // use locale defaults
083:                            return getMenuSeparatorText(null,
084:                                    "menu.separator.folders");
085:                        }
086:
087:                        /**
088:                         * getText - get locale specific text for separator from metadata
089:                         *
090:                         * @param locale preferred locale
091:                         * @return text
092:                         */
093:                        public String getText(Locale locale) {
094:                            // use specified locale
095:                            return getMenuSeparatorText(locale,
096:                                    "menu.separator.folders");
097:                        }
098:                    });
099:                    menuElements.add(new StandardMenuOptionsDefinitionImpl() {
100:                        /**
101:                         * getOptions - get comma separated menu options
102:                         *
103:                         * @return option paths specification
104:                         */
105:                        public String getOptions() {
106:                            return "." + Folder.PATH_SEPARATOR + "*"
107:                                    + Folder.PATH_SEPARATOR;
108:                        }
109:
110:                        /**
111:                         * isRegexp - get regexp flag for interpreting option
112:                         *
113:                         * @return regexp flag
114:                         */
115:                        public boolean isRegexp() {
116:                            return true;
117:                        }
118:                    });
119:                    menuElements.add(new StandardMenuIncludeDefinitionImpl() {
120:                        /**
121:                         * getName - get menu name to nest or with options to include
122:                         *
123:                         * @return menu name
124:                         */
125:                        public String getName() {
126:                            return SiteView.CUSTOM_PAGE_NAVIGATIONS_MENU_NAME;
127:                        }
128:                    });
129:                    menuElements.add(new StandardMenuSeparatorDefinitionImpl() {
130:                        /**
131:                         * getText - get default text for separator
132:                         *
133:                         * @return text
134:                         */
135:                        public String getText() {
136:                            // use locale defaults
137:                            return getMenuSeparatorText(null,
138:                                    "menu.separator.links");
139:                        }
140:
141:                        /**
142:                         * getText - get locale specific text for separator from metadata
143:                         *
144:                         * @param locale preferred locale
145:                         * @return text
146:                         */
147:                        public String getText(Locale locale) {
148:                            // use specified locale
149:                            return getMenuSeparatorText(locale,
150:                                    "menu.separator.links");
151:                        }
152:                    });
153:                    menuElements.add(new StandardMenuOptionsDefinitionImpl() {
154:                        /**
155:                         * getOptions - get comma separated menu options
156:                         *
157:                         * @return option paths specification
158:                         */
159:                        public String getOptions() {
160:                            return Folder.PATH_SEPARATOR + "*"
161:                                    + Link.DOCUMENT_TYPE;
162:                        }
163:
164:                        /**
165:                         * isRegexp - get regexp flag for interpreting option
166:                         *
167:                         * @return regexp flag
168:                         */
169:                        public boolean isRegexp() {
170:                            return true;
171:                        }
172:                    });
173:                }
174:                return menuElements;
175:            }
176:
177:            /**
178:             * getSkin - get skin name for menu element
179:             *
180:             * @return skin name
181:             */
182:            public String getSkin() {
183:                return "left-navigations";
184:            }
185:
186:            /**
187:             * getMenuSeparatorText - lookup resource bundle based on locale
188:             *                        and use to extract menu separator text
189:             *
190:             * @param locale preferred locale
191:             * @param key message key for text
192:             */
193:            protected String getMenuSeparatorText(Locale locale, String key) {
194:                try {
195:                    // get resource bundle
196:                    ResourceBundle bundle = null;
197:                    if (locale != null) {
198:                        bundle = ResourceBundle
199:                                .getBundle(
200:                                        "org.apache.jetspeed.portalsite.menu.resources.MenuSeparators",
201:                                        locale);
202:                    } else {
203:                        bundle = ResourceBundle
204:                                .getBundle("org.apache.jetspeed.portalsite.menu.resources.MenuSeparators");
205:                    }
206:
207:                    // lookup and return keyed message
208:                    return bundle.getString(key);
209:                } catch (MissingResourceException mre) {
210:                }
211:                return null;
212:            }
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.