本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}