Source Code Cross Referenced for CmsWorkplaceCustomFoot.java in  » Content-Management-System » opencms » org » opencms » workplace » 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 » opencms » org.opencms.workplace 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/CmsWorkplaceCustomFoot.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:45 $
004:         * Version: $Revision: 1.4 $
005:         *
006:         * This library is part of OpenCms -
007:         * the Open Source Content Management System
008:         *
009:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010:         *
011:         * This library is free software; you can redistribute it and/or
012:         * modify it under the terms of the GNU Lesser General Public
013:         * License as published by the Free Software Foundation; either
014:         * version 2.1 of the License, or (at your option) any later version.
015:         *
016:         * This library is distributed in the hope that it will be useful,
017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019:         * Lesser General Public License for more details.
020:         *
021:         * For further information about Alkacon Software GmbH, please see the
022:         * company website: http://www.alkacon.com
023:         *
024:         * For further information about OpenCms, please see the
025:         * project website: http://www.opencms.org
026:         * 
027:         * You should have received a copy of the GNU Lesser General Public
028:         * License along with this library; if not, write to the Free Software
029:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030:         */
031:
032:        package org.opencms.workplace;
033:
034:        import org.opencms.main.CmsException;
035:        import org.opencms.main.OpenCms;
036:        import org.opencms.util.CmsMacroResolver;
037:        import org.opencms.util.CmsStringUtil;
038:
039:        /**
040:         * A custom foot configuration to create a specially designed foot for the OpenCms workplace.<p>
041:         * 
042:         * @author Andreas Zahner 
043:         * 
044:         * @version $Revision: 1.4 $ 
045:         * 
046:         * @since 6.9.2 
047:         */
048:        public class CmsWorkplaceCustomFoot {
049:
050:            /** The default foot frame font color. */
051:            public static final String DEFAUL_COLOR = "WindowText";
052:
053:            /** The default foot frame background color. */
054:            public static final String DEFAULT_BACKGROUNDCOLOR = "ThreeDFace";
055:
056:            /** The default workplace foot text to display. */
057:            public static final String DEFAULT_TEXT = "%("
058:                    + CmsMacroResolver.KEY_LOCALIZED_PREFIX
059:                    + Messages.GUI_LABEL_USER_0 + ") %("
060:                    + CmsMacroResolver.KEY_CURRENT_USER_FULLNAME + ") %("
061:                    + CmsMacroResolver.KEY_LOCALIZED_PREFIX
062:                    + Messages.GUI_LABEL_LOGINTIME_0 + ") %("
063:                    + CmsMacroResolver.KEY_CURRENT_USER_LASTLOGIN + ") %("
064:                    + CmsMacroResolver.KEY_LOCALIZED_PREFIX
065:                    + Messages.GUI_LABEL_LOGINADDRESS_0 + ") %("
066:                    + CmsMacroResolver.KEY_OPENCMS + "remoteaddress) ";
067:
068:            /** The default workplace foot text to display. */
069:            public static final String DEFAULT_TEXT_WITH_OU = DEFAULT_TEXT
070:                    + "[%(" + CmsMacroResolver.KEY_LOCALIZED_PREFIX
071:                    + Messages.GUI_LABEL_OU_0 + ") %("
072:                    + CmsMacroResolver.KEY_CURRENT_ORGUNIT_DESCRIPTION + ")] ";
073:
074:            /** The background color of the foot frame. */
075:            private String m_backgroundColor;
076:
077:            /** The font color of the foot frame. */
078:            private String m_color;
079:
080:            /** Indicates if the default text should be replaced or kept. */
081:            private boolean m_replaceDefault;
082:
083:            /** The additional text of the foot frame. */
084:            private String m_text;
085:
086:            /** The text shown in the foot frame (can contain macros). */
087:            private String m_textShown;
088:
089:            /**
090:             * Empty constructor.<p>
091:             */
092:            public CmsWorkplaceCustomFoot() {
093:
094:                // initialize members with default or empty values
095:                m_backgroundColor = DEFAULT_BACKGROUNDCOLOR;
096:                m_color = DEFAUL_COLOR;
097:                m_text = "";
098:            }
099:
100:            /**
101:             * Returns the background color of the foot frame.<p>
102:             * 
103:             * @return the background color of the foot frame
104:             */
105:            public String getBackgroundColor() {
106:
107:                return m_backgroundColor;
108:            }
109:
110:            /**
111:             * Returns the font color of the foot frame.<p>
112:             * 
113:             * @return the font color of the foot frame
114:             */
115:            public String getColor() {
116:
117:                return m_color;
118:            }
119:
120:            /**
121:             * Returns the additional text of the foot frame.<p>
122:             * 
123:             * @return the additional text of the foot frame
124:             */
125:            public String getText() {
126:
127:                return m_text;
128:            }
129:
130:            /**
131:             * Returns the text of the foot frame with resolved macros.<p>
132:             * 
133:             * @param wp the initialized workplace dialog
134:             * @return the text of the foot frame with resolved macros
135:             */
136:            public String getTextResolved(CmsWorkplace wp) {
137:
138:                CmsMacroResolver resolver = CmsMacroResolver.newInstance();
139:                resolver.setCmsObject(wp.getCms());
140:                resolver.setJspPageContext(wp.getJsp().getJspContext());
141:                resolver.setMessages(wp.getMessages());
142:                if (m_textShown == null) {
143:                    // create the shown text containing macros
144:                    StringBuffer text = new StringBuffer(512);
145:                    if (!isReplaceDefault()) {
146:                        // the default text should be shown
147:                        try {
148:                            if (OpenCms.getOrgUnitManager()
149:                                    .getOrganizationalUnits(wp.getCms(), "",
150:                                            true).isEmpty()) {
151:                                text.append(DEFAULT_TEXT).append(" ");
152:                            } else {
153:                                text.append(DEFAULT_TEXT_WITH_OU).append(" ");
154:                            }
155:                        } catch (CmsException e) {
156:                            text.append(DEFAULT_TEXT).append(" ");
157:                        }
158:                    }
159:                    text.append(m_text);
160:                    m_textShown = text.toString();
161:                }
162:                // return the resolved text
163:                return resolver.resolveMacros(m_textShown);
164:            }
165:
166:            /**
167:             * Returns if the default text should be replaced or kept.<p>
168:             * 
169:             * @return true if the default text should be replaced, otherwise false
170:             */
171:            public boolean isReplaceDefault() {
172:
173:                return m_replaceDefault;
174:            }
175:
176:            /**
177:             * Sets the background color of the foot frame.<p>
178:             * 
179:             * @param backgroundColor the background color of the foot frame
180:             */
181:            public void setBackgroundColor(String backgroundColor) {
182:
183:                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(backgroundColor)) {
184:                    m_backgroundColor = backgroundColor;
185:                }
186:            }
187:
188:            /**
189:             * Sets the font color of the foot frame.<p>
190:             * 
191:             * @param color the font color of the foot frame
192:             */
193:            public void setColor(String color) {
194:
195:                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(color)) {
196:                    m_color = color;
197:                }
198:            }
199:
200:            /**
201:             * Sets the additional text of the foot frame.<p>
202:             * 
203:             * @param text the additional text of the foot frame
204:             * @param replaceDefault flag indicating if the default text should be replaced or kept
205:             */
206:            public void setText(String text, String replaceDefault) {
207:
208:                m_replaceDefault = Boolean.valueOf(replaceDefault)
209:                        .booleanValue();
210:                m_text = text;
211:            }
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.