本文整理汇总了Java中javax.faces.component.UIOutput.setRendererType方法的典型用法代码示例。如果您正苦于以下问题:Java UIOutput.setRendererType方法的具体用法?Java UIOutput.setRendererType怎么用?Java UIOutput.setRendererType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.component.UIOutput
的用法示例。
在下文中一共展示了UIOutput.setRendererType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installAjaxResourceIfNecessary
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
/**
* Copy-pasted from {@link AjaxHandler}
*/
private void installAjaxResourceIfNecessary() {
FacesContext context = FacesContext.getCurrentInstance();
if (RenderKitUtils.hasScriptBeenRendered(context)) {
// Already included, return
return;
}
final String name = "jsf.js";
final String library = "javax.faces";
if (RenderKitUtils.hasResourceBeenInstalled(context, name, library)) {
RenderKitUtils.setScriptAsRendered(context);
return;
}
UIOutput output = new UIOutput();
output.setRendererType("javax.faces.resource.Script");
output.getAttributes().put("name", name);
output.getAttributes().put("library", library);
context.getViewRoot().addComponentResource(context, output, "head");
// Set the context to record script as included
RenderKitUtils.setScriptAsRendered(context);
}
示例2: addMetaTags
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
/**
* Add the viewport meta tag if not disabled from context-param
*
* @param root
* @param context
* @param isProduction
*/
private void addMetaTags(UIViewRoot root, FacesContext context) {
// Check context-param
String viewportParam = BsfUtils.getInitParam(C.P_VIEWPORT, context);
viewportParam = evalELIfPossible(viewportParam);
String content = "width=device-width, initial-scale=1";
if (!viewportParam.isEmpty() && isFalseOrNo(viewportParam))
return;
if(!viewportParam.isEmpty() && !isTrueOrYes(viewportParam))
content = viewportParam;
// Otherwise
String viewportMeta = "<meta name=\"viewport\" content=\"" + content + "\"/>";
UIOutput viewport = new UIOutput();
viewport.setRendererType("javax.faces.Text");
viewport.getAttributes().put("escape", false);
viewport.setValue(viewportMeta);
UIComponent header = findHeader(root);
if(header != null) {
header.getChildren().add(0, viewport);
}
}
示例3: createAndAddComponent
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
private void createAndAddComponent(UIViewRoot root, FacesContext context,
String rendererType, String name, String library, String position) {
// if (library != null && BSF_LIBRARY.equals(library)) {
// boolean loadBsfResource = shouldLibraryBeLoaded(P_GET_BOOTSTRAP_COMPONENTS_FROM_CDN, true);
//
// if (! loadBsfResource) {
// return;
// }
// }
UIOutput output = new UIOutput();
output.setRendererType(rendererType);
output.getAttributes().put("name", name);
output.getAttributes().put("library", library);
output.getAttributes().put("target", "head");
if (position != null) {
output.getAttributes().put("position", position);
}
addResourceIfNecessary(root, context, output);
}
示例4: addGeneratedResource
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
/**
* Add a new resource.
*/
private void addGeneratedResource(FacesContext context, String resourceName, String rendererType, String value,
UIViewRoot view) {
final UIOutput resource = new UIOutput();
resource.getAttributes().put("name", resourceName);
resource.setRendererType(rendererType);
resource.getAttributes().put("library", value);
view.addComponentResource(context, resource, HEAD);
}
示例5: generateLabel
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
/**
* Generates a JSF OutputText component/renderer
*
* @param context JSF context
* @param displayLabel The display label text
*
* @return UIComponent
*/
private UIComponent generateLabel(FacesContext context, String displayLabel)
{
UIOutput label = (UIOutput)context.getApplication().createComponent(ComponentConstants.JAVAX_FACES_OUTPUT);
label.setId(context.getViewRoot().createUniqueId());
label.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
label.setValue(displayLabel);
return label;
}
示例6: addSpacingRow
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
/**
* Creates an output text component to represent a spacing row.
*
* @param context Faces context
*/
@SuppressWarnings("unchecked")
protected void addSpacingRow(FacesContext context)
{
UIOutput spacingRow = (UIOutput)context.getApplication().createComponent(
ComponentConstants.JAVAX_FACES_OUTPUT);
spacingRow.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
FacesHelper.setupComponentId(context, spacingRow, null);
spacingRow.setValue("<div class=\"wizardButtonSpacing\" />");
spacingRow.getAttributes().put("escape", Boolean.FALSE);
this.getChildren().add(spacingRow);
}
示例7: createOutputTextComponent
import javax.faces.component.UIOutput; //导入方法依赖的package包/类
/**
* Creates an output text component.
*
* @param context FacesContext
* @param id Optional id to set
* @return The new component
*/
protected UIOutput createOutputTextComponent(FacesContext context, String id)
{
UIOutput component = (UIOutput)context.getApplication().createComponent(
ComponentConstants.JAVAX_FACES_OUTPUT);
component.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
FacesHelper.setupComponentId(context, component, id);
return component;
}