Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
StarUML Evológica Plugin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
evologica
StarUML Evológica Plugin
Commits
39a85144
Commit
39a85144
authored
Mar 09, 2020
by
Lucio Sandrini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementação de cadastro de formulário (Dynamo)
parent
473fdaef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
269 additions
and
200 deletions
+269
-200
ituCadastrarFormulario.lfm
EvoUMLPlugin/src/ituCadastrarFormulario.lfm
+151
-113
ituCadastrarFormulario.pas
EvoUMLPlugin/src/ituCadastrarFormulario.pas
+118
-87
No files found.
EvoUMLPlugin/src/ituCadastrarFormulario.lfm
View file @
39a85144
object itCadastrarFormulario: TitCadastrarFormulario
object itCadastrarFormulario: TitCadastrarFormulario
Left = 356
Left = 356
Height =
511
Height =
482
Top = 218
Top = 218
Width = 9
48
Width = 9
37
ClientHeight =
511
ClientHeight =
482
ClientWidth = 9
48
ClientWidth = 9
37
LCLVersion = '2.1.0.0'
LCLVersion = '2.1.0.0'
object scrlbxTudo: TScrollBox
object scrlbxTudo: TScrollBox
Left = 0
Left = 0
Height = 8
69
Height = 8
40
Top = 0
Top = 0
Width = 16
66
Width = 16
55
HorzScrollBar.Page = 9
31
HorzScrollBar.Page = 9
49
HorzScrollBar.Tracking = True
HorzScrollBar.Tracking = True
VertScrollBar.Page = 4
9
0
VertScrollBar.Page = 4
7
0
VertScrollBar.Tracking = True
VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom]
Anchors = [akTop, akLeft, akRight, akBottom]
BorderStyle = bsNone
BorderStyle = bsNone
ClientHeight = 8
69
ClientHeight = 8
40
ClientWidth = 16
66
ClientWidth = 16
55
TabOrder = 0
TabOrder = 0
object Panel1: TPanel
object Panel1: TPanel
Left = 0
Left = 0
Height = 8
69
Height = 8
40
Top = 0
Top = 0
Width = 16
66
Width = 16
55
Align = alClient
Align = alClient
ClientHeight = 8
69
ClientHeight = 8
40
ClientWidth = 16
66
ClientWidth = 16
55
TabOrder = 0
TabOrder = 0
object edtCampo: TEdit
object edtCampo: TEdit
Left = 104
Left = 104
Height = 23
Height = 23
Top = 4
48
Top = 4
25
Width = 142
Width = 142
AutoSize = False
AutoSize = False
OnKeyPress = edtCampoKeyPress
OnKeyPress = edtCampoKeyPress
TabOrder = 0
TabOrder = 0
end
end
object btnCancelar: TButton
object btnCancelar: TButton
Left = 78
5
Left = 78
3
Height = 49
Height = 49
Top = 4
4
0
Top = 4
2
0
Width = 14
5
Width = 14
0
Caption = 'CANCELAR'
Caption = 'CANCELAR'
OnClick = btnCancelarClick
OnClick = btnCancelarClick
TabOrder = 1
TabOrder = 1
end
end
object btnSalvar: TButton
object btnSalvar: TButton
Left = 6
41
Left = 6
34
Height = 49
Height = 49
Top = 4
4
0
Top = 4
2
0
Width = 14
5
Width = 14
0
Caption = 'SALVAR'
Caption = 'SALVAR'
OnClick = btnSalvarClick
OnClick = btnSalvarClick
TabOrder = 2
TabOrder = 2
...
@@ -59,7 +59,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -59,7 +59,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
object lvCampos: TListView
object lvCampos: TListView
Left = 16
Left = 16
Height = 300
Height = 300
Top = 1
30
Top = 1
07
Width = 604
Width = 604
Checkboxes = True
Checkboxes = True
Columns = <
Columns = <
...
@@ -93,19 +93,10 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -93,19 +93,10 @@ object itCadastrarFormulario: TitCadastrarFormulario
OnClick = lvCamposClick
OnClick = lvCamposClick
OnSelectItem = lvCamposSelectItem
OnSelectItem = lvCamposSelectItem
end
end
object edtCodigo: TEdit
Left = 74
Height = 23
Top = 64
Width = 143
AutoSize = False
Enabled = False
TabOrder = 4
end
object btnAdd: TSpeedButton
object btnAdd: TSpeedButton
Left = 253
Left = 253
Height = 25
Height = 25
Top = 4
48
Top = 4
25
Width = 70
Width = 70
Caption = 'Adicionar'
Caption = 'Adicionar'
OnClick = btnAddClick
OnClick = btnAddClick
...
@@ -113,7 +104,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -113,7 +104,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
object lblNovoCampo: TLabel
object lblNovoCampo: TLabel
Left = 16
Left = 16
Height = 18
Height = 18
Top = 4
51
Top = 4
28
Width = 81
Width = 81
Caption = 'NOVO CAMPO:'
Caption = 'NOVO CAMPO:'
Font.Color = clWindowText
Font.Color = clWindowText
...
@@ -122,23 +113,10 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -122,23 +113,10 @@ object itCadastrarFormulario: TitCadastrarFormulario
ParentColor = False
ParentColor = False
ParentFont = False
ParentFont = False
end
end
object lblCodigo: TLabel
Left = 16
Height = 18
Top = 65
Width = 52
Caption = 'CÓDIGO:'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Trebuchet MS'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object lblExibirCampos: TLabel
object lblExibirCampos: TLabel
Left = 16
Left = 16
Height = 18
Height = 18
Top =
106
Top =
83
Width = 55
Width = 55
Caption = 'CAMPOS:'
Caption = 'CAMPOS:'
Font.Color = clWindowText
Font.Color = clWindowText
...
@@ -148,49 +126,68 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -148,49 +126,68 @@ object itCadastrarFormulario: TitCadastrarFormulario
ParentColor = False
ParentColor = False
ParentFont = False
ParentFont = False
end
end
object lblClasseName: TLabel
object Panel2: TPanel
Left = 88
Left = 0
Height = 18
Height = 72
Top = 24
Top = 0
Width = 65
Width = 948
Caption = 'ClassName'
ClientHeight = 72
Font.Color = clWindowText
ClientWidth = 948
Font.Height = -13
TabOrder = 4
Font.Name = 'Trebuchet MS'
object lblCodigo: TLabel
Font.Style = [fsBold]
Left = 232
ParentColor = False
Height = 18
ParentFont = False
Top = 16
end
Width = 157
object lblClassIDO: TLabel
Caption = 'CÓDIGO DO FORMULÁRIO:'
Left = 192
Font.Color = clWindowText
Height = 18
Font.Height = -13
Top = 24
Font.Name = 'Trebuchet MS'
Width = 52
Font.Style = [fsBold]
Caption = 'ClassIDO'
ParentColor = False
Font.Color = clWindowText
ParentFont = False
Font.Height = -13
end
Font.Name = 'Trebuchet MS'
object lblClasseName: TLabel
Font.Style = [fsBold]
Left = 16
ParentColor = False
Height = 18
ParentFont = False
Top = 16
Width = 107
Caption = 'NOME DA CLASSE:'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Trebuchet MS'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object lblNomeClasse: TLabel
Left = 16
Height = 15
Top = 40
Width = 79
Caption = 'lblNomeClasse'
ParentColor = False
end
end
end
object lblTipoAtributo: TLabel
object lstAtributos: TValueListEditor
Left = 641
Left = 634
Height = 18
Height = 134
Top = 234
Top = 273
Width = 98
Width = 289
Caption = 'TIPO DO CAMPO: '
FixedCols = 0
Font.Color = clWindowText
RowCount = 2
Font.Height = -12
TabOrder = 5
Font.Name = 'Trebuchet MS'
OnValidateEntry = lstAtributosValidateEntry
ParentColor = False
ColWidths = (
ParentFont = False
144
141
)
end
end
object cbbTipo: TComboBox
object cbbTipo: TComboBox
Left = 6
41
Left = 6
34
Height = 24
Height = 24
Hint = 'Tipo'
Hint = 'Tipo'
Top = 2
5
5
Top = 2
4
5
Width = 145
Width = 145
Font.Color = clWindowText
Font.Color = clWindowText
Font.Height = -11
Font.Height = -11
...
@@ -199,42 +196,40 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -199,42 +196,40 @@ object itCadastrarFormulario: TitCadastrarFormulario
OnChange = cbbTipoChange
OnChange = cbbTipoChange
ParentFont = False
ParentFont = False
Style = csDropDownList
Style = csDropDownList
TabOrder = 5
end
object lstAtributos: TValueListEditor
Left = 641
Height = 145
Top = 285
Width = 289
FixedCols = 0
RowCount = 2
TabOrder = 6
TabOrder = 6
OnValidate = lstAtributosValidate
end
ColWidths = (
object lblTipoAtributo: TLabel
144
Left = 634
141
Height = 18
)
Top = 226
Width = 98
Caption = 'TIPO DO CAMPO: '
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Trebuchet MS'
ParentColor = False
ParentFont = False
end
end
object btnUp: TSpeedButton
object btnUp: TSpeedButton
Left = 6
41
Left = 6
34
Height = 2
5
Height = 2
2
Top = 1
96
Top = 1
84
Width = 70
Width = 70
Caption = 'Sobe'
Caption = 'Sobe'
OnClick = btnUpClick
OnClick = btnUpClick
end
end
object btnDown: TSpeedButton
object btnDown: TSpeedButton
Left = 7
18
Left = 7
07
Height = 2
5
Height = 2
2
Top = 1
96
Top = 1
84
Width = 70
Width = 70
Caption = 'Desce'
Caption = 'Desce'
OnClick = btnDownClick
OnClick = btnDownClick
end
end
object lblOrdem: TLabel
object lblOrdem: TLabel
Left = 6
41
Left = 6
34
Height = 18
Height = 18
Top = 1
75
Top = 1
67
Width = 43
Width = 43
Caption = 'ORDEM:'
Caption = 'ORDEM:'
Font.Color = clWindowText
Font.Color = clWindowText
...
@@ -244,27 +239,27 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -244,27 +239,27 @@ object itCadastrarFormulario: TitCadastrarFormulario
ParentFont = False
ParentFont = False
end
end
object rbNao: TRadioButton
object rbNao: TRadioButton
Left = 8
66
Left = 8
59
Height = 19
Height = 19
Top = 19
9
Top = 19
0
Width = 42
Width = 42
Caption = 'Não'
Caption = 'Não'
OnChange = rbNaoChange
OnChange = rbNaoChange
TabOrder = 7
TabOrder = 7
end
end
object rbSim: TRadioButton
object rbSim: TRadioButton
Left = 8
20
Left = 8
13
Height = 19
Height = 19
Top = 19
9
Top = 19
0
Width = 40
Width = 40
Caption = 'Sim'
Caption = 'Sim'
OnChange = rbSimChange
OnChange = rbSimChange
TabOrder = 8
TabOrder = 8
end
end
object lblObrigatorio: TLabel
object lblObrigatorio: TLabel
Left = 8
20
Left = 8
13
Height = 18
Height = 18
Top = 1
75
Top = 1
67
Width = 79
Width = 79
Caption = 'OBRIGATÓRIO:'
Caption = 'OBRIGATÓRIO:'
Font.Color = clWindowText
Font.Color = clWindowText
...
@@ -273,6 +268,49 @@ object itCadastrarFormulario: TitCadastrarFormulario
...
@@ -273,6 +268,49 @@ object itCadastrarFormulario: TitCadastrarFormulario
ParentColor = False
ParentColor = False
ParentFont = False
ParentFont = False
end
end
object edtNome: TEdit
Left = 633
Height = 23
Top = 124
Width = 138
AutoSize = False
OnChange = edtNomeChange
TabOrder = 9
end
object edtDisplayNome: TEdit
Left = 785
Height = 23
Top = 124
Width = 138
AutoSize = False
OnChange = edtDisplayNomeChange
OnKeyPress = edtCampoKeyPress
TabOrder = 10
end
object lblNome: TLabel
Left = 634
Height = 18
Top = 106
Width = 37
Caption = 'NOME:'
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Trebuchet MS'
ParentColor = False
ParentFont = False
end
object lblDisplayNome: TLabel
Left = 785
Height = 18
Top = 106
Width = 83
Caption = 'DISPLAY NOME:'
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Trebuchet MS'
ParentColor = False
ParentFont = False
end
end
end
end
end
end
end
EvoUMLPlugin/src/ituCadastrarFormulario.pas
View file @
39a85144
...
@@ -8,27 +8,31 @@ uses
...
@@ -8,27 +8,31 @@ uses
LCLIntf
,
LCLType
,
LMessages
,
Messages
,
SysUtils
,
Variants
,
Classes
,
Graphics
,
LCLIntf
,
LCLType
,
LMessages
,
Messages
,
SysUtils
,
Variants
,
Classes
,
Graphics
,
Controls
,
Forms
,
StdCtrls
,
Dialogs
,
JvExControls
,
ComCtrls
,
ExtCtrls
,
Buttons
,
Controls
,
Forms
,
StdCtrls
,
Dialogs
,
JvExControls
,
ComCtrls
,
ExtCtrls
,
Buttons
,
MaskEdit
,
JvBaseEdits
,
JvCheckBox
,
utuMessage
,
Grids
,
ValEdit
,
StarUMLintf
,
MaskEdit
,
JvBaseEdits
,
JvCheckBox
,
utuMessage
,
Grids
,
ValEdit
,
StarUMLintf
,
cxuCadastroDefinicaoClasse
;
cxuCadastroDefinicaoClasse
,
IntegracaoDelphiSUML
;
type
type
{ TitCadastrarFormulario }
{ TitCadastrarFormulario }
TitCadastrarFormulario
=
class
(
TForm
)
TitCadastrarFormulario
=
class
(
TForm
)
edtNome
:
TEdit
;
edtDisplayNome
:
TEdit
;
lblNomeClasse
:
TLabel
;
lblCodigo
:
TLabel
;
lblCodigo
:
TLabel
;
lblClasseName
:
TLabel
;
lblClasseName
:
TLabel
;
lblClassIDO
:
TLabel
;
lblOrdem
:
TLabel
;
lblOrdem
:
TLabel
;
lblObrigatorio
:
TLabel
;
lblObrigatorio
:
TLabel
;
lblNome
:
TLabel
;
lblDisplayNome
:
TLabel
;
lvCampos
:
TListView
;
lvCampos
:
TListView
;
lblExibirCampos
:
TLabel
;
lblExibirCampos
:
TLabel
;
btnUp
:
TSpeedButton
;
btnUp
:
TSpeedButton
;
btnDown
:
TSpeedButton
;
btnDown
:
TSpeedButton
;
edtCodigo
:
TEdit
;
cbbTipo
:
TComboBox
;
cbbTipo
:
TComboBox
;
lblTipoAtributo
:
TLabel
;
lblTipoAtributo
:
TLabel
;
lstAtributos
:
TValueListEditor
;
lstAtributos
:
TValueListEditor
;
Panel1
:
TPanel
;
Panel1
:
TPanel
;
Panel2
:
TPanel
;
rbNao
:
TRadioButton
;
rbNao
:
TRadioButton
;
rbSim
:
TRadioButton
;
rbSim
:
TRadioButton
;
scrlbxTudo
:
TScrollBox
;
scrlbxTudo
:
TScrollBox
;
...
@@ -37,24 +41,26 @@ type
...
@@ -37,24 +41,26 @@ type
edtCampo
:
TEdit
;
edtCampo
:
TEdit
;
lblNovoCampo
:
TLabel
;
lblNovoCampo
:
TLabel
;
btnAdd
:
TSpeedButton
;
btnAdd
:
TSpeedButton
;
procedure
lstAtributosClear
;
procedure
edtDisplayNomeChange
(
Sender
:
TObject
);
procedure
edtNomeChange
(
Sender
:
TObject
);
procedure
lstAtributosFill
(
piType
:
string
);
procedure
lstAtributosFill
(
piType
:
string
);
procedure
btnCancelarClick
(
Sender
:
TObject
);
procedure
btnCancelarClick
(
Sender
:
TObject
);
procedure
btnUpClick
(
Sender
:
TObject
);
procedure
btnUpClick
(
Sender
:
TObject
);
procedure
btnDownClick
(
Sender
:
TObject
);
procedure
btnDownClick
(
Sender
:
TObject
);
procedure
lstAtributosValidateEntry
(
sender
:
TObject
;
aCol
,
aRow
:
Integer
;
const
OldValue
:
string
;
var
NewValue
:
String
);
procedure
lvCamposSelectItem
(
Sender
:
TObject
;
Item
:
TListItem
;
procedure
lvCamposSelectItem
(
Sender
:
TObject
;
Item
:
TListItem
;
Selected
:
Boolean
);
Selected
:
Boolean
);
procedure
lvCamposClick
(
Sender
:
TObject
);
procedure
lvCamposClick
(
Sender
:
TObject
);
procedure
btnSalvarClick
(
Sender
:
TObject
);
procedure
btnSalvarClick
(
Sender
:
TObject
);
procedure
cbbTipoChange
(
Sender
:
TObject
);
procedure
cbbTipoChange
(
Sender
:
TObject
);
procedure
lstAtributosValidate
(
Sender
:
TObject
;
ACol
,
ARow
:
Integer
;
const
KeyName
,
KeyValue
:
string
);
procedure
btnAddClick
(
Sender
:
TObject
);
procedure
btnAddClick
(
Sender
:
TObject
);
procedure
edtCampoKeyPress
(
Sender
:
TObject
;
var
Key
:
Char
);
procedure
edtCampoKeyPress
(
Sender
:
TObject
;
var
Key
:
Char
);
procedure
rbNaoChange
(
Sender
:
TObject
);
procedure
rbNaoChange
(
Sender
:
TObject
);
procedure
rbSimChange
(
Sender
:
TObject
);
procedure
rbSimChange
(
Sender
:
TObject
);
private
private
fUtil
:
TUtil
;
fUMLClass
:
IUMLClass
;
fUMLClass
:
IUMLClass
;
fcxCadastroDefinicaoClasse
:
cxCadastroDefinicaoClasse
;
fcxCadastroDefinicaoClasse
:
cxCadastroDefinicaoClasse
;
fClassPackage
:
IUMLPackage
;
fClassPackage
:
IUMLPackage
;
...
@@ -74,26 +80,10 @@ type
...
@@ -74,26 +80,10 @@ type
property
ClassPackage
:
IUMLPackage
read
fClassPackage
write
fClassPackage
;
property
ClassPackage
:
IUMLPackage
read
fClassPackage
write
fClassPackage
;
end
;
end
;
//itCadastrarFormulario = class(itInterface)
//private
// fTypesField : utField;
// fFieldTypeList : utField;
// fIdCount : Integer;
//
// procedure ObterAtributosSuccess (piRequest : acRequest);
// procedure EditarSuccess (piRequest : acRequest);
// procedure IncluirSuccess (piRequest : acRequest);
// procedure SalvarSuccess (piRequest : acRequest);
// { Private declarations }
//public
// procedure Initialize; override;
// procedure Finalize; override;
//end;
implementation
implementation
uses
uses
acuObject
;
acuObject
,
acuFramework
,
acuModel
;
const
const
__STRING
=
1
;
__STRING
=
1
;
...
@@ -111,16 +101,25 @@ const
...
@@ -111,16 +101,25 @@ const
{ itCadastrarCliente }
{ itCadastrarCliente }
constructor
TitCadastrarFormulario
.
Create
(
Sender
:
TComponent
;
piCadastroClasse
:
cxCadastroDefinicaoClasse
;
piUMLClass
:
IUMLCLass
);
constructor
TitCadastrarFormulario
.
Create
(
Sender
:
TComponent
;
piCadastroClasse
:
cxCadastroDefinicaoClasse
;
piUMLClass
:
IUMLCLass
);
var
lMetaModelGenOpt
:
TMetaModelGenerationOptions
;
begin
begin
inherited
Create
(
sender
);
inherited
Create
(
sender
);
if
assigned
(
piUMLClass
)
then
if
assigned
(
piUMLClass
)
then
begin
begin
fUMLClass
:=
piUMLClass
;
fUMLClass
:=
piUMLClass
;
lblClassIDO
.
Caption
:=
fUMLClass
.
GetTaggedValueAsString
(
'DBMappings'
,
'DBClassMap'
,
'DBIDO'
);
lblNomeClasse
.
Caption
:=
fUMLClass
.
Name
;
lblClasseName
.
Caption
:=
fUMLClass
.
GetTaggedValueAsString
(
'DBMappings'
,
'DBClassMap'
,
'Table'
);
//lblClassIDO.Caption := fUMLClass.GetTaggedValueAsString('DBMappings', 'DBClassMap', 'DBIDO');
//lblClasseName.Caption := fUMLClass.GetTaggedValueAsString('DBMappings', 'DBClassMap', 'Table');
end
;
end
;
fcxCadastroDefinicaoClasse
:=
piCadastroClasse
;
fcxCadastroDefinicaoClasse
:=
piCadastroClasse
;
lMetaModelGenOpt
.
CheckDBAttributeNameLength
:=
false
;
lMetaModelGenOpt
.
CheckDBTableNameLength
:=
false
;
fUtil
:=
TUtil
.
Create
;
fUtil
.
AlimentarMetamodel
(
lMetaModelGenOpt
,
nil
);
self
.
Initialize
;
self
.
Initialize
;
end
;
end
;
...
@@ -130,6 +129,7 @@ begin
...
@@ -130,6 +129,7 @@ begin
lField
:=
utField
.
Create
;
lField
:=
utField
.
Create
;
lResponseField
:=
utField
.
Create
;
lResponseField
:=
utField
.
Create
;
fFieldTypeList
:=
utField
.
Create
;
fFieldTypeList
:=
utField
.
Create
;
fcxCadastroDefinicaoClasse
.
rmObtemContexto
(
lField
,
lResponseField
);
fcxCadastroDefinicaoClasse
.
rmObtemContexto
(
lField
,
lResponseField
);
SendToInterface
(
lResponseField
);
SendToInterface
(
lResponseField
);
lvCamposClick
(
nil
);
lvCamposClick
(
nil
);
...
@@ -138,8 +138,10 @@ end;
...
@@ -138,8 +138,10 @@ end;
procedure
TitCadastrarFormulario
.
SendToInterface
(
piField
:
utField
);
procedure
TitCadastrarFormulario
.
SendToInterface
(
piField
:
utField
);
var
var
lFieldItem
:
utField
;
lFieldItem
:
utField
;
lEnum
:
acEnumerator
;
lEnum
:
acEnumerator
;
i
:
Integer
;
lClassCode
,
lRelationName
:
string
;
lClass
:
acClassTicket
;
i
:
Integer
;
begin
begin
inherited
;
inherited
;
fTypesField
:=
piField
.
FindField
(
'FieldTypes'
);
fTypesField
:=
piField
.
FindField
(
'FieldTypes'
);
...
@@ -161,9 +163,24 @@ begin
...
@@ -161,9 +163,24 @@ begin
end
;
end
;
end
;
end
;
for
i
:=
0
to
fUMLClass
.
GetAttributeCount
-
1
do
lClassCode
:=
fUMLClass
.
GetTaggedValueAsString
(
'DBMappings'
,
'DBClassMap'
,
'Cod'
);
lClass
:=
fUtil
.
MetaModel
.
ClassTicketByCode
[
lClassCode
]
as
acClassTicket
;
for
i
:=
0
to
lClass
.
Attributes
.
Count
-
1
do
begin
AdicionarCampo
(
lClass
.
Attributes
[
i
]);
end
;
for
i
:=
0
to
lClass
.
RelationTicketsIn
.
Count
-
1
do
begin
begin
AdicionarCampo
(
fUMLClass
.
GetAttributeAt
(
i
).
Name
);
lRelationName
:=
acRelationTicket
(
lClass
.
RelationTicketsIn
.
Objects
[
i
]).
DestinationPropertyName
;
if
lRelationName
<>
''
then
AdicionarCampo
(
lRelationName
);
end
;
for
i
:=
0
to
lClass
.
RelationTicketsOut
.
Count
-
1
do
begin
lRelationName
:=
acRelationTicket
(
lClass
.
RelationTicketsOut
.
Objects
[
i
]).
OriginPropertyName
;
if
lRelationName
<>
''
then
AdicionarCampo
(
lRelationName
);
end
;
end
;
end
;
end
;
...
@@ -220,13 +237,33 @@ begin
...
@@ -220,13 +237,33 @@ begin
Self
.
Close
;
Self
.
Close
;
end
;
end
;
procedure
MoveListViewItem
(
ListView
:
TListView
;
IndexFrom
,
IndexTo
:
Integer
);
var
Source
,
Target
:
TListItem
;
begin
listview
.
Items
.
BeginUpdate
;
try
Source
:=
listview
.
Items
[
IndexFrom
];
Target
:=
listview
.
Items
.
Insert
(
IndexTo
);
Target
.
Assign
(
Source
);
Target
.
Checked
:=
Source
.
Checked
;
Source
.
Free
;
finally
listview
.
Items
.
EndUpdate
;
end
;
end
;
procedure
TitCadastrarFormulario
.
btnDownClick
(
Sender
:
TObject
);
procedure
TitCadastrarFormulario
.
btnDownClick
(
Sender
:
TObject
);
var
var
lIndex
:
Integer
;
lIndex
:
Integer
;
begin
begin
lIndex
:=
lvCampos
.
Selected
.
Index
;
lIndex
:=
lvCampos
.
Selected
.
Index
;
//lvCampos.MoveDown(lIndex);
if
lIndex
<>
lvCampos
.
Items
.
Count
-
1
then
begin
MoveListViewItem
(
lvCampos
,
lIndex
,
lIndex
+
2
);
lvCampos
.
Selected
:=
lvCampos
.
Items
[
lIndex
+
1
];
end
;
lvCampos
.
SetFocus
;
end
;
end
;
procedure
TitCadastrarFormulario
.
btnUpClick
(
Sender
:
TObject
);
procedure
TitCadastrarFormulario
.
btnUpClick
(
Sender
:
TObject
);
...
@@ -234,7 +271,12 @@ var
...
@@ -234,7 +271,12 @@ var
lIndex
:
Integer
;
lIndex
:
Integer
;
begin
begin
lIndex
:=
lvCampos
.
Selected
.
Index
;
lIndex
:=
lvCampos
.
Selected
.
Index
;
//lvCampos.MoveUp(lIndex);
if
lIndex
<>
0
then
begin
MoveListViewItem
(
lvCampos
,
lIndex
,
lIndex
-
1
);
lvCampos
.
Selected
:=
lvCampos
.
Items
[
lIndex
-
1
];
end
;
lvCampos
.
SetFocus
;
end
;
end
;
...
@@ -300,81 +342,62 @@ begin
...
@@ -300,81 +342,62 @@ begin
end
;
end
;
end
;
end
;
procedure
TitCadastrarFormulario
.
lstAtributosClear
;
procedure
TitCadastrarFormulario
.
edtNomeChange
(
Sender
:
TObject
);
var
i
:
Integer
;
begin
begin
if
lstAtributos
.
RowCount
>
2
then
lvCampos
.
Selected
.
Caption
:=
edtNome
.
Text
;
for
i
:=
lstAtributos
.
RowCount
-
1
downto
1
do
lstAtributos
.
DeleteRow
(
i
)
else
lstAtributos
.
Values
[
lstAtributos
.
Keys
[
1
]]
:=
''
;
end
;
end
;
procedure
TitCadastrarFormulario
.
edtDisplayNomeChange
(
Sender
:
TObject
);
begin
lvCampos
.
Selected
.
SubItems
[
__DISPLAY_NAME
]
:=
edtDisplayNome
.
Text
;
end
;
procedure
TitCadastrarFormulario
.
lstAtributosValidate
(
Sender
:
TObject
;
ACol
,
procedure
TitCadastrarFormulario
.
lstAtributosValidate
Entry
(
sender
:
TObject
;
ARow
:
Integer
;
const
KeyName
,
KeyValue
:
s
tring
);
aCol
,
aRow
:
Integer
;
const
OldValue
:
string
;
var
NewValue
:
S
tring
);
var
var
lField
,
lAttributeField
,
lTypeField
:
utField
;
lField
,
lAttributeField
,
lTypeField
:
utField
;
lOID
,
lAttributeType
,
lIntValue
:
Integer
;
lOID
,
lAttributeType
,
lIntValue
:
Integer
;
l
OK
,
l
BoolValue
:
Boolean
;
lBoolValue
:
Boolean
;
l
Messag
e
:
string
;
l
KeyNam
e
:
string
;
begin
begin
if
(
lvCampos
.
SelCount
>
0
)
and
(
lvCampos
.
Selected
.
SubItems
[
__TIPO
]
<>
''
)
then
if
NewValue
<>
OldValue
then
begin
begin
lKeyName
:=
lstAtributos
.
Keys
[
aRow
];
lTypeField
:=
fTypesField
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__TIPO
]);
lTypeField
:=
fTypesField
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__TIPO
]);
lAttributeType
:=
lTypeField
.
FieldByName
(
'Attributes'
).
FieldByName
(
KeyName
).
AttributeByName
(
'type'
).
AsInteger
;
lAttributeType
:=
lTypeField
.
FieldByName
(
'Attributes'
).
FieldByName
(
l
KeyName
).
AttributeByName
(
'type'
).
AsInteger
;
lOK
:=
True
;
if
NewValue
=
''
then
if
lAttributeType
=
__NUMBER
then
begin
begin
lOK
:=
TryStrToInt
(
KeyValue
,
lIntValue
);
lField
:=
fFieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
lMessage
:=
'Atributo '
+
KeyName
+
' deve ser do tipo INTEGER'
;
if
lField
.
HasField
(
lKeyName
)
then
end
lField
.
RemoveField
(
lField
.
FieldByName
(
lKeyName
));
else
if
lAttributeType
=
__BOOLEAN
then
Exit
;
begin
lOK
:=
TryStrToBool
(
KeyValue
,
lBoolValue
);
lMessage
:=
'Atributo '''
+
KeyName
+
''' deve ser do tipo BOOLEAN'
;
end
;
end
;
if
KeyValue
<>
''
then
if
(
lAttributeType
=
__NUMBER
)
and
(
TryStrToInt
(
NewValue
,
lIntValue
)
=
False
)
then
raise
Exception
.
Create
(
'Atributo '
+
lKeyName
+
' deve ser do tipo INTEGER'
);
if
(
lAttributeType
=
__BOOLEAN
)
and
(
TryStrToBool
(
NewValue
,
lBoolValue
)
=
False
)
then
raise
Exception
.
Create
(
'Atributo '''
+
lKeyName
+
''' deve ser do tipo BOOLEAN'
);
//caso os dados estejam validos:
lOID
:=
Integer
(
lstAtributos
.
Strings
.
Objects
[
lstAtributos
.
Strings
.
IndexOfName
(
lKeyName
)]);
lField
:=
fFieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
if
lField
.
HasField
(
lKeyName
)
then
begin
begin
if
lOK
then
lAttributeField
:=
lField
.
FieldByName
(
lKeyName
);
begin
lAttributeField
.
AttributeByName
(
'OID'
).
AsInteger
:=
lOID
;
lOID
:=
Integer
(
lstAtributos
.
Strings
.
Objects
[
lstAtributos
.
Strings
.
IndexOfName
(
KeyName
)]);
lAttributeField
.
AttributeByName
(
'value'
).
AsString
:=
NewValue
;
lField
:=
fFieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
if
lField
.
HasField
(
KeyName
)
then
begin
lAttributeField
:=
lField
.
FieldByName
(
KeyName
);
lAttributeField
.
AttributeByName
(
'OID'
).
AsInteger
:=
lOID
;
lAttributeField
.
AttributeByName
(
'value'
).
AsString
:=
KeyValue
;
end
else
begin
lAttributeField
:=
lField
.
AddField
(
KeyName
);
lAttributeField
.
AddAttribute
(
'OID'
).
AsInteger
:=
lOID
;
lAttributeField
.
AddAttribute
(
'value'
).
AsString
:=
KeyValue
;
end
;
end
else
begin
// lstAtributos.Col := ACol;
// lstAtributos.Row := ARow;
//lstAtributos.Values[KeyName] := '';
//MessageDlg(lMessage, mtError, [mbOK], 0);
raise
Exception
.
Create
(
lMessage
);
end
;
end
end
else
else
begin
begin
l
Field
:=
fFieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
l
AttributeField
:=
lField
.
AddField
(
lKeyName
);
if
lField
.
HasField
(
KeyName
)
then
lAttributeField
.
AddAttribute
(
'OID'
).
AsInteger
:=
lOID
;
lField
.
RemoveField
(
lField
.
FieldByName
(
KeyName
))
;
lAttributeField
.
AddAttribute
(
'value'
).
AsString
:=
NewValue
;
end
;
end
;
end
;
end
;
end
;
end
;
procedure
TitCadastrarFormulario
.
rbNaoChange
(
Sender
:
TObject
);
procedure
TitCadastrarFormulario
.
rbNaoChange
(
Sender
:
TObject
);
begin
begin
lvCampos
.
Selected
.
SubItems
[
__OBRIGATORIO
]
:=
'N'
;
lvCampos
.
Selected
.
SubItems
[
__OBRIGATORIO
]
:=
'N'
;
...
@@ -397,6 +420,10 @@ begin
...
@@ -397,6 +420,10 @@ begin
lblOrdem
.
Enabled
:=
False
;
lblOrdem
.
Enabled
:=
False
;
lblObrigatorio
.
Enabled
:=
False
;
lblObrigatorio
.
Enabled
:=
False
;
lblTipoAtributo
.
Enabled
:=
False
;
lblTipoAtributo
.
Enabled
:=
False
;
lblNome
.
Enabled
:=
False
;
lblDisplayNome
.
Enabled
:=
False
;
edtNome
.
Enabled
:=
False
;
edtDisplayNome
.
Enabled
:=
False
;
lstAtributos
.
Enabled
:=
False
;
lstAtributos
.
Enabled
:=
False
;
lstAtributos
.
Clear
;
lstAtributos
.
Clear
;
end
end
...
@@ -410,6 +437,10 @@ begin
...
@@ -410,6 +437,10 @@ begin
lblOrdem
.
Enabled
:=
True
;
lblOrdem
.
Enabled
:=
True
;
lblObrigatorio
.
Enabled
:=
True
;
lblObrigatorio
.
Enabled
:=
True
;
lblTipoAtributo
.
Enabled
:=
True
;
lblTipoAtributo
.
Enabled
:=
True
;
lblNome
.
Enabled
:=
True
;
lblDisplayNome
.
Enabled
:=
True
;
edtNome
.
Enabled
:=
True
;
edtDisplayNome
.
Enabled
:=
True
;
lstAtributos
.
Enabled
:=
True
;
lstAtributos
.
Enabled
:=
True
;
end
;
end
;
end
;
end
;
...
@@ -418,8 +449,8 @@ procedure TitCadastrarFormulario.lvCamposSelectItem(Sender: TObject; Item: TList
...
@@ -418,8 +449,8 @@ procedure TitCadastrarFormulario.lvCamposSelectItem(Sender: TObject; Item: TList
begin
begin
if
Selected
then
if
Selected
then
begin
begin
//
edtNome.Text := Item.Caption;
edtNome
.
Text
:=
Item
.
Caption
;
//edtNomeDisplay
.Text := Item.SubItems[__DISPLAY_NAME];
edtDisplayNome
.
Text
:=
Item
.
SubItems
[
__DISPLAY_NAME
];
if
Item
.
SubItems
[
__OBRIGATORIO
]
=
'N'
then
if
Item
.
SubItems
[
__OBRIGATORIO
]
=
'N'
then
rbNao
.
Checked
:=
True
rbNao
.
Checked
:=
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment