Author: alexsmirnov
Date: 2007-05-14 21:09:43 -0400 (Mon, 14 May 2007)
New Revision: 196
Added:
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Container.java
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/ControlResultsController.java
trunk/samples/tomahawkCompability/src/main/webapp/pages/dataTable.jsp
Modified:
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml
Log:
Test for a support Tomahawk extended data table component.
Modified: trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-05-14
23:56:53 UTC (rev 195)
+++
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-05-15
01:09:43 UTC (rev 196)
@@ -84,13 +84,16 @@
* javax.faces.component.UIComponent)
*/
protected void doDecode(FacesContext context, UIComponent component) {
- UIAjaxForm form = (UIAjaxForm) component;
+ UIForm form = (UIForm) component;
boolean submitted = context.getExternalContext()
.getRequestParameterMap().containsKey(
component.getClientId(context));
form.setSubmitted(submitted);
- if (submitted && form.isAjaxSubmit()) {
- component.queueEvent(new AjaxEvent(component));
+ if (component instanceof UIAjaxForm) {
+ UIAjaxForm ajaxForm = (UIAjaxForm) component;
+ if (submitted && ajaxForm.isAjaxSubmit()) {
+ component.queueEvent(new AjaxEvent(component));
+ }
}
}
Modified: trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java
===================================================================
--- trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java 2007-05-14
23:56:53 UTC (rev 195)
+++ trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java 2007-05-15
01:09:43 UTC (rev 196)
@@ -20,13 +20,33 @@
*/
package org.ajax4jsf;
+
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author $Autor$
*
*/
public class Bean {
private int counter;
+
+ private List containers ;
+ public Bean() {
+ containers = new ArrayList();
+ boolean availible=false;
+ boolean changed=true;
+ for(int i=0;i<10;i++){
+ Container c = new Container();
+ c.setContainerNumber(i);
+ c.setAvailable(availible);
+ c.setChanged(changed);
+ availible = ! availible;
+ changed = ! changed;
+ containers.add(c);
+ }
+ }
/**
* @return the counter
*/
@@ -49,4 +69,16 @@
counter--;
return null;
}
+ /**
+ * @return the containers
+ */
+ public List getContainers() {
+ return containers;
+ }
+ /**
+ * @param containers the containers to set
+ */
+ public void setContainers(List containers) {
+ this.containers = containers;
+ }
}
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Container.java
===================================================================
--- trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Container.java
(rev 0)
+++ trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Container.java 2007-05-15
01:09:43 UTC (rev 196)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.ajax4jsf;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class Container {
+ private boolean available;
+ private boolean changed;
+ private int containerNumber;
+ /**
+ * @return the available
+ */
+ public boolean isAvailable() {
+ return available;
+ }
+ /**
+ * @param available the available to set
+ */
+ public void setAvailable(boolean available) {
+ this.available = available;
+ }
+ /**
+ * @return the changed
+ */
+ public boolean isChanged() {
+ return changed;
+ }
+ /**
+ * @param changed the changed to set
+ */
+ public void setChanged(boolean changed) {
+ this.changed = changed;
+ }
+ /**
+ * @return the containerNumber
+ */
+ public int getContainerNumber() {
+ return containerNumber;
+ }
+ /**
+ * @param containerNumber the containerNumber to set
+ */
+ public void setContainerNumber(int containerNumber) {
+ this.containerNumber = containerNumber;
+ }
+
+}
Added:
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/ControlResultsController.java
===================================================================
---
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/ControlResultsController.java
(rev 0)
+++
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/ControlResultsController.java 2007-05-15
01:09:43 UTC (rev 196)
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.ajax4jsf;
+
+import javax.faces.event.ActionEvent;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ControlResultsController {
+ public String addRow() {
+ return null;
+ }
+
+ public String removeElement() {
+ return null;
+ }
+
+ public void updateValue(ActionEvent e) {
+
+ }
+}
Modified: trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml 2007-05-14
23:56:53 UTC (rev 195)
+++ trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml 2007-05-15
01:09:43 UTC (rev 196)
@@ -17,6 +17,11 @@
<managed-bean-class>org.ajax4jsf.TreeBacker</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>controlResultsController</managed-bean-name>
+
<managed-bean-class>org.ajax4jsf.ControlResultsController</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<render-kit>
<renderer>
<component-family>javax.faces.Form</component-family>
Added: trunk/samples/tomahawkCompability/src/main/webapp/pages/dataTable.jsp
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/pages/dataTable.jsp
(rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/pages/dataTable.jsp 2007-05-15
01:09:43 UTC (rev 196)
@@ -0,0 +1,61 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"
%>
+<%@ taglib
uri="http://myfaces.apache.org/tomahawk"
prefix="t"%>
+<html>
+ <head>
+ <title>Tomahawk extended data table</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+<t:dataTable id="containers" value="#{bean.containers}"
+ var="GIContainers" styleClass="normalText" border="1"
+ cellspacing="0" cellpadding="0"
rowIndexVar="rowIndex">
+ <t:column>
+ <f:facet name="header">?????</f:facet>
+
+ <h:inputText id="container"
+ styleClass="#{(GIContainers.available) ? ((GIContainers.changed) ?
'redText' : '') : 'strikeText'}"
+ size="5" maxlength="17"
value="#{GIContainers.containerNumber}">
+ <a4j:support event="onchange" ajaxSingle="true"
+ reRender="containers"
+ actionListener="#{controlResultsController.updateValue}">
+ <a4j:actionparam name="rowIndex" value="#{rowIndex}"
/>
+ <a4j:actionparam name="changeTable" value="containers"
/>
+ </a4j:support>
+ <f:validateLength maximum="17" />
+ </h:inputText>
+ </t:column>
+ <t:column>
+ <f:facet name="header">??? ?? ?????????</f:facet>
+
+ <h:inputText size="5" maxlength="17"
+ styleClass="#{(GIContainers.available) ? ((GIContainers.changed) ?
'redText' : '') : 'strikeText'}"
+ value="#{GIContainers.containerNumber}">
+ <f:validateLength maximum="17" />
+ </h:inputText>
+ </t:column>
+ <t:column>
+ <f:facet name="header">
+ <a4j:commandLink immediate="true"
+ action="#{controlResultsController.addRow}"
+ reRender="containers">
+ <h:graphicImage style="border: none"
value="/images/plus.gif" />
+ <a4j:actionparam name="plusTable"
value="containers"></a4j:actionparam>
+ </a4j:commandLink>
+ </f:facet>
+
+ <a4j:commandLink reRender="containers" immediate="true"
+ style="text-decoration : none"
+ action="#{controlResultsController.removeElement}">
+ <h:graphicImage style="border: none;"
value="/images/minus.gif" />
+ <a4j:actionparam name="rowIndex"
value="#{rowIndex}"></a4j:actionparam>
+ <a4j:actionparam name="minusTable"
value="containers"></a4j:actionparam>
+ </a4j:commandLink>
+ </t:column>
+ </t:dataTable>
+ </h:form>
+ </f:view>
+ </body>
+</html>