Source Code Cross Referenced for CmsGroupOverviewDialog.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/CmsGroupOverviewDialog.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:25 $
004:         * Version: $Revision: 1.14 $
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.CmsGroup;
035:        import org.opencms.jsp.CmsJspActionElement;
036:        import org.opencms.main.CmsException;
037:        import org.opencms.main.CmsIllegalArgumentException;
038:        import org.opencms.main.OpenCms;
039:        import org.opencms.util.CmsStringUtil;
040:        import org.opencms.util.CmsUUID;
041:        import org.opencms.widgets.CmsDisplayWidget;
042:        import org.opencms.workplace.CmsWidgetDialog;
043:        import org.opencms.workplace.CmsWidgetDialogParameter;
044:
045:        import java.util.ArrayList;
046:
047:        import javax.servlet.http.HttpServletRequest;
048:        import javax.servlet.http.HttpServletResponse;
049:        import javax.servlet.jsp.PageContext;
050:
051:        /**
052:         * The group overview and group info widget dialog.<p>
053:         * 
054:         * @author Michael Moossen 
055:         * 
056:         * @version $Revision: 1.14 $ 
057:         * 
058:         * @since 6.0.0 
059:         */
060:        public class CmsGroupOverviewDialog extends CmsWidgetDialog {
061:
062:            /** localized messages Keys prefix. */
063:            public static final String KEY_PREFIX = "group.ov";
064:
065:            /** Defines which pages are valid for this dialog. */
066:            public static final String[] PAGES = { "page1" };
067:
068:            /** Request parameter name for the user id. */
069:            public static final String PARAM_GROUPID = "groupid";
070:
071:            /** The user object that is edited on this dialog. */
072:            protected CmsGroup m_group;
073:
074:            /** Stores the value of the request parameter for the group id. */
075:            private String m_paramGroupid;
076:
077:            /** Auxiliary Property for better representation of the bean parentId property. */
078:            private String m_parentGroup;
079:
080:            /**
081:             * Public constructor with JSP action element.<p>
082:             * 
083:             * @param jsp an initialized JSP action element
084:             */
085:            public CmsGroupOverviewDialog(CmsJspActionElement jsp) {
086:
087:                super (jsp);
088:
089:            }
090:
091:            /**
092:             * Public constructor with JSP variables.<p>
093:             * 
094:             * @param context the JSP page context
095:             * @param req the JSP request
096:             * @param res the JSP response
097:             */
098:            public CmsGroupOverviewDialog(PageContext context,
099:                    HttpServletRequest req, HttpServletResponse res) {
100:
101:                this (new CmsJspActionElement(context, req, res));
102:            }
103:
104:            /**
105:             * Commits the edited group to the db.<p>
106:             */
107:            public void actionCommit() {
108:
109:                // no saving needed
110:                setCommitErrors(new ArrayList());
111:            }
112:
113:            /**
114:             * Returns the description of the parent ou.<p>
115:             * 
116:             * @return the description of the parent ou
117:             */
118:            public String getAssignedOu() {
119:
120:                try {
121:                    return OpenCms.getOrgUnitManager().readOrganizationalUnit(
122:                            getCms(), m_group.getOuFqn()).getDisplayName(
123:                            getLocale());
124:                } catch (CmsException e) {
125:                    return null;
126:                }
127:            }
128:
129:            /**
130:             * Returns the localized description of the group if the description is a message key.<p>
131:             * 
132:             * @return the localized description of the group if the description is a message key
133:             */
134:            public String getDescription() {
135:
136:                return m_group.getDescription(getLocale());
137:            }
138:
139:            /**
140:             * Returns the simple name of the user object.<p>
141:             * 
142:             * @return the simple name of the user object
143:             */
144:            public String getName() {
145:
146:                return m_group.getSimpleName();
147:            }
148:
149:            /**
150:             * Returns the user id parameter value.<p>
151:             * 
152:             * @return the user id parameter value
153:             */
154:            public String getParamGroupid() {
155:
156:                return m_paramGroupid;
157:            }
158:
159:            /**
160:             * Returns the parent Group name.<p>
161:             *
162:             * @return the parent Group name
163:             */
164:            public String getParentGroup() {
165:
166:                return m_parentGroup;
167:            }
168:
169:            /**
170:             * Setter for widget definition.<p>
171:             * 
172:             * @param assignedOu the ou description
173:             */
174:            public void setAssignedOu(String assignedOu) {
175:
176:                assignedOu.length();
177:            }
178:
179:            /**
180:             * Sets the description of the group.<p>
181:             * 
182:             * @param description the description of the group
183:             */
184:            public void setDescription(String description) {
185:
186:                m_group.setDescription(description);
187:            }
188:
189:            /**
190:             * Sets the name of the user object.<p>
191:             * 
192:             * @param name the name of the user object
193:             */
194:            public void setName(String name) {
195:
196:                name.length();
197:            }
198:
199:            /**
200:             * Sets the user id parameter value.<p>
201:             * 
202:             * @param userId the user id parameter value
203:             */
204:            public void setParamGroupid(String userId) {
205:
206:                m_paramGroupid = userId;
207:            }
208:
209:            /**
210:             * Sets the parent Group name.<p>
211:             *
212:             * @param parentGroup the parent Group name to set
213:             */
214:            public void setParentGroup(String parentGroup) {
215:
216:                if (CmsStringUtil.isEmpty(parentGroup)
217:                        || parentGroup.equals("null")
218:                        || parentGroup.equals("none")) {
219:                    parentGroup = null;
220:                }
221:                if (parentGroup != null) {
222:                    try {
223:                        getCms().readGroup(parentGroup);
224:                    } catch (CmsException e) {
225:                        throw new CmsIllegalArgumentException(e
226:                                .getMessageContainer());
227:                    }
228:                }
229:                m_parentGroup = parentGroup;
230:            }
231:
232:            /**
233:             * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
234:             * 
235:             * This overwrites the method from the super class to create a layout variation for the widgets.<p>
236:             * 
237:             * @param dialog the dialog (page) to get the HTML for
238:             * @return the dialog HTML for all defined widgets of the named dialog (page)
239:             */
240:            protected String createDialogHtml(String dialog) {
241:
242:                StringBuffer result = new StringBuffer(1024);
243:
244:                // create widget table
245:                result.append(createWidgetTableStart());
246:
247:                // show error header once if there were validation errors
248:                result.append(createWidgetErrorHeader());
249:
250:                int n = (!isOverview() ? 2 : 4);
251:                if (dialog.equals(PAGES[0])) {
252:                    // create the widgets for the first dialog page
253:                    result
254:                            .append(dialogBlockStart(key(Messages.GUI_GROUP_EDITOR_LABEL_IDENTIFICATION_BLOCK_0)));
255:                    result.append(createWidgetTableStart());
256:                    result.append(createDialogRowsHtml(0, n));
257:                    result.append(createWidgetTableEnd());
258:                    result.append(dialogBlockEnd());
259:                    if (isOverview()) {
260:                        result
261:                                .append(dialogBlockStart(key(Messages.GUI_GROUP_EDITOR_LABEL_FLAGS_BLOCK_0)));
262:                        result.append(createWidgetTableStart());
263:                        result.append(createDialogRowsHtml(5, 6));
264:                        result.append(createWidgetTableEnd());
265:                        result.append(dialogBlockEnd());
266:                    }
267:                }
268:
269:                // close widget table
270:                result.append(createWidgetTableEnd());
271:
272:                return result.toString();
273:            }
274:
275:            /**
276:             * @see org.opencms.workplace.CmsWidgetDialog#defaultActionHtmlEnd()
277:             */
278:            protected String defaultActionHtmlEnd() {
279:
280:                return "";
281:            }
282:
283:            /**
284:             * Creates the list of widgets for this dialog.<p>
285:             */
286:            protected void defineWidgets() {
287:
288:                // initialize the user object to use for the dialog
289:                initGroupObject();
290:
291:                setKeyPrefix(KEY_PREFIX);
292:
293:                // widgets to display
294:                if (!isOverview()) {
295:                    addWidget(new CmsWidgetDialogParameter(this , "name",
296:                            PAGES[0], new CmsDisplayWidget()));
297:                    addWidget(new CmsWidgetDialogParameter(this , "description",
298:                            PAGES[0], new CmsDisplayWidget()));
299:                    addWidget(new CmsWidgetDialogParameter(this , "assignedOu",
300:                            PAGES[0], new CmsDisplayWidget()));
301:                } else {
302:                    addWidget(new CmsWidgetDialogParameter(this , "name",
303:                            PAGES[0], new CmsDisplayWidget()));
304:                    addWidget(new CmsWidgetDialogParameter(this , "description",
305:                            PAGES[0], new CmsDisplayWidget()));
306:                    addWidget(new CmsWidgetDialogParameter(this , "assignedOu",
307:                            PAGES[0], new CmsDisplayWidget()));
308:                    addWidget(new CmsWidgetDialogParameter(this , "parentGroup",
309:                            PAGES[0], new CmsDisplayWidget()));
310:                    addWidget(new CmsWidgetDialogParameter(m_group, "enabled",
311:                            PAGES[0], new CmsDisplayWidget()));
312:                    addWidget(new CmsWidgetDialogParameter(m_group,
313:                            "projectManager", PAGES[0], new CmsDisplayWidget()));
314:                    addWidget(new CmsWidgetDialogParameter(m_group,
315:                            "projectCoWorker", PAGES[0], new CmsDisplayWidget()));
316:                }
317:            }
318:
319:            /**
320:             * @see org.opencms.workplace.CmsWidgetDialog#getPageArray()
321:             */
322:            protected String[] getPageArray() {
323:
324:                return PAGES;
325:            }
326:
327:            /**
328:             * Initializes the group object.<p>
329:             */
330:            protected void initGroupObject() {
331:
332:                try {
333:                    // edit an existing group, get the group object from db
334:                    m_group = getCms()
335:                            .readGroup(new CmsUUID(getParamGroupid()));
336:                    setParentGroup(getCms().readGroup(m_group.getParentId())
337:                            .getName());
338:                } catch (CmsException e) {
339:                    // should never happen
340:                }
341:            }
342:
343:            /**
344:             * @see org.opencms.workplace.CmsWorkplace#initMessages()
345:             */
346:            protected void initMessages() {
347:
348:                // add specific dialog resource bundle
349:                addMessages(Messages.get().getBundleName());
350:                // add default resource bundles
351:                super .initMessages();
352:            }
353:
354:            /**
355:             * Overridden to set the online help path for this dialog.<p>
356:             * 
357:             * @see org.opencms.workplace.CmsWorkplace#initWorkplaceMembers(org.opencms.jsp.CmsJspActionElement)
358:             */
359:            protected void initWorkplaceMembers(CmsJspActionElement jsp) {
360:
361:                super .initWorkplaceMembers(jsp);
362:                setOnlineHelpUriCustom("/accounts/groups/overview/");
363:            }
364:
365:            /**
366:             * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters()
367:             */
368:            protected void validateParamaters() throws Exception {
369:
370:                // test the needed parameters
371:                getCms().readGroup(new CmsUUID(getParamGroupid())).getName();
372:            }
373:
374:            /**
375:             * Checks if the group overview has to be displayed.<p>
376:             * 
377:             * @return <code>true</code> if the group overview has to be displayed
378:             */
379:            private boolean isOverview() {
380:
381:                return getCurrentToolPath().endsWith("/groups/edit");
382:            }
383:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.