1 5 package com.opensymphony.webwork.views.xslt; 6 7 import org.apache.commons.logging.Log; 8 import org.apache.commons.logging.LogFactory; 9 10 import java.util.ArrayList ; 11 import java.util.Collection ; 12 import java.util.Iterator ; 13 import java.util.List ; 14 15 16 21 public class CollectionAdapter extends DefaultElementAdapter { 22 24 private Log log = LogFactory.getLog(this.getClass()); 25 26 28 public CollectionAdapter(DOMAdapter rootAdapter, AdapterNode parent, String propertyName, Object value) { 29 super(rootAdapter, parent, propertyName, value); 30 } 31 32 34 protected List buildChildrenAdapters() { 35 Collection values = (Collection ) getValue(); 36 List children = new ArrayList (values.size()); 37 38 for (Iterator i = values.iterator(); i.hasNext();) { 39 AdapterNode childAdapter = getRootAdapter().adapt(getRootAdapter(), this, "item", i.next()); 40 children.add(childAdapter); 41 42 if (log.isDebugEnabled()) { 43 log.debug(this + " adding adapter: " + childAdapter); 44 } 45 } 46 47 return children; 48 } 49 } 50 | Popular Tags |