cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno Dumon (JIRA)" <>
Subject [jira] Commented: (COCOON-1879) Make fd:field whitespace trimming behavior configurable
Date Mon, 10 Jul 2006 16:53:30 GMT
    [ ] 

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.

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) { = 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:

> Make fd:field whitespace trimming behavior configurable
> -------------------------------------------------------
>          Key: COCOON-1879
>          URL:
>      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:
> Patch forthcoming.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message