haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Quintiq file version 2.0
#parent: #root
Method Initialize
{
  Description:
  [*
    Initialize the calendar.
    Is automatically called when a calendar is created, can be explicitly called to initialize an already existing calendar for the Calendar Library.
  *]
  TextBody:
  [*
    // Set the CalendarType.
    this.SetCalendarType();
    
    // Set the CalendarID if it has not already been set (by the import-mechanism).
    if( this.CalendarID() = "" )
    {
      this.SetCalendarID();
    }
    
    // Initialize the settings.
    this.InitializeSettings();
    
    // Explicitly calculate End.
    Transaction::Transaction().Propagate( attribute( LibCal_Calendar, End ) );
    
    // Let the calendar start closed.
    this.StartClosed();
    
    // Initialize the attributes that are used for detecting that the calendar window has been moved.
    this.CalcStartDate();
    this.CalcEndDate();
    this.PreviousStartDate( this.StartDate() );
    this.PreviousEndDate(   this.EndDate()   );
    
    // Let the calendar subscribe to default events.
    this.SubscribeToDefaultEvents();
    
    // Initialize the events of the calendar.
    // InitializeEvents() can be be overridden to implement specific events for the calendar,
    // either by creating them or by subscribing to events from other calendars.
    this.InitializeEvents();
  *]
}