Search in sources :

Example 1 with WindowStateException

use of javax.portlet.WindowStateException in project uPortal by Jasig.

the class DirectoryPortletController method submitSearch.

@ActionMapping
public void submitSearch(ActionRequest request, ActionResponse response, @RequestParam(value = "query", required = false) String query) {
    // Should we request to maximize?
    PortletPreferences prefs = request.getPreferences();
    boolean maximize = Boolean.parseBoolean(// default is true
    prefs.getValue(MAXIMIZE_ON_SEARCH_PREFERENCE, "true"));
    if (maximize) {
        try {
            response.setWindowState(WindowState.MAXIMIZED);
        } catch (WindowStateException e) {
            log.warn("Failed to set the window state to MAXIMIZED", e);
        }
    }
    // Forward the query parameter...
    if (query != null) {
        response.setRenderParameter("query", query);
    }
}
Also used : WindowStateException(javax.portlet.WindowStateException) PortletPreferences(javax.portlet.PortletPreferences) ActionMapping(org.springframework.web.portlet.bind.annotation.ActionMapping)

Aggregations

PortletPreferences (javax.portlet.PortletPreferences)1 WindowStateException (javax.portlet.WindowStateException)1 ActionMapping (org.springframework.web.portlet.bind.annotation.ActionMapping)1