You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Ivo Danihelka <i....@sh.cvut.cz> on 2005/04/24 20:35:21 UTC

more generic AbstractTextField

Hi,

AbstractTextField without concrete HTML would be nice. It should render
specific HTML in a method which subclasses can override. ValidTextArea
would subclass ValidField and only override this method.

The changes would be minimal:
===================================================================
RCS file: /home/cvspublic/jakarta-tapestry/framework/src/java/org/apache/tapestry/form/AbstractTextField.java,v
retrieving revision 1.4
diff -u -p -r1.4 AbstractTextField.java
--- framework/src/java/org/apache/tapestry/form/AbstractTextField.java	8 Mar 2005 15:36:37 -0000	1.4
+++ framework/src/java/org/apache/tapestry/form/AbstractTextField.java	24 Apr 2005 18:20:36 -0000
@@ -66,6 +66,21 @@ public abstract class AbstractTextField 
             return;
         }
 
+        renderField(writer, cycle, name, value);
+    }
+
+    /**
+     * Renders input field.
+     * Allows subclasses to render their own markup.
+     * Method {@link #beforeCloseTag(IMarkupWriter, IRequestCycle)} should
+     * be called before the tag is closed.
+     * @param writer the {@link IMarkupWriter} to send output to
+     * @param cycle the current request cycle
+     * @param name request parameter name
+     * @param value request parameter value
+     */
+    protected void renderField(IMarkupWriter writer, IRequestCycle cycle, String name, String value)
+    {
         writer.beginEmpty("input");
 
         writer.attribute("type", isHidden() ? "password" : "text");

-- 
Ivo Danihelka


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org