From ff7f64d95ca92b644e0d66e2195a69344895b2ce Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 14 Oct 2010 12:29:19 +0200 Subject: Moved tiOPF related units into the tiOPF repository. It makes more sense to have the tiOPF related units with the rest of the tiOPF. It's easier to keep changes in sync, and have atomic commits across the various GUI toolkits supported by tiOPF. --- .../demos/Demo_07_VisitorBasics/Client_BOM.pas | 81 ------------- .../tiopf/demos/Demo_07_VisitorBasics/demo_07.lpi | 70 ----------- .../tiopf/demos/Demo_07_VisitorBasics/demo_07.lpr | 39 ------ .../tiopf/demos/Demo_07_VisitorBasics/frm_main.pas | 131 --------------------- 4 files changed, 321 deletions(-) delete mode 100644 extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas delete mode 100644 extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpi delete mode 100644 extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpr delete mode 100644 extras/tiopf/demos/Demo_07_VisitorBasics/frm_main.pas (limited to 'extras/tiopf/demos/Demo_07_VisitorBasics') diff --git a/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas b/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas deleted file mode 100644 index 49195b48..00000000 --- a/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas +++ /dev/null @@ -1,81 +0,0 @@ -unit Client_BOM; - -interface -uses - tiObject - ,tiOID - ,tiOIDGUID - ,tiVisitor - ; - -type - - TClient = class; - TClientList = class; - - TClientName = String[200]; - TClientID = String[9]; - - TClientList = class(TtiObjectList); - - - TClient = class(TtiObject) - private - FClientID: TClientID; - FClientName: TClientName; - published - property ClientName: TClientName read FClientName write FClientName; - property ClientID : TClientID read FClientID write FClientID; - end; - - - TClientVisitor = class(TtiVisitor) - protected - function AcceptVisitor: boolean; override; - public - procedure Execute(const AVisited: TtiVisited); override; - end; - - -procedure RegisterMappings; - - -implementation -uses - tiOPFManager - ,tiAutoMap - ,tiConstants - ,tiDialogs - ; - -procedure RegisterMappings; -begin - // Class, Table, Property, Column, Special Info - gTIOPFManager.ClassDBMappingMgr.RegisterMapping(TClient, 'Client', 'OID', 'OID', [pktDB]); - gTIOPFManager.ClassDBMappingMgr.RegisterMapping(TClient, 'Client', 'ClientName', 'Client_Name' ); - gTIOPFManager.ClassDBMappingMgr.RegisterMapping(TClient, 'Client', 'ClientID', 'Client_ID' ); - gTIOPFManager.ClassDBMappingMgr.RegisterCollection(TClientList, TClient); -end; - -{ TClientVisitor } - -function TClientVisitor.AcceptVisitor: boolean; -begin - // Put the code to check if this visitor should act on this object in here. - Result:= Visited is TClient; - // Remove this line and the visitor will touch the TClientList object - // as well as it's owned TClient objects. -end; - -procedure TClientVisitor.Execute(const AVisited: TtiVisited); -begin - inherited; - if not AcceptVisitor then - Exit; - tiShowMessage((Visited as TtiObject).AsDebugString); -end; - -end. - - - diff --git a/extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpi b/extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpi deleted file mode 100644 index 10179042..00000000 --- a/extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpi +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpr b/extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpr deleted file mode 100644 index 125dd248..00000000 --- a/extras/tiopf/demos/Demo_07_VisitorBasics/demo_07.lpr +++ /dev/null @@ -1,39 +0,0 @@ -program demo_07; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, fpg_main, frm_main, tiOIDGUID, tiOPFManager, Client_BOM; - - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - - // Change the connection string to suite your database location - // ** Remote connection - //gTIOPFManager.ConnectDatabase('192.168.0.54|/home/graemeg/programming/data/tiopf.fdb', 'sysdba', 'masterkey'); - // ** Local connection - //gTIOPFManager.ConnectDatabase('/home/graemeg/programming/data/tiopf.fdb', 'sysdba', 'masterkey'); - - frm := TMainForm.Create(nil); - try - frm.Show; - fpgApplication.Run; - finally - frm.Free; - //gTIOPFManager.DisconnectDatabase; - //gTIOPFManager.Terminate; - end; -end; - -begin - MainProc; -end. - - diff --git a/extras/tiopf/demos/Demo_07_VisitorBasics/frm_main.pas b/extras/tiopf/demos/Demo_07_VisitorBasics/frm_main.pas deleted file mode 100644 index 8a10f2df..00000000 --- a/extras/tiopf/demos/Demo_07_VisitorBasics/frm_main.pas +++ /dev/null @@ -1,131 +0,0 @@ -unit frm_main; - -{$mode objfpc}{$H+} - -interface - -uses - SysUtils, Classes, - fpg_main, fpg_form, fpg_button, - Client_BOM; - -type - - TMainForm = class(TfpgForm) - private - FClientList: TClientList; - procedure btnAddClientClick(Sender: TObject); - procedure btnShowListClick(Sender: TObject); - procedure btnRunClientVisitorClick(Sender: TObject); - public - {@VFD_HEAD_BEGIN: MainForm} - btnAddClient: TfpgButton; - btnShowList: TfpgButton; - btnRunClientVisitor: TfpgButton; - {@VFD_HEAD_END: MainForm} - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure AfterCreate; override; - end; - -{@VFD_NEWFORM_DECL} - -implementation - -uses - tiUtils - ,tiDialogs - ,tiOPFManager - ; - -{@VFD_NEWFORM_IMPL} - -procedure TMainForm.btnAddClientClick(Sender: TObject); -var - lClient: TClient; -begin - lClient := TClient.Create; - lClient.OID.AsString := IntToStr(tiGetTickCount); // Not how you do it in real life! - lClient.ClientName := 'Test ' + DateTimeToStr(Now); - lClient.ClientID := IntToStr(tiGetTickCount); - FClientList.Add(lClient); -end; - -procedure TMainForm.btnShowListClick(Sender: TObject); -begin - tiShowString(FClientList.AsDebugString); -end; - -procedure TMainForm.btnRunClientVisitorClick(Sender: TObject); -var - lVis: TClientVisitor; -begin - lVis := TClientVisitor.Create; - try - FClientList.Iterate(lVis); - finally - lVis.Free; - end; -end; - -constructor TMainForm.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FClientList := TClientList.Create; -end; - -destructor TMainForm.Destroy; -begin -// FClientList.Save; - FClientList.Free; - inherited Destroy; -end; - -procedure TMainForm.AfterCreate; -begin - {@VFD_BODY_BEGIN: MainForm} - Name := 'MainForm'; - SetPosition(854, 117, 244, 166); - WindowTitle := 'Visitor Basics'; - WindowPosition := wpScreenCenter; - Sizeable := False; - - btnAddClient := TfpgButton.Create(self); - with btnAddClient do - begin - Name := 'btnAddClient'; - SetPosition(68, 24, 107, 24); - Text := 'Add client'; - FontDesc := '#Label1'; - ImageName := ''; - OnClick := @btnAddClientClick; - end; - - btnShowList := TfpgButton.Create(self); - with btnShowList do - begin - Name := 'btnShowList'; - SetPosition(68, 56, 107, 24); - Text := 'Show list'; - FontDesc := '#Label1'; - ImageName := ''; - OnClick := @btnShowListClick; - end; - - btnRunClientVisitor := TfpgButton.Create(self); - with btnRunClientVisitor do - begin - Name := 'btnRunClientVisitor'; - SetPosition(68, 88, 107, 24); - Text := 'Run client visitor'; - FontDesc := '#Label1'; - ImageName := ''; - OnClick := @btnRunClientVisitorClick; - end; - - {@VFD_BODY_END: MainForm} -end; - - -end. - -- cgit v1.2.3-70-g09d2