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


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsUserRoleDialog.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:26 $
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.tools.accounts;
033:
034:        import org.opencms.file.CmsUser;
035:        import org.opencms.jsp.CmsJspActionElement;
036:        import org.opencms.util.CmsUUID;
037:        import org.opencms.widgets.CmsDisplayWidget;
038:        import org.opencms.workplace.CmsWidgetDialog;
039:        import org.opencms.workplace.CmsWidgetDialogParameter;
040:
041:        import javax.servlet.http.HttpServletRequest;
042:        import javax.servlet.http.HttpServletResponse;
043:        import javax.servlet.jsp.PageContext;
044:
045:        /**
046:         * Dialog to edit the roles of a user.<p>
047:         * 
048:         * @author Raphael Schnuck 
049:         * 
050:         * @version $Revision: 1.4 $ 
051:         * 
052:         * @since 6.5.6
053:         */
054:        public class CmsUserRoleDialog extends CmsWidgetDialog {
055:
056:            /** localized messages Keys prefix. */
057:            public static final String KEY_PREFIX = "user";
058:
059:            /** Defines which pages are valid for this dialog. */
060:            public static final String[] PAGES = { "page1" };
061:
062:            /** The user object that is edited on this dialog. */
063:            protected CmsUser m_user;
064:
065:            /** Stores the value of the request parameter for the user id. */
066:            private String m_paramUserid;
067:
068:            /**
069:             * Public constructor with JSP action element.<p>
070:             * 
071:             * @param jsp an initialized JSP action element
072:             */
073:            public CmsUserRoleDialog(CmsJspActionElement jsp) {
074:
075:                super (jsp);
076:            }
077:
078:            /**
079:             * Public constructor with JSP variables.<p>
080:             * 
081:             * @param context the JSP page context
082:             * @param req the JSP request
083:             * @param res the JSP response
084:             */
085:            public CmsUserRoleDialog(PageContext context,
086:                    HttpServletRequest req, HttpServletResponse res) {
087:
088:                this (new CmsJspActionElement(context, req, res));
089:            }
090:
091:            /**
092:             * @see org.opencms.workplace.CmsWidgetDialog#actionCommit()
093:             */
094:            public void actionCommit() {
095:
096:                // noop
097:            }
098:
099:            /**
100:             * Returns the simple name of the user object.<p>
101:             * 
102:             * @return the simple name of the user object
103:             */
104:            public String getName() {
105:
106:                return m_user.getSimpleName();
107:            }
108:
109:            /**
110:             * Returns the user id parameter value.<p>
111:             * 
112:             * @return the user id parameter value
113:             */
114:            public String getParamUserid() {
115:
116:                return m_paramUserid;
117:            }
118:
119:            /**
120:             * This method is needed only for displaying reasons.<p>
121:             * 
122:             * @param name nothing to do with this parameter
123:             */
124:            public void setName(String name) {
125:
126:                // nothing will be done here, just to avoid warnings
127:                name.length();
128:            }
129:
130:            /**
131:             * Sets the user id parameter value.<p>
132:             * 
133:             * @param userId the user id parameter value
134:             */
135:            public void setParamUserid(String userId) {
136:
137:                m_paramUserid = userId;
138:            }
139:
140:            /**
141:             * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
142:             * 
143:             * This overwrites the method from the super class to create a layout variation for the widgets.<p>
144:             * 
145:             * @param dialog the dialog (page) to get the HTML for
146:             * @return the dialog HTML for all defined widgets of the named dialog (page)
147:             */
148:            protected String createDialogHtml(String dialog) {
149:
150:                StringBuffer result = new StringBuffer(1024);
151:
152:                result.append(createWidgetTableStart());
153:                // show error header once if there were validation errors
154:                result.append(createWidgetErrorHeader());
155:                if (dialog.equals(PAGES[0])) {
156:                    // create the widgets for the first dialog page
157:                    result
158:                            .append(dialogBlockStart(key(Messages.GUI_USER_EDITOR_LABEL_IDENTIFICATION_BLOCK_0)));
159:                    result.append(createWidgetTableStart());
160:                    result.append(createDialogRowsHtml(0, 2));
161:                    result.append(createWidgetTableEnd());
162:                    result.append(dialogBlockEnd());
163:                }
164:
165:                result.append(createWidgetTableEnd());
166:                return result.toString();
167:            }
168:
169:            /**
170:             * @see org.opencms.workplace.CmsWidgetDialog#defaultActionHtmlEnd()
171:             */
172:            protected String defaultActionHtmlEnd() {
173:
174:                return "";
175:            }
176:
177:            /**
178:             * @see org.opencms.workplace.CmsWidgetDialog#defineWidgets()
179:             */
180:            protected void defineWidgets() {
181:
182:                // initialize the user object to use for the dialog
183:                initUserObject();
184:
185:                setKeyPrefix(KEY_PREFIX);
186:
187:                // widgets to display
188:                addWidget(new CmsWidgetDialogParameter(this , "name", PAGES[0],
189:                        new CmsDisplayWidget()));
190:                addWidget(new CmsWidgetDialogParameter(m_user, "lastname",
191:                        PAGES[0], new CmsDisplayWidget()));
192:                addWidget(new CmsWidgetDialogParameter(m_user, "firstname",
193:                        PAGES[0], new CmsDisplayWidget()));
194:            }
195:
196:            /**
197:             * @see org.opencms.workplace.CmsWidgetDialog#getPageArray()
198:             */
199:            protected String[] getPageArray() {
200:
201:                return PAGES;
202:            }
203:
204:            /**
205:             * Initializes the user object to work with depending on the dialog state and request parameters.<p>
206:             */
207:            protected void initUserObject() {
208:
209:                try {
210:                    m_user = getCms().readUser(new CmsUUID(getParamUserid()));
211:                    return;
212:                } catch (Exception e) {
213:                    // noop
214:                }
215:            }
216:
217:            /**
218:             * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters()
219:             */
220:            protected void validateParamaters() throws Exception {
221:
222:                // test the needed parameters
223:                getCms().readUser(new CmsUUID(getParamUserid())).getName();
224:            }
225:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.