Commit fd27e393 authored by Jucelino Fonseca's avatar Jucelino Fonseca

Ajustes

parent 1a931289
......@@ -678,18 +678,22 @@ begin
end;
procedure TExplorerV2.MontarModelExploreHieraquia(Sender: TObject; Node: TTreeNode);
var lClassTicket: acClassTicket;
var lClassTicketChild,
lClassTicketPatriarc,
lClassTicket: acClassTicket;
lAttributeTicket: acAttributeTicket;
lRelationTicket: acRelationTicket;
lCardinality: string;
lEnumeratorChild,
lEnumerator: acEnumerator;
li: integer;
lNodeParent,
targetNode : TTreeNode;
lAchei,
lFiltro : boolean;
begin
lFiltro := trim(edtClasse.Text) <> '';
if Node.HasChildren {and (Node.Count = 0)}then
if Node.HasChildren and (Node.Count = 0) then
begin
Node.Owner.BeginUpdate;
try
......@@ -701,121 +705,132 @@ begin
while not lEnumerator.EOL do
begin
lClassTicket := acClassTicket(lEnumerator.Current);
lAchei := false;
if not Assigned(lClassTicket.ParentClassTicket) then
begin
if BuscaParcialClasse(lClassTicket.PersistentObjectClassName,lFiltro) then
if BuscaParcialClasse(lClassTicket.PersistentObjectClassName,lFiltro) then
begin
targetNode := Node.Owner.AddChildObject(Node, lClassTicket.PersistentObjectClassName, lClassTicket);
targetNode.ImageIndex := 6;
targetNode.HasChildren := True;
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
lAchei := true;
end
else if lClassTicket.HasDescendants then
begin
lNodeParent := Node.Owner.FindNodeWithData(lClassTicket.ParentClassTicket);
if Assigned(lNodeParent) then
begin
targetNode := Node.Owner.AddChildObject(lNodeParent, lClassTicket.PersistentObjectClassName, lClassTicket);
end
else
begin
targetNode := Node.Owner.AddChildObject(Node, lClassTicket.PersistentObjectClassName, lClassTicket);
lEnumeratorChild := lClassTicket.DirectDescendants.GetEnumerator;
try
while not lEnumeratorChild.EOL do
begin
lClassTicketChild := acClassTicket(lEnumeratorChild.Current);
if BuscaParcialClasse(lClassTicketChild.PersistentObjectClassName,lFiltro) then
begin
if not Assigned(Node.Owner.FindNodeWithData(lClassTicket)) then
begin
lAchei := true;
end;
end;
lEnumeratorChild.MoveNext;
end;
finally
lEnumeratorChild.Free;
end;
targetNode.ImageIndex := 6;
targetNode.HasChildren := True;
end;
end;
if lAchei then
begin
targetNode := Node.Owner.AddChildObject(Node, lClassTicket.PersistentObjectClassName, lClassTicket);
targetNode.ImageIndex := 6;
targetNode.HasChildren := True;
end;
lEnumerator.MoveNext;
end;
finally
lEnumerator.Free;
end;
end
else if (TObject(Node.Data) is acClassTicket) then
begin
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
lAttributeTicket := acAttributeTicket(lClassTicket.Attributes.Objects[li]);
if lAttributeTicket.Stereotype = acAttributeStereotype.pvPersistent then
targetNode := Node.Owner.AddChildObject(Node, lAttributeTicket.AttributeName + ': ' + lAttributeTicket.AttributeType, lAttributeTicket);
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
targetNode := Node.Owner.AddChildObject(Node, lAttributeTicket.AttributeName + ': ' + lAttributeTicket.AttributeType, lAttributeTicket);
if lAttributeTicket.Mandatory then
targetNode.ImageIndex := 5
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 4
else
targetNode.ImageIndex := 0;
targetNode.ImageIndex := 2;
end
else
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 3
else
targetNode.ImageIndex := 1;
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
lRelationTicket := acRelationTicket(lClassTicket.RelationTicketsIn.Objects[li]);
if lRelationTicket.DestinationMaxMultiplicity = N
if lRelationTicket.OriginMaxMultiplicity = N
then lCardinality := '*'
else lCardinality := inttostr(lRelationTicket.DestinationMaxMultiplicity);
if lRelationTicket.DestinationPropertyName <> '' then
else lCardinality := inttostr(lRelationTicket.OriginMaxMultiplicity);
targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.OriginPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.DestinationClassTicket.PersistentObjectClassName, lRelationTicket.DestinationClassTicket);
targetNode.HasChildren := True;
if lRelationTicket.OriginMaxMultiplicity = N then
begin
targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.DestinationPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.OriginClassTicket.PersistentObjectClassName, lRelationTicket.OriginClassTicket);
targetNode.HasChildren := True;
if lRelationTicket.DestinationMaxMultiplicity = N then
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 4
else
targetNode.ImageIndex := 2;
end
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 4
else
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 3
else
targetNode.ImageIndex := 1;
end;
targetNode.ImageIndex := 2;
end
else
begin
if lRelationTicket.DestinationMinMultiplicity = 1 then
targetNode.ImageIndex := 3
else
targetNode.ImageIndex := 1;
end;
end;
for li := 0 to pred(lClassTicket.RelationTicketsOut.Count) do
begin
lRelationTicket := acRelationTicket(lClassTicket.RelationTicketsOut.Objects[li]);
if lRelationTicket.OriginPropertyName <> '' then
end;
if lClassTicket.HasDescendants then
begin
//Carrega os filhos
lEnumerator := lClassTicket.DirectDescendants.GetEnumerator;
try
while not lEnumerator.EOL do
begin
if lRelationTicket.OriginMaxMultiplicity = N
then lCardinality := '*'
else lCardinality := inttostr(lRelationTicket.OriginMaxMultiplicity);
targetNode := Node.Owner.AddChildObject(Node, lRelationTicket.OriginPropertyName + ': (' + lCardinality + ') ' + lRelationTicket.DestinationClassTicket.PersistentObjectClassName, lRelationTicket.DestinationClassTicket);
lClassTicketChild := acClassTicket(lEnumerator.Current);
targetNode := Node.Owner.AddChildObject(Node, lClassTicketChild.PersistentObjectClassName, lClassTicketChild);
targetNode.ImageIndex := 6;
targetNode.HasChildren := True;
if lRelationTicket.OriginMaxMultiplicity = N then
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;
lEnumerator.MoveNext;
end;
finally
lEnumerator.Free;
end;
//lClassTicket := lClassTicket.ParentClassTicket;
//until lClassTicket = nil;
end;
end;
finally
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