1 6 7 package javax.portlet; 8 9 10 11 39 public abstract class GenericPortlet implements Portlet, PortletConfig 40 { 41 42 private transient PortletConfig config; 43 44 47 48 public GenericPortlet() 49 { 50 } 51 52 53 81 82 public void init (PortletConfig config) throws PortletException 83 { 84 this.config = config; 85 this.init(); 86 } 87 88 89 105 106 public void init() throws PortletException 107 { 108 } 109 110 111 132 public void processAction (ActionRequest request, ActionResponse response) 133 throws PortletException, java.io.IOException { 134 throw new PortletException("processAction method not implemented"); 135 } 136 137 138 158 public void render (RenderRequest request, 159 RenderResponse response) 160 throws PortletException, java.io.IOException 161 { 162 response.setTitle(getTitle(request)); 163 doDispatch(request, response); 164 } 165 166 184 185 protected java.lang.String getTitle(RenderRequest request) { 186 return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title"); 187 } 188 189 190 225 protected void doDispatch (RenderRequest request, 226 RenderResponse response) throws PortletException,java.io.IOException 227 { 228 WindowState state = request.getWindowState(); 229 230 if ( ! state.equals(WindowState.MINIMIZED)) { 231 PortletMode mode = request.getPortletMode(); 232 if (mode.equals(PortletMode.VIEW)) { 233 doView (request, response); 234 } 235 else if (mode.equals(PortletMode.EDIT)) { 236 doEdit (request, response); 237 } 238 else if (mode.equals(PortletMode.HELP)) { 239 doHelp (request, response); 240 } 241 else { 242 throw new PortletException("unknown portlet mode: " + mode); 243 } 244 } 245 246 } 247 248 249 269 270 protected void doView (RenderRequest request, 271 RenderResponse response) 272 throws PortletException, java.io.IOException 273 { 274 throw new PortletException("doView method not implemented"); 275 } 276 277 278 298 299 protected void doEdit (RenderRequest request, 300 RenderResponse response) 301 throws PortletException, java.io.IOException 302 { 303 throw new PortletException("doEdit method not implemented"); 304 } 305 306 325 326 protected void doHelp (RenderRequest request, 327 RenderResponse response) 328 throws PortletException, java.io.IOException 329 { 330 throw new PortletException("doHelp method not implemented"); 331 332 } 333 334 335 336 341 342 public PortletConfig getPortletConfig () 343 { 344 return config; 345 } 346 347 348 355 356 public void destroy () 357 { 358 } 360 361 365 366 373 374 public String getPortletName () 375 { 376 return config.getPortletName(); 377 } 378 379 380 386 387 public PortletContext getPortletContext () 388 { 389 return config.getPortletContext(); 390 } 391 392 393 394 402 403 public java.util.ResourceBundle getResourceBundle(java.util.Locale locale) 404 { 405 return config.getResourceBundle(locale); 406 } 407 408 409 422 423 public String getInitParameter(java.lang.String name) 424 { 425 return config.getInitParameter(name); 426 } 427 428 429 439 440 public java.util.Enumeration getInitParameterNames() 441 { 442 return config.getInitParameterNames(); 443 } 444 } 445 | Popular Tags |