The MindFusion Forums
Scheduling and Gantt Components >> Java Swing >> One row/task
https://mindfusion.eu/Forum/YaBB.pl?num=1495019220

Message started by Ionut Murarasu on May 17th, 2017 at 11:07am

Title: One row/task
Post by Ionut Murarasu on May 17th, 2017 at 11:07am
Hello,

Please take a look in the attachment image.
I want to block the user to add more than one appointments in the same task like in the example from the image.
I want to have only one appointment for the same task.
Can Awt Calendar stop the user from extend the task in more than one row ?
jPlanner.JPG ( 66 KB | 170 Downloads )

Title: Re: One row/task
Post by Meppy on May 17th, 2017 at 12:02pm
Hi,

You can listen to the itemModifying event of the Calendar and ensure that the moved item does not collide with another item. The following code illustrates how:

[code]calendar.addCalendarListener(new CalendarAdapter() {
     @Override
     public void itemModifying(ItemModifyConfirmEvent e) {
           if (calendar.getSchedule().getAllItems(e.getNewStartTime(), e.getNewEndTime(), e.getResource()).size() > 1)
                 e.setConfirm(false);
     }
});[/code]
Regards,
Meppy

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.