diff options
Diffstat (limited to 'wotonomy-web-test/src/main')
5 files changed, 116 insertions, 3 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() + "'"); diff --git a/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html b/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html index 48143bd..750a74f 100644 --- a/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html +++ b/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html @@ -9,12 +9,14 @@ </div> <div class = "row"> <div class = "leftcolumn"> + <webobject name="cardlist"> <div class = "card"> - <h2>TITLE HEADING</h2> + <h2><webobject name="entryTitle"></webobject></h2> <h5>Title description, Dec 7, 2017</h5> <div class = "fakeimg" style = "height:200px;"> Image </div> <p>Some text..</p> </div> + </webobject> <div class = "card"> <h2>TITLE HEADING</h2> <h5>Title description, Sep 2, 2017</h5> diff --git a/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.wod b/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.wod index e69de29..a4349b4 100644 --- a/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.wod +++ b/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.wod @@ -0,0 +1,8 @@ +cardlist : WORepetition { + list = application.blogEntries; + item = blogEntry; +} + +entryTitle : WOString { + value = blogEntry.title; +}
\ No newline at end of file |
