当前位置: 首页>>代码示例>>Java>>正文


Java WindowState类代码示例

本文整理汇总了Java中javax.portlet.WindowState的典型用法代码示例。如果您正苦于以下问题:Java WindowState类的具体用法?Java WindowState怎么用?Java WindowState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WindowState类属于javax.portlet包,在下文中一共展示了WindowState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleRenderRequest

import javax.portlet.WindowState; //导入依赖的package包/类
@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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:AbstractController.java

示例2: shouldApplyTo

import javax.portlet.WindowState; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:35,代码来源:AbstractHandlerExceptionResolver.java

示例3: doView

import javax.portlet.WindowState; //导入依赖的package包/类
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>");
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:18,代码来源:WelcomePortlet.java

示例4: testSerialization

import javax.portlet.WindowState; //导入依赖的package包/类
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);

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:PortletStateTest.java

示例5: testEncodeDecode

import javax.portlet.WindowState; //导入依赖的package包/类
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());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:SimplePortletStateEncoderTest.java

示例6: execute

import javax.portlet.WindowState; //导入依赖的package包/类
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;
}
 
开发者ID:micromagic,项目名称:eterna,代码行数:27,代码来源:RenderExecute.java

示例7: handleRenderRequest

import javax.portlet.WindowState; //导入依赖的package包/类
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);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:23,代码来源:AbstractController.java

示例8: getURLView

import javax.portlet.WindowState; //导入依赖的package包/类
@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;
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:17,代码来源:ArtistAssetRenderer.java

示例9: doStartTag

import javax.portlet.WindowState; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:18,代码来源:IsMaximizedTag.java

示例10: getDefinedWindowStates

import javax.portlet.WindowState; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:PortletURLTag168.java

示例11: render

import javax.portlet.WindowState; //导入依赖的package包/类
@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);

}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:27,代码来源:ExceptionTests_WindowStateException_ApiRender.java

示例12: checkEqualStateAwareResponse

import javax.portlet.WindowState; //导入依赖的package包/类
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;
   }
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:27,代码来源:Utils.java

示例13: getLink

import javax.portlet.WindowState; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getLink()
	throws Exception {

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

	return sb.toString();
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:16,代码来源:BaseResultItemBuilder.java

示例14: match

import javax.portlet.WindowState; //导入依赖的package包/类
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));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:33,代码来源:AnnotationMethodHandlerAdapter.java

示例15: defaultNoRenderWhenMinimized

import javax.portlet.WindowState; //导入依赖的package包/类
@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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:SimpleMappingExceptionResolverTests.java


注:本文中的javax.portlet.WindowState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。