You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2022/09/01 10:57:14 UTC
[isis] branch ISIS-3197 updated: ISIS-3197: adds support for loading tableDecoration from .layout.xml
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-3197
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/ISIS-3197 by this push:
new 512f739be6 ISIS-3197: adds support for loading tableDecoration from .layout.xml
512f739be6 is described below
commit 512f739be69ee43d745638ac2376c6c3f803da8b
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Sep 1 11:57:06 2022 +0100
ISIS-3197: adds support for loading tableDecoration from .layout.xml
---
.../applib/layout/component/component.xsd | 9 ++++
.../layout/component/CollectionLayoutData.java | 20 +++++++
.../layout/component/DomainObjectLayoutData.java | 18 +++++++
.../applib/layout/component/TableDecoration.java | 31 +++++++++++
...TableDecorationFacetForCollectionLayoutXml.java | 53 +++++++++++++++++++
...bleDecorationFacetForDomainObjectLayoutXml.java | 61 ++++++++++++++++++++++
.../services/grid/GridSystemServiceAbstract.java | 13 +++++
7 files changed, 205 insertions(+)
diff --git a/antora/supplemental-ui/applib/layout/component/component.xsd b/antora/supplemental-ui/applib/layout/component/component.xsd
index fa669c2cc8..306880d918 100644
--- a/antora/supplemental-ui/applib/layout/component/component.xsd
+++ b/antora/supplemental-ui/applib/layout/component/component.xsd
@@ -45,6 +45,7 @@
<xs:attribute name="cssClassFa" type="xs:string"/>
<xs:attribute name="cssClassFaPosition" type="tns:cssClassFaPosition"/>
<xs:attribute name="namedEscaped" type="xs:boolean"/>
+ <xs:attribute name="tableDecoration" type="tns:tableDecoration"/>
</xs:complexType>
<xs:complexType name="action">
@@ -128,6 +129,7 @@
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="namedEscaped" type="xs:boolean"/>
<xs:attribute name="paged" type="xs:int"/>
+ <xs:attribute name="tableDecoration" type="tns:tableDecoration"/>
</xs:complexType>
@@ -199,6 +201,13 @@
</xs:restriction>
</xs:simpleType>
+ <xs:simpleType name="tableDecoration">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="NONE"/>
+ <xs:enumeration value="DATATABLES_NET"/>
+ </xs:restriction>
+ </xs:simpleType>
+
<xs:simpleType name="repainting">
<xs:restriction base="xs:string">
<xs:enumeration value="REPAINT"/>
diff --git a/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java b/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
index 5133b604cb..b1f94df20d 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
@@ -45,7 +45,12 @@ import org.apache.isis.applib.layout.links.Link;
, propOrder = {
"named"
,"describedAs"
+ ,"cssClass"
+ ,"defaultView"
+ ,"hidden"
+ ,"paged"
,"sortedBy"
+ ,"tableDecoration"
, "actions"
, "metadataError"
, "link"
@@ -155,6 +160,8 @@ HasCssClass, HasDescribedAs, HasHidden, HasNamed {
this.named = named;
}
+
+
private Integer paged;
@XmlAttribute(required = false)
@@ -181,6 +188,19 @@ HasCssClass, HasDescribedAs, HasHidden, HasNamed {
+ private TableDecoration tableDecoration;
+
+ @XmlElement(required = false)
+ public TableDecoration getTableDecoration() {
+ return tableDecoration;
+ }
+
+ public void setTableDecoration(final TableDecoration tableDecoration) {
+ this.tableDecoration = tableDecoration;
+ }
+
+
+
private List<ActionLayoutData> actions = new ArrayList<>();
// no wrapper
diff --git a/api/applib/src/main/java/org/apache/isis/applib/layout/component/DomainObjectLayoutData.java b/api/applib/src/main/java/org/apache/isis/applib/layout/component/DomainObjectLayoutData.java
index dfecad3e1f..22a85767d7 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/layout/component/DomainObjectLayoutData.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/layout/component/DomainObjectLayoutData.java
@@ -43,6 +43,10 @@ import org.apache.isis.applib.layout.links.Link;
"named"
, "describedAs"
, "plural"
+ , "cssClass"
+ , "cssClassFa"
+ , "cssClassFaPosition"
+ , "tableDecoration"
, "metadataError"
, "link"
}
@@ -158,6 +162,20 @@ HasBookmarking, HasCssClass, HasCssClassFa, HasDescribedAs, HasNamed {
+ private TableDecoration tableDecoration;
+
+ @XmlElement(required = false)
+ public TableDecoration getTableDecoration() {
+ return tableDecoration;
+ }
+
+ public void setTableDecoration(final TableDecoration tableDecoration) {
+ this.tableDecoration = tableDecoration;
+ }
+
+
+
+
private String metadataError;
diff --git a/api/applib/src/main/java/org/apache/isis/applib/layout/component/TableDecoration.java b/api/applib/src/main/java/org/apache/isis/applib/layout/component/TableDecoration.java
new file mode 100644
index 0000000000..ab7d2c59eb
--- /dev/null
+++ b/api/applib/src/main/java/org/apache/isis/applib/layout/component/TableDecoration.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.component;
+
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @since 1.x {@index}
+ */
+@XmlType(
+ namespace = "http://isis.apache.org/applib/layout/component"
+ )
+public enum TableDecoration {
+ NONE, DATATABLES_NET;
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/tabledec/CollectionLayoutTableDecorationFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/tabledec/CollectionLayoutTableDecorationFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000000..2f3eb20290
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/tabledec/CollectionLayoutTableDecorationFacetForCollectionLayoutXml.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.metamodel.facets.collections.layout.tabledec;
+
+import java.util.Optional;
+
+import org.apache.isis.applib.layout.component.CollectionLayoutData;
+import org.apache.isis.applib.layout.component.TableDecoration;
+import org.apache.isis.core.config.metamodel.facets.CollectionLayoutConfigOptions;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacet;
+
+public class CollectionLayoutTableDecorationFacetForCollectionLayoutXml
+extends CollectionLayoutTableDecorationFacetAbstract {
+
+ public static final Class<CollectionLayoutTableDecorationFacet> type() {
+ return CollectionLayoutTableDecorationFacet.class;
+ }
+
+ public static Optional<CollectionLayoutTableDecorationFacet> create(
+ final CollectionLayoutData collectionLayout,
+ final FacetHolder holder) {
+ if (collectionLayout == null) {
+ return Optional.empty();
+ }
+
+ final TableDecoration tableDecoration = collectionLayout.getTableDecoration();
+ return tableDecoration == TableDecoration.DATATABLES_NET
+ ? Optional.of(new CollectionLayoutTableDecorationFacetForCollectionLayoutXml(holder))
+ : Optional.empty();
+ }
+
+ private CollectionLayoutTableDecorationFacetForCollectionLayoutXml(final FacetHolder holder) {
+ super(CollectionLayoutConfigOptions.TableDecoration.DATATABLES_NET, holder);
+ }
+
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/tabledec/DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/tabledec/DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml.java
new file mode 100644
index 0000000000..420c48712e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/tabledec/DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobjectlayout.tabledec;
+
+import java.util.Optional;
+
+import org.apache.isis.applib.layout.component.DomainObjectLayoutData;
+import org.apache.isis.applib.layout.component.TableDecoration;
+import org.apache.isis.commons.internal.base._Strings;
+import org.apache.isis.core.config.metamodel.facets.DomainObjectLayoutConfigOptions;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.i8n.noun.NounForms;
+import org.apache.isis.core.metamodel.facets.all.named.ObjectNamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.ObjectNamedFacetAbstract;
+
+import lombok.val;
+
+public class DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml
+extends DomainObjectLayoutTableDecorationFacetAbstract {
+
+ public static final Class<DomainObjectLayoutTableDecorationFacet> type() {
+ return DomainObjectLayoutTableDecorationFacet.class;
+ }
+
+ public static Optional<DomainObjectLayoutTableDecorationFacet> create(
+ final DomainObjectLayoutData domainObjectLayout,
+ final FacetHolder holder) {
+
+ if(domainObjectLayout == null) {
+ return Optional.empty();
+ }
+
+ val tableDecoration = domainObjectLayout.getTableDecoration();
+ return Optional.ofNullable(
+ tableDecoration == TableDecoration.DATATABLES_NET ?
+ new DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml(holder)
+ : null);
+ }
+
+ private DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml(final FacetHolder holder) {
+ super(DomainObjectLayoutConfigOptions.TableDecoration.DATATABLES_NET, holder);
+ }
+
+
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridSystemServiceAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridSystemServiceAbstract.java
index 2ac5a96e5c..99622a624f 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridSystemServiceAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridSystemServiceAbstract.java
@@ -55,6 +55,7 @@ import org.apache.isis.core.metamodel.facets.collections.layout.MemberDescribedF
import org.apache.isis.core.metamodel.facets.collections.layout.MemberNamedFacetForCollectionLayoutXml;
import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionLayoutXml;
import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.tabledec.CollectionLayoutTableDecorationFacetForCollectionLayoutXml;
import org.apache.isis.core.metamodel.facets.members.layout.group.GroupIdAndName;
import org.apache.isis.core.metamodel.facets.members.layout.group.LayoutGroupFacetForLayoutXml;
import org.apache.isis.core.metamodel.facets.members.layout.order.LayoutOrderFacetForLayoutXml;
@@ -63,6 +64,7 @@ import org.apache.isis.core.metamodel.facets.object.domainobjectlayout.CssClassF
import org.apache.isis.core.metamodel.facets.object.domainobjectlayout.CssClassFacetForDomainObjectLayoutXml;
import org.apache.isis.core.metamodel.facets.object.domainobjectlayout.ObjectDescribedFacetForDomainObjectLayoutXml;
import org.apache.isis.core.metamodel.facets.object.domainobjectlayout.ObjectNamedFacetForDomainObjectLayoutXml;
+import org.apache.isis.core.metamodel.facets.object.domainobjectlayout.tabledec.DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml;
import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyLayoutXml;
import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyLayoutXml;
import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyLayoutXml;
@@ -184,6 +186,11 @@ implements GridSystemService<G> {
ObjectNamedFacetForDomainObjectLayoutXml.class::isInstance,
ObjectNamedFacetForDomainObjectLayoutXml.create(domainObjectLayoutData, objectSpec),
objectSpec);
+ updateFacet(
+ DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml.type(),
+ DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml.class::isInstance,
+ DomainObjectLayoutTableDecorationFacetForDomainObjectLayoutXml.create(domainObjectLayoutData, objectSpec),
+ objectSpec);
}
@Override
@@ -404,6 +411,12 @@ implements GridSystemService<G> {
DefaultViewFacetForCollectionLayoutXml.create(collectionLayoutData, oneToManyAssociation),
oneToManyAssociation);
+ updateFacet(
+ CollectionLayoutTableDecorationFacetForCollectionLayoutXml.type(),
+ CollectionLayoutTableDecorationFacetForCollectionLayoutXml.class::isInstance,
+ CollectionLayoutTableDecorationFacetForCollectionLayoutXml.create(collectionLayoutData, oneToManyAssociation),
+ oneToManyAssociation);
+
updateFacet(
MemberDescribedFacetForCollectionLayoutXml.type(),
MemberDescribedFacetForCollectionLayoutXml.class::isInstance,