1 2 Previous Next 19 Replies Latest reply on Jul 31, 2008 11:51 PM by markrich

    Rich Calendar

    rhythmicdevil

      Hello,
      I am trying to figure out how to use some of the attributes on the Rich Calendar. I need to specify the earliest date that the calendar can display as now plus one day.

      I setup today's date in a bean and provide getters and setters like this:

      SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
      public String currentDate = format.format(new java.util.Date());


      Here is my tag:

      <rich:calendar
      id="startDate"
      value="#{ads.inv.adsInvSearchActionNew.startDate}"
      required="true"
      inputClass="datePicker"
      datePattern="MM/dd/yyyy"
      style="display:block;"
      enableManualInput="false"
      preloadDateRangeBegin="#{searchAction.currentDate}"
      />


      I get the following error:

      Unparseable date: "10-24-2007"; - nested throwable: (java.text.ParseException: Unparseable date: "10-24-2007")


      Has anyone used this before? How do you define the earliest date the calendar can display?

      Thanks in advance.
      Steve

        • 1. Re: Rich Calendar

          try do not convert to the String by yourself. point EL directly to the instance of java.util.Date

          • 2. Re: Rich Calendar
            tjakopec

            It doesn't work for me!

            <r:calendar inputStyle="width: 90px"
            value="#{stopaOlaksica.datumVazenja}" preloadDateRangeBegin="#{binding.todayDate}" preloadDateRangeEnd="#{binding.afterTenDays}" datePattern="dd. MM. yyyy." />
            


            public Date getTodayDate(){
             return new Date();
             }
            
             public Date getAfterTenDays(){
             Calendar c = Calendar.getInstance();
             c.setTime(new Date());
             c.add(Calendar.DAY_OF_YEAR, 10);
             return c.getTime();
             }
            


            Calendar show all dates

            RF version 3.1.2.GA

            • 3. Re: Rich Calendar
              rhythmicdevil

              How do I get the calendar to only show dates from today + 1 day?

              This is in the bean:

              public Date currentDate = new java.util.Date();


              This is the tag:

              <rich:calendar
              id="startDate"
              value="#{ads.inv.adsInvSearchActionNew.startDate}"
              required="true"
              inputClass="datePicker"
              datePattern="MM/dd/yyyy"
              style="display:block;"
              enableManualInput="false"
              preloadDateRangeBegin="#{searchAction.currentDate}"
              />


              The display and selectable dates does not change regardless of the value of preloadDateRangeBegin. Does anyone know why this is? Does this attribute do something other than what it's name suggests?

              Thanks
              Steve

              • 4. Re: Rich Calendar
                rhythmicdevil

                I have changed the way I am doing this.

                Here is my new bean code:

                // Get today's date
                public Calendar currentDate = Calendar.getInstance();

                /**
                * @return the currentDate + 1 day
                */
                public Date getCurrentDate() {
                currentDate.add(Calendar.DAY_OF_MONTH, 1);
                return currentDate.getTime();
                }


                Here is my tag code:

                <rich:calendar
                id="startDate"
                value="#{ads.inv.adsInvSearchActionNew.startDate}"
                required="true"
                inputClass="datePicker"
                datePattern="MM/dd/yyyy"
                style="display:block;"
                enableManualInput="false"
                preloadDateRangeBegin="#{searchAction.currentDate}"
                />


                The result is same as above however. I can still select any date that I want to.

                How do I prevent the user from selecting a date before tomorrow?

                Steve

                • 5. Re: Rich Calendar
                  rhythmicdevil

                  Any takes? Come on it cant be that hard these components are supposed to be really good.

                  • 6. Re: Rich Calendar
                    utdrew

                    Has anyone figured this out? I'm also trying to disable some dates and it doesn't seem to work with either backing bean properties or when I call it directly in some javascript.

                    Drew

                    • 7. Re: Rich Calendar
                      rhythmicdevil

                      Hi Drew,
                      as you can tell no one has replied to my question. So far I have to say that response time for any real problems is rather slow.

                      • 8. Re: Rich Calendar
                        utdrew

                        Hey Steve,

                        I stumbled upon this later on http://www.jboss.com/index.html?module=bb&op=viewtopic&t=119376. Looks like the methods are there but they didn't bother to implement it and who knows when it will happen.

                        Drew

                        • 9. Re: Rich Calendar
                          rhythmicdevil

                          Hi Drew,
                          thanks for the info, I really appreciate it. I dont know about you but I just got into JSF a few months back and so far I am underwhelmed to say the least. I come from a LAMP background where I found everything to be exceptionally stable and predictable where JSF seems to be the opposite.

                          Steve

                          • 10. Re: Rich Calendar
                            utdrew

                            I think JSF has a lot of promise, particularly if you are coming from a Java background. The problem is coding web-apps is so different from coding desktop apps and it seems like the people who created the JSF spec did a sloppy job with maintaining backward compatability with existing JSP functionality and handling errors and that sort of thing. LAMP is definitely a more mature technology but suffers from some other issues like not really being able to support a middle tier and that sort of thing. Have you tried MyFaces, ICEFaces or one of the other JSF frameworks?

                            Drew

                            • 11. Re: Rich Calendar
                              ilya_shaikovsky

                              Disablement already implemented in 3.2.0 branch.
                              Look developers sample which implements calendar dataModel. Also read please guidelines and site articles about data model... And sorry about responce time... but now we are in design new components phase and have no enough time to answer all the questions ;)

                              • 12. Re: Rich Calendar
                                rhythmicdevil

                                I definitely agree with the promise of JSF. That was one of the primary reasons that I took my current position. We are currently using Rich Faces and Seam. We tried Trinidad but did not think it was worth the effort.

                                Here is one of things that confuses me. I would imagine that the people working on Richfaces want developers to use their library. That being the case why does the documentation not provide more useful information? For instance, the Richfaces demo page has great looking demos which include code examples for the tags. However there are no examples of the backing bean code that supports the tags which makes the examples next to useless.

                                If it were me I would provide code examples that someone could literally copy and paste that would work. I think that would help my frustration immensely.

                                • 13. Re: Rich Calendar
                                  ilya_shaikovsky

                                  http://labs.jboss.com/wiki/RichFaces

                                  There are many usefull links. I think you should look at list at links to demo-site sources and all components sample sources ;)

                                  • 14. Re: Rich Calendar
                                    rhythmicdevil

                                    Ilya,
                                    thanks for the link it's much appreciated. I would still really like to see backing bean examples along with the tag examples. I am very curious as to why that was not done.

                                    From my point of view as a UI developer using Richfaces I need to move quickly. I understand how the tags work from your examples but I dont have any idea how to back them. That is where I always run into trouble. If you had examples for both the back and front end I believe that I and others could work much faster. This would lead to Richfaces being more successful. Everyone I speak to about Richfaces and other JSF frameworks have the exact same complaint.

                                    Steve

                                    1 2 Previous Next