You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Terry lee <Sp...@sqatester.com> on 2004/03/03 08:22:30 UTC

Minimize doesn't work when i add a custom portlet mode

Hi all,

  After i deploy the portlet in below, the minimize(window state) doesn't work , why??

---------------------------
...

	public void render(RenderRequest request, RenderResponse response) 
	throws PortletException, IOException{
		doDispatcher(request,response);
	} 
	  
	public void doDispatcher(RenderRequest request, RenderResponse response)
		throws PortletException, IOException{
		if(request.getPortletMode().equals(PortletMode.VIEW)){
			doView(request,response);
		}else if(request.getPortletMode().equals(PortletMode.EDIT)){
			doEdit(request,response);
		}else if(request.getPortletMode().equals(new PortletMode("CONFIG"))){
			doConfig(request,response);
		}
	}
	
	public void doConfig(RenderRequest request, RenderResponse response)
	  throws PortletException, IOException
	{
	  response.setContentType("text/html");

	  String jspName = getPortletConfig().getInitParameter("all");

	  PortletRequestDispatcher rd =
		getPortletContext().getRequestDispatcher(jspName);

	  rd.include(request, response);
	}

...

---------------------------

thanks in advance!

Terry

_____________________________________________________________
Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm

Re: Minimize doesn't work when i add a custom portlet mode

Posted by Stefan Hepper <st...@hursley.ibm.com>.
Terry lee wrote:

> Hi all,
> 
>   After i deploy the portlet in below, the minimize(window state) doesn't work , why??
> 
> ---------------------------
> ...
> 
> 	public void render(RenderRequest request, RenderResponse response) 
> 	throws PortletException, IOException{
> 		doDispatcher(request,response);
> 	} 
> 	  
> 	public void doDispatcher(RenderRequest request, RenderResponse response)
> 		throws PortletException, IOException{
> 		if(request.getPortletMode().equals(PortletMode.VIEW)){
> 			doView(request,response);
> 		}else if(request.getPortletMode().equals(PortletMode.EDIT)){
> 			doEdit(request,response);
> 		}else if(request.getPortletMode().equals(new PortletMode("CONFIG"))){
> 			doConfig(request,response);
> 		}
> 	}
> 	
> 	public void doConfig(RenderRequest request, RenderResponse response)
> 	  throws PortletException, IOException
> 	{
> 	  response.setContentType("text/html");
> 
> 	  String jspName = getPortletConfig().getInitParameter("all");
> 
> 	  PortletRequestDispatcher rd =
> 		getPortletContext().getRequestDispatcher(jspName);
> 
> 	  rd.include(request, response);
> 	}
> 
> ...
> 
> ---------------------------
> 
> thanks in advance!
> 
> Terry
> 
> _____________________________________________________________
> Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm
> 

that is because the generic portlet does the following in doDispatch 
before dispatching:

     if ( ! state.equals(WindowState.MINIMIZED)) {
       PortletMode mode = request.getPortletMode();


this line is missing in your code which means your portlets doXYZ 
methods will also be called in minimized (which me be of use for some 
portlets) and in the doXZY methods you do not check for the window state.

Stefan