184 lines
4.5 KiB
ObjectPascal
184 lines
4.5 KiB
ObjectPascal
unit uROIDEEditors;
|
|
|
|
{----------------------------------------------------------------------------}
|
|
{ RemObjects SDK Library - IDE Integration
|
|
{
|
|
{ compiler: Delphi 6 and up
|
|
{ platform: Win32, Linux
|
|
{
|
|
{ (c)opyright RemObjects Software. all rights reserved.
|
|
{
|
|
{ Using this code requires a valid license of the RemObjects SDK
|
|
{ which can be obtained at http://www.remobjects.com.
|
|
{----------------------------------------------------------------------------}
|
|
|
|
{$I RemObjects.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
{$IFDEF VER140UP}DesignEditors, DesignIntf, {$ELSE} DsgnIntf,{$ENDIF}
|
|
Classes;
|
|
|
|
const prop_ServiceName = 'ServiceName';
|
|
prop_OperationName = 'OperationName';
|
|
prop_Dispatchers = 'Dispatchers';
|
|
|
|
capt_TestConnection = 'Test Connection...';
|
|
|
|
type { TROServiceNameProperty }
|
|
TROServiceNameProperty = class(TStringProperty)
|
|
protected
|
|
public
|
|
function GetAttributes: TPropertyAttributes; override;
|
|
procedure GetValues(Proc: TGetStrProc); override;
|
|
end;
|
|
|
|
{ TDispatchersProperty }
|
|
TDispatchersProperty = class(TClassProperty)
|
|
public
|
|
procedure Edit; override;
|
|
function GetAttributes: TPropertyAttributes; override;
|
|
end;
|
|
|
|
{$IFDEF VER140UP}
|
|
{ TROServerEditor }
|
|
TROServerEditor = class(TComponentEditor)
|
|
public
|
|
procedure Edit; override;
|
|
end;
|
|
|
|
{ TRORemoteServiceEditor }
|
|
TRORemoteServiceEditor = class(TComponentEditor)
|
|
protected
|
|
public
|
|
procedure ExecuteVerb(Index: Integer); override;
|
|
function GetVerb(Index: Integer): string; override;
|
|
function GetVerbCount: Integer; override;
|
|
end;
|
|
{$ENDIF VER140UP}
|
|
|
|
|
|
implementation
|
|
|
|
uses Forms, Controls, Dialogs, uRORemoteService, uROServer, uROClasses,
|
|
{$IFDEF MSWINDOWS}
|
|
fDispatchersEditorForm;
|
|
{$ENDIF}
|
|
{$IFDEF LINUX}
|
|
fDispatchersEditorFormKylix;
|
|
{$ENDIF}
|
|
|
|
function FindDesigner(Container: TComponent): IDesigner;
|
|
begin
|
|
Result := nil;
|
|
if Container <> nil then begin
|
|
if Container is TCustomForm then begin
|
|
Result := TCustomForm(Container).Designer as IDesigner;
|
|
end
|
|
else if (Container is TDataModule) and (Container.Owner <> nil) then begin
|
|
Result := (Container.Owner as TForm).Designer as IDesigner;
|
|
end
|
|
else if (Container is TWinControl) and (Container.Owner <> nil) then begin
|
|
Result := (Container.Owner as TForm).Designer as IDesigner;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
{ TROServiceNameProperty }
|
|
|
|
function TROServiceNameProperty.GetAttributes: TPropertyAttributes;
|
|
begin
|
|
result := [paValueList]
|
|
end;
|
|
|
|
procedure TROServiceNameProperty.GetValues(Proc: TGetStrProc);
|
|
var conn : TRORemoteService;
|
|
i : integer;
|
|
ss : IROStrings;
|
|
begin
|
|
conn := TRORemoteService(GetComponent(0));
|
|
|
|
ss := conn.GetServiceNames;
|
|
if assigned(ss) then
|
|
for i := 0 to (ss.Count-1) do
|
|
Proc(ss[i]);
|
|
end;
|
|
|
|
{ TDispatchersProperty }
|
|
|
|
procedure TDispatchersProperty.Edit;
|
|
begin
|
|
with TDispatchersEditorForm.Create(TROServer(GetComponent(0))) do try
|
|
ShowModal;
|
|
Modified();
|
|
finally
|
|
Free;
|
|
end;
|
|
end;
|
|
|
|
function TDispatchersProperty.GetAttributes: TPropertyAttributes;
|
|
begin
|
|
result := [paDialog]
|
|
end;
|
|
|
|
{ TROServerEditor }
|
|
|
|
{$IFDEF VER140UP}
|
|
procedure TROServerEditor.Edit;
|
|
var
|
|
lDesigner:IDesigner;
|
|
begin
|
|
with TDispatchersEditorForm.Create(TROServer(GetComponent())) do try
|
|
ShowModal;
|
|
lDesigner := FindDesigner(GetComponent().Owner);
|
|
if Assigned(lDesigner) then lDesigner.Modified()
|
|
//else ShowMessage('No designer');
|
|
finally
|
|
Free;
|
|
end;
|
|
end;
|
|
{$ENDIF VER140UP}
|
|
|
|
{ TRORemoteServiceEditor }
|
|
|
|
{$IFDEF VER140UP}
|
|
procedure TRORemoteServiceEditor.ExecuteVerb(Index: Integer);
|
|
var conn : TRORemoteService;
|
|
i : integer;
|
|
s : string;
|
|
ss : IROStrings;
|
|
begin
|
|
conn := TRORemoteService(GetComponent);
|
|
|
|
case Index of
|
|
0 : begin
|
|
ss := conn.GetServiceNames;
|
|
if assigned(ss) then begin
|
|
s := 'The server exposes the following service(s):'+#13#13;
|
|
for i := 0 to (ss.Count-1) do
|
|
s := s+ss[i]+#13;
|
|
MessageDlg(s, mtInformation, [mbOK], 0);
|
|
end
|
|
else begin
|
|
MessageDlg('The server exposes no services.', mtInformation, [mbOK], 0);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
function TRORemoteServiceEditor.GetVerb(Index: Integer): string;
|
|
begin
|
|
case Index of
|
|
0 : result := capt_TestConnection;
|
|
end;
|
|
end;
|
|
|
|
function TRORemoteServiceEditor.GetVerbCount: Integer;
|
|
begin
|
|
result := 1;
|
|
end;
|
|
{$ENDIF VER140UP}
|
|
|
|
end.
|