You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Jason Johnston (JIRA)" <ji...@apache.org> on 2006/07/09 19:04:31 UTC

[jira] Created: (COCOON-1879) Make fd:field whitespace trimming behavior configurable

Make fd:field whitespace trimming behavior configurable
-------------------------------------------------------

         Key: COCOON-1879
         URL: http://issues.apache.org/jira/browse/COCOON-1879
     Project: Cocoon
        Type: Improvement

  Components: Blocks: Forms  
    Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)    
    Reporter: Jason Johnston


Currently fd:field widgets always trim leading and trailing whitespace from the user's input. Sometimes this behavior is not desired, so it should be configurable.

See this thread for discussion: http://marc.theaimsgroup.com/?t=114960231400008&r=1&w=2

Patch forthcoming.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (COCOON-1879) Make fd:field whitespace trimming behavior configurable

Posted by "Simone Gianni (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1879?page=comments#action_12420150 ] 

Simone Gianni commented on COCOON-1879:
---------------------------------------

If you're going to use a typesafe enumeration, then consider using org.apache.commons.lang.enums.Enum, not to reinvent the wheel and also because could save you some work. See http://jakarta.apache.org/commons/lang/

> Make fd:field whitespace trimming behavior configurable
> -------------------------------------------------------
>
>          Key: COCOON-1879
>          URL: http://issues.apache.org/jira/browse/COCOON-1879
>      Project: Cocoon
>         Type: Improvement

>   Components: Blocks: Forms
>     Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)
>     Reporter: Jason Johnston
>  Attachments: COCOON-1879.diff
>
> Currently fd:field widgets always trim leading and trailing whitespace from the user's input. Sometimes this behavior is not desired, so it should be configurable.
> See this thread for discussion: http://marc.theaimsgroup.com/?t=114960231400008&r=1&w=2
> Patch forthcoming.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (COCOON-1879) Make fd:field whitespace trimming behavior configurable

Posted by "Bruno Dumon (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1879?page=comments#action_12420112 ] 

Bruno Dumon commented on COCOON-1879:
-------------------------------------

Looks good.

I'd validate the value of the whitespace attribute so that it gives an error when using an unsupported value (to protect against typos).

I'd also avoid doing string comparisons to check the type of whitespace trimming (e..g trimming.equals("preserve")), since these are relatively expensive (though for these short strings, it won't matter much).

Something that solves both problems, is the use of an enumeration class, following the type-safe enumeration pattern, as described at e.g.
http://java.sun.com/developer/Books/shiftintojava/page1.html

Thus a class like:

public class Whitespace {
    public static final Whitespace PRESERVE = new Whitespace("preserve");
    public static final Whitespace TRIM_START = new Whitespace("trim-start");

    private final String name;

    private Whitespace(String name) {
        this.name = name;
    }

    public String toString() {
        return name;
    }
}

and as described in the linked article, one can then simply use e.g. "trimming == Whitespace.PRESERVE" to test the sort of trimming.

With this change, this patch will be ready to commit, so if you have SVN access already, you can do that yourself.

Don't forget to mention the change in status.xml, and update the docs in Daisy:
http://cocoon.zones.apache.org/daisy/documentation/864/forms/widgets/481.html

> Make fd:field whitespace trimming behavior configurable
> -------------------------------------------------------
>
>          Key: COCOON-1879
>          URL: http://issues.apache.org/jira/browse/COCOON-1879
>      Project: Cocoon
>         Type: Improvement

>   Components: Blocks: Forms
>     Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)
>     Reporter: Jason Johnston
>  Attachments: COCOON-1879.diff
>
> Currently fd:field widgets always trim leading and trailing whitespace from the user's input. Sometimes this behavior is not desired, so it should be configurable.
> See this thread for discussion: http://marc.theaimsgroup.com/?t=114960231400008&r=1&w=2
> Patch forthcoming.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (COCOON-1879) Make fd:field whitespace trimming behavior configurable

Posted by "Jason Johnston (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1879?page=comments#action_12449230 ] 
            
Jason Johnston commented on COCOON-1879:
----------------------------------------

I incorporated the suggestions from Bruno and Simone (thanks!) and committed at revision 474132. The fd:field documentation page has been updated in Daisy.

> Make fd:field whitespace trimming behavior configurable
> -------------------------------------------------------
>
>                 Key: COCOON-1879
>                 URL: http://issues.apache.org/jira/browse/COCOON-1879
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Forms
>    Affects Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)
>            Reporter: Jason Johnston
>         Attachments: COCOON-1879.diff
>
>
> Currently fd:field widgets always trim leading and trailing whitespace from the user's input. Sometimes this behavior is not desired, so it should be configurable.
> See this thread for discussion: http://marc.theaimsgroup.com/?t=114960231400008&r=1&w=2
> Patch forthcoming.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (COCOON-1879) Make fd:field whitespace trimming behavior configurable

Posted by "Jason Johnston (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COCOON-1879?page=all ]

Jason Johnston closed COCOON-1879.
----------------------------------

    Resolution: Fixed

> Make fd:field whitespace trimming behavior configurable
> -------------------------------------------------------
>
>                 Key: COCOON-1879
>                 URL: http://issues.apache.org/jira/browse/COCOON-1879
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Forms
>    Affects Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)
>            Reporter: Jason Johnston
>         Attachments: COCOON-1879.diff
>
>
> Currently fd:field widgets always trim leading and trailing whitespace from the user's input. Sometimes this behavior is not desired, so it should be configurable.
> See this thread for discussion: http://marc.theaimsgroup.com/?t=114960231400008&r=1&w=2
> Patch forthcoming.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (COCOON-1879) Make fd:field whitespace trimming behavior configurable

Posted by "Jason Johnston (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COCOON-1879?page=all ]

Jason Johnston updated COCOON-1879:
-----------------------------------

    Attachment: COCOON-1879.diff

Attached patch implements a new optional 'whitespace' attribute for fd:field.  Possible values are:

whitespace="preserve" : leading and trailing whitespace is preserved
whitespace="trim-start" : only leading whitespace is trimmed
whitespace="trim-end" : only trailing whitespace is trimmed
whitespace="trim" : (default) both leading and trailing whitespace is trimmed, like old behavior.

Input welcome.

> Make fd:field whitespace trimming behavior configurable
> -------------------------------------------------------
>
>          Key: COCOON-1879
>          URL: http://issues.apache.org/jira/browse/COCOON-1879
>      Project: Cocoon
>         Type: Improvement

>   Components: Blocks: Forms
>     Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)
>     Reporter: Jason Johnston
>  Attachments: COCOON-1879.diff
>
> Currently fd:field widgets always trim leading and trailing whitespace from the user's input. Sometimes this behavior is not desired, so it should be configurable.
> See this thread for discussion: http://marc.theaimsgroup.com/?t=114960231400008&r=1&w=2
> Patch forthcoming.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira