I changed the translators so multiple attributes can be passed to the
client. The constructor is now

*public* DateTranslator(String name, String format, String messageKey,
String... attributes) {


and the render does


*public* *void* render(Field field, String message, MarkupWriter writer,
FormSupport formSupport) {

    writer.attributes(attributes);

}


So when you declare a translator


configuration.add(Date.*class*, *new* DateTranslator("DateSlow","MM-dd-yyyy"
,"date","data-date-format","mm/dd/yy","data-duration","slow"));


you can default arguments passed back to the javascript on the client



On Thu, Oct 3, 2013 at 3:49 PM, Barry Books <trs...@gmail.com> wrote:

> It will work fine
>
>
> On Thursday, October 3, 2013, Lenny Primak wrote:
>
>> My primary use case would be beaneditor. I don't think translator will
>> work In this case. Correct me if I'm wrong.
>>
>>
>>
>> > On Oct 3, 2013, at 12:33 PM, Barry Books <trs...@gmail.com> wrote:
>> >
>> > You can configure it with data- attributes. If you want defaults you
>> could
>> > do this in the translator.  Currently the JavaScript includes are hard
>> > coded but I'm thinking about using a configuration to support different
>> > JavaScript components. It seems like that would solve your problem also
>> >
>> >
>> >> On Thursday, October 3, 2013, Lenny Primak wrote:
>> >>
>> >> Very good. Since I didn't look at it yet, I know the datepicker
>> supports
>> >> myriad of options. Is there a way to configure it?  Perhaps a symbol?
>>  Also
>> >> since you are including jquery UI, there should also be configuration
>> to
>> >> override it so i can use the requireJS method to load it from CDN.
>> >>
>> >>>> On Oct 3, 2013, at 3:32 AM, Barry Books <trs...@gmail.com<javascript:;>>
>> >>> wrote:
>> >>>
>> >>> I already have a Sonatype account and I'll probably put this into
>> Maven
>> >>> Central this weekend.  I think I'm going to add one of the Bootstrap
>> >>> javascript implementations and write some test cases before I do that.
>> >>>
>> >>> I'll also offer it up to be included in Tapestry. Since it's not at
>> all
>> >>> compatible with the current component perhaps it could be a module
>> like
>> >>> FileUpload.
>> >>>
>> >>> I will make it work in BeanEditor. I have a 5.3 version that I use
>> >> already
>> >>> and it works in BeanEditor plus I use BeanEditForm almost
>> exclusively. My
>> >>> plan is to support Date/Calendar with a "Date" type format and
>> Timestamp
>> >> as
>> >>> a "DateTime" format if the javascript component supports that.
>> >>>
>> >>>
>> >>>> On Wed, Oct 2, 2013 at 9:53 PM, Lenny Primak <lpri...@hope.nyc.ny.us
>> <javascript:;>>
>> >> wrote:
>> >>>>
>> >>>>
>> >>>> Excellent. Any plans to make beaneditor use this or does this already
>> >> work?
>> >>>>
>> >>>>
>> >>>>> On Oct 2, 2013, at 7:08 PM, Barry Books <trs...@gmail.com
>> <javascript:;>>
>> >> wrote:
>> >>>>>
>> >>>>> I've uploaded the initial version to github
>> >>>>>
>> >>>>> https://github.com/trsvax/tapestry-datepicker
>> >>>>>
>> >>>>> I think I'm going to make this standalone project that only contains
>> >> the
>> >>>>> datepicker. This will make it easier for other project to just
>> include
>> >>>> it.
>> >>>>> Currently to use it you will have to download and build it.  Here
>> is an
>> >>>>> example usage
>> >>>>>
>> >>>>> <t:form>
>> >>>>>  <t:textfield value="date" t:mixins="datefield/JQueryDatePicker"
>> >>>>> data-duration="slow"/>
>> >>>>>  <input type="submit"/>
>> >>>>> </t:form>
>> >>>>>
>> >>>>>
>> >>>>> All that's required is the input type be a date which causes
>> Tapestry
>> >> to
>> >>>>> use a Date Translator to convert the data to/from a string. This
>> also
>> >>>>> creates the client side validation. The mixin adds the client side
>> >>>>> interface. In this case the JQuery UI calendar.
>> >>>>>
>> >>>>> If you prefer you can create your own component and override the
>> >> Tapestry
>> >>>>> one.
>> >>>>>
>> >>>>> public class DateField extends TextField {
>> >>>>>
>> >>>>>  @Mixin
>> >>>>>  private JQueryDatePIcker mixin;
>> >>>>>
>> >>>>> }
>> >>>>>
>> >>>>> Questions, commets etc are welcome
>> >>>>>
>> >>>>> Barry
>> >>>>
>> >>>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> <javascript:;>
>> >>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> <javascript:;>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> <javascript:;>
>> >> For additional commands, e-mail: users-h...@tapestry.apache.org
>> <javascript:;>
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>

Reply via email to