summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-09-13 05:19:56 (EDT)
committerStephan Born2013-09-13 05:19:56 (EDT)
commitc76393afde4d331304177eba3bb452613a8df766 (patch)
treed42a42eb33b3f09ae0c9e698665286b98bdc3e2e
parent5e0f6c372453db42f99289d750ca0670aca2d6b3 (diff)
downloadorg.eclipse.stardust.ui.web-c76393afde4d331304177eba3bb452613a8df766.zip
org.eclipse.stardust.ui.web-c76393afde4d331304177eba3bb452613a8df766.tar.gz
org.eclipse.stardust.ui.web-c76393afde4d331304177eba3bb452613a8df766.tar.bz2
Jira-ID: CRNT-30362
1)Added CommonUtils.js in portal-common/xhtml/CommonUtils.js , added Timer related scripts from InfinityBpm_Core.js 2)Added hidden field in portalSingleViewLaunchPanelsOnly.xhtml for timer. git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@67264 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/timer/TimerManager.java9
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/CommonUtils.js40
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/js/BridgeUtils.js1
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/portalHead.xhtml1
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/portalSingleViewLaunchPanelsOnly.xhtml3
5 files changed, 49 insertions, 5 deletions
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/timer/TimerManager.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/timer/TimerManager.java
index d62751e..a1d000a 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/timer/TimerManager.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/common/timer/TimerManager.java
@@ -16,6 +16,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
+import org.eclipse.stardust.ui.web.common.app.PortalApplicationEventScript;
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.util.FacesUtils;
@@ -51,8 +52,8 @@ public class TimerManager
public void startTimer(String id, long interval, TimerEventHandler handler)
{
handlers.put(id, handler);
- String timerScript = "InfinityBpm.Core.startTimer('" + id + "', " + interval + ");";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), timerScript);
+ String timerScript = "parent.CommonUtils.startTimer('" + id + "', " + interval + ");";
+ PortalApplicationEventScript.getInstance().addEventScript(timerScript);
if (trace.isDebugEnabled())
{
@@ -66,8 +67,8 @@ public class TimerManager
public void stopTimer(String id)
{
handlers.remove(id);
- String timerScript = "InfinityBpm.Core.stopTimer('" + id + "');";
- JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), timerScript);
+ String timerScript = "parent.CommonUtils.stopTimer('" + id + "');";
+ PortalApplicationEventScript.getInstance().addEventScript(timerScript);
if (trace.isDebugEnabled())
{
diff --git a/portal-common/src/main/resources/META-INF/xhtml/CommonUtils.js b/portal-common/src/main/resources/META-INF/xhtml/CommonUtils.js
new file mode 100644
index 0000000..5c04471
--- /dev/null
+++ b/portal-common/src/main/resources/META-INF/xhtml/CommonUtils.js
@@ -0,0 +1,40 @@
+var CommonUtils = function() {
+
+ var timerInfo = {};
+
+ // Supports multiple times
+ function startTimer(id, interval) {
+ var timerId = window.setInterval(new TimerHandler(id).timerInvoked,
+ interval);
+ timerInfo[id] = timerId;
+ }
+
+ function stopTimer(id) {
+ if (timerInfo[id]) {
+ window.clearInterval(timerInfo[id]);
+ }
+ }
+
+ return {
+ startTimer : function(id, interval) {
+ startTimer(id, interval);
+ },
+
+ stopTimer : function(id) {
+ stopTimer(id);
+ }
+ };
+}();
+
+function TimerHandler(id) {
+ this.id = id;
+ this.timerInvoked = timerInvoked;
+ function timerInvoked() {
+ var modelerLaunchPanel=document.getElementById("modelerLaunchPanels");
+ var timeField = modelerLaunchPanel.contentDocument.getElementById("viewFormLP:timerInvoked");
+ if (timeField) {
+ timeField.value = id + ":" + new Date().getTime();
+ modelerLaunchPanel.contentWindow.iceSubmitPartial(modelerLaunchPanel.contentDocument.getElementById("viewFormLP"), timeField);
+ }
+ }
+}
diff --git a/portal-common/src/main/resources/META-INF/xhtml/js/BridgeUtils.js b/portal-common/src/main/resources/META-INF/xhtml/js/BridgeUtils.js
index 718a856..c21622c 100644
--- a/portal-common/src/main/resources/META-INF/xhtml/js/BridgeUtils.js
+++ b/portal-common/src/main/resources/META-INF/xhtml/js/BridgeUtils.js
@@ -1003,6 +1003,7 @@ if (!window["BridgeUtils"].FrameManager) {
injectJavaScript(head, 'plugins/common/js/Messaging.js');
injectJavaScript(head, 'plugins/common/js/ProcessPortal.js');
injectJavaScript(head, 'plugins/common/UiUtils.js');
+ injectJavaScript(head, 'plugins/common/CommonUtils.js');
}
/*
diff --git a/portal-common/src/main/resources/META-INF/xhtml/portalHead.xhtml b/portal-common/src/main/resources/META-INF/xhtml/portalHead.xhtml
index 6a2a2f1..1336fdc 100644
--- a/portal-common/src/main/resources/META-INF/xhtml/portalHead.xhtml
+++ b/portal-common/src/main/resources/META-INF/xhtml/portalHead.xhtml
@@ -8,7 +8,6 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<ui:include src="I18NInclude.xhtml" />
- <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/InfinityBpm_Core.js" />
<script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/UiUtils.js" />
<script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/plugins/common/eventHub.js" />
diff --git a/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewLaunchPanelsOnly.xhtml b/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewLaunchPanelsOnly.xhtml
index 86ab524..85ffa6b 100644
--- a/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewLaunchPanelsOnly.xhtml
+++ b/portal-common/src/main/resources/META-INF/xhtml/portalSingleViewLaunchPanelsOnly.xhtml
@@ -45,6 +45,9 @@
<ice:inputHidden id="messageData" value="#{ippSingleViewLaunchPanels.emptyString}"
valueChangeListener="#{ippSingleViewLaunchPanels.messageReceived}"
partialSubmit="true" immediate="true" />
+ <ice:inputHidden id="timerInvoked" value="#{ippSingleViewLaunchPanels.emptyString}"
+ valueChangeListener="#{timerManager.processTimerEvent}"
+ partialSubmit="true" immediate="true" />
</ice:form>
</div>