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


Java UIComponent.getValueExpression方法代碼示例

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


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

示例1: getAsObject

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
public Object getAsObject(FacesContext context, UIComponent component,
        String value) {

    if (value == null || component.getValueExpression("value") == null) {
        return null;
    }
    @SuppressWarnings("unchecked")
    Class<? extends Enum<?>> enumType = (Class<? extends Enum<?>>) component
            .getValueExpression("value").getType(context.getELContext());
    for (Enum<?> e : enumType.getEnumConstants()) {
        if (e.toString().equals(value)) {
            return e;
        }
    }
    return null;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:17,代碼來源:EnumConverter.java

示例2: _getMessage

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private LabeledFacesMessage _getMessage(
 UIComponent component,
 String text)
{
  // Using the LabeledFacesMessage allows the <tr:messages> component to
  // properly prepend the label as a link.
  LabeledFacesMessage lfm =
    new LabeledFacesMessage(FacesMessage.SEVERITY_ERROR,
                            "Conversion Error", text);
  if (component != null)
  {
    Object label = null;
    label = component.getAttributes().get("label");
    if (label == null)
      label = component.getValueExpression("label");
    if (label != null)
      lfm.setLabel(label);
  }
  return lfm;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:21,代碼來源:SSNConverter.java

示例3: _executeBindings

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
 * Execute any "binding" attributes so that a popped view
 * is properly set up
 */
@SuppressWarnings("unchecked")
private void _executeBindings(FacesContext context, UIComponent component)
{
  ValueExpression expression = component.getValueExpression("binding");
  if (expression != null)
    expression.setValue(context.getELContext(), component);

  Iterator<UIComponent> kids = component.getFacetsAndChildren();
  while (kids.hasNext())
    _executeBindings(context, kids.next());
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:16,代碼來源:DialogServiceImpl.java

示例4: _getLabel

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private static Object _getLabel(UIComponent component)
{
  Object o = null;
  if (component != null)
  {
    o = component.getAttributes().get("label");
    if (o == null)
      o = component.getValueExpression("label");
  }
  return o;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:PasswordValidator.java

示例5: _getLabel

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private static Object _getLabel(UIComponent component)
{
  Object o = null;
  if (component != null)
  {
    o = component.getAttributes().get("label");
    if (o == null)
      o = component.getValueExpression ("label");
  }
  return o;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:MessageFactory.java

示例6: _updateRowKeySetInPlace

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private void _updateRowKeySetInPlace(UIComponent component, String attrName, RowKeySet newValue)
{
  ValueExpression oldExpression = component.getValueExpression(attrName);
  
  // due to bug in how the trinidad table and tree handle their RowKeySets, always use
  // invoke on component and get the old value in context all of the time for now rather
  // than trying to get the value directly if we don't have an expression
  //use EL to get the oldValue and then determine whether we need to update in place
  final FacesContext context = FacesContext.getCurrentInstance();
              
  context.getViewRoot().invokeOnComponent(
    context,
    _clientId,
    new GetOldValueAndUpdate(oldExpression, attrName, newValue));
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:16,代碼來源:RowKeySetAttributeChange.java

示例7: getConverter

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
private Converter getConverter(FacesContext context, UIComponent component) {
	Converter converter = ((UIInput) component).getConverter();
	if (converter != null) {
		return converter;
	}
	ValueExpression exp = component.getValueExpression("value");
	if (exp == null) {
		return null;
	}
	Class valueType = exp.getType(context.getELContext());
	if (valueType == null) {
		return null;
	}
	return context.getApplication().createConverter(valueType);
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:16,代碼來源:SketchPadRenderer.java

示例8: getConverter

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
static public Converter getConverter(
  UIComponent component)
{  
  FacesContext fContext = FacesContext.getCurrentInstance();

  Converter converter = null;
  Class<?> modelClass = null;
  
  ValueExpression expression = component.getValueExpression("value");
  if (expression != null)
  {
    modelClass = expression.getType(fContext.getELContext());
    if (modelClass == null)
    {
      Object o = expression.getValue(fContext.getELContext());
      if (o != null)
      {
        modelClass = o.getClass();
      }
    }
  }

  if ((modelClass != null) && 
      ( modelClass.isArray() ||  modelClass.isAssignableFrom(List.class)))
  {
      // get the itemClass in the case where modelClass is an array or List
      // for instance, in the case of selectManyListbox
      Class<?> itemClass = modelClass.getComponentType();
      if (itemClass != null)
      {
         converter = ConverterUtils.createConverter(fContext, itemClass);           
      }      
  }
  else
  {
    converter = ConverterUtils.createConverter(fContext, modelClass);
  }


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

示例9: _typeConvertAndDefaultAttrs

import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private boolean _typeConvertAndDefaultAttrs(
  String regionType,
  ComponentMetaData cmd)
{
  boolean hasErrors = false;
  UIComponent region = getComponentInstance();
  Map<String, Object> compAttrs = region.getAttributes();
  List<AttributeMetaData> attrs = cmd.getAttributes();
  int sz = attrs.size();
  for(int i=0; i<sz; i++)
  {
    AttributeMetaData attr = attrs.get(i);
    String name = attr.getAttrName();
    Class<?> klass = attr.getAttrClass();
    if (region.getValueExpression(name) != null)
      continue;

    Object compValue = compAttrs.get(name);
    if (compValue == null)
    {
      // if attribute value was not specified then try to default it:
      String defaultValue = attr.getDefaultValue();
      if (defaultValue != null)
      {
        hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);
      }
      // if no default value was found then make sure the attribute was not
      // required:
      else if (attr.isRequired())
      {
        _LOG.severe("COMPONENTTYPE_MISSING_ATTRIBUTE", new Object[] {name, regionType});
        hasErrors = true;
      }
    }
    // if a value was specified see if it needs to be type converted:
    else if (compValue instanceof String)
    {
      hasErrors |= _typeConvert(compAttrs, name, (String) compValue, klass);
    }
  }
  return hasErrors;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:44,代碼來源:ComponentRefTag.java


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