Java 类javax.portlet.WindowState 实例源码

项目:spring4-understanding    文件:AbstractController.java   
@Override
public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws Exception {
    // If the portlet is minimized and we don't want to render then return null.
    if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) {
        return null;
    }

    // Delegate to PortletContentGenerator for checking and preparing.
    checkAndPrepare(request, response);

    // Execute in synchronized block if required.
    if (this.synchronizeOnSession) {
        PortletSession session = request.getPortletSession(false);
        if (session != null) {
            Object mutex = PortletUtils.getSessionMutex(session);
            synchronized (mutex) {
                return handleRenderRequestInternal(request, response);
            }
        }
    }

    return handleRenderRequestInternal(request, response);
}
项目:spring4-understanding    文件:AbstractHandlerExceptionResolver.java   
/**
 * Check whether this resolver is supposed to apply to the given handler.
 * <p>The default implementation checks against the specified mapped handlers
 * and handler classes, if any, and also checks the window state (according
 * to the "renderWhenMinimize" property).
 * @param request current portlet request
 * @param handler the executed handler, or {@code null} if none chosen at the
 * time of the exception (for example, if multipart resolution failed)
 * @return whether this resolved should proceed with resolving the exception
 * for the given request and handler
 * @see #setMappedHandlers
 * @see #setMappedHandlerClasses
 */
