Skip to content

Commit

Permalink
JNG-5840 fix abstraction for ViewPanels
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg committed Jul 17, 2024
1 parent c9870b2 commit 5638506
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ operation JSL!TransferDeclaration getAllRelations(): Set {
relations.addAll(linkRelations);
}

for (member in self.members.select(m | m.isTypeOf(JSL!ViewGroupDeclaration) or m.isTypeOf(JSL!ViewTabsDeclaration))) {
for (member in self.members.select(m | m.isKindOf(JSL!ViewPanelDeclaration))) {
relations.addAll(member.getAllRelations());
}

Expand All @@ -81,7 +81,7 @@ operation JSL!TransferDeclaration getAllPrimitiveFields(): Set {
var fields = new Set();
fields.addAll(self.members.select(m | m.isKindOf(JSL!TransferFieldDeclaration) and m.referenceType.isDefined() and m.referenceType.`primitive`.isDefined()));

for (member in self.members.select(m | m.isTypeOf(JSL!ViewPanelDeclaration))) {
for (member in self.members.select(m | m.isKindOf(JSL!ViewPanelDeclaration))) {
fields.addAll(member.getAllPrimitiveFields());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ operation JSL!TransferFieldDeclaration getTransferFieldDeclarationEquivalent():
operation JSL!TransferFieldDeclaration getTransferContainer(): JSL!TransferDeclaration {
if (self.eContainer.isKindOf(JSL!TransferDeclaration)) {
return self.eContainer;
} else if (self.eContainer.isKindOf(JSL!ViewGroupDeclaration) or self.eContainer.isKindOf(JSL!ViewTabsDeclaration) ) {
} else if (self.eContainer.isKindOf(JSL!ViewPanelDeclaration)) {
return self.eContainer.getTransferContainer();
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ operation JSL!TransferRelationDeclaration getTransferContainer(): JSL!TransferDe
return self.eContainer;
} else if (self.eContainer.isTypeOf(JSL!ActorGroupDeclaration)) {
return self.eContainer.getActorDeclaration();
} else if (self.eContainer.isKindOf(JSL!ViewGroupDeclaration) or self.eContainer.isKindOf(JSL!ViewTabsDeclaration)) {
} else if (self.eContainer.isKindOf(JSL!ViewPanelDeclaration)) {
return self.eContainer.getTransferContainer();
}
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,63 +1,52 @@
@cached
operation JSL!ViewGroupDeclaration getAllRelations(): Set {
operation JSL!ViewPanelDeclaration getAllRelations(): Set {
var relations = new Set();
relations.addAll(self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)));
for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) {
relations.addAll(group.getAllRelations());
}
for (tabs in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) {
relations.addAll(tabs.getAllRelations());
}
return relations;
}

@cached
operation JSL!ViewTabsDeclaration getAllRelations(): Set {
var relations = new Set();
for (group in self.groups) {
relations.addAll(group.getAllRelations());
if (self.isTypeOf(JSL!ViewGroupDeclaration)) {
relations.addAll(self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)));
for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) {
relations.addAll(group.getAllRelations());
}
for (tabs in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) {
relations.addAll(tabs.getAllRelations());
}
} else if (self.isTypeOf(JSL!ViewTabsDeclaration)) {
for (group in self.groups) {
relations.addAll(group.getAllRelations());
}
}

return relations;
}

@cached
operation JSL!ViewGroupDeclaration getAllPrimitiveFields(): Set {
operation JSL!ViewPanelDeclaration getAllPrimitiveFields(): Set {
var fields = new Set();
fields.addAll(self.members.select(m | m.isKindOf(JSL!TransferFieldDeclaration) and m.referenceType.isDefined() and m.referenceType.`primitive`.isDefined()));
for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) {
fields.addAll(group.getAllPrimitiveFields());
}
for (tabs in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) {
fields.addAll(tabs.getAllPrimitiveFields());
}
return fields;
}

@cached
operation JSL!ViewTabsDeclaration getAllPrimitiveFields(): Set {
var fields = new Set();
for (group in self.groups) {
fields.addAll(group.getAllPrimitiveFields());
if (self.isTypeOf(JSL!ViewGroupDeclaration)) {
fields.addAll(self.members.select(m | m.isKindOf(JSL!TransferFieldDeclaration) and m.referenceType.isDefined() and m.referenceType.`primitive`.isDefined()));
for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) {
fields.addAll(group.getAllPrimitiveFields());
}
for (tab in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) {
fields.addAll(tab.getAllPrimitiveFields());
}
} else if (self.isTypeOf(JSL!ViewTabsDeclaration)) {
for (group in self.groups) {
fields.addAll(group.getAllPrimitiveFields());
}
}

return fields;
}

@cached
operation JSL!ViewGroupDeclaration getTransferContainer(): JSL!TransferDeclaration {
operation JSL!ViewPanelDeclaration getTransferContainer(): JSL!TransferDeclaration {
if (self.eContainer.isKindOf(JSL!TransferDeclaration)) {
return self.eContainer;
} else if (self.eContainer.isKindOf(JSL!ViewGroupDeclaration) or self.eContainer.isKindOf(JSL!ViewTabsDeclaration)) {
return self.eContainer.getTransferContainer();
} else if (self.eContainer.isKindOf(JSL!ViewPanelDeclaration)) {
return self.eContainer.getTransferContainer();
}
return null;
}

@cached
operation JSL!ViewTabsDeclaration getTransferContainer(): JSL!TransferDeclaration {
if (self.eContainer.isKindOf(JSL!TransferDeclaration)) {
return self.eContainer;
} else if (self.eContainer.isKindOf(JSL!ViewGroupDeclaration) or self.eContainer.isKindOf(JSL!ViewTabsDeclaration)) {
return self.eContainer.getTransferContainer();
}
return null;
}

0 comments on commit 5638506

Please sign in to comment.