On Sat, Apr 26, 2008 at 12:48 AM, Yung-Luen Lan <[EMAIL PROTECTED]> wrote:
>  package your.app;
>
>  import com.webobjects.appserver.*;
>  import com.webobjects.appserver._private.WODynamicElementCreationException;
>  import com.webobjects.foundation.*;
>
>  public class MyGenericContainer extends WODynamicElement {
>         protected NSDictionary<String, WOAssociation> extraBindings = null;
>         protected WOAssociation elementName;
>         protected WOElement children;
>
>         public MyGenericContainer(String n, NSDictionary<String,
>  WOAssociation> m, WOElement t) {
>         super(n, m, t);
>         elementName = m.objectForKey("elementName");
>         if (elementName == null) {
>                 throw new WODynamicElementCreationException("Need 
> elementName.");
>         }
>
>         if (m.count() > 1) {
>             NSMutableDictionary<String, WOAssociation> tempBindings =
>  m.mutableClone();
>                 tempBindings.removeObjectForKey("elementName");
>                 extraBindings = tempBindings.immutableClone();
>         }
>         children = t;
>         }
>
>         public void appendToResponse(WOResponse r, WOContext c) {
>                 r.appendContentString("<" + 
> elementName.valueInComponent(c.component()));
>                 if (extraBindings != null) {
>                         NSArray<String> allKeys = extraBindings.allKeys();
>                         for (String k : allKeys) {
>                                 WOAssociation binding = 
> extraBindings.objectForKey(k);
>                                 r.appendContentString(" " + k + "=\"" +
>  binding.valueInComponent(c.component()).toString() + "\"");
>                         }
>                 }
>                 r.appendContentString(">");

Forgot to add this line:
if (children != null)

>                 children.appendToResponse(r, c);
>                 r.appendContentString("</" +
>  elementName.valueInComponent(c.component()) + ">");
>         }
>  }
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to