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 2020/06/28 07:09:48 UTC

[isis] branch ISIS-2222 updated: ISIS-2222: improves asciidoc styling.

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

danhaywood pushed a commit to branch ISIS-2222
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/ISIS-2222 by this push:
     new db3e7cd  ISIS-2222: improves asciidoc styling.
db3e7cd is described below

commit db3e7cdc4ffab91c28a6b1d245947aa97f0a11cb
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Jun 28 08:09:13 2020 +0100

    ISIS-2222: improves asciidoc styling.
---
 .../dom/homepage/DemoHomePage-description.adoc     |  6 ++-
 .../demoapp/dom/homepage/DemoHomePage-welcome.adoc |  5 ++-
 .../java/demoapp/dom/homepage/DemoHomePage.java    |  5 ++-
 .../src/main/java/demoapp/dom/menubars.layout.xml  |  2 +-
 .../java/demoapp/dom/viewmodels/ViewModels.java    |  1 +
 .../viewmodels/jaxbrefentity/ChildJdoEntity.java   |  2 +
 .../StatefulViewModelJaxbRefsEntity.java           |  7 ++-
 .../StatefulViewModelUsingJaxb-description.adoc    | 52 ++--------------------
 .../usingjaxb/StatefulViewModelUsingJaxb.java      | 17 ++++---
 .../src/main/resources/static/css/application.css  | 48 +++++++++++++++++---
 .../main/resources/static/scripts/application.js   |  1 +
 11 files changed, 80 insertions(+), 66 deletions(-)

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 0f390d7..b30e1ad 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
@@ -6,8 +6,10 @@ include::DemoHomePage.java[tags="class"]
 ----
 
 <.> declares this view-model class to be used as the viewer's homepage, there can be only one
-<.> as displayed
-<.> to determine the current user
+<.> 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.
 
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 ac30e4f..b969fb9 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
@@ -22,7 +22,10 @@ If running in prototype mode then there are a number of actions contributed by t
 
 Click into the application and try things out.
 
-NOTE: The demo app uses an in-memory database, so any changes made will be lost when the app is stopped.
+[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 0959e9b..8ed1dd8 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
@@ -50,13 +50,14 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
         , objectType = "demo.Homepage"
 )
 @HomePage                                                       // <.>
