本文整理了Java中javax.faces.webapp.UIComponentClassicTagBase
类的一些代码示例,展示了UIComponentClassicTagBase
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UIComponentClassicTagBase
类的具体详情如下:
包路径:javax.faces.webapp.UIComponentClassicTagBase
类名称:UIComponentClassicTagBase
[英]UIComponentTagBase
is the base class for all JSP tags that use the "classic" JSP tag interface that correspond to a javax.faces.component.UIComponent instance in the view. In Faces 1.2, all component tags are BodyTag
instances to allow for the execution of the page to build the component tree, but not render it. Rendering happens only after the component tree is completely built.
UIComponentTag extends UIComponentClassicTagBase
to add support for properties that conform to the Faces 1.1 EL.
UIComponentELTag extends UIComponentClassicTagBase
class to add support for properties that conform to the EL API.
The default implementation allows the proper interweaving of template text, non-Faces JSP tag output, and Faces component tag output in the same page, as expected by the page author.
The CASE markers in the following example will be cited in the method descriptions of this class.
<h:panelGrid style="color:red" border="4" columns="2">
CASE 1
<h:outputText value="component 1"/>
CASE 2
<h:outputText value="component 2"/>
<f:verbatim>CASE 3</f:verbatim>
<c:out value="${pageScope.CASE4}" />
</h:panelGrid>
The preceding arrangement of faces component tags, must yield markup that will render identically to the following (assuming that ${pageScope.CASE4}
evaluates to "CASE 4
" without the quotes).
<table border="4" style="color:red">
<tbody>
<tr><td>CASE 1</td></tr> <tr><td>component 1</td></tr>
<tr><td>CASE 2</td> <tr><td>component 2</td></tr>
<tr><td>CASE 3</td> <td>CASE 4</td></tr>
</tbody>
</table>
[中]UIComponentTagBase
是所有使用对应于javax的“经典”JSP标记接口的JSP标记的基类。面孔。组成部分视图中的UIComponent实例。在Faces 1.2中,所有组件标记都是BodyTag
实例,以允许执行页面来构建组件树,但不呈现它。只有在组件树完全构建之后,才会进行渲染。
UIComponentTag扩展UIComponentClassicTagBase
以添加对符合Faces 1.1 EL的属性的支持。
UIComponentELTag扩展了UIComponentClassicTagBase
类,以添加对符合EL API的属性的支持。
默认实现允许模板文本、非Faces JSP标记输出和Faces组件标记输出在同一页面中正确交织,正如页面作者所期望的那样。
下面示例中的案例标记将在该类的方法描述中引用。
*案例1描述了模板文本和/或非组件自定义标记输出,作为组件标记的子项出现,但在该组件标记的第一个组件标记子项之前。
*案例2描述了两个同级组件标记之间发生的模板文本和/或非组件自定义标记输出。
*案例3描述了模板文本和/或非组件自定义标记输出,它们作为<f:verbatim>标记在页面中任意点的子内容出现。
*案例4描述了在最后一个子组件标记和其封闭的父组件标记的结束标记之间发生的模板文本和/或非组件自定义标记输出。
<h:panelGrid style="color:red" border="4" columns="2">
CASE 1
<h:outputText value="component 1"/>
CASE 2
<h:outputText value="component 2"/>
<f:verbatim>CASE 3</f:verbatim>
<c:out value="${pageScope.CASE4}" />
</h:panelGrid>
前面的faces组件标记排列必须产生与以下内容相同的标记(假设${pageScope.CASE4}
的计算结果为“CASE 4
”,不带引号)。
<table border="4" style="color:red">
<tbody>
<tr><td>CASE 1</td></tr> <tr><td>component 1</td></tr>
<tr><td>CASE 2</td> <tr><td>component 2</td></tr>
<tr><td>CASE 3</td> <td>CASE 4</td></tr>
</tbody>
</table>
代码示例来源:origin: javax/javaee-web-api
void addChildToComponentAndTag(UIComponent child) {
UIComponent myComponent = this.getComponentInstance();
int indexOfNextChildTag = this.getIndexOfNextChildTag();
if (indexOfNextChildTag > myComponent.getChildCount()) {
indexOfNextChildTag = myComponent.getChildCount();
}
myComponent.getChildren().add(indexOfNextChildTag, child);
this.addChild(child);
}
代码示例来源:origin: org.apache.myfaces.core/myfaces-api
@Override
public boolean getCreated()
{
return target.getCreated();
}
代码示例来源:origin: org.apache.myfaces.core/myfaces-api
public int doEndTag() throws JspException
popTag();
UIComponent component = getComponentInstance();
removeFormerChildren(component);
removeFormerFacets(component);
UIComponentClassicTagBase parentTag = getParentUIComponentClassicTagBase(pageContext);
UIComponent verbatimComp = createVerbatimComponentFromBodyContent();
component.getChildren().add(verbatimComp);
parentTag.addChild(verbatimComp);
throw new JspException(e);
int retValue = getDoEndValue();
internalRelease();
代码示例来源:origin: javax/javaee-web-api
/**
* <p>Create a new child component using <code>createComponent</code>,
* initialize its properties, and add it to its parent as a child.
* </p>
* @param context {@link FacesContext} for the current request
* @param parent Parent {@link UIComponent} for the new child
* @param componentId Component identifier for the new child,
* or <code>null</code> for no explicit identifier
*/
private UIComponent createChild(
FacesContext context,
UIComponent parent,
UIComponentClassicTagBase parentTag,
String componentId) throws JspException {
UIComponent component = createComponent(context, componentId);
int indexOfNextChildTag = parentTag.getIndexOfNextChildTag();
if (indexOfNextChildTag > parent.getChildCount()) {
indexOfNextChildTag = parent.getChildCount();
}
parent.getChildren().add(indexOfNextChildTag, component);
created = true;
return (component);
}
代码示例来源:origin: javax/javaee-web-api
UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null) { // PENDING - i18n
throw new JspException("Not nested in a UIComponentTag");
UIComponent component = tag.getComponentInstance();
if (component == null) { // PENDING - i18n
throw new JspException("No component associated with UIComponentTag");
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory exprFactory =
context.getApplication().getExpressionFactory();
ELContext elContext = context.getELContext();
.getValue(elContext);
if (component.getAttributes().get(nameVal) == null) {
component.getAttributes().put(nameVal, valueVal);
代码示例来源:origin: javax/javaee-web-api
context = getFacesContext();
if (null == context) {
if (null == getFacetName() &&
null != parentTag) {
Tag p = this.getParent();
verbatim = parentTag.createVerbatimComponentFromBodyContent();
component = findComponent(context);
addVerbatimBeforeComponent(parentTag,
verbatim, component);
clientId = getId();
getParentNamingContainerTag().getNamingContainerChildIds().get(clientId);
&& !this.getJspId().equals(temp.getJspId())) {
tagInstance = this;
} else if (temp != null
&& temp != this
&& this.getJspId().equals(temp.getJspId())) {
if (getParentNamingContainerTag().getNamingContainerChildIds().containsKey(clientId)) {
printTree(context.getViewRoot(), clientId, writer, 0);
String msg = "Duplicate component id: '"
+ clientId
代码示例来源:origin: org.apache.myfaces.core/myfaces-impl
if (componentTag == null)
throw new JspException("no parent UIComponentTag found");
UIComponent component = componentTag.getComponentInstance();
if (component == null)
throw new JspException("parent UIComponentTag has no UIComponent");
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
if (component.getAttributes().get(name) == null)
component.getAttributes().put(name, value);
component.setValueExpression(name, _valueExpression);
代码示例来源:origin: javax.faces/com.springsource.javax.faces
context = getFacesContext();
if (null == context) {
parentTag = getParentUIComponentClassicTagBase(pageContext);
Map<String,Object> requestMap = context.getExternalContext().getRequestMap();
Map<String,UIComponentTagBase> componentIds;
if (parentTag == null) {
if (null == getFacetName() &&
null != parentTag) {
Tag p = this.getParent();
verbatim = parentTag.createVerbatimComponentFromBodyContent();
component = findComponent(context);
addVerbatimBeforeComponent(parentTag,
verbatim, component);
&& !this.getJspId().equals(temp.getJspId())) {
tagInstance = this;
} else if (temp != null
&& temp != this
&& this.getJspId().equals(temp.getJspId())) {
printTree(context.getViewRoot(), clientId, writer, 0);
String msg = "Duplicate component id: '"
+ clientId
代码示例来源:origin: javax/javaee-web-api
UIComponentClassicTagBase parentTag = _getParentUIComponentClassicTagBase(context.getAttributes());
parentTag.getComponentInstance().getRendersChildren())) {
if (null != (verbatim = this.createVerbatimComponentFromBodyContent())) {
component.getAttributes().get(JSP_CREATED_COMPONENT_IDS);
if (createdIds != null) {
int listIdx = component.getChildCount();
if (createdIds.size() == listIdx) {
component.getChildren().set((listIdx - 1), verbatim);
component.getChildren().add(verbatim);
parentTag.addChild(verbatim);
return (getDoAfterBodyValue());
代码示例来源:origin: org.apache.myfaces.core/myfaces-shaded-impl
@Override
public int doStartTag() throws JspException
{
if (log.isLoggable(Level.FINE))
log.fine("JSF 1.2 Spec : Create a new instance of the ActionListener");
ActionListener actionListener = new SetPropertyActionListener(target, value);
UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (tag == null)
throw new JspException("Could not find a " + "parent UIComponentClassicTagBase ... is this "
+ "tag in a child of a UIComponentClassicTagBase?");
if (tag.getCreated())
{
UIComponent component = tag.getComponentInstance();
if (component == null)
throw new JspException(" Could not locate a UIComponent " + "for a UIComponentClassicTagBase w/ a "
+ "JSP id of " + tag.getJspId());
if (!(component instanceof ActionSource))
throw new JspException("Component w/ id of " + component.getId()
+ " is associated w/ a tag w/ JSP id of " + tag.getJspId() + ". This component is of type "
+ component.getClass() + ", which is not an " + ActionSource.class);
if (log.isLoggable(Level.FINE))
log.fine(" ... register it with the UIComponent " + "instance associated with our most immediately "
+ "surrounding UIComponentTagBase");
((ActionSource)component).addActionListener(actionListener);
}
return SKIP_BODY;
}
代码示例来源:origin: com.caucho/resin
context = FacesContext.getCurrentInstance();
= (UIComponentClassicTagBase) req.getAttribute("caucho.jsf.parent");
parent = parentTag.getComponentInstance();
BodyContent body = parentTag.getBodyContent();
child = (UIComponent) binding.getValue(context.getELContext());
binding.setValue(context.getELContext(), child);
parent.getChildren().add(child);
代码示例来源:origin: javax/javaee-web-api
popUIComponentClassicTagBase();
removeOldChildren();
removeOldFacets();
UIComponentClassicTagBase parentTag = _getParentUIComponentClassicTagBase(
context.getAttributes());
if (null != (verbatim = this.createVerbatimComponentFromBodyContent())) {
component.getChildren().add(verbatim);
if (null != parentTag) {
parentTag.addChild(verbatim);
throw new JspException(e);
} finally {
component = null;
this.release();
return (getDoEndValue());
代码示例来源:origin: org.apache.myfaces.core/myfaces-api
this._facesContext = getFacesContext();
_parentClassicTag = getParentUIComponentClassicTagBase(pageContext);
if (!isFacet())
Tag parent = getParent();
verbatimComp = _parentClassicTag.createVerbatimComponentFromBodyContent();
_componentInstance = findComponent(_facesContext);
addVerbatimBeforeComponent(_parentClassicTag, verbatimComp, _componentInstance);
Map<String, Object> viewComponentIds = getViewComponentIds();
throw new JspException("Duplicated component Id: '" + clientId + "' " + "for component: '"
+ getPathToComponent(_componentInstance) + "'.");
if (isFacet())
_parentClassicTag.addFacet(getFacetName());
_parentClassicTag.addChild(_componentInstance);
pushTag();
return getDoStartValue();
代码示例来源:origin: com.caucho/resin
context = FacesContext.getCurrentInstance();
= (UIComponentClassicTagBase) req.getAttribute("caucho.jsf.parent");
parent = parentTag.getComponentInstance();
child = (UIComponent) binding.getValue(context.getELContext());
parent.getFacets().put(facetName, child);
binding.setValue(context.getELContext(), child);
代码示例来源:origin: org.apache.myfaces.core/myfaces-api
@Override
public int doStartTag() throws JspException
{
UIComponentClassicTagBase componentTag = UIComponentELTag.getParentUIComponentClassicTagBase(pageContext);
if (componentTag == null)
{
throw new JspException("no parent UIComponentTag found");
}
if (!componentTag.getCreated())
{
return Tag.SKIP_BODY;
}
Validator validator = createValidator();
UIComponent component = componentTag.getComponentInstance();
if (component == null)
{
throw new JspException("parent UIComponentTag has no UIComponent");
}
if (!(component instanceof EditableValueHolder))
{
throw new JspException("UIComponent is no EditableValueHolder");
}
((EditableValueHolder)component).addValidator(validator);
return Tag.SKIP_BODY;
}
代码示例来源:origin: org.apache.myfaces/com.springsource.org.apache.myfaces.javax.faces
public int doAfterBody() throws JspException
UIComponentClassicTagBase parentTag = getParentUIComponentClassicTagBase(pageContext);
if (isRootTag(parentTag) || isInRenderedChildrenComponent(parentTag))
UIComponent verbatimComp = createVerbatimComponentFromBodyContent();
_componentInstance.getAttributes().get(FORMER_CHILD_IDS_SET_ATTR);
_componentInstance.getChildren().add(verbatimComp);
int index = _componentInstance.getChildCount();
if (childrenAddedIds.size() == index)
parentTag.addChild(verbatimComp);
return getDoAfterBodyValue();
代码示例来源:origin: com.caucho/resin
public static UIComponent findFacet(FacesContext context,
ServletRequest req,
UIComponent parent,
String facetName)
throws Exception
{
if (context == null)
FacesContext.getCurrentInstance();
if (parent == null) {
UIComponentClassicTagBase parentTag
= (UIComponentClassicTagBase) req.getAttribute("caucho.jsf.parent");
parent = parentTag.getComponentInstance();
}
if (parent != null)
return parent.getFacet(facetName);
else
return null;
}
代码示例来源:origin: com.caucho/resin
public static UIComponent addTransient(FacesContext context,
ServletRequest req,
UIComponent parent,
String prevId,
Class childClass)
throws Exception
{
if (context == null)
context = FacesContext.getCurrentInstance();
if (parent == null) {
UIComponentClassicTagBase parentTag
= (UIComponentClassicTagBase) req.getAttribute("caucho.jsf.parent");
parent = parentTag.getComponentInstance();
BodyContent body = parentTag.getBodyContent();
if (body != null)
addVerbatim(parent, body);
}
UIComponent child = null;;
if (child == null)
child = (UIComponent) childClass.newInstance();
child.setTransient(true);
addChild(parent, prevId, child);
return child;
}
代码示例来源:origin: org.apache.myfaces.core/myfaces-api
@Override
public int doStartTag() throws JspException
{
UIComponentClassicTagBase componentTag =
UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (componentTag == null)
{
throw new JspException("no parent UIComponentTag found");
}
if (!componentTag.getCreated())
{
return Tag.SKIP_BODY;
}
Converter converter = createConverter();
UIComponent component = componentTag.getComponentInstance();
if (component == null)
{
throw new JspException("parent UIComponentTag has no UIComponent");
}
if (!(component instanceof ValueHolder))
{
throw new JspException("UIComponent is no ValueHolder");
}
((ValueHolder)component).setConverter(converter);
return Tag.SKIP_BODY;
}
代码示例来源:origin: com.sun.faces/jsf-api
/**
* <p>Add <i>verbatim</i> as a sibling of <i>component</i> in
* <i>component</i> in the parent's child list. <i>verbatim</i> is
* added to the list at the position immediatly following
* <i>component</i>.</p>
*/
protected void addVerbatimAfterComponent(UIComponentClassicTagBase parentTag,
UIComponent verbatim,
UIComponent component) {
int indexOfComponentInParent;
UIComponent parent = component.getParent();
// invert the order of this if and the assignment below. Since this line is
// here, it appears an early return is acceptable/desired if parent is null,
// and, if it is null, we should probably check for that before we try to
// access it. 2006-03-15 jdl
if (null == parent) {
return;
}
List<UIComponent> children = parent.getChildren();
indexOfComponentInParent = children.indexOf(component);
if (children.size() - 1 == indexOfComponentInParent) {
children.add(verbatim);
}
else {
children.add(indexOfComponentInParent + 1, verbatim);
}
parentTag.addChild(verbatim);
}
内容来源于网络,如有侵权,请联系作者删除!