1 2 Previous Next 24 Replies Latest reply on Apr 9, 2008 9:55 AM by jamesjmp Go to original post
      • 15. Re: Calendar what type is the date?
        daniel.soneira

        rich:calendar SHOULD be able to work with java.util.Calendar.

        see http://jira.jboss.com/jira/browse/RF-933.

        • 16. Re: Calendar what type is the date?
          tony.herstell1

          Well I could not get the calendar to work with 3.1.4.GA with Seam 2.0.1.GA on JBoss 4.2.1.GA. Closest I ever got was illegalArgument exceptions and no way to figure out why....
          Using java.util.date worked.
          :(

          • 17. Re: Calendar what type is the date?


            HI,

            How can I get the currently selected date into the JavaScript? If anyone know give me tips.

            • 18. Re: Calendar what type is the date?
              ilya_shaikovsky

              http://livedemo.exadel.com/richfaces-demo/richfaces/calendar.jsf

              see JS API tab.

              Also it described in our developers guide.

              • 19. Re: Calendar what type is the date?

                hi,
                I am using RF 3.1.4.GA, Seam 2.0.1.GA and JBoss 4.2.2.

                In a list page I want to filter by a date value using a java.util.date property in the backing bean.

                This is code from the xhtml page:

                 <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
                 <h:form id="instrumentFundExSearch" styleClass="edit">
                 <rich:simpleTogglePanel label="#{messages['InstrumentFundEx']}: #{messages['search.parameters']}" switchType="ajax">
                
                 <s:decorate id="navDateDecoration" template="layout/display.xhtml">
                 <ui:define name="label">#{messages['NavDate']}</ui:define>
                 <rich:calendar value="#{instrumentFundExList.navDateCompos}"
                 ajaxSingle="true"
                 id="navDateCompos"
                 popup="true"
                 currentDate="#{instrumentFundExList.navDateCompos}"
                 datePattern="#{constantes.datePattern}"
                 inputSize="20"
                 immediate="true">
                 <a:support event="ondateselected" />
                 </rich:calendar>
                 <rich:spacer width="15" height="5"/>
                 <h:outputText value="#{messages['If.empty.max.date']}"></h:outputText>
                 </s:decorate>
                
                
                 <s:decorate template="layout/display.xhtml">
                 <ui:define name="label">securityName</ui:define>
                 <h:inputText id="securityName" value="#{instrumentFundExList.instrumentFundEx.id.securityName}"/>
                 </s:decorate>
                
                 </rich:simpleTogglePanel>
                 <br></br>
                <s:div styleClass="actionButtons" >
                <h:commandButton id="search" value="#{messages['Search']}" action="/InstrumentFundExList.xhtml"/>
                 </s:div>
                
                 </h:form>
                
                


                constantes.datePattern value is this: dd/MM/yyyy

                On the other hand in the page.xml I have:


                 <param name="securityName" value="#{instrumentFundExList.instrumentFundEx.id.securityName}"/>
                
                 <param name="navDateCompos" value="#{instrumentFundExList.navDateCompos}"/>
                
                


                And java class code snippet is the following:
                ...
                import java.util.Date;
                ...
                
                @Name("instrumentFundExList")
                public class InstrumentFundExList extends EntityQuery {
                
                 private Date navDateCompos;
                
                 private static final String[] RESTRICTIONS = {
                 "instrumentFundEx.id.navDate = #{navDateCompos}",
                 "lower(instrumentFundEx.id.securityName) like concat(lower(#{instrumentFundExList.instrumentFundEx.id.securityName}),'%')",
                 };
                
                
                
                
                 @Temporal(TemporalType.DATE)
                // @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
                 public Date getNavDateCompos() {
                 return navDateCompos;
                 }
                
                // @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
                 public void setNavDateCompos(Date dateRequired) {
                 log.info("setNavDateCompos-->"+dateRequired+"<--");
                 this.navDateCompos = dateRequired;
                 }
                
                
                 @Override
                 @SuppressWarnings("unchecked")
                 public List getResultList() {
                 List listados = null;
                 try {
                 System.out.println("instrumentFundExList - getResultList!!");
                 if (navDateCompos == null) {
                 navDateCompos = new Date();
                 System.out.println("navDateCompos was null, assigned today date: " + navDateCompos);
                 } else {
                 System.out.println("navDateCompos was filled with this value: " + navDateCompos);
                 }
                 listados = super.getResultList();
                 } catch (Exception ex) {
                 System.out.println("Exception instrumentFundExList------->" + ex.getMessage() + "<-- !!!!!");
                 ex.printStackTrace();
                 }
                 return listados;
                 }
                


                Filtering by securityName works perfect, but doing it by navDateCompos does not work.

                This is the log selecting 2008-03-17 in the rich:calendar component:



                11:22:33,609 ERROR [SeamPhaseListener] uncaught exception
                javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch
                at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
                at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)

                ....
                Caused by: java.lang.IllegalArgumentException: argument type mismatch
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
                ... 51 more
                11:22:33,703 ERROR [Exceptions] Can't find exception class for exception handler
                java.lang.ClassNotFoundException: No ClassLoaders found for: com.sun.facelets.FaceletViewHandler.handleRenderException
                at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
                at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
                at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                at java.lang.Thread.run(Thread.java:619)
                ..
                11:22:34,218 ERROR [SeamPhaseListener] swallowing exception
                javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch
                at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
                at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)

                11:22:34,218 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:34,218 INFO [STDOUT] navDateCompos was null, assigned today date: Thu Mar 06 11:22:34 CET 2008
                11:22:34,234 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:34,718 INFO [STDOUT] Exception
                instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!

                11:22:34,718 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                11:22:34,718 ERROR [STDERR] at org.hibernate.type.DateType.toString(DateType.java:78)
                ....
                11:22:35,234 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:35,234 INFO [STDOUT] navDateCompos was filled with this value: Thu Mar 06 11:22:34 CET 2008
                11:22:35,234 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:35,734 INFO [STDOUT] Exception instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!
                11:22:35,734 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                11:22:35,734 ERROR [STDERR] at org.hibernate.type.DateType.toString(DateType.java:78)
                .....
                11:22:36,750 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:36,750 INFO [STDOUT] navDateCompos was filled with this value: Thu Mar 06 11:22:34 CET 2008
                11:22:36,765 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:37,234 INFO [STDOUT] Exception instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!
                11:22:37,234 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                11:22:37,234 ERROR [STDERR] at org.hibernate.type.DateType.toString(DateType.java:78)
                ....
                11:22:38,250 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:38,250 INFO [STDOUT] navDateCompos was filled with this value: Thu Mar 06 11:22:34 CET 2008
                11:22:38,250 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:38,750 INFO [STDOUT] Exception instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!
                11:22:38,750 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                11:22:38,750 ERROR [STDERR] at org.hibernate.type.DateType.toString(DateType.java:78)
                ....
                11:22:39,281 INFO [InstrumentFundExList] setNavDateCompos-->Mon Mar 17 00:00:00 CET 2008<--
                11:22:39,281 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:39,281 INFO [STDOUT] navDateCompos was filled with this value: Mon Mar 17 00:00:00 CET 2008
                11:22:39,281 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:39,765 INFO [STDOUT] Exception instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!
                11:22:39,765 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                11:22:39,765 ERROR [STDERR] at org.hibernate.type.DateType.toString(DateType.java:78)
                ...

                11:22:41,781 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:41,781 INFO [STDOUT] navDateCompos was filled with this value: Mon Mar 17 00:00:00 CET 2008
                11:22:41,781 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:42,281 INFO [STDOUT] Exception instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!
                11:22:42,281 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                11:22:42,281 ERROR [STDERR] at org.hibernate.type.DateType.toString(DateType.java:78)
                11:22:42,281 ERROR [STDERR] at org.hibernate.type.NullableType.nullSafeToString(NullableType.java:93)
                ....
                11:22:44,796 INFO [STDOUT] instrumentFundExList - getResultList!!
                11:22:44,796 INFO [STDOUT] navDateCompos was filled with this value: Mon Mar 17 00:00:00 CET 2008
                11:22:44,796 INFO [STDOUT] Hibernate:
                select
                instrument0_.asset_type as asset1_65_,
                instrument0_.currency_iso as currency2_65_,
                instrument0_.entity_group_code as entity3_65_,
                instrument0_.currency_des as currency4_65_,
                instrument0_.id_asset as id5_65_,
                instrument0_.instr_category_des as instr6_65_,
                instrument0_.instr_type_des as instr7_65_,
                instrument0_.nav_date as nav8_65_,
                instrument0_.security_name as security9_65_,
                instrument0_.total_mk_value_invest_ccy as total10_65_
                from
                prisk.dbo.INSTRUMENT_FUND_EX instrument0_
                where
                (
                lower(instrument0_.entity_group_code) like (lower(?)+'%')
                )
                and instrument0_.nav_date=?
                11:22:45,296 INFO [STDOUT] Exception instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!
                11:22:45,296 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
                ...
                11:22:45,812 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
                11:22:45,953 INFO [ConnectionManager] forcing batcher resource cleanup on transaction completion; forgot to close ScrollableResults/Iterator?





                I am using java.util.date, I really do not understand why are there these exceptions:

                javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch

                instrumentFundExList------->java.lang.String cannot be cast to java.util.Date<-- !!!!!


                By the way using or not TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
                have not made any difference.
                Any idea?
                thanks in advance!!

                • 20. Re: Calendar what type is the date?

                  By the way, before I was using RichFaces 3.1.3GA, but in my case having moved to 3.1.4.GA has not meant any progress ;-(

                  • 21. Re: Calendar what type is the date?
                    tim_ph

                    and change currentDate to value="". currentDate only set what today is. You are not mapping your date to calendar at all.
                    Anyway, I also got problem when page restarts with calendar request params.

                    • 22. Re: Calendar what type is the date?

                      Hi,
                      removing currentDate or assigning it to "" does not solve the problem, but anyway you have reason there is no pint to use them un my case. Thank you.
                      By the way, after testing and testing is curious that Rich:Calendar works ok as far as editing a new register (if adding it for instance to a seam-gened POJOEdit page)
                      but it does NOT work to filter if adding it to a seam gened POJOList page, at least in my case
                      Have anyone managed to use Rich:Calendar to filter in a List page?
                      thank you!

                      • 23. Re: Calendar what type is the date?
                        nathandennis

                        I'm having trouble using it anywhere it isn't directly linked to an entity or seam's home object.
                        i have tried 3.1.3 3.1.4 and a 3.2.0 snapshot. all three failed. i ended up reverting back to 3.1.4 because there still is too much broken in 3.2. ie it broke the pageation on all my rich data grids.. go figured. (no errors,, just didnt work).

                        the only error i got from rich calendar failing was the same as hartsel..

                        17:17:52,218 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
                        sourceId=j_id51:j_id55:eventdateDecoration:eventdate[severity=(ERROR 2), summary=(/timeline/include/event.xhtml @38,51 value="#{timelineAction.eventdate}": Error writing 'eventdate' on type org.javassist.tmp.java.lang.Object_$$_javassist_17), detail=(/timeline/include/event.xhtml @38,51 value="#{timelineAction.eventdate}": Error writing 'eventdate' on type org.javassist.tmp.java.lang.Object_$$_javassist_17)]
                        




                        here is my current code.. i also tried Calendar as my object type,,, but since Date is used everywhere i know of this component working,,, i switched back to it and will await a patch i guess.

                        Stateful
                        @Name("timelineAction")
                        @Scope(ScopeType.CONVERSATION)
                        public class TimelineAction implements TimelineLocal, DropListener {
                        .....
                         @Temporal(TemporalType.DATE)
                         @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
                         public Date getEventdate(){
                         return this.eventdate;
                         }
                        
                        
                         @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
                         public void setEventdate(Date eventdate){
                         this.eventdate = eventdate;
                         }
                        
                        ...

                        also have a local interface with it in there.
                        @Local
                        public interface TimelineLocal {
                        
                         public Date getEventdate();
                         public void setEventdate(Date eventdate);
                        ...


                        xhtml
                        <s:decorate id="eventdateDecoration" template="../layout/edit.xhtml">
                         <ui:define name="label">Date:</ui:define>
                         <rich:calendar id="eventdate" mode="ajax"
                         value="#{timelineAction.eventdate}"
                         datePattern="MM/dd/yyyy" />
                         <a:support event="ondateselected" reRender="eventdateDecoration" />
                         </s:decorate>
                        


                        no cigar,, and im around 99% on my code being correct.


                        • 24. Re: Calendar what type is the date?

                          Finally this is working for me! I have moved to RF 3.2.0.GA and I have recoded, cleaned and redeployed.
                          The key jas been using java.util.Date and the converter org.jboss.seam.ui.DateTimeConverter.

                          Example:

                          <param name="prueba" value="#{instrumentFundExList.navDateRich}" converterId="org.jboss.seam.ui.DateTimeConverter" />
                          


                          regards!


                          1 2 Previous Next