Class: server_mixin

Module location: Server.pkg line 153 (view source)

Class Hierarchy:

cObjectMixinserver_mixin

Class Definition

Properties

IntegerAdd_focus_msg
by dflt no message
IntegerAuto_Fill_State
**JJT**(4) - moved logic to create broadcasters elsewhere. Only created if needed now move (make_broadcaster(DESKTOP)) to obj# set Watched_Servers to obj# set broadcast_state of obj# to TRUE
IntegerChange_Disabled_State
(JJT) Since this package's SET changed_state is using change_ disabled_state we might as well define it here. This gets changed by Clear_mx to support setting of defaults without changing the objects changed_state. This stops changed_state from getting changed. It allows item_changed_ state to chagne without the object's changed_state getting changed. This should be considered protected (i.e., likely to change). The new messages Entry_Defaults and Set Default_Value are both public and use this. Try to use these messages instead of this property.
IntegerDeferred_State
integerexplicit_server_state
(JJT) added to support DEO request-delegation. This is set true if the server is explicitly set in this DEO (normally via a USING parameter).
integerprivate.Server
integerprivate.Servers_Scanned
IntegerRefresh_dirty_state
**JJT**(3) new properties to better support tables. If Refresh_dirty_state is true then the list object needs refreshing (because it was inactive and changes were made that were not updated). After add_focus is complete the add_focus_msg is sent (allows tables to initialize the list). when not active/dirty
IntegerStatic_Server_State
integerWatched_Servers

Functions and Procedures

