import net.wotonomy.foundation.NSDate; import net.wotonomy.web.*; public class Main extends WOComponent { private BlogEntry blogEntry; 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 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() + "'"); 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; } }