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/WOSwitchComponent.java | |
| parent | ff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff) | |
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSwitchComponent.java')
| -rw-r--r-- | projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSwitchComponent.java | 160 |
1 files changed, 74 insertions, 86 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSwitchComponent.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSwitchComponent.java index d2e373a..6f42199 100644 --- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSwitchComponent.java +++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSwitchComponent.java @@ -23,90 +23,78 @@ import net.wotonomy.foundation.NSMutableDictionary; public class WOSwitchComponent extends WODynamicElement { - private NSMutableDictionary elements; - private String currentName; - private WOElement currentElement; - - protected WOSwitchComponent() - { - super(); - elements = new NSMutableDictionary(); - } - - public WOSwitchComponent(String aName, NSDictionary aMap, WOElement template) - { - super(aName, aMap, template); - elements = new NSMutableDictionary(); - } - - private WOElement getCurrentElement( WOContext c ) - { - String name = stringForProperty( "WOComponentName", c.component() ); - if ( name == null ) return null; - - if ( currentElement != null && name.equals( currentName ) ) return currentElement; - - currentName = name; - currentElement = (WOElement) elements.objectForKey( name ); - if ( currentElement == null ) - { - currentElement = WOApplication.application().pageWithName( name, c ); - if ( currentElement != null ) - { - currentElement.associations = associations; - elements.setObjectForKey( currentElement, name ); - } - } - - return currentElement; - } - - void ensureAwakeInContext (WOContext aContext) - { - if ( aContext != null ) - { - WOElement element = getCurrentElement( aContext ); - if ( element != null ) - { - aContext.pushElement( element ); - element.ensureAwakeInContext( aContext ); - aContext.popElement(); - } - } - } - - public void takeValuesFromRequest(WORequest r, WOContext c) - { - WOElement element = getCurrentElement( c ); - if ( element != null ) - { - c.pushElement( element ); - element.takeValuesFromRequest( r, c ); - c.popElement(); - } - } - - public WOActionResults invokeAction(WORequest r, WOContext c) - { - WOActionResults result = null; - WOElement element = getCurrentElement( c ); - if ( element != null ) - { - c.pushElement( element ); - result = element.invokeAction( r, c ); - c.popElement(); - } - return result; - } - - public void appendToResponse(WOResponse r, WOContext c) - { - WOElement element = getCurrentElement( c ); - if ( element != null ) - { - c.pushElement( element ); - element.appendToResponse( r, c ); - c.popElement(); - } - } + private NSMutableDictionary elements; + private String currentName; + private WOElement currentElement; + + protected WOSwitchComponent() { + super(); + elements = new NSMutableDictionary(); + } + + public WOSwitchComponent(String aName, NSDictionary aMap, WOElement template) { + super(aName, aMap, template); + elements = new NSMutableDictionary(); + } + + private WOElement getCurrentElement(WOContext c) { + String name = stringForProperty("WOComponentName", c.component()); + if (name == null) + return null; + + if (currentElement != null && name.equals(currentName)) + return currentElement; + + currentName = name; + currentElement = (WOElement) elements.objectForKey(name); + if (currentElement == null) { + currentElement = WOApplication.application().pageWithName(name, c); + if (currentElement != null) { + currentElement.associations = associations; + elements.setObjectForKey(currentElement, name); + } + } + + return currentElement; + } + + void ensureAwakeInContext(WOContext aContext) { + if (aContext != null) { + WOElement element = getCurrentElement(aContext); + if (element != null) { + aContext.pushElement(element); + element.ensureAwakeInContext(aContext); + aContext.popElement(); + } + } + } + + public void takeValuesFromRequest(WORequest r, WOContext c) { + WOElement element = getCurrentElement(c); + if (element != null) { + c.pushElement(element); + element.takeValuesFromRequest(r, c); + c.popElement(); + } + } + + public WOActionResults invokeAction(WORequest r, WOContext c) { + WOActionResults result = null; + WOElement element = getCurrentElement(c); + if (element != null) { + c.pushElement(element); + result = element.invokeAction(r, c); + c.popElement(); + } + return result; + } + + public void appendToResponse(WOResponse r, WOContext c) { + WOElement element = getCurrentElement(c); + if (element != null) { + c.pushElement(element); + element.appendToResponse(r, c); + c.popElement(); + } + } } |
