unit uDADBSessionManagerEditor; {----------------------------------------------------------------------------} { Data Abstract Library - IDE Library { { compiler: Delphi 6 and up, Kylix 3 and up { platform: Win32, Linux { { (c)opyright RemObjects Software. all rights reserved. { { Using this code requires a valid license of the Data Abstract { which can be obtained at http://www.remobjects.com. {----------------------------------------------------------------------------} {$IFDEF MSWINDOWS} {$I ..\DataAbstract.inc} {$ENDIF MSWINDOWS} {$IFDEF LINUX} {$I ../DataAbstract.inc} {$ENDIF LINUX} interface uses Classes, DesignIntf, DesignEditors, uDAClasses; type TDASchemaItemListEditor = class(TStringProperty) protected function GetSchema: TDASchema; virtual; public function GetAttributes: TPropertyAttributes; override; procedure SetValue(const Value: string); override; property Schema: TDASchema read GetSchema; end; TDASchemaCommandListEditor = class(TDASchemaItemListEditor) public procedure GetValues(Proc: TGetStrProc); override; end; TDASchemaDataSetListEditor = class(TDASchemaItemListEditor) public procedure GetValues(Proc: TGetStrProc); override; end; TDARemoteServiceDataSetListEditor = class(TDASchemaDataSetListEditor) protected function GetSchema: TDASchema; override; end; TDARemoteServiceCommandListEditor = class(TDASchemaCommandListEditor) protected function GetSchema: TDASchema; override; end; TDASchemaCommandAndDataSetListEditor = class(TDASchemaItemListEditor) public procedure GetValues(Proc: TGetStrProc); override; end; TDASchemaConnectionsListEditor = class(TDASchemaItemListEditor) public procedure GetValues(Proc: TGetStrProc); override; end; implementation uses uDADBSessionManager, Dialogs, DARemoteService_Impl; { TDASchemaItemListEditor } function TDASchemaItemListEditor.GetAttributes: TPropertyAttributes; begin result := [paValueList, paSortList] end; function TDASchemaItemListEditor.GetSchema: TDASchema; begin result := (GetComponent(0) as TDADBSessionManager).Schema; end; procedure TDASchemaItemListEditor.SetValue(const Value: string); begin inherited; end; { TDASchemaCommandListEditor } procedure TDASchemaCommandListEditor.GetValues(Proc: TGetStrProc); var i: integer; begin if Assigned(Schema) then begin for i := 0 to Schema.Commands.Count - 1 do begin Proc(Schema.Commands[i].Name); end; end; end; { TDASchemaDataSetListEditor } procedure TDASchemaDataSetListEditor.GetValues(Proc: TGetStrProc); var i: integer; begin if Assigned(Schema) then begin for i := 0 to Schema.Datasets.Count - 1 do begin Proc(Schema.Datasets[i].Name); end; end; end; { TDASchemaCommandAndDataSetListEditor } procedure TDASchemaCommandAndDataSetListEditor.GetValues(Proc: TGetStrProc); var i: integer; begin if Assigned(Schema) then begin for i := 0 to Schema.Datasets.Count - 1 do begin Proc(Schema.Datasets[i].Name); end; if (Schema.Datasets.Count > 0) and (Schema.Commands.Count > 0) then Proc('---'); for i := 0 to Schema.Commands.Count - 1 do begin Proc(Schema.Commands[i].Name); end; end; end; { TDASchemaConnectionsListEditor } procedure TDASchemaConnectionsListEditor.GetValues(Proc: TGetStrProc); var i: integer; begin if Assigned(Schema) and Assigned(Schema.ConnectionManager) then begin for i := 0 to Schema.ConnectionManager.Connections.Count - 1 do begin Proc(Schema.ConnectionManager.Connections[i].Name); end; end; end; { TDARemoteServiceDataSetListEditor } function TDARemoteServiceDataSetListEditor.GetSchema: TDASchema; begin result := (GetComponent(0) as TDARemoteService).ServiceSchema; end; { TDARemoteServiceCommandListEditor } function TDARemoteServiceCommandListEditor.GetSchema: TDASchema; begin result := (GetComponent(0) as TDARemoteService).ServiceSchema; end; end.