From: <fg...@us...> - 2007-02-05 21:48:04
|
Revision: 216 http://svn.sourceforge.net/openutils/?rev=216&view=rev Author: fgiust Date: 2007-02-05 13:47:59 -0800 (Mon, 05 Feb 2007) Log Message: ----------- [maven-scm] copy for tag openutils-spring-1.0.1 Added Paths: ----------- tags/openutils-spring-1.0.1/ tags/openutils-spring-1.0.1/pom.xml tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java Removed Paths: ------------- tags/openutils-spring-1.0.1/pom.xml tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java Copied: tags/openutils-spring-1.0.1 (from rev 208, trunk/openutils-spring) Deleted: tags/openutils-spring-1.0.1/pom.xml =================================================================== --- trunk/openutils-spring/pom.xml 2007-02-05 21:37:30 UTC (rev 208) +++ tags/openutils-spring-1.0.1/pom.xml 2007-02-05 21:47:59 UTC (rev 216) @@ -1,87 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils</artifactId> - <version>3</version> - <relativePath>..</relativePath> - </parent> - <artifactId>openutils-spring</artifactId> - <name>openutils spring tools</name> - <version>1.1-SNAPSHOT</version> - <description /> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>2.0.1</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>jstl:jar</artifactId> - </exclusion> - <exclusion> - <groupId>taglibs</groupId> - <artifactId>standard</artifactId> - </exclusion> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - <exclusion> - <groupId>logkit</groupId> - <artifactId>logkit</artifactId> - </exclusion> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - <exclusion> - <groupId>struts</groupId> - <artifactId>struts</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.2</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.0.1</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>3.2.1.ga</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-spring-1.0.1/pom.xml (from rev 215, trunk/openutils-spring/pom.xml) =================================================================== --- tags/openutils-spring-1.0.1/pom.xml (rev 0) +++ tags/openutils-spring-1.0.1/pom.xml 2007-02-05 21:47:59 UTC (rev 216) @@ -0,0 +1,92 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils</artifactId> + <version>3</version> + <relativePath>..</relativePath> + </parent> + <artifactId>openutils-spring</artifactId> + <name>openutils spring tools</name> + <version>1.0.1</version> + <description /> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>2.0.1</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>jstl:jar</artifactId> + </exclusion> + <exclusion> + <groupId>taglibs</groupId> + <artifactId>standard</artifactId> + </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + <exclusion> + <groupId>struts</groupId> + <artifactId>struts</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.2</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.7.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.2.1.ga</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-spring-1.0.1</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-spring-1.0.1</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-spring-1.0.1</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java =================================================================== --- trunk/openutils-spring/src/main/java/it/openutils/web/spring/BaseFormController.java 2007-02-05 21:37:30 UTC (rev 208) +++ tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java 2007-02-05 21:47:59 UTC (rev 216) @@ -1,118 +0,0 @@ -package it.openutils.web.spring; - -import it.openutils.web.util.MessageUtils; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.ClassUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.propertyeditors.CustomDateEditor; -import org.springframework.beans.propertyeditors.CustomNumberEditor; -import org.springframework.beans.propertyeditors.StringTrimmerEditor; -import org.springframework.web.bind.ServletRequestDataBinder; -import org.springframework.web.servlet.mvc.SimpleFormController; - - -/** - * @author fgiust - * @version $Revision$ ($Author$) - */ -public class BaseFormController extends SimpleFormController -{ - - /** - * Logger. - */ - protected Log log = LogFactory.getLog(getClass()); - - /** - * {@inheritDoc} - */ - @Override - protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) - { - // convert java.util.Date - SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); - dateFormat.setLenient(false); - binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, true)); - - // convert Integers and Longs - binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, true)); - binder.registerCustomEditor(Double.class, null, new EasyDoubleCustomEditor(Double.class, true)); - binder.registerCustomEditor(Integer.class, null, new CustomNumberEditor(Integer.class, true)); - binder.registerCustomEditor(Short.class, null, new CustomNumberEditor(Short.class, true)); - - // trim empty strings - binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); - - } - - // /** - // * Convenience method for getting a i18n key's value. Calling getMessageSourceAccessor() is used because the - // * RequestContext variable is not set in unit tests b/c there's no DispatchServlet Request. - // * @param msgKey - // * @return String - // */ - // public String getText(String msgKey) - // { - // String currentLocale = ThreadLocaleHolder.getLocale(); - // if (currentLocale != null) - // { - // return getMessageSourceAccessor().getMessage(msgKey, new Locale(currentLocale)); - // } - // - // return getMessageSourceAccessor().getMessage(msgKey); - // } - - /** - * Convenient method for getting a i18n key's value with a single string argument. - * @param msgKey - * @param arg - * @return String - */ - public String getText(String msgKey, Object arg) - { - return getText(msgKey, new Object[]{arg}); - } - - // /** - // * Convenience method for getting a i18n key's value with arguments. - // * @param msgKey - // * @param args - // * @return String - // */ - // public String getText(String msgKey, Object[] args) - // { - // String currentLocale = ThreadLocaleHolder.getLocale(); - // if (currentLocale != null) - // { - // return getMessageSourceAccessor().getMessage(msgKey, args, new Locale(currentLocale)); - // } - // - // return getMessageSourceAccessor().getMessage(msgKey, args); - // } - - public void saveMessage(HttpServletRequest request, String message) - { - MessageUtils.saveMessage(request, message); - } - - public void saveError(HttpServletRequest request, String message) - { - MessageUtils.saveError(request, message); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() - { - return ClassUtils.getShortClassName(getClass()); - } - -} \ No newline at end of file Copied: tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java (from rev 214, trunk/openutils-spring/src/main/java/it/openutils/web/spring/BaseFormController.java) =================================================================== --- tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java (rev 0) +++ tags/openutils-spring-1.0.1/src/main/java/it/openutils/web/spring/BaseFormController.java 2007-02-05 21:47:59 UTC (rev 216) @@ -0,0 +1,84 @@ +package it.openutils.web.spring; + +import it.openutils.web.util.MessageUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang.ClassUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.beans.propertyeditors.CustomNumberEditor; +import org.springframework.beans.propertyeditors.StringTrimmerEditor; +import org.springframework.web.bind.ServletRequestDataBinder; +import org.springframework.web.servlet.mvc.SimpleFormController; + + +/** + * @author fgiust + * @version $Revision$ ($Author$) + */ +public class BaseFormController extends SimpleFormController +{ + + /** + * Logger. + */ + protected Log log = LogFactory.getLog(getClass()); + + /** + * {@inheritDoc} + */ + @Override + protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) + { + // convert java.util.Date + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + dateFormat.setLenient(false); + binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, true, 10)); + + // convert Integers and Longs + binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, true)); + binder.registerCustomEditor(Double.class, null, new EasyDoubleCustomEditor(Double.class, true)); + binder.registerCustomEditor(Integer.class, null, new CustomNumberEditor(Integer.class, true)); + binder.registerCustomEditor(Short.class, null, new CustomNumberEditor(Short.class, true)); + + // trim empty strings + binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); + + } + + /** + * Convenient method for getting a i18n key's value with a single string argument. + * @param msgKey + * @param arg + * @return String + */ + public String getText(String msgKey, Object arg) + { + return getText(msgKey, new Object[]{arg }); + } + + public void saveMessage(HttpServletRequest request, String message) + { + MessageUtils.saveMessage(request, message); + } + + public void saveError(HttpServletRequest request, String message) + { + MessageUtils.saveError(request, message); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + return ClassUtils.getShortClassName(getClass()); + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |