modify ScheduleEvent

UI Components for JSF
Post Reply
jhonny034
Posts: 10
Joined: 24 Jun 2010, 07:51

28 Jun 2010, 19:21

good morning to all, I need to add some attributes to ScheduleEvent and everything seems fine, but when I refresh my page events are not loaded in the Schedule, when I use the DefaultSchedule this if it works well. someone knows I am doing wrong?
thank you.

package calendario;
import java.util.Date;
import org.primefaces.model.ScheduleEvent;

public class Evento implements ScheduleEvent{
String id;
Object data;
String title;
Date startDate;
Date endDate;
boolean allDay=false;
String styleClass;
private String telefono;

public Evento(){

}


public Evento(String title, Date startDate, Date endDate,boolean allDay){
this.title=title;
this.startDate=startDate;
this.endDate=endDate;
this.allDay=allDay;
}

public Evento(String title, Date startDate, Date endDate){
this.title=title;
this.startDate=startDate;
this.endDate=endDate;

}

public String getId(){
return id;
}
public void setId(String id){
this.id=id;
}
public Object getData(){
return data;
}
public String getTitle(){
return title;
}

public Date getStartDate(){

return startDate;
}
public Date getEndDate(){
return endDate;
}

public boolean isAllDay(){
return allDay;
}
public String getStyleClass(){
return styleClass;
}

/**
* @return the telefono
*/
public String getTelefono() {
return telefono;
}

/**
* @param telefono the telefono to set
*/
public void setTelefono(String telefono) {
this.telefono = telefono;
}
}

///////////////////////////////////////////////
import java.util.Calendar;
import java.util.Date;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import org.primefaces.event.DateSelectEvent;
import org.primefaces.event.ScheduleEntryMoveEvent;
import org.primefaces.event.ScheduleEntryResizeEvent;
import org.primefaces.event.ScheduleEntrySelectEvent;

import org.primefaces.model.DefaultScheduleModel;
import org.primefaces.model.LazyScheduleModel;
import org.primefaces.model.ScheduleEvent;
import org.primefaces.model.ScheduleModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import java.io.Serializable;

public class CalendarioBean implements Serializable{

private ScheduleModel eventModel;

private ScheduleModel lazyEventModel;

private ScheduleEvent event;

private String theme;
private static final Log log = LogFactory.getLog(CalendarioBean.class);

ClassPathResource classPathResource = new ClassPathResource("spring-config.xml");
XmlBeanFactory beanFactory = new XmlBeanFactory(classPathResource);
dao.CitasDao citasDao = (dao.CitasDao)beanFactory.getBean("citasDao");


public CalendarioBean() {

eventModel.addEvent(new Evento("Champions League Match", previousDay8Pm(), previousDay11Pm(),false));
eventModel.addEvent(new Evento("Birthday Party", today1Pm(), today6Pm(),false));
eventModel.addEvent(new Evento("Breakfast at Tiffanys", nextDay9Am(), nextDay11Am(),false));
eventModel.addEvent(new Evento("Plant the new garden stuff", theDayAfter3Pm(), fourDaysLater3pm(),false));


lazyEventModel = new LazyScheduleModel() {

@Override
public void loadEvents(Date start, Date end) {
clear();

Date random = getRandomDate(start);
addEvent(new Evento("Lazy Event 1", random, random));

random = getRandomDate(start);
addEvent(new Evento("Lazy Event 2", random, random));
}
};
}
........
............

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

30 Jun 2010, 11:50

Strange, can you try with extending DefaultScheduleEvent instead of implement ScheduleEvent.

jhonny034
Posts: 10
Joined: 24 Jun 2010, 07:51

30 Jun 2010, 16:07

oh thank you very much, now if it works correctly, i only have one problem and maybe you know how to solve, in the view "week" when I move or resize an event and then I create another event, the previous event which I resize it disappears or returns to its original size.
when I test the same happens in the showcase.

any ideas?
thank you.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests