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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Quintiq file version 2.0
#parent: ndCalendarElement
Response OnDraw (
  CalendarElement element
) id:Response_LibCal_gcResourceCalendars_ndCalendarElement_OnDraw
{
  #keys: '[131094.1.547629094]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebGanttChartNode_OnDraw'
  QuillAction
  {
    Body:
    [*
      // CalendarElement; draw the backgroundcolor of the node based on the capacity.
      // The color cannot be determined base on the EventType, because that is not available here.
      // As a consequence 'Partial' with Capacity = 0.0 is visualized as 'Unavailable' and
      // 'Partial' with Capacity = 1.0 is visualized as 'Available' here, while the TimeIntervals
      // that define the CalendarElement are still shown as 'Partial'.
      // But having 'Partial' with 0.0 or 1.0 is considered to be an edge-case. 
      
      showOccurrences := not isnull( dhShowOccurrences.Data() );
      
      // Show white as light yellow because the backgroundcolor of the row is white and cannot be changed.
      white := Color::Color( 255, 255, 204 );  // Light yellow
      
      if( element.Capacity() = 0.0 )       // Unavailable
      {
        drawinfo.BackgroundColor( Color::LightGray() );
      }
      else if( element.Capacity() = 1.0 )  // Available (for completeness, is filtered out)
      {                                    // DevNote: are currently NOT filtered out because the 'white' needs to be shown.
        if( not showOccurrences )          // Filter of ndCalendarElement can be added back when real White can always be used.
        {
          drawinfo.BackgroundColor( white );
        }
        else
        {
          drawinfo.BackgroundColor( Color::White() );
        }  
      }
      else                                 // Partially available
      {
        // Show the CalendarElement in light gray when the events are not shown individually,
        // otherwise show the CalendarElement as 'white' (i.e. light yellow). In that case, partial capacity is visualized
        // by a different node that shows the occurrence (i.e. an ExplicityTimeInterval).
        if( not showOccurrences )
        {
          backgroundColor := Color::Interpolate( Color::Gray(), white, 0.7 );  // Grayish yellow
          drawinfo.BackgroundColor( backgroundColor );
        }
        else
        {
          drawinfo.BackgroundColor( Color::White() );
        }
      }
    *]
    GroupServerCalls: false
  }
}