Module deodlgmx.pkg
1//****************************************
2//
3// DEO Delegate Mixin class
4//
5// Allows for automatic delegation of standard data base operations in DEOs.
6// Also adds database operation support to clients.
7//
8// 04-08-94 LS First attempt.
9// 09/02/94 JJT Added request_save_no_clear.
10// Modifed changed_state to return should_save (as
11// all other objects do.
12// LS Undid changed_state modification.
13// 12/20/94 JJT Moved Explicit_server to Server.pkg
14// Create single deo_delegate_mixin for DEO controls and
15// containers.
16// Created Messages Should_delegate_save, _clear, _delete
17// and _find.
18// Moved all request_ out ofthis package and placed them
19// in the appropriate DEO class.
20// 4-11-95 LS Changed should delegate to check to see delegated object is
21// server instead of current object; was causing request_save to
22// be delegated to data_sets when deos were nested in them (as
23// in a DFAuto program). This meant that request_validate
24// wasn't being sent (since data_sets don't send request_validate
25// during request_save).
26// 05/22/95 JJT - created desktop messages Get_object_Validation and
27// Set_Object_Validation. See comments below for reasons
28// 09/04/95 JJT - Code Clean up (removed dead commented code)
29//****************************************
30
31//****************************************
32// Augmented Messages: None (all right!)
33//****************************************
34
35use VDFBase.pkg
36
37enum_list
38 define DELEGATE_NEVER
39 define DELEGATE_SERVER
40 define DELEGATE_ALWAYS
41end_enum_list
42
43// JJT: 8/28/2002 - Removed for 8.3 This was way too complicated and nobody ever chagned the
44// default delegate mode via this global anyway. Just set the default in the mixin. If you want
45// to change this, do it is sub-classes (and you will never want to change this).
46
47//integer default.deo.delegate.mode
48//
49//move DELEGATE_SERVER to default.deo.delegate.mode
50//
51////Doc/ MethodType=Property Visibility=Public
52//procedure set default_deo_delegate_mode for desktop integer val
53// move val to default.deo.delegate.mode
54//end_procedure
55//
56////Doc/ MethodType=Property Visibility=Public
57//function default_deo_delegate_mode for desktop returns integer
58// function_return default.deo.delegate.mode
59//end_function
60
61register_function component_state returns integer
62
63class deo_delegate_mixin is a mixin
64 { Visibility=Private }
65 procedure define_deo_delegate
66
67// See above notes
68// property integer deo_delegate_mode public (default_deo_delegate_mode(desktop))
69 { EnumList="Delegate_Never, Delegate_Server, Delegate_Always" }
70 { Category=Data }
71 property integer DEO_Delegate_Mode Delegate_Server
72
73 { Visibility=Private }
74 property integer delegate_clear_state TRUE
75
76 { Visibility=Private }
77 property integer delegate_delete_state TRUE
78
79 { Visibility=Private }
80 property integer delegate_find_state FALSE
81
82 { Visibility=Private }
83 property integer delegate_save_state TRUE
84 end_procedure
85
86 { Visibility=Private }
87 function should_delegate returns integer
88 integer Mode Dlg_Obj
89
90 delegate get Object_Id to Dlg_Obj
91 get Deo_Delegate_Mode to Mode
92 function_return ( (((Mode = DELEGATE_SERVER) and ;
93 not(Explicit_Server_State(Self)) and ;
94 (Locate_Server(Self) <> Dlg_Obj)) or ; // don't delegate if the object to delegate to is a server.
95 (Mode = DELEGATE_ALWAYS)) and Component_State(Self))
96 end_function
97
98 { Visibility=Private }
99 Function Should_delegate_Clear returns integer
100 Function_Return (should_delegate(Self) and ;
101 delegate_clear_state(Self))
102 End_function
103
104 { Visibility=Private }
105 Function Should_delegate_Save returns integer
106 Function_Return (should_delegate(Self) and ;
107 delegate_Save_state(Self))
108 End_function
109
110 { Visibility=Private }
111 Function Should_delegate_Delete returns integer
112 Function_Return (should_delegate(Self) and ;
113 delegate_delete_state(Self))
114 End_function
115
116 { Visibility=Private }
117 Function Should_delegate_Find returns integer
118 Function_Return (should_delegate(Self) and ;
119 delegate_Find_state(Self))
120 End_function
121
122End_Class
123
124// Added: 05/22/95 JJT
125//
126// During a clear (or a save/delete which sends clear) object-validation is
127// properly shut off. However, the false assumption had been made that the
128// DEO request_clear/clear_all messages originated with the object that had
129// the focus. This was never true and is now even less likely to be true
130// with the request_??? delegation method. The proper solution is to shut
131// off object-validation in the focus object. The problem here is that
132// the focus object may not understand this message (text_windows, buttons,
133// etc). The work-around for now is to make sure that all objects understand
134// these message. We can not directly add an Object_Validation message to the
135// desktop (Object class). Because this message is internal this didn't work.
136// By default this does nothing. Objects using val_mx actually pass this on
137// object_validation.
138
139{ MethodType=Property Visibility=Private }
140Procedure Set Object_Item_validation for cUIObject integer fg
141End_Procedure
142
143{ MethodType=Property Visibility=Private }
144Function Object_Item_Validation for cUIObject returns integer
145End_Function
146
147