IntegerAdd_Focus(Handle hoParent)
Removed server scan logic and moved it to attach-deo_to_server
add_watched_server(integer obj#)
Description This procedure adds the specified object id (obj#) to this object's set of database agents who are merely 'watched', and establishes a connection between the database agent and this object. Assumptions/Preconditions This object must understand Active_State. Exceptions None. Notes None.
Attach_Deo_To_Server()
**JJT**(2) --- Start of changes Added server scan logic here instead of add_focus.
Connect_DEOs_to_Servers(Integer DoAllFg)
Connect DEO to Server if Demanded (DoAllfg=t) or ; allowed (static_server_State=t). Broadcast if children exist
Copy_Item_Options(Integer iDSO Integer iFile Integer iField Integer iDEO Integer iItem)
**JJT**(5) - Added for Xds Support This does nothing. Other sub-classes (or later mixins) should add logic to this.
IntegerDefault_Static_Server_State()
When an object is created this sets the default value for Static_Server_state. If a parent DEO exists it will use its static_server_state property. An Entry_view_Client0 object sets this - this way view based daf programs will use the new behavior (although it can be disabled) but non-daf programs will work like they always did.
Define_Extended_DEO_Mixin()
**JJT**(5) - Added for Xds Support This does little. Other sub-classes (or later mixins) should add logic to this.
define_server()
Description This procedure defines the properties which are required to support a server-object for database access. Assumptions/Preconditions The global function MAKE_BROADCASTER must be defined to return the object id of a new instance of the Broadcaster class (see BRDCSTER.PKG). Exceptions None. Notes Server is the object id of the database agent for this object. Watched_Servers is a set of object ids for database agents whose state must also be monitored by this object (but which never receive requests directly from this object, unlike the Server). Servers_Scanned determines if the items of this object have been scanned to see if this object should be connected to other database agents as 'just watching' (see Watched_Servers, above). Auto_Fill_State determines if this object should always automatically fill itself with data when it is activated. Deferred_State determines if this object's browsing in database files should be reflected immediately in this object's database agent (and the agents' agents, etc.), or not.
delete_watched_servers()
Description This procedure empties the Watched_Servers broadcaster, after detaching this object from all of the broadcaster's elements. Assumptions/Preconditions None. Exceptions None. Notes This procedure is invoked by Find_Servers_to_Watch, in preparation for a scan.
Destroy()
**JJT**(2) - Moved procedure SET Changed_State integer newVal integer srvr# forward set Changed_State to newVal get server to srvr# if (newVal AND srvr#) set Changed_State of srvr# to TRUE if (newVal) set Changed_State of (Watched_Servers(self)) to TRUE if (not(newVal) AND not(Active_State(self))) ; send remove_DEO_from_Server end_procedure (JJT) Moved to Val_mx function validate_items integer flag returns integer integer retval oldautotop forward get validate_items flag to retval if (retval <> 0 AND focus(desktop) <> self) begin get auto_top_item_state to oldautotop set auto_top_item_state to false send activate //take focus w/out changing current_item set auto_top_item_state to oldautotop end function_return retval end_function ************************************************************************ Servmod.Pkg Version: 1.0 04-22-1992 : Created Author: John J. Tuohy Mod for Server.pkg package 04-22-1992 Altered to fix watched server bug 07-07-1992 Altered for 3.01 to destroy bcaster after the object. Suggested by Doug G. and Bob W. 09-12-1992 Altered to support reverse order child destruction using new desktop procedure request_destroy_children. ************************************************************************ This only gets called when the developer is killing this object. During application shut-down, only destroy_object is called. This augmentation destroys the watched broadcaster (which is sitting on the desktop). During program shut down we don't care if this is called because it is getting destroyed anyway. We are making the assumption that a developer controlled destroy will always be called with the watcher still existing.
Disconnect_DEOs_from_Servers(Integer DoAllMode)
Disconnect DEOs from Servers according to rules. Broadcast to child components. Pass: DoAllMode DETACH_NEVER Never DETACH_IF_NO_CHANGE Do if changed_state=F DETACH_ALWAYS Do it no matter what DETACH_IF_ALLOWED Do if changed_state=F and auto_attach (I don't think this will be needed!)
integerFind_Server()
Description This procedure adds this object into the focus-tree as a child of the specified toObj#, and also add the child-objects of this object into the focus-tree as children of this object. If necessary, it also scans the fields of this object's items to determine which database agents to 'watch', and creates a connection between this object and its database agents. Assumptions/Preconditions This object must understand Client_Area_State. Exceptions None. Notes Client-objects already automatically add their children into the focus- tree. **JJT**(2) - Moved procedure add_focus integer toObj# returns integer integer srvscn retval // // standard DEO behavior // forward get msg_add_focus toObj# to retval if retval procedure_return retval if (client_area_State(self) = 0) ; //clients already broadcast broadcast NO_STOP send add_focus self // // server augmentation // get private.Servers_Scanned to srvscn if srvscn eq 0 send scan_servers if (focus_mode(self) <> NO_ACTIVATE AND Active_State(self)) ; send attach_DEO_to_server end_procedure Description This procedure removes this object from the focus-tree, and disconnects it from its database agents, if any. Assumptions/Preconditions This object must understand Changed_State. Exceptions If this object has been changed, it will not be detached from its database agents until the changes are saved or abandoned. Notes Opposite of Add_Focus. **JJT**(2) - Moved procedure remove_object forward send remove_object if (Changed_State(self) = 0) ; //only detach if unchanged! send remove_DEO_from_server end_procedure Description This function returns the object id of the database server which encloses this object, if any. Note that only the Data_Set class defines this function to return anything other than 0. Assumptions/Preconditions None. Exceptions None. Notes This function is used with delegation to locate the Data_Set which is the closest parent of this object.
find_servers_to_watch(integer tableFlag)
**JJT**(4) - Major change to optimize and not use watched server if not needed! Description This procedure scans the fields of this object's items to determine what other database agents (data_sets) other than this object's Server should be 'watched' (for data changes). Assumptions/Preconditions tableFlag is a boolean determining whether this object relies on a prototype row (TRUE) or an item list (FALSE). This object must understand Client_Area_State, and have a private boolean property named Private.Servers_Scanned to note the event. Exceptions None. Notes This procedure is invoked once per object, the first time the object is activated. If the data_file, data_field, and/or main_file of this object are changed (don't change them while this object is active!), set Private.Servers_Scanned to FALSE to force this object to scan again (when it is next activated).
integerLocate_Server()
Description This function returns the object id of the database agent of this object, or 0. Assumptions/Preconditions None. Exceptions None. Notes See the Server function. below.
Mark_As_Component()
created for Nesting support
remove_deo_from_server()
Description This procedure establishes a connection between this object and its database agent(s) (Server and Watched_Servers). Assumptions/Preconditions This object must understand Client_Area_State; its database agent(s) must understand Add_User_Interface. Exceptions If this object has no database agents, no action is taken. Notes During the establishment of the connection, the database agent(s) may direct this object to Display or Clear, depending on the state of the record buffers and Auto_Fill_State. **JJT**(2) - Moved procedure attach_deo_to_server integer obj# isclient get Server to obj# get client_area_state to isclient if (obj# <> 0 AND isclient = 0) ; send add_user_interface to obj# self if isclient eq 0 send add_user_interface ; to (Watched_Servers(self)) self if (obj# <> 0 AND isclient = 0) send update_dependent_items end_procedure Description This procedure discontinues the connection between this object and its database agent(s) (Server and Watched_Servers). Assumptions/Preconditions This object must understand Client_Area_State; its database agent(s) must understand Remove_User_Interface. Exceptions If this object has no database agents, no action is taken. Notes None.
Remove_Object()
Changed to not remove from server if static.
remove_watched_server(integer obj#)
Description This procedure removes the specified object id (obj#) from this object's set of database agents who are merely 'watched', and destroys the connection between the database agent and this object. Assumptions/Preconditions This object must understand Active_State. Exceptions None. Notes None.
Scan_Servers()
Description This procedure causes the scanning of this object's items' fields, and the production of a set of database agents who should be 'watched'. Assumptions/Preconditions None. Exceptions None. Notes This procedure depends completely upon Find_Servers_To_Watch, below.
integerServer()
Description This function returns the object id of the database agent of this object, or 0. Assumptions/Preconditions This object must understand Component_State. Exceptions If this object's Server is 0, this object's parent's Server is returned, if any. Notes This function is used to allow nested data-entry objects to use the database agent defined by their parent object.
server_changed(integer oldVal integer newVal)
Description This procedure servers as notification of a change in the connection of this object's parent to its database agent. If this object uses its parent's database agent by default (see the Server and Find_Server functions, above), it must disconnect from the old agent and connect with the new agent. Assumptions/Preconditions This object must understand Client_Area_State. Exceptions None. Notes None.
set(integer newVal)
Description This procedure sets the value of the Server property of this object, notifying child-objects of the change, and destroying and creating connections with database agents, as required. Assumptions/Preconditions This object must understand Active_State. Exceptions If the Server of this object is changed while this object is inactive, no notification of child-objects is required or performed. Notes None.
SET(Integer newVal)
(JJT) Changed so that this respects Change_disabled_state. I don't like this here but its the best I can think of. Therefore, all objects using server.pkg must understand Change_disabled_state. 12/27/94 (JJT) Checks deferred_state and if set do not change the changed state of the server object. This had been in datalist and is required to make deferred_state work right. Deferred_state was created to make selection-lists work correctly and as far as I am concerned it should be the only supported use of this. Therefore, I would not *ever* expect deferred_state to be set true in tables, entry_forms, or text_ windows. Since deferred-state is known to this mixin the change belongs here - but I expect it to only ever change behaviors in selection-lists. Changed to not remove from server if static.
IntegerShould_Save()
(LS) moved into server.pkg from various pkgs.