Source Code Cross Referenced for WebCommonService.java in  » Workflow-Engines » wilos » wilos » presentation » web » utils » 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 » Workflow Engines » wilos » wilos.presentation.web.utils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
003:         * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
004:         * Copyright (C) 2007 Mathieu BENOIT <mbenoit@wilos-project.org>
005:         *
006:         * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
007:         * General Public License as published by the Free Software Foundation; either version 2 of the License,
008:         * or (at your option) any later version.
009:         *
010:         * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
011:         * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012:         * GNU General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU General Public License along with this program; if not,
015:         * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
016:         */
017:
018:        package wilos.presentation.web.utils;
019:
020:        import javax.faces.application.FacesMessage;
021:        import javax.faces.context.FacesContext;
022:
023:        import wilos.presentation.web.template.MenuBean;
024:        import wilos.presentation.web.template.PageContentBean;
025:        import wilos.resources.WilosBundle;
026:        import wilos.utils.Constantes.State;
027:
028:        public class WebCommonService {
029:
030:            /* Manage Beans */
031:            /**
032:             * Gets a bean thanks to its name
033:             * @param _beanName the name of the bean
034:             * @return the expected bean
035:             */
036:            public static Object getBean(String _beanName) {
037:                return getCurrentFacesContext().getApplication()
038:                        .getVariableResolver().resolveVariable(
039:                                getCurrentFacesContext(), _beanName);
040:            }
041:
042:            /* Manage pages */
043:
044:            /**
045:             * Changes the content of the page 
046:             * @param _pageUrl the new url of the new page to display
047:             */
048:            public static void changeContentPage(String _pageUrl) {
049:                getMenuBean().changePage(_pageUrl);
050:            }
051:
052:            /**
053:             * Gets the currently selected panel
054:             * @return the selected panel
055:             */
056:            public static PageContentBean getSelectedPanel() {
057:                return getMenuBean().getSelectedPanel();
058:            }
059:
060:            /* Manage messages */
061:
062:            /**
063:             * Displays a information message
064:             * @param _message the message to display
065:             */
066:            public static void addInfoMessage(String _message) {
067:                FacesMessage message = new FacesMessage();
068:                message.setSummary(_message);
069:                message.setSeverity(FacesMessage.SEVERITY_INFO);
070:                getCurrentFacesContext().addMessage(null, message);
071:            }
072:
073:            /**
074:             * Displays an error message
075:             * @param _message the message to display
076:             */
077:            public static void addErrorMessage(String _message) {
078:                FacesMessage message = new FacesMessage();
079:                message.setSummary(_message);
080:                message.setSeverity(FacesMessage.SEVERITY_ERROR);
081:                getCurrentFacesContext().addMessage(null, message);
082:            }
083:
084:            /* Manage constante translation according the language */
085:
086:            /**
087:             * Gets the state currently displayed
088:             * @param _state the current state
089:             * @return the state to display
090:             */
091:            public static String getDisplayedState(String _state) {
092:                String stateInString = "";
093:                if (_state.equals(State.CREATED)) {
094:                    stateInString = WilosBundle
095:                            .getText("constantes.state.created");
096:                } else if (_state.equals(State.READY)) {
097:                    stateInString = WilosBundle
098:                            .getText("constantes.state.ready");
099:                } else if (_state.equals(State.STARTED)) {
100:                    stateInString = WilosBundle
101:                            .getText("constantes.state.started");
102:                } else if (_state.equals(State.SUSPENDED)) {
103:                    stateInString = WilosBundle
104:                            .getText("constantes.state.suspended");
105:                } else if (_state.equals(State.FINISHED)) {
106:                    stateInString = WilosBundle
107:                            .getText("constantes.state.finished");
108:                }
109:                return stateInString;
110:            }
111:
112:            /**
113:             * Gets the state currently displayed fo a milestone
114:             * @param _state the current state
115:             * @return the state to display
116:             */
117:            public static String getDisplayedStateForMilestone(String _state) {
118:                String stateInString = "";
119:                if (_state.equals(State.CREATED)) {
120:                    stateInString = WilosBundle
121:                            .getText("constantes.state.created.ms");
122:                } else if (_state.equals(State.READY)) {
123:                    stateInString = WilosBundle
124:                            .getText("constantes.state.ready.ms");
125:                } else if (_state.equals(State.FINISHED)) {
126:                    stateInString = WilosBundle
127:                            .getText("constantes.state.finished.ms");
128:                }
129:                return stateInString;
130:            }
131:
132:            /**
133:             * Gets the state currently displayed for a work product
134:             * @param _state the current state
135:             * @return the state to display
136:             */
137:            public static String getDisplayedStateForWorkProduct(String _state) {
138:                String stateInString = "";
139:                if (_state.equals(State.CREATED)) {
140:                    stateInString = WilosBundle
141:                            .getText("constantes.state.created.wp");
142:                } else if (_state.equals(State.READY)) {
143:                    stateInString = WilosBundle
144:                            .getText("constantes.state.ready.wp");
145:                } else {
146:                    stateInString = _state;
147:                }
148:                return stateInString;
149:            }
150:
151:            /* Private methods */
152:
153:            /**
154:             * Gets the current faces context
155:             * @return the faces context
156:             */
157:            private static FacesContext getCurrentFacesContext() {
158:                return FacesContext.getCurrentInstance();
159:            }
160:
161:            /**
162:             * Gets the menu bean
163:             * @return the menu bean
164:             */
165:            private static MenuBean getMenuBean() {
166:                MenuBean menuBean = (MenuBean) getCurrentFacesContext()
167:                        .getApplication().createValueBinding("#{menu}")
168:                        .getValue(getCurrentFacesContext());
169:                return menuBean;
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.