2007-09-09 10:56:47 +00:00
|
|
|
unit uEditorControlBase;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, uEditorDBItem, DB, uDADataTable, JvAppStorage,
|
|
|
|
|
JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList,
|
|
|
|
|
PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock,
|
|
|
|
|
TB2Toolbar, ExtCtrls, JvExControls, JvComponent, JvNavigationPane,
|
2008-04-15 09:28:58 +00:00
|
|
|
uBizControlesBase, schControlesClient_Intf, uViewControlBase, uDAInterfaces,
|
|
|
|
|
pngimage;
|
2007-09-09 10:56:47 +00:00
|
|
|
|
|
|
|
|
type
|
|
|
|
|
IEditorControlBase = interface(IEditorDBItem)
|
|
|
|
|
['{A9892225-82DB-41AF-B69D-821E0663B3EF}']
|
|
|
|
|
function GetControl: IBizControlBase;
|
|
|
|
|
procedure SetControl(const Value: IBizControlBase);
|
|
|
|
|
property Control: IBizControlBase read GetControl write SetControl;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TfEditorControlBase = class(TfEditorDBItem, IEditorControlBase)
|
|
|
|
|
actPropiedades: TAction;
|
|
|
|
|
TBXSeparatorItem14: TTBXSeparatorItem;
|
|
|
|
|
tbxiPropiedades: TTBXItem;
|
|
|
|
|
TBXSeparatorItem15: TTBXSeparatorItem;
|
|
|
|
|
tbxiPropiedades2: TTBXItem;
|
|
|
|
|
procedure actPropiedadesExecute(Sender: TObject);
|
|
|
|
|
procedure actGuardarCerrarUpdate(Sender: TObject);
|
|
|
|
|
procedure actGuardarUpdate(Sender: TObject);
|
|
|
|
|
procedure actPrevisualizarExecute(Sender: TObject);
|
|
|
|
|
procedure actImprimirExecute(Sender: TObject);
|
|
|
|
|
procedure actEliminarExecute(Sender: TObject);
|
|
|
|
|
protected
|
|
|
|
|
FControl : IBizControlBase;
|
|
|
|
|
FViewControl : IViewControlBase;
|
|
|
|
|
function GetControl: IBizControlBase; virtual;
|
|
|
|
|
procedure SetControl(const Value: IBizControlBase); virtual;
|
|
|
|
|
procedure RefrescarTituloEditor; virtual;
|
|
|
|
|
function GetModified: Boolean; override;
|
|
|
|
|
procedure RellenarCabeceraInforme; virtual;
|
|
|
|
|
public
|
|
|
|
|
property Control: IBizControlBase read GetControl write SetControl;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses uEditorDBBase, uEditorBase;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
{ TfEditorControlBase }
|
|
|
|
|
|
|
|
|
|
function TfEditorControlBase.GetControl: IBizControlBase;
|
|
|
|
|
begin
|
|
|
|
|
Result := FControl;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.SetControl(const Value: IBizControlBase);
|
|
|
|
|
begin
|
|
|
|
|
FControl := Value;
|
|
|
|
|
dsDataTable.DataTable := FControl.DataTable;
|
|
|
|
|
if Assigned(FViewControl) then
|
|
|
|
|
FViewControl.Control := FControl;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.actPropiedadesExecute(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
try
|
|
|
|
|
FControl.VerPropiedades;
|
|
|
|
|
finally
|
|
|
|
|
RefrescarTituloEditor;
|
|
|
|
|
FViewControl.Modificable := FControl.EsModificable;
|
|
|
|
|
inherited actGuardarExecute(Sender);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.RefrescarTituloEditor;
|
|
|
|
|
begin
|
|
|
|
|
if Assigned(FControl) and (Length(FControl.NOMBRE) > 0) then
|
|
|
|
|
begin
|
|
|
|
|
Caption := FControl.NOMBRE;
|
|
|
|
|
JvNavPanelHeader.Caption := FControl.NOMBRE;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TfEditorControlBase.GetModified: Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := inherited GetModified and
|
|
|
|
|
(Assigned(FControl) and FControl.EsModificable);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.actGuardarCerrarUpdate(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
(Sender as TAction).Enabled := Assigned(FControl) and (FControl.EsModificable);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.actGuardarUpdate(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
(Sender as TAction).Enabled := Assigned(FControl) and (FControl.EsModificable);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.actPrevisualizarExecute(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
RellenarCabeceraInforme;
|
|
|
|
|
inherited;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.RellenarCabeceraInforme;
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.actImprimirExecute(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
RellenarCabeceraInforme;
|
|
|
|
|
inherited;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorControlBase.actEliminarExecute(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if not FControl.EsModificable then
|
|
|
|
|
ShowMessage('Este control no se puede eliminar')
|
|
|
|
|
else
|
|
|
|
|
inherited
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|