Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNG-5928 groups to views in jsl #270

Merged
merged 23 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/id.eol
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ operation Any getId() : String {

return r.getId(self);
}

operation String purify() : String {
// e.g. xmiids do not like such characters
return self.replace("::", "/");
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
/*
@cached
operation JSL!ActorGroupDeclaration getFqName(): String {
if (self.eContainer.isTypeOf(JSL!ActorGroupDeclaration) or self.eContainer.isTypeOf(JSL!ActorDeclaration)) {
return self.eContainer.getFqName() + "::MenuItemGroup::" + self.name;
operation JSL!UIMenuGroupDeclaration getFqName(): String {
if (self.eContainer.isTypeOf(JSL!UIMenuGroupDeclaration) or self.eContainer.isTypeOf(JSL!UIMenuDeclaration)) {
return self.eContainer.getFqName() + "::" + self.name;
}
return self.tag;
return self.name;
}

@cached
operation JSL!ActorGroupDeclaration getActorDeclaration(): JSL!ActorDeclaration {
if (self.eContainer.isTypeOf(JSL!ActorGroupDeclaration)) {
return self.eContainer.getActorDeclaration();
} else if (self.eContainer.isTypeOf(JSL!ActorDeclaration)) {
return self.eContainer;
operation JSL!UIMenuGroupDeclaration getRootMenu(): JSL!UIMenuDeclaration {
if (self.eContainer.isDefined()) {
if (self.eContainer.isTypeOf(JSL!UIMenuGroupDeclaration)) {
return self.eContainer.getRootMenu();
} else if (self.eContainer.isTypeOf(JSL!UIMenuDeclaration)) {
return self.eContainer;
}
}
return null;
}
*/

@cached
operation JSL!UIMenuGroupDeclaration getActorDeclaration(): JSL!ActorDeclaration {
var root = self.getRootMenu();
if (root.isDefined()) {
return root.getActorDeclaration();
}
return null;
}

@cached
operation JSL!UIMenuGroupDeclaration getExposedVisualElements(): Set {
var ves = new Set();

ves.add(self);

for (link in self.members.select(m | m.isTypeOf(JSL!UIMenuLinkDeclaration)).asSet()) {
ves.addAll(link.getExposedVisualElements());
}

for (table in self.members.select(m | m.isTypeOf(JSL!UIMenuTableDeclaration)).asSet()) {
ves.addAll(table.getExposedVisualElements());
}

for (group in self.members.select(m | m.isTypeOf(JSL!UIMenuGroupDeclaration)).asSet()) {
ves.addAll(group.getExposedVisualElements());
}

return ves;
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
/*
@cached
operation JSL!ActorLinkDeclaration getFqName(): String {
if (self.getTransferContainer().isDefined()) {
return self.getTransferContainer().getFqName() + "::" + self.name;
operation JSL!UIMenuLinkDeclaration getFqName(): String {
if (self.eContainer.isTypeOf(JSL!UIMenuGroupDeclaration) or self.eContainer.isTypeOf(JSL!UIMenuDeclaration)) {
return self.eContainer.getFqName() + "::" + self.name;
}
return self.name;
}

@cached
operation JSL!ActorLinkDeclaration getActorDeclaration(): JSL!ActorDeclaration {
if (self.eContainer.isTypeOf(JSL!ActorGroupDeclaration)) {
return self.eContainer.getActorDeclaration();
} else if (self.eContainer.isTypeOf(JSL!ActorDeclaration)) {
return self.eContainer;
operation JSL!UIMenuLinkDeclaration getRootMenu(): JSL!UIMenuDeclaration {
if (self.eContainer.isDefined()) {
if (self.eContainer.isTypeOf(JSL!UIMenuGroupDeclaration)) {
return self.eContainer.getRootMenu();
} else if (self.eContainer.isTypeOf(JSL!UIMenuDeclaration)) {
return self.eContainer;
}
}
return null;
}
*/

@cached
operation JSL!UIMenuLinkDeclaration getActorDeclaration(): JSL!ActorDeclaration {
var root = self.getRootMenu();
if (root.isDefined()) {
return root.getActorDeclaration();
}
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ operation JSL!TransferDeclaration getAllRelations(): Set {
}
}

for (member in self.members.select(m | m.isKindOf(JSL!ViewPanelDeclaration))) {
for (member in self.members.select(m | m.isKindOf(JSL!UIViewPanelDeclaration))) {
relations.addAll(member.getAllRelations());
}
*/
Expand All @@ -98,28 +98,28 @@ operation JSL!TransferDeclaration getAllRelations(): Set {
operation JSL!TransferDeclaration getDirectRelations(): Set {
var relations = new Set();
relations.addAll(self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)));
/*

if (self.isKindOf(JSL!ActorDeclaration)) {
var linkRelations = self.getAllMenuDeclarations();
relations.addAll(linkRelations);
}

for (member in self.members.select(m | m.isKindOf(JSL!ViewPanelDeclaration))) {
for (member in self.members.select(m | m.isKindOf(JSL!UIViewPanelDeclaration))) {
relations.addAll(member.getDirectRelations());
}
*/

return relations;
}

@cached
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.isKindOf(JSL!ViewPanelDeclaration))) {

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

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ operation JSL!TransferFieldDeclaration getTransferFieldDeclarationEquivalent():
if (self.maps()) {
return self.equivalent("CreateMappedTransferAttribute");
}
throw "Could not determinate attribute type: " + s.fqName();
throw "Could not determinate attribute type: " + self.fqName();
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,3 @@ operation JSL!TransferRelationDeclaration getContainerEquivalentClassType(): UI!
}
return null;
}

