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/11/10 01:12:42 UTC

svn commit: r332181 - in /myfaces/examples/trunk/sandbox: home.jsp inputAjax.jsp src/java/org/apache/myfaces/examples/inputAjax/InputAjaxBean.java

Author: prophecy
Date: Wed Nov  9 16:12:41 2005
New Revision: 332181

URL: http://svn.apache.org/viewcvs?rev=332181&view=rev
Log:
- Added some new parameters to input text that will show Ok/cancel buttons before submitting via ajax
- fixed up the example page and explained what each does

Modified:
    myfaces/examples/trunk/sandbox/home.jsp
    myfaces/examples/trunk/sandbox/inputAjax.jsp
    myfaces/examples/trunk/sandbox/src/java/org/apache/myfaces/examples/inputAjax/InputAjaxBean.java

Modified: myfaces/examples/trunk/sandbox/home.jsp
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/sandbox/home.jsp?rev=332181&r1=332180&r2=332181&view=diff
==============================================================================
--- myfaces/examples/trunk/sandbox/home.jsp (original)
+++ myfaces/examples/trunk/sandbox/home.jsp Wed Nov  9 16:12:41 2005
@@ -22,7 +22,7 @@
             <h:outputLink value="inputSuggest.jsf" ><f:verbatim>Input Suggest</f:verbatim></h:outputLink>
             <h:outputLink value="schedule.jsf" ><f:verbatim>Schedule</f:verbatim></h:outputLink>
             <h:outputLink value="autoUpdateDataTable.jsf" ><f:verbatim>Automatically updated dataTable per AJAX</f:verbatim></h:outputLink>
-            <h:outputLink value="inputAjax.jsf" ><f:verbatim>Form fields that update dynamically through AJAX</f:verbatim></h:outputLink>            
+            <h:outputLink value="inputAjax.jsf" ><f:verbatim>AJAX Form Components</f:verbatim></h:outputLink>            
             <h:outputLink value="accordionPanel.jsf" ><f:verbatim>AccordionPanel</f:verbatim></h:outputLink>
             <h:outputLink value="validateUrl.jsf" ><f:verbatim>Validation example 2 - including URL validator</f:verbatim></h:outputLink>
             <h:outputLink value="graphicImageDynamic.jsf" ><f:verbatim>GraphicImageDynamic - graphic image without a dedicated servlet</f:verbatim></h:outputLink>

Modified: myfaces/examples/trunk/sandbox/inputAjax.jsp
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/sandbox/inputAjax.jsp?rev=332181&r1=332180&r2=332181&view=diff
==============================================================================
--- myfaces/examples/trunk/sandbox/inputAjax.jsp (original)
+++ myfaces/examples/trunk/sandbox/inputAjax.jsp Wed Nov  9 16:12:41 2005
@@ -40,35 +40,63 @@
         statusDiv.innerHTML = "DOH!";
     }
 </script>
-<h1>InputAjax Components</h1>
-<p>The backend data model will update without having to click the submit button.  To see error handling, put in some
-random text into the Date field.</p>
+<style type="text/css">
+    .bold {
+        font-weight:bold;
+    }
+</style>
+
+<h1>Ajax Form Components</h1>
+
+<p>The backend data model will update without having to click the submit button. To see error handling, put in some
+    random text into the Date field.</p>
 <f:view>
 
     <h:form>
-        <h:panelGrid columns="2">
+        <h:panelGrid columns="2" columnClasses="bold,normal">
             <h:outputText value="Input Some Text"/>
-            <s:inputTextAjax value="#{inputAjaxBean.text1}"
-                    id="text1"
-                    forceId="true"></s:inputTextAjax>
+            <h:panelGrid columns="1">
+                <s:inputTextAjax value="#{inputAjaxBean.text1}"
+                                 id="text1"
+                                 forceId="true"></s:inputTextAjax>
+                <f:verbatim>This component demonstrates ajax updating ability when you change the
+                    text.</f:verbatim>
+            </h:panelGrid>
 
+            <h:outputText value="Input Some Text2"/>
+            <h:panelGrid columns="1">
+                <s:inputTextAjax value="#{inputAjaxBean.text2}"
+                                 id="text2"
+                                 forceId="true"
+                                 showOkButton="true"
+                                 showCancelText="true"></s:inputTextAjax>
+                <f:verbatim>This component demonstrates ajax updating ability, but you must click Ok for it to send.
+                    Cancel will clear the text and not send an update.</f:verbatim>
+            </h:panelGrid>
 
             <h:outputText value="Input a Date"/>
-            <s:inputTextAjax value="#{inputAjaxBean.date1}"
-                    id="date1"
-                    forceId="true">
-                <s:convertDateTime pattern="yyyy-MM-dd"></s:convertDateTime>
-            </s:inputTextAjax>
+            <h:panelGrid columns="1">
+                <s:inputTextAjax value="#{inputAjaxBean.date1}"
+                                 id="date1"
+                                 forceId="true">
+                    <s:convertDateTime pattern="yyyy-MM-dd"/>
+                </s:inputTextAjax>
+                <f:verbatim>This component demonstrates error handling capabilities, enter an invalid string to see the
+                    error returned from the server through ajax.</f:verbatim>
+            </h:panelGrid>
+
 
             <h:outputText value="Select Some Boxes"/>
-            <s:selectManyCheckboxAjax
-                    id="smcb"
-                    forceId="true"
-                    value="#{inputAjaxBean.chosenValues}"
-                    >
-                <f:selectItems
-                        value="#{inputAjaxBean.checkboxItems}"/>
-            </s:selectManyCheckboxAjax>
+            <h:panelGrid columns="1">
+                <s:selectManyCheckboxAjax
+                        id="smcb"
+                        forceId="true"
+                        value="#{inputAjaxBean.chosenValues}">
+                    <f:selectItems
+                            value="#{inputAjaxBean.checkboxItems}"/>
+                </s:selectManyCheckboxAjax>
+                <f:verbatim>This component demonstrates ajax updating ability on a checkboxes.</f:verbatim>
+            </h:panelGrid>
 
 
         </h:panelGrid>

Modified: myfaces/examples/trunk/sandbox/src/java/org/apache/myfaces/examples/inputAjax/InputAjaxBean.java
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/sandbox/src/java/org/apache/myfaces/examples/inputAjax/InputAjaxBean.java?rev=332181&r1=332180&r2=332181&view=diff
==============================================================================
--- myfaces/examples/trunk/sandbox/src/java/org/apache/myfaces/examples/inputAjax/InputAjaxBean.java (original)
+++ myfaces/examples/trunk/sandbox/src/java/org/apache/myfaces/examples/inputAjax/InputAjaxBean.java Wed Nov  9 16:12:41 2005
@@ -28,8 +28,9 @@
 public class InputAjaxBean {
     private List checkboxItems;
     private List chosenValues = new ArrayList();
-    public String text1;
-    public Date date1 = new Date();
+    private String text1;
+    private String text2;
+    private Date date1 = new Date();
 
     public List getCheckboxItems() {
         if (checkboxItems == null) {
@@ -75,5 +76,15 @@
 
     public String submit() {
         return null;
+    }
+
+    public String getText2()
+    {
+        return text2;
+    }
+
+    public void setText2(String text2)
+    {
+        this.text2 = text2;
     }
 }