< Day Day Up > |
Window events are sent by the portlet container when a user modifies the window's state by clicking control buttons such as the maximize or minimize buttons . To receive window events, you have to implement the WindowListener interface at the portlet class. Note The WindowEvent interface is deprecated; use PortletWindow.getWindowState() instead. In the next example, the doView() method checks whether the window is maximized to set a parameter that the JSP page uses to display more information about each entry of the agenda. Example 5-5. Get the window state.public void doView(PortletRequest request, PortletResponse response) throws PortletException, IOException { PortletWindow.State state = request.getWindow().getWindowState(); if ( state == PortletWindow.State.MAXIMIZED ) request.setAttribute("detail", "1"); else request.setAttribute("detail", "0"); ....... The JSP checks detail attribute and displays information depending on its value. Figure 5-1 and Figure 5-2 show the results depending on the window state. Figure 5-1. Information shown when the window is not maximized
Figure 5-2. Information shows when the window is maximized
|
< Day Day Up > |