From aedc34d55462a75e329bbf342251ff6504cd117e Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sun, 19 May 2024 17:56:33 -0400 Subject: Initial import from SVN --- wotonomy-test/WEB-INF/classes/Main.java | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 wotonomy-test/WEB-INF/classes/Main.java (limited to 'wotonomy-test/WEB-INF/classes/Main.java') diff --git a/wotonomy-test/WEB-INF/classes/Main.java b/wotonomy-test/WEB-INF/classes/Main.java new file mode 100644 index 0000000..a12ca44 --- /dev/null +++ b/wotonomy-test/WEB-INF/classes/Main.java @@ -0,0 +1,54 @@ +import net.wotonomy.foundation.NSDate; +import net.wotonomy.web.*; + +public class Main extends WOComponent { + + private boolean showing; + private String textFieldValue; + + public Main() { + super(); + showing = true; + } + + public NSDate getCurrentTime() { + return new NSDate(); + } + + public boolean getShowTime() { + return showing; + } + public void setShowTime(boolean value) { + showing = value; + } + + public WOActionResults submit() { + System.out.println("Form Submitted"); + System.out.println("textfield says '" + getTextValue() + "'"); + return null; + } + + public void takeValuesFromRequest(WORequest r, WOContext c) { + System.out.println("taking values from request"); + if (r.formValueForKey("show") != null) + setShowTime(r.formValueForKey("show").equals("true")); + } + + public String getTimeLinkString() { + return showing ? "Hide the time display" : "Show time display"; + } + + public void setTextValue(String value) { + textFieldValue = value; + } + public String getTextValue() { + return textFieldValue; + } + + public WOComponent switchTime() { + System.out.println("switching time display"); + setShowTime(!getShowTime()); + return this; + } + +} -- cgit v1.2.3