This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 0f1fd0a1448ab27d65857b9c59e601d7cd84d1c1 Author: danhaywood <[email protected]> AuthorDate: Tue May 23 23:58:21 2023 +0100 CAUSEWAY-2485: doc updates is all --- examples/demo/.run/DemoAppWicketJpa.run.xml | 3 ++ .../dom/_infra/docgen/SuppressDocumentation.java | 15 ++++++ .../dom/homepage/DemoHomePage-description.adoc | 23 ++++++---- .../demoapp/dom/homepage/DemoHomePage-welcome.adoc | 8 ++-- .../java/demoapp/dom/homepage/DemoHomePage.java | 13 +++--- .../docgen/helptree/HelpNodeVm.layout.xml | 53 ++++++++++++++++++++++ 6 files changed, 93 insertions(+), 22 deletions(-) diff --git a/examples/demo/.run/DemoAppWicketJpa.run.xml b/examples/demo/.run/DemoAppWicketJpa.run.xml index f768659871..c8a1c1fe51 100644 --- a/examples/demo/.run/DemoAppWicketJpa.run.xml +++ b/examples/demo/.run/DemoAppWicketJpa.run.xml @@ -1,6 +1,9 @@ <component name="ProjectRunConfigurationManager"> <configuration default="false" name="DemoAppWicketJpa" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <option name="ACTIVE_PROFILES" value="port9090" /> + <envs> + <env name="KROKI_MAX_URI_LENGTH" value="8192" /> + </envs> <module name="demo-wicket-jpa" /> <option name="SHORTEN_COMMAND_LINE" value="ARGS_FILE" /> <option name="SPRING_BOOT_MAIN_CLASS" value="demoapp.webapp.wicket.jpa.DemoAppWicketJpa" /> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/docgen/SuppressDocumentation.java b/examples/demo/domain/src/main/java/demoapp/dom/_infra/docgen/SuppressDocumentation.java new file mode 100644 index 0000000000..ff3dbbda83 --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/_infra/docgen/SuppressDocumentation.java @@ -0,0 +1,15 @@ +package demoapp.dom._infra.docgen; + +import org.apache.causeway.extensions.docgen.menu.DocumentationMenu; + +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Service; + +@Service +public class SuppressDocumentation { + + @EventListener(DocumentationMenu.help.ActionDomainEvent.class) + public void on(DocumentationMenu.help.ActionDomainEvent ev) { + ev.hide(); + } +} diff --git a/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-description.adoc index e4fbef952d..3fb62ebdbd 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-description.adoc @@ -1,6 +1,16 @@ :Notice: 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 ag [...] -Apache Causeway applications can nominate a view model to act as the home page, using the link:https://causeway.apache.org/refguide/${CAUSEWAY_VERSION}/applib-ant/HomePage.html[@HomePage] annotation: +Apache Causeway applications can nominate a view model to act as the home page. +These typically act as a dashboard, displaying the most useful current information to the user (perhaps a task list, or alerts). +Such a home page would have a number of repository services injected into it, in order to query and render those tasks or alerts. + +Home pages often also have the framework's link:https://causeway.apache.org/refguide/${CAUSEWAY_VERSION}/applib/index/services/user/UserService.html[UserService] injected, in order that the information displayed is relevant to the current user. + +== How this demo works + +This demo application's home page is pretty simple, not much more than a couple of hard-coded text fields that you're reading right now. + +In terms of code, the framework indicates which view model is the home page using the link:https://causeway.apache.org/refguide/${CAUSEWAY_VERSION}/applib-ant/HomePage.html[@HomePage] annotation: [source,java] ---- @@ -11,13 +21,6 @@ include::DemoHomePage.java[tags="class"] <.> contributes the description property on the right hand side (in other words, what you're reading right now). <.> customises the title, top left <.> the welcome text, on the left handside -<.> framework-provided service, injected by the framework so that the home page object can find the current user - -This application's home page is pretty simple, not much more than a couple of hard-coded text fields that you're reading right now. - -A more common implementation of a home page is as a dashboard, displaying the most useful current information to the user (perhaps a task list, or alerts). -Such a home page would have a number of repository services injected into it, in order to query and render those tasks or alerts. - -It would probably also have the framework's link:https://causeway.apache.org/refguide/${CAUSEWAY_VERSION}/applib/index/services/user/UserService.html[UserService] injected, in order that the information displayed is relevant to the current user. -As you can see, this app's home page does actually do this, in order to "personalise" the title. +<.> framework-provided service, injected by the framework so that the home page object can find the current user. +This allows us to "personalise" the title on this home page. diff --git a/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-welcome.adoc b/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-welcome.adoc index 114f4b6db0..5d7d1b4fbc 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-welcome.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage-welcome.adoc @@ -4,6 +4,8 @@ This is an link:https://causeway.apache.org[Apache Causeway] application to demo On the left hand side of each page you'll find a working example of the feature, while on the right hand side you'll find a description of the feature with annotated code examples. +Be aware, the demo app uses an in-memory database, so any changes made will be lost when the app is stopped. + == Page Layout This is as good place as any to explain the page layout of an Apache Causeway webapp: @@ -20,16 +22,12 @@ Properties and collections are the object's state, actions are the object's beha (This home page object has two properties, each of type `AsciiDoc`. The `welcome` property - what you are reading now - is on the left, the `description` property on the right). + -If running in prototype mode then there are a number of actions contributed by the framework (their label is in _italics_) so you can dig into the internal implementation. +If running in prototype mode then there are a number of actions provided by the framework for development purposes; their label is in _italics_. * At the bottom is a menu bar with credits, and to allow the user to *change theme*. Click into the application and try things out. -[CAUTION] -==== -The demo app uses an in-memory database, so any changes made will be lost when the app is stopped. -==== === Getting Help and Assistance diff --git a/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage.java b/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage.java index efd5ccb004..3d2baa4ac1 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/homepage/DemoHomePage.java @@ -33,21 +33,20 @@ import demoapp.dom._infra.resources.AsciiDocReaderService; //tag::class[] @Named("demo.Homepage") -@DomainObject( - nature=Nature.VIEW_MODEL) -@HomePage // <.> +@DomainObject(nature=Nature.VIEW_MODEL) +@HomePage // <.> public class DemoHomePage - implements HasAsciiDocDescription { // <.> + implements HasAsciiDocDescription { // <.> - @ObjectSupport public String title() { // <.> + @ObjectSupport public String title() { // <.> return "Hello, " + userService.currentUserNameElseNobody(); } - public AsciiDoc getWelcome() { // <.> + public AsciiDoc getWelcome() { // <.> return asciiDocReaderService.readFor(this, "welcome"); } - @Inject UserService userService; // <.> + @Inject UserService userService; // <.> @Inject AsciiDocReaderService asciiDocReaderService; } //end::class[] diff --git a/examples/demo/domain/src/main/java/org/apache/causeway/extensions/docgen/helptree/HelpNodeVm.layout.xml b/examples/demo/domain/src/main/java/org/apache/causeway/extensions/docgen/helptree/HelpNodeVm.layout.xml new file mode 100644 index 0000000000..d2848616aa --- /dev/null +++ b/examples/demo/domain/src/main/java/org/apache/causeway/extensions/docgen/helptree/HelpNodeVm.layout.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- 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. --> +<bs3:grid + xsi:schemaLocation="https://causeway.apache.org/applib/layout/component https://causeway.apache.org/applib/layout/component/component.xsd https://causeway.apache.org/applib/layout/grid/bootstrap3 https://causeway.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd" + xmlns:bs3="https://causeway.apache.org/applib/layout/grid/bootstrap3" + xmlns:cpt="https://causeway.apache.org/applib/layout/component" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <bs3:row> + <bs3:col span="10" unreferencedActions="true"> + <cpt:domainObject /> + </bs3:col> + <bs3:col span="2"> + <cpt:fieldSet name="" id="sources" /> + </bs3:col> + </bs3:row> + + <bs3:row> + <bs3:col span="3"> + <cpt:fieldSet name="Index" id="tree"> + <cpt:action id="clearHints" position="PANEL" /> + <cpt:action id="rebuildMetamodel" position="PANEL"/> + <cpt:action id="downloadLayout" position="PANEL_DROPDOWN"/> + <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/> + <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/> + <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/> + <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/> + <cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/> + <cpt:action id="openRestApi" position="PANEL_DROPDOWN" /> + </cpt:fieldSet> + <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + </bs3:col> + <bs3:col span="9"> + <cpt:fieldSet name="Detail" id="detail"> + <cpt:property id="helpNode"/> + </cpt:fieldSet> + </bs3:col> + </bs3:row> + <bs3:row> + <bs3:col span="12" unreferencedCollections="true"/> + </bs3:row> +</bs3:grid>
