KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > content > explorer > component > UIJCRChildrenInfo


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portlets.content.explorer.component;
6
7 import java.io.File JavaDoc;
8 import java.util.ArrayList JavaDoc;
9 import java.util.List JavaDoc;
10 import javax.jcr.Node ;
11 import javax.jcr.NodeIterator ;
12 import org.exoplatform.portlets.content.explorer.component.model.FileNodeDescriptor;
13 import org.exoplatform.portlets.content.explorer.component.model.NodeDescriptor;
14 import org.exoplatform.portlets.content.explorer.component.model.JCRNodeDescriptor;
15 /**
16  * @email: tuan08@users.sourceforge.net
17  * @version: $Id: UIContentDisplayer.java,v 1.2 2004/08/07 18:11:26 tuan08 Exp $
18  */

19 public class UIJCRChildrenInfo extends UIChildrenInfo {
20   
21   public void onRemove(UIExplorer uiExplorer, NodeDescriptor node) {
22   }
23   
24   public void onAddChild(UIExplorer uiExplorer, NodeDescriptor node) {
25   }
26   
27   protected List JavaDoc getChildren(UIExplorer uiExplorer, NodeDescriptor node) {
28     UIJCRExplorer explorer = (UIJCRExplorer) uiExplorer ;
29     List JavaDoc nodeChildren = new ArrayList JavaDoc() ;
30     String JavaDoc parentUri = node.getUri() ;
31     if ("/".equals(parentUri)) parentUri = "" ;
32     Node jcrNode = explorer.getCurrentNode() ;
33     try {
34       NodeIterator i = jcrNode.getNodes() ;
35       while(i.hasNext()) {
36         Node child = i.nextNode();
37         NodeDescriptor uiChild = new JCRNodeDescriptor(parentUri, child) ;
38         nodeChildren.add(uiChild) ;
39       }
40     } catch (Exception JavaDoc ex) {
41       ex.printStackTrace() ;
42     }
43     return nodeChildren ;
44   }
45 }
Popular Tags