@cached
operation JSL!TransferRelationDeclaration getTransferObjectType(): JSL!TransferDeclaration {
return self.referenceType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ operation JSL!Modifiable getRows(): JSL!Modifier {
return (self.modifiers.selectOne(m | m.type == "rows"));
}

@cached
operation JSL!Modifiable getSelector(): JSL!Modifier {
return (self.modifiers.selectOne(m | m.type == "selector"));
}

@cached
operation JSL!Modifiable getCreateFormModifier(): JSL!Modifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!CreateFormModifier));
Expand All @@ -161,3 +156,8 @@ operation JSL!Modifiable getCreateFormModifier(): JSL!Modifier {
operation JSL!Modifiable getUpdateViewModifier(): JSL!Modifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!UpdateViewModifier));
}

@cached
operation JSL!Modifiable getSelectorTableModifier(): JSL!Modifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!SelectorTableModifier));
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "menuDeclaration.eol";
import "menuLinkDeclaration.eol";
import "menuTableDeclaration.eol";
import "rowColumnDeclaration.eol";
import "rowLinkDeclaration.eol";
import "rowDeclaration.eol";
import "viewActionDeclaration.eol";
import "viewDeclaration.eol";
import "viewGroupDeclaration.eol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,32 @@ operation JSL!UIMenuDeclaration getFqName(): String {

@cached
operation JSL!UIMenuDeclaration getRootMenu(): JSL!UIMenuDeclaration {
if (self.eContainer.isDefined()) {
if (self.eContainer.isTypeOf(JSL!ModelDeclaration)) {
return self;
return self;
}

}
// todo handle groups traversing upwards?
return self.getRootMenu();
}
return null;
@cached
operation JSL!UIMenuDeclaration getActorDeclaration(): JSL!ActorDeclaration {
return self.map.actor;
}

