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
d7ffe4a3
Commit
d7ffe4a3
authored
Mar 16, 2020
by
Lucio Sandrini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementação de Cadastro de Formulário (Dynamo) finalizada.
parent
3cf47eb1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
59 deletions
+183
-59
cxuCadastroDefinicaoClasse.pas
EvoUMLPlugin/src/cxuCadastroDefinicaoClasse.pas
+2
-2
ituCadastrarFormulario.lfm
EvoUMLPlugin/src/ituCadastrarFormulario.lfm
+14
-5
ituCadastrarFormulario.pas
EvoUMLPlugin/src/ituCadastrarFormulario.pas
+167
-52
No files found.
EvoUMLPlugin/src/cxuCadastroDefinicaoClasse.pas
View file @
d7ffe4a3
...
...
@@ -43,7 +43,7 @@ procedure cxCadastroDefinicaoClasse.rmSalvaObjeto(piField: utField; const piResp
var
lRequestMessage
:
mxRequestMessage
;
lResponseMessage
:
mxAnswerMessage
;
begin
lRequestMessage
:=
self
.
NewRequest
(
'RM_SALVA
_OBJETO
'
,
piField
);
lRequestMessage
:=
self
.
NewRequest
(
'RM_SALVA
R
'
,
piField
);
try
lResponseMessage
:=
self
.
Session
.
SendRequest
(
lRequestMessage
);
try
...
...
@@ -60,7 +60,7 @@ procedure cxCadastroDefinicaoClasse.rmExcluiObjeto(piField: utField; const piRes
var
lRequestMessage
:
mxRequestMessage
;
lResponseMessage
:
mxAnswerMessage
;
begin
lRequestMessage
:=
self
.
NewRequest
(
'RM_EXCLUI
_OBJETO
'
,
piField
);
lRequestMessage
:=
self
.
NewRequest
(
'RM_EXCLUI
R
'
,
piField
);
try
lResponseMessage
:=
self
.
Session
.
SendRequest
(
lRequestMessage
);
try
...
...
EvoUMLPlugin/src/ituCadastrarFormulario.lfm
View file @
d7ffe4a3
...
...
@@ -184,7 +184,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
TabOrder = 0
end
object lblNomeForm: TLabel
Left = 46
7
Left = 46
6
Height = 18
Top = 16
Width = 145
...
...
@@ -196,8 +196,8 @@ object itCadastrarFormulario: TitCadastrarFormulario
ParentColor = False
ParentFont = False
end
object edtNome
1
: TEdit
Left = 63
2
object edtNome
Form
: TEdit
Left = 63
1
Height = 23
Top = 13
Width = 140
...
...
@@ -205,7 +205,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
TabOrder = 1
end
object lblCodigoForm: TLabel
Left = 46
7
Left = 46
6
Height = 18
Top = 40
Width = 157
...
...
@@ -218,13 +218,22 @@ object itCadastrarFormulario: TitCadastrarFormulario
ParentFont = False
end
object lblCodigoForm2: TLabel
Left = 63
2
Left = 63
1
Height = 15
Top = 40
Width = 80
Caption = 'lblCodigoForm'
ParentColor = False
end
object btnExcluir: TButton
Left = 784
Height = 49
Top = 8
Width = 140
Caption = 'EXCLUIR'
OnClick = btnExcluirClick
TabOrder = 2
end
end
object lstAtributos: TValueListEditor
Left = 634
...
...
EvoUMLPlugin/src/ituCadastrarFormulario.pas
View file @
d7ffe4a3
...
...
@@ -8,17 +8,18 @@ uses
LCLIntf
,
LCLType
,
LMessages
,
Messages
,
SysUtils
,
Variants
,
Classes
,
Graphics
,
Controls
,
Forms
,
StdCtrls
,
Dialogs
,
JvExControls
,
ComCtrls
,
ExtCtrls
,
Buttons
,
MaskEdit
,
JvBaseEdits
,
JvCheckBox
,
utuMessage
,
Grids
,
ValEdit
,
StarUMLintf
,
cxuCadastroDefinicaoClasse
,
IntegracaoDelphiSUML
;
cxuCadastroDefinicaoClasse
,
IntegracaoDelphiSUML
,
acuModel
;
type
{ TitCadastrarFormulario }
TitCadastrarFormulario
=
class
(
TForm
)
btnExcluir
:
TButton
;
cbbForm
:
TComboBox
;
edtNome
:
TEdit
;
edtDisplayNome
:
TEdit
;
edtNome
1
:
TEdit
;
edtNome
Form
:
TEdit
;
lblCodigoForm
:
TLabel
;
lblCodigoForm2
:
TLabel
;
lblNomeForm
:
TLabel
;
...
...
@@ -46,6 +47,7 @@ type
edtCampo
:
TEdit
;
lblNovoCampo
:
TLabel
;
btnAdd
:
TSpeedButton
;
procedure
btnExcluirClick
(
Sender
:
TObject
);
procedure
cbbFormSelect
(
Sender
:
TObject
);
procedure
edtDisplayNomeChange
(
Sender
:
TObject
);
procedure
edtNomeChange
(
Sender
:
TObject
);
...
...
@@ -79,6 +81,7 @@ type
procedure
Initialize
;
procedure
SendToInterface
(
piField
:
utField
);
procedure
FillListViewClassData
(
piClass
:
acClassTicket
);
function
AdicionarCampo
(
piName
:
string
)
:
TListItem
;
public
Constructor
Create
(
Sender
:
TComponent
;
piCadastroClasse
:
cxCadastroDefinicaoClasse
;
piUMLClass
:
IUMLClass
);
reintroduce
;
...
...
@@ -91,7 +94,7 @@ type
implementation
uses
acuObject
,
acuFramework
,
acuModel
;
acuObject
,
acuFramework
;
const
__STRING
=
1
;
...
...
@@ -185,6 +188,10 @@ begin
begin
lFieldItem
:=
lEnum
.
Current
as
utField
;
lFieldItem
.
Name
:=
lFieldItem
.
AttributeByName
(
'OID'
).
AsString
;
if
lFieldItem
.
HasAttribute
(
'name'
)
then
cbbForm
.
AddItem
(
lFieldItem
.
AttributeByName
(
'name'
).
AsString
,
Pointer
(
lFieldItem
.
AttributeByName
(
'OID'
).
AsInteger
))
else
cbbForm
.
AddItem
(
lFieldItem
.
AttributeByName
(
'code'
).
AsString
,
Pointer
(
lFieldItem
.
AttributeByName
(
'OID'
).
AsInteger
));
lEnum
.
MoveNext
;
end
;
...
...
@@ -198,31 +205,119 @@ begin
{preenche a listview com os atributos e relaes da classe}
lClass
:=
fUtil
.
MetaModel
.
ClassTicketByCode
[
fClassCode
]
as
acClassTicket
;
//lClass := fUtil.MetaModel.ClassTicketByCode[fClassCode] as acClassTicket;
//FillListViewClassData(lClass);
end
;
for
i
:=
0
to
lClass
.
Attributes
.
Count
-
1
do
procedure
TitCadastrarFormulario
.
FillListViewClassData
(
piClass
:
acClassTicket
);
var
lRelationName
:
string
;
i
:
Integer
;
begin
for
i
:=
0
to
piClass
.
Attributes
.
Count
-
1
do
begin
AdicionarCampo
(
l
Class
.
Attributes
[
i
]);
AdicionarCampo
(
pi
Class
.
Attributes
[
i
]);
end
;
for
i
:=
0
to
l
Class
.
RelationTicketsIn
.
Count
-
1
do
for
i
:=
0
to
pi
Class
.
RelationTicketsIn
.
Count
-
1
do
begin
lRelationName
:=
acRelationTicket
(
l
Class
.
RelationTicketsIn
.
Objects
[
i
]).
DestinationPropertyName
;
lRelationName
:=
acRelationTicket
(
pi
Class
.
RelationTicketsIn
.
Objects
[
i
]).
DestinationPropertyName
;
if
lRelationName
<>
''
then
AdicionarCampo
(
lRelationName
);
end
;
for
i
:=
0
to
l
Class
.
RelationTicketsOut
.
Count
-
1
do
for
i
:=
0
to
pi
Class
.
RelationTicketsOut
.
Count
-
1
do
begin
lRelationName
:=
acRelationTicket
(
l
Class
.
RelationTicketsOut
.
Objects
[
i
]).
OriginPropertyName
;
lRelationName
:=
acRelationTicket
(
pi
Class
.
RelationTicketsOut
.
Objects
[
i
]).
OriginPropertyName
;
if
lRelationName
<>
''
then
AdicionarCampo
(
lRelationName
);
end
;
lvCampos
.
Selected
:=
nil
;
end
;
procedure
TitCadastrarFormulario
.
btnSalvarClick
(
Sender
:
TObject
);
var
lField
,
lResponseField
,
lFormField
,
lFields
,
lNewForm
,
lFieldField
,
lTypeField
,
lTypeSelectRelation
:
utField
;
lOrder
,
lFormOID
:
Integer
;
lItem
:
TListItem
;
begin
lField
:=
utField
.
Create
;
lFormField
:=
lField
.
AddField
(
'Form'
);
if
cbbForm
.
Text
<>
'Novo'
then
lFormField
.
AddAttribute
(
'OID'
).
AsInteger
:=
Integer
(
cbbForm
.
Items
.
Objects
[
cbbForm
.
ItemIndex
]);
if
edtNomeForm
.
Text
<>
''
then
lFormField
.
AddAttribute
(
'name'
).
AsString
:=
edtNomeForm
.
Text
;
lFields
:=
lFormField
.
AddField
(
'Fields'
);
lOrder
:=
0
;
for
lItem
in
lvCampos
.
Items
do
begin
if
lItem
.
Checked
then
begin
if
(
lItem
.
Caption
=
''
)
or
(
lItem
.
SubItems
[
__DISPLAY_NAME
]
=
''
)
then
raise
Exception
.
Create
(
'Todos os campos devem possuir um nome e um display nome'
);
if
lItem
.
SubItems
[
__TIPO
]
=
''
then
raise
Exception
.
Create
(
'O campo '''
+
lItem
.
Caption
+
''' deve possuir um tipo'
);
if
lItem
.
SubItems
[
__TIPO
]
=
'ftSelectRelation'
then
begin
lTypeSelectRelation
:=
fFormFields
.
FieldByName
(
lItem
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
if
not
lTypeSelectRelation
.
HasField
(
'labelAttribute'
)
then
begin
raise
Exception
.
Create
(
'O campo '''
+
lItem
.
Caption
+
''' deve preencher o valor da Key: ''labelAttribute'''
);
end
end
;
lFieldField
:=
lFields
.
AddField
(
'Field'
);
lFieldField
.
AddAttribute
(
'name'
).
AsString
:=
lItem
.
Caption
;
lFieldField
.
AddAttribute
(
'displayName'
).
AsString
:=
lItem
.
SubItems
[
__DISPLAY_NAME
];
lFieldField
.
AddAttribute
(
'order'
).
AsInteger
:=
lOrder
;
lFieldField
.
AddAttribute
(
'required'
).
AsBoolean
:=
(
lItem
.
SubItems
[
__OBRIGATORIO
]
=
'S'
);
lFieldField
.
AddAttribute
(
'id'
).
AsInteger
:=
StrToInt
(
lItem
.
SubItems
[
__ID
]);
lTypeField
:=
lFieldField
.
AddField
(
'Type'
);
lTypeField
.
Assign
(
fFormFields
.
FieldByName
(
lItem
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
));
lOrder
:=
lOrder
+
1
;
end
;
end
;
if
not
lFields
.
HasField
(
'Field'
)
then
raise
Exception
.
Create
(
'O formulrio deve possuir pelo menos um campo, use as CheckBoxes para escolhe-los.'
);
lResponseField
:=
utField
.
Create
;
fcxCadastroDefinicaoClasse
.
rmSalvaObjeto
(
lField
,
lResponseField
);
{caso tenha sido salvo com sucesso}
if
lResponseField
.
HasField
(
'Form'
)
then
begin
lFormOID
:=
lResponseField
.
FieldByName
(
'Form'
).
AttributeByName
(
'OID'
).
AsInteger
;
if
cbbForm
.
Text
=
'Novo'
then
begin
lblCodigoForm2
.
Caption
:=
IntToStr
(
lFormOID
);
cbbForm
.
Items
.
Objects
[
cbbForm
.
ItemIndex
]
:=
Pointer
(
lFormOID
);
cbbForm
.
Items
[
cbbForm
.
ItemIndex
]
:=
IntToStr
(
lFormOID
);
{mudar para o nome depois---------------------}
cbbForm
.
AddItem
(
'Novo'
,
nil
);
lNewForm
:=
fForms
.
AddField
(
'Form'
);
lNewForm
.
Assign
(
lResponseField
.
FieldByName
(
'Form'
));
lNewForm
.
Name
:=
IntToStr
(
lFormOID
);
end
else
begin
//cbbForm.Text := IntToStr(lFormOID); {mudar para o nome depois---------------------}
fForms
.
FieldByName
(
IntToStr
(
lFormOID
)).
Assign
(
lResponseField
.
FieldByName
(
'Form'
));
fForms
.
FieldByName
(
'Form'
).
Name
:=
IntToStr
(
lFormOID
);
end
;
if
lResponseField
.
FieldByName
(
'Form'
).
HasAttribute
(
'name'
)
then
begin
cbbForm
.
Items
[
cbbForm
.
ItemIndex
]
:=
lResponseField
.
FieldByName
(
'Form'
).
AttributeByName
(
'name'
).
AsString
;
edtNomeForm
.
Text
:=
lResponseField
.
FieldByName
(
'Form'
).
AttributeByName
(
'name'
).
AsString
;
end
;
application
.
MessageBox
(
'Formulrio salvo com sucesso.'
,
'StarUML'
,
MB_ICONASTERISK
+
MB_OK
);
end
else
raise
Exception
.
Create
(
'Erro ao salvar formulrio.'
);
end
;
function
TitCadastrarFormulario
.
AdicionarCampo
(
piName
:
string
)
:
TListItem
;
...
...
@@ -318,69 +413,52 @@ end;
procedure
TitCadastrarFormulario
.
cbbFormSelect
(
Sender
:
TObject
);
var
lField
,
lResponseField
,
lField
Item
:
utField
;
l
Code
,
lFieldName
,
lFormOID
,
teste
:
string
;
lFieldItem
:
utField
;
l
FieldName
,
lFormOID
:
string
;
lEnum
:
acEnumerator
;
lItem
:
TListItem
;
lPosition
,
lIndex
,
lId
:
Integer
;
lId
:
Integer
;
lClass
:
acClassTicket
;
begin
lvCampos
.
Clear
;
lblCodigoForm2
.
Caption
:=
''
;
edtNomeForm
.
Clear
;
fIdCount
:=
0
;
if
cbbForm
.
Text
=
'Novo'
then
begin
if
not
fForms
.
HasField
(
'Novo'
)
then
begin
fForms
.
AddField
(
'Novo'
);
lField
:=
utField
.
Create
;
lResponseField
:=
utField
.
Create
;
fcxCadastroDefinicaoClasse
.
rmIncluiObjeto
(
lField
,
lResponseField
);
cbbForm
.
Items
.
Objects
[
cbbForm
.
ItemIndex
]
:=
Pointer
(
lResponseField
.
FieldByName
(
'Form'
).
AttributeByName
(
'OID'
).
AsInteger
);
end
;
if
not
fForms
.
HasField
(
'Novo'
)
then
fForms
.
AddField
(
'Novo'
);
if
fFormFields
<>
nil
then
fFormFields
.
Free
;
fFormFields
:=
utField
.
Create
;
lblCodigoForm2
.
Caption
:=
IntToStr
(
Integer
(
cbbForm
.
Items
.
Objects
[
cbbForm
.
ItemIndex
]));
end
else
begin
lFormOID
:=
IntToStr
(
Integer
(
cbbForm
.
Items
.
Objects
[
cbbForm
.
ItemIndex
]));
lblCodigoForm2
.
Caption
:=
fForms
.
FieldByName
(
lFormOID
).
AttributeByName
(
'OID'
).
AsString
;
//lFormOID;
fFormFIelds
:=
utField
.
Create
;
lblCodigoForm2
.
Caption
:=
lFormOID
;
fFormFields
.
Assign
(
fForms
.
FieldByName
(
lFormOID
).
FieldByName
(
'Fields'
));
if
fForms
.
FieldByName
(
lFormOID
).
HasAttribute
(
'name'
)
then
edtNomeForm
.
Text
:=
fForms
.
FieldByName
(
lFormOID
).
AttributeByName
(
'name'
).
AsString
;
lEnum
:=
fFormFields
.
GetFieldsEnumerator
;
try
while
not
lEnum
.
EOL
do
begin
lFieldItem
:=
lEnum
.
Current
as
utField
;
teste
:=
lFieldItem
.
GetXMLString
;
if
lFieldItem
.
Name
<>
'Field'
then
Break
;
lFieldName
:=
lFieldItem
.
AttributeByName
(
'name'
).
AsString
;
lId
:=
lFieldItem
.
AttributeByName
(
'id'
).
AsInteger
;
if
lId
>
fIdCount
then
fIdCount
:=
lId
;
if
lId
>
fIdCount
then
fIdCount
:=
lId
-
1
;
lItem
:=
AdicionarCampo
(
lFieldName
);
lItem
.
Checked
:=
True
;
lItem
.
SubItems
[
__DISPLAY_NAME
]
:=
lFieldItem
.
AttributeByName
(
'displayName'
).
AsString
;
lItem
.
SubItems
[
__OBRIGATORIO
]
:=
lFieldItem
.
AttributeByName
(
'required'
).
AsString
;
lItem
.
SubItems
[
__ID
]
:=
lFieldItem
.
AttributeByName
(
'id'
).
AsString
;
lItem
.
SubItems
[
__TIPO
]
:=
lFieldItem
.
FieldByName
(
'Type'
).
AttributeByName
(
'name'
).
AsString
;
//lPosition := lFieldItem.AttributeByName('order').AsInteger;
//lIndex := lItem.Index;
//
//while lIndex > lPosition do
//begin
// lvCampos.MoveUp(lIndex, False);
// lIndex := lIndex - 1;
//end;
//
//while lIndex < lPosition do
//begin
// lvCampos.MoveDown(lIndex, False);
// lIndex := lIndex + 1;
//end;
//
lFieldItem
.
Name
:=
IntToStr
(
lId
);
//fFormFields.AddField(IntToStr(lId));
//fFormFields.FieldByName(IntToStr(lId)).Assign(lFieldItem);
lEnum
.
MoveNext
;
end
;
...
...
@@ -388,6 +466,37 @@ begin
lEnum
.
Free
;
end
;
end
;
lClass
:=
fUtil
.
MetaModel
.
ClassTicketByCode
[
fClassCode
]
as
acClassTicket
;
FillListViewClassData
(
lClass
);
lvCampos
.
Selected
:=
nil
;
lvCamposClick
(
nil
);
end
;
procedure
TitCadastrarFormulario
.
btnExcluirClick
(
Sender
:
TObject
);
var
lField
,
lResponseField
,
lFormField
:
utField
;
lClass
:
acClassTicket
;
begin
if
cbbForm
.
Text
=
'Novo'
then
begin
lvCampos
.
Clear
;
cbbFormSelect
(
nil
);
end
else
begin
lField
:=
utField
.
Create
;
lResponseField
:=
utField
.
Create
;
lFormField
:=
lField
.
AddField
(
'Form'
);
lFormField
.
AddAttribute
(
'OID'
).
AsInteger
:=
Integer
(
cbbForm
.
Items
.
Objects
[
cbbForm
.
ItemIndex
]);
fcxCadastroDefinicaoClasse
.
rmExcluiObjeto
(
lField
,
lResponseField
);
cbbForm
.
Items
.
Delete
(
cbbForm
.
ItemIndex
);
cbbForm
.
ItemIndex
:=
0
;
cbbFormSelect
(
nil
);
end
;
end
;
procedure
TitCadastrarFormulario
.
cbbTipoChange
(
Sender
:
TObject
);
...
...
@@ -454,11 +563,13 @@ end;
procedure
TitCadastrarFormulario
.
edtNomeChange
(
Sender
:
TObject
);
begin
if
lvCampos
.
SelCount
<>
0
then
lvCampos
.
Selected
.
Caption
:=
edtNome
.
Text
;
end
;
procedure
TitCadastrarFormulario
.
edtDisplayNomeChange
(
Sender
:
TObject
);
begin
if
lvCampos
.
SelCount
<>
0
then
lvCampos
.
Selected
.
SubItems
[
__DISPLAY_NAME
]
:=
edtDisplayNome
.
Text
;
end
;
...
...
@@ -510,11 +621,13 @@ end;
procedure
TitCadastrarFormulario
.
rbNaoChange
(
Sender
:
TObject
);
begin
if
lvCampos
.
SelCount
<>
0
then
lvCampos
.
Selected
.
SubItems
[
__OBRIGATORIO
]
:=
'N'
;
end
;
procedure
TitCadastrarFormulario
.
rbSimChange
(
Sender
:
TObject
);
begin
if
lvCampos
.
SelCount
<>
0
then
lvCampos
.
Selected
.
SubItems
[
__OBRIGATORIO
]
:=
'S'
;
end
;
...
...
@@ -532,6 +645,8 @@ begin
lblTipoAtributo
.
Enabled
:=
False
;
lblNome
.
Enabled
:=
False
;
lblDisplayNome
.
Enabled
:=
False
;
edtNome
.
Clear
;
edtDisplayNome
.
Clear
;
edtNome
.
Enabled
:=
False
;
edtDisplayNome
.
Enabled
:=
False
;
lstAtributos
.
Enabled
:=
False
;
...
...
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