@Override
  protected void writeAjaxPage(
      RenderRequest request, RenderResponse response, Window window, Application application)
      throws IOException, MalformedURLException, PortletException {
    MailApplication mailApplication = (MailApplication) application;

    // user is set in the portlet listener by the application
    if (mailApplication.getController().getUser() == null) {
      // normally, the portal takes care of this
      // this branch is in case the user has not been registered in the controller
      writeNotLoggedInPageHtml(request, response, window);
    } else if (PortletMode.VIEW.equals(request.getPortletMode())
        && WindowState.NORMAL.equals(request.getWindowState())) {
      mailApplication.writeViewPageHtml(request, response, window);
    } else {
      // this includes other modes as well as the maximized state
      super.writeAjaxPage(request, response, window, application);
    }
  }
 /**
  * Activate mode.
  *
  * @param newMode the mode
  * @throws Exception the exception
  */
 public void activateMode(PortletMode newMode) throws Exception {
   if (getChild(UIPresentationContainer.class) != null) {
     removeChild(UIPresentationContainer.class);
   }
   if (getChild(UISCVPreferences.class) != null) {
     removeChild(UISCVPreferences.class);
   }
   if (PortletMode.VIEW.equals(newMode)) {
     PortletRequestContext pContext =
         (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
     uiPresentation =
         addChild(
             UIPresentationContainer.class,
             null,
             UIPresentationContainer.class.getSimpleName() + pContext.getWindowId());
   } else if (PortletMode.EDIT.equals(newMode)) {
     popPreferences = addChild(UISCVPreferences.class, null, null);
     popPreferences.setInternalPreferencesMode(true);
   }
 }
Exemple #3
0
 /**
  * Check if the portlet current mode is view mode or not
  *
  * @param pContext The request context of a portlet
  * @return return true if current portlet mode is view mode; otherwise return false
  */
 public static boolean isPortletViewMode(PortletRequestContext pContext) {
   return PortletMode.VIEW.equals(pContext.getApplicationMode());
 }