You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/01/29 13:34:11 UTC
svn commit: r1439858 - in
/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main:
java/org/apache/myfaces/tobago/example/test/ webapp/WEB-INF/
webapp/test/script/
Author: lofwyr
Date: Tue Jan 29 12:34:11 2013
New Revision: 1439858
URL: http://svn.apache.org/viewvc?rev=1439858&view=rev
Log:
test for onload/onunload/onexit
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ScriptEvent.java
- copied unchanged from r1439818, myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ScriptEvent.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ScriptEventItem.java
- copied unchanged from r1439818, myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ScriptEventItem.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ScriptEventServlet.java
- copied unchanged from r1439818, myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ScriptEventServlet.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.js
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.xhtml
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml?rev=1439858&r1=1439857&r2=1439858&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml Tue Jan 29 12:34:11 2013
@@ -185,6 +185,12 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>scriptEvent</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.ScriptEvent</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>navigation</from-outcome>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml?rev=1439858&r1=1439857&r2=1439858&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/web.xml Tue Jan 29 12:34:11 2013
@@ -68,30 +68,36 @@
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
+ <servlet-mapping>
+ <servlet-name>FacesServlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
<servlet>
<servlet-name>ResourceServlet</servlet-name>
<servlet-class>org.apache.myfaces.tobago.servlet.ResourceServlet</servlet-class>
</servlet>
+ <servlet-mapping>
+ <servlet-name>ResourceServlet</servlet-name>
+ <url-pattern>/org/apache/myfaces/tobago/renderkit/*</url-pattern>
+ </servlet-mapping>
<servlet>
<servlet-name>KillSessionServlet</servlet-name>
<servlet-class>org.apache.myfaces.tobago.example.test.KillSession</servlet-class>
</servlet>
-
- <servlet-mapping>
- <servlet-name>FacesServlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
-
<servlet-mapping>
- <servlet-name>ResourceServlet</servlet-name>
- <url-pattern>/org/apache/myfaces/tobago/renderkit/*</url-pattern>
+ <servlet-name>KillSessionServlet</servlet-name>
+ <url-pattern>/KillSession</url-pattern>
</servlet-mapping>
+ <servlet>
+ <servlet-name>ScriptEventServlet</servlet-name>
+ <servlet-class>org.apache.myfaces.tobago.example.test.ScriptEventServlet</servlet-class>
+ </servlet>
<servlet-mapping>
- <servlet-name>KillSessionServlet</servlet-name>
- <url-pattern>/KillSession</url-pattern>
+ <servlet-name>ScriptEventServlet</servlet-name>
+ <url-pattern>/ScriptEventServlet</url-pattern>
</servlet-mapping>
<filter>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.js?rev=1439858&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.js Tue Jan 29 12:34:11 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ScriptEvent = {};
+
+ScriptEvent.onload = function() {
+ jQuery.ajax({url:"/ScriptEventServlet?event=onload",async:false});
+};
+
+ScriptEvent.onunload = function() {
+ jQuery.ajax({url:"/ScriptEventServlet?event=onunload",async:false});
+};
+
+ScriptEvent.onexit = function() {
+ jQuery.ajax({url:"/ScriptEventServlet?event=onexit",async:false});
+};
+
+function showTime() {
+ jQuery(Tobago.Utils.escapeClientId("page:list")).find(".tobago-box-header").html(formatDate(new Date(), "hh:mm:ss"));
+ setTimeout(showTime, 500);
+}
+
+setTimeout(showTime, 0);
Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.xhtml?rev=1439858&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/script/script-event.xhtml Tue Jan 29 12:34:11 2013
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<f:view
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <tc:page id="page">
+ <f:facet name="layout">
+ <tc:gridLayout columns="*;*" rows="auto;*"/>
+ </f:facet>
+ <tc:gridLayoutConstraint width="600px" height="300px"/>
+
+ <tc:messages>
+ <tc:gridLayoutConstraint columnSpan="2" />
+ </tc:messages>
+
+ <tc:box id="panel">
+ <f:facet name="layout">
+ <tc:gridLayout rows="*;auto;auto;auto"/>
+ </f:facet>
+
+ <tc:script
+ file="test/script/script-event.js"
+ onload="ScriptEvent.onload();"
+ onunload="ScriptEvent.onunload();"
+ onexit="ScriptEvent.onexit();">
+ </tc:script>
+
+ <tc:out value="TODO: write an automated tests."/>
+
+ <tc:button label="No Action"/>
+ <tc:button label="Action" action="#{scriptEvent.action}"/>
+ <tc:button label="External link" link="http://www.apache.org" target="_blank"/>
+
+ </tc:box>
+
+ <tc:box id="list" label="time">
+ <f:facet name="layout">
+ <tc:gridLayout rows="auto;*"/>
+ </f:facet>
+
+ <tc:button label="Reload List" renderedPartially="list"/>
+
+ <tc:sheet value="#{scriptEvent.items}" var="item">
+ <tc:column label="Event">
+ <tc:out value="#{item.name}"/>
+ </tc:column>
+ <tc:column label="Time">
+ <tc:out value="#{item.time}">
+ <f:convertDateTime timeStyle="long" type="time"/>
+ </tc:out>
+ </tc:column>
+ </tc:sheet>
+
+ </tc:box>
+ </tc:page>
+</f:view>