protected boolean shouldApplyTo(PortletRequest request, Object handler) {
    // If the portlet is minimized and we don't want to render then return null.
    if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) {
        return false;
    }
    // Check mapped handlers...
    if (handler != null) {
        if (this.mappedHandlers != null && this.mappedHandlers.contains(handler)) {
            return true;
        }
        if (this.mappedHandlerClasses != null) {
            for (Class<?> mappedClass : this.mappedHandlerClasses) {
                if (mappedClass.isInstance(handler)) {
                    return true;
                }
            }
        }
    }
    // Else only apply if there are no explicit handler mappings.
    return (this.mappedHandlers == null && this.mappedHandlerClasses == null);
}
项目:cacheonix-core    文件:WelcomePortlet.java   
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<h1>Welcome to the Pet Portal!</h1>");
    if(request.getWindowState().equals(WindowState.MAXIMIZED)) {
        out.println("<p>This portlet delegates to an existing JSR-168 portlet via a HandlerAdapter</p>");
        out.println("<p>(see WEB-INF/context/welcome-context.xml for the details).</p>");
        out.println("<p>Portlet Name: " + this.getPortletName() + "</p>");
        out.println("<p>Init Parameters:</p><ul>");
        for (Enumeration e = this.getInitParameterNames(); e.hasMoreElements();) {
                String name = (String)e.nextElement();
                out.println("<li>" + name + " = " + this.getInitParameter(name) + "</li>");
        }
        out.println("</ul>");
        out.println("<p>Your Locale: " + request.getLocale().toString() + "</p>");
    }
}
项目:sakai    文件:PortletStateTest.java   
public void testSerialization() throws IOException, ClassNotFoundException
{
    PortletState state = new PortletState("id");
    state.setPortletMode(PortletMode.VIEW);
    state.setWindowState(WindowState.MAXIMIZED);

    ByteArrayOutputStream bao = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bao);

    out.writeObject(state);

    ByteArrayInputStream bai = new ByteArrayInputStream(bao.toByteArray());
    ObjectInputStream in = new ObjectInputStream(bai);
    PortletState alter = (PortletState) in.readObject();

    assertEquals(state, alter);

}
项目:sakai    文件:SimplePortletStateEncoderTest.java   
public void testEncodeDecode()
{
    PortletState state = new PortletState("id");
    state.setAction(true);
    state.setSecure(true);
    state.setWindowState(WindowState.MAXIMIZED);
    state.setPortletMode(PortletMode.EDIT);

    String uriSafe = encoder.encode(state);
    PortletState read = encoder.decode(uriSafe);
    assertEquals(state.getId(), read.getId());
    assertEquals(state.isAction(), read.isAction());
    assertEquals(state.isSecure(), read.isSecure());
    assertEquals(state.getWindowState(), read.getWindowState());
    assertEquals(state.getPortletMode(), read.getPortletMode());
}
项目:eterna    文件:RenderExecute.java   
public ModelExport execute(AppData data, Connection conn)
        throws ConfigurationException, SQLException, IOException
{
    WindowState state = data.renderRequest.getWindowState();
    if (!state.equals(WindowState.MINIMIZED))
    {
        PortletMode mode = data.renderRequest.getPortletMode();
        if (PortletMode.VIEW.equals(mode))
        {
            return this.view;
        }
        else if (PortletMode.EDIT.equals(mode))
        {
            return this.edit;
        }
        else if (PortletMode.HELP.equals(mode))
        {
            return this.help;
        }
        else
        {
            log.error("Unknown portlet mode: " + mode + ".");
        }
    }
    return null;
}
项目:class-guard    文件:AbstractController.java   
public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws Exception {
    // If the portlet is minimized and we don't want to render then return null.
    if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) {
        return null;
    }

    // Delegate to PortletContentGenerator for checking and preparing.
    checkAndPrepare(request, response);

    // Execute in synchronized block if required.
    if (this.synchronizeOnSession) {
        PortletSession session = request.getPortletSession(false);
        if (session != null) {
            Object mutex = PortletUtils.getSessionMutex(session);
            synchronized (mutex) {
                return handleRenderRequestInternal(request, response);
            }
        }
    }

    return handleRenderRequestInternal(request, response);
}
项目:sakai    文件:SimplePortletStateEncoderTest.java   
public void testEncodeDecode()
{
    PortletState state = new PortletState("id");
    state.setAction(true);
    state.setSecure(true);
    state.setWindowState(WindowState.MAXIMIZED);
    state.setPortletMode(PortletMode.EDIT);

    String uriSafe = encoder.encode(state);
    PortletState read = encoder.decode(uriSafe);
    assertEquals(state.getId(), read.getId());
    assertEquals(state.isAction(), read.isAction());
    assertEquals(state.isSecure(), read.isSecure());
    assertEquals(state.getWindowState(), read.getWindowState());
    assertEquals(state.getPortletMode(), read.getPortletMode());
}
项目:jukebox-portlet    文件:ArtistAssetRenderer.java   
@Override
public PortletURL getURLView(
        LiferayPortletResponse liferayPortletResponse,
        WindowState windowState)
    throws Exception {

    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
        ArtistsPortlet.PORTLET_ID, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("jspPage", "/html/artists/view_artist.jsp");
    portletURL.setParameter(
        "artistId", String.valueOf(_artist.getArtistId()));
    portletURL.setWindowState(windowState);

    return portletURL;
}
项目:portals-pluto    文件:IsMaximizedTag.java   
public int doStartTag() throws JspException {
    PortalRequestContext portalEnv = PortalRequestContext.getContext(
            (HttpServletRequest) pageContext.getRequest());

    PortalURL portalURL = portalEnv.getRequestedPortalURL();

    // Check if someone else is maximized. If yes, don't show content.
    Map windowStates = portalURL.getWindowStates();
    for (Iterator it = windowStates.values().iterator(); it.hasNext();) {
        WindowState windowState = (WindowState) it.next();
        if (WindowState.MAXIMIZED.equals(windowState)) {
            pageContext.setAttribute(var, Boolean.TRUE);
            break;
        }
    }
    return SKIP_BODY;
}
项目:portals-pluto    文件:PortletURLTag168.java   
/**
 * Provides a list of all static WindowsStates available in the specifications by using introspection
 * 
 * @return Hashtable
 */
private static Hashtable<String, Object> getDefinedWindowStates() {
   Hashtable<String, Object> definedWindowStates = new Hashtable<String, Object>();
   Field[] f = WindowState.class.getDeclaredFields();

   for (int i = 0; i < f.length; i++) {
      if (f[i].getType().isAssignableFrom(javax.portlet.WindowState.class)) {
         try {
            definedWindowStates.put(f[i].get(f[i]).toString().toUpperCase(), f[i].get(f[i]));
         } catch (IllegalAccessException e) {

         }
      }
   }
   return definedWindowStates;
}
项目:portals-pluto    文件:ExceptionTests_WindowStateException_ApiRender.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
    throws PortletException, IOException {

  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2ExceptionTests_WindowStateException_ApiRender_getState */
  /* Details: "Method getState(): Returns the WindowState object */
  /* causing this exception" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2EXCEPTIONTESTS_WINDOWSTATEEXCEPTION_APIRENDER_GETSTATE);
  WindowState ws = new WindowState("teststate");
  WindowStateException wse = new WindowStateException("Unsupported State Causing Exception", ws);
  if (wse.getState().toString().equals("teststate")) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

}
项目:portals-pluto    文件:Utils.java   
public boolean checkEqualStateAwareResponse(
      StateAwareResponse injectedPortletArtifact,
      StateAwareResponse stateAwareResponse) {
   if (injectedPortletArtifact.equals(stateAwareResponse)) {
      return true;
   }
   PortletMode injectedPortletMode = injectedPortletArtifact
         .getPortletMode();
   PortletMode portletPortletMode = stateAwareResponse.getPortletMode();
   WindowState injectedWindowState = injectedPortletArtifact
         .getWindowState();
   WindowState portletWindowState = stateAwareResponse.getWindowState();
   MutableRenderParameters injectedMutableRenderParams = injectedPortletArtifact
         .getRenderParameters();
   MutableRenderParameters portletMutableRenderParams = stateAwareResponse
         .getRenderParameters();
   if (checkEqualResponses(injectedPortletArtifact, stateAwareResponse)
         && injectedPortletMode.equals(portletPortletMode)
         && injectedWindowState.equals(portletWindowState)
         && checkEqualParameters(injectedMutableRenderParams,
               portletMutableRenderParams)) {
      return true;
   } else {
      return false;
   }
}
项目:sakai    文件:PortletStateTest.java   
public void testSerialization() throws IOException, ClassNotFoundException
{
    PortletState state = new PortletState("id");
    state.setPortletMode(PortletMode.VIEW);
    state.setWindowState(WindowState.MAXIMIZED);

    ByteArrayOutputStream bao = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bao);

    out.writeObject(state);

    ByteArrayInputStream bai = new ByteArrayInputStream(bao.toByteArray());
    ObjectInputStream in = new ObjectInputStream(bai);
    PortletState alter = (PortletState) in.readObject();

    assertEquals(state, alter);

}
项目:liferay-gsearch    文件:BaseResultItemBuilder.java   
/**
 * {@inheritDoc}
 */
@Override
public String getLink()
    throws Exception {

    StringBundler sb = new StringBundler();
    sb.append(
        getAssetRenderer().getURLView(
            (LiferayPortletResponse) _portletResponse,
            WindowState.MAXIMIZED));

    return sb.toString();
}
项目:spring4-understanding    文件:AnnotationMethodHandlerAdapter.java   
public boolean match(PortletRequest request) {
    if (!this.modes.isEmpty() && !this.modes.contains(request.getPortletMode())) {
        return false;
    }
    if (StringUtils.hasLength(this.phase) &&
            !this.phase.equals(request.getAttribute(PortletRequest.LIFECYCLE_PHASE))) {
        return false;
    }
    if (StringUtils.hasLength(this.value)) {
        if (this.phase.equals(PortletRequest.ACTION_PHASE) &&
                !this.value.equals(request.getParameter(ActionRequest.ACTION_NAME))) {
            return false;
        }
        else if (this.phase.equals(PortletRequest.RENDER_PHASE) &&
                !(new WindowState(this.value)).equals(request.getWindowState())) {
            return false;
        }
        else if (this.phase.equals(PortletRequest.RESOURCE_PHASE) &&
                !this.value.equals(((ResourceRequest) request).getResourceID())) {
            return false;
        }
        else if (this.phase.equals(PortletRequest.EVENT_PHASE)) {
            Event event = ((EventRequest) request).getEvent();
            if (!this.value.equals(event.getName()) && !this.value.equals(event.getQName().toString())) {
                return false;
            }
        }
    }
    return (PortletAnnotationMappingUtils.checkRequestMethod(this.methods, request) &&
            PortletAnnotationMappingUtils.checkParameters(this.params, request) &&
            PortletAnnotationMappingUtils.checkHeaders(this.headers, request));
}
项目:spring4-understanding    文件:SimpleMappingExceptionResolverTests.java   
@Test
public void defaultNoRenderWhenMinimized() {
    exceptionResolver.setDefaultErrorView(DEFAULT_VIEW);
    request.setWindowState(WindowState.MINIMIZED);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertNull("Should not render when WindowState is MINIMIZED", mav);
}
项目:spring4-understanding    文件:SimpleMappingExceptionResolverTests.java   
@Test
public void doRenderWhenMinimized() {
    exceptionResolver.setDefaultErrorView(DEFAULT_VIEW);
    exceptionResolver.setRenderWhenMinimized(true);
    request.setWindowState(WindowState.MINIMIZED);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertNotNull("ModelAndView should not be null", mav);
    assertEquals(DEFAULT_VIEW, mav.getViewName());
}
项目:spring4-understanding    文件:MockPortletURL.java   
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
    if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) {
        throw new WindowStateException("WindowState not supported", windowState);
    }
    this.windowState = windowState;
}
项目:spring4-understanding    文件:MockPortalContext.java   
/**
 * Create a new MockPortalContext
 * with default PortletModes (VIEW, EDIT, HELP)
 * and default WindowStates (NORMAL, MAXIMIZED, MINIMIZED).
 * @see javax.portlet.PortletMode
 * @see javax.portlet.WindowState
 */
