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/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new fe4f501ba9 CAUSEWAY-3402: demo: adds error page show case
fe4f501ba9 is described below
commit fe4f501ba9cc7287d71e5badc9986f4c24949f78
Author: andi-huber <[email protected]>
AuthorDate: Thu Apr 13 09:05:17 2023 +0200
CAUSEWAY-3402: demo: adds error page show case
- also consolidating 'feature' show cases into new FeaturedMenu
---
.../dom/domain/actions/Action/ActionMenu.java | 16 +++---
.../WhereInTheWorldMenu.java => FeaturedMenu.java} | 51 ++++++++++++++++---
.../customui/vm/WhereInTheWorldVm-description.adoc | 2 +-
.../layout/describedAs/DescribedAsMenu.java | 59 ----------------------
.../demoapp/dom/featured/layout/tabs/TabMenu.java | 52 -------------------
.../src/main/java/demoapp/dom/menubars.layout.xml | 14 ++---
6 files changed, 62 insertions(+), 132 deletions(-)
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
index 2b4fba1aa0..dbec5ddb26 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
@@ -18,6 +18,16 @@
*/
package demoapp.dom.domain.actions.Action;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.ActionLayout;
+import org.apache.causeway.applib.annotation.DomainService;
+import org.apache.causeway.applib.annotation.NatureOfService;
+import org.apache.causeway.applib.annotation.PriorityPrecedence;
+import org.apache.causeway.applib.annotation.SemanticsOf;
+
import demoapp.dom._infra.samples.NameSamples;
import demoapp.dom.domain.actions.Action.choicesFrom.ActionChoicesFromPage;
import
demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingPage;
@@ -31,11 +41,6 @@ import
demoapp.dom.domain.actions.Action.typeOf.child.ActionTypeOfChildVm;
import lombok.RequiredArgsConstructor;
import lombok.val;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.causeway.applib.annotation.*;
-
@Named("demo.ActionMenu")
@DomainService(nature=NatureOfService.VIEW)
@javax.annotation.Priority(PriorityPrecedence.EARLY)
@@ -96,5 +101,4 @@ public class ActionMenu {
return page;
}
-
}
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldMenu.java
b/examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java
similarity index 61%
rename from
examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldMenu.java
rename to
examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java
index 4d5bb646d2..9cf9643e41 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.featured.customui.vm;
+package demoapp.dom.featured;
import java.util.Arrays;
import java.util.List;
@@ -31,19 +31,37 @@ import org.apache.causeway.applib.annotation.MemberSupport;
import org.apache.causeway.applib.annotation.NatureOfService;
import org.apache.causeway.applib.annotation.PriorityPrecedence;
import org.apache.causeway.applib.annotation.SemanticsOf;
+import org.apache.causeway.applib.services.factory.FactoryService;
+import org.apache.causeway.commons.internal.exceptions._Exceptions;
+import demoapp.dom.domain.progmodel.actions.assoc.assoc.DemoItem;
import demoapp.dom.featured.customui.geocoding.GeoapifyClient;
import demoapp.dom.featured.customui.latlng.Zoom;
+import demoapp.dom.featured.customui.vm.WhereInTheWorldVm;
+import demoapp.dom.featured.layout.describedAs.DescribedAsVm;
+import demoapp.dom.featured.layout.tabs.TabDemo;
+import lombok.RequiredArgsConstructor;
import lombok.val;
-@Named("demo.WhereInTheWorldMenu")
+@Named("demo.FeaturedMenu")
@DomainService(
nature=NatureOfService.VIEW
)
@javax.annotation.Priority(PriorityPrecedence.EARLY)
-public class WhereInTheWorldMenu {
+@RequiredArgsConstructor(onConstructor_ = { @Inject })
+public class FeaturedMenu {
-//tag::action[]
+ final FactoryService factoryService;
+
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(
+ cssClassFa="fa-skull-crossbones",
+ describedAs = "Throws an unrecoverable error for demonstration
purposes")
+ public Object errorPage(){
+ throw _Exceptions.unrecoverable("Error for demonstration purposes!");
+ }
+
+//tag::whereInTheWorldAction[]
@Inject
private GeoapifyClient geoapifyClient;
@@ -65,17 +83,36 @@ public class WhereInTheWorldMenu {
return vm;
}
-//end::action[]
+//end::whereInTheWorldAction[]
@MemberSupport public List<String> choices0WhereInTheWorld() {
return Arrays.asList("Malvern, UK", "Vienna, Austria", "Leeuwarden,
Netherlands", "Dublin, Ireland");
}
-
@MemberSupport public String default0WhereInTheWorld() {
return "Malvern, UK";
}
-
@MemberSupport public int default1WhereInTheWorld() {
return 14;
}
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(cssClassFa="fa-comment", describedAs="Opens the Tooltip-Demo
page.")
+ public DescribedAsVm toolTips(){
+ val demo = factoryService.viewModel(new DescribedAsVm());
+
+ demo.getCollection().add(DemoItem.of("first"));
+ demo.getCollection().add(DemoItem.of("second"));
+ demo.getCollection().add(DemoItem.of("third"));
+
+ return demo;
+ }
+
+ @Action
+ @ActionLayout(
+ cssClassFa="fa-bolt",
+ describedAs="Opens the Tabs-Demo page."
+ )
+ public TabDemo tabDemo(){
+ return factoryService.viewModel(new TabDemo());
+ }
+
}
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldVm-description.adoc
b/examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldVm-description.adoc
index d972a21033..7e3fa49214 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldVm-description.adoc
+++
b/examples/demo/domain/src/main/java/demoapp/dom/featured/customui/vm/WhereInTheWorldVm-description.adoc
@@ -17,7 +17,7 @@ A `zoom` level, which will be used when retrieving the map,
is also prompted for
[source,java,indent=0]
.WhereInTheWorldMenu.java
----
-include::WhereInTheWorldMenu.java[tags=action]
+include::../../FeaturedMenu.java[tags=whereInTheWorldAction]
----
The `WhereInTheWorldVm` view model returned by the menu is defined normally.
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsMenu.java
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsMenu.java
deleted file mode 100644
index 3a5cb0a2f6..0000000000
---
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsMenu.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 demoapp.dom.featured.layout.describedAs;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-import org.apache.causeway.applib.annotation.DomainService;
-import org.apache.causeway.applib.annotation.NatureOfService;
-import org.apache.causeway.applib.annotation.PriorityPrecedence;
-import org.apache.causeway.applib.annotation.SemanticsOf;
-import org.apache.causeway.applib.services.factory.FactoryService;
-
-import demoapp.dom.domain.progmodel.actions.assoc.assoc.DemoItem;
-import lombok.RequiredArgsConstructor;
-import lombok.val;
-
-@Named("demo.DescribedAsMenu")
-@DomainService(
- nature=NatureOfService.VIEW
-)
[email protected](PriorityPrecedence.EARLY)
-@RequiredArgsConstructor(onConstructor_ = { @Inject })
-public class DescribedAsMenu {
-
- final FactoryService factoryService;
-
-
- @Action(semantics = SemanticsOf.SAFE)
- @ActionLayout(cssClassFa="fa-comment", describedAs="Opens the Tooltip-Demo
page.")
- public DescribedAsVm describedAs(){
- val demo = factoryService.viewModel(new DescribedAsVm());
-
- demo.getCollection().add(DemoItem.of("first"));
- demo.getCollection().add(DemoItem.of("second"));
- demo.getCollection().add(DemoItem.of("third"));
-
- return demo;
- }
-
-}
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tabs/TabMenu.java
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tabs/TabMenu.java
deleted file mode 100644
index 78b2cbfd1c..0000000000
---
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tabs/TabMenu.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 demoapp.dom.featured.layout.tabs;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-import org.apache.causeway.applib.annotation.DomainService;
-import org.apache.causeway.applib.annotation.NatureOfService;
-import org.apache.causeway.applib.annotation.PriorityPrecedence;
-import org.apache.causeway.applib.services.factory.FactoryService;
-
-import lombok.RequiredArgsConstructor;
-
-@Named("demo.TabMenu")
-@DomainService(
- nature=NatureOfService.VIEW
-)
[email protected](PriorityPrecedence.EARLY)
-@RequiredArgsConstructor(onConstructor_ = { @Inject })
-public class TabMenu {
-
- final FactoryService factoryService;
-
- @Action
- @ActionLayout(
- cssClassFa="fa-bolt",
- describedAs="Opens the Tabs-Demo page."
- )
- public TabDemo tabDemo(){
- return factoryService.viewModel(new TabDemo());
- }
-
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
b/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
index 4ee317beea..d6c2426407 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
@@ -45,7 +45,6 @@ For latest we use:
https://raw.githubusercontent.com/apache/causeway/master/anto
<mb3:serviceAction objectType="demo.DomainObjectLayoutMenu"
id="describedAs"/>
<mb3:serviceAction objectType="demo.DomainObjectLayoutMenu"
id="named"/>
<mb3:serviceAction objectType="demo.DomainObjectLayoutMenu"
id="paged"/>
- <mb3:serviceAction objectType="demo.DomainObjectLayoutMenu"
id="plural"/>
<mb3:serviceAction objectType="demo.DomainObjectLayoutMenu"
id="tableDecorator"/>
<mb3:serviceAction objectType="demo.DomainObjectLayoutMenu"
id="uiEvents"/>
</mb3:section>
@@ -67,7 +66,6 @@ For latest we use:
https://raw.githubusercontent.com/apache/causeway/master/anto
<mb3:section>
<mb3:named>@ActionLayout</mb3:named>
<mb3:serviceAction objectType="demo.ActionLayoutMenu"
id="associateWith"/>
- <mb3:serviceAction objectType="demo.ActionLayoutMenu"
id="bookmarking"/>
<mb3:serviceAction objectType="demo.ActionLayoutMenu"
id="cssClass"/>
<mb3:serviceAction objectType="demo.ActionLayoutMenu"
id="cssClassFa"/>
<mb3:serviceAction objectType="demo.ActionLayoutMenu"
id="describedAs"/>
@@ -278,16 +276,18 @@ For latest we use:
https://raw.githubusercontent.com/apache/causeway/master/anto
<mb3:menu>
<mb3:named>Featured</mb3:named>
+ <mb3:section>
+ <mb3:named>Error</mb3:named>
+ <mb3:serviceAction objectType="demo.FeaturedMenu"
id="errorPage" />
+ </mb3:section>
<mb3:section>
<mb3:named>Layout</mb3:named>
- <mb3:serviceAction objectType="demo.DescribedAsMenu"
id="describedAs">
- <mb3:named>Tool Tips</mb3:named>
- </mb3:serviceAction>
- <mb3:serviceAction objectType="demo.TabMenu" id="tabDemo" />
+ <mb3:serviceAction objectType="demo.FeaturedMenu"
id="toolTips" />
+ <mb3:serviceAction objectType="demo.FeaturedMenu" id="tabDemo"
/>
</mb3:section>
<mb3:section>
<mb3:named>Custom UI</mb3:named>
- <mb3:serviceAction objectType="demo.WhereInTheWorldMenu"
id="whereInTheWorld" />
+ <mb3:serviceAction objectType="demo.FeaturedMenu"
id="whereInTheWorld" />
</mb3:section>
</mb3:menu>