You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/07/13 23:23:38 UTC
svn commit: r1146488 - in /myfaces/tomahawk/trunk/examples/simple20/src/main:
java/org/apache/myfaces/examples/listexample/ItemsBean.java
webapp/WEB-INF/examples-config.xml webapp/fullStateDataTable.xhtml
Author: lu4242
Date: Wed Jul 13 21:23:38 2011
New Revision: 1146488
URL: http://svn.apache.org/viewvc?rev=1146488&view=rev
Log:
add full row state test
Added:
myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ItemsBean.java
myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/fullStateDataTable.xhtml
Modified:
myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/WEB-INF/examples-config.xml
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ItemsBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ItemsBean.java?rev=1146488&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ItemsBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ItemsBean.java Wed Jul 13 21:23:38 2011
@@ -0,0 +1,34 @@
+package org.apache.myfaces.examples.listexample;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.event.ActionEvent;
+
+@ManagedBean(name="itemsBean")
+@SessionScoped
+public class ItemsBean
+{
+
+ private List<String> items;
+
+ public List<String> getItems()
+ {
+ if (items == null)
+ {
+ items = new ArrayList<String>();
+ items.add("A");
+ items.add("B");
+ items.add("C");
+ items.add("D");
+ }
+ return items;
+ }
+
+ public void changeToRed(ActionEvent evt)
+ {
+ evt.getComponent().getAttributes().put("style", "background:red");
+ }
+}
Modified: myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/WEB-INF/examples-config.xml?rev=1146488&r1=1146487&r2=1146488&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/WEB-INF/examples-config.xml Wed Jul 13 21:23:38 2011
@@ -8,6 +8,11 @@
<variable-resolver>org.apache.myfaces.examples.accessedbeans.AccessTrackingVariableResolver</variable-resolver>
</application>
+ <managed-bean>
+ <managed-bean-name>itemsBean</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.listexample.ItemsBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<managed-bean>
<managed-bean-name>environmentInfo</managed-bean-name>
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/fullStateDataTable.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/fullStateDataTable.xhtml?rev=1146488&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/fullStateDataTable.xhtml (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/webapp/fullStateDataTable.xhtml Wed Jul 13 21:23:38 2011
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!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:composite="http://java.sun.com/jsf/composite"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:t="http://myfaces.apache.org/tomahawk"
+ >
+<h:head>
+</h:head>
+<h:body>
+<h:form id="mainForm">
+with h:dataTable
+ <h:dataTable value="#{itemsBean.items}" var="item">
+ <h:column>
+ <h:outputText value="#{item}"/>
+ <h:commandButton value="Change Only this Button To Red" actionListener="#{itemsBean.changeToRed}"/>
+ </h:column>
+ </h:dataTable>
+c:forEach
+ <table>
+ <c:forEach items="#{itemsBean.items}" var="item">
+ <tr>
+ <td>
+ <h:outputText value="#{item}"/>
+ <h:commandButton value="Change Only this Button To Red" actionListener="#{itemsBean.changeToRed}"/>
+ </td>
+ </tr>
+ </c:forEach>
+ </table>
+with h:dataTable
+ <h:dataTable value="#{itemsBean.items}" var="item" rowStatePreserved="true">
+ <h:column>
+ <h:outputText value="#{item}"/>
+ <h:commandButton value="Change Only this Button To Red" actionListener="#{itemsBean.changeToRed}"/>
+ </h:column>
+ </h:dataTable>
+with t:dataTable
+ <t:dataTable value="#{itemsBean.items}" var="item" rowStatePreserved="true">
+ <h:column>
+ <h:outputText value="#{item}"/>
+ <h:commandButton value="Change Only this Button To Red" actionListener="#{itemsBean.changeToRed}"/>
+ </h:column>
+ </t:dataTable>
+with t:dataList
+ <table>
+ <t:dataList value="#{itemsBean.items}" var="item" rowStatePreserved="true">
+ <tr>
+ <td>
+ <h:outputText value="#{item}"/>
+ <h:commandButton value="Change Only this Button To Red" actionListener="#{itemsBean.changeToRed}"/>
+ </td>
+ </tr>
+ </t:dataList>
+ </table>
+</h:form>
+</h:body>
+</html>
\ No newline at end of file