Java Code Examples for javax.faces.component.UIComponent.getValueBinding()

The following are Jave code examples for showing how to use getValueBinding() of the javax.faces.component.UIComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: myfaces-trinidad   File: ConverterUtils.java   Source Code and License Vote up 5 votes
private static final Object _getLabel(
  UIComponent component
)
{
  Object o = component.getAttributes().get("label");
  if (o == null)
    o = component.getValueBinding("label");

  return o;
}
 
Example 2
Project: myfaces-trinidad   File: ValidatorUtils.java   Source Code and License Vote up 5 votes
static Object getComponentLabel(UIComponent component)
{ 
    Object label = component.getAttributes().get("label");
    if ( null == label)
     label = component.getValueBinding("label");
     
    return label;
}
 
Example 3
Project: myfaces-trinidad   File: ConverterUtils.java   Source Code and License Vote up 5 votes
static Object getComponentLabel(UIComponent component)
{ 
    Object label = component.getAttributes().get("label");
    if ( null == label)
     label = component.getValueBinding("label");
     
    return label;
}
 
Example 4
Project: myfaces-trinidad   File: ComponentEditorHandler.java   Source Code and License Vote up 4 votes
public List<PropertyOfComponent> getAttributes()
{
  if (_list != null)
    return _list;

  UIComponent comp = getComponent();
  if (comp == null)
    return null;

  List<PropertyOfComponent> list = new ArrayList<PropertyOfComponent>();
  try
  {
    BeanInfo beanInfo = Introspector.getBeanInfo(comp.getClass());
    PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
    for (int i = 0; i < descriptors.length; i++)
    {
      PropertyDescriptor descriptor = descriptors[i];
      // "Write-only" properties - no go
      if (descriptor.getReadMethod() == null)
        continue;

      PropertyOfComponent poc = null;

      boolean readOnly = descriptor.getWriteMethod() == null;
      if (readOnly)
        continue;

      // For now, skip any attributes with ValueBindings
      String name = descriptor.getName();
      if (comp.getValueBinding(name) != null)
        continue;
                      

      Class<?> type = descriptor.getPropertyType();
      if ((type == String.class) ||
          (type == Object.class))
      {
        if (!isJavascriptShown() &&
            name.startsWith("on"))
          continue;

        poc = new StringProperty(comp, descriptor);
      }
      else if ((type == Integer.class) ||
               (type == Integer.TYPE))
      {
        poc = new IntegerProperty(comp, descriptor);
      }
      else if ((type == Boolean.class) ||
               (type == Boolean.TYPE))
      {
        poc = new BooleanProperty(comp, descriptor);
      }
      else if (type == Date.class)
      {
        poc = new DateProperty(comp, descriptor);
      }

      if (poc != null)
        list.add(poc);
    }

    // Sort the list by property name
    Collections.sort(list);

    _list = list;

    return list;
  }
  catch (Exception e)
  {
    e.printStackTrace();
  }

  return null;
}