summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-01-18 05:03:03 (EST)
committerStephan Born2013-01-25 13:21:51 (EST)
commit166ef3c2998c1be6890ed3708b115afe727426b6 (patch)
tree69bf876eb24443635fa24cd44af3273e81e1d3f6
parenta4c15a74d57ea8aedb984f040f618ae46b27a41b (diff)
downloadorg.eclipse.stardust.ui.web-166ef3c2998c1be6890ed3708b115afe727426b6.zip
org.eclipse.stardust.ui.web-166ef3c2998c1be6890ed3708b115afe727426b6.tar.gz
org.eclipse.stardust.ui.web-166ef3c2998c1be6890ed3708b115afe727426b6.tar.bz2
Jira-ID: CRNT-27229
Added method getPortalTitle in portal-common/common/utils/FacesUtils.java Added method in PortalApplication.java and ExternalDocumentViewerBean to read the portalTitle Made changes to title in main.xhtml and externalDocumentView.xhtml. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@62129 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/common/Constants.java2
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/common/app/PortalApplication.java9
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/FacesUtils.java108
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/main.xhtml4
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java1
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java35
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/login.xhtml2
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/views/document/externalDocumentView.xhtml4
8 files changed, 128 insertions, 37 deletions
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/Constants.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/Constants.java
index e9da286..e61bec5 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/Constants.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/Constants.java
@@ -17,4 +17,6 @@ package org.eclipse.stardust.ui.web.common;
public interface Constants
{
String CONTEXT_PARAM_LOGOUT_URI = "com.infinity.bpm.portal.common.logoutURI";
+ String LOGIN_HEADING = "carnot.login.HEADING";
+ String COMMON_MESSAGE_BUNDLE = "web-ui-common-messages";// "CommonMessages";
}
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/app/PortalApplication.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/app/PortalApplication.java
index df98c06..d3707eb 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/app/PortalApplication.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/app/PortalApplication.java
@@ -333,6 +333,15 @@ public class PortalApplication
}
/**
+ *
+ * @return
+ */
+ public String getPortalHeader()
+ {
+ return FacesUtils.getPortalTitle();
+ }
+
+ /**
* @param viewDef
* @param url
* @param messageBean
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/FacesUtils.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/FacesUtils.java
index effec7c..42c0a6b 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/FacesUtils.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/FacesUtils.java
@@ -21,6 +21,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import java.util.StringTokenizer;
import javax.faces.FactoryFinder;
@@ -41,13 +43,13 @@ import org.eclipse.stardust.ui.web.common.ToolbarSection;
import org.eclipse.stardust.ui.web.common.app.View;
import org.eclipse.stardust.ui.web.common.log.LogManager;
import org.eclipse.stardust.ui.web.common.log.Logger;
-
+import org.eclipse.stardust.ui.web.common.Constants;
/**
* Provides Utility methods that can be called from XHTMLs
* @author Subodh.Godbole
*/
-public class FacesUtils
+public class FacesUtils implements Constants
{
private static final Logger trace = LogManager.getLogger(FacesUtils.class);
@@ -590,4 +592,106 @@ public class FacesUtils
{
return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
}
+
+ /**
+ *
+ * @return
+ */
+ public static String getPortalTitle()
+ {
+ String result = null;
+
+ String headingNlsKey = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(LOGIN_HEADING);
+ if (!StringUtils.isEmpty(headingNlsKey) && (-1 != headingNlsKey.indexOf("#")))
+ {
+ String bundleName = null;
+ String nlsKey = null;
+ Iterator<String> i = StringUtils.split(headingNlsKey, "#");
+ if (i.hasNext())
+ {
+ bundleName = i.next();
+ }
+ if (i.hasNext())
+ {
+ nlsKey = i.next();
+ }
+
+ if (!StringUtils.isEmpty(bundleName) && !StringUtils.isEmpty(nlsKey))
+ {
+ result = getString(getLocaleFromRequest(), bundleName, nlsKey);
+ }
+ }
+
+ if (null == result)
+ {
+ result = MessagePropertiesBean.getInstance().getString("portalFramework.title");
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param locale
+ * @param bundleName
+ * @param key
+ * @return
+ */
+ public static String getString(Locale locale, String bundleName, String key)
+ {
+ String text = null;
+ String failureMsg = null;
+ try
+ {
+ if (bundleName != null)
+ {
+ ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale, getCurrentClassLoader());
+ text = bundle != null ? bundle.getString(key) : null;
+ if (text == null)
+ {
+ // If message-bundle not found, search in common message bundle
+ String baseName = FacesContext.getCurrentInstance().getExternalContext()
+ .getInitParameter(COMMON_MESSAGE_BUNDLE);
+ if (baseName != null)
+ {
+ bundle = ResourceBundle.getBundle(baseName, locale, getCurrentClassLoader());
+ text = bundle != null ? bundle.getString(key) : null;
+ }
+ }
+ }
+ }
+ catch (MissingResourceException e)
+ {
+ failureMsg = "cannot find '" + key + "' in ResourceBundle";
+ }
+ catch (Exception e)
+ {
+ failureMsg = "error getting value of '" + key + "' in resource bundle '";
+ }
+ finally
+ {
+ if (failureMsg != null)
+ {
+ trace.error(failureMsg);
+ }
+ }
+ return text;
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected static ClassLoader getCurrentClassLoader()
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ if (null == loader)
+ {
+ loader = FacesUtils.class.getClassLoader();
+ }
+
+ return loader;
+ }
}
+ \ No newline at end of file
diff --git a/portal-common/src/main/resources/META-INF/xhtml/main.xhtml b/portal-common/src/main/resources/META-INF/xhtml/main.xhtml
index 2a1749e..b3f0a4b 100644
--- a/portal-common/src/main/resources/META-INF/xhtml/main.xhtml
+++ b/portal-common/src/main/resources/META-INF/xhtml/main.xhtml
@@ -2,7 +2,7 @@
<html style="width: 100%; height: 100%">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
- <title>#{common_msgPropsBean['portalFramework.title']}</title>
+ <title>#{ippPortalApp.portalHeader}</title>
<link rel="shortcut icon"
href="#{facesContext.externalContext.requestContextPath}/plugins/common/images/icons/favicon.ico"></link>
<script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/InfinityBPMI18N.js" />
@@ -27,4 +27,4 @@
</div>
<div id="ippPortalOverlays" style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px;"></div>
</body>
-</html> \ No newline at end of file
+</html> \ No newline at end of file
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java
index 5a92f56..a466577 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java
@@ -40,7 +40,6 @@ public class Constants
public final static String LOGIN_APP_ID = "carnot.login.APPLICATION_ID";
public final static String LOGIN_ADMIN_ROLE_REQUIRED = "carnot.login.ADMINISTRATOR_ROLE_REQUIRED";
public final static String LOGIN_MODEL_REQUIRED = "carnot.login.MODEL_REQUIRED";
- public final static String LOGIN_HEADING = "carnot.login.HEADING";
public final static String SESSION_LISTENER_BEANS = "carnot.SESSION_LISTENERS";
public final static String PRINCIPAL_PAGE = "carnot.PRINCIPAL_PAGE";
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java
index 7a637bf..446f1f4 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java
@@ -83,6 +83,8 @@ public class LoginDialogBean implements Serializable, InitializingBean
private String pluginLoginStyleSheetPath;
+ private String loginHeader;
+
public LoginDialogBean()
{
changePwdDialog = new ChangePasswordDialog();
@@ -180,37 +182,12 @@ public class LoginDialogBean implements Serializable, InitializingBean
public String getLoginHeader()
{
- String result = null;
-
- String headingNlsKey = FacesContext.getCurrentInstance()
- .getExternalContext()
- .getInitParameter(Constants.LOGIN_HEADING);
- if ( !StringUtils.isEmpty(headingNlsKey) && ( -1 != headingNlsKey.indexOf("#")))
+ if (StringUtils.isEmpty(loginHeader))
{
- String bundleName = null;
- String nlsKey = null;
- Iterator<String> i = StringUtils.split(headingNlsKey, "#");
- if (i.hasNext())
- {
- bundleName = i.next();
- }
- if (i.hasNext())
- {
- nlsKey = i.next();
- }
-
- if ( !StringUtils.isEmpty(bundleName) && !StringUtils.isEmpty(nlsKey))
- {
- result = Localizer.getString(new LocalizerKey(bundleName, nlsKey));
- }
- }
-
- if (null == result)
- {
- result = MessagePropertiesBean.getInstance().getString("portalFramework.title");
+ loginHeader = FacesUtils.getPortalTitle();
+ trace.debug("Login Header text set");
}
-
- return result;
+ return loginHeader;
}
public String getAccount()
diff --git a/views-common/src/main/resources/META-INF/xhtml/login.xhtml b/views-common/src/main/resources/META-INF/xhtml/login.xhtml
index 937fc58..427971f 100644
--- a/views-common/src/main/resources/META-INF/xhtml/login.xhtml
+++ b/views-common/src/main/resources/META-INF/xhtml/login.xhtml
@@ -13,7 +13,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>#{common_msgPropsBean['portalFramework.title']}</title>
+ <title>#{ippLoginDialog.loginHeader}</title>
<link rel="shortcut icon"
href="#{facesContext.externalContext.requestContextPath}/plugins/views-common/images/icons/favicon.ico"></link>
<script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/InfinityBpm_Core.js" />
diff --git a/views-common/src/main/resources/META-INF/xhtml/views/document/externalDocumentView.xhtml b/views-common/src/main/resources/META-INF/xhtml/views/document/externalDocumentView.xhtml
index 0585058..0b1341b 100644
--- a/views-common/src/main/resources/META-INF/xhtml/views/document/externalDocumentView.xhtml
+++ b/views-common/src/main/resources/META-INF/xhtml/views/document/externalDocumentView.xhtml
@@ -8,7 +8,7 @@
<html>
<head>
- <title>#{common_msgPropsBean['portalFramework.title']}</title>
+ <title>#{externalDocumentViewerBean.portalHeader}</title>
<ui:include src="/plugins/common/portalHead.xhtml" />
<script type="text/javascript">
window.onbeforeunload = onWindowUnload;
@@ -53,7 +53,7 @@
valueChangeListener="#{externalDocumentViewerBean.closeWindowListener}"
partialSubmit="true" immediate="true">
<pc:automationTag value="auto-COM-DocView-ExtDocView-ToolbarWindUploaded"/>
- </ice:inputHidden>
+ </ice:inputHidden>
</ice:form>
</body>
</html>