Update of /cvsroot/instantobjects/Source/Core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32480/Core
Modified Files:
InstantConnectionManager.pas
Log Message:
Ability to customize loading and saving connectiondefs: retouch
Index: InstantConnectionManager.pas
===================================================================
RCS file: /cvsroot/instantobjects/Source/Core/InstantConnectionManager.pas,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** InstantConnectionManager.pas 26 Jun 2005 14:28:20 -0000 1.15
--- InstantConnectionManager.pas 30 Jun 2005 08:49:35 -0000 1.16
***************
*** 82,87 ****
function GetConnectionDefs: TInstantConnectionDefs;
function GetModel: TInstantModel;
- procedure SetFileName(const Value: string);
procedure SetFileFormat(const Value: TInstantStreamFormat);
procedure SetModel(Value: TInstantModel);
procedure SetOnBuild(Value: TInstantConnectionDefEvent);
--- 82,87 ----
function GetConnectionDefs: TInstantConnectionDefs;
function GetModel: TInstantModel;
procedure SetFileFormat(const Value: TInstantStreamFormat);
+ procedure SetFileName(const Value: string);
procedure SetModel(Value: TInstantModel);
procedure SetOnBuild(Value: TInstantConnectionDefEvent);
***************
*** 96,99 ****
--- 96,109 ----
function GetDefsFileName: string;
protected
+ // Sets FileFormat based on FileName.
+ procedure SetFileFormatFromFileName;
+ // Called when FileName changes. The default implementation calls
+ // SetFileFormatFromFileName and LoadConnectionDefs to auto-load the
+ // connection definitions.
+ // This method may be overridden to skip auto-loading in cases where
+ // more than just the file name is needed in order to call
+ // LoadConnectionDefs.
+ procedure AfterFileNameChange; virtual;
+ // Fully qualified FileName.
property DefsFileName: string read GetDefsFileName;
// Creates and returns a stream to read the connectiondefs data from.
***************
*** 181,193 ****
if Value <> FFileName then
begin
- if SameText(ExtractFileExt(Value), '.xml') then
- FFileFormat := sfXML
- else
- FFileFormat := sfBinary;
FFileName := Value;
! LoadConnectionDefs;
end;
end;
procedure TInstantConnectionManager.SetFileFormat(
const Value: TInstantStreamFormat);
--- 191,213 ----
if Value <> FFileName then
begin
FFileName := Value;
! AfterFileNameChange;
end;
end;
+ procedure TInstantConnectionManager.SetFileFormatFromFileName;
+ begin
+ if SameText(ExtractFileExt(FFileName), '.xml') then
+ FFileFormat := sfXML
+ else
+ FFileFormat := sfBinary;
+ end;
+
+ procedure TInstantConnectionManager.AfterFileNameChange;
+ begin
+ SetFileFormatFromFileName;
+ LoadConnectionDefs;
+ end;
+
procedure TInstantConnectionManager.SetFileFormat(
const Value: TInstantStreamFormat);
|