You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/05/26 18:27:58 UTC

[isis] branch master updated: ISIS-2369: add demo (mixin demo) to reproduce the issue

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new be8d720  ISIS-2369: add demo (mixin demo) to reproduce the issue
be8d720 is described below

commit be8d720e7aaaa234fe68d2d33a598074d7973664
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue May 26 20:27:43 2020 +0200

    ISIS-2369: add demo (mixin demo) to reproduce the issue
---
 ...ixinDemo_mixedInProperty.java => DemoItem.java} | 34 ++++++----
 .../java/demoapp/dom/mixins/DemoItem.layout.xml    | 73 ++++++++++++++++++++++
 .../main/java/demoapp/dom/mixins/MixinDemo.java    |  7 +--
 .../dom/mixins/MixinDemo_mixedInCollection.java    |  2 -
 .../dom/mixins/MixinDemo_mixedInProperty.java      |  4 +-
 .../demoapp/dom/mixins/legacy/MixinLegacyDemo.java |  8 +--
 .../legacy/MixinLegacyDemo_mixedInCollection.java  |  2 +-
 .../legacy/MixinLegacyDemo_mixedInProperty.java    |  4 +-
 8 files changed, 106 insertions(+), 28 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/DemoItem.java
similarity index 53%
copy from examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java
copy to examples/demo/domain/src/main/java/demoapp/dom/mixins/DemoItem.java
index 19c0709..beaf7d4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/DemoItem.java
@@ -18,22 +18,32 @@
  */
 package demoapp.dom.mixins;
 
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Nature;
 import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
 
-import lombok.RequiredArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
-import demoapp.dom.actions.assoc.DemoItem;
 
-@Property
-@RequiredArgsConstructor
-public class MixinDemo_mixedInProperty {
-    
-    @SuppressWarnings("unused")
-    private final MixinDemo holder;
-    
-    public DemoItem prop() {
-        return DemoItem.of("A mixed-in Property");
+@DomainObject(nature=Nature.INMEMORY_ENTITY, objectType = "demo.MixinDemoItem")
+@NoArgsConstructor 
+@AllArgsConstructor(staticName="of")
+public class DemoItem {
+
+    public String title() {
+        return String.format("DemoItem '%s'", getName());
     }
+
+    @Property(editing = Editing.DISABLED)
+    @PropertyLayout(describedAs="The name of this 'DemoItem'.")
+    @Getter @Setter private String name;
     
+    @Property(editing = Editing.DISABLED)
+    @Getter @Setter private DemoItem friend;
+
 }
- 
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/DemoItem.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/mixins/DemoItem.layout.xml
new file mode 100644
index 0000000..ae3b334
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/DemoItem.layout.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<bs3:grid xsi:schemaLocation="http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/links http://isis.apache.org/applib/layout/links/links.xsd http://isis.apache.org/applib/layout/grid/bootstrap3 http://isis.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd" xmlns:bs3="http://isis.apache.org/applib/layout/grid/bootstrap3" xmlns:cpt="http://isis.apache.org/applib/layout/component" xmlns:lnk="h [...]
+    <bs3:row>
+        <bs3:col span="12" unreferencedActions="true">
+            <cpt:domainObject bookmarking="AS_ROOT"/>
+            <cpt:action bookmarking="NEVER" cssClassFa="far fa-fw fa-circle" cssClassFaPosition="LEFT" id="clearHints">
+                <cpt:named>Clear Hints</cpt:named>
+            </cpt:action>
+        </bs3:col>
+    </bs3:row>
+    <bs3:row>
+        <bs3:col span="4">
+            <bs3:row>
+                <bs3:col span="12">
+                    <bs3:tabGroup>
+                        <bs3:tab name="Identity">
+                            <bs3:row>
+                                <bs3:col span="12">
+                                    <cpt:fieldSet name="Identity" id="identity"/>
+                                </bs3:col>
+                            </bs3:row>
+                        </bs3:tab>
+                        <bs3:tab name="Other">
+                            <bs3:row>
+                                <bs3:col span="12">
+                                    <cpt:fieldSet name="Other" id="other" unreferencedProperties="true">
+                                        
+                                        <cpt:property id="name" typicalLength="25">
+                                            <cpt:named>Name</cpt:named>
+                                            <cpt:describedAs>The name of this 'DemoItem'.</cpt:describedAs>
+                                        </cpt:property>
+                                        
+                                        <cpt:property id="friend">
+                                            <cpt:named>Friend</cpt:named>
+                                        </cpt:property>
+                                        
+                                    </cpt:fieldSet>
+                                </bs3:col>
+                            </bs3:row>
+                        </bs3:tab>
+                        <bs3:tab name="Metadata">
+                            <bs3:row>
+                                <bs3:col span="12">
+                                    <cpt:fieldSet name="Metadata" id="metadata">
+                                        <cpt:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
+                                        <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
+                                        <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
+                                        <cpt:action id="openRestApi" position="PANEL_DROPDOWN"/>
+                                        <cpt:action id="rebuildMetamodel" position="PANEL_DROPDOWN"/>
+                                        <cpt:property hidden="ALL_TABLES" id="objectType" typicalLength="25">
+                                            <cpt:named>Object Type</cpt:named>
+                                        </cpt:property>
+                                        <cpt:property hidden="ALL_TABLES" id="objectIdentifier" typicalLength="25">
+                                            <cpt:named>Object Identifier</cpt:named>
+                                        </cpt:property>
+                                    </cpt:fieldSet>
+                                </bs3:col>
+                            </bs3:row>
+                        </bs3:tab>
+                    </bs3:tabGroup>
+                </bs3:col>
+            </bs3:row>
+            <bs3:row>
+                <bs3:col span="12">
+                    <cpt:fieldSet name="Details" id="details"/>
+                </bs3:col>
+            </bs3:row>
+        </bs3:col>
+        <bs3:col span="8">
+            <bs3:tabGroup unreferencedCollections="true"/>
+        </bs3:col>
+    </bs3:row>
+</bs3:grid>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo.java
index 09cdb75..38a29b6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo.java
@@ -36,7 +36,6 @@ import org.apache.isis.applib.annotation.PropertyLayout;
 import lombok.Getter;
 import lombok.Setter;
 
-import demoapp.dom.actions.assoc.DemoItem;
 import demoapp.utils.DemoStub;
 
 @XmlRootElement(name = "Demo")
@@ -64,9 +63,9 @@ public class MixinDemo extends DemoStub {
         note = "Update me! The button below is contributed by one of my mixins.";
         
         collection = new ArrayList<>();
-        collection.add(DemoItem.of("first"));
-        collection.add(DemoItem.of("second"));
-        collection.add(DemoItem.of("third"));
+        collection.add(DemoItem.of("first", null));
+        collection.add(DemoItem.of("second", collection.get(0)));
+        collection.add(DemoItem.of("third", collection.get(1)));
 
     }
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInCollection.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInCollection.java
index 4aa84dc..2ad0376 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInCollection.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInCollection.java
@@ -24,8 +24,6 @@ import org.apache.isis.applib.annotation.Collection;
 
 import lombok.RequiredArgsConstructor;
 
-import demoapp.dom.actions.assoc.DemoItem;
-
 @Collection
 @RequiredArgsConstructor
 public class MixinDemo_mixedInCollection {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java
index 19c0709..604fabc 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/MixinDemo_mixedInProperty.java
@@ -22,8 +22,6 @@ import org.apache.isis.applib.annotation.Property;
 
 import lombok.RequiredArgsConstructor;
 
-import demoapp.dom.actions.assoc.DemoItem;
-
 @Property
 @RequiredArgsConstructor
 public class MixinDemo_mixedInProperty {
@@ -32,7 +30,7 @@ public class MixinDemo_mixedInProperty {
     private final MixinDemo holder;
     
     public DemoItem prop() {
-        return DemoItem.of("A mixed-in Property");
+        return DemoItem.of("A mixed-in Property", null);
     }
     
 }
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo.java
index badbe57..50c3f19 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo.java
@@ -36,7 +36,7 @@ import org.apache.isis.applib.annotation.PropertyLayout;
 import lombok.Getter;
 import lombok.Setter;
 
-import demoapp.dom.actions.assoc.DemoItem;
+import demoapp.dom.mixins.DemoItem;
 import demoapp.utils.DemoStub;
 
 @XmlRootElement(name = "Demo")
@@ -64,9 +64,9 @@ public class MixinLegacyDemo extends DemoStub {
         note = "Update me! The button below is contributed by one of my mixins.";
         
         collection = new ArrayList<>();
-        collection.add(DemoItem.of("first"));
-        collection.add(DemoItem.of("second"));
-        collection.add(DemoItem.of("third"));
+        collection.add(DemoItem.of("first", null));
+        collection.add(DemoItem.of("second", collection.get(0)));
+        collection.add(DemoItem.of("third", collection.get(1)));
 
     }
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInCollection.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInCollection.java
index b8bf58e..ac72141 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInCollection.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInCollection.java
@@ -28,7 +28,7 @@ import org.apache.isis.applib.annotation.SemanticsOf;
 
 import lombok.RequiredArgsConstructor;
 
-import demoapp.dom.actions.assoc.DemoItem;
+import demoapp.dom.mixins.DemoItem;
 
 @Mixin(method="coll")
 @RequiredArgsConstructor
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInProperty.java b/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInProperty.java
index 45ef675..efc0e6a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInProperty.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/mixins/legacy/MixinLegacyDemo_mixedInProperty.java
@@ -26,7 +26,7 @@ import org.apache.isis.applib.annotation.SemanticsOf;
 
 import lombok.RequiredArgsConstructor;
 
-import demoapp.dom.actions.assoc.DemoItem;
+import demoapp.dom.mixins.DemoItem;
 
 @Mixin(method="prop")
 @RequiredArgsConstructor
@@ -38,7 +38,7 @@ public class MixinLegacyDemo_mixedInProperty {
     @Action(semantics=SemanticsOf.SAFE)   // required
     @ActionLayout(contributed=Contributed.AS_ASSOCIATION)  // required
     public DemoItem prop() {
-        return DemoItem.of("A mixed-in Property");
+        return DemoItem.of("A mixed-in Property", null);
     }
     
 }