public MockPortalContext() {
    this.portletModes = new ArrayList<PortletMode>(3);
    this.portletModes.add(PortletMode.VIEW);
    this.portletModes.add(PortletMode.EDIT);
    this.portletModes.add(PortletMode.HELP);

    this.windowStates = new ArrayList<WindowState>(3);
    this.windowStates.add(WindowState.NORMAL);
    this.windowStates.add(WindowState.MAXIMIZED);
    this.windowStates.add(WindowState.MINIMIZED);
}
项目:spring4-understanding    文件:MockStateAwareResponse.java   
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
    if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) {
        throw new WindowStateException("WindowState not supported", windowState);
    }
    this.windowState = windowState;
}
项目:spring4-understanding    文件:MockActionResponse.java   
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
    if (this.redirectedUrl != null) {
        throw new IllegalStateException("Cannot set WindowState after sendRedirect has been called");
    }
    super.setWindowState(windowState);
    this.redirectAllowed = false;
}
项目:spring4-understanding    文件:MockPortletURL.java   
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
    if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) {
        throw new WindowStateException("WindowState not supported", windowState);
    }
    this.windowState = windowState;
}
项目:spring4-understanding    文件:MockPortalContext.java   
/**
 * Create a new MockPortalContext
 * with default PortletModes (VIEW, EDIT, HELP)
 * and default WindowStates (NORMAL, MAXIMIZED, MINIMIZED).
 * @see javax.portlet.PortletMode
 * @see javax.portlet.WindowState
 */
