Issue with timeline after upgrading to PF 5 and EXT 2.0.0

Community Driven Extensions Project
Post Reply
vidya.ambadipudi
Posts: 4
Joined: 12 Jun 2013, 15:58

14 Aug 2014, 11:18

Hi,

Timeline with add, edit and delete functionality was working fine until I upgraded. Right now I am using the following
PF 5.0
PF ext 2.0.0

Somehow event = e.getTimelineEvent() in the onEdit method is returning null. I am not able to figure out why :cry:

here is my code.

timeline.xhtml

Code: Select all


<p:panel>
		<pe:timeline id="timeline" height="250px"
			value="#{basicTimelineController.model}" editable="true"
			var="milestone" timeZone="#{basicTimelineController.timeZone}"
			widgetVar="timelineWdgt"
			style="margin-top:10px; width: 750px !important;"
			min="#{basicTimelineController.min}"
			max="#{basicTimelineController.max}"
			zoomMax="#{basicTimelineController.zoomMax}">
			<p:ajax event="change" update="@none"
				listener="#{basicTimelineController.onChange}" />
			<p:ajax event="delete"
				update=":delete-milestone-form:deleteMilestoneInner"
				listener="#{basicTimelineController.onDelete}"
				onstart="PF('timelineWdgt').cancelDelete()"
				oncomplete="PF('deleteMilestoneWdgt').show()" />
			<p:ajax event="edit"
				update=":update-milestone-form:updateMilestoneInner"
				listener="#{basicTimelineController.onEdit}"
				oncomplete="PF('updateMilestoneWdgt').show()" />
			<p:ajax event="add" update="@none" onstart="PF('timelineWdgt').cancelAdd()" />
		</pe:timeline>

		<p:commandButton value="Add Milestone" style="margin-top:15px;"
			onclick="PF('addMilestoneWdgt').show()" />
		<p:commandButton value="Save Timeline" style="margin-top:15px;"
			immediate="true"
			actionListener="#{basicTimelineController.saveTimeline()}" />
		<p:commandButton value="Reset Timeline" style="margin-top:15px;"
			immediate="true"
			actionListener="#{basicTimelineController.resetTimeline()}" />

	</p:panel>

update-milestone.xhtml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
	<h:form id="update-milestone-form">
		<p:dialog id="updateMilestoneDlg" header="Milestone Details"
			modal="true" dynamic="true" widgetVar="updateMilestoneWdgt"
			showEffect="clip" hideEffect="clip">
			<h:panelGroup id="updateMilestoneInner" layout="block">
				<p:messages id="update-milestone-messages" closable="true" />
				<h:panelGrid columns="2" cellpadding="3">
					<h:outputText value="Milestone Type: " />
					<p:selectOneMenu id="taskDisplayNames1"
						value="#{basicTimelineController.milestoneToUpdate.taskName}"
						required="true" requiredMessage="Please select milestone type"
						update="taskName1">
						<f:selectItem itemLabel="Select Task" itemValue="" />
						<f:selectItems
							value="#{basicTimelineController.milestoneTypeSelectItems}" />
						<p:ajax event="change"
							listener="#{basicTimelineController.milestoneTypeChanged}"
							update="taskName1" />
					</p:selectOneMenu>
					<h:outputText value="Start Date: " />
					<p:calendar widgetVar="startDate1" showButtonPanel="true"
						effect="slideDown" pattern="dd/MM/yyyy"
						mindate="#{basicTimelineController.getRequestStartDate()}"
						maxdate="#{basicTimelineController.getRequestEndDate()}"
						value="#{basicTimelineController.milestoneToUpdate.startDate}"
						required="true" requiredMessage="Please select start date" />
					<h:outputText value="Milestone Name: " />
					<p:inputText id="taskName1"
						value="#{basicTimelineController.milestoneToUpdate.taskDisplayName}"
						required="true" requiredMessage="Please select task name" />
					<h:outputText value="Notes: " />
					<p:inputTextarea id="notes1"
						value="#{basicTimelineController.milestoneToUpdate.notes}" />
				</h:panelGrid>
			</h:panelGroup>
			<f:facet name="footer">
				<p:commandButton value="Update"
					update="update-milestone-messages updateMilestoneInner"
					actionListener="#{basicTimelineController.updateMilestone()}"
					oncomplete="PF('updateMilestoneWdgt').hide()" />
				<p:commandButton value="Close" immediate="true"
					update="update-milestone-form"
					actionListener="#{basicTimelineController.closeMilestone()}"
					onclick="PF('updateMilestoneWdgt').hide()" />
			</f:facet>
		</p:dialog>
	</h:form>
</ui:composition>
Bean

Code: Select all

public void onEdit(TimelineModificationEvent e) {
		this.dirtyBit = true;
		event = e.getTimelineEvent();
		this.milestoneToUpdate = (Milestone) event.getData();
		this.milestoneToUpdate.setStartDate(event.getStartDate());
	}

public void onChange(TimelineModificationEvent e) {
		TimelineUpdater timelineUpdater = null;
		if (this.admin) {
			timelineUpdater = TimelineUpdater.getCurrentInstance(":seo-process-detail-form:seo-detail-tabview:timeline");
		} else {
			timelineUpdater = TimelineUpdater.getCurrentInstance(":pop_up_ui_form:detail-tabview:timeline");
		}
		event = e.getTimelineEvent();
		model.update(event, timelineUpdater);
		FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "The milestone dates have been updated", null);
		FacesContext.getCurrentInstance().addMessage(null, msg);
		this.dirtyBit = true;
	}

public void onDelete(TimelineModificationEvent e) {
		event = e.getTimelineEvent();
		this.dirtyBit = true;
	}
This is happening for onChange and onDelete as well.

I would appreciate any help :)

Thanks
Vidya A

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

17 Aug 2014, 16:49

Strange. Can you debug the method queueEvent() in Timeline.java please? What do you get for the "edit" event here?

Code: Select all

TimelineEvent timelineEvent = getValue().getEvent(params.get(clientId + "_eventIdx"));
What do you get from params.get(clientId + "_eventIdx")?
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

vidya.ambadipudi
Posts: 4
Joined: 12 Jun 2013, 15:58

18 Aug 2014, 15:53

Hi Eyeryone,

Sorry, this was a false alarm. Even though i changed the pom.xml to point to 2.0.0 of extension, in debug i saw that it was using classes from 1.2.1.. :( :(
Some issues with the maven i guess. After restarting glassfish, it started working perfectly.

Thanks for your help :) :)

Regards
Vidya Ambadipudi

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

20 Aug 2014, 22:44

Glad to hear.

We will release 2.1.0 this week with some imrovements in the timeline too.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests