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 2016/11/04 13:26:41 UTC
svn commit: r1768028 - in
/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main:
java/org/apache/myfaces/tobago/example/demo/EventController.java
webapp/content/40-test/6000-event/event.test.js
webapp/content/40-test/6000-event/event.xhtml
Author: lofwyr
Date: Fri Nov 4 13:26:41 2016
New Revision: 1768028
URL: http://svn.apache.org/viewvc?rev=1768028&view=rev
Log:
TOBAGO-1617: New tag <tc:event> to be similar to <f:ajax> and to replace <tc:command> in facets
* tests
[developed by hnoeth]
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.test.js
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java?rev=1768028&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java Fri Nov 4 13:26:41 2016
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.example.demo;
+
+import org.apache.myfaces.tobago.example.data.SolarObject;
+import org.apache.myfaces.tobago.util.ComponentUtils;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.component.UIData;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.AjaxBehaviorEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.inject.Named;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@SessionScoped
+@Named
+public class EventController implements Serializable {
+
+ private int action = 0;
+ private int actionListener = 0;
+ private int ajaxListener = 0;
+ private int valueChangeListener = 0;
+ private List<SolarObject> planets = new ArrayList<SolarObject>();
+ private String selectedPlanet;
+
+ public EventController() {
+ planets.add(new SolarObject("Mercury", "I", "Sun", 57910, 87.97, 7.00, 0.21, "-", null));
+ planets.add(new SolarObject("Venus", "II", "Sun", 108200, 224.70, 3.39, 0.01, "-", null));
+ planets.add(new SolarObject("Earth", "III", "Sun", 149600, 365.26, 0.00, 0.02, "-", null));
+ planets.add(new SolarObject("Mars", "IV", "Sun", 227940, 686.98, 1.85, 0.09, "-", null));
+ planets.add(new SolarObject("Jupiter", "V", "Sun", 778330, 4332.71, 1.31, 0.05, "-", null));
+ planets.add(new SolarObject("Saturn", "VI", "Sun", 1429400, 10759.50, 2.49, 0.06, "-", null));
+ planets.add(new SolarObject("Uranus", "VII", "Sun", 2870990, 30685.0, 0.77, 0.05, "Herschel", 1781));
+ planets.add(new SolarObject("Neptune", "VIII", "Sun", 4504300, 60190.0, 1.77, 0.01, "Adams", 1846));
+ }
+
+ public void reset() {
+ action = 0;
+ actionListener = 0;
+ ajaxListener = 0;
+ valueChangeListener = 0;
+ selectedPlanet = null;
+ }
+
+ public void action() {
+ action++;
+ }
+
+ public void actionListener(final ActionEvent event) {
+ actionListener++;
+ }
+
+ public void ajaxListener(final AjaxBehaviorEvent event) {
+ ajaxListener++;
+ }
+
+ public void valueChangeListener(final ValueChangeEvent event) {
+ valueChangeListener++;
+ }
+
+ public int getActionCount() {
+ return action;
+ }
+
+ public int getActionListenerCount() {
+ return actionListener;
+ }
+
+ public int getAjaxListenerCount() {
+ return ajaxListener;
+ }
+
+ public int getValueChangeListenerCount() {
+ return valueChangeListener;
+ }
+
+ public long getCurrentTimestamp() {
+ return new Date().getTime();
+ }
+
+ public List<SolarObject> getPlanets() {
+ return planets;
+ }
+
+ public String getSelectedPlanet() {
+ return selectedPlanet;
+ }
+
+ public void setSelectedPlanet(String selectedPlanet) {
+ this.selectedPlanet = selectedPlanet;
+ }
+
+ public void selectPlanet(final ActionEvent actionEvent) {
+ final UIData data = ComponentUtils.findAncestor(actionEvent.getComponent(), UIData.class);
+ selectedPlanet = data != null ? ((SolarObject) data.getRowData()).getName() : null;
+ }
+}
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.test.js?rev=1768028&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.test.js Fri Nov 4 13:26:41 2016
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+
+QUnit.test("tc:in tc:event - change", function(assert) {
+ assert.expect(4);
+ var done = assert.async();
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inEventChange\\:\\:field");
+ var newValue = "hello";
+ if (newValue == $inputField.val()) {
+ newValue = "hi there";
+ }
+ $inputField.val(newValue).trigger("change");
+
+ jQuery("#page\\:testframe").load(function() {
+ var newActionCount = getActionCount();
+ var newActionListenerCount = getActionListenerCount();
+ var newAjaxListenerCount = getAjaxListenerCount();
+ var newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount > oldValueChangeListenerCount);
+
+ done();
+ });
+});
+
+QUnit.test("tc:in tc:event - click", function(assert) {
+ assert.expect(4);
+ var done = assert.async();
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inEventClick\\:\\:field");
+ $inputField.trigger("click");
+
+ jQuery("#page\\:testframe").load(function() {
+ var newActionCount = getActionCount();
+ var newActionListenerCount = getActionListenerCount();
+ var newAjaxListenerCount = getAjaxListenerCount();
+ var newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount == oldValueChangeListenerCount);
+
+ done();
+ });
+});
+
+QUnit.test("tc:in tc:event - change + click", function(assert) {
+ assert.expect(8);
+ var done = assert.async(2);
+ var step = 1;
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+ var newActionCount;
+ var newActionListenerCount;
+ var newAjaxListenerCount;
+ var newValueChangeListenerCount;
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inEventChangeClick\\:\\:field");
+ $inputField.trigger("click");
+
+ jQuery("#page\\:testframe").load(function() {
+ if (step == 1) {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount == oldValueChangeListenerCount);
+
+ $inputField = jQueryFrame($inputField.selector);
+ var newValue = "hello";
+ if (newValue == $inputField.val()) {
+ newValue = "hi there";
+ }
+ $inputField.val(newValue).trigger("change");
+ } else if (step == 2) {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount > oldValueChangeListenerCount);
+
+ oldActionCount = getActionCount();
+ oldActionListenerCount = getActionListenerCount();
+ oldAjaxListenerCount = getAjaxListenerCount();
+ oldValueChangeListenerCount = getValueChangeListenerCount();
+ }
+
+ step++;
+ done();
+ });
+});
+
+QUnit.test("tc:in tc:ajax - change", function(assert) {
+ assert.expect(4);
+ var done = assert.async();
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+ var newActionCount;
+ var newActionListenerCount;
+ var newAjaxListenerCount;
+ var newValueChangeListenerCount;
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inAjaxChange\\:\\:field");
+ var newValue = "hello";
+ if (newValue == $inputField.val()) {
+ newValue = "hi there";
+ }
+ $inputField.val(newValue).trigger("change");
+
+ waitForAjax(function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+ return (newActionCount == oldActionCount)
+ && (newActionListenerCount == oldActionListenerCount)
+ && (newAjaxListenerCount > oldAjaxListenerCount)
+ && (newValueChangeListenerCount > oldValueChangeListenerCount);
+ }, function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount == oldActionCount);
+ assert.ok(newActionListenerCount == oldActionListenerCount);
+ assert.ok(newAjaxListenerCount > oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount > oldValueChangeListenerCount);
+
+ done();
+ });
+});
+
+/*QUnit.test("tc:in tc:ajax - click", function(assert) {
+ assert.expect(4);
+ var done = assert.async();
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+ var newActionCount;
+ var newActionListenerCount;
+ var newAjaxListenerCount;
+ var newValueChangeListenerCount;
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inAjaxClick\\:\\:field");
+ $inputField.trigger("click");
+
+ waitForAjax(function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+ return (newActionCount == oldActionCount)
+ && (newActionListenerCount == oldActionListenerCount)
+ && (newAjaxListenerCount > oldAjaxListenerCount)
+ && (newValueChangeListenerCount == oldValueChangeListenerCount);
+ }, function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount == oldActionCount);
+ assert.ok(newActionListenerCount == oldActionListenerCount);
+ assert.ok(newAjaxListenerCount > oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount == oldValueChangeListenerCount);
+
+ done();
+ });
+});*/
+
+/*QUnit.test("tc:in tc:ajax - change + click", function(assert) {
+ assert.expect(8);
+ var done = assert.async();
+ var step = 1;
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+ var newActionCount;
+ var newActionListenerCount;
+ var newAjaxListenerCount;
+ var newValueChangeListenerCount;
+
+ var $inputField = jQueryFrame("#page\\:mainForm\\:inAjaxChangeClick\\:\\:field");
+ $inputField.trigger("click");
+
+ waitForAjax(function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+ return step == 1
+ && (newActionCount == oldActionCount)
+ && (newActionListenerCount == oldActionListenerCount)
+ && (newAjaxListenerCount > oldAjaxListenerCount)
+ && (newValueChangeListenerCount == oldValueChangeListenerCount);
+ }, function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount > oldValueChangeListenerCount);
+
+ $inputField = jQueryFrame($inputField.selector);
+ var newValue = "hello";
+ if (newValue == $inputField.val()) {
+ newValue = "hi there";
+ }
+ $inputField.val(newValue).trigger("change");
+
+ waitForAjax(function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+ return step == 2
+ && (newActionCount == oldActionCount)
+ && (newActionListenerCount == oldActionListenerCount)
+ && (newAjaxListenerCount > oldAjaxListenerCount)
+ && (newValueChangeListenerCount > oldValueChangeListenerCount);
+ }, function() {
+ newActionCount = getActionCount();
+ newActionListenerCount = getActionListenerCount();
+ newAjaxListenerCount = getAjaxListenerCount();
+ newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount == oldActionCount);
+ assert.ok(newActionListenerCount == oldActionListenerCount);
+ assert.ok(newAjaxListenerCount > oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount > oldValueChangeListenerCount);
+ });
+
+ step++;
+ done();
+ });
+});*/
+
+QUnit.test("tc:button tc:event - click", function(assert) {
+ assert.expect(4);
+ var done = assert.async();
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+
+ var button = jQueryFrame("#page\\:mainForm\\:buttonEventClick");
+ button.click();
+
+ jQuery("#page\\:testframe").load(function() {
+ var newActionCount = getActionCount();
+ var newActionListenerCount = getActionListenerCount();
+ var newAjaxListenerCount = getAjaxListenerCount();
+ var newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount == oldValueChangeListenerCount);
+
+ done();
+ });
+});
+
+QUnit.test("tc:sheet tc:event - click", function(assert) {
+ assert.expect(4);
+ var done = assert.async();
+
+ var oldActionCount = getActionCount();
+ var oldActionListenerCount = getActionListenerCount();
+ var oldAjaxListenerCount = getAjaxListenerCount();
+ var oldValueChangeListenerCount = getValueChangeListenerCount();
+
+ var button = jQueryFrame("#page\\:mainForm\\:buttonEventClick");
+ button.click();
+
+ jQuery("#page\\:testframe").load(function() {
+ var newActionCount = getActionCount();
+ var newActionListenerCount = getActionListenerCount();
+ var newAjaxListenerCount = getAjaxListenerCount();
+ var newValueChangeListenerCount = getValueChangeListenerCount();
+
+ assert.ok(newActionCount > oldActionCount);
+ assert.ok(newActionListenerCount > oldActionListenerCount);
+ assert.ok(newAjaxListenerCount == oldAjaxListenerCount);
+ assert.ok(newValueChangeListenerCount == oldValueChangeListenerCount);
+
+ done();
+ });
+});
+
+function getActionCount() {
+ return parseInt(jQueryFrame("#page\\:mainForm\\:outAction span").text());
+}
+
+function getActionListenerCount() {
+ return parseInt(jQueryFrame("#page\\:mainForm\\:outActionListener span").text());
+}
+
+function getAjaxListenerCount() {
+ return parseInt(jQueryFrame("#page\\:mainForm\\:outAjaxListener span").text());
+}
+
+function getValueChangeListenerCount() {
+ return parseInt(jQueryFrame("#page\\:mainForm\\:outValueChangeListener span").text());
+}
+
+function getTimestamp() {
+ return parseInt(jQueryFrame("#page\\:mainForm\\:outTimestamp span").text());
+}
+
+function getSelectedPlanet() {
+ return jQueryFrame("#page\\:mainForm\\:outPlanet span").text();
+}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml?rev=1768028&r1=1768027&r2=1768028&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml Fri Nov 4 13:26:41 2016
@@ -21,123 +21,170 @@
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:f="http://java.sun.com/jsf/core">
-
- <tc:section label="Checking different solutions to adjust f:ajax and the old tobago event facets.">
-
- <tc:box label="Panel with reload, every 10 seconds">
-
- <tc:section label="Old">
- <tc:panel>
- <f:facet name="reload">
- <tc:reload frequency="10000"/>
- </f:facet>
- Panel content
- </tc:panel>
- </tc:section>
-
- <tc:section label="New">
- <tc:panel>
- <tc:reload frequency="10000"/>
- Panel content
- </tc:panel>
- </tc:section>
-
- </tc:box>
-
- <tc:box label="Send AJAX call on change event on input field.">
-
- <tc:section label="Old = New">
- <tc:in label="input">
- <f:ajax/>
- </tc:in>
- </tc:section>
-
- </tc:box>
-
- <tc:box label="Send normal call on change event on input field.">
-
- <tc:section label="Old">
- <tc:in label="input">
- <f:facet name="change">
- <tc:command/>
- </f:facet>
- </tc:in>
- </tc:section>
-
- <tc:section label="New">
- <tc:in label="input">
- <tc:event event="change"/>
- </tc:in>
- </tc:section>
-
- </tc:box>
-
- <tc:box label="Sheet: click in a row (AJAX)">
-
- <tc:section label="Old">
- <tc:sheet markup="small,hover" value="#{sheetController.solarList}" var="object" rows="3">
- <tc:columnEvent>
- <tc:command>
- <f:ajax/>
- </tc:command>
- </tc:columnEvent>
- <tc:column label="Name">
- <tc:out value="#{object.name}" labelLayout="skip"/>
- </tc:column>
- </tc:sheet>
- Remark: event attribute of tc:columnEvent must not be defined.
- </tc:section>
-
- <tc:section label="New">
- <tc:sheet markup="small,hover" value="#{sheetController.solarList}" var="object" rows="3">
- <tc:row>
- <f:ajax/>
- </tc:row>
- <tc:column label="Name">
- <tc:out value="#{object.name}" labelLayout="skip"/>
- </tc:column>
- </tc:sheet>
- </tc:section>
-
- </tc:box>
-
- <tc:box label="Sheet: click in a row (no AJAX, normal request)">
-
- <tc:section label="Old">
- <tc:sheet markup="small,hover" value="#{sheetController.solarList}" var="object" rows="3">
- <tc:columnEvent event="click">
- <tc:command action="..."/>
- </tc:columnEvent>
- <tc:column label="Name">
- <tc:out value="#{object.name}" labelLayout="skip"/>
- </tc:column>
- </tc:sheet>
- </tc:section>
-
- <tc:section label="New">
- <tc:sheet markup="small,hover" value="#{sheetController.solarList}" var="object" rows="3">
- <tc:row>
- <tc:event event="click" action="..."/>
- </tc:row>
- <tc:column label="Name">
- <tc:out value="#{object.name}" labelLayout="skip"/>
- </tc:column>
- </tc:sheet>
- </tc:section>
-
- </tc:box>
-
- <tc:box label="TODO">
-
- <tc:section label="Old">
- </tc:section>
-
- <tc:section label="New">
- </tc:section>
-
- </tc:box>
-
+ xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
+ <ui:param name="title" value="<tc:event>"/>
+ <tc:box id="metrics" label="Metrics">
+ <f:facet name="bar">
+ <tc:button label="Reset" action="#{eventController.reset}"/>
+ </f:facet>
+ <tc:out id="outAction" label="Action" value="#{eventController.actionCount}"/>
+ <tc:out id="outActionListener" label="ActionListener" value="#{eventController.actionListenerCount}"/>
+ <tc:out id="outAjaxListener" label="AjaxListener" value="#{eventController.ajaxListenerCount}"/>
+ <tc:out id="outValueChangeListener" label="ValueChange-Listener"
+ value="#{eventController.valueChangeListenerCount}"/>
+ <tc:separator/>
+ <tc:out id="outTimestamp" label="Timestamp" value="#{eventController.currentTimestamp}"/>
+ <tc:in id="inPlanet" label="Selected planet" value="#{eventController.selectedPlanet}"/>
+ </tc:box>
+ <tc:section label="<tc:in>">
+ <tc:segmentLayout medium="6;6">
+ <tc:box label="<tc:event>">
+ <tc:section label="change">
+ <tc:in id="inEventChange" valueChangeListener="#{eventController.valueChangeListener}">
+ <tc:event event="change" action="#{eventController.action}"
+ actionListener="#{eventController.actionListener}"/>
+ </tc:in>
+ </tc:section>
+ <tc:section label="click">
+ <tc:in id="inEventClick" valueChangeListener="#{eventController.valueChangeListener}">
+ <tc:event event="click" action="#{eventController.action}"
+ actionListener="#{eventController.actionListener}"/>
+ </tc:in>
+ </tc:section>
+ <tc:section label="change + click">
+ <tc:in id="inEventChangeClick" valueChangeListener="#{eventController.valueChangeListener}">
+ <tc:event event="change" action="#{eventController.action}"
+ actionListener="#{eventController.actionListener}"/>
+ <tc:event event="click" action="#{eventController.action}"
+ actionListener="#{eventController.actionListener}"/>
+ </tc:in>
+ </tc:section>
+ </tc:box>
+ <tc:box label="<f:ajax>">
+ <tc:section label="change">
+ <tc:in id="inAjaxChange" valueChangeListener="#{eventController.valueChangeListener}">
+ <f:ajax render="metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:in>
+ </tc:section>
+ <tc:section label="click">
+ <tc:in id="inAjaxClick" valueChangeListener="#{eventController.valueChangeListener}">
+ <f:ajax event="click" render="metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:in>
+ <p>AjaxListener doesn't work for click!</p>
+ </tc:section>
+ <tc:section label="change + click">
+ <tc:in id="inAjaxChangeClick" valueChangeListener="#{eventController.valueChangeListener}">
+ <f:ajax event="change" render="metrics" listener="#{eventController.ajaxListener}"/>
+ <f:ajax event="click" render="metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:in>
+ <p>AjaxListener doesn't work for click!</p>
+ </tc:section>
+ </tc:box>
+ </tc:segmentLayout>
+ </tc:section>
+ <tc:section label="<tc:button>">
+ <tc:segmentLayout medium="6;6">
+ <tc:box label="<tc:event>">
+ <tc:section label="click">
+ <tc:button id="buttonEventClick" label="Button" action="#{eventController.action}"
+ actionListener="#{eventController.actionListener}"/>
+ </tc:section>
+ <tc:section label="dblclick">
+ <p>Not implemented yet!</p>
+ </tc:section>
+ <tc:section label="mousedown">
+ <p>Not implemented yet!</p>
+ </tc:section>
+ </tc:box>
+ <tc:box label="<f:ajax>">
+ <tc:section label="click">
+ <tc:button id="buttonAjaxClick" label="Button" action="#{eventController.action}"
+ actionListener="#{eventController.actionListener}">
+ <f:ajax render="metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:button>
+ <p>AjaxListener doesn't work for click!</p>
+ </tc:section>
+ <tc:section label="dblclick">
+ <!--<tc:button id="buttonAjaxDblclick" label="Button" action="#{eventController.action}" actionListener="#{eventController.actionListener}">
+ <f:ajax event="dblclick" render="metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:button>-->
+ <p>Not implemented yet!</p>
+ </tc:section>
+ <tc:section label="mousedown">
+ <!--<tc:button id="buttonAjaxMousedown" label="Button" action="#{eventController.action}" actionListener="#{eventController.actionListener}">
+ <f:ajax event="mousedown" render="metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:button>-->
+ <p>Not implemented yet!</p>
+ </tc:section>
+ </tc:box>
+ </tc:segmentLayout>
+ </tc:section>
+ <!--<tc:section label="<tc:panel>">
+ <tc:box label="Reload">
+ <tc:panel>
+ <f:facet name="reload">
+ <tc:reload frequency="1000"/>
+ </f:facet>
+ <p>Still old implementation!</p>
+ <tc:progress id="progessReload" value="#{progressController.currentSeconds}" max="59"/>
+ </tc:panel>
+ </tc:box>
+ </tc:section>-->
+ <tc:section label="<tc:sheet>">
+ <tc:segmentLayout medium="6;6">
+ <tc:box label="<tc:event>">
+ <tc:section label="click">
+ <tc:sheet id="sheetEventClick" value="#{eventController.planets}" var="planet" markup="small">
+ <tc:style maxHeight="200px"/>
+ <tc:column label="Planet">
+ <tc:out value="#{planet.name}" labelLayout="skip"/>
+ </tc:column>
+ <tc:row>
+ <tc:event event="click" action="#{eventController.action}"
+ actionListener="#{eventController.selectPlanet}"/>
+ </tc:row>
+ </tc:sheet>
+ <p>ActionListener doesn't work!</p>
+ </tc:section>
+ <tc:section label="dblclick">
+ <!--<tc:sheet id="sheetEventDblclick" value="#{eventController.planets}" var="planet" markup="small">
+ <tc:style maxHeight="200px"/>
+ <tc:column label="Planet">
+ <tc:out value="#{planet.name}" labelLayout="skip"/>
+ </tc:column>
+ <tc:row>
+ <tc:event event="dblclick" action="#{eventController.action}" actionListener="#{eventController.selectPlanet}"/>
+ </tc:row>
+ </tc:sheet>-->
+ <p>Not implemented yet!</p>
+ </tc:section>
+ </tc:box>
+ <tc:box label="<f:ajax>">
+ <tc:section label="click">
+ <tc:sheet id="sheetAjaxClick" value="#{eventController.planets}" var="planet" markup="small">
+ <tc:style maxHeight="200px"/>
+ <tc:column label="Planet">
+ <tc:out value="#{planet.name}" labelLayout="skip"/>
+ </tc:column>
+ <tc:row>
+ <f:ajax render="::metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:row>
+ </tc:sheet>
+ <p>Not implemented yet</p>
+ </tc:section>
+ <tc:section label="dblclick">
+ <!--<tc:sheet id="sheetAjaxClick" value="#{eventController.planets}" var="planet" markup="small">
+ <tc:style maxHeight="200px"/>
+ <tc:column label="Planet">
+ <tc:out value="#{planet.name}" labelLayout="skip"/>
+ </tc:column>
+ <tc:row>
+ <f:ajax event="dblclick" render="::metrics" listener="#{eventController.ajaxListener}"/>
+ </tc:row>
+ </tc:sheet>-->
+ <p>Not implemented yet!</p>
+ </tc:section>
+ </tc:box>
+ </tc:segmentLayout>
</tc:section>
-
</ui:composition>