Source Code Cross Referenced for MenuElementImpl.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » portalsite » impl » 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.impl 
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.impl;
018:
019:        import java.util.Locale;
020:
021:        import org.apache.jetspeed.om.common.GenericMetadata;
022:        import org.apache.jetspeed.page.document.Node;
023:        import org.apache.jetspeed.portalsite.Menu;
024:        import org.apache.jetspeed.portalsite.MenuElement;
025:
026:        /**
027:         * This abstract class implements common features of portal-site
028:         * menu elements constructed and returned to decorators.
029:         * 
030:         * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
031:         * @version $Id: MenuElementImpl.java 516448 2007-03-09 16:25:47Z ate $
032:         */
033:        public abstract class MenuElementImpl implements  MenuElement, Cloneable {
034:            /**
035:             * parentMenu - parent menu implementation
036:             */
037:            private MenuImpl parent;
038:
039:            /**
040:             * node - underlying node proxy associated with this
041:             *        menu element in the site view
042:             */
043:            private Node node;
044:
045:            /**
046:             * skin - inherited skin name for menu element
047:             */
048:            private String skin;
049:
050:            /**
051:             * skinInherited - flag indicating whether skin value
052:             *                 has been inherited by propagating
053:             *                 from parent menu
054:             */
055:            private boolean skinInherited;
056:
057:            /**
058:             * MenuElementImpl - constructor
059:             *
060:             * @param parent containing menu implementation
061:             */
062:            protected MenuElementImpl(MenuImpl parent) {
063:                this .parent = parent;
064:            }
065:
066:            /**
067:             * MenuElementImpl - node proxy constructor
068:             *
069:             * @param parent containing menu implementation
070:             * @param node menu element node proxy
071:             */
072:            protected MenuElementImpl(MenuImpl parent, Node node) {
073:                this (parent);
074:                this .node = node;
075:            }
076:
077:            /**
078:             * clone - clone this instance
079:             *
080:             * @return unparented copy
081:             */
082:            public Object clone() throws CloneNotSupportedException {
083:                // clone this object
084:                MenuElementImpl copy = (MenuElementImpl) super .clone();
085:
086:                // clear parent reference
087:                copy.parent = null;
088:                return copy;
089:            }
090:
091:            /**
092:             * equals - compare menu element implementations
093:             *
094:             * @return equals result
095:             */
096:            public boolean equals(Object obj) {
097:                // compare menu implementation by type, url, and
098:                // name, instances with no url and no name are
099:                // always considered unique
100:                if (this .getClass().equals(obj.getClass())) {
101:                    String url = getUrl();
102:                    String name = getName();
103:                    if ((url != null) || (name != null)) {
104:                        String objUrl = ((MenuElementImpl) obj).getUrl();
105:                        String objName = ((MenuElementImpl) obj).getName();
106:                        return ((((name == null) && (objName == null)) || ((name != null) && name
107:                                .equals(objName))) && (((url != null) && url
108:                                .equals(objUrl)) || ((url == null) && (objUrl == null))));
109:                    }
110:                }
111:                return false;
112:            }
113:
114:            /**
115:             * getElementType - get type of menu element
116:             *
117:             * @return MENU_ELEMENT_TYPE, OPTION_ELEMENT_TYPE, or
118:             *         SEPARATOR_ELEMENT_TYPE
119:             */
120:            public abstract String getElementType();
121:
122:            /**
123:             * getParentMenu - get menu that contains menu element 
124:             *
125:             * @return parent menu
126:             */
127:            public Menu getParentMenu() {
128:                return parent;
129:            }
130:
131:            /**
132:             * setParentMenu - set menu that contains menu element 
133:             *
134:             * @param parentMenu parent menu
135:             */
136:            protected void setParentMenu(Menu parentMenu) {
137:                parent = (MenuImpl) parentMenu;
138:            }
139:
140:            /**
141:             * getName - get name of menu element used for default title
142:             *
143:             * @return menu element name
144:             */
145:            public String getName() {
146:                // no name by default
147:                return null;
148:            }
149:
150:            /**
151:             * getUrl - get url of menu element used for comparison
152:             *
153:             * @return folder, page, or link url
154:             */
155:            public String getUrl() {
156:                // no url by default
157:                return null;
158:            }
159:
160:            /**
161:             * getTitle - get default title for menu element
162:             *
163:             * @return title text
164:             */
165:            public String getTitle() {
166:                // return node or default title
167:                if (node != null) {
168:                    return node.getTitle();
169:                }
170:                return getName();
171:            }
172:
173:            /**
174:             * getShortTitle - get default short title for menu element
175:             *
176:             * @return short title text
177:             */
178:            public String getShortTitle() {
179:                // return node or default short title
180:                if (node != null) {
181:                    return node.getShortTitle();
182:                }
183:                return getName();
184:            }
185:
186:            /**
187:             * getTitle - get locale specific title for menu element
188:             *            from metadata
189:             *
190:             * @param locale preferred locale
191:             * @return title text
192:             */
193:            public String getTitle(Locale locale) {
194:                // return node or default title for preferred locale
195:                if (node != null) {
196:                    return node.getTitle(locale);
197:                }
198:                return getName();
199:            }
200:
201:            /**
202:             * getShortTitle - get locale specific short title for menu
203:             *                 element from metadata
204:             *
205:             * @param locale preferred locale
206:             * @return short title text
207:             */
208:            public String getShortTitle(Locale locale) {
209:                // return node or default short title for preferred locale
210:                if (node != null) {
211:                    return node.getShortTitle(locale);
212:                }
213:                return getName();
214:            }
215:
216:            /**
217:             * getMetadata - get generic metadata for menu element
218:             *
219:             * @return metadata
220:             */
221:            public GenericMetadata getMetadata() {
222:                // return node metadata
223:                if (node != null) {
224:                    GenericMetadata metadata = node.getMetadata();
225:                    if (metadata != null && metadata.getFields() != null
226:                            && !metadata.getFields().isEmpty()) {
227:                        return metadata;
228:                    }
229:                }
230:                return null;
231:            }
232:
233:            /**
234:             * getSkin - get skin name for menu element
235:             *
236:             * @return skin name
237:             */
238:            public String getSkin() {
239:                // no skin by default, check parent for
240:                // skin value and cache locally
241:                if (!skinInherited) {
242:                    if (parent != null) {
243:                        skin = parent.getSkin();
244:                    }
245:                    skinInherited = true;
246:                }
247:                return skin;
248:            }
249:
250:            /**
251:             * getNode - get menu element node proxy in the site view
252:             *
253:             * @return node proxy
254:             */
255:            protected Node getNode() {
256:                return node;
257:            }
258:
259:            /**
260:             * setNode - set menu element node proxy in the site view
261:             *
262:             * @param node node proxy
263:             */
264:            protected void setNode(Node node) {
265:                this.node = node;
266:            }
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.