1 16 package org.apache.pluto.portlet.admin.bean; 17 18 import java.util.ArrayList ; 19 import java.util.Iterator ; 20 import java.util.List ; 21 22 import org.apache.pluto.portalImpl.om.page.impl.FragmentImpl; 23 import org.apache.pluto.portlet.admin.BaseAdminObject; 24 25 33 public class PageTO extends BaseAdminObject { 34 35 public static final String CLASS_NAME = "PageTO"; 36 37 private FragmentImpl _page = null; 38 private int _rows = 1; 40 private int _cols = 1; 41 private String _name = ""; 42 private String _title = ""; 43 private String _description = ""; 44 private List _portlets = new ArrayList (); 45 46 47 50 public PageTO() { 51 super(CLASS_NAME); 52 } 53 56 public PageTO(FragmentImpl page) { 57 super(CLASS_NAME); 58 _page = page; 59 } 60 61 64 public int getCols() { 65 return _cols; 66 } 67 71 public FragmentImpl getPage() { 72 return _page; 73 } 74 77 public void setPage(FragmentImpl page) { 78 _page = page; 79 _name = page.getName(); 80 } 81 84 public int getRows() { 85 return _rows; 86 } 87 88 91 public void setCols(int cols) { 92 _cols = cols; 93 } 94 97 public void setRows(int rows) { 98 _rows = rows; 99 } 100 public String getName() { 101 return _name; 102 } 103 104 107 public void setName(String name) { 108 _name = name; 109 } 110 public String getTitle(){ 111 return _title; 112 } 113 114 132 133 151 152 158 public PortletTO getPortlet(int row, int col) { 159 PortletTO portlet = null; 160 _portlets = getPortlets(); 161 Iterator iter = _portlets.iterator(); 162 while (iter.hasNext()) { 163 PortletTO plet = (PortletTO) iter.next(); 164 if (plet.getRow() == row && plet.getCol() == col) { 165 portlet = plet; 166 break; 167 } 168 } 169 return portlet; 170 } 171 172 177 public PortletTO getPortlet(String value) { 178 final String METHOD_NAME = "getPortlet(value)"; 179 logMethodStart(METHOD_NAME); 180 PortletTO portlet = null; 181 Iterator iter = _portlets.iterator(); 182 while (iter.hasNext()) { 183 PortletTO plet = (PortletTO) iter.next(); 184 if (plet.getValue().equals(value)) { 185 portlet = plet; 186 break; 187 } 188 } 189 logMethodEnd(METHOD_NAME, portlet); 190 return portlet; 191 } 192 193 194 199 public PortletTO getPortletByCell(int row, int col) { 200 final String METHOD_NAME = "getPortletByCell(row,col)"; 201 logMethodStart(METHOD_NAME); 202 PortletTO portlet = null; 203 Iterator iter = _portlets.iterator(); 204 while (iter.hasNext()) { 205 PortletTO plet = (PortletTO) iter.next(); 206 if (plet.getRow() == row && plet.getCol() == col) { 207 portlet = plet; 208 break; 209 } 210 } 211 logMethodEnd(METHOD_NAME, portlet); 212 return portlet; 213 } 214 215 218 public List getPortlets() { 219 return _portlets; 220 } 221 222 225 public void setPortlets(List portlets) { 226 _portlets = portlets; 227 } 228 231 public void setDescription(String description) { 232 _description = description; 233 } 234 237 public void setTitle(String title) { 238 _title = title; 239 } 240 243 public String getDescription() { 244 return _description; 245 } 246 247 public String toString(){ 248 StringBuffer sb = new StringBuffer (); 249 sb.append("Page[ "); 250 sb.append(_title); 251 sb.append(" Rows="); 252 sb.append(_rows); 253 sb.append(" Cols="); 254 sb.append(_cols); 255 sb.append(" Portlets[ "); 256 Iterator iter = _portlets.iterator(); 257 while (iter.hasNext()) { 258 PortletTO element = (PortletTO) iter.next(); 259 sb.append(element + " "); 260 } 261 sb.append("] ]"); 262 return sb.toString(); 263 } 264 } 265 | Popular Tags |