jsf – Primefaces Planning Error

Click OK to view the main applications with interfaces and calendars with the corresponding calendar so that they are an ideal showcase for interfaces and components (Calendar). There is no choice for the job, but it was created to create an index.XHTML and a .java and it introduced the person's code so that it was not indexed. nada.

He joined the work program as a senior executive of JSF as a dependency of Primefaces (6.2) and did not leave. Click on the following link to learn more about the Primefaces program (https://www.primefaces.org/showcase/ui/data/schedule.xhtml).

index.xhtml:




    
        Title Facelet

        
        

    
    


        
            

            
                

Editable timetable

Local support (example: Turkish)

Lazy schedule

ScheduleView.java:

package com.g1.calendario;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import javax.annotation.ManagedBean;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import org.primefaces.event.ScheduleEntryMoveEvent;
import org.primefaces.event.ScheduleEntryResizeEvent;
import org.primefaces.event.SelectEvent;
import org.primefaces.model.DefaultScheduleEvent;
import org.primefaces.model.DefaultScheduleModel;
import org.primefaces.model.LazyScheduleModel;
import org.primefaces.model.ScheduleEvent;
import org.primefaces.model.ScheduleModel;

/ **
*
* @author Josemanuu
* /
@ManagedBean
@ViewScoped
@Appointed
Public class ScheduleView implements Serializable {

private ScheduleModel eventModel;

private ScheduleModel lazyEventModel;

private event ScheduleEvent = new DefaultScheduleEvent ();

@PostConstruct
public void init () {
eventModel = new DefaultScheduleModel ();
eventModel.addEvent (new DefaultScheduleEvent ("Champions League Match", previousDay8Pm (), previousDay11Pm ()));
eventModel.addEvent (new DefaultScheduleEvent ("Birthday Party", today1Pm (), today6Pm ()));
eventModel.addEvent (new DefaultScheduleEvent ("Breakfast at Tiffanys", nextDay9Am (), nextDay11Am ()));
eventModel.addEvent (new DefaultScheduleEvent ("Plant new garden elements", the DayAfter3Pm (), fourDaysLater3pm ()));

lazyEventModel = new LazyScheduleModel () {

@Override
public void loadEvents (Date start, Date end) {
Date random = getRandomDate (start);
addEvent (new DefaultScheduleEvent ("Lazy Event 1", random, random));

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

public Date getRandomDate (Database) {
Calendar Date = Calendar.getInstance ();
date.setTime (base);
date.add (Calendar.DATE, ((int) (Math.random () * 30)) + 1); // set the day of the month at random

return date.getTime ();
}

public Date getInitialDate () {
Calendar calendar = Calendar.getInstance ();
calendar.set (calendar.get (Calendar.YEAR), Calendar.FEBRUARY, calendar.get (Calendar.DATE), 0, 0, 0);

return calendar.getTime ();
}

public ScheduleModel getEventModel () {
return eventModel;
}

public ScheduleModel getLazyEventModel () {
return lazyEventModel;
}

Private Calendar Today () {
Calendar calendar = Calendar.getInstance ();
calendar.set (calendar.get (Calendar.YEAR), calendar.get (Calendar.MONTH), calendar.get (Calendar.DATE), 0, 0, 0);

return schedule;
}

private Date previousDay8Pm () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.PM);
t.set (Calendar.DATE, t.get (Calendar.DATE) - 1);
t.set (Calendar.HOUR, 8);

return t.getTime ();
}

private Date previousDay11Pm () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.PM);
t.set (Calendar.DATE, t.get (Calendar.DATE) - 1);
t.set (Calendar.HOUR, 11);

return t.getTime ();
}

private Date today1Pm () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.PM);
t.set (Calendar.HOUR, 1);

return t.getTime ();
}

private Date theDayAfter3Pm () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.DATE, t.get (Calendar.DATE) + 2);
t.set (Calendar.AM_PM, Calendar.PM);
t.set (Calendar.HOUR, 3);

return t.getTime ();
}

private Date today6Pm () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.PM);
t.set (Calendar.HOUR, 6);

return t.getTime ();
}

private Date nextDay9Am () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.AM);
t.set (Calendar.DATE, t.get (Calendar.DATE) + 1);
t.set (Calendar.HOUR, 9);

return t.getTime ();
}

private Date nextDay11Am () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.AM);
t.set (Calendar.DATE, t.get (Calendar.DATE) + 1);
t.set (Calendar.HOUR, 11);

return t.getTime ();
}

private Date fourDaysLater3pm () {
Calendar t = (Calendar) today (). Clone ();
t.set (Calendar.AM_PM, Calendar.PM);
t.set (Calendar.DATE, t.get (Calendar.DATE) + 4);
t.set (Calendar.HOUR, 3);

return t.getTime ();
}

public ScheduleEvent getEvent () {
return event;
}

public void setEvent (ScheduleEvent event) {
this.event = event;
}

public void addEvent () {
if (event.getId () == null) {
eventModel.addEvent (event);
} other {
eventModel.updateEvent (event);
}

event = new DefaultScheduleEvent ();
}

public void onEventSelect (SelectEvent selectEvent) {
event = (ScheduleEvent) selectEvent.getObject ();
}

public void onDateSelect (SelectEvent selectEvent) {
event = new DefaultScheduleEvent ("", (Date) selectEvent.getObject (), (Date) selectEvent.getObject ());
}

public void onEventMove (ScheduleEntryMoveEvent event) {
MessageMessage message = new FacesMessage (FacesMessage.SEVERITY_INFO, "Event moved", "Delta of the day:" + event.getDayDelta () + ", Delta of the minute:" + event.getMinuteDelta ());

addMessage (message);
}

public void onEventResize (ScheduleEntryResizeEvent event) {
FacesMessage message = new FacesMessage (FacesMessage.SEVERITY_INFO, "Resized event", "Delta day:" + event.getDayDelta () + ", Delta minute:" + event.getMinuteDelta ());

addMessage (message);
}

private void addMessage (FacesMessage message) {
FacesContext.getCurrentInstance (). AddMessage (null, message);
}
}

List of directors who are the subject of a complete graphical copy of the table (in English):

Introduce the description of the pictorial image

It was not long before applications were displayed:

Introduce the description of the pictorial image

If you want to see the content of what you want or want to do, do not forget that you are on the right path to start.

EDITORIAL: It is reviewed and logged on for sale, but you can not go wrong with an error, but it has not lost its time yet:

Introduce the description of the pictorial image

Muchas gracias a todos 🙂