Supervising Controller
Passive View
IProductView = interface
end;
TProductForm = class(TForm, IProductView)
...
end;
TProductPresenter = class
private
FView: IProductView;
public
constructor Create(AView:IProductView);
end;
TProductForm = class(TForm, IProductView)
private
FPresenter: TProductPresenter;
public
constructor Create;
...
end;
implementation
TProductForm.Create
begin
FPresenter := TProductPresenter.Create(self);
end;
TProductForm.NameDBEditChange(Sender: TObject);
begin
FPresenter.ValidateName;
end;
IProductView = interface
function GetName:string;
procedure SetName(Value: string);
property Name: string read GetName write SetName;
GetName
SetName
TProductForm.GetName: string;
begin
Result := NameDBEdit.Text;
end;
TProductForm.SetName(Value: string);
begin
NameDBEdit.Text := Value;
end;