summaryrefslogtreecommitdiff
path: root/wotonomy-web-test/src/main/java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-10-14 11:33:31 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-10-14 11:33:31 -0400
commitbe03e4adfe97561553c9ed2c10561c49d35c06d9 (patch)
treeac39a71ef7be15bfac02d3907426f206eab7cab5 /wotonomy-web-test/src/main/java
parentdf38659b7474d0cc00a125872b51cc399978a67f (diff)
Add basic blog enttry list
This adds a basic blog entry list to the front page. Currently, the blog entries are just populated from code, but eventually they will be pulled from the database
Diffstat (limited to 'wotonomy-web-test/src/main/java')
-rw-r--r--wotonomy-web-test/src/main/java/Application.java23
-rw-r--r--wotonomy-web-test/src/main/java/BlogEntry.java75
-rw-r--r--wotonomy-web-test/src/main/java/Main.java9
3 files changed, 105 insertions, 2 deletions
diff --git a/wotonomy-web-test/src/main/java/Application.java b/wotonomy-web-test/src/main/java/Application.java
index 815e210..5418913 100644
--- a/wotonomy-web-test/src/main/java/Application.java
+++ b/wotonomy-web-test/src/main/java/Application.java
@@ -3,12 +3,31 @@
// Decompiler options: packimports(3) fieldsfirst nonlb space
// Source File Name: Application.java
-import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
import net.wotonomy.web.WOApplication;
public class Application extends WOApplication {
-
+ private static final long serialVersionUID = 618161830400238273L;
+
+ public List<BlogEntry> blogEntries;
+
public Application() {
System.out.println("Application()");
}
+
+ @Override
+ public void awake() {
+ blogEntries = new ArrayList<>();
+
+ BlogEntry testEntry1 = new BlogEntry();
+ testEntry1.setTitle("Hello World");
+
+ BlogEntry testEntry2 = new BlogEntry();
+ testEntry2.setTitle("Goodbye World");
+
+ blogEntries.add(testEntry1);
+ blogEntries.add(testEntry2);
+ }
}
diff --git a/wotonomy-web-test/src/main/java/BlogEntry.java b/wotonomy-web-test/src/main/java/BlogEntry.java
new file mode 100644
index 0000000..274dbc7
--- /dev/null
+++ b/wotonomy-web-test/src/main/java/BlogEntry.java
@@ -0,0 +1,75 @@
+import java.io.Serializable;
+import java.util.Objects;
+
+import net.wotonomy.control.EOGenericRecord;
+import net.wotonomy.foundation.NSDate;
+
+public class BlogEntry implements Serializable {
+ private static final long serialVersionUID = 5106301363154029769L;
+
+ private String title;
+ private String subtitle;
+ private NSDate createdAt;
+ private String body;
+
+ public BlogEntry() {
+ super();
+ }
+
+ public BlogEntry(String title, String subtitle, NSDate createdAt, String body) {
+ super();
+ this.title = title;
+ this.subtitle = subtitle;
+ this.createdAt = createdAt;
+ this.body = body;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getSubtitle() {
+ return subtitle;
+ }
+ public void setSubtitle(String subtitle) {
+ this.subtitle = subtitle;
+ }
+ public NSDate getCreatedAt() {
+ return createdAt;
+ }
+ public void setCreatedAt(NSDate createdAt) {
+ this.createdAt = createdAt;
+ }
+ public String getBody() {
+ return body;
+ }
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(body, createdAt, subtitle, title);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ BlogEntry other = (BlogEntry) obj;
+ return Objects.equals(body, other.body) && Objects.equals(createdAt, other.createdAt)
+ && Objects.equals(subtitle, other.subtitle) && Objects.equals(title, other.title);
+ }
+
+ @Override
+ public String toString() {
+ return "BlogEntry [title=" + title + ", subtitle=" + subtitle + ", createdAt=" + createdAt + ", body=" + body
+ + "]";
+ }
+}
diff --git a/wotonomy-web-test/src/main/java/Main.java b/wotonomy-web-test/src/main/java/Main.java
index 0820fbc..1c8f1fb 100644
--- a/wotonomy-web-test/src/main/java/Main.java
+++ b/wotonomy-web-test/src/main/java/Main.java
@@ -3,6 +3,7 @@ import net.wotonomy.web.*;
public class Main extends WOComponent {
+ private BlogEntry blogEntry;
private boolean showing;
private String textFieldValue;
@@ -22,6 +23,14 @@ public class Main extends WOComponent {
showing = value;
}
+ public BlogEntry getBlogEntry() {
+ return blogEntry;
+ }
+
+ public void setBlogEntry(BlogEntry blogEntry) {
+ this.blogEntry = blogEntry;
+ }
+
public WOActionResults submit() {
System.out.println("Form Submitted");
System.out.println("textfield says '" + getTextValue() + "'");