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


Java UIViewRoot.findComponent方法代码示例

本文整理汇总了Java中javax.faces.component.UIViewRoot.findComponent方法的典型用法代码示例。如果您正苦于以下问题:Java UIViewRoot.findComponent方法的具体用法?Java UIViewRoot.findComponent怎么用?Java UIViewRoot.findComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.component.UIViewRoot的用法示例。


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

示例1: getTableSectionId

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
/**
 * Ids of fields inside tables look like <code>tableId:rowNr:fieldId</code>.
 * So we try to cut the fieldId and the rowNr parts to get the table id and
 * then check if it is inside a section and return the section id.
 * 
 * @param clientId
 *            the id of the field inside of a table
 * @param root
 *            the {@link UIViewRoot}
 * @return the section id or <code>null</code>
 */
private String getTableSectionId(String clientId, UIViewRoot root) {
    if (!clientId.contains(":")) {
        return null;
    }
    // cut the field id
    clientId = clientId.substring(0, clientId.lastIndexOf(':'));
    if (!clientId.contains(":")) {
        return null;
    }
    // cut the row number - we should have the table id
    clientId = clientId.substring(0, clientId.lastIndexOf(':'));
    UIComponent comp = root.findComponent(clientId);
    if (comp != null) {
        return getSectionId(comp);
    }
    return null;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:29,代码来源:MessageListener.java

示例2: getComponentValue

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public static String getComponentValue(String componentId) {
	String value = null;

	UIViewRoot root = getCurrentInstance().getViewRoot();
	UIComponent component = root.findComponent(componentId);

	if (component != null) {
		Object o = component.getValueExpression("value").getValue(getCurrentInstance().getELContext());
		value = (String) o;
	}

	return value;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:14,代码来源:JSFUtil.java

示例3: removeComponent

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public static void removeComponent(String componentId) {
	UIViewRoot root = getCurrentInstance().getViewRoot();
	UIComponent component = root.findComponent(componentId);

	if (component != null) {
		UIComponent parent = component.getParent();
		parent.getChildren().remove(component);
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:10,代码来源:JSFUtil.java

示例4: getComponent

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
/**
* This method will use a calculated "component path" to walk down to the <code>UIComponent</code>
* that is referenced by this class. If the component can not be found, the <code>getComponent()</code>
* will return <code>null</code>. 
* 
* @return the referenced <code>UIComponent</code> or <code>null</code> if it can not be found.
* @throws IllegalStateException if the component used to create the
* ComponentReference is not in the component tree or does <b>not</b> have an <code>Id</code>
* @see ComponentReference#newUIComponentReference(UIComponent)
*/
@SuppressWarnings("unchecked")
public final T getComponent()
{
  // get the scopedId, calculating it if necessary
  String scopedId = getScopedId();
      
  UIComponent foundComponent = null;

  // In order to find the component with its
  // calculated path, we need to start at the ViewRoot;
  UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();

  List<Object> componentPath = _componentPath;
  
  if (componentPath != null) 
  {
    // Walk down the component tree, to the component we are looking for.
    // We start at the ViewRoot and use the previous calculated "component path"
    foundComponent = _walkPathToComponent(root, componentPath);
  }

  // Check if we really found it with the previously created "component path"
  if (foundComponent == null || (!getComponentId().equals(foundComponent.getId())))
  {
    // OK, we were not lucky with the calculated "component path", let's
    // see if we can find it by using the "scoped ID" and the regular 
    // findComponent();
    foundComponent = root.findComponent(scopedId);

    // was the regular findComponent() successful ?
    if (foundComponent != null)
    {        
      // OK, now let's rebuild the path
      _componentPath = calculateComponentPath(foundComponent);
    }
  }

  return (T)foundComponent;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:50,代码来源:ComponentReference.java

示例5: teste

import javax.faces.component.UIViewRoot; //导入方法依赖的package包/类
public void teste() {
    FacesContext context = FacesContext.getCurrentInstance();
    UIViewRoot viewRoot = context.getViewRoot();
    DataTable dataTable = (DataTable) viewRoot.findComponent("Rel:tabelaRelatorio");
    dataTable.setValue(null);
    dataTable.setColumns(null);
    Validacao.AtualizarCompoente("Rel", "tabelaRelatorio");
    String tipoRelatorio = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("relatorio");
    relatorio.setTipoRelatorio(tipoRelatorio);
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:11,代码来源:RelatorioBean.java


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