You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by pr...@apache.org on 2005/12/15 00:50:01 UTC

svn commit: r356942 - in /myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom: ajax/api/ inputAjax/

Author: prophecy
Date: Wed Dec 14 15:49:54 2005
New Revision: 356942

URL: http://svn.apache.org/viewcvs?rev=356942&view=rev
Log:
- supports ValueChangeListeners now so you can process events when something changes.

Added:
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/SampleValueChangeListener.java
Modified:
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlInputTextAjax.java
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectBooleanCheckboxAjax.java
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectManyCheckboxAjax.java

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java?rev=356942&r1=356941&r2=356942&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java Wed Dec 14 15:49:54 2005
@@ -86,7 +86,6 @@
             {
                 try
                 {
-                    // TR - What is this HtmlBufferResponseWriterWrapper stuff for????  This caused me hours and hours of pain
                     if (context.getResponseWriter() == null)
                     {
                         ServletResponse response = (ServletResponse) context.getExternalContext().getResponse();

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlInputTextAjax.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlInputTextAjax.java?rev=356942&r1=356941&r2=356942&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlInputTextAjax.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlInputTextAjax.java Wed Dec 14 15:49:54 2005
@@ -46,9 +46,10 @@
     {
         log.debug("entering HtmlInputTextAjax.decodeAjax");
 
-        HtmlRendererUtils.decodeUIInput(context, this);
-        validate(context);
-        updateModel(context);
+        processDecodes(context);
+        processValidators(context);
+        processUpdates(context);
+        context.getViewRoot().processApplication(context);
         if (log.isDebugEnabled())
         {
             Object valOb = this.getValue();

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectBooleanCheckboxAjax.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectBooleanCheckboxAjax.java?rev=356942&r1=356941&r2=356942&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectBooleanCheckboxAjax.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectBooleanCheckboxAjax.java Wed Dec 14 15:49:54 2005
@@ -55,7 +55,7 @@
         boolean checked = Boolean.valueOf(checkedStr).booleanValue();
         if (checked)
         {
-            HtmlRendererUtils.decodeUISelectBoolean(context, this);
+            processDecodes(context);
         }
         else
         {
@@ -63,8 +63,9 @@
             decodeUISelectBoolean(context, this);
         }
         //System.out.println("SUBMITTED VALUE: " + ((EditableValueHolder) this).getSubmittedValue());
-        validate(context);
-        updateModel(context);
+        processValidators(context);
+        processUpdates(context);
+        context.getViewRoot().processApplication(context);
 
         //String elname = (String) requestParams.get("elname");
         //String elvalue = (String) requestParams.get("elvalue");

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectManyCheckboxAjax.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectManyCheckboxAjax.java?rev=356942&r1=356941&r2=356942&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectManyCheckboxAjax.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/HtmlSelectManyCheckboxAjax.java Wed Dec 14 15:49:54 2005
@@ -47,6 +47,8 @@
     {
         log.debug("entering HtmlSelectManyCheckboxAjax.decodeAjax");
 
+        // this requires special handling
+        // should maybe put the end collection, "c" into the EditableValueHolder as request params: ((EditableValueHolder) component).setSubmittedValue(reqValues);
         Map requestParams = context.getExternalContext().getRequestParameterMap();
 
         String elname = (String) requestParams.get("elname");
@@ -66,6 +68,11 @@
         } else {
             log.error("Invalid chosen values type in HtmlSelectManyCheckbox");
         }
+
+        // now the rest of the lifecycle
+        processValidators(context);
+        processUpdates(context);
+        context.getViewRoot().processApplication(context);
     }
     /**
      * Will find the chosen value in the chosenValues list and update set or unset accordingly.

Added: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/SampleValueChangeListener.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/SampleValueChangeListener.java?rev=356942&view=auto
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/SampleValueChangeListener.java (added)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputAjax/SampleValueChangeListener.java Wed Dec 14 15:49:54 2005
@@ -0,0 +1,21 @@
+package org.apache.myfaces.custom.inputAjax;
+
+import javax.faces.event.ValueChangeListener;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.context.FacesContext;
+import javax.faces.application.FacesMessage;
+
+/**
+ * User: treeder
+ * Date: Dec 14, 2005
+ * Time: 2:05:53 PM
+ */
+public class SampleValueChangeListener implements ValueChangeListener
+{
+    public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
+    {
+        String msg = "Value changed from [" + event.getOldValue() + "] to [" + event.getNewValue() + "]";
+        System.out.println(msg);
+    }
+}