Author: lfryc(a)redhat.com
Date: 2010-09-09 06:36:33 -0400 (Thu, 09 Sep 2010)
New Revision: 19141
Added:
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java
Log:
metamer:clientTime composite component + refactored push test accordingly
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml 2010-09-09
10:33:24 UTC (rev 19140)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jPush/simple.xhtml 2010-09-09
10:36:33 UTC (rev 19141)
@@ -34,7 +34,6 @@
</f:viewParam>
</f:metadata>
<h:outputStylesheet library="css"
name="a4jPush.css"/>
- <h:outputScript library="script" name="date-format.js"
/>
</ui:define>
<ui:define name="outOfTemplateBefore">
@@ -48,16 +47,7 @@
<f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss.SSS" />
</h:outputText>
***
- <h:outputText value="Client: " />
- <h:outputText id="clientDate" value=""
title="" />
- <script type="text/javascript">
- //<![CDATA[
- var now = new Date();
- jQuery("div.content span[id$=clientDate]")
- .text(now.format("dd.mm.yyyy HH:MM:ss.l", false))
- .attr("title", now.getTime());
- //]]>
- </script>
+ <metamer:clientTime id="clientDate" label="Client:
" />
***
<h:outputText value="Counter: " />
<h:outputText id="outputCounter"
value="#{a4jPushBean.counter}"/>
Added:
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml 2010-09-09
10:36:33 UTC (rev 19141)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <h:body>
+ <composite:interface>
+ <composite:attribute name="label"
type="java.lang.String" required="true" />
+ <composite:attribute name="name"
type="java.lang.String" default="metamerOutputTime" />
+ </composite:interface>
+
+ <composite:implementation>
+ <h:outputLabel value="#{cc.attrs.label}"
for="#{cc.attrs.name}" />
+ <h:outputText styleClass="metamerOutputTime"
id="#{cc.attrs.name}" value="" title="" />
+ <h:outputScript library="script" name="date-format.js"
/>
+ <script type="text/javascript">
+ //<![CDATA[
+ function #{cc.attrs.name}Refresh() {
+ var now = new Date();
+ jQuery("span.metamerOutputTime[id$=#{cc.attrs.name}]")
+ .text(now.format("dd.mm.yyyy HH:MM:ss.l", false))
+ .attr("title", now.getTime());
+ }
+ #{cc.attrs.name}Refresh();
+ //]]>
+ </script>
+ </composite:implementation>
+ </h:body>
+</html>
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java 2010-09-09
10:33:24 UTC (rev 19140)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java 2010-09-09
10:36:33 UTC (rev 19141)
@@ -43,7 +43,7 @@
* @version $Revision$
*/
public class TestInterval extends AbstractPushTest {
-
+
private static final int DEFAULT_COUNTER_STEP = 2;
private static final int ITERATION_COUNT = 3;
private static final int MULTIPLE_PUSH_COUNT = 5;
@@ -51,7 +51,7 @@
@Inject
int interval;
- AttributeLocator<?> clientTime =
pjq("span[id$=clientDate]").getAttribute(Attribute.TITLE);
+ AttributeLocator<?> clientTime =
pjq("span[id$=metamerOutputTime]").getAttribute(Attribute.TITLE);
long startTime;
int counter;