diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
| commit | 40a9d99496e098562f090fb7ffce9e749011b131 (patch) | |
| tree | 437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java | |
| parent | ff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff) | |
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java')
| -rw-r--r-- | projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java index 5d22d36..8e706c1 100644 --- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java +++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOCheckBox.java @@ -7,75 +7,75 @@ import net.wotonomy.foundation.NSMutableArray; public class WOCheckBox extends WOInput { - protected boolean checked = false; + protected boolean checked = false; - public WOCheckBox() { - super(); - } + public WOCheckBox() { + super(); + } - public WOCheckBox(String aName, NSDictionary assocs, WOElement template) { - super(aName, assocs, template); - } + public WOCheckBox(String aName, NSDictionary assocs, WOElement template) { + super(aName, assocs, template); + } - protected String inputType() { - return "CHECKBOX"; - } + protected String inputType() { + return "CHECKBOX"; + } - protected Object value(WOContext c) { - Object val = null; - boolean checked = false; - if (associations.objectForKey("value") != null) { - val = valueForProperty("value", c.component()); - Object sel = valueForProperty("selection", c.component()); - if (sel != null && val != null && sel.equals(val)) - checked = true; - } - if (val == null) { - val = c.elementID(); - } - return val; - } + protected Object value(WOContext c) { + Object val = null; + boolean checked = false; + if (associations.objectForKey("value") != null) { + val = valueForProperty("value", c.component()); + Object sel = valueForProperty("selection", c.component()); + if (sel != null && val != null && sel.equals(val)) + checked = true; + } + if (val == null) { + val = c.elementID(); + } + return val; + } - protected void appendExtras(WOResponse r, WOContext c) { - checked |= booleanForProperty("checked", c.component()); - if (checked) - r.appendContentString(" CHECKED"); - } + protected void appendExtras(WOResponse r, WOContext c) { + checked |= booleanForProperty("checked", c.component()); + if (checked) + r.appendContentString(" CHECKED"); + } - protected NSMutableArray additionalAttributes() { - NSMutableArray a = super.additionalAttributes(); - a.addObject("checked"); - a.addObject("selection"); - return a; - } + protected NSMutableArray additionalAttributes() { + NSMutableArray a = super.additionalAttributes(); + a.addObject("checked"); + a.addObject("selection"); + return a; + } - public void appendToResponse(WOResponse r, WOContext c) { - checked = false; - super.appendToResponse(r, c); - } + public void appendToResponse(WOResponse r, WOContext c) { + checked = false; + super.appendToResponse(r, c); + } - public void takeValuesFromRequest(WORequest r, WOContext c) { - if (disabled(c)) - return; - NSArray values = r.formValuesForKey(inputName(c)); - Object val = valueForProperty("value", c.component()); - if (val == null) - val = c.elementID(); - java.util.Enumeration enumerator = values.objectEnumerator(); - checked = false; - while (enumerator.hasMoreElements()) { - Object nextval = enumerator.nextElement(); - if (nextval.equals(val)) - checked = true; - } - if (associations.objectForKey("value") != null && associations.objectForKey("selection") != null) { - if (checked) - setValueForProperty("selection", val, c.component()); - else if (valueForProperty("selection", c.component()) != null) - setValueForProperty("selection", null, c.component()); - } - if (associations.objectForKey("checked") != null) - setValueForProperty("checked", checked ? Boolean.TRUE : Boolean.FALSE, c.component()); - } + public void takeValuesFromRequest(WORequest r, WOContext c) { + if (disabled(c)) + return; + NSArray values = r.formValuesForKey(inputName(c)); + Object val = valueForProperty("value", c.component()); + if (val == null) + val = c.elementID(); + java.util.Enumeration enumerator = values.objectEnumerator(); + checked = false; + while (enumerator.hasMoreElements()) { + Object nextval = enumerator.nextElement(); + if (nextval.equals(val)) + checked = true; + } + if (associations.objectForKey("value") != null && associations.objectForKey("selection") != null) { + if (checked) + setValueForProperty("selection", val, c.component()); + else if (valueForProperty("selection", c.component()) != null) + setValueForProperty("selection", null, c.component()); + } + if (associations.objectForKey("checked") != null) + setValueForProperty("checked", checked ? Boolean.TRUE : Boolean.FALSE, c.component()); + } }
\ No newline at end of file |
