1 5 package org.exoplatform.services.portal.model; 6 7 import java.util.* ; 8 14 public class Container extends Component { 15 private String title ; 16 private List children = new ArrayList(5) ; 17 18 public String getTitle() { return title ; } 19 public void setTitle(String 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 windowId) { 26 if(children == null) return null ; 27 for(int i = 0 ; i < children.size(); i++) { 28 Object 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 |