summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-07-18 06:43:19 (EDT)
committerStephan Born2013-09-23 04:54:17 (EDT)
commit418020068bc6ee612531ba6567c6ccdad756212b (patch)
tree7e248fc75224abd9c4b99ccb79ecda74c1b01ea3
parent8dd26324fdaf1ec987d33299355f9f11ac6a68de (diff)
downloadorg.eclipse.stardust.ui.web-418020068bc6ee612531ba6567c6ccdad756212b.zip
org.eclipse.stardust.ui.web-418020068bc6ee612531ba6567c6ccdad756212b.tar.gz
org.eclipse.stardust.ui.web-418020068bc6ee612531ba6567c6ccdad756212b.tar.bz2
Jira-ID: CRNT-28362
-Tiff Viewer changes Added softClick on tiffDocumentDetails.xhtml to reset running script on TiffViewer passed width and height args for BridgeUtils.activateAndResizeIframe() from tiffViewerEventScript.js git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@66099 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.java47
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js8
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/views/document/tiffDocumentDetails.xhtml20
3 files changed, 42 insertions, 33 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 46fff76..cf7857c 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
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
import org.eclipse.stardust.common.log.LogManager;
import org.eclipse.stardust.common.log.Logger;
@@ -79,6 +80,8 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
private boolean descriptionChanged;
+ private String executionScript;
+
/*
* (non-Javadoc)
*
@@ -311,6 +314,15 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
break;
}
}
+
+ /**
+ *
+ * @param event
+ */
+ public void scriptExecuteActionListener(ActionEvent event)
+ {
+ setExecutionScript(null);
+ }
/**
*
@@ -336,12 +348,11 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
String activateScript = "activateAndResizeIframe('" + frameId + "','" + pagePath + "')";
if (iframeDelay > 0)
{
- PortalApplication.getInstance().addEventScript(
- "window.setTimeout(function() {" + activateScript + "}," + iframeDelay + ");");
+ executionScript = "window.setTimeout(function() {" + activateScript + "}," + iframeDelay + ");";
}
else
{
- PortalApplication.getInstance().addEventScript(activateScript);
+ executionScript = activateScript;
}
}
}
@@ -421,8 +432,7 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
if (!isPoppedOut())
{
String anchor = "tiffViewerIframe";
- String restoreTiffIframe = "restoreTiffIframe('" + frameId + "','" + anchor + "')";
- PortalApplication.getInstance().addEventScript(restoreTiffIframe);
+ executionScript = "restoreTiffIframe('" + frameId + "','" + anchor + "')";
}
}
@@ -439,22 +449,6 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
/**
*
*/
- private void calculateOptimalDivSize()
- {
- String calculateOptimalDivSizeJS = "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, windowHeight = document.body.clientHeight;"
- + "var docWidth = parseInt((document.body.clientWidth - leftValue)) - 30;"
- + "var docHeight = parseInt(docWidth * 1.4);";
-
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), calculateOptimalDivSizeJS);
- PortalApplication.getInstance().addEventScript(calculateOptimalDivSizeJS);
- }
-
- /**
- *
- */
public void deActivateIframe()
{
String deActivateIframeJS = "this.window.parent.BridgeUtils.FrameManager.deactivate('" + frameId + "');";
@@ -464,7 +458,6 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
private void closeIframe()
{
String closeIframeJS = "parent.InfinityBpm.ProcessPortal.closeContentFrame('" + frameId + "');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), closeIframeJS);
PortalApplication.getInstance().addEventScript(closeIframeJS);
}
@@ -597,6 +590,16 @@ public class TIFFViewer implements IDocumentViewer, ICustomDocumentSaveHandler,
{
return documentInfo;
}
+
+ public String getExecutionScript()
+ {
+ return executionScript;
+ }
+
+ public void setExecutionScript(String executionScript)
+ {
+ this.executionScript = executionScript;
+ }
public void setCustomSaveDialogOptions()
{
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
index 72d6726..8c4d1c1 100644
--- a/views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js
+++ b/views-common/src/main/resources/META-INF/xhtml/scripts/tiffViewerEventScript.js
@@ -30,9 +30,9 @@ function restoreTiffIframe(iframeId, anchorId) {
if (document.getElementById('tiffViewerIframe')) {
try {
document.getElementById('tiffViewerIframe').style.width = docWidth;
- + 'px';
+ +'px';
document.getElementById('tiffViewerIframe').style.height = docHeight;
- + 'px';
+ +'px';
window.parent.EventHub.events.publish('CANVAS_RESIZED', docWidth,
docHeight);
} catch (e) {
@@ -58,7 +58,9 @@ function activateAndResizeIframe(iframeId, defaultPath) {
defaultPath, {
canvasWidth : docWidth,
canvasHeight : docHeight,
+ width : docWidth,
+ height : docHeight,
anchorId : anchorId
});
-}
+} \ No newline at end of file
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 3714d67..00844df 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
@@ -276,6 +276,10 @@
</c:when>
<c:otherwise>
<div id="tiffViewerIframe" />
+ <ice:commandButton id="onExecuteActionButton"
+ actionListener="#{contentHandler.scriptExecuteActionListener}"
+ value="hiddenOnLoadButton" visible="false">
+ </ice:commandButton>
</c:otherwise>
</c:choose>
</ice:panelGroup>
@@ -283,14 +287,14 @@
</ice:panelGrid>
</ice:panelGroup>
<script id="tiffRepositionScripts" lang="javascript">
- // 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);
- }
+ if(#{contentHandler.executionScript == null || contentHandler.executionScript == 'undefined'}){
+ <!-- DO nothing -->
+ }else{
+ eval("#{contentHandler.executionScript}");
+ // Soft click required to prevent re-exectution of script on partial submit
+ parent.UiUtils.softClick(this.window,
+ 'input', 'onExecuteActionButton');
+ }
//TODO - Crosscheck if below code is required