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


Java RenderKit类代码示例

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


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

示例1: _getResponseStateManager

import javax.faces.render.RenderKit; //导入依赖的package包/类
static private ResponseStateManager _getResponseStateManager(
  FacesContext context,
  String       renderKitId)
{
  RenderKitFactory factory = (RenderKitFactory)
    FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
  RenderKit kit = factory.getRenderKit(context, renderKitId);
  return kit.getResponseStateManager();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:StateManagerImpl.java

示例2: getRenderKit

import javax.faces.render.RenderKit; //导入依赖的package包/类
static public RenderKit getRenderKit(FacesContext context)
{
  RenderKitFactory factory = (RenderKitFactory)
    FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);

  factory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT, new BasicHtmlRenderKit());

  String renderKitId = null;
  if (context.getViewRoot() != null)
    renderKitId = context.getViewRoot().getRenderKitId();
  if (renderKitId == null)
    renderKitId = "org.apache.myfaces.trinidad.core";

  RenderKit renderKit = factory.getRenderKit(context,renderKitId);
  if (renderKit == null)
    throw new IllegalStateException("Could not create renderKit " + renderKitId);

  return renderKit;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:RenderKitBootstrap.java

示例3: _getRendererImpl

import javax.faces.render.RenderKit; //导入依赖的package包/类
private Renderer _getRendererImpl(FacesContext context)
{
  String rendererType = getRendererType();
  if (rendererType != null)
  {
    RenderKit renderKit = context.getRenderKit();
    Renderer renderer = renderKit.getRenderer(getFamily(), rendererType);
    if (renderer == null)
    {
      _LOG.warning("CANNOT_FIND_RENDERER", new Object[]{this, rendererType});
    }

    return renderer;
  }

  return null;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:UIXComponentBase.java

示例4: setUp

import javax.faces.render.RenderKit; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
  super.setUp();
  FacesContext oldFacesContext = facesContext;
  UIViewRoot oldViewRoot = oldFacesContext.getViewRoot();
  oldFacesContext.release();
  facesContext = new MockFacesContext12(externalContext,
                                        lifecycle,
                                        application);
  facesContext.setViewRoot(oldViewRoot);
  facesContext.setApplication(application);

  facesContext.getViewRoot().setRenderKitId("org.apache.myfaces.trinidad.core"); 
  RenderKitFactory renderKitFactory = (RenderKitFactory)
  FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
  Mock mockRenderKitty = mock(RenderKit.class);
  RenderKit renderKit = (RenderKit) mockRenderKitty.proxy();
  _mockRenderKit = new MockRenderKitWrapper(mockRenderKitty, renderKit);
  renderKitFactory.addRenderKit("org.apache.myfaces.trinidad.core", renderKit);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:FacesTestCase.java

示例5: mockFacesContext

import javax.faces.render.RenderKit; //导入依赖的package包/类
public static FacesContext mockFacesContext() {
    FacesContext context = Mockito.mock(FacesContext.class);
    Application application = Mockito.mock(Application.class);
    ExternalContext external = Mockito.mock(ExternalContext.class);
    ResourceBundle bundle = Mockito.mock(ResourceBundle.class);
    RenderKit renderKit = Mockito.mock(RenderKit.class);
    UIViewRoot viewRoot = Mockito.mock(UIViewRoot.class);
    ELContext elContext = Mockito.mock(ELContext.class);
    when(context.getApplication()).thenReturn(application);
    when(context.getExternalContext()).thenReturn(external);
    when(application.getResourceBundle(context, MessageProvider.BUNDLE_KEY)).thenReturn(bundle);
    when(context.getRenderKit()).thenReturn(renderKit);
    when(context.getViewRoot()).thenReturn(viewRoot);
    when(context.getELContext()).thenReturn(elContext);
    when(renderKit.getRenderer(Matchers.anyString(), Matchers.anyString())).thenReturn(Mockito.mock(Renderer.class));

    setCurrentInstance(context);
    Mockito.doAnswer(RELEASE).when(context).release();
    return context;
}
 
开发者ID:studentloanscompany,项目名称:ft-components,代码行数:21,代码来源:MockFacesContext.java

示例6: setupResponseWriter

import javax.faces.render.RenderKit; //导入依赖的package包/类
/** setup the JSF response writer. */
private ResponseWriter setupResponseWriter(final String mimetype,
                                           final HttpServletResponse response, 
                                           final FacesContext facesContext)
   throws IOException
{
   final OutputStream os = response.getOutputStream();
   final UIViewRoot viewRoot = facesContext.getViewRoot();
   final RenderKitFactory renderFactory = (RenderKitFactory)
      FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
   final RenderKit renderKit = 
      renderFactory.getRenderKit(facesContext, viewRoot.getRenderKitId());
   final ResponseWriter writer = 
      renderKit.createResponseWriter(new OutputStreamWriter(os, "UTF-8"), 
                                     mimetype, 
                                     "UTF-8");
   facesContext.setResponseWriter(writer);
   // must be text/xml otherwise IE doesn't parse the response properly into responseXML
   response.setContentType(mimetype);
   return writer;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:InvokeCommand.java

示例7: getRenderKit

import javax.faces.render.RenderKit; //导入依赖的package包/类
@Override
public RenderKit getRenderKit(FacesContext context, String renderKitId)
{
  if (CoreRenderKit.getId().equals(renderKitId))
  {
    renderKitId = CoreRenderKit.chooseRenderKit(context);
  }

  return _factory.getRenderKit(context, renderKitId);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:11,代码来源:CoreRenderKitFactory.java

示例8: createResponseWriter

import javax.faces.render.RenderKit; //导入依赖的package包/类
@Override
public ResponseWriter createResponseWriter(
  Writer writer,
  String contentTypeList,
  String encoding)
{
  RenderKit renderKit = getRenderKit();
  ResponseWriter out =
    renderKit.createResponseWriter(writer, contentTypeList, encoding);

  return createDecoratedResponseWriter(out);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:13,代码来源:RenderKitDecorator.java

示例9: findRenderer

import javax.faces.render.RenderKit; //导入依赖的package包/类
@Override
public Renderer findRenderer(
  String componentFamily,
  String rendererType)
{
  Renderer renderer = super.findRenderer(componentFamily, rendererType);

  // We did not find a renderer in our own render kit, so check
  // the decorated RenderKit
  if (renderer == null)
  {
    RenderKit renderKit = getRenderKit();

    // Use findRenderer() to avoid "not found" warning messages
    if (renderKit instanceof RenderKitBase)
      renderer = ((RenderKitBase) renderKit).findRenderer(
                                      componentFamily, rendererType);
    else
      renderer = renderKit.getRenderer(componentFamily, rendererType);

    // copy-on-read
    if (renderer != null)
      addRenderer(componentFamily, rendererType, renderer);
  }

  return renderer;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:28,代码来源:RenderKitDecorator.java

示例10: _getDialogRenderKitService

import javax.faces.render.RenderKit; //导入依赖的package包/类
static private DialogRenderKitService _getDialogRenderKitService(
  FacesContext context)
{
  RenderKit rk = context.getRenderKit();
  DialogRenderKitService service = 
     Service.getService(rk, DialogRenderKitService.class);

  if (service == null)
  {
    _LOG.info("RENDERKIT_NOT_SUPPORT_DIALOGRENDERKITSERVICE", rk);
  }

  return service;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:15,代码来源:DialogServiceImpl.java

示例11: getRenderKit

import javax.faces.render.RenderKit; //导入依赖的package包/类
@Override
public RenderKit getRenderKit()
{
  if (_kit == null)
  {
    _kit = _base.getRenderKit();
  }
  else
  {
    UIViewRoot root = getViewRoot();
    if (root != null)
    {
      String renderKitId = root.getRenderKitId();
      // Yes, instance equality, not .equals();  within a single
      // request and single thread, instance equality should always
      // be sufficient, and behavior will still be correct even
      // if it was somehow not (we'll just spend more time re-getting the
      // RenderKit)
      if (renderKitId != _cachedRenderKitId)
      {
        _cachedRenderKitId = renderKitId;
        _kit = _base.getRenderKit();
      }
    }
  }

  return _kit;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:29,代码来源:FacesContextFactoryImpl.java

示例12: _getExtendedRenderKitService

import javax.faces.render.RenderKit; //导入依赖的package包/类
private ExtendedRenderKitService _getExtendedRenderKitService(
  FacesContext context)
{
  RenderKit rk = context.getRenderKit();
  if (rk == null)
    throw new NullPointerException("No renderkit");

  return Service.getService(rk, ExtendedRenderKitService.class);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:RenderKitPerfTestCase.java

示例13: getRenderKit

import javax.faces.render.RenderKit; //导入依赖的package包/类
@Override
public RenderKit getRenderKit()
{
  if (_viewRoot == null)
    throw new IllegalStateException("Trying to get a RenderKit without a UIViewRoot");
  // this method is called a lot, so we don't want to use the "mock"
  // implementations as those expect a specific number of calls:
  return _kit;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:MFacesContext.java

示例14: getRenderKitService

import javax.faces.render.RenderKit; //导入依赖的package包/类
/**
 * A convenience for retrieving a service from the current RenderKit.
 */
static public <T> T getRenderKitService(FacesContext context,
                                        Class<T> serviceClass)
{
  // Provide a better exception than an NPE from inside of
  // Service.getService().
  RenderKit rk = context.getRenderKit();
  if (rk == null)
    throw new NullPointerException(_LOG.getMessage(
      "OBTAIN_NULL_RENDERKIT_WHILE_GETTING_SERVICE", serviceClass.getName()));
 

  return getService(rk, serviceClass);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:Service.java

示例15: doTestApplyRequestValues

import javax.faces.render.RenderKit; //导入依赖的package包/类
/**
 * Tests the apply-request-values lifecycle phase.
 */
protected void doTestApplyRequestValues(
  UIViewRoot  root,
  UIComponent component)
{

  Mock mockRenderKitFactory = mock(RenderKitFactory.class);

  Mock mockRenderkit = getMockRenderKitWrapper().getMock();
  RenderKit renderkit = getMockRenderKitWrapper().getRenderKit();

  Mock mockRenderer = mock(Renderer.class);
  Renderer renderer = (Renderer) mockRenderer.proxy();

  mockRenderKitFactory.stubs().method("getRenderKit").will(returnValue(renderkit));
  mockRenderkit.stubs().method("getRenderer").will(returnValue(renderer));

  if (isRendererUsed() && component.isRendered())
  {
    mockRenderer.expects(once()).method("decode");
  }
  else
  {
    mockRenderer.expects(never()).method("decode");
  }

  try
  {
    setCurrentContext(facesContext);
    doTestApplyRequestValues(facesContext, root, component);
  }
  finally
  {
    setCurrentContext(null);
  }

  mockRenderKitFactory.verify();
  mockRenderkit.verify();
  mockRenderer.verify();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:43,代码来源:UIComponentTestCase.java


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