unit uViewEpigrafe; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uViewBase, ExtCtrls, StdCtrls, Buttons, DB, uDADataTable, DBCtrls, Grids, DBGrids, uBizEpigrafes, uEpigrafesController, Mask, ComCtrls, uCustomView, JvComponent, JvFormAutoSize, cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, dxLayoutControl, uDAInterfaces, cxGraphics, cxDropDownEdit, cxImageComboBox, cxMaskEdit, cxCalendar, ActnList, ImgList, PngImageList; type IViewEpigrafe = interface(IViewBase) ['{F44F8AEF-CB9C-44D5-93DA-53D6AB6A2D29}'] function GetController : IEpigrafesController; procedure SetController (const Value : IEpigrafesController); property Controller : IEpigrafesController read GetController write SetController; function GetEpigrafe: IBizEpigrafe; procedure SetEpigrafe(const Value: IBizEpigrafe); property Epigrafe: IBizEpigrafe read GetEpigrafe write SetEpigrafe; end; TfrViewEpigrafe = class(TfrViewBase, IViewEpigrafe) DADataSource: TDADataSource; dxLayoutControlEpigrafeGroup_Root: TdxLayoutGroup; dxLayoutControlEpigrafe: TdxLayoutControl; dxLayoutControlEpigrafeGroup1: TdxLayoutGroup; dxLayoutControlEpigrafeItem3: TdxLayoutItem; eReferencia: TcxDBTextEdit; dxLayoutControlEpigrafeItem1: TdxLayoutItem; eDescripcion: TcxDBTextEdit; dxLayoutControlEpigrafeItem2: TdxLayoutItem; eEpigrafe: TcxDBTextEdit; dxLayoutControlEpigrafeItem4: TdxLayoutItem; BitBtn1: TBitBtn; dxLayoutControlEpigrafeGroup2: TdxLayoutGroup; png: TActionList; actElegirEpigrafe: TAction; SmallImages: TPngImageList; procedure actElegirEpigrafeExecute(Sender: TObject); protected FController : IEpigrafesController; FEpigrafe: IBizEpigrafe; function GetEpigrafe: IBizEpigrafe; procedure SetEpigrafe(const Value: IBizEpigrafe); function GetController : IEpigrafesController; procedure SetController (const Value : IEpigrafesController); public property Controller : IEpigrafesController read GetController write SetController; property Epigrafe: IBizEpigrafe read GetEpigrafe write SetEpigrafe; end; implementation {$R *.dfm} { TfrViewEpigrafes } { ******************************* TfrViewEpigrafes ******************************** } procedure TfrViewEpigrafe.actElegirEpigrafeExecute(Sender: TObject); var AEpigrafe : IBizEpigrafe; begin inherited; AEpigrafe := (Controller.ElegirEpigrafe(Controller.BuscarTodos, 'El epigrafe seleccionado se establecerá como padre', False) as IBizEpigrafe); Controller.AsignarPadre(Epigrafe, AEpigrafe); AEpigrafe := Nil; end; function TfrViewEpigrafe.GetController: IEpigrafesController; begin Result := FController; end; function TfrViewEpigrafe.GetEpigrafe: IBizEpigrafe; begin Result := FEpigrafe; end; procedure TfrViewEpigrafe.SetController(const Value: IEpigrafesController); begin FController := Value; end; procedure TfrViewEpigrafe.SetEpigrafe(const Value: IBizEpigrafe); begin FEpigrafe := Value; if Assigned(FEpigrafe) then DADataSource.DataTable := FEpigrafe.DataTable else DADataSource.DataTable := NIL; end; end.