- Welcome, Guest. Please Login or Register
MindFusion  
  Version 2 of our Xamarin Calendar component adds Resource view and support for Universal Windows Platform. Now beta testing spreadsheet component for Java Swing. We have released our Java Swing Pack.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Recurrence
Read 148 times

Ionut Murarasu   Offline
YaBB Newbies
*
Posts: 6
I Love MindFusion!


   
     
 
Recurrence
Jul 3rd, 2017 at 2:53pm
 
Hello,

I need some help with a problem.
I want to add some recurrence appointments in my calendar.
After I added an appointment with recurrence in the calendar, in the appointment an icon with two circular arrows appears, that means my appointment was added as recurrence.
But after I made a change in the appointment, like name or change the capacity of the interval those two arrows are underline and my modifications are made only for the appointment from my current day not the entire recurrence period.

For example my appointment has recurrence for every Monday, but if I try to change the name, it's change only for the current day, not for every Monday.

I need some help with this problem, please.

This is the way how I added a recurrence when I created the appointment:

Recurrence recurrencae = new Recurrence();
recurrence.setPattern(RecurrencePattern.Daily);
recurrence.setOccurrence(Occurrence.First);
recurrence.setDays(7);
recurrence.setStartDate(date);
recurrence.setRecurrenceEnd(RecurrenceEnd.Never);
app.setRecurrence(recurrence);

 
 

recurrence.JPG (69 KB | 9 )
recurrence.JPG
 
IP Logged    
 
     

Meppy   Offline
YaBB Moderator
*****
Posts: 1755
Gender: male
MindFusion support


   
     
 
Re: Recurrence
Reply #1 - Jul 3rd, 2017 at 3:13pm
 
Hi,

Modifying a recurring appointment modifies the instance only (not the master) and causes an exception to be automatically created. If you want to apply the modification to the master (and to all the occurrences), handle the itemModifed event:

Code:
calendar.addCalendarListener(new CalendarAdapter() {
	@Override
	public void itemModified(ItemModifiedEvent e) {
		// TODO Auto-generated method stub
		super.itemModified(e);

		if (e.getItem().getRecurrenceState() == RecurrenceState.Exception)
		{
			Item master = e.getItem().getRecurrence().getMaster();
			master.setStartTime(e.getItem().getStartTime());
			master.setEndTime(e.getItem().getEndTime());
			e.getItem().getRecurrence().removeException(e.getItem());
		}
	}
} 


Regards,
Meppy
 
 
 
IP Logged    
 
     

Ionut Murarasu   Offline
YaBB Newbies
*
Posts: 6
I Love MindFusion!


   
     
 
Re: Recurrence
Reply #2 - Jul 3rd, 2017 at 3:26pm
 
Thanks !

I will try.
 
 
 
IP Logged    
 
     

Ionut Murarasu   Offline
YaBB Newbies
*
Posts: 6
I Love MindFusion!


   
     
 
Re: Recurrence
Reply #3 - Jul 4th, 2017 at 8:28am
 
Hello again,

First time I want to thank you for your help!
It works when I try to change the change the interval and remains recurring, but I can't move the appointment to another day.
I can't  drag the item from today to tomorrow.
Why is this happening ?
 
 
 
IP Logged    
 
     

Meppy   Offline
YaBB Moderator
*****
Posts: 1755
Gender: male
MindFusion support


   
     
 
Re: Recurrence
Reply #4 - Jul 4th, 2017 at 12:11pm
 
Hi,

If you want to adjust the start of the recurrence, you can do this through the Recurrence.setStartDate method. In your case you can detect if the user moved an item to another day and adjust the recurrence pattern appropriately:

Code:
int fromDay = (int)((e.getOldStartTime().getTicks() - e.getOldStartTime().getTimeOfDay().getTicks()) / Duration.TicksPerDay);
int toDay = (int)((e.getItem().getStartTime().getTicks() - e.getItem().getStartTime().getTimeOfDay().getTicks()) / Duration.TicksPerDay);
if (fromDay != toDay)
	e.getItem().getRecurrence().setStartDate(e.getItem().getRecurrence().getStartDate().addDays(toDay - fromDay)); 


I hope this help.

Regards,
Meppy
 
 
 
IP Logged    
 
     

Ionut Murarasu   Offline
YaBB Newbies
*
Posts: 6
I Love MindFusion!


   
     
 
Re: Recurrence
Reply #5 - Jul 4th, 2017 at 2:10pm
 
Thanks for your answer.

I have one more little problem. When I try to remove a recurring appointment, all items are removed without the first one from where series started.

See print screen in the attachment.

In the first image I tried to remove the second appointment but almost all was removed without the first one. Also in the first item the recurring icon was removed and become non recurring.

Can you help me please with a solution to remove the entire series ?

I added this code to remove the recurring

@Override
public void itemDeleted(ItemEvent e) {
     super.itemDeleted(e);
     
     if (e.getItem().getRecurrenceState() == RecurrenceState.Exception) {
           Item master = e.getItem().getRecurrence().getMaster();
           master.setRecurrence(null);
     }
}
 
 

rec1.JPG (40 KB | 10 )
rec1.JPG
 
IP Logged    
 
     

Meppy   Offline
YaBB Moderator
*****
Posts: 1755
Gender: male
MindFusion support


   
     
 
Re: Recurrence
Reply #6 - Jul 5th, 2017 at 7:04am
 
Hi,

You need to also remove the master item from the schedule:

Code:
calendar.getSchedule().getItems().remove(master); 


Regards,
Meppy
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print