I'd prefer calling the constructor instead of static methods. It makes
it clear that you are creating a new instance, and how you could
extend the class if you needed to.

Oh, and 'for' is a reserved keyword :)

Tetsuo



On Wed, Jun 8, 2011 at 9:02 AM, Martijn Dashorst
<[email protected]> wrote:
> On Wed, Jun 8, 2011 at 1:02 PM, James Carman
> <[email protected]> wrote:
>> What about the separator?
>
> I'm thinking of ditching the separator as a constructor parameter, and
> defaulting to ' ' (space). Is there anyone who uses any other value
> for the separator? The attribute modifier will have a setter for the
> separator, so that you can do AttrbuteModifier.append("onclick",
> "return false;").setSeparator(";");
>
> As for the fluent api... we can add that as a bonus. I'd like to keep
> the shorthand for  AttributeModifier.append/prepend/overwrite
>
> Might I suggest the following fluent api:
>
> AttributeModifier.for("class").overwrites().value("error");
> AttributeModifier.for("class").appends().value(Model.of("error"));
> AttributeModifier.for("onclick").prepends().value("if(!confirm('Sure?'))
> return false;');
>
> Or perhaps:
>
> AttributeModifier.for("class").puts("error");
> AttributeModifier.for("class").appends(Model.of("error"));
> AttributeModifier.for("onclick").prepends("if(!confirm('Sure?'))
> return false;');
>
> Martijn
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>

Reply via email to