1. opensymphony
  2. webwork

Commits

plightbo  committed a7438cf

* removed m_ from class files
* changed project files to use the correct formatting conventions
* fixed a small client-side validation bug

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@496573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits c20cf1a
  • Branches master

Comments (0)

Files changed (6)

File WebWork.ipr

View file
     </buildFile>
   </component>
   <component name="CodeStyleSettingsManager">
-    <option name="PER_PROJECT_SETTINGS" />
-    <option name="USE_PER_PROJECT_SETTINGS" value="false" />
+    <option name="PER_PROJECT_SETTINGS">
+      <value />
+    </option>
+    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
   </component>
   <component name="CompilerConfiguration">
     <option name="DEFAULT_COMPILER" value="Javac" />

File src/java/com/opensymphony/webwork/validators/JavaScriptDateRangeFieldValidator.java

View file
     //~ Methods ////////////////////////////////////////////////////////////////
 
     public String validationScript(Map parameters) {
-        return "";
+        return "alert('foo')";
     }
 }

File src/java/com/opensymphony/webwork/validators/JavaScriptVisitorFieldValidator.java

View file
 
 /**
  * This validator adds client-side validation to make sure a required field has been filled in.
- * <p>
+ * <p/>
  * <i>Implementation note:</i> this class is marked final because WebWork handles visitor field
  * validation as a special case to cache validator lookups.
  */
 public final class JavaScriptVisitorFieldValidator extends VisitorFieldValidator implements ScriptValidationAware {
     //~ Instance fields ////////////////////////////////////////////////////////
 
-    private Class m_validatedClass;
+    private Class validatedClass;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
     public void setClassName(String className) {
         try {
-            m_validatedClass = Class.forName(className);
+            validatedClass = Class.forName(className);
         } catch (ClassNotFoundException ex) {
             log.error("Cannot find class '" + className + "'", ex);
         }
     }
 
     public void setValidatedClass(Class validatedClass) {
-        m_validatedClass = validatedClass;
+        this.validatedClass = validatedClass;
     }
 
     public Class getValidatedClass() {
-        return m_validatedClass;
+        return validatedClass;
     }
 
     public String validationScript(Map parameters) {

File src/java/com/opensymphony/webwork/views/jsp/ui/AbstractUITag.java

View file
 import com.opensymphony.webwork.validators.ScriptValidationAware;
 import com.opensymphony.webwork.views.jsp.ParameterizedTagSupport;
 import com.opensymphony.webwork.views.velocity.VelocityManager;
-
 import com.opensymphony.xwork.ModelDriven;
 import com.opensymphony.xwork.util.OgnlValueStack;
-import com.opensymphony.xwork.validator.ActionValidatorManager;
-import com.opensymphony.xwork.validator.DelegatingValidatorContext;
-import com.opensymphony.xwork.validator.FieldValidator;
-import com.opensymphony.xwork.validator.Validator;
-import com.opensymphony.xwork.validator.ValidatorContext;
-
+import com.opensymphony.xwork.validator.*;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.velocity.Template;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspException;
 import java.io.Writer;
-
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspException;
-
 
 /**
  * Abstract base class for all UI tags.
     }
 
     /**
-    * A contract that requires each concrete UI Tag to specify which template should be used as a default.  For
-    * example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm".  This value
-    * <strong>not</strong> begin with a '/' unless you intend to make the path absolute rather than relative to the
-    * current theme.
-    *
-    * @return The name of the template to be used as the default.
-    */
+     * A contract that requires each concrete UI Tag to specify which template should be used as a default.  For
+     * example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm".  This value
+     * <strong>not</strong> begin with a '/' unless you intend to make the path absolute rather than relative to the
+     * current theme.
+     *
+     * @return The name of the template to be used as the default.
+     */
     protected abstract String getDefaultTemplate();
 
     /**
-    * Find the name of the Velocity template that we should use.
-    *
-    * @return The name of the Velocity template that we should use. This value should begin with a '/'
-    */
+     * Find the name of the Velocity template that we should use.
+     *
+     * @return The name of the Velocity template that we should use. This value should begin with a '/'
+     */
     protected String getTemplateName() {
         return buildTemplateName(templateAttr, getDefaultTemplate());
     }
     }
 
     /**
-    * @param myTemplate
-    * @param myDefaultTemplate
-    */
+     * @param myTemplate
+     * @param myDefaultTemplate
+     */
     protected String buildTemplateName(String myTemplate, String myDefaultTemplate) {
         String template = myDefaultTemplate;
 
             // register ScriptValiationAware validators for this UI tag with the form
             Boolean validate = (Boolean) formTag.getParameters().get("validate");
 
-            if ((validate != null) && validate.booleanValue() && (formTag.getActionClass() != null) && (formTag.getActionName() != null)) {
+            if ((validate != null) && validate.booleanValue() && (formTag.getActionClass() != null) && (formTag.getActionName() != null) && name != null) {
                 findScriptingValidators(formTag, (String) name, formTag.getActionClass(), null);
             }
         }
     /**
      * Finds all ScriptValidationAware validators that apply to the field covered by this tag.
      *
-     * @param formTag the parent form tag this tag is in
-     * @param fieldName the name of the field to validate (used for error message key)
-     * @param fieldClass the Class of the object the field is for
+     * @param formTag      the parent form tag this tag is in
+     * @param fieldName    the name of the field to validate (used for error message key)
+     * @param fieldClass   the Class of the object the field is for
      * @param propertyName the actual property name to get validator for; if null, fieldName is used
      */
     private void findScriptingValidators(FormTag formTag, String fieldName, Class fieldClass, String propertyName) {

File src/test/com/opensymphony/webwork/TestAction.java

View file
 package com.opensymphony.webwork;
 
 import com.opensymphony.webwork.views.jsp.ui.User;
-
 import com.opensymphony.xwork.Action;
 import com.opensymphony.xwork.ActionSupport;
 
     private Map map;
     private String foo;
     private String result;
-    private User m_user;
+    private User user;
     private String[] array;
     private String[][] list;
 
     }
 
     public void setUser(User user) {
-        m_user = user;
+        this.user = user;
     }
 
     public User getUser() {
-        return m_user;
+        return user;
     }
 
     public String execute() throws Exception {

File src/test/com/opensymphony/webwork/views/jsp/ui/User.java

View file
 public class User {
     //~ Instance fields ////////////////////////////////////////////////////////
 
-    private String m_name;
+    private String name;
 
     //~ Constructors ///////////////////////////////////////////////////////////
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
     public void setName(String name) {
-        m_name = name;
+        this.name = name;
     }
 
     public String getName() {
-        return m_name;
+        return name;
     }
 }