summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-07-18 04:50:30 (EDT)
committer Stephan Born2013-09-23 04:54:07 (EDT)
commit214a88dcda00b3bc25cb8ad5ad1b1438d75bb964 (patch)
tree9055fa133c7ee0dd413ec2b150091094336ed1b0
parent4c7e4786483e28aae688d580631159127f3025a7 (diff)
downloadorg.eclipse.stardust.ui.web-214a88dcda00b3bc25cb8ad5ad1b1438d75bb964.zip
org.eclipse.stardust.ui.web-214a88dcda00b3bc25cb8ad5ad1b1438d75bb964.tar.gz
org.eclipse.stardust.ui.web-214a88dcda00b3bc25cb8ad5ad1b1438d75bb964.tar.bz2
Jira-ID: CRNT-28362
-Message Dialog Appears left aligned 1)Added portalSingleViewUtils.js to handle PopupDialog centering. 2)Added call from PopupDialog.java for resizeDialog git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@66087 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Sidharth Singh <sidharth.singh@sungard.com>
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/common/PopupUIComponentBean.java2
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/PopupDialog.java5
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/js/portalSingleViewUtils.js101
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/portalSingleViewMain.xhtml1
4 files changed, 103 insertions, 6 deletions
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/PopupUIComponentBean.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/PopupUIComponentBean.java
index 5e12a93..b89b6fb 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/PopupUIComponentBean.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/PopupUIComponentBean.java
@@ -116,7 +116,6 @@ public abstract class PopupUIComponentBean extends UIComponentBean
// FOR PANAMA
String popupScript = "parent.BridgeUtils.Dialog.open(" + fromlaunchPanels + ");";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), popupScript);
PortalApplication.getInstance().addEventScript(popupScript);
if ((null != focusView) && !PortalUiController.getInstance().broadcastVetoableViewEvent(focusView, ViewEventType.DEACTIVATED))
@@ -133,7 +132,6 @@ public abstract class PopupUIComponentBean extends UIComponentBean
if (condition)
{
String positionPopupScript = "InfinityBpm.Core.positionMessageDialog('" + divId + "');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), positionPopupScript);
PortalApplication.getInstance().addEventScript(positionPopupScript);
}
}
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/PopupDialog.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/PopupDialog.java
index 405a9d2..547d154 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/PopupDialog.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/util/PopupDialog.java
@@ -133,7 +133,6 @@ public abstract class PopupDialog implements Serializable
// TODO trace
}
}
-
addPopupCenteringScript();
visible = true;
@@ -141,7 +140,6 @@ public abstract class PopupDialog implements Serializable
if (modal)
{
String popupScript = "parent.BridgeUtils.Dialog.open(" + fromlaunchPanels + ");";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), popupScript);
PortalApplication.getInstance().addEventScript(popupScript);
}
@@ -158,8 +156,7 @@ public abstract class PopupDialog implements Serializable
{
if (popupAutoCenter)
{
- String positionPopupScript = "InfinityBpm.Core.positionMessageDialog('" + getBeanId() + "');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), positionPopupScript);
+ String positionPopupScript = "resizeMessageDialog('" + getBeanId() + "');";
PortalApplicationEventScript.getInstance().addEventScript(positionPopupScript);
}
}
diff --git a/portal-common/src/main/resources/META-INF/xhtml/js/portalSingleViewUtils.js b/portal-common/src/main/resources/META-INF/xhtml/js/portalSingleViewUtils.js
new file mode 100644
index 0000000..62411a1
--- /dev/null
+++ b/portal-common/src/main/resources/META-INF/xhtml/js/portalSingleViewUtils.js
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+/**
+ *
+ * @param divId
+ */
+function resizeMessageDialog(divId) {
+ var scrollX = 0;
+ var scrollY = 0;
+ var mainWin = window;
+ if (navigator.appName == 'Netscape') {
+ scrollX = mainWin.pageXOffset;
+ scrollY = mainWin.pageYOffset;
+ } else if (navigator.appName == 'Microsoft Internet Explorer') {
+ scrollX = mainWin.document.documentElement.scrollLeft;
+ scrollY = mainWin.document.documentElement.scrollTop;
+ }
+ var windowSize = getBrowserDimensions(mainWin);
+ var popupDivs = getElementsWithIDLike('div', divId, document);
+ if (popupDivs && (popupDivs.length > 0)) {
+ for ( var i = 0; i < popupDivs.length; i++) {
+ try {
+ var popupDiv = popupDivs[i];
+ var widthOffset = (popupDiv.offsetWidth < windowSize.width) ? popupDiv.offsetWidth
+ : 0;
+ var heightOffset = (popupDiv.offsetHeight < windowSize.height) ? popupDiv.offsetHeight
+ : 0;
+ popupDiv.style.left = (((windowSize.width - widthOffset) / 2) + scrollX)
+ + 'px';
+ popupDiv.style.top = (((windowSize.height - heightOffset) / 2) + scrollY)
+ + 'px';
+ } catch (e) {
+ popupDiv.style.left = (scrollX + 200) + 'px';
+ popupDiv.style.top = (scrollY + 200) + 'px';
+ }
+ }
+ }
+}
+
+/**
+ *
+ * @param tagName
+ * @param elementId
+ * @param doc
+ * @returns
+ */
+function getElementsWithIDLike(tagName, elementId, doc) {
+ var allElems;
+ if (doc) {
+ allElems = doc.getElementsByTagName(tagName);
+ } else {
+ allElems = document.getElementsByTagName(tagName);
+ }
+ var selectedElems = [];
+ if (allElems) {
+ for ( var i = 0; i < allElems.length; i++) {
+ if (allElems[i].id && (allElems[i].id.indexOf(elementId) >= 0)) {
+ selectedElems.push(allElems[i]);
+ }
+ }
+ }
+
+ return selectedElems;
+}
+
+/**
+ *
+ * @returns {___anonymous2479_2521}
+ */
+function getBrowserDimensions(mainWin) {
+ var winW = screen.availWidth ? screen.availWidth : screen.width;
+ var winH = screen.availWidth ? screen.availHeight : screen.height;
+ var mainDoc = mainWin.document;
+ if (mainDoc.body && mainDoc.body.offsetWidth) {
+ winW = mainDoc.body.offsetWidth;
+ winH = mainDoc.body.offsetHeight;
+ }
+ if (mainDoc.compatMode == 'CSS1Compat' && mainDoc.documentElement
+ && mainDoc.documentElement.offsetWidth) {
+ winW = mainDoc.documentElement.offsetWidth;
+ winH = mainDoc.documentElement.offsetHeight;
+ }
+ if (mainWin.innerWidth && mainWin.innerHeight) {
+ winW = mainWin.innerWidth;
+ winH = mainWin.innerHeight;
+ }
+
+ return {
+ 'width' : winW,
+ 'height' : winH
+ };
+}
+
diff --git a/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewMain.xhtml b/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewMain.xhtml
index 3704741..53d8183 100644
--- a/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewMain.xhtml
+++ b/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewMain.xhtml
@@ -17,6 +17,7 @@
<ui:include src="portalStyleSheets.xhtml" />
<script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/js/thirdparty/json2.js" />
+ <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/js/portalSingleViewUtils.js" />
<script lang="javascript">
/*