com.sun.faces.application
Class ConverterPropertyEditorBase

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by com.sun.faces.application.ConverterPropertyEditorBase
All Implemented Interfaces:
java.beans.PropertyEditor
Direct Known Subclasses:
ConverterPropertyEditorFor_XXXX

public abstract class ConverterPropertyEditorBase
extends java.beans.PropertyEditorSupport

Abstract base for a PropertyEditor that delegates to a faces Converter that was registered by-type in a faces-config descriptor. Concrete implementations (such as generated by ConverterPropertyEditorFactory) will override getTargetClass(). (This is based on the original ConverterPropertyEditor code).


Field Summary
protected static java.util.logging.Logger logger
           
static java.lang.String TARGET_COMPONENT_ATTRIBUTE_NAME
           
 
Constructor Summary
ConverterPropertyEditorBase()
           
 
Method Summary
 java.lang.String getAsText()
          Convert an object of type getTargetClass() to text by delegating to a converter obtained from the Faces application.
protected  javax.faces.component.UIComponent getComponent()
          Return the UIComponent that is currently being processed, so it can be passed on to the Converter.
protected abstract  java.lang.Class<?> getTargetClass()
          Return the target class of the objects that are being edited.
 void setAsText(java.lang.String textValue)
          Convert the textValue to an object of type getTargetClass() by delegating to a converter obtained from the Faces application.
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final java.util.logging.Logger logger

TARGET_COMPONENT_ATTRIBUTE_NAME

public static final java.lang.String TARGET_COMPONENT_ATTRIBUTE_NAME
See Also:
Constant Field Values
Constructor Detail

ConverterPropertyEditorBase

public ConverterPropertyEditorBase()
Method Detail

getTargetClass

protected abstract java.lang.Class<?> getTargetClass()
Return the target class of the objects that are being edited. This is used as a key to find the appropriate Converter from the Faces application.

Returns:
the target class.

getComponent

protected javax.faces.component.UIComponent getComponent()
Return the UIComponent that is currently being processed, so it can be passed on to the Converter. (Most basic converters use this for creating and setting error messages, although they may also use attributes of the component to customize the conversion). For now, do this by looking for a request attribute keyed on TARGET_COMPONENT_ATTRIBUTE_NAME.

Returns:
the current component, or null.

setAsText

public void setAsText(java.lang.String textValue)
               throws java.lang.IllegalArgumentException
Convert the textValue to an object of type getTargetClass() by delegating to a converter obtained from the Faces application.

Specified by:
setAsText in interface java.beans.PropertyEditor
Overrides:
setAsText in class java.beans.PropertyEditorSupport
Throws:
java.lang.IllegalArgumentException

getAsText

public java.lang.String getAsText()
Convert an object of type getTargetClass() to text by delegating to a converter obtained from the Faces application.

Specified by:
getAsText in interface java.beans.PropertyEditor
Overrides:
getAsText in class java.beans.PropertyEditorSupport


Copyright ? 2002-2006 Sun Microsystems, Inc. All Rights Reserved.