-public class DemoHomePage implements HasAsciiDocDescription {
+public class DemoHomePage
+        implements HasAsciiDocDescription {                     // <.>
 
     public String title() {                                     // <.>
         return "Hello, " + userService.getUser().getName();
     }
 
-    public AsciiDoc getWelcome() {
+    public AsciiDoc getWelcome() {                              // <.>
         return asciiDocReaderService.readFor(this, "welcome");
     }
 
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 4dd9b7b..b6699b8 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
@@ -8,7 +8,7 @@
         <mb3:menu>
             <mb3:named>View Models</mb3:named>
             <mb3:section>
-                <mb3:serviceAction objectType="demo.ViewModels" id="openStateful"/>
+                <mb3:serviceAction objectType="demo.ViewModels" id="openStateful" cssClassFa="mountain"/>
                 <mb3:serviceAction objectType="demo.ViewModels" id="openStatefulRefsEntity"/>
             </mb3:section>
         </mb3:menu>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/ViewModels.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/ViewModels.java
index eaa5141..4cbe58d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/ViewModels.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/ViewModels.java
@@ -19,6 +19,7 @@
 package demoapp.dom.viewmodels;
 
 import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
 import org.apache.isis.applib.annotation.DomainService;
 import org.apache.isis.applib.annotation.SemanticsOf;
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java
index 5cab845..ab9d359 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java
@@ -19,6 +19,7 @@ import lombok.Data;
 import lombok.Getter;
 import lombok.Setter;
 
+//tag::class[]
 @PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo" )
 @DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
 @DomainObject(bounding = Bounding.BOUNDED)
@@ -33,3 +34,4 @@ public class ChildJdoEntity {
     @Getter @Setter
     private String name;
 }
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
index dc6fe6e..f030c0b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
@@ -42,6 +42,7 @@ import lombok.Setter;
 
 import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 
+//tag::class[]
 @XmlRootElement(name = "demo.StatefulViewModelJaxbRefsEntity")
 @XmlType(
         propOrder = {"message", "favoriteChild", "children"}
@@ -85,7 +86,9 @@ public class StatefulViewModelJaxbRefsEntity implements HasAsciiDocDescription {
         }
     }
 
-    // using a ediatble property seems to fail, though...
+//end::class[]
+
+// TODO: using a editable property seems to fail, though...
 //    public List<ChildEntity> choicesFavoriteChild() {
 //        return getChildren();
 //    }
@@ -93,6 +96,7 @@ public class StatefulViewModelJaxbRefsEntity implements HasAsciiDocDescription {
 //        return getChildren().isEmpty() ? "no children" : null;
 //    }
 
+//tag::class[]
     @Getter @Setter
     @Collection
     @XmlElementWrapper(name = "children")
@@ -119,3 +123,4 @@ public class StatefulViewModelJaxbRefsEntity implements HasAsciiDocDescription {
     }
 
 }
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb-description.adoc
index b472425..070de2d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb-description.adoc
@@ -7,21 +7,7 @@ The framework provides a number of ways to serialize this state, but the most fl
 
 [source,java]
 ----
-@XmlRootElement(name = "demo.DemoStatefulViewModel")     // <.>
-@XmlType                                                    // <.>
-@XmlAccessorType(XmlAccessType.FIELD)                       // <.>
-@DomainObject(
-        nature=Nature.VIEW_MODEL
-        , objectType = "demo.DemoStatefulViewModel"
-)
-public class StatefulViewModelUsingJaxb implements HasAsciiDocDescription {
-
-    // ...
-
-    @Property(editing = Editing.ENABLED)
-    @Getter @Setter
-    private String message;                                 // <.>
-}
+include::StatefulViewModelUsingJaxb.java[tags=class]
 ----
 
 <.> mandatory, specifies this is a JAXB element
@@ -40,50 +26,18 @@ JAXB also handles serializing graphs of data, which means that view models can a
 
 [source,java,indent=0]
 ----
-    @XmlRootElement(name = "child")
-    @XmlType
-    @XmlAccessorType(XmlAccessType.FIELD)
-    @Data
-    public static class Child {
-        @Title
-        private String name;
-    }
-
-    @Getter @Setter
-    @Collection
-    @XmlElementWrapper(name = "children")
-    @XmlElement(name = "child")
-    private List<Child> children = new ArrayList<>();
+include::StatefulViewModelUsingJaxb.java[tags=child]
 ----
 
 The demo provides a couple of actions to allow objects to be added and removed.
 
 [source,java,indent=0]
 ----
-    @Action(associateWith = "children", associateWithSequence = "1", semantics = SemanticsOf.NON_IDEMPOTENT)
-    public StatefulViewModelUsingJaxb addChild(final String name) {
-        val child = new Child();
-        child.setName(name);
-        children.add(child);
-        return this;
-    }
-
-    @Action(associateWith = "children", associateWithSequence = "2", semantics = SemanticsOf.IDEMPOTENT)
-    public StatefulViewModelUsingJaxb removeChild(final Child child) {
-        children.remove(child);
-        return this;
-    }
-    public List<Child> choices0RemoveChild() { return getChildren(); }
-    public String disableRemoveChild() {
-        return choices0RemoveChild().isEmpty()? "No children to remove" : null;
-    }
-
-
+include::StatefulViewModelUsingJaxb.java[tags=addChild]
 ----
 
 NOTE: the child object has value-type semantics (is annotated with `@lombok.Data`).
 
-TODO: references to persistent java entities
 
 == Long URLs
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb.java
index 832ff1e..fe8871f 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/usingjaxb/StatefulViewModelUsingJaxb.java
@@ -44,10 +44,10 @@ import lombok.val;
 
 import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 
-@XmlRootElement(name = "demo.StatefulViewModelUsingJaxb")
-@XmlType(
-)
-@XmlAccessorType(XmlAccessType.FIELD)
+//tag::class[]
+@XmlRootElement(name = "demo.StatefulViewModelUsingJaxb")   // <.>
+@XmlType                                                    // <.>
+@XmlAccessorType(XmlAccessType.FIELD)                       // <.>
 @DomainObject(
         nature=Nature.VIEW_MODEL
         , objectType = "demo.StatefulViewModelUsingJaxb"
@@ -61,8 +61,10 @@ public class StatefulViewModelUsingJaxb implements HasAsciiDocDescription {
     @Property(editing = Editing.ENABLED)
     @Getter @Setter
     @XmlElement
-    private String message;
+    private String message;                                 // <.>
 
+//end::class[]
+//tag::child[]
     @XmlRootElement(name = "demo.StatefulViewModelUsingJaxb.Child")
     @XmlType
     @XmlAccessorType(XmlAccessType.FIELD)
@@ -77,7 +79,9 @@ public class StatefulViewModelUsingJaxb implements HasAsciiDocDescription {
     @XmlElementWrapper(name = "children")
     @XmlElement(name = "child")
     private List<Child> children = new ArrayList<>();
+//end::child[]
 
+//tag::addChild[]
     @Action(associateWith = "children", associateWithSequence = "1", semantics = SemanticsOf.NON_IDEMPOTENT)
     public StatefulViewModelUsingJaxb addChild(final String name) {
         val child = new Child();
@@ -95,5 +99,8 @@ public class StatefulViewModelUsingJaxb implements HasAsciiDocDescription {
     public String disableRemoveChild() {
         return choices0RemoveChild().isEmpty()? "No children to remove" : null;
     }
+//end::addChild[]
 
+    //tag::class[]
 }
+//end::class[]
diff --git a/examples/demo/domain/src/main/resources/static/css/application.css b/examples/demo/domain/src/main/resources/static/css/application.css
index f34c721..5a51dd8 100644
--- a/examples/demo/domain/src/main/resources/static/css/application.css
+++ b/examples/demo/domain/src/main/resources/static/css/application.css
@@ -1,12 +1,14 @@
+/*
+ * Demonstrates use of @PropertyLayout(cssClass='red')
+ */
 .property.red label {
     color: red;
 }
 
-.welcome {
-    font-size: 16px;
-}
-
-
+/*
+ * admonitionblock styles (ie, NOTE: TIP: CAUTION: IMPORTANT: WARNING:)
+ * (taken from asciidoctor.css)
+ */
 .admonitionblock td.content > .title {
     line-height: 1.45;
     color: #7a2518;
@@ -93,6 +95,10 @@
     color: #bf0000
 }
 
+/*
+ * colist (callout list) styles
+ * (taken from asciidoctor.css)
+ */
 .colist > table {
     border: 0;
     background: none
@@ -120,6 +126,10 @@
     padding: .25em 0
 }
 
+/*
+ * conum (callout number) styles
+ * (taken from asciidoctor.css)
+ */
 .conum[data-value] {
     display: inline-block;
     color: #fff !important;
@@ -159,4 +169,32 @@ b.conum * {
 
 .conum:not([data-value]):empty {
     display: none
+}
+
+
+/*
+ * Miscellaneous other styles
+ */
+.welcome {
+    font-size: 16px;
+}
+
+div.paragraph a {
+    text-decoration: underline dotted;
+}
+
+div.paragraph a:hover{
+    text-decoration: underline solid;
+}
+
+div.paragraph a.a-has-code {
+    text-decoration-color: #c7254e;
+}
+
+div.paragraph a.a-has-code:hover {
+    text-decoration-color: #c7254e;
+}
+
+div.colist {
+    margin-bottom: 1em;
 }
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/resources/static/scripts/application.js b/examples/demo/domain/src/main/resources/static/scripts/application.js
index 97c3169..7461263 100644
--- a/examples/demo/domain/src/main/resources/static/scripts/application.js
+++ b/examples/demo/domain/src/main/resources/static/scripts/application.js
@@ -1,5 +1,6 @@
 $(document).ready(function() {
 	/// here...
+    $("a:has(code)").addClass("a-has-code");
 });