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/06/03 05:53:33 UTC

[isis] branch master updated: ISIS-2371: add inline editing demo to show the issue (EventDemo)

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 66b10b7  ISIS-2371: add inline editing demo to show the issue (EventDemo)
66b10b7 is described below

commit 66b10b7be9dc2fa18640a10308e0227731504390
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jun 3 07:53:17 2020 +0200

    ISIS-2371: add inline editing demo to show the issue (EventDemo)
    
    update via Action works, update via inline edit fails
---
 .../java/demoapp/dom/events/EventLogEntry.java     | 37 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/events/EventLogEntry.java b/examples/demo/domain/src/main/java/demoapp/dom/events/EventLogEntry.java
index 5655162..3fdea6b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/events/EventLogEntry.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/events/EventLogEntry.java
@@ -19,12 +19,14 @@
 package demoapp.dom.events;
 
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 
 import javax.jdo.annotations.DatastoreIdentity;
 import javax.jdo.annotations.IdGeneratorStrategy;
 import javax.jdo.annotations.IdentityType;
 import javax.jdo.annotations.PersistenceCapable;
 
+import org.apache.isis.applib.annotation.Action;
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.Editing;
 import org.apache.isis.applib.annotation.Property;
@@ -40,19 +42,40 @@ import demoapp.dom.events.EventsDemo.UiButtonEvent;
 @DomainObject
 public class EventLogEntry {
 
+    public static EventLogEntry of(UiButtonEvent even) {
+        val x = new EventLogEntry();
+        x.setEvent("Button clicked " + LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_TIME));
+        return x;
+    }
+    
+    public String title() {
+        return getEvent();
+    }
+
     @javax.jdo.annotations.Column(allowsNull = "false")
     @Property(editing = Editing.DISABLED)
     @Getter @Setter
     private String event;
 
-    public static EventLogEntry of(UiButtonEvent even) {
-        val x = new EventLogEntry();
-        x.setEvent("Button clicked " + LocalDateTime.now().toString());
-        return x;
+    // demonstrating 2 methods of changing a property ...
+    // - inline edit
+    // - via action
+    
+    public static enum Acknowledge {
+        IGNORE,
+        CRITICAL
     }
-
-    public static String version() {
-        return "1.0.0";
+    
+    @javax.jdo.annotations.Column(allowsNull = "true")
+    @Property(editing = Editing.ENABLED)
+    @Getter @Setter
+    private Acknowledge acknowledge;
+    
+    @Action(associateWith = "acknowledge")
+    public EventLogEntry acknowledge(Acknowledge acknowledge) {
+        setAcknowledge(acknowledge);
+        return this;
     }
+    
 
 }