use p:schedule

UI Components for JSF
User avatar
fiorenzino
Posts: 32
Joined: 26 Sep 2009, 12:00

06 Feb 2010, 21:06

I want use the new component p:schedule, like in the showcase.

This is the error, using primefaces-1.0.0-SNAPSHOT.jar :

Code: Select all

java.text.ParseException: Unparseable date: "Mon, 15 Feb 2010 23:00:00 GMT"
	at java.text.DateFormat.parse(DateFormat.java:337)
	at org.primefaces.component.schedule.ScheduleRenderer.decode(ScheduleRenderer.java:63)
	at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789)
	at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1031)
	at javax.faces.component.UIForm.processDecodes(UIForm.java:209)
	at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
	at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:540)
	at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.primefaces.examples.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:32)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:619)
and this is the code in xhtml page:

Code: Select all

<h:form>

			<p:ajaxStatus style="height:24px;display:block;">
				<f:facet name="start">
					<h:graphicImage value="images/ajaxloading.gif" />
				</f:facet>

				<f:facet name="complete">
					<h:outputText value="" />
				</f:facet>
			</p:ajaxStatus>

			<p:schedule value="#{scheduleController.lazyEventModel}"
				editable="true" widgetVar="myschedule"
				eventSelectListener="#{scheduleController.onEventSelect}"
				dateSelectListener="#{scheduleController.onDateSelect}">

				<p:scheduleEventDialog header="Event Details">
					<h:panelGrid columns="2">
						<h:outputLabel for="title" value="Title:" />
						<h:inputText id="title" value="#{scheduleController.event.title}" />

						<h:outputLabel for="from" value="From:" />
						<p:inputMask id="from"
							value="#{scheduleController.event.startDate}" mask="99/99/9999">
							<f:convertDateTime pattern="dd/MM/yyyy" />
						</p:inputMask>

						<h:outputLabel for="to" value="To:" />
						<p:inputMask id="to" value="#{scheduleController.event.endDate}"
							mask="99/99/9999">
							<f:convertDateTime pattern="dd/MM/yyyy" />
						</p:inputMask>

						<h:outputLabel for="allDay" value="All Day:" />
						<h:selectBooleanCheckbox id="allDay"
							value="#{scheduleController.event.allDay}" />

						<p:commandButton type="reset" value="Reset" />
						<p:commandButton value="Save"
							actionListener="#{scheduleController.addEvent}"
							oncomplete="myschedule.update();" />
					</h:panelGrid>
				</p:scheduleEventDialog>
			</p:schedule>


		</h:form>
Also if i use a DateTimeConverter, like this:

Code: Select all


<converter>
		<converter-for-class>java.util.Date</converter-for-class>
		<converter-class>it.quartz.web.converter.CustomDateTimeConverter</converter-class>
	</converter>

Code: Select all

public CustomDateTimeConverter() {
		super();
		TimeZone tz = TimeZone.getTimeZone("Europe/Rome");
		TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
		setTimeZone(tz);
		setLocale(new Locale("it/IT"));
		setPattern("dd/MM/yyyy");
		
	}
Any ideas?

Best regards.

Fiorenzo

Sanhi
Posts: 6
Joined: 03 Feb 2010, 16:51

06 Feb 2010, 22:42

Converter should not be necessary. Did you implement the scheduleController as shown in the example? Not sure where it goes wrong, but I implemented the schedule with 1.0.0-SNAPSHOT yesterday, and everything worked out smoothly.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Feb 2010, 23:44

Fiorenzo, this happens when you click an empty date right?

Code that throws the exception is;

Code: Select all

try {
    String dateAsString = params.get(selectedDateParam);
    SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
    schedule.queueEvent(new ScheduleDateSelectEvent(component, format.parse(dateAsString)));
} catch (ParseException e) {
    throw new FacesException("Cannot parse selected date", e);
}
So it seems the selected date does not fit in "EEE, dd MMM yyyy HH:mm:ss z" pattern, this is interesting because on client side schedule widget sends the date in this format. Can't figure out how your converter can cause a problem here.

User avatar
fiorenzino
Posts: 32
Joined: 26 Sep 2009, 12:00

07 Feb 2010, 13:46

Fiorenzo, this happens when you click an empty date right?
Yes!

This happens also in my local prime-showcase.

POST parameters:
j_id7:j_id11_start Sat, 30 Jan 2010 23:00:00 GMT
j_id7:j_id11_end Sat, 13 Mar 2010 23:00:00 GMT

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Feb 2010, 14:08

Weird can't reproduce it, anyone can?


User avatar
fiorenzino
Posts: 32
Joined: 26 Sep 2009, 12:00

07 Feb 2010, 16:02

Some details:

jboss-4.2.3
ubuntu server
java-6-sun-1.6.0.15

locale:
LANG=it_IT.UTF-8
LC_CTYPE="it_IT.UTF-8"
LC_NUMERIC="it_IT.UTF-8"
LC_TIME="it_IT.UTF-8"
LC_COLLATE="it_IT.UTF-8"
LC_MONETARY="it_IT.UTF-8"
LC_MESSAGES="it_IT.UTF-8"
LC_PAPER="it_IT.UTF-8"
LC_NAME="it_IT.UTF-8"
LC_ADDRESS="it_IT.UTF-8"
LC_TELEPHONE="it_IT.UTF-8"
LC_MEASUREMENT="it_IT.UTF-8"
LC_IDENTIFICATION="it_IT.UTF-8"

User avatar
fiorenzino
Posts: 32
Joined: 26 Sep 2009, 12:00

08 Feb 2010, 15:42

Someone can suggest some workaround?

Pending an official solution, can i change the schedule widget in some fashion to change the date format transmit or change ScheduleRenderer.decode method to accept different pattern of date?


Thanks in advance

Fiorenzo

User avatar
fiorenzino
Posts: 32
Joined: 26 Sep 2009, 12:00

09 Feb 2010, 21:38

if i use this options in run.conf (for jboss boot):

-Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -Duser.timezone=Europe/Rome

the schedule component works correctly!

bye

fiorenzo

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

10 Feb 2010, 19:01

Thanks for sharing the solution, I guess we need to add a timeZone attribute to schedule to handle this case easier.

Code: Select all

<p:schedule timeZone="..." />

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 56 guests