Author: jkuhnert
Date: Sun Jul 22 13:32:56 2007
New Revision: 558539

URL: http://svn.apache.org/viewvc?view=rev&rev=558539
Log:
Fixes TAPESTRY-1656.  Added listener/parameters parameter to InlineEditBox.

Added:
    
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
   (with props)
Modified:
    tapestry/tapestry4/trunk/src/site/site.xml
    tapestry/tapestry4/trunk/src/site/xdoc/components/dojo/inlineeditbox.xml
    tapestry/tapestry4/trunk/src/site/xdoc/components/link/genericlink.xml
    
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IDirect.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.jwc
    
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestIncludeScripts.java

Modified: tapestry/tapestry4/trunk/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/site.xml?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- tapestry/tapestry4/trunk/src/site/site.xml (original)
+++ tapestry/tapestry4/trunk/src/site/site.xml Sun Jul 22 13:32:56 2007
@@ -28,7 +28,7 @@
         </links>
         
         <head>
-            <script src="http://www.google-analytics.com/urchin.js"; 
type="text/javascript"></script>
+            <script src="http://www.google-analytics.com/urchin.js"; 
type="text/javascript"> </script>
             <script type="text/javascript">_uacct = "UA-400821-1"; 
urchinTracker();</script>
             <link rel="shortcut icon" 
href="http://tapestry.apache.org/tapestry4.1/favicon.ico"; />
         </head>

