Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/InternalUtils.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/InternalUtils.java?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/InternalUtils.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/InternalUtils.java
 Fri Nov 17 15:42:14 2006
@@ -12,373 +12,407 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.internal.util;
-
-import static org.apache.tapestry.util.CollectionFactory.newList;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.apache.tapestry.Locatable;
-import org.apache.tapestry.Location;
-import org.apache.tapestry.ioc.ServiceLocator;
-import org.apache.tapestry.ioc.annotations.Inject;
-import org.apache.tapestry.ioc.annotations.InjectService;
-
-/**
- * Utilities used within various internal implemenations of Tapestry IOC and 
the rest of the
- * tapestry-core framework.
- */
-
-public class InternalUtils
-{
-    /**
-     * Leading punctiation on member names that is stripped off to form a 
property name or new
-     * member name.
-     */
-    public static final String NAME_PREFIX = "_$";
-
-    private InternalUtils()
-    {
-    }
-
-    /**
-     * Converts a method to a user presentable string consisting of the 
containing class name, the
-     * method name, and the short form of the parameter list (the class name 
of each parameter type,
-     * shorn of the package name portion).
-     * 
-     * @param method
-     * @return short string representation
-     */
-    public static String asString(Method method)
-    {
-        StringBuilder buffer = new StringBuilder();
-
-        buffer.append(method.getDeclaringClass().getName());
-        buffer.append(".");
-        buffer.append(method.getName());
-        buffer.append("(");
-
-        for (int i = 0; i < method.getParameterTypes().length; i++)
-        {
-            if (i > 0)
-                buffer.append(", ");
-
-            String name = method.getParameterTypes()[i].getSimpleName();
-
-            int dotx = name.lastIndexOf('.');
-
-            buffer.append(name.substring(dotx + 1));
-        }
-
-        return buffer.append(")").toString();
-    }
-
-    /** Returns the size of an object array, or null if the array is empty. */
-
-    public static int size(Object[] array)
-    {
-        return array == null ? 0 : array.length;
-    }
-
-    /** Strips leading punctuation ("_" and "$") from the provided name. */
-    public static String stripMemberPrefix(String memberName)
-    {
-        StringBuilder builder = new StringBuilder(memberName);
-
-        // There may be other prefixes we want to strip off, at some point!
-
-        // Strip off leading characters defined by NAME_PREFIX
-
-        // This code is really ugly and needs to be fixed.
-
-        while (true)
-        {
-            char ch = builder.charAt(0);
-
-            if (InternalUtils.NAME_PREFIX.indexOf(ch) < 0)
-                break;
-
-            builder.deleteCharAt(0);
-        }
-
-        return builder.toString();
-    }
-
-    /**
-     * Strips leading characters defined by [EMAIL PROTECTED] 
InternalUtils#NAME_PREFIX}, then adds the prefix
-     * back in.
-     */
-    public static String createMemberName(String memberName)
-    {
-        return NAME_PREFIX + stripMemberPrefix(memberName);
-    }
-
-    /**
-     * Converts an enumeration (of Strings) into a sorted list of Strings.
-     */
-    public static List<String> toList(Enumeration e)
-    {
-        List<String> result = newList();
-
-        while (e.hasMoreElements())
-        {
-            String name = (String) e.nextElement();
-
-            result.add(name);
-        }
-
-        Collections.sort(result);
-
-        return result;
-    }
-
-    /**
-     * Finds a specific annotation type within an array of annotations.
-     * 
-     * @param <T>
-     * @param annotations
-     *            to search
-     * @param annotationClass
-     *            to match
-     * @return the annotation instance, if found, or null otherwise
-     */
-    public static <T extends Annotation> T findAnnotation(Annotation[] 
annotations,
-            Class<T> annotationClass)
-    {
-        for (Annotation a : annotations)
-        {
-            if (annotationClass.isInstance(a))
-                return annotationClass.cast(a);
-        }
-
-        return null;
-    }
-
-    @SuppressWarnings("unchecked")
-    private static Object calculateParameterValue(Class parameterType,
-            Annotation[] parameterAnnotations, ServiceLocator locator,
-            Map<Class, Object> parameterDefaults)
-    {
-        InjectService is = findAnnotation(parameterAnnotations, 
InjectService.class);
-
-        if (is != null)
-        {
-            String serviceId = is.value();
-
-            return locator.getService(serviceId, parameterType);
-        }
-
-        Inject i = findAnnotation(parameterAnnotations, Inject.class);
-
-        if (i != null)
-        {
-            String reference = i.value();
-
-            return locator.getObject(reference, parameterType);
-        }
-
-        // See if we have any "pre-determined" parameter type to object 
mappings
-
-        Object result = parameterDefaults.get(parameterType);
-
-        // This will return a non-null value, or throw an exception
-
-        if (result == null)
-            result = locator.getService(parameterType);
-
-        // ... so the result is never null
-
-        return result;
-    }
-
-    public static Object[] calculateParametersForMethod(Method method, 
ServiceLocator locator,
-            Map<Class, Object> parameterDefaults)
-    {
-        Class[] parameterTypes = method.getParameterTypes();
-        Annotation[][] annotations = method.getParameterAnnotations();
-
-        return InternalUtils.calculateParameters(
-                locator,
-                parameterDefaults,
-                parameterTypes,
-                annotations);
-    }
-
-    public static Object[] calculateParameters(ServiceLocator locator,
-            Map<Class, Object> parameterDefaults, Class[] parameterTypes,
-            Annotation[][] parameterAnnotations)
-    {
-        int parameterCount = parameterTypes.length;
-
-        Object[] parameters = new Object[parameterCount];
-
-        for (int i = 0; i < parameterCount; i++)
-        {
-            parameters[i] = calculateParameterValue(
-                    parameterTypes[i],
-                    parameterAnnotations[i],
-                    locator,
-                    parameterDefaults);
-        }
-
-        return parameters;
-    }
-
-    /** Joins together some number of elements to form a comma separated list. 
*/
-    public static String join(List elements)
-    {
-        StringBuilder buffer = new StringBuilder();
-        boolean first = true;
-
-        for (Object o : elements)
-        {
-            if (!first)
-                buffer.append(", ");
-
-            buffer.append(String.valueOf(o));
-
-            first = false;
-        }
-
-        return buffer.toString();
-    }
-
-    /** Creates a sorted copy of the provided elements, then turns that into a 
comma separated list. */
-    public static String joinSorted(Collection elements)
-    {
-        List<String> list = newList();
-
-        for (Object o : elements)
-            list.add(String.valueOf(o));
-
-        Collections.sort(list);
-
-        return join(list);
-    }
-
-    /**
-     * Returns true if the input is null, or is a zero length string 
(excluding leading/trailing
-     * whitespace).
-     */
-
-    public static boolean isBlank(String input)
-    {
-        return input == null || input.length() == 0 || input.trim().length() 
== 0;
-    }
-
-    public static boolean isNonBlank(String input)
-    {
-        return !isBlank(input);
-    }
-
-    /** Capitalizes a string, converting the first character to uppercase. */
-    public static String capitalize(String input)
-    {
-        if (input.length() == 0)
-            return input;
-
-        return input.substring(0, 1).toUpperCase() + input.substring(1);
-    }
-
-    /**
-     * Sniffs the object to see if it is a [EMAIL PROTECTED] Location} or 
[EMAIL PROTECTED] Locatable}. Returns null if
-     * null or not convertable to a location.
-     */
-
-    public static Location locationOf(Object location)
-    {
-        if (location == null)
-            return null;
-
-        if (location instanceof Location)
-            return (Location) location;
-
-        if (location instanceof Locatable)
-            return ((Locatable) location).getLocation();
-
-        return null;
-    }
-
-    /**
-     * Extracts the string keys from a map and returns them in sorted order. 
The keys are converted
-     * to strings.
-     * 
-     * @param map
-     *            the map to extract keys from (may be null)
-     * @return the sorted keys, or the empty set if map is null
-     */
-
-    public static List<String> sortedKeys(Map map)
-    {
-        if (map == null)
-            return Collections.emptyList();
-
-        List<String> keys = newList();
-
-        for (Object o : map.keySet())
-            keys.add(String.valueOf(o));
-
-        Collections.sort(keys);
-
-        return keys;
-    }
-
-    /**
-     * Gets a value from a map (which may be null).
-     * 
-     * @param <K>
-     * @param <V>
-     * @param map
-     *            the map to extract from (may be null)
-     * @param key
-     * @return the value from the map, or null if the map is null
-     */
-
-    public static <K, V> V get(Map<K, V> map, K key)
-    {
-        if (map == null)
-            return null;
-
-        return map.get(key);
-    }
-
-    /** Returns true if the method provided is a static method. */
-    public static final boolean isStatic(Method method)
-    {
-        return Modifier.isStatic(method.getModifiers());
-    }
-
-    public static final <T> Iterator<T> reverseIterator(final List<T> list)
-    {
-        final ListIterator<T> normal = list.listIterator(list.size());
-
-        return new Iterator<T>()
-        {
-            public boolean hasNext()
-            {
-                return normal.hasPrevious();
-            }
-
-            public T next()
-            {
-                // TODO Auto-generated method stub
-                return normal.previous();
-            }
-
-            public void remove()
-            {
-                throw new UnsupportedOperationException();
-            }
-
-        };
-    }
-}
+package org.apache.tapestry.internal.util;
+
+import static org.apache.tapestry.util.CollectionFactory.newList;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.apache.tapestry.Locatable;
+import org.apache.tapestry.Location;
+import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.ioc.annotations.InjectService;
+
+/**
+ * Utilities used within various internal implemenations of Tapestry IOC and 
the rest of the
+ * tapestry-core framework.
+ */
+
+public class InternalUtils
+{
+    /**
+     * Leading punctiation on member names that is stripped off to form a 
property name or new
+     * member name.
+     */
+    public static final String NAME_PREFIX = "_$";
+
+    private InternalUtils()
+    {
+    }
+
+    /**
+     * Converts a method to a user presentable string consisting of the 
containing class name, the
+     * method name, and the short form of the parameter list (the class name 
of each parameter type,
+     * shorn of the package name portion).
+     * 
+     * @param method
+     * @return short string representation
+     */
+    public static String asString(Method method)
+    {
+        StringBuilder buffer = new StringBuilder();
+
+        buffer.append(method.getDeclaringClass().getName());
+        buffer.append(".");
+        buffer.append(method.getName());
+        buffer.append("(");
+
+        for (int i = 0; i < method.getParameterTypes().length; i++)
+        {
+            if (i > 0)
+                buffer.append(", ");
+
+            String name = method.getParameterTypes()[i].getSimpleName();
+
+            int dotx = name.lastIndexOf('.');
+
+            buffer.append(name.substring(dotx + 1));
+        }
+
+        return buffer.append(")").toString();
+    }
+
+    /** Returns the size of an object array, or null if the array is empty. */
+
+    public static int size(Object[] array)
+    {
+        return array == null ? 0 : array.length;
+    }
+
+    /** Strips leading punctuation ("_" and "$") from the provided name. */
+    public static String stripMemberPrefix(String memberName)
+    {
+        StringBuilder builder = new StringBuilder(memberName);
+
+        // There may be other prefixes we want to strip off, at some point!
+
+        // Strip off leading characters defined by NAME_PREFIX
+
+        // This code is really ugly and needs to be fixed.
+
+        while (true)
+        {
+            char ch = builder.charAt(0);
+
+            if (InternalUtils.NAME_PREFIX.indexOf(ch) < 0)
+                break;
+
+            builder.deleteCharAt(0);
+        }
+
+        return builder.toString();
+    }
+
+    /**
+     * Strips leading characters defined by [EMAIL PROTECTED] 
InternalUtils#NAME_PREFIX}, then adds the prefix
+     * back in.
+     */
+    public static String createMemberName(String memberName)
+    {
+        return NAME_PREFIX + stripMemberPrefix(memberName);
+    }
+
+    /**
+     * Converts an enumeration (of Strings) into a sorted list of Strings.
+     */
+    public static List<String> toList(Enumeration e)
+    {
+        List<String> result = newList();
+
+        while (e.hasMoreElements())
+        {
+            String name = (String) e.nextElement();
+
+            result.add(name);
+        }
+
+        Collections.sort(result);
+
+        return result;
+    }
+
+    /**
+     * Finds a specific annotation type within an array of annotations.
+     * 
+     * @param <T>
+     * @param annotations
+     *            to search
+     * @param annotationClass
+     *            to match
+     * @return the annotation instance, if found, or null otherwise
+     */
+    public static <T extends Annotation> T findAnnotation(Annotation[] 
annotations,
+            Class<T> annotationClass)
+    {
+        for (Annotation a : annotations)
+        {
+            if (annotationClass.isInstance(a))
+                return annotationClass.cast(a);
+        }
+
+        return null;
+    }
+
+    @SuppressWarnings("unchecked")
+    private static Object calculateParameterValue(Class parameterType,
+            Annotation[] parameterAnnotations, ServiceLocator locator,
+            Map<Class, Object> parameterDefaults)
+    {
+        InjectService is = findAnnotation(parameterAnnotations, 
InjectService.class);
+
+        if (is != null)
+        {
+            String serviceId = is.value();
+
+            return locator.getService(serviceId, parameterType);
+        }
+
+        Inject i = findAnnotation(parameterAnnotations, Inject.class);
+
+        if (i != null)
+        {
+            String reference = i.value();
+
+            return locator.getObject(reference, parameterType);
+        }
+
+        // See if we have any "pre-determined" parameter type to object 
mappings
+
+        Object result = parameterDefaults.get(parameterType);
+
+        // This will return a non-null value, or throw an exception
+
+        if (result == null)
+            result = locator.getService(parameterType);
+
+        // ... so the result is never null
+
+        return result;
+    }
+
+    public static Object[] calculateParametersForMethod(Method method, 
ServiceLocator locator,
+            Map<Class, Object> parameterDefaults)
+    {
+        Class[] parameterTypes = method.getParameterTypes();
+        Annotation[][] annotations = method.getParameterAnnotations();
+
+        return InternalUtils.calculateParameters(
+                locator,
+                parameterDefaults,
+                parameterTypes,
+                annotations);
+    }
+
+    public static Object[] calculateParameters(ServiceLocator locator,
+            Map<Class, Object> parameterDefaults, Class[] parameterTypes,
+            Annotation[][] parameterAnnotations)
+    {
+        int parameterCount = parameterTypes.length;
+
+        Object[] parameters = new Object[parameterCount];
+
+        for (int i = 0; i < parameterCount; i++)
+        {
+            parameters[i] = calculateParameterValue(
+                    parameterTypes[i],
+                    parameterAnnotations[i],
+                    locator,
+                    parameterDefaults);
+        }
+
+        return parameters;
+    }
+
+    /** Joins together some number of elements to form a comma separated list. 
*/
+    public static String join(List elements)
+    {
+        StringBuilder buffer = new StringBuilder();
+        boolean first = true;
+
+        for (Object o : elements)
+        {
+            if (!first)
+                buffer.append(", ");
+
+            buffer.append(String.valueOf(o));
+
+            first = false;
+        }
+
+        return buffer.toString();
+    }
+
+    /** Creates a sorted copy of the provided elements, then turns that into a 
comma separated list. */
+    public static String joinSorted(Collection elements)
+    {
+        List<String> list = newList();
+
+        for (Object o : elements)
+            list.add(String.valueOf(o));
+
+        Collections.sort(list);
+
+        return join(list);
+    }
+
+    /**
+     * Returns true if the input is null, or is a zero length string 
(excluding leading/trailing
+     * whitespace).
+     */
+
+    public static boolean isBlank(String input)
+    {
+        return input == null || input.length() == 0 || input.trim().length() 
== 0;
+    }
+
+    public static boolean isNonBlank(String input)
+    {
+        return !isBlank(input);
+    }
+
+    /** Capitalizes a string, converting the first character to uppercase. */
+    public static String capitalize(String input)
+    {
+        if (input.length() == 0)
+            return input;
+
+        return input.substring(0, 1).toUpperCase() + input.substring(1);
+    }
+
+    /**
+     * Sniffs the object to see if it is a [EMAIL PROTECTED] Location} or 
[EMAIL PROTECTED] Locatable}. Returns null if
+     * null or not convertable to a location.
+     */
+
+    public static Location locationOf(Object location)
+    {
+        if (location == null)
+            return null;
+
+        if (location instanceof Location)
+            return (Location) location;
+
+        if (location instanceof Locatable)
+            return ((Locatable) location).getLocation();
+
+        return null;
+    }
+
+    /**
+     * Extracts the string keys from a map and returns them in sorted order. 
The keys are converted
+     * to strings.
+     * 
+     * @param map
+     *            the map to extract keys from (may be null)
+     * @return the sorted keys, or the empty set if map is null
+     */
+
+    public static List<String> sortedKeys(Map map)
+    {
+        if (map == null)
+            return Collections.emptyList();
+
+        List<String> keys = newList();
+
+        for (Object o : map.keySet())
+            keys.add(String.valueOf(o));
+
+        Collections.sort(keys);
+
+        return keys;
+    }
+
+    /**
+     * Gets a value from a map (which may be null).
+     * 
+     * @param <K>
+     * @param <V>
+     * @param map
+     *            the map to extract from (may be null)
+     * @param key
+     * @return the value from the map, or null if the map is null
+     */
+
+    public static <K, V> V get(Map<K, V> map, K key)
+    {
+        if (map == null)
+            return null;
+
+        return map.get(key);
+    }
+
+    /** Returns true if the method provided is a static method. */
+    public static final boolean isStatic(Method method)
+    {
+        return Modifier.isStatic(method.getModifiers());
+    }
+
+    public static final <T> Iterator<T> reverseIterator(final List<T> list)
+    {
+        final ListIterator<T> normal = list.listIterator(list.size());
+
+        return new Iterator<T>()
+        {
+            public boolean hasNext()
+            {
+                return normal.hasPrevious();
+            }
+
+            public T next()
+            {
+                // TODO Auto-generated method stub
+                return normal.previous();
+            }
+
+            public void remove()
+            {
+                throw new UnsupportedOperationException();
+            }
+
+        };
+    }
+
+    /**
+     * Capitalizes the string, and inserts a space before each upper case 
character (or sequence of
+     * upper case characters). Thus "userId" becomes "User Id", etc.
+     */
+    public static String toUserPresentable(String id)
+    {
+        StringBuilder builder = new StringBuilder(id.length() * 2);
+
+        char[] chars = id.toCharArray();
+        boolean postSpace = true;
+
+        for (int i = 0; i < chars.length; i++)
+        {
+            char ch = chars[i];
+
+            if (i == 0)
+            {
+                builder.append(Character.toUpperCase(ch));
+                continue;
+            }
+
+            boolean upperCase = Character.isUpperCase(ch);
+
+            if (upperCase && !postSpace)
+                builder.append(' ');
+
+            builder.append(ch);
+
+            postSpace = upperCase;
+        }
+
+        return builder.toString();
+    }
+}

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
 Fri Nov 17 15:42:14 2006
