KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > views > xslt > ArrayAdapter


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

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 JavaDoc;
11 import java.util.List JavaDoc;
12
13
14 /**
15  * @author <a HREF="mailto:meier@meisterbohne.de">Philipp Meier</a>
16  * Date: 14.10.2003
17  * Time: 18:59:07
18  */

19 public class ArrayAdapter extends DefaultElementAdapter {
20     //~ Instance fields ////////////////////////////////////////////////////////
21

22     private Log log = LogFactory.getLog(this.getClass());
23
24     //~ Constructors ///////////////////////////////////////////////////////////
25

26     public ArrayAdapter(DOMAdapter rootAdapter, AdapterNode parent, String JavaDoc propertyName, Object JavaDoc value) {
27         super(rootAdapter, parent, propertyName, value);
28     }
29
30     //~ Methods ////////////////////////////////////////////////////////////////
31

32     protected List JavaDoc buildChildrenAdapters() {
33         List JavaDoc children = new ArrayList JavaDoc();
34         Object JavaDoc[] values = (Object JavaDoc[]) getValue();
35
36         for (int i = 0; i < values.length; i++) {
37             AdapterNode childAdapter = getRootAdapter().adapt(getRootAdapter(), this, "item", values[i]);
38             children.add(childAdapter);
39
40             if (log.isDebugEnabled()) {
41                 log.debug(this + " adding adapter: " + childAdapter);
42             }
43         }
44
45         return children;
46     }
47 }
48
Popular Tags