Modified: 
tapestry/tapestry4/trunk/src/site/xdoc/components/dojo/inlineeditbox.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/dojo/inlineeditbox.xml?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/dojo/inlineeditbox.xml 
(original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/dojo/inlineeditbox.xml 
Sun Jul 22 13:32:56 2007
@@ -25,11 +25,11 @@
             <p>
                 Manages a single string value that can be edited "inline" in 
either text or textarea mode.
             </p>
-            
+
             <img src="../../images/ComponentReference/InlineEditBox.png" />
-            
+
             <img 
src="../../images/ComponentReference/InlineEditBox-editing.png" />
-            
+
             <section name="Parameters">
                 <table>
                     <tr>
@@ -43,16 +43,108 @@
                         <td>value</td>
                         <td>String</td>
                         <td>yes</td>
-                        <td></td>
+                        <td> </td>
                         <td>
-                            The string property to manage. This will be 
dynamically updated with any changes made by 
+                            The string property to manage. This will be 
dynamically updated with any changes made by
                             someone editing the value "inline" in the browser.
                         </td>
                     </tr>
                     <tr>
+                        <td>listener</td>
+                        <td>
+                            <a 
href="../../apidocs/org/apache/tapestry/IActionListener.html">
+                                IActionListener
+                            </a>
+                        </td>
+                        <td>no</td>
+                        <td> </td>
+                        <td>
+                            Specifies an object that is notified when the 
inline change is made,  which is
+                            typically a listener method of its container (for 
example, listeners.<em>method</em>).
+
+                            <br /><br />
+                            <span class="warn">
+                                <strong>Warning:</strong>
+                                <p>
+                                    Because of the way the client side control 
works for this widget you will <em>not</em> be able to make an
+                                    <code>updateComponents</code> call from 
your listener method when a change is made.  
+                                </p>
+                                <p>
+                                    If you would like a slightly more flexible 
way to get notified of changes AND be able to update other components
+                                    asynchronously you should use an 
<code>@EventListener(events = "onSave", targets="projName")</code> annotation 
instead.
+                                </p>
+                            </span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>parameters</td>
+                        <td>
+                            Object or
+                            <br />
+
+                            Object[] or
+                            <br />
+                            List
+                        </td>
+                        <td>no</td>
+                        <td> </td>
+                        <td>
+                            <p>
+                                An array of objects to be encoded into the 
URL. These parameters
+                                will be decoded when the inline change is 
triggered.
+                            </p>
+
+                            <p>
+                                In a web application built onto of Enterprise 
JavaBeans, the context
+                                is often the primary key of some Entity bean; 
typically such keys
+                                are Strings or Integers.
+                            </p>
+                            <p>
+                                A listener method can retrieve the parameters 
three ways:
+                                <br />
+                                parameters are declared in the method itself, 
e.g. - listenerMethod(
+                                <em>parameters</em>
+                                )
+                                <br />
+                                parameters are declared along with the 
IRequestCycle, e.g. -
+                                listenerMethod(IRequestCycle cycle,
+                                <em>parameters</em>
+                                )
+
+                                <br />
+                                or through the request cycle, e.g. - 
listenerMethod(IReuqestCycle
+                                cycle), using 
IRequestCycle.getListenerParameters()
+                            </p>
+                            <p>
+                                Prior to release 2.2, the parameters were 
always type String. They
+                                may now be of any type; type will be 
maintained when the parameters
+                                are later retrieved by a listener. See
+                                <a 
href="../../apidocs/org/apache/tapestry/util/io/SqueezeAdaptor.html">
+                                    SqueezeAdaptor
+                                </a>
+                                for more details.
+                            </p>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>stateful</td>
+                        <td>boolean</td>
+                        <td>no</td>
+                        <td>true</td>
+                        <td>
+                            If true (the default), then the component requires 
an active (i.e.,
+                            non-new) HttpSession when triggered. Failing that, 
it throws a
+                            <a 
href="../../apidocs/org/apache/tapestry/StaleLinkException.html">
+                                StaleLinkException
+                            </a>
+                            . If false, then no check is necessary. The latter 
works well with links
+                            that encode all necessary state inside the URL 
itself.
+                        </td>
+                    </tr>
+                    <tr>
                         <td>mode</td>
                         <td>
-                        One of [text,textarea].
+                            One of [text,textarea].
                         </td>
                         <td>no</td>
                         <td>literal:text</td>
@@ -68,7 +160,7 @@
                         <td>
                             Controls whether the component is active or not. A 
disabled
                             InlineEditBox that isn't currently being edited 
will simply not allow editing
-                            when clicking on it. If the edit box is already 
being used when it is disable (like with 
+                            when clicking on it. If the edit box is already 
being used when it is disable (like with
                             an ajax request update) the editable area will be 
"greyed" out using the native browser
                             controls for disabling form input.
                         </td>
@@ -97,7 +189,7 @@
                         <td>no</td>
                         <td>false</td>
                         <td>
-                            Whether the animation transition from editing -> 
normal mode should be a fade. If 
+                            Whether the animation transition from editing -> 
normal mode should be a fade. If
                             false (the default) - the animation sequence will 
be a simple highlight effect.
                         </td>
                     </tr>
@@ -123,7 +215,7 @@
             <section name="Examples">
                 TODO...
             </section>
-            
+
         </section>
 
     </body>

Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/link/genericlink.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/link/genericlink.xml?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/link/genericlink.xml 
(original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/link/genericlink.xml Sun 
Jul 22 13:32:56 2007
@@ -55,20 +55,15 @@
                     <tr>
                         <th>Name</th>
                         <th>Type</th>
-                        <th>Direction</th>
                         <th>Required</th>
                         <th>Default</th>
-
                         <th>Description</th>
                     </tr>
                     <tr>
                         <td>href</td>
                         <td>String</td>
-
-                        <td>in</td>
-
                         <td>yes</td>
-                        <td />
+                        <td> </td>
                         <td>
                             The URL to trigger when the link is clicked. This 
is often of the form:
                             <code>&lt;a&gt; 
href="javascript:functionName('param')"&gt;</code>
@@ -78,10 +73,8 @@
 
                         <td>disabled</td>
                         <td>boolean</td>
-                        <td>in</td>
                         <td>no</td>
                         <td>false</td>
-
                         <td>
 
                             Controls whether the link is produced. If 
disabled, the portion of the
@@ -90,10 +83,9 @@
                     </tr>
                     <tr>
                         <td>target</td>
-
                         <td>String</td>
                         <td>no</td>
-                        <td />
+                        <td> </td>
                         <td>
                             The name of the html target for this link, this is 
just the normal html attribute that will
                             control where the response generated from this 
link will go. (Usually used in frames) 
@@ -101,12 +93,9 @@
                     </tr>
                     <tr>
                         <td>anchor</td>
-
                         <td>String</td>
-                        <td>in</td>
-
                         <td>no</td>
-                        <td />
+                        <td> </td>
                         <td>
                             The name of an anchor or element to link to. The 
final URL will have '#'
                             and the anchor appended to it.
@@ -117,15 +106,12 @@
                         <td>renderer</td>
 
                         <td>
-                            <a
-                                
href="../../apidocs/org/apache/tapestry/link/ILinkRenderer.html">
+                            <a 
href="../../apidocs/org/apache/tapestry/link/ILinkRenderer.html">
                                 ILinkRenderer
                             </a>
                         </td>
-                        <td>in</td>
                         <td>no</td>
-                        <td />
-
+                        <td> </td>
                         <td>The object which will actually render the 
link.</td>
                     </tr>
 
@@ -137,7 +123,6 @@
                 </p>
 
                 <p>
-
                     Informal parameters:
                     <strong>allowed</strong>
                 </p>
@@ -150,7 +135,6 @@
             </section>
 
             <section name="Examples">
-
                 <p>
                     Under Construction.
 

Modified: 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
 Sun Jul 22 13:32:56 2007
@@ -134,8 +134,9 @@
 
     @EventListener(events = "onSave", targets="projName")
     public void onNameUpdate()
-    {
-        if (getSelectedProject() != null) {
+    {        
+        if (getSelectedProject() != null)
+        {
             getProjectDao().update(getSelectedProject());
             
             getBuilder().updateComponent("projectChoose");

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IDirect.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IDirect.java?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IDirect.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IDirect.java
 Sun Jul 22 13:32:56 2007
@@ -18,10 +18,7 @@
 /**
  *  Interface that defines classes that may be messaged by the direct
  *  service.
- *
- *  @author Howard Lewis Ship
- **/
-
+ */
 public interface IDirect extends IComponent, IDynamicInvoker
 {
     /**
@@ -29,8 +26,9 @@
      *  the appropriate action.  The [EMAIL PROTECTED] 
org.apache.tapestry.link.DirectLink} component will
      *  notify its listener.
      *
+     * @param cycle
+     *          The current request.
      */
-
     void trigger(IRequestCycle cycle);
 
     /**
@@ -39,10 +37,10 @@
      *  [EMAIL PROTECTED] javax.servlet.http.HttpSession} is active, then a
      *  [EMAIL PROTECTED] org.apache.tapestry.StaleSessionException} is
      *  thrown by the service.
-     * 
-     *  @since 2.3
-     * 
+     *
+     * @return Whether or not invocation should include state information and 
validate
+     *          that a valid session exists when triggered.
+     * @since 2.3
      */
-
     boolean isStateful();
 }

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.java?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.java
 Sun Jul 22 13:32:56 2007
@@ -19,6 +19,8 @@
 import org.apache.tapestry.engine.DirectServiceParameter;
 import org.apache.tapestry.engine.IEngineService;
 import org.apache.tapestry.json.JSONObject;
+import org.apache.tapestry.link.DirectLink;
+import org.apache.tapestry.listener.ListenerInvoker;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -74,15 +76,21 @@
     
     public abstract boolean getDoFade();
     
-    public abstract boolean isDiabled();
-    
+    public abstract boolean isDisabled();
+
+    public abstract IActionListener getListener();
+
+    public abstract Object getParameters();
+
+    public abstract void setStateful(boolean value);
+
     /**
      * [EMAIL PROTECTED]
      */
     public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
     {
-        if (!cycle.isRewinding()) {
-            
+        if (!cycle.isRewinding())
+        {    
             writer.begin(getTemplateTagName()); // use whatever template tag 
they specified
             renderInformalParameters(writer, cycle);
             renderIdAttribute(writer, cycle);
@@ -90,19 +98,16 @@
         
         renderBody(writer, cycle);
         
-        if (!cycle.isRewinding()) {
-            
+        if (!cycle.isRewinding())
+        {    
             writer.end();
         }
         
-        if(!TEXT_MODE.equals(getMode())
-                && !TEXT_AREA_MODE.equals(getMode())) {
+        if(getMode() == null || (!TEXT_MODE.equals(getMode()) && 
!TEXT_AREA_MODE.equals(getMode())))
             throw new 
ApplicationRuntimeException(WidgetMessages.invalidTextMode(getMode()));
-        }
         
-        if (cycle.isRewinding()) {
+        if (cycle.isRewinding())
             return;
-        }
         
         JSONObject prop = new JSONObject();
         prop.put("widgetId", getClientId());
@@ -122,13 +127,17 @@
     
     /**
      * Callback url used by client side widget to update server component.
+     *
+     * @return The url string to be used by the client side js function to 
notify
+     *          this component that an update has been made.
      */
     public String getUpdateUrl()
     {
-        DirectServiceParameter dsp =
-            new DirectServiceParameter(this);
+        Object[] parameters = 
DirectLink.constructServiceParameters(getParameters());
+
+        DirectServiceParameter dsp = new DirectServiceParameter(this, 
parameters);
         
-        return getEngine().getLink(false, dsp).getURL();
+        return getEngine().getLink(isStateful(), dsp).getURL();
     }
     
     /**
@@ -163,6 +172,11 @@
         String newValue = cycle.getParameter(getClientId());
         
         setValue(newValue);
+
+        if (getListener() != null)
+        {
+            getListenerInvoker().invokeListener(getListener(), this, cycle);
+        }
     }
     
     /** Injected. */
@@ -170,4 +184,7 @@
     
     /** Injected. */
     public abstract IScript getScript();
+
+    /** Injected. */
+    public abstract ListenerInvoker getListenerInvoker();
 }

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.jwc
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.jwc?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.jwc
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/InlineEditBox.jwc
 Sun Jul 22 13:32:56 2007
@@ -25,21 +25,34 @@
     <description>
         Creates an inline editable textbox/textarea.
     </description>
-    
+
     <parameter name="value" required="yes" />
-    
+
+    <parameter name="listener" />
+
+    <parameter name="parameters">
+        <description>
+            An object, or list of objects, encoded into the URL as listener
+            parameters (and made available to the ulimate listener object or 
method).
+        </description>
+    </parameter>
+
+    <parameter name="stateful" default-value="true"/>
+
     <parameter name="mode" default-value="literal:text" />
-    
+
     <parameter name="minWidth" default-value="100" />
-    
+
     <parameter name="minHeight" default-value="200" />
-    
+
     <parameter name="doFade" default-value="false" />
-    
+
     <parameter name="disabled" default-value="false" />
-    
+
     <inject property="engine" object="service:tapestry.services.Direct"/>
-    
+
     <inject property="script" type="script" object="InlineEditBox.script"/>
+
+    <inject property="listenerInvoker" 
object="infrastructure:listenerInvoker"/>
 
 </component-specification>

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
 Sun Jul 22 13:32:56 2007
@@ -14,20 +14,7 @@
 
 package org.apache.tapestry.dojo.form;
 
-import static org.easymock.EasyMock.checkOrder;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tapestry.IForm;
-import org.apache.tapestry.IMarkupWriter;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.IScript;
-import org.apache.tapestry.PageRenderSupport;
+import org.apache.tapestry.*;
 import org.apache.tapestry.engine.DirectServiceParameter;
 import org.apache.tapestry.engine.IEngineService;
 import org.apache.tapestry.engine.ILink;
@@ -40,12 +27,17 @@
 import org.apache.tapestry.services.ResponseBuilder;
 import org.apache.tapestry.valid.IValidationDelegate;
 import org.apache.tapestry.valid.ValidatorException;
+import static org.easymock.EasyMock.*;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Tests for [EMAIL PROTECTED] org.apache.tapestry.form.TextField}.
- * 
+ *
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
@@ -55,52 +47,52 @@
     private IAutocompleteModel createModel()
     {
         List values = new ArrayList();
-        
+
         SimpleBean s1 = new SimpleBean(new Integer(1), "Simple 1", 100);
         SimpleBean s2 = new SimpleBean(new Integer(2), "Simple 2", 200);
         SimpleBean s3 = new SimpleBean(new Integer(3), "Simple 3", 300);
-        
+
         values.add(s1);
         values.add(s2);
         values.add(s3);
-        
+
         return new DefaultAutocompleteModel(values, "id", "label");
     }
-    
+
     public void test_Rewind()
     {
         IAutocompleteModel model = createModel();
         ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
         DataSqueezer ds = newMock(DataSqueezer.class);
-        
-        Autocompleter component = newInstance(Autocompleter.class, 
-                new Object[] { "model", model, "validatableFieldSupport", vfs,
-            "dataSqueezer", ds});
-        
+
+        Autocompleter component = newInstance(Autocompleter.class,
+                                              new Object[] { "model", model, 
"validatableFieldSupport", vfs,
+                                                             "dataSqueezer", 
ds});
+
         IRequestCycle cycle = newMock(IRequestCycle.class);
         IForm form = newMock(IForm.class);
-        
+
         IMarkupWriter writer = newWriter();
-        
+
         IValidationDelegate delegate = newDelegate();
-        
+
         expect(cycle.renderStackPush(component)).andReturn(component);
-        
+
         trainGetForm(cycle, form);
         trainWasPrerendered(form, writer, component, false);
         trainGetDelegate(form, delegate);
-        
+
         delegate.setFormComponent(component);
-        
+
         trainGetElementId(form, component, "barney");
         trainIsRewinding(form, true);
-        
+
         trainGetParameter(cycle, "barney", "1");
-        
+
         expect(ds.unsqueeze("1")).andReturn(new Integer(1));
-        
+
         SimpleBean match = new SimpleBean(new Integer(1), null, -1);
-        
+
         try
         {
             vfs.validate(component, writer, cycle, match);
@@ -109,192 +101,192 @@
         {
             unreachable();
         }
-        
+
         expect(cycle.renderStackPop()).andReturn(component);
-        
+
         replay();
-        
+
         component.render(writer, cycle);
-        
+
         verify();
-        
+
         assertEquals(match, component.getValue());
     }
-    
+
     public void test_Rewind_NotForm()
     {
         Autocompleter component = (Autocompleter) 
newInstance(Autocompleter.class);
-        
+
         IRequestCycle cycle = newMock(IRequestCycle.class);
         IForm form = newMock(IForm.class);
-        
+
         IMarkupWriter writer = newWriter();
-        
+
         IValidationDelegate delegate = newDelegate();
-        
+
         expect(cycle.renderStackPush(component)).andReturn(component);
-        
+
         trainGetForm(cycle, form);
         trainWasPrerendered(form, writer, component, false);
         trainGetDelegate(form, delegate);
-        
+
         delegate.setFormComponent(component);
-        
+
         trainGetElementId(form, component, "barney");
         trainIsRewinding(form, false);
         trainIsRewinding(cycle, true);
-        
+
         expect(cycle.renderStackPop()).andReturn(component);
-        
+
         replay();
-        
+
         component.render(writer, cycle);
-        
+
         verify();
     }
-    
+
     @DataProvider(name="renderings")
     public Object[][] createRenderings() {
         return new Object[][] {
-            {"<span class=\"prefix\"><select name=\"fred\" 
autocomplete=\"off\" id=\"fred\" class=\"validation-delegate\"> 
</select></span>",
-                     Boolean.FALSE},
-            {"<span class=\"prefix\"><select name=\"fred\" 
autocomplete=\"off\" id=\"fred\" class=\"validation-delegate\"> <option " +
-                     "value=\"1p\">Simple 1</option><option value=\"2p\" 
selected=\"selected\">Simple 2</option><option value=\"3p\">Simple 
3</option></select></span>",
-                     Boolean.TRUE}
+          {"<span class=\"prefix\"><select name=\"fred\" autocomplete=\"off\" 
id=\"fred\" class=\"validation-delegate\"> </select></span>",
+           Boolean.FALSE},
+          {"<span class=\"prefix\"><select name=\"fred\" autocomplete=\"off\" 
id=\"fred\" class=\"validation-delegate\"> <option " +
+           "value=\"1p\">Simple 1</option><option value=\"2p\" 
selected=\"selected\">Simple 2</option><option value=\"3p\">Simple 
3</option></select></span>",
+           Boolean.TRUE}
         };
-    }    
-    
+    }
+
     @Test(dataProvider = "renderings")
     public void test_Render(String outcome, Boolean local)
-    {           
+    {
         IAutocompleteModel model = createModel();
         ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
         DataSqueezer ds = newMock(DataSqueezer.class);
         ResponseBuilder resp = newMock(ResponseBuilder.class);
-        
+
         IRequestCycle cycle = newMock(IRequestCycle.class);
         IForm form = newMock(IForm.class);
         checkOrder(form, false);
-        
+
         MockDelegate delegate = new MockDelegate();
-        
+
         IEngineService engine = newEngineService();
         ILink link = newLink();
-        
+
         IScript script = newMock(IScript.class);
-        
+
         SimpleBean match = new SimpleBean(new Integer(2), "Simple 2", 200);
-        
-        Autocompleter component = newInstance(Autocompleter.class, 
-                new Object[] { 
-            "name", "fred", "model", model, 
-            "directService", engine,
-            "script", script,
-            "validatableFieldSupport", vfs, 
-            "value", match,
-            "dataSqueezer", ds, "local", local
-        });
-        
+
+        Autocompleter component = newInstance(Autocompleter.class,
+                                              new Object[] {
+                                                "name", "fred", "model", model,
+                                                "directService", engine,
+                                                "script", script,
+                                                "validatableFieldSupport", vfs,
+                                                "value", match,
+                                                "dataSqueezer", ds, "local", 
local
+                                              });
+
         expect(cycle.renderStackPush(component)).andReturn(component);
-        
+
         expect(form.getName()).andReturn("testform").anyTimes();
-        
+
         form.setFormFieldUpdating(true);
-        
+
         IMarkupWriter writer = newBufferWriter();
-        
-        DirectServiceParameter dsp = 
-            new DirectServiceParameter(component);
-        
+
+        DirectServiceParameter dsp =
+          new DirectServiceParameter(component);
+
         trainGetForm(cycle, form);
         trainWasPrerendered(form, writer, component, false);
-        
+
         trainGetDelegate(form, delegate);
-        
+
         delegate.setFormComponent(component);
-        
+
         trainGetElementId(form, component, "fred");
         trainIsRewinding(form, false);
         expect(cycle.isRewinding()).andReturn(false).anyTimes();
-        
+
         delegate.setFormComponent(component);
-        
+
         expect(cycle.getResponseBuilder()).andReturn(resp).anyTimes();
         expect(resp.isDynamic()).andReturn(false).anyTimes();
-        
+
         vfs.renderContributions(component, writer, cycle);
-        if (!local.booleanValue()) 
+        if (!local.booleanValue())
         {
-            trainGetLinkCheckIgnoreParameter(engine, cycle, true, dsp, link);  
      
+            trainGetLinkCheckIgnoreParameter(engine, cycle, true, dsp, link);
             trainGetURL(link, "urlstring");
         }
-        else 
+        else
         {
             expect(ds.squeeze(1)).andReturn("1p");
             expect(ds.squeeze(2)).andReturn("2p");
             expect(ds.squeeze(3)).andReturn("3p");
         }
         // for the default value
-        expect(ds.squeeze(2)).andReturn("2p"); 
-        
+        expect(ds.squeeze(2)).andReturn("2p");
+
         PageRenderSupport prs = newPageRenderSupport();
         trainGetPageRenderSupport(cycle, prs);
-        
+
         script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
-        
+
         expect(cycle.renderStackPop()).andReturn(component);
-        
+
         replay();
-        
+
         component.render(writer, cycle);
-        
+
         verify();
-        
+
         assertBuffer(outcome);
     }
-    
+
     public void test_Render_JSON()
     {
         IAutocompleteModel model = createModel();
         IRequestCycle cycle = newMock(IRequestCycle.class);
         DataSqueezer ds = newMock(DataSqueezer.class);
         checkOrder(ds, false);
-        
+
         IJSONWriter writer = newBufferJSONWriter();
-        
+
         Autocompleter component = newInstance(Autocompleter.class, new Object[]
-        { "name", "fred", "model", model,
+          { "name", "fred", "model", model,
             "filter", "l", "dataSqueezer", ds });
-        
+
         expect(ds.squeeze(1)).andReturn("1");
         expect(ds.squeeze(2)).andReturn("2");
         expect(ds.squeeze(3)).andReturn("3");
-        
+
         replay();
-        
+
         component.renderComponent(writer, cycle);
-        
+
         verify();
-        
+
         JSONObject json = writer.object();
-        
+
         assertEquals(json.length(), 3);
         assertEquals(json.get("1"), "Simple 1");
         assertEquals(json.get("2"), "Simple 2");
         assertEquals(json.get("3"), "Simple 3");
     }
-    
+
     public void test_Is_Required()
     {
         ValidatableFieldSupport support = 
newMock(ValidatableFieldSupport.class);
-        
-        Autocompleter field = newInstance(Autocompleter.class, 
-                new Object[] { "validatableFieldSupport", support, });
-        
+
+        Autocompleter field = newInstance(Autocompleter.class,
+                                          new Object[] { 
"validatableFieldSupport", support, });
+
         expect(support.isRequired(field)).andReturn(true);
-        
+
         replay();
-        
+
         assert field.isRequired();
 
         verify();

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestIncludeScripts.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestIncludeScripts.java?view=diff&rev=558539&r1=558538&r2=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestIncludeScripts.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestIncludeScripts.java
 Sun Jul 22 13:32:56 2007
@@ -13,18 +13,15 @@
 // limitations under the License.
 package org.apache.tapestry.dojo.html;
 
-import static org.easymock.EasyMock.expect;
-
 import org.apache.tapestry.BaseComponentTestCase;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
+import static org.easymock.EasyMock.expect;
 import org.testng.annotations.Test;
 
 
 /**
  * Tests functionality of [EMAIL PROTECTED] ScriptIncludes} component.
- *
- * @author jkuhnert
  */
 @Test
 public class TestIncludeScripts extends BaseComponentTestCase
@@ -32,13 +29,10 @@
     public void test_Rewinding()
     {
         IMarkupWriter writer = newWriter();
-        
         IRequestCycle cycle = newCycle(true);
-        
         ScriptIncludes comp = newInstance(ScriptIncludes.class, null);
         
         expect(cycle.renderStackPush(comp)).andReturn(comp);
-        
         expect(cycle.renderStackPop()).andReturn(comp);
         
         replay();

Added: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java?view=auto&rev=558539
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
 (added)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
 Sun Jul 22 13:32:56 2007
@@ -0,0 +1,71 @@
+package org.apache.tapestry.dojo.html;
+
+import org.apache.tapestry.*;
+import org.apache.tapestry.engine.IEngineService;
+import static org.easymock.EasyMock.*;
+import org.testng.annotations.Test;
+
+import java.util.Map;
+
+/**
+ * Tests functionality of [EMAIL PROTECTED] InlineEditBox}. 
+ */
[EMAIL PROTECTED]
+public class TestInlineEditBox extends BaseComponentTestCase {
+
+    public void test_Render_Widget()
+    {
+        IRequestCycle cycle = newCycle();
+        PageRenderSupport prs = newPageRenderSupport();
+        IScript script = newMock(IScript.class);
+        IEngineService engine = newMock(IEngineService.class);
+
+        IMarkupWriter writer = newBufferWriter();
+
+        InlineEditBox comp = newInstance(InlineEditBox.class,
+                                         "templateTagName", "div",
+                                         "clientId", "inline",
+                                         "value", "Foo",
+                                         "mode", InlineEditBox.TEXT_MODE,
+                                         "stateful", false,
+                                         "disabled", false,
+                                         "doFade", false,
+                                         "minWidth", 100,
+                                         "minHeight", 200,
+                                         "engine", engine,
+                                         "script", script);
+
+        expect(cycle.isRewinding()).andReturn(false).anyTimes();
+        trainGetPageRenderSupport(cycle, prs);
+
+        script.execute(eq(comp), eq(cycle), eq(prs), isA(Map.class));
+        
+        replay();
+
+        comp.renderWidget(writer, cycle);
+
+        verify();
+
+        assertBuffer("<div id=\"inline\"></div>");
+    }
+
+    public void test_Rewind()
+    {
+        IRequestCycle cycle = newCycle();
+        IMarkupWriter writer = newMock(IMarkupWriter.class);
+
+        InlineEditBox comp = newInstance(InlineEditBox.class,
+                                         "templateTagName", "div",
+                                         "clientId", "inline",
+                                         "value", "Foo",
+                                         "mode", InlineEditBox.TEXT_MODE);
+
+        expect(cycle.isRewinding()).andReturn(true).anyTimes();
+
+        replay();
+
+        comp.renderWidget(writer, cycle);
+
+        verify();
+    }
+}

Propchange: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/html/TestInlineEditBox.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to