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


Java UIParameter类代码示例

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


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

示例1: getParameterComponents

import javax.faces.component.UIParameter; //导入依赖的package包/类
/**
 * Return the map of name/value pairs for any child UIParameter components.
 * 
 * @param component to find UIParameter child values for
 * 
 * @return a Map of name/value pairs or <tt>null</tt> if none found
 */
protected static Map<String, String> getParameterComponents(final UIComponent component)
{
   if (component.getChildCount() == 0)
   {
      return null;
   }

   final Map<String, String> params = new HashMap<String, String>(component.getChildCount(), 1.0f);
   for (UIComponent child : (List<UIComponent>)component.getChildren())
   {
      if (child instanceof UIParameter)
      {
         final UIParameter param = (UIParameter)child;
         params.put(param.getName(), param.getValue() != null ? param.getValue().toString() : null);
      }
   }
   return params;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:26,代码来源:BaseRenderer.java

示例2: encodeFormSubmit

import javax.faces.component.UIParameter; //导入依赖的package包/类
private static void encodeFormSubmit(UIComponent component, ResponseWriter rw, boolean evenWithoutParameters)
		throws IOException {
	String parameterList = "";
	List<UIComponent> children = component.getChildren();
	for (UIComponent parameter : children) {
		if (parameter instanceof UIParameter) {
			String value = String.valueOf(((UIParameter) parameter).getValue());
			String name = ((UIParameter) parameter).getName();
			if (null != value) {
				parameterList += ",'" + name + "':'" + value + "'";
			}
		}
	}
	if (evenWithoutParameters || parameterList.length() > 0) {
		UIForm currentForm = getSurroundingForm((UIComponent) component, false);
		parameterList = "'" + currentForm.getClientId() + "',{'" + component.getClientId() + "':'"
				+ component.getClientId() + "'" + parameterList + "}";
		rw.writeAttribute("onclick",
				encodeClick((UIComponent) component) + "BsF.submitForm(" + parameterList + ");return false;", null);
	}
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:22,代码来源:AJAXRenderer.java

示例3: encodeBegin

import javax.faces.component.UIParameter; //导入依赖的package包/类
@Override
public void encodeBegin(FacesContext context) throws IOException {

    JsfRenderUtils.addEventHandlingHiddenFieldsIfNotExists(context, this);
    List<UIParameter> uiParameters = getParametersWithNameAttribute();
    JsfRenderUtils.addHiddenFieldsForParametersIfNotExists(context, this, uiParameters);
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("a", this);
    writer.writeAttribute("type", (this.getType() != null) ? this.getType() : "", null);
    writer.writeAttribute("title", (this.getTitle() != null) ? this.getTitle() : "", null);
    if (this.getTarget() != null) {
        writer.writeAttribute("target", this.getTarget(), null);
    }
    writer.writeAttribute("onclick", getOnClickEvent(context, uiParameters), null);
    writer.writeAttribute("href", "#", null);
    writer.writeAttribute("id", getClientId(context), null);
    writer.writeAttribute("name", getClientId(context), null);
    writer.writeAttribute("style", (this.getStyle() != null) ? this.getStyle() : "", null);
    writer.writeAttribute("class", (this.getStyleClass() != null) ? this.getStyleClass() : "", null);

    writer.writeText(this.getValue(), null);

}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:25,代码来源:UICommandLink.java

示例4: getParametersWithNameAttribute

import javax.faces.component.UIParameter; //导入依赖的package包/类
private List<UIParameter> getParametersWithNameAttribute() {
    List<UIParameter> result = new ArrayList<UIParameter>();

    List children = this.getChildren();

    for (int i = 0; i < children.size(); i++) {
        UIComponent child = (UIComponent) children.get(i);

        if (child instanceof UIParameter) {
            UIParameter parameter = (UIParameter) child;

            if (parameter.getName() != null) {
                result.add(parameter);
            }
        }
    }

    return result;
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:20,代码来源:UICommandLink.java

示例5: getSubmitJavaScriptWithParameters

import javax.faces.component.UIParameter; //导入依赖的package包/类
/**
 * 
 * @param context
 * @param component
 * @param uiParameterList
 * @return
 */
public static String getSubmitJavaScriptWithParameters(FacesContext context, UIComponent component,
        List<UIParameter> uiParameterList) {
    UIForm parentForm = findForm(component);
    String parentFormClientId = parentForm.getClientId(context);
    String componentClientId = component.getClientId(context);
    String eventSenderHiddenFieldId = getEventSenderHiddenFieldId(parentFormClientId);

    StringBuilder setParametersJavaScript = new StringBuilder();

    for (int i = 0; i < uiParameterList.size(); i++) {
        UIParameter parameter = uiParameterList.get(i);
        setParametersJavaScript.append("document.forms['").append(parentFormClientId).append("'].elements['")
                .append(parameter.getName()).append("'].value='").append(parameter.getValue()).append("';");

    }

    StringBuilder onClickEvent = new StringBuilder();
    onClickEvent.append("document.forms['").append(parentFormClientId).append("'].elements['");
    onClickEvent.append(eventSenderHiddenFieldId).append("'].value='").append(componentClientId).append("';");
    onClickEvent.append(setParametersJavaScript.toString());
    onClickEvent.append("document.forms['").append(parentFormClientId).append("'].submit();");

    return onClickEvent.toString();
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:32,代码来源:JsfRenderUtils.java

示例6: encodeBegin

import javax.faces.component.UIParameter; //导入依赖的package包/类
@Override
public void encodeBegin(FacesContext context) throws IOException {

    ResponseWriter writer = context.getResponseWriter();

    JsfRenderUtils.addEventHandlingHiddenFieldsIfNotExists(context, this);
    List<UIParameter> uiParameters = getParametersWithNameAttribute();
    JsfRenderUtils.addHiddenFieldsForParametersIfNotExists(context, this, uiParameters);

    writer.startElement("input", this);
    writer.writeAttribute("type", (this.getType() == null) ? INPUT_SUBMIT_TYPE : this.getType(), null);
    writer.writeAttribute("id", getClientId(context), null);
    writer.writeAttribute("name", getClientId(context), null);
    writer.writeAttribute("style", (this.getStyle() != null) ? this.getStyle() : "", null);
    writer.writeAttribute("class", (this.getStyleClass() != null) ? this.getStyleClass() : "", null);
    writer.writeAttribute("alt", (this.getAlt() != null) ? this.getAlt() : "", null);
    writer.writeAttribute("value", (this.getValue() != null) ? this.getValue() : "", null);
    writer.writeAttribute("onclick", getOnClickEvent(context, uiParameters), null);

    if (this.getType() != null && this.getType().equalsIgnoreCase(INPUT_IMAGE_TYPE)) {
        writer.writeAttribute("src", (this.getImage() != null) ? this.getImage() : "", null);
    }

}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:25,代码来源:UICommandButton.java

示例7: addChildParametersToHref

import javax.faces.component.UIParameter; //导入依赖的package包/类
private void addChildParametersToHref(FacesContext facesContext,
                                      UIComponent linkComponent,
                                      StringBuffer hrefBuf,
                                      boolean firstParameter,
                                      String charEncoding)
        throws IOException
{
    boolean strictXhtmlLinks
            = MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isStrictXhtmlLinks();
    
    List<UIParameter> validParams = HtmlRendererUtils.getValidUIParameterChildren(
            facesContext, getChildren(linkComponent), false, false);
    for (UIParameter param : validParams)
    {
        String name = param.getName();
        Object value = param.getValue();
        addParameterToHref(name, value, hrefBuf, firstParameter, charEncoding, strictXhtmlLinks);
        firstParameter = false;
    }
}
 
开发者ID:OWASP,项目名称:EJSF,代码行数:21,代码来源:EsapiOutputLinkRenderer.java

示例8: getBehaviorParameters

import javax.faces.component.UIParameter; //导入依赖的package包/类
/**
 * Get a collection of all the parameters that are children of the current component as
 * client behavior parameters.
 * @param component The component
 * @return Collection of parameters (will be non-null)
 */
public static Collection<ClientBehaviorContext.Parameter> getBehaviorParameters(
  UIComponent component)
{
  int childCount = component.getChildCount();
  if (childCount > 0)
  {
    List<ClientBehaviorContext.Parameter> list = null;
    for (UIComponent child : component.getChildren())
    {
      if (!(child instanceof UIParameter)) { continue; }

      if (list == null)
      {
        // leave plenty of room to hold the parameters
        list = new ArrayList<ClientBehaviorContext.Parameter>(childCount);
      }
      UIParameter param = (UIParameter) child;
      list.add(new ClientBehaviorContext.Parameter(param.getName(), param.getValue()));
    }

    if (list != null)
    {
      return list;
    }
  }

  return Collections.<ClientBehaviorContext.Parameter>emptyList();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:35,代码来源:CoreRenderer.java

示例9: removeOrder

import javax.faces.component.UIParameter; //导入依赖的package包/类
public void removeOrder(ActionEvent event) {
    try {
        UIParameter param = (UIParameter) event.getComponent().findComponent("deleteOrderId");
        Integer id = Integer.parseInt(param.getValue().toString());
        request.removeOrder(id);
        logger.log(Level.INFO, "Removed order {0}.", id);
    } catch (NumberFormatException e) {
    }
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:10,代码来源:OrderManager.java

示例10: getEventParameterMap

import javax.faces.component.UIParameter; //导入依赖的package包/类
/**
 * If the JSF h:commandLink component includes f:param children, those name-value pairs
 * are put into the request parameter map for later use by the action handler. Unfortunately,
 * the same isn't done for h:commandButton. This is a workaround to let arguments
 * be associated with a button.
 *
 * Because action listeners are guaranteed to be executed before action methods, an
 * action listener can use this method to update any context the action method might need.
 */
public static final Map getEventParameterMap(FacesEvent event) {
	Map parameterMap = new HashMap();
	List children = event.getComponent().getChildren();
	for (Iterator iter = children.iterator(); iter.hasNext(); ) {
		Object next = iter.next();
		if (next instanceof UIParameter) {
			UIParameter param = (UIParameter)next;
			parameterMap.put(param.getName(), param.getValue());
		}
	}
	if (log.isDebugEnabled()) log.debug("parameterMap=" + parameterMap);
	return parameterMap;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:23,代码来源:FacesUtil.java

示例11: getParams

import javax.faces.component.UIParameter; //导入依赖的package包/类
/**
 * Find all parameters to include by looking at nested uiparams and params
 * of navigation case
 */
protected Map<String, List<String>> getParams(NavigationCase navCase, AbstractNavLink button) {
	Map<String, List<String>> params = new LinkedHashMap<String, List<String>>();

	// UIParams
	for (UIComponent child : ((UIComponent) button).getChildren()) {
		if (child.isRendered() && (child instanceof UIParameter)) {
			UIParameter uiParam = (UIParameter) child;

			if (!uiParam.isDisable()) {
				List<String> paramValues = params.get(uiParam.getName());
				if (paramValues == null) {
					paramValues = new ArrayList<String>();
					params.put(uiParam.getName(), paramValues);
				}

				paramValues.add(String.valueOf(uiParam.getValue()));
			}
		}
	}

	// NavCase Params
	Map<String, List<String>> navCaseParams = navCase.getParameters();
	if (navCaseParams != null && !navCaseParams.isEmpty()) {
		for (Map.Entry<String, List<String>> entry : navCaseParams.entrySet()) {
			String key = entry.getKey();

			// UIParams take precedence
			if (!params.containsKey(key)) {
				params.put(key, entry.getValue());
			}
		}
	}

	return params;
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:40,代码来源:NavLinkRenderer.java

示例12: removeOrder

import javax.faces.component.UIParameter; //导入依赖的package包/类
public void removeOrder(ActionEvent event) {
    try {
        UIParameter param = (UIParameter) event.getComponent().findComponent("deleteOrderId");
        Integer id = Integer.parseInt(param.getValue().toString());
        request.removeOrder(id);
        logger.log(Level.INFO, "Removed order {0}.", id);
    } catch (Exception e) {
    }
}
 
开发者ID:osmanpub,项目名称:oracle-samples,代码行数:10,代码来源:OrderManager.java

示例13: getOnClickEvent

import javax.faces.component.UIParameter; //导入依赖的package包/类
private String getOnClickEvent(FacesContext context, List<UIParameter> uiParameters) {
    StringBuilder onClickEvent = new StringBuilder();

    if (this.getOnclick() != null) {
        onClickEvent.append(this.getOnclick()).append(";");
    }

    onClickEvent.append(JsfRenderUtils.getSubmitJavaScriptWithParameters(context, this, uiParameters));

    return onClickEvent.toString();
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:12,代码来源:UICommandLink.java

示例14: addHiddenFieldsForParametersIfNotExists

import javax.faces.component.UIParameter; //导入依赖的package包/类
public static void addHiddenFieldsForParametersIfNotExists(FacesContext context, UIComponent parentComponent,
        List<UIParameter> uiParameters) throws IOException {

    UIForm parentForm = findForm(parentComponent);
    String parentFormClientId = parentForm.getClientId(context);
    ResponseWriter writer = context.getResponseWriter();
    HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();

    for (int i = 0; i < uiParameters.size(); i++) {
        UIParameter parameter = uiParameters.get(i);
        addHiddenFieldForParameterIfNotExists(parentFormClientId, request, writer, parameter.getName());
    }
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:14,代码来源:JsfRenderUtils.java

示例15: getParameters

import javax.faces.component.UIParameter; //导入依赖的package包/类
/**
 * Find all UIParameter children of a component, and
 * return it as a JS string of "name1:value1,name2:value2".
 */
@SuppressWarnings("unchecked")
public static String getParameters(UIComponent comp)
{
  int childCount = comp.getChildCount();
  if (childCount == 0)
    return null;

  StringBuilder builder = null;
  for(UIComponent child : (List<UIComponent>)comp.getChildren())
  {
    if (child instanceof UIParameter)
    {
      UIParameter param = (UIParameter) child;
      String name = param.getName();
      Object value = param.getValue();
      if ((value == null) || (name == null))
        continue;

      if (builder == null)
        builder = new StringBuilder();

      // Add a comma if needed
      if (builder.length() > 0)
        builder.append(',');

      // Add the name and value, and in both cases
      // wrap in single quotes and escape it - we don't
      // know for sure if the name will be a legit JS identifier
      builder.append('\'');
      builder.append(XhtmlUtils.escapeJS(name));
      builder.append("':'");
      builder.append(XhtmlUtils.escapeJS(value.toString()));
      builder.append('\'');
    }
  }

  if (builder == null)
    return null;

  return builder.toString();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:46,代码来源:AutoSubmitUtils.java


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