@@ -38,6 +38,7 @@
 import org.apache.tapestry.annotations.PreBeginRender;
 import org.apache.tapestry.annotations.SetupRender;
 import org.apache.tapestry.internal.InternalConstants;
+import org.apache.tapestry.internal.bindings.ComponentBindingFactory;
 import org.apache.tapestry.internal.bindings.LiteralBindingFactory;
 import org.apache.tapestry.internal.services.ApplicationGlobalsImpl;
 import org.apache.tapestry.internal.services.BindingSourceImpl;
@@ -449,6 +450,7 @@
     {
         configuration.add(InternalConstants.LITERAL_BINDING_PREFIX, new 
LiteralBindingFactory());
         configuration.add(InternalConstants.PROP_BINDING_PREFIX, 
propBindingFactory);
+        configuration.add("component", new ComponentBindingFactory());
     }
 
     /**

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt 
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt 
Fri Nov 17 15:42:14 2006
@@ -117,7 +117,9 @@
 
*------------+----------------------------------------------------------------------------------+
 | <<Prefix>> | <<Description>>                                                 
                 |
 
*------------+----------------------------------------------------------------------------------+
-| literal:   | A literal string. The default inside a component template.      
                 |
+| component: | The id of another component within the same template.           
                 |
+*------------+----------------------------------------------------------------------------------+
+| literal:   | A literal string.                                               
                 |
 
*------------+----------------------------------------------------------------------------------+
 | prop:      | The name of a property of the containing component to read or 
update.            |
 
*------------+----------------------------------------------------------------------------------+

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
 Fri Nov 17 15:42:14 2006
@@ -251,6 +251,10 @@
 
         clickAndWait("link=SimpleForm");
 
+        assertText("//label[1]", "Email");
+        assertText("//label[2]", "Incident Message");
+        assertText("//label[3]", "Urgent");
+
         assertValue("email", "");
         assertValue("message", "");
         assertValue("urgent", "off");
@@ -270,6 +274,23 @@
         assertTextPresent("[EMAIL PROTECTED]");
         assertTextPresent("[Message for you, sir!]");
         assertTextPresent("[true]");
+    }
+
+    private void assertText(String locator, String expected)
+    {
+        String actual = _selenium.getText(locator);
+
+        if (actual.equals(expected))
+            return;
+
+        System.err.printf(
+                "Text for %s should be '%s' but is '%s', in:\n\n%s\n\n",
+                locator,
+                expected,
+                actual,
+                _selenium.getHtmlSource());
+
+        throw new AssertionError(String.format("%s was '%s' not '%s'", 
locator, actual, expected));
     }
 
     private void assertValue(String locator, String expected)

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Countdown.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Countdown.java?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Countdown.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Countdown.java
 Fri Nov 17 15:42:14 2006
@@ -12,38 +12,29 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.integration.app1.pages;
-
-import org.apache.tapestry.annotations.Component;
-import org.apache.tapestry.annotations.ComponentClass;
-import org.apache.tapestry.integration.app1.components.Count;
-
-/**
- * 
- */
[EMAIL PROTECTED]
-public class Countdown
-{
-    @Component(parameters =
-    { "start=10", "end=1", "value=countValue" })
-    private Count _count;
-
-    private int _countValue;
-
-    public int getCountValue()
-    {
-        return _countValue;
-    }
-
-    public void setCountValue(int countValue)
-    {
-        _countValue = countValue;
-    }
-
-    // Just needed until component: binding prefix is added.
-
-    public Count getComponent()
-    {
-        return _count;
-    }
-}
+package org.apache.tapestry.integration.app1.pages;
+
+import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.integration.app1.components.Count;
+
[EMAIL PROTECTED]
+public class Countdown
+{
+    @SuppressWarnings("unused")
+    @Component(parameters =
+    { "start=10", "end=1", "value=countValue" })
+    private Count _count;
+
+    private int _countValue;
+
+    public int getCountValue()
+    {
+        return _countValue;
+    }
+
+    public void setCountValue(int countValue)
+    {
+        _countValue = countValue;
+    }
+}

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/InternalUtilsTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/InternalUtilsTest.java?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/InternalUtilsTest.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/InternalUtilsTest.java
 Fri Nov 17 15:42:14 2006
