2017-05-17 22:32:45 +02:00
|
|
|
{ *************************************************************************** }
|
|
|
|
{ }
|
|
|
|
{ Delphi MVC Framework }
|
|
|
|
{ }
|
|
|
|
{ Copyright (c) 2010-2017 Daniele Teti and the DMVCFramework Team }
|
|
|
|
{ }
|
|
|
|
{ https://github.com/danieleteti/delphimvcframework }
|
|
|
|
{ }
|
|
|
|
{ *************************************************************************** }
|
|
|
|
{ }
|
|
|
|
{ Licensed under the Apache License, Version 2.0 (the "License"); }
|
|
|
|
{ you may not use this file except in compliance with the License. }
|
|
|
|
{ You may obtain a copy of the License at }
|
|
|
|
{ }
|
|
|
|
{ http://www.apache.org/licenses/LICENSE-2.0 }
|
|
|
|
{ }
|
|
|
|
{ Unless required by applicable law or agreed to in writing, software }
|
|
|
|
{ distributed under the License is distributed on an "AS IS" BASIS, }
|
|
|
|
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
|
|
|
|
{ See the License for the specific language governing permissions and }
|
|
|
|
{ limitations under the License. }
|
|
|
|
{ }
|
|
|
|
{ This IDE expert is based off of the one included with the DUnitX }
|
|
|
|
{ project. Original source by Robert Love. Adapted by Nick Hodges. }
|
|
|
|
{ }
|
|
|
|
{ The DUnitX project is run by Vincent Parrett and can be found at: }
|
|
|
|
{ }
|
|
|
|
{ https://github.com/VSoftTechnologies/DUnitX }
|
|
|
|
{ *************************************************************************** }
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
unit DMVC.Expert.Forms.NewUnitWizard;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
WinAPI.Windows,
|
|
|
|
WinAPI.Messages,
|
|
|
|
System.SysUtils,
|
|
|
|
System.Variants,
|
|
|
|
System.Classes,
|
|
|
|
VCL.Graphics,
|
|
|
|
VCL.Controls,
|
|
|
|
VCL.Forms,
|
|
|
|
VCL.Dialogs,
|
|
|
|
VCL.StdCtrls;
|
|
|
|
|
|
|
|
type
|
|
|
|
TfrmDMVCNewUnit = class(TForm)
|
|
|
|
GroupBox1: TGroupBox;
|
|
|
|
btnOK: TButton;
|
|
|
|
btnCancel: TButton;
|
|
|
|
lblClassName: TLabel;
|
|
|
|
edtClassName: TEdit;
|
|
|
|
chkCreateIndexMethod: TCheckBox;
|
2016-02-24 22:37:13 +01:00
|
|
|
chkCreateActionFiltersMethods: TCheckBox;
|
2017-05-17 22:32:45 +02:00
|
|
|
chkCreateCRUDMethods: TCheckBox;
|
2016-02-23 01:41:13 +01:00
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
private
|
|
|
|
function GetCreateIndexMethod: boolean;
|
|
|
|
function GetControllerClassName: string;
|
2016-02-24 22:37:13 +01:00
|
|
|
function GetCreateActionFiltersMethods: boolean;
|
2017-05-17 22:32:45 +02:00
|
|
|
function GetCreateCRUDMethods: boolean;
|
2016-02-23 01:41:13 +01:00
|
|
|
{ Private declarations }
|
|
|
|
public
|
|
|
|
{ Public declarations }
|
2017-05-17 22:32:45 +02:00
|
|
|
property ControllerClassName: string read GetControllerClassName;
|
|
|
|
property CreateIndexMethod: boolean read GetCreateIndexMethod;
|
|
|
|
property CreateCRUDMethods: boolean read GetCreateCRUDMethods;
|
2016-02-24 22:37:13 +01:00
|
|
|
property CreateActionFiltersMethods: boolean read GetCreateActionFiltersMethods;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
frmDMVCNewUnit: TfrmDMVCNewUnit;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
DMVC.Expert.CodeGen.Templates;
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
procedure TfrmDMVCNewUnit.FormCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
edtClassName.TextHint := sDefaultControllerName;
|
|
|
|
end;
|
|
|
|
|
2016-02-24 22:37:13 +01:00
|
|
|
function TfrmDMVCNewUnit.GetCreateActionFiltersMethods: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateActionFiltersMethods.Checked;
|
|
|
|
end;
|
|
|
|
|
2017-05-17 22:32:45 +02:00
|
|
|
function TfrmDMVCNewUnit.GetCreateCRUDMethods: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateCRUDMethods.Checked;
|
|
|
|
end;
|
|
|
|
|
2016-02-23 01:41:13 +01:00
|
|
|
function TfrmDMVCNewUnit.GetCreateIndexMethod: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateIndexMethod.Checked;
|
|
|
|
end;
|
|
|
|
|
|
|
|
function TfrmDMVCNewUnit.GetControllerClassName: string;
|
|
|
|
begin
|
|
|
|
if Trim(edtClassName.Text) = '' then
|
|
|
|
begin
|
|
|
|
Result := sDefaultControllerName
|
2017-05-17 22:32:45 +02:00
|
|
|
end
|
|
|
|
else
|
2016-02-23 01:41:13 +01:00
|
|
|
begin
|
|
|
|
Result := Trim(edtClassName.Text);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|