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


Java UIComponent.getClientId方法代碼示例

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


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

示例1: validateFromAndToDate

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
public void validateFromAndToDate(final FacesContext context,
        final UIComponent toValidate, final Object value) {
    model.setFailedDateComponentId("");
    validator.setToDate(getModel().getToDate());
    validator.setFromDate(getModel().getFromDate());
    String clientId = toValidate.getClientId(context);
    try {
        validator.validate(context, toValidate, value);
    } catch (ValidatorException ex) {
        context.addMessage(
                clientId,
                new FacesMessage(FacesMessage.SEVERITY_ERROR, ex
                        .getLocalizedMessage(), null));
        model.setFailedDateComponentId(clientId);
    }

}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:18,代碼來源:ExportBillingDataCtrl.java

示例2: 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

示例3: _findChild

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 *  Find the child whose Id is passed as argument.
 *
 *  If the specified child can't be found, doesn't do anything.
 *
 *  @param context the facesContext object
 *  @param parent which may contain disclosedChildId as it's child
 *  @param disclosedChildId id of the child to be found among it's children
 *
 */
@SuppressWarnings("unchecked")
private static UIComponent _findChild(FacesContext context,
                                      UIComponent component,
                                      String disclosedChildId)
{
  if  (disclosedChildId == null)
  {
    return null;
  }

  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    String childId = child.getClientId(context);
    if (disclosedChildId.equals(childId))
    {
      return child;
    }
  }

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

示例4: getRendererClientId

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * Returns the clientId used by the renderer in place of the clientId used by the component.
 * Certain renderers render their root element with a clientId that differs from the one
 * used by the component.
 * @param context FacesContent.
 * @param component UIComponent.
 * @return component clientId if the renderer clientId is null. Otherwise clientId used by 
 * renderer.
 */
