myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dennisby...@apache.org
Subject svn commit: r400417 - in /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom: collapsiblemenu/ convertString/ convertString/TrimConverter.java
Date Sun, 07 May 2006 05:00:26 GMT
Author: dennisbyrne
Date: Sat May  6 22:00:24 2006
New Revision: 400417

URL: http://svn.apache.org/viewcvs?rev=400417&view=rev
Log:
This one's for Mike ;)

Added:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertString/
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertString/TrimConverter.java
Removed:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/collapsiblemenu/

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertString/TrimConverter.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertString/TrimConverter.java?rev=400417&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertString/TrimConverter.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/convertString/TrimConverter.java
Sat May  6 22:00:24 2006
@@ -0,0 +1,29 @@
+package org.apache.myfaces.custom.convertString;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * Useful when a char(5) field ends up rendered as "abc  " .
+ * 
+ * @author Dennis Byrne
+ */
+
+public class TrimConverter implements Converter
+{
+    
+    public Object getAsObject(FacesContext context, UIComponent component,
+            String value) throws ConverterException
+    {
+        return value == null ? null : value;
+    }
+
+    public String getAsString(FacesContext context, UIComponent component,
+            Object value) throws ConverterException
+    {
+        return value == null ? "" : value.toString().trim();
+    }
+
+}



Mime
View raw message