optimus.prime: add DefaultScheduleEvent constructor

UI Components for JSF
Post Reply
smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Nov 2011, 21:24

Optimus.Prime,

Can the following constructor be added to DefaultScheduleEvent?

Code: Select all

    public DefaultScheduleEvent(String title, Date start, Date end, boolean allDay, Object data) {
        //compiled code
        throw new RuntimeException("Compiled Code");
    }
Existing code in PF3.0RC1-SNAPSHOT I downloaded immediately after M4 was released.

Code: Select all

    public DefaultScheduleEvent() {
        //compiled code
        throw new RuntimeException("Compiled Code");
    }

    public DefaultScheduleEvent(String title, Date start, Date end) {
        //compiled code
        throw new RuntimeException("Compiled Code");
    }

    public DefaultScheduleEvent(String title, Date start, Date end, boolean allDay) {
        //compiled code
        throw new RuntimeException("Compiled Code");
    }

    public DefaultScheduleEvent(String title, Date start, Date end, String styleClass) {
        //compiled code
        throw new RuntimeException("Compiled Code");
    }

    public DefaultScheduleEvent(String title, Date start, Date end, Object data) {
        //compiled code
        throw new RuntimeException("Compiled Code");
    }
FYI, I'm currently using the constructor that accepts Boolean allDay parameter, and allDay is not working at all. :(

Thanks,
Howard
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Nov 2011, 22:27

Wow, the two different constructors that accepts allDay and Object data are BOTH NOT working, so I did the following, and the following is working as designed/expected. :)

Code: Select all

    Integer listSize = filteredList.size();
    Boolean allDayEvent = false;
    DefaultScheduleEvent event = null;

    for (int i = 0; i < listSize; i++) {
        Orders order = filteredList.get(i);
        String title = order.getCustomerId().getCustomerName();
        Date tripDate = order.getTripDateTime();
        Date returnDate = order.getReturnDateTime();
        //System.out.println("pf_OrdersController: lazyEventModel.addEvent(" + title + "," + tripDate + "," + returnDate + ")");
        event = new DefaultScheduleEvent(title, tripDate, returnDate, allDayEvent);
        event.setAllDay(allDayEvent);
        event.setData(order);
        addEvent(event);
    }
BUT, now I'm trying to figure out what does enduser need to do to trigger eventSelect ajax event; i clicked events on p:schedule in browser, and nothing happened. :(

Please see code below and advise.

bean

Code: Select all

    public void onEventSelect(ScheduleEntrySelectEvent e) {
        ScheduleEvent scheduleEvent = e.getScheduleEvent();
        current = (Orders) scheduleEvent.getData();
        selectedRows[0] = current;
        prepareView();
    }
xhtml

Code: Select all

                <p:schedule editable="false" draggable="false"
                            value="#{pf_ordersController.lazyEventModel}">
                    <p:ajax event="eventSelect" listener="#{pf_ordersController.onEventSelect}"
                             update=":pageContentPanel"/>
                </p:schedule>
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Nov 2011, 22:52

I added form submit javascript to p:ajax (below), but when I click on an event on the Schedule/Calendar, another page/xhtml is not be opened/displayed. I really would like to be able to click an event on the p:schedule component and another xhtml page opened/displayed. Please advise.

Code: Select all

                    <p:ajax event="eventSelect" listener="#{pf_ordersController.onEventSelect}"
                             update=":pageContentPanel" oncomplete="ordersScheduleForm.submit()"/>
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Nov 2011, 23:25

In public void onEventSelect(ScheduleEntrySelectEvent e), ScheduleEntrySelectEvent e has NULL values, even though p:schedule is populated with events, successfully (see code in previous posts above).
Caused by: java.lang.NullPointerException
at jsf.orders.pf_OrdersController.onEventSelect(pf_OrdersController.java:1377)
Code which includes debug lines; NullPointException is returned by scheduleEvent.getTitle(), getStartDate(), and I didn't try getEndDate() yet.

Code: Select all

    public void onEventSelect(ScheduleEntrySelectEvent e) {
        ScheduleEvent scheduleEvent = e.getScheduleEvent();
        //String title = scheduleEvent.getTitle();
        Date tripDate = scheduleEvent.getStartDate();
        Date returnDate = scheduleEvent.getEndDate();
        System.out.println("pf_OrdersController: lazyEventModel.addEvent(" + tripDate + "," + returnDate + ")");
        //System.out.println("pf_OrdersController: lazyEventModel.addEvent(" + title + "," + tripDate + "," + returnDate + ")");
        /*
         * 
        current = (Orders) scheduleEvent.getData();
        selectedRows[0] = current;
        prepareView();
         * 
         */
    }
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 25 guests