1 48 49 package com.caucho.portal.generic; 50 51 import javax.portlet.PortletContext; 52 import javax.portlet.PortletException; 53 import java.io.IOException ; 54 import java.util.ArrayList ; 55 import java.util.logging.Level ; 56 import java.util.logging.Logger ; 57 58 61 public class GenericLayoutWindow 62 extends GenericWindow 63 { 64 static protected final Logger log = 65 Logger.getLogger(GenericLayoutWindow.class.getName()); 66 67 private ArrayList <GenericWindow> _children 68 = new ArrayList <GenericWindow>(); 69 70 public GenericLayoutWindow() 71 { 72 } 73 74 77 public void add(GenericWindow window) 78 { 79 _children.add(window); 80 } 81 82 89 public void addWindow(GenericPortletWindow portletWindow) 90 { 91 _children.add(portletWindow); 92 } 93 94 101 public void addLayout(GenericLayoutWindow layoutWindow) 102 { 103 _children.add(layoutWindow); 104 } 105 106 109 public void init(PortletContext portletContext) 110 throws PortletException 111 { 112 super.init(portletContext); 113 114 for (int i = 0; i < _children.size(); i++) { 115 _children.get(i).init(portletContext); 116 } 117 } 118 119 123 public void processAction(PortletConnection connection) 124 throws PortletException, IOException 125 { 126 Action action = connection.getAction(this, getNamespace()); 127 128 if (action != null) { 129 try { 130 for (int i = 0; i < _children.size(); i++) { 131 _children.get(i).processAction(connection); 132 } 133 } 134 finally { 135 action.finish(); 136 } 137 } 138 } 139 140 144 public void render(PortletConnection connection) 145 throws PortletException, IOException 146 { 147 Render render = connection.getRender(this, getNamespace()); 148 149 if (render != null) { 150 try { 151 for (int i = 0; i < _children.size(); i++) { 152 _children.get(i).render(connection); 153 } 154 } 155 finally { 156 render.finish(); 157 } 158 } 159 } 160 161 164 public void destroy() 165 { 166 ArrayList <GenericWindow> children 167 = new ArrayList <GenericWindow>(_children); 168 169 _children.clear(); 170 171 for (int i = 0; i < children.size(); i++) { 172 try { 173 children.get(i).destroy(); 174 } 175 catch (Exception ex) { 176 log.log(Level.WARNING, ex.toString(), ex); 177 } 178 } 179 } 180 } 181 182 | Popular Tags |