yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
60
Quintiq file version 2.0
#parent: ListLibOpt_BT_UICustomSetting/DataHolderOwner
Response OnCreated () id:Response_ListLibOpt_BT_UICustomSetting_DataHolderOwner_OnCreated
{
  #keys: '[139544.1.1248681456]'
  Body:
  [*
    owner := construct( shadow[LibOpt_UIOwner] ); 
    
    type := typeof( LibOpt_BT_CustomSetting );
    
    allowed_args := construct( structured_Type );
    allowed_args.Add( typeof( LibOpt_Optimizer ) );
    allowed_args.Add( typeof( LibOpt_Optimization ) );
    
    tv := type.TypeView();
    stats := selectset( tv, Statics, stat,
                        stat.Arguments( relsize ) = 1 and
                        allowed_args.Find( stat.Arguments( relget ).Element( 0 ).ElementType() ) >= 0 );
    
    instance := Dialog.Data().WrappedInstance();
    levels := instance.GetSettingsAncestors();
    
    levels.Add( instance );
    existing := selectset( levels, Elements.CustomSetting, cs, true );
    traverse( existing, Elements, cs )
    {
      stat := select( stats, Elements, stat, 
                      stat.Name() = cs.MethodName()
                      and stat.Arguments( relget ).Element( 0 ).ElementType().Name() = cs.ArgumentType() );
      owner.UICustomSetting( relnew, MethodName := cs.MethodName(),
                                     ArgumentType := cs.ArgumentType(),
                                     Description := guard( stat.Description(), '' ),
                                     CanMove := cs.TrackingTableBase() = instance,
                                     DefinedOn := cs.TrackingTableBase().GetName(),
                                     IsCreated := true
                                     );
    }
    
    // Find non-existing
    set := selectvalues( existing, Elements, cs, true, cs.MethodName() + '(' + cs.ArgumentType() + ')' );
    
    traverse( stats, Elements, stat )
    {
      arg := stat.Arguments( relget ).Element( 0 );
      if( set.Find( stat.Name() + '(' + arg.ElementType().Name() + ')' ) < 0 )
      {
        owner.UICustomSetting( relnew, MethodName := stat.Name(),
                                       ArgumentType := arg.ElementType().Name(),
                                       Description := stat.Description(),
                                       CanMove := true,
                                       IsCreated := false );
      }
    }
    
    this.Data( & owner );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_GUIComponent_OnCreated'
}