summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-07-17 06:00:47 (EDT)
committerStephan Born2013-09-23 04:53:56 (EDT)
commit989e83d72e970d863e6ea4694343cb674b71abe8 (patch)
tree08c5a1f5591e06623001fbb051c305361e4e6b34
parentb19ba06af2bb86ce6188966854a9d98de7a273fe (diff)
downloadorg.eclipse.stardust.ui.web-989e83d72e970d863e6ea4694343cb674b71abe8.zip
org.eclipse.stardust.ui.web-989e83d72e970d863e6ea4694343cb674b71abe8.tar.gz
org.eclipse.stardust.ui.web-989e83d72e970d863e6ea4694343cb674b71abe8.tar.bz2
Jira-ID: CRNT-28362
-Fixed the issue of Tiff viewer not opening Added tiffViewerEventScript.js and moved the code to activate and resize Tiff viewer to it. Added code to call tiff viewer activate while tiffDocumentDetails.xhtml loading. git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@66071 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Sidharth Singh <sidharth.singh@sungard.com>
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/TIFFViewer.java28
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js64
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/views/document/tiffDocumentDetails.xhtml20
3 files changed, 92 insertions, 20 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/TIFFViewer.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/TIFFViewer.java
index 86713a0..46fff76 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/TIFFViewer.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/TIFFViewer.java
@@ -30,7 +30,6 @@ import org.eclipse.stardust.ui.web.common.app.View;
import org.eclipse.stardust.ui.web.common.event.ViewEvent;
import org.eclipse.stardust.ui.web.common.event.ViewEventHandler;
import org.eclipse.stardust.ui.web.common.message.MessageDialog;
-import org.eclipse.stardust.ui.web.common.util.FacesUtils;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.core.SessionSharedObjectsMap;
import org.eclipse.stardust.ui.web.viewscommon.docmgmt.DocumentMgmtUtility;
@@ -259,7 +258,6 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
|| PortalApplication.getInstance().getActiveView() == event.getView())
{
String publishReinitializeMsg = "window.parent.EventHub.events.publish('RE_INITIALIZE_VIEWER');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), publishReinitializeMsg);
PortalApplication.getInstance().addEventScript(publishReinitializeMsg);
activate();
}
@@ -334,10 +332,8 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
restoreTiffIframe();
String anchor = "tiffViewerIframe";
-
- String activateScript = "InfinityBpm.ProcessPortal.createOrActivateContentFrame('" + frameId + "', '"
- + pagePath + "' + '&canvasWidth=' + docWidth + '&canvasHeight=' + docHeight, {anchorId:'" + anchor
- + "'});";
+
+ String activateScript = "activateAndResizeIframe('" + frameId + "','" + pagePath + "')";
if (iframeDelay > 0)
{
PortalApplication.getInstance().addEventScript(
@@ -356,7 +352,6 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
public void close()
{
String publishSaveMsg = "window.parent.EventHub.events.publish('VIEW_CLOSING', '" + docId + "');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), publishSaveMsg);
PortalApplication.getInstance().addEventScript(publishSaveMsg);
DOC_ID_VS_DOC_MAP.remove(docId);
closeIframe();
@@ -425,15 +420,8 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
{
if (!isPoppedOut())
{
- calculateOptimalDivSize();
String anchor = "tiffViewerIframe";
- String restoreTiffIframe = "if (document.getElementById('tiffViewerIframe')) {"
- + "try{document.getElementById('tiffViewerIframe').style.width = (docWidth + 10) + 'px';"
- + "document.getElementById('tiffViewerIframe').style.height = (docHeight + 70) + 'px';"
- + "window.parent.EventHub.events.publish('CANVAS_RESIZED', docWidth, docHeight);}catch(e){}"
- + "InfinityBpm.ProcessPortal.resizeContentFrame('" + frameId + "', {anchorId:'" + anchor + "'});}";
-
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), restoreTiffIframe);
+ String restoreTiffIframe = "restoreTiffIframe('" + frameId + "','" + anchor + "')";
PortalApplication.getInstance().addEventScript(restoreTiffIframe);
}
}
@@ -469,14 +457,13 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
*/
public void deActivateIframe()
{
- String deActivateIframeJS = "InfinityBpm.ProcessPortal.deactivateContentFrame('" + frameId + "');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), deActivateIframeJS);
+ String deActivateIframeJS = "this.window.parent.BridgeUtils.FrameManager.deactivate('" + frameId + "');";
PortalApplication.getInstance().addEventScript(deActivateIframeJS);
}
private void closeIframe()
{
- String closeIframeJS = "InfinityBpm.ProcessPortal.closeContentFrame('" + frameId + "');";
+ String closeIframeJS = "parent.InfinityBpm.ProcessPortal.closeContentFrame('" + frameId + "');";
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), closeIframeJS);
PortalApplication.getInstance().addEventScript(closeIframeJS);
}
@@ -606,6 +593,11 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
return poppedOut;
}
+ public IDocumentContentInfo getDocumentInfo()
+ {
+ return documentInfo;
+ }
+
public void setCustomSaveDialogOptions()
{
TIFFCustomSaveDialog saveDialog = TIFFCustomSaveDialog.getCurrent();
diff --git a/views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js b/views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js
new file mode 100644
index 0000000..72d6726
--- /dev/null
+++ b/views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+var docWidth = 0, docHeight = 0;
+
+/**
+ *
+ * @param iframeId
+ * @param anchorId
+ */
+function restoreTiffIframe(iframeId, anchorId) {
+ var divObj = document.getElementById('tiffViewerIframe');
+ var topValue = 0, leftValue = 0;
+
+ while (divObj) {
+ leftValue += divObj.offsetLeft;
+ topValue += divObj.offsetTop;
+ divObj = divObj.offsetParent;
+ }
+ var windowWidth = document.body.clientWidth;
+ var windowHeight = document.body.clientHeight;
+ docWidth = parseInt((document.body.clientWidth - leftValue)) - 30;
+ docHeight = parseInt(docWidth * 1.2);
+ if (document.getElementById('tiffViewerIframe')) {
+ try {
+ document.getElementById('tiffViewerIframe').style.width = docWidth;
+ + 'px';
+ document.getElementById('tiffViewerIframe').style.height = docHeight;
+ + 'px';
+ window.parent.EventHub.events.publish('CANVAS_RESIZED', docWidth,
+ docHeight);
+ } catch (e) {
+ }
+ this.parent.window.BridgeUtils.FrameManager.resizeAndReposition(
+ iframeId, {
+ anchorId : anchorId
+ });
+ }
+}
+
+/**
+ *
+ * @param iframeId
+ * @param defaultPath
+ */
+function activateAndResizeIframe(iframeId, defaultPath) {
+
+ var anchorId = "tiffViewerIframe";
+ restoreTiffIframe(iframeId, anchorId);
+ defaultPath += "&canvasWidth=" + docWidth + "&canvasHeight=" + docHeight;
+ this.parent.window.BridgeUtils.FrameManager.createOrActivate(iframeId,
+ defaultPath, {
+ canvasWidth : docWidth,
+ canvasHeight : docHeight,
+ anchorId : anchorId
+ });
+
+}
diff --git a/views-common/src/main/resources/META-INF/xhtml/views/document/tiffDocumentDetails.xhtml b/views-common/src/main/resources/META-INF/xhtml/views/document/tiffDocumentDetails.xhtml
index 61da92d..3714d67 100644
--- a/views-common/src/main/resources/META-INF/xhtml/views/document/tiffDocumentDetails.xhtml
+++ b/views-common/src/main/resources/META-INF/xhtml/views/document/tiffDocumentDetails.xhtml
@@ -27,6 +27,10 @@
border : 3px solid #999999;
}
</style>
+
+ <script type="text/javascript"
+ src="#{facesContext.externalContext.requestContextPath}/plugins/views-common/scripts/tiffViewerEventScript.js" />
+
<ice:panelGrid columns="5"
style="border: 1px solid; border-color: #CCCCCC; height: 100%"
cellspacing="0" cellpadding="0" columnClasses="tiffViewerPnlGrdCol">
@@ -279,7 +283,18 @@
</ice:panelGrid>
</ice:panelGroup>
<script id="tiffRepositionScripts" lang="javascript">
- function repositionTIFFIFRAME() {
+ // Server side activation call and client side page load are not in syn on Iframe creation,
+ // manually activating Iframe on fist load
+ if ('loading' == window.document.readyState || 'complete' == window.document.readyState) {
+ var iframeId="tiff_frame#{contentHandler.tiffDocumentHolder.docId}";
+ var pagePath = "#{contentHandler.tiffDocumentHolder.defaultPagePath}" + '&amp;isEditable='
+ + "#{contentHandler.documentInfo.contentEditable}";
+ activateAndResizeIframe(iframeId,pagePath);
+ }
+
+ //TODO - Crosscheck if below code is required
+
+ /* function repositionTIFFIFRAME() {
var elems = window.parent.document.getElementsByTagName("IFRAME");
for (var i = 0; i != elems.length; i++) {
if ("tiff_frame#{contentHandler.tiffDocumentHolder.docId}" == elems[i].id) {
@@ -294,6 +309,7 @@
});
Ice.onAsynchronousReceive("document:body", function() {
repositionTIFFIFRAME();
- });
+ }); */
+
</script>
</f:view> \ No newline at end of file