public MockPortalContext() {
    this.portletModes = new ArrayList<PortletMode>(3);
    this.portletModes.add(PortletMode.VIEW);
    this.portletModes.add(PortletMode.EDIT);
    this.portletModes.add(PortletMode.HELP);

    this.windowStates = new ArrayList<WindowState>(3);
    this.windowStates.add(WindowState.NORMAL);
    this.windowStates.add(WindowState.MAXIMIZED);
    this.windowStates.add(WindowState.MINIMIZED);
}
项目:spring4-understanding    文件:MockStateAwareResponse.java   
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
    if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) {
        throw new WindowStateException("WindowState not supported", windowState);
    }
    this.windowState = windowState;
}
项目:spring4-understanding    文件:MockActionResponse.java   
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
    if (this.redirectedUrl != null) {
        throw new IllegalStateException("Cannot set WindowState after sendRedirect has been called");
    }
    super.setWindowState(windowState);
    this.redirectAllowed = false;
}
项目:liferaylms-portlet    文件:LearningActivityBaseAssetRenderer.java   
@Override
public final PortletURL getURLView(LiferayPortletResponse liferayPortletResponse,
        WindowState windowState) throws Exception {

    String portletId;

    if(_isRuntimePortlet){
        portletId = ACTIVITY_VIEWER_PORTLET_ID;
    }else{
        portletId = _portletId;
    }

    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(_layout.getPlid(),portletId, PortletRequest.RENDER_PHASE);
    portletURL.setWindowState(windowState);
    portletURL.setParameter("actId",Long.toString( _learningactivity.getActId()));
    portletURL.setParameter("moduleId",Long.toString( _learningactivity.getModuleId()));
    portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
    portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
    portletURL.setParameter("actionEditingModule", StringPool.FALSE);
    portletURL.setParameter("actionCalifications", StringPool.FALSE);
    portletURL.setParameter("activityStarted", StringPool.TRUE);

    long userId = PrincipalThreadLocal.getUserId();

    if(Validator.isNotNull(userId)) {
        String mvcPath = getMvcPathView(userId,liferayPortletResponse,windowState);
        if(Validator.isNotNull(mvcPath)){
            portletURL.setParameter("mvcPath",mvcPath);
        }
    }

    prepareRuntimePortlet(portletURL);

    log.debug("portletURL::"+portletURL.toString());

    return portletURL;
}
项目:liferaylms-portlet    文件:LiferayViewUtil.java   
public static void setWindowStateRenderParameter(ActionResponse actionResponse,WindowState winState) throws WindowStateException
{
    actionResponse.setWindowState(winState);
    actionResponse.setRenderParameter("p_p_state", winState.toString()); 
        // En teor�a el par�metro windowState del actionURL deber�a ser suficiente,
        // y el setWindowState deber�a ser una in�til reiteraci�n, pero aun as�
        // lo �nico que funciona es poner A PELO el p_p_state, o hago algo mal o es penoso en fin...        
}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
public static final PortletURL getURLCalifications(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, LearningActivity activity) throws Exception {

    long plid = PortalUtil.getPlidFromPortletId(activity.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);

    log.debug("PLID: "+plid);

    if (plid == LayoutConstants.DEFAULT_PLID) {
        throw new NoSuchLayoutException();
    }       

    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITACTIVITY_PORTLET_ID, PortletRequest.RENDER_PHASE);
    portletURL.setWindowState(WindowState.NORMAL);

    portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
    portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
    portletURL.setParameter("actionEditingModule", StringPool.FALSE);
    portletURL.setParameter("actionCalifications", StringPool.TRUE);
    portletURL.setParameter("actId",Long.toString( activity.getActId()));

    long userId = PrincipalThreadLocal.getUserId();

    if(Validator.isNotNull(userId)) {           
        //portletURL.setParameter("mvcPath", "/html/editactivity/editactivity.jsp");
        portletURL.setParameter("califications", StringPool.TRUE);
        portletURL.setParameter("editing", StringPool.FALSE);
        portletURL.setParameter("resId",Long.toString( activity.getActId()));
        portletURL.setParameter("resModuleId",Long.toString( activity.getModuleId())); 
    }

    portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);

    //log.debug(" getURLCalifications: "+portletURL);

    return portletURL;      
}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
public static final PortletURL getURLEditActivity(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, LearningActivity activity) throws Exception {
    PortletURL portletURL = null;
    if(activity!=null){
        long plid = PortalUtil.getPlidFromPortletId(activity.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);


        log.debug("PLID: "+plid);

        if (plid == LayoutConstants.DEFAULT_PLID) {
            throw new NoSuchLayoutException();
        }       

        portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITACTIVITY_PORTLET_ID, PortletRequest.RENDER_PHASE);
        portletURL.setWindowState(WindowState.NORMAL);
        portletURL.setParameter("actId",Long.toString( activity.getActId()));
        portletURL.setParameter("moduleId",Long.toString( activity.getModuleId()));
        portletURL.setParameter("actionEditingActivity", StringPool.TRUE);
        portletURL.setParameter("actionCalifications", StringPool.FALSE);
        portletURL.setParameter("actionEditingModule", StringPool.FALSE);
        portletURL.setParameter("actionEditingDetails", StringPool.FALSE);


        long userId = PrincipalThreadLocal.getUserId();

        if(Validator.isNotNull(userId)) {           
            portletURL.setParameter("mvcPath", "/html/editactivity/editactivity.jsp");
            portletURL.setParameter("editing", StringPool.TRUE);
            portletURL.setParameter("resId",Long.toString( activity.getActId()));
            portletURL.setParameter("resModuleId",Long.toString( activity.getModuleId())); 
        }

        portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);

        //log.debug(" getURLEditActivity: "+portletURL);

    }
    return portletURL;

}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
public static final PortletURL getURLCreateActivity(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, Module module) throws Exception {
    PortletURL portletURL = null;
    if(module!=null){
        long plid = PortalUtil.getPlidFromPortletId(module.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);

        log.debug("PLID: "+plid);

        if (plid == LayoutConstants.DEFAULT_PLID) {
            throw new NoSuchLayoutException();
        }       

        portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITACTIVITY_PORTLET_ID, PortletRequest.RENDER_PHASE);
        portletURL.setWindowState(WindowState.NORMAL);
        portletURL.setParameter("actionEditingActivity", StringPool.TRUE);
        portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
        portletURL.setParameter("mvcPath", "/html/lmsactivitieslist/newactivity.jsp");
        portletURL.setParameter("resModuleId",Long.toString(module.getModuleId()));     
        portletURL.setParameter("actId",Long.toString(0)); 
        portletURL.setParameter("resId",Long.toString(0)); 
        portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);

        log.debug(" getURLCreateActivity: "+portletURL);

    }

    return portletURL;      
}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
public static final PortletURL getURLEditModule(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, Module module) throws Exception {

    PortletURL portletURL = null;
    if(module!=null){
        long plid = PortalUtil.getPlidFromPortletId(module.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);

        log.debug("PLID: "+plid);

        if (plid == LayoutConstants.DEFAULT_PLID) {
            throw new NoSuchLayoutException();
        }

        portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITMODULE_PORTLET_ID, PortletRequest.RENDER_PHASE);
        portletURL.setWindowState(WindowState.NORMAL);
        portletURL.setParameter("actionEditingModule", StringPool.TRUE);
        portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
        portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
        portletURL.setParameter("actionCalifications", StringPool.FALSE);
        portletURL.setParameter("view", "editmodule");
        portletURL.setParameter("moduleId",Long.toString(module.getModuleId()));
        portletURL.setParameter("actId","");
        portletURL.setParameter("resourcePrimKey",Long.toString(module.getModuleId()));     
        portletURL.setParameter("editType","edit");     
        portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);

        //log.debug(" getURLEditModule: "+portletURL);
    }


    return portletURL;      
}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
public static final PortletURL getURLCreateModule(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, ThemeDisplay themeDisplay) throws Exception {

    Layout layout = null;       

    @SuppressWarnings("unchecked")
    List<Layout> layouts = LayoutLocalServiceUtil.dynamicQuery(LayoutLocalServiceUtil.dynamicQuery().
            add(PropertyFactoryUtil.forName("privateLayout").eq(false)).
            add(PropertyFactoryUtil.forName("type").eq(LayoutConstants.TYPE_PORTLET)).
            add(PropertyFactoryUtil.forName("companyId").eq(themeDisplay.getCompanyId())).
            add(PropertyFactoryUtil.forName("groupId").eq(themeDisplay.getScopeGroupId())).
            add(PropertyFactoryUtil.forName("friendlyURL").eq("/reto")), 0, 1);

    if(layouts.isEmpty()) {
        throw new NoSuchLayoutException();          
    }

    layout = layouts.get(0);        


    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(layout.getPlid(), LMS_EDITMODULE_PORTLET_ID, PortletRequest.RENDER_PHASE);
    portletURL.setWindowState(WindowState.NORMAL);
    portletURL.setParameter("actionEditingModule", StringPool.TRUE);
    portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
    portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
    portletURL.setParameter("actionCalifications", StringPool.FALSE);
    portletURL.setParameter("view", "editmodule");
    portletURL.setParameter("moduleId",Long.toString(0));
    portletURL.setParameter("actId","");
    portletURL.setParameter("resourcePrimKey",Long.toString(0));        
    portletURL.setParameter("editType","add");      
    portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);

    //log.debug(" getURLCreateModule: "+portletURL);

    return portletURL;      
}
项目:liferaylms-portlet    文件:ExecActivity.java   
public void setBankTest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{

    long actId = ParamUtil.getLong(actionRequest, "actId", 0);
    String redirect = actionRequest.getParameter("redirect");
    String isMultiple = ParamUtil.getString(actionRequest, "banks-multipleselections", "false");
    String isBank = ParamUtil.getString(actionRequest, "is-bank", "false"); 
    String assetCategoryIds = ParamUtil.getString(actionRequest, "assetCategoryIds", StringPool.BLANK);
    long[] longCategoryIds = GetterUtil.getLongValues(StringUtil.split(assetCategoryIds));

    AssetEntryQuery entryQuery = new AssetEntryQuery();
    entryQuery.setAllCategoryIds(longCategoryIds);

    if(!Validator.equals(AssetEntryLocalServiceUtil.getEntries(entryQuery).size(), 0)){
        LearningActivityLocalServiceUtil.setExtraContentValue(actId,"isBank", isBank);
        LearningActivityLocalServiceUtil.setExtraContentValue(actId,"isMultiple", isMultiple);
        if(!StringPool.BLANK.equals(assetCategoryIds)){
            LearningActivityLocalServiceUtil.setExtraContentValue(actId,"categoriesId", assetCategoryIds);
            SessionMessages.add(actionRequest,"data-exist-for-these-categories");
        }else{
            SessionErrors.add(actionRequest, "error-selector-categories-empty");
        }
    }else{
        SessionErrors.add(actionRequest, "error-not-results");
    }

    WindowState windowState = actionRequest.getWindowState();
    if (Validator.isNotNull(redirect)) {
        if (!windowState.equals(LiferayWindowState.POP_UP)) {
            actionResponse.sendRedirect(redirect);
        }
        else {
            redirect = PortalUtil.escapeRedirect(redirect);
            if (Validator.isNotNull(redirect)) {
                actionResponse.sendRedirect(redirect);
            }
        }
    }

}
项目:liferaylms-portlet    文件:EvaluationAvgPortlet.java   
@Override
public void doView(RenderRequest renderRequest,
        RenderResponse renderResponse) throws IOException, PortletException {

    if(ParamUtil.getBoolean(renderRequest, WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,false)){
        if(WindowState.MAXIMIZED.equals(renderRequest.getWindowState())){
            renderRequest.setAttribute(WebKeys.PORTLET_DECORATE, Boolean.TRUE);
        }

        super.doView(renderRequest, renderResponse);
    }
    else {
        renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.FALSE);
    }
}
项目:liferaylms-portlet    文件:TestAssetRenderer.java   
@Override
protected String getMvcPathView(long userId,
        LiferayPortletResponse liferayPortletResponse,
        WindowState windowState) throws Exception {

    if((getLearningactivity().getTries()==0)||
       (Validator.isNotNull(LearningActivityTryLocalServiceUtil.getLearningActivityTryNotFinishedByActUser(getLearningactivity().getActId(), userId)))) {
        return "/html/execactivity/test/view.jsp";
    }
    else {
        return "/html/execactivity/test/preview.jsp";
    }
}
项目:liferaylms-portlet    文件:CourseAssetRenderer.java   
@Override
public final PortletURL getURLView(LiferayPortletResponse liferayPortletResponse,
        WindowState windowState) throws Exception {
    Group courseGroup= GroupLocalServiceUtil.getGroup(_course.getGroupCreatedId());
    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(courseGroup.getDefaultPublicPlid(), StringPool.BLANK, PortletRequest.RENDER_PHASE);
    return portletURL;
}
项目:sakai    文件:SakaiPortalContext.java   
public SakaiPortalContext()
{
    properties = new HashMap();
    modes = new ArrayList();
    states = new ArrayList();

    modes.add(PortletMode.VIEW);
    modes.add(PortletMode.HELP);
    modes.add(PortletMode.EDIT);

    states.add(WindowState.MAXIMIZED);
    states.add(WindowState.MINIMIZED);
    states.add(WindowState.NORMAL);
}
项目:sakai    文件:PortletState.java   
public PortletState(String id)
{
    this.id = id;
    portletMode = PortletMode.VIEW;
    windowState = WindowState.NORMAL;
    parameters = new HashMap();
}
项目:sakai    文件:PortletState.java   
private void readObject(ObjectInputStream in) throws IOException,
        ClassNotFoundException
{

    id = in.readObject().toString();
    action = in.readBoolean();
    secure = in.readBoolean();
    parameters = (Map) in.readObject();
    portletMode = new PortletMode(in.readObject().toString());
    windowState = new WindowState(in.readObject().toString());

    log.debug("Deserializing PortletState [action={}]", action);

}