KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portal > model > Container


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.services.portal.model;
6
7 import java.util.* ;
8 /**
9  * May 13, 2004
10  * @author: Tuan Nguyen
11  * @email: tuan08@users.sourceforge.net
12  * @version: $Id: Container.java,v 1.8 2004/11/03 01:23:55 tuan08 Exp $
13  **/

14 public class Container extends Component {
15   private String JavaDoc title ;
16   private List children = new ArrayList(5) ;
17   
18   public String JavaDoc getTitle() { return title ; }
19   public void setTitle(String JavaDoc s) { title = s ; }
20   
21   public List getChildren() { return children ; }
22   public void setChildren(List l) { children = l ; }
23   public void addChild(Component comp) { children.add(comp) ; }
24   
25   public Portlet findPortletByWindowId(String JavaDoc windowId) {
26     if(children == null) return null ;
27     for(int i = 0 ; i < children.size(); i++) {
28         Object JavaDoc child = children.get(i) ;
29         if(child instanceof Portlet) {
30             Portlet portlet = (Portlet) child ;
31             if(windowId.equals(portlet.getWindowId())) return portlet ;
32         } else if (child instanceof Container){
33             Container container = (Container) child ;
34             Portlet portlet = container.findPortletByWindowId(windowId) ;
35             if(portlet != null) return portlet ;
36         }
37     }
38     return null ;
39   }
40   
41   public Component softCloneObject() {
42     Container container = new Container() ;
43     container.copyBasicProperties(this) ;
44     container.setTitle(title) ;
45     container.getChildren().addAll(children) ;
46     return container ;
47   }
48 }
Popular Tags