From 40a9d99496e098562f090fb7ffce9e749011b131 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 20 May 2024 17:58:16 -0400 Subject: Formatting pass --- .../src/main/java/net/wotonomy/web/WOForm.java | 181 ++++++++++----------- 1 file changed, 89 insertions(+), 92 deletions(-) (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOForm.java') diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOForm.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOForm.java index 887d1a3..b4dca91 100644 --- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOForm.java +++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOForm.java @@ -21,104 +21,101 @@ package net.wotonomy.web; import net.wotonomy.foundation.NSArray; import net.wotonomy.foundation.NSDictionary; -/** -* Implements a FORM element with dynamic bindings. -* @author michael@mpowers.net -* @author $Author: cgruber $ -* @version $Revision: 905 $ -*/ +/** + * Implements a FORM element with dynamic bindings. + * + * @author michael@mpowers.net + * @author $Author: cgruber $ + * @version $Revision: 905 $ + */ public class WOForm extends WODynamicElement { - public WOForm() { - super(); - } - - public WOForm(String n, NSDictionary m, WOElement t) { - super(n, m, t); - } - - public String href(WOContext c) { - return (String)valueForProperty("href", c.component()); - } - - public String directActionName(WOContext c) { - return (String)valueForProperty("directAction", c.component()); - } - - public String directActionClass(WOContext c) { - return (String)valueForProperty("actionClass", c.component()); - } - - public boolean multipleSubmit(WOContext c) { - return booleanForProperty("multipleSubmit", c.component()); - } - - public void takeValuesFromRequest ( - WORequest aRequest, WOContext aContext) - { - if ( rootElement != null ) - { - rootElement.takeValuesFromRequest( aRequest, aContext ); - } - } - - public void appendToResponse(WOResponse r, WOContext c) { - //Append the opening tag - r.appendContentString(" 0) - r.appendContentString(link); - r.appendContentString(">"); - //Notify that we're inside a form now - c.setInForm(true); - //Append the inner template - rootElement.appendToResponse(r, c); - //Close the tag - r.appendContentString(""); + // Append any additional properties + link = additionalHTMLProperties(c.component(), + new NSArray(new Object[] { "href", "action", "directActionName", "actionClass", "multipleSubmit" })); + if (link.length() > 0) + r.appendContentString(link); + r.appendContentString(">"); + // Notify that we're inside a form now + c.setInForm(true); + // Append the inner template + rootElement.appendToResponse(r, c); + // Close the tag + r.appendContentString(""); // c.deleteLastElementIDComponent(); - c.setInForm(false); - } - - public WOActionResults invokeAction(WORequest r, WOContext c) { - //We only process the request if it's not a multipleSubmit (otherwise we leave it to the buttons) - if (!multipleSubmit(c) - && c.elementID().equals(c.senderID()) - && associations.objectForKey("action") != null ) { - return (WOActionResults)valueForProperty("action", c.component()); - } - WOActionResults res = rootElement.invokeAction(r, c); - return res; - } + c.setInForm(false); + } + + public WOActionResults invokeAction(WORequest r, WOContext c) { + // We only process the request if it's not a multipleSubmit (otherwise we leave + // it to the buttons) + if (!multipleSubmit(c) && c.elementID().equals(c.senderID()) && associations.objectForKey("action") != null) { + return (WOActionResults) valueForProperty("action", c.component()); + } + WOActionResults res = rootElement.invokeAction(r, c); + return res; + } } -- cgit v1.2.3