本文整理汇总了Java中javax.faces.component.UIOutput类的典型用法代码示例。如果您正苦于以下问题:Java UIOutput类的具体用法?Java UIOutput怎么用?Java UIOutput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIOutput类属于javax.faces.component包,在下文中一共展示了UIOutput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindInPanelComponents
import javax.faces.component.UIOutput; //导入依赖的package包/类
public void testFindInPanelComponents()
{
UIViewRoot root = facesContext.getViewRoot(); root.setId("root");
UIPanel panel1 = new UIPanel(); panel1.setId("panel1");
UIPanel panel2 = new UIPanel(); panel2.setId("panel2");
UIPanel panel3 = new UIPanel(); panel3.setId("panel3");
UIOutput txt = new UIOutput(); txt.setId("txt");
// build the Tree...
root.getChildren().add(panel1);
panel1.getChildren().add(panel2);
panel2.getChildren().add(panel3);
panel3.getChildren().add(txt);
// Get the ComponentReference util
ComponentReference<UIOutput> uiRef = ComponentReference.newUIComponentReference(txt);
// find the component...
UIOutput referencedComp = uiRef.getComponent();
assertEquals(txt, referencedComp);
}
示例2: visit
import javax.faces.component.UIOutput; //导入依赖的package包/类
@Override
public VisitResult visit(final VisitContext context, final UIComponent target) {
// if (!target.isRendered()) {
// return VisitResult.REJECT;
// }
if (target instanceof UIInput) {
this.inputs.add((UIInput) target);
}
if (target instanceof UIForm) {
this.forms.add((UIForm) target);
}
if (target instanceof UICommand) {
this.commands.add((UICommand) target);
}
if (target instanceof UIOutput) {
this.outputs.add((UIOutput) target);
}
if (target instanceof UISubmenu) {
this.subMenus.add((UISubmenu) target);
}
if (target instanceof Column) {
this.columns.add((Column) target);
}
if (target instanceof DataTable) {
this.tables.add((DataTable) target);
}
if (target instanceof UISelectItems) {
this.selectItems.add((UISelectItems) target);
}
if (target instanceof PanelGrid) {
this.panelGrids.add((PanelGrid) target);
}
return VisitResult.ACCEPT;
}
示例3: 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);
}
示例4: generateAndAdd
import javax.faces.component.UIOutput; //导入依赖的package包/类
@Override
public UIComponent generateAndAdd(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item)
{
UIComponent component = super.generateAndAdd(context, propertySheet, item);
if ((component instanceof UIInput) && (component instanceof UISelectOne) == false)
{
component.setRendererType(RepoConstants.ALFRESCO_FACES_MLTEXTAREA_RENDERER);
}
else if ((component instanceof UIOutput))
{
component.setRendererType(RepoConstants.ALFRESCO_FACES_MLTEXT_RENDERER);
}
return component;
}
示例5: generate
import javax.faces.component.UIOutput; //导入依赖的package包/类
/**
* @see org.alfresco.web.bean.generator.IComponentGenerator#generate(javax.faces.context.FacesContext, java.lang.String)
*/
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
UIComponent component = null;
if (this.inEditMode == false)
{
component = context.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
component.setRendererType("javax.faces.Link");
component.getAttributes().put("target", "new");
}
else
{
component = context.getApplication().createComponent(ComponentConstants.JAVAX_FACES_INPUT);
component.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
}
FacesHelper.setupComponentId(context, component, id);
return component;
}
示例6: setupProperty
import javax.faces.component.UIOutput; //导入依赖的package包/类
/**
* @see org.alfresco.web.bean.generator.BaseComponentGenerator#setupProperty(javax.faces.context.FacesContext, org.alfresco.web.ui.repo.component.property.UIPropertySheet, org.alfresco.web.ui.repo.component.property.PropertySheetItem, org.alfresco.service.cmr.dictionary.PropertyDefinition, javax.faces.component.UIComponent)
*/
@SuppressWarnings("unchecked")
@Override
protected void setupProperty(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item, PropertyDefinition propertyDef, UIComponent component)
{
super.setupProperty(context, propertySheet, item, propertyDef, component);
if (component.getRendererType().equals("javax.faces.Link") == true)
{
// Add child text component
UIOutput output = createOutputTextComponent(context, "linklabel_" + component.getId());
output.setValueBinding("value", component.getValueBinding("value"));
component.getChildren().add(output);
}
}
示例7: setupConverter
import javax.faces.component.UIOutput; //导入依赖的package包/类
@Override
protected void setupConverter(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem property,
PropertyDefinition propertyDef, UIComponent component)
{
if (property.getConverter() != null)
{
// create and add the custom converter
createAndSetConverter(context, property.getConverter(), component);
}
else
{
// use the default converter for the date component
// we can cast this as we know it is an UIOutput type
((UIOutput)component).setConverter(getDefaultConverter(context));
}
}
示例8: createAndSetConverter
import javax.faces.component.UIOutput; //导入依赖的package包/类
/**
* Creates the converter with the given id and adds it to the component.
*
* @param context FacesContext
* @param converterId The name of the converter to create
* @param component The component to add the converter to
*/
protected void createAndSetConverter(FacesContext context, String converterId,
UIComponent component)
{
if (converterId != null && component instanceof UIOutput)
{
try
{
Converter conv = context.getApplication().createConverter(converterId);
((UIOutput)component).setConverter(conv);
}
catch (NullPointerException npe)
{
// workaround a NPE bug in MyFaces
logger.warn("Converter " + converterId + " could not be applied");
}
catch (FacesException fe)
{
logger.warn("Converter " + converterId + " could not be applied");
}
}
}
示例9: processUIComponent
import javax.faces.component.UIOutput; //导入依赖的package包/类
private void processUIComponent(UIComponent uiComponent) {
if (uiComponent instanceof PickerUpdater) {
PickerUpdater pu = (PickerUpdater) uiComponent;
if (pu.isRequired()) {
markOutputRequired(lastOutput);
}
return;
}
if (uiComponent instanceof UIInput) {
processInput((UIInput) uiComponent);
return;
}
if (uiComponent instanceof UIOutput) {
processUIOutput((UIOutput) uiComponent);
return;
}
}
示例10: 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);
}
}
示例11: 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);
}
示例12: decode
import javax.faces.component.UIOutput; //导入依赖的package包/类
public void decode(FacesContext facesContext, UIComponent component)
{
RendererUtils.checkParamValidity(facesContext,component,null);
if (component instanceof UIInput)
{
HtmlRendererUtils.decodeUIInput(facesContext, component);
if (component instanceof ClientBehaviorHolder &&
!HtmlRendererUtils.isDisabled(component))
{
HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
}
}
else if (component instanceof UIOutput)
{
//nothing to decode
}
else
{
throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
}
}
示例13: testCustomFacet
import javax.faces.component.UIOutput; //导入依赖的package包/类
public void testCustomFacet()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UIForm form = new UIForm(); form.setId("form");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
UIPanel panel = new UIPanel(); panel.setId("panel");
UIInput input = new UIInput(); input.setId("input1");
// build the Tree...
panel.getFacets().put("fancyFacet", input);
nc3.getChildren().add(panel);
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(nc3);
nc1.getChildren().add(nc2);
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(nc1);
root.getChildren().add(new UIOutput());
root.getChildren().add(form);
// Get the ComponentReference util
ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);
// find the component...
UIInput referencedComp = uiRef.getComponent();
assertEquals(input, referencedComp);
// find it again!
assertEquals(input, uiRef.getComponent());
}
示例14: testCustomFacetWithFind
import javax.faces.component.UIOutput; //导入依赖的package包/类
public void testCustomFacetWithFind()
{
UIViewRoot root = new UIViewRoot();
root.setId("root");
UIForm form = new UIForm(); form.setId("form");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
UIPanel panel = new UIPanel(); panel.setId("panel");
UIInput input = new UIInput(); input.setId("input1");
// build the Tree...
panel.getFacets().put("fancyFacet", input);
panel.getChildren().add(input);
nc3.getChildren().add(panel);
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(nc3);
nc1.getChildren().add(nc2);
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(nc1);
root.getChildren().add(new UIOutput());
root.getChildren().add(form);
facesContext.setViewRoot(root);
// Get the ComponentReference util
ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);
// find the component...
UIInput referencedComp = uiRef.getComponent();
assertEquals(input, referencedComp);
// find it again!
assertEquals(input, uiRef.getComponent());
}
示例15: testUIDataFooterFacet
import javax.faces.component.UIOutput; //导入依赖的package包/类
public void testUIDataFooterFacet()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UIForm form = new UIForm(); form.setId("form");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
UIData table = new UIData(); table.setId("table1");
UIInput input = new UIInput(); input.setId("input1");
// build the Tree...
table.setFooter(input);
nc3.getChildren().add(table);
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(nc3);
nc1.getChildren().add(nc2);
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(nc1);
root.getChildren().add(new UIOutput());
root.getChildren().add(form);
// Get the ComponentReference util
ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);
// find the component...
UIInput referencedComp = uiRef.getComponent();
assertEquals(input, referencedComp);
}