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


001:        /*
002:         * File   : $Source$
003:         * Date   : $Date$
004:         * Version: $Revision$
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.widgets;
033:
034:        import org.opencms.file.CmsObject;
035:        import org.opencms.main.OpenCms;
036:        import org.opencms.util.CmsStringUtil;
037:        import org.opencms.workplace.CmsWorkplace;
038:
039:        /**
040:         * Provides a OpenCms User selection widget, for use on a widget dialog.<p>
041:         *
042:         * @author Michael Moossen
043:         * 
044:         * @version $Revision$ 
045:         * 
046:         * @since 6.0.0 
047:         */
048:        public class CmsUserWidget extends A_CmsWidget {
049:
050:            /** Configuration parameter to set the flags of the users to display, optional. */
051:            public static final String CONFIGURATION_FLAGS = "flags";
052:
053:            /** Configuration parameter to set the group of users to display, optional. */
054:            public static final String CONFIGURATION_GROUP = "group";
055:
056:            /** The the flags used in the popup window. */
057:            private Integer m_flags;
058:
059:            /** The the group used in the popup window. */
060:            private String m_groupName;
061:
062:            /**
063:             * Creates a new user selection widget.<p>
064:             */
065:            public CmsUserWidget() {
066:
067:                // empty constructor is required for class registration
068:                this ("");
069:            }
070:
071:            /**
072:             * Creates a new user selection widget with the parameters to configure the popup window behaviour.<p>
073:             * 
074:             * @param flags the group flags to restrict the group selection, can be <code>null</code>
075:             * @param groupName the group to restrict the user selection, can be <code>null</code>
076:             */
077:            public CmsUserWidget(Integer flags, String groupName) {
078:
079:                m_flags = flags;
080:                m_groupName = groupName;
081:            }
082:
083:            /**
084:             * Creates a new user selection widget with the given configuration.<p>
085:             * 
086:             * @param configuration the configuration to use
087:             */
088:            public CmsUserWidget(String configuration) {
089:
090:                super (configuration);
091:            }
092:
093:            /**
094:             * @see org.opencms.widgets.A_CmsWidget#getConfiguration()
095:             */
096:            public String getConfiguration() {
097:
098:                StringBuffer result = new StringBuffer(8);
099:
100:                // append flags to configuration
101:                if (m_flags != null) {
102:                    if (result.length() > 0) {
103:                        result.append("|");
104:                    }
105:                    result.append(CONFIGURATION_FLAGS);
106:                    result.append("=");
107:                    result.append(m_flags);
108:                }
109:                // append group to configuration
110:                if (m_groupName != null) {
111:                    if (result.length() > 0) {
112:                        result.append("|");
113:                    }
114:                    result.append(CONFIGURATION_GROUP);
115:                    result.append("=");
116:                    result.append(m_groupName);
117:                }
118:
119:                return result.toString();
120:            }
121:
122:            /**
123:             * @see org.opencms.widgets.I_CmsWidget#getDialogIncludes(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog)
124:             */
125:            public String getDialogIncludes(CmsObject cms,
126:                    I_CmsWidgetDialog widgetDialog) {
127:
128:                StringBuffer result = new StringBuffer(16);
129:                result.append(getJSIncludeFile(CmsWorkplace.getSkinUri()
130:                        + "components/widgets/userselector.js"));
131:                return result.toString();
132:            }
133:
134:            /**
135:             * @see org.opencms.widgets.I_CmsWidget#getDialogWidget(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)
136:             */
137:            public String getDialogWidget(CmsObject cms,
138:                    I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) {
139:
140:                String id = param.getId();
141:                StringBuffer result = new StringBuffer(128);
142:
143:                result.append("<td class=\"xmlTd\">");
144:                result
145:                        .append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"maxwidth\"><tr><td style=\"width: 100%;\">");
146:                result.append("<input style=\"width: 99%;\" class=\"xmlInput");
147:                if (param.hasError()) {
148:                    result.append(" xmlInputError");
149:                }
150:                result.append("\" value=\"");
151:                result.append(param.getStringValue(cms));
152:                result.append("\" name=\"");
153:                result.append(id);
154:                result.append("\" id=\"");
155:                result.append(id);
156:                result.append("\"></td>");
157:                result.append(widgetDialog.dialogHorizontalSpacer(10));
158:                result
159:                        .append("<td><table class=\"editorbuttonbackground\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
160:
161:                StringBuffer buttonJs = new StringBuffer(8);
162:                buttonJs.append("javascript:openUserWin('");
163:                buttonJs.append(OpenCms.getSystemInfo().getOpenCmsContext());
164:                buttonJs.append("/system/workplace/commons/user_selection.jsp");
165:                buttonJs.append("','EDITOR',  '");
166:                buttonJs.append(id);
167:                buttonJs.append("', document, ");
168:                if (m_flags != null) {
169:                    buttonJs.append("'");
170:                    buttonJs.append(m_flags);
171:                    buttonJs.append("'");
172:                } else {
173:                    buttonJs.append("null");
174:                }
175:                buttonJs.append(", ");
176:                if (m_groupName != null) {
177:                    buttonJs.append("'");
178:                    buttonJs.append(m_groupName);
179:                    buttonJs.append("'");
180:                } else {
181:                    buttonJs.append("null");
182:                }
183:                buttonJs.append(");");
184:
185:                result
186:                        .append(widgetDialog
187:                                .button(
188:                                        buttonJs.toString(),
189:                                        null,
190:                                        "user",
191:                                        org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_SEARCH_0,
192:                                        widgetDialog.getButtonStyle()));
193:                result.append("</tr></table>");
194:                result.append("</td></tr></table>");
195:
196:                result.append("</td>");
197:
198:                return result.toString();
199:            }
200:
201:            /**
202:             * Returns the flags, or <code>null</code> if all.<p>
203:             *
204:             * @return the flags, or <code>null</code> if all
205:             */
206:            public Integer getFlags() {
207:
208:                return m_flags;
209:            }
210:
211:            /**
212:             * Returns the group name, or <code>null</code> if all.<p>
213:             *
214:             * @return the group name, or <code>null</code> if all
215:             */
216:            public String getGroupName() {
217:
218:                return m_groupName;
219:            }
220:
221:            /**
222:             * @see org.opencms.widgets.I_CmsWidget#newInstance()
223:             */
224:            public I_CmsWidget newInstance() {
225:
226:                return new CmsUserWidget(getConfiguration());
227:            }
228:
229:            /**
230:             * @see org.opencms.widgets.A_CmsWidget#setConfiguration(java.lang.String)
231:             */
232:            public void setConfiguration(String configuration) {
233:
234:                m_groupName = null;
235:                m_flags = null;
236:                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration)) {
237:                    int flagsIndex = configuration.indexOf(CONFIGURATION_FLAGS);
238:                    if (flagsIndex != -1) {
239:                        // user is given
240:                        String flags = configuration
241:                                .substring(CONFIGURATION_FLAGS.length() + 1);
242:                        if (flags.indexOf('|') != -1) {
243:                            // cut eventual following configuration values
244:                            flags = flags.substring(0, flags.indexOf('|'));
245:                        }
246:                        try {
247:                            m_flags = Integer.valueOf(flags);
248:                        } catch (Throwable t) {
249:                            // invalid flags
250:                        }
251:                    }
252:                    int groupIndex = configuration.indexOf(CONFIGURATION_GROUP);
253:                    if (groupIndex != -1) {
254:                        // group is given
255:                        String group = configuration
256:                                .substring(CONFIGURATION_GROUP.length() + 1);
257:                        if (group.indexOf('|') != -1) {
258:                            // cut eventual following configuration values
259:                            group = group.substring(0, group.indexOf('|'));
260:                        }
261:                        m_groupName = group;
262:                    }
263:                }
264:                super.setConfiguration(configuration);
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.