Home Forums CalendarFX How can I customize the date popover in the YearPage control?

  • Author
    Posts
  • NHS
    Participant
    Post count: 26
    #13085 |

    When using the YearPage a small popover is shown when the user clicks on a date. How can we override that default. Below does not seem to work

    calendarView.getYearPage().setEntryDetailsPopOverContentCallback(new Callback<DateControl.EntryDetailsPopOverContentParameter, Node>() {
    @Override
    public Node call(DateControl.EntryDetailsPopOverContentParameter param) {
    System.out.println(“HER…..0”);
    return null;
    }
    });

    calendarView.getYearMonthView().setEntryDetailsPopOverContentCallback(new Callback<DateControl.EntryDetailsPopOverContentParameter, Node>() {
    @Override
    public Node call(DateControl.EntryDetailsPopOverContentParameter param) {
    System.out.println(“HER…..1”);
    return null;
    }
    });

  • Dirk Lemmermann
    Keymaster
    Post count: 64
    #13088 |

    Please use the setDateDetailsCallback() for creating your own popover. The “entry details popover content” callback allows you to have a specific callback just for the inside of a popover. This functionality does not exist for the date popover. So you will need to create your own popover instance.

  • NHS
    Participant
    Post count: 26
    #13092 |

    Better title…

    It seems a bit strange – none of the 3 system out are called when click on a day in the year / month view

     

    calendarView.getYearPage().setDateDetailsCallback(new Callback<DateControl.DateDetailsParameter, Boolean>() {
    @Override
    public Boolean call(DateControl.DateDetailsParameter param) {
    System.out.println(“HER…..1”);
    return null;
    }
    });

    calendarView.getYearMonthView().setDateDetailsCallback(new Callback<DateControl.DateDetailsParameter, Boolean>() {
    @Override
    public Boolean call(DateControl.DateDetailsParameter param) {
    System.out.println(“HER…..2”);
    return null;
    }
    });

    calendarView.setDateDetailsCallback(new Callback<DateControl.DateDetailsParameter, Boolean>() {
    @Override
    public Boolean call(DateControl.DateDetailsParameter param) {
    System.out.println(“HER…..3”);
    return null;
    }
    });

  • Dirk Lemmermann
    Keymaster
    Post count: 64
    #13093 |

    The third option should have been the right one, but unfortunately there is a bug. The bindings between the individual month views and the year page are not correct. This will be fixed in the next release. Until then you can use this workaround (using Java 8 lambda syntax):

    
    calendarView.getYearPage().getMonthView(Month.JANUARY)
       .setDateDetailsCallback(param -> 
             {
                System.out.println("Hello");
                return null;
             }
    );
    

    Unfortunately you have to do this for each month, so please put it into a loop and iterate over Month.values().

  • NHS
    Participant
    Post count: 26
    #13094 |

    Thanks!

You must be logged in to reply to this topic.