當前位置: 首頁>>代碼示例>>Java>>正文


Java UIComponent.getParent方法代碼示例

本文整理匯總了Java中javax.faces.component.UIComponent.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java UIComponent.getParent方法的具體用法?Java UIComponent.getParent怎麽用?Java UIComponent.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.component.UIComponent的用法示例。


在下文中一共展示了UIComponent.getParent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _getContainingForm

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private UIComponent _getContainingForm(UIComponent component)
{
  UIComponent previous = component;
  UIComponent parent = component.getParent();

  while (parent != null)
  {
    if ((parent instanceof UIForm)
        || (parent instanceof UIXForm)
        || (parent instanceof UIXSubform))
      return parent;

    previous = parent;
    parent = parent.getParent();
  }
  return previous;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:18,代碼來源:ResetActionListener.java

示例2: doTestUpdateModelValues

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected void doTestUpdateModelValues(
  FacesContext context,
  UIViewRoot   root,
  UIComponent  component)
{
  Mock mock = createMockUIComponent();
  UIComponent child = (UIComponent) mock.proxy();

  // JavaServer Faces 1.0 Specification, section 2.2.4
  // During the update-model-values phase,
  // only the processUpdates lifecycle method may be called.
  if (willChildrenBeProcessed(component))
    mock.expects(once()).method("processUpdates");

  // construct the UIComponent tree and
  // execute the apply-request-values lifecycle phase
  if (component.getParent() == null)
    root.getChildren().add(component);
  component.getChildren().add(child);
  root.processUpdates(context);

  mock.verify();
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:25,代碼來源:UIComponentTestCase.java

示例3: getFormId

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 *  Retrieves id of the form the component is contained in.
 *
 * @param context the faces context object
 * @param component UIComponent whose container form id is to be retuirned
 *
 * @return String id of the form if one exists in component's hierarchy,
 *                otherwise null
 */
public static String getFormId(
  FacesContext context,
  UIComponent  component)
{
  UIComponent form = null;
  while (component != null)
  {
    if ((component instanceof UIForm) ||
        (component instanceof UIXForm))
    {
      form = component;
      break;
    }

    component = component.getParent();
  }

  if (form == null)
    return null;

  return form.getClientId(context);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:32,代碼來源:RenderUtils.java

示例4: _addPartialTargetImpl

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * @see #addPartialTarget(FacesContext, PartialPageContext, UIComponent)
 * @see #setPartialTarget(FacesContext, PartialPageContext)
 */
private static void _addPartialTargetImpl(
  FacesContext facesContext, PartialPageContext partialContext, UIComponent component)
{
  if (component.getRendererType() == null)
  {
    if (component.getParent() != null)
    {
      // delegate to the parent component, assuming that no renderer type means that
      // there is no suitable replacable DOM element for this component
      addPartialTarget(facesContext, partialContext, component.getParent());
    }
  }
  else
  {
    partialContext.addPartialTarget(component.getClientId(facesContext));
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:22,代碼來源:UIXComponent.java

示例5: add

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
public void add(int index, UIComponent element)
{
  if (element == null)
    throw new NullPointerException();

  if ((index < 0) || (index > size()))
    throw new IndexOutOfBoundsException(_LOG.getMessage(
      "INDEX_SIZE", new Object[]{index, size()}));

  UIComponent oldParent = element.getParent();
  if (oldParent != null)
  {
    int adjustedIndex = __removeFromParent(element, index);
    // Only adjust the index when the child is re-added to the same parent
    if (oldParent == _parent)
    {
      index = adjustedIndex; 
    }
  }
  
  // do not change the order of these calls, see TRINIDAD-1674 for more info
  super.add(index, element);
  element.setParent(_parent);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:ChildArrayList.java

示例6: removeComponent

import javax.faces.component.UIComponent; //導入方法依賴的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

示例7: addComponentChange

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void addComponentChange(
  FacesContext facesContext,
  UIComponent uiComponent,
  ComponentChange change)
{
  // if our component is a stamped component by UIXIterator, we 
  // don't want to persist the changes 
  UIComponent parent = uiComponent.getParent();
  UIComponent root = facesContext.getViewRoot();
  while (parent != null && parent != root)
  {
    if (parent.getClass() == UIXIterator.class) 
    {
      _LOG.info("DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR");      
      return;
    }
    parent = parent.getParent();      
  }
      
  if (facesContext == null || uiComponent == null || change == null)
    throw new IllegalArgumentException(_LOG.getMessage(
      "CANNOT_ADD_CHANGE_WITH_FACECONTEXT_OR_UICOMPONENT_OR_NULL"));

  // add the change to the component
  addComponentChangeImpl(facesContext, uiComponent, change);

  // add a corresponding DocumentChange if possible
  _addEquivalentDocumentChange(facesContext, uiComponent, change);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:34,代碼來源:BaseChangeManager.java

示例8: encodeAll

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
protected final void encodeAll(
  FacesContext     context,
  RenderingContext rc,
  UIComponent      component,
  FacesBean        bean
  ) throws IOException
{
  UIComponent parent = component.getParent();

  //
  // complain if our parent isn't a FrameBorderLayout
  //
  if ((parent == null) ||
      !HtmlFrameBorderLayout.COMPONENT_FAMILY.equals(parent.getFamily()))
  {
    _LOG.warning("FRAMES_MUST_INSIDE_FRAMEBORDERLAYOUTS");
  }
  else
  {
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("frame", component);
    renderId(context, component);
    renderAllAttributes(context, rc, component, bean);
    writer.endElement("frame");
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:FrameRenderer.java

示例9: getLogicalParent

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * Provides a logical parent for the component (a parent in the context of the document where the component was
 * defined). The default implementation will simply call getParent() on the component. Components that get relocated during
 * tag execution should have their original parent returned (if available).
 * @param component - child component whose parent is being retrieved
 * @return logical parent component
 */
public static UIComponent getLogicalParent(UIComponent component)
{
  if (component instanceof UIXComponent)
  {
    return ((UIXComponent)component).getLogicalParent();
  }

  return component.getParent();
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:17,代碼來源:UIXComponent.java

示例10: _isParentPanelForm

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private boolean _isParentPanelForm(
  FacesContext context,
  UIComponent  component)
{
  if (PanelFormLayoutRenderer.__isInPanelFormLayout(context, component))
  {
    return true;
  }

  // We must know if the immediate parent is a PanelForm because if there is
  // even just one other component inbetween this component and a PanelForm,
  // we must render different DOM--the same DOM as if there were no parent
  // PanelForm.
  UIComponent parentComponent = component.getParent();
  String family = parentComponent.getFamily();
  // FIXME: OK... This is another strong coupling
  //        We could add a an interface instead like ComponentHolder or something
  //        instead of checking against a specific component family.
  while (UIXGroup.COMPONENT_FAMILY.equals(family))
  {
    // Special case:
    // Since UIXGroup components are purely organizational, it is valid to
    // have them inbetween panelForm-friendly components and the panelForm,
    // so we need to look further up the chain:
    parentComponent = parentComponent.getParent();
    if (parentComponent == null)
    {
      return false;
    }
    family = parentComponent.getFamily();
  }
  if (UIXPanel.COMPONENT_FAMILY.equals(family))
  {
    String rendererType = parentComponent.getRendererType();
    if (_isFormRendererType(rendererType))
      return true;
  }
  return false;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:40,代碼來源:LabelAndMessageRenderer.java

示例11: _getAncestor

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * Returns the nth ancestor of the passed in component.
 * @param component The UIComponent whose nth ancestor has to be found
 * @param level Indicates how many levels to go up from the component
 * @return The nth ancestor of the component
 */
private static UIComponent _getAncestor(UIComponent component, int level) 
{
  assert(level >= 0);
  
  while(level > 0)
  {
    component = component.getParent();
    level--;
  }
  return component;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:18,代碼來源:MoveChildComponentChange.java

示例12: encodeAll

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
public void encodeAll(FacesContext context) throws IOException {
	ResponseWriter writer = context.getResponseWriter();
	UIComponent parent = this;

	while (!(parent instanceof Map)) {
		parent = parent.getParent();
	}

	Map mapComponent = (Map) parent;
	String mapVar = mapComponent.getJsVariable();

	writer.write(mapVar + ".addControl(new ol.control.ZoomSlider());\n");
}
 
開發者ID:elielwaltrick,項目名稱:ol3jsf,代碼行數:15,代碼來源:ZoomSlider.java

示例13: encodeAll

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
public void encodeAll(FacesContext context) throws IOException {
	ResponseWriter writer = context.getResponseWriter();
	UIComponent parent = this;

	while (!(parent instanceof Map)) {
		parent = parent.getParent();
	}

	Map mapComponent = (Map) parent;
	String mapVar = mapComponent.getJsVariable();

	writer.write(mapVar + ".addControl(new ol.control.OverviewMap());\n");
}
 
開發者ID:elielwaltrick,項目名稱:ol3jsf,代碼行數:15,代碼來源:OverviewMap.java

示例14: _renderAsTable

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private boolean _renderAsTable(
  UIXRenderingContext context,
  UINode              node
  )
{
  UIComponent component = NodeUtils.getUIComponent(context, node);
  if (component.getParent() instanceof CorePanelButtonBar)
    return false;

  return true;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:ProcessChoiceBarRenderer.java

示例15: _getParentNamingContainerOrViewRoot

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private static UIComponent _getParentNamingContainerOrViewRoot (
  UIComponent from)
{
  while (from.getParent() != null)
  {
    from = from.getParent();
    if (from instanceof NamingContainer)
      break;
  }
  return from;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:ComponentUtils.java


注:本文中的javax.faces.component.UIComponent.getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。