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
3cf47eb1
Commit
3cf47eb1
authored
Mar 11, 2020
by
Lucio Sandrini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementação de Cadastro de Formulário.
parent
39a85144
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
34 deletions
+198
-34
CurioAddIn.lpi
EvoUMLPlugin/src/CurioAddIn.lpi
+0
-3
cxuCadastroDefinicaoClasse.pas
EvoUMLPlugin/src/cxuCadastroDefinicaoClasse.pas
+1
-1
ituCadastrarFormulario.lfm
EvoUMLPlugin/src/ituCadastrarFormulario.lfm
+67
-10
ituCadastrarFormulario.pas
EvoUMLPlugin/src/ituCadastrarFormulario.pas
+130
-20
No files found.
EvoUMLPlugin/src/CurioAddIn.lpi
View file @
3cf47eb1
...
...
@@ -110,9 +110,6 @@
</Linking>
<Other>
<CustomOptions
Value=
"-dUseCThreads"
/>
<OtherDefines
Count=
"1"
>
<Define0
Value=
"FullDebugMode"
/>
</OtherDefines>
</Other>
</CompilerOptions>
</Item3>
...
...
EvoUMLPlugin/src/cxuCadastroDefinicaoClasse.pas
View file @
3cf47eb1
...
...
@@ -77,7 +77,7 @@ procedure cxCadastroDefinicaoClasse.rmIncluiObjeto(piField: utField; const piRes
var
lRequestMessage
:
mxRequestMessage
;
lResponseMessage
:
mxAnswerMessage
;
begin
lRequestMessage
:=
self
.
NewRequest
(
'RM_INCLUI
_OBJETO
'
,
piField
);
lRequestMessage
:=
self
.
NewRequest
(
'RM_INCLUI
R
'
,
piField
);
try
lResponseMessage
:=
self
.
Session
.
SendRequest
(
lRequestMessage
);
try
...
...
EvoUMLPlugin/src/ituCadastrarFormulario.lfm
View file @
3cf47eb1
object itCadastrarFormulario: TitCadastrarFormulario
Left =
356
Left =
628
Height = 482
Top =
218
Top =
321
Width = 937
ClientHeight = 482
ClientWidth = 937
...
...
@@ -134,12 +134,12 @@ object itCadastrarFormulario: TitCadastrarFormulario
ClientHeight = 72
ClientWidth = 948
TabOrder = 4
object lbl
Codigo
: TLabel
Left =
232
object lbl
Form
: TLabel
Left =
177
Height = 18
Top = 16
Width =
157
Caption = '
CÓDIGO DO
FORMULÁRIO:'
Width =
85
Caption = 'FORMULÁRIO:'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Trebuchet MS'
...
...
@@ -151,8 +151,8 @@ object itCadastrarFormulario: TitCadastrarFormulario
Left = 16
Height = 18
Top = 16
Width =
107
Caption = '
NOME DA
CLASSE:'
Width =
49
Caption = 'CLASSE:'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Trebuchet MS'
...
...
@@ -168,6 +168,63 @@ object itCadastrarFormulario: TitCadastrarFormulario
Caption = 'lblNomeClasse'
ParentColor = False
end
object cbbForm: TComboBox
Left = 272
Height = 24
Hint = 'Tipo'
Top = 13
Width = 140
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Trebuchet MS'
ItemHeight = 16
OnSelect = cbbFormSelect
ParentFont = False
Style = csDropDownList
TabOrder = 0
end
object lblNomeForm: TLabel
Left = 467
Height = 18
Top = 16
Width = 145
Caption = 'NOME DO FORMULÁRIO:'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Trebuchet MS'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object edtNome1: TEdit
Left = 632
Height = 23
Top = 13
Width = 140
AutoSize = False
TabOrder = 1
end
object lblCodigoForm: TLabel
Left = 467
Height = 18
Top = 40
Width = 157
Caption = 'CÓDIGO DO FORMULÁRIO:'
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Trebuchet MS'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object lblCodigoForm2: TLabel
Left = 632
Height = 15
Top = 40
Width = 80
Caption = 'lblCodigoForm'
ParentColor = False
end
end
object lstAtributos: TValueListEditor
Left = 634
...
...
@@ -241,7 +298,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
object rbNao: TRadioButton
Left = 859
Height = 19
Top = 1
90
Top = 1
87
Width = 42
Caption = 'Não'
OnChange = rbNaoChange
...
...
@@ -250,7 +307,7 @@ object itCadastrarFormulario: TitCadastrarFormulario
object rbSim: TRadioButton
Left = 813
Height = 19
Top = 1
90
Top = 1
87
Width = 40
Caption = 'Sim'
OnChange = rbSimChange
...
...
EvoUMLPlugin/src/ituCadastrarFormulario.pas
View file @
3cf47eb1
...
...
@@ -15,10 +15,15 @@ type
{ TitCadastrarFormulario }
TitCadastrarFormulario
=
class
(
TForm
)
cbbForm
:
TComboBox
;
edtNome
:
TEdit
;
edtDisplayNome
:
TEdit
;
edtNome1
:
TEdit
;
lblCodigoForm
:
TLabel
;
lblCodigoForm2
:
TLabel
;
lblNomeForm
:
TLabel
;
lblNomeClasse
:
TLabel
;
lbl
Codigo
:
TLabel
;
lbl
Form
:
TLabel
;
lblClasseName
:
TLabel
;
lblOrdem
:
TLabel
;
lblObrigatorio
:
TLabel
;
...
...
@@ -41,6 +46,7 @@ type
edtCampo
:
TEdit
;
lblNovoCampo
:
TLabel
;
btnAdd
:
TSpeedButton
;
procedure
cbbFormSelect
(
Sender
:
TObject
);
procedure
edtDisplayNomeChange
(
Sender
:
TObject
);
procedure
edtNomeChange
(
Sender
:
TObject
);
procedure
lstAtributosFill
(
piType
:
string
);
...
...
@@ -64,18 +70,20 @@ type
fUMLClass
:
IUMLClass
;
fcxCadastroDefinicaoClasse
:
cxCadastroDefinicaoClasse
;
fClassPackage
:
IUMLPackage
;
fClassCode
:
string
;
fFieldTypeList
:
utField
;
fForms
:
utField
;
fFormFields
:
utField
;
fTypesField
:
utField
;
fIdCount
:
Integer
;
procedure
Initialize
;
procedure
SendToInterface
(
piField
:
utField
);
procedure
AdicionarCampo
(
piName
:
string
)
;
function
AdicionarCampo
(
piName
:
string
)
:
TListItem
;
public
Constructor
Create
(
Sender
:
TComponent
;
piCadastroClasse
:
cxCadastroDefinicaoClasse
;
piUMLClass
:
IUMLClass
);
reintroduce
;
property
FieldTypeList
:
utField
read
fF
ieldTypeList
write
fFieldTypeList
;
property
FieldTypeList
:
utField
read
fF
ormFields
write
fFormFields
;
property
UMLClass
:
IUMLClass
read
fUMLClass
write
fUMLClass
;
property
ClassPackage
:
IUMLPackage
read
fClassPackage
write
fClassPackage
;
end
;
...
...
@@ -109,6 +117,7 @@ begin
begin
fUMLClass
:=
piUMLClass
;
lblNomeClasse
.
Caption
:=
fUMLClass
.
Name
;
fClassCode
:=
fUMLClass
.
GetTaggedValueAsString
(
'DBMappings'
,
'DBClassMap'
,
'Cod'
);
//lblClassIDO.Caption := fUMLClass.GetTaggedValueAsString('DBMappings', 'DBClassMap', 'DBIDO');
//lblClasseName.Caption := fUMLClass.GetTaggedValueAsString('DBMappings', 'DBClassMap', 'Table');
end
;
...
...
@@ -124,11 +133,16 @@ begin
end
;
procedure
TitCadastrarFormulario
.
Initialize
;
var
lField
,
lResponseField
:
utField
;
var
lField
,
lResponseField
,
lClassField
:
utField
;
begin
lField
:=
utField
.
Create
;
fForms
:=
utField
.
Create
;
fFormFields
:=
utField
.
Create
;
lResponseField
:=
utField
.
Create
;
fFieldTypeList
:=
utField
.
Create
;
lField
:=
utField
.
Create
;
lClassField
:=
lField
.
AddField
(
'Class'
);
lClassField
.
AddAttribute
(
'name'
).
AsString
:=
fUMLClass
.
Name
;
lClassField
.
AddAttribute
(
'code'
).
AsString
:=
fClassCode
;
fcxCadastroDefinicaoClasse
.
rmObtemContexto
(
lField
,
lResponseField
);
SendToInterface
(
lResponseField
);
...
...
@@ -139,7 +153,7 @@ procedure TitCadastrarFormulario.SendToInterface(piField: utField);
var
lFieldItem
:
utField
;
lEnum
:
acEnumerator
;
l
ClassCode
,
l
RelationName
:
string
;
lRelationName
:
string
;
lClass
:
acClassTicket
;
i
:
Integer
;
begin
...
...
@@ -153,18 +167,38 @@ begin
while
not
lEnum
.
EOL
do
{preenche a comboBox com os tipos de field }
begin
lFieldItem
:=
lEnum
.
Current
as
utField
;
cbbTipo
.
AddItem
(
lFieldItem
.
Name
,
Pointer
(
lFieldItem
.
AttributeByName
(
'OID'
).
AsInteger
));
lEnum
.
MoveNext
;
end
;
finally
lEnum
.
Free
;
end
;
end
;
{preenche a combo box de opes de formulrio da classe}
if
piField
.
HasField
(
'Forms'
)
then
begin
fForms
.
Assign
(
piField
.
FieldByName
(
'Forms'
));
lEnum
:=
fForms
.
ChildFields
.
GetEnumerator
;
try
while
not
lEnum
.
EOL
do
{preenche a comboBox com os tipos de field }
begin
lFieldItem
:=
lEnum
.
Current
as
utField
;
lFieldItem
.
Name
:=
lFieldItem
.
AttributeByName
(
'OID'
).
AsString
;
cbbForm
.
AddItem
(
lFieldItem
.
AttributeByName
(
'code'
).
AsString
,
Pointer
(
lFieldItem
.
AttributeByName
(
'OID'
).
AsInteger
));
lEnum
.
MoveNext
;
end
;
finally
lEnum
.
Free
;
end
;
end
;
cbbForm
.
AddItem
(
'Novo'
,
nil
);
cbbForm
.
ItemIndex
:=
0
;
cbbFormSelect
(
nil
);
lClassCode
:=
fUMLClass
.
GetTaggedValueAsString
(
'DBMappings'
,
'DBClassMap'
,
'Cod'
);
lClass
:=
fUtil
.
MetaModel
.
ClassTicketByCode
[
l
ClassCode
]
as
acClassTicket
;
{preenche a listview com os atributos e relaes da classe}
lClass
:=
fUtil
.
MetaModel
.
ClassTicketByCode
[
f
ClassCode
]
as
acClassTicket
;
for
i
:=
0
to
lClass
.
Attributes
.
Count
-
1
do
begin
...
...
@@ -182,6 +216,8 @@ begin
lRelationName
:=
acRelationTicket
(
lClass
.
RelationTicketsOut
.
Objects
[
i
]).
OriginPropertyName
;
if
lRelationName
<>
''
then
AdicionarCampo
(
lRelationName
);
end
;
lvCampos
.
Selected
:=
nil
;
end
;
...
...
@@ -189,7 +225,7 @@ procedure TitCadastrarFormulario.btnSalvarClick(Sender: TObject);
begin
end
;
procedure
TitCadastrarFormulario
.
AdicionarCampo
(
piName
:
string
)
;
function
TitCadastrarFormulario
.
AdicionarCampo
(
piName
:
string
)
:
TListItem
;
var
lItem
:
TListItem
;
begin
...
...
@@ -198,11 +234,11 @@ begin
if
lItem
=
nil
then
begin
fIdCount
:=
fIdCount
+
1
;
fF
ieldTypeList
.
AddField
(
IntToStr
(
fIdCount
));
fF
ormFields
.
AddField
(
IntToStr
(
fIdCount
));
lItem
:=
lvCampos
.
Items
.
Add
;
lItem
.
Caption
:=
piName
;
lItem
.
Checked
:=
True
;
//
lItem.Checked := True;
with
lItem
.
SubItems
do
begin
...
...
@@ -212,7 +248,8 @@ begin
Add
(
''
);
//tipo
end
;
end
else
raise
Exception
.
Create
(
'Campo '''
+
piName
+
''' j existe.'
);
else
lvCampos
.
Selected
:=
lItem
;
Result
:=
lItem
;
end
;
procedure
TitCadastrarFormulario
.
btnAddClick
(
Sender
:
TObject
);
...
...
@@ -279,6 +316,79 @@ begin
lvCampos
.
SetFocus
;
end
;
procedure
TitCadastrarFormulario
.
cbbFormSelect
(
Sender
:
TObject
);
var
lField
,
lResponseField
,
lFieldItem
:
utField
;
lCode
,
lFieldName
,
lFormOID
,
teste
:
string
;
lEnum
:
acEnumerator
;
lItem
:
TListItem
;
lPosition
,
lIndex
,
lId
:
Integer
;
begin
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
;
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
;
fFormFields
.
Assign
(
fForms
.
FieldByName
(
lFormOID
).
FieldByName
(
'Fields'
));
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
;
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
;
finally
lEnum
.
Free
;
end
;
end
;
end
;
procedure
TitCadastrarFormulario
.
cbbTipoChange
(
Sender
:
TObject
);
var
...
...
@@ -286,7 +396,7 @@ var
begin
lvCampos
.
Selected
.
SubItems
[
__TIPO
]
:=
cbbTipo
.
Text
;
lField
:=
fF
ieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]);
lField
:=
fF
ormFields
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]);
if
lField
.
HasField
(
'Type'
)
then
lField
.
RemoveField
(
lField
.
FieldByName
(
'Type'
));
...
...
@@ -318,9 +428,9 @@ begin
lAttribute
:=
lFieldItem
.
Name
;
lValue
:=
''
;
if
fF
ieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
HasField
(
'Type'
)
then
if
fF
ormFields
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
HasField
(
'Type'
)
then
begin
lTypeField
:=
fF
ieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
lTypeField
:=
fF
ormFields
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
if
lTypeField
.
HasField
(
lAttribute
)
then
lValue
:=
lTypeField
.
FieldByName
(
lAttribute
).
AttributeByName
(
'value'
).
AsString
;
end
;
...
...
@@ -368,7 +478,7 @@ var
if
NewValue
=
''
then
begin
lField
:=
fF
ieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
lField
:=
fF
ormFields
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
if
lField
.
HasField
(
lKeyName
)
then
lField
.
RemoveField
(
lField
.
FieldByName
(
lKeyName
));
Exit
;
...
...
@@ -382,7 +492,7 @@ var
//caso os dados estejam validos:
lOID
:=
Integer
(
lstAtributos
.
Strings
.
Objects
[
lstAtributos
.
Strings
.
IndexOfName
(
lKeyName
)]);
lField
:=
fF
ieldTypeList
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
lField
:=
fF
ormFields
.
FieldByName
(
lvCampos
.
Selected
.
SubItems
[
__ID
]).
FieldByName
(
'Type'
);
if
lField
.
HasField
(
lKeyName
)
then
begin
lAttributeField
:=
lField
.
FieldByName
(
lKeyName
);
...
...
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