@cached
operation JSL!UIMenuDeclaration getExposedVisualElements(): Set {
var ves = new Set();

ves.add(self);

for (link in self.members.select(m | m.isTypeOf(JSL!UIMenuLinkDeclaration)).asSet()) {
ves.add(link);
ves.addAll(link.getExposedVisualElements());
}

for (table in self.members.select(m | m.isTypeOf(JSL!UIMenuTableDeclaration)).asSet()) {
ves.add(table);
ves.addAll(table.getExposedVisualElements());
}

for (group in self.members.select(m | m.isTypeOf(JSL!UIMenuGroupDeclaration)).asSet()) {
ves.addAll(group.getExposedVisualElements());
}

return ves;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ operation JSL!UIMenuLinkDeclaration getExposedVisualElements(): Set {
var ves = new Set();
var viewDeclaration = self.referenceType;

for (link in viewDeclaration.members.select(m | m.isTypeOf(JSL!UIMenuLinkDeclaration)).asSet()) {
ves.addAll(link.getExposedVisualElements());
}
ves.add(self);
ves.add(viewDeclaration);
ves.addAll(viewDeclaration.getExposedVisualElements());

for (table in viewDeclaration.members.select(m | m.isTypeOf(JSL!UIMenuTableDeclaration)).asSet()) {
ves.addAll(table.getExposedVisualElements());
if (self.getCreateFormModifier().isDefined()) {
ves.add(self.getCreateFormModifier().form);
ves.addAll(self.getCreateFormModifier().form.getExposedVisualElements());
}

ves.addAll(viewDeclaration.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet());

return ves;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ operation JSL!UIMenuTableDeclaration getExposedVisualElements(): Set {
var ves = new Set();
var rowDeclaration = self.referenceType;

ves.add(self);
ves.add(rowDeclaration);
ves.addAll(rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration)).asSet());

if (self.getCreateFormModifier().isDefined()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ operation JSL!UIRowColumnDeclaration getTransferFieldDeclarationEquivalent(): UI
if (field.maps()) {
return field.equivalent("CreateMappedTransferAttribute");
}
throw "Could not determinate attribute type: " + s.fqName();
throw "Could not determinate attribute type: " + self.fqName();
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@cached
operation JSL!UIRowDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!UIRowDeclaration getFqName(): String {
if (self.eContainer.isDefined()) {
return self.eContainer.getFqName() + "::" + self.name;
}
return self.name;
}

@cached
operation JSL!UIRowDeclaration getExposedVisualElements(): Set {
var ves = new Set();

ves.add(self);
ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration)).asSet());

return ves;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,74 @@ operation JSL!UIViewDeclaration uiContainer() : UI!ui::VisualElement {
operation JSL!UIViewDeclaration getExposedVisualElements(): Set {
var ves = new Set();

for (link in self.members.select(m | m.isTypeOf(JSL!UIMenuLinkDeclaration)).asSet()) {
ves.add(self);
ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet());

for (link in self.members.select(m | m.isTypeOf(JSL!UIViewLinkDeclaration)).asSet()) {
ves.addAll(link.getExposedVisualElements());
}

for (table in self.members.select(m | m.isTypeOf(JSL!UIMenuTableDeclaration)).asSet()) {
for (table in self.members.select(m | m.isTypeOf(JSL!UIViewTableDeclaration)).asSet()) {
ves.addAll(table.getExposedVisualElements());
}

ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet());
for (group in self.members.select(m | m.isKindOf(JSL!UIViewGroupDeclaration)).asSet()) {
ves.addAll(group.getExposedVisualElements());
}

for (tab in self.members.select(m | m.isKindOf(JSL!UIViewTabsDeclaration)).asSet()) {
ves.addAll(tab.getExposedVisualElements());
}

return ves;
}

@cached
operation JSL!UIViewDeclaration getAllLinks(): Set {
return self.getExposedVisualElements().select(v | v.isKindOf(JSL!UIViewLinkDeclaration)).asSet();
}

@cached
operation JSL!UIViewDeclaration getOwnLinks(): Set {
var all = self.getExposedVisualElements().select(v | v.isKindOf(JSL!UIViewLinkDeclaration)).asSet();
var res = new Set();

for (link in all) {
var parent: Any = link.eContainer;
while (not parent.isTypeOf(JSL!UIViewDeclaration) and parent.isDefined()) {
if (not parent.isTypeOf(JSL!UIViewDeclaration)) {
parent = parent.eContainer;
}
}
if (parent == self) {
res.add(link);
}
}

return res;
}

@cached
operation JSL!UIViewDeclaration getAllTables(): Set {
return self.getExposedVisualElements().select(v | v.isKindOf(JSL!UIViewTableDeclaration)).asSet();
}

@cached
operation JSL!UIViewDeclaration getOwnTables(): Set {
var all = self.getExposedVisualElements().select(v | v.isKindOf(JSL!UIViewTableDeclaration)).asSet();
var res = new Set();

for (table in all) {
var parent: Any = table.eContainer;
while (not parent.isTypeOf(JSL!UIViewDeclaration) and parent.isDefined()) {
if (not parent.isTypeOf(JSL!UIViewDeclaration)) {
parent = parent.eContainer;
}
}
if (parent == self) {
res.add(table);
}
}

return res;
}
Loading