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 0d757ec9..07f9a26f 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 @@ -132,3 +132,13 @@ operation JSL!Modifiable getVAlign(): JSL!Modifier { operation JSL!Modifiable getLines(): JSL!Modifier { return (self.modifiers.selectOne(m | m.type == "lines")); } + +@cached +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")); +} 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 index 4bfdd268..3283d916 100644 --- 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 @@ -84,6 +84,13 @@ rule 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("ViewLinkPageDefinitionBackAction")); 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 4c5dfac4..af99281e 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 @@ -50,6 +50,13 @@ rule RowLinkPageDefinition if (table.isDeleteAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "RowLinkPageDefinition")); } + if (table.isAddReferenceAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "RowLinkPageDefinition")); + } + if (table.isRemoveReferenceAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "RowLinkPageDefinition")); + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "RowLinkPageDefinition")); + } if (detailLink.isDefined()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "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 b03779e4..5deae1d6 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 @@ -53,6 +53,13 @@ rule ViewLinkPageDefinition if (table.isDeleteAllowed()) { t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "ViewLinkPageDefinition")); } + if (table.isAddReferenceAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenAddSelectorAction", "ViewLinkPageDefinition")); + } + if (table.isRemoveReferenceAllowed()) { + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationClearAction", "ViewLinkPageDefinition")); + t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationBulkRemoveAction", "ViewLinkPageDefinition")); + } } t.actions.add(s.equivalent("ViewLinkPageDefinitionBackAction")); @@ -428,7 +435,7 @@ rule ViewLinkDeclarationOpenCreateFormActionDefinition transform s: JSL!ViewLinkDeclaration to t: UI!ui::OpenCreateFormActionDefinition { t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenCreateFormActionDefinition"); - t.name = s.name + "::Create"; + t.name = s.name + "::OpenCreate"; t.isContainedRelationAction = true; var targetCreateEvent = s.referenceType.getCreateEventDeclaration(); 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 fc9f9fd5..baf68d12 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 @@ -168,21 +168,6 @@ rule TablePrimitiveColumn t.icon = s.equivalent("ColumnIcon"); } t.width = s.getWidth().isDefined() ? s.getWidth().value : "120"; - - /* - if (s.customImplementation.isDefined()) { - t.customImplementation = s.customImplementation; - } - if (s.sort.isDefined()) { - t.sort = s.getUiSort(); - } - if (s.sortPrecedence.isDefined()) { - t.sortPrecedence = s.sortPrecedence; - } - if (s.formatValue.isDefined()) { - t.formatValue = s.formatValue; - } - */ t.attributeType = s.getTransferFieldDeclarationEquivalent(); log.debug("TablePrimitiveColumn: " + t.name); @@ -302,7 +287,7 @@ rule InlineViewTableButtonGroup transform s: JSL!ViewTableDeclaration to t: UI!ui::ButtonGroup { t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/InlineViewTableButtonGroup"); - t.name = s.name + "InlineViewTableButtonGroup"; + t.name = s.name + "::InlineViewTableButtonGroup"; t.label = "Actions"; // TODO add buttons @@ -316,6 +301,13 @@ rule InlineViewTableButtonGroup if (s.isCreateAllowed()) { t.buttons.add(s.equivalent("ViewTableDeclarationOpenCreateButton")); } + if (s.isAddReferenceAllowed()) { + t.buttons.add(s.equivalent("ViewTableDeclarationOpenAddSelectorButton")); + } + if (s.isRemoveReferenceAllowed()) { + t.buttons.add(s.equivalent("ViewTableDeclarationClearButton")); + t.buttons.add(s.equivalent("ViewTableDeclarationBulkRemoveButton")); + } log.debug("InlineViewTableButtonGroup: " + t.name); } @@ -586,3 +578,464 @@ rule ViewTableDeclarationRowDeleteAction log.debug("ViewTableDeclarationRowDeleteAction: " + t.name); } + +@lazy +rule ViewTableDeclarationOpenAddSelectorButton + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorButton"); + t.name = s.name + "::OpenAddSelector"; + t.icon = s.equivalent("ViewTableDeclarationOpenAddSelectorButtonIcon"); + t.label = "Add"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("ViewTableDeclarationOpenAddSelectorActionDefinition"); + + log.debug("ViewTableDeclarationOpenAddSelectorButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationOpenAddSelectorButtonIcon + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Icon { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorButtonIcon"); + t.name = s.name + "OpenAddSelectorIcon"; + t.iconName = "attachment-plus"; + + log.debug("ViewTableDeclarationOpenAddSelectorButtonIcon: " + t.name); +} + +@lazy +rule ViewTableDeclarationOpenAddSelectorActionDefinition + transform s: JSL!ViewTableDeclaration + to t: UI!ui::OpenAddSelectorActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationOpenAddSelectorActionDefinition"); + t.name = s.name + "::OpenAddSelector"; + t.isContainedRelationAction = true; + t.selectorFor = s.equivalent("ViewTableDeclarationAddSelectorActionDefinition"); + + log.debug("ViewTableDeclarationOpenAddSelectorActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationOpenAddSelectorAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveButton"); + t.name = s.name + "::BulkRemove"; + t.icon = s.equivalent("ViewTableDeclarationBulkRemoveButtonIcon"); + t.label = "Remove"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("ViewTableDeclarationBulkRemoveActionDefinition"); + + log.debug("ViewTableDeclarationBulkRemoveButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationBulkRemoveButtonIcon + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Icon { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveButtonIcon"); + t.name = s.name + "RemoveIcon"; + t.iconName = "link-off"; + + log.debug("ViewTableDeclarationBulkRemoveButtonIcon: " + t.name); +} + +@lazy +rule ViewTableDeclarationBulkRemoveActionDefinition + transform s: JSL!ViewTableDeclaration + to t: UI!ui::BulkRemoveActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveActionDefinition"); + t.name = s.name + "::BulkRemove"; + t.targetType = s.referenceType.equivalent("ClassType"); + t.isContainedRelationAction = true; + t.isBulk = true; + + log.debug("ViewTableDeclarationBulkRemoveActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationBulkRemoveAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationBulkRemoveAction"); + t.name = s.name + "::BulkRemove"; + t.actionDefinition = s.equivalent("ViewTableDeclarationBulkRemoveActionDefinition"); + + t.ownerDataElement = s.equivalent("RelationType"); + t.targetDataElement = s.equivalent("RelationType"); + + log.debug("ViewTableDeclarationBulkRemoveAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationClearButton + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearButton"); + t.name = s.name + "::Clear"; + t.icon = s.equivalent("ViewTableDeclarationClearButtonIcon"); + t.label = "Clear"; + t.buttonStyle = "text"; + t.actionDefinition = s.equivalent("ViewTableDeclarationClearActionDefinition"); + + log.debug("ViewTableDeclarationClearButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationClearButtonIcon + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Icon { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearButtonIcon"); + t.name = s.name + "ClearIcon"; + t.iconName = "link-off"; + + log.debug("ViewTableDeclarationClearButtonIcon: " + t.name); +} + +@lazy +rule ViewTableDeclarationClearActionDefinition + transform s: JSL!ViewTableDeclaration + to t: UI!ui::ClearActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearActionDefinition"); + t.name = s.name + "::Clear"; + t.isContainedRelationAction = true; + + log.debug("ViewTableDeclarationClearActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationClearAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationClearAction"); + t.name = s.name + "::Clear"; + t.actionDefinition = s.equivalent("ViewTableDeclarationClearActionDefinition"); + + t.ownerDataElement = s.equivalent("RelationType"); + t.targetDataElement = s.equivalent("RelationType"); + + log.debug("ViewTableDeclarationClearAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorPageDefinition + transform s: JSL!ViewTableDeclaration + to t: UI!ui::PageDefinition { + + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageDefinition"); + + t.name = s.getFqName() + "::AddSelector::PageDefinition"; + + t.container = s.equivalent("ViewTableDeclarationAddSelectorPageContainer"); + t.dataElement = s.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")); + + actorDeclaration.equivalent("Application").pages.add(t); + + log.debug("ViewTableDeclarationAddSelectorPageDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorAddAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorAddAction"); + t.name = s.getFqName() + "::AddSelector::Add"; + t.ownerDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableAddSelectorAddActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorAddAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorBackAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorBackAction"); + t.name = s.getFqName() + "::AddSelector::Back"; + t.ownerDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableBackActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorBackAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableFilterAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableFilterAction"); + t.name = s.getFqName() + "::AddSelector::Table::Filter"; + t.ownerDataElement = s.equivalent("RelationType"); + t.targetDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableFilterAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableRangeAction + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Action { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableRangeAction"); + t.name = s.getFqName() + "::AddSelector::Table::Range"; + t.ownerDataElement = s.equivalent("RelationType"); + t.targetDataElement = s.equivalent("RelationType"); + t.actionDefinition = s.equivalent("ViewTableDeclarationAddSelectorTableRangeActionDefinition"); + + log.debug("ViewTableDeclarationAddSelectorTableRangeAction: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorPageContainer + transform s: JSL!ViewTableDeclaration + to t: UI!ui::PageContainer { + + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorPageContainer"); + + t.name = s.getFqName() + "::AddSelector::PageContainer"; + var label = s.getLabelModifier(); + if (label.isDefined()) { + t.label = label.value.value; + } + 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.equivalent("ClassType"); + t.isSelector = true; + t.isRelationSelector = true; + + actorDeclaration.equivalent("Application").pageContainers.add(t); + + log.debug("ViewTableDeclarationAddSelectorPageContainer: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableRangeActionDefinition + transform s: JSL!ViewTableDeclaration + to t: UI!ui::SelectorRangeActionDefinition { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::ButtonGroup { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::BackActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableBackActionDefinition"); + t.name = s.getFqName() + "::Back"; + log.debug("ViewTableDeclarationAddSelectorTableBackActionDefinition: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableAddSelectorAddButton + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::AddActionDefinition { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::Flex { + t.~pos = 0; + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::Frame { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableAddSelectorFrame"); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableTable + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Table { + var id = actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTable"; + t.setId(id); + t.col = 12d; + if (s.getLabelModifier().isDefined()) { + t.label = s.getLabelModifier().value.value; + } + t.isSelectorTable = true; + t.isRelationSelectorTable = true; + t.allowSelectMultiple = true; + t.name = s.name + "::Add::Selector"; + t.relationName = s.name; + t.dataElement = s.referenceType.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.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("ViewTableDeclarationAddSelectorTableTable: " + t.name); +} + +@lazy +rule ViewTableDeclarationAddSelectorTableTableButtonGroup + transform s: JSL!ViewTableDeclaration + to t: UI!ui::ButtonGroup { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.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!ViewTableDeclaration + to t: UI!ui::FilterActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationAddSelectorTableTableFilterActionDefinition"); + t.name = s.getFqName() + "::Table::Filter"; + log.debug("ViewTableDeclarationAddSelectorTableTableFilterActionDefinition: " + t.name); +} + +@lazy +rule TransferObjectTableAddSelectorTableRefreshButton + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.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/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 2abaca0b..eaf8c847 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 @@ -159,11 +159,11 @@ void testSummaryCRUD() throws Exception { assertEquals(11, relationTypes.size()); assertEquals(8, classTypes.size()); - assertEquals(8, pageContainers.size()); - assertEquals(10, pages.size()); + assertEquals(9, pageContainers.size()); + assertEquals(11, pages.size()); assertEquals(3, links.size()); - assertEquals(2, tables.size()); - assertEquals(52, allActions.size()); + assertEquals(3, tables.size()); + assertEquals(62, allActions.size()); PageDefinition actorDashboardPage = pages.stream().filter(p -> p.getName().equals("SummaryCRUD::NavigationActor::DashboardPage")).findFirst().orElseThrow(); @@ -200,7 +200,8 @@ void testSummaryCRUD() throws Exception { "SummaryCRUD::RelatedForm::PageContainer", "SummaryCRUD::RelatedRow::PageContainer", "SummaryCRUD::JumperRow::PageContainer", - "SummaryCRUD::JumperForm::PageContainer" + "SummaryCRUD::JumperForm::PageContainer", + "SummaryCRUD::RelatedView::myJumpers::AddSelector::PageContainer" ), pageContainers.stream().map(NamedElement::getName).collect(Collectors.toSet())); assertEquals(Set.of( @@ -213,7 +214,8 @@ void testSummaryCRUD() throws Exception { "SummaryCRUD::RelatedView::myJumper::Create::PageDefinition", "SummaryCRUD::RelatedView::myJumpers::Create::PageDefinition", "SummaryCRUD::JumperRow::jumperRowDetail::View::PageDefinition", - "SummaryCRUD::RelatedRow::detail::View::PageDefinition" + "SummaryCRUD::RelatedRow::detail::View::PageDefinition", + "SummaryCRUD::RelatedView::myJumpers::AddSelector::PageDefinition" ), pages.stream().map(NamedElement::getName).collect(Collectors.toSet())); assertEquals(Set.of( @@ -224,7 +226,8 @@ void testSummaryCRUD() throws Exception { assertEquals(Set.of( "myJumpers", - "relatedCollection" + "relatedCollection", + "myJumpers::Add::Selector" ), tables.stream().map(NamedElement::getName).collect(Collectors.toSet())); } @@ -371,8 +374,11 @@ void testSingleRelationViewCRUD() throws Exception { PageDefinition myJumperCreatePageDefinition = pages.stream().filter(p -> p.getName().equals("SingleRelationViewCRUD::RelatedView::myJumper::Create::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(); - assertEquals(15, pageDefinition.getActions().size()); + assertEquals(18, pageDefinition.getActions().size()); + assertEquals(4, myJumpersAddSelectorPageDefinition.getActions().size()); assertEquals(2, pageContainer.getLinks().size()); assertEquals(1, pageContainer.getTables().size()); @@ -389,8 +395,11 @@ void testSingleRelationViewCRUD() throws Exception { "myJumper::RowDelete", "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())); @@ -444,6 +453,16 @@ void testSingleRelationViewCRUD() throws Exception { 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(); @@ -492,7 +511,10 @@ void testSingleRelationViewCRUD() throws Exception { assertEquals(Set.of( "myJumpers::Filter", "myJumpers::Refresh", - "myJumpers::OpenCreate" + "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(); @@ -510,6 +532,21 @@ void testSingleRelationViewCRUD() throws Exception { 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" @@ -526,6 +563,42 @@ void testSingleRelationViewCRUD() throws Exception { 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()); } @Test @@ -547,10 +620,11 @@ void testRelatedRowDetailViewCRUD() throws Exception { 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(13, pageDefinition.getActions().size()); + assertEquals(16, pageDefinition.getActions().size()); assertEquals(2, pageContainer.getLinks().size()); assertEquals(1, pageContainer.getTables().size()); @@ -567,7 +641,10 @@ void testRelatedRowDetailViewCRUD() throws Exception { "myJumpers::OpenCreate", "myJumpers::Filter", "myJumpers::Refresh", - "myJumpers::RowDelete" + "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(); @@ -614,6 +691,10 @@ void testRelatedRowDetailViewCRUD() throws Exception { 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(); @@ -662,7 +743,10 @@ void testRelatedRowDetailViewCRUD() throws Exception { assertEquals(Set.of( "myJumpers::Filter", "myJumpers::Refresh", - "myJumpers::OpenCreate" + "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(); @@ -680,6 +764,21 @@ void testRelatedRowDetailViewCRUD() throws Exception { 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" 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 695b4935..e5423859 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 @@ -15,6 +15,8 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.*; @@ -408,7 +410,7 @@ view RelatedView(Related r) { // Tables - assertEquals(1 , tables.size()); + assertEquals(2 , tables.size()); Table table = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); RelationType tableRelation = (RelationType) table.getDataElement(); @@ -420,6 +422,13 @@ view RelatedView(Related r) { assertEquals("relatedCollection", tableRelation.getName()); assertEquals(relatedRowClassType, tableRelation.getTarget()); + Table relatedAddSelector = tables.stream().filter(t -> t.getName().equals("relatedCollection::Add::Selector")).findFirst().orElseThrow(); + assertTrue(relatedAddSelector.getDataElement() instanceof ClassType); + + assertEquals("Related Collection", relatedAddSelector.getLabel()); + assertEquals(12, relatedAddSelector.getCol()); + assertEquals("relatedCollection", relatedAddSelector.getRelationName()); + // Columns List columns = table.getColumns(); @@ -460,6 +469,11 @@ view RelatedView(Related r) { assertEquals(nonDetailLinkRepresentsRelation, nonDetailLinkColumn.getRepresentsRelation()); assertEquals(relatedViewClassType, nonDetailLinkRepresentsRelation.getTarget()); + List relatedAddSelectorColumns = relatedAddSelector.getColumns(); + assertEquals(Set.of("Non Detail Link", "First", "Second"), relatedAddSelectorColumns.stream().map(LabeledElement::getLabel).collect(Collectors.toSet())); + assertEquals(Set.of("_text_nonDetailLink", "first", "second"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getName()).collect(Collectors.toSet())); + assertEquals(Set.of("Numeric", "String"), relatedAddSelectorColumns.stream().map(c -> c.getAttributeType().getDataType().getName()).collect(Collectors.toSet())); + // Filters List filters = table.getFilters(); @@ -478,5 +492,12 @@ view RelatedView(Related r) { assertEquals("Non Detail Link", nonDetailLinkFilter.getLabel()); assertEquals(nonDetailLinkAttribute, nonDetailLinkFilter.getAttributeType()); + + List relatedAddSelectorFilters = relatedAddSelector.getFilters(); + + assertEquals(Set.of("Non Detail Link", "First", "Second"), relatedAddSelectorFilters.stream().map(LabeledElement::getLabel).collect(Collectors.toSet())); + assertEquals(Set.of("_text_nonDetailLink", "first", "second"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getName()).collect(Collectors.toSet())); + assertEquals(Set.of("Numeric", "String"), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().getDataType().getName()).collect(Collectors.toSet())); + assertEquals(Set.of(true), relatedAddSelectorFilters.stream().map(c -> c.getAttributeType().isIsFilterable()).collect(Collectors.toSet())); } }