public static String getRendererClientId(
  FacesContext context, 
  UIComponent component) 
{
  String clientId = component.getClientId(context);
  String family = component.getFamily();
  String rendererType = component.getRendererType();
  if (rendererType != null)
  {
    Renderer renderer = context.getRenderKit().getRenderer(family, rendererType);
    if (renderer instanceof CoreRenderer)
    {
      CoreRenderer coreRenderer = (CoreRenderer) renderer;
      String rendererClientId = coreRenderer.getClientId(context, component);
      return rendererClientId == null ? clientId : rendererClientId;
    }
  }
  return clientId;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:RenderUtils.java

示例5: getValue

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
public Object getValue(UIXRenderingContext context)
{
    
  UIComponent stamp = getStamp(_menuComponent);
  
  if(stamp != null)
  { 
    // Save the current key  
    Object oldPath =_menuComponent.getRowKey();
    boolean isNewPath = setNewPath(_menuComponent);
    if (isNewPath)
    {
      String clientId = stamp.getClientId(context.getFacesContext());
      _menuComponent.setRowKey(oldPath);
      return clientId;
    }
  }
  
  return null;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:21,代碼來源:MenuSelectedValueBoundValue.java

示例6: decode

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * @todo Set "expanded" vs. "collapsed" correctly on the queued
 *  DisclosureEvent
 * @todo deal with null and exceptions
 */
@SuppressWarnings("unchecked")
@Override
protected void decode(
  FacesContext facesContext,
  UIComponent  component,
  @SuppressWarnings("unused")
  FacesBean    facesBean,
  String       clientId)
{
  decodeSelection(facesContext, component);

  Map<String, String> parameters =
    facesContext.getExternalContext().getRequestParameterMap();

  Object source = parameters.get(XhtmlConstants.SOURCE_PARAM);
  clientId = clientId == null ? component.getClientId(facesContext) : clientId;
  if (clientId.equals(source))
  {
    UIXTreeTable treeTable = (UIXTreeTable) component;
    TreeUtils.decodeExpandEvents(parameters, component,
                                 TreeUtils.getFocusRowKey(treeTable));
    TreeUtils.decodeFocusEvent(parameters, component);
    TreeUtils.decodeGotoEvent(parameters, component);
    // bug 4522210:
    RequestContext.getCurrentInstance().addPartialTarget(component);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:33,代碼來源:TreeTableRenderer.java

示例7: encodeBegin

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
public void encodeBegin(FacesContext context, UIComponent component)
{
  boolean isDefault = ((UIXSubform) component).isDefault();
  String clientId = component.getClientId(context);
  getSubformList(context, false, true).add(clientId);
  if (isDefault)
    getSubformList(context, true, true).add(clientId);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:10,代碼來源:SubformRenderer.java

示例8: decode

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
public void decode(FacesContext context, UIComponent component)
{
  Object source =
    context.getExternalContext().getRequestParameterMap().get("source");

  String clientId = component.getClientId(context);
  if ((source != null) &&
      source.equals(clientId))
  {
    (new ActionEvent(component)).queue();
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:14,代碼來源:HtmlCommandButtonRenderer.java

示例9: decode

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void decode(
  FacesContext facesContext,
  UIComponent  component,
  @SuppressWarnings("unused")
  FacesBean    facesBean,
  String       clientId)
{
  Map<String, String> parameters =
    facesContext.getExternalContext().getRequestParameterMap();

  Object event = parameters.get(XhtmlConstants.EVENT_PARAM);
  if (XhtmlConstants.POLL_EVENT.equals(event))
  {
    Object source = parameters.get(XhtmlConstants.SOURCE_PARAM);
    String id = clientId == null ? component.getClientId(facesContext) : clientId;

    if (id.equals(source))
    {
      // This component always uses PPR (unless not supported at all)
      PartialPageUtils.forcePartialRendering(facesContext);

      // And forcibly re-render ourselves - because that's how
      // we get the poll re-started
      RequestContext.getCurrentInstance().addPartialTarget(component);

      UIXPoll poll = (UIXPoll) component;
      (new PollEvent(component)).queue();
      if (poll.isImmediate())
        facesContext.renderResponse();
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:35,代碼來源:PollRenderer.java

示例10: _pushPartialTarget

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private void _pushPartialTarget(
  UIComponent component,
  String      elementName)
  throws IOException
{
  PPRTag tag = null;

  // If we're already inside a target, don't bother
  if (!_isInsideTarget())
  {
    if (component != null)
    {
      String clientId = component.getClientId(_facesContext);
      String renderedClientId = RenderUtils.getRendererClientId(_facesContext, component);
      if (_state.pprContext.isPartialTarget(clientId))
      {
        tag = new PPRTag(clientId, renderedClientId);
        _state.enteringPPR = component;
      }
    }
  }

  if (tag != null)
  {
    super.flush();
    tag.startUpdate(_state.pprContext, elementName);
  }

  _state.componentStack.add(tag);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:31,代碼來源:PPRResponseWriter.java

示例11: decode

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
protected void decode(
  FacesContext facesContext,
  UIComponent  component,
  @SuppressWarnings("unused")
  FacesBean    facesBean,
  String       clientId)
{
  if (skipDecode(facesContext))
    return;

  Object submittedValue;
  if (!wasSubmitted(facesContext, component))
    submittedValue = null;
  else
  {
    if (clientId == null)
    {
      clientId = component.getClientId(facesContext);
    }
    submittedValue = getSubmittedValue(facesContext, component, clientId);
  }

  if (_LOG.isFinest())
  {
    if (clientId == null)
    {
      clientId = component.getClientId(facesContext);
    }
    _LOG.finest("Value submitted for ID {0} is {1}",
      new Object[]{clientId, submittedValue});
  }

  EditableValueHolder evh = (EditableValueHolder) component;
  evh.setSubmittedValue(submittedValue);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:37,代碼來源:EditableValueRenderer.java

示例12: decode

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void decode(
  FacesContext facesContext,
  UIComponent  component,
  FacesBean    facesBean,
  String       clientId)
{
  RequestContext requestContext = RequestContext.getCurrentInstance();
  ReturnEvent returnEvent =
    requestContext.getDialogService().getReturnEvent(component);
  if (returnEvent != null)
  {
    returnEvent.queue();
  }
  else
  {
    Map<String, String> parameterMap =
      facesContext.getExternalContext().getRequestParameterMap();

    Object source = parameterMap.get("javax.faces.source");
    
    // Support the legacy as well as JSF2 parameter name
    if (source == null) 
    {
      source = parameterMap.get("source");  
    }
    
    if (clientId == null)
    {
      clientId = component.getClientId(facesContext);
    }

    if ((source != null) && source.equals(clientId))
    {
      (new ActionEvent(component)).queue();
      if (getPartialSubmit(component, facesBean))
      {
        PartialPageUtils.forcePartialRendering(facesContext);
      }
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:44,代碼來源:CommandLinkRenderer.java

示例13: decode

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void decode(FacesContext context, UIComponent component)
{
  Map<String, String> parameters =  
    context.getExternalContext().getRequestParameterMap();
  
  Object event = parameters.get(UIConstants.EVENT_PARAM);

  if (UIConstants.GOTO_EVENT.equals(event))
  {
    Object source = parameters.get(UIConstants.SOURCE_PARAM);

    String id = component.getClientId(context);

    if (id.equals(source))
    {

      Object newValue = parameters.get(UIConstants.VALUE_PARAM);

      int newValueInt = -1;

      if ( newValue != null)
      {
        try{
          newValueInt = Integer.parseInt(newValue.toString());
        }
        catch ( NumberFormatException nfe)
        {
          _LOG.severe(nfe);
        }
      }


      // queue the action on the singleStep component
      // set immediate to true when going back (no validation)
      // and set to false when going forward (validation).
      UIXSingleStep singleStep = (UIXSingleStep) component;

      int oldValueInt = singleStep.getSelectedStep();
      if (newValueInt < oldValueInt )
      {
        singleStep.setActionType(UIXSingleStep.PREVIOUS_ACTION_TYPE);

      }
      else
      {
        singleStep.setActionType(UIXSingleStep.NEXT_ACTION_TYPE);

      }



      // queue an action event
      // This must be added to queue AFTER the actionType is set
      (new ActionEvent(component)).queue();
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:60,代碼來源:SingleStepRenderer.java

示例14: _getRelativeId

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private static String _getRelativeId(
  FacesContext context,
  UIComponent  from,
  String       relativeId,
  int          colonCount)
{


  if (colonCount == 1)
    return relativeId.substring(1);
  else if (colonCount > 1)
  {
    relativeId = relativeId.substring(colonCount);
  }
    
  // if the component is not a NamingContainer, then we need to 
  // get the component's naming container and set this as the 'from'.

  if (!(from instanceof NamingContainer))
  {
    from = _getParentNamingContainer(from);
  }
  // pop out of the naming containers if there are multiple colons
  // from will be null if there are no more naming containers
  for (int j = 1; j < colonCount; j++)
  {
    from = _getParentNamingContainer(from);
  }

  // assumption is no one but the parent naming container modifies its
  // client id
  if (from == null)
    return relativeId;
  else
  {
    return (from.getClientId(context) +
            NamingContainer.SEPARATOR_CHAR + relativeId);
  }


}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:42,代碼來源:RenderUtils.java

示例15: renderListDisplay

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * @inheritDoc
 *
 */
@Override
protected void renderListDisplay(FacesContext context,
                                 UIComponent component,
                                 String disclosedChildId)
  throws IOException
{
  // This renders the select controls alongwith javascript onchange handler.
  UIXRenderingContext rCtx =
    getRenderingContext(context, component);

  String compId = component.getClientId(context);

  ResponseWriter out = context.getResponseWriter();

  // draw table to contain the select UI control
  out.startElement("table", component);
  out.writeAttribute("id", compId + _CHOICE_TABLE_SUFFIX_ID_CONST, null);
  out.writeAttribute("border", "0", null);
  out.writeAttribute("cellspacing", "0", null);
  out.writeAttribute("cellpadding", "0", null);

  if (!XhtmlLafRenderer.isInaccessibleMode(rCtx))
  {
    out.writeAttribute("summary", "", null);
  }

  out.startElement("tr", component);

  renderSelectLabel(rCtx, component, out, compId);

  // Render filler / separator between label and select control
  renderSpacerTD(out, component, getLabelControlSeparatorSize());

  _renderSelectItemInTD(context,
                        component,
                        disclosedChildId);

  out.endElement("tr");
  out.endElement("table");
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:45,代碼來源:CorePanelChoiceRenderer.java


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