Cool. I tried to use date-picker with a LocalDate (from Joda Time) but got a class-cast exception. It was unaware that I had contributed TypeCoercers between LocalDate and Date ( http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/typecoercers ).
It's an easy fix that will allow the date picker to work with any class that is coerced to, and from, Date. Add this: @Inject private TypeCoercer coercer; and replace this: Date date = (Date) value; with this: Date date = coercer.coerce(value, Date.class); Cheers, Geoff On 24/11/2013, at 1:32 AM, Barry Books wrote: > Thanks, > > I added this to the code > > > On Wed, Nov 20, 2013 at 2:13 AM, Geoff Callender < > geoff.callender.jumpst...@gmail.com> wrote: > >> Very nice. But doesn't handle disabled. It's an easy fix: >> >> Instead of this: >> >> @InjectContainer >> >> private ClientElement clientElement; >> >> do this: >> >> @InjectContainer >> >> private TextField clientElement; >> >> and replace this: >> >> element.elementBefore("input", "value", formatedDate, "type", "hidden", >> "class", "form-control", "id", clientID); >> >> with this: >> >> Element dateField = element.elementBefore("input", "value", formatedDate, >> "type", "hidden", "class", >> >> "form-control", "id", clientID); >> >> >> if (clientElement.isDisabled()) { >> >> dateField.attribute("disabled", "disabled"); >> >> } >> >> Cheers, >> >> Geoff >> >> >> On 9 October 2013 22:02, Barry Books <trs...@gmail.com> wrote: >> >>> I pushed a new snapshot. What documentation there is here >>> >>> https://github.com/trsvax/tapestry-datepicker >>> >>> This version allows overriding the location of the javascript and css for >>> the jquery date picker. >>> >>> The basic features are >>> >>> 1. Translators for textfield to validate date/calendar/timestamp entry >>> 2. A mixin that adds jQuery Calendar support to the textfield >>> 3. Native type="date" support (at least on the iPhone) >>> 4. BeanEdit support >>> 5. Ability to override css/javascript included by the jQuery mixin >>> >>> I think this makes it feature complete but at this point things are still >>> subject to change. I'm going to create some better docs and tests then >> I'll >>> push a version to maven central >>> >>> Thanks for the input so far >>> >>> >>> >>> On Tue, Oct 8, 2013 at 7:54 PM, Barry Books <trs...@gmail.com> wrote: >>> >>>> it's in the current one. I'll also be pushing up some fixes in the >>> morning. >>>> >>>> >>>> On Tue, Oct 8, 2013 at 5:53 PM, Lenny Primak <lpri...@hope.nyc.ny.us >>>> wrote: >>>> >>>>> Let us know when the beaneditor support is there. I'll try it then >> and >>>>> give feedback >>>>> Thank you! >>>>> >>>>> On Oct 8, 2013, at 6:39 AM, Barry Books wrote: >>>>> >>>>>> https://oss.sonatype.org/content/repositories/snapshots/ >>>>>> >>>>>> >>>>>> >>>>>> <groupId>com.trsvax</groupId> >>>>>> >>>>>> <artifactId>tapestry-datepicker</artifactId> >>>>>> >>>>>> <version>0.0.1-SNAPSHOT</version> >>>>>> >>>>>> >>>>>> It's still a work in progress but I think it's starting to come >>>>> together. >>>>>> Being able to pass attributes from the translator into the html >> stream >>>>> is >>>>>> proving useful. For example you can do things such as >>>>>> >>>>>> placeholder="mm-dd-yyyy" >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Oct 8, 2013 at 4:33 AM, Geoff Callender < >>>>>> geoff.callender.jumpst...@gmail.com> wrote: >>>>>> >>>>>>> What's the artifact info? >>>>>>> >>>>>>> On 07/10/2013, at 10:26 PM, Barry Books wrote: >>>>>>> >>>>>>>> Snapshot 0.0.1-SNAPSHOT is available at >>>>>>>> >>>>>>>> >>>>>>>> https://oss.sonatype.org/content/repositories/snapshots/ >>>>>>>> >>>>>>>> I have a bit of cleanup and then I'll push a version to maven >>> central >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Fri, Oct 4, 2013 at 3:33 PM, Barry Books <trs...@gmail.com> >>> wrote: >>>>>>>> >>>>>>>>> After much googling I think I've added iPhone type="date" >> support. >>> I >>>>> had >>>>>>>>> to make a few assumptions to get it to work. >>>>>>>>> >>>>>>>>> 1. The format for type="date" support is yyyy-mm-dd. This is what >>> the >>>>>>>>> iPhone appears to use and seems a reasonable choice. >>>>>>>>> 2. The best test I could find to indicate native support is >>>>>>>>> >>>>>>>>> *var* input = document.createElement('input'); >>>>>>>>> >>>>>>>>> input.setAttribute('type', 'date'); >>>>>>>>> >>>>>>>>> input.value = 'testing'; >>>>>>>>> >>>>>>>>> >>>>>>>>> If the type is date and the value is not testing I'm assuming >>> native >>>>>>> date >>>>>>>>> support. >>>>>>>>> >>>>>>>>> >>>>>>>>> What I ended up doing was adding a hidden element to support >> native >>>>> date >>>>>>>>> pickers. If I think there is support I hide the real one and turn >>> the >>>>>>>>> hidden one into a date. On a form submit I copy the data into the >>>>> real >>>>>>>>> element. This way I can support both date formats. It seems to >> work >>>>> on >>>>>>> my >>>>>>>>> iPhone but that's not a large sample. >>>>>>>>> >>>>>>>>> >>>>>>>>> There is still work to be done but I think I should be able to >> meet >>>>> all >>>>>>>>> the requirements I've seen so far. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Oct 3, 2013 at 9:15 PM, Barry Books <trs...@gmail.com> >>>>> wrote: >>>>>>>>> >>>>>>>>>> Unfortunately modernizer does not really support that. From the >>> docs >>>>>>>>>> >>>>>>>>>> Modernizr cannot detect that date inputs create a datepicker, >>>>>>>>>> >>>>>>>>>> It is possible to detect if a browser support type="date" but >> that >>>>> does >>>>>>>>>> not mean it has a datepicker. I suspect I'm going to add an >> option >>>>> to >>>>>>> give >>>>>>>>>> it a try. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Thu, Oct 3, 2013 at 8:12 PM, Geoff Callender < >>>>>>>>>> geoff.callender.jumpst...@gmail.com> wrote: >>>>>>>>>> >>>>>>>>>>> Sounds good, Barry. >>>>>>>>>>> >>>>>>>>>>> You mentioned earlier that you were "planing on using modernizr >>> to >>>>>>> detect >>>>>>>>>>> if type="date" is supported. " so that browsers with good HTML5 >>>>> date >>>>>>>>>>> support (eg. iOS Safari, Chrome) are left alone. How did that >> go? >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On 3 October 2013 12:08, Barry Books <trs...@gmail.com> 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 >>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>>> >>>>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>> >>>>> >>>> >>> >>