Primefaces Timeline strange behavior on deployed app

Community Driven Extensions Project
Post Reply
Master Azazel
Posts: 9
Joined: 09 Oct 2015, 13:48

30 Nov 2015, 11:13

Hello,

ive been working on a web application with jsf+primefaces 5.2+extensions 3.2.0

now that app is working fine when i run it inside my local tomcat installation.

my build server is automatically deploying the webapp to the prod-server.

now heres my problem, i looked at my code but didnt find the solution right away:


i have a page, absences.xhtml, wich shows one timeline and all absences of the logged in user.

i enabled the drag/dropping inside the timeline (ajax-event changed)
now when i try to move an event on the deployed app, it centers the selected event after i let it go

the changes are saved anyway, thats not the point, i just wonder why the heck its only centering that event only with the deployed app and how i can turn it off

Code: Select all

		<h:form id="mainForm">
			<pe:timeline id="timeline" value="#{absenceController.model}"
				var="appointment" timeZone="#{absenceController.timeZone}"
				zoomMax="#{absenceController.zoomMax*12}"
				zoomMin="#{absenceController.zoomMax}"
				start="#{absenceController.startDate}"
				end="#{absenceController.endDate}" editable="true" locale="de"
				zoomable="true" moveable="true" unselectable="false"
				axisOnTop="true" timeChangeable="true" minHeight="150"
				widgetVar="timelineWdgt" snapEvents="true" stackEvents="false"
				showCurrentTime="false" showButtonNew="false">
				<p:ajax event="select" listener="#{absenceController.onSelect}" />
				<p:ajax event="changed" update=":dataTableForm:absenceTable"
					listener="#{absenceController.onChange}" />
				<p:ajax event="edit"
					update=":dialogForm:detailsBookingInner, :mainForm:timeline, :dataTableForm:absenceTable"
					oncomplete="PF('detailsBookingWdgt').show()"
					onerror="PF('detailsBookingWdgt').show()">
					<p:resetInput target=":dialogForm:detailsBookingDlg" />
				</p:ajax>
				<p:ajax event="add" update=":dialogForm:detailsBookingInner"
					listener="#{absenceController.onAdd}"
					oncomplete="PF('detailsBookingWdgt').show()"
					onerror="PF('detailsBookingWdgt').show()" />
				<p:ajax event="delete" update=":mainForm:timeline, :dataTableForm"
					listener="#{absenceController.deleteItemTimeline}" />
				<p:ajax event="rangechanged"
					listener="#{absenceController.rangeChanged}" />

				<h:panelGrid columns="1">
					<h:outputText value="" />
					<h:outputText value="" />
					<h:outputText value="Grund:" />
					<h:outputText value="" />
					<h:outputText value="#{appointment.reason}" />
					<h:outputText value="" />
				</h:panelGrid>
			</pe:timeline>
		</h:form>

and my actionlistener method:

Code: Select all

	@Override
	public void onChange(TimelineModificationEvent e) {
		// get clone of the TimelineEvent to be changed with new start / end
		// dates
		event = e.getTimelineEvent();
		TimelineEvent oldEvent = model.getEvent(model.getIndex(event));
		FacesMessage msg = null;
		// update booking in DB...
		// if everything was ok, no UI update is required. Only the model should
		// be updated
		TimelineUpdater timelineUpdater = TimelineUpdater.getCurrentInstance(MAIN_FORM_TIMELINE);
		model.update(event);
		if (model.getOverlappedEvents(event) == null
				|| model.getOverlappedEvents(event).first().getStartDate().equals(event.getEndDate())
				|| model.getOverlappedEvents(event).first().getEndDate().equals(event.getStartDate())) {
			logger.info("Changed dates on following absence: " + getEventId());
			msg = new FacesMessage(FacesMessage.SEVERITY_INFO,
					"Datumsangaben der Absenz " + getEventId() + " wurden aktualisiert.", null);
			this.checkForConflicts(login.getUser(), this.save());
		} else {
			msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
					"Fehler: " + getEventId() + "\nüberschneidet sich mit einem anderen Element.", null);
			logger.info(((Appointment) event.getData()).getOwner() + " tried to change the dates on absence "
					+ getEventId() + ", overlapped another absence");
			// otherwise (if DB operation failed) a rollback can be done with
			// the
			// same response as follows:
			model.update(oldEvent);
			model.update(oldEvent, timelineUpdater);
		}
		FacesContext.getCurrentInstance().addMessage(null, msg);
	}

Code: Select all

	public void onChange(TimelineModificationEvent e) {
		model.update(e.getTimelineEvent());
		event = e.getTimelineEvent();
		//save operation
		this.save();
		logger.info(((Appointment) event.getData()));
	}

any help appreciated, i kinda dont know where to look :?

Master Azazel

Master Azazel
Posts: 9
Joined: 09 Oct 2015, 13:48

30 Nov 2015, 14:03

found the solution:

way back when i started developing the app, i changed something in the pf-extensions by hand so selection wouldn't center the event anymore

i select the event after its been saved, and since my deployment server goes and gets a new (unchanged) version of the extensions-jar, the events become centered again after safe

i think this http://forum.primefaces.org/viewtopic.php?f=14&t=34902 might be the solution since i don't want my changed jar in deployed app anyway, its really ugly...


problem identified and solved ;)

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests