Commit fd27e393 authored by Jucelino Fonseca's avatar Jucelino Fonseca

Ajustes

parent 1a931289
...@@ -678,18 +678,22 @@ begin ...@@ -678,18 +678,22 @@ begin
end; end;
procedure TExplorerV2.MontarModelExploreHieraquia(Sender: TObject; Node: TTreeNode); procedure TExplorerV2.MontarModelExploreHieraquia(Sender: TObject; Node: TTreeNode);
var lClassTicket: acClassTicket; var lClassTicketChild,
lClassTicketPatriarc,
lClassTicket: acClassTicket;
lAttributeTicket: acAttributeTicket; lAttributeTicket: acAttributeTicket;
lRelationTicket: acRelationTicket; lRelationTicket: acRelationTicket;
lCardinality: string; lCardinality: string;
lEnumeratorChild,
lEnumerator: acEnumerator; lEnumerator: acEnumerator;
li: integer; li: integer;
lNodeParent, lNodeParent,
targetNode : TTreeNode; targetNode : TTreeNode;
lAchei,
lFiltro : boolean; lFiltro : boolean;
begin begin
lFiltro := trim(edtClasse.Text) <> ''; lFiltro := trim(edtClasse.Text) <> '';
if Node.HasChildren {and (Node.Count = 0)}then if Node.HasChildren and (Node.Count = 0) then
begin begin
Node.Owner.BeginUpdate; Node.Owner.BeginUpdate;
try try
...@@ -701,121 +705,132 @@ begin ...@@ -701,121 +705,132 @@ begin
while not lEnumerator.EOL do while not lEnumerator.EOL do
begin begin
lClassTicket := acClassTicket(lEnumerator.Current); lClassTicket := acClassTicket(lEnumerator.Current);
lAchei := false;
if not Assigned(lClassTicket.ParentClassTicket) then if not Assigned(lClassTicket.ParentClassTicket) then
begin begin
if BuscaParcialClasse(lClassTicket.PersistentObjectClassName,lFiltro) then if BuscaParcialClasse(lClassTicket.PersistentObjectClassName,lFiltro) then
begin begin
targetNode := Node.Owner.AddChildObject(Node, lClassTicket.PersistentObjectClassName, lClassTicket); lAchei := true;
targetNode.ImageIndex := 6; end
targetNode.HasChildren := True; else if lClassTicket.HasDescendants then
end;
end;
lEnumerator.MoveNext;
end;
finally
lEnumerator.Free;
end;
//Carrega os filhos
lEnumerator := acMetaModel(Node.Data).ClassTickets.GetEnumerator;
try
while not lEnumerator.EOL do
begin
lClassTicket := acClassTicket(lEnumerator.Current);
if Assigned(lClassTicket.ParentClassTicket) then
begin
if BuscaParcialClasse(lClassTicket.PersistentObjectClassName,lFiltro) then
begin begin
lNodeParent := Node.Owner.FindNodeWithData(lClassTicket.ParentClassTicket); lEnumeratorChild := lClassTicket.DirectDescendants.GetEnumerator;
if Assigned(lNodeParent) then try
begin while not lEnumeratorChild.EOL do
targetNode := Node.Owner.AddChildObject(lNodeParent, lClassTicket.PersistentObjectClassName, lClassTicket); begin
end lClassTicketChild := acClassTicket(lEnumeratorChild.Current);
else if BuscaParcialClasse(lClassTicketChild.PersistentObjectClassName,lFiltro) then
begin begin
targetNode := Node.Owner.AddChildObject(Node, lClassTicket.PersistentObjectClassName, lClassTicket); if not Assigned(Node.Owner.FindNodeWithData(lClassTicket)) then
begin
lAchei := true;
end;
end;
lEnumeratorChild.MoveNext;
end;
finally
lEnumeratorChild.Free;
end; end;
targetNode.ImageIndex := 6;
targetNode.HasChildren := True;
end; end;
end; end;
if lAchei then
begin
targetNode := Node.Owner.AddChildObject(Node, lClassTicket.PersistentObjectClassName, lClassTicket);
targetNode.ImageIndex := 6;
targetNode.HasChildren := True;
end;
lEnumerator.MoveNext; lEnumerator.MoveNext;
end; end;
finally finally
lEnumerator.Free; lEnumerator.Free;
end; end;
end end
else if (TObject(Node.Data) is acClassTicket) then else if (TObject(Node.Data) is acClassTicket) then
begin begin
lClassTicket := acClassTicket(Node.Data); lClassTicket := acClassTicket(Node.Data);
//repeat for li := 0 to pred(lClassTicket.Attributes.Count) do
for li := 0 to pred(lClassTicket.Attributes.Count) do begin
lAttributeTicket := acAttributeTicket(lClassTicket.Attributes.Objects[li]);
if lAttributeTicket.Stereotype = acAttributeStereotype.pvPersistent then
begin begin
lAttributeTicket := acAttributeTicket(lClassTicket.Attributes.Objects[li]); targetNode := Node.Owner.AddChildObject(Node, lAttributeTicket.AttributeName + ': ' + lAttributeTicket.AttributeType, lAttributeTicket);
if lAttributeTicket.Stereotype = acAttributeStereotype.pvPersistent then if lAttributeTicket.Mandatory then
targetNode.ImageIndex := 5
else
targetNode.ImageIndex := 0;
end;
end;
for li := 0 to pred(lClassTicket.RelationTicketsIn.Count) do
begin
lRelationTicket := acRelationTicket(lClassTicket.RelationTicketsIn.Objects[li]);
if lRelationTicket.DestinationMaxMultiplicity = N
then lCardinality := '*'
else lCardinality := inttostr(lRelationTicket.DestinationMaxMultiplicity);
if lRelationTicket.DestinationPropertyName <> '' then
begin
targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.DestinationPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.OriginClassTicket.PersistentObjectClassName, lRelationTicket.OriginClassTicket);
targetNode.HasChildren := True;
if lRelationTicket.DestinationMaxMultiplicity = N then
begin begin
targetNode := Node.Owner.AddChildObject(Node, lAttributeTicket.AttributeName + ': ' + lAttributeTicket.AttributeType, lAttributeTicket); if lRelationTicket.DestinationMinMultiplicity = 1 then
if lAttributeTicket.Mandatory then targetNode.ImageIndex := 4
targetNode.ImageIndex := 5
else else
targetNode.ImageIndex := 0; targetNode.ImageIndex := 2;
end
else
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 3
else
targetNode.ImageIndex := 1;
end; end;
end; end;
for li := 0 to pred(lClassTicket.RelationTicketsIn.Count) do end;
for li := 0 to pred(lClassTicket.RelationTicketsOut.Count) do
begin
lRelationTicket := acRelationTicket(lClassTicket.RelationTicketsOut.Objects[li]);
if lRelationTicket.OriginPropertyName <> '' then
begin begin
lRelationTicket := acRelationTicket(lClassTicket.RelationTicketsIn.Objects[li]); if lRelationTicket.OriginMaxMultiplicity = N
if lRelationTicket.DestinationMaxMultiplicity = N
then lCardinality := '*' then lCardinality := '*'
else lCardinality := inttostr(lRelationTicket.DestinationMaxMultiplicity); else lCardinality := inttostr(lRelationTicket.OriginMaxMultiplicity);
if lRelationTicket.DestinationPropertyName <> '' then targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.OriginPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.DestinationClassTicket.PersistentObjectClassName, lRelationTicket.DestinationClassTicket);
targetNode.HasChildren := True;
if lRelationTicket.OriginMaxMultiplicity = N then
begin begin
targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.DestinationPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.OriginClassTicket.PersistentObjectClassName, lRelationTicket.OriginClassTicket); if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.HasChildren := True; targetNode.ImageIndex := 4
if lRelationTicket.DestinationMaxMultiplicity = N then
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 4
else
targetNode.ImageIndex := 2;
end
else else
begin targetNode.ImageIndex := 2;
if lRelationTicket.DestinationMinMultiplicity = 1 then end
targetNode.ImageIndex := 3 else
else begin
targetNode.ImageIndex := 1; if lRelationTicket.DestinationMinMultiplicity = 1 then
end; targetNode.ImageIndex := 3
else
targetNode.ImageIndex := 1;
end; end;
end; end;
for li := 0 to pred(lClassTicket.RelationTicketsOut.Count) do end;
begin if lClassTicket.HasDescendants then
lRelationTicket := acRelationTicket(lClassTicket.RelationTicketsOut.Objects[li]); begin
if lRelationTicket.OriginPropertyName <> '' then //Carrega os filhos
lEnumerator := lClassTicket.DirectDescendants.GetEnumerator;
try
while not lEnumerator.EOL do
begin begin
if lRelationTicket.OriginMaxMultiplicity = N lClassTicketChild := acClassTicket(lEnumerator.Current);
then lCardinality := '*' targetNode := Node.Owner.AddChildObject(Node, lClassTicketChild.PersistentObjectClassName, lClassTicketChild);
else lCardinality := inttostr(lRelationTicket.OriginMaxMultiplicity); targetNode.ImageIndex := 6;
targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.OriginPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.DestinationClassTicket.PersistentObjectClassName, lRelationTicket.DestinationClassTicket);
targetNode.HasChildren := True; targetNode.HasChildren := True;
if lRelationTicket.OriginMaxMultiplicity = N then lEnumerator.MoveNext;
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 4
else
targetNode.ImageIndex := 2;
end
else
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 3
else
targetNode.ImageIndex := 1;
end;
end; end;
finally
lEnumerator.Free;
end; end;
//lClassTicket := lClassTicket.ParentClassTicket; end;
//until lClassTicket = nil;
end; end;
finally finally
Node.Owner.EndUpdate; Node.Owner.EndUpdate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment