From bbfb08957223cde8d8d8acce2090d5dddd28a487 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Tue, 17 Sep 2024 18:50:22 +0200 Subject: [PATCH 01/21] JNG-5928 Groups to views in JSL --- .../jsl/actor/actorGroupDeclaration.eol | 53 +- .../operations/jsl/ui/menuDeclaration.eol | 18 +- .../modules/application/actorDeclaration.etl | 1 - .../application/actorGroupDeclaration.etl | 33 + .../ui/modules/view/menuTableDeclaration.etl | 9 +- .../JslModel2UiApplicationTest.java | 847 +++++++++--------- .../jsl2ui/application/JslModel2UiTest.java | 6 +- pom.xml | 2 +- 8 files changed, 529 insertions(+), 440 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol index ccffbe85..fadd97ad 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol @@ -1,19 +1,50 @@ -/* @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(); + + 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.add(group); + ves.addAll(group.getExposedVisualElements()); + } + + return ves; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol index d1ec6b4e..6246e153 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol @@ -13,15 +13,12 @@ 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 @@ -38,6 +35,11 @@ operation JSL!UIMenuDeclaration getExposedVisualElements(): Set { ves.addAll(table.getExposedVisualElements()); } + for (group in self.members.select(m | m.isTypeOf(JSL!UIMenuGroupDeclaration)).asSet()) { + ves.add(group); + ves.addAll(group.getExposedVisualElements()); + } + return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl index 832b6fec..ce0adc24 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl @@ -1,4 +1,3 @@ - rule Actor transform s: JSL!ActorDeclaration to t: UI!ui::data::ClassType { diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorGroupDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorGroupDeclaration.etl index e69de29b..ef813468 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorGroupDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorGroupDeclaration.etl @@ -0,0 +1,33 @@ +rule MenuItemGroup + transform s: JSL!UIMenuGroupDeclaration + to t : UI!ui::NavigationItem { + guard: s.getRootMenu() == rootMenu + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/MenuItemGroup"); + t.name = s.getFqName(); + + log.debug("Create Navigation Group: " + s.name ); + + var label = s.getLabelModifier(); + if (label.isDefined()) { + t.label = label.value.value; + } + + var icon = s.getIconModifier(); + if (icon.isDefined()) { + t.icon = icon.equivalent("IconModifierIcon"); + } + + /*if (s.hiddenBy.isDefined()) { + t.hiddenBy = s.hiddenBy.name; + }*/ + + if (s.eContainer.isKindOf(JSL!UIMenuGroupDeclaration)) { + s.eContainer.equivalent("MenuItemGroup").items.add(t); + t.~pos = s.eContainer.members.indexOf(s); + } else { + var navigationController = rootMenu.equivalent("Application").navigationController; + navigationController.items.add(t); + t.~pos = s.eContainer.members.indexOf(s); + } +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index 5c2cf004..04ebb4d6 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -14,7 +14,10 @@ rule MenuTableNavigationItem t.target = s.equivalent("AccessTablePageDefinition"); - if (s.eContainer.isTypeOf(JSL!UIMenuDeclaration)) { + if (s.eContainer.isKindOf(JSL!UIMenuGroupDeclaration)) { + s.eContainer.equivalent("MenuItemGroup").items.add(t); + t.~pos = s.eContainer.members.indexOf(s); + } else { var navigationController = rootMenu.equivalent("Application").navigationController; navigationController.items.add(t); t.~pos = s.eContainer.members.indexOf(s); @@ -36,7 +39,9 @@ rule AccessTablePageDefinition t.dataElement = relation.equivalent("RelationType"); t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - t.actions.add(s.equivalent("AccessTableRowOpenPageAction")); + if (s.getUpdateViewModifier().isDefined()) { + t.actions.add(s.equivalent("AccessTableRowOpenPageAction")); + } if (relation.isRefreshAllowed()) { t.actions.add(s.equivalent("AccessTableTableRefreshAction")); } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java index 80cbf854..4d779493 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java @@ -47,416 +47,439 @@ static void prepareTestFolders() throws IOException { } } -// @Test -// void testActors() throws Exception { -// jslModel = JslParser.getModelFromStrings("ApplicationTestModel", List.of(""" -// model ApplicationTestModel; -// -// actor AppActor human; -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app1 = apps.get(0); -// -// assertEquals("AppActor::Application", app1.getName()); -// assertEquals("ApplicationTestModel", app1.getModelName()); -// assertEquals("judo-color-logo.png", app1.getLogo()); -// assertEquals("en-US", app1.getDefaultLanguage()); -// -// assertNotNull(app1.getActor()); -// -// ClassType actor = app1.getActor(); -// -// assertEquals("ApplicationTestModel::AppActor::ClassType", actor.getName()); -// assertEquals("AppActor", actor.getSimpleName()); -// assertTrue(actor.isIsActor()); -// -// assertNotNull(app1.getTheme()); -// -// Theme theme = app1.getTheme(); -// -// assertEquals("#3C4166FF", theme.getPrimaryColor()); -// assertEquals("#E7501DFF", theme.getSecondaryColor()); -// assertEquals("#17191DFF", theme.getTextPrimaryColor()); -// assertEquals("#434448FF", theme.getTextSecondaryColor()); -// assertEquals("#FAFAFAFF", theme.getBackgroundColor()); -// assertEquals("#8C8C8C", theme.getSubtitleColor()); -// } -// -// @Test -// void testMenu() throws Exception { -// jslModel = JslParser.getModelFromStrings("MenuTestModel", List.of(""" -// model MenuTestModel; -// -// import judo::types; -// -// entity User { -// identifier String userName required; -// } -// -// view UserListView { -// table UserRow[] users <= User.all(); -// } -// -// row UserRow(User user) { -// field String userName <= user.userName label:"Username"; -// } -// -// entity Product { -// identifier String name required; -// field Integer price required; -// } -// -// view ProductListView { -// table ProductRow[] products <= Product.all(); -// } -// -// row ProductRow(Product product) { -// field String name <= product.name label:"Name"; -// field String price <= product.price.asString() + " HUF" label:"Price"; -// } -// -// actor MenuActor human { -// group first label:"Group1" { -// group second label:"Group2" { -// link ProductListView products label:"Products" icon:"close"; -// } -// link ProductListView products2 label:"Products2"; -// } -// link UserListView users label:"Users" icon:"account-multiple"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app1 = apps.get(0); -// -// NavigationController navigationController = app1.getNavigationController(); -// -// assertNotNull(navigationController); -// -// List firstLevelMenus = navigationController.getItems(); -// -// assertEquals(2, firstLevelMenus.size()); -// -// NavigationItem first1 = firstLevelMenus.get(0); -// NavigationItem first2 = firstLevelMenus.get(1); -// -// assertEquals("MenuTestModel::MenuActor::MenuItemGroup::first", first1.getName()); -// assertEquals("Group1", first1.getLabel()); -// assertEquals("MenuTestModel::MenuActor::users", first2.getName()); -// assertEquals("Users", first2.getLabel()); -// -// List secondLevelMenus = first1.getItems(); -// -// assertEquals(2, secondLevelMenus.size()); -// -// NavigationItem second1 = secondLevelMenus.get(0); -// NavigationItem second2 = secondLevelMenus.get(1); -// -// assertEquals("MenuTestModel::MenuActor::MenuItemGroup::first::MenuItemGroup::second", second1.getName()); -// assertEquals("Group2", second1.getLabel()); -// assertEquals("MenuTestModel::MenuActor::products2", second2.getName()); -// assertEquals("Products2", second2.getLabel()); -// -// List thirdLevelMenus = second1.getItems(); -// -// assertEquals(1, thirdLevelMenus.size()); -// -// NavigationItem third1 = thirdLevelMenus.get(0); -// -// assertEquals("MenuTestModel::MenuActor::products", third1.getName()); -// assertEquals("Products", third1.getLabel()); -// assertEquals("close", third1.getIcon().getIconName()); -// } -// -// @Test -// void testMultipleActors() throws Exception { -// jslModel = JslParser.getModelFromStrings("MultipleActorsTestModel", List.of(""" -// model MultipleActorsTestModel; -// -// import judo::types; -// -// entity User { -// identifier String userName required; -// } -// -// entity User2 { -// identifier String userName2 required; -// } -// -// entity Product { -// identifier String name required; -// field Integer price required; -// } -// -// entity Product2 { -// identifier String name2 required; -// field Integer price2 required; -// } -// -// view ProductListView { -// table ProductRow[] productsOnList <= Product.all(); -// } -// -// view ProductListView2 { -// table ProductRow2[] products2OnList <= Product2.all(); -// } -// -// view ProductDetailView(Product product) { -// field String name <= product.name; -// field Integer priceNumber <= product.price; -// field String price <= product.price.asString() + " HUF"; -// } -// -// view ProductDetailView2(Product2 product2) { -// field String name2 <= product2.name2; -// field Integer priceNumber2 <= product2.price2; -// field String price2 <= product2.price2.asString() + " HUF"; -// } -// -// row ProductRow(Product product) { -// link ProductDetailView detail <= product eager detail; -// field String name <= product.name label:"Name"; -// field String price <= product.price.asString() + " HUF" label:"Price"; -// } -// -// row ProductRow2(Product2 product2) { -// link ProductDetailView2 detail2 <= product2 eager detail; -// field String name2 <= product2.name2 label:"Name 2"; -// field String price2 <= product2.price2.asString() + " HUF" label:"Price 2"; -// } -// -// actor Actor1 human { -// group first label:"Group1" { -// link ProductListView products1 label:"Products1"; -// } -// link ProductListView allProducts label:"All Products" icon:"tools"; -// } -// -// actor Actor2 human { -// group first label:"Group2" { -// link ProductListView2 products2 label:"Products2"; -// } -// link ProductListView2 allProducts2 label:"All Products 2" icon:"tools"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// // Apps -// -// assertEquals(2, apps.size()); -// -// Application app1 = apps.get(0); -// Application app2 = apps.get(1); -// -// assertEquals("Actor1::Application", app1.getName()); -// assertEquals("MultipleActorsTestModel", app1.getModelName()); -// assertEquals("judo-color-logo.png", app1.getLogo()); -// assertEquals("en-US", app1.getDefaultLanguage()); -// -// assertNotNull(app1.getActor()); -// -// ClassType actor = app1.getActor(); -// -// assertEquals("MultipleActorsTestModel::Actor1::ClassType", actor.getName()); -// assertEquals("Actor1", actor.getSimpleName()); -// assertTrue(actor.isIsActor()); -// -// assertEquals("Actor1::Application", app1.getName()); -// assertEquals("MultipleActorsTestModel", app1.getModelName()); -// assertEquals("judo-color-logo.png", app1.getLogo()); -// assertEquals("en-US", app1.getDefaultLanguage()); -// -// assertNotNull(app2.getActor()); -// -// ClassType actor2 = app2.getActor(); -// -// assertEquals("MultipleActorsTestModel::Actor2::ClassType", actor2.getName()); -// assertEquals("Actor2", actor2.getSimpleName()); -// assertTrue(actor2.isIsActor()); -// -// assertEquals("Actor2::Application", app2.getName()); -// assertEquals("MultipleActorsTestModel", app2.getModelName()); -// assertEquals("judo-color-logo.png", app2.getLogo()); -// assertEquals("en-US", app2.getDefaultLanguage()); -// -// // Menus -// -// NavigationController navigationController = app1.getNavigationController(); -// assertNotNull(navigationController); -// -// List firstLevelMenus = navigationController.getItems(); -// -// NavigationItem first1 = firstLevelMenus.get(0); -// NavigationItem first2 = firstLevelMenus.get(1); -// -// assertEquals("MultipleActorsTestModel::Actor1::MenuItemGroup::first", first1.getName()); -// assertEquals("Group1", first1.getLabel()); -// assertEquals("MultipleActorsTestModel::Actor1::allProducts", first2.getName()); -// assertEquals("All Products", first2.getLabel()); -// -// NavigationController navigationController2 = app2.getNavigationController(); -// assertNotNull(navigationController2); -// -// List firstLevelMenus2 = navigationController2.getItems(); -// -// NavigationItem first21 = firstLevelMenus2.get(0); -// NavigationItem first22 = firstLevelMenus2.get(1); -// -// assertEquals("MultipleActorsTestModel::Actor2::MenuItemGroup::first", first21.getName()); -// assertEquals("Group2", first21.getLabel()); -// assertEquals("MultipleActorsTestModel::Actor2::allProducts2", first22.getName()); -// assertEquals("All Products 2", first22.getLabel()); -// -// // Data Elements -// -// List classTypes = app1.getClassTypes(); -// List relationTypes = app1.getRelationTypes(); -// -// assertEquals(4, classTypes.size()); -// assertEquals(4, relationTypes.size()); -// -// Set class1Names = classTypes.stream().map(c -> c.getName()).collect(Collectors.toSet()); -// Set relations1Names = relationTypes.stream().map(c -> c.getFQName()).collect(Collectors.toSet()); -// -// assertEquals(Set.of( -// "MultipleActorsTestModel::Actor1::ClassType", -// "MultipleActorsTestModel::ProductDetailView::ClassType", -// "MultipleActorsTestModel::ProductListView::ClassType", -// "MultipleActorsTestModel::ProductRow::ClassType" -// ), class1Names); -// -// assertEquals(Set.of( -// "Actor1::Application::MultipleActorsTestModel::Actor1::ClassType::products1", -// "Actor1::Application::MultipleActorsTestModel::Actor1::ClassType::allProducts", -// "Actor1::Application::MultipleActorsTestModel::ProductListView::ClassType::productsOnList", -// "Actor1::Application::MultipleActorsTestModel::ProductRow::ClassType::detail" -// ), relations1Names); -// -// List dataTypes1 = app1.getDataTypes(); -// -// Set dataTypes1Names = dataTypes1.stream().map(c -> c.getName()).collect(Collectors.toSet()); -// -// assertEquals(Set.of( -// "Integer", -// "String" -// ), dataTypes1Names); -// assertTrue(getXMIID(dataTypes1.get(0)).contains("judo::types")); -// assertTrue(getXMIID(dataTypes1.get(1)).contains("judo::types")); -// -// List classTypes2 = app2.getClassTypes(); -// List relationsTypes2 = app2.getRelationTypes(); -// -// assertEquals(4, classTypes2.size()); -// assertEquals(4, relationsTypes2.size()); -// -// Set class2Names = classTypes2.stream().map(c -> c.getName()).collect(Collectors.toSet()); -// Set relations2Names = relationsTypes2.stream().map(c -> c.getFQName()).collect(Collectors.toSet()); -// -// assertEquals(Set.of( -// "MultipleActorsTestModel::Actor2::ClassType", -// "MultipleActorsTestModel::ProductDetailView2::ClassType", -// "MultipleActorsTestModel::ProductListView2::ClassType", -// "MultipleActorsTestModel::ProductRow2::ClassType" -// ), class2Names); -// -// assertEquals(Set.of( -// "Actor2::Application::MultipleActorsTestModel::Actor2::ClassType::products2", -// "Actor2::Application::MultipleActorsTestModel::Actor2::ClassType::allProducts2", -// "Actor2::Application::MultipleActorsTestModel::ProductListView2::ClassType::products2OnList", -// "Actor2::Application::MultipleActorsTestModel::ProductRow2::ClassType::detail2" -// ), relations2Names); -// -// // Pages -// -// List pages = app1.getPages(); -// -// assertEquals(Set.of( -// "MultipleActorsTestModel::Actor1::products1::View::PageDefinition", -// "MultipleActorsTestModel::Actor1::allProducts::View::PageDefinition", -// "MultipleActorsTestModel::ProductRow::detail::View::PageDefinition", -// "MultipleActorsTestModel::Actor1::DashboardPage" -// ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// List pages2 = app2.getPages(); -// -// assertEquals(Set.of( -// "MultipleActorsTestModel::Actor2::products2::View::PageDefinition", -// "MultipleActorsTestModel::Actor2::allProducts2::View::PageDefinition", -// "MultipleActorsTestModel::ProductRow2::detail2::View::PageDefinition", -// "MultipleActorsTestModel::Actor2::DashboardPage" -// ), pages2.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// } -// -// @Test -// void testSecurity() throws Exception { -// jslModel = JslParser.getModelFromStrings("SecurityTestModel", List.of(""" -// model SecurityTestModel; -// -// import judo::types; -// -// entity User { -// identifier String email required; -// } -// -// transfer UserTransfer maps User as u { -// field String email <= u.email bind; -// } -// -// actor Actor human realm:"COMPANY" claim:"email" identity:UserTransfer::email; -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// // Apps -// -// assertEquals(1, apps.size()); -// -// // Authentication -// -// Authentication authentication = apps.get(0).getAuthentication(); -// -// assertNotNull(authentication); -// -// assertEquals("COMPANY", authentication.getRealm()); -// -// // Actor -// -// ClassType actor = apps.get(0).getActor(); -// -// assertNotNull(actor); -// assertEquals("SecurityTestModel::Actor::ClassType", actor.getName()); -// assertEquals("Actor", actor.getSimpleName()); -// -// // Principal -// -// ClassType principal = apps.get(0).getPrincipal(); -// -// assertNotNull(principal); -// assertEquals("SecurityTestModel::UserTransfer::ClassType", principal.getName()); -// assertEquals("UserTransfer", principal.getSimpleName()); -// assertTrue(principal.isIsPrincipal()); -// -// // Claim -// -// assertEquals(1, authentication.getClaims().size()); -// assertEquals("UNDEFINED", authentication.getClaims().get(0).getType().getName()); -// assertEquals(principal.getAttributes().stream().filter(a -> a.getName().equals("email")).findFirst().orElse(null), authentication.getClaims().get(0).getAttributeType()); -// -// } + @Test + void testActors() throws Exception { + jslModel = JslParser.getModelFromStrings("ApplicationTestModel", List.of(""" + model ApplicationTestModel; + + actor AppActor; + + menu AppMenu(AppActor a) { + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application app1 = apps.get(0); + + assertEquals("AppActor", app1.getName()); + assertEquals("ApplicationTestModel", app1.getModelName()); + assertEquals("judo-color-logo.png", app1.getLogo()); + assertEquals("en-US", app1.getDefaultLanguage()); + + assertNotNull(app1.getActor()); + + ClassType actor = app1.getActor(); + + assertEquals("ApplicationTestModel::AppActor::ClassType", actor.getName()); + assertEquals("AppActor", actor.getSimpleName()); + assertTrue(actor.isIsActor()); + + assertNotNull(app1.getTheme()); + + Theme theme = app1.getTheme(); + + assertEquals("#3C4166FF", theme.getPrimaryColor()); + assertEquals("#E7501DFF", theme.getSecondaryColor()); + assertEquals("#17191DFF", theme.getTextPrimaryColor()); + assertEquals("#434448FF", theme.getTextSecondaryColor()); + assertEquals("#FAFAFAFF", theme.getBackgroundColor()); + assertEquals("#8C8C8C", theme.getSubtitleColor()); + } + + @Test + void testMenu() throws Exception { + jslModel = JslParser.getModelFromStrings("MenuTestModel", List.of(""" + model MenuTestModel; + + import judo::types; + + entity User { + identifier String userName required; + } + + entity Product { + identifier String name required; + field Integer price required; + } + + transfer UserTransfer(User u) { + field String userName <= u.userName required; + } + + transfer ProductTransfer(Product p) { + field String name <= p.name required; + field String price <= p.price.asString() + " HUF"; + } + + table UsersTable(UserTransfer u) { + column String userName <= u.userName label:"Username"; + } + + table ProductsTable(ProductTransfer p) { + column String name <= p.name label:"Name"; + column String price <= p.price label:"Price"; + } + + actor Actor { + access ProductTransfer[] products <= Product.all(); + access ProductTransfer[] products2 <= Product.all(); + access UserTransfer[] users <= User.all(); + } + + menu MenuActor(Actor usr) { + group first label:"Group1" { + group second label:"Group2" { + table ProductsTable products <= usr.products label:"Products" icon:"close"; + } + table ProductsTable products2 <= usr.products2 label:"Products2"; + } + table UsersTable users <= usr.users label:"Users" icon:"account-multiple"; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application app1 = apps.get(0); + + NavigationController navigationController = app1.getNavigationController(); + + assertNotNull(navigationController); + + List firstLevelMenus = navigationController.getItems(); + + assertEquals(2, firstLevelMenus.size()); + + NavigationItem first1 = firstLevelMenus.get(0); + NavigationItem first2 = firstLevelMenus.get(1); + + assertEquals("MenuTestModel::MenuActor::first", first1.getName()); + assertEquals("Group1", first1.getLabel()); + assertEquals("MenuTestModel::MenuActor::users", first2.getName()); + assertEquals("Users", first2.getLabel()); + + List secondLevelMenus = first1.getItems(); + + assertEquals(2, secondLevelMenus.size()); + + NavigationItem second1 = secondLevelMenus.get(0); + NavigationItem second2 = secondLevelMenus.get(1); + + assertEquals("MenuTestModel::MenuActor::first::second", second1.getName()); + assertEquals("Group2", second1.getLabel()); + assertEquals("MenuTestModel::MenuActor::first::products2", second2.getName()); + assertEquals("Products2", second2.getLabel()); + + List thirdLevelMenus = second1.getItems(); + + assertEquals(1, thirdLevelMenus.size()); + + NavigationItem third1 = thirdLevelMenus.get(0); + + assertEquals("MenuTestModel::MenuActor::first::second::products", third1.getName()); + assertEquals("Products", third1.getLabel()); + assertEquals("close", third1.getIcon().getIconName()); + } + + @Test + void testMultipleActors() throws Exception { + jslModel = JslParser.getModelFromStrings("MultipleActorsTestModel", List.of(""" + model MultipleActorsTestModel; + + import judo::types; + + entity User { + identifier String userName required; + } + + entity User2 { + identifier String userName2 required; + } + + entity Product { + identifier String name required; + field Integer price required; + } + + entity Product2 { + identifier String name2 required; + field Integer price2 required; + } + + transfer UserTransfer(User u) { + field String userName <= u.userName; + } + + transfer User2Transfer(User2 u) { + field String userName2 <= u.userName2; + } + + transfer ProductTransfer(Product p) { + field String name required; + field Integer priceOriginal <= p.price; + field String price <= p.price.asString() + " HUF"; + + event update onUpdate; + } + + transfer Product2Transfer(Product2 p) { + field String name2 required; + field Integer price2Original <= p.price2; + field String price2 <= p.price2.asString() + " HUF"; + + event update onUpdate; + } + + view ProductView(ProductTransfer product) { + widget String name <= product.name; + widget String price <= product.price; + } + + view Product2View(Product2Transfer product2) { + widget String name2 <= product2.name2; + widget String price2 <= product2.price2; + } + + table ProductsTable(ProductTransfer product) { + column String name <= product.name label:"Name"; + column String price <= product.price label:"Price"; + } + + table ProductsTable2(Product2Transfer product2) { + column String name2 <= product2.name2 label:"Name 2"; + column String price2 <= product2.price2 label:"Price 2"; + } + + actor Actor1 { + access ProductTransfer[] products <= Product.all() update; + } + + actor Actor2 { + access Product2Transfer[] products2 <= Product2.all() update; + } + + menu App1(Actor1 a) { + group first label:"Group1" { + table ProductsTable products1 <= a.products label:"Products1" view:ProductView; + } + table ProductsTable allProducts <= a.products label:"All Products" icon:"tools" view:ProductView; + } + + menu App2(Actor2 a) { + group first label:"Group2" { + table ProductsTable2 products2 <= a.products2 label:"Products2" view:Product2View; + } + table ProductsTable2 allProducts2 <= a.products2 label:"All Products 2" icon:"tools" view:Product2View; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + // Apps + + assertEquals(2, apps.size()); + + Application app1 = apps.get(0); + Application app2 = apps.get(1); + + assertEquals("Actor1", app1.getName()); + assertEquals("MultipleActorsTestModel", app1.getModelName()); + assertEquals("judo-color-logo.png", app1.getLogo()); + assertEquals("en-US", app1.getDefaultLanguage()); + + assertNotNull(app1.getActor()); + + ClassType actor = app1.getActor(); + + assertEquals("MultipleActorsTestModel::Actor1::ClassType", actor.getName()); + assertEquals("Actor1", actor.getSimpleName()); + assertTrue(actor.isIsActor()); + + assertEquals("Actor1", app1.getName()); + assertEquals("MultipleActorsTestModel", app1.getModelName()); + assertEquals("judo-color-logo.png", app1.getLogo()); + assertEquals("en-US", app1.getDefaultLanguage()); + + assertNotNull(app2.getActor()); + + ClassType actor2 = app2.getActor(); + + assertEquals("MultipleActorsTestModel::Actor2::ClassType", actor2.getName()); + assertEquals("Actor2", actor2.getSimpleName()); + assertTrue(actor2.isIsActor()); + + assertEquals("Actor2", app2.getName()); + assertEquals("MultipleActorsTestModel", app2.getModelName()); + assertEquals("judo-color-logo.png", app2.getLogo()); + assertEquals("en-US", app2.getDefaultLanguage()); + + // Menus + + NavigationController navigationController = app1.getNavigationController(); + assertNotNull(navigationController); + + List firstLevelMenus = navigationController.getItems(); + + NavigationItem first1 = firstLevelMenus.get(0); + NavigationItem first2 = firstLevelMenus.get(1); + + assertEquals("MultipleActorsTestModel::App1::first", first1.getName()); + assertEquals("Group1", first1.getLabel()); + assertEquals("MultipleActorsTestModel::App1::allProducts", first2.getName()); + assertEquals("All Products", first2.getLabel()); + + NavigationController navigationController2 = app2.getNavigationController(); + assertNotNull(navigationController2); + + List firstLevelMenus2 = navigationController2.getItems(); + + NavigationItem first21 = firstLevelMenus2.get(0); + NavigationItem first22 = firstLevelMenus2.get(1); + + assertEquals("MultipleActorsTestModel::App2::first", first21.getName()); + assertEquals("Group2", first21.getLabel()); + assertEquals("MultipleActorsTestModel::App2::allProducts2", first22.getName()); + assertEquals("All Products 2", first22.getLabel()); + + // Data Elements + + List classTypes = app1.getClassTypes(); + List relationTypes = app1.getRelationTypes(); + + assertEquals(2, classTypes.size()); + assertEquals(1, relationTypes.size()); + + Set class1Names = classTypes.stream().map(c -> c.getName()).collect(Collectors.toSet()); + Set relations1Names = relationTypes.stream().map(c -> c.getFQName()).collect(Collectors.toSet()); + + assertEquals(Set.of( + "MultipleActorsTestModel::ProductTransfer::ClassType", + "MultipleActorsTestModel::Actor1::ClassType" + ), class1Names); + + assertEquals(Set.of( + "Actor1::MultipleActorsTestModel::Actor1::ClassType::products" + ), relations1Names); + + List dataTypes1 = app1.getDataTypes(); + + Set dataTypes1Names = dataTypes1.stream().map(c -> c.getName()).collect(Collectors.toSet()); + + assertEquals(Set.of( + "StringOperation", + "Integer", + "EnumerationOperation", + "BooleanOperation", + "String", + "NumericOperation" + ), dataTypes1Names); + + List classTypes2 = app2.getClassTypes(); + List relationsTypes2 = app2.getRelationTypes(); + + assertEquals(2, classTypes2.size()); + assertEquals(1, relationsTypes2.size()); + + Set class2Names = classTypes2.stream().map(c -> c.getName()).collect(Collectors.toSet()); + Set relations2Names = relationsTypes2.stream().map(c -> c.getFQName()).collect(Collectors.toSet()); + + assertEquals(Set.of( + "MultipleActorsTestModel::Product2Transfer::ClassType", + "MultipleActorsTestModel::Actor2::ClassType" + ), class2Names); + + assertEquals(Set.of( + "Actor2::MultipleActorsTestModel::Actor2::ClassType::products2" + ), relations2Names); + + // Pages + + List pages = app1.getPages(); + + assertEquals(Set.of( + "MultipleActorsTestModel::App1::allProducts::AccessTablePage", + "MultipleActorsTestModel::App1::DashboardPage", + "MultipleActorsTestModel::App1::first::products1::AccessTablePage" + ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); + + List pages2 = app2.getPages(); + + assertEquals(Set.of( + "MultipleActorsTestModel::App2::allProducts2::AccessTablePage", + "MultipleActorsTestModel::App2::DashboardPage", + "MultipleActorsTestModel::App2::first::products2::AccessTablePage" + ), pages2.stream().map(NamedElement::getName).collect(Collectors.toSet())); + } + + @Test + void testSecurity() throws Exception { + jslModel = JslParser.getModelFromStrings("SecurityTestModel", List.of(""" + model SecurityTestModel; + + import judo::types; + + entity User { + identifier String email required; + } + + transfer UserTransfer(User u) { + field String email <=> u.email; + } + + actor Actor realm:"COMPANY" claim:"email" identity:UserTransfer::email; + + menu ActorApp(Actor usr) { + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + // Apps + + assertEquals(1, apps.size()); + + // Authentication + + Authentication authentication = apps.get(0).getAuthentication(); + + assertNotNull(authentication); + + assertEquals("COMPANY", authentication.getRealm()); + + // Actor + + ClassType actor = apps.get(0).getActor(); + + assertNotNull(actor); + assertEquals("SecurityTestModel::Actor::ClassType", actor.getName()); + assertEquals("Actor", actor.getSimpleName()); + + // Principal + + ClassType principal = apps.get(0).getPrincipal(); + + assertNotNull(principal); + assertEquals("SecurityTestModel::UserTransfer::ClassType", principal.getName()); + assertEquals("UserTransfer", principal.getSimpleName()); + assertTrue(principal.isIsPrincipal()); + + // Claim + + assertEquals(1, authentication.getClaims().size()); + assertEquals("UNDEFINED", authentication.getClaims().get(0).getType().getName()); + assertEquals(principal.getAttributes().stream().filter(a -> a.getName().equals("email")).findFirst().orElse(null), authentication.getClaims().get(0).getAttributeType()); + + } } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java index 0f0d4b4e..f8add4c2 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java @@ -86,11 +86,7 @@ transfer CarTransfer(Car c) { event delete deleteCar; } - actor UserActor - realm: "COMPANY" - claim: "email" - identity: UserTransfer::email - { + actor UserActor realm: "COMPANY" claim: "email" identity: UserTransfer::email { access CarTransfer[] cars <= Car.all() create delete update; } diff --git a/pom.xml b/pom.xml index 530801e2..348b037d 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 3.3.0 - 1.0.3.20240907_040656_1b2ae114_develop + 1.0.3-SNAPSHOT 1.0.2.20240612_080018_05e004e9_develop 1.0.4.20240410_091349_e488ea5d_develop 1.1.0.20240913_150723_d3ab84dc_develop From 1cd152943cf517d93554bca61fd054e70fc54010 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Tue, 17 Sep 2024 20:18:41 +0200 Subject: [PATCH 02/21] JNG-5928 save state --- .../jsl/actor/actorLinkDeclaration.eol | 29 +- .../epsilon/operations/jsl/ui/_importUI.eol | 1 - .../operations/jsl/ui/rowLinkDeclaration.eol | 14 - .../operations/jsl/ui/viewLinkDeclaration.eol | 4 +- .../jsl/ui/viewPanelDeclaration.eol | 6 +- .../jsl/ui/viewTableDeclaration.eol | 4 +- .../epsilon/transformations/ui/jslToUi.etl | 2 +- .../application/actorLinkDeclaration.etl | 0 .../structure/transferFieldDeclaration.etl | 2 +- .../ui/modules/view/menuLinkDeclaration.etl | 277 +++++++++ .../ui/modules/view/menuTableDeclaration.etl | 6 +- .../application/JslModel2UiWidgetsTest.java | 542 +++++++++--------- 12 files changed, 589 insertions(+), 298 deletions(-) delete mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowLinkDeclaration.eol delete mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorLinkDeclaration.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorLinkDeclaration.eol index cee9fe2a..4bbe4821 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorLinkDeclaration.eol @@ -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; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol index 50aa9482..64c74b3f 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol @@ -3,7 +3,6 @@ import "menuDeclaration.eol"; import "menuLinkDeclaration.eol"; import "menuTableDeclaration.eol"; import "rowColumnDeclaration.eol"; -import "rowLinkDeclaration.eol"; import "viewActionDeclaration.eol"; import "viewDeclaration.eol"; import "viewGroupDeclaration.eol"; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowLinkDeclaration.eol deleted file mode 100644 index 2588259b..00000000 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowLinkDeclaration.eol +++ /dev/null @@ -1,14 +0,0 @@ -/* -@cached -operation JSL!RowLinkDeclaration getId(): String { - return (self.eContainer.getId() + "/" + self.name); -} - -@cached -operation JSL!RowLinkDeclaration getFqName(): String { - if (self.getTransferContainer().isDefined()) { - return self.getTransferContainer().getFqName() + "::" + self.name; - } - return self.name; -} -*/ diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol index c5be7509..d35b1e3b 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol @@ -5,8 +5,8 @@ operation JSL!UIViewLinkDeclaration getId(): String { @cached operation JSL!UIViewLinkDeclaration getFqName(): String { - if (self.getTransferContainer().isDefined()) { - return self.getTransferContainer().getFqName() + "::" + self.name; + if (self.eContainer.isDefined()) { + return self.eContainer.getFqName() + "::" + self.name; } return self.name; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol index 0e19cb2b..bee4bec7 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol @@ -70,11 +70,11 @@ operation JSL!ViewPanelDeclaration getAllPrimitiveFields(): Set { } @cached -operation JSL!ViewPanelDeclaration getTransferContainer(): JSL!TransferDeclaration { - if (self.eContainer.isKindOf(JSL!TransferDeclaration)) { +operation JSL!ViewPanelDeclaration getViewContainer(): JSL!UIViewDeclaration { + if (self.eContainer.isKindOf(JSL!UIViewDeclaration)) { return self.eContainer; } else if (self.eContainer.isKindOf(JSL!ViewPanelDeclaration)) { - return self.eContainer.getTransferContainer(); + return self.eContainer.getViewContainer(); } return null; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol index 1b6c035a..db5845b3 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol @@ -5,8 +5,8 @@ operation JSL!UIViewTableDeclaration getId(): String { @cached operation JSL!UIViewTableDeclaration getFqName(): String { - if (self.getTransferContainer().isDefined()) { - return self.getTransferContainer().getFqName() + "::" + self.name; + if (self.eContainer.isDefined()) { + return self.eContainer.getFqName() + "::" + self.name; } return self.name; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl index 20b3e2c1..39944ed1 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl @@ -2,7 +2,6 @@ import "../../operations/_importAll.eol"; import "modules/application/actorDeclaration.etl"; import "modules/application/actorGroupDeclaration.etl"; -import "modules/application/actorLinkDeclaration.etl"; import "modules/application/modifiable.etl"; import "modules/structure/transferDeclaration.etl"; @@ -14,6 +13,7 @@ import "modules/type/type.etl"; import "modules/view/enumLiteral.etl"; import "modules/view/menuDeclaration.etl"; +import "modules/view/menuLinkDeclaration.etl"; import "modules/view/menuTableDeclaration.etl"; import "modules/view/rowColumnDeclaration.etl"; import "modules/view/rowLinkDeclaration.etl"; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorLinkDeclaration.etl deleted file mode 100644 index e69de29b..00000000 diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl index 7c375879..bdb5feb7 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl @@ -3,7 +3,7 @@ rule AbstractCreateTransferAttribute transform s: JSL!TransferFieldDeclaration to t: UI!ui::data::AttributeType { guard: s.referenceType.isKindOf(JSL!PrimitiveDeclaration) - and actorDeclaration.getExposedTransferObjects().includes(s.getTransferContainer()) + and actorDeclaration.getExposedTransferObjects().includes(s.eContainer) t.name = s.name; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl new file mode 100644 index 00000000..19dba872 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -0,0 +1,277 @@ +rule MenuLinkNavigationItem + transform s: JSL!UIMenuLinkDeclaration + to t : UI!ui::NavigationItem { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/MenuLinkNavigationItem"); + t.name = s.getFqName(); + + var label = s.getLabelModifier(); + if (label.isDefined()) { + t.label = label.value.value; + } + + var icon = s.getIconModifier(); + if (icon.isDefined()) { + t.icon = icon.equivalent("IconModifierIcon"); + } + + t.target = s.equivalent("AccessViewPageDefinition"); + + if (s.eContainer.isKindOf(JSL!UIMenuGroupDeclaration)) { + s.eContainer.equivalent("MenuItemGroup").items.add(t); + t.~pos = s.eContainer.members.indexOf(s); + } else { + var navigationController = rootMenu.equivalent("Application").navigationController; + navigationController.items.add(t); + t.~pos = s.eContainer.members.indexOf(s); + } + + log.debug("MenuLinkNavigationItem: " + s.name); + } + +rule AccessViewPageDefinition + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) + + var relation = s.actorAccess.target; + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageDefinition"); + t.name = s.getFqName() + "::AccessViewPage"; + t.container = s.equivalent("AccessViewPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = relation.equivalent("RelationType"); + + // var relations = s.referenceType.getDirectRelations(); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ +/* + for (link in relations.select(r | r.isKindOf(JSL!ViewLinkDeclaration))) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "AccessPageDefinition")); + if (link.isRefreshAllowed() and not link.isEager()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "AccessPageDefinition")); + } + if (link.isCreateAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "AccessPageDefinition")); + } + if (link.isDeleteAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "AccessPageDefinition")); + } + if (link.isSetReferenceAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "AccessPageDefinition")); + } + if (link.isUnsetReferenceAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "AccessPageDefinition")); + } + } + + for (table in relations.select(r | r.isKindOf(JSL!ViewTableDeclaration))) { + var detailLink = table.getDetailLink(); + + if (detailLink.isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "AccessPageDefinition")); + } + if (table.isFilterSupported()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "AccessPageDefinition")); + } + if (table.isRefreshAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "AccessPageDefinition")); + } + if (table.isCreateAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "AccessPageDefinition")); + } + if (table.isDeleteAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "AccessPageDefinition")); + } + if (table.isAddReferenceAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "AccessPageDefinition")); + } + if (table.isRemoveReferenceAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "AccessPageDefinition")); + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "AccessPageDefinition")); + } + } +*/ +/* + t.actions.add(s.equivalent("AccessViewBackAction")); + if (relation.isRefreshAllowed()) { + t.actions.add(s.equivalent("AccessViewRefreshAction")); + } + */ + /* + if (relation.isUpdateAllowed()) { + t.actions.add(s.equivalent("ViewLinkPageDefinitionUpdateAction")); + } + if (relation.isDeleteAllowed()) { + t.actions.add(s.equivalent("ViewLinkPageDefinitionDeleteAction")); + } + */ + + log.debug("Create AccessViewPageDefinition: " + t.name); +} + +@lazy +rule AccessViewBackAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableBackAction"); + t.name = s.name + "::Back"; + t.actionDefinition = s.equivalent("AccessViewPageContainerBackActionDefinition"); + + log.debug("AccessTableBackAction: " + t.name); +} + +rule AccessViewPageContainer + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::PageContainer { + guard: rootMenu.containsVisualElement(s) + + var relation = s.actorAccess.target; + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainer"); + t.name = s.getFqName() + "::View::PageContainer"; + t.label = s.getLabelWithNameFallback(); + t.titleFrom = UI!ui::TitleFrom#LABEL; + t.type = UI!ui::PageContainerType#VIEW; + t.children.add(s.equivalent("AccessViewPageContainerVisualElement")); + t.actionButtonGroup = s.equivalent("AccessViewPageContainerButtonGroup"); + t.dataElement = relation.referenceType.equivalent("ClassType"); + t.onInit = s.equivalent("AccessViewPageContainerRefreshActionDefinition"); + + rootMenu.equivalent("Application").pageContainers.add(t); + + /* + for (dataFeature in s.additionalMaskFeatures) { + var attributeType = dataFeature.getMember().mapAttributeType(s.eContainer.equivalent("ClassType")); + t.additionalMaskAttributes.add(attributeType); + } + */ + + log.debug("Create AccessViewPageDefinition: " + t.name); +} + +@lazy +rule AccessViewPageContainerButtonGroup + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerButtonGroup"); + t.name = s.getFqName() + "::PageActions"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("AccessViewPageContainerBackButton")); + t.buttons.add(s.equivalent("AccessViewPageContainerRefreshButton")); + + log.debug("AccessViewPageContainerButtonGroup: " + t.name); +} + +@lazy +rule AccessViewPageContainerBackButtonIcon + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Icon { + t.iconName = "arrow-left"; + t.name = s.name + "BackIcon"; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerBackButtonIcon"); +} + +@lazy +rule AccessViewPageContainerBackActionDefinition + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("AccessViewPageContainerBackActionDefinition: " + t.name); +} + +@lazy +rule AccessViewPageContainerBackButton + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerBackButton"); + t.name = s.getFqName() + "::Back"; + t.label = "Back"; + t.buttonStyle = "text"; + t.icon = s.equivalent("AccessViewPageContainerBackButtonIcon"); + t.actionDefinition = s.equivalent("AccessViewPageContainerBackActionDefinition"); + log.debug("AccessViewPageContainerBackButton: " + t.name); +} + +@lazy +rule AccessViewPageContainerVisualElement + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Flex { + t.~pos = 0; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerVisualElement"); + t.name = s.name; + t.direction = UI!Axis#VERTICAL; + t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; + t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; + t.col = 12d; + // t.children.add(s.equivalent("AccessTableTable")); + t.frame = s.equivalent("AccessViewFrame"); + + log.debug("AccessViewPageContainerVisualElement: " + t.name); +} + +@lazy +rule AccessViewFrame + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Frame { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewFrame"); +} + +@lazy +rule AccessViewPageContainerRefreshButton + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerRefreshButton"); + t.name = s.name + "::Refresh"; + t.icon = s.equivalent("AccessViewPageContainerRefreshButtonIcon"); + t.label = "Refresh"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("AccessViewPageContainerRefreshActionDefinition"); + + log.debug("AccessViewPageContainerRefreshButton: " + t.name); +} + +@lazy +rule AccessViewPageContainerRefreshButtonIcon + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerRefreshButtonIcon"); + t.name = s.name + "RefreshIcon"; + t.iconName = "refresh"; + + log.debug("AccessViewPageContainerRefreshButtonIcon: " + t.name); +} + +@lazy +rule AccessViewPageContainerRefreshActionDefinition + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::RefreshActionDefinition { + var relation = s.actorAccess.target; + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerRefreshActionDefinition"); + t.name = s.name + "::Refresh"; + t.targetType = relation.referenceType.equivalent("ClassType"); + + log.debug("AccessViewPageContainerRefreshActionDefinition: " + t.name); +} + +@lazy +rule AccessViewRefreshAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); + t.name = s.name + "::Refresh"; + t.actionDefinition = s.equivalent("AccessViewPageContainerRefreshActionDefinition"); + + log.debug("AccessViewRefreshAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index 04ebb4d6..9aa9275c 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -161,16 +161,16 @@ rule AccessTablePageContainerVisualElement t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; t.col = 12d; t.children.add(s.equivalent("AccessTableTable")); - t.frame = s.equivalent("ViewLinkDeclarationSetSelectorFrame"); + t.frame = s.equivalent("AccessTableFrame"); log.debug("AccessTablePageContainerVisualElement: " + t.name); } @lazy -rule ViewLinkDeclarationSetSelectorFrame +rule AccessTableFrame transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Frame { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorFrame"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableFrame"); } @lazy diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java index 44550e71..dbda7e52 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java @@ -39,267 +39,287 @@ protected Logger createLog() { return log; } -// @BeforeAll -// static void prepareTestFolders() throws IOException { -// if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { -// Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); -// } -// } -// -// @Test -// void testBasicWidgets() throws Exception { -// jslModel = JslParser.getModelFromStrings("BasicWidgetsTestModel", List.of(""" -// model BasicWidgetsTestModel; -// -// type binary Binary max-file-size: 1MB mime-type: ["image/*"]; -// type boolean Boolean; -// type date Date; -// type numeric Numeric scale: 0 precision: 9; -// type string String min-size: 0 max-size: 255; -// type time Time; -// type timestamp Timestamp; -// -// enum MyEnum { -// Atomic = 0; -// Bombastic = 1; -// Crazy = 2; -// } -// -// entity User { -// identifier String email required; -// field Binary binary; -// field String string; -// field Boolean boolean; -// field Date date; -// field Numeric numeric; -// field Time time; -// field Timestamp timestamp; -// field MyEnum `enum` default:MyEnum#Bombastic; -// } -// -// view UserView(User u) { -// group level1 label:"Yo" icon:"text" { -// group level2 width:12 frame:true icon:"unicorn" label:"Level 2" stretch:true { -// field String email <= u.email bind required icon:"text" label: "My Email"; -// field Binary binaryDerived <= u.binary icon:"binary" label:"Binary Derived"; -// field String stringDerived <= u.string icon:"string" label:"String Derived"; -// } -// -// group level22 width:6 frame:true icon:"dog" label:"Level 2 - 2" orientation:horizontal { -// field Boolean booleanDerived <= u.boolean icon:"boolean" label:"Boolean Derived"; -// field Date dateDerived <= u.date icon:"date" label:"Date Derived"; -// field Numeric numericDerived <= u.numeric icon:"numeric" label:"Numeric Derived"; -// } -// -// tabs tabs0 orientation:horizontal width:6 { -// group tab1 label:"Tab1" icon:"numbers" h-align:left { -// field Time timeDerived <= u.time icon:"time" label:"Time Derived"; -// } -// -// group tab2 label:"Tab2" icon:"numbers" h-align:right { -// field Timestamp timestampDerived <= u.timestamp icon:"timestamp" label:"Timestamp Derived"; -// field MyEnum mappedEnum <= u.`enum` bind default:MyEnum#Crazy icon:"enum" label:"Mapped Enum"; -// } -// } -// } -// } -// -// actor WidgetsActor human { -// link UserView user <= User.any() label:"User" icon:"tools"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app = apps.get(0); -// -// List pageContainers = app.getPageContainers(); -// -// assertEquals(2, pageContainers.size()); -// -// PageContainer dashboard = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::WidgetsActor::Dashboard")).findFirst().orElseThrow(); -// PageContainer user = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::UserView::PageContainer")).findFirst().orElseThrow(); -// -// // Dashboard -// assertEquals(0, dashboard.getChildren().size()); -// -// // User -// -// assertEquals(1, user.getChildren().size()); -// -// // Root Flex -// Flex rootFlex = (Flex) user.getChildren().get(0); -// -// assertEquals("UserView", rootFlex.getName()); -// assertNull(rootFlex.getLabel()); -// assertEquals(12, rootFlex.getCol()); -// assertEquals(Axis.VERTICAL, rootFlex.getDirection()); -// assertEquals(1, rootFlex.getChildren().size()); -// -// // level1 -// -// Flex level1 = (Flex) rootFlex.getChildren().get(0); -// -// assertEquals("level1", level1.getName()); -// assertEquals("Yo", level1.getLabel()); -// assertEquals("text", level1.getIcon().getIconName()); -// assertEquals(12, level1.getCol()); -// assertEquals(Axis.VERTICAL, level1.getDirection()); -// assertEquals(3, level1.getChildren().size()); -// -// // level2 -// -// Flex level2 = (Flex) level1.getChildren().stream().filter(c -> c.getName().equals("level2")).findFirst().orElseThrow(); -// -// assertEquals("level2", level2.getName()); -// assertEquals("Level 2", level2.getLabel()); -// assertEquals("unicorn", level2.getIcon().getIconName()); -// assertEquals(12, level2.getCol()); -// assertEquals(Axis.VERTICAL, level2.getDirection()); -// assertNotNull(level2.getFrame()); -// assertNotNull(level2.getStretch()); -// assertEquals(3, level2.getChildren().size()); -// -// // level2 -> children -// -// TextInput email = (TextInput) level2.getChildren().stream().filter(c -> c.getName().equals("email")).findFirst().orElseThrow(); -// -// assertEquals("email", email.getName()); -// assertEquals("My Email", email.getLabel()); -// assertEquals("text", email.getIcon().getIconName()); -// assertEquals("String", email.getAttributeType().getDataType().getName()); -// assertTrue(email.getAttributeType().isIsRequired()); -// assertFalse(email.getAttributeType().isIsReadOnly()); -// -// BinaryTypeInput binaryDerived = (BinaryTypeInput) level2.getChildren().stream().filter(c -> c.getName().equals("binaryDerived")).findFirst().orElseThrow(); -// -// assertEquals("binaryDerived", binaryDerived.getName()); -// assertEquals("Binary Derived", binaryDerived.getLabel()); -// assertEquals("binary", binaryDerived.getIcon().getIconName()); -// assertEquals("Binary", binaryDerived.getAttributeType().getDataType().getName()); -// assertFalse(binaryDerived.getAttributeType().isIsRequired()); -// assertTrue(binaryDerived.getAttributeType().isIsReadOnly()); -// -// TextInput stringDerived = (TextInput) level2.getChildren().stream().filter(c -> c.getName().equals("stringDerived")).findFirst().orElseThrow(); -// -// assertEquals("stringDerived", stringDerived.getName()); -// assertEquals("String Derived", stringDerived.getLabel()); -// assertEquals("string", stringDerived.getIcon().getIconName()); -// assertEquals("String", stringDerived.getAttributeType().getDataType().getName()); -// assertFalse(stringDerived.getAttributeType().isIsRequired()); -// assertTrue(stringDerived.getAttributeType().isIsReadOnly()); -// -// // level2 - 2 -// -// Flex level22 = (Flex) level1.getChildren().stream().filter(c -> c.getName().equals("level22")).findFirst().orElseThrow(); -// -// assertEquals("level22", level22.getName()); -// assertEquals("Level 2 - 2", level22.getLabel()); -// assertEquals("dog", level22.getIcon().getIconName()); -// assertEquals(6, level22.getCol()); -// assertEquals(Axis.HORIZONTAL, level22.getDirection()); -// assertEquals(3, level22.getChildren().size()); -// -// // level2 - 2 -> children -// -// TrinaryLogicCombo booleanDerived = (TrinaryLogicCombo) level22.getChildren().stream().filter(c -> c.getName().equals("booleanDerived")).findFirst().orElseThrow(); -// -// assertEquals("booleanDerived", booleanDerived.getName()); -// assertEquals("Boolean Derived", booleanDerived.getLabel()); -// assertEquals("boolean", booleanDerived.getIcon().getIconName()); -// assertEquals("Boolean", booleanDerived.getAttributeType().getDataType().getName()); -// assertFalse(booleanDerived.getAttributeType().isIsRequired()); -// assertTrue(booleanDerived.getAttributeType().isIsReadOnly()); -// -// DateInput dateDerived = (DateInput) level22.getChildren().stream().filter(c -> c.getName().equals("dateDerived")).findFirst().orElseThrow(); -// -// assertEquals("dateDerived", dateDerived.getName()); -// assertEquals("Date Derived", dateDerived.getLabel()); -// assertEquals("date", dateDerived.getIcon().getIconName()); -// assertEquals("Date", dateDerived.getAttributeType().getDataType().getName()); -// assertFalse(dateDerived.getAttributeType().isIsRequired()); -// assertTrue(dateDerived.getAttributeType().isIsReadOnly()); -// -// NumericInput numericDerived = (NumericInput) level22.getChildren().stream().filter(c -> c.getName().equals("numericDerived")).findFirst().orElseThrow(); -// -// assertEquals("numericDerived", numericDerived.getName()); -// assertEquals("Numeric Derived", numericDerived.getLabel()); -// assertEquals("numeric", numericDerived.getIcon().getIconName()); -// assertEquals("Numeric", numericDerived.getAttributeType().getDataType().getName()); -// assertFalse(numericDerived.getAttributeType().isIsRequired()); -// assertTrue(numericDerived.getAttributeType().isIsReadOnly()); -// -// // tabs 0 -// -// TabController tabs0 = (TabController) level1.getChildren().stream().filter(c -> c.getName().equals("tabs0")).findFirst().orElseThrow(); -// -// assertEquals("tabs0", tabs0.getName()); -// assertEquals(6, tabs0.getCol()); -// assertEquals(TabOrientation.HORIZONTAL, tabs0.getOrientation()); -// assertEquals(2, tabs0.getTabs().size()); -// -// // tab1 -// -// Tab tab1 = tabs0.getTabs().stream().filter(t -> t.getName().equals("tab1")).findFirst().orElseThrow(); -// Flex tab1Element = (Flex) tab1.getElement(); -// -// assertEquals("tab1", tab1Element.getName()); -// assertEquals(12, tab1Element.getCol()); -// assertEquals("Tab1", tab1Element.getLabel()); -// assertEquals("numbers", tab1Element.getIcon().getIconName()); -// assertEquals(Axis.VERTICAL, tab1Element.getDirection()); -// assertEquals(CrossAxisAlignment.START, tab1Element.getCrossAxisAlignment()); -// assertEquals(1, tab1Element.getChildren().size()); -// -// // tab1 -> children -// -// TimeInput timeDerived = (TimeInput) tab1Element.getChildren().stream().filter(c -> c.getName().equals("timeDerived")).findFirst().orElseThrow(); -// -// assertEquals("timeDerived", timeDerived.getName()); -// assertEquals("Time Derived", timeDerived.getLabel()); -// assertEquals("time", timeDerived.getIcon().getIconName()); -// assertEquals("Time", timeDerived.getAttributeType().getDataType().getName()); -// assertFalse(timeDerived.getAttributeType().isIsRequired()); -// assertTrue(timeDerived.getAttributeType().isIsReadOnly()); -// -// // tab2 -// -// Tab tab2 = tabs0.getTabs().stream().filter(t -> t.getName().equals("tab2")).findFirst().orElseThrow(); -// Flex tab2Element = (Flex) tab2.getElement(); -// -// assertEquals("tab2", tab2Element.getName()); -// assertEquals(12, tab2Element.getCol()); -// assertEquals("Tab2", tab2Element.getLabel()); -// assertEquals("numbers", tab2Element.getIcon().getIconName()); -// assertEquals(Axis.VERTICAL, tab2Element.getDirection()); -// assertEquals(CrossAxisAlignment.END, tab2Element.getCrossAxisAlignment()); -// assertEquals(2, tab2Element.getChildren().size()); -// -// // tab2 -> children -// -// DateTimeInput timestampDerived = (DateTimeInput) tab2Element.getChildren().stream().filter(c -> c.getName().equals("timestampDerived")).findFirst().orElseThrow(); -// -// assertEquals("timestampDerived", timestampDerived.getName()); -// assertEquals("Timestamp Derived", timestampDerived.getLabel()); -// assertEquals("timestamp", timestampDerived.getIcon().getIconName()); -// assertEquals("Timestamp", timestampDerived.getAttributeType().getDataType().getName()); -// assertFalse(timestampDerived.getAttributeType().isIsRequired()); -// assertTrue(timestampDerived.getAttributeType().isIsReadOnly()); -// -// EnumerationCombo mappedEnum = (EnumerationCombo) tab2Element.getChildren().stream().filter(c -> c.getName().equals("mappedEnum")).findFirst().orElseThrow(); -// -// assertEquals("mappedEnum", mappedEnum.getName()); -// assertEquals("Mapped Enum", mappedEnum.getLabel()); -// assertEquals("enum", mappedEnum.getIcon().getIconName()); -// assertEquals("MyEnum", mappedEnum.getAttributeType().getDataType().getName()); -// assertFalse(mappedEnum.getAttributeType().isIsRequired()); -// assertFalse(mappedEnum.getAttributeType().isIsReadOnly()); -// } -// + @BeforeAll + static void prepareTestFolders() throws IOException { + if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { + Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); + } + } + + @Test + void testBasicWidgets() throws Exception { + jslModel = JslParser.getModelFromStrings("BasicWidgetsTestModel", List.of(""" + model BasicWidgetsTestModel; + + type binary Binary max-file-size: 1MB mime-type: ["image/*"]; + type boolean Boolean; + type date Date; + type numeric Numeric scale: 0 precision: 9; + type string String min-size: 0 max-size: 255; + type time Time; + type timestamp Timestamp; + + enum MyEnum { + Atomic = 0; + Bombastic = 1; + Crazy = 2; + } + + entity User { + identifier String email required; + field Binary binary; + field String string; + field Boolean boolean; + field Date date; + field Numeric numeric; + field Time time; + field Timestamp timestamp; + field MyEnum `enum` default:MyEnum#Bombastic; + } + + transfer UserTransfer(User u) { + field String email <=> u.email; + field Binary binary <= u.binary; + field String string <= u.string; + field Boolean boolean <= u.boolean; + field Date date <= u.date; + field Numeric numeric <= u.numeric; + field Time time <= u.time; + field Timestamp timestamp <= u.timestamp; + field MyEnum `enum` <=> u.`enum` default:MyEnum#Crazy; + + event create onCreate; + event update onUpdate; + event delete onDelete; + } + + view UserView(UserTransfer u) { + group level1 label:"Yo" icon:"text" { + group level2 width:12 frame:true icon:"unicorn" label:"Level 2" stretch:true { + widget String email <= u.email icon:"text" label: "My Email"; + widget Binary binaryDerived <= u.binary icon:"binary" label:"Binary Derived"; + widget String stringDerived <= u.string icon:"string" label:"String Derived"; + } + + group level22 width:6 frame:true icon:"dog" label:"Level 2 - 2" orientation:horizontal { + widget Boolean booleanDerived <= u.boolean icon:"boolean" label:"Boolean Derived"; + widget Date dateDerived <= u.date icon:"date" label:"Date Derived"; + widget Numeric numericDerived <= u.numeric icon:"numeric" label:"Numeric Derived"; + } + + tabs tabs0 orientation:horizontal width:6 { + group tab1 label:"Tab1" icon:"numbers" h-align:left { + widget Time timeDerived <= u.time icon:"time" label:"Time Derived"; + } + + group tab2 label:"Tab2" icon:"numbers" h-align:right { + widget Timestamp timestampDerived <= u.timestamp icon:"timestamp" label:"Timestamp Derived"; + widget MyEnum mappedEnum <= u.`enum` icon:"enum" label:"Mapped Enum"; + } + } + } + } + + actor WidgetsActor { + access UserTransfer user <= User.any() create delete update; + } + + menu WidgetsApp(WidgetsActor a) { + link UserView user <= a.user label:"User" icon:"tools"; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application app = apps.get(0); + + List pageContainers = app.getPageContainers(); + + assertEquals(2, pageContainers.size()); + + PageContainer dashboard = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::WidgetsApp::Dashboard")).findFirst().orElseThrow(); + PageContainer user = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::WidgetsApp::user::View::PageContainer")).findFirst().orElseThrow(); + + // Dashboard + assertEquals(0, dashboard.getChildren().size()); + + // User + + assertEquals(1, user.getChildren().size()); + + // Root Flex + Flex rootFlex = (Flex) user.getChildren().get(0); + + assertEquals("user", rootFlex.getName()); + assertNull(rootFlex.getLabel()); + assertEquals(12, rootFlex.getCol()); + assertEquals(Axis.VERTICAL, rootFlex.getDirection()); + assertEquals(1, rootFlex.getChildren().size()); + + // level1 + + Flex level1 = (Flex) rootFlex.getChildren().get(0); + + assertEquals("level1", level1.getName()); + assertEquals("Yo", level1.getLabel()); + assertEquals("text", level1.getIcon().getIconName()); + assertEquals(12, level1.getCol()); + assertEquals(Axis.VERTICAL, level1.getDirection()); + assertEquals(3, level1.getChildren().size()); + + // level2 + + Flex level2 = (Flex) level1.getChildren().stream().filter(c -> c.getName().equals("level2")).findFirst().orElseThrow(); + + assertEquals("level2", level2.getName()); + assertEquals("Level 2", level2.getLabel()); + assertEquals("unicorn", level2.getIcon().getIconName()); + assertEquals(12, level2.getCol()); + assertEquals(Axis.VERTICAL, level2.getDirection()); + assertNotNull(level2.getFrame()); + assertNotNull(level2.getStretch()); + assertEquals(3, level2.getChildren().size()); + + // level2 -> children + + TextInput email = (TextInput) level2.getChildren().stream().filter(c -> c.getName().equals("email")).findFirst().orElseThrow(); + + assertEquals("email", email.getName()); + assertEquals("My Email", email.getLabel()); + assertEquals("text", email.getIcon().getIconName()); + assertEquals("String", email.getAttributeType().getDataType().getName()); + assertTrue(email.getAttributeType().isIsRequired()); + assertFalse(email.getAttributeType().isIsReadOnly()); + + BinaryTypeInput binaryDerived = (BinaryTypeInput) level2.getChildren().stream().filter(c -> c.getName().equals("binaryDerived")).findFirst().orElseThrow(); + + assertEquals("binaryDerived", binaryDerived.getName()); + assertEquals("Binary Derived", binaryDerived.getLabel()); + assertEquals("binary", binaryDerived.getIcon().getIconName()); + assertEquals("Binary", binaryDerived.getAttributeType().getDataType().getName()); + assertFalse(binaryDerived.getAttributeType().isIsRequired()); + assertTrue(binaryDerived.getAttributeType().isIsReadOnly()); + + TextInput stringDerived = (TextInput) level2.getChildren().stream().filter(c -> c.getName().equals("stringDerived")).findFirst().orElseThrow(); + + assertEquals("stringDerived", stringDerived.getName()); + assertEquals("String Derived", stringDerived.getLabel()); + assertEquals("string", stringDerived.getIcon().getIconName()); + assertEquals("String", stringDerived.getAttributeType().getDataType().getName()); + assertFalse(stringDerived.getAttributeType().isIsRequired()); + assertTrue(stringDerived.getAttributeType().isIsReadOnly()); + + // level2 - 2 + + Flex level22 = (Flex) level1.getChildren().stream().filter(c -> c.getName().equals("level22")).findFirst().orElseThrow(); + + assertEquals("level22", level22.getName()); + assertEquals("Level 2 - 2", level22.getLabel()); + assertEquals("dog", level22.getIcon().getIconName()); + assertEquals(6, level22.getCol()); + assertEquals(Axis.HORIZONTAL, level22.getDirection()); + assertEquals(3, level22.getChildren().size()); + + // level2 - 2 -> children + + TrinaryLogicCombo booleanDerived = (TrinaryLogicCombo) level22.getChildren().stream().filter(c -> c.getName().equals("booleanDerived")).findFirst().orElseThrow(); + + assertEquals("booleanDerived", booleanDerived.getName()); + assertEquals("Boolean Derived", booleanDerived.getLabel()); + assertEquals("boolean", booleanDerived.getIcon().getIconName()); + assertEquals("Boolean", booleanDerived.getAttributeType().getDataType().getName()); + assertFalse(booleanDerived.getAttributeType().isIsRequired()); + assertTrue(booleanDerived.getAttributeType().isIsReadOnly()); + + DateInput dateDerived = (DateInput) level22.getChildren().stream().filter(c -> c.getName().equals("dateDerived")).findFirst().orElseThrow(); + + assertEquals("dateDerived", dateDerived.getName()); + assertEquals("Date Derived", dateDerived.getLabel()); + assertEquals("date", dateDerived.getIcon().getIconName()); + assertEquals("Date", dateDerived.getAttributeType().getDataType().getName()); + assertFalse(dateDerived.getAttributeType().isIsRequired()); + assertTrue(dateDerived.getAttributeType().isIsReadOnly()); + + NumericInput numericDerived = (NumericInput) level22.getChildren().stream().filter(c -> c.getName().equals("numericDerived")).findFirst().orElseThrow(); + + assertEquals("numericDerived", numericDerived.getName()); + assertEquals("Numeric Derived", numericDerived.getLabel()); + assertEquals("numeric", numericDerived.getIcon().getIconName()); + assertEquals("Numeric", numericDerived.getAttributeType().getDataType().getName()); + assertFalse(numericDerived.getAttributeType().isIsRequired()); + assertTrue(numericDerived.getAttributeType().isIsReadOnly()); + + // tabs 0 + + TabController tabs0 = (TabController) level1.getChildren().stream().filter(c -> c.getName().equals("tabs0")).findFirst().orElseThrow(); + + assertEquals("tabs0", tabs0.getName()); + assertEquals(6, tabs0.getCol()); + assertEquals(TabOrientation.HORIZONTAL, tabs0.getOrientation()); + assertEquals(2, tabs0.getTabs().size()); + + // tab1 + + Tab tab1 = tabs0.getTabs().stream().filter(t -> t.getName().equals("tab1")).findFirst().orElseThrow(); + Flex tab1Element = (Flex) tab1.getElement(); + + assertEquals("tab1", tab1Element.getName()); + assertEquals(12, tab1Element.getCol()); + assertEquals("Tab1", tab1Element.getLabel()); + assertEquals("numbers", tab1Element.getIcon().getIconName()); + assertEquals(Axis.VERTICAL, tab1Element.getDirection()); + assertEquals(CrossAxisAlignment.START, tab1Element.getCrossAxisAlignment()); + assertEquals(1, tab1Element.getChildren().size()); + + // tab1 -> children + + TimeInput timeDerived = (TimeInput) tab1Element.getChildren().stream().filter(c -> c.getName().equals("timeDerived")).findFirst().orElseThrow(); + + assertEquals("timeDerived", timeDerived.getName()); + assertEquals("Time Derived", timeDerived.getLabel()); + assertEquals("time", timeDerived.getIcon().getIconName()); + assertEquals("Time", timeDerived.getAttributeType().getDataType().getName()); + assertFalse(timeDerived.getAttributeType().isIsRequired()); + assertTrue(timeDerived.getAttributeType().isIsReadOnly()); + + // tab2 + + Tab tab2 = tabs0.getTabs().stream().filter(t -> t.getName().equals("tab2")).findFirst().orElseThrow(); + Flex tab2Element = (Flex) tab2.getElement(); + + assertEquals("tab2", tab2Element.getName()); + assertEquals(12, tab2Element.getCol()); + assertEquals("Tab2", tab2Element.getLabel()); + assertEquals("numbers", tab2Element.getIcon().getIconName()); + assertEquals(Axis.VERTICAL, tab2Element.getDirection()); + assertEquals(CrossAxisAlignment.END, tab2Element.getCrossAxisAlignment()); + assertEquals(2, tab2Element.getChildren().size()); + + // tab2 -> children + + DateTimeInput timestampDerived = (DateTimeInput) tab2Element.getChildren().stream().filter(c -> c.getName().equals("timestampDerived")).findFirst().orElseThrow(); + + assertEquals("timestampDerived", timestampDerived.getName()); + assertEquals("Timestamp Derived", timestampDerived.getLabel()); + assertEquals("timestamp", timestampDerived.getIcon().getIconName()); + assertEquals("Timestamp", timestampDerived.getAttributeType().getDataType().getName()); + assertFalse(timestampDerived.getAttributeType().isIsRequired()); + assertTrue(timestampDerived.getAttributeType().isIsReadOnly()); + + EnumerationCombo mappedEnum = (EnumerationCombo) tab2Element.getChildren().stream().filter(c -> c.getName().equals("mappedEnum")).findFirst().orElseThrow(); + + assertEquals("mappedEnum", mappedEnum.getName()); + assertEquals("Mapped Enum", mappedEnum.getLabel()); + assertEquals("enum", mappedEnum.getIcon().getIconName()); + assertEquals("MyEnum", mappedEnum.getAttributeType().getDataType().getName()); + assertFalse(mappedEnum.getAttributeType().isIsRequired()); + assertFalse(mappedEnum.getAttributeType().isIsReadOnly()); + } + // @Test // void testRelationWidgets() throws Exception { // jslModel = JslParser.getModelFromStrings("RelationWidgetsTestModel", List.of(""" From b564b0b3ea5e2355c5febad8ce45a694933b9bf3 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Wed, 18 Sep 2024 17:57:13 +0200 Subject: [PATCH 03/21] JNG-5928 save state --- .../jsl/actor/actorGroupDeclaration.eol | 2 + .../jsl/data/transferDeclaration.eol | 14 +- .../jsl/data/transferRelationDeclaration.eol | 5 - .../epsilon/operations/jsl/ui/_importUI.eol | 1 + .../operations/jsl/ui/menuDeclaration.eol | 2 + .../operations/jsl/ui/menuLinkDeclaration.eol | 12 +- .../jsl/ui/menuTableDeclaration.eol | 2 + .../operations/jsl/ui/rowDeclaration.eol | 12 + .../operations/jsl/ui/viewDeclaration.eol | 14 +- .../jsl/ui/viewGroupDeclaration.eol | 46 +- .../operations/jsl/ui/viewLinkDeclaration.eol | 3 + .../jsl/ui/viewPanelDeclaration.eol | 48 +- .../jsl/ui/viewTableDeclaration.eol | 2 + .../operations/jsl/ui/viewTabsDeclaration.eol | 46 +- .../jsl/ui/viewWidgetDeclaration.eol | 22 - .../epsilon/transformations/ui/jslToUi.etl | 29 +- .../ui/modules/view/menuLinkDeclaration.etl | 151 +-- .../ui/modules/view/menuTableDeclaration.etl | 911 ++---------------- .../ui/modules/view/rowDeclaration.etl | 462 +++++++++ .../view/rowDeclarationAddSelector.etl | 229 +++++ .../ui/modules/view/viewGroupDeclaration.etl | 34 +- .../ui/modules/view/viewLinkDeclaration.etl | 2 +- .../ui/modules/view/viewTableDeclaration.etl | 6 +- .../ui/modules/view/viewTabsDeclaration.etl | 25 +- .../ui/modules/view/viewWidgetDeclaration.etl | 2 +- .../jsl2ui/application/JslModel2UiTest.java | 6 +- .../application/JslModel2UiWidgetsTest.java | 6 +- 27 files changed, 982 insertions(+), 1112 deletions(-) create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol index fadd97ad..82d840d0 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol @@ -31,6 +31,8 @@ operation JSL!UIMenuGroupDeclaration getActorDeclaration(): JSL!ActorDeclaration 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.add(link); ves.addAll(link.getExposedVisualElements()); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferDeclaration.eol index 0bd8f1fa..edd7f33a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferDeclaration.eol @@ -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()); } */ @@ -98,16 +98,16 @@ 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; } @@ -115,11 +115,11 @@ operation JSL!TransferDeclaration getDirectRelations(): Set { 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; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferRelationDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferRelationDeclaration.eol index e563903d..f49d9096 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferRelationDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferRelationDeclaration.eol @@ -163,8 +163,3 @@ operation JSL!TransferRelationDeclaration getContainerEquivalentClassType(): UI! } return null; } - -@cached -operation JSL!TransferRelationDeclaration getTransferObjectType(): JSL!TransferDeclaration { - return self.referenceType; -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol index 64c74b3f..7847815c 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/_importUI.eol @@ -3,6 +3,7 @@ import "menuDeclaration.eol"; import "menuLinkDeclaration.eol"; import "menuTableDeclaration.eol"; import "rowColumnDeclaration.eol"; +import "rowDeclaration.eol"; import "viewActionDeclaration.eol"; import "viewDeclaration.eol"; import "viewGroupDeclaration.eol"; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol index 6246e153..6e549c3d 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol @@ -25,6 +25,8 @@ operation JSL!UIMenuDeclaration getActorDeclaration(): JSL!ActorDeclaration { 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()); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol index 8c6d7c76..0016d675 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol @@ -16,15 +16,9 @@ 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()); - } - - for (table in viewDeclaration.members.select(m | m.isTypeOf(JSL!UIMenuTableDeclaration)).asSet()) { - ves.addAll(table.getExposedVisualElements()); - } - - ves.addAll(viewDeclaration.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); + ves.add(self); + ves.add(viewDeclaration); + ves.addAll(viewDeclaration.getExposedVisualElements()); return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuTableDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuTableDeclaration.eol index ed58baf4..4aa7ed97 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuTableDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuTableDeclaration.eol @@ -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()) { diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol new file mode 100644 index 00000000..bc7323dd --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol @@ -0,0 +1,12 @@ +@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; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol index 75092310..9e8642cd 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol @@ -19,14 +19,24 @@ 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); + + 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()); } + 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()); + } + ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); return ves; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewGroupDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewGroupDeclaration.eol index 38d5fbae..9234dd6f 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewGroupDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewGroupDeclaration.eol @@ -1,30 +1,46 @@ -/* @cached -operation JSL!ViewGroupDeclaration getId(): String { +operation JSL!UIViewGroupDeclaration getId(): String { return (self.eContainer.getId() + "/" + self.name); } @cached -operation JSL!ViewGroupDeclaration getFqName(): String { +operation JSL!UIViewGroupDeclaration getFqName(): String { return self.eContainer.getFqName() + "::" + self.name; } @cached -operation JSL!ViewGroupDeclaration getTransferObjectType(): JSL!TransferDeclaration { - var to = self.eContainer; - while (to.isDefined() and not to.isKindOf(JSL!TransferDeclaration)) { - to = to.eContainer; - } - return to; -} - -@cached -operation JSL!ViewGroupDeclaration isFrame(): Boolean { +operation JSL!UIViewGroupDeclaration isFrame(): Boolean { var frame = self.getFrame(); return frame.isDefined() and frame.isTrue(); } -operation JSL!ViewGroupDeclaration uiContainer() : UI!ui::VisualElement { +operation JSL!UIViewGroupDeclaration uiContainer() : UI!ui::VisualElement { return self.equivalent("GroupVisualElement"); } -*/ + +@cached +operation JSL!UIViewGroupDeclaration getExposedVisualElements(): Set { + var ves = new Set(); + + ves.add(self); + + 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!UIViewTableDeclaration)).asSet()) { + ves.addAll(table.getExposedVisualElements()); + } + + 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()); + } + + ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); + + return ves; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol index d35b1e3b..28d2b3bc 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol @@ -21,6 +21,9 @@ operation JSL!UIViewLinkDeclaration getExposedVisualElements(): Set { var ves = new Set(); var viewDeclaration = self.referenceType; + ves.add(self); + ves.add(viewDeclaration); + for (link in self.members.select(m | m.isTypeOf(JSL!UIViewLinkDeclaration)).asSet()) { ves.addAll(link.getExposedVisualElements()); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol index bee4bec7..17cb1ee3 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewPanelDeclaration.eol @@ -1,20 +1,19 @@ -/* @cached -operation JSL!ViewPanelDeclaration getDirectRelations(): Set { +operation JSL!UIViewPanelDeclaration getDirectRelations(): Set { var relations = new Set(); - if (self.isTypeOf(JSL!ViewGroupDeclaration)) { + if (self.isTypeOf(JSL!UIViewGroupDeclaration)) { var ownRelations = self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)); relations.addAll(ownRelations); - for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) { + for (group in self.members.select(m | m.isKindOf(JSL!UIViewGroupDeclaration))) { relations.addAll(group.getAllRelations()); } - for (tabs in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) { + for (tabs in self.members.select(m | m.isKindOf(JSL!UIViewTabsDeclaration))) { relations.addAll(tabs.getAllRelations()); } - } else if (self.isTypeOf(JSL!ViewTabsDeclaration)) { - for (group in self.groups) { - relations.addAll(group.getAllRelations()); + } else if (self.isTypeOf(JSL!UIViewTabsDeclaration)) { + for (panel in self.panels) { + relations.addAll(panel.getAllRelations()); } } @@ -22,16 +21,16 @@ operation JSL!ViewPanelDeclaration getDirectRelations(): Set { } @cached -operation JSL!ViewPanelDeclaration getAllRelations(): Set { +operation JSL!UIViewPanelDeclaration getAllRelations(): Set { var relations = new Set(); - if (self.isTypeOf(JSL!ViewGroupDeclaration)) { + if (self.isTypeOf(JSL!UIViewGroupDeclaration)) { var ownRelations = self.members.select(m | m.isKindOf(JSL!UIViewLinkDeclaration)); relations.addAll(ownRelations); - for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) { + for (group in self.members.select(m | m.isKindOf(JSL!UIViewGroupDeclaration))) { relations.addAll(group.getAllRelations()); } - for (tabs in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) { + for (tabs in self.members.select(m | m.isKindOf(JSL!UIViewTabsDeclaration))) { relations.addAll(tabs.getAllRelations()); } @@ -39,9 +38,9 @@ operation JSL!ViewPanelDeclaration getAllRelations(): Set { for (member in ownRelations) { relations.addAll(member.referenceType.getAllRelations()); } - } else if (self.isTypeOf(JSL!ViewTabsDeclaration)) { - for (group in self.groups) { - relations.addAll(group.getAllRelations()); + } else if (self.isTypeOf(JSL!UIViewTabsDeclaration)) { + for (panel in self.panels) { + relations.addAll(panel.getAllRelations()); } } @@ -49,20 +48,20 @@ operation JSL!ViewPanelDeclaration getAllRelations(): Set { } @cached -operation JSL!ViewPanelDeclaration getAllPrimitiveFields(): Set { +operation JSL!UIViewPanelDeclaration getAllPrimitiveFields(): Set { var fields = new Set(); - if (self.isTypeOf(JSL!ViewGroupDeclaration)) { + if (self.isTypeOf(JSL!UIViewGroupDeclaration)) { 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))) { + for (group in self.members.select(m | m.isKindOf(JSL!UIViewGroupDeclaration))) { fields.addAll(group.getAllPrimitiveFields()); } - for (tab in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) { + for (tab in self.members.select(m | m.isKindOf(JSL!UIViewTabsDeclaration))) { fields.addAll(tab.getAllPrimitiveFields()); } - } else if (self.isTypeOf(JSL!ViewTabsDeclaration)) { - for (group in self.groups) { - fields.addAll(group.getAllPrimitiveFields()); + } else if (self.isTypeOf(JSL!UIViewTabsDeclaration)) { + for (panel in self.panels) { + fields.addAll(panel.getAllPrimitiveFields()); } } @@ -70,13 +69,12 @@ operation JSL!ViewPanelDeclaration getAllPrimitiveFields(): Set { } @cached -operation JSL!ViewPanelDeclaration getViewContainer(): JSL!UIViewDeclaration { +operation JSL!UIViewPanelDeclaration getViewContainer(): JSL!UIViewDeclaration { if (self.eContainer.isKindOf(JSL!UIViewDeclaration)) { return self.eContainer; - } else if (self.eContainer.isKindOf(JSL!ViewPanelDeclaration)) { + } else if (self.eContainer.isKindOf(JSL!UIViewPanelDeclaration)) { return self.eContainer.getViewContainer(); } return null; } -*/ diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol index db5845b3..12103aaf 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol @@ -33,6 +33,8 @@ operation JSL!UIViewTableDeclaration 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()); return ves; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol index e028f4ff..e08eeb2b 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol @@ -1,29 +1,45 @@ -/* @cached -operation JSL!ViewTabsDeclaration getId(): String { +operation JSL!UIViewTabsDeclaration getId(): String { return (self.eContainer.getId() + "/" + self.name); } @cached -operation JSL!ViewTabsDeclaration getFqName(): String { +operation JSL!UIViewTabsDeclaration getFqName(): String { return self.eContainer.getFqName() + "::" + self.name; } @cached -operation JSL!ViewTabsDeclaration getTransferObjectType(): JSL!TransferDeclaration { - var to = self.eContainer; - while (to.isDefined() and not to.isKindOf(JSL!TransferDeclaration)) { - to = to.eContainer; - } - return to; -} - -@cached -operation JSL!ViewTabsDeclaration isFrame(): Boolean { +operation JSL!UIViewTabsDeclaration isFrame(): Boolean { return false; } -operation JSL!ViewTabsDeclaration uiContainer() : UI!ui::VisualElement { +operation JSL!UIViewTabsDeclaration uiContainer() : UI!ui::VisualElement { return self.equivalent("TabBarVisualElement"); } -*/ + +@cached +operation JSL!UIViewTabsDeclaration getExposedVisualElements(): Set { + var ves = new Set(); + + ves.add(self); + + for (link in self.panels.select(m | m.isTypeOf(JSL!UIViewLinkDeclaration)).asSet()) { + ves.addAll(link.getExposedVisualElements()); + } + + for (table in self.panels.select(m | m.isTypeOf(JSL!UIViewTableDeclaration)).asSet()) { + ves.addAll(table.getExposedVisualElements()); + } + + for (group in self.panels.select(m | m.isKindOf(JSL!UIViewGroupDeclaration)).asSet()) { + ves.addAll(group.getExposedVisualElements()); + } + + for (tab in self.panels.select(m | m.isKindOf(JSL!UIViewTabsDeclaration)).asSet()) { + ves.addAll(tab.getExposedVisualElements()); + } + + ves.addAll(self.panels.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); + + return ves; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol index 76a8ef67..0f42a324 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol @@ -8,28 +8,6 @@ operation JSL!UIViewWidgetDeclaration getFqName(): String { return self.eContainer.getFqName() + "::" + self.name; } -@cached -operation JSL!UIViewWidgetDeclaration getTransferObjectType(): JSL!TransferDeclaration { - /* - var to = self.eContainer; - while (to.isDefined() and not to.isKindOf(JSL!TransferDeclaration)) { - to = to.eContainer; - } - return to; - */ - return self.referenceType.eContainer; -} - -operation JSL!UIViewWidgetDeclaration uiContainer() : UI!ui::VisualElement { - if (self.eContainer.isKindOf(JSL!UIViewDeclaration)) { - if (self.eContainer.form.isDefined() and self.form) { - return self.eContainer.equivalent("FormPageContainerVisualElement"); - } - return self.eContainer.equivalent("ViewPageContainerVisualElement"); - } - throw "Could not map container for uiContainer()"; -} - @cached operation JSL!UIViewWidgetDeclaration getTransferFieldDeclarationEquivalent(): UI!ui::data::AttributeType { var primitive = self.transferField.target; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl index 39944ed1..3e165464 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl @@ -16,6 +16,8 @@ import "modules/view/menuDeclaration.etl"; import "modules/view/menuLinkDeclaration.etl"; import "modules/view/menuTableDeclaration.etl"; import "modules/view/rowColumnDeclaration.etl"; +import "modules/view/rowDeclaration.etl"; +import "modules/view/rowDeclarationAddSelector.etl"; import "modules/view/rowLinkDeclaration.etl"; import "modules/view/viewDeclaration.etl"; import "modules/view/viewGroupDeclaration.etl"; @@ -29,27 +31,30 @@ pre { var __cacheMap = new ConcurrentMap(); var __originalMap = new ConcurrentMap(); var System = Native("java.lang.System"); -/* - for (container : JSL!ViewPanelDeclaration in JSL!ViewPanelDeclaration.all()) { - if (container.isTypeOf(JSL!ViewGroupDeclaration)) { + + for (container : JSL!UIViewPanelDeclaration in JSL!UIViewPanelDeclaration.all()) { + if (container.isTypeOf(JSL!UIViewGroupDeclaration)) { for (member in container.members) { member.~pos = container.members.indexOf(member) + 1; } - } else if (container.isTypeOf(JSL!ViewTabsDeclaration)) { - for (group in container.groups) { - group.~pos = container.groups.indexOf(group) + 1; + } else if (container.isTypeOf(JSL!UIViewTabsDeclaration)) { + for (panel in container.panels) { + panel.~pos = container.panels.indexOf(panel) + 1; } } } - for (visible : JSL!VisibleDeclaration in JSL!VisibleDeclaration.all()) { - if (visible.isTypeOf(JSL!ViewDeclaration) or visible.isTypeOf(JSL!RowDeclaration)) { - for (member in visible.members) { - member.~pos = visible.members.indexOf(member) + 1; - } + for (visible : JSL!UIRowDeclaration in JSL!UIRowDeclaration.all()) { + for (member in visible.members) { + member.~pos = visible.members.indexOf(member) + 1; + } + } + + for (visible : JSL!UIViewDeclaration in JSL!UIViewDeclaration.all()) { + for (member in visible.members) { + member.~pos = visible.members.indexOf(member) + 1; } } -*/ } post { diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl index 19dba872..7b74ad35 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -39,7 +39,7 @@ rule AccessViewPageDefinition t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageDefinition"); t.name = s.getFqName() + "::AccessViewPage"; - t.container = s.equivalent("AccessViewPageContainer"); + t.container = s.referenceType.equivalent("ViewPageContainer"); rootMenu.equivalent("Application").pages.add(t); @@ -105,7 +105,7 @@ rule AccessViewPageDefinition if (relation.isRefreshAllowed()) { t.actions.add(s.equivalent("AccessViewRefreshAction")); } - */ +*/ /* if (relation.isUpdateAllowed()) { t.actions.add(s.equivalent("ViewLinkPageDefinitionUpdateAction")); @@ -128,150 +128,3 @@ rule AccessViewBackAction log.debug("AccessTableBackAction: " + t.name); } - -rule AccessViewPageContainer - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::PageContainer { - guard: rootMenu.containsVisualElement(s) - - var relation = s.actorAccess.target; - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainer"); - t.name = s.getFqName() + "::View::PageContainer"; - t.label = s.getLabelWithNameFallback(); - t.titleFrom = UI!ui::TitleFrom#LABEL; - t.type = UI!ui::PageContainerType#VIEW; - t.children.add(s.equivalent("AccessViewPageContainerVisualElement")); - t.actionButtonGroup = s.equivalent("AccessViewPageContainerButtonGroup"); - t.dataElement = relation.referenceType.equivalent("ClassType"); - t.onInit = s.equivalent("AccessViewPageContainerRefreshActionDefinition"); - - rootMenu.equivalent("Application").pageContainers.add(t); - - /* - for (dataFeature in s.additionalMaskFeatures) { - var attributeType = dataFeature.getMember().mapAttributeType(s.eContainer.equivalent("ClassType")); - t.additionalMaskAttributes.add(attributeType); - } - */ - - log.debug("Create AccessViewPageDefinition: " + t.name); -} - -@lazy -rule AccessViewPageContainerButtonGroup - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerButtonGroup"); - t.name = s.getFqName() + "::PageActions"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("AccessViewPageContainerBackButton")); - t.buttons.add(s.equivalent("AccessViewPageContainerRefreshButton")); - - log.debug("AccessViewPageContainerButtonGroup: " + t.name); -} - -@lazy -rule AccessViewPageContainerBackButtonIcon - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Icon { - t.iconName = "arrow-left"; - t.name = s.name + "BackIcon"; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerBackButtonIcon"); -} - -@lazy -rule AccessViewPageContainerBackActionDefinition - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::BackActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerBackActionDefinition"); - t.name = s.getFqName() + "::Back"; - log.debug("AccessViewPageContainerBackActionDefinition: " + t.name); -} - -@lazy -rule AccessViewPageContainerBackButton - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerBackButton"); - t.name = s.getFqName() + "::Back"; - t.label = "Back"; - t.buttonStyle = "text"; - t.icon = s.equivalent("AccessViewPageContainerBackButtonIcon"); - t.actionDefinition = s.equivalent("AccessViewPageContainerBackActionDefinition"); - log.debug("AccessViewPageContainerBackButton: " + t.name); -} - -@lazy -rule AccessViewPageContainerVisualElement - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Flex { - t.~pos = 0; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerVisualElement"); - t.name = s.name; - t.direction = UI!Axis#VERTICAL; - t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; - t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; - t.col = 12d; - // t.children.add(s.equivalent("AccessTableTable")); - t.frame = s.equivalent("AccessViewFrame"); - - log.debug("AccessViewPageContainerVisualElement: " + t.name); -} - -@lazy -rule AccessViewFrame - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Frame { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewFrame"); -} - -@lazy -rule AccessViewPageContainerRefreshButton - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerRefreshButton"); - t.name = s.name + "::Refresh"; - t.icon = s.equivalent("AccessViewPageContainerRefreshButtonIcon"); - t.label = "Refresh"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessViewPageContainerRefreshActionDefinition"); - - log.debug("AccessViewPageContainerRefreshButton: " + t.name); -} - -@lazy -rule AccessViewPageContainerRefreshButtonIcon - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerRefreshButtonIcon"); - t.name = s.name + "RefreshIcon"; - t.iconName = "refresh"; - - log.debug("AccessViewPageContainerRefreshButtonIcon: " + t.name); -} - -@lazy -rule AccessViewPageContainerRefreshActionDefinition - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::RefreshActionDefinition { - var relation = s.actorAccess.target; - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageContainerRefreshActionDefinition"); - t.name = s.name + "::Refresh"; - t.targetType = relation.referenceType.equivalent("ClassType"); - - log.debug("AccessViewPageContainerRefreshActionDefinition: " + t.name); -} - -@lazy -rule AccessViewRefreshAction - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); - t.name = s.name + "::Refresh"; - t.actionDefinition = s.equivalent("AccessViewPageContainerRefreshActionDefinition"); - - log.debug("AccessViewRefreshAction: " + t.name); -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index 9aa9275c..ad9c3c64 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -35,7 +35,7 @@ rule AccessTablePageDefinition t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageDefinition"); t.name = s.getFqName() + "::AccessTablePage"; - t.container = s.equivalent("AccessTablePageContainer"); + t.container = s.referenceType.equivalent("TablePageContainer"); t.dataElement = relation.equivalent("RelationType"); t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; @@ -73,275 +73,22 @@ rule AccessTableBackAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableBackAction"); t.name = s.name + "::Back"; - t.actionDefinition = s.equivalent("AccessTablePageContainerBackActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("AccessTablePageContainerBackActionDefinition"); log.debug("AccessTableBackAction: " + t.name); } -rule AccessTablePageContainer - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageContainer { - guard: rootMenu.containsVisualElement(s) - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageContainer"); - t.name = s.getFqName() + "::Table::PageContainer"; - t.label = s.getLabelWithNameFallback(); - t.titleFrom = UI!ui::TitleFrom#LABEL; - t.type = UI!ui::PageContainerType#TABLE; - t.children.add(s.equivalent("AccessTablePageContainerVisualElement")); - t.actionButtonGroup = s.equivalent("AccessTablePageContainerButtonGroup"); - t.dataElement = s.actorAccess.target.referenceType.equivalent("ClassType"); - t.onInit = s.equivalent("AccessTableTableRefreshActionDefinition"); - - rootMenu.equivalent("Application").pageContainers.add(t); - - /* - for (dataFeature in s.additionalMaskFeatures) { - var attributeType = dataFeature.getMember().mapAttributeType(s.eContainer.equivalent("ClassType")); - t.additionalMaskAttributes.add(attributeType); - } - */ - - log.debug("Create AccessTablePageDefinition: " + t.name); -} - -@lazy -rule AccessTablePageContainerButtonGroup - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageContainerButtonGroup"); - t.name = s.getFqName() + "::PageActions"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("AccessTablePageContainerBackButton")); - - log.debug("AccessTablePageContainerButtonGroup: " + t.name); -} - -@lazy -rule AccessTablePageContainerBackButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.iconName = "arrow-left"; - t.name = s.name + "BackIcon"; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageContainerBackButtonIcon"); -} - -@lazy -rule AccessTablePageContainerBackActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::BackActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageContainerBackActionDefinition"); - t.name = s.getFqName() + "::Back"; - log.debug("AccessTablePageContainerBackActionDefinition: " + t.name); -} - -@lazy -rule AccessTablePageContainerBackButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageContainerBackButton"); - t.name = s.getFqName() + "::Back"; - t.label = "Back"; - t.buttonStyle = "text"; - t.icon = s.equivalent("AccessTablePageContainerBackButtonIcon"); - t.actionDefinition = s.equivalent("AccessTablePageContainerBackActionDefinition"); - log.debug("AccessTablePageContainerBackButton: " + t.name); -} - -@lazy -rule AccessTablePageContainerVisualElement - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Flex { - t.~pos = 0; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageContainerVisualElement"); - t.name = s.name; - t.direction = UI!Axis#VERTICAL; - t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; - t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; - t.col = 12d; - t.children.add(s.equivalent("AccessTableTable")); - t.frame = s.equivalent("AccessTableFrame"); - - log.debug("AccessTablePageContainerVisualElement: " + t.name); -} - -@lazy -rule AccessTableFrame - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Frame { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableFrame"); -} - -@lazy -rule AccessTableTable - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Table { - var id = rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTable"; - t.setId(id); - t.col = 12d; - t.label = s.getLabelWithNameFallback(); - t.name = s.name + "::Table"; - t.dataElement = s.actorAccess.target.referenceType.equivalent("ClassType"); - t.relationName = ""; - if (t.~pos.isUndefined()) { - t.~pos = 0; - } - - var rowDeclaration = s.referenceType; - var primitiveFields = rowDeclaration.members.select(m | m.transferField.isDefined() and m.transferField.target.referenceType.`primitive`.isDefined()); - - for (field in primitiveFields) { - var col = field.equivalentDiscriminated("RowColumnDeclarationPrimitiveColumn", id); - t.columns.add(col); - if (col.attributeType.isFilterable) { - t.filters.add(field.equivalentDiscriminated("RowColumnDeclarationPrimitiveColumnFilter", id)); - } - } - - t.tableActionButtonGroup = s.equivalent("AccessTableTableButtonGroup"); - t.rowActionButtonGroup = s.equivalent("AccessTableRowButtonGroup"); - - // TODO transform selector row per page - t.selectorRowsPerPage = 10; - - log.debug("AccessTableTable: " + t.name); -} - @lazy -rule AccessTableTableButtonGroup - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableButtonGroup"); - t.name = s.name + "::InlineViewTableButtonGroup"; - t.label = "Actions"; - - // TODO add buttons - - var relation = s.actorAccess.target; - - if (relation.isFilterSupported()) { - t.buttons.add(s.equivalent("AccessTableTableFilterButton")); - } - if (relation.isRefreshAllowed()) { - t.buttons.add(s.equivalent("AccessTableTableRefreshButton")); - } - if (relation.isCreateAllowed()) { - t.buttons.add(s.equivalent("AccessTableTableOpenCreateButton")); - } - if (relation.isAddReferenceAllowed()) { - t.buttons.add(s.equivalent("AccessTableTableOpenAddSelectorButton")); - } - if (relation.isRemoveReferenceAllowed()) { - t.buttons.add(s.equivalent("AccessTableTableClearButton")); - t.buttons.add(s.equivalent("AccessTableTableBulkRemoveButton")); - } - - log.debug("AccessTableTableButtonGroup: " + t.name); -} - -@lazy -rule AccessTableRowButtonGroup - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowButtonGroup"); - t.name = s.name + "InlineViewTableRowButtonGroup"; - t.label = "Actions"; - - // TODO add buttons - - if (s.getUpdateViewModifier().isDefined()) { - t.buttons.add(s.equivalent("AccessTableRowOpenPageButton")); - } - if (s.actorAccess.target.isDeleteAllowed()) { - t.buttons.add(s.equivalent("AccessTableRowDeleteButton")); - } - - log.debug("AccessTableRowButtonGroup: " + t.name); -} - - -@lazy -rule AccessTableTableFilterButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterButton"); - t.name = s.name + "::Filter"; - t.icon = s.equivalent("AccessTableTableFilterButtonIcon"); - t.label = "Filter"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessTableTableFilterActionDefinition"); - - log.debug("AccessTableTableFilterButton: " + t.name); -} - -@lazy -rule AccessTableTableFilterButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterButtonIcon"); - t.name = s.name + "FilterIcon"; - t.iconName = "filter"; - - log.debug("AccessTableTableFilterButtonIcon: " + t.name); -} - -@lazy -rule AccessTableTableFilterActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::FilterActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterActionDefinition"); - t.name = s.name + "::Filter"; - t.targetType = s.referenceType.equivalent("ClassType"); - - log.debug("AccessTableTableFilterActionDefinition: " + t.name); -} - -@lazy -rule AccessTableTableFilterAction +rule AccessTableTableOpenCreateAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterAction"); - t.name = s.name + "::Filter"; - t.actionDefinition = s.equivalent("AccessTableTableFilterActionDefinition"); - - log.debug("AccessTableTableFilterAction: " + t.name); -} - -@lazy -rule AccessTableTableRefreshButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableRefreshButton"); - t.name = s.name + "::Refresh"; - t.icon = s.equivalent("AccessTableTableRefreshButtonIcon"); - t.label = "Refresh"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessTableTableRefreshActionDefinition"); - - log.debug("AccessTableTableRefreshButton: " + t.name); -} - -@lazy -rule AccessTableTableRefreshButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableRefreshButtonIcon"); - t.name = s.name + "RefreshIcon"; - t.iconName = "refresh"; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateAction"); + t.name = s.name + "::OpenCreate"; + t.actionDefinition = s.referenceType.equivalent("TableTableOpenCreateActionDefinition"); - log.debug("AccessTableTableRefreshButtonIcon: " + t.name); -} + t.targetPageDefinition = s.getCreateFormModifier().form.equivalent("AccessTableCreateFormPageDefinition"); -@lazy -rule AccessTableTableRefreshActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::RefreshActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableRefreshActionDefinition"); - t.name = s.name + "::Refresh"; - t.targetType = s.referenceType.equivalent("ClassType"); - - log.debug("AccessTableTableRefreshActionDefinition: " + t.name); + log.debug("AccessTableTableOpenCreateAction: " + t.name); } @lazy @@ -350,98 +97,20 @@ rule AccessTableTableRefreshAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableRefreshAction"); t.name = s.name + "::Refresh"; - t.actionDefinition = s.equivalent("AccessTableTableRefreshActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableTableRefreshActionDefinition"); log.debug("AccessTableTableRefreshAction: " + t.name); } @lazy -rule AccessTableTableOpenCreateButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateButton"); - t.name = s.name + "::OpenCreate"; - t.icon = s.equivalent("AccessTableTableOpenCreateButtonIcon"); - t.label = "Create"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessTableTableOpenCreateActionDefinition"); - - log.debug("AccessTableTableOpenCreateButton: " + t.name); -} - -@lazy -rule AccessTableTableOpenCreateButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateButtonIcon"); - t.name = s.name + "OpenCreateIcon"; - t.iconName = "file-document-plus"; - - log.debug("AccessTableTableFilterButtonIcon: " + t.name); -} - -@lazy -rule AccessTableTableOpenCreateActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::OpenCreateFormActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateActionDefinition"); - t.name = s.name + "::OpenCreate"; - t.targetType = s.getCreateFormModifier().form.map.transfer.equivalent("ClassType"); - - log.debug("AccessTableTableOpenCreateActionDefinition: " + t.name); -} - -@lazy -rule AccessTableTableOpenCreateAction +rule AccessTableTableFilterAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateAction"); - t.name = s.name + "::OpenCreate"; - t.actionDefinition = s.equivalent("AccessTableTableOpenCreateActionDefinition"); - - t.targetPageDefinition = s.equivalent("AccessTableCreateFormPageDefinition"); - - log.debug("AccessTableTableOpenCreateAction: " + t.name); -} - -@lazy -rule AccessTableRowOpenPageButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowOpenPageButton"); - t.name = s.name + "::View"; - t.icon = s.equivalent("AccessTableRowOpenPageButtonIcon"); - t.label = "View"; - t.buttonStyle = "contained"; - t.actionDefinition = s.equivalent("AccessTableRowOpenPageActionDefinition"); - - log.debug("AccessTableRowOpenPageButton: " + t.name); -} - -@lazy -rule AccessTableRowOpenPageButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowOpenPageButtonIcon"); - t.name = s.name + "RowOpenIcon"; - t.iconName = "visibility"; - - log.debug("AccessTableRowOpenPageButtonIcon: " + t.name); -} - -@lazy -rule AccessTableRowOpenPageActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::OpenPageActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowOpenPageActionDefinition"); - t.name = s.name + "::View"; - t.targetType = s.getUpdateViewModifier().view.map.transfer.equivalent("ClassType"); - - //var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - - //t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterAction"); + t.name = s.name + "::Filter"; + t.actionDefinition = s.referenceType.equivalent("TableTableFilterActionDefinition"); - log.debug("AccessTableRowOpenPageActionDefinition: " + t.name); + log.debug("AccessTableTableFilterAction: " + t.name); } @lazy @@ -451,148 +120,24 @@ rule AccessTableRowOpenPageAction t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowOpenPageAction"); t.name = s.name + "::OpenPage"; - t.actionDefinition = s.equivalent("AccessTableRowOpenPageActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableRowOpenPageActionDefinition"); t.targetPageDefinition = s.equivalent("AccessTableViewPageDefinition"); log.debug("AccessTableRowOpenPageAction: " + t.name); } -@lazy -rule AccessTableRowDeleteButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowDeleteButton"); - t.name = s.name + "::RowDelete"; - t.icon = s.equivalent("AccessTableRowDeleteButtonIcon"); - t.label = "Delete"; - t.buttonStyle = "contained"; - t.actionDefinition = s.equivalent("AccessTableRowDeleteActionDefinition"); - - log.debug("AccessTableRowDeleteButton: " + t.name); -} - -@lazy -rule AccessTableRowDeleteButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowDeleteButtonIcon"); - t.name = s.name + "RowDeleteIcon"; - t.iconName = "delete_forever"; - - log.debug("AccessTableRowDeleteButtonIcon: " + t.name); -} - -@lazy -rule AccessTableRowDeleteActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::RowDeleteActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowDeleteActionDefinition"); - t.name = s.name + "::RowDelete"; - t.targetType = s.referenceType.map.transfer.equivalent("ClassType"); - - log.debug("AccessTableRowDeleteActionDefinition: " + t.name); -} - @lazy rule AccessTableRowDeleteAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowDeleteAction"); t.name = s.name + "::RowDelete"; - t.actionDefinition = s.equivalent("AccessTableRowDeleteActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableRowDeleteActionDefinition"); log.debug("AccessTableRowDeleteAction: " + t.name); } -@lazy -rule AccessTableTableOpenAddSelectorButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenAddSelectorButton"); - t.name = s.name + "::OpenAddSelector"; - t.icon = s.equivalent("AccessTableTableOpenAddSelectorButtonIcon"); - t.label = "Add"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessTableTableOpenAddSelectorActionDefinition"); - - log.debug("AccessTableTableOpenAddSelectorButton: " + t.name); -} - -@lazy -rule AccessTableTableOpenAddSelectorButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenAddSelectorButtonIcon"); - t.name = s.name + "OpenAddSelectorIcon"; - t.iconName = "attachment-plus"; - - log.debug("AccessTableTableOpenAddSelectorButtonIcon: " + t.name); -} - -@lazy -rule AccessTableTableOpenAddSelectorActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::OpenAddSelectorActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenAddSelectorActionDefinition"); - t.name = s.name + "::OpenAddSelector"; - t.isContainedRelationAction = true; - t.selectorFor = s.equivalent("AccessTableTableAddSelectorActionDefinition"); - - log.debug("AccessTableTableOpenAddSelectorActionDefinition: " + t.name); -} - -@lazy -rule AccessTableTableOpenAddSelectorAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenAddSelectorAction"); - t.name = s.name + "::OpenAddSelector"; - t.actionDefinition = s.equivalent("AccessTableTableOpenAddSelectorActionDefinition"); - - t.targetPageDefinition = s.equivalent("AccessTableTableAddSelectorPageDefinition"); - - log.debug("AccessTableTableOpenAddSelectorAction: " + t.name); -} - -@lazy -rule AccessTableTableBulkRemoveButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableBulkRemoveButton"); - t.name = s.name + "::BulkRemove"; - t.icon = s.equivalent("AccessTableTableBulkRemoveButtonIcon"); - t.label = "Remove"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessTableTableBulkRemoveActionDefinition"); - - log.debug("AccessTableTableBulkRemoveButton: " + t.name); -} - -@lazy -rule AccessTableTableBulkRemoveButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableBulkRemoveButtonIcon"); - t.name = s.name + "RemoveIcon"; - t.iconName = "link-off"; - - log.debug("AccessTableTableBulkRemoveButtonIcon: " + t.name); -} - -@lazy -rule AccessTableTableBulkRemoveActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::BulkRemoveActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableBulkRemoveActionDefinition"); - t.name = s.name + "::BulkRemove"; - t.targetType = s.referenceType.map.transfer.equivalent("ClassType"); - t.isContainedRelationAction = true; - t.isBulk = true; - - log.debug("AccessTableTableBulkRemoveActionDefinition: " + t.name); -} - @lazy rule AccessTableTableBulkRemoveAction transform s: JSL!UIMenuTableDeclaration @@ -607,42 +152,6 @@ rule AccessTableTableBulkRemoveAction log.debug("AccessTableTableBulkRemoveAction: " + t.name); } -@lazy -rule AccessTableTableClearButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableClearButton"); - t.name = s.name + "::Clear"; - t.icon = s.equivalent("AccessTableTableClearButtonIcon"); - t.label = "Clear"; - t.buttonStyle = "text"; - t.actionDefinition = s.equivalent("AccessTableTableClearActionDefinition"); - - log.debug("AccessTableTableClearButton: " + t.name); -} - -@lazy -rule AccessTableTableClearButtonIcon - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableClearButtonIcon"); - t.name = s.name + "ClearIcon"; - t.iconName = "link-off"; - - log.debug("AccessTableTableClearButtonIcon: " + t.name); -} - -@lazy -rule AccessTableTableClearActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::ClearActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableClearActionDefinition"); - t.name = s.name + "::Clear"; - t.isContainedRelationAction = true; - - log.debug("AccessTableTableClearActionDefinition: " + t.name); -} - @lazy rule AccessTableTableClearAction transform s: JSL!UIMenuTableDeclaration @@ -666,7 +175,7 @@ rule AccessTableTableAddSelectorPageDefinition t.name = s.getFqName() + "::AddSelectorPage"; - t.container = s.equivalent("AccessTableTableAddSelectorPageContainer"); + t.container = s.referenceType.equivalent("TableAddSelectorPageContainer"); t.dataElement = s.actorAccess.target.equivalent("RelationType"); t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; t.openInDialog = true; @@ -689,7 +198,7 @@ rule AccessTableTableAddSelectorAddAction t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorAddAction"); t.name = s.getFqName() + "::AddSelector::Add"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableAddSelectorAddActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorAddActionDefinition"); log.debug("AccessTableTableAddSelectorAddAction: " + t.name); } @@ -701,7 +210,7 @@ rule AccessTableTableAddSelectorBackAction t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorBackAction"); t.name = s.getFqName() + "::AddSelector::Back"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableBackActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableBackActionDefinition"); log.debug("AccessTableTableAddSelectorBackAction: " + t.name); } @@ -714,7 +223,7 @@ rule AccessTableTableAddSelectorTableFilterAction t.name = s.getFqName() + "::AddSelector::Table::Filter"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableTableFilterActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableTableFilterActionDefinition"); log.debug("AccessTableTableAddSelectorTableFilterAction: " + t.name); } @@ -727,239 +236,121 @@ rule AccessTableTableAddSelectorTableRangeAction t.name = s.getFqName() + "::AddSelector::Table::Range"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableRangeActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableRangeActionDefinition"); log.debug("AccessTableTableAddSelectorTableRangeAction: " + t.name); } -@lazy -rule AccessTableTableAddSelectorPageContainer +rule AccessTableViewPageDefinition transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageContainer { - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorPageContainer"); - - t.name = s.getFqName() + "::AddSelector::PageContainer"; - t.label = s.getLabelWithNameFallback(); - t.titleFrom = UI!ui::TitleFrom#LABEL; - t.type = UI!ui::PageContainerType#TABLE; - t.onInit = s.equivalent("AccessTableTableAddSelectorTableRangeActionDefinition"); - - t.children.add(s.equivalent("AccessTableTableAddSelectorTableAddSelectorVisualElement")); - t.actionButtonGroup = s.equivalent("AccessTableTableAddSelectorTableAddSelectorButtonGroup"); - t.dataElement = s.actorAccess.target.referenceType.equivalent("ClassType"); - t.isSelector = true; - t.isRelationSelector = true; - - rootMenu.equivalent("Application").pageContainers.add(t); - - log.debug("AccessTableTableAddSelectorPageContainer: " + t.name); -} + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() -@lazy -rule AccessTableTableAddSelectorTableRangeActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::SelectorRangeActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableRangeActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewPageDefinition"); - t.name = s.getFqName() + "::AddSelector::Table::Range"; - t.targetType = s.referenceType.map.transfer.equivalent("ClassType"); + t.name = s.getFqName() + "::AccessTableViewPage"; + t.container = s.getUpdateViewModifier().view.equivalent("ViewPageContainer"); - log.debug("AccessTableTableAddSelectorTableRangeActionDefinition: " + t.name); -} + rootMenu.equivalent("Application").pages.add(t); -@lazy -rule AccessTableTableAddSelectorTableAddSelectorButtonGroup - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableAddSelectorButtonGroup"); - t.name = s.getFqName() + "::AddSelectorTableAddSelectorButtonGroup"; - t.label = "Actions"; + t.dataElement = s.actorAccess.target.equivalent("RelationType"); + t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - t.buttons.add(s.equivalent("AccessTableTableAddSelectorTableAddSelectorBackButton")); - t.buttons.add(s.equivalent("AccessTableTableAddSelectorTableAddSelectorAddButton")); + // var relations = s.referenceType.getDirectRelations(); - log.debug("AccessTableTableAddSelectorTableAddSelectorButtonGroup: " + t.name); -} + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + /* + for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { + t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); + } -@lazy -rule AccessTableTableAddSelectorTableAddSelectorBackButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableAddSelectorBackButton"); - t.name = s.getFqName() + "::Back"; - t.label = "Back"; - t.buttonStyle = "text"; - t.icon = "arrow-left".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableBackActionDefinition"); - - log.debug("AccessTableTableAddSelectorTableAddSelectorBackButton: " + t.name); -} + for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { + var detailLink = table.getDetailLink(); -@lazy -rule AccessTableTableAddSelectorTableBackActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::BackActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableBackActionDefinition"); - t.name = s.getFqName() + "::Back"; - log.debug("AccessTableTableAddSelectorTableBackActionDefinition: " + t.name); -} + if (detailLink.isDefined()) { + t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); + } + } + */ -@lazy -rule AccessTableTableAddSelectorTableAddSelectorAddButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableAddSelectorAddButton"); - t.name = s.getFqName() + "::Add"; - t.label = "Add"; - t.buttonStyle = "contained"; - t.icon = "attachment-plus".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableAddSelectorAddActionDefinition"); - - log.debug("AccessTableTableAddSelectorTableAddSelectorAddButton: " + t.name); -} + t.actions.add(s.equivalent("AccessTableViewBackAction")); + if (s.actorAccess.target.isRefreshAllowed()) { + t.actions.add(s.equivalent("AccessTableViewRefreshAction")); + } + if (s.actorAccess.target.isUpdateAllowed()) { + t.actions.add(s.equivalent("AccessTableViewCancelAction")); + t.actions.add(s.equivalent("AccessTableViewUpdateAction")); + } + if (s.actorAccess.target.isDeleteAllowed()) { + t.actions.add(s.equivalent("AccessTableViewDeleteAction")); + } -@lazy -rule AccessTableTableAddSelectorTableAddSelectorAddActionDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::AddActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableAddSelectorAddActionDefinition"); - t.name = s.getFqName() + "::Add"; - t.targetType = s.referenceType.map.transfer.equivalent("ClassType"); - log.debug("AccessTableTableAddSelectorTableAddSelectorAddActionDefinition: " + t.name); + log.debug("Create AccessTableViewPageDefinition: " + t.name); } @lazy -rule AccessTableTableAddSelectorTableAddSelectorVisualElement +rule AccessTableViewBackAction transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Flex { - t.~pos = 0; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableAddSelectorVisualElement"); - t.name = s.name; - t.direction = UI!Axis#VERTICAL; - t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; - t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; - t.col = 12d; - t.children.add(s.equivalent("AccessTableTableAddSelectorTableTable")); - t.frame = s.equivalent("AccessTableTableAddSelectorTableAddSelectorFrame"); - - log.debug("AccessTableTableAddSelectorTableAddSelectorVisualElement: " + t.name); -} + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewBackAction"); + t.name = s.getFqName() + "::Back"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerBackActionDefinition"); -@lazy -rule AccessTableTableAddSelectorTableAddSelectorFrame - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Frame { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableAddSelectorFrame"); + log.debug("AccessTableViewBackAction: " + t.name); } @lazy -rule AccessTableTableAddSelectorTableTable +rule AccessTableViewRefreshAction transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Table { - var id = rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableTable"; - t.setId(id); - t.col = 12d; - t.label = s.getLabelWithNameFallback(); - t.isSelectorTable = true; - t.isRelationSelectorTable = true; - t.allowSelectMultiple = true; - t.name = s.name + "::Add::Selector"; - t.relationName = ""; - t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); - t.tableActionButtonGroup = s.equivalent("AccessTableTableAddSelectorTableTableButtonGroup"); - t.~pos = s.~pos; - t.showTotalCount = false; - t.selectorRowsPerPage = 10; - - if (s.getRows().isDefined()) { - t.rowsPerPage = s.getRows().value.asInteger(); - } else { - t.rowsPerPage = 10; - } - if (t.~pos.isUndefined()) { - t.~pos = 0; - } - - // TODO eventually selector should work? - var rowDeclaration = s.referenceType; - - var primitiveFields = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowFieldDeclaration) and m.referenceType.`primitive`.isDefined()); - // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - - for (field in primitiveFields) { - var col = field.equivalentDiscriminated("TablePrimitiveColumn", id); - t.columns.add(col); - if (col.attributeType.isFilterable) { - t.filters.add(field.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); - } - } -/* - for (link in links) { - if (link.getDetail().isUndefined()) { - var col = link.equivalentDiscriminated("RowLinkDerivedColumn", id); - t.columns.add(col); - if (col.attributeType.isFilterable) { - t.filters.add(link.equivalentDiscriminated("RowLinkDerivedColumnFilter", id)); - } - } else { - // TODO generate open action from link with detail modifier - } + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewRefreshAction"); + t.name = s.getFqName() + "::Refresh"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerRefreshActionDefinition"); - } -*/ - log.debug("AccessTableTableAddSelectorTableTable: " + t.name); + log.debug("AccessTableViewRefreshAction: " + t.name); } @lazy -rule AccessTableTableAddSelectorTableTableButtonGroup +rule AccessTableViewCancelAction transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableTableButtonGroup"); - t.name = s.getFqName() + "::AddSelectorTableActions"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("AccessTableTableAddSelectorTableTableFilterButton")); - t.buttons.add(s.equivalent("TransferObjectTableAddSelectorTableRefreshButton")); + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewCancelAction"); + t.name = s.getFqName() + "::Cancel"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerCancelActionDefinition"); - log.debug("AccessTableTableAddSelectorTableTableButtonGroup: " + t.name); + log.debug("AccessTableViewCancelAction: " + t.name); } @lazy -rule AccessTableTableAddSelectorTableTableFilterButton +rule AccessTableViewUpdateAction transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableTableFilterButton"); - t.name = s.getFqName() + "::AddSelector::Table::Filter"; - t.label = "Set Filters"; - t.buttonStyle = "text"; - t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableTableFilterActionDefinition"); + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewUpdateAction"); + t.name = s.getFqName() + "::Update"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerUpdateActionDefinition"); - log.debug("AccessTableTableAddSelectorTableTableFilterButton: " + t.name); + log.debug("AccessTableViewUpdateAction: " + t.name); } @lazy -rule AccessTableTableAddSelectorTableTableFilterActionDefinition +rule AccessTableViewDeleteAction transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::FilterActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableTableFilterActionDefinition"); - t.name = s.getFqName() + "::Table::Filter"; - log.debug("AccessTableTableAddSelectorTableTableFilterActionDefinition: " + t.name); -} + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewDeleteAction"); + t.name = s.getFqName() + "::Delete"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerDeleteActionDefinition"); -@lazy -rule TransferObjectTableAddSelectorTableRefreshButton - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TransferObjectTableAddSelectorTableRefreshButton"); - t.name = s.getFqName() + "::AddSelector::Table::Refresh"; - t.label = "Refresh"; - t.buttonStyle = "text"; - t.icon = "refresh".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("AccessTableTableAddSelectorTableRangeActionDefinition"); - - log.debug("TransferObjectTableAddSelectorTableRefreshButton: " + t.name); + log.debug("AccessTableViewDeleteAction: " + t.name); } rule AccessTableCreateFormPageDefinition @@ -1018,115 +409,3 @@ rule AccessTableCreateFormCreateAction log.debug("AccessTableCreateFormCreateAction: " + t.name); } - -rule AccessTableViewPageDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewPageDefinition"); - - t.name = s.getFqName() + "::AccessViewPage"; - t.container = s.getUpdateViewModifier().view.equivalent("ViewPageContainer"); - - rootMenu.equivalent("Application").pages.add(t); - - t.dataElement = s.actorAccess.target.equivalent("RelationType"); - t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - - // var relations = s.referenceType.getDirectRelations(); - - /* - log.info("==================="); - log.info(t.name + ":"); - log.info(relations.collect(r | r.name).concat(", ")); - log.info("==================="); - */ - /* - for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { - t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); - } - - for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { - var detailLink = table.getDetailLink(); - - if (detailLink.isDefined()) { - t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); - } - } - */ - - t.actions.add(s.equivalent("AccessViewBackAction")); - if (s.actorAccess.target.isRefreshAllowed()) { - t.actions.add(s.equivalent("AccessViewRefreshAction")); - } - if (s.actorAccess.target.isUpdateAllowed()) { - t.actions.add(s.equivalent("AccessViewCancelAction")); - t.actions.add(s.equivalent("AccessViewUpdateAction")); - } - if (s.actorAccess.target.isDeleteAllowed()) { - t.actions.add(s.equivalent("AccessViewDeleteAction")); - } - - log.debug("Create AccessTableViewPageDefinition: " + t.name); -} - -@lazy -rule AccessViewBackAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewBackAction"); - t.name = s.getFqName() + "::Back"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerBackActionDefinition"); - - log.debug("AccessViewBackAction: " + t.name); -} - -@lazy -rule AccessViewRefreshAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); - t.name = s.getFqName() + "::Refresh"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerRefreshActionDefinition"); - - log.debug("AccessViewRefreshAction: " + t.name); -} - -@lazy -rule AccessViewCancelAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewCancelAction"); - t.name = s.getFqName() + "::Cancel"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerCancelActionDefinition"); - - log.debug("AccessViewCancelAction: " + t.name); -} - -@lazy -rule AccessViewUpdateAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewUpdateAction"); - t.name = s.getFqName() + "::Update"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerUpdateActionDefinition"); - - log.debug("AccessViewUpdateAction: " + t.name); -} - -@lazy -rule AccessViewDeleteAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewDeleteAction"); - t.name = s.getFqName() + "::Delete"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerDeleteActionDefinition"); - - log.debug("AccessViewDeleteAction: " + t.name); -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl new file mode 100644 index 00000000..16dd7366 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl @@ -0,0 +1,462 @@ +rule TablePageContainer + transform s: JSL!UIRowDeclaration + to t: UI!ui::PageContainer { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePageContainer"); + t.name = s.getFqName() + "::Table::PageContainer"; + t.label = s.getLabelWithNameFallback(); + t.titleFrom = UI!ui::TitleFrom#LABEL; + t.type = UI!ui::PageContainerType#TABLE; + t.children.add(s.equivalent("TablePageContainerVisualElement")); + t.actionButtonGroup = s.equivalent("TablePageContainerButtonGroup"); + t.dataElement = s.map.transfer.equivalent("ClassType"); + t.onInit = s.equivalent("TableTableRefreshActionDefinition"); + + rootMenu.equivalent("Application").pageContainers.add(t); + + /* + for (dataFeature in s.additionalMaskFeatures) { + var attributeType = dataFeature.getMember().mapAttributeType(s.eContainer.equivalent("ClassType")); + t.additionalMaskAttributes.add(attributeType); + } + */ + + log.debug("Create TablePageContainer: " + t.name); +} + + +@lazy +rule TablePageContainerButtonGroup + transform s: JSL!UIRowDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePageContainerButtonGroup"); + t.name = s.getFqName() + "::PageActions"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("TablePageContainerBackButton")); + + log.debug("TablePageContainerButtonGroup: " + t.name); +} + +@lazy +rule TablePageContainerBackButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.iconName = "arrow-left"; + t.name = s.name + "BackIcon"; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePageContainerBackButtonIcon"); +} + +@lazy +rule TablePageContainerBackActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePageContainerBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("TablePageContainerBackActionDefinition: " + t.name); +} + +@lazy +rule TablePageContainerBackButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePageContainerBackButton"); + t.name = s.getFqName() + "::Back"; + t.label = "Back"; + t.buttonStyle = "text"; + t.icon = s.equivalent("TablePageContainerBackButtonIcon"); + t.actionDefinition = s.equivalent("TablePageContainerBackActionDefinition"); + log.debug("TablePageContainerBackButton: " + t.name); +} + +@lazy +rule TablePageContainerVisualElement + transform s: JSL!UIRowDeclaration + to t: UI!ui::Flex { + t.~pos = 0; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePageContainerVisualElement"); + t.name = s.name; + t.direction = UI!Axis#VERTICAL; + t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; + t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; + t.col = 12d; + t.children.add(s.equivalent("TableTable")); + t.frame = s.equivalent("TableFrame"); + + log.debug("TablePageContainerVisualElement: " + t.name); +} + +@lazy +rule TableFrame + transform s: JSL!UIRowDeclaration + to t: UI!ui::Frame { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableFrame"); +} + +@lazy +rule TableTable + transform s: JSL!UIRowDeclaration + to t: UI!ui::Table { + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/TableTable"; + t.setId(id); + t.col = 12d; + t.label = s.getLabelWithNameFallback(); + t.name = s.name + "::Table"; + t.dataElement = s.map.transfer.equivalent("ClassType"); + t.relationName = ""; + if (t.~pos.isUndefined()) { + t.~pos = 0; + } + + var primitiveFields = s.members.select(m | m.transferField.isDefined() and m.transferField.target.referenceType.`primitive`.isDefined()); + + for (field in primitiveFields) { + var col = field.equivalentDiscriminated("RowColumnDeclarationPrimitiveColumn", id); + t.columns.add(col); + if (col.attributeType.isFilterable) { + t.filters.add(field.equivalentDiscriminated("RowColumnDeclarationPrimitiveColumnFilter", id)); + } + } + + t.tableActionButtonGroup = s.equivalent("TableTableButtonGroup"); + t.rowActionButtonGroup = s.equivalent("TableRowButtonGroup"); + + // TODO transform selector row per page + t.selectorRowsPerPage = 10; + + log.debug("TableTable: " + t.name); +} + +@lazy +rule TableTableButtonGroup + transform s: JSL!UIRowDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableButtonGroup"); + t.name = s.name + "::TableTableButtonGroup"; + t.label = "Actions"; + + // TODO add buttons + + t.buttons.add(s.equivalent("TableTableFilterButton")); + t.buttons.add(s.equivalent("TableTableRefreshButton")); + t.buttons.add(s.equivalent("TableTableOpenCreateButton")); + t.buttons.add(s.equivalent("TableTableOpenAddSelectorButton")); + t.buttons.add(s.equivalent("TableTableClearButton")); + t.buttons.add(s.equivalent("TableTableBulkRemoveButton")); + + log.debug("TableTableButtonGroup: " + t.name); +} + +@lazy +rule TableRowButtonGroup + transform s: JSL!UIRowDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowButtonGroup"); + t.name = s.name + "TableRowButtonGroup"; + t.label = "Actions"; + + // TODO add buttons + + t.buttons.add(s.equivalent("TableRowOpenPageButton")); + t.buttons.add(s.equivalent("TableRowDeleteButton")); + + log.debug("TableRowButtonGroup: " + t.name); +} + + +@lazy +rule TableTableFilterButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableFilterButton"); + t.name = s.name + "::Filter"; + t.icon = s.equivalent("TableTableFilterButtonIcon"); + t.label = "Filter"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("TableTableFilterActionDefinition"); + + log.debug("TableTableFilterButton: " + t.name); +} + +@lazy +rule TableTableFilterButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableFilterButtonIcon"); + t.name = s.name + "FilterIcon"; + t.iconName = "filter"; + + log.debug("TableTableFilterButtonIcon: " + t.name); +} + +@lazy +rule TableTableFilterActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::FilterActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableFilterActionDefinition"); + t.name = s.name + "::Filter"; + t.targetType = s.map.transfer.equivalent("ClassType"); + + log.debug("TableTableFilterActionDefinition: " + t.name); +} + +@lazy +rule TableTableRefreshButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableRefreshButton"); + t.name = s.name + "::Refresh"; + t.icon = s.equivalent("TableTableRefreshButtonIcon"); + t.label = "Refresh"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("TableTableRefreshActionDefinition"); + + log.debug("TableTableRefreshButton: " + t.name); +} + +@lazy +rule TableTableRefreshButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableRefreshButtonIcon"); + t.name = s.name + "RefreshIcon"; + t.iconName = "refresh"; + + log.debug("TableTableRefreshButtonIcon: " + t.name); +} + +@lazy +rule TableTableRefreshActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::RefreshActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableRefreshActionDefinition"); + t.name = s.name + "::Refresh"; + t.targetType = s.map.transfer.equivalent("ClassType"); + + log.debug("TableTableRefreshActionDefinition: " + t.name); +} + +@lazy +rule TableTableOpenCreateButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableOpenCreateButton"); + t.name = s.name + "::OpenCreate"; + t.icon = s.equivalent("TableTableOpenCreateButtonIcon"); + t.label = "Create"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("TableTableOpenCreateActionDefinition"); + + log.debug("TableTableOpenCreateButton: " + t.name); +} + +@lazy +rule TableTableOpenCreateButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableOpenCreateButtonIcon"); + t.name = s.name + "OpenCreateIcon"; + t.iconName = "file-document-plus"; + + log.debug("TableTableFilterButtonIcon: " + t.name); +} + +@lazy +rule TableTableOpenCreateActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::OpenCreateFormActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableOpenCreateActionDefinition"); + t.name = s.name + "::OpenCreate"; + t.targetType = s.map.transfer.equivalent("ClassType"); + + log.debug("TableTableOpenCreateActionDefinition: " + t.name); +} + +@lazy +rule TableRowOpenPageButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowOpenPageButton"); + t.name = s.name + "::View"; + t.icon = s.equivalent("TableRowOpenPageButtonIcon"); + t.label = "View"; + t.buttonStyle = "contained"; + t.actionDefinition = s.equivalent("TableRowOpenPageActionDefinition"); + + log.debug("TableRowOpenPageButton: " + t.name); +} + +@lazy +rule TableRowOpenPageButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowOpenPageButtonIcon"); + t.name = s.name + "RowOpenIcon"; + t.iconName = "visibility"; + + log.debug("TableRowOpenPageButtonIcon: " + t.name); +} + +@lazy +rule TableRowOpenPageActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::OpenPageActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowOpenPageActionDefinition"); + t.name = s.name + "::View"; + t.targetType = s.map.transfer.equivalent("ClassType"); + + //var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + + //t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); + + log.debug("TableRowOpenPageActionDefinition: " + t.name); +} + +@lazy +rule TableRowDeleteButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowDeleteButton"); + t.name = s.name + "::RowDelete"; + t.icon = s.equivalent("TableRowDeleteButtonIcon"); + t.label = "Delete"; + t.buttonStyle = "contained"; + t.actionDefinition = s.equivalent("TableRowDeleteActionDefinition"); + + log.debug("TableRowDeleteButton: " + t.name); +} + +@lazy +rule TableRowDeleteButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowDeleteButtonIcon"); + t.name = s.name + "RowDeleteIcon"; + t.iconName = "delete_forever"; + + log.debug("TableRowDeleteButtonIcon: " + t.name); +} + +@lazy +rule TableRowDeleteActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::RowDeleteActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowDeleteActionDefinition"); + t.name = s.name + "::RowDelete"; + t.targetType = s.map.transfer.equivalent("ClassType"); + + log.debug("TableRowDeleteActionDefinition: " + t.name); +} + +@lazy +rule TableTableOpenAddSelectorButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableOpenAddSelectorButton"); + t.name = s.name + "::OpenAddSelector"; + t.icon = s.equivalent("TableTableOpenAddSelectorButtonIcon"); + t.label = "Add"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("TableTableOpenAddSelectorActionDefinition"); + + log.debug("TableTableOpenAddSelectorButton: " + t.name); +} + +@lazy +rule TableTableOpenAddSelectorButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableOpenAddSelectorButtonIcon"); + t.name = s.name + "OpenAddSelectorIcon"; + t.iconName = "attachment-plus"; + + log.debug("TableTableOpenAddSelectorButtonIcon: " + t.name); +} + +@lazy +rule TableTableOpenAddSelectorActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::OpenAddSelectorActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableOpenAddSelectorActionDefinition"); + t.name = s.name + "::OpenAddSelector"; + t.isContainedRelationAction = true; + t.selectorFor = s.equivalent("TableTableAddSelectorActionDefinition"); + + log.debug("TableTableOpenAddSelectorActionDefinition: " + t.name); +} + +@lazy +rule TableTableBulkRemoveButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableBulkRemoveButton"); + t.name = s.name + "::BulkRemove"; + t.icon = s.equivalent("TableTableBulkRemoveButtonIcon"); + t.label = "Remove"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("TableTableBulkRemoveActionDefinition"); + + log.debug("TableTableBulkRemoveButton: " + t.name); +} + +@lazy +rule TableTableBulkRemoveButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableBulkRemoveButtonIcon"); + t.name = s.name + "RemoveIcon"; + t.iconName = "link-off"; + + log.debug("TableTableBulkRemoveButtonIcon: " + t.name); +} + +@lazy +rule TableTableBulkRemoveActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::BulkRemoveActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableBulkRemoveActionDefinition"); + t.name = s.name + "::BulkRemove"; + t.targetType = s.map.transfer.equivalent("ClassType"); + t.isContainedRelationAction = true; + t.isBulk = true; + + log.debug("TableTableBulkRemoveActionDefinition: " + t.name); +} + +@lazy +rule TableTableClearButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableClearButton"); + t.name = s.name + "::Clear"; + t.icon = s.equivalent("TableTableClearButtonIcon"); + t.label = "Clear"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("TableTableClearActionDefinition"); + + log.debug("TableTableClearButton: " + t.name); +} + +@lazy +rule TableTableClearButtonIcon + transform s: JSL!UIRowDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableClearButtonIcon"); + t.name = s.name + "ClearIcon"; + t.iconName = "link-off"; + + log.debug("TableTableClearButtonIcon: " + t.name); +} + +@lazy +rule TableTableClearActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::ClearActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableTableClearActionDefinition"); + t.name = s.name + "::Clear"; + t.isContainedRelationAction = true; + + log.debug("TableTableClearActionDefinition: " + t.name); +} + diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl new file mode 100644 index 00000000..43cd17c0 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl @@ -0,0 +1,229 @@ +@lazy +rule TableAddSelectorPageContainer + transform s: JSL!UIRowDeclaration + to t: UI!ui::PageContainer { + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorPageContainer"); + + t.name = s.getFqName() + "::AddSelector::PageContainer"; + t.label = s.getLabelWithNameFallback(); + t.titleFrom = UI!ui::TitleFrom#LABEL; + t.type = UI!ui::PageContainerType#TABLE; + t.onInit = s.equivalent("TableAddSelectorTableRangeActionDefinition"); + + t.children.add(s.equivalent("TableAddSelectorVisualElement")); + t.actionButtonGroup = s.equivalent("TableAddSelectorButtonGroup"); + t.dataElement = s.actorAccess.target.referenceType.equivalent("ClassType"); + t.isSelector = true; + t.isRelationSelector = true; + + rootMenu.equivalent("Application").pageContainers.add(t); + + log.debug("TableAddSelectorPageContainer: " + t.name); +} + +@lazy +rule TableAddSelectorTableRangeActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::SelectorRangeActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorTableRangeActionDefinition"); + + t.name = s.getFqName() + "::AddSelector::Table::Range"; + t.targetType = s.referenceType.map.transfer.equivalent("ClassType"); + + log.debug("TableAddSelectorTableRangeActionDefinition: " + t.name); +} + +@lazy +rule TableAddSelectorButtonGroup + transform s: JSL!UIRowDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorButtonGroup"); + t.name = s.getFqName() + "::AddSelectorTableAddSelectorButtonGroup"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("TableAddSelectorBackButton")); + t.buttons.add(s.equivalent("TableAddSelectorAddButton")); + + log.debug("TableAddSelectorButtonGroup: " + t.name); +} + +@lazy +rule TableAddSelectorBackButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorBackButton"); + t.name = s.getFqName() + "::Back"; + t.label = "Back"; + t.buttonStyle = "text"; + t.icon = "arrow-left".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("TableAddSelectorTableBackActionDefinition"); + + log.debug("TableAddSelectorBackButton: " + t.name); +} + +@lazy +rule TableAddSelectorTableBackActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorTableBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("TableAddSelectorTableBackActionDefinition: " + t.name); +} + +@lazy +rule TableAddSelectorAddButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorAddButton"); + t.name = s.getFqName() + "::Add"; + t.label = "Add"; + t.buttonStyle = "contained"; + t.icon = "attachment-plus".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("TableAddSelectorAddActionDefinition"); + + log.debug("TableAddSelectorAddButton: " + t.name); +} + +@lazy +rule TableAddSelectorAddActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::AddActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorAddActionDefinition"); + t.name = s.getFqName() + "::Add"; + t.targetType = s.referenceType.map.transfer.equivalent("ClassType"); + log.debug("TableAddSelectorAddActionDefinition: " + t.name); +} + +@lazy +rule TableAddSelectorVisualElement + transform s: JSL!UIRowDeclaration + to t: UI!ui::Flex { + t.~pos = 0; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorVisualElement"); + t.name = s.name; + t.direction = UI!Axis#VERTICAL; + t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; + t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; + t.col = 12d; + t.children.add(s.equivalent("TableAddSelectorTableTable")); + t.frame = s.equivalent("TableAddSelectorFrame"); + + log.debug("TableAddSelectorVisualElement: " + t.name); +} + +@lazy +rule TableAddSelectorFrame + transform s: JSL!UIRowDeclaration + to t: UI!ui::Frame { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorFrame"); +} + +@lazy +rule TableAddSelectorTableTable + transform s: JSL!UIRowDeclaration + to t: UI!ui::Table { + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorTableTable"; + t.setId(id); + t.col = 12d; + t.label = s.getLabelWithNameFallback(); + t.isSelectorTable = true; + t.isRelationSelectorTable = true; + t.allowSelectMultiple = true; + t.name = s.name + "::Add::Selector"; + t.relationName = ""; + t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); + t.tableActionButtonGroup = s.equivalent("TableAddSelectorTableTableButtonGroup"); + t.~pos = s.~pos; + t.showTotalCount = false; + t.selectorRowsPerPage = 10; + + if (s.getRows().isDefined()) { + t.rowsPerPage = s.getRows().value.asInteger(); + } else { + t.rowsPerPage = 10; + } + if (t.~pos.isUndefined()) { + t.~pos = 0; + } + + // TODO eventually selector should work? + var rowDeclaration = s.referenceType; + + var primitiveFields = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowFieldDeclaration) and m.referenceType.`primitive`.isDefined()); + // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + + for (field in primitiveFields) { + var col = field.equivalentDiscriminated("TablePrimitiveColumn", id); + t.columns.add(col); + if (col.attributeType.isFilterable) { + t.filters.add(field.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + } + } +/* + for (link in links) { + if (link.getDetail().isUndefined()) { + var col = link.equivalentDiscriminated("RowLinkDerivedColumn", id); + t.columns.add(col); + if (col.attributeType.isFilterable) { + t.filters.add(link.equivalentDiscriminated("RowLinkDerivedColumnFilter", id)); + } + } else { + // TODO generate open action from link with detail modifier + } + + } +*/ + log.debug("TableAddSelectorTableTable: " + t.name); +} + +@lazy +rule TableAddSelectorTableTableButtonGroup + transform s: JSL!UIRowDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorTableTableButtonGroup"); + t.name = s.getFqName() + "::AddSelectorTableActions"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("TableAddSelectorTableTableFilterButton")); + t.buttons.add(s.equivalent("TransferObjectTableAddSelectorTableRefreshButton")); + + log.debug("TableAddSelectorTableTableButtonGroup: " + t.name); +} + +@lazy +rule TableAddSelectorTableTableFilterButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorTableTableFilterButton"); + t.name = s.getFqName() + "::AddSelector::Table::Filter"; + t.label = "Set Filters"; + t.buttonStyle = "text"; + t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("TableAddSelectorTableTableFilterActionDefinition"); + + log.debug("TableAddSelectorTableTableFilterButton: " + t.name); +} + +@lazy +rule TableAddSelectorTableTableFilterActionDefinition + transform s: JSL!UIRowDeclaration + to t: UI!ui::FilterActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableAddSelectorTableTableFilterActionDefinition"); + t.name = s.getFqName() + "::Table::Filter"; + log.debug("TableAddSelectorTableTableFilterActionDefinition: " + t.name); +} + +@lazy +rule TransferObjectTableAddSelectorTableRefreshButton + transform s: JSL!UIRowDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TransferObjectTableAddSelectorTableRefreshButton"); + t.name = s.getFqName() + "::AddSelector::Table::Refresh"; + t.label = "Refresh"; + t.buttonStyle = "text"; + t.icon = "refresh".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("TableAddSelectorTableRangeActionDefinition"); + + log.debug("TransferObjectTableAddSelectorTableRefreshButton: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl index 9ebbe5c9..f081c733 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl @@ -1,7 +1,6 @@ -/* @abstract rule AbstractViewGroupDeclaration - transform s: JSL!ViewGroupDeclaration + transform s: JSL!UIViewGroupDeclaration to t: UI!ui::Flex { t.name = s.name; t.label = s.getLabelWithNameFallback(); @@ -64,14 +63,14 @@ rule AbstractViewGroupDeclaration } rule GroupVisualElement - transform s: JSL!ViewGroupDeclaration + transform s: JSL!UIViewGroupDeclaration to t: UI!ui::Flex extends AbstractViewGroupDeclaration { - guard: s.getTransferObjectType().isGenerated() + guard: rootMenu.containsVisualElement(s) - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/GroupVisualElement"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/GroupVisualElement"); - if (not s.eContainer.isKindOf(JSL!ViewTabsDeclaration)) { + if (not s.eContainer.isKindOf(JSL!UIViewTabsDeclaration)) { var holder = t; if (s.isFrame()) { holder.frame = s.equivalent("GroupFrame"); @@ -86,18 +85,31 @@ rule GroupVisualElement @lazy @greedy rule GroupFrame - transform s: JSL!ViewGroupDeclaration + transform s: JSL!UIViewGroupDeclaration to t: UI!ui::Frame { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/GroupFrame"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/GroupFrame"); } @lazy @greedy rule GroupIcon - transform s: JSL!ViewGroupDeclaration + transform s: JSL!UIViewGroupDeclaration to t: UI!ui::Icon { t.iconName = s.getIconModifier().value.value; t.name = s.name + "GroupIcon"; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/GroupIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/GroupIcon"); +} + +@greedy +rule TabGroup + transform s: JSL!UIViewGroupDeclaration + to t: UI!ui::Tab { + guard: s.eContainer.isKindOf(JSL!UIViewTabsDeclaration) and rootMenu.containsVisualElement(s) + + s.eContainer.equivalent("TabBarVisualElement").tabs.add(t); + t.element = s.equivalent("GroupVisualElement"); + t.name = t.element.name; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TabGroup"); + + log.debug("TabGroup: " + t.name); } -*/ diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl index 5a5b5057..af7177ba 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl @@ -259,7 +259,7 @@ rule InlineViewLink transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Link extends AbstractViewLinkDeclaration { - guard: s.getTransferObjectType().isGenerated() + guard: rootMenu.containsVisualElement(s) var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewLink"; t.setId(id); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index e3b7cda8..77954703 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -110,7 +110,7 @@ rule InlineViewTable transform s: JSL!UIViewTableDeclaration to t: UI!ui::Table extends AbstractViewTableDeclaration { - guard: s.getTransferObjectType().isGenerated() + guard: rootMenu.containsVisualElement(s) var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewTable"; t.setId(id); @@ -762,7 +762,7 @@ rule ViewTableDeclarationAddSelectorTableFilterAction t.name = s.getFqName() + "::AddSelector::Table::Filter"; t.ownerDataElement = s.equivalent("RelationType"); t.targetDataElement = s.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); log.debug("ViewTableDeclarationAddSelectorTableFilterAction: " + t.name); } @@ -982,7 +982,7 @@ rule ViewTableDeclarationAddSelectorTableTableFilterButton t.label = "Set Filters"; t.buttonStyle = "text"; t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); log.debug("ViewTableDeclarationAddSelectorTableTableFilterButton: " + t.name); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl index 441b10af..a779eba0 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl @@ -1,10 +1,9 @@ -/* rule TabBarVisualElement - transform s: JSL!ViewTabsDeclaration + transform s: JSL!UIViewTabsDeclaration to t: UI!ui::TabController { - guard: s.getTransferObjectType().isGenerated() + guard: rootMenu.containsVisualElement(s) - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/TabBarVisualElement"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TabBarVisualElement"); t.name = s.name; t.~pos = s.~pos; t.col = s.getWidth().isDefined() ? s.getWidth().value.asReal() : 12d; @@ -25,26 +24,26 @@ rule TabBarVisualElement log.debug("TabBarVisualElement: " + t.name); } -rule GroupTab - transform s: JSL!ViewGroupDeclaration +@greedy +rule SubTab + transform s: JSL!UIViewTabsDeclaration to t: UI!ui::Tab { - guard: s.eContainer.isKindOf(JSL!ViewTabsDeclaration) and s.getTransferObjectType().isGenerated() + guard: s.eContainer.isKindOf(JSL!UIViewTabsDeclaration) and rootMenu.containsVisualElement(s) s.eContainer.equivalent("TabBarVisualElement").tabs.add(t); - t.element = s.equivalent("GroupVisualElement"); + t.element = s.equivalent("TabBarVisualElement"); t.name = t.element.name; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/GroupTab"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/SubTab"); - log.debug("GroupTab: " + t.name); + log.debug("SubTab: " + t.name); } @lazy @greedy rule TabsIcon - transform s: JSL!ViewTabsDeclaration + transform s: JSL!UIViewTabsDeclaration to t: UI!ui::Icon { t.iconName = s.getIconModifier().value.value; t.name = s.name + "TabsIcon"; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/TabsIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TabsIcon"); } -*/ diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl index 7c56cd1c..819b347a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl @@ -118,7 +118,7 @@ rule EnumerationTypeRadio to t: UI!ui::EnumerationRadio extends AbstractViewWidgetDeclaration { guard: s.enumWidget == ESM!esm::ui::EnumWidget#RADIO - and s.getTransferObjectType().isGenerated() + and rootMenu.containsVisualElement(s) and not s.dataFeature.getMember().isQuery and s.dataFeature.getMember().getDataType().isTypeOf(ESM!esm::type::EnumerationType) diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java index f8add4c2..f341d676 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java @@ -139,14 +139,14 @@ menu CarApp(UserActor usr) { assertEquals(Set.of( "Car::CarView::View::PageContainer", - "Car::CarApp::cars::Table::PageContainer", + "Car::CarTable::Table::PageContainer", "Car::CarApp::Dashboard", "Car::CarForm::Create::PageContainer" ), pageContainers.stream().map(NamedElement::getName).collect(Collectors.toSet())); assertEquals(Set.of( + "Car::CarApp::cars::AccessTableViewPage", "Car::CarApp::cars::AccessFormPage", - "Car::CarApp::cars::AccessViewPage", "Car::CarApp::DashboardPage", "Car::CarApp::cars::AccessTablePage" ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); @@ -154,7 +154,7 @@ menu CarApp(UserActor usr) { assertEquals(Set.of(), links.stream().map(NamedElement::getName).collect(Collectors.toSet())); assertEquals(Set.of( - "cars::Table" + "CarTable::Table" ), tables.stream().map(NamedElement::getName).collect(Collectors.toSet())); } } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java index dbda7e52..f45a67c7 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java @@ -78,7 +78,7 @@ enum MyEnum { } transfer UserTransfer(User u) { - field String email <=> u.email; + field String email <=> u.email required; field Binary binary <= u.binary; field String string <= u.string; field Boolean boolean <= u.boolean; @@ -142,7 +142,7 @@ menu WidgetsApp(WidgetsActor a) { assertEquals(2, pageContainers.size()); PageContainer dashboard = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::WidgetsApp::Dashboard")).findFirst().orElseThrow(); - PageContainer user = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::WidgetsApp::user::View::PageContainer")).findFirst().orElseThrow(); + PageContainer user = pageContainers.stream().filter(c -> c.getName().equals("BasicWidgetsTestModel::UserView::View::PageContainer")).findFirst().orElseThrow(); // Dashboard assertEquals(0, dashboard.getChildren().size()); @@ -154,7 +154,7 @@ menu WidgetsApp(WidgetsActor a) { // Root Flex Flex rootFlex = (Flex) user.getChildren().get(0); - assertEquals("user", rootFlex.getName()); + assertEquals("UserView", rootFlex.getName()); assertNull(rootFlex.getLabel()); assertEquals(12, rootFlex.getCol()); assertEquals(Axis.VERTICAL, rootFlex.getDirection()); From f6b39cea19889b1ee269a20cd364d804dda515ba Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Wed, 18 Sep 2024 20:11:11 +0200 Subject: [PATCH 04/21] JNG-5928 save state with failing tests --- .../operations/jsl/namespace/modifiable.eol | 5 + .../operations/jsl/ui/viewLinkDeclaration.eol | 12 +- .../application/JslModel2UiDataTest.java | 1324 ++++++++--------- 3 files changed, 653 insertions(+), 688 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol index 0d8c1778..e4145ddd 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol @@ -161,3 +161,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)); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol index 28d2b3bc..9c71694a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol @@ -24,15 +24,17 @@ operation JSL!UIViewLinkDeclaration getExposedVisualElements(): Set { ves.add(self); ves.add(viewDeclaration); - for (link in self.members.select(m | m.isTypeOf(JSL!UIViewLinkDeclaration)).asSet()) { - ves.addAll(link.getExposedVisualElements()); + if (s.getCreateFormModifier().isDefined()) { + ves.addAll(s.getCreateFormModifier().form.getExposedVisualElements()); } - for (table in self.members.select(m | m.isTypeOf(JSL!UIViewTableDeclaration)).asSet()) { - ves.addAll(table.getExposedVisualElements()); + if (s.getUpdateViewModifier().isDefined()) { + ves.addAll(s.getUpdateViewModifier().view.getExposedVisualElements()); } - ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); + if (s.getSelectorTableModifier().isDefined()) { + ves.addAll(s.getSelectorTableModifier().row.getExposedVisualElements()); + } return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java index 85733697..a390a05e 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java @@ -38,687 +38,645 @@ protected Logger createLog() { return log; } -// @BeforeAll -// static void prepareTestFolders() throws IOException { -// if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { -// Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); -// } -// } -// -// @Test -// void testBasicData() throws Exception { -// jslModel = JslParser.getModelFromStrings("BasicDataTestModel", List.of(""" -// model BasicDataTestModel; -// -// type binary Binary max-file-size: 1MB mime-type: ["image/*"]; -// type boolean Boolean; -// type date Date; -// type numeric Numeric scale: 0 precision: 9; -// type string String min-size: 0 max-size: 255; -// type time Time; -// type timestamp Timestamp; -// -// enum MyEnum { -// Atomic = 0; -// Bombastic = 1; -// Crazy = 2; -// } -// -// entity User { -// identifier String email required; -// field Binary binary; -// field String string; -// field Boolean boolean; -// field Date date; -// field Numeric numeric; -// field Time time; -// field Timestamp timestamp; -// field MyEnum `enum` default:MyEnum#Bombastic; -// } -// -// transfer UserTransfer maps User as u { -// field String email <= u.email bind required; -// field Binary binaryDerived <= u.binary; -// field String stringDerived <= u.string; -// field Boolean booleanDerived <= u.boolean; -// field Date dateDerived <= u.date; -// field Numeric numericDerived <= u.numeric; -// field Time timeDerived <= u.time; -// field Timestamp timestampDerived <= u.timestamp; -// field MyEnum mappedEnum <= u.`enum` bind default:MyEnum#Crazy; -// -// field Binary binaryTransient; -// field String stringTransient; -// field Boolean booleanTransient; -// field Date dateTransient; -// field Numeric numericTransient; -// field Time timeTransient; -// field Timestamp timestampTransient; -// -// field Binary binaryMapped <= u.binary bind: true; -// field String stringMapped <= u.string bind: true; -// field Boolean booleanMapped <= u.boolean bind: true; -// field Date dateMapped <= u.date bind: true; -// field Numeric numericMapped <= u.numeric bind: true; -// field Time timeMapped <= u.time bind: true; -// field Timestamp timestampMapped <= u.timestamp bind: true; -// } -// -// actor Actor human realm:"COMPANY" claim:"email" identity:UserTransfer::email; -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app = apps.get(0); -// -// // DataTypes -// -// var dataTypes = app.getDataTypes(); -// StringType stringType = (StringType) dataTypes.stream().filter(t -> t instanceof StringType).findFirst().orElseThrow(); -// BooleanType booleanType = (BooleanType) dataTypes.stream().filter(t -> t instanceof BooleanType).findFirst().orElseThrow(); -// BinaryType binaryType = (BinaryType) dataTypes.stream().filter(t -> t instanceof BinaryType).findFirst().orElseThrow(); -// NumericType numericType = (NumericType) dataTypes.stream().filter(t -> t instanceof NumericType).findFirst().orElseThrow(); -// EnumerationType enumType = (EnumerationType) dataTypes.stream().filter(t -> t instanceof EnumerationType).findFirst().orElseThrow(); -// DateType dateType = (DateType) dataTypes.stream().filter(t -> t instanceof DateType).findFirst().orElseThrow(); -// TimeType timeType = (TimeType) dataTypes.stream().filter(t -> t instanceof TimeType).findFirst().orElseThrow(); -// TimestampType timestampType = (TimestampType) dataTypes.stream().filter(t -> t instanceof TimestampType).findFirst().orElseThrow(); -// -// assertEquals(8, dataTypes.size()); -// -// assertNotNull(stringType); -// assertEquals("String", stringType.getName()); -// assertEquals(255, stringType.getMaxLength()); -// -// assertNotNull(booleanType); -// assertEquals("Boolean", booleanType.getName()); -// -// assertNotNull(stringType); -// assertEquals("Numeric", numericType.getName()); -// assertEquals(9, numericType.getPrecision()); -// assertEquals(0, numericType.getScale()); -// -// assertNotNull(dateType); -// assertEquals("Date", dateType.getName()); -// -// assertNotNull(timeType); -// assertEquals("Time", timeType.getName()); -// -// assertNotNull(timestampType); -// assertEquals("Timestamp", timestampType.getName()); -// -// assertNotNull(binaryType); -// assertEquals("Binary", binaryType.getName()); -// assertEquals(1000000, binaryType.getMaxFileSize()); -// assertEquals(1, binaryType.getMimeTypes().size()); -// assertEquals("image", binaryType.getMimeTypes().get(0).getType()); -// assertEquals("*", binaryType.getMimeTypes().get(0).getSubType()); -// -// assertNotNull(enumType); -// assertEquals("MyEnum", enumType.getName()); -// assertEquals(3, enumType.getMembers().size()); -// assertEquals(0, enumType.getMembers().get(0).getOrdinal()); -// assertEquals("Atomic", enumType.getMembers().get(0).getName()); -// assertEquals(1, enumType.getMembers().get(1).getOrdinal()); -// assertEquals("Bombastic", enumType.getMembers().get(1).getName()); -// assertEquals(2, enumType.getMembers().get(2).getOrdinal()); -// assertEquals("Crazy", enumType.getMembers().get(2).getName()); -// -// // Attributes -// -// AttributeAssertion asserter = new AttributeAssertion("Actor::Application::BasicDataTestModel::UserTransfer::ClassType::"); -// -// ClassType userTransfer = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataTestModel::UserTransfer::ClassType")).findFirst().orElseThrow(); -// assertNotNull(userTransfer); -// assertEquals(23, userTransfer.getAttributes().size()); -// -// AttributeType email = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("email")).findFirst().orElseThrow(); -// asserter.assertAttributeType(email, "email", "String", MemberType.MAPPED, true, true, false); -// -// AttributeType binaryDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("binaryDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(binaryDerived, "binaryDerived", "Binary", MemberType.DERIVED, false, false, true); -// -// AttributeType stringDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("stringDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(stringDerived, "stringDerived", "String", MemberType.DERIVED, false, true, true); -// -// AttributeType booleanDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("booleanDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(booleanDerived, "booleanDerived", "Boolean", MemberType.DERIVED, false, true, true); -// -// AttributeType dateDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("dateDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(dateDerived, "dateDerived", "Date", MemberType.DERIVED, false, true, true); -// -// AttributeType numericDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("numericDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(numericDerived, "numericDerived", "Numeric", MemberType.DERIVED, false, true, true); -// -// AttributeType timeDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timeDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(timeDerived, "timeDerived", "Time", MemberType.DERIVED, false, true, true); -// -// AttributeType timestampDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timestampDerived")).findFirst().orElseThrow(); -// asserter.assertAttributeType(timestampDerived, "timestampDerived", "Timestamp", MemberType.DERIVED, false, true, true); -// -// AttributeType mappedEnum = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("mappedEnum")).findFirst().orElseThrow(); -// asserter.assertAttributeType(mappedEnum, "mappedEnum", "MyEnum", MemberType.MAPPED, false, false, false); -// -// AttributeType binaryTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("binaryTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(binaryTransient, "binaryTransient", "Binary", MemberType.TRANSIENT, false, false, false); -// -// AttributeType stringTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("stringTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(stringTransient, "stringTransient", "String", MemberType.TRANSIENT, false, false, false); -// -// AttributeType booleanTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("booleanTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(booleanTransient, "booleanTransient", "Boolean", MemberType.TRANSIENT, false, false, false); -// -// AttributeType dateTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("dateTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(dateTransient, "dateTransient", "Date", MemberType.TRANSIENT, false, false, false); -// -// AttributeType numericTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("numericTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(numericTransient, "numericTransient", "Numeric", MemberType.TRANSIENT, false, false, false); -// -// AttributeType timeTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timeTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(timeTransient, "timeTransient", "Time", MemberType.TRANSIENT, false, false, false); -// -// AttributeType timestampTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timestampTransient")).findFirst().orElseThrow(); -// asserter.assertAttributeType(timestampTransient, "timestampTransient", "Timestamp", MemberType.TRANSIENT, false, false, false); -// -// AttributeType binaryMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("binaryMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(binaryMapped, "binaryMapped", "Binary", MemberType.MAPPED, false, false, false); -// -// AttributeType stringMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("stringMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(stringMapped, "stringMapped", "String", MemberType.MAPPED, false, true, false); -// -// AttributeType booleanMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("booleanMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(booleanMapped, "booleanMapped", "Boolean", MemberType.MAPPED, false, true, false); -// -// AttributeType dateMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("dateMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(dateMapped, "dateMapped", "Date", MemberType.MAPPED, false, true, false); -// -// AttributeType numericMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("numericMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(numericMapped, "numericMapped", "Numeric", MemberType.MAPPED, false, true, false); -// -// AttributeType timeMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timeMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(timeMapped, "timeMapped", "Time", MemberType.MAPPED, false, true, false); -// -// AttributeType timestampMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timestampMapped")).findFirst().orElseThrow(); -// asserter.assertAttributeType(timestampMapped, "timestampMapped", "Timestamp", MemberType.MAPPED, false, true, false); -// } -// -// @Test -// void testBasicDataCrossTransfers() throws Exception { -// jslModel = JslParser.getModelFromStrings("BasicDataCrossTransfersTestModel", List.of(""" -// model BasicDataCrossTransfersTestModel; -// -// import judo::types; -// -// entity Entity1 { -// field String string; -// field Boolean boolean; -// } -// -// entity Entity2 { -// field Integer integer; -// } -// -// row Transfer1Row(Entity1 e1) { -// field String string <= e1.string label:"String"; -// field Boolean boolean <= e1.boolean label:"Boolean"; -// } -// -// row Transfer2Row(Entity2 e2) { -// field Integer integer <= e2.integer label:"Integer"; -// } -// -// view Transfer1ListView { -// table Transfer1Row[] tr1s <= Entity1.all(); -// } -// -// view Transfer2ListView { -// table Transfer2Row[] tr2s <= Entity2.all(); -// } -// -// actor Actor1 human { -// link Transfer1ListView tr1s label:"TR1S"; -// link Transfer2ListView tr2s label:"TR2S"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app = apps.get(0); -// -// ClassType transfer1Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer1Row::ClassType")).findFirst().orElseThrow(); -// assertNotNull(transfer1Row); -// assertEquals(2, transfer1Row.getAttributes().size()); -// -// AttributeAssertion tr1Asserter = new AttributeAssertion("Actor1::Application::BasicDataCrossTransfersTestModel::Transfer1Row::ClassType::"); -// -// AttributeType string = transfer1Row.getAttributes().stream().filter(a -> a.getName().equals("string")).findFirst().orElseThrow(); -// tr1Asserter.assertAttributeType(string, "string", "String", MemberType.DERIVED, false, true, true); -// -// AttributeType booleanAttr = transfer1Row.getAttributes().stream().filter(a -> a.getName().equals("boolean")).findFirst().orElseThrow(); -// tr1Asserter.assertAttributeType(booleanAttr, "boolean", "Boolean", MemberType.DERIVED, false, true, true); -// -// ClassType transfer2Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer2Row::ClassType")).findFirst().orElseThrow(); -// assertNotNull(transfer2Row); -// assertEquals(1, transfer2Row.getAttributes().size()); -// -// AttributeAssertion tr2Asserter = new AttributeAssertion("Actor1::Application::BasicDataCrossTransfersTestModel::Transfer2Row::ClassType::"); -// -// AttributeType integer = transfer2Row.getAttributes().stream().filter(a -> a.getName().equals("integer")).findFirst().orElseThrow(); -// tr2Asserter.assertAttributeType(integer, "integer", "Integer", MemberType.DERIVED, false, true, true); -// } -// -// @Test -// void testNestedFieldsAndRelations() throws Exception { -// jslModel = JslParser.getModelFromStrings("NestedFieldsAndRelationsTestModel", List.of(""" -// model NestedFieldsAndRelationsTestModel; -// -// import judo::types; -// -// entity Entity1 { -// field String string; -// field Boolean boolean; -// } -// -// row Transfer1Row(Entity1 e1) { -// field String stringOnRow <= e1.string label:"String On Row"; -// field Boolean booleanOnRow <= e1.boolean label:"Boolean On Row"; -// } -// -// view Transfer1View(Entity1 e1) { -// field String stringOnView <= e1.string; -// field Boolean booleanOnView <= e1.boolean; -// } -// -// view TransferRootView { -// group level1 frame { -// group level2 { -// table Transfer1Row[] tr1s <= Entity1.all(); -// link Transfer1View tr1 <= Entity1.any(); -// field String transientNested; -// } -// } -// } -// -// actor ActorForNestedMembers human { -// link TransferRootView root label:"Root"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app = apps.get(0); -// -// List classTypes = app.getClassTypes(); -// -// assertEquals(4, classTypes.size()); -// -// ClassType actorClass = classTypes.stream().filter(c -> c.isIsActor()).findFirst().orElseThrow(); -// ClassType transferRootViewClass = classTypes.stream().filter(c -> c.getName().equals("NestedFieldsAndRelationsTestModel::TransferRootView::ClassType")).findFirst().orElseThrow(); -// ClassType transfer1ViewClass = classTypes.stream().filter(c -> c.getName().equals("NestedFieldsAndRelationsTestModel::Transfer1View::ClassType")).findFirst().orElseThrow(); -// ClassType transfer1RowClass = classTypes.stream().filter(c -> c.getName().equals("NestedFieldsAndRelationsTestModel::Transfer1Row::ClassType")).findFirst().orElseThrow(); -// -// assertEquals("NestedFieldsAndRelationsTestModel::ActorForNestedMembers::ClassType", actorClass.getName()); -// assertEquals(1, actorClass.getRelations().size()); -// -// RelationType relation = actorClass.getRelations().get(0); -// assertEquals("root", relation.getName()); -// assertEquals(transferRootViewClass, relation.getTarget()); -// -// assertEquals(1, transferRootViewClass.getAttributes().size()); -// assertEquals("transientNested", transferRootViewClass.getAttributes().get(0).getName()); -// -// assertEquals(2, transferRootViewClass.getRelations().size()); -// -// RelationType tr1 = transferRootViewClass.getRelations().stream().filter(r -> r.getTarget().equals(transfer1ViewClass)).findFirst().orElseThrow(); -// RelationType tr1s = transferRootViewClass.getRelations().stream().filter(r -> r.getTarget().equals(transfer1RowClass)).findFirst().orElseThrow(); -// -// assertEquals("tr1", tr1.getName()); -// assertFalse(tr1.isIsCollection()); -// -// assertEquals("tr1s", tr1s.getName()); -// assertTrue(tr1s.isIsCollection()); -// -// assertEquals(2, transfer1RowClass.getAttributes().size()); -// -// AttributeType stringOnRow = transfer1RowClass.getAttributes().stream().filter(a -> a.getName().equals("stringOnRow")).findFirst().orElseThrow(); -// AttributeType booleanOnRow = transfer1RowClass.getAttributes().stream().filter(a -> a.getName().equals("booleanOnRow")).findFirst().orElseThrow(); -// -// assertEquals("String", stringOnRow.getDataType().getName()); -// assertTrue(stringOnRow.getIsMemberTypeDerived()); -// -// assertEquals("Boolean", booleanOnRow.getDataType().getName()); -// assertTrue(booleanOnRow.getIsMemberTypeDerived()); -// -// assertEquals(2, transfer1ViewClass.getAttributes().size()); -// -// AttributeType stringOnView = transfer1ViewClass.getAttributes().stream().filter(a -> a.getName().equals("stringOnView")).findFirst().orElseThrow(); -// AttributeType booleanOnView = transfer1ViewClass.getAttributes().stream().filter(a -> a.getName().equals("booleanOnView")).findFirst().orElseThrow(); -// -// assertEquals("String", stringOnView.getDataType().getName()); -// assertTrue(stringOnView.getIsMemberTypeDerived()); -// -// assertEquals("Boolean", booleanOnView.getDataType().getName()); -// assertTrue(booleanOnView.getIsMemberTypeDerived()); -// } -// -// @Test -// void testRelations() throws Exception { -// jslModel = JslParser.getModelFromStrings("RelationsTestModel", List.of(""" -// model RelationsTestModel; -// -// import judo::types; -// -// entity User { -// identifier String email required; -// -// field EntityRelated containment; -// field EntityRelated[] containmentCollection; -// -// relation EntityRelated association; -// relation EntityRelated[] associationCollection; -// relation EntityRelated derivedContainment <= self.containment eager:true; -// relation EntityRelated[] derivedContainmentCollection <= self.containmentCollection eager:true; -// } -// -// entity EntityRelated { -// field String hello; -// -// relation User user opposite-add:userRelatedOpposite; -// relation User userCollection opposite-add:userRelatedOppositeCollection[]; -// } -// -// transfer UserTransfer maps User as u { -// field String email <= u.email bind; -// } -// -// view UserView(User u) { -// link UnmappedRelated unmappedLazy; -// link UnmappedRelated unmappedLazyRequired required; -// table UnmappedRelatedRow[] unmappedLazyCollection; -// -// link MappedRelated lazyAssociation <= u.association create:true update:true delete:true; -// link MappedRelated lazyAssociationOpposite <= u.userRelatedOpposite create:true update:true delete:true; -// -// link MappedRelated derivedLazyContainment <= u.containment; -// table MappedRelatedRow[] derivedLazyContainmentCollection <= u.containmentCollection; -// -// link MappedRelated derivedEagerContainment <= u.containment eager:true; -// table MappedRelatedRow[] derivedEagerContainmentCollection <= u.containmentCollection eager:true; -// -// link MappedRelated derivedLazyAssociation <= u.association; -// table MappedRelatedRow[] derivedLazyAssociationCollection <= u.associationCollection; -// -// link MappedRelated derivedEagerAssociation <= u.association eager:true; -// table MappedRelatedRow[] derivedEagerAssociationCollection <= u.associationCollection eager:true; -// -// link MappedRelated derivedLazyStatic <= EntityRelated.any(); -// table MappedRelatedRow[] derivedLazyCollectionStatic <= EntityRelated.all(); -// -// link MappedRelated derivedEagerStatic <= EntityRelated.any() eager:true; -// table MappedRelatedRow[] derivedEagerCollectionStatic <= EntityRelated.all() eager:true; -// -// link MappedRelated mappedLazyAssociationDerived <= u.derivedContainment; -// table MappedRelatedRow[] mappedLazyAssociationCollectionDerived <= u.derivedContainmentCollection; -// -// link MappedRelated lazyAssociationWithChoicesAndDefault <= u.association choices:EntityRelated.all() default:EntityRelated.any() create:true; -// table MappedRelatedRow[] lazyAssociationCollectionWithChoicesAndDefault <= u.associationCollection choices:EntityRelated.all() default:EntityRelated.all() create:true; -// link MappedRelated lazyAssociationOppositeWithChoicesAndDefault <= u.userRelatedOpposite choices:EntityRelated.all(); -// table MappedRelatedRow[] lazyAssociationOppositeCollectionWithChoicesAndDefault <= u.userRelatedOppositeCollection choices:EntityRelated.all(); -// -// link MappedRelated lazyTransientWithDefault default:EntityRelated.any(); -// table MappedRelatedRow[] lazyTransientCollectionWithDefault default:EntityRelated.all(); -// } -// -// view UnmappedRelated { -// field String transient; -// } -// -// row UnmappedRelatedRow { -// field String transient label:"Transient"; -// } -// -// view MappedRelated(EntityRelated e) { -// field String mappedAttribute <= e.hello; -// event create onCreate; -// event update onUpdate; -// event delete onDelete; -// } -// -// row MappedRelatedRow(EntityRelated e) { -// field String mappedAttribute <= e.hello label:"Mapped Attribute"; -// event create onCreate; -// } -// -// actor Actor human realm:"COMPANY" claim:"email" identity:UserTransfer::email { -// link UserView users label:"Users"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application app1 = apps.get(0); -// -// assertEquals(7, app1.getClassTypes().size()); -// assertEquals(26, app1.getRelationTypes().size()); -// -// RelationType users = (RelationType) app1.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("users")).findFirst().orElseThrow(); -// -// ClassType userTransfer = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserTransfer::ClassType")).findFirst().orElseThrow(); -// ClassType userView = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserView::ClassType")).findFirst().orElseThrow(); -// ClassType mappedRelated = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::MappedRelated::ClassType")).findFirst().orElseThrow(); -// ClassType mappedRelatedRow = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::MappedRelatedRow::ClassType")).findFirst().orElseThrow(); -// ClassType unmappedRelated = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UnmappedRelated::ClassType")).findFirst().orElseThrow(); -// ClassType unmappedRelatedRow = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UnmappedRelatedRow::ClassType")).findFirst().orElseThrow(); -// -// assertEquals(userView, users.getTarget()); -// -// List userViewRelations = userView.getRelations(); -// -// assertEquals(25, userViewRelations.size()); -// -// // According to JSLUtils, transients are always aggregation regardless of what we model. -// RelationType unmappedLazy = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazy")).findFirst().orElseThrow(); -// assertRelationType(unmappedLazy, unmappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of()); -// -// RelationType unmappedLazyRequired = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazyRequired")).findFirst().orElseThrow(); -// assertRelationType(unmappedLazyRequired, unmappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, false, false, false, Set.of()); -// -// RelationType unmappedLazyCollection = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazyCollection")).findFirst().orElseThrow(); -// assertRelationType(unmappedLazyCollection, unmappedRelatedRow, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of()); -// -// RelationType lazyAssociation = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociation")).findFirst().orElseThrow(); -// assertRelationType(lazyAssociation, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( -// RelationBehaviourType.VALIDATE_CREATE, -// RelationBehaviourType.CREATE, -// RelationBehaviourType.VALIDATE_UPDATE, -// RelationBehaviourType.UPDATE, -// RelationBehaviourType.DELETE, -// RelationBehaviourType.REFRESH, -// RelationBehaviourType.LIST -// )); -// -// RelationType lazyAssociationOpposite = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOpposite")).findFirst().orElseThrow(); -// assertRelationType(lazyAssociationOpposite, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( -// RelationBehaviourType.VALIDATE_CREATE, -// RelationBehaviourType.CREATE, -// RelationBehaviourType.VALIDATE_UPDATE, -// RelationBehaviourType.UPDATE, -// RelationBehaviourType.DELETE, -// RelationBehaviourType.REFRESH, -// RelationBehaviourType.LIST -// )); -// -// RelationType derivedLazyContainment = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyContainment")).findFirst().orElseThrow(); -// assertRelationType(derivedLazyContainment, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedLazyContainmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyContainmentCollection")).findFirst().orElseThrow(); -// assertRelationType(derivedLazyContainmentCollection, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedEagerContainment = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerContainment")).findFirst().orElseThrow(); -// assertRelationType(derivedEagerContainment, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedEagerContainmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerContainmentCollection")).findFirst().orElseThrow(); -// assertRelationType(derivedEagerContainmentCollection, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedLazyAssociation = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyAssociation")).findFirst().orElseThrow(); -// assertRelationType(derivedLazyAssociation, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedLazyAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyAssociationCollection")).findFirst().orElseThrow(); -// assertRelationType(derivedLazyAssociationCollection, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedEagerAssociation = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerAssociation")).findFirst().orElseThrow(); -// assertRelationType(derivedEagerAssociation, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedEagerAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerAssociationCollection")).findFirst().orElseThrow(); -// assertRelationType(derivedEagerAssociationCollection, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedLazyStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyStatic")).findFirst().orElseThrow(); -// assertRelationType(derivedLazyStatic, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedLazyCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyCollectionStatic")).findFirst().orElseThrow(); -// assertRelationType(derivedLazyCollectionStatic, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedEagerStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerStatic")).findFirst().orElseThrow(); -// assertRelationType(derivedEagerStatic, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType derivedEagerCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerCollectionStatic")).findFirst().orElseThrow(); -// assertRelationType(derivedEagerCollectionStatic, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType mappedLazyAssociationDerived = userViewRelations.stream().filter(r -> r.getName().equals("mappedLazyAssociationDerived")).findFirst().orElseThrow(); -// assertRelationType(mappedLazyAssociationDerived, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType mappedLazyAssociationCollectionDerived = userViewRelations.stream().filter(r -> r.getName().equals("mappedLazyAssociationCollectionDerived")).findFirst().orElseThrow(); -// assertRelationType(mappedLazyAssociationCollectionDerived, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH -// )); -// -// RelationType lazyAssociationWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationWithChoicesAndDefault")).findFirst().orElseThrow(); -// assertRelationType(lazyAssociationWithChoicesAndDefault, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH, -// RelationBehaviourType.RANGE, -// RelationBehaviourType.TEMPLATE, -// RelationBehaviourType.CREATE, -// RelationBehaviourType.VALIDATE_CREATE -// )); -// -// RelationType lazyAssociationCollectionWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationCollectionWithChoicesAndDefault")).findFirst().orElseThrow(); -// assertRelationType(lazyAssociationCollectionWithChoicesAndDefault, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.STORED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH, -// RelationBehaviourType.RANGE, -// RelationBehaviourType.TEMPLATE, -// RelationBehaviourType.CREATE, -// RelationBehaviourType.VALIDATE_CREATE -// )); -// -// RelationType lazyAssociationOppositeWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOppositeWithChoicesAndDefault")).findFirst().orElseThrow(); -// assertRelationType(lazyAssociationOppositeWithChoicesAndDefault, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH, -// RelationBehaviourType.RANGE -// )); -// -// RelationType lazyAssociationOppositeCollectionWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOppositeCollectionWithChoicesAndDefault")).findFirst().orElseThrow(); -// assertRelationType(lazyAssociationOppositeCollectionWithChoicesAndDefault, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.STORED, true, true, true, true, Set.of( -// RelationBehaviourType.LIST, -// RelationBehaviourType.REFRESH, -// RelationBehaviourType.RANGE -// )); -// -// // According to JSLUtils, transients are always aggregation regardless of what we model. -// RelationType lazyTransientWithDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyTransientWithDefault")).findFirst().orElseThrow(); -// assertRelationType(lazyTransientWithDefault, mappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of( -// RelationBehaviourType.TEMPLATE -// )); -// -// RelationType lazyTransientCollectionWithDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyTransientCollectionWithDefault")).findFirst().orElseThrow(); -// assertRelationType(lazyTransientCollectionWithDefault, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of( -// RelationBehaviourType.TEMPLATE -// )); -// } -// -// static class AttributeAssertion { -// private final String fqPrefix; -// -// AttributeAssertion(String fqPrefix) { -// this.fqPrefix = fqPrefix; -// } -// -// public void assertAttributeType(AttributeType attributeType, String name, String typeName, MemberType memberType, boolean isRequired, boolean isFilterable, boolean isReadonly) { -// assertEquals(name, attributeType.getName()); -// assertEquals(fqPrefix + name, attributeType.getFQName()); -// assertEquals(typeName, attributeType.getDataType().getName()); -// assertEquals(memberType, attributeType.getMemberType()); -// assertEquals(isRequired, attributeType.isIsRequired()); -// assertEquals(isFilterable, attributeType.isIsFilterable()); -// assertEquals(isReadonly,attributeType.isIsReadOnly()); -// } -// } -// -// static void assertRelationType(RelationType relationType, ClassType target, RelationKind relationKind, MemberType memberType, boolean isCollection, boolean isOptional, boolean isOrderable, boolean isFilterable, Set behaviourTypes) { -// assertEquals(isCollection, relationType.isIsCollection()); -// assertEquals(isOptional, relationType.isIsOptional()); -// assertEquals(target, relationType.getTarget()); -// assertEquals(memberType, relationType.getMemberType()); -// assertEquals(relationKind, relationType.getRelationKind()); -// assertEquals(behaviourTypes, new HashSet<>(relationType.getBehaviours())); -// assertEquals(isOrderable, relationType.isIsOrderable()); -// assertEquals(isFilterable, relationType.isIsFilterable()); -// } + @BeforeAll + static void prepareTestFolders() throws IOException { + if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { + Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); + } + } + + @Test + void testBasicData() throws Exception { + jslModel = JslParser.getModelFromStrings("BasicDataTestModel", List.of(""" + model BasicDataTestModel; + + type binary Binary max-file-size: 1MB mime-type: ["image/*"]; + type boolean Boolean; + type date Date; + type numeric Numeric scale: 0 precision: 9; + type string String min-size: 0 max-size: 255; + type time Time; + type timestamp Timestamp; + + enum MyEnum { + Atomic = 0; + Bombastic = 1; + Crazy = 2; + } + + entity User { + identifier String email required; + field Binary binary; + field String string; + field Boolean boolean; + field Date date; + field Numeric numeric; + field Time time; + field Timestamp timestamp; + field MyEnum `enum` default:MyEnum#Bombastic; + } + + transfer UserTransfer maps User as u { + field String email <=> u.email required; + field Binary binaryDerived <= u.binary; + field String stringDerived <= u.string; + field Boolean booleanDerived <= u.boolean; + field Date dateDerived <= u.date; + field Numeric numericDerived <= u.numeric; + field Time timeDerived <= u.time; + field Timestamp timestampDerived <= u.timestamp; + field MyEnum mappedEnum <=> u.`enum` default:MyEnum#Crazy; + + field Binary binaryTransient; + field String stringTransient; + field Boolean booleanTransient; + field Date dateTransient; + field Numeric numericTransient; + field Time timeTransient; + field Timestamp timestampTransient; + + field Binary binaryMapped <=> u.binary; + field String stringMapped <=> u.string; + field Boolean booleanMapped <=> u.boolean; + field Date dateMapped <=> u.date; + field Numeric numericMapped <=> u.numeric; + field Time timeMapped <=> u.time; + field Timestamp timestampMapped <=> u.timestamp; + } + + actor Actor realm:"COMPANY" claim:"email" identity:UserTransfer::email; + + menu ActorApp(Actor a) {} + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application app = apps.get(0); + + // DataTypes + + var dataTypes = app.getDataTypes(); + StringType stringType = (StringType) dataTypes.stream().filter(t -> t instanceof StringType).findFirst().orElseThrow(); + BooleanType booleanType = (BooleanType) dataTypes.stream().filter(t -> t instanceof BooleanType).findFirst().orElseThrow(); + BinaryType binaryType = (BinaryType) dataTypes.stream().filter(t -> t instanceof BinaryType).findFirst().orElseThrow(); + NumericType numericType = (NumericType) dataTypes.stream().filter(t -> t instanceof NumericType).findFirst().orElseThrow(); + EnumerationType enumType = (EnumerationType) dataTypes.stream().filter(t -> t instanceof EnumerationType && t.getName().equals("MyEnum")).findFirst().orElseThrow(); + DateType dateType = (DateType) dataTypes.stream().filter(t -> t instanceof DateType).findFirst().orElseThrow(); + TimeType timeType = (TimeType) dataTypes.stream().filter(t -> t instanceof TimeType).findFirst().orElseThrow(); + TimestampType timestampType = (TimestampType) dataTypes.stream().filter(t -> t instanceof TimestampType).findFirst().orElseThrow(); + + assertEquals(Set.of( + "Actor::Boolean", + "Actor::Numeric", + "Actor::Binary", + "Actor::MyEnum", + "Actor::String", + "Actor::Time", + "Actor::Timestamp", + "Actor::Date", + "Actor::BooleanOperation", + "Actor::NumericOperation", + "Actor::StringOperation", + "Actor::EnumerationOperation" + ), dataTypes.stream().map(d -> d.getFQName()).collect(Collectors.toSet())); + + assertNotNull(stringType); + assertEquals("String", stringType.getName()); + assertEquals(255, stringType.getMaxLength()); + + assertNotNull(booleanType); + assertEquals("Boolean", booleanType.getName()); + + assertNotNull(stringType); + assertEquals("Numeric", numericType.getName()); + assertEquals(9, numericType.getPrecision()); + assertEquals(0, numericType.getScale()); + + assertNotNull(dateType); + assertEquals("Date", dateType.getName()); + + assertNotNull(timeType); + assertEquals("Time", timeType.getName()); + + assertNotNull(timestampType); + assertEquals("Timestamp", timestampType.getName()); + + assertNotNull(binaryType); + assertEquals("Binary", binaryType.getName()); + assertEquals(1000000, binaryType.getMaxFileSize()); + assertEquals(1, binaryType.getMimeTypes().size()); + assertEquals("image", binaryType.getMimeTypes().get(0).getType()); + assertEquals("*", binaryType.getMimeTypes().get(0).getSubType()); + + assertNotNull(enumType); + assertEquals("MyEnum", enumType.getName()); + assertEquals(3, enumType.getMembers().size()); + assertEquals(0, enumType.getMembers().get(0).getOrdinal()); + assertEquals("Atomic", enumType.getMembers().get(0).getName()); + assertEquals(1, enumType.getMembers().get(1).getOrdinal()); + assertEquals("Bombastic", enumType.getMembers().get(1).getName()); + assertEquals(2, enumType.getMembers().get(2).getOrdinal()); + assertEquals("Crazy", enumType.getMembers().get(2).getName()); + + // Attributes + + AttributeAssertion asserter = new AttributeAssertion("Actor::BasicDataTestModel::UserTransfer::ClassType::"); + + ClassType userTransfer = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataTestModel::UserTransfer::ClassType")).findFirst().orElseThrow(); + assertNotNull(userTransfer); + assertEquals(23, userTransfer.getAttributes().size()); + + AttributeType email = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("email")).findFirst().orElseThrow(); + asserter.assertAttributeType(email, "email", "String", MemberType.MAPPED, true, true, false); + + AttributeType binaryDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("binaryDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(binaryDerived, "binaryDerived", "Binary", MemberType.DERIVED, false, false, true); + + AttributeType stringDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("stringDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(stringDerived, "stringDerived", "String", MemberType.DERIVED, false, true, true); + + AttributeType booleanDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("booleanDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(booleanDerived, "booleanDerived", "Boolean", MemberType.DERIVED, false, true, true); + + AttributeType dateDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("dateDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(dateDerived, "dateDerived", "Date", MemberType.DERIVED, false, true, true); + + AttributeType numericDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("numericDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(numericDerived, "numericDerived", "Numeric", MemberType.DERIVED, false, true, true); + + AttributeType timeDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timeDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(timeDerived, "timeDerived", "Time", MemberType.DERIVED, false, true, true); + + AttributeType timestampDerived = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timestampDerived")).findFirst().orElseThrow(); + asserter.assertAttributeType(timestampDerived, "timestampDerived", "Timestamp", MemberType.DERIVED, false, true, true); + + AttributeType mappedEnum = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("mappedEnum")).findFirst().orElseThrow(); + asserter.assertAttributeType(mappedEnum, "mappedEnum", "MyEnum", MemberType.MAPPED, false, false, false); + + AttributeType binaryTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("binaryTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(binaryTransient, "binaryTransient", "Binary", MemberType.TRANSIENT, false, false, false); + + AttributeType stringTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("stringTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(stringTransient, "stringTransient", "String", MemberType.TRANSIENT, false, false, false); + + AttributeType booleanTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("booleanTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(booleanTransient, "booleanTransient", "Boolean", MemberType.TRANSIENT, false, false, false); + + AttributeType dateTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("dateTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(dateTransient, "dateTransient", "Date", MemberType.TRANSIENT, false, false, false); + + AttributeType numericTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("numericTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(numericTransient, "numericTransient", "Numeric", MemberType.TRANSIENT, false, false, false); + + AttributeType timeTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timeTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(timeTransient, "timeTransient", "Time", MemberType.TRANSIENT, false, false, false); + + AttributeType timestampTransient = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timestampTransient")).findFirst().orElseThrow(); + asserter.assertAttributeType(timestampTransient, "timestampTransient", "Timestamp", MemberType.TRANSIENT, false, false, false); + + AttributeType binaryMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("binaryMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(binaryMapped, "binaryMapped", "Binary", MemberType.MAPPED, false, false, false); + + AttributeType stringMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("stringMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(stringMapped, "stringMapped", "String", MemberType.MAPPED, false, true, false); + + AttributeType booleanMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("booleanMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(booleanMapped, "booleanMapped", "Boolean", MemberType.MAPPED, false, true, false); + + AttributeType dateMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("dateMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(dateMapped, "dateMapped", "Date", MemberType.MAPPED, false, true, false); + + AttributeType numericMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("numericMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(numericMapped, "numericMapped", "Numeric", MemberType.MAPPED, false, true, false); + + AttributeType timeMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timeMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(timeMapped, "timeMapped", "Time", MemberType.MAPPED, false, true, false); + + AttributeType timestampMapped = userTransfer.getAttributes().stream().filter(a -> a.getName().equals("timestampMapped")).findFirst().orElseThrow(); + asserter.assertAttributeType(timestampMapped, "timestampMapped", "Timestamp", MemberType.MAPPED, false, true, false); + } + + @Test + void testBasicDataCrossTransfers() throws Exception { + jslModel = JslParser.getModelFromStrings("BasicDataCrossTransfersTestModel", List.of(""" + model BasicDataCrossTransfersTestModel; + + import judo::types; + + entity Entity1 { + field String string; + field Boolean boolean; + } + + entity Entity2 { + field Integer integer; + } + + transfer Transfer1(Entity1 e1) { + field String string <= e1.string; + field Boolean boolean <= e1.boolean; + } + + transfer Transfer2(Entity2 e2) { + field Integer integer <= e2.integer; + } + + table Transfer1Table(Transfer1 t1) { + column String string <= t1.string label:"String"; + column Boolean boolean <= t1.boolean label:"Boolean"; + } + + table Transfer2Table(Transfer2 t2) { + column Integer integer <= t2.integer label:"Integer"; + } + + actor Actor1 { + access Transfer1[] tr1s <= Entity1.all(); + access Transfer2[] tr2s <= Entity2.all(); + } + + menu TestApp(Actor1 a) { + table Transfer1Table tr1s <= a.tr1s label:"TR1S"; + table Transfer2Table tr2s <= a.tr2s label:"TR2S"; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application app = apps.get(0); + + assertEquals(Set.of( + "Actor1::BasicDataCrossTransfersTestModel::Actor1::ClassType", + "Actor1::BasicDataCrossTransfersTestModel::Transfer1::ClassType", + "Actor1::BasicDataCrossTransfersTestModel::Transfer2::ClassType" + ), app.getClassTypes().stream().map(c -> ((ClassType) c).getFQName()).collect(Collectors.toSet())); + + ClassType transfer1Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer1::ClassType")).findFirst().orElseThrow(); + assertNotNull(transfer1Row); + assertEquals(2, transfer1Row.getAttributes().size()); + + AttributeAssertion tr1Asserter = new AttributeAssertion("Actor1::BasicDataCrossTransfersTestModel::Transfer1::ClassType::"); + + AttributeType string = transfer1Row.getAttributes().stream().filter(a -> a.getName().equals("string")).findFirst().orElseThrow(); + tr1Asserter.assertAttributeType(string, "string", "String", MemberType.DERIVED, false, true, true); + + AttributeType booleanAttr = transfer1Row.getAttributes().stream().filter(a -> a.getName().equals("boolean")).findFirst().orElseThrow(); + tr1Asserter.assertAttributeType(booleanAttr, "boolean", "Boolean", MemberType.DERIVED, false, true, true); + + ClassType transfer2Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer2::ClassType")).findFirst().orElseThrow(); + assertNotNull(transfer2Row); + assertEquals(1, transfer2Row.getAttributes().size()); + + AttributeAssertion tr2Asserter = new AttributeAssertion("Actor1::BasicDataCrossTransfersTestModel::Transfer2::ClassType::"); + + AttributeType integer = transfer2Row.getAttributes().stream().filter(a -> a.getName().equals("integer")).findFirst().orElseThrow(); + tr2Asserter.assertAttributeType(integer, "integer", "Integer", MemberType.DERIVED, false, true, true); + } + + @Test + void testRelations() throws Exception { + jslModel = JslParser.getModelFromStrings("RelationsTestModel", List.of(""" + model RelationsTestModel; + + import judo::types; + + entity User { + identifier String email required; + + field EntityRelated containment; + field EntityRelated[] containmentCollection; + + relation EntityRelated association; + relation EntityRelated[] associationCollection; + relation EntityRelated derivedContainment <= self.containment; + relation EntityRelated[] derivedContainmentCollection <= self.containmentCollection; + } + + entity EntityRelated { + field String hello; + + relation User user opposite-add:userRelatedOpposite; + relation User userCollection opposite-add:userRelatedOppositeCollection[]; + } + + transfer UserTransfer(User u) { + field String email <=> u.email; + + relation EntityRelatedTransfer association <= u.association create:true update:true delete:true; + relation EntityRelatedTransfer[] associationCollection <= u.associationCollection create:true update:true delete:true; + relation EntityRelatedTransfer eagerAssociation <= u.association create:true update:true delete:true eager:true; + relation EntityRelatedTransfer[] eagerAssociationCollection <= u.associationCollection create:true update:true delete:true eager:true; + relation EntityRelatedTransfer userRelatedOpposite <= u.userRelatedOpposite create:true update:true delete:true; + + relation EntityRelatedTransfer containment <= u.containment; + relation EntityRelatedTransfer[] containmentCollection <= u.containmentCollection; + + relation EntityRelatedTransfer derivedLazyStatic <= EntityRelated.any(); + relation EntityRelatedTransfer derivedLazyStaticEager <= EntityRelated.any() eager:true; + relation EntityRelatedTransfer[] derivedLazyCollectionStatic <= EntityRelated.all(); + relation EntityRelatedTransfer[] derivedLazyCollectionStaticEager <= EntityRelated.all() eager:true; + + relation EntityRelatedTransfer derivedContainment <= u.containment; + relation EntityRelatedTransfer derivedEagerContainment <= u.containment eager:true; + relation EntityRelatedTransfer[] derivedContainmentCollection <= u.containmentCollection; + relation EntityRelatedTransfer[] derivedEagerContainmentCollection <= u.containmentCollection eager:true; + + relation EntityRelatedTransfer lazyTransientWithDefault default:EntityRelated.any(); + relation EntityRelatedTransfer[] lazyTransientCollectionWithDefault default:EntityRelated.all(); + + relation EntityRelatedTransfer unmapped; + relation EntityRelatedTransfer unmappedRequired required:true; + relation EntityRelatedTransfer[] unmappedCollection; + + event create onCreate; + event update onUpdate; + event delete onDelete; + } + + transfer EntityRelatedTransfer(EntityRelated e) { + field String hello <= e.hello; + field String transient; + + event create onCreate; + event update onUpdate; + event delete onDelete; + } + + view UserView(UserTransfer u) { + link UnmappedRelated unmappedLazy <= u.unmapped; + link UnmappedRelated unmappedLazyRequired <= u.unmappedRequired; + table UnmappedRelatedTable unmappedLazyCollection <= u.unmappedCollection; + + link MappedRelated lazyAssociation <= u.association; + table MappedRelatedTable lazyAssociationCollection <= u.associationCollection; + link MappedRelated lazyAssociationOpposite <= u.userRelatedOpposite; + + link MappedRelated derivedLazyContainment <= u.containment; + table MappedRelatedTable derivedLazyContainmentCollection <= u.containmentCollection; + + link MappedRelated derivedEagerContainment <= u.derivedEagerContainment; + table MappedRelatedTable derivedEagerContainmentCollection <= u.derivedEagerContainmentCollection; + + link MappedRelated derivedEagerAssociation <= u.eagerAssociation; + table MappedRelatedTable derivedEagerAssociationCollection <= u.eagerAssociationCollection; + + link MappedRelated derivedLazyStatic <= u.derivedLazyStatic; + table MappedRelatedTable derivedLazyCollectionStatic <= u.derivedLazyCollectionStatic; + + link MappedRelated derivedEagerStatic <= u.derivedLazyStaticEager; + table MappedRelatedTable derivedEagerCollectionStatic <= u.derivedLazyCollectionStaticEager; + + link MappedRelated lazyTransientWithDefault <= u.lazyTransientWithDefault; + table MappedRelatedTable lazyTransientCollectionWithDefault <= u.lazyTransientCollectionWithDefault; + } + + view UnmappedRelated(EntityRelatedTransfer t) { + widget String transient <= t.transient label:"Transient Field"; + } + + table UnmappedRelatedTable(EntityRelatedTransfer t) { + column String transient <= t.transient label:"Transient"; + } + + view MappedRelated(EntityRelatedTransfer e) { + widget String mappedAttribute <= e.hello; + } + + table MappedRelatedTable(EntityRelatedTransfer e) { + column String mappedAttribute <= e.hello label:"Mapped Attribute"; + } + + actor Actor realm:"COMPANY" claim:"email" identity:UserTransfer::email { + access UserTransfer user <= User.any() create delete update; + } + + menu TestApp(Actor a) { + link UserView user <= a.user label:"User"; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application app1 = apps.get(0); + + assertEquals(7, app1.getClassTypes().size()); + assertEquals(26, app1.getRelationTypes().size()); + + RelationType users = (RelationType) app1.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("users")).findFirst().orElseThrow(); + + ClassType userTransfer = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserTransfer::ClassType")).findFirst().orElseThrow(); + ClassType userView = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserView::ClassType")).findFirst().orElseThrow(); + ClassType mappedRelated = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::MappedRelated::ClassType")).findFirst().orElseThrow(); + ClassType mappedRelatedRow = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::MappedRelatedRow::ClassType")).findFirst().orElseThrow(); + ClassType unmappedRelated = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UnmappedRelated::ClassType")).findFirst().orElseThrow(); + ClassType unmappedRelatedRow = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UnmappedRelatedTable::ClassType")).findFirst().orElseThrow(); + + assertEquals(userView, users.getTarget()); + + List userViewRelations = userView.getRelations(); + + assertEquals(25, userViewRelations.size()); + + // According to JSLUtils, transients are always aggregation regardless of what we model. + RelationType unmappedLazy = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazy")).findFirst().orElseThrow(); + assertRelationType(unmappedLazy, unmappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of()); + + RelationType unmappedLazyRequired = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazyRequired")).findFirst().orElseThrow(); + assertRelationType(unmappedLazyRequired, unmappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, false, false, false, Set.of()); + + RelationType unmappedLazyCollection = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazyCollection")).findFirst().orElseThrow(); + assertRelationType(unmappedLazyCollection, unmappedRelatedRow, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of()); + + RelationType lazyAssociation = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociation")).findFirst().orElseThrow(); + assertRelationType(lazyAssociation, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationBehaviourType.VALIDATE_CREATE, + RelationBehaviourType.CREATE, + RelationBehaviourType.VALIDATE_UPDATE, + RelationBehaviourType.UPDATE, + RelationBehaviourType.DELETE, + RelationBehaviourType.REFRESH, + RelationBehaviourType.LIST + )); + + RelationType lazyAssociationOpposite = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOpposite")).findFirst().orElseThrow(); + assertRelationType(lazyAssociationOpposite, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationBehaviourType.VALIDATE_CREATE, + RelationBehaviourType.CREATE, + RelationBehaviourType.VALIDATE_UPDATE, + RelationBehaviourType.UPDATE, + RelationBehaviourType.DELETE, + RelationBehaviourType.REFRESH, + RelationBehaviourType.LIST + )); + + RelationType derivedLazyContainment = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyContainment")).findFirst().orElseThrow(); + assertRelationType(derivedLazyContainment, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedLazyContainmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyContainmentCollection")).findFirst().orElseThrow(); + assertRelationType(derivedLazyContainmentCollection, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedEagerContainment = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerContainment")).findFirst().orElseThrow(); + assertRelationType(derivedEagerContainment, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedEagerContainmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerContainmentCollection")).findFirst().orElseThrow(); + assertRelationType(derivedEagerContainmentCollection, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedLazyAssociation = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyAssociation")).findFirst().orElseThrow(); + assertRelationType(derivedLazyAssociation, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedLazyAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyAssociationCollection")).findFirst().orElseThrow(); + assertRelationType(derivedLazyAssociationCollection, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedEagerAssociation = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerAssociation")).findFirst().orElseThrow(); + assertRelationType(derivedEagerAssociation, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedEagerAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerAssociationCollection")).findFirst().orElseThrow(); + assertRelationType(derivedEagerAssociationCollection, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedLazyStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyStatic")).findFirst().orElseThrow(); + assertRelationType(derivedLazyStatic, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedLazyCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyCollectionStatic")).findFirst().orElseThrow(); + assertRelationType(derivedLazyCollectionStatic, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedEagerStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerStatic")).findFirst().orElseThrow(); + assertRelationType(derivedEagerStatic, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType derivedEagerCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerCollectionStatic")).findFirst().orElseThrow(); + assertRelationType(derivedEagerCollectionStatic, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType mappedLazyAssociationDerived = userViewRelations.stream().filter(r -> r.getName().equals("mappedLazyAssociationDerived")).findFirst().orElseThrow(); + assertRelationType(mappedLazyAssociationDerived, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType mappedLazyAssociationCollectionDerived = userViewRelations.stream().filter(r -> r.getName().equals("mappedLazyAssociationCollectionDerived")).findFirst().orElseThrow(); + assertRelationType(mappedLazyAssociationCollectionDerived, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH + )); + + RelationType lazyAssociationWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationWithChoicesAndDefault")).findFirst().orElseThrow(); + assertRelationType(lazyAssociationWithChoicesAndDefault, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH, + RelationBehaviourType.RANGE, + RelationBehaviourType.TEMPLATE, + RelationBehaviourType.CREATE, + RelationBehaviourType.VALIDATE_CREATE + )); + + RelationType lazyAssociationCollectionWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationCollectionWithChoicesAndDefault")).findFirst().orElseThrow(); + assertRelationType(lazyAssociationCollectionWithChoicesAndDefault, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.STORED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH, + RelationBehaviourType.RANGE, + RelationBehaviourType.TEMPLATE, + RelationBehaviourType.CREATE, + RelationBehaviourType.VALIDATE_CREATE + )); + + RelationType lazyAssociationOppositeWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOppositeWithChoicesAndDefault")).findFirst().orElseThrow(); + assertRelationType(lazyAssociationOppositeWithChoicesAndDefault, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH, + RelationBehaviourType.RANGE + )); + + RelationType lazyAssociationOppositeCollectionWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOppositeCollectionWithChoicesAndDefault")).findFirst().orElseThrow(); + assertRelationType(lazyAssociationOppositeCollectionWithChoicesAndDefault, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.STORED, true, true, true, true, Set.of( + RelationBehaviourType.LIST, + RelationBehaviourType.REFRESH, + RelationBehaviourType.RANGE + )); + + // According to JSLUtils, transients are always aggregation regardless of what we model. + RelationType lazyTransientWithDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyTransientWithDefault")).findFirst().orElseThrow(); + assertRelationType(lazyTransientWithDefault, mappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of( + RelationBehaviourType.TEMPLATE + )); + + RelationType lazyTransientCollectionWithDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyTransientCollectionWithDefault")).findFirst().orElseThrow(); + assertRelationType(lazyTransientCollectionWithDefault, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of( + RelationBehaviourType.TEMPLATE + )); + } + + static class AttributeAssertion { + private final String fqPrefix; + + AttributeAssertion(String fqPrefix) { + this.fqPrefix = fqPrefix; + } + + public void assertAttributeType(AttributeType attributeType, String name, String typeName, MemberType memberType, boolean isRequired, boolean isFilterable, boolean isReadonly) { + assertEquals(name, attributeType.getName()); + assertEquals(fqPrefix + name, attributeType.getFQName()); + assertEquals(typeName, attributeType.getDataType().getName()); + assertEquals(memberType, attributeType.getMemberType()); + assertEquals(isRequired, attributeType.isIsRequired()); + assertEquals(isFilterable, attributeType.isIsFilterable()); + assertEquals(isReadonly,attributeType.isIsReadOnly()); + } + } + + static void assertRelationType(RelationType relationType, ClassType target, RelationKind relationKind, MemberType memberType, boolean isCollection, boolean isOptional, boolean isOrderable, boolean isFilterable, Set behaviourTypes) { + assertEquals(isCollection, relationType.isIsCollection()); + assertEquals(isOptional, relationType.isIsOptional()); + assertEquals(target, relationType.getTarget()); + assertEquals(memberType, relationType.getMemberType()); + assertEquals(relationKind, relationType.getRelationKind()); + assertEquals(behaviourTypes, new HashSet<>(relationType.getBehaviours())); + assertEquals(isOrderable, relationType.isIsOrderable()); + assertEquals(isFilterable, relationType.isIsFilterable()); + } } From 39da0a429400e5b582980d265b4e9f5472842558 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 19 Sep 2024 16:19:02 +0200 Subject: [PATCH 05/21] update tests --- .../modules/application/actorDeclaration.etl | 2 +- .../modules/structure/transferDeclaration.etl | 2 +- .../JslModel2UiApplicationTest.java | 22 +- .../application/JslModel2UiDataTest.java | 246 +++++++++--------- .../jsl2ui/application/JslModel2UiTest.java | 6 +- 5 files changed, 141 insertions(+), 137 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl index ce0adc24..fa15b52b 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/application/actorDeclaration.etl @@ -4,7 +4,7 @@ rule Actor guard: s = actorDeclaration t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/Actor"); - t.name = s.getFqName() + "::ClassType"; + t.name = s.getFqName(); t.simpleName = s.name; //t.setPackageNameTokens(s); t.packageNameTokens.add(0, defaultModelName); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferDeclaration.etl index 847ac910..a9107fa7 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferDeclaration.etl @@ -6,7 +6,7 @@ rule ClassType t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ClassType"); - t.name = s.getFqName() + "::ClassType"; + t.name = s.getFqName(); t.transferObjectTypeName = s.name; t.simpleName = s.name; //t.setPackageNameTokens(s); diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java index 4d779493..ad319950 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java @@ -75,7 +75,7 @@ menu AppMenu(AppActor a) { ClassType actor = app1.getActor(); - assertEquals("ApplicationTestModel::AppActor::ClassType", actor.getName()); + assertEquals("ApplicationTestModel::AppActor", actor.getName()); assertEquals("AppActor", actor.getSimpleName()); assertTrue(actor.isIsActor()); @@ -301,7 +301,7 @@ menu App2(Actor2 a) { ClassType actor = app1.getActor(); - assertEquals("MultipleActorsTestModel::Actor1::ClassType", actor.getName()); + assertEquals("MultipleActorsTestModel::Actor1", actor.getName()); assertEquals("Actor1", actor.getSimpleName()); assertTrue(actor.isIsActor()); @@ -314,7 +314,7 @@ menu App2(Actor2 a) { ClassType actor2 = app2.getActor(); - assertEquals("MultipleActorsTestModel::Actor2::ClassType", actor2.getName()); + assertEquals("MultipleActorsTestModel::Actor2", actor2.getName()); assertEquals("Actor2", actor2.getSimpleName()); assertTrue(actor2.isIsActor()); @@ -363,12 +363,12 @@ menu App2(Actor2 a) { Set relations1Names = relationTypes.stream().map(c -> c.getFQName()).collect(Collectors.toSet()); assertEquals(Set.of( - "MultipleActorsTestModel::ProductTransfer::ClassType", - "MultipleActorsTestModel::Actor1::ClassType" + "MultipleActorsTestModel::ProductTransfer", + "MultipleActorsTestModel::Actor1" ), class1Names); assertEquals(Set.of( - "Actor1::MultipleActorsTestModel::Actor1::ClassType::products" + "Actor1::MultipleActorsTestModel::Actor1::products" ), relations1Names); List dataTypes1 = app1.getDataTypes(); @@ -394,12 +394,12 @@ menu App2(Actor2 a) { Set relations2Names = relationsTypes2.stream().map(c -> c.getFQName()).collect(Collectors.toSet()); assertEquals(Set.of( - "MultipleActorsTestModel::Product2Transfer::ClassType", - "MultipleActorsTestModel::Actor2::ClassType" + "MultipleActorsTestModel::Product2Transfer", + "MultipleActorsTestModel::Actor2" ), class2Names); assertEquals(Set.of( - "Actor2::MultipleActorsTestModel::Actor2::ClassType::products2" + "Actor2::MultipleActorsTestModel::Actor2::products2" ), relations2Names); // Pages @@ -463,7 +463,7 @@ menu ActorApp(Actor usr) { ClassType actor = apps.get(0).getActor(); assertNotNull(actor); - assertEquals("SecurityTestModel::Actor::ClassType", actor.getName()); + assertEquals("SecurityTestModel::Actor", actor.getName()); assertEquals("Actor", actor.getSimpleName()); // Principal @@ -471,7 +471,7 @@ menu ActorApp(Actor usr) { ClassType principal = apps.get(0).getPrincipal(); assertNotNull(principal); - assertEquals("SecurityTestModel::UserTransfer::ClassType", principal.getName()); + assertEquals("SecurityTestModel::UserTransfer", principal.getName()); assertEquals("UserTransfer", principal.getSimpleName()); assertTrue(principal.isIsPrincipal()); diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java index a390a05e..883fd016 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiDataTest.java @@ -2,6 +2,7 @@ import hu.blackbelt.judo.meta.jsl.runtime.JslParser; import hu.blackbelt.judo.meta.ui.Application; +import hu.blackbelt.judo.meta.ui.NamedElement; import hu.blackbelt.judo.meta.ui.data.*; import hu.blackbelt.judo.tatami.jsl.jsl2ui.AbstractTest; import lombok.extern.slf4j.Slf4j; @@ -184,9 +185,9 @@ menu ActorApp(Actor a) {} // Attributes - AttributeAssertion asserter = new AttributeAssertion("Actor::BasicDataTestModel::UserTransfer::ClassType::"); + AttributeAssertion asserter = new AttributeAssertion("Actor::BasicDataTestModel::UserTransfer::"); - ClassType userTransfer = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataTestModel::UserTransfer::ClassType")).findFirst().orElseThrow(); + ClassType userTransfer = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataTestModel::UserTransfer")).findFirst().orElseThrow(); assertNotNull(userTransfer); assertEquals(23, userTransfer.getAttributes().size()); @@ -314,16 +315,16 @@ menu TestApp(Actor1 a) { Application app = apps.get(0); assertEquals(Set.of( - "Actor1::BasicDataCrossTransfersTestModel::Actor1::ClassType", - "Actor1::BasicDataCrossTransfersTestModel::Transfer1::ClassType", - "Actor1::BasicDataCrossTransfersTestModel::Transfer2::ClassType" + "Actor1::BasicDataCrossTransfersTestModel::Actor1", + "Actor1::BasicDataCrossTransfersTestModel::Transfer1", + "Actor1::BasicDataCrossTransfersTestModel::Transfer2" ), app.getClassTypes().stream().map(c -> ((ClassType) c).getFQName()).collect(Collectors.toSet())); - ClassType transfer1Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer1::ClassType")).findFirst().orElseThrow(); + ClassType transfer1Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer1")).findFirst().orElseThrow(); assertNotNull(transfer1Row); assertEquals(2, transfer1Row.getAttributes().size()); - AttributeAssertion tr1Asserter = new AttributeAssertion("Actor1::BasicDataCrossTransfersTestModel::Transfer1::ClassType::"); + AttributeAssertion tr1Asserter = new AttributeAssertion("Actor1::BasicDataCrossTransfersTestModel::Transfer1::"); AttributeType string = transfer1Row.getAttributes().stream().filter(a -> a.getName().equals("string")).findFirst().orElseThrow(); tr1Asserter.assertAttributeType(string, "string", "String", MemberType.DERIVED, false, true, true); @@ -331,11 +332,11 @@ menu TestApp(Actor1 a) { AttributeType booleanAttr = transfer1Row.getAttributes().stream().filter(a -> a.getName().equals("boolean")).findFirst().orElseThrow(); tr1Asserter.assertAttributeType(booleanAttr, "boolean", "Boolean", MemberType.DERIVED, false, true, true); - ClassType transfer2Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer2::ClassType")).findFirst().orElseThrow(); + ClassType transfer2Row = (ClassType) app.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("BasicDataCrossTransfersTestModel::Transfer2")).findFirst().orElseThrow(); assertNotNull(transfer2Row); assertEquals(1, transfer2Row.getAttributes().size()); - AttributeAssertion tr2Asserter = new AttributeAssertion("Actor1::BasicDataCrossTransfersTestModel::Transfer2::ClassType::"); + AttributeAssertion tr2Asserter = new AttributeAssertion("Actor1::BasicDataCrossTransfersTestModel::Transfer2::"); AttributeType integer = transfer2Row.getAttributes().stream().filter(a -> a.getName().equals("integer")).findFirst().orElseThrow(); tr2Asserter.assertAttributeType(integer, "integer", "Integer", MemberType.DERIVED, false, true, true); @@ -372,8 +373,8 @@ transfer UserTransfer(User u) { relation EntityRelatedTransfer association <= u.association create:true update:true delete:true; relation EntityRelatedTransfer[] associationCollection <= u.associationCollection create:true update:true delete:true; - relation EntityRelatedTransfer eagerAssociation <= u.association create:true update:true delete:true eager:true; - relation EntityRelatedTransfer[] eagerAssociationCollection <= u.associationCollection create:true update:true delete:true eager:true; + relation EntityRelatedTransfer eagerAssociation <= u.association eager:true; + relation EntityRelatedTransfer[] eagerAssociationCollection <= u.associationCollection eager:true; relation EntityRelatedTransfer userRelatedOpposite <= u.userRelatedOpposite create:true update:true delete:true; relation EntityRelatedTransfer containment <= u.containment; @@ -471,182 +472,185 @@ menu TestApp(Actor a) { Application app1 = apps.get(0); - assertEquals(7, app1.getClassTypes().size()); - assertEquals(26, app1.getRelationTypes().size()); - - RelationType users = (RelationType) app1.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("users")).findFirst().orElseThrow(); - - ClassType userTransfer = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserTransfer::ClassType")).findFirst().orElseThrow(); - ClassType userView = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserView::ClassType")).findFirst().orElseThrow(); - ClassType mappedRelated = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::MappedRelated::ClassType")).findFirst().orElseThrow(); - ClassType mappedRelatedRow = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::MappedRelatedRow::ClassType")).findFirst().orElseThrow(); - ClassType unmappedRelated = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UnmappedRelated::ClassType")).findFirst().orElseThrow(); - ClassType unmappedRelatedRow = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UnmappedRelatedTable::ClassType")).findFirst().orElseThrow(); - - assertEquals(userView, users.getTarget()); + assertEquals(Set.of( + "Actor::RelationsTestModel::UserTransfer", + "Actor::RelationsTestModel::EntityRelatedTransfer", + "Actor::RelationsTestModel::Actor" + ), app1.getClassTypes().stream().map(c -> ((ClassType) c).getFQName()).collect(Collectors.toSet())); - List userViewRelations = userView.getRelations(); + assertEquals(Set.of( + "Actor::RelationsTestModel::Actor::user", + "Actor::RelationsTestModel::UserTransfer::derivedLazyCollectionStaticEager", + "Actor::RelationsTestModel::UserTransfer::lazyTransientWithDefault", + "Actor::RelationsTestModel::UserTransfer::derivedEagerContainment", + "Actor::RelationsTestModel::UserTransfer::derivedLazyCollectionStatic", + "Actor::RelationsTestModel::UserTransfer::associationCollection", + "Actor::RelationsTestModel::UserTransfer::containmentCollection", + "Actor::RelationsTestModel::UserTransfer::lazyTransientCollectionWithDefault", + "Actor::RelationsTestModel::UserTransfer::userRelatedOpposite", + "Actor::RelationsTestModel::UserTransfer::containment", + "Actor::RelationsTestModel::UserTransfer::eagerAssociation", + "Actor::RelationsTestModel::UserTransfer::association", + "Actor::RelationsTestModel::UserTransfer::derivedLazyStaticEager", + "Actor::RelationsTestModel::UserTransfer::unmappedRequired", + "Actor::RelationsTestModel::UserTransfer::derivedContainment", + "Actor::RelationsTestModel::UserTransfer::derivedContainmentCollection", + "Actor::RelationsTestModel::UserTransfer::eagerAssociationCollection", + "Actor::RelationsTestModel::UserTransfer::unmappedCollection", + "Actor::RelationsTestModel::UserTransfer::derivedLazyStatic", + "Actor::RelationsTestModel::UserTransfer::unmapped", + "Actor::RelationsTestModel::UserTransfer::derivedEagerContainmentCollection" + ), app1.getRelationTypes().stream().map(c -> ((RelationType) c).getFQName()).collect(Collectors.toSet())); + + RelationType user = (RelationType) app1.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("user")).findFirst().orElseThrow(); + + ClassType actorTransfer = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::Actor")).findFirst().orElseThrow(); + ClassType userTransfer = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::UserTransfer")).findFirst().orElseThrow(); + ClassType entityRelatedTransfer = (ClassType) app1.getClassTypes().stream().filter(c -> ((ClassType) c).getName().equals("RelationsTestModel::EntityRelatedTransfer")).findFirst().orElseThrow(); + + assertEquals(userTransfer, user.getTarget()); + + List userViewRelations = userTransfer.getRelations(); - assertEquals(25, userViewRelations.size()); + assertEquals(Set.of( + "Actor::RelationsTestModel::UserTransfer::derivedContainmentCollection", + "Actor::RelationsTestModel::UserTransfer::containment", + "Actor::RelationsTestModel::UserTransfer::derivedLazyStatic", + "Actor::RelationsTestModel::UserTransfer::derivedEagerContainment", + "Actor::RelationsTestModel::UserTransfer::association", + "Actor::RelationsTestModel::UserTransfer::eagerAssociation", + "Actor::RelationsTestModel::UserTransfer::unmappedRequired", + "Actor::RelationsTestModel::UserTransfer::unmapped", + "Actor::RelationsTestModel::UserTransfer::derivedLazyCollectionStaticEager", + "Actor::RelationsTestModel::UserTransfer::derivedEagerContainmentCollection", + "Actor::RelationsTestModel::UserTransfer::derivedLazyStaticEager", + "Actor::RelationsTestModel::UserTransfer::lazyTransientWithDefault", + "Actor::RelationsTestModel::UserTransfer::unmappedCollection", + "Actor::RelationsTestModel::UserTransfer::userRelatedOpposite", + "Actor::RelationsTestModel::UserTransfer::associationCollection", + "Actor::RelationsTestModel::UserTransfer::containmentCollection", + "Actor::RelationsTestModel::UserTransfer::derivedLazyCollectionStatic", + "Actor::RelationsTestModel::UserTransfer::lazyTransientCollectionWithDefault", + "Actor::RelationsTestModel::UserTransfer::eagerAssociationCollection", + "Actor::RelationsTestModel::UserTransfer::derivedContainment" + ), userTransfer.getRelations().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); // According to JSLUtils, transients are always aggregation regardless of what we model. - RelationType unmappedLazy = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazy")).findFirst().orElseThrow(); - assertRelationType(unmappedLazy, unmappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of()); + RelationType unmapped = userViewRelations.stream().filter(r -> r.getName().equals("unmapped")).findFirst().orElseThrow(); + assertRelationType(unmapped, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of(RelationBehaviourType.TEMPLATE)); - RelationType unmappedLazyRequired = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazyRequired")).findFirst().orElseThrow(); - assertRelationType(unmappedLazyRequired, unmappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, false, false, false, Set.of()); + RelationType unmappedRequired = userViewRelations.stream().filter(r -> r.getName().equals("unmappedRequired")).findFirst().orElseThrow(); + assertRelationType(unmappedRequired, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, false, false, false, Set.of(RelationBehaviourType.TEMPLATE)); - RelationType unmappedLazyCollection = userViewRelations.stream().filter(r -> r.getName().equals("unmappedLazyCollection")).findFirst().orElseThrow(); - assertRelationType(unmappedLazyCollection, unmappedRelatedRow, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of()); + RelationType unmappedCollection = userViewRelations.stream().filter(r -> r.getName().equals("unmappedCollection")).findFirst().orElseThrow(); + assertRelationType(unmappedCollection, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of(RelationBehaviourType.TEMPLATE)); - RelationType lazyAssociation = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociation")).findFirst().orElseThrow(); - assertRelationType(lazyAssociation, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationType association = userViewRelations.stream().filter(r -> r.getName().equals("association")).findFirst().orElseThrow(); + assertRelationType(association, entityRelatedTransfer, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationBehaviourType.TEMPLATE, RelationBehaviourType.VALIDATE_CREATE, RelationBehaviourType.CREATE, RelationBehaviourType.VALIDATE_UPDATE, RelationBehaviourType.UPDATE, RelationBehaviourType.DELETE, RelationBehaviourType.REFRESH, - RelationBehaviourType.LIST + RelationBehaviourType.LIST, + RelationBehaviourType.SET, + RelationBehaviourType.UNSET )); - RelationType lazyAssociationOpposite = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOpposite")).findFirst().orElseThrow(); - assertRelationType(lazyAssociationOpposite, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationType userRelatedOpposite = userViewRelations.stream().filter(r -> r.getName().equals("userRelatedOpposite")).findFirst().orElseThrow(); + assertRelationType(userRelatedOpposite, entityRelatedTransfer, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationBehaviourType.TEMPLATE, RelationBehaviourType.VALIDATE_CREATE, RelationBehaviourType.CREATE, RelationBehaviourType.VALIDATE_UPDATE, RelationBehaviourType.UPDATE, RelationBehaviourType.DELETE, RelationBehaviourType.REFRESH, - RelationBehaviourType.LIST + RelationBehaviourType.LIST, + RelationBehaviourType.SET, + RelationBehaviourType.UNSET )); - RelationType derivedLazyContainment = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyContainment")).findFirst().orElseThrow(); - assertRelationType(derivedLazyContainment, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationType containment = userViewRelations.stream().filter(r -> r.getName().equals("containment")).findFirst().orElseThrow(); + assertRelationType(containment, entityRelatedTransfer, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH + RelationBehaviourType.REFRESH, + RelationBehaviourType.TEMPLATE )); - RelationType derivedLazyContainmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyContainmentCollection")).findFirst().orElseThrow(); - assertRelationType(derivedLazyContainmentCollection, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationType containmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("containmentCollection")).findFirst().orElseThrow(); + assertRelationType(containmentCollection, entityRelatedTransfer, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH + RelationBehaviourType.REFRESH, + RelationBehaviourType.TEMPLATE )); RelationType derivedEagerContainment = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerContainment")).findFirst().orElseThrow(); - assertRelationType(derivedEagerContainment, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( + assertRelationType(derivedEagerContainment, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH + RelationBehaviourType.REFRESH, + RelationBehaviourType.TEMPLATE )); RelationType derivedEagerContainmentCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerContainmentCollection")).findFirst().orElseThrow(); - assertRelationType(derivedEagerContainmentCollection, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType derivedLazyAssociation = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyAssociation")).findFirst().orElseThrow(); - assertRelationType(derivedLazyAssociation, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType derivedLazyAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyAssociationCollection")).findFirst().orElseThrow(); - assertRelationType(derivedLazyAssociationCollection, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( + assertRelationType(derivedEagerContainmentCollection, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH + RelationBehaviourType.REFRESH, + RelationBehaviourType.TEMPLATE )); - RelationType derivedEagerAssociation = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerAssociation")).findFirst().orElseThrow(); - assertRelationType(derivedEagerAssociation, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( + RelationType eagerAssociation = userViewRelations.stream().filter(r -> r.getName().equals("eagerAssociation")).findFirst().orElseThrow(); + assertRelationType(eagerAssociation, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH + RelationBehaviourType.REFRESH, + RelationBehaviourType.TEMPLATE )); - RelationType derivedEagerAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerAssociationCollection")).findFirst().orElseThrow(); - assertRelationType(derivedEagerAssociationCollection, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( + RelationType eagerAssociationCollection = userViewRelations.stream().filter(r -> r.getName().equals("eagerAssociationCollection")).findFirst().orElseThrow(); + assertRelationType(eagerAssociationCollection, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH + RelationBehaviourType.REFRESH, + RelationBehaviourType.TEMPLATE )); RelationType derivedLazyStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyStatic")).findFirst().orElseThrow(); - assertRelationType(derivedLazyStatic, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType derivedLazyCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyCollectionStatic")).findFirst().orElseThrow(); - assertRelationType(derivedLazyCollectionStatic, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType derivedEagerStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerStatic")).findFirst().orElseThrow(); - assertRelationType(derivedEagerStatic, mappedRelated, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType derivedEagerCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedEagerCollectionStatic")).findFirst().orElseThrow(); - assertRelationType(derivedEagerCollectionStatic, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType mappedLazyAssociationDerived = userViewRelations.stream().filter(r -> r.getName().equals("mappedLazyAssociationDerived")).findFirst().orElseThrow(); - assertRelationType(mappedLazyAssociationDerived, mappedRelated, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType mappedLazyAssociationCollectionDerived = userViewRelations.stream().filter(r -> r.getName().equals("mappedLazyAssociationCollectionDerived")).findFirst().orElseThrow(); - assertRelationType(mappedLazyAssociationCollectionDerived, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( - RelationBehaviourType.LIST, - RelationBehaviourType.REFRESH - )); - - RelationType lazyAssociationWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationWithChoicesAndDefault")).findFirst().orElseThrow(); - assertRelationType(lazyAssociationWithChoicesAndDefault, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + assertRelationType(derivedLazyStatic, entityRelatedTransfer, RelationKind.ASSOCIATION, MemberType.DERIVED, false, true, true, true, Set.of( RelationBehaviourType.LIST, RelationBehaviourType.REFRESH, - RelationBehaviourType.RANGE, - RelationBehaviourType.TEMPLATE, - RelationBehaviourType.CREATE, - RelationBehaviourType.VALIDATE_CREATE + RelationBehaviourType.TEMPLATE )); - RelationType lazyAssociationCollectionWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationCollectionWithChoicesAndDefault")).findFirst().orElseThrow(); - assertRelationType(lazyAssociationCollectionWithChoicesAndDefault, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.STORED, true, true, true, true, Set.of( + RelationType derivedLazyCollectionStatic = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyCollectionStatic")).findFirst().orElseThrow(); + assertRelationType(derivedLazyCollectionStatic, entityRelatedTransfer, RelationKind.ASSOCIATION, MemberType.DERIVED, true, true, true, true, Set.of( RelationBehaviourType.LIST, RelationBehaviourType.REFRESH, - RelationBehaviourType.RANGE, - RelationBehaviourType.TEMPLATE, - RelationBehaviourType.CREATE, - RelationBehaviourType.VALIDATE_CREATE + RelationBehaviourType.TEMPLATE )); - RelationType lazyAssociationOppositeWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOppositeWithChoicesAndDefault")).findFirst().orElseThrow(); - assertRelationType(lazyAssociationOppositeWithChoicesAndDefault, mappedRelated, RelationKind.ASSOCIATION, MemberType.STORED, false, true, true, true, Set.of( + RelationType derivedLazyStaticEager = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyStaticEager")).findFirst().orElseThrow(); + assertRelationType(derivedLazyStaticEager, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.DERIVED, false, true, true, true, Set.of( RelationBehaviourType.LIST, RelationBehaviourType.REFRESH, - RelationBehaviourType.RANGE + RelationBehaviourType.TEMPLATE )); - RelationType lazyAssociationOppositeCollectionWithChoicesAndDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyAssociationOppositeCollectionWithChoicesAndDefault")).findFirst().orElseThrow(); - assertRelationType(lazyAssociationOppositeCollectionWithChoicesAndDefault, mappedRelatedRow, RelationKind.ASSOCIATION, MemberType.STORED, true, true, true, true, Set.of( + RelationType derivedLazyCollectionStaticEager = userViewRelations.stream().filter(r -> r.getName().equals("derivedLazyCollectionStaticEager")).findFirst().orElseThrow(); + assertRelationType(derivedLazyCollectionStaticEager, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.DERIVED, true, true, true, true, Set.of( RelationBehaviourType.LIST, RelationBehaviourType.REFRESH, - RelationBehaviourType.RANGE + RelationBehaviourType.TEMPLATE )); // According to JSLUtils, transients are always aggregation regardless of what we model. RelationType lazyTransientWithDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyTransientWithDefault")).findFirst().orElseThrow(); - assertRelationType(lazyTransientWithDefault, mappedRelated, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of( + assertRelationType(lazyTransientWithDefault, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.TRANSIENT, false, true, false, false, Set.of( RelationBehaviourType.TEMPLATE )); RelationType lazyTransientCollectionWithDefault = userViewRelations.stream().filter(r -> r.getName().equals("lazyTransientCollectionWithDefault")).findFirst().orElseThrow(); - assertRelationType(lazyTransientCollectionWithDefault, mappedRelatedRow, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of( + assertRelationType(lazyTransientCollectionWithDefault, entityRelatedTransfer, RelationKind.AGGREGATION, MemberType.TRANSIENT, true, true, false, false, Set.of( RelationBehaviourType.TEMPLATE )); } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java index f341d676..61f7fb82 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiTest.java @@ -132,9 +132,9 @@ menu CarApp(UserActor usr) { ), relationTypes.stream().map(NamedElement::getName).collect(Collectors.toSet())); assertEquals(Set.of( - "Car::CarTransfer::ClassType", - "Car::UserActor::ClassType", - "Car::UserTransfer::ClassType" + "Car::CarTransfer", + "Car::UserActor", + "Car::UserTransfer" ), classTypes.stream().map(NamedElement::getName).collect(Collectors.toSet())); assertEquals(Set.of( From b0ec75e89896fee738f323bbf553f97c795a88f4 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 19 Sep 2024 20:24:56 +0200 Subject: [PATCH 06/21] save state --- .../operations/jsl/ui/viewDeclaration.eol | 10 + .../ui/modules/view/menuLinkDeclaration.etl | 81 ++- .../ui/modules/view/menuTableDeclaration.etl | 2 +- .../view/rowDeclarationAddSelector.etl | 8 +- .../ui/modules/view/viewLinkDeclaration.etl | 165 +++--- .../ui/modules/view/viewTableDeclaration.etl | 188 +++---- .../application/JslModel2UiWidgetsTest.java | 487 +++++++++--------- 7 files changed, 494 insertions(+), 447 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol index 9e8642cd..ded8ff3d 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol @@ -41,3 +41,13 @@ operation JSL!UIViewDeclaration getExposedVisualElements(): Set { return ves; } + +@cached +operation JSL!UIViewDeclaration getAllLinks(): Set { + return self.getExposedVisualElements().select(v | v.isKindOf(JSL!UIViewLinkDeclaration)).asSet(); +} + +@cached +operation JSL!UIViewDeclaration getAllTables(): Set { + return self.getExposedVisualElements().select(v | v.isKindOf(JSL!UIViewTableDeclaration)).asSet(); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl index 7b74ad35..9cb42a81 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -45,75 +45,74 @@ rule AccessViewPageDefinition t.dataElement = relation.equivalent("RelationType"); - // var relations = s.referenceType.getDirectRelations(); - /* log.info("==================="); log.info(t.name + ":"); log.info(relations.collect(r | r.name).concat(", ")); log.info("==================="); */ -/* - for (link in relations.select(r | r.isKindOf(JSL!ViewLinkDeclaration))) { + + for (link in s.referenceType.getAllLinks()) { + var lRelation = link.transferRelation.target; + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "AccessPageDefinition")); - if (link.isRefreshAllowed() and not link.isEager()) { + if (lRelation.isRefreshAllowed() and not lRelation.isEager()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "AccessPageDefinition")); } - if (link.isCreateAllowed()) { + if (lRelation.isCreateAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "AccessPageDefinition")); } - if (link.isDeleteAllowed()) { + if (lRelation.isDeleteAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "AccessPageDefinition")); } - if (link.isSetReferenceAllowed()) { + if (lRelation.isSetReferenceAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "AccessPageDefinition")); } - if (link.isUnsetReferenceAllowed()) { + if (lRelation.isUnsetReferenceAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "AccessPageDefinition")); } } - for (table in relations.select(r | r.isKindOf(JSL!ViewTableDeclaration))) { + for (table in s.referenceType.getAllTables()) { + var tRelation = table.transferRelation.target; + /* var detailLink = table.getDetailLink(); if (detailLink.isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "AccessPageDefinition")); } - if (table.isFilterSupported()) { + */ + if (tRelation.isFilterSupported()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "AccessPageDefinition")); } - if (table.isRefreshAllowed()) { + if (tRelation.isRefreshAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "AccessPageDefinition")); } - if (table.isCreateAllowed()) { + if (tRelation.isCreateAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "AccessPageDefinition")); } - if (table.isDeleteAllowed()) { + if (tRelation.isDeleteAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "AccessPageDefinition")); } - if (table.isAddReferenceAllowed()) { + if (tRelation.isAddReferenceAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "AccessPageDefinition")); } - if (table.isRemoveReferenceAllowed()) { + if (tRelation.isRemoveReferenceAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "AccessPageDefinition")); t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "AccessPageDefinition")); } } -*/ -/* + t.actions.add(s.equivalent("AccessViewBackAction")); if (relation.isRefreshAllowed()) { t.actions.add(s.equivalent("AccessViewRefreshAction")); } -*/ - /* if (relation.isUpdateAllowed()) { - t.actions.add(s.equivalent("ViewLinkPageDefinitionUpdateAction")); + t.actions.add(s.equivalent("AccessViewUpdateAction")); } if (relation.isDeleteAllowed()) { - t.actions.add(s.equivalent("ViewLinkPageDefinitionDeleteAction")); + t.actions.add(s.equivalent("AccessViewDeleteAction")); } - */ log.debug("Create AccessViewPageDefinition: " + t.name); } @@ -128,3 +127,39 @@ rule AccessViewBackAction log.debug("AccessTableBackAction: " + t.name); } + +@lazy +rule AccessViewRefreshAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); + t.name = s.getFqName() + "::Refresh"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerRefreshActionDefinition"); + + log.debug("AccessViewRefreshAction: " + t.name); +} + +@lazy +rule AccessViewUpdateAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewUpdateAction"); + t.name = s.getFqName() + "::Update"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerUpdateActionDefinition"); + + log.debug("AccessViewUpdateAction: " + t.name); +} + +@lazy +rule AccessViewDeleteAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewDeleteAction"); + t.name = s.getFqName() + "::Delete"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerDeleteActionDefinition"); + + log.debug("AccessViewDeleteAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index ad9c3c64..6b4f78eb 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -73,7 +73,7 @@ rule AccessTableBackAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableBackAction"); t.name = s.name + "::Back"; - t.actionDefinition = s.referenceType.equivalent("AccessTablePageContainerBackActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TablePageContainerBackActionDefinition"); log.debug("AccessTableBackAction: " + t.name); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl index 43cd17c0..c1ae94fe 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl @@ -150,14 +150,14 @@ rule TableAddSelectorTableTable // TODO eventually selector should work? var rowDeclaration = s.referenceType; - var primitiveFields = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowFieldDeclaration) and m.referenceType.`primitive`.isDefined()); - // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + var primitiveFields = s.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); + // var links = s.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); for (field in primitiveFields) { - var col = field.equivalentDiscriminated("TablePrimitiveColumn", id); + var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } /* diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl index af7177ba..af977e13 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl @@ -1,18 +1,17 @@ rule ViewLinkPageDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::PageDefinition { - guard: actorDeclaration.getAllRelations().contains(s) - - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinition"); + guard: rootMenu.containsVisualElement(s) + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinition"); t.name = s.getFqName() + "::ViewPage"; - t.container = s.referenceType.equivalent("TransferDeclarationPageContainer"); + t.container = s.referenceType.equivalent("ViewPageContainer"); - actorDeclaration.equivalent("Application").pages.add(t); + rootMenu.equivalent("Application").pages.add(t); t.dataElement = s.equivalent("RelationType"); - var relations = s.referenceType.getDirectRelations(); + var relations = s.referenceType.map.transfer.getDirectRelations(); /* log.info("==================="); @@ -67,7 +66,7 @@ rule ViewLinkPageDefinition t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "ViewLinkPageDefinition")); } } - +/* t.actions.add(s.equivalent("ViewLinkPageDefinitionBackAction")); if (s.isRefreshAllowed()) { t.actions.add(s.equivalent("ViewLinkPageDefinitionRefreshAction")); @@ -78,7 +77,7 @@ rule ViewLinkPageDefinition if (s.isDeleteAllowed()) { t.actions.add(s.equivalent("ViewLinkPageDefinitionDeleteAction")); } - +*/ log.debug("Create ViewLinkPageDefinition: " + t.name); } @@ -87,9 +86,9 @@ rule ViewLinkPageDefinition rule ViewLinkPageDefinitionRefreshAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - guard: actorDeclaration.getAllRelations().contains(s) + guard: rootMenu.containsVisualElement(s) - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionRefreshAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionRefreshAction"); t.name = s.name + "::Refresh"; t.actionDefinition = s.referenceType.equivalent("TransferDeclarationRefreshActionDefinition"); @@ -101,9 +100,9 @@ rule ViewLinkPageDefinitionRefreshAction rule ViewLinkPageDefinitionBackAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - guard: actorDeclaration.getAllRelations().contains(s) + guard: rootMenu.containsVisualElement(s) - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionBackAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionBackAction"); t.name = s.name + "::Back"; t.actionDefinition = s.referenceType.equivalent("TransferDeclarationBackActionDefinition"); @@ -115,7 +114,7 @@ rule ViewLinkPageDefinitionBackAction rule ViewLinkPageDefinitionUpdateAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionUpdateAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionUpdateAction"); t.name = s.name + "::Update"; t.actionDefinition = s.referenceType.equivalent("TransferDeclarationUpdateActionDefinition"); @@ -128,7 +127,7 @@ rule ViewLinkPageDefinitionUpdateAction rule ViewLinkPageDefinitionDeleteAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionDeleteAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionDeleteAction"); t.name = s.name + "::Delete"; t.actionDefinition = s.referenceType.equivalent("TransferDeclarationDeleteActionDefinition"); @@ -140,9 +139,9 @@ rule ViewLinkPageDefinitionDeleteAction rule ViewLinkCreateFormPageDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::PageDefinition { - guard: actorDeclaration.getAllRelations().contains(s) and s.isFormRelation() + guard: rootMenu.containsVisualElement(s) and s.referenceType.form.isDefined() and s.referenceType.form - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormPageDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormPageDefinition"); t.name = s.getFqName() + "::FormPage"; @@ -150,11 +149,11 @@ rule ViewLinkCreateFormPageDefinition var targetContainer = targetCreateEvent.parameterType; t.container = targetContainer.equivalent("TransferDeclarationPageContainer"); - actorDeclaration.equivalent("Application").pages.add(t); + rootMenu.equivalent("Application").pages.add(t); t.dataElement = s.equivalent("FormRelationType"); - // var relations = s.referenceType.getDirectRelations(); + var relations = s.referenceType.map.transfer.getDirectRelations(); /* log.info("==================="); @@ -162,7 +161,7 @@ rule ViewLinkCreateFormPageDefinition log.info(relations.collect(r | r.name).concat(", ")); log.info("==================="); */ - /* + for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); } @@ -174,7 +173,6 @@ rule ViewLinkCreateFormPageDefinition t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); } } - */ t.actions.add(s.equivalent("ViewLinkCreateFormBackAction")); t.actions.add(s.equivalent("ViewLinkCreateFormCreateAction")); @@ -187,7 +185,7 @@ rule ViewLinkCreateFormPageDefinition rule ViewLinkCreateFormCreateAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormCreateAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormCreateAction"); var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; @@ -203,7 +201,7 @@ rule ViewLinkCreateFormCreateAction rule ViewLinkCreateFormBackAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormBackAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormBackAction"); var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; @@ -218,7 +216,7 @@ rule ViewLinkCreateFormBackAction rule AbstractViewLinkDeclaration transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Link { - guard: actorDeclaration.getAllRelations().contains(s) + guard: rootMenu.containsVisualElement(s) t.name = s.name; t.relationName = s.name; @@ -229,12 +227,12 @@ rule AbstractViewLinkDeclaration t.row = 1d; t.col = s.width.isDefined() ? s.width.asReal() : 12d; t.~pos = s.~pos; - t.isEager = s.isEager(); + t.isEager = s.transferRelation.target.isEager(); if (t.~pos.isUndefined()) { t.~pos = 0; } - if (s.isEager()) { + if (t.isEager) { // TODO finish additional mas attributes /* for (dataFeature in s.additionalMaskFeatures) { @@ -252,7 +250,7 @@ rule LinkIcon to t: UI!ui::Icon { t.iconName = s.getIconModifier().value.value; t.name = s.name + "ViewLinkIcon"; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/LinkIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/LinkIcon"); } rule InlineViewLink @@ -261,9 +259,9 @@ rule InlineViewLink extends AbstractViewLinkDeclaration { guard: rootMenu.containsVisualElement(s) - var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewLink"; + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewLink"; t.setId(id); - t.dataElement = s.equivalent("RelationType"); + t.dataElement = s.transferRelation.target.equivalent("RelationType"); s.eContainer.uiContainer().children.add(t); @@ -281,7 +279,7 @@ rule InlineViewLink t.autocompleteSetActionDefinition = s.equivalent("TabularReferenceFieldLinkAutocompleteSetActionDefinition"); */ - if (s.isRefreshAllowed() and not s.isEager()) { + if (s.transferRelation.target.isRefreshAllowed() and not s.transferRelation.target.isEager()) { t.refreshActionDefinition = s.equivalent("ViewLinkDeclarationRefreshActionDefinition"); } @@ -292,7 +290,7 @@ rule InlineViewLink rule ViewLinkDeclarationRefreshActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::RefreshActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRefreshActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRefreshActionDefinition"); t.name = s.name + "::Refresh"; t.isContainedRelationAction = true; @@ -304,7 +302,7 @@ rule ViewLinkDeclarationRefreshActionDefinition rule ViewLinkDeclarationRefreshAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRefreshAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRefreshAction"); t.name = s.name + "::Refresh"; t.actionDefinition = s.equivalent("ViewLinkDeclarationRefreshActionDefinition"); @@ -315,22 +313,22 @@ rule ViewLinkDeclarationRefreshAction rule InlineViewLinkButtonGroup transform s: JSL!UIViewLinkDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewLinkButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewLinkButtonGroup"); t.name = s.name + "::Actions"; t.label = "Actions"; t.buttons.add(s.equivalent("ViewLinkDeclarationOpenPageButton")); - if (s.isCreateAllowed()) { + if (s.transferRelation.target.isCreateAllowed()) { t.buttons.add(s.equivalent("ViewLinkDeclarationOpenFormButton")); } - if (s.isDeleteAllowed()) { + if (s.transferRelation.target.isDeleteAllowed()) { t.buttons.add(s.equivalent("ViewLinkDeclarationDeleteButton")); } - if (s.isSetReferenceAllowed()) { + if (s.transferRelation.target.isSetReferenceAllowed()) { t.buttons.add(s.equivalent("ViewLinkDeclarationOpenSetSelectorButton")); } - if (s.isUnsetReferenceAllowed()) { + if (s.transferRelation.target.isUnsetReferenceAllowed()) { t.buttons.add(s.equivalent("ViewLinkDeclarationUnsetButton")); } @@ -341,9 +339,9 @@ rule InlineViewLinkButtonGroup rule ViewLinkDeclarationRepresentationColumn transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Column { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRepresentationColumn"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRepresentationColumn"); - var firstStringFromTarget = s.referenceType.getAllPrimitiveFields().selectOne(f | f.referenceType.isDefined() and f.referenceType.`primitive` == "string"); + var firstStringFromTarget = s.referenceType.map.transfer.getAllPrimitiveFields().selectOne(f | f.referenceType.isDefined() and f.referenceType.`primitive` == "string"); if (firstStringFromTarget.isUndefined()) { throw "Could not get string type field from relation target to use for representation: " + s.referenceType.name; @@ -364,7 +362,7 @@ rule ViewLinkDeclarationRepresentationColumn rule ViewLinkDeclarationOpenPageButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageButton"); t.name = s.name + "::View"; t.buttonStyle = "contained"; t.label = "View"; @@ -378,7 +376,7 @@ rule ViewLinkDeclarationOpenPageButton rule ViewLinkDeclarationOpenPageButtonIcon transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageButtonIcon"); t.iconName = "eye"; t.name = s.name + "OpenPageIcon"; @@ -389,7 +387,7 @@ rule ViewLinkDeclarationOpenPageButtonIcon rule ViewLinkDeclarationOpenPageActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::OpenPageActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageActionDefinition"); t.name = s.name + "::View"; t.isContainedRelationAction = true; t.targetType = s.referenceType.equivalent("ClassType"); @@ -402,7 +400,7 @@ rule ViewLinkDeclarationOpenPageActionDefinition rule ViewLinkDeclarationOpenPageAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageAction"); t.name = s.name + "::OpenPage"; t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenPageActionDefinition"); @@ -417,7 +415,7 @@ rule ViewLinkDeclarationOpenPageAction rule ViewLinkDeclarationOpenFormButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormButton"); t.name = s.name + "::Create::Open"; t.buttonStyle = "contained"; t.label = "Create"; @@ -431,7 +429,7 @@ rule ViewLinkDeclarationOpenFormButton rule ViewLinkDeclarationOpenFormButtonIcon transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormButtonIcon"); t.iconName = "note-add"; t.name = s.name + "OpenFormIcon"; @@ -442,17 +440,10 @@ rule ViewLinkDeclarationOpenFormButtonIcon rule ViewLinkDeclarationOpenCreateFormActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::OpenCreateFormActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenCreateFormActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenCreateFormActionDefinition"); t.name = s.name + "::OpenCreate"; t.isContainedRelationAction = true; - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - - if (targetCreateEvent.parameterType.isDefined() and targetCreateEvent.parameterType.isKindOf(JSL!TransferDeclaration)) { - t.targetType = targetCreateEvent.parameterType.equivalent("ClassType"); - } else { - t.targetType = s.referenceType.equivalent("ClassType"); - } + t.targetType = s.transferRelation.target.referenceType.equivalent("ClassType"); log.debug("ViewLinkDeclarationOpenCreateFormActionDefinition: " + t.name); } @@ -462,7 +453,7 @@ rule ViewLinkDeclarationOpenCreateFormActionDefinition rule ViewLinkDeclarationOpenFormAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormAction"); t.name = s.name + "::OpenForm"; t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenCreateFormActionDefinition"); @@ -476,7 +467,7 @@ rule ViewLinkDeclarationOpenFormAction rule ViewLinkDeclarationDeleteButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationDeleteButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationDeleteButton"); t.name = s.name + "::Delete"; t.buttonStyle = "contained"; t.label = "Delete"; @@ -490,7 +481,7 @@ rule ViewLinkDeclarationDeleteButton rule ViewLinkDeclarationDeleteButtonIcon transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationDeleteButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationDeleteButtonIcon"); t.iconName = "delete_forever"; t.name = s.name + "DeleteIcon"; @@ -501,7 +492,7 @@ rule ViewLinkDeclarationDeleteButtonIcon rule ViewLinkDeclarationRowDeleteActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::RowDeleteActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRowDeleteActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRowDeleteActionDefinition"); t.name = s.name + "::Delete"; t.isContainedRelationAction = true; t.targetType = s.referenceType.equivalent("ClassType"); @@ -514,7 +505,7 @@ rule ViewLinkDeclarationRowDeleteActionDefinition rule ViewLinkDeclarationRowDeleteAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRowDeleteAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRowDeleteAction"); t.name = s.name + "::RowDelete"; t.actionDefinition = s.equivalent("ViewLinkDeclarationRowDeleteActionDefinition"); @@ -526,7 +517,7 @@ rule ViewLinkDeclarationRowDeleteAction rule ViewLinkDeclarationUnsetButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetButton"); t.name = s.name + "::Unset"; t.label = "Unset"; t.buttonStyle = "contained"; @@ -540,7 +531,7 @@ rule ViewLinkDeclarationUnsetButton rule ViewLinkDeclarationUnsetActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::UnsetActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetActionDefinition"); t.name = s.name + "::Unset"; t.isContainedRelationAction = true; t.targetType = s.referenceType.equivalent("ClassType"); @@ -552,7 +543,7 @@ rule ViewLinkDeclarationUnsetActionDefinition rule ViewLinkDeclarationUnsetAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetAction"); t.name = s.name + "::Unset"; t.actionDefinition = s.equivalent("ViewLinkDeclarationUnsetActionDefinition"); @@ -563,7 +554,7 @@ rule ViewLinkDeclarationUnsetAction rule ViewLinkDeclarationOpenSetSelectorButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorButton"); t.name = s.name + "::OpenSetSelector"; t.label = "Set"; t.buttonStyle = "contained"; @@ -577,7 +568,7 @@ rule ViewLinkDeclarationOpenSetSelectorButton rule ViewLinkDeclarationOpenSetSelectorActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::OpenSetSelectorActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorActionDefinition"); t.name = s.name + "::OpenSetSelector"; t.isContainedRelationAction = true; t.selectorFor = s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); @@ -589,7 +580,7 @@ rule ViewLinkDeclarationOpenSetSelectorActionDefinition rule ViewLinkDeclarationOpenSetSelectorDialogAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorDialogAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorDialogAction"); t.name = s.name + "::OpenSetSelector"; t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenSetSelectorActionDefinition"); t.targetPageDefinition = s.equivalent("ViewLinkDeclarationSetSelectorPageDefinition"); @@ -601,7 +592,7 @@ rule ViewLinkDeclarationOpenSetSelectorDialogAction rule ViewLinkDeclarationSetSelectorPageDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::PageDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageDefinition"); t.name = s.getFqName() + "::SetSelectorPage"; t.container = s.equivalent("ViewLinkDeclarationSetSelectorPageContainer"); t.dataElement = s.equivalent("RelationType"); @@ -613,7 +604,7 @@ rule ViewLinkDeclarationSetSelectorPageDefinition t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorTableFilterAction")); t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorTableRangeAction")); - actorDeclaration.equivalent("Application").pages.add(t); + rootMenu.equivalent("Application").pages.add(t); log.debug("ViewLinkDeclarationSetSelectorPageDefinition: " + t.name); } @@ -622,7 +613,7 @@ rule ViewLinkDeclarationSetSelectorPageDefinition rule ViewLinkDeclarationSetSelectorSetAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetAction"); t.name = s.getFqName() + "::SetSelector::Set"; t.ownerDataElement = s.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); @@ -634,7 +625,7 @@ rule ViewLinkDeclarationSetSelectorSetAction rule ViewLinkDeclarationSetSelectorBackAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackAction"); t.name = s.getFqName() + "::SetSelector::Back"; t.ownerDataElement = s.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorBackActionDefinition"); @@ -646,7 +637,7 @@ rule ViewLinkDeclarationSetSelectorBackAction rule ViewLinkDeclarationSetSelectorTableFilterAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterAction"); t.name = s.getFqName() + "::SetSelector::Table::Filter"; t.ownerDataElement = s.equivalent("RelationType"); t.targetDataElement = s.equivalent("RelationType"); @@ -659,7 +650,7 @@ rule ViewLinkDeclarationSetSelectorTableFilterAction rule ViewLinkDeclarationSetSelectorTableRangeAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeAction"); t.name = s.getFqName() + "::SetSelector::Table::Range"; t.ownerDataElement = s.equivalent("RelationType"); t.targetDataElement = s.equivalent("RelationType"); @@ -672,7 +663,7 @@ rule ViewLinkDeclarationSetSelectorTableRangeAction rule ViewLinkDeclarationSetSelectorPageContainer transform s: JSL!UIViewLinkDeclaration to t: UI!ui::PageContainer { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageContainer"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageContainer"); t.name = s.getFqName() + "::SetSelector::PageContainer"; t.label = s.getLabelWithNameFallback(); t.titleFrom = UI!ui::TitleFrom#LABEL; @@ -685,7 +676,7 @@ rule ViewLinkDeclarationSetSelectorPageContainer t.isSelector = true; t.isRelationSelector = true; - actorDeclaration.equivalent("Application").pageContainers.add(t); + rootMenu.equivalent("Application").pageContainers.add(t); log.debug("ViewLinkDeclarationSetSelectorPageContainer: " + t.name); } @@ -695,7 +686,7 @@ rule ViewLinkDeclarationSetSelectorVisualElement transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Flex { t.~pos = 0; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorVisualElement"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorVisualElement"); t.name = s.name; t.direction = UI!Axis#VERTICAL; t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; @@ -711,14 +702,14 @@ rule ViewLinkDeclarationSetSelectorVisualElement rule ViewLinkDeclarationSetSelectorFrame transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Frame { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorFrame"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorFrame"); } @lazy rule ViewLinkDeclarationSetSelectorTable transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Table { - var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTable"; + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTable"; t.setId(id); t.col = 12d; t.label = s.getLabelWithNameFallback(); @@ -748,10 +739,10 @@ rule ViewLinkDeclarationSetSelectorTable var primitiveFields = targetDeclaration.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration) and m.referenceType.`primitive`.isDefined()); for (field in primitiveFields) { - var col = field.equivalentDiscriminated("TablePrimitiveColumn", id); + var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } @@ -762,7 +753,7 @@ rule ViewLinkDeclarationSetSelectorTable rule ViewLinkDeclarationSetSelectorTableButtonGroup transform s: JSL!UIViewLinkDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableButtonGroup"); t.name = s.getFqName() + "::SetSelectorTableActions"; t.label = "Actions"; @@ -776,7 +767,7 @@ rule ViewLinkDeclarationSetSelectorTableButtonGroup rule ViewLinkDeclarationSetSelectorTableFilterButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterButton"); t.name = s.getFqName() + "::SetSelector::Table::Filter"; t.label = "Set Filters"; t.buttonStyle = "text"; @@ -790,7 +781,7 @@ rule ViewLinkDeclarationSetSelectorTableFilterButton rule ViewLinkDeclarationSetSelectorTableFilterActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::FilterActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); t.name = s.getFqName() + "::Table::Filter"; log.debug("ViewLinkDeclarationSetSelectorTableFilterActionDefinition: " + t.name); } @@ -799,7 +790,7 @@ rule ViewLinkDeclarationSetSelectorTableFilterActionDefinition rule ViewLinkDeclarationSetSelectorTableRefreshButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRefreshButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRefreshButton"); t.name = s.getFqName() + "::SetSelector::Table::Refresh"; t.label = "Refresh"; t.buttonStyle = "text"; @@ -813,7 +804,7 @@ rule ViewLinkDeclarationSetSelectorTableRefreshButton rule ViewLinkDeclarationSetSelectorTableRangeActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::SelectorRangeActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); t.name = s.getFqName() + "::SetSelector::Table::Range"; t.targetType = s.referenceType.equivalent("ClassType"); @@ -825,7 +816,7 @@ rule ViewLinkDeclarationSetSelectorTableRangeActionDefinition rule ViewLinkDeclarationSetSelectorButtonGroup transform s: JSL!UIViewLinkDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorButtonGroup"); t.name = s.getFqName() + "::SetSelectorButtonGroup"; t.label = "Actions"; @@ -839,7 +830,7 @@ rule ViewLinkDeclarationSetSelectorButtonGroup rule ViewLinkDeclarationSetSelectorSetSelectorBackButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorBackButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorBackButton"); t.name = s.getFqName() + "::Back"; t.label = "Back"; t.buttonStyle = "text"; @@ -853,7 +844,7 @@ rule ViewLinkDeclarationSetSelectorSetSelectorBackButton rule ViewLinkDeclarationSetSelectorBackActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::BackActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackActionDefinition"); t.name = s.getFqName() + "::Back"; log.debug("ViewLinkDeclarationSetSelectorBackActionDefinition: " + t.name); } @@ -862,7 +853,7 @@ rule ViewLinkDeclarationSetSelectorBackActionDefinition rule ViewLinkDeclarationSetSelectorSetSelectorSetButton transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetButton"); t.name = s.getFqName() + "::Set"; t.label = "Set"; t.buttonStyle = "contained"; @@ -876,7 +867,7 @@ rule ViewLinkDeclarationSetSelectorSetSelectorSetButton rule ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition transform s: JSL!UIViewLinkDeclaration to t: UI!ui::SetActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); t.name = s.getFqName() + "::Set"; t.targetType = s.referenceType.equivalent("ClassType"); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index 77954703..02988992 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -2,9 +2,9 @@ rule ViewTableCreateFormPageDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::PageDefinition { - guard: actorDeclaration.getAllRelations().contains(s) and s.isFormRelation() + guard: rootMenu.containsVisualElement(s) and s.referenceType.form.isDefined() and s.referenceType.form - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormPageDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormPageDefinition"); t.name = s.getFqName() + "::FormPage"; @@ -12,7 +12,7 @@ rule ViewTableCreateFormPageDefinition var targetContainer = targetCreateEvent.parameterType; t.container = targetContainer.equivalent("TransferDeclarationPageContainer"); - actorDeclaration.equivalent("Application").pages.add(t); + rootMenu.equivalent("Application").pages.add(t); t.dataElement = s.equivalent("FormRelationType"); @@ -49,7 +49,7 @@ rule ViewTableCreateFormPageDefinition rule ViewTableCreateFormCreateAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormCreateAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormCreateAction"); var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; @@ -65,7 +65,7 @@ rule ViewTableCreateFormCreateAction rule ViewTableCreateFormBackAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormBackAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormBackAction"); var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; @@ -80,7 +80,7 @@ rule ViewTableCreateFormBackAction rule AbstractViewTableDeclaration transform s: JSL!UIViewTableDeclaration to t: UI!ui::Table { - guard: actorDeclaration.getAllRelations().contains(s) + guard: rootMenu.containsVisualElement(s) t.name = s.name; t.relationName = s.name; @@ -101,7 +101,7 @@ rule AbstractViewTableDeclaration rule TableIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/TableIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableIcon"); t.name = s.name + "TableIcon"; t.iconName = s.getIconModifier().value.value; } @@ -112,20 +112,20 @@ rule InlineViewTable extends AbstractViewTableDeclaration { guard: rootMenu.containsVisualElement(s) - var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewTable"; + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewTable"; t.setId(id); t.dataElement = s.equivalent("RelationType"); s.eContainer.uiContainer().children.add(t); - var primitiveFields = s.referenceType.members.select(m | m.isTypeOf(JSL!RowFieldDeclaration) and m.referenceType.`primitive`.isDefined()); + var primitiveFields = s.referenceType.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); // var links = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); for (field in primitiveFields) { - var col = field.equivalentDiscriminated("TablePrimitiveColumn", id); + var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } /* @@ -156,7 +156,7 @@ rule InlineViewTable rule TablePrimitiveColumn transform s: JSL!TransferFieldDeclaration to t: UI!ui::Column { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/TablePrimitiveColumn"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePrimitiveColumn"); t.name = s.name; t.format = "%s"; t.label = s.getLabelWithNameFallback(); @@ -174,10 +174,10 @@ rule TablePrimitiveColumn rule ColumnIcon transform s: JSL!TransferFieldDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ColumnIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ColumnIcon"); t.iconName = s.getIconModifier().value.value; t.name = s.name + "FieldIcon"; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ColumnIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ColumnIcon"); log.debug("ColumnIcon: " + t.name); } @@ -187,7 +187,7 @@ rule ColumnIcon rule TablePrimitiveColumnFilter transform s: JSL!TransferFieldDeclaration to t: UI!ui::Filter { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/TablePrimitiveColumnFilter"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePrimitiveColumnFilter"); t.name = s.name + "Filter"; t.attributeType = s.getTransferFieldDeclarationEquivalent(); t.label = s.getLabelWithNameFallback(); @@ -199,7 +199,7 @@ rule TablePrimitiveColumnFilter rule RowLinkDerivedColumn transform s: JSL!RowLinkDeclaration to t: UI!ui::Column { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedColumn"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedColumn"); // we keep the name of the link it self because the relation won't be present in the visual elements only in the data model t.name = s.name; t.format = "%s"; @@ -219,7 +219,7 @@ rule RowLinkDerivedColumn rule RowLinkDerivedColumnIcon transform s: JSL!RowLinkDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedColumnIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedColumnIcon"); t.iconName = s.getIconModifier().value.value; t.name = s.name + "DerivedColumnIcon"; @@ -231,7 +231,7 @@ rule RowLinkDerivedColumnIcon rule RowLinkDerivedColumnFilter transform s: JSL!RowLinkDeclaration to t: UI!ui::Filter { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedColumnFilter"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedColumnFilter"); t.name = s.name + "Filter"; t.attributeType = s.equivalent("RowLinkDerivedAttributeType"); t.label = s.getLabelWithNameFallback(); @@ -243,7 +243,7 @@ rule RowLinkDerivedColumnFilter rule RowLinkDerivedAttributeType transform s: JSL!RowLinkDeclaration to t: UI!ui::data::AttributeType { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedAttributeType"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedAttributeType"); t.memberType = UI!ui::data::MemberType#DERIVED; t.isReadOnly = true; t.name = "_text_" + s.name; @@ -251,7 +251,7 @@ rule RowLinkDerivedAttributeType t.isFilterable = true; // TODO investigate if it really does not matter which string type we pick - t.dataType = actorDeclaration.equivalent("Application").dataTypes.selectOne(d | d.isTypeOf(UI!ui::data::StringType)); + t.dataType = rootMenu.equivalent("Application").dataTypes.selectOne(d | d.isTypeOf(UI!ui::data::StringType)); s.getContainerEquivalentClassType().attributes.add(t); log.debug("Created RowLinkDerivedAttributeType for ViewLinkDeclaration: [" + t.name + "] for [" + s.name + "]"); @@ -261,25 +261,27 @@ rule RowLinkDerivedAttributeType rule InlineViewTableButtonGroup transform s: JSL!UIViewTableDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewTableButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewTableButtonGroup"); t.name = s.name + "::InlineViewTableButtonGroup"; t.label = "Actions"; // TODO add buttons - if (s.isFilterSupported()) { + var relation = s.transferRelation.target; + + if (relation.isFilterSupported()) { t.buttons.add(s.equivalent("ViewTableDeclarationFilterButton")); } - if (s.isRefreshAllowed()) { + if (relation.isRefreshAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationRefreshButton")); } - if (s.isCreateAllowed()) { + if (relation.isCreateAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationOpenCreateButton")); } - if (s.isAddReferenceAllowed()) { + if (relation.isAddReferenceAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationOpenAddSelectorButton")); } - if (s.isRemoveReferenceAllowed()) { + if (relation.isRemoveReferenceAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationClearButton")); t.buttons.add(s.equivalent("ViewTableDeclarationBulkRemoveButton")); } @@ -291,17 +293,16 @@ rule InlineViewTableButtonGroup rule InlineViewTableRowButtonGroup transform s: JSL!UIViewTableDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewTableRowButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewTableRowButtonGroup"); t.name = s.name + "InlineViewTableRowButtonGroup"; t.label = "Actions"; // TODO add buttons - var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - if (rowLinks.selectOne(l | l.getDetail().isDefined()).isDefined()) { + if (s.getUpdateViewModifier().isDefined()) { t.buttons.add(s.equivalent("ViewTableDeclarationRowOpenPageButton")); } - if (s.isDeleteAllowed()) { + if (s.transferRelation.target.isDeleteAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationRowDeleteButton")); } @@ -312,7 +313,7 @@ rule InlineViewTableRowButtonGroup rule ViewTableDeclarationFilterButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterButton"); t.name = s.name + "::Filter"; t.icon = s.equivalent("ViewTableDeclarationFilterButtonIcon"); t.label = "Filter"; @@ -326,7 +327,7 @@ rule ViewTableDeclarationFilterButton rule ViewTableDeclarationFilterButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterButtonIcon"); t.name = s.name + "FilterIcon"; t.iconName = "filter"; @@ -337,7 +338,7 @@ rule ViewTableDeclarationFilterButtonIcon rule ViewTableDeclarationFilterActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::FilterActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterActionDefinition"); t.name = s.name + "::Filter"; t.targetType = s.referenceType.equivalent("ClassType"); @@ -348,7 +349,7 @@ rule ViewTableDeclarationFilterActionDefinition rule ViewTableDeclarationFilterAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterAction"); t.name = s.name + "::Filter"; t.actionDefinition = s.equivalent("ViewTableDeclarationFilterActionDefinition"); @@ -359,7 +360,7 @@ rule ViewTableDeclarationFilterAction rule ViewTableDeclarationRefreshButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshButton"); t.name = s.name + "::Refresh"; t.icon = s.equivalent("ViewTableDeclarationRefreshButtonIcon"); t.label = "Refresh"; @@ -373,7 +374,7 @@ rule ViewTableDeclarationRefreshButton rule ViewTableDeclarationRefreshButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshButtonIcon"); t.name = s.name + "RefreshIcon"; t.iconName = "refresh"; @@ -384,7 +385,7 @@ rule ViewTableDeclarationRefreshButtonIcon rule ViewTableDeclarationRefreshActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::RefreshActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshActionDefinition"); t.name = s.name + "::Refresh"; t.targetType = s.referenceType.equivalent("ClassType"); @@ -395,7 +396,7 @@ rule ViewTableDeclarationRefreshActionDefinition rule ViewTableDeclarationRefreshAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshAction"); t.name = s.name + "::Refresh"; t.actionDefinition = s.equivalent("ViewTableDeclarationRefreshActionDefinition"); @@ -406,7 +407,7 @@ rule ViewTableDeclarationRefreshAction rule ViewTableDeclarationOpenCreateButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateButton"); t.name = s.name + "::OpenCreate"; t.icon = s.equivalent("ViewTableDeclarationOpenCreateButtonIcon"); t.label = "Create"; @@ -420,7 +421,7 @@ rule ViewTableDeclarationOpenCreateButton rule ViewTableDeclarationOpenCreateButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateButtonIcon"); t.name = s.name + "OpenCreateIcon"; t.iconName = "file-document-plus"; @@ -431,7 +432,7 @@ rule ViewTableDeclarationOpenCreateButtonIcon rule ViewTableDeclarationOpenCreateActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::OpenCreateFormActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateActionDefinition"); t.name = s.name + "::OpenCreate"; t.targetType = s.referenceType.equivalent("ClassType"); @@ -442,7 +443,7 @@ rule ViewTableDeclarationOpenCreateActionDefinition rule ViewTableDeclarationOpenCreateAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateAction"); t.name = s.name + "::OpenCreate"; t.actionDefinition = s.equivalent("ViewTableDeclarationOpenCreateActionDefinition"); @@ -455,7 +456,7 @@ rule ViewTableDeclarationOpenCreateAction rule ViewTableDeclarationRowOpenPageButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButton"); t.name = s.name + "::View"; t.icon = s.equivalent("ViewTableDeclarationRowOpenPageButtonIcon"); t.label = "View"; @@ -469,7 +470,7 @@ rule ViewTableDeclarationRowOpenPageButton rule ViewTableDeclarationRowOpenPageButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButtonIcon"); t.name = s.name + "RowOpenIcon"; t.iconName = "visibility"; @@ -480,13 +481,12 @@ rule ViewTableDeclarationRowOpenPageButtonIcon rule ViewTableDeclarationRowOpenPageActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::RowOpenPageActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageActionDefinition"); t.name = s.name + "::View"; - t.targetType = s.referenceType.equivalent("ClassType"); - - var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + t.targetType = s.transferRelation.target.referenceType.equivalent("ClassType"); - t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); + // var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + // t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); log.debug("ViewTableDeclarationRowOpenPageActionDefinition: " + t.name); } @@ -497,7 +497,7 @@ rule ViewTableDeclarationOpenPageAction to t: UI!ui::Action { var row = s.referenceType; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageAction"); t.name = s.name + "::OpenPage"; t.actionDefinition = s.equivalent("ViewTableDeclarationRowOpenPageActionDefinition"); @@ -511,7 +511,7 @@ rule ViewTableDeclarationOpenPageAction rule ViewTableDeclarationRowDeleteButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteButton"); t.name = s.name + "::RowDelete"; t.icon = s.equivalent("ViewTableDeclarationRowDeleteButtonIcon"); t.label = "Delete"; @@ -525,7 +525,7 @@ rule ViewTableDeclarationRowDeleteButton rule ViewTableDeclarationRowDeleteButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteButtonIcon"); t.name = s.name + "RowDeleteIcon"; t.iconName = "delete_forever"; @@ -536,7 +536,7 @@ rule ViewTableDeclarationRowDeleteButtonIcon rule ViewTableDeclarationRowDeleteActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::RowDeleteActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteActionDefinition"); t.name = s.name + "::RowDelete"; t.targetType = s.referenceType.equivalent("ClassType"); @@ -547,7 +547,7 @@ rule ViewTableDeclarationRowDeleteActionDefinition rule ViewTableDeclarationRowDeleteAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteAction"); t.name = s.name + "::RowDelete"; t.actionDefinition = s.equivalent("ViewTableDeclarationRowDeleteActionDefinition"); @@ -558,7 +558,7 @@ rule ViewTableDeclarationRowDeleteAction rule ViewTableDeclarationOpenAddSelectorButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorButton"); t.name = s.name + "::OpenAddSelector"; t.icon = s.equivalent("ViewTableDeclarationOpenAddSelectorButtonIcon"); t.label = "Add"; @@ -572,7 +572,7 @@ rule ViewTableDeclarationOpenAddSelectorButton rule ViewTableDeclarationOpenAddSelectorButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorButtonIcon"); t.name = s.name + "OpenAddSelectorIcon"; t.iconName = "attachment-plus"; @@ -583,7 +583,7 @@ rule ViewTableDeclarationOpenAddSelectorButtonIcon rule ViewTableDeclarationOpenAddSelectorActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::OpenAddSelectorActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorActionDefinition"); t.name = s.name + "::OpenAddSelector"; t.isContainedRelationAction = true; t.selectorFor = s.equivalent("ViewTableDeclarationAddSelectorActionDefinition"); @@ -595,7 +595,7 @@ rule ViewTableDeclarationOpenAddSelectorActionDefinition rule ViewTableDeclarationOpenAddSelectorAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorAction"); t.name = s.name + "::OpenAddSelector"; t.actionDefinition = s.equivalent("ViewTableDeclarationOpenAddSelectorActionDefinition"); @@ -608,7 +608,7 @@ rule ViewTableDeclarationOpenAddSelectorAction rule ViewTableDeclarationBulkRemoveButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveButton"); t.name = s.name + "::BulkRemove"; t.icon = s.equivalent("ViewTableDeclarationBulkRemoveButtonIcon"); t.label = "Remove"; @@ -622,7 +622,7 @@ rule ViewTableDeclarationBulkRemoveButton rule ViewTableDeclarationBulkRemoveButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveButtonIcon"); t.name = s.name + "RemoveIcon"; t.iconName = "link-off"; @@ -633,7 +633,7 @@ rule ViewTableDeclarationBulkRemoveButtonIcon rule ViewTableDeclarationBulkRemoveActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::BulkRemoveActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveActionDefinition"); t.name = s.name + "::BulkRemove"; t.targetType = s.referenceType.equivalent("ClassType"); t.isContainedRelationAction = true; @@ -646,7 +646,7 @@ rule ViewTableDeclarationBulkRemoveActionDefinition rule ViewTableDeclarationBulkRemoveAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveAction"); t.name = s.name + "::BulkRemove"; t.actionDefinition = s.equivalent("ViewTableDeclarationBulkRemoveActionDefinition"); @@ -660,7 +660,7 @@ rule ViewTableDeclarationBulkRemoveAction rule ViewTableDeclarationClearButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearButton"); t.name = s.name + "::Clear"; t.icon = s.equivalent("ViewTableDeclarationClearButtonIcon"); t.label = "Clear"; @@ -674,7 +674,7 @@ rule ViewTableDeclarationClearButton rule ViewTableDeclarationClearButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearButtonIcon"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearButtonIcon"); t.name = s.name + "ClearIcon"; t.iconName = "link-off"; @@ -685,7 +685,7 @@ rule ViewTableDeclarationClearButtonIcon rule ViewTableDeclarationClearActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::ClearActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearActionDefinition"); t.name = s.name + "::Clear"; t.isContainedRelationAction = true; @@ -696,7 +696,7 @@ rule ViewTableDeclarationClearActionDefinition rule ViewTableDeclarationClearAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearAction"); t.name = s.name + "::Clear"; t.actionDefinition = s.equivalent("ViewTableDeclarationClearActionDefinition"); @@ -711,7 +711,7 @@ rule ViewTableDeclarationAddSelectorPageDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::PageDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageDefinition"); t.name = s.getFqName() + "::AddSelectorPage"; @@ -725,7 +725,7 @@ rule ViewTableDeclarationAddSelectorPageDefinition t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorTableFilterAction")); t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorTableRangeAction")); - actorDeclaration.equivalent("Application").pages.add(t); + rootMenu.equivalent("Application").pages.add(t); log.debug("ViewTableDeclarationAddSelectorPageDefinition: " + t.name); } @@ -734,7 +734,7 @@ rule ViewTableDeclarationAddSelectorPageDefinition rule ViewTableDeclarationAddSelectorAddAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorAddAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorAddAction"); t.name = s.getFqName() + "::AddSelector::Add"; t.ownerDataElement = s.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); @@ -746,7 +746,7 @@ rule ViewTableDeclarationAddSelectorAddAction rule ViewTableDeclarationAddSelectorBackAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorBackAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorBackAction"); t.name = s.getFqName() + "::AddSelector::Back"; t.ownerDataElement = s.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); @@ -758,7 +758,7 @@ rule ViewTableDeclarationAddSelectorBackAction rule ViewTableDeclarationAddSelectorTableFilterAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableFilterAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableFilterAction"); t.name = s.getFqName() + "::AddSelector::Table::Filter"; t.ownerDataElement = s.equivalent("RelationType"); t.targetDataElement = s.equivalent("RelationType"); @@ -771,7 +771,7 @@ rule ViewTableDeclarationAddSelectorTableFilterAction rule ViewTableDeclarationAddSelectorTableRangeAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeAction"); t.name = s.getFqName() + "::AddSelector::Table::Range"; t.ownerDataElement = s.equivalent("RelationType"); t.targetDataElement = s.equivalent("RelationType"); @@ -785,7 +785,7 @@ rule ViewTableDeclarationAddSelectorPageContainer transform s: JSL!UIViewTableDeclaration to t: UI!ui::PageContainer { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageContainer"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageContainer"); t.name = s.getFqName() + "::AddSelector::PageContainer"; t.label = s.getLabelWithNameFallback(); @@ -799,7 +799,7 @@ rule ViewTableDeclarationAddSelectorPageContainer t.isSelector = true; t.isRelationSelector = true; - actorDeclaration.equivalent("Application").pageContainers.add(t); + rootMenu.equivalent("Application").pageContainers.add(t); log.debug("ViewTableDeclarationAddSelectorPageContainer: " + t.name); } @@ -808,7 +808,7 @@ rule ViewTableDeclarationAddSelectorPageContainer rule ViewTableDeclarationAddSelectorTableRangeActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::SelectorRangeActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeActionDefinition"); t.name = s.getFqName() + "::AddSelector::Table::Range"; t.targetType = s.referenceType.equivalent("ClassType"); @@ -820,7 +820,7 @@ rule ViewTableDeclarationAddSelectorTableRangeActionDefinition rule ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup transform s: JSL!UIViewTableDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); t.name = s.getFqName() + "::AddSelectorTableAddSelectorButtonGroup"; t.label = "Actions"; @@ -834,7 +834,7 @@ rule ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup rule ViewTableDeclarationAddSelectorTableAddSelectorBackButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorBackButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorBackButton"); t.name = s.getFqName() + "::Back"; t.label = "Back"; t.buttonStyle = "text"; @@ -848,7 +848,7 @@ rule ViewTableDeclarationAddSelectorTableAddSelectorBackButton rule ViewTableDeclarationAddSelectorTableBackActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::BackActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableBackActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableBackActionDefinition"); t.name = s.getFqName() + "::Back"; log.debug("ViewTableDeclarationAddSelectorTableBackActionDefinition: " + t.name); } @@ -857,7 +857,7 @@ rule ViewTableDeclarationAddSelectorTableBackActionDefinition rule ViewTableDeclarationAddSelectorTableAddSelectorAddButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddButton"); t.name = s.getFqName() + "::Add"; t.label = "Add"; t.buttonStyle = "contained"; @@ -871,7 +871,7 @@ rule ViewTableDeclarationAddSelectorTableAddSelectorAddButton rule ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::AddActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); t.name = s.getFqName() + "::Add"; t.targetType = s.referenceType.equivalent("ClassType"); log.debug("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition: " + t.name); @@ -882,7 +882,7 @@ rule ViewTableDeclarationAddSelectorTableAddSelectorVisualElement transform s: JSL!UIViewTableDeclaration to t: UI!ui::Flex { t.~pos = 0; - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorVisualElement"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorVisualElement"); t.name = s.name; t.direction = UI!Axis#VERTICAL; t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; @@ -898,14 +898,14 @@ rule ViewTableDeclarationAddSelectorTableAddSelectorVisualElement rule ViewTableDeclarationAddSelectorTableAddSelectorFrame transform s: JSL!UIViewTableDeclaration to t: UI!ui::Frame { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorFrame"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorFrame"); } @lazy rule ViewTableDeclarationAddSelectorTableTable transform s: JSL!UIViewTableDeclaration to t: UI!ui::Table { - var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTable"; + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTable"; t.setId(id); t.col = 12d; t.label = s.getLabelWithNameFallback(); @@ -932,17 +932,17 @@ rule ViewTableDeclarationAddSelectorTableTable // TODO eventually selector should work? var rowDeclaration = s.referenceType; - var primitiveFields = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowFieldDeclaration) and m.referenceType.`primitive`.isDefined()); - var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + var primitiveFields = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); + // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); for (field in primitiveFields) { - var col = field.equivalentDiscriminated("TablePrimitiveColumn", id); + var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } - +/* for (link in links) { if (link.getDetail().isUndefined()) { var col = link.equivalentDiscriminated("RowLinkDerivedColumn", id); @@ -955,7 +955,7 @@ rule ViewTableDeclarationAddSelectorTableTable } } - +*/ log.debug("ViewTableDeclarationAddSelectorTableTable: " + t.name); } @@ -963,7 +963,7 @@ rule ViewTableDeclarationAddSelectorTableTable rule ViewTableDeclarationAddSelectorTableTableButtonGroup transform s: JSL!UIViewTableDeclaration to t: UI!ui::ButtonGroup { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableButtonGroup"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableButtonGroup"); t.name = s.getFqName() + "::AddSelectorTableActions"; t.label = "Actions"; @@ -977,12 +977,12 @@ rule ViewTableDeclarationAddSelectorTableTableButtonGroup rule ViewTableDeclarationAddSelectorTableTableFilterButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterButton"); t.name = s.getFqName() + "::AddSelector::Table::Filter"; t.label = "Set Filters"; t.buttonStyle = "text"; t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.referenceType.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); log.debug("ViewTableDeclarationAddSelectorTableTableFilterButton: " + t.name); } @@ -991,7 +991,7 @@ rule ViewTableDeclarationAddSelectorTableTableFilterButton rule ViewTableDeclarationAddSelectorTableTableFilterActionDefinition transform s: JSL!UIViewTableDeclaration to t: UI!ui::FilterActionDefinition { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); t.name = s.getFqName() + "::Table::Filter"; log.debug("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition: " + t.name); } @@ -1000,7 +1000,7 @@ rule ViewTableDeclarationAddSelectorTableTableFilterActionDefinition rule TransferObjectTableAddSelectorTableRefreshButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/TransferObjectTableAddSelectorTableRefreshButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TransferObjectTableAddSelectorTableRefreshButton"); t.name = s.getFqName() + "::AddSelector::Table::Refresh"; t.label = "Refresh"; t.buttonStyle = "text"; diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java index f45a67c7..1d3b724c 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java @@ -320,242 +320,253 @@ menu WidgetsApp(WidgetsActor a) { assertFalse(mappedEnum.getAttributeType().isIsReadOnly()); } -// @Test -// void testRelationWidgets() throws Exception { -// jslModel = JslParser.getModelFromStrings("RelationWidgetsTestModel", List.of(""" -// model RelationWidgetsTestModel; -// -// type numeric Numeric scale: 0 precision: 9; -// type string String min-size: 0 max-size: 255; -// -// entity User { -// identifier String email required; -// field Numeric numeric; -// -// field Related related; -// relation Related relatedAssociation; -// relation Related[] relatedCollection; -// } -// -// entity Related { -// field String first; -// field Numeric second; -// } -// -// view UserView(User u) { -// group level1 label:"Yo" icon:"text" { -// group level2 width:12 frame:true icon:"unicorn" label:"Level 2" stretch:true { -// link RelatedView related <= u.related eager:true icon:"related" label:"Related" width:6 create:true update:true delete:true; -// link RelatedView relatedAssociation <= u.relatedAssociation icon:"related-association" label:"Related Association" width:6 choices:Related.all() selector:RelatedRow create:true update:true delete:true; -// } -// -// tabs tabs0 orientation:horizontal width:6 { -// group tab1 label:"Tab1" icon:"numbers" h-align:left { -// field String email <= u.email icon:"text" label:"My Email"; -// } -// -// group tab2 label:"Tab2" icon:"numbers" h-align:right { -// table RelatedRow[] relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" width:6 rows:25 choices:Related.all() selector:RelatedRow create:true update:true delete:true; -// } -// } -// } -// -// event create onCreate; -// event update onUpdate; -// event delete onDelete; -// } -// -// row RelatedRow(Related r) { -// field String first <= r.first label:"First"; -// field Numeric second <= r.second label:"Second"; -// link RelatedView detail <= r detail:true; -// link RelatedView nonDetailLink <= r text:r.first label:"Non Detail Link"; -// -// event create onCreate; -// event update onUpdate; -// event delete onDelete; -// } -// -// view RelatedView(Related r) { -// field String first <= r.first label: "First"; -// field Numeric second <= r.second label: "Second"; -// -// event create onCreate; -// event update onUpdate; -// event delete onDelete; -// } -// -// actor RelationWidgetsActor human { -// link UserView user <= User.any() label:"User" icon:"tools"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application application = apps.get(0); -// -// List classTypes = application.getClassTypes(); -// List links = application.getLinks(); -// List tables = application.getTables(); -// -// // Links -// -// assertEquals(2 , links.size()); -// -// ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); -// -// Link related = links.stream().filter(l -> l.getName().equals("related")).findFirst().orElseThrow(); -// RelationType relatedRelation = (RelationType) related.getDataElement(); -// -// assertEquals("Related", related.getLabel()); -// assertEquals("related", related.getIcon().getIconName()); -// assertEquals("related", related.getRelationName()); -// assertTrue(related.isIsEager()); -// assertEquals("related", relatedRelation.getName()); -// assertEquals(relatedViewClassType, relatedRelation.getTarget()); -// -// Link relatedAssociation = links.stream().filter(l -> l.getName().equals("relatedAssociation")).findFirst().orElseThrow(); -// RelationType relatedAssociationAttribute = (RelationType) relatedAssociation.getDataElement(); -// -// assertEquals("Related Association", relatedAssociation.getLabel()); -// assertEquals("related-association", relatedAssociation.getIcon().getIconName()); -// assertEquals("relatedAssociation", relatedAssociation.getRelationName()); -// assertFalse(relatedAssociation.isIsEager()); -// assertEquals("relatedAssociation", relatedAssociationAttribute.getName()); -// assertEquals(relatedViewClassType, relatedAssociationAttribute.getTarget()); -// -// // Tables -// -// assertEquals(4 , tables.size()); -// -// Table table = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); -// RelationType tableRelation = (RelationType) table.getDataElement(); -// ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); -// -// assertEquals("Related Collection", table.getLabel()); -// assertEquals(12, table.getCol()); -// assertEquals("relatedCollection", table.getRelationName()); -// assertEquals("relatedCollection", tableRelation.getName()); -// assertEquals(relatedRowClassType, tableRelation.getTarget()); -// -// Table relatedCollectionAddSelector = tables.stream().filter(t -> t.getName().equals("relatedCollection::Add::Selector")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionAddSelector.getDataElement() instanceof ClassType); -// -// assertEquals("Related Collection", relatedCollectionAddSelector.getLabel()); -// assertEquals(12, relatedCollectionAddSelector.getCol()); -// assertEquals("relatedCollection", relatedCollectionAddSelector.getRelationName()); -// -// Table relatedSetSelector = tables.stream().filter(t -> t.getName().equals("related::Set::Selector")).findFirst().orElseThrow(); -// assertTrue(relatedSetSelector.getDataElement() instanceof ClassType); -// -// assertEquals("Related", relatedSetSelector.getLabel()); -// assertEquals(12, relatedSetSelector.getCol()); -// assertEquals("related", relatedSetSelector.getRelationName()); -// -// Table relatedAssociationSetSelector = tables.stream().filter(t -> t.getName().equals("relatedAssociation::Set::Selector")).findFirst().orElseThrow(); -// assertTrue(relatedAssociationSetSelector.getDataElement() instanceof ClassType); -// -// assertEquals("Related Association", relatedAssociationSetSelector.getLabel()); -// assertEquals(12, relatedAssociationSetSelector.getCol()); -// assertEquals("relatedAssociation", relatedAssociationSetSelector.getRelationName()); -// -// // Columns -// -// List columns = table.getColumns(); -// -// assertEquals(3, columns.size()); -// -// Column firstColumn = columns.stream().filter(c -> c.getName().equals("first")).findFirst().orElseThrow(); -// AttributeType firstAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("first")).findFirst().orElseThrow(); -// Column secondColumn = columns.stream().filter(c -> c.getName().equals("second")).findFirst().orElseThrow(); -// AttributeType secondAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("second")).findFirst().orElseThrow(); -// Column nonDetailLinkColumn = columns.stream().filter(c -> c.getName().equals("nonDetailLink")).findFirst().orElseThrow(); -// AttributeType nonDetailLinkAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("_text_nonDetailLink")).findFirst().orElseThrow(); -// RelationType nonDetailLinkRepresentsRelation = relatedRowClassType.getRelations().stream().filter(a -> a.getName().equals("nonDetailLink")).findFirst().orElseThrow(); -// -// assertEquals("First", firstColumn.getLabel()); -// assertEquals("%s", firstColumn.getFormat()); -// assertEquals("120", firstColumn.getWidth()); -// assertEquals(firstAttribute, firstColumn.getAttributeType()); -// assertTrue(firstAttribute.getIsMemberTypeDerived()); -// assertTrue(firstAttribute.isIsFilterable()); -// assertEquals("String", firstAttribute.getDataType().getName()); -// -// assertEquals("Second", secondColumn.getLabel()); -// assertEquals("%s", secondColumn.getFormat()); -// assertEquals("120", secondColumn.getWidth()); -// assertEquals(secondAttribute, secondColumn.getAttributeType()); -// assertTrue(secondAttribute.getIsMemberTypeDerived()); -// assertTrue(secondAttribute.isIsFilterable()); -// assertEquals("Numeric", secondAttribute.getDataType().getName()); -// -// assertEquals("Non Detail Link", nonDetailLinkColumn.getLabel()); -// assertEquals("%s", nonDetailLinkColumn.getFormat()); -// assertEquals("120", nonDetailLinkColumn.getWidth()); -// assertEquals(nonDetailLinkAttribute, nonDetailLinkColumn.getAttributeType()); -// assertTrue(nonDetailLinkAttribute.getIsMemberTypeDerived()); -// assertTrue(nonDetailLinkAttribute.isIsFilterable()); -// assertEquals("String", nonDetailLinkAttribute.getDataType().getName()); -// assertEquals(nonDetailLinkRepresentsRelation, nonDetailLinkColumn.getRepresentsRelation()); -// assertEquals(relatedViewClassType, nonDetailLinkRepresentsRelation.getTarget()); -// -// List relatedAddSelectorColumns = relatedCollectionAddSelector.getColumns(); -// assertEquals(List.of("First", "Second", "Non Detail Link"), relatedAddSelectorColumns.stream().map(LabeledElement::getLabel).toList()); -// assertEquals(List.of("first", "second", "_text_nonDetailLink"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); -// assertEquals(List.of("String", "Numeric", "String"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); -// -// List relatedSetSelectorColumns = relatedSetSelector.getColumns(); -// assertEquals(List.of("First", "Second"), relatedSetSelectorColumns.stream().map(LabeledElement::getLabel).toList()); -// assertEquals(List.of("first", "second"), relatedSetSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); -// assertEquals(List.of("String", "Numeric"), relatedSetSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); -// -// List relatedAssociationSetSelectorColumns = relatedSetSelector.getColumns(); -// assertEquals(List.of("First", "Second"), relatedAssociationSetSelectorColumns.stream().map(LabeledElement::getLabel).toList()); -// assertEquals(List.of("first", "second"), relatedAssociationSetSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); -// assertEquals(List.of("String", "Numeric"), relatedAssociationSetSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); -// -// // Filters -// -// List filters = table.getFilters(); -// -// assertEquals(3, filters.size()); -// -// Filter firstFilter = filters.stream().filter(c -> c.getName().equals("firstFilter")).findFirst().orElseThrow(); -// Filter secondFilter = filters.stream().filter(c -> c.getName().equals("secondFilter")).findFirst().orElseThrow(); -// Filter nonDetailLinkFilter = filters.stream().filter(c -> c.getName().equals("nonDetailLinkFilter")).findFirst().orElseThrow(); -// -// assertEquals("First", firstFilter.getLabel()); -// assertEquals(firstAttribute, firstFilter.getAttributeType()); -// -// assertEquals("Second", secondFilter.getLabel()); -// assertEquals(secondAttribute, secondFilter.getAttributeType()); -// -// assertEquals("Non Detail Link", nonDetailLinkFilter.getLabel()); -// assertEquals(nonDetailLinkAttribute, nonDetailLinkFilter.getAttributeType()); -// -// List relatedAddSelectorFilters = relatedCollectionAddSelector.getFilters(); -// -// assertEquals(List.of("First", "Second", "Non Detail Link"), relatedAddSelectorFilters.stream().map(LabeledElement::getLabel).toList()); -// assertEquals(List.of("first", "second", "_text_nonDetailLink"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); -// assertEquals(List.of("String", "Numeric", "String"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); -// assertEquals(List.of(true, true, true), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); -// -// List relatedSetSelectorFilters = relatedSetSelector.getFilters(); -// -// assertEquals(List.of("First", "Second"), relatedSetSelectorFilters.stream().map(LabeledElement::getLabel).toList()); -// assertEquals(List.of("first", "second"), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); -// assertEquals(List.of("String", "Numeric"), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); -// assertEquals(List.of(true, true), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); -// -// List relatedAssociationSetSelectorFilters = relatedAssociationSetSelector.getFilters(); -// -// assertEquals(List.of("First", "Second"), relatedAssociationSetSelectorFilters.stream().map(LabeledElement::getLabel).toList()); -// assertEquals(List.of("first", "second"), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); -// assertEquals(List.of("String", "Numeric"), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); -// assertEquals(List.of(true, true), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); -// } + @Test + void testRelationWidgets() throws Exception { + jslModel = JslParser.getModelFromStrings("RelationWidgetsTestModel", List.of(""" + model RelationWidgetsTestModel; + + type numeric Numeric scale: 0 precision: 9; + type string String min-size: 0 max-size: 255; + + entity User { + identifier String email required; + field Numeric numeric; + field Related related; + relation Related relatedAssociation; + relation Related[] relatedCollection; + } + + entity Related { + field String first; + field Numeric second; + } + + transfer UserTransfer(User u) { + field String email <= u.email required; + field Numeric numeric <= u.numeric; + + relation RelatedTransfer related <= u.related eager:true create:true update:true delete:true; + relation RelatedTransfer relatedAssociation <= u.relatedAssociation choices:Related.all() create:true update:true delete:true; + relation RelatedTransfer[] relatedCollection <= u.relatedCollection choices:Related.all() create:true update:true delete:true; + + event create onCreate; + event update onUpdate; + event delete onDelete; + } + + transfer RelatedTransfer(Related r) { + field String first <= r.first; + field Numeric second <= r.second; + + event create onCreate; + event update onUpdate; + event delete onDelete; + } + + view UserView(UserTransfer u) { + group level1 label:"Yo" icon:"text" { + group level2 width:12 frame:true icon:"unicorn" label:"Level 2" stretch:true { + link RelatedView related <= u.related icon:"related" label:"Related" width:6; + link RelatedView relatedAssociation <= u.relatedAssociation icon:"related-association" label:"Related Association" width:6 selector:RelatedTable; + } + + tabs tabs0 orientation:horizontal width:6 { + group tab1 label:"Tab1" icon:"numbers" h-align:left { + widget String email <= u.email icon:"text" label:"My Email"; + } + + group tab2 label:"Tab2" icon:"numbers" h-align:right { + table RelatedTable relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" width:6 selector:RelatedTable view:RelatedView; + } + } + } + } + + table RelatedTable(RelatedTransfer r) { + column String first <= r.first label:"First"; + column Numeric second <= r.second label:"Second"; + } + + view RelatedView(RelatedTransfer r) { + widget String first <= r.first label: "First"; + widget Numeric second <= r.second label: "Second"; + } + + actor RelationWidgetsActor { + access UserTransfer user <= User.any(); + } + + menu RelationWidgets(RelationWidgetsActor a) { + link UserView user <= a.user label:"User" icon:"tools"; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application application = apps.get(0); + + List classTypes = application.getClassTypes(); + List links = application.getLinks(); + List
tables = application.getTables(); + + // Links + + assertEquals(2 , links.size()); + + ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); + + Link related = links.stream().filter(l -> l.getName().equals("related")).findFirst().orElseThrow(); + RelationType relatedRelation = (RelationType) related.getDataElement(); + + assertEquals("Related", related.getLabel()); + assertEquals("related", related.getIcon().getIconName()); + assertEquals("related", related.getRelationName()); + assertTrue(related.isIsEager()); + assertEquals("related", relatedRelation.getName()); + assertEquals(relatedViewClassType, relatedRelation.getTarget()); + + Link relatedAssociation = links.stream().filter(l -> l.getName().equals("relatedAssociation")).findFirst().orElseThrow(); + RelationType relatedAssociationAttribute = (RelationType) relatedAssociation.getDataElement(); + + assertEquals("Related Association", relatedAssociation.getLabel()); + assertEquals("related-association", relatedAssociation.getIcon().getIconName()); + assertEquals("relatedAssociation", relatedAssociation.getRelationName()); + assertFalse(relatedAssociation.isIsEager()); + assertEquals("relatedAssociation", relatedAssociationAttribute.getName()); + assertEquals(relatedViewClassType, relatedAssociationAttribute.getTarget()); + + // Tables + + assertEquals(4 , tables.size()); + + Table table = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); + RelationType tableRelation = (RelationType) table.getDataElement(); + ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); + + assertEquals("Related Collection", table.getLabel()); + assertEquals(12, table.getCol()); + assertEquals("relatedCollection", table.getRelationName()); + assertEquals("relatedCollection", tableRelation.getName()); + assertEquals(relatedRowClassType, tableRelation.getTarget()); + + Table relatedCollectionAddSelector = tables.stream().filter(t -> t.getName().equals("relatedCollection::Add::Selector")).findFirst().orElseThrow(); + assertTrue(relatedCollectionAddSelector.getDataElement() instanceof ClassType); + + assertEquals("Related Collection", relatedCollectionAddSelector.getLabel()); + assertEquals(12, relatedCollectionAddSelector.getCol()); + assertEquals("relatedCollection", relatedCollectionAddSelector.getRelationName()); + + Table relatedSetSelector = tables.stream().filter(t -> t.getName().equals("related::Set::Selector")).findFirst().orElseThrow(); + assertTrue(relatedSetSelector.getDataElement() instanceof ClassType); + + assertEquals("Related", relatedSetSelector.getLabel()); + assertEquals(12, relatedSetSelector.getCol()); + assertEquals("related", relatedSetSelector.getRelationName()); + + Table relatedAssociationSetSelector = tables.stream().filter(t -> t.getName().equals("relatedAssociation::Set::Selector")).findFirst().orElseThrow(); + assertTrue(relatedAssociationSetSelector.getDataElement() instanceof ClassType); + + assertEquals("Related Association", relatedAssociationSetSelector.getLabel()); + assertEquals(12, relatedAssociationSetSelector.getCol()); + assertEquals("relatedAssociation", relatedAssociationSetSelector.getRelationName()); + + // Columns + + List columns = table.getColumns(); + + assertEquals(3, columns.size()); + + Column firstColumn = columns.stream().filter(c -> c.getName().equals("first")).findFirst().orElseThrow(); + AttributeType firstAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("first")).findFirst().orElseThrow(); + Column secondColumn = columns.stream().filter(c -> c.getName().equals("second")).findFirst().orElseThrow(); + AttributeType secondAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("second")).findFirst().orElseThrow(); + Column nonDetailLinkColumn = columns.stream().filter(c -> c.getName().equals("nonDetailLink")).findFirst().orElseThrow(); + AttributeType nonDetailLinkAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("_text_nonDetailLink")).findFirst().orElseThrow(); + RelationType nonDetailLinkRepresentsRelation = relatedRowClassType.getRelations().stream().filter(a -> a.getName().equals("nonDetailLink")).findFirst().orElseThrow(); + + assertEquals("First", firstColumn.getLabel()); + assertEquals("%s", firstColumn.getFormat()); + assertEquals("120", firstColumn.getWidth()); + assertEquals(firstAttribute, firstColumn.getAttributeType()); + assertTrue(firstAttribute.getIsMemberTypeDerived()); + assertTrue(firstAttribute.isIsFilterable()); + assertEquals("String", firstAttribute.getDataType().getName()); + + assertEquals("Second", secondColumn.getLabel()); + assertEquals("%s", secondColumn.getFormat()); + assertEquals("120", secondColumn.getWidth()); + assertEquals(secondAttribute, secondColumn.getAttributeType()); + assertTrue(secondAttribute.getIsMemberTypeDerived()); + assertTrue(secondAttribute.isIsFilterable()); + assertEquals("Numeric", secondAttribute.getDataType().getName()); + + assertEquals("Non Detail Link", nonDetailLinkColumn.getLabel()); + assertEquals("%s", nonDetailLinkColumn.getFormat()); + assertEquals("120", nonDetailLinkColumn.getWidth()); + assertEquals(nonDetailLinkAttribute, nonDetailLinkColumn.getAttributeType()); + assertTrue(nonDetailLinkAttribute.getIsMemberTypeDerived()); + assertTrue(nonDetailLinkAttribute.isIsFilterable()); + assertEquals("String", nonDetailLinkAttribute.getDataType().getName()); + assertEquals(nonDetailLinkRepresentsRelation, nonDetailLinkColumn.getRepresentsRelation()); + assertEquals(relatedViewClassType, nonDetailLinkRepresentsRelation.getTarget()); + + List relatedAddSelectorColumns = relatedCollectionAddSelector.getColumns(); + assertEquals(List.of("First", "Second", "Non Detail Link"), relatedAddSelectorColumns.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second", "_text_nonDetailLink"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric", "String"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + + List relatedSetSelectorColumns = relatedSetSelector.getColumns(); + assertEquals(List.of("First", "Second"), relatedSetSelectorColumns.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second"), relatedSetSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric"), relatedSetSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + + List relatedAssociationSetSelectorColumns = relatedSetSelector.getColumns(); + assertEquals(List.of("First", "Second"), relatedAssociationSetSelectorColumns.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second"), relatedAssociationSetSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric"), relatedAssociationSetSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + + // Filters + + List filters = table.getFilters(); + + assertEquals(3, filters.size()); + + Filter firstFilter = filters.stream().filter(c -> c.getName().equals("firstFilter")).findFirst().orElseThrow(); + Filter secondFilter = filters.stream().filter(c -> c.getName().equals("secondFilter")).findFirst().orElseThrow(); + Filter nonDetailLinkFilter = filters.stream().filter(c -> c.getName().equals("nonDetailLinkFilter")).findFirst().orElseThrow(); + + assertEquals("First", firstFilter.getLabel()); + assertEquals(firstAttribute, firstFilter.getAttributeType()); + + assertEquals("Second", secondFilter.getLabel()); + assertEquals(secondAttribute, secondFilter.getAttributeType()); + + assertEquals("Non Detail Link", nonDetailLinkFilter.getLabel()); + assertEquals(nonDetailLinkAttribute, nonDetailLinkFilter.getAttributeType()); + + List relatedAddSelectorFilters = relatedCollectionAddSelector.getFilters(); + + assertEquals(List.of("First", "Second", "Non Detail Link"), relatedAddSelectorFilters.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second", "_text_nonDetailLink"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric", "String"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + assertEquals(List.of(true, true, true), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); + + List relatedSetSelectorFilters = relatedSetSelector.getFilters(); + + assertEquals(List.of("First", "Second"), relatedSetSelectorFilters.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second"), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric"), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + assertEquals(List.of(true, true), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); + + List relatedAssociationSetSelectorFilters = relatedAssociationSetSelector.getFilters(); + + assertEquals(List.of("First", "Second"), relatedAssociationSetSelectorFilters.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second"), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric"), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + assertEquals(List.of(true, true), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); + } } From 2d2e340134deb9fed68f2783d48e501c64916c57 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Fri, 20 Sep 2024 11:25:26 +0200 Subject: [PATCH 07/21] save state --- .../transformations/ui/modules/view/menuLinkDeclaration.etl | 6 +++--- .../ui/modules/view/viewTableDeclaration.etl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl index 9cb42a81..cbf30ff3 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -121,11 +121,11 @@ rule AccessViewPageDefinition rule AccessViewBackAction transform s: JSL!UIMenuLinkDeclaration to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableBackAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewBackAction"); t.name = s.name + "::Back"; - t.actionDefinition = s.equivalent("AccessViewPageContainerBackActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerBackActionDefinition"); - log.debug("AccessTableBackAction: " + t.name); + log.debug("AccessViewBackAction: " + t.name); } @lazy diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index 02988992..c10fcd36 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -762,7 +762,7 @@ rule ViewTableDeclarationAddSelectorTableFilterAction t.name = s.getFqName() + "::AddSelector::Table::Filter"; t.ownerDataElement = s.equivalent("RelationType"); t.targetDataElement = s.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); log.debug("ViewTableDeclarationAddSelectorTableFilterAction: " + t.name); } From 4a2eb29ec61127c0bcd687c568d127cbb4d6805d Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Fri, 20 Sep 2024 12:57:21 +0200 Subject: [PATCH 08/21] save state --- .../ui/modules/view/menuLinkDeclaration.etl | 4 +- .../ui/modules/view/menuTableDeclaration.etl | 10 +- .../ui/modules/view/rowDeclaration.etl | 30 +++--- .../ui/modules/view/rowLinkDeclaration.etl | 4 +- .../ui/modules/view/viewLinkDeclaration.etl | 19 ++-- .../ui/modules/view/viewTableDeclaration.etl | 87 ++++++++-------- .../application/JslModel2UiWidgetsTest.java | 99 +++++++++---------- 7 files changed, 120 insertions(+), 133 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl index cbf30ff3..eb861cdf 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -65,10 +65,10 @@ rule AccessViewPageDefinition if (lRelation.isDeleteAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "AccessPageDefinition")); } - if (lRelation.isSetReferenceAllowed()) { + if (link.getSelectorTableModifier().isDefined()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "AccessPageDefinition")); } - if (lRelation.isUnsetReferenceAllowed()) { + if (link.getSelectorTableModifier().isDefined()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "AccessPageDefinition")); } } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index 6b4f78eb..1497276b 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -40,7 +40,7 @@ rule AccessTablePageDefinition t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; if (s.getUpdateViewModifier().isDefined()) { - t.actions.add(s.equivalent("AccessTableRowOpenPageAction")); + t.actions.add(s.equivalent("AccessTableOpenPageAction")); } if (relation.isRefreshAllowed()) { t.actions.add(s.equivalent("AccessTableTableRefreshAction")); @@ -114,17 +114,17 @@ rule AccessTableTableFilterAction } @lazy -rule AccessTableRowOpenPageAction +rule AccessTableOpenPageAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowOpenPageAction"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableOpenPageAction"); t.name = s.name + "::OpenPage"; - t.actionDefinition = s.referenceType.equivalent("TableRowOpenPageActionDefinition"); + t.actionDefinition = s.referenceType.equivalent("TableOpenPageActionDefinition"); t.targetPageDefinition = s.equivalent("AccessTableViewPageDefinition"); - log.debug("AccessTableRowOpenPageAction: " + t.name); + log.debug("AccessTableOpenPageAction: " + t.name); } @lazy diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl index 16dd7366..798c1e50 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclaration.etl @@ -158,7 +158,7 @@ rule TableRowButtonGroup // TODO add buttons - t.buttons.add(s.equivalent("TableRowOpenPageButton")); + t.buttons.add(s.equivalent("TableOpenPageButton")); t.buttons.add(s.equivalent("TableRowDeleteButton")); log.debug("TableRowButtonGroup: " + t.name); @@ -274,43 +274,39 @@ rule TableTableOpenCreateActionDefinition } @lazy -rule TableRowOpenPageButton +rule TableOpenPageButton transform s: JSL!UIRowDeclaration to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowOpenPageButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableOpenPageButton"); t.name = s.name + "::View"; - t.icon = s.equivalent("TableRowOpenPageButtonIcon"); + t.icon = s.equivalent("TableOpenPageButtonIcon"); t.label = "View"; t.buttonStyle = "contained"; - t.actionDefinition = s.equivalent("TableRowOpenPageActionDefinition"); + t.actionDefinition = s.equivalent("TableOpenPageActionDefinition"); - log.debug("TableRowOpenPageButton: " + t.name); + log.debug("TableOpenPageButton: " + t.name); } @lazy -rule TableRowOpenPageButtonIcon +rule TableOpenPageButtonIcon transform s: JSL!UIRowDeclaration to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowOpenPageButtonIcon"); - t.name = s.name + "RowOpenIcon"; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableOpenPageButtonIcon"); + t.name = s.name + "OpenPageIcon"; t.iconName = "visibility"; - log.debug("TableRowOpenPageButtonIcon: " + t.name); + log.debug("TableOpenPageButtonIcon: " + t.name); } @lazy -rule TableRowOpenPageActionDefinition +rule TableOpenPageActionDefinition transform s: JSL!UIRowDeclaration to t: UI!ui::OpenPageActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableRowOpenPageActionDefinition"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TableOpenPageActionDefinition"); t.name = s.name + "::View"; t.targetType = s.map.transfer.equivalent("ClassType"); - //var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - - //t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); - - log.debug("TableRowOpenPageActionDefinition: " + t.name); + log.debug("TableOpenPageActionDefinition: " + t.name); } @lazy diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl index 6a4e6f9e..0b2ad2d7 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl @@ -27,10 +27,10 @@ rule RowLinkPageDefinition if (link.isDeleteAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "RowLinkPageDefinition")); } - if (link.isSetReferenceAllowed()) { + if (link.getSelectorTableModifier().isDefined()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "RowLinkPageDefinition")); } - if (link.isUnsetReferenceAllowed()) { + if (link.getSelectorTableModifier().isDefined()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "RowLinkPageDefinition")); } } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl index af977e13..ec0fbf04 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl @@ -32,10 +32,10 @@ rule ViewLinkPageDefinition if (link.isDeleteAllowed()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "ViewLinkPageDefinition")); } - if (link.isSetReferenceAllowed()) { + if (link.getSelectorTableModifier().isDefined()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "ViewLinkPageDefinition")); } - if (link.isUnsetReferenceAllowed()) { + if (link.getSelectorTableModifier().isDefined()) { t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "ViewLinkPageDefinition")); } } @@ -325,10 +325,10 @@ rule InlineViewLinkButtonGroup if (s.transferRelation.target.isDeleteAllowed()) { t.buttons.add(s.equivalent("ViewLinkDeclarationDeleteButton")); } - if (s.transferRelation.target.isSetReferenceAllowed()) { + if (s.getSelectorTableModifier().isDefined()) { t.buttons.add(s.equivalent("ViewLinkDeclarationOpenSetSelectorButton")); } - if (s.transferRelation.target.isUnsetReferenceAllowed()) { + if (s.getSelectorTableModifier().isDefined()) { t.buttons.add(s.equivalent("ViewLinkDeclarationUnsetButton")); } @@ -718,7 +718,7 @@ rule ViewLinkDeclarationSetSelectorTable t.allowSelectMultiple = false; t.name = s.name + "::Set::Selector"; t.relationName = s.name; - t.dataElement = s.referenceType.equivalent("ClassType"); + t.dataElement = s.transferRelation.target.referenceType.equivalent("ClassType"); t.tableActionButtonGroup = s.equivalent("ViewLinkDeclarationSetSelectorTableButtonGroup"); t.~pos = s.~pos; t.showTotalCount = false; @@ -735,14 +735,15 @@ rule ViewLinkDeclarationSetSelectorTable // TODO eventually selector should work? var targetDeclaration = s.referenceType; + var rowDeclaration = s.getSelectorTableModifier().row; - var primitiveFields = targetDeclaration.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration) and m.referenceType.`primitive`.isDefined()); + var columns = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); - for (field in primitiveFields) { - var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); + for (column in columns) { + var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index c10fcd36..b935feb9 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -114,18 +114,18 @@ rule InlineViewTable var id = rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewTable"; t.setId(id); - t.dataElement = s.equivalent("RelationType"); + t.dataElement = s.transferRelation.target.equivalent("RelationType"); s.eContainer.uiContainer().children.add(t); - var primitiveFields = s.referenceType.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); + var columns = s.referenceType.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); // var links = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - for (field in primitiveFields) { - var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); + for (column in columns) { + var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } /* @@ -154,7 +154,7 @@ rule InlineViewTable @lazy @greedy rule TablePrimitiveColumn - transform s: JSL!TransferFieldDeclaration + transform s: JSL!UIRowColumnDeclaration to t: UI!ui::Column { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePrimitiveColumn"); t.name = s.name; @@ -172,7 +172,7 @@ rule TablePrimitiveColumn @lazy @greedy rule ColumnIcon - transform s: JSL!TransferFieldDeclaration + transform s: JSL!UIRowColumnDeclaration to t: UI!ui::Icon { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ColumnIcon"); t.iconName = s.getIconModifier().value.value; @@ -185,7 +185,7 @@ rule ColumnIcon @lazy @greedy rule TablePrimitiveColumnFilter - transform s: JSL!TransferFieldDeclaration + transform s: JSL!UIRowColumnDeclaration to t: UI!ui::Filter { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TablePrimitiveColumnFilter"); t.name = s.name + "Filter"; @@ -300,7 +300,7 @@ rule InlineViewTableRowButtonGroup // TODO add buttons if (s.getUpdateViewModifier().isDefined()) { - t.buttons.add(s.equivalent("ViewTableDeclarationRowOpenPageButton")); + t.buttons.add(s.equivalent("ViewTableDeclarationOpenPageButton")); } if (s.transferRelation.target.isDeleteAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationRowDeleteButton")); @@ -453,42 +453,39 @@ rule ViewTableDeclarationOpenCreateAction } @lazy -rule ViewTableDeclarationRowOpenPageButton +rule ViewTableDeclarationOpenPageButton transform s: JSL!UIViewTableDeclaration to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButton"); + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageButton"); t.name = s.name + "::View"; - t.icon = s.equivalent("ViewTableDeclarationRowOpenPageButtonIcon"); + t.icon = s.equivalent("ViewTableDeclarationOpenPageButtonIcon"); t.label = "View"; t.buttonStyle = "contained"; - t.actionDefinition = s.equivalent("ViewTableDeclarationRowOpenPageActionDefinition"); + t.actionDefinition = s.equivalent("ViewTableDeclarationOpenPageActionDefinition"); - log.debug("ViewTableDeclarationRowOpenPageButton: " + t.name); + log.debug("ViewTableDeclarationOpenPageButton: " + t.name); } @lazy -rule ViewTableDeclarationRowOpenPageButtonIcon +rule ViewTableDeclarationOpenPageButtonIcon transform s: JSL!UIViewTableDeclaration to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButtonIcon"); - t.name = s.name + "RowOpenIcon"; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageButtonIcon"); + t.name = s.name + "OpenPageIcon"; t.iconName = "visibility"; - log.debug("ViewTableDeclarationRowOpenPageButtonIcon: " + t.name); + log.debug("ViewTableDeclarationOpenPageButtonIcon: " + t.name); } @lazy -rule ViewTableDeclarationRowOpenPageActionDefinition +rule ViewTableDeclarationOpenPageActionDefinition transform s: JSL!UIViewTableDeclaration - to t: UI!ui::RowOpenPageActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageActionDefinition"); + to t: UI!ui::OpenPageActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageActionDefinition"); t.name = s.name + "::View"; t.targetType = s.transferRelation.target.referenceType.equivalent("ClassType"); - // var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - // t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); - - log.debug("ViewTableDeclarationRowOpenPageActionDefinition: " + t.name); + log.debug("ViewTableDeclarationOpenPageActionDefinition: " + t.name); } @lazy @@ -499,8 +496,8 @@ rule ViewTableDeclarationOpenPageAction t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageAction"); - t.name = s.name + "::OpenPage"; - t.actionDefinition = s.equivalent("ViewTableDeclarationRowOpenPageActionDefinition"); + t.name = s.name + "::OpenPage"; + t.actionDefinition = s.equivalent("ViewTableDeclarationOpenPageActionDefinition"); t.targetPageDefinition = s.getDetailLink().equivalent("RowLinkPageDefinition"); @@ -650,8 +647,8 @@ rule ViewTableDeclarationBulkRemoveAction t.name = s.name + "::BulkRemove"; t.actionDefinition = s.equivalent("ViewTableDeclarationBulkRemoveActionDefinition"); - t.ownerDataElement = s.equivalent("RelationType"); - t.targetDataElement = s.equivalent("RelationType"); + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); log.debug("ViewTableDeclarationBulkRemoveAction: " + t.name); } @@ -700,8 +697,8 @@ rule ViewTableDeclarationClearAction t.name = s.name + "::Clear"; t.actionDefinition = s.equivalent("ViewTableDeclarationClearActionDefinition"); - t.ownerDataElement = s.equivalent("RelationType"); - t.targetDataElement = s.equivalent("RelationType"); + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); log.debug("ViewTableDeclarationClearAction: " + t.name); } @@ -716,7 +713,7 @@ rule ViewTableDeclarationAddSelectorPageDefinition t.name = s.getFqName() + "::AddSelectorPage"; t.container = s.equivalent("ViewTableDeclarationAddSelectorPageContainer"); - t.dataElement = s.equivalent("RelationType"); + t.dataElement = s.transferRelation.target.equivalent("RelationType"); t.openInDialog = true; t.dialogSize = UI!ui::DialogSize#MD; @@ -736,7 +733,7 @@ rule ViewTableDeclarationAddSelectorAddAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorAddAction"); t.name = s.getFqName() + "::AddSelector::Add"; - t.ownerDataElement = s.equivalent("RelationType"); + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); log.debug("ViewTableDeclarationAddSelectorAddAction: " + t.name); @@ -748,7 +745,7 @@ rule ViewTableDeclarationAddSelectorBackAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorBackAction"); t.name = s.getFqName() + "::AddSelector::Back"; - t.ownerDataElement = s.equivalent("RelationType"); + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); log.debug("ViewTableDeclarationAddSelectorBackAction: " + t.name); @@ -760,8 +757,8 @@ rule ViewTableDeclarationAddSelectorTableFilterAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableFilterAction"); t.name = s.getFqName() + "::AddSelector::Table::Filter"; - t.ownerDataElement = s.equivalent("RelationType"); - t.targetDataElement = s.equivalent("RelationType"); + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); log.debug("ViewTableDeclarationAddSelectorTableFilterAction: " + t.name); @@ -773,8 +770,8 @@ rule ViewTableDeclarationAddSelectorTableRangeAction to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeAction"); t.name = s.getFqName() + "::AddSelector::Table::Range"; - t.ownerDataElement = s.equivalent("RelationType"); - t.targetDataElement = s.equivalent("RelationType"); + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); log.debug("ViewTableDeclarationAddSelectorTableRangeAction: " + t.name); @@ -795,7 +792,7 @@ rule ViewTableDeclarationAddSelectorPageContainer t.children.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorVisualElement")); t.actionButtonGroup = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); - t.dataElement = s.referenceType.equivalent("ClassType"); + t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); t.isSelector = true; t.isRelationSelector = true; @@ -914,7 +911,7 @@ rule ViewTableDeclarationAddSelectorTableTable t.allowSelectMultiple = true; t.name = s.name + "::Add::Selector"; t.relationName = s.name; - t.dataElement = s.referenceType.equivalent("ClassType"); + t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); t.tableActionButtonGroup = s.equivalent("ViewTableDeclarationAddSelectorTableTableButtonGroup"); t.~pos = s.~pos; t.showTotalCount = false; @@ -930,16 +927,16 @@ rule ViewTableDeclarationAddSelectorTableTable } // TODO eventually selector should work? - var rowDeclaration = s.referenceType; + var rowDeclaration = s.getSelectorTableModifier().row; - var primitiveFields = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); + var columns = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - for (field in primitiveFields) { - var col = field.transferField.target.equivalentDiscriminated("TablePrimitiveColumn", id); + for (column in columns) { + var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); t.columns.add(col); if (col.attributeType.isFilterable) { - t.filters.add(field.transferField.target.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } /* diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java index 1d3b724c..b13303f4 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java @@ -413,11 +413,20 @@ menu RelationWidgets(RelationWidgetsActor a) { List links = application.getLinks(); List
tables = application.getTables(); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserTransfer", + "RelationWidgetsActor::RelationWidgetsTestModel::RelatedTransfer", + "RelationWidgetsActor::RelationWidgetsTestModel::RelationWidgetsActor" + ), classTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + // Links - assertEquals(2 , links.size()); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::level2::related", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::level2::relatedAssociation" + ), links.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); - ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); + ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedTransfer")).findFirst().orElseThrow(); Link related = links.stream().filter(l -> l.getName().equals("related")).findFirst().orElseThrow(); RelationType relatedRelation = (RelationType) related.getDataElement(); @@ -441,11 +450,16 @@ menu RelationWidgets(RelationWidgetsActor a) { // Tables - assertEquals(4 , tables.size()); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::SetSelector::PageContainer::relatedAssociation::relatedAssociation::Set::Selector", + "RelationWidgetsActor::RelationWidgetsTestModel::RelatedTable::Table::PageContainer::RelatedTable::RelatedTable::Table", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::AddSelector::PageContainer::relatedCollection::relatedCollection::Add::Selector", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection" + ), tables.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); Table table = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); RelationType tableRelation = (RelationType) table.getDataElement(); - ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); + ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedTransfer")).findFirst().orElseThrow(); assertEquals("Related Collection", table.getLabel()); assertEquals(12, table.getCol()); @@ -460,13 +474,6 @@ menu RelationWidgets(RelationWidgetsActor a) { assertEquals(12, relatedCollectionAddSelector.getCol()); assertEquals("relatedCollection", relatedCollectionAddSelector.getRelationName()); - Table relatedSetSelector = tables.stream().filter(t -> t.getName().equals("related::Set::Selector")).findFirst().orElseThrow(); - assertTrue(relatedSetSelector.getDataElement() instanceof ClassType); - - assertEquals("Related", relatedSetSelector.getLabel()); - assertEquals(12, relatedSetSelector.getCol()); - assertEquals("related", relatedSetSelector.getRelationName()); - Table relatedAssociationSetSelector = tables.stream().filter(t -> t.getName().equals("relatedAssociation::Set::Selector")).findFirst().orElseThrow(); assertTrue(relatedAssociationSetSelector.getDataElement() instanceof ClassType); @@ -478,15 +485,19 @@ menu RelationWidgets(RelationWidgetsActor a) { List columns = table.getColumns(); - assertEquals(3, columns.size()); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection::second", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection::first" + ), columns.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + Column firstColumn = columns.stream().filter(c -> c.getName().equals("first")).findFirst().orElseThrow(); AttributeType firstAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("first")).findFirst().orElseThrow(); Column secondColumn = columns.stream().filter(c -> c.getName().equals("second")).findFirst().orElseThrow(); AttributeType secondAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("second")).findFirst().orElseThrow(); - Column nonDetailLinkColumn = columns.stream().filter(c -> c.getName().equals("nonDetailLink")).findFirst().orElseThrow(); - AttributeType nonDetailLinkAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("_text_nonDetailLink")).findFirst().orElseThrow(); - RelationType nonDetailLinkRepresentsRelation = relatedRowClassType.getRelations().stream().filter(a -> a.getName().equals("nonDetailLink")).findFirst().orElseThrow(); +// Column nonDetailLinkColumn = columns.stream().filter(c -> c.getName().equals("nonDetailLink")).findFirst().orElseThrow(); +// AttributeType nonDetailLinkAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("_text_nonDetailLink")).findFirst().orElseThrow(); +// RelationType nonDetailLinkRepresentsRelation = relatedRowClassType.getRelations().stream().filter(a -> a.getName().equals("nonDetailLink")).findFirst().orElseThrow(); assertEquals("First", firstColumn.getLabel()); assertEquals("%s", firstColumn.getFormat()); @@ -504,40 +515,32 @@ menu RelationWidgets(RelationWidgetsActor a) { assertTrue(secondAttribute.isIsFilterable()); assertEquals("Numeric", secondAttribute.getDataType().getName()); - assertEquals("Non Detail Link", nonDetailLinkColumn.getLabel()); - assertEquals("%s", nonDetailLinkColumn.getFormat()); - assertEquals("120", nonDetailLinkColumn.getWidth()); - assertEquals(nonDetailLinkAttribute, nonDetailLinkColumn.getAttributeType()); - assertTrue(nonDetailLinkAttribute.getIsMemberTypeDerived()); - assertTrue(nonDetailLinkAttribute.isIsFilterable()); - assertEquals("String", nonDetailLinkAttribute.getDataType().getName()); - assertEquals(nonDetailLinkRepresentsRelation, nonDetailLinkColumn.getRepresentsRelation()); - assertEquals(relatedViewClassType, nonDetailLinkRepresentsRelation.getTarget()); +// assertEquals("Non Detail Link", nonDetailLinkColumn.getLabel()); +// assertEquals("%s", nonDetailLinkColumn.getFormat()); +// assertEquals("120", nonDetailLinkColumn.getWidth()); +// assertEquals(nonDetailLinkAttribute, nonDetailLinkColumn.getAttributeType()); +// assertTrue(nonDetailLinkAttribute.getIsMemberTypeDerived()); +// assertTrue(nonDetailLinkAttribute.isIsFilterable()); +// assertEquals("String", nonDetailLinkAttribute.getDataType().getName()); +// assertEquals(nonDetailLinkRepresentsRelation, nonDetailLinkColumn.getRepresentsRelation()); +// assertEquals(relatedViewClassType, nonDetailLinkRepresentsRelation.getTarget()); List relatedAddSelectorColumns = relatedCollectionAddSelector.getColumns(); - assertEquals(List.of("First", "Second", "Non Detail Link"), relatedAddSelectorColumns.stream().map(LabeledElement::getLabel).toList()); - assertEquals(List.of("first", "second", "_text_nonDetailLink"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); - assertEquals(List.of("String", "Numeric", "String"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); - - List relatedSetSelectorColumns = relatedSetSelector.getColumns(); - assertEquals(List.of("First", "Second"), relatedSetSelectorColumns.stream().map(LabeledElement::getLabel).toList()); - assertEquals(List.of("first", "second"), relatedSetSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); - assertEquals(List.of("String", "Numeric"), relatedSetSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); - - List relatedAssociationSetSelectorColumns = relatedSetSelector.getColumns(); - assertEquals(List.of("First", "Second"), relatedAssociationSetSelectorColumns.stream().map(LabeledElement::getLabel).toList()); - assertEquals(List.of("first", "second"), relatedAssociationSetSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); - assertEquals(List.of("String", "Numeric"), relatedAssociationSetSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + assertEquals(List.of("First", "Second"), relatedAddSelectorColumns.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); // Filters List filters = table.getFilters(); - assertEquals(3, filters.size()); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection::firstFilter", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection::secondFilter" + ), filters.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); Filter firstFilter = filters.stream().filter(c -> c.getName().equals("firstFilter")).findFirst().orElseThrow(); Filter secondFilter = filters.stream().filter(c -> c.getName().equals("secondFilter")).findFirst().orElseThrow(); - Filter nonDetailLinkFilter = filters.stream().filter(c -> c.getName().equals("nonDetailLinkFilter")).findFirst().orElseThrow(); assertEquals("First", firstFilter.getLabel()); assertEquals(firstAttribute, firstFilter.getAttributeType()); @@ -545,22 +548,12 @@ menu RelationWidgets(RelationWidgetsActor a) { assertEquals("Second", secondFilter.getLabel()); assertEquals(secondAttribute, secondFilter.getAttributeType()); - assertEquals("Non Detail Link", nonDetailLinkFilter.getLabel()); - assertEquals(nonDetailLinkAttribute, nonDetailLinkFilter.getAttributeType()); - List relatedAddSelectorFilters = relatedCollectionAddSelector.getFilters(); - assertEquals(List.of("First", "Second", "Non Detail Link"), relatedAddSelectorFilters.stream().map(LabeledElement::getLabel).toList()); - assertEquals(List.of("first", "second", "_text_nonDetailLink"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); - assertEquals(List.of("String", "Numeric", "String"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); - assertEquals(List.of(true, true, true), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); - - List relatedSetSelectorFilters = relatedSetSelector.getFilters(); - - assertEquals(List.of("First", "Second"), relatedSetSelectorFilters.stream().map(LabeledElement::getLabel).toList()); - assertEquals(List.of("first", "second"), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); - assertEquals(List.of("String", "Numeric"), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); - assertEquals(List.of(true, true), relatedSetSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); + assertEquals(List.of("First", "Second"), relatedAddSelectorFilters.stream().map(LabeledElement::getLabel).toList()); + assertEquals(List.of("first", "second"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); + assertEquals(List.of("String", "Numeric"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); + assertEquals(List.of(true, true), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); List relatedAssociationSetSelectorFilters = relatedAssociationSetSelector.getFilters(); From b68d016357472ce5466ea0ced34024d6a5b74ba7 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Fri, 20 Sep 2024 13:03:51 +0200 Subject: [PATCH 09/21] save state --- .../transformations/ui/modules/view/menuLinkDeclaration.etl | 6 +++--- .../ui/modules/view/menuTableDeclaration.etl | 6 +++--- .../transformations/ui/modules/view/rowLinkDeclaration.etl | 6 +++--- .../transformations/ui/modules/view/viewLinkDeclaration.etl | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl index eb861cdf..850dc2e7 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -88,16 +88,16 @@ rule AccessViewPageDefinition if (tRelation.isRefreshAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "AccessPageDefinition")); } - if (tRelation.isCreateAllowed()) { + if (table.getCreateFormModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "AccessPageDefinition")); } if (tRelation.isDeleteAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "AccessPageDefinition")); } - if (tRelation.isAddReferenceAllowed()) { + if (table.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "AccessPageDefinition")); } - if (tRelation.isRemoveReferenceAllowed()) { + if (table.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "AccessPageDefinition")); t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "AccessPageDefinition")); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index 1497276b..3ce6fb8b 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -51,13 +51,13 @@ rule AccessTablePageDefinition if (relation.isFilterSupported()) { t.actions.add(s.equivalent("AccessTableTableFilterAction")); } - if (relation.isCreateAllowed()) { + if (s.getCreateFormModifier().isDefined()) { t.actions.add(s.equivalent("AccessTableTableOpenCreateAction")); } - if (relation.isAddReferenceAllowed()) { + if (s.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalent("ViewTableDeclarationOpenAddSelectorAction")); } - if (relation.isRemoveReferenceAllowed()) { + if (s.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalent("AccessTableTableClearAction")); t.actions.add(table.equivalent("AccessTableTableBulkRemoveAction")); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl index 0b2ad2d7..476e5ec3 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl @@ -44,16 +44,16 @@ rule RowLinkPageDefinition if (table.isRefreshAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "RowLinkPageDefinition")); } - if (table.isCreateAllowed()) { + if (table.getCreateFormModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "RowLinkPageDefinition")); } if (table.isDeleteAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "RowLinkPageDefinition")); } - if (table.isAddReferenceAllowed()) { + if (table.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "RowLinkPageDefinition")); } - if (table.isRemoveReferenceAllowed()) { + if (table.getSelectorTableModifier().isDefined())) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "RowLinkPageDefinition")); t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "RowLinkPageDefinition")); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl index ec0fbf04..50952673 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl @@ -52,16 +52,16 @@ rule ViewLinkPageDefinition if (table.isRefreshAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "ViewLinkPageDefinition")); } - if (table.isCreateAllowed()) { + if (table.getCreateFormModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "ViewLinkPageDefinition")); } if (table.isDeleteAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "ViewLinkPageDefinition")); } - if (table.isAddReferenceAllowed()) { + if (table.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "ViewLinkPageDefinition")); } - if (table.isRemoveReferenceAllowed()) { + if (table.getSelectorTableModifier().isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "ViewLinkPageDefinition")); t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "ViewLinkPageDefinition")); } From 7ffd62d9e6f464f4a582f6bd4c5fcbf5cade7f1a Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Fri, 20 Sep 2024 18:48:06 +0200 Subject: [PATCH 10/21] save state --- .../jsl/actor/actorGroupDeclaration.eol | 3 - .../operations/jsl/ui/menuDeclaration.eol | 3 - .../operations/jsl/ui/menuLinkDeclaration.eol | 5 + .../operations/jsl/ui/viewDeclaration.eol | 3 +- .../operations/jsl/ui/viewLinkDeclaration.eol | 6 +- .../jsl/ui/viewTableDeclaration.eol | 12 + .../operations/jsl/ui/viewTabsDeclaration.eol | 3 +- .../epsilon/transformations/ui/jslToUi.etl | 14 +- .../ui/modules/view/menuLinkDeclaration.etl | 134 ---- .../view/menuLinkDeclarationViewPage.etl | 130 ++++ .../ui/modules/view/menuTableDeclaration.etl | 384 ------------ ...> menuTableDeclarationAddSelectorPage.etl} | 76 +++ .../view/menuTableDeclarationFormPage.etl | 57 ++ .../view/menuTableDeclarationTablePage.etl | 140 +++++ .../view/menuTableDeclarationViewPage.etl | 112 ++++ .../ui/modules/view/rowLinkDeclaration.etl | 132 ---- .../ui/modules/view/viewDeclaration.etl | 139 ----- .../ui/modules/view/viewDeclarationForm.etl | 137 ++++ .../ui/modules/view/viewLinkDeclaration.etl | 587 +----------------- .../view/viewLinkDeclarationFormPage.etl | 74 +++ .../viewLinkDeclarationSetSelectorPage.etl | 286 +++++++++ .../view/viewLinkDeclarationViewPage.etl | 213 +++++++ .../ui/modules/view/viewTableDeclaration.etl | 486 +-------------- .../viewTableDeclarationAddSelectorPage.etl | 303 +++++++++ .../view/viewTableDeclarationFormPage.etl | 75 +++ .../view/viewTableDeclarationViewPage.etl | 238 +++++++ .../JslModel2UiApplicationTest.java | 8 +- .../JslModel2UiNavigationTest.java | 504 ++++++++------- 28 files changed, 2148 insertions(+), 2116 deletions(-) create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl rename judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/{rowDeclarationAddSelector.etl => menuTableDeclarationAddSelectorPage.etl} (72%) create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationFormPage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationTablePage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl delete mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclarationForm.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationSetSelectorPage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationViewPage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationAddSelectorPage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl create mode 100644 judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationViewPage.etl diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol index 82d840d0..a906e21e 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/actorGroupDeclaration.eol @@ -34,17 +34,14 @@ operation JSL!UIMenuGroupDeclaration getExposedVisualElements(): 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.add(group); ves.addAll(group.getExposedVisualElements()); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol index 6e549c3d..ea6c5575 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuDeclaration.eol @@ -28,17 +28,14 @@ operation JSL!UIMenuDeclaration getExposedVisualElements(): 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.add(group); ves.addAll(group.getExposedVisualElements()); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol index 0016d675..375e7279 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/menuLinkDeclaration.eol @@ -20,5 +20,10 @@ operation JSL!UIMenuLinkDeclaration getExposedVisualElements(): Set { ves.add(viewDeclaration); ves.addAll(viewDeclaration.getExposedVisualElements()); + if (self.getCreateFormModifier().isDefined()) { + ves.add(self.getCreateFormModifier().form); + ves.addAll(self.getCreateFormModifier().form.getExposedVisualElements()); + } + return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol index ded8ff3d..9887fe3e 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewDeclaration.eol @@ -20,6 +20,7 @@ operation JSL!UIViewDeclaration getExposedVisualElements(): Set { var ves = new Set(); 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()); @@ -37,8 +38,6 @@ operation JSL!UIViewDeclaration getExposedVisualElements(): Set { ves.addAll(tab.getExposedVisualElements()); } - ves.addAll(self.members.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); - return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol index 9c71694a..541f1acb 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol @@ -22,16 +22,12 @@ operation JSL!UIViewLinkDeclaration getExposedVisualElements(): Set { var viewDeclaration = self.referenceType; ves.add(self); - ves.add(viewDeclaration); + ves.addAll(viewDeclaration.getExposedVisualElements()); if (s.getCreateFormModifier().isDefined()) { ves.addAll(s.getCreateFormModifier().form.getExposedVisualElements()); } - if (s.getUpdateViewModifier().isDefined()) { - ves.addAll(s.getUpdateViewModifier().view.getExposedVisualElements()); - } - if (s.getSelectorTableModifier().isDefined()) { ves.addAll(s.getSelectorTableModifier().row.getExposedVisualElements()); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol index 12103aaf..ea47263a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol @@ -37,5 +37,17 @@ operation JSL!UIViewTableDeclaration getExposedVisualElements(): Set { ves.add(rowDeclaration); ves.addAll(rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration)).asSet()); + if (s.getCreateFormModifier().isDefined()) { + ves.addAll(s.getCreateFormModifier().form.getExposedVisualElements()); + } + + if (s.getUpdateViewModifier().isDefined()) { + ves.addAll(s.getUpdateViewModifier().view.getExposedVisualElements()); + } + + if (s.getSelectorTableModifier().isDefined()) { + ves.addAll(s.getSelectorTableModifier().row.getExposedVisualElements()); + } + return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol index e08eeb2b..3d0f0599 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTabsDeclaration.eol @@ -22,6 +22,7 @@ operation JSL!UIViewTabsDeclaration getExposedVisualElements(): Set { var ves = new Set(); ves.add(self); + ves.addAll(self.panels.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); for (link in self.panels.select(m | m.isTypeOf(JSL!UIViewLinkDeclaration)).asSet()) { ves.addAll(link.getExposedVisualElements()); @@ -39,7 +40,5 @@ operation JSL!UIViewTabsDeclaration getExposedVisualElements(): Set { ves.addAll(tab.getExposedVisualElements()); } - ves.addAll(self.panels.select(m | m.isTypeOf(JSL!UIViewWidgetDeclaration)).asSet()); - return ves; } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl index 3e165464..f9914a5a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/jslToUi.etl @@ -14,15 +14,25 @@ import "modules/type/type.etl"; import "modules/view/enumLiteral.etl"; import "modules/view/menuDeclaration.etl"; import "modules/view/menuLinkDeclaration.etl"; +import "modules/view/menuLinkDeclarationViewPage.etl"; import "modules/view/menuTableDeclaration.etl"; +import "modules/view/menuTableDeclarationAddSelectorPage.etl"; +import "modules/view/menuTableDeclarationFormPage.etl"; +import "modules/view/menuTableDeclarationTablePage.etl"; +import "modules/view/menuTableDeclarationViewPage.etl"; import "modules/view/rowColumnDeclaration.etl"; import "modules/view/rowDeclaration.etl"; -import "modules/view/rowDeclarationAddSelector.etl"; -import "modules/view/rowLinkDeclaration.etl"; import "modules/view/viewDeclaration.etl"; +import "modules/view/viewDeclarationForm.etl"; import "modules/view/viewGroupDeclaration.etl"; import "modules/view/viewLinkDeclaration.etl"; +import "modules/view/viewLinkDeclarationFormPage.etl"; +import "modules/view/viewLinkDeclarationSetSelectorPage.etl"; +import "modules/view/viewLinkDeclarationViewPage.etl"; import "modules/view/viewTableDeclaration.etl"; +import "modules/view/viewTableDeclarationAddSelectorPage.etl"; +import "modules/view/viewTableDeclarationFormPage.etl"; +import "modules/view/viewTableDeclarationViewPage.etl"; import "modules/view/viewTabsDeclaration.etl"; import "modules/view/viewWidgetDeclaration.etl"; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl index 850dc2e7..4e23e979 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclaration.etl @@ -28,138 +28,4 @@ rule MenuLinkNavigationItem } log.debug("MenuLinkNavigationItem: " + s.name); - } - -rule AccessViewPageDefinition - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) - - var relation = s.actorAccess.target; - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageDefinition"); - t.name = s.getFqName() + "::AccessViewPage"; - t.container = s.referenceType.equivalent("ViewPageContainer"); - - rootMenu.equivalent("Application").pages.add(t); - - t.dataElement = relation.equivalent("RelationType"); - - /* - log.info("==================="); - log.info(t.name + ":"); - log.info(relations.collect(r | r.name).concat(", ")); - log.info("==================="); - */ - - for (link in s.referenceType.getAllLinks()) { - var lRelation = link.transferRelation.target; - - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "AccessPageDefinition")); - if (lRelation.isRefreshAllowed() and not lRelation.isEager()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "AccessPageDefinition")); - } - if (lRelation.isCreateAllowed()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "AccessPageDefinition")); - } - if (lRelation.isDeleteAllowed()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "AccessPageDefinition")); - } - if (link.getSelectorTableModifier().isDefined()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "AccessPageDefinition")); - } - if (link.getSelectorTableModifier().isDefined()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "AccessPageDefinition")); - } - } - - for (table in s.referenceType.getAllTables()) { - var tRelation = table.transferRelation.target; - /* - var detailLink = table.getDetailLink(); - - if (detailLink.isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "AccessPageDefinition")); - } - */ - if (tRelation.isFilterSupported()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "AccessPageDefinition")); - } - if (tRelation.isRefreshAllowed()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "AccessPageDefinition")); - } - if (table.getCreateFormModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "AccessPageDefinition")); - } - if (tRelation.isDeleteAllowed()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "AccessPageDefinition")); - } - if (table.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "AccessPageDefinition")); - } - if (table.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "AccessPageDefinition")); - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "AccessPageDefinition")); - } - } - - t.actions.add(s.equivalent("AccessViewBackAction")); - if (relation.isRefreshAllowed()) { - t.actions.add(s.equivalent("AccessViewRefreshAction")); - } - if (relation.isUpdateAllowed()) { - t.actions.add(s.equivalent("AccessViewUpdateAction")); - } - if (relation.isDeleteAllowed()) { - t.actions.add(s.equivalent("AccessViewDeleteAction")); - } - - log.debug("Create AccessViewPageDefinition: " + t.name); -} - -@lazy -rule AccessViewBackAction - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewBackAction"); - t.name = s.name + "::Back"; - t.actionDefinition = s.referenceType.equivalent("ViewPageContainerBackActionDefinition"); - - log.debug("AccessViewBackAction: " + t.name); -} - -@lazy -rule AccessViewRefreshAction - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); - t.name = s.getFqName() + "::Refresh"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("ViewPageContainerRefreshActionDefinition"); - - log.debug("AccessViewRefreshAction: " + t.name); -} - -@lazy -rule AccessViewUpdateAction - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewUpdateAction"); - t.name = s.getFqName() + "::Update"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("ViewPageContainerUpdateActionDefinition"); - - log.debug("AccessViewUpdateAction: " + t.name); -} - -@lazy -rule AccessViewDeleteAction - transform s: JSL!UIMenuLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewDeleteAction"); - t.name = s.getFqName() + "::Delete"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("ViewPageContainerDeleteActionDefinition"); - - log.debug("AccessViewDeleteAction: " + t.name); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl new file mode 100644 index 00000000..a40fcb0f --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl @@ -0,0 +1,130 @@ +rule AccessViewPageDefinition + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) + + var relation = s.actorAccess.target; + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewPageDefinition"); + t.name = s.getFqName() + "::AccessViewPage"; + t.container = s.referenceType.equivalent("ViewPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = relation.equivalent("RelationType"); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + + for (link in s.referenceType.getAllLinks()) { + var lRelation = link.transferRelation.target; + + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "AccessPageDefinition")); + if (lRelation.isRefreshAllowed() and not lRelation.isEager()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "AccessPageDefinition")); + } + if (link.getCreateFormModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "AccessPageDefinition")); + } + if (lRelation.isDeleteAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "AccessPageDefinition")); + } + if (link.getSelectorTableModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "AccessPageDefinition")); + } + if (link.getSelectorTableModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "AccessPageDefinition")); + } + } + + for (table in s.referenceType.getAllTables()) { + var tRelation = table.transferRelation.target; + + if (table.getUpdateViewModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "AccessPageDefinition")); + } + if (tRelation.isFilterSupported()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "AccessPageDefinition")); + } + if (tRelation.isRefreshAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "AccessPageDefinition")); + } + if (table.getCreateFormModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "AccessPageDefinition")); + } + if (tRelation.isDeleteAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "AccessPageDefinition")); + } + if (table.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "AccessPageDefinition")); + } + if (table.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "AccessPageDefinition")); + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "AccessPageDefinition")); + } + } + + t.actions.add(s.equivalent("AccessViewBackAction")); + if (relation.isRefreshAllowed()) { + t.actions.add(s.equivalent("AccessViewRefreshAction")); + } + if (relation.isUpdateAllowed()) { + t.actions.add(s.equivalent("AccessViewUpdateAction")); + } + if (relation.isDeleteAllowed()) { + t.actions.add(s.equivalent("AccessViewDeleteAction")); + } + + log.debug("Create AccessViewPageDefinition: " + t.name); +} + +@lazy +rule AccessViewBackAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewBackAction"); + t.name = s.name + "::Back"; + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerBackActionDefinition"); + + log.debug("AccessViewBackAction: " + t.name); +} + +@lazy +rule AccessViewRefreshAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); + t.name = s.getFqName() + "::Refresh"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerRefreshActionDefinition"); + + log.debug("AccessViewRefreshAction: " + t.name); +} + +@lazy +rule AccessViewUpdateAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewUpdateAction"); + t.name = s.getFqName() + "::Update"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerUpdateActionDefinition"); + + log.debug("AccessViewUpdateAction: " + t.name); +} + +@lazy +rule AccessViewDeleteAction + transform s: JSL!UIMenuLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewDeleteAction"); + t.name = s.getFqName() + "::Delete"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerDeleteActionDefinition"); + + log.debug("AccessViewDeleteAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl index 3ce6fb8b..9d3d2569 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclaration.etl @@ -25,387 +25,3 @@ rule MenuTableNavigationItem log.debug("MenuTableNavigationItem: " + s.name); } - -rule AccessTablePageDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) - - var relation = s.actorAccess.target; - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageDefinition"); - t.name = s.getFqName() + "::AccessTablePage"; - t.container = s.referenceType.equivalent("TablePageContainer"); - t.dataElement = relation.equivalent("RelationType"); - t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - - if (s.getUpdateViewModifier().isDefined()) { - t.actions.add(s.equivalent("AccessTableOpenPageAction")); - } - if (relation.isRefreshAllowed()) { - t.actions.add(s.equivalent("AccessTableTableRefreshAction")); - } - if (relation.isDeleteAllowed()) { - t.actions.add(s.equivalent("AccessTableRowDeleteAction")); - } - if (relation.isFilterSupported()) { - t.actions.add(s.equivalent("AccessTableTableFilterAction")); - } - if (s.getCreateFormModifier().isDefined()) { - t.actions.add(s.equivalent("AccessTableTableOpenCreateAction")); - } - if (s.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalent("ViewTableDeclarationOpenAddSelectorAction")); - } - if (s.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalent("AccessTableTableClearAction")); - t.actions.add(table.equivalent("AccessTableTableBulkRemoveAction")); - } - - rootMenu.equivalent("Application").pages.add(t); - - log.debug("Create AccessTablePageDefinition: " + t.name); -} - -@lazy -rule AccessTableBackAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableBackAction"); - t.name = s.name + "::Back"; - t.actionDefinition = s.referenceType.equivalent("TablePageContainerBackActionDefinition"); - - log.debug("AccessTableBackAction: " + t.name); -} - -@lazy -rule AccessTableTableOpenCreateAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateAction"); - t.name = s.name + "::OpenCreate"; - t.actionDefinition = s.referenceType.equivalent("TableTableOpenCreateActionDefinition"); - - t.targetPageDefinition = s.getCreateFormModifier().form.equivalent("AccessTableCreateFormPageDefinition"); - - log.debug("AccessTableTableOpenCreateAction: " + t.name); -} - -@lazy -rule AccessTableTableRefreshAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableRefreshAction"); - t.name = s.name + "::Refresh"; - t.actionDefinition = s.referenceType.equivalent("TableTableRefreshActionDefinition"); - - log.debug("AccessTableTableRefreshAction: " + t.name); -} - -@lazy -rule AccessTableTableFilterAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterAction"); - t.name = s.name + "::Filter"; - t.actionDefinition = s.referenceType.equivalent("TableTableFilterActionDefinition"); - - log.debug("AccessTableTableFilterAction: " + t.name); -} - -@lazy -rule AccessTableOpenPageAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableOpenPageAction"); - - t.name = s.name + "::OpenPage"; - t.actionDefinition = s.referenceType.equivalent("TableOpenPageActionDefinition"); - - t.targetPageDefinition = s.equivalent("AccessTableViewPageDefinition"); - - log.debug("AccessTableOpenPageAction: " + t.name); -} - -@lazy -rule AccessTableRowDeleteAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowDeleteAction"); - t.name = s.name + "::RowDelete"; - t.actionDefinition = s.referenceType.equivalent("TableRowDeleteActionDefinition"); - - log.debug("AccessTableRowDeleteAction: " + t.name); -} - -@lazy -rule AccessTableTableBulkRemoveAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableBulkRemoveAction"); - t.name = s.name + "::BulkRemove"; - t.actionDefinition = s.equivalent("AccessTableTableBulkRemoveActionDefinition"); - - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); - - log.debug("AccessTableTableBulkRemoveAction: " + t.name); -} - -@lazy -rule AccessTableTableClearAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableClearAction"); - t.name = s.name + "::Clear"; - t.actionDefinition = s.equivalent("AccessTableTableClearActionDefinition"); - - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); - - log.debug("AccessTableTableClearAction: " + t.name); -} - -@lazy -rule AccessTableTableAddSelectorPageDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageDefinition { - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorPageDefinition"); - - t.name = s.getFqName() + "::AddSelectorPage"; - - t.container = s.referenceType.equivalent("TableAddSelectorPageContainer"); - t.dataElement = s.actorAccess.target.equivalent("RelationType"); - t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - t.openInDialog = true; - t.dialogSize = UI!ui::DialogSize#MD; - - t.actions.add(s.equivalent("AccessTableTableAddSelectorAddAction")); - t.actions.add(s.equivalent("AccessTableTableAddSelectorBackAction")); - t.actions.add(s.equivalent("AccessTableTableAddSelectorTableFilterAction")); - t.actions.add(s.equivalent("AccessTableTableAddSelectorTableRangeAction")); - - rootMenu.equivalent("Application").pages.add(t); - - log.debug("AccessTableTableAddSelectorPageDefinition: " + t.name); -} - -@lazy -rule AccessTableTableAddSelectorAddAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorAddAction"); - t.name = s.getFqName() + "::AddSelector::Add"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("TableAddSelectorAddActionDefinition"); - - log.debug("AccessTableTableAddSelectorAddAction: " + t.name); -} - -@lazy -rule AccessTableTableAddSelectorBackAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorBackAction"); - t.name = s.getFqName() + "::AddSelector::Back"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableBackActionDefinition"); - - log.debug("AccessTableTableAddSelectorBackAction: " + t.name); -} - -@lazy -rule AccessTableTableAddSelectorTableFilterAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableFilterAction"); - t.name = s.getFqName() + "::AddSelector::Table::Filter"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableTableFilterActionDefinition"); - - log.debug("AccessTableTableAddSelectorTableFilterAction: " + t.name); -} - -@lazy -rule AccessTableTableAddSelectorTableRangeAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableRangeAction"); - t.name = s.getFqName() + "::AddSelector::Table::Range"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableRangeActionDefinition"); - - log.debug("AccessTableTableAddSelectorTableRangeAction: " + t.name); -} - -rule AccessTableViewPageDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewPageDefinition"); - - t.name = s.getFqName() + "::AccessTableViewPage"; - t.container = s.getUpdateViewModifier().view.equivalent("ViewPageContainer"); - - rootMenu.equivalent("Application").pages.add(t); - - t.dataElement = s.actorAccess.target.equivalent("RelationType"); - t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - - // var relations = s.referenceType.getDirectRelations(); - - /* - log.info("==================="); - log.info(t.name + ":"); - log.info(relations.collect(r | r.name).concat(", ")); - log.info("==================="); - */ - /* - for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { - t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); - } - - for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { - var detailLink = table.getDetailLink(); - - if (detailLink.isDefined()) { - t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); - } - } - */ - - t.actions.add(s.equivalent("AccessTableViewBackAction")); - if (s.actorAccess.target.isRefreshAllowed()) { - t.actions.add(s.equivalent("AccessTableViewRefreshAction")); - } - if (s.actorAccess.target.isUpdateAllowed()) { - t.actions.add(s.equivalent("AccessTableViewCancelAction")); - t.actions.add(s.equivalent("AccessTableViewUpdateAction")); - } - if (s.actorAccess.target.isDeleteAllowed()) { - t.actions.add(s.equivalent("AccessTableViewDeleteAction")); - } - - log.debug("Create AccessTableViewPageDefinition: " + t.name); -} - -@lazy -rule AccessTableViewBackAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewBackAction"); - t.name = s.getFqName() + "::Back"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerBackActionDefinition"); - - log.debug("AccessTableViewBackAction: " + t.name); -} - -@lazy -rule AccessTableViewRefreshAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewRefreshAction"); - t.name = s.getFqName() + "::Refresh"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerRefreshActionDefinition"); - - log.debug("AccessTableViewRefreshAction: " + t.name); -} - -@lazy -rule AccessTableViewCancelAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewCancelAction"); - t.name = s.getFqName() + "::Cancel"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerCancelActionDefinition"); - - log.debug("AccessTableViewCancelAction: " + t.name); -} - -@lazy -rule AccessTableViewUpdateAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewUpdateAction"); - t.name = s.getFqName() + "::Update"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerUpdateActionDefinition"); - - log.debug("AccessTableViewUpdateAction: " + t.name); -} - -@lazy -rule AccessTableViewDeleteAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewDeleteAction"); - t.name = s.getFqName() + "::Delete"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerDeleteActionDefinition"); - - log.debug("AccessTableViewDeleteAction: " + t.name); -} - -rule AccessTableCreateFormPageDefinition - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormPageDefinition"); - t.openInDialog = true; - t.name = s.getFqName() + "::AccessFormPage"; - t.container = s.getCreateFormModifier().form.equivalent("FormPageContainer"); - t.dataElement = s.actorAccess.target.equivalent("RelationType"); - t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; - - t.actions.add(s.equivalent("AccessTableCreateFormBackAction")); - t.actions.add(s.equivalent("AccessTableCreateFormCreateAction")); - if (s.actorAccess.target.isTemplateAllowed()) { - t.actions.add(s.equivalent("AccessTableCreateFormGetTemplateAction")); - } - - rootMenu.equivalent("Application").pages.add(t); - - log.debug("Create AccessTableCreateFormPageDefinition: " + t.name); -} - -@lazy -rule AccessTableCreateFormBackAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormBackAction"); - t.name = s.name + "::Back"; - t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerBackActionDefinition"); - - log.debug("AccessTableCreateFormBackAction: " + t.name); -} - -@lazy -rule AccessTableCreateFormGetTemplateAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormGetTemplateAction"); - t.name = s.name + "::GetTemplate"; - t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerGetTemplateActionDefinition"); - log.debug("AccessTableCreateFormGetTemplateAction: " + t.name); -} - -@lazy -rule AccessTableCreateFormCreateAction - transform s: JSL!UIMenuTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormCreateAction"); - t.name = s.name + "::Create"; - t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); - t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerCreateActionDefinition"); - t.targetPageDefinition = s.getCreateFormModifier().form.equivalent("AccessTableViewPageDefinition"); - - log.debug("AccessTableCreateFormCreateAction: " + t.name); -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationAddSelectorPage.etl similarity index 72% rename from judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl rename to judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationAddSelectorPage.etl index c1ae94fe..344692a0 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowDeclarationAddSelector.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationAddSelectorPage.etl @@ -1,3 +1,28 @@ +@lazy +rule AccessTableTableAddSelectorPageDefinition + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::PageDefinition { + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorPageDefinition"); + + t.name = s.getFqName() + "::AddSelectorPage"; + + t.container = s.referenceType.equivalent("TableAddSelectorPageContainer"); + t.dataElement = s.actorAccess.target.equivalent("RelationType"); + t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; + t.openInDialog = true; + t.dialogSize = UI!ui::DialogSize#MD; + + t.actions.add(s.equivalent("AccessTableTableAddSelectorAddAction")); + t.actions.add(s.equivalent("AccessTableTableAddSelectorBackAction")); + t.actions.add(s.equivalent("AccessTableTableAddSelectorTableFilterAction")); + t.actions.add(s.equivalent("AccessTableTableAddSelectorTableRangeAction")); + + rootMenu.equivalent("Application").pages.add(t); + + log.debug("AccessTableTableAddSelectorPageDefinition: " + t.name); +} + @lazy rule TableAddSelectorPageContainer transform s: JSL!UIRowDeclaration @@ -227,3 +252,54 @@ rule TransferObjectTableAddSelectorTableRefreshButton log.debug("TransferObjectTableAddSelectorTableRefreshButton: " + t.name); } + + +@lazy +rule AccessTableTableAddSelectorAddAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorAddAction"); + t.name = s.getFqName() + "::AddSelector::Add"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorAddActionDefinition"); + + log.debug("AccessTableTableAddSelectorAddAction: " + t.name); +} + +@lazy +rule AccessTableTableAddSelectorBackAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorBackAction"); + t.name = s.getFqName() + "::AddSelector::Back"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableBackActionDefinition"); + + log.debug("AccessTableTableAddSelectorBackAction: " + t.name); +} + +@lazy +rule AccessTableTableAddSelectorTableFilterAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableFilterAction"); + t.name = s.getFqName() + "::AddSelector::Table::Filter"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableTableFilterActionDefinition"); + + log.debug("AccessTableTableAddSelectorTableFilterAction: " + t.name); +} + +@lazy +rule AccessTableTableAddSelectorTableRangeAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableAddSelectorTableRangeAction"); + t.name = s.getFqName() + "::AddSelector::Table::Range"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.referenceType.equivalent("TableAddSelectorTableRangeActionDefinition"); + + log.debug("AccessTableTableAddSelectorTableRangeAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationFormPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationFormPage.etl new file mode 100644 index 00000000..14f1f352 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationFormPage.etl @@ -0,0 +1,57 @@ + +rule AccessTableCreateFormPageDefinition + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormPageDefinition"); + t.openInDialog = true; + t.name = s.getFqName() + "::AccessFormPage"; + t.container = s.getCreateFormModifier().form.equivalent("FormPageContainer"); + t.dataElement = s.actorAccess.target.equivalent("RelationType"); + t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; + + t.actions.add(s.equivalent("AccessTableCreateFormBackAction")); + t.actions.add(s.equivalent("AccessTableCreateFormCreateAction")); + if (s.actorAccess.target.isTemplateAllowed()) { + t.actions.add(s.equivalent("AccessTableCreateFormGetTemplateAction")); + } + + rootMenu.equivalent("Application").pages.add(t); + + log.debug("Create AccessTableCreateFormPageDefinition: " + t.name); +} + +@lazy +rule AccessTableCreateFormBackAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormBackAction"); + t.name = s.name + "::Back"; + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerBackActionDefinition"); + + log.debug("AccessTableCreateFormBackAction: " + t.name); +} + +@lazy +rule AccessTableCreateFormGetTemplateAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormGetTemplateAction"); + t.name = s.name + "::GetTemplate"; + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerGetTemplateActionDefinition"); + log.debug("AccessTableCreateFormGetTemplateAction: " + t.name); +} + +@lazy +rule AccessTableCreateFormCreateAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableCreateFormCreateAction"); + t.name = s.name + "::Create"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerCreateActionDefinition"); + t.targetPageDefinition = s.getCreateFormModifier().form.equivalent("AccessTableViewPageDefinition"); + + log.debug("AccessTableCreateFormCreateAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationTablePage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationTablePage.etl new file mode 100644 index 00000000..04dbb5ef --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationTablePage.etl @@ -0,0 +1,140 @@ + +rule AccessTablePageDefinition + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) + + var relation = s.actorAccess.target; + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTablePageDefinition"); + t.name = s.getFqName() + "::AccessTablePage"; + t.container = s.referenceType.equivalent("TablePageContainer"); + t.dataElement = relation.equivalent("RelationType"); + t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; + + if (s.getUpdateViewModifier().isDefined()) { + t.actions.add(s.equivalent("AccessTableOpenPageAction")); + } + if (relation.isRefreshAllowed()) { + t.actions.add(s.equivalent("AccessTableTableRefreshAction")); + } + if (relation.isDeleteAllowed()) { + t.actions.add(s.equivalent("AccessTableRowDeleteAction")); + } + if (relation.isFilterSupported()) { + t.actions.add(s.equivalent("AccessTableTableFilterAction")); + } + if (s.getCreateFormModifier().isDefined()) { + t.actions.add(s.equivalent("AccessTableTableOpenCreateAction")); + } + if (s.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalent("ViewTableDeclarationOpenAddSelectorAction")); + } + if (s.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalent("AccessTableTableClearAction")); + t.actions.add(table.equivalent("AccessTableTableBulkRemoveAction")); + } + + rootMenu.equivalent("Application").pages.add(t); + + log.debug("Create AccessTablePageDefinition: " + t.name); +} + +@lazy +rule AccessTableBackAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableBackAction"); + t.name = s.name + "::Back"; + t.actionDefinition = s.referenceType.equivalent("TablePageContainerBackActionDefinition"); + + log.debug("AccessTableBackAction: " + t.name); +} + +@lazy +rule AccessTableTableOpenCreateAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableOpenCreateAction"); + t.name = s.name + "::OpenCreate"; + t.actionDefinition = s.referenceType.equivalent("TableTableOpenCreateActionDefinition"); + + t.targetPageDefinition = s.getCreateFormModifier().form.equivalent("AccessTableCreateFormPageDefinition"); + + log.debug("AccessTableTableOpenCreateAction: " + t.name); +} + +@lazy +rule AccessTableTableRefreshAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableRefreshAction"); + t.name = s.name + "::Refresh"; + t.actionDefinition = s.referenceType.equivalent("TableTableRefreshActionDefinition"); + + log.debug("AccessTableTableRefreshAction: " + t.name); +} + +@lazy +rule AccessTableTableFilterAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableFilterAction"); + t.name = s.name + "::Filter"; + t.actionDefinition = s.referenceType.equivalent("TableTableFilterActionDefinition"); + + log.debug("AccessTableTableFilterAction: " + t.name); +} + +@lazy +rule AccessTableOpenPageAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableOpenPageAction"); + + t.name = s.name + "::OpenPage"; + t.actionDefinition = s.referenceType.equivalent("TableOpenPageActionDefinition"); + + t.targetPageDefinition = s.equivalent("AccessTableViewPageDefinition"); + + log.debug("AccessTableOpenPageAction: " + t.name); +} + +@lazy +rule AccessTableRowDeleteAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableRowDeleteAction"); + t.name = s.name + "::RowDelete"; + t.actionDefinition = s.referenceType.equivalent("TableRowDeleteActionDefinition"); + + log.debug("AccessTableRowDeleteAction: " + t.name); +} + +@lazy +rule AccessTableTableBulkRemoveAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableBulkRemoveAction"); + t.name = s.name + "::BulkRemove"; + t.actionDefinition = s.equivalent("AccessTableTableBulkRemoveActionDefinition"); + + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); + + log.debug("AccessTableTableBulkRemoveAction: " + t.name); +} + +@lazy +rule AccessTableTableClearAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableTableClearAction"); + t.name = s.name + "::Clear"; + t.actionDefinition = s.equivalent("AccessTableTableClearActionDefinition"); + + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.targetDataElement = s.actorAccess.target.equivalent("RelationType"); + + log.debug("AccessTableTableClearAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl new file mode 100644 index 00000000..6130b1c2 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl @@ -0,0 +1,112 @@ + +rule AccessTableViewPageDefinition + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) and s.getUpdateViewModifier().isDefined() + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewPageDefinition"); + + t.name = s.getFqName() + "::AccessTableViewPage"; + t.container = s.getUpdateViewModifier().view.equivalent("ViewPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = s.actorAccess.target.equivalent("RelationType"); + t.dataElement.memberType = UI!ui::data::MemberType#ACCESS; + + // var relations = s.referenceType.getDirectRelations(); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + /* + for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { + t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); + } + + for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { + var detailLink = table.getDetailLink(); + + if (detailLink.isDefined()) { + t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); + } + } + */ + + t.actions.add(s.equivalent("AccessTableViewBackAction")); + if (s.actorAccess.target.isRefreshAllowed()) { + t.actions.add(s.equivalent("AccessTableViewRefreshAction")); + } + if (s.actorAccess.target.isUpdateAllowed()) { + t.actions.add(s.equivalent("AccessTableViewCancelAction")); + t.actions.add(s.equivalent("AccessTableViewUpdateAction")); + } + if (s.actorAccess.target.isDeleteAllowed()) { + t.actions.add(s.equivalent("AccessTableViewDeleteAction")); + } + + log.debug("Create AccessTableViewPageDefinition: " + t.name); +} + +@lazy +rule AccessTableViewBackAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewBackAction"); + t.name = s.getFqName() + "::Back"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerBackActionDefinition"); + + log.debug("AccessTableViewBackAction: " + t.name); +} + +@lazy +rule AccessTableViewRefreshAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewRefreshAction"); + t.name = s.getFqName() + "::Refresh"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerRefreshActionDefinition"); + + log.debug("AccessTableViewRefreshAction: " + t.name); +} + +@lazy +rule AccessTableViewCancelAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewCancelAction"); + t.name = s.getFqName() + "::Cancel"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerCancelActionDefinition"); + + log.debug("AccessTableViewCancelAction: " + t.name); +} + +@lazy +rule AccessTableViewUpdateAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewUpdateAction"); + t.name = s.getFqName() + "::Update"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerUpdateActionDefinition"); + + log.debug("AccessTableViewUpdateAction: " + t.name); +} + +@lazy +rule AccessTableViewDeleteAction + transform s: JSL!UIMenuTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewDeleteAction"); + t.name = s.getFqName() + "::Delete"; + t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerDeleteActionDefinition"); + + log.debug("AccessTableViewDeleteAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl deleted file mode 100644 index 476e5ec3..00000000 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/rowLinkDeclaration.etl +++ /dev/null @@ -1,132 +0,0 @@ -/* -rule RowLinkPageDefinition - transform s: JSL!RowLinkDeclaration - to t: UI!ui::PageDefinition { - guard: actorDeclaration.getAllRelations().contains(s) - - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkPageDefinition"); - - t.name = s.getFqName() + "::ViewPage"; - t.container = s.referenceType.equivalent("TransferDeclarationPageContainer"); - - actorDeclaration.equivalent("Application").pages.add(t); - - t.dataElement = s.equivalent("RelationType"); - - var relations = s.referenceType.getDirectRelations(); - - for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "RowLinkPageDefinition")); - - if (link.isRefreshAllowed() and not link.isEager()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "RowLinkPageDefinition")); - } - if (link.isCreateAllowed()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "RowLinkPageDefinition")); - } - if (link.isDeleteAllowed()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "RowLinkPageDefinition")); - } - if (link.getSelectorTableModifier().isDefined()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "RowLinkPageDefinition")); - } - if (link.getSelectorTableModifier().isDefined()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "RowLinkPageDefinition")); - } - } - - for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { - var detailLink = table.getDetailLink(); - - if (table.isFilterSupported()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "RowLinkPageDefinition")); - } - if (table.isRefreshAllowed()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "RowLinkPageDefinition")); - } - if (table.getCreateFormModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "RowLinkPageDefinition")); - } - if (table.isDeleteAllowed()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "RowLinkPageDefinition")); - } - if (table.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "RowLinkPageDefinition")); - } - if (table.getSelectorTableModifier().isDefined())) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "RowLinkPageDefinition")); - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "RowLinkPageDefinition")); - } - if (detailLink.isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "RowLinkPageDefinition")); - } - } - - t.actions.add(s.equivalent("RowLinkPageDefinitionBackAction")); - if (s.isRefreshAllowed()) { - t.actions.add(s.equivalent("RowLinkPageDefinitionRefreshAction")); - } - if (s.isUpdateAllowed()) { - t.actions.add(s.equivalent("RowLinkPageDefinitionUpdateAction")); - } - if (s.isDeleteAllowed()) { - t.actions.add(s.equivalent("RowLinkPageDefinitionDeleteAction")); - } - - log.debug("Create RowLinkPageDefinition: " + t.name); -} - -@lazy -@greedy -rule RowLinkPageDefinitionRefreshAction - transform s: JSL!RowLinkDeclaration - to t: UI!ui::Action { - guard: actorDeclaration.getAllRelations().contains(s) - - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkPageDefinitionRefreshAction"); - t.name = s.name + "::Refresh"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationRefreshActionDefinition"); - - log.debug("RowLinkPageDefinitionRefreshAction: " + t.name); -} - -@lazy -@greedy -rule RowLinkPageDefinitionBackAction - transform s: JSL!RowLinkDeclaration - to t: UI!ui::Action { - guard: actorDeclaration.getAllRelations().contains(s) - - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkPageDefinitionBackAction"); - t.name = s.name + "::Back"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationBackActionDefinition"); - - log.debug("RowLinkPageDefinitionBackAction: " + t.name); -} - -@lazy -@greedy -rule RowLinkPageDefinitionUpdateAction - transform s: JSL!RowLinkDeclaration - to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkPageDefinitionUpdateAction"); - - t.name = s.name + "::Update"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationUpdateActionDefinition"); - - log.debug("RowLinkPageDefinitionUpdateAction: " + t.name); -} - -@lazy -@greedy -rule RowLinkPageDefinitionDeleteAction - transform s: JSL!RowLinkDeclaration - to t: UI!ui::Action { - t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkPageDefinitionDeleteAction"); - - t.name = s.name + "::Delete"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationDeleteActionDefinition"); - - log.debug("RowLinkPageDefinitionDeleteAction: " + t.name); -} -*/ diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclaration.etl index 6a24c18f..a4787d59 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclaration.etl @@ -1,44 +1,3 @@ -rule FormPageContainer - transform s: JSL!UIViewDeclaration - to t: UI!ui::PageContainer { - guard: rootMenu.containsVisualElement(s) and s.form.isDefined() and s.form - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainer"); - if (t.~pos.isUndefined()) { - t.~pos = 0; - } - t.label = s.getLabelWithNameFallback(); - t.name = s.getFqName() + "::Create::PageContainer"; - t.children.add(s.equivalent("FormPageContainerVisualElement")); - t.actionButtonGroup = s.equivalent("FormPageContainerButtonGroup"); - t.dataElement = s.map.transfer.equivalent("ClassType"); - t.type = UI!ui::PageContainerType#FORM; - t.onInit = s.equivalent("FormPageContainerGetTemplateActionDefinition"); - t.templateAction = s.equivalent("FormPageContainerGetTemplateActionDefinition"); - - rootMenu.equivalent("Application").pageContainers.add(t); - - log.debug("Create FormPageContainer: " + t.name); -} - -@lazy -rule FormPageContainerVisualElement - transform s: JSL!UIViewDeclaration - to t: UI!ui::Flex { - guard: rootMenu.containsVisualElement(s) and s.form.isDefined() and s.form - - t.~pos = 0; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerVisualElement"); - t.name = s.name; - t.direction = UI!Axis#VERTICAL; - t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; - t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; - t.col = 12d; - - log.debug("FormPageContainerVisualElement: " + t.name); -} - - rule ViewPageContainer transform s: JSL!UIViewDeclaration to t: UI!ui::PageContainer { @@ -273,101 +232,3 @@ rule ViewPageContainerCancelButton log.debug("ViewPageContainerCancelButton: " + t.name); } - -@lazy -rule FormPageContainerButtonGroup - transform s: JSL!UIViewDeclaration - to t: UI!ui::ButtonGroup { - var id = rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerButtonGroup"; - t.setId(id); - t.name = s.getFqName() + "::PageActions"; - t.label = "Actions"; - t.buttons.add(s.equivalent("FormPageContainerBackButton")); - t.buttons.add(s.equivalent("FormPageContainerCreateButton")); - - log.debug("FormPageContainerButtonGroup: " + t.name); -} - -@lazy -rule FormPageContainerBackActionDefinition - transform s: JSL!UIViewDeclaration - to t: UI!ui::BackActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerBackActionDefinition"); - t.name = s.getFqName() + "::Back"; - log.debug("FormPageContainerBackActionDefinition: " + t.name); -} - -@lazy -rule FormPageContainerBackButtonIcon - transform s: JSL!UIViewDeclaration - to t: UI!ui::Icon { - t.iconName = "arrow-left"; - t.name = s.name + "BackButtonIcon"; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerBackButtonIcon"); -} - -@lazy -rule FormPageContainerBackButton - transform s: JSL!UIViewDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerBackButton"); - t.name = s.getFqName() + "::Back"; - t.label = "Back"; - t.buttonStyle = "text"; - t.icon = s.equivalent("FormPageContainerBackButtonIcon"); - t.actionDefinition = s.equivalent("FormPageContainerBackActionDefinition"); - - log.debug("FormPageContainerBackButton: " + t.name); -} - -@lazy -rule FormPageContainerCreateButtonIcon - transform s: JSL!UIViewDeclaration - to t: UI!ui::Icon { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerCreateButtonIcon"); - t.name = s.name + "CreateButtonIcon"; - t.iconName = "content-save"; - - log.debug("FormPageContainerCreateButtonIcon: " + t.name); -} - -@lazy -rule FormPageContainerCreateButton - transform s: JSL!UIViewDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerCreateButton"); - t.name = s.getFqName() + "::Create"; - t.label = "Create"; - t.buttonStyle = "contained"; - t.icon = s.equivalent("FormPageContainerCreateButtonIcon"); - t.actionDefinition = s.equivalent("FormPageContainerCreateActionDefinition"); - - log.debug("FormPageContainerCreateButton: " + t.name); -} - -@lazy -rule FormPageContainerCreateActionDefinition - transform s: JSL!UIViewDeclaration - to t: UI!ui::CreateActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerCreateActionDefinition"); - t.name = s.getFqName() + "::Create"; - - /* - if (s.autoOpenAfterCreate.isDefined()) { - t.autoOpenAfterCreate = s.autoOpenAfterCreate; - } - */ - - log.debug("FormPageContainerCreateActionDefinition: " + t.name); -} - -@lazy -rule FormPageContainerGetTemplateActionDefinition - transform s: JSL!UIViewDeclaration - to t: UI!ui::GetTemplateActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerGetTemplateActionDefinition"); - t.name = s.getFqName() + "::GetTemplate"; - t.targetType = s.map.transfer.equivalent("ClassType"); - - log.debug("FormPageContainerGetTemplateActionDefinition: " + t.name); -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclarationForm.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclarationForm.etl new file mode 100644 index 00000000..345a824a --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewDeclarationForm.etl @@ -0,0 +1,137 @@ +rule FormPageContainer + transform s: JSL!UIViewDeclaration + to t: UI!ui::PageContainer { + guard: rootMenu.containsVisualElement(s) and s.form.isDefined() and s.form + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainer"); + if (t.~pos.isUndefined()) { + t.~pos = 0; + } + t.label = s.getLabelWithNameFallback(); + t.name = s.getFqName() + "::Create::PageContainer"; + t.children.add(s.equivalent("FormPageContainerVisualElement")); + t.actionButtonGroup = s.equivalent("FormPageContainerButtonGroup"); + t.dataElement = s.map.transfer.equivalent("ClassType"); + t.type = UI!ui::PageContainerType#FORM; + t.onInit = s.equivalent("FormPageContainerGetTemplateActionDefinition"); + t.templateAction = s.equivalent("FormPageContainerGetTemplateActionDefinition"); + + rootMenu.equivalent("Application").pageContainers.add(t); + + log.debug("Create FormPageContainer: " + t.name); +} + +@lazy +rule FormPageContainerVisualElement + transform s: JSL!UIViewDeclaration + to t: UI!ui::Flex { + guard: rootMenu.containsVisualElement(s) and s.form.isDefined() and s.form + + t.~pos = 0; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerVisualElement"); + t.name = s.name; + t.direction = UI!Axis#VERTICAL; + t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; + t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; + t.col = 12d; + + log.debug("FormPageContainerVisualElement: " + t.name); +} + +@lazy +rule FormPageContainerButtonGroup + transform s: JSL!UIViewDeclaration + to t: UI!ui::ButtonGroup { + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerButtonGroup"; + t.setId(id); + t.name = s.getFqName() + "::PageActions"; + t.label = "Actions"; + t.buttons.add(s.equivalent("FormPageContainerBackButton")); + t.buttons.add(s.equivalent("FormPageContainerCreateButton")); + + log.debug("FormPageContainerButtonGroup: " + t.name); +} + +@lazy +rule FormPageContainerBackActionDefinition + transform s: JSL!UIViewDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("FormPageContainerBackActionDefinition: " + t.name); +} + +@lazy +rule FormPageContainerBackButtonIcon + transform s: JSL!UIViewDeclaration + to t: UI!ui::Icon { + t.iconName = "arrow-left"; + t.name = s.name + "BackButtonIcon"; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerBackButtonIcon"); +} + +@lazy +rule FormPageContainerBackButton + transform s: JSL!UIViewDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerBackButton"); + t.name = s.getFqName() + "::Back"; + t.label = "Back"; + t.buttonStyle = "text"; + t.icon = s.equivalent("FormPageContainerBackButtonIcon"); + t.actionDefinition = s.equivalent("FormPageContainerBackActionDefinition"); + + log.debug("FormPageContainerBackButton: " + t.name); +} + +@lazy +rule FormPageContainerCreateButtonIcon + transform s: JSL!UIViewDeclaration + to t: UI!ui::Icon { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerCreateButtonIcon"); + t.name = s.name + "CreateButtonIcon"; + t.iconName = "content-save"; + + log.debug("FormPageContainerCreateButtonIcon: " + t.name); +} + +@lazy +rule FormPageContainerCreateButton + transform s: JSL!UIViewDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerCreateButton"); + t.name = s.getFqName() + "::Create"; + t.label = "Create"; + t.buttonStyle = "contained"; + t.icon = s.equivalent("FormPageContainerCreateButtonIcon"); + t.actionDefinition = s.equivalent("FormPageContainerCreateActionDefinition"); + + log.debug("FormPageContainerCreateButton: " + t.name); +} + +@lazy +rule FormPageContainerCreateActionDefinition + transform s: JSL!UIViewDeclaration + to t: UI!ui::CreateActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerCreateActionDefinition"); + t.name = s.getFqName() + "::Create"; + + /* + if (s.autoOpenAfterCreate.isDefined()) { + t.autoOpenAfterCreate = s.autoOpenAfterCreate; + } + */ + + log.debug("FormPageContainerCreateActionDefinition: " + t.name); +} + +@lazy +rule FormPageContainerGetTemplateActionDefinition + transform s: JSL!UIViewDeclaration + to t: UI!ui::GetTemplateActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/FormPageContainerGetTemplateActionDefinition"); + t.name = s.getFqName() + "::GetTemplate"; + t.targetType = s.map.transfer.equivalent("ClassType"); + + log.debug("FormPageContainerGetTemplateActionDefinition: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl index 50952673..8b2aad12 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl @@ -1,217 +1,3 @@ -rule ViewLinkPageDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinition"); - t.name = s.getFqName() + "::ViewPage"; - t.container = s.referenceType.equivalent("ViewPageContainer"); - - rootMenu.equivalent("Application").pages.add(t); - - t.dataElement = s.equivalent("RelationType"); - - var relations = s.referenceType.map.transfer.getDirectRelations(); - - /* - log.info("==================="); - log.info(t.name + ":"); - log.info(relations.collect(r | r.name).concat(", ")); - log.info("==================="); - */ - - for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "ViewLinkPageDefinition")); - - if (link.isRefreshAllowed() and not link.isEager()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "ViewLinkPageDefinition")); - } - if (link.isCreateAllowed()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "ViewLinkPageDefinition")); - } - if (link.isDeleteAllowed()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "ViewLinkPageDefinition")); - } - if (link.getSelectorTableModifier().isDefined()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "ViewLinkPageDefinition")); - } - if (link.getSelectorTableModifier().isDefined()) { - t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "ViewLinkPageDefinition")); - } - } - - for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { - var detailLink = table.getDetailLink(); - - if (detailLink.isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "ViewLinkPageDefinition")); - } - if (table.isFilterSupported()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "ViewLinkPageDefinition")); - } - if (table.isRefreshAllowed()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "ViewLinkPageDefinition")); - } - if (table.getCreateFormModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "ViewLinkPageDefinition")); - } - if (table.isDeleteAllowed()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "ViewLinkPageDefinition")); - } - if (table.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "ViewLinkPageDefinition")); - } - if (table.getSelectorTableModifier().isDefined()) { - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "ViewLinkPageDefinition")); - t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "ViewLinkPageDefinition")); - } - } -/* - t.actions.add(s.equivalent("ViewLinkPageDefinitionBackAction")); - if (s.isRefreshAllowed()) { - t.actions.add(s.equivalent("ViewLinkPageDefinitionRefreshAction")); - } - if (s.isUpdateAllowed()) { - t.actions.add(s.equivalent("ViewLinkPageDefinitionUpdateAction")); - } - if (s.isDeleteAllowed()) { - t.actions.add(s.equivalent("ViewLinkPageDefinitionDeleteAction")); - } -*/ - log.debug("Create ViewLinkPageDefinition: " + t.name); -} - -@lazy -@greedy -rule ViewLinkPageDefinitionRefreshAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - guard: rootMenu.containsVisualElement(s) - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionRefreshAction"); - t.name = s.name + "::Refresh"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationRefreshActionDefinition"); - - log.debug("ViewLinkPageDefinitionRefreshAction: " + t.name); -} - -@lazy -@greedy -rule ViewLinkPageDefinitionBackAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - guard: rootMenu.containsVisualElement(s) - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionBackAction"); - t.name = s.name + "::Back"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationBackActionDefinition"); - - log.debug("ViewLinkPageDefinitionBackAction: " + t.name); -} - -@lazy -@greedy -rule ViewLinkPageDefinitionUpdateAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionUpdateAction"); - - t.name = s.name + "::Update"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationUpdateActionDefinition"); - - log.debug("ViewLinkPageDefinitionUpdateAction: " + t.name); -} - -@lazy -@greedy -rule ViewLinkPageDefinitionDeleteAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionDeleteAction"); - - t.name = s.name + "::Delete"; - t.actionDefinition = s.referenceType.equivalent("TransferDeclarationDeleteActionDefinition"); - - log.debug("ViewLinkPageDefinitionDeleteAction: " + t.name); -} - -@greedy -rule ViewLinkCreateFormPageDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) and s.referenceType.form.isDefined() and s.referenceType.form - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormPageDefinition"); - - t.name = s.getFqName() + "::FormPage"; - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType; - t.container = targetContainer.equivalent("TransferDeclarationPageContainer"); - - rootMenu.equivalent("Application").pages.add(t); - - t.dataElement = s.equivalent("FormRelationType"); - - var relations = s.referenceType.map.transfer.getDirectRelations(); - - /* - log.info("==================="); - log.info(t.name + ":"); - log.info(relations.collect(r | r.name).concat(", ")); - log.info("==================="); - */ - - for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { - t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); - } - - for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { - var detailLink = table.getDetailLink(); - - if (detailLink.isDefined()) { - t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); - } - } - - t.actions.add(s.equivalent("ViewLinkCreateFormBackAction")); - t.actions.add(s.equivalent("ViewLinkCreateFormCreateAction")); - - log.debug("Create ViewLinkCreateFormPageDefinition: " + t.name); -} - -@greedy -@lazy -rule ViewLinkCreateFormCreateAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormCreateAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - - t.name = s.name + "::Create"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationCreateActionDefinition"); - - log.debug("ViewLinkCreateFormCreateAction: " + t.name); -} - -@greedy -@lazy -rule ViewLinkCreateFormBackAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormBackAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - - t.name = s.name + "::Back"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationBackActionDefinition"); - - log.debug("ViewLinkCreateFormBackAction: " + t.name); -} - @abstract rule AbstractViewLinkDeclaration transform s: JSL!UIViewLinkDeclaration @@ -233,7 +19,7 @@ rule AbstractViewLinkDeclaration } if (t.isEager) { - // TODO finish additional mas attributes + // TODO finish additional mask attributes /* for (dataFeature in s.additionalMaskFeatures) { var attributeType = dataFeature.getMember().mapAttributeType(s.getRoot().getTransferObjectType().equivalent("ClassType")); @@ -257,8 +43,6 @@ rule InlineViewLink transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Link extends AbstractViewLinkDeclaration { - guard: rootMenu.containsVisualElement(s) - var id = rootMenu.name + "/(jsl/" + s.getId() + ")/InlineViewLink"; t.setId(id); t.dataElement = s.transferRelation.target.equivalent("RelationType"); @@ -297,18 +81,6 @@ rule ViewLinkDeclarationRefreshActionDefinition log.debug("ViewLinkDeclarationOpenPageActionDefinitionViewLinkDeclarationRefreshActionDefinition: " + t.name); } -@greedy -@lazy -rule ViewLinkDeclarationRefreshAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRefreshAction"); - t.name = s.name + "::Refresh"; - t.actionDefinition = s.equivalent("ViewLinkDeclarationRefreshActionDefinition"); - - log.debug("ViewLinkDeclarationRefreshAction: " + t.name); -} - @lazy rule InlineViewLinkButtonGroup transform s: JSL!UIViewLinkDeclaration @@ -318,8 +90,7 @@ rule InlineViewLinkButtonGroup t.label = "Actions"; t.buttons.add(s.equivalent("ViewLinkDeclarationOpenPageButton")); - - if (s.transferRelation.target.isCreateAllowed()) { + if (s.getCreateFormModifier().isDefined()) { t.buttons.add(s.equivalent("ViewLinkDeclarationOpenFormButton")); } if (s.transferRelation.target.isDeleteAllowed()) { @@ -395,22 +166,6 @@ rule ViewLinkDeclarationOpenPageActionDefinition log.debug("ViewLinkDeclarationOpenPageActionDefinition: " + t.name); } -@greedy -@lazy -rule ViewLinkDeclarationOpenPageAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageAction"); - - t.name = s.name + "::OpenPage"; - t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenPageActionDefinition"); - - t.targetPageDefinition = s.equivalent("ViewLinkPageDefinition"); - - log.debug("ViewLinkDeclarationOpenPageAction: " + t.name); -} - - @lazy rule ViewLinkDeclarationOpenFormButton transform s: JSL!UIViewLinkDeclaration @@ -448,21 +203,6 @@ rule ViewLinkDeclarationOpenCreateFormActionDefinition log.debug("ViewLinkDeclarationOpenCreateFormActionDefinition: " + t.name); } -@greedy -@lazy -rule ViewLinkDeclarationOpenFormAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormAction"); - - t.name = s.name + "::OpenForm"; - t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenCreateFormActionDefinition"); - - t.targetPageDefinition = s.equivalent("ViewLinkCreateFormPageDefinition"); - - log.debug("ViewLinkDeclarationOpenFormAction: " + t.name); -} - @lazy rule ViewLinkDeclarationDeleteButton transform s: JSL!UIViewLinkDeclaration @@ -500,19 +240,6 @@ rule ViewLinkDeclarationRowDeleteActionDefinition log.debug("ViewLinkDeclarationRowDeleteActionDefinition: " + t.name); } -@greedy -@lazy -rule ViewLinkDeclarationRowDeleteAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRowDeleteAction"); - - t.name = s.name + "::RowDelete"; - t.actionDefinition = s.equivalent("ViewLinkDeclarationRowDeleteActionDefinition"); - - log.debug("ViewLinkDeclarationRowDeleteAction: " + t.name); -} - @lazy rule ViewLinkDeclarationUnsetButton transform s: JSL!UIViewLinkDeclaration @@ -539,17 +266,6 @@ rule ViewLinkDeclarationUnsetActionDefinition log.debug("ViewLinkDeclarationUnsetActionDefinition: " + t.name); } -@lazy -rule ViewLinkDeclarationUnsetAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetAction"); - t.name = s.name + "::Unset"; - t.actionDefinition = s.equivalent("ViewLinkDeclarationUnsetActionDefinition"); - - log.debug("ViewLinkDeclarationUnsetAction: " + t.name); -} - @lazy rule ViewLinkDeclarationOpenSetSelectorButton transform s: JSL!UIViewLinkDeclaration @@ -575,302 +291,3 @@ rule ViewLinkDeclarationOpenSetSelectorActionDefinition log.debug("ViewLinkDeclarationOpenSetSelectorActionDefinition: " + t.name); } - -@lazy -rule ViewLinkDeclarationOpenSetSelectorDialogAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorDialogAction"); - t.name = s.name + "::OpenSetSelector"; - t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenSetSelectorActionDefinition"); - t.targetPageDefinition = s.equivalent("ViewLinkDeclarationSetSelectorPageDefinition"); - - log.debug("ViewLinkDeclarationOpenSetSelectorDialogAction: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorPageDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::PageDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageDefinition"); - t.name = s.getFqName() + "::SetSelectorPage"; - t.container = s.equivalent("ViewLinkDeclarationSetSelectorPageContainer"); - t.dataElement = s.equivalent("RelationType"); - t.openInDialog = true; - t.dialogSize = UI!ui::DialogSize#MD; - - t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorSetAction")); - t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorBackAction")); - t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorTableFilterAction")); - t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorTableRangeAction")); - - rootMenu.equivalent("Application").pages.add(t); - - log.debug("ViewLinkDeclarationSetSelectorPageDefinition: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorSetAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetAction"); - t.name = s.getFqName() + "::SetSelector::Set"; - t.ownerDataElement = s.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorSetAction: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorBackAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackAction"); - t.name = s.getFqName() + "::SetSelector::Back"; - t.ownerDataElement = s.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorBackActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorBackAction: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableFilterAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterAction"); - t.name = s.getFqName() + "::SetSelector::Table::Filter"; - t.ownerDataElement = s.equivalent("RelationType"); - t.targetDataElement = s.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorTableFilterAction: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableRangeAction - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeAction"); - t.name = s.getFqName() + "::SetSelector::Table::Range"; - t.ownerDataElement = s.equivalent("RelationType"); - t.targetDataElement = s.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorTableRangeAction: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorPageContainer - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::PageContainer { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageContainer"); - t.name = s.getFqName() + "::SetSelector::PageContainer"; - t.label = s.getLabelWithNameFallback(); - t.titleFrom = UI!ui::TitleFrom#LABEL; - t.type = UI!ui::PageContainerType#TABLE; - t.onInit = s.equivalent("ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); - - t.children.add(s.equivalent("ViewLinkDeclarationSetSelectorVisualElement")); - t.actionButtonGroup = s.equivalent("ViewLinkDeclarationSetSelectorButtonGroup"); - t.dataElement = s.referenceType.equivalent("ClassType"); - t.isSelector = true; - t.isRelationSelector = true; - - rootMenu.equivalent("Application").pageContainers.add(t); - - log.debug("ViewLinkDeclarationSetSelectorPageContainer: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorVisualElement - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Flex { - t.~pos = 0; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorVisualElement"); - t.name = s.name; - t.direction = UI!Axis#VERTICAL; - t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; - t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; - t.col = 12d; - t.children.add(s.equivalent("ViewLinkDeclarationSetSelectorTable")); - t.frame = s.equivalent("ViewLinkDeclarationSetSelectorFrame"); - - log.debug("ViewLinkDeclarationSetSelectorVisualElement: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorFrame - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Frame { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorFrame"); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTable - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Table { - var id = rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTable"; - t.setId(id); - t.col = 12d; - t.label = s.getLabelWithNameFallback(); - t.isSelectorTable = true; - t.isRelationSelectorTable = true; - t.allowSelectMultiple = false; - t.name = s.name + "::Set::Selector"; - t.relationName = s.name; - t.dataElement = s.transferRelation.target.referenceType.equivalent("ClassType"); - t.tableActionButtonGroup = s.equivalent("ViewLinkDeclarationSetSelectorTableButtonGroup"); - t.~pos = s.~pos; - t.showTotalCount = false; - t.selectorRowsPerPage = 10; - - if (s.getRows().isDefined()) { - t.rowsPerPage = s.getRows().value.asInteger(); - } else { - t.rowsPerPage = 10; - } - if (t.~pos.isUndefined()) { - t.~pos = 0; - } - - // TODO eventually selector should work? - var targetDeclaration = s.referenceType; - var rowDeclaration = s.getSelectorTableModifier().row; - - var columns = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); - - for (column in columns) { - var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); - t.columns.add(col); - if (col.attributeType.isFilterable) { - t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); - } - } - - log.debug("ViewLinkDeclarationSetSelectorTable: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableButtonGroup - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableButtonGroup"); - t.name = s.getFqName() + "::SetSelectorTableActions"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorTableFilterButton")); - t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorTableRefreshButton")); - - log.debug("ViewLinkDeclarationSetSelectorTableButtonGroup: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableFilterButton - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterButton"); - t.name = s.getFqName() + "::SetSelector::Table::Filter"; - t.label = "Set Filters"; - t.buttonStyle = "text"; - t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorTableFilterButton: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableFilterActionDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::FilterActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); - t.name = s.getFqName() + "::Table::Filter"; - log.debug("ViewLinkDeclarationSetSelectorTableFilterActionDefinition: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableRefreshButton - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRefreshButton"); - t.name = s.getFqName() + "::SetSelector::Table::Refresh"; - t.label = "Refresh"; - t.buttonStyle = "text"; - t.icon = "refresh".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorTableRefreshButton: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorTableRangeActionDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::SelectorRangeActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); - - t.name = s.getFqName() + "::SetSelector::Table::Range"; - t.targetType = s.referenceType.equivalent("ClassType"); - - log.debug("ViewLinkDeclarationSetSelectorTableRangeActionDefinition: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorButtonGroup - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorButtonGroup"); - t.name = s.getFqName() + "::SetSelectorButtonGroup"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorBackButton")); - t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetButton")); - - log.debug("ViewLinkDeclarationSetSelectorButtonGroup: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorSetSelectorBackButton - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorBackButton"); - t.name = s.getFqName() + "::Back"; - t.label = "Back"; - t.buttonStyle = "text"; - t.icon = "arrow-left".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorBackActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorSetSelectorBackButton: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorBackActionDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::BackActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackActionDefinition"); - t.name = s.getFqName() + "::Back"; - log.debug("ViewLinkDeclarationSetSelectorBackActionDefinition: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorSetSelectorSetButton - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetButton"); - t.name = s.getFqName() + "::Set"; - t.label = "Set"; - t.buttonStyle = "contained"; - t.icon = "attachment-plus".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); - - log.debug("ViewLinkDeclarationSetSelectorSetSelectorSetButton: " + t.name); -} - -@lazy -rule ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition - transform s: JSL!UIViewLinkDeclaration - to t: UI!ui::SetActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); - t.name = s.getFqName() + "::Set"; - t.targetType = s.referenceType.equivalent("ClassType"); - - log.debug("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition: " + t.name); -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl new file mode 100644 index 00000000..fe4803ab --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl @@ -0,0 +1,74 @@ +@greedy +rule ViewLinkCreateFormPageDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormPageDefinition"); + + t.name = s.getFqName() + "::FormPage"; + + t.container = s.getCreateFormModifier().form.equivalent("FormPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = s.transferRelation.target.equivalent("RelationType"); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + +/* + for (link in s.getCreateFormModifier().form.getAllLinks()) { + t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); + } + + for (table in s.getCreateFormModifier().form.getAllLinks()) { + var detailLink = table.getDetailLink(); + + if (detailLink.isDefined()) { + t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); + } + } +*/ + + t.actions.add(s.equivalent("ViewLinkCreateFormBackAction")); + t.actions.add(s.equivalent("ViewLinkCreateFormCreateAction")); + + log.debug("Create ViewLinkCreateFormPageDefinition: " + t.name); +} + +@greedy +@lazy +rule ViewLinkCreateFormCreateAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormCreateAction"); + + var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); + var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; + + t.name = s.name + "::Create"; + t.actionDefinition = targetContainer.equivalent("TransferDeclarationCreateActionDefinition"); + + log.debug("ViewLinkCreateFormCreateAction: " + t.name); +} + +@greedy +@lazy +rule ViewLinkCreateFormBackAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormBackAction"); + + var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); + var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; + + t.name = s.name + "::Back"; + t.actionDefinition = targetContainer.equivalent("TransferDeclarationBackActionDefinition"); + + log.debug("ViewLinkCreateFormBackAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationSetSelectorPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationSetSelectorPage.etl new file mode 100644 index 00000000..e428507d --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationSetSelectorPage.etl @@ -0,0 +1,286 @@ +@lazy +rule ViewLinkDeclarationSetSelectorPageDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::PageDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageDefinition"); + t.name = s.getFqName() + "::SetSelectorPage"; + t.container = s.equivalent("ViewLinkDeclarationSetSelectorPageContainer"); + t.dataElement = s.equivalent("RelationType"); + t.openInDialog = true; + t.dialogSize = UI!ui::DialogSize#MD; + + t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorSetAction")); + t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorBackAction")); + t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorTableFilterAction")); + t.actions.add(s.equivalent("ViewLinkDeclarationSetSelectorTableRangeAction")); + + rootMenu.equivalent("Application").pages.add(t); + + log.debug("ViewLinkDeclarationSetSelectorPageDefinition: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorPageContainer + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::PageContainer { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorPageContainer"); + t.name = s.getFqName() + "::SetSelector::PageContainer"; + t.label = s.getLabelWithNameFallback(); + t.titleFrom = UI!ui::TitleFrom#LABEL; + t.type = UI!ui::PageContainerType#TABLE; + t.onInit = s.equivalent("ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); + + t.children.add(s.equivalent("ViewLinkDeclarationSetSelectorVisualElement")); + t.actionButtonGroup = s.equivalent("ViewLinkDeclarationSetSelectorButtonGroup"); + t.dataElement = s.referenceType.equivalent("ClassType"); + t.isSelector = true; + t.isRelationSelector = true; + + rootMenu.equivalent("Application").pageContainers.add(t); + + log.debug("ViewLinkDeclarationSetSelectorPageContainer: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorVisualElement + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Flex { + t.~pos = 0; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorVisualElement"); + t.name = s.name; + t.direction = UI!Axis#VERTICAL; + t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; + t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; + t.col = 12d; + t.children.add(s.equivalent("ViewLinkDeclarationSetSelectorTable")); + t.frame = s.equivalent("ViewLinkDeclarationSetSelectorFrame"); + + log.debug("ViewLinkDeclarationSetSelectorVisualElement: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorFrame + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Frame { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorFrame"); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTable + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Table { + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTable"; + t.setId(id); + t.col = 12d; + t.label = s.getLabelWithNameFallback(); + t.isSelectorTable = true; + t.isRelationSelectorTable = true; + t.allowSelectMultiple = false; + t.name = s.name + "::Set::Selector"; + t.relationName = s.name; + t.dataElement = s.transferRelation.target.referenceType.equivalent("ClassType"); + t.tableActionButtonGroup = s.equivalent("ViewLinkDeclarationSetSelectorTableButtonGroup"); + t.~pos = s.~pos; + t.showTotalCount = false; + t.selectorRowsPerPage = 10; + + if (s.getRows().isDefined()) { + t.rowsPerPage = s.getRows().value.asInteger(); + } else { + t.rowsPerPage = 10; + } + if (t.~pos.isUndefined()) { + t.~pos = 0; + } + + // TODO eventually selector should work? + var targetDeclaration = s.referenceType; + var rowDeclaration = s.getSelectorTableModifier().row; + + var columns = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); + + for (column in columns) { + var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); + t.columns.add(col); + if (col.attributeType.isFilterable) { + t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + } + } + + log.debug("ViewLinkDeclarationSetSelectorTable: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableButtonGroup + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableButtonGroup"); + t.name = s.getFqName() + "::SetSelectorTableActions"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorTableFilterButton")); + t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorTableRefreshButton")); + + log.debug("ViewLinkDeclarationSetSelectorTableButtonGroup: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableFilterButton + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterButton"); + t.name = s.getFqName() + "::SetSelector::Table::Filter"; + t.label = "Set Filters"; + t.buttonStyle = "text"; + t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorTableFilterButton: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableFilterActionDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::FilterActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); + t.name = s.getFqName() + "::Table::Filter"; + log.debug("ViewLinkDeclarationSetSelectorTableFilterActionDefinition: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableRefreshButton + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRefreshButton"); + t.name = s.getFqName() + "::SetSelector::Table::Refresh"; + t.label = "Refresh"; + t.buttonStyle = "text"; + t.icon = "refresh".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorTableRefreshButton: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableRangeActionDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::SelectorRangeActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); + + t.name = s.getFqName() + "::SetSelector::Table::Range"; + t.targetType = s.referenceType.equivalent("ClassType"); + + log.debug("ViewLinkDeclarationSetSelectorTableRangeActionDefinition: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorButtonGroup + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorButtonGroup"); + t.name = s.getFqName() + "::SetSelectorButtonGroup"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorBackButton")); + t.buttons.add(s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetButton")); + + log.debug("ViewLinkDeclarationSetSelectorButtonGroup: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorSetSelectorBackButton + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorBackButton"); + t.name = s.getFqName() + "::Back"; + t.label = "Back"; + t.buttonStyle = "text"; + t.icon = "arrow-left".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorBackActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorSetSelectorBackButton: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorBackActionDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("ViewLinkDeclarationSetSelectorBackActionDefinition: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorSetSelectorSetButton + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetButton"); + t.name = s.getFqName() + "::Set"; + t.label = "Set"; + t.buttonStyle = "contained"; + t.icon = "attachment-plus".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorSetSelectorSetButton: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::SetActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); + t.name = s.getFqName() + "::Set"; + t.targetType = s.referenceType.equivalent("ClassType"); + + log.debug("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorSetAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorSetAction"); + t.name = s.getFqName() + "::SetSelector::Set"; + t.ownerDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorSetSelectorSetActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorSetAction: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorBackAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorBackAction"); + t.name = s.getFqName() + "::SetSelector::Back"; + t.ownerDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorBackActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorBackAction: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableFilterAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableFilterAction"); + t.name = s.getFqName() + "::SetSelector::Table::Filter"; + t.ownerDataElement = s.equivalent("RelationType"); + t.targetDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableFilterActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorTableFilterAction: " + t.name); +} + +@lazy +rule ViewLinkDeclarationSetSelectorTableRangeAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationSetSelectorTableRangeAction"); + t.name = s.getFqName() + "::SetSelector::Table::Range"; + t.ownerDataElement = s.equivalent("RelationType"); + t.targetDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewLinkDeclarationSetSelectorTableRangeActionDefinition"); + + log.debug("ViewLinkDeclarationSetSelectorTableRangeAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationViewPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationViewPage.etl new file mode 100644 index 00000000..e2b2a126 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationViewPage.etl @@ -0,0 +1,213 @@ +rule ViewLinkPageDefinition + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinition"); + t.name = s.getFqName() + "::ViewPage"; + t.container = s.referenceType.equivalent("ViewPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = s.transferRelation.target.equivalent("RelationType"); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + + for (link in s.referenceType.getAllLinks()) { + var lRelation = link.transferRelation.target; + + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "ViewLinkPageDefinition")); + if (lRelation.isRefreshAllowed() and not lRelation.isEager()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "ViewLinkPageDefinition")); + } + if (link.getCreateFormModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "ViewLinkPageDefinition")); + } + if (lRelation.isDeleteAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "ViewLinkPageDefinition")); + } + if (link.getSelectorTableModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "ViewLinkPageDefinition")); + } + if (link.getSelectorTableModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "ViewLinkPageDefinition")); + } + } + + for (table in s.referenceType.getAllTables()) { + var tRelation = table.transferRelation.target; + + if (table.getUpdateViewModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "ViewLinkPageDefinition")); + } + if (tRelation.isFilterSupported()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "ViewLinkPageDefinition")); + } + if (tRelation.isRefreshAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "ViewLinkPageDefinition")); + } + if (table.getCreateFormModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "ViewLinkPageDefinition")); + } + if (tRelation.isDeleteAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "ViewLinkPageDefinition")); + } + if (table.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "ViewLinkPageDefinition")); + } + if (table.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "ViewLinkPageDefinition")); + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "ViewLinkPageDefinition")); + } + } + + t.actions.add(s.equivalent("ViewLinkPageDefinitionBackAction")); + if (s.transferRelation.target.isRefreshAllowed()) { + t.actions.add(s.equivalent("ViewLinkPageDefinitionRefreshAction")); + } + if (s.transferRelation.target.isUpdateAllowed()) { + t.actions.add(s.equivalent("ViewLinkPageDefinitionUpdateAction")); + } + if (s.transferRelation.target.isDeleteAllowed()) { + t.actions.add(s.equivalent("ViewLinkPageDefinitionDeleteAction")); + } + + log.debug("Create ViewLinkPageDefinition: " + t.name); +} + +@lazy +@greedy +rule ViewLinkPageDefinitionRefreshAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionRefreshAction"); + t.name = s.name + "::Refresh"; + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerRefreshActionDefinition"); + + log.debug("ViewLinkPageDefinitionRefreshAction: " + t.name); +} + +@lazy +@greedy +rule ViewLinkPageDefinitionBackAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionBackAction"); + t.name = s.name + "::Back"; + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerBackActionDefinition"); + + log.debug("ViewLinkPageDefinitionBackAction: " + t.name); +} + +@lazy +@greedy +rule ViewLinkPageDefinitionUpdateAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionUpdateAction"); + + t.name = s.name + "::Update"; + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerUpdateActionDefinition"); + + log.debug("ViewLinkPageDefinitionUpdateAction: " + t.name); +} + +@lazy +@greedy +rule ViewLinkPageDefinitionDeleteAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkPageDefinitionDeleteAction"); + + t.name = s.name + "::Delete"; + t.actionDefinition = s.referenceType.equivalent("ViewPageContainerDeleteActionDefinition"); + + log.debug("ViewLinkPageDefinitionDeleteAction: " + t.name); +} + +@greedy +@lazy +rule ViewLinkDeclarationRefreshAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRefreshAction"); + t.name = s.name + "::Refresh"; + t.actionDefinition = s.equivalent("ViewLinkDeclarationRefreshActionDefinition"); + + log.debug("ViewLinkDeclarationRefreshAction: " + t.name); +} + +@greedy +@lazy +rule ViewLinkDeclarationOpenPageAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageAction"); + + t.name = s.name + "::OpenPage"; + t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenPageActionDefinition"); + + t.targetPageDefinition = s.equivalent("ViewLinkPageDefinition"); + + log.debug("ViewLinkDeclarationOpenPageAction: " + t.name); +} + +@greedy +@lazy +rule ViewLinkDeclarationOpenFormAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenFormAction"); + + t.name = s.name + "::OpenForm"; + t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenCreateFormActionDefinition"); + + t.targetPageDefinition = s.equivalent("ViewLinkCreateFormPageDefinition"); + + log.debug("ViewLinkDeclarationOpenFormAction: " + t.name); +} + +@greedy +@lazy +rule ViewLinkDeclarationRowDeleteAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationRowDeleteAction"); + + t.name = s.name + "::RowDelete"; + t.actionDefinition = s.equivalent("ViewLinkDeclarationRowDeleteActionDefinition"); + + log.debug("ViewLinkDeclarationRowDeleteAction: " + t.name); +} + +@lazy +rule ViewLinkDeclarationUnsetAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationUnsetAction"); + t.name = s.name + "::Unset"; + t.actionDefinition = s.equivalent("ViewLinkDeclarationUnsetActionDefinition"); + + log.debug("ViewLinkDeclarationUnsetAction: " + t.name); +} + +@lazy +rule ViewLinkDeclarationOpenSetSelectorDialogAction + transform s: JSL!UIViewLinkDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenSetSelectorDialogAction"); + t.name = s.name + "::OpenSetSelector"; + t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenSetSelectorActionDefinition"); + t.targetPageDefinition = s.equivalent("ViewLinkDeclarationSetSelectorPageDefinition"); + + log.debug("ViewLinkDeclarationOpenSetSelectorDialogAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index b935feb9..fd2a1dcf 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -1,81 +1,3 @@ -@greedy -rule ViewTableCreateFormPageDefinition - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::PageDefinition { - guard: rootMenu.containsVisualElement(s) and s.referenceType.form.isDefined() and s.referenceType.form - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormPageDefinition"); - - t.name = s.getFqName() + "::FormPage"; - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType; - t.container = targetContainer.equivalent("TransferDeclarationPageContainer"); - - rootMenu.equivalent("Application").pages.add(t); - - t.dataElement = s.equivalent("FormRelationType"); - - // var relations = s.referenceType.getDirectRelations(); - - /* - log.info("==================="); - log.info(t.name + ":"); - log.info(relations.collect(r | r.name).concat(", ")); - log.info("==================="); - */ - /* - for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { - t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); - } - - for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { - var detailLink = table.getDetailLink(); - - if (detailLink.isDefined()) { - t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); - } - } - */ - - t.actions.add(s.equivalent("ViewTableCreateFormBackAction")); - t.actions.add(s.equivalent("ViewTableCreateFormCreateAction")); - - log.debug("Create ViewTableCreateFormPageDefinition: " + t.name); -} - -@greedy -@lazy -rule ViewTableCreateFormCreateAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormCreateAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - - t.name = s.name + "::Create"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationCreateActionDefinition"); - - log.debug("ViewTableCreateFormCreateAction: " + t.name); -} - -@greedy -@lazy -rule ViewTableCreateFormBackAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormBackAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - - t.name = s.name + "::Back"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationBackActionDefinition"); - - log.debug("ViewTableCreateFormBackAction: " + t.name); -} - @abstract rule AbstractViewTableDeclaration transform s: JSL!UIViewTableDeclaration @@ -128,6 +50,7 @@ rule InlineViewTable t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); } } + /* for (link in links) { if (link.getDetail().isUndefined()) { @@ -345,17 +268,6 @@ rule ViewTableDeclarationFilterActionDefinition log.debug("ViewTableDeclarationFilterActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationFilterAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterAction"); - t.name = s.name + "::Filter"; - t.actionDefinition = s.equivalent("ViewTableDeclarationFilterActionDefinition"); - - log.debug("ViewTableDeclarationFilterAction: " + t.name); -} - @lazy rule ViewTableDeclarationRefreshButton transform s: JSL!UIViewTableDeclaration @@ -392,17 +304,6 @@ rule ViewTableDeclarationRefreshActionDefinition log.debug("ViewTableDeclarationRefreshActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationRefreshAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshAction"); - t.name = s.name + "::Refresh"; - t.actionDefinition = s.equivalent("ViewTableDeclarationRefreshActionDefinition"); - - log.debug("ViewTableDeclarationRefreshAction: " + t.name); -} - @lazy rule ViewTableDeclarationOpenCreateButton transform s: JSL!UIViewTableDeclaration @@ -439,19 +340,6 @@ rule ViewTableDeclarationOpenCreateActionDefinition log.debug("ViewTableDeclarationOpenCreateActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationOpenCreateAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateAction"); - t.name = s.name + "::OpenCreate"; - t.actionDefinition = s.equivalent("ViewTableDeclarationOpenCreateActionDefinition"); - - t.targetPageDefinition = s.equivalent("ViewTableCreateFormPageDefinition"); - - log.debug("ViewTableDeclarationOpenCreateAction: " + t.name); -} - @lazy rule ViewTableDeclarationOpenPageButton transform s: JSL!UIViewTableDeclaration @@ -488,22 +376,6 @@ rule ViewTableDeclarationOpenPageActionDefinition log.debug("ViewTableDeclarationOpenPageActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationOpenPageAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - var row = s.referenceType; - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageAction"); - - t.name = s.name + "::OpenPage"; - t.actionDefinition = s.equivalent("ViewTableDeclarationOpenPageActionDefinition"); - - t.targetPageDefinition = s.getDetailLink().equivalent("RowLinkPageDefinition"); - - log.debug("ViewTableDeclarationOpenPageAction: " + t.name); -} - @lazy rule ViewTableDeclarationRowDeleteButton transform s: JSL!UIViewTableDeclaration @@ -540,17 +412,6 @@ rule ViewTableDeclarationRowDeleteActionDefinition log.debug("ViewTableDeclarationRowDeleteActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationRowDeleteAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteAction"); - t.name = s.name + "::RowDelete"; - t.actionDefinition = s.equivalent("ViewTableDeclarationRowDeleteActionDefinition"); - - log.debug("ViewTableDeclarationRowDeleteAction: " + t.name); -} - @lazy rule ViewTableDeclarationOpenAddSelectorButton transform s: JSL!UIViewTableDeclaration @@ -588,19 +449,6 @@ rule ViewTableDeclarationOpenAddSelectorActionDefinition log.debug("ViewTableDeclarationOpenAddSelectorActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationOpenAddSelectorAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorAction"); - t.name = s.name + "::OpenAddSelector"; - t.actionDefinition = s.equivalent("ViewTableDeclarationOpenAddSelectorActionDefinition"); - - t.targetPageDefinition = s.equivalent("ViewTableDeclarationAddSelectorPageDefinition"); - - log.debug("ViewTableDeclarationOpenAddSelectorAction: " + t.name); -} - @lazy rule ViewTableDeclarationBulkRemoveButton transform s: JSL!UIViewTableDeclaration @@ -639,20 +487,6 @@ rule ViewTableDeclarationBulkRemoveActionDefinition log.debug("ViewTableDeclarationBulkRemoveActionDefinition: " + t.name); } -@lazy -rule ViewTableDeclarationBulkRemoveAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveAction"); - t.name = s.name + "::BulkRemove"; - t.actionDefinition = s.equivalent("ViewTableDeclarationBulkRemoveActionDefinition"); - - t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); - t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); - - log.debug("ViewTableDeclarationBulkRemoveAction: " + t.name); -} - @lazy rule ViewTableDeclarationClearButton transform s: JSL!UIViewTableDeclaration @@ -688,321 +522,3 @@ rule ViewTableDeclarationClearActionDefinition log.debug("ViewTableDeclarationClearActionDefinition: " + t.name); } - -@lazy -rule ViewTableDeclarationClearAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearAction"); - t.name = s.name + "::Clear"; - t.actionDefinition = s.equivalent("ViewTableDeclarationClearActionDefinition"); - - t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); - t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); - - log.debug("ViewTableDeclarationClearAction: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorPageDefinition - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::PageDefinition { - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageDefinition"); - - t.name = s.getFqName() + "::AddSelectorPage"; - - t.container = s.equivalent("ViewTableDeclarationAddSelectorPageContainer"); - t.dataElement = s.transferRelation.target.equivalent("RelationType"); - t.openInDialog = true; - t.dialogSize = UI!ui::DialogSize#MD; - - t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorAddAction")); - t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorBackAction")); - t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorTableFilterAction")); - t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorTableRangeAction")); - - rootMenu.equivalent("Application").pages.add(t); - - log.debug("ViewTableDeclarationAddSelectorPageDefinition: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorAddAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorAddAction"); - t.name = s.getFqName() + "::AddSelector::Add"; - t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorAddAction: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorBackAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorBackAction"); - t.name = s.getFqName() + "::AddSelector::Back"; - t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorBackAction: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableFilterAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableFilterAction"); - t.name = s.getFqName() + "::AddSelector::Table::Filter"; - t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); - t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorTableFilterAction: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableRangeAction - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Action { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeAction"); - t.name = s.getFqName() + "::AddSelector::Table::Range"; - t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); - t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorTableRangeAction: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorPageContainer - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::PageContainer { - - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageContainer"); - - t.name = s.getFqName() + "::AddSelector::PageContainer"; - t.label = s.getLabelWithNameFallback(); - t.titleFrom = UI!ui::TitleFrom#LABEL; - t.type = UI!ui::PageContainerType#TABLE; - t.onInit = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); - - t.children.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorVisualElement")); - t.actionButtonGroup = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); - t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); - t.isSelector = true; - t.isRelationSelector = true; - - rootMenu.equivalent("Application").pageContainers.add(t); - - log.debug("ViewTableDeclarationAddSelectorPageContainer: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableRangeActionDefinition - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::SelectorRangeActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeActionDefinition"); - - t.name = s.getFqName() + "::AddSelector::Table::Range"; - t.targetType = s.referenceType.equivalent("ClassType"); - - log.debug("ViewTableDeclarationAddSelectorTableRangeActionDefinition: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); - t.name = s.getFqName() + "::AddSelectorTableAddSelectorButtonGroup"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorBackButton")); - t.buttons.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddButton")); - - log.debug("ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableAddSelectorBackButton - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorBackButton"); - t.name = s.getFqName() + "::Back"; - t.label = "Back"; - t.buttonStyle = "text"; - t.icon = "arrow-left".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorTableAddSelectorBackButton: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableBackActionDefinition - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::BackActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableBackActionDefinition"); - t.name = s.getFqName() + "::Back"; - log.debug("ViewTableDeclarationAddSelectorTableBackActionDefinition: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableAddSelectorAddButton - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddButton"); - t.name = s.getFqName() + "::Add"; - t.label = "Add"; - t.buttonStyle = "contained"; - t.icon = "attachment-plus".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorTableAddSelectorAddButton: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::AddActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); - t.name = s.getFqName() + "::Add"; - t.targetType = s.referenceType.equivalent("ClassType"); - log.debug("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableAddSelectorVisualElement - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Flex { - t.~pos = 0; - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorVisualElement"); - t.name = s.name; - t.direction = UI!Axis#VERTICAL; - t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; - t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; - t.col = 12d; - t.children.add(s.equivalent("ViewTableDeclarationAddSelectorTableTable")); - t.frame = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorFrame"); - - log.debug("ViewTableDeclarationAddSelectorTableAddSelectorVisualElement: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableAddSelectorFrame - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Frame { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorFrame"); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableTable - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Table { - var id = rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTable"; - t.setId(id); - t.col = 12d; - t.label = s.getLabelWithNameFallback(); - t.isSelectorTable = true; - t.isRelationSelectorTable = true; - t.allowSelectMultiple = true; - t.name = s.name + "::Add::Selector"; - t.relationName = s.name; - t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); - t.tableActionButtonGroup = s.equivalent("ViewTableDeclarationAddSelectorTableTableButtonGroup"); - t.~pos = s.~pos; - t.showTotalCount = false; - t.selectorRowsPerPage = 10; - - if (s.getRows().isDefined()) { - t.rowsPerPage = s.getRows().value.asInteger(); - } else { - t.rowsPerPage = 10; - } - if (t.~pos.isUndefined()) { - t.~pos = 0; - } - - // TODO eventually selector should work? - var rowDeclaration = s.getSelectorTableModifier().row; - - var columns = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); - // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); - - for (column in columns) { - var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); - t.columns.add(col); - if (col.attributeType.isFilterable) { - t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); - } - } -/* - for (link in links) { - if (link.getDetail().isUndefined()) { - var col = link.equivalentDiscriminated("RowLinkDerivedColumn", id); - t.columns.add(col); - if (col.attributeType.isFilterable) { - t.filters.add(link.equivalentDiscriminated("RowLinkDerivedColumnFilter", id)); - } - } else { - // TODO generate open action from link with detail modifier - } - - } -*/ - log.debug("ViewTableDeclarationAddSelectorTableTable: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableTableButtonGroup - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::ButtonGroup { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableButtonGroup"); - t.name = s.getFqName() + "::AddSelectorTableActions"; - t.label = "Actions"; - - t.buttons.add(s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterButton")); - t.buttons.add(s.equivalent("TransferObjectTableAddSelectorTableRefreshButton")); - - log.debug("ViewTableDeclarationAddSelectorTableTableButtonGroup: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableTableFilterButton - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterButton"); - t.name = s.getFqName() + "::AddSelector::Table::Filter"; - t.label = "Set Filters"; - t.buttonStyle = "text"; - t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); - - log.debug("ViewTableDeclarationAddSelectorTableTableFilterButton: " + t.name); -} - -@lazy -rule ViewTableDeclarationAddSelectorTableTableFilterActionDefinition - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::FilterActionDefinition { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); - t.name = s.getFqName() + "::Table::Filter"; - log.debug("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition: " + t.name); -} - -@lazy -rule TransferObjectTableAddSelectorTableRefreshButton - transform s: JSL!UIViewTableDeclaration - to t: UI!ui::Button { - t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TransferObjectTableAddSelectorTableRefreshButton"); - t.name = s.getFqName() + "::AddSelector::Table::Refresh"; - t.label = "Refresh"; - t.buttonStyle = "text"; - t.icon = "refresh".createSyntheticIcon(s.getId(), s.getFqName()); - t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); - - log.debug("TransferObjectTableAddSelectorTableRefreshButton: " + t.name); -} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationAddSelectorPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationAddSelectorPage.etl new file mode 100644 index 00000000..6381537a --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationAddSelectorPage.etl @@ -0,0 +1,303 @@ +@lazy +rule ViewTableDeclarationAddSelectorPageDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::PageDefinition { + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageDefinition"); + + t.name = s.getFqName() + "::AddSelectorPage"; + + t.container = s.equivalent("ViewTableDeclarationAddSelectorPageContainer"); + t.dataElement = s.transferRelation.target.equivalent("RelationType"); + t.openInDialog = true; + t.dialogSize = UI!ui::DialogSize#MD; + + t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorAddAction")); + t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorBackAction")); + t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorTableFilterAction")); + t.actions.add(s.equivalent("ViewTableDeclarationAddSelectorTableRangeAction")); + + rootMenu.equivalent("Application").pages.add(t); + + log.debug("ViewTableDeclarationAddSelectorPageDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorPageContainer + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::PageContainer { + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageContainer"); + + t.name = s.getFqName() + "::AddSelector::PageContainer"; + t.label = s.getLabelWithNameFallback(); + t.titleFrom = UI!ui::TitleFrom#LABEL; + t.type = UI!ui::PageContainerType#TABLE; + t.onInit = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); + + t.children.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorVisualElement")); + t.actionButtonGroup = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); + t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); + t.isSelector = true; + t.isRelationSelector = true; + + rootMenu.equivalent("Application").pageContainers.add(t); + + log.debug("ViewTableDeclarationAddSelectorPageContainer: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableRangeActionDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::SelectorRangeActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeActionDefinition"); + + t.name = s.getFqName() + "::AddSelector::Table::Range"; + t.targetType = s.referenceType.equivalent("ClassType"); + + log.debug("ViewTableDeclarationAddSelectorTableRangeActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup"); + t.name = s.getFqName() + "::AddSelectorTableAddSelectorButtonGroup"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorBackButton")); + t.buttons.add(s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddButton")); + + log.debug("ViewTableDeclarationAddSelectorTableAddSelectorButtonGroup: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorBackButton + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorBackButton"); + t.name = s.getFqName() + "::Back"; + t.label = "Back"; + t.buttonStyle = "text"; + t.icon = "arrow-left".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableAddSelectorBackButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableBackActionDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("ViewTableDeclarationAddSelectorTableBackActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorAddButton + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddButton"); + t.name = s.getFqName() + "::Add"; + t.label = "Add"; + t.buttonStyle = "contained"; + t.icon = "attachment-plus".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableAddSelectorAddButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::AddActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); + t.name = s.getFqName() + "::Add"; + t.targetType = s.referenceType.equivalent("ClassType"); + log.debug("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorVisualElement + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Flex { + t.~pos = 0; + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorVisualElement"); + t.name = s.name; + t.direction = UI!Axis#VERTICAL; + t.mainAxisAlignment = UI!ui::MainAxisAlignment#START; + t.crossAxisAlignment = UI!ui::CrossAxisAlignment#STRETCH; + t.col = 12d; + t.children.add(s.equivalent("ViewTableDeclarationAddSelectorTableTable")); + t.frame = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorFrame"); + + log.debug("ViewTableDeclarationAddSelectorTableAddSelectorVisualElement: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorFrame + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Frame { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorFrame"); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableTable + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Table { + var id = rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTable"; + t.setId(id); + t.col = 12d; + t.label = s.getLabelWithNameFallback(); + t.isSelectorTable = true; + t.isRelationSelectorTable = true; + t.allowSelectMultiple = true; + t.name = s.name + "::Add::Selector"; + t.relationName = s.name; + t.dataElement = s.referenceType.map.transfer.equivalent("ClassType"); + t.tableActionButtonGroup = s.equivalent("ViewTableDeclarationAddSelectorTableTableButtonGroup"); + t.~pos = s.~pos; + t.showTotalCount = false; + t.selectorRowsPerPage = 10; + + if (s.getRows().isDefined()) { + t.rowsPerPage = s.getRows().value.asInteger(); + } else { + t.rowsPerPage = 10; + } + if (t.~pos.isUndefined()) { + t.~pos = 0; + } + + // TODO eventually selector should work? + var rowDeclaration = s.getSelectorTableModifier().row; + + var columns = rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration) and m.referenceType.`primitive`.isDefined()); + // var links = rowDeclaration.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + + for (column in columns) { + var col = column.equivalentDiscriminated("TablePrimitiveColumn", id); + t.columns.add(col); + if (col.attributeType.isFilterable) { + t.filters.add(column.equivalentDiscriminated("TablePrimitiveColumnFilter", id)); + } + } +/* + for (link in links) { + if (link.getDetail().isUndefined()) { + var col = link.equivalentDiscriminated("RowLinkDerivedColumn", id); + t.columns.add(col); + if (col.attributeType.isFilterable) { + t.filters.add(link.equivalentDiscriminated("RowLinkDerivedColumnFilter", id)); + } + } else { + // TODO generate open action from link with detail modifier + } + + } +*/ + log.debug("ViewTableDeclarationAddSelectorTableTable: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableTableButtonGroup + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::ButtonGroup { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableButtonGroup"); + t.name = s.getFqName() + "::AddSelectorTableActions"; + t.label = "Actions"; + + t.buttons.add(s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterButton")); + t.buttons.add(s.equivalent("TransferObjectTableAddSelectorTableRefreshButton")); + + log.debug("ViewTableDeclarationAddSelectorTableTableButtonGroup: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableTableFilterButton + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterButton"); + t.name = s.getFqName() + "::AddSelector::Table::Filter"; + t.label = "Set Filters"; + t.buttonStyle = "text"; + t.icon = "filter".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableTableFilterButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableTableFilterActionDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::FilterActionDefinition { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.name = s.getFqName() + "::Table::Filter"; + log.debug("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition: " + t.name); +} + +@lazy +rule TransferObjectTableAddSelectorTableRefreshButton + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Button { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TransferObjectTableAddSelectorTableRefreshButton"); + t.name = s.getFqName() + "::AddSelector::Table::Refresh"; + t.label = "Refresh"; + t.buttonStyle = "text"; + t.icon = "refresh".createSyntheticIcon(s.getId(), s.getFqName()); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); + + log.debug("TransferObjectTableAddSelectorTableRefreshButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorAddAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorAddAction"); + t.name = s.getFqName() + "::AddSelector::Add"; + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorAddAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorBackAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorBackAction"); + t.name = s.getFqName() + "::AddSelector::Back"; + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorBackAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableFilterAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableFilterAction"); + t.name = s.getFqName() + "::AddSelector::Table::Filter"; + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableFilterAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableRangeAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeAction"); + t.name = s.getFqName() + "::AddSelector::Table::Range"; + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableRangeAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl new file mode 100644 index 00000000..a0156ff9 --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl @@ -0,0 +1,75 @@ +@greedy +rule ViewTableCreateFormPageDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) and s.getCreateFormModifier().isDefined() + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormPageDefinition"); + + t.name = s.getFqName() + "::FormPage"; + + t.container = s.getCreateFormModifier().form.equivalent("FormPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = s.transferRelation.target.equivalent("RelationType"); + + // var relations = s.referenceType.getDirectRelations(); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + /* + for (link in relations.select(r | r.isKindOf(JSL!UIViewLinkDeclaration))) { + t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction")); + } + + for (table in relations.select(r | r.isKindOf(JSL!UIViewTableDeclaration))) { + var detailLink = table.getDetailLink(); + + if (detailLink.isDefined()) { + t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction")); + } + } + */ + + t.actions.add(s.equivalent("ViewTableCreateFormBackAction")); + t.actions.add(s.equivalent("ViewTableCreateFormCreateAction")); + + log.debug("Create ViewTableCreateFormPageDefinition: " + t.name); +} + +@greedy +@lazy +rule ViewTableCreateFormCreateAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormCreateAction"); + + var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); + var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; + + t.name = s.name + "::Create"; + t.actionDefinition = targetContainer.equivalent("TransferDeclarationCreateActionDefinition"); + + log.debug("ViewTableCreateFormCreateAction: " + t.name); +} + +@greedy +@lazy +rule ViewTableCreateFormBackAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormBackAction"); + + var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); + var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; + + t.name = s.name + "::Back"; + t.actionDefinition = targetContainer.equivalent("TransferDeclarationBackActionDefinition"); + + log.debug("ViewTableCreateFormBackAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationViewPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationViewPage.etl new file mode 100644 index 00000000..821af27d --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationViewPage.etl @@ -0,0 +1,238 @@ +rule ViewTableViewPageDefinition + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::PageDefinition { + guard: rootMenu.containsVisualElement(s) and s.getUpdateViewModifier().isDefined() + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableViewPageDefinition"); + t.name = s.getFqName() + "::ViewPage"; + t.container = s.getUpdateViewModifier().view.equivalent("ViewPageContainer"); + + rootMenu.equivalent("Application").pages.add(t); + + t.dataElement = s.transferRelation.target.equivalent("RelationType"); + + /* + log.info("==================="); + log.info(t.name + ":"); + log.info(relations.collect(r | r.name).concat(", ")); + log.info("==================="); + */ + + for (link in s.getUpdateViewModifier().view.getAllLinks()) { + var lRelation = link.transferRelation.target; + + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "ViewTableViewPageDefinition")); + if (lRelation.isRefreshAllowed() and not lRelation.isEager()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "ViewTableViewPageDefinition")); + } + if (link.getCreateFormModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "ViewTableViewPageDefinition")); + } + if (lRelation.isDeleteAllowed()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "ViewTableViewPageDefinition")); + } + if (link.getSelectorTableModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenSetSelectorDialogAction", "ViewTableViewPageDefinition")); + } + if (link.getSelectorTableModifier().isDefined()) { + t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationUnsetAction", "ViewTableViewPageDefinition")); + } + } + + for (table in s.getUpdateViewModifier().view.getAllTables()) { + var tRelation = table.transferRelation.target; + + if (table.getUpdateViewModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "ViewTableViewPageDefinition")); + } + if (tRelation.isFilterSupported()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "ViewTableViewPageDefinition")); + } + if (tRelation.isRefreshAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "ViewTableViewPageDefinition")); + } + if (table.getCreateFormModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "ViewTableViewPageDefinition")); + } + if (tRelation.isDeleteAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "ViewTableViewPageDefinition")); + } + if (table.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "ViewTableViewPageDefinition")); + } + if (table.getSelectorTableModifier().isDefined()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "ViewTableViewPageDefinition")); + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "ViewTableViewPageDefinition")); + } + } + + t.actions.add(s.equivalent("ViewTableViewPageDefinitionBackAction")); + if (s.transferRelation.target.isRefreshAllowed()) { + t.actions.add(s.equivalent("ViewTableViewPageDefinitionRefreshAction")); + } + if (s.transferRelation.target.isUpdateAllowed()) { + t.actions.add(s.equivalent("ViewTableViewPageDefinitionUpdateAction")); + } + if (s.transferRelation.target.isDeleteAllowed()) { + t.actions.add(s.equivalent("ViewTableViewPageDefinitionDeleteAction")); + } + + log.debug("Create ViewTableViewPageDefinition: " + t.name); +} + +@lazy +@greedy +rule ViewTableViewPageDefinitionRefreshAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableViewPageDefinitionRefreshAction"); + t.name = s.name + "::Refresh"; + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerRefreshActionDefinition"); + + log.debug("ViewTableViewPageDefinitionRefreshAction: " + t.name); +} + +@lazy +@greedy +rule ViewTableViewPageDefinitionBackAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + guard: rootMenu.containsVisualElement(s) + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableViewPageDefinitionBackAction"); + t.name = s.name + "::Back"; + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerBackActionDefinition"); + + log.debug("ViewTableViewPageDefinitionBackAction: " + t.name); +} + +@lazy +@greedy +rule ViewTableViewPageDefinitionUpdateAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableViewPageDefinitionUpdateAction"); + + t.name = s.name + "::Update"; + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerUpdateActionDefinition"); + + log.debug("ViewTableViewPageDefinitionUpdateAction: " + t.name); +} + +@lazy +@greedy +rule ViewTableViewPageDefinitionDeleteAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableViewPageDefinitionDeleteAction"); + + t.name = s.name + "::Delete"; + t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerDeleteActionDefinition"); + + log.debug("ViewTableViewPageDefinitionDeleteAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationFilterAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationFilterAction"); + t.name = s.name + "::Filter"; + t.actionDefinition = s.equivalent("ViewTableDeclarationFilterActionDefinition"); + + log.debug("ViewTableDeclarationFilterAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationRefreshAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRefreshAction"); + t.name = s.name + "::Refresh"; + t.actionDefinition = s.equivalent("ViewTableDeclarationRefreshActionDefinition"); + + log.debug("ViewTableDeclarationRefreshAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationOpenCreateAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenCreateAction"); + t.name = s.name + "::OpenCreate"; + t.actionDefinition = s.equivalent("ViewTableDeclarationOpenCreateActionDefinition"); + + t.targetPageDefinition = s.equivalent("ViewTableCreateFormPageDefinition"); + + log.debug("ViewTableDeclarationOpenCreateAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationOpenPageAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + var row = s.referenceType; + + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenPageAction"); + + t.name = s.name + "::OpenPage"; + t.actionDefinition = s.equivalent("ViewTableDeclarationOpenPageActionDefinition"); + + t.targetPageDefinition = s.equivalent("ViewTableViewPageDefinition"); + + log.debug("ViewTableDeclarationOpenPageAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationRowDeleteAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowDeleteAction"); + t.name = s.name + "::RowDelete"; + t.actionDefinition = s.equivalent("ViewTableDeclarationRowDeleteActionDefinition"); + + log.debug("ViewTableDeclarationRowDeleteAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationOpenAddSelectorAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorAction"); + t.name = s.name + "::OpenAddSelector"; + t.actionDefinition = s.equivalent("ViewTableDeclarationOpenAddSelectorActionDefinition"); + + t.targetPageDefinition = s.equivalent("ViewTableDeclarationAddSelectorPageDefinition"); + + log.debug("ViewTableDeclarationOpenAddSelectorAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationBulkRemoveAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveAction"); + t.name = s.name + "::BulkRemove"; + t.actionDefinition = s.equivalent("ViewTableDeclarationBulkRemoveActionDefinition"); + + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); + + log.debug("ViewTableDeclarationBulkRemoveAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationClearAction + transform s: JSL!UIViewTableDeclaration + to t: UI!ui::Action { + t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearAction"); + t.name = s.name + "::Clear"; + t.actionDefinition = s.equivalent("ViewTableDeclarationClearActionDefinition"); + + t.ownerDataElement = s.transferRelation.target.equivalent("RelationType"); + t.targetDataElement = s.transferRelation.target.equivalent("RelationType"); + + log.debug("ViewTableDeclarationClearAction: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java index ad319950..a97309df 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiApplicationTest.java @@ -408,16 +408,20 @@ menu App2(Actor2 a) { assertEquals(Set.of( "MultipleActorsTestModel::App1::allProducts::AccessTablePage", + "MultipleActorsTestModel::App1::allProducts::AccessTableViewPage", "MultipleActorsTestModel::App1::DashboardPage", + "MultipleActorsTestModel::App1::first::products1::AccessTableViewPage", "MultipleActorsTestModel::App1::first::products1::AccessTablePage" - ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); + ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); List pages2 = app2.getPages(); assertEquals(Set.of( "MultipleActorsTestModel::App2::allProducts2::AccessTablePage", + "MultipleActorsTestModel::App2::allProducts2::AccessTableViewPage", "MultipleActorsTestModel::App2::DashboardPage", - "MultipleActorsTestModel::App2::first::products2::AccessTablePage" + "MultipleActorsTestModel::App2::first::products2::AccessTablePage", + "MultipleActorsTestModel::App2::first::products2::AccessTableViewPage" ), pages2.stream().map(NamedElement::getName).collect(Collectors.toSet())); } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java index 404a536b..df93d898 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java @@ -39,242 +39,270 @@ protected Logger createLog() { return log; } -// @BeforeAll -// static void prepareTestFolders() throws IOException { -// if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { -// Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); -// } -// } -// -// @Test -// void testNavigation() throws Exception { -// jslModel = JslParser.getModelFromStrings("NavigationTestModel", List.of(""" -// model NavigationTestModel; -// -// import judo::types; -// -// entity User { -// identifier String email required; -// field Integer numeric; -// -// field Related related; -// relation Related[] relatedCollection; -// } -// -// entity Related { -// field String first; -// field Integer second; -// field Jumper theJumper; -// relation Jumper[] theJumpersCollection; -// } -// -// entity Jumper { -// field String first; -// } -// -// view UserView(User u) { -// group level1 { -// link RelatedView related <= u.related eager:true icon:"related" label:"Related" width:6; -// table RelatedRow[] relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection"; -// } -// } -// -// row RelatedRow(Related r) { -// field String first <= r.first label:"First"; -// field Integer second <= r.second label:"Second"; -// link RelatedView detail <= r detail:true; -// } -// -// view RelatedView(Related r) { -// field String first <= r.first label: "First"; -// field Integer second <= r.second label: "Second"; -// link JumperView myJumper <= r.theJumper eager:false icon:"jumping" label:"My Jumper" width:6; -// table JumperRow[] myJumpers <= r.theJumpersCollection eager:false icon:"jumping-all" label:"My Jumpers" width:6; -// } -// -// view JumperView(Jumper j) { -// field String first <= j.first label: "First"; -// } -// -// row JumperRow(Jumper j) { -// field String first <= j.first label: "First"; -// link JumperView jumperRowDetail <= j detail:true; -// } -// -// actor NavigationActor human { -// link UserView user <= User.any() label:"User" icon:"tools"; -// } -// """)); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application application = apps.get(0); -// -// List classTypes = application.getClassTypes(); -// List relationTypes = application.getRelationTypes(); -// List links = application.getLinks(); -// List
tables = application.getTables(); -// List pages = application.getPages(); -// -// assertEquals(6, classTypes.size()); -// assertEquals(2, links.size()); -// assertEquals(2, tables.size()); -// assertEquals(6, pages.size()); -// assertEquals(7, relationTypes.size()); -// -// ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); -// ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); -// ClassType jumperRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::JumperRow::ClassType")).findFirst().orElseThrow(); -// ClassType jumperViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::JumperView::ClassType")).findFirst().orElseThrow(); -// -// RelationType detailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("detail")).findFirst().orElseThrow(); -// RelationType jumperRowDetailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("jumperRowDetail")).findFirst().orElseThrow(); -// -// // Relations -// -// assertEquals(Set.of( -// "NavigationActor::Application::NavigationTestModel::JumperRow::ClassType::jumperRowDetail", -// "NavigationActor::Application::NavigationTestModel::NavigationActor::ClassType::user", -// "NavigationActor::Application::NavigationTestModel::RelatedRow::ClassType::detail", -// "NavigationActor::Application::NavigationTestModel::RelatedView::ClassType::myJumper", -// "NavigationActor::Application::NavigationTestModel::RelatedView::ClassType::myJumpers", -// "NavigationActor::Application::NavigationTestModel::UserView::ClassType::related", -// "NavigationActor::Application::NavigationTestModel::UserView::ClassType::relatedCollection" -// ), relationTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); -// -// // Tables -// -// // - relatedCollection -// -// Table relatedCollectionTable = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); -// -// List
tables = application.getTables(); + List pages = application.getPages(); + + assertEquals(Set.of( + "NavigationActor::NavigationTestModel::RelatedTransfer", + "NavigationActor::NavigationTestModel::JumperTransfer", + "NavigationActor::NavigationTestModel::UserTransfer", + "NavigationActor::NavigationTestModel::NavigationActor" + ), classTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(2, links.size()); + assertEquals(2, tables.size()); + assertEquals(6, pages.size()); + assertEquals(7, relationTypes.size()); + + ClassType relatedTransferClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationActor::NavigationTestModel::RelatedTransfer")).findFirst().orElseThrow(); + ClassType jumperTransferClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationActor::NavigationTestModel::JumperTransfer")).findFirst().orElseThrow(); + + RelationType detailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("detail")).findFirst().orElseThrow(); + RelationType jumperRowDetailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("jumperRowDetail")).findFirst().orElseThrow(); + + // Relations + + assertEquals(Set.of( + "NavigationActor::Application::NavigationTestModel::JumperRow::ClassType::jumperRowDetail", + "NavigationActor::Application::NavigationTestModel::NavigationActor::ClassType::user", + "NavigationActor::Application::NavigationTestModel::RelatedRow::ClassType::detail", + "NavigationActor::Application::NavigationTestModel::RelatedView::ClassType::myJumper", + "NavigationActor::Application::NavigationTestModel::RelatedView::ClassType::myJumpers", + "NavigationActor::Application::NavigationTestModel::UserView::ClassType::related", + "NavigationActor::Application::NavigationTestModel::UserView::ClassType::relatedCollection" + ), relationTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + // Tables + + // - relatedCollection + + Table relatedCollectionTable = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); + + List
tables = application.getTables(); + List pages = application.getPages(); assertEquals(Set.of( "RelationWidgetsActor::RelationWidgetsTestModel::UserTransfer", @@ -419,11 +467,25 @@ menu RelationWidgets(RelationWidgetsActor a) { "RelationWidgetsActor::RelationWidgetsTestModel::RelationWidgetsActor" ), classTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + assertEquals(Set.of( + "RelationWidgetsTestModel::UserForm::relatedCollection::ViewPage", + "RelationWidgetsTestModel::UserForm::level1::related::ViewPage", + "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::SetSelectorPage", + "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::ViewPage", + "RelationWidgetsTestModel::UserView::level1::level2::related::ViewPage", + "RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::AddSelectorPage", + "RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::ViewPage", + "RelationWidgetsTestModel::RelationWidgets::user::AccessViewPage", + "RelationWidgetsTestModel::RelationWidgets::user::AccessFormPage", + "RelationWidgetsTestModel::RelationWidgets::DashboardPage" + ), pages.stream().map(PageDefinition::getName).collect(Collectors.toSet())); + // Links assertEquals(Set.of( - "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::level2::related", - "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::level2::relatedAssociation" + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::level2::related", + "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::level2::relatedAssociation" ), links.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedTransfer")).findFirst().orElseThrow(); @@ -451,19 +513,22 @@ menu RelationWidgets(RelationWidgetsActor a) { // Tables assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection", "RelationWidgetsActor::RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::SetSelector::PageContainer::relatedAssociation::relatedAssociation::Set::Selector", "RelationWidgetsActor::RelationWidgetsTestModel::RelatedTable::Table::PageContainer::RelatedTable::RelatedTable::Table", "RelationWidgetsActor::RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::AddSelector::PageContainer::relatedCollection::relatedCollection::Add::Selector", "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection" ), tables.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); - Table table = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); - RelationType tableRelation = (RelationType) table.getDataElement(); + PageDefinition userView = application.getPages().stream().filter(p -> p.getName().equals("RelationWidgetsTestModel::RelationWidgets::user::AccessViewPage")).findFirst().orElseThrow(); + + Table userViewTable = ((Collection
) userView.getContainer().getTables()).stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); + RelationType tableRelation = (RelationType) userViewTable.getDataElement(); ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("RelationWidgetsTestModel::RelatedTransfer")).findFirst().orElseThrow(); - assertEquals("Related Collection", table.getLabel()); - assertEquals(12, table.getCol()); - assertEquals("relatedCollection", table.getRelationName()); + assertEquals("Related Collection", userViewTable.getLabel()); + assertEquals(12, userViewTable.getCol()); + assertEquals("relatedCollection", userViewTable.getRelationName()); assertEquals("relatedCollection", tableRelation.getName()); assertEquals(relatedRowClassType, tableRelation.getTarget()); @@ -483,7 +548,7 @@ menu RelationWidgets(RelationWidgetsActor a) { // Columns - List columns = table.getColumns(); + List columns = userViewTable.getColumns(); assertEquals(Set.of( "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection::second", @@ -532,7 +597,7 @@ menu RelationWidgets(RelationWidgetsActor a) { // Filters - List filters = table.getFilters(); + List filters = userViewTable.getFilters(); assertEquals(Set.of( "RelationWidgetsActor::RelationWidgetsTestModel::UserView::View::PageContainer::UserView::level1::tabs0::tab2::tab2::relatedCollection::firstFilter", @@ -561,5 +626,120 @@ menu RelationWidgets(RelationWidgetsActor a) { assertEquals(List.of("first", "second"), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().getName()).toList()); assertEquals(List.of("String", "Numeric"), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).toList()); assertEquals(List.of(true, true), relatedAssociationSetSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).toList()); + + // User Form + + PageDefinition userForm = application.getPages().stream().filter(p -> p.getName().equals("RelationWidgetsTestModel::RelationWidgets::user::AccessFormPage")).findFirst().orElseThrow(); + + List formChildren = ((Flex) userForm.getContainer().getChildren().get(0)).getChildren(); + + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection" + ), formChildren.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + // group level1 + + Flex formLevel1 = (Flex) formChildren.get(0); + assertEquals("level1", formLevel1.getName()); + assertEquals("Yo", formLevel1.getLabel()); + assertEquals("text", formLevel1.getIcon().getIconName()); + + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related" + ), formLevel1.getChildren().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Link formLevel1Related = (Link) formLevel1.getChildren().get(0); + assertEquals("related", formLevel1Related.getName()); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related::related::Actions::related::Delete", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related::related::Actions::related::View" + ), formLevel1Related.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button userFormRelatedView = formLevel1Related.getActionButtonGroup().getButtons().get(0); + assertEquals("related::View", userFormRelatedView.getName()); + assertEquals("View", userFormRelatedView.getLabel()); + assertEquals("contained", userFormRelatedView.getButtonStyle()); + assertTrue(userFormRelatedView.getActionDefinition().getIsOpenPageAction()); + + Button userFormRelatedDelete = formLevel1Related.getActionButtonGroup().getButtons().get(1); + assertEquals("related::Delete", userFormRelatedDelete.getName()); + assertEquals("Delete", userFormRelatedDelete.getLabel()); + assertEquals("contained", userFormRelatedDelete.getButtonStyle()); + assertTrue(userFormRelatedDelete.getActionDefinition().getIsRowDeleteAction()); + + // table + + Table formRelatedCollection = (Table) formChildren.get(1); + assertEquals("relatedCollection", formRelatedCollection.getName()); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::first", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::second" + ), formRelatedCollection.getColumns().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::firstFilter", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::secondFilter" + ), formRelatedCollection.getFilters().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::Clear", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::OpenAddSelector", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::Refresh", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::BulkRemove", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::Filter", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::OpenCreate" + ), formRelatedCollection.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button formRelatedCollectionFilter = formRelatedCollection.getTableActionButtonGroup().getButtons().get(0); + assertEquals("relatedCollection::Filter", formRelatedCollectionFilter.getName()); + assertEquals("Filter", formRelatedCollectionFilter.getLabel()); + assertEquals("text", formRelatedCollectionFilter.getButtonStyle()); + assertTrue(formRelatedCollectionFilter.getActionDefinition().getIsFilterAction()); + + Button formRelatedCollectionRefresh = formRelatedCollection.getTableActionButtonGroup().getButtons().get(1); + assertEquals("relatedCollection::Refresh", formRelatedCollectionRefresh.getName()); + assertEquals("Refresh", formRelatedCollectionRefresh.getLabel()); + assertEquals("text", formRelatedCollectionRefresh.getButtonStyle()); + assertTrue(formRelatedCollectionRefresh.getActionDefinition().getIsRefreshAction()); + + Button formRelatedCollectionOpenCreate = formRelatedCollection.getTableActionButtonGroup().getButtons().get(2); + assertEquals("relatedCollection::OpenCreate", formRelatedCollectionOpenCreate.getName()); + assertEquals("Create", formRelatedCollectionOpenCreate.getLabel()); + assertEquals("text", formRelatedCollectionOpenCreate.getButtonStyle()); + assertTrue(formRelatedCollectionOpenCreate.getActionDefinition().getIsOpenCreateFormAction()); + + Button formRelatedCollectionOpenAddSelector = formRelatedCollection.getTableActionButtonGroup().getButtons().get(3); + assertEquals("relatedCollection::OpenAddSelector", formRelatedCollectionOpenAddSelector.getName()); + assertEquals("Add", formRelatedCollectionOpenAddSelector.getLabel()); + assertEquals("text", formRelatedCollectionOpenAddSelector.getButtonStyle()); + assertTrue(formRelatedCollectionOpenAddSelector.getActionDefinition().getIsOpenAddSelectorAction()); + + Button formRelatedCollectionClear = formRelatedCollection.getTableActionButtonGroup().getButtons().get(4); + assertEquals("relatedCollection::Clear", formRelatedCollectionClear.getName()); + assertEquals("Clear", formRelatedCollectionClear.getLabel()); + assertEquals("text", formRelatedCollectionClear.getButtonStyle()); + assertTrue(formRelatedCollectionClear.getActionDefinition().getIsClearAction()); + + Button formRelatedCollectionBulkRemove = formRelatedCollection.getTableActionButtonGroup().getButtons().get(5); + assertEquals("relatedCollection::BulkRemove", formRelatedCollectionBulkRemove.getName()); + assertEquals("Remove", formRelatedCollectionBulkRemove.getLabel()); + assertEquals("text", formRelatedCollectionBulkRemove.getButtonStyle()); + assertTrue(formRelatedCollectionBulkRemove.getActionDefinition().getIsBulkRemoveAction()); + + assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollectionInlineViewTableRowButtonGroup::relatedCollection::RowDelete", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::relatedCollectionInlineViewTableRowButtonGroup::relatedCollection::View" + ), formRelatedCollection.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button formRelatedCollectionRowView = formRelatedCollection.getRowActionButtonGroup().getButtons().get(0); + assertEquals("relatedCollection::View", formRelatedCollectionRowView.getName()); + assertEquals("View", formRelatedCollectionRowView.getLabel()); + assertEquals("contained", formRelatedCollectionRowView.getButtonStyle()); + assertTrue(formRelatedCollectionRowView.getActionDefinition().getIsOpenPageAction()); + + Button formRelatedCollectionRowDelete = formRelatedCollection.getRowActionButtonGroup().getButtons().get(1); + assertEquals("relatedCollection::RowDelete", formRelatedCollectionRowDelete.getName()); + assertEquals("Delete", formRelatedCollectionRowDelete.getLabel()); + assertEquals("contained", formRelatedCollectionRowDelete.getButtonStyle()); + assertTrue(formRelatedCollectionRowDelete.getActionDefinition().getIsRowDeleteAction()); } } From 2b327a684bc0c0ce567530cc61a32adb374b02e3 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Sun, 22 Sep 2024 20:56:40 +0200 Subject: [PATCH 13/21] add missing form transformations --- .../jsl/data/transferFieldDeclaration.eol | 2 +- .../operations/jsl/namespace/modifiable.eol | 5 -- .../jsl/ui/rowColumnDeclaration.eol | 2 +- .../operations/jsl/ui/rowDeclaration.eol | 10 +++ .../operations/jsl/ui/viewLinkDeclaration.eol | 11 +-- .../jsl/ui/viewTableDeclaration.eol | 15 ++-- .../jsl/ui/viewWidgetDeclaration.eol | 2 +- .../view/viewLinkDeclarationFormPage.etl | 12 +--- .../view/viewTableDeclarationFormPage.etl | 12 +--- .../application/JslModel2UiWidgetsTest.java | 70 +++++++++++-------- 10 files changed, 74 insertions(+), 67 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferFieldDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferFieldDeclaration.eol index b8cd7c5d..b2058277 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferFieldDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/transferFieldDeclaration.eol @@ -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(); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol index e4145ddd..ce6270c5 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/namespace/modifiable.eol @@ -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)); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowColumnDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowColumnDeclaration.eol index 19fb3293..63301c08 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowColumnDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowColumnDeclaration.eol @@ -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(); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol index bc7323dd..e7215c46 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/rowDeclaration.eol @@ -10,3 +10,13 @@ operation JSL!UIRowDeclaration getFqName(): String { } 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; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol index 541f1acb..e4444997 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewLinkDeclaration.eol @@ -22,14 +22,17 @@ operation JSL!UIViewLinkDeclaration getExposedVisualElements(): Set { var viewDeclaration = self.referenceType; ves.add(self); + ves.add(viewDeclaration); ves.addAll(viewDeclaration.getExposedVisualElements()); - if (s.getCreateFormModifier().isDefined()) { - ves.addAll(s.getCreateFormModifier().form.getExposedVisualElements()); + if (self.getCreateFormModifier().isDefined()) { + ves.add(self.getCreateFormModifier().form); + ves.addAll(self.getCreateFormModifier().form.getExposedVisualElements()); } - if (s.getSelectorTableModifier().isDefined()) { - ves.addAll(s.getSelectorTableModifier().row.getExposedVisualElements()); + if (self.getSelectorTableModifier().isDefined()) { + ves.add(self.getSelectorTableModifier().row); + ves.addAll(self.getSelectorTableModifier().row.getExposedVisualElements()); } return ves; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol index ea47263a..a658724e 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewTableDeclaration.eol @@ -37,16 +37,19 @@ operation JSL!UIViewTableDeclaration getExposedVisualElements(): Set { ves.add(rowDeclaration); ves.addAll(rowDeclaration.members.select(m | m.isTypeOf(JSL!UIRowColumnDeclaration)).asSet()); - if (s.getCreateFormModifier().isDefined()) { - ves.addAll(s.getCreateFormModifier().form.getExposedVisualElements()); + if (self.getCreateFormModifier().isDefined()) { + ves.add(self.getCreateFormModifier().form); + ves.addAll(self.getCreateFormModifier().form.getExposedVisualElements()); } - if (s.getUpdateViewModifier().isDefined()) { - ves.addAll(s.getUpdateViewModifier().view.getExposedVisualElements()); + if (self.getUpdateViewModifier().isDefined()) { + ves.add(self.getUpdateViewModifier().view); + ves.addAll(self.getUpdateViewModifier().view.getExposedVisualElements()); } - if (s.getSelectorTableModifier().isDefined()) { - ves.addAll(s.getSelectorTableModifier().row.getExposedVisualElements()); + if (self.getSelectorTableModifier().isDefined()) { + ves.add(self.getSelectorTableModifier().row); + ves.addAll(self.getSelectorTableModifier().row.getExposedVisualElements()); } return ves; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol index 0f42a324..ca6de81f 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/viewWidgetDeclaration.eol @@ -21,5 +21,5 @@ operation JSL!UIViewWidgetDeclaration getTransferFieldDeclarationEquivalent(): U if (primitive.maps()) { return primitive.equivalent("CreateMappedTransferAttribute"); } - throw "Could not determinate attribute type: " + s.fqName(); + throw "Could not determinate attribute type: " + self.fqName(); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl index fe4803ab..361c0f54 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclarationFormPage.etl @@ -47,12 +47,8 @@ rule ViewLinkCreateFormCreateAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormCreateAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - t.name = s.name + "::Create"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationCreateActionDefinition"); + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerCreateActionDefinition"); log.debug("ViewLinkCreateFormCreateAction: " + t.name); } @@ -63,12 +59,8 @@ rule ViewLinkCreateFormBackAction transform s: JSL!UIViewLinkDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewLinkCreateFormBackAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - t.name = s.name + "::Back"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationBackActionDefinition"); + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerBackActionDefinition"); log.debug("ViewLinkCreateFormBackAction: " + t.name); } diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl index a0156ff9..8bad7c5a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclarationFormPage.etl @@ -48,12 +48,8 @@ rule ViewTableCreateFormCreateAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormCreateAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - t.name = s.name + "::Create"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationCreateActionDefinition"); + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerCreateActionDefinition"); log.debug("ViewTableCreateFormCreateAction: " + t.name); } @@ -64,12 +60,8 @@ rule ViewTableCreateFormBackAction transform s: JSL!UIViewTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/ViewTableCreateFormBackAction"); - - var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); - var targetContainer = targetCreateEvent.parameterType.isDefined() ? targetCreateEvent.parameterType : s.referenceType; - t.name = s.name + "::Back"; - t.actionDefinition = targetContainer.equivalent("TransferDeclarationBackActionDefinition"); + t.actionDefinition = s.getCreateFormModifier().form.equivalent("FormPageContainerBackActionDefinition"); log.debug("ViewTableCreateFormBackAction: " + t.name); } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java index 769ab423..d6ec4a7e 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java @@ -385,7 +385,7 @@ transfer UserTransfer(User u) { field String email <= u.email required; field Numeric numeric <= u.numeric; - relation RelatedTransfer related <= u.related eager:true create update delete; + relation RelatedTransfer related <= u.related eager create update delete; relation RelatedTransfer relatedAssociation <= u.relatedAssociation choices:Related.all() create update delete; relation RelatedTransfer[] relatedCollection <= u.relatedCollection choices:Related.all() create update delete; @@ -403,11 +403,15 @@ transfer RelatedTransfer(Related r) { event delete onDelete; } + table UserTable(UserTransfer u) { + column String email <= u.email; + } + view UserView(UserTransfer u) { group level1 label:"Yo" icon:"text" { group level2 width:12 frame:true icon:"unicorn" label:"Level 2" stretch:true { - link RelatedView related <= u.related icon:"related" label:"Related" width:6; - link RelatedView relatedAssociation <= u.relatedAssociation icon:"related-association" label:"Related Association" width:6 selector:RelatedTable; + link RelatedView related <= u.related icon:"related" label:"Related" width:6 form:RelatedForm; + link RelatedView relatedAssociation <= u.relatedAssociation icon:"related-association" label:"Related Association" width:6 selector:RelatedTable form:RelatedForm; } tabs tabs0 orientation:horizontal width:6 { @@ -416,7 +420,7 @@ view UserView(UserTransfer u) { } group tab2 label:"Tab2" icon:"numbers" h-align:right { - table RelatedTable relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" width:6 selector:RelatedTable view:RelatedView; + table RelatedTable relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" width:6 selector:RelatedTable view:RelatedView form:RelatedForm; } } } @@ -424,9 +428,9 @@ view UserView(UserTransfer u) { form UserForm(UserTransfer u) { group level1 label:"Yo" icon:"text" { - link RelatedView related <= u.related icon:"related" label:"Related" width:6; + link RelatedView related <= u.related icon:"related" label:"Related" width:6 form:RelatedForm; } - table RelatedTable relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" width:6 selector:RelatedTable view:RelatedView; + table RelatedTable relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" width:6 selector:RelatedTable view:RelatedView form:RelatedForm; } table RelatedTable(RelatedTransfer r) { @@ -439,12 +443,19 @@ view RelatedView(RelatedTransfer r) { widget Numeric second <= r.second label: "Second"; } + form RelatedForm(RelatedTransfer r) { + widget String first <= r.first label: "First"; + widget Numeric second <= r.second label: "Second"; + } + actor RelationWidgetsActor { access UserTransfer user <= User.any() create; + access UserTransfer[] users <= User.all() create; } menu RelationWidgets(RelationWidgetsActor a) { - link UserView user <= a.user label:"User" icon:"tools" form:UserForm; + link UserView user <= a.user label:"User" icon:"tools"; + table UserTable users <= a.users label:"Users" icon:"tools" form:UserForm; } """)); @@ -468,17 +479,23 @@ menu RelationWidgets(RelationWidgetsActor a) { ), classTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); assertEquals(Set.of( + "RelationWidgetsTestModel::RelationWidgets::user::AccessViewPage", "RelationWidgetsTestModel::UserForm::relatedCollection::ViewPage", + "RelationWidgetsTestModel::UserForm::relatedCollection::FormPage", + "RelationWidgetsTestModel::UserForm::level1::related::FormPage", "RelationWidgetsTestModel::UserForm::level1::related::ViewPage", - "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::SetSelectorPage", - "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::ViewPage", "RelationWidgetsTestModel::UserView::level1::level2::related::ViewPage", + "RelationWidgetsTestModel::UserView::level1::level2::related::FormPage", + "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::FormPage", + "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::ViewPage", + "RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::SetSelectorPage", + "RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::FormPage", "RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::AddSelectorPage", "RelationWidgetsTestModel::UserView::level1::tabs0::tab2::relatedCollection::ViewPage", - "RelationWidgetsTestModel::RelationWidgets::user::AccessViewPage", - "RelationWidgetsTestModel::RelationWidgets::user::AccessFormPage", + "RelationWidgetsTestModel::RelationWidgets::users::AccessTablePage", + "RelationWidgetsTestModel::RelationWidgets::users::AccessFormPage", "RelationWidgetsTestModel::RelationWidgets::DashboardPage" - ), pages.stream().map(PageDefinition::getName).collect(Collectors.toSet())); + ), pages.stream().map(PageDefinition::getName).collect(Collectors.toSet())); // Links @@ -513,6 +530,7 @@ menu RelationWidgets(RelationWidgetsActor a) { // Tables assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserTable::Table::PageContainer::UserTable::UserTable::Table", "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection", "RelationWidgetsActor::RelationWidgetsTestModel::UserView::level1::level2::relatedAssociation::SetSelector::PageContainer::relatedAssociation::relatedAssociation::Set::Selector", "RelationWidgetsActor::RelationWidgetsTestModel::RelatedTable::Table::PageContainer::RelatedTable::RelatedTable::Table", @@ -560,9 +578,6 @@ menu RelationWidgets(RelationWidgetsActor a) { AttributeType firstAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("first")).findFirst().orElseThrow(); Column secondColumn = columns.stream().filter(c -> c.getName().equals("second")).findFirst().orElseThrow(); AttributeType secondAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("second")).findFirst().orElseThrow(); -// Column nonDetailLinkColumn = columns.stream().filter(c -> c.getName().equals("nonDetailLink")).findFirst().orElseThrow(); -// AttributeType nonDetailLinkAttribute = relatedRowClassType.getAttributes().stream().filter(a -> a.getName().equals("_text_nonDetailLink")).findFirst().orElseThrow(); -// RelationType nonDetailLinkRepresentsRelation = relatedRowClassType.getRelations().stream().filter(a -> a.getName().equals("nonDetailLink")).findFirst().orElseThrow(); assertEquals("First", firstColumn.getLabel()); assertEquals("%s", firstColumn.getFormat()); @@ -580,16 +595,6 @@ menu RelationWidgets(RelationWidgetsActor a) { assertTrue(secondAttribute.isIsFilterable()); assertEquals("Numeric", secondAttribute.getDataType().getName()); -// assertEquals("Non Detail Link", nonDetailLinkColumn.getLabel()); -// assertEquals("%s", nonDetailLinkColumn.getFormat()); -// assertEquals("120", nonDetailLinkColumn.getWidth()); -// assertEquals(nonDetailLinkAttribute, nonDetailLinkColumn.getAttributeType()); -// assertTrue(nonDetailLinkAttribute.getIsMemberTypeDerived()); -// assertTrue(nonDetailLinkAttribute.isIsFilterable()); -// assertEquals("String", nonDetailLinkAttribute.getDataType().getName()); -// assertEquals(nonDetailLinkRepresentsRelation, nonDetailLinkColumn.getRepresentsRelation()); -// assertEquals(relatedViewClassType, nonDetailLinkRepresentsRelation.getTarget()); - List relatedAddSelectorColumns = relatedCollectionAddSelector.getColumns(); assertEquals(List.of("First", "Second"), relatedAddSelectorColumns.stream().map(LabeledElement::getLabel).toList()); assertEquals(List.of("first", "second"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getName()).toList()); @@ -629,9 +634,9 @@ menu RelationWidgets(RelationWidgetsActor a) { // User Form - PageDefinition userForm = application.getPages().stream().filter(p -> p.getName().equals("RelationWidgetsTestModel::RelationWidgets::user::AccessFormPage")).findFirst().orElseThrow(); + PageDefinition usersForm = application.getPages().stream().filter(p -> p.getName().equals("RelationWidgetsTestModel::RelationWidgets::users::AccessFormPage")).findFirst().orElseThrow(); - List formChildren = ((Flex) userForm.getContainer().getChildren().get(0)).getChildren(); + List formChildren = ((Flex) usersForm.getContainer().getChildren().get(0)).getChildren(); assertEquals(Set.of( "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1", @@ -653,7 +658,8 @@ menu RelationWidgets(RelationWidgetsActor a) { assertEquals("related", formLevel1Related.getName()); assertEquals(Set.of( "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related::related::Actions::related::Delete", - "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related::related::Actions::related::View" + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related::related::Actions::related::View", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1::related::related::Actions::related::Create::Open" ), formLevel1Related.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); Button userFormRelatedView = formLevel1Related.getActionButtonGroup().getButtons().get(0); @@ -662,7 +668,13 @@ menu RelationWidgets(RelationWidgetsActor a) { assertEquals("contained", userFormRelatedView.getButtonStyle()); assertTrue(userFormRelatedView.getActionDefinition().getIsOpenPageAction()); - Button userFormRelatedDelete = formLevel1Related.getActionButtonGroup().getButtons().get(1); + Button userFormRelatedCreateOpen = formLevel1Related.getActionButtonGroup().getButtons().get(1); + assertEquals("related::Create::Open", userFormRelatedCreateOpen.getName()); + assertEquals("Create", userFormRelatedCreateOpen.getLabel()); + assertEquals("contained", userFormRelatedCreateOpen.getButtonStyle()); + assertTrue(userFormRelatedCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); + + Button userFormRelatedDelete = formLevel1Related.getActionButtonGroup().getButtons().get(2); assertEquals("related::Delete", userFormRelatedDelete.getName()); assertEquals("Delete", userFormRelatedDelete.getLabel()); assertEquals("contained", userFormRelatedDelete.getButtonStyle()); From 134224f51717c4f2f7e37df12d856dee1fa73b86 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Sun, 22 Sep 2024 21:30:54 +0200 Subject: [PATCH 14/21] fix element positioning, add missing readonly widget handling --- .../operations/jsl/ui/visibleDeclaration.eol | 11 +++++++ .../ui/modules/view/viewGroupDeclaration.etl | 6 +--- .../ui/modules/view/viewTabsDeclaration.etl | 2 +- .../ui/modules/view/viewWidgetDeclaration.etl | 9 +++++- .../application/JslModel2UiWidgetsTest.java | 32 +++++++++++++++---- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/visibleDeclaration.eol b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/visibleDeclaration.eol index 431e7285..940fa133 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/visibleDeclaration.eol +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/ui/visibleDeclaration.eol @@ -9,3 +9,14 @@ operation JSL!VisibleDeclaration getFqName(): String { return self.eContainer.getFqName() + "::" + self.name; } */ + +operation Any getPos(): Integer { + if (self.eContainer.isKindOf(JSL!UIViewDeclaration)) { + return self.eContainer.members.indexOf(self); + } else if (self.eContainer.isKindOf(JSL!UIViewGroupDeclaration)) { + return self.eContainer.members.indexOf(self); + } else if (self.eContainer.isKindOf(JSL!UIViewTabsDeclaration)) { + return self.eContainer.panels.indexOf(self); + } + return self.~pos.isDefined() ? self.~pos : 0; +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl index f081c733..f0c3137d 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewGroupDeclaration.etl @@ -17,11 +17,7 @@ rule AbstractViewGroupDeclaration } t.col = s.getWidth().isDefined() ? s.getWidth().value.asReal() : 12d; - - - if (t.~pos.isUndefined()) { - t.~pos = 0; - } + t.~pos = s.getPos(); if (s.getOrientationModifier().isDefined()) { t.direction = s.getOrientationModifier().isVertical() ? UI!Axis#VERTICAL : UI!Axis#HORIZONTAL; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl index a779eba0..3f96aeb3 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTabsDeclaration.etl @@ -5,7 +5,7 @@ rule TabBarVisualElement t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/TabBarVisualElement"); t.name = s.name; - t.~pos = s.~pos; + t.~pos = s.getPos(); t.col = s.getWidth().isDefined() ? s.getWidth().value.asReal() : 12d; t.label = s.getLabelWithNameFallback(); if (s.getIconModifier().isDefined()) { diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl index 819b347a..2952258c 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewWidgetDeclaration.etl @@ -10,12 +10,19 @@ rule AbstractViewWidgetDeclaration t.icon = s.equivalent("ViewWidgetIcon"); } t.attributeType = s.getTransferFieldDeclarationEquivalent(); + t.isReadOnly = s.bind.isUndefined(); + /* if (s.eContainer.isKindOf(JSL!UIViewDeclaration)) { t.~pos = s.eContainer.members.indexOf(s); + } else if (s.eContainer.isKindOf(JSL!UIViewGroupDeclaration)) { + t.~pos = s.eContainer.members.indexOf(s); + } else if (s.eContainer.isKindOf(JSL!UIViewTabsDeclaration)) { + t.~pos = s.eContainer.panels.indexOf(s); } else { t.~pos = s.~pos.isDefined() ? s.~pos : 0; } - + */ + t.~pos = s.getPos(); } @lazy diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java index d6ec4a7e..57929036 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiWidgetsTest.java @@ -343,7 +343,11 @@ menu WidgetsApp(WidgetsActor a) { "WidgetsActor::BasicWidgetsTestModel::UserForm::Create::PageContainer::UserForm::email" ), formFlex.getChildren().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); - VisualElement formLevel1Group = formFlex.getChildren().get(0); + VisualElement formEmail = formFlex.getChildren().get(0); + assertEquals("email", formEmail.getName()); + assertTrue(formEmail instanceof TextInput); + + VisualElement formLevel1Group = formFlex.getChildren().get(1); assertEquals("level1", formLevel1Group.getName()); assertTrue(formLevel1Group instanceof Flex); @@ -354,10 +358,6 @@ menu WidgetsApp(WidgetsActor a) { VisualElement formLevel1Timestamp = ((Flex) formLevel1Group).getChildren().get(0); assertEquals("timestampDerived", formLevel1Timestamp.getName()); assertTrue(formLevel1Timestamp instanceof DateTimeInput); - - VisualElement formEmail = formFlex.getChildren().get(1); - assertEquals("email", formEmail.getName()); - assertTrue(formEmail instanceof TextInput); } @Test @@ -427,6 +427,8 @@ view UserView(UserTransfer u) { } form UserForm(UserTransfer u) { + widget String emailReadOnly <= u.email icon:"text" label:"Readonly Email"; + widget String emailWritable <=> u.email icon:"text" label:"Writable Email"; group level1 label:"Yo" icon:"text" { link RelatedView related <= u.related icon:"related" label:"Related" width:6 form:RelatedForm; } @@ -639,13 +641,29 @@ menu RelationWidgets(RelationWidgetsActor a) { List formChildren = ((Flex) usersForm.getContainer().getChildren().get(0)).getChildren(); assertEquals(Set.of( + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::emailReadOnly", + "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::emailWritable", "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::level1", "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection" ), formChildren.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + // primitives + + TextInput formEmailReadonly = (TextInput) formChildren.get(0); + assertEquals("emailReadOnly", formEmailReadonly.getName()); + assertEquals("Readonly Email", formEmailReadonly.getLabel()); + assertEquals("text", formEmailReadonly.getIcon().getIconName()); + assertTrue(formEmailReadonly.isIsReadOnly()); + + TextInput formEmailWritable = (TextInput) formChildren.get(1); + assertEquals("emailWritable", formEmailWritable.getName()); + assertEquals("Writable Email", formEmailWritable.getLabel()); + assertEquals("text", formEmailWritable.getIcon().getIconName()); + assertFalse(formEmailWritable.isIsReadOnly()); + // group level1 - Flex formLevel1 = (Flex) formChildren.get(0); + Flex formLevel1 = (Flex) formChildren.get(2); assertEquals("level1", formLevel1.getName()); assertEquals("Yo", formLevel1.getLabel()); assertEquals("text", formLevel1.getIcon().getIconName()); @@ -682,7 +700,7 @@ menu RelationWidgets(RelationWidgetsActor a) { // table - Table formRelatedCollection = (Table) formChildren.get(1); + Table formRelatedCollection = (Table) formChildren.get(3); assertEquals("relatedCollection", formRelatedCollection.getName()); assertEquals(Set.of( "RelationWidgetsActor::RelationWidgetsTestModel::UserForm::Create::PageContainer::UserForm::relatedCollection::first", From 07145576abcb3e2648a1a62839545c70a29c416d Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Mon, 23 Sep 2024 20:40:13 +0200 Subject: [PATCH 15/21] update models, fix tests, transformations --- .../view/menuLinkDeclarationViewPage.etl | 6 +- .../view/menuTableDeclarationViewPage.etl | 8 +- .../ui/modules/view/viewTableDeclaration.etl | 6 +- .../application/JslModel2UiCRUDTest.java | 1842 +++++++++-------- .../JslModel2UiNavigationTest.java | 2 +- 5 files changed, 1000 insertions(+), 864 deletions(-) diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl index b9941806..ad567f35 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuLinkDeclarationViewPage.etl @@ -98,7 +98,7 @@ rule AccessViewRefreshAction transform s: JSL!UIMenuLinkDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewRefreshAction"); - t.name = s.getFqName() + "::Refresh"; + t.name = s.name + "::Refresh"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.referenceType.equivalent("ViewPageContainerRefreshActionDefinition"); @@ -110,7 +110,7 @@ rule AccessViewUpdateAction transform s: JSL!UIMenuLinkDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewUpdateAction"); - t.name = s.getFqName() + "::Update"; + t.name = s.name + "::Update"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.referenceType.equivalent("ViewPageContainerUpdateActionDefinition"); @@ -122,7 +122,7 @@ rule AccessViewDeleteAction transform s: JSL!UIMenuLinkDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessViewDeleteAction"); - t.name = s.getFqName() + "::Delete"; + t.name = s.name + "::Delete"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.referenceType.equivalent("ViewPageContainerDeleteActionDefinition"); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl index 6130b1c2..7b87ba1a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/menuTableDeclarationViewPage.etl @@ -56,7 +56,7 @@ rule AccessTableViewBackAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewBackAction"); - t.name = s.getFqName() + "::Back"; + t.name = s.name + "::Back"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerBackActionDefinition"); @@ -68,7 +68,7 @@ rule AccessTableViewRefreshAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewRefreshAction"); - t.name = s.getFqName() + "::Refresh"; + t.name = s.name + "::Refresh"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerRefreshActionDefinition"); @@ -80,7 +80,7 @@ rule AccessTableViewCancelAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewCancelAction"); - t.name = s.getFqName() + "::Cancel"; + t.name = s.name + "::Cancel"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerCancelActionDefinition"); @@ -92,7 +92,7 @@ rule AccessTableViewUpdateAction transform s: JSL!UIMenuTableDeclaration to t: UI!ui::Action { t.setId(rootMenu.name + "/(jsl/" + s.getId() + ")/AccessTableViewUpdateAction"); - t.name = s.getFqName() + "::Update"; + t.name = s.name + "::Update"; t.ownerDataElement = s.actorAccess.target.equivalent("RelationType"); t.actionDefinition = s.getUpdateViewModifier().view.equivalent("ViewPageContainerUpdateActionDefinition"); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index fd2a1dcf..f47df64a 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -198,13 +198,13 @@ rule InlineViewTableButtonGroup if (relation.isRefreshAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationRefreshButton")); } - if (relation.isCreateAllowed()) { + if (s.getCreateFormModifier().isDefined()) { t.buttons.add(s.equivalent("ViewTableDeclarationOpenCreateButton")); } - if (relation.isAddReferenceAllowed()) { + if (s.getSelectorTableModifier().isDefined()) { t.buttons.add(s.equivalent("ViewTableDeclarationOpenAddSelectorButton")); } - if (relation.isRemoveReferenceAllowed()) { + if (s.getSelectorTableModifier().isDefined()) { t.buttons.add(s.equivalent("ViewTableDeclarationClearButton")); t.buttons.add(s.equivalent("ViewTableDeclarationBulkRemoveButton")); } diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiCRUDTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiCRUDTest.java index c44a4f2b..ad335095 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiCRUDTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiCRUDTest.java @@ -17,7 +17,9 @@ import java.util.Set; import java.util.stream.Collectors; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + @Slf4j public class JslModel2UiCRUDTest extends AbstractTest { @@ -47,886 +49,1020 @@ private static String createModelString(String name) { entity User { identifier String email required; field Integer numeric; - - field Related related; + + relation Related related; relation Related[] relatedCollection; } - + entity Related { field String first; field Integer second; - field Jumper theJumper; + relation Jumper theJumper; relation Jumper[] theJumpersCollection; } - + entity Jumper { field String first; field String second; } - - view UserView(User u) { - field String email <= u.email label:"Email"; - group level { - link RelatedView related <= u.related eager:true icon:"related" label:"Related" width:6 create:true update:true delete:true; - table RelatedRow[] relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection"; - } - + + transfer UserTransfer(User u) { + field String email <= u.email; + relation RelatedTransfer related <= u.related choices:Related.all() eager create update delete; + relation RelatedTransfer[] relatedCollection <= u.relatedCollection create update; + + event create onCreate; event update onUpdate; event delete onDelete; } - - row RelatedRow(Related r) { - field String first <= r.first label:"First"; - field Integer second <= r.second label:"Second"; - link RelatedView detail <= r detail:true; + + transfer RelatedTransfer(Related r) { + field String first <= r.first; + field Integer second <= r.second; + relation JumperTransfer theJumper <= r.theJumper create update delete choices:Jumper.all(); + relation JumperTransfer[] theJumpersCollection <= r.theJumpersCollection create update delete choices:Jumper.all(); + + event create onCreate; + event update onUpdate; + event delete onDelete; } - - view RelatedView(Related r) { - field String first <= r.first label:"First"; - field Integer second <= r.second label:"Second"; - group g1 { - link JumperView readOnlyJumper <= r.theJumper eager:false icon:"jumping" label:"Read only Jumper"; - link JumperView myJumper <= r.theJumper eager:false icon:"jumping" label:"My Jumper" width:6 create:true update:true delete:true; - table JumperRow[] myJumpers <= r.theJumpersCollection eager:false icon:"jumping-all" label:"My Jumpers" width:6 create:true update:true delete:true; - } - - event create onCreate(RelatedForm form); + + transfer JumperTransfer(Jumper j) { + field String first <=j.first; + field String second <= j.second; + + event create onCreate; event update onUpdate; event delete onDelete; } - - view RelatedForm(Related r) { + + view UserView(UserTransfer u) { + widget String email <= u.email label:"Email"; + group level { + link RelatedView related <= u.related icon:"related" label:"Related" width:6 form:RelatedForm selector:RelatedTable; + table RelatedTable relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection" view:RelatedView; + } + } + + table RelatedTable(RelatedTransfer r) { + column String first <= r.first label:"First"; + column Integer second <= r.second label:"Second"; + } + + view RelatedView(RelatedTransfer r) { + widget String first <= r.first label:"First"; + widget Integer second <= r.second label:"Second"; + group g1 { + link JumperView readOnlyJumper <= r.theJumper icon:"jumping" label:"Read only Jumper" form:JumperForm view:JumperView selector:JumperTable; + link JumperView myJumper <= r.theJumper icon:"jumping" label:"My Jumper" width:6 form:JumperForm selector:JumperTable; + table JumperTable myJumpers <= r.theJumpersCollection icon:"jumping-all" label:"My Jumpers" width:6 view:JumperView form:JumperForm selector:JumperTable; + } + } + + form RelatedForm(RelatedTransfer r) { group one label:"Group 1" { - field String first <= r.first label:"First"; + widget String first <= r.first label:"First"; } } - - view JumperView(Jumper j) { - field String first <= j.first label:"First"; - - event create onCreate(JumperForm form); - event update onUpdate; - event delete onDelete; + + view JumperView(JumperTransfer j) { + widget String first <= j.first label:"First"; } - - row JumperRow(Jumper j) { - field String second <= j.second label:"Second"; - link JumperView jumperRowDetail <= j detail:true; - - event create onCreate(JumperForm form); - event update onUpdate; - event delete onDelete; + + table JumperTable(JumperTransfer j) { + column String second <= j.second label:"Second"; } - - view JumperForm(Jumper j) { + + form JumperForm(JumperTransfer j) { group one label:"Group 1" { - field String firstOnForm <= j.first label:"First on form"; + widget String firstOnForm <= j.first label:"First on form"; } } - - actor NavigationActor human { - link UserView user <= User.any() label:"User" icon:"tools" update:true delete:true; + + actor NavigationActor { + access UserTransfer user <= User.any() update delete; + } + + menu NavigationApp(NavigationActor a) { + link UserView user <= a.user label:"User" icon:"tools" view:UserView; } """.formatted(name); } -// @BeforeAll -// static void prepareTestFolders() throws IOException { -// if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { -// Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); -// } -// } -// -// @Test -// void testSummaryCRUD() throws Exception { -// jslModel = JslParser.getModelFromStrings("SummaryCRUD", List.of(createModelString("SummaryCRUD"))); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// assertEquals(1, apps.size()); -// -// Application application = apps.get(0); -// -// List relationTypes = application.getRelationTypes(); -// List classTypes = application.getClassTypes(); -// List pageContainers = application.getPageContainers(); -// List pages = application.getPages(); -// List links = application.getLinks(); -// List
tables = application.getTables(); -// List allActions = application.getPages().stream().flatMap(ps -> ps.getActions().stream()).toList(); -// -// assertEquals(11, relationTypes.size()); -// assertEquals(8, classTypes.size()); -// assertEquals(11, pageContainers.size()); -// assertEquals(13, pages.size()); -// assertEquals(3, links.size()); -// assertEquals(5, tables.size()); -// assertEquals(76, allActions.size()); -// -// PageDefinition actorDashboardPage = pages.stream().filter(p -> p.getName().equals("SummaryCRUD::NavigationActor::DashboardPage")).findFirst().orElseThrow(); -// -// assertEquals(Set.of( -// "jumperRowDetail", -// "user", -// "detail", -// "myJumper", -// "myJumperForm", -// "myJumpers", -// "myJumpersForm", -// "readOnlyJumper", -// "related", -// "relatedForm", -// "relatedCollection" -// ), relationTypes.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// assertEquals(Set.of( -// "SummaryCRUD::NavigationActor::ClassType", -// "SummaryCRUD::JumperRow::ClassType", -// "SummaryCRUD::RelatedForm::ClassType", -// "SummaryCRUD::RelatedRow::ClassType", -// "SummaryCRUD::UserView::ClassType", -// "SummaryCRUD::JumperView::ClassType", -// "SummaryCRUD::RelatedView::ClassType", -// "SummaryCRUD::JumperForm::ClassType" -// ), classTypes.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// assertEquals(Set.of( -// "SummaryCRUD::NavigationActor::Dashboard", -// "SummaryCRUD::UserView::PageContainer", -// "SummaryCRUD::UserView::related::SetSelector::PageContainer", -// "SummaryCRUD::RelatedView::PageContainer", -// "SummaryCRUD::JumperView::PageContainer", -// "SummaryCRUD::RelatedForm::PageContainer", -// "SummaryCRUD::RelatedRow::PageContainer", -// "SummaryCRUD::JumperRow::PageContainer", -// "SummaryCRUD::JumperForm::PageContainer", -// "SummaryCRUD::RelatedView::myJumper::SetSelector::PageContainer", -// "SummaryCRUD::RelatedView::myJumpers::AddSelector::PageContainer" -// ), pageContainers.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// assertEquals(Set.of( -// "SummaryCRUD::NavigationActor::DashboardPage", -// "SummaryCRUD::NavigationActor::user::View::PageDefinition", -// "SummaryCRUD::UserView::related::Create::PageDefinition", -// "SummaryCRUD::UserView::related::View::PageDefinition", -// "SummaryCRUD::UserView::related::SetSelector::PageDefinition", -// "SummaryCRUD::RelatedView::readOnlyJumper::View::PageDefinition", -// "SummaryCRUD::RelatedView::myJumper::View::PageDefinition", -// "SummaryCRUD::RelatedView::myJumper::Create::PageDefinition", -// "SummaryCRUD::RelatedView::myJumpers::Create::PageDefinition", -// "SummaryCRUD::JumperRow::jumperRowDetail::View::PageDefinition", -// "SummaryCRUD::RelatedRow::detail::View::PageDefinition", -// "SummaryCRUD::RelatedView::myJumper::SetSelector::PageDefinition", -// "SummaryCRUD::RelatedView::myJumpers::AddSelector::PageDefinition" -// ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// assertEquals(Set.of( -// "myJumper", -// "readOnlyJumper", -// "related" -// ), links.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// assertEquals(Set.of( -// "relatedCollection", -// "related::Set::Selector", -// "myJumpers", -// "myJumpers::Add::Selector", -// "myJumper::Set::Selector" -// ), tables.stream().map(NamedElement::getName).collect(Collectors.toSet())); -// } -// -// @Test -// void testAccessViewCRUD() throws Exception { -// jslModel = JslParser.getModelFromStrings("AccessViewCRUD", List.of(createModelString("AccessViewCRUD"))); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// Application application = apps.get(0); -// -// List pages = application.getPages(); -// -// PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::NavigationActor::user::View::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition userViewRelatedViewPageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::UserView::related::View::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition userViewRelatedCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::UserView::related::Create::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition relatedRowDetailViewPageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::RelatedRow::detail::View::PageDefinition")).findFirst().orElseThrow(); -// -// PageContainer pageContainer = pageDefinition.getContainer(); -// -// assertEquals(12, pageDefinition.getActions().size()); -// assertEquals(1, pageContainer.getLinks().size()); -// assertEquals(1, pageContainer.getTables().size()); -// -// assertEquals(Set.of( -// "related::OpenPage", -// "related::OpenForm", -// "related::RowDelete", -// "related::OpenSetSelector", -// "related::Unset", -// "relatedCollection::OpenPage", -// "relatedCollection::Filter", -// "relatedCollection::Refresh", -// "user::Back", -// "user::Refresh", -// "user::Update", -// "user::Delete" -// ), pageDefinition.getActions().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Action backAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("user::Back")).findFirst().orElseThrow(); -// assertTrue(backAction.getIsBackAction()); -// -// Action updateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("user::Update")).findFirst().orElseThrow(); -// assertTrue(updateAction.getIsUpdateAction()); -// -// Action deleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("user::Delete")).findFirst().orElseThrow(); -// assertTrue(deleteAction.getIsDeleteAction()); -// -// Action relatedOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::OpenPage")).findFirst().orElseThrow(); -// assertTrue(relatedOpenPageAction.getIsOpenPageAction()); -// assertEquals(userViewRelatedViewPageDefinition, relatedOpenPageAction.getTargetPageDefinition()); -// -// Action relatedOpenFormAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::OpenForm")).findFirst().orElseThrow(); -// assertTrue(relatedOpenFormAction.getIsOpenFormAction()); -// assertEquals(userViewRelatedCreatePageDefinition, relatedOpenFormAction.getTargetPageDefinition()); -// -// Action relatedRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::RowDelete")).findFirst().orElseThrow(); -// assertTrue(relatedRowDeleteAction.getIsRowDeleteAction()); -// -// Action relatedCollectionOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("relatedCollection::OpenPage")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionOpenPageAction.getIsRowOpenPageAction()); -// assertEquals(relatedRowDetailViewPageDefinition, relatedCollectionOpenPageAction.getTargetPageDefinition()); -// -// Action relatedCollectionFilterAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("relatedCollection::Filter")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionFilterAction.getIsFilterAction()); -// -// Action relatedCollectionRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("relatedCollection::Refresh")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionRefreshAction.getIsRefreshAction()); -// -// // - Link - related -// -// Link related = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("related")).findFirst().orElseThrow(); -// assertEquals("related", related.getDataElement().getName()); -// assertEquals(Set.of( -// "related::Create::Open", -// "related::View", -// "related::Delete", -// "related::OpenSetSelector", -// "related::Unset" -// ), related.getActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button relatedCreateOpen = related.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("related::Create::Open")).findFirst().orElseThrow(); -// assertTrue(relatedCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); -// assertButtonVisuals(relatedCreateOpen, "Create", "note-add", "contained"); -// assertEquals(relatedOpenFormAction.getActionDefinition(), relatedCreateOpen.getActionDefinition()); -// -// Button relatedView = related.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("related::View")).findFirst().orElseThrow(); -// assertTrue(relatedView.getActionDefinition().getIsOpenPageAction()); -// assertButtonVisuals(relatedView, "View", "eye", "contained"); -// assertEquals(relatedOpenPageAction.getActionDefinition(), relatedView.getActionDefinition()); -// assertEquals(userViewRelatedViewPageDefinition, relatedOpenPageAction.getTargetPageDefinition()); -// -// Button relatedDelete = related.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("related::Delete")).findFirst().orElseThrow(); -// assertTrue(relatedDelete.getActionDefinition().getIsRowDeleteAction()); -// assertButtonVisuals(relatedDelete, "Delete", "delete_forever", "contained"); -// assertEquals(relatedRowDeleteAction.getActionDefinition(), relatedDelete.getActionDefinition()); -// -// // - Table - relatedCollection -// -// Table relatedCollection = (Table) pageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("relatedCollection")).findFirst().orElseThrow(); -// assertEquals("relatedCollection", relatedCollection.getDataElement().getName()); -// -// assertEquals(Set.of( -// "relatedCollection::Filter", -// "relatedCollection::Refresh" -// ), relatedCollection.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button relatedCollectionFilter = relatedCollection.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("relatedCollection::Filter")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionFilter.getActionDefinition().getIsFilterAction()); -// assertButtonVisuals(relatedCollectionFilter, "Filter", "filter", "text"); -// assertEquals(relatedCollectionFilterAction.getActionDefinition(), relatedCollectionFilter.getActionDefinition()); -// -// Button relatedCollectionRefresh = relatedCollection.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("relatedCollection::Refresh")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionRefresh.getActionDefinition().getIsRefreshAction()); -// assertButtonVisuals(relatedCollectionRefresh, "Refresh", "refresh", "text"); -// assertEquals(relatedCollectionRefreshAction.getActionDefinition(), relatedCollectionRefresh.getActionDefinition()); -// -// assertEquals(Set.of( -// "relatedCollection::View" -// ), relatedCollection.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button relatedCollectionView = relatedCollection.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("relatedCollection::View")).findFirst().orElseThrow(); -// assertTrue(relatedCollectionView.getActionDefinition().getIsRowOpenPageAction()); -// assertButtonVisuals(relatedCollectionView, "View", "visibility", "contained"); -// assertEquals(relatedCollectionOpenPageAction.getActionDefinition(), relatedCollectionView.getActionDefinition()); -// assertEquals(userViewRelatedViewPageDefinition, relatedOpenPageAction.getTargetPageDefinition()); -// -// } -// -// @Test -// void testSingleRelationViewCRUD() throws Exception { -// jslModel = JslParser.getModelFromStrings("SingleRelationViewCRUD", List.of(createModelString("SingleRelationViewCRUD"))); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// Application application = apps.get(0); -// List pages = application.getPages(); -// -// PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::UserView::related::View::PageDefinition")).findFirst().orElseThrow(); -// PageContainer pageContainer = pageDefinition.getContainer(); -// -// PageDefinition readOnlyJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::readOnlyJumper::View::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition relatedSetSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::UserView::related::SetSelector::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::View::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumperCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::Create::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumperSetSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition jumperRowDetailViewPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::JumperRow::jumperRowDetail::View::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumpersCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::Create::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumpersAddSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::PageDefinition")).findFirst().orElseThrow(); -// PageContainer myJumpersAddSelectorPageContainer = myJumpersAddSelectorPageDefinition.getContainer(); -// PageContainer myJumperSetSelectorPageContainer = myJumperSetSelectorPageDefinition.getContainer(); -// -// assertEquals(20, pageDefinition.getActions().size()); -// assertEquals(4, myJumpersAddSelectorPageDefinition.getActions().size()); -// assertEquals(2, pageContainer.getLinks().size()); -// assertEquals(1, pageContainer.getTables().size()); -// -// assertEquals(Set.of( -// "related::Back", -// "related::Refresh", -// "related::Update", -// "related::Delete", -// "readOnlyJumper::OpenPage", -// "readOnlyJumper::Refresh", -// "myJumper::OpenPage", -// "myJumper::Refresh", -// "myJumper::OpenForm", -// "myJumper::RowDelete", -// "myJumper::OpenSetSelector", -// "myJumper::Unset", -// "myJumpers::OpenPage", -// "myJumpers::OpenCreate", -// "myJumpers::OpenAddSelector", -// "myJumpers::Filter", -// "myJumpers::Refresh", -// "myJumpers::Clear", -// "myJumpers::BulkRemove", -// "myJumpers::RowDelete" -// ), pageDefinition.getActions().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Action BackAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Back")).findFirst().orElseThrow(); -// assertTrue(BackAction.getIsBackAction()); -// -// Action refreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Refresh")).findFirst().orElseThrow(); -// assertTrue(refreshAction.getIsRefreshAction()); -// -// Action updateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Update")).findFirst().orElseThrow(); -// assertTrue(updateAction.getIsUpdateAction()); -// -// Action deleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Delete")).findFirst().orElseThrow(); -// assertTrue(deleteAction.getIsDeleteAction()); -// -// Action readOnlyJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::OpenPage")).findFirst().orElseThrow(); -// assertTrue(readOnlyJumperOpenPageAction.getIsOpenPageAction()); -// assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); -// -// Action readOnlyJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::Refresh")).findFirst().orElseThrow(); -// assertTrue(readOnlyJumperRefreshAction.getIsRefreshAction()); -// -// Action myJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenPage")).findFirst().orElseThrow(); -// assertTrue(myJumperOpenPageAction.getIsOpenPageAction()); -// assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); -// -// Action myJumperOpenFormAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenForm")).findFirst().orElseThrow(); -// assertTrue(myJumperOpenFormAction.getIsOpenFormAction()); -// assertEquals(myJumperCreatePageDefinition, myJumperOpenFormAction.getTargetPageDefinition()); -// -// Action myJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::Refresh")).findFirst().orElseThrow(); -// assertTrue(myJumperRefreshAction.getIsRefreshAction()); -// -// Action myJumperRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::RowDelete")).findFirst().orElseThrow(); -// assertTrue(myJumperRowDeleteAction.getIsRowDeleteAction()); -// -// Action myJumperOpenSetSelectorAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenSetSelector")).findFirst().orElseThrow(); -// assertTrue(myJumperOpenSetSelectorAction.isOpenSetSelectorAction()); -// assertEquals(myJumperSetSelectorPageDefinition, myJumperOpenSetSelectorAction.getTargetPageDefinition()); -// -// Action myJumperUnsetAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::Unset")).findFirst().orElseThrow(); -// assertTrue(myJumperUnsetAction.getIsUnsetAction()); -// -// Action myJumpersOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenPage")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenPageAction.getIsRowOpenPageAction()); -// assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); -// -// Action myJumpersFilterAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumpersFilterAction.getIsFilterAction()); -// -// Action myJumpersRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); -// assertTrue(myJumpersRefreshAction.getIsRefreshAction()); -// -// Action myJumpersOpenCreateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenCreateAction.isOpenCreateFormAction()); -// assertEquals(myJumpersCreatePageDefinition, myJumpersOpenCreateAction.getTargetPageDefinition()); -// -// Action myJumpersRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); -// assertTrue(myJumpersRowDeleteAction.getIsRowDeleteAction()); -// -// Action myJumpersClearAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Clear")).findFirst().orElseThrow(); -// assertTrue(myJumpersClearAction.getIsClearAction()); -// -// Action myJumpersBulkRemoveAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::BulkRemove")).findFirst().orElseThrow(); -// assertTrue(myJumpersBulkRemoveAction.getIsBulkRemoveAction()); -// -// Action myJumpersOpenAddSelectorAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenAddSelectorAction.isOpenAddSelectorAction()); -// assertEquals(myJumpersAddSelectorPageDefinition, myJumpersOpenAddSelectorAction.getTargetPageDefinition()); -// -// // - link readOnlyJumper -// -// Link readOnlyJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("readOnlyJumper")).findFirst().orElseThrow(); -// assertEquals("readOnlyJumper", readOnlyJumper.getDataElement().getName()); -// assertEquals(Set.of( -// "readOnlyJumper::View" -// ), readOnlyJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button readOnlyJumperView = readOnlyJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("readOnlyJumper::View")).findFirst().orElseThrow(); -// assertTrue(readOnlyJumperView.getActionDefinition().getIsOpenPageAction()); -// assertButtonVisuals(readOnlyJumperView, "View", "eye", "contained"); -// assertEquals(readOnlyJumperOpenPageAction.getActionDefinition(), readOnlyJumperView.getActionDefinition()); -// assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); -// -// // - Link - myJumper -// -// Link myJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("myJumper")).findFirst().orElseThrow(); -// assertEquals("myJumper", myJumper.getDataElement().getName()); -// assertEquals(Set.of( -// "myJumper::Create::Open", -// "myJumper::View", -// "myJumper::Delete", -// "myJumper::OpenSetSelector", -// "myJumper::Unset" -// ), myJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumperCreateOpen = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Create::Open")).findFirst().orElseThrow(); -// assertTrue(myJumperCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); -// assertButtonVisuals(myJumperCreateOpen, "Create", "note-add", "contained"); -// assertEquals(myJumperOpenFormAction.getActionDefinition(), myJumperCreateOpen.getActionDefinition()); -// -// Button myJumperView = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::View")).findFirst().orElseThrow(); -// assertTrue(myJumperView.getActionDefinition().getIsOpenPageAction()); -// assertButtonVisuals(myJumperView, "View", "eye", "contained"); -// assertEquals(myJumperOpenPageAction.getActionDefinition(), myJumperView.getActionDefinition()); -// assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); -// -// Button myJumperDelete = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Delete")).findFirst().orElseThrow(); -// assertTrue(myJumperDelete.getActionDefinition().getIsRowDeleteAction()); -// assertButtonVisuals(myJumperDelete, "Delete", "delete_forever", "contained"); -// assertEquals(myJumperRowDeleteAction.getActionDefinition(), myJumperDelete.getActionDefinition()); -// -// Button myJumperOpenSetSelector = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::OpenSetSelector")).findFirst().orElseThrow(); -// assertTrue(myJumperOpenSetSelector.getActionDefinition().getIsOpenSelectorAction()); -// assertButtonVisuals(myJumperOpenSetSelector, "Set", "link", "contained"); -// assertEquals(myJumperOpenSetSelectorAction.getActionDefinition(), myJumperOpenSetSelector.getActionDefinition()); -// -// Button myJumperUnset = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Unset")).findFirst().orElseThrow(); -// assertTrue(myJumperUnset.getActionDefinition().getIsUnsetAction()); -// assertButtonVisuals(myJumperUnset, "Unset", "link-off", "contained"); -// assertEquals(myJumperUnsetAction.getActionDefinition(), myJumperUnset.getActionDefinition()); -// -// // - Table - myJumpers -// -// Table myJumpers = (Table) pageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumpers")).findFirst().orElseThrow(); -// assertEquals("myJumpers", myJumpers.getDataElement().getName()); -// -// assertEquals(Set.of( -// "myJumpers::Filter", -// "myJumpers::Refresh", -// "myJumpers::OpenCreate", -// "myJumpers::OpenAddSelector", -// "myJumpers::Clear", -// "myJumpers::BulkRemove" -// ), myJumpers.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumpersFilter = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumpersFilter.getActionDefinition().getIsFilterAction()); -// assertButtonVisuals(myJumpersFilter, "Filter", "filter", "text"); -// assertEquals(myJumpersFilterAction.getActionDefinition(), myJumpersFilter.getActionDefinition()); -// -// Button myJumpersRefresh = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); -// assertTrue(myJumpersRefresh.getActionDefinition().getIsRefreshAction()); -// assertButtonVisuals(myJumpersRefresh, "Refresh", "refresh", "text"); -// assertEquals(myJumpersRefreshAction.getActionDefinition(), myJumpersRefresh.getActionDefinition()); -// -// Button myJumpersOpenCreate = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenCreate.getActionDefinition().getIsOpenCreateFormAction()); -// assertButtonVisuals(myJumpersOpenCreate, "Create", "file-document-plus", "text"); -// assertEquals(myJumpersOpenCreateAction.getActionDefinition(), myJumpersOpenCreate.getActionDefinition()); -// -// Button myJumpersClear = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Clear")).findFirst().orElseThrow(); -// assertTrue(myJumpersClear.getActionDefinition().getIsClearAction()); -// assertButtonVisuals(myJumpersClear, "Clear", "link-off", "text"); -// assertEquals(myJumpersClearAction.getActionDefinition(), myJumpersClear.getActionDefinition()); -// -// Button myJumpersBulkRemove = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::BulkRemove")).findFirst().orElseThrow(); -// assertTrue(myJumpersBulkRemove.getActionDefinition().getIsBulkRemoveAction()); -// assertButtonVisuals(myJumpersBulkRemove, "Remove", "link-off", "text"); -// assertEquals(myJumpersBulkRemoveAction.getActionDefinition(), myJumpersBulkRemove.getActionDefinition()); -// -// Button myJumpersOpenAddSelector = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenAddSelector.getActionDefinition().getIsOpenAddSelectorAction()); -// assertButtonVisuals(myJumpersOpenAddSelector, "Add", "attachment-plus", "text"); -// assertEquals(myJumpersOpenAddSelectorAction.getActionDefinition(), myJumpersOpenAddSelector.getActionDefinition()); -// -// assertEquals(Set.of( -// "myJumpers::View", -// "myJumpers::RowDelete" -// ), myJumpers.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumpersView = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::View")).findFirst().orElseThrow(); -// assertTrue(myJumpersView.getActionDefinition().getIsRowOpenPageAction()); -// assertButtonVisuals(myJumpersView, "View", "visibility", "contained"); -// assertEquals(myJumpersOpenPageAction.getActionDefinition(), myJumpersView.getActionDefinition()); -// assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); -// -// Button myJumpersRowDelete = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); -// assertTrue(myJumpersRowDelete.getActionDefinition().getIsRowDeleteAction()); -// assertButtonVisuals(myJumpersRowDelete, "Delete", "delete_forever", "contained"); -// assertEquals(myJumpersRowDeleteAction.getActionDefinition(), myJumpersRowDelete.getActionDefinition()); -// -// // add selector - myJumpers -// -// assertEquals(Set.of( -// "SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Add", -// "SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Filter", -// "SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Range", -// "SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Back" -// ), myJumpersAddSelectorPageDefinition.getActions().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Action myJumpersAddSelectorAddAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Add")).findFirst().orElseThrow(); -// assertTrue(myJumpersAddSelectorAddAction.getActionDefinition().getIsAddAction()); -// -// Action myJumpersAddSelectorFilterAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumpersAddSelectorFilterAction.getActionDefinition().getIsFilterAction()); -// -// Action myJumpersAddSelectorrangeAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Range")).findFirst().orElseThrow(); -// assertTrue(myJumpersAddSelectorrangeAction.getActionDefinition().getIsSelectorRangeAction()); -// -// Action myJumpersAddSelectorBackAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Back")).findFirst().orElseThrow(); -// assertTrue(myJumpersAddSelectorBackAction.getActionDefinition().getIsBackAction()); -// -// Table myJumpersAddSelector = (Table) myJumpersAddSelectorPageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumpers::Add::Selector")).findFirst().orElseThrow(); -// assertEquals("SingleRelationViewCRUD::JumperRow::ClassType", myJumpersAddSelector.getDataElement().getName()); -// assertTrue(myJumpersAddSelector.isAllowSelectMultiple()); -// assertTrue(myJumpersAddSelector.isIsRelationSelectorTable()); -// assertTrue(myJumpersAddSelector.isIsSelectorTable()); -// -// assertEquals(Set.of( -// "SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Filter", -// "SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Refresh" -// ), myJumpersAddSelector.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumpersAddSelectorFilter = myJumpersAddSelector.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("SingleRelationViewCRUD::RelatedView::myJumpers::AddSelector::Table::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumpersAddSelectorFilter.getActionDefinition().getIsFilterAction()); -// assertButtonVisuals(myJumpersAddSelectorFilter, "Set Filters", "filter", "text"); -// assertEquals(myJumpersAddSelectorFilterAction.getActionDefinition(), myJumpersAddSelectorFilter.getActionDefinition()); -// -// // set selector - myJumper -// -// assertEquals(Set.of( -// "SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Filter", -// "SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Range", -// "SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Set", -// "SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Back" -// ), myJumperSetSelectorPageDefinition.getActions().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Action myJumperSetSelectorFilterAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumperSetSelectorFilterAction.getActionDefinition().getIsFilterAction()); -// -// Action myJumperSetSelectorrangeAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Range")).findFirst().orElseThrow(); -// assertTrue(myJumperSetSelectorrangeAction.getActionDefinition().getIsSelectorRangeAction()); -// -// Action myJumperSetSelectorSetAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Set")).findFirst().orElseThrow(); -// assertTrue(myJumperSetSelectorSetAction.getActionDefinition().getIsSetAction()); -// -// Action myJumperSetSelectorBackAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Back")).findFirst().orElseThrow(); -// assertTrue(myJumperSetSelectorBackAction.getActionDefinition().getIsBackAction()); -// -// Table myJumperSetSelector = (Table) myJumperSetSelectorPageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumper::Set::Selector")).findFirst().orElseThrow(); -// assertEquals("SingleRelationViewCRUD::JumperRow::ClassType", myJumpersAddSelector.getDataElement().getName()); -// assertTrue(myJumpersAddSelector.isAllowSelectMultiple()); -// assertTrue(myJumpersAddSelector.isIsRelationSelectorTable()); -// assertTrue(myJumpersAddSelector.isIsSelectorTable()); -// -// assertEquals(Set.of( -// "SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Filter", -// "SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Refresh" -// ), myJumperSetSelector.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumperSetSelectorFilter = myJumperSetSelector.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::SetSelector::Table::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumperSetSelectorFilter.getActionDefinition().getIsFilterAction()); -// assertButtonVisuals(myJumperSetSelectorFilter, "Set Filters", "filter", "text"); -// assertEquals(myJumperSetSelectorFilterAction.getActionDefinition(), myJumperSetSelectorFilter.getActionDefinition()); -// } -// -// @Test -// void testRelatedRowDetailViewCRUD() throws Exception { -// jslModel = JslParser.getModelFromStrings("RelatedRowDetailViewCRUD", List.of(createModelString("RelatedRowDetailViewCRUD"))); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// Application application = apps.get(0); -// List pages = application.getPages(); -// -// PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedRow::detail::View::PageDefinition")).findFirst().orElseThrow(); -// PageContainer pageContainer = pageDefinition.getContainer(); -// -// PageDefinition readOnlyJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::readOnlyJumper::View::PageDefinition")).findFirst().orElseThrow(); -// -// PageDefinition myJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::myJumper::View::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumperCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::myJumper::Create::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumpersCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::myJumpers::Create::PageDefinition")).findFirst().orElseThrow(); -// PageDefinition myJumpersAddSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::myJumpers::AddSelector::PageDefinition")).findFirst().orElseThrow(); -// -// PageDefinition jumperRowDetailViewPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::JumperRow::jumperRowDetail::View::PageDefinition")).findFirst().orElseThrow(); -// -// assertEquals(18, pageDefinition.getActions().size()); -// assertEquals(2, pageContainer.getLinks().size()); -// assertEquals(1, pageContainer.getTables().size()); -// -// assertEquals(Set.of( -// "detail::Back", -// "detail::Refresh", -// "readOnlyJumper::OpenPage", -// "readOnlyJumper::Refresh", -// "myJumper::OpenPage", -// "myJumper::Refresh", -// "myJumper::OpenForm", -// "myJumper::RowDelete", -// "myJumper::OpenSetSelector", -// "myJumper::Unset", -// "myJumpers::OpenPage", -// "myJumpers::OpenCreate", -// "myJumpers::Filter", -// "myJumpers::Refresh", -// "myJumpers::RowDelete", -// "myJumpers::BulkRemove", -// "myJumpers::Clear", -// "myJumpers::OpenAddSelector" -// ), pageDefinition.getActions().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Action BackAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("detail::Back")).findFirst().orElseThrow(); -// assertTrue(BackAction.getIsBackAction()); -// -// Action refreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("detail::Refresh")).findFirst().orElseThrow(); -// assertTrue(refreshAction.getIsRefreshAction()); -// -// Action readOnlyJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::OpenPage")).findFirst().orElseThrow(); -// assertTrue(readOnlyJumperOpenPageAction.getIsOpenPageAction()); -// assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); -// -// Action readOnlyJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::Refresh")).findFirst().orElseThrow(); -// assertTrue(readOnlyJumperRefreshAction.getIsRefreshAction()); -// -// Action myJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenPage")).findFirst().orElseThrow(); -// assertTrue(myJumperOpenPageAction.getIsOpenPageAction()); -// assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); -// -// Action myJumperOpenFormAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenForm")).findFirst().orElseThrow(); -// assertTrue(myJumperOpenFormAction.getIsOpenFormAction()); -// assertEquals(myJumperCreatePageDefinition, myJumperOpenFormAction.getTargetPageDefinition()); -// -// Action myJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::Refresh")).findFirst().orElseThrow(); -// assertTrue(myJumperRefreshAction.getIsRefreshAction()); -// -// Action myJumperRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::RowDelete")).findFirst().orElseThrow(); -// assertTrue(myJumperRowDeleteAction.getIsRowDeleteAction()); -// -// Action myJumpersOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenPage")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenPageAction.getIsRowOpenPageAction()); -// assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); -// -// Action myJumpersFilterAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumpersFilterAction.getIsFilterAction()); -// -// Action myJumpersRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); -// assertTrue(myJumpersRefreshAction.getIsRefreshAction()); -// -// Action myJumpersOpenCreateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenCreateAction.getIsOpenFormAction()); -// assertEquals(myJumpersCreatePageDefinition, myJumpersOpenCreateAction.getTargetPageDefinition()); -// -// Action myJumpersRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); -// assertTrue(myJumpersRowDeleteAction.getIsRowDeleteAction()); -// -// Action myJumpersOpenAddSelectorAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenAddSelectorAction.isOpenAddSelectorAction()); -// assertEquals(myJumpersAddSelectorPageDefinition, myJumpersOpenAddSelectorAction.getTargetPageDefinition()); -// -// // - link readOnlyJumper -// -// Link readOnlyJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("readOnlyJumper")).findFirst().orElseThrow(); -// assertEquals("readOnlyJumper", readOnlyJumper.getDataElement().getName()); -// assertEquals(Set.of( -// "readOnlyJumper::View" -// ), readOnlyJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button readOnlyJumperView = readOnlyJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("readOnlyJumper::View")).findFirst().orElseThrow(); -// assertTrue(readOnlyJumperView.getActionDefinition().getIsOpenPageAction()); -// assertButtonVisuals(readOnlyJumperView, "View", "eye", "contained"); -// assertEquals(readOnlyJumperOpenPageAction.getActionDefinition(), readOnlyJumperView.getActionDefinition()); -// assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); -// -// // - Link - myJumper -// -// Link myJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("myJumper")).findFirst().orElseThrow(); -// assertEquals("myJumper", myJumper.getDataElement().getName()); -// assertEquals(Set.of( -// "myJumper::Create::Open", -// "myJumper::View", -// "myJumper::Delete", -// "myJumper::OpenSetSelector", -// "myJumper::Unset" -// ), myJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumperCreateOpen = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Create::Open")).findFirst().orElseThrow(); -// assertTrue(myJumperCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); -// assertButtonVisuals(myJumperCreateOpen, "Create", "note-add", "contained"); -// assertEquals(myJumperOpenFormAction.getActionDefinition(), myJumperCreateOpen.getActionDefinition()); -// -// Button myJumperView = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::View")).findFirst().orElseThrow(); -// assertTrue(myJumperView.getActionDefinition().getIsOpenPageAction()); -// assertButtonVisuals(myJumperView, "View", "eye", "contained"); -// assertEquals(myJumperOpenPageAction.getActionDefinition(), myJumperView.getActionDefinition()); -// assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); -// -// Button myJumperDelete = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Delete")).findFirst().orElseThrow(); -// assertTrue(myJumperDelete.getActionDefinition().getIsRowDeleteAction()); -// assertButtonVisuals(myJumperDelete, "Delete", "delete_forever", "contained"); -// assertEquals(myJumperRowDeleteAction.getActionDefinition(), myJumperDelete.getActionDefinition()); -// -// // - Table - myJumpers -// -// Table myJumpers = (Table) pageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumpers")).findFirst().orElseThrow(); -// assertEquals("myJumpers", myJumpers.getDataElement().getName()); -// -// assertEquals(Set.of( -// "myJumpers::Filter", -// "myJumpers::Refresh", -// "myJumpers::OpenCreate", -// "myJumpers::OpenAddSelector", -// "myJumpers::Clear", -// "myJumpers::BulkRemove" -// ), myJumpers.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumpersFilter = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); -// assertTrue(myJumpersFilter.getActionDefinition().getIsFilterAction()); -// assertButtonVisuals(myJumpersFilter, "Filter", "filter", "text"); -// assertEquals(myJumpersFilterAction.getActionDefinition(), myJumpersFilter.getActionDefinition()); -// -// Button myJumpersRefresh = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); -// assertTrue(myJumpersRefresh.getActionDefinition().getIsRefreshAction()); -// assertButtonVisuals(myJumpersRefresh, "Refresh", "refresh", "text"); -// assertEquals(myJumpersRefreshAction.getActionDefinition(), myJumpersRefresh.getActionDefinition()); -// -// Button myJumpersOpenCreate = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenCreate.getActionDefinition().getIsOpenCreateFormAction()); -// assertButtonVisuals(myJumpersOpenCreate, "Create", "file-document-plus", "text"); -// assertEquals(myJumpersOpenCreateAction.getActionDefinition(), myJumpersOpenCreate.getActionDefinition()); -// -// Button myJumpersOpenAddSelector = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); -// assertTrue(myJumpersOpenAddSelector.getActionDefinition().getIsOpenAddSelectorAction()); -// assertButtonVisuals(myJumpersOpenAddSelector, "Add", "attachment-plus", "text"); -// assertEquals(myJumpersOpenAddSelectorAction.getActionDefinition(), myJumpersOpenAddSelector.getActionDefinition()); -// -// Button myJumpersClear = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Clear")).findFirst().orElseThrow(); -// assertTrue(myJumpersClear.getActionDefinition().getIsClearAction()); -// assertButtonVisuals(myJumpersClear, "Clear", "link-off", "text"); -// assertEquals(myJumpersClear.getActionDefinition(), myJumpersClear.getActionDefinition()); -// -// Button myJumpersBulkRemove = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::BulkRemove")).findFirst().orElseThrow(); -// assertTrue(myJumpersBulkRemove.getActionDefinition().getIsBulkRemoveAction()); -// assertButtonVisuals(myJumpersBulkRemove, "Remove", "link-off", "text"); -// assertEquals(myJumpersBulkRemove.getActionDefinition(), myJumpersBulkRemove.getActionDefinition()); -// -// assertEquals(Set.of( -// "myJumpers::View", -// "myJumpers::RowDelete" -// ), myJumpers.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getName).collect(Collectors.toSet())); -// -// Button myJumpersView = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::View")).findFirst().orElseThrow(); -// assertTrue(myJumpersView.getActionDefinition().getIsRowOpenPageAction()); -// assertButtonVisuals(myJumpersView, "View", "visibility", "contained"); -// assertEquals(myJumpersOpenPageAction.getActionDefinition(), myJumpersView.getActionDefinition()); -// assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); -// -// Button myJumpersRowDelete = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); -// assertTrue(myJumpersRowDelete.getActionDefinition().getIsRowDeleteAction()); -// assertButtonVisuals(myJumpersRowDelete, "Delete", "delete_forever", "contained"); -// assertEquals(myJumpersRowDeleteAction.getActionDefinition(), myJumpersRowDelete.getActionDefinition()); -// } -// -// @Test -// void testRelatedFormCRUD() throws Exception { -// jslModel = JslParser.getModelFromStrings("RelatedFormCRUD", List.of(createModelString("RelatedFormCRUD"))); -// -// transform(); -// -// List apps = uiModelWrapper.getStreamOfUiApplication().toList(); -// -// Application application = apps.get(0); -// List pages = application.getPages(); -// -// PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedFormCRUD::UserView::related::Create::PageDefinition")).findFirst().orElseThrow(); -// PageContainer pageContainer = pageDefinition.getContainer(); -// List
tables = application.getTables(); + List allActions = application.getPages().stream().flatMap(ps -> ps.getActions().stream()).toList(); + + PageDefinition actorDashboardPage = pages.stream().filter(p -> p.getName().equals("SummaryCRUD::NavigationApp::DashboardPage")).findFirst().orElseThrow(); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::NavigationActor::user", + "NavigationActor::SummaryCRUD::RelatedTransfer::theJumpersCollection", + "NavigationActor::SummaryCRUD::RelatedTransfer::theJumper", + "NavigationActor::SummaryCRUD::UserTransfer::relatedCollection", + "NavigationActor::SummaryCRUD::UserTransfer::related" + ), relationTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::NavigationActor", + "NavigationActor::SummaryCRUD::RelatedTransfer", + "NavigationActor::SummaryCRUD::JumperTransfer", + "NavigationActor::SummaryCRUD::UserTransfer" + ), classTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::NavigationApp::Dashboard", + "NavigationActor::SummaryCRUD::UserView::View::PageContainer", + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelector::PageContainer", + "NavigationActor::SummaryCRUD::RelatedTable::Table::PageContainer", + "NavigationActor::SummaryCRUD::RelatedForm::Create::PageContainer", + "NavigationActor::SummaryCRUD::RelatedView::View::PageContainer", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelector::PageContainer", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelector::PageContainer", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelector::PageContainer", + "NavigationActor::SummaryCRUD::JumperTable::Table::PageContainer", + "NavigationActor::SummaryCRUD::JumperView::View::PageContainer", + "NavigationActor::SummaryCRUD::JumperForm::Create::PageContainer" + ), pageContainers.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::NavigationApp::DashboardPage", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage", + "NavigationActor::SummaryCRUD::UserView::level::related::FormPage", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage", + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelectorPage", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::ViewPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelectorPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::FormPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::ViewPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::FormPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelectorPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::ViewPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::FormPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelectorPage" + ), pages.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::UserView::View::PageContainer::UserView::level::related", + "NavigationActor::SummaryCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper", + "NavigationActor::SummaryCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper" + ), links.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::UserView::View::PageContainer::UserView::level::relatedCollection", + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelector::PageContainer::related::related::Set::Selector", + "NavigationActor::SummaryCRUD::JumperTable::Table::PageContainer::JumperTable::JumperTable::Table", + "NavigationActor::SummaryCRUD::RelatedTable::Table::PageContainer::RelatedTable::RelatedTable::Table", + "NavigationActor::SummaryCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelector::PageContainer::myJumper::myJumper::Set::Selector", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelector::PageContainer::myJumpers::myJumpers::Add::Selector", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelector::PageContainer::readOnlyJumper::readOnlyJumper::Set::Selector" + ), tables.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelectorPage::SummaryCRUD::UserView::level::related::SetSelector::Set", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::FormPage::readOnlyJumper::Back", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::FormPage::myJumpers::Back", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SummaryCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Filter", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::ViewPage::readOnlyJumper::Delete", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SummaryCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Range", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::FormPage::myJumper::Back", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::ViewPage::myJumper::Update", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::readOnlyJumper::RowDelete", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::OpenCreate", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::OpenPage", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::related::Refresh", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::ViewPage::myJumpers::Refresh", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumper::RowDelete", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::ViewPage::myJumpers::Delete", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::user::Back", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::readOnlyJumper::Unset", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::ViewPage::myJumper::Delete", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::OpenAddSelector", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::relatedCollection::Back", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::related::OpenForm", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::ViewPage::myJumpers::Update", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::ViewPage::myJumper::Refresh", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SummaryCRUD::RelatedView::g1::myJumpers::AddSelector::Back", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::RowDelete", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::ViewPage::readOnlyJumper::Update", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::myJumper::SetSelector::Set", + "NavigationActor::SummaryCRUD::UserView::level::related::FormPage::related::Create", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumper::OpenForm", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::myJumper::SetSelector::Back", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::related::OpenSetSelector", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::readOnlyJumper::Refresh", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::related::Update", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::Filter", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::FormPage::myJumpers::Create", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::relatedCollection::Refresh", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::FormPage::readOnlyJumper::Create", + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelectorPage::SummaryCRUD::UserView::level::related::SetSelector::Back", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumper::OpenForm", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::ViewPage::myJumpers::Back", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::FormPage::myJumper::Create", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::ViewPage::readOnlyJumper::Refresh", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::OpenCreate", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::Filter", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::Clear", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::user::Refresh", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::related::RowDelete", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::relatedCollection::Refresh", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::relatedCollection::Update", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelector::Table::Range", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::OpenAddSelector", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::OpenPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::myJumper::SetSelector::Table::Range", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::related::OpenPage", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::user::Update", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::readOnlyJumper::Refresh", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenForm", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::readOnlyJumper::OpenSetSelector", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumper::RowDelete", + "NavigationActor::SummaryCRUD::UserView::level::related::FormPage::related::Back", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumper::OpenSetSelector", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::user::Delete", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::readOnlyJumper::Unset", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::related::Back", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelector::Table::Filter", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::readOnlyJumper::OpenPage", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumper::Refresh", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelector::Back", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::readOnlyJumper::RowDelete", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::related::Delete", + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelectorPage::SummaryCRUD::UserView::level::related::SetSelector::Table::Filter", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::readOnlyJumper::OpenForm", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::Refresh", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumper::OpenPage", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenPage", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::BulkRemove", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::RowDelete", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::ViewPage::readOnlyJumper::Back", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::Refresh", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::ViewPage::myJumper::Back", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::relatedCollection::OpenPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::myJumper::SetSelector::Table::Filter", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumpers::Clear", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::relatedCollection::Filter", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenSetSelector", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumper::Unset", + "NavigationActor::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelectorPage::SummaryCRUD::RelatedView::g1::readOnlyJumper::SetSelector::Set", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumper::OpenSetSelector", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumper::Unset", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumper::OpenPage", + "NavigationActor::SummaryCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SummaryCRUD::RelatedView::g1::myJumpers::AddSelector::Add", + "NavigationActor::SummaryCRUD::UserView::level::related::SetSelectorPage::SummaryCRUD::UserView::level::related::SetSelector::Table::Range", + "NavigationActor::SummaryCRUD::UserView::level::relatedCollection::ViewPage::myJumpers::BulkRemove", + "NavigationActor::SummaryCRUD::NavigationApp::user::AccessViewPage::related::Unset", + "NavigationActor::SummaryCRUD::UserView::level::related::ViewPage::myJumper::Refresh" + ), allActions.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + } + + @Test + void testAccessViewCRUD() throws Exception { + jslModel = JslParser.getModelFromStrings("AccessViewCRUD", List.of(createModelString("AccessViewCRUD"))); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + Application application = apps.get(0); + + List pages = application.getPages(); + + PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::NavigationApp::user::AccessViewPage")).findFirst().orElseThrow(); + PageDefinition userViewRelatedViewPageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::UserView::level::related::ViewPage")).findFirst().orElseThrow(); + PageDefinition userViewRelatedCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::UserView::level::related::FormPage")).findFirst().orElseThrow(); + PageDefinition relatedRowDetailViewPageDefinition = pages.stream().filter(p -> p.getName().equals("AccessViewCRUD::UserView::level::relatedCollection::ViewPage")).findFirst().orElseThrow(); + + PageContainer pageContainer = pageDefinition.getContainer(); + + assertEquals(Set.of( + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::user::Back", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::user::Refresh", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::user::Delete", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::user::Update", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::relatedCollection::Filter", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::relatedCollection::Refresh", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::relatedCollection::OpenPage", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::related::OpenForm", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::related::OpenPage", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::related::RowDelete", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::related::Unset", + "NavigationActor::AccessViewCRUD::NavigationApp::user::AccessViewPage::related::OpenSetSelector" + ), pageDefinition.getActions().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::related" + ), pageContainer.getLinks().stream().map(l -> ((Link) l).getFQName()).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::relatedCollection" + ), pageContainer.getTables().stream().map(t -> ((Table) t).getFQName()).collect(Collectors.toSet())); + + Action backAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("user::Back")).findFirst().orElseThrow(); + assertTrue(backAction.getIsBackAction()); + + Action updateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("user::Update")).findFirst().orElseThrow(); + assertTrue(updateAction.getIsUpdateAction()); + + Action deleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("user::Delete")).findFirst().orElseThrow(); + assertTrue(deleteAction.getIsDeleteAction()); + + Action relatedOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::OpenPage")).findFirst().orElseThrow(); + assertTrue(relatedOpenPageAction.getIsOpenPageAction()); + assertEquals(userViewRelatedViewPageDefinition, relatedOpenPageAction.getTargetPageDefinition()); + + Action relatedOpenFormAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::OpenForm")).findFirst().orElseThrow(); + assertTrue(relatedOpenFormAction.getIsOpenFormAction()); + assertEquals(userViewRelatedCreatePageDefinition, relatedOpenFormAction.getTargetPageDefinition()); + + Action relatedRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::RowDelete")).findFirst().orElseThrow(); + assertTrue(relatedRowDeleteAction.getIsRowDeleteAction()); + + Action relatedCollectionOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("relatedCollection::OpenPage")).findFirst().orElseThrow(); + assertTrue(relatedCollectionOpenPageAction.getIsOpenPageAction()); + assertEquals(relatedRowDetailViewPageDefinition, relatedCollectionOpenPageAction.getTargetPageDefinition()); + + Action relatedCollectionFilterAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("relatedCollection::Filter")).findFirst().orElseThrow(); + assertTrue(relatedCollectionFilterAction.getIsFilterAction()); + + Action relatedCollectionRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("relatedCollection::Refresh")).findFirst().orElseThrow(); + assertTrue(relatedCollectionRefreshAction.getIsRefreshAction()); + + // - Link - related + + Link related = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("related")).findFirst().orElseThrow(); + assertEquals("related", related.getDataElement().getName()); + assertEquals(Set.of( + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::related::related::Actions::related::OpenSetSelector", + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::related::related::Actions::related::Create::Open", + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::related::related::Actions::related::Delete", + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::related::related::Actions::related::View", + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::related::related::Actions::related::Unset" + ), related.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button relatedCreateOpen = related.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("related::Create::Open")).findFirst().orElseThrow(); + assertTrue(relatedCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); + assertButtonVisuals(relatedCreateOpen, "Create", "note-add", "contained"); + assertEquals(relatedOpenFormAction.getActionDefinition(), relatedCreateOpen.getActionDefinition()); + + Button relatedView = related.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("related::View")).findFirst().orElseThrow(); + assertTrue(relatedView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(relatedView, "View", "eye", "contained"); + assertEquals(relatedOpenPageAction.getActionDefinition(), relatedView.getActionDefinition()); + assertEquals(userViewRelatedViewPageDefinition, relatedOpenPageAction.getTargetPageDefinition()); + + Button relatedDelete = related.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("related::Delete")).findFirst().orElseThrow(); + assertTrue(relatedDelete.getActionDefinition().getIsRowDeleteAction()); + assertButtonVisuals(relatedDelete, "Delete", "delete_forever", "contained"); + assertEquals(relatedRowDeleteAction.getActionDefinition(), relatedDelete.getActionDefinition()); + + // - Table - relatedCollection + + Table relatedCollection = (Table) pageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("relatedCollection")).findFirst().orElseThrow(); + assertEquals("relatedCollection", relatedCollection.getDataElement().getName()); + + assertEquals(Set.of( + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::Filter", + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::relatedCollection::relatedCollection::InlineViewTableButtonGroup::relatedCollection::Refresh" + ), relatedCollection.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button relatedCollectionFilter = relatedCollection.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("relatedCollection::Filter")).findFirst().orElseThrow(); + assertTrue(relatedCollectionFilter.getActionDefinition().getIsFilterAction()); + assertButtonVisuals(relatedCollectionFilter, "Filter", "filter", "text"); + assertEquals(relatedCollectionFilterAction.getActionDefinition(), relatedCollectionFilter.getActionDefinition()); + + Button relatedCollectionRefresh = relatedCollection.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("relatedCollection::Refresh")).findFirst().orElseThrow(); + assertTrue(relatedCollectionRefresh.getActionDefinition().getIsRefreshAction()); + assertButtonVisuals(relatedCollectionRefresh, "Refresh", "refresh", "text"); + assertEquals(relatedCollectionRefreshAction.getActionDefinition(), relatedCollectionRefresh.getActionDefinition()); + + assertEquals(Set.of( + "NavigationActor::AccessViewCRUD::UserView::View::PageContainer::UserView::level::relatedCollection::relatedCollectionInlineViewTableRowButtonGroup::relatedCollection::View" + ), relatedCollection.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button relatedCollectionView = relatedCollection.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("relatedCollection::View")).findFirst().orElseThrow(); + assertTrue(relatedCollectionView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(relatedCollectionView, "View", "visibility", "contained"); + assertEquals(relatedCollectionOpenPageAction.getActionDefinition(), relatedCollectionView.getActionDefinition()); + assertEquals(userViewRelatedViewPageDefinition, relatedOpenPageAction.getTargetPageDefinition()); + + } + + @Test + void testSingleRelationViewCRUD() throws Exception { + jslModel = JslParser.getModelFromStrings("SingleRelationViewCRUD", List.of(createModelString("SingleRelationViewCRUD"))); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + Application application = apps.get(0); + List pages = application.getPages(); + + PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::UserView::level::related::ViewPage")).findFirst().orElseThrow(); + PageContainer pageContainer = pageDefinition.getContainer(); + + PageDefinition readOnlyJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::readOnlyJumper::ViewPage")).findFirst().orElseThrow(); + PageDefinition relatedSetSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::UserView::level::related::SetSelectorPage")).findFirst().orElseThrow(); + PageDefinition myJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::ViewPage")).findFirst().orElseThrow(); + PageDefinition myJumperCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::FormPage")).findFirst().orElseThrow(); + PageDefinition myJumperSetSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorPage")).findFirst().orElseThrow(); + PageDefinition jumperRowDetailViewPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::ViewPage")).findFirst().orElseThrow(); + PageDefinition myJumpersCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::FormPage")).findFirst().orElseThrow(); + PageDefinition myJumpersAddSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorPage")).findFirst().orElseThrow(); + PageContainer myJumpersAddSelectorPageContainer = myJumpersAddSelectorPageDefinition.getContainer(); + PageContainer myJumperSetSelectorPageContainer = myJumperSetSelectorPageDefinition.getContainer(); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumper::OpenForm", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumper::OpenPage", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumper::OpenSetSelector", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumper::Refresh", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumper::RowDelete", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumper::Unset", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::BulkRemove", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::Clear", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::Filter", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::OpenAddSelector", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::OpenCreate", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::OpenPage", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::Refresh", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::myJumpers::RowDelete", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenForm", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenPage", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenSetSelector", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::Refresh", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::RowDelete", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::Unset", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::related::Back", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::related::Delete", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::related::Refresh", + "NavigationActor::SingleRelationViewCRUD::UserView::level::related::ViewPage::related::Update" + ), pageDefinition.getActions().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper" + ), pageContainer.getLinks().stream().map(l -> ((Link) l).getFQName()).collect(Collectors.toSet())); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers" + ), pageContainer.getTables().stream().map(t -> ((Table) t).getFQName()).collect(Collectors.toSet())); + + Action BackAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Back")).findFirst().orElseThrow(); + assertTrue(BackAction.getIsBackAction()); + + Action refreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Refresh")).findFirst().orElseThrow(); + assertTrue(refreshAction.getIsRefreshAction()); + + Action updateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Update")).findFirst().orElseThrow(); + assertTrue(updateAction.getIsUpdateAction()); + + Action deleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Delete")).findFirst().orElseThrow(); + assertTrue(deleteAction.getIsDeleteAction()); + + Action readOnlyJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::OpenPage")).findFirst().orElseThrow(); + assertTrue(readOnlyJumperOpenPageAction.getIsOpenPageAction()); + assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); + + Action readOnlyJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::Refresh")).findFirst().orElseThrow(); + assertTrue(readOnlyJumperRefreshAction.getIsRefreshAction()); + + Action myJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenPage")).findFirst().orElseThrow(); + assertTrue(myJumperOpenPageAction.getIsOpenPageAction()); + assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); + + Action myJumperOpenFormAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenForm")).findFirst().orElseThrow(); + assertTrue(myJumperOpenFormAction.getIsOpenFormAction()); + assertEquals(myJumperCreatePageDefinition, myJumperOpenFormAction.getTargetPageDefinition()); + + Action myJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumperRefreshAction.getIsRefreshAction()); + + Action myJumperRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::RowDelete")).findFirst().orElseThrow(); + assertTrue(myJumperRowDeleteAction.getIsRowDeleteAction()); + + Action myJumperOpenSetSelectorAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenSetSelector")).findFirst().orElseThrow(); + assertTrue(myJumperOpenSetSelectorAction.isOpenSetSelectorAction()); + assertEquals(myJumperSetSelectorPageDefinition, myJumperOpenSetSelectorAction.getTargetPageDefinition()); + + Action myJumperUnsetAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::Unset")).findFirst().orElseThrow(); + assertTrue(myJumperUnsetAction.getIsUnsetAction()); + + Action myJumpersOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenPage")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenPageAction.getIsOpenPageAction()); + assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); + + Action myJumpersFilterAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); + assertTrue(myJumpersFilterAction.getIsFilterAction()); + + Action myJumpersRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumpersRefreshAction.getIsRefreshAction()); + + Action myJumpersOpenCreateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenCreateAction.isOpenCreateFormAction()); + assertEquals(myJumpersCreatePageDefinition, myJumpersOpenCreateAction.getTargetPageDefinition()); + + Action myJumpersRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); + assertTrue(myJumpersRowDeleteAction.getIsRowDeleteAction()); + + Action myJumpersClearAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Clear")).findFirst().orElseThrow(); + assertTrue(myJumpersClearAction.getIsClearAction()); + + Action myJumpersBulkRemoveAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::BulkRemove")).findFirst().orElseThrow(); + assertTrue(myJumpersBulkRemoveAction.getIsBulkRemoveAction()); + + Action myJumpersOpenAddSelectorAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenAddSelectorAction.isOpenAddSelectorAction()); + assertEquals(myJumpersAddSelectorPageDefinition, myJumpersOpenAddSelectorAction.getTargetPageDefinition()); + + // - link readOnlyJumper + + Link readOnlyJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("readOnlyJumper")).findFirst().orElseThrow(); + assertEquals("theJumper", readOnlyJumper.getDataElement().getName()); + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::OpenSetSelector", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::View", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::Delete", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::Unset", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::Create::Open" + ), readOnlyJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button readOnlyJumperView = readOnlyJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("readOnlyJumper::View")).findFirst().orElseThrow(); + assertTrue(readOnlyJumperView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(readOnlyJumperView, "View", "eye", "contained"); + assertEquals(readOnlyJumperOpenPageAction.getActionDefinition(), readOnlyJumperView.getActionDefinition()); + assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); + + // - Link - myJumper + + Link myJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("myJumper")).findFirst().orElseThrow(); + assertEquals("theJumper", myJumper.getDataElement().getName()); + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::Create::Open", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::View", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::OpenSetSelector", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::Unset", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::Delete" + ), myJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumperCreateOpen = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Create::Open")).findFirst().orElseThrow(); + assertTrue(myJumperCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); + assertButtonVisuals(myJumperCreateOpen, "Create", "note-add", "contained"); + assertEquals(myJumperOpenFormAction.getActionDefinition(), myJumperCreateOpen.getActionDefinition()); + + Button myJumperView = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::View")).findFirst().orElseThrow(); + assertTrue(myJumperView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(myJumperView, "View", "eye", "contained"); + assertEquals(myJumperOpenPageAction.getActionDefinition(), myJumperView.getActionDefinition()); + assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); + + Button myJumperDelete = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Delete")).findFirst().orElseThrow(); + assertTrue(myJumperDelete.getActionDefinition().getIsRowDeleteAction()); + assertButtonVisuals(myJumperDelete, "Delete", "delete_forever", "contained"); + assertEquals(myJumperRowDeleteAction.getActionDefinition(), myJumperDelete.getActionDefinition()); + + Button myJumperOpenSetSelector = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::OpenSetSelector")).findFirst().orElseThrow(); + assertTrue(myJumperOpenSetSelector.getActionDefinition().getIsOpenSelectorAction()); + assertButtonVisuals(myJumperOpenSetSelector, "Set", "link", "contained"); + assertEquals(myJumperOpenSetSelectorAction.getActionDefinition(), myJumperOpenSetSelector.getActionDefinition()); + + Button myJumperUnset = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Unset")).findFirst().orElseThrow(); + assertTrue(myJumperUnset.getActionDefinition().getIsUnsetAction()); + assertButtonVisuals(myJumperUnset, "Unset", "link-off", "contained"); + assertEquals(myJumperUnsetAction.getActionDefinition(), myJumperUnset.getActionDefinition()); + + // - Table - myJumpers + + Table myJumpers = (Table) pageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumpers")).findFirst().orElseThrow(); + assertEquals("theJumpersCollection", myJumpers.getDataElement().getName()); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::Clear", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::BulkRemove", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::Filter", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::Refresh", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::OpenAddSelector", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::OpenCreate" + ), myJumpers.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumpersFilter = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); + assertTrue(myJumpersFilter.getActionDefinition().getIsFilterAction()); + assertButtonVisuals(myJumpersFilter, "Filter", "filter", "text"); + assertEquals(myJumpersFilterAction.getActionDefinition(), myJumpersFilter.getActionDefinition()); + + Button myJumpersRefresh = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumpersRefresh.getActionDefinition().getIsRefreshAction()); + assertButtonVisuals(myJumpersRefresh, "Refresh", "refresh", "text"); + assertEquals(myJumpersRefreshAction.getActionDefinition(), myJumpersRefresh.getActionDefinition()); + + Button myJumpersOpenCreate = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenCreate.getActionDefinition().getIsOpenCreateFormAction()); + assertButtonVisuals(myJumpersOpenCreate, "Create", "file-document-plus", "text"); + assertEquals(myJumpersOpenCreateAction.getActionDefinition(), myJumpersOpenCreate.getActionDefinition()); + + Button myJumpersClear = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Clear")).findFirst().orElseThrow(); + assertTrue(myJumpersClear.getActionDefinition().getIsClearAction()); + assertButtonVisuals(myJumpersClear, "Clear", "link-off", "text"); + assertEquals(myJumpersClearAction.getActionDefinition(), myJumpersClear.getActionDefinition()); + + Button myJumpersBulkRemove = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::BulkRemove")).findFirst().orElseThrow(); + assertTrue(myJumpersBulkRemove.getActionDefinition().getIsBulkRemoveAction()); + assertButtonVisuals(myJumpersBulkRemove, "Remove", "link-off", "text"); + assertEquals(myJumpersBulkRemoveAction.getActionDefinition(), myJumpersBulkRemove.getActionDefinition()); + + Button myJumpersOpenAddSelector = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenAddSelector.getActionDefinition().getIsOpenAddSelectorAction()); + assertButtonVisuals(myJumpersOpenAddSelector, "Add", "attachment-plus", "text"); + assertEquals(myJumpersOpenAddSelectorAction.getActionDefinition(), myJumpersOpenAddSelector.getActionDefinition()); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpersInlineViewTableRowButtonGroup::myJumpers::View", + "NavigationActor::SingleRelationViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpersInlineViewTableRowButtonGroup::myJumpers::RowDelete" + ), myJumpers.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumpersView = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::View")).findFirst().orElseThrow(); + assertTrue(myJumpersView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(myJumpersView, "View", "visibility", "contained"); + assertEquals(myJumpersOpenPageAction.getActionDefinition(), myJumpersView.getActionDefinition()); + assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); + + Button myJumpersRowDelete = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); + assertTrue(myJumpersRowDelete.getActionDefinition().getIsRowDeleteAction()); + assertButtonVisuals(myJumpersRowDelete, "Delete", "delete_forever", "contained"); + assertEquals(myJumpersRowDeleteAction.getActionDefinition(), myJumpersRowDelete.getActionDefinition()); + + // add selector - myJumpers + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Add", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Range", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Back", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Filter" + ), myJumpersAddSelectorPageDefinition.getActions().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Action myJumpersAddSelectorAddAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Add")).findFirst().orElseThrow(); + assertTrue(myJumpersAddSelectorAddAction.getActionDefinition().getIsAddAction()); + + Action myJumpersAddSelectorFilterAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Filter")).findFirst().orElseThrow(); + assertTrue(myJumpersAddSelectorFilterAction.getActionDefinition().getIsFilterAction()); + + Action myJumpersAddSelectorrangeAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Range")).findFirst().orElseThrow(); + assertTrue(myJumpersAddSelectorrangeAction.getActionDefinition().getIsSelectorRangeAction()); + + Action myJumpersAddSelectorBackAction = myJumpersAddSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Back")).findFirst().orElseThrow(); + assertTrue(myJumpersAddSelectorBackAction.getActionDefinition().getIsBackAction()); + + Table myJumpersAddSelector = (Table) myJumpersAddSelectorPageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumpers::Add::Selector")).findFirst().orElseThrow(); + assertEquals("SingleRelationViewCRUD::JumperTransfer", myJumpersAddSelector.getDataElement().getName()); + assertTrue(myJumpersAddSelector.isAllowSelectMultiple()); + assertTrue(myJumpersAddSelector.isIsRelationSelectorTable()); + assertTrue(myJumpersAddSelector.isIsSelectorTable()); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::PageContainer::myJumpers::myJumpers::Add::Selector::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorTableActions::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Refresh", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::PageContainer::myJumpers::myJumpers::Add::Selector::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelectorTableActions::SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Filter" + ), myJumpersAddSelector.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumpersAddSelectorFilter = myJumpersAddSelector.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumpers::AddSelector::Table::Filter")).findFirst().orElseThrow(); + assertTrue(myJumpersAddSelectorFilter.getActionDefinition().getIsFilterAction()); + assertButtonVisuals(myJumpersAddSelectorFilter, "Set Filters", "filter", "text"); + assertEquals(myJumpersAddSelectorFilterAction.getActionDefinition(), myJumpersAddSelectorFilter.getActionDefinition()); + + // set selector - myJumper + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Filter", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Back", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Set", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorPage::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Range" + ), myJumperSetSelectorPageDefinition.getActions().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Action myJumperSetSelectorFilterAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Filter")).findFirst().orElseThrow(); + assertTrue(myJumperSetSelectorFilterAction.getActionDefinition().getIsFilterAction()); + + Action myJumperSetSelectorrangeAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Range")).findFirst().orElseThrow(); + assertTrue(myJumperSetSelectorrangeAction.getActionDefinition().getIsSelectorRangeAction()); + + Action myJumperSetSelectorSetAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Set")).findFirst().orElseThrow(); + assertTrue(myJumperSetSelectorSetAction.getActionDefinition().getIsSetAction()); + + Action myJumperSetSelectorBackAction = myJumperSetSelectorPageDefinition.getActions().stream().filter(a -> a.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Back")).findFirst().orElseThrow(); + assertTrue(myJumperSetSelectorBackAction.getActionDefinition().getIsBackAction()); + + Table myJumperSetSelector = (Table) myJumperSetSelectorPageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumper::Set::Selector")).findFirst().orElseThrow(); + assertEquals("SingleRelationViewCRUD::JumperTransfer", myJumpersAddSelector.getDataElement().getName()); + assertTrue(myJumpersAddSelector.isAllowSelectMultiple()); + assertTrue(myJumpersAddSelector.isIsRelationSelectorTable()); + assertTrue(myJumpersAddSelector.isIsSelectorTable()); + + assertEquals(Set.of( + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::PageContainer::myJumper::myJumper::Set::Selector::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorTableActions::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Refresh", + "NavigationActor::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::PageContainer::myJumper::myJumper::Set::Selector::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelectorTableActions::SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Filter" + ), myJumperSetSelector.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumperSetSelectorFilter = myJumperSetSelector.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Filter")).findFirst().orElseThrow(); + assertTrue(myJumperSetSelectorFilter.getActionDefinition().getIsFilterAction()); + assertButtonVisuals(myJumperSetSelectorFilter, "Set Filters", "filter", "text"); + assertEquals(myJumperSetSelectorFilterAction.getActionDefinition(), myJumperSetSelectorFilter.getActionDefinition()); + + Button myJumperSetSelectorRefresh = myJumperSetSelector.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("SingleRelationViewCRUD::RelatedView::g1::myJumper::SetSelector::Table::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumperSetSelectorRefresh.getActionDefinition().getIsSelectorRangeAction()); + assertButtonVisuals(myJumperSetSelectorRefresh, "Refresh", "refresh", "text"); + assertEquals(myJumperSetSelectorrangeAction.getActionDefinition(), myJumperSetSelectorRefresh.getActionDefinition()); + } + + @Test + void testRelatedRowDetailViewCRUD() throws Exception { + jslModel = JslParser.getModelFromStrings("RelatedRowDetailViewCRUD", List.of(createModelString("RelatedRowDetailViewCRUD"))); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + Application application = apps.get(0); + List pages = application.getPages(); + + PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::UserView::level::related::ViewPage")).findFirst().orElseThrow(); + PageContainer pageContainer = pageDefinition.getContainer(); + + PageDefinition readOnlyJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::g1::readOnlyJumper::ViewPage")).findFirst().orElseThrow(); + + PageDefinition myJumperViewPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::g1::myJumper::ViewPage")).findFirst().orElseThrow(); + PageDefinition myJumperCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::g1::myJumper::FormPage")).findFirst().orElseThrow(); + PageDefinition myJumpersCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::g1::myJumpers::FormPage")).findFirst().orElseThrow(); + PageDefinition myJumpersAddSelectorPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::g1::myJumpers::AddSelectorPage")).findFirst().orElseThrow(); + + PageDefinition jumperRowDetailViewPageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedRowDetailViewCRUD::RelatedView::g1::myJumpers::ViewPage")).findFirst().orElseThrow(); + + assertEquals(24, pageDefinition.getActions().size()); + assertEquals(2, pageContainer.getLinks().size()); + assertEquals(1, pageContainer.getTables().size()); + + assertEquals(Set.of( + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumper::OpenForm", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumper::OpenPage", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumper::OpenSetSelector", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumper::Refresh", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumper::RowDelete", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumper::Unset", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::BulkRemove", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::Clear", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::Filter", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::OpenAddSelector", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::OpenCreate", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::OpenPage", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::Refresh", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::myJumpers::RowDelete", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenForm", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenPage", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::OpenSetSelector", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::Refresh", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::RowDelete", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::readOnlyJumper::Unset", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::related::Back", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::related::Delete", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::related::Refresh", + "NavigationActor::RelatedRowDetailViewCRUD::UserView::level::related::ViewPage::related::Update" + ), pageDefinition.getActions().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Action BackAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Back")).findFirst().orElseThrow(); + assertTrue(BackAction.getIsBackAction()); + + Action refreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("related::Refresh")).findFirst().orElseThrow(); + assertTrue(refreshAction.getIsRefreshAction()); + + Action readOnlyJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::OpenPage")).findFirst().orElseThrow(); + assertTrue(readOnlyJumperOpenPageAction.getIsOpenPageAction()); + assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); + + Action readOnlyJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("readOnlyJumper::Refresh")).findFirst().orElseThrow(); + assertTrue(readOnlyJumperRefreshAction.getIsRefreshAction()); + + Action myJumperOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenPage")).findFirst().orElseThrow(); + assertTrue(myJumperOpenPageAction.getIsOpenPageAction()); + assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); + + Action myJumperOpenFormAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::OpenForm")).findFirst().orElseThrow(); + assertTrue(myJumperOpenFormAction.getIsOpenFormAction()); + assertEquals(myJumperCreatePageDefinition, myJumperOpenFormAction.getTargetPageDefinition()); + + Action myJumperRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumperRefreshAction.getIsRefreshAction()); + + Action myJumperRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumper::RowDelete")).findFirst().orElseThrow(); + assertTrue(myJumperRowDeleteAction.getIsRowDeleteAction()); + + Action myJumpersOpenPageAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenPage")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenPageAction.getIsOpenPageAction()); + assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); + + Action myJumpersFilterAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); + assertTrue(myJumpersFilterAction.getIsFilterAction()); + + Action myJumpersRefreshAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumpersRefreshAction.getIsRefreshAction()); + + Action myJumpersOpenCreateAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenCreateAction.getIsOpenFormAction()); + assertEquals(myJumpersCreatePageDefinition, myJumpersOpenCreateAction.getTargetPageDefinition()); + + Action myJumpersRowDeleteAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); + assertTrue(myJumpersRowDeleteAction.getIsRowDeleteAction()); + + Action myJumpersOpenAddSelectorAction = pageDefinition.getActions().stream().filter(a -> a.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenAddSelectorAction.isOpenAddSelectorAction()); + assertEquals(myJumpersAddSelectorPageDefinition, myJumpersOpenAddSelectorAction.getTargetPageDefinition()); + + // - link readOnlyJumper + + Link readOnlyJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("readOnlyJumper")).findFirst().orElseThrow(); + assertEquals("theJumper", readOnlyJumper.getDataElement().getName()); + assertEquals(Set.of( + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::Delete", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::Create::Open", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::OpenSetSelector", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::Unset", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::readOnlyJumper::readOnlyJumper::Actions::readOnlyJumper::View" + ), readOnlyJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button readOnlyJumperView = readOnlyJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("readOnlyJumper::View")).findFirst().orElseThrow(); + assertTrue(readOnlyJumperView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(readOnlyJumperView, "View", "eye", "contained"); + assertEquals(readOnlyJumperOpenPageAction.getActionDefinition(), readOnlyJumperView.getActionDefinition()); + assertEquals(readOnlyJumperViewPageDefinition, readOnlyJumperOpenPageAction.getTargetPageDefinition()); + + // - Link - myJumper + + Link myJumper = (Link) pageContainer.getLinks().stream().filter(l -> ((Link) l).getName().equals("myJumper")).findFirst().orElseThrow(); + assertEquals("theJumper", myJumper.getDataElement().getName()); + assertEquals(Set.of( + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::Delete", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::Create::Open", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::OpenSetSelector", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::Unset", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumper::myJumper::Actions::myJumper::View" + ), myJumper.getActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumperCreateOpen = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Create::Open")).findFirst().orElseThrow(); + assertTrue(myJumperCreateOpen.getActionDefinition().getIsOpenCreateFormAction()); + assertButtonVisuals(myJumperCreateOpen, "Create", "note-add", "contained"); + assertEquals(myJumperOpenFormAction.getActionDefinition(), myJumperCreateOpen.getActionDefinition()); + + Button myJumperView = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::View")).findFirst().orElseThrow(); + assertTrue(myJumperView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(myJumperView, "View", "eye", "contained"); + assertEquals(myJumperOpenPageAction.getActionDefinition(), myJumperView.getActionDefinition()); + assertEquals(myJumperViewPageDefinition, myJumperOpenPageAction.getTargetPageDefinition()); + + Button myJumperDelete = myJumper.getActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumper::Delete")).findFirst().orElseThrow(); + assertTrue(myJumperDelete.getActionDefinition().getIsRowDeleteAction()); + assertButtonVisuals(myJumperDelete, "Delete", "delete_forever", "contained"); + assertEquals(myJumperRowDeleteAction.getActionDefinition(), myJumperDelete.getActionDefinition()); + + // - Table - myJumpers + + Table myJumpers = (Table) pageContainer.getTables().stream().filter(t -> ((Table) t).getName().equals("myJumpers")).findFirst().orElseThrow(); + assertEquals("theJumpersCollection", myJumpers.getDataElement().getName()); + + assertEquals(Set.of( + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::Filter", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::Refresh", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::Clear", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::BulkRemove", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::OpenAddSelector", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpers::InlineViewTableButtonGroup::myJumpers::OpenCreate" + ), myJumpers.getTableActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumpersFilter = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Filter")).findFirst().orElseThrow(); + assertTrue(myJumpersFilter.getActionDefinition().getIsFilterAction()); + assertButtonVisuals(myJumpersFilter, "Filter", "filter", "text"); + assertEquals(myJumpersFilterAction.getActionDefinition(), myJumpersFilter.getActionDefinition()); + + Button myJumpersRefresh = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Refresh")).findFirst().orElseThrow(); + assertTrue(myJumpersRefresh.getActionDefinition().getIsRefreshAction()); + assertButtonVisuals(myJumpersRefresh, "Refresh", "refresh", "text"); + assertEquals(myJumpersRefreshAction.getActionDefinition(), myJumpersRefresh.getActionDefinition()); + + Button myJumpersOpenCreate = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenCreate")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenCreate.getActionDefinition().getIsOpenCreateFormAction()); + assertButtonVisuals(myJumpersOpenCreate, "Create", "file-document-plus", "text"); + assertEquals(myJumpersOpenCreateAction.getActionDefinition(), myJumpersOpenCreate.getActionDefinition()); + + Button myJumpersOpenAddSelector = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::OpenAddSelector")).findFirst().orElseThrow(); + assertTrue(myJumpersOpenAddSelector.getActionDefinition().getIsOpenAddSelectorAction()); + assertButtonVisuals(myJumpersOpenAddSelector, "Add", "attachment-plus", "text"); + assertEquals(myJumpersOpenAddSelectorAction.getActionDefinition(), myJumpersOpenAddSelector.getActionDefinition()); + + Button myJumpersClear = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::Clear")).findFirst().orElseThrow(); + assertTrue(myJumpersClear.getActionDefinition().getIsClearAction()); + assertButtonVisuals(myJumpersClear, "Clear", "link-off", "text"); + assertEquals(myJumpersClear.getActionDefinition(), myJumpersClear.getActionDefinition()); + + Button myJumpersBulkRemove = myJumpers.getTableActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::BulkRemove")).findFirst().orElseThrow(); + assertTrue(myJumpersBulkRemove.getActionDefinition().getIsBulkRemoveAction()); + assertButtonVisuals(myJumpersBulkRemove, "Remove", "link-off", "text"); + assertEquals(myJumpersBulkRemove.getActionDefinition(), myJumpersBulkRemove.getActionDefinition()); + + assertEquals(Set.of( + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpersInlineViewTableRowButtonGroup::myJumpers::RowDelete", + "NavigationActor::RelatedRowDetailViewCRUD::RelatedView::View::PageContainer::RelatedView::g1::myJumpers::myJumpersInlineViewTableRowButtonGroup::myJumpers::View" + ), myJumpers.getRowActionButtonGroup().getButtons().stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + + Button myJumpersView = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::View")).findFirst().orElseThrow(); + assertTrue(myJumpersView.getActionDefinition().getIsOpenPageAction()); + assertButtonVisuals(myJumpersView, "View", "visibility", "contained"); + assertEquals(myJumpersOpenPageAction.getActionDefinition(), myJumpersView.getActionDefinition()); + assertEquals(jumperRowDetailViewPageDefinition, myJumpersOpenPageAction.getTargetPageDefinition()); + + Button myJumpersRowDelete = myJumpers.getRowActionButtonGroup().getButtons().stream().filter(b -> b.getName().equals("myJumpers::RowDelete")).findFirst().orElseThrow(); + assertTrue(myJumpersRowDelete.getActionDefinition().getIsRowDeleteAction()); + assertButtonVisuals(myJumpersRowDelete, "Delete", "delete_forever", "contained"); + assertEquals(myJumpersRowDeleteAction.getActionDefinition(), myJumpersRowDelete.getActionDefinition()); + } + + @Test + void testRelatedFormCRUD() throws Exception { + jslModel = JslParser.getModelFromStrings("RelatedFormCRUD", List.of(createModelString("RelatedFormCRUD"))); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + Application application = apps.get(0); + List pages = application.getPages(); + + PageDefinition pageDefinition = pages.stream().filter(p -> p.getName().equals("RelatedFormCRUD::UserView::level::related::FormPage")).findFirst().orElseThrow(); + PageContainer pageContainer = pageDefinition.getContainer(); + List