summaryrefslogtreecommitdiff
path: root/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-29 09:45:05 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-29 09:45:05 +0000
commit23f73e3ea0ea04325f132c54d3a1349ed34f0e8a (patch)
treeaed41c0fdfac3b09c474c2c5f93f9e62c266d326 /extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas
parent475482d47ccc2b9fb74e0cc933716bc5f4a573cf (diff)
downloadfpGUI-23f73e3ea0ea04325f132c54d3a1349ed34f0e8a.tar.xz
* Minor fix in docs.
* Ported tiOPF2 Demos 06 and 07 to fpGUI.
Diffstat (limited to 'extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas')
-rw-r--r--extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas81
1 files changed, 81 insertions, 0 deletions
diff --git a/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas b/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas
new file mode 100644
index 00000000..49195b48
--- /dev/null
+++ b/extras/tiopf/demos/Demo_07_VisitorBasics/Client_BOM.pas
@@ -0,0 +1,81 @@
+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.
+
+
+