unit uViewParametrosControlGrid;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewBase, uViewControlGrid;

type
  IViewParametrosControlGrid = interface(IViewBase)
  ['{A060605B-AFB1-4F6F-8273-7739C4C4905B}']
    function GetModificable: Boolean;
    procedure SetModificable(const Value: Boolean);
    property Modificable : Boolean read GetModificable write SetModificable;

    procedure SetViewControlGrid (const Value : IViewControlGrid);
    function GetViewControlGrid : IViewControlGrid;
    property ViewControlGrid : IViewControlGrid read GetViewControlGrid write SetViewControlGrid;

    procedure Execute;
    procedure Refresh;
  end;

  TfrViewParametrosControlGrid = class(TfrViewBase, IViewParametrosControlGrid)
  protected
    FViewControlGrid : IViewControlGrid;
    FModificable : Boolean;
    function GetModificable: Boolean; virtual;
    procedure SetModificable(const Value: Boolean); virtual;
    procedure SetViewControlGrid (const Value : IViewControlGrid); virtual;
    function GetViewControlGrid : IViewControlGrid; virtual;
  public
    property Modificable : Boolean read GetModificable write SetModificable;
    property ViewControlGrid : IViewControlGrid read GetViewControlGrid write SetViewControlGrid;
    procedure Execute; virtual;
    procedure Refresh; override;
  end;


implementation

{$R *.dfm}

{ TfrViewParametrosControlGrid }


procedure TfrViewParametrosControlGrid.Execute;
begin
  if not Assigned(ViewControlGrid) then
    raise Exception.Create('Vista para el control no asignada (Execute)');
end;

function TfrViewParametrosControlGrid.GetModificable: Boolean;
begin
  Result := FModificable;
end;

function TfrViewParametrosControlGrid.GetViewControlGrid: IViewControlGrid;
begin
  Result := FViewControlGrid;
end;

procedure TfrViewParametrosControlGrid.Refresh;
begin
  inherited;
  if not Assigned(ViewControlGrid) then
    raise Exception.Create('Vista para el control no asignada (Refresh)');
end;

procedure TfrViewParametrosControlGrid.SetModificable(
  const Value: Boolean);
begin
  FModificable := Value;
end;

procedure TfrViewParametrosControlGrid.SetViewControlGrid(
  const Value: IViewControlGrid);
begin
  FViewControlGrid := Value;
end;

end.