@@ -12,274 +12,290 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.internal.util;
-
-import static org.apache.tapestry.internal.util.InternalUtils.toList;
-import static org.apache.tapestry.util.CollectionFactory.newMap;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tapestry.Locatable;
-import org.apache.tapestry.Location;
-import org.apache.tapestry.internal.test.InternalBaseTestCase;
-import org.apache.tapestry.util.CollectionFactory;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * 
- */
-public class InternalUtilsTest extends InternalBaseTestCase
-{
-    @Test
-    public void method_as_string_no_args() throws Exception
-    {
-
-        Method m = Object.class.getMethod("toString");
-
-        assertEquals(InternalUtils.asString(m), "java.lang.Object.toString()");
-    }
-
-    @Test
-    public void method_as_string_with_args() throws Exception
-    {
-        Method m = Collections.class.getMethod("sort", List.class, 
Comparator.class);
-
-        assertEquals(InternalUtils.asString(m), 
"java.util.Collections.sort(List, Comparator)");
-    }
-
-    @Test
-    public void method_as_string_primitive_arg() throws Exception
-    {
-        Method m = Object.class.getMethod("wait", long.class);
-
-        assertEquals(InternalUtils.asString(m), "java.lang.Object.wait(long)");
-    }
-
-    @Test
-    public void method_as_string_primitive_array_arg() throws Exception
-    {
-        Method m = Arrays.class.getMethod("sort", int[].class);
-
-        assertEquals(InternalUtils.asString(m), 
"java.util.Arrays.sort(int[])");
-    }
-
-    @Test
-    public void method_as_string_array_arg() throws Exception
-    {
-        Method m = Arrays.class.getMethod("sort", Object[].class);
-
-        assertEquals(InternalUtils.asString(m), 
"java.util.Arrays.sort(Object[])");
-    }
-
-    @Test
-    public void array_size_when_null()
-    {
-        assertEquals(InternalUtils.size(null), 0);
-    }
-
-    @Test
-    public void array_size_when_non_null()
-    {
-        Object[] array =
-        { 1, 2, 3 };
-
-        assertEquals(InternalUtils.size(array), 3);
-    }
-
-    @Test(dataProvider = "memberPrefixData")
-    public void strip_member_prefix(String input, String expected)
-    {
-        assertEquals(InternalUtils.stripMemberPrefix(input), expected);
-    }
-
-    @DataProvider(name = "memberPrefixData")
-    public Object[][] memberPrefixData()
-    {
-        return new Object[][]
-        {
-        { "simple", "simple" },
-        { "_name", "name" },
-        { "$name", "name" },
-        { "$_$__$__$_$___$_$_$_$$name$", "name$" } };
-    }
-
-    @Test
-    public void enumeration_to_list()
-    {
-        List<String> input = Arrays.asList("wilma", "fred", "barney");
-        Enumeration e = Collections.enumeration(input);
-
-        List<String> output = toList(e);
-
-        assertEquals(output, Arrays.asList("barney", "fred", "wilma"));
-    }
-
-    @Test
-    public void join_empty_list()
-    {
-        List<String> empty = CollectionFactory.newList();
-
-        assertEquals(InternalUtils.join(empty), "");
-    }
-
-    @Test
-    public void join_single()
-    {
-        List<String> single = Arrays.asList("barney");
-
-        assertEquals(InternalUtils.join(single), "barney");
-    }
-
-    @Test
-    public void join_multiple()
-    {
-        List<String> many = Arrays.asList("fred", "barney", "wilma");
-        assertEquals(InternalUtils.join(many), "fred, barney, wilma");
-    }
-
-    @Test
-    public void join_sorted()
-    {
-        List<String> unsorted = Arrays.asList("betty", "fred", "barney", 
"wilma");
-        List<String> copy = CollectionFactory.newList(unsorted);
-
-        assertEquals(InternalUtils.joinSorted(copy), "barney, betty, fred, 
wilma");
-
-        // Make sure that joinSorted() doesn't change the input list
-
-        assertEquals(copy, unsorted);
-    }
-
-    @Test(dataProvider = "capitalize_inputs")
-    public void capitalize(String input, String expected)
-    {
-        assertEquals(InternalUtils.capitalize(input), expected);
-    }
-
-    @DataProvider(name = "capitalize_inputs")
-    public Object[][] capitalize_inputs()
-    {
-        return new Object[][]
-        {
-        { "hello", "Hello" },
-        { "Goodbye", "Goodbye" },
-        { "", "" },
-        { "a", "A" },
-        { "A", "A" } };
-    }
-
-    @Test
-    public void location_of_not_found()
-    {
-        assertNull(InternalUtils.locationOf(null));
-        assertNull(InternalUtils.locationOf("La! La!"));
-    }
-
-    @Test
-    public void location_of_location()
-    {
-        Location l = newLocation();
-
-        replay();
-
-        assertSame(l, InternalUtils.locationOf(l));
-
-        verify();
-    }
-
-    @Test
-    public void location_of_locatable()
-    {
-        Location l = newLocation();
-        Locatable locatable = newMock(Locatable.class);
-
-        locatable.getLocation();
-        setReturnValue(l);
-
-        replay();
-
-        assertSame(l, InternalUtils.locationOf(locatable));
-
-        verify();
-    }
-
-    @Test
-    public void sorted_keys_from_null_map()
-    {
-        List<String> list = InternalUtils.sortedKeys(null);
-
-        assertTrue(list.isEmpty());
-    }
-
-    @Test
-    public void sorted_keys_from_map()
-    {
-        Map<String, String> map = newMap();
-
-        map.put("fred", "flintstone");
-        map.put("barney", "rubble");
-
-        assertEquals(InternalUtils.sortedKeys(map), Arrays.asList("barney", 
"fred"));
-    }
-
-    @Test
-    public void get_from_null_map()
-    {
-        assertNull(InternalUtils.get(null, null));
-    }
-
-    @Test
-    public void get_from_map()
-    {
-        Map<String, String> map = newMap();
-
-        map.put("fred", "flintstone");
-
-        assertEquals("flintstone", InternalUtils.get(map, "fred"));
-    }
-
-    @Test
-    public void reverse_iterator()
-    {
-        List<String> list = Arrays.asList("a", "b", "c");
-
-        Iterator<String> i = InternalUtils.reverseIterator(list);
-
-        assertTrue(i.hasNext());
-        assertEquals(i.next(), "c");
-
-        assertTrue(i.hasNext());
-        assertEquals(i.next(), "b");
-
-        assertTrue(i.hasNext());
-        assertEquals(i.next(), "a");
-
-        assertFalse(i.hasNext());
-    }
-
-    @Test
-    public void reverse_iterator_does_not_support_remove()
-    {
-        List<String> list = Arrays.asList("a", "b", "c");
-
-        Iterator<String> i = InternalUtils.reverseIterator(list);
-
-        try
-        {
-            i.remove();
-            unreachable();
-        }
-        catch (UnsupportedOperationException ex)
-        {
-
-        }
-    }
-}
+package org.apache.tapestry.internal.util;
+
+import static org.apache.tapestry.internal.util.InternalUtils.toList;
+import static org.apache.tapestry.util.CollectionFactory.newMap;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tapestry.Locatable;
+import org.apache.tapestry.Location;
+import org.apache.tapestry.internal.test.InternalBaseTestCase;
+import org.apache.tapestry.util.CollectionFactory;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ */
+public class InternalUtilsTest extends InternalBaseTestCase
+{
+    @Test
+    public void method_as_string_no_args() throws Exception
+    {
+
+        Method m = Object.class.getMethod("toString");
+
+        assertEquals(InternalUtils.asString(m), "java.lang.Object.toString()");
+    }
+
+    @Test
+    public void method_as_string_with_args() throws Exception
+    {
+        Method m = Collections.class.getMethod("sort", List.class, 
Comparator.class);
+
+        assertEquals(InternalUtils.asString(m), 
"java.util.Collections.sort(List, Comparator)");
+    }
+
+    @Test
+    public void method_as_string_primitive_arg() throws Exception
+    {
+        Method m = Object.class.getMethod("wait", long.class);
+
+        assertEquals(InternalUtils.asString(m), "java.lang.Object.wait(long)");
+    }
+
+    @Test
+    public void method_as_string_primitive_array_arg() throws Exception
+    {
+        Method m = Arrays.class.getMethod("sort", int[].class);
+
+        assertEquals(InternalUtils.asString(m), 
"java.util.Arrays.sort(int[])");
+    }
+
+    @Test
+    public void method_as_string_array_arg() throws Exception
+    {
+        Method m = Arrays.class.getMethod("sort", Object[].class);
+
+        assertEquals(InternalUtils.asString(m), 
"java.util.Arrays.sort(Object[])");
+    }
+
+    @Test
+    public void array_size_when_null()
+    {
+        assertEquals(InternalUtils.size(null), 0);
+    }
+
+    @Test
+    public void array_size_when_non_null()
+    {
+        Object[] array =
+        { 1, 2, 3 };
+
+        assertEquals(InternalUtils.size(array), 3);
+    }
+
+    @Test(dataProvider = "memberPrefixData")
+    public void strip_member_prefix(String input, String expected)
+    {
+        assertEquals(InternalUtils.stripMemberPrefix(input), expected);
+    }
+
+    @DataProvider(name = "memberPrefixData")
+    public Object[][] memberPrefixData()
+    {
+        return new Object[][]
+        {
+        { "simple", "simple" },
+        { "_name", "name" },
+        { "$name", "name" },
+        { "$_$__$__$_$___$_$_$_$$name$", "name$" } };
+    }
+
+    @Test
+    public void enumeration_to_list()
+    {
+        List<String> input = Arrays.asList("wilma", "fred", "barney");
+        Enumeration e = Collections.enumeration(input);
+
+        List<String> output = toList(e);
+
+        assertEquals(output, Arrays.asList("barney", "fred", "wilma"));
+    }
+
+    @Test
+    public void join_empty_list()
+    {
+        List<String> empty = CollectionFactory.newList();
+
+        assertEquals(InternalUtils.join(empty), "");
+    }
+
+    @Test
+    public void join_single()
+    {
+        List<String> single = Arrays.asList("barney");
+
+        assertEquals(InternalUtils.join(single), "barney");
+    }
+
+    @Test
+    public void join_multiple()
+    {
+        List<String> many = Arrays.asList("fred", "barney", "wilma");
+        assertEquals(InternalUtils.join(many), "fred, barney, wilma");
+    }
+
+    @Test
+    public void join_sorted()
+    {
+        List<String> unsorted = Arrays.asList("betty", "fred", "barney", 
"wilma");
+        List<String> copy = CollectionFactory.newList(unsorted);
+
+        assertEquals(InternalUtils.joinSorted(copy), "barney, betty, fred, 
wilma");
+
+        // Make sure that joinSorted() doesn't change the input list
+
+        assertEquals(copy, unsorted);
+    }
+
+    @Test(dataProvider = "capitalize_inputs")
+    public void capitalize(String input, String expected)
+    {
+        assertEquals(InternalUtils.capitalize(input), expected);
+    }
+
+    @DataProvider(name = "capitalize_inputs")
+    public Object[][] capitalize_inputs()
+    {
+        return new Object[][]
+        {
+        { "hello", "Hello" },
+        { "Goodbye", "Goodbye" },
+        { "", "" },
+        { "a", "A" },
+        { "A", "A" } };
+    }
+
+    @Test
+    public void location_of_not_found()
+    {
+        assertNull(InternalUtils.locationOf(null));
+        assertNull(InternalUtils.locationOf("La! La!"));
+    }
+
+    @Test
+    public void location_of_location()
+    {
+        Location l = newLocation();
+
+        replay();
+
+        assertSame(l, InternalUtils.locationOf(l));
+
+        verify();
+    }
+
+    @Test
+    public void location_of_locatable()
+    {
+        Location l = newLocation();
+        Locatable locatable = newMock(Locatable.class);
+
+        locatable.getLocation();
+        setReturnValue(l);
+
+        replay();
+
+        assertSame(l, InternalUtils.locationOf(locatable));
+
+        verify();
+    }
+
+    @Test
+    public void sorted_keys_from_null_map()
+    {
+        List<String> list = InternalUtils.sortedKeys(null);
+
+        assertTrue(list.isEmpty());
+    }
+
+    @Test
+    public void sorted_keys_from_map()
+    {
+        Map<String, String> map = newMap();
+
+        map.put("fred", "flintstone");
+        map.put("barney", "rubble");
+
+        assertEquals(InternalUtils.sortedKeys(map), Arrays.asList("barney", 
"fred"));
+    }
+
+    @Test
+    public void get_from_null_map()
+    {
+        assertNull(InternalUtils.get(null, null));
+    }
+
+    @Test
+    public void get_from_map()
+    {
+        Map<String, String> map = newMap();
+
+        map.put("fred", "flintstone");
+
+        assertEquals("flintstone", InternalUtils.get(map, "fred"));
+    }
+
+    @Test
+    public void reverse_iterator()
+    {
+        List<String> list = Arrays.asList("a", "b", "c");
+
+        Iterator<String> i = InternalUtils.reverseIterator(list);
+
+        assertTrue(i.hasNext());
+        assertEquals(i.next(), "c");
+
+        assertTrue(i.hasNext());
+        assertEquals(i.next(), "b");
+
+        assertTrue(i.hasNext());
+        assertEquals(i.next(), "a");
+
+        assertFalse(i.hasNext());
+    }
+
+    @Test
+    public void reverse_iterator_does_not_support_remove()
+    {
+        List<String> list = Arrays.asList("a", "b", "c");
+
+        Iterator<String> i = InternalUtils.reverseIterator(list);
+
+        try
+        {
+            i.remove();
+            unreachable();
+        }
+        catch (UnsupportedOperationException ex)
+        {
+
+        }
+    }
+
+    @Test(dataProvider = "to_user_presentable")
+    public void to_user_presentable(String input, String expected)
+    {
+        assertEquals(InternalUtils.toUserPresentable(input), expected);
+    }
+
+    @DataProvider(name = "to_user_presentable")
+    public Object[][] to_user_presentable_data()
+    {
+        return new Object[][]
+        {
+        { "hello", "Hello" },
+        { "userId", "User Id" },
+        { "useHTML", "Use HTML" }, };
+    }
+}

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Countdown.html
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Countdown.html?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Countdown.html
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Countdown.html
 Fri Nov 17 15:42:14 2006
@@ -6,6 +6,6 @@
     </p>
     
     <p>
-        Brought to you by the ${component} component.
+        Brought to you by the ${component:count} component.
     </p>
 </t:comp>

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/SimpleForm.html
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/SimpleForm.html?view=diff&rev=476369&r1=476368&r2=476369
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/SimpleForm.html
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/SimpleForm.html
 Fri Nov 17 15:42:14 2006
@@ -4,39 +4,29 @@
     <p> This is the <em>very early</em> start to Tapestry 5 form support. </p>
 
     <t:comp type="Form">
+        <t:comp type="Label"  field="component:email">This isn't 
used</t:comp>: <t:comp
+            type="TextField" id="email" value="incident.email" size="50"/>
+        <br/>
+        <t:comp type="Label"  field="component:message"/>: <t:comp 
type="TextArea" id="message" label="literal:Incident Message"
+            value="incident.message" cols="50" rows="10"> You can put text 
here, but it isn't used. </t:comp>
+        <br/>
+        <t:comp type="Checkbox" id="urgent" value="incident.urgent"/>
+        <t:comp type="Label" field="component:urgent"/>
+        <br/>
+        <input type="submit"/>
+    </t:comp>
+
+
+    <hr/>
+
+    <p> Entered data: </p>
 
-        Email: <t:comp type="TextField" id="email" value="incident.email" 
size="50"/>
-
-<br/>
-
-Message: <t:comp type="TextArea" id="message" value="incident.message" 
cols="50" rows="10">
-    You can put text here, but it isn't used.
-    </t:comp>
-
-
-<br/>
-
-Urgent?: <t:comp type="Checkbox" id="urgent" value="incident.urgent"/>
-
-        <br/>
-        
-        <input type="submit"/>
-        
-    </t:comp>
-    
-    
-    <hr/>
-    
-    <p>
-        Entered data:
-    </p>
-    
     <ul>
-        <li>email: [${incident.email}]</li>
-        <li>message: [${incident.message}]</li>
+        <li>email: [${incident.email}]</li>
+        <li>message: [${incident.message}]</li>
         <li>urgent: [${incident.urgent}]</li>
-    </ul>
-
-    
+    </ul>
+
+
 
 </t:comp>


Reply via email to