Source Code Cross Referenced for DashboardBean.java in  » Portal » jboss-portal-2.6.4 » org » jboss » portal » core » admin » ui » dashboard » 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 » jboss portal 2.6.4 » org.jboss.portal.core.admin.ui.dashboard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /******************************************************************************
002:         * JBoss, a division of Red Hat                                               *
003:         * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
004:         * contributors as indicated by the @authors tag. See the                     *
005:         * copyright.txt in the distribution for a full listing of                    *
006:         * individual contributors.                                                   *
007:         *                                                                            *
008:         * This is free software; you can redistribute it and/or modify it            *
009:         * under the terms of the GNU Lesser General Public License as                *
010:         * published by the Free Software Foundation; either version 2.1 of           *
011:         * the License, or (at your option) any later version.                        *
012:         *                                                                            *
013:         * This software is distributed in the hope that it will be useful,           *
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
016:         * Lesser General Public License for more details.                            *
017:         *                                                                            *
018:         * You should have received a copy of the GNU Lesser General Public           *
019:         * License along with this software; if not, write to the Free                *
020:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
021:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
022:         ******************************************************************************/package org.jboss.portal.core.admin.ui.dashboard;
023:
024:        import org.jboss.portal.common.util.IteratorStatus;
025:        import org.jboss.portal.core.admin.ui.actions.AddPageAction;
026:        import org.jboss.portal.core.admin.ui.common.PageManagerBean;
027:        import org.jboss.portal.core.admin.ui.portlet.PortletDefinitionInvoker;
028:        import org.jboss.portal.core.model.instance.InstanceContainer;
029:        import org.jboss.portal.core.model.portal.NoSuchPortalObjectException;
030:        import org.jboss.portal.core.model.portal.Page;
031:        import org.jboss.portal.core.model.portal.Portal;
032:        import org.jboss.portal.core.model.portal.PortalObject;
033:        import org.jboss.portal.core.model.portal.PortalObjectContainer;
034:        import org.jboss.portal.core.model.portal.PortalObjectId;
035:        import org.jboss.portal.core.model.portal.PortalObjectPath;
036:        import org.jboss.portal.theme.LayoutService;
037:        import org.jboss.portal.theme.ThemeConstants;
038:        import org.jboss.portal.theme.ThemeService;
039:
040:        import javax.faces.context.FacesContext;
041:        import javax.faces.model.SelectItem;
042:        import java.util.Collection;
043:
044:        /**
045:         * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
046:         * @version $Revision: 9130 $
047:         */
048:        public class DashboardBean implements  AddPageAction.Listener {
049:
050:            /** . */
051:            private static final PortalObjectId dashboardId = PortalObjectId
052:                    .parse("dashboard" + PortalObjectId.NAMESPACE_SEPARATOR
053:                            + PortalObjectPath.CanonicalFormat.PATH_SEPARATOR,
054:                            PortalObjectPath.CANONICAL_FORMAT);
055:
056:            // Wired services
057:
058:            /** . */
059:            public PortalObjectContainer portalObjectContainer;
060:
061:            /** . */
062:            public LayoutService layoutService;
063:
064:            /** . */
065:            public ThemeService themeService;
066:
067:            /** . */
068:            public InstanceContainer instanceContainer;
069:
070:            // Navigational state
071:
072:            /** . */
073:            public String selectedPageName;
074:
075:            // Runtime fields
076:
077:            /** . */
078:            public Portal userPortal;
079:
080:            /** . */
081:            public String selectedPageTheme;
082:
083:            /** . */
084:            public String selectedPageLayout;
085:
086:            /** . */
087:            public PageManagerBean pageManager;
088:
089:            /** . */
090:            public SelectItem[] pageItems;
091:
092:            /** . */
093:            public boolean selectePageIsDefault;
094:
095:            //
096:
097:            public void pageCreated(Page page) {
098:                // Select page to show
099:                selectedPageName = page.getName();
100:            }
101:
102:            public void actionRefresh() {
103:                refresh();
104:            }
105:
106:            public Page getSelectedPage() {
107:                return pageManager.page;
108:            }
109:
110:            private void refresh() {
111:                // Create page manager if it does not exit
112:                if (pageManager == null) {
113:                    pageManager = new PageManagerBean(layoutService,
114:                            new PortletDefinitionInvoker(instanceContainer));
115:                }
116:
117:                // Get user name
118:                String userId = FacesContext.getCurrentInstance()
119:                        .getExternalContext().getRemoteUser();
120:
121:                // Load portal
122:                userPortal = (Portal) portalObjectContainer.getObject(
123:                        dashboardId).getChild(userId);
124:
125:                if (userPortal == null) {
126:                    return;
127:                }
128:
129:                // Page for editing
130:                if (selectedPageName != null) {
131:                    pageManager.page = userPortal.getPage(selectedPageName);
132:                }
133:                if (pageManager.page == null) {
134:                    pageManager.page = userPortal.getDefaultPage();
135:                    selectedPageName = pageManager.page.getName();
136:                }
137:
138:                //
139:                String defaultPageName = pageManager.page
140:                        .getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
141:                if (defaultPageName == null) {
142:                    defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
143:                }
144:                selectePageIsDefault = selectedPageName.equals(defaultPageName);
145:
146:                //
147:                Collection pages = userPortal
148:                        .getChildren(PortalObject.PAGE_MASK);
149:                pageItems = new SelectItem[pages.size()];
150:                for (IteratorStatus i = new IteratorStatus(pages); i.hasNext();) {
151:                    PortalObject object = (PortalObject) i.next();
152:                    SelectItem item = new SelectItem();
153:                    item.setValue(object.getName());
154:                    item.setLabel(object.getName());
155:                    pageItems[i.getIndex()] = item;
156:                }
157:            }
158:
159:            public void renderRefresh() {
160:                refresh();
161:
162:                if (userPortal != null) {
163:                    //
164:                    selectedPageTheme = userPortal
165:                            .getDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME);
166:                    if (selectedPageTheme == null) {
167:                        selectedPageTheme = "";
168:                    }
169:
170:                    //
171:                    selectedPageLayout = userPortal
172:                            .getDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
173:                    if (selectedPageLayout == null) {
174:                        selectedPageLayout = "";
175:                    }
176:                }
177:            }
178:
179:            public void updateTheme() {
180:                userPortal.setDeclaredProperty(
181:                        ThemeConstants.PORTAL_PROP_THEME, ""
182:                                .equals(selectedPageTheme) ? null
183:                                : selectedPageTheme);
184:            }
185:
186:            public void updateLayout() {
187:                userPortal.setDeclaredProperty(
188:                        ThemeConstants.PORTAL_PROP_LAYOUT, ""
189:                                .equals(selectedPageLayout) ? null
190:                                : selectedPageLayout);
191:            }
192:
193:            public void destroyPage() {
194:                try {
195:                    userPortal.destroyChild(selectedPageName);
196:
197:                    // Fallback to default page
198:                    String defaultPageName = pageManager.page
199:                            .getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
200:                    if (defaultPageName == null) {
201:                        defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
202:                    }
203:                    selectedPageName = defaultPageName;
204:                } catch (NoSuchPortalObjectException e) {
205:                    e.printStackTrace();
206:                }
207:            }
208:
209:            public PortalObjectContainer getPortalObjectContainer() {
210:                return portalObjectContainer;
211:            }
212:
213:            public void setPortalObjectContainer(
214:                    PortalObjectContainer portalObjectContainer) {
215:                this .portalObjectContainer = portalObjectContainer;
216:            }
217:
218:            public LayoutService getLayoutService() {
219:                return layoutService;
220:            }
221:
222:            public void setLayoutService(LayoutService layoutService) {
223:                this .layoutService = layoutService;
224:            }
225:
226:            public ThemeService getThemeService() {
227:                return themeService;
228:            }
229:
230:            public void setThemeService(ThemeService themeService) {
231:                this .themeService = themeService;
232:            }
233:
234:            public InstanceContainer getInstanceContainer() {
235:                return instanceContainer;
236:            }
237:
238:            public void setInstanceContainer(InstanceContainer instanceContainer) {
239:                this.instanceContainer = instanceContainer;
240:            }
241:        }
ww_w__.___j___a_v__a___2___s___.__c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.