public void apply(FaceletContext faceletContext,
UIComponent parent) throws IOException, FacesException, FaceletException, ELException
{
if(ComponentSupport.isNew(parent))
{
FileDownloadActionListener listener = new FileDownloadActionListener();
if (_filename != null)
{
if (_filename.isLiteral())
listener.setFilename(_filename.getValue());
else
{
ValueExpression valueExp = _filename.getValueExpression(faceletContext,
Object.class);
listener.setValueBinding(FileDownloadActionListener.FILENAME_KEY,
new LegacyValueBinding(valueExp));
}
}
if (_contentType != null)
{
if (_contentType.isLiteral())
listener.setContentType(_contentType.getValue());
else
{
ValueExpression valueExp = _contentType.getValueExpression(faceletContext,
Object.class);
listener.setValueBinding(FileDownloadActionListener.CONTENT_TYPE_KEY,
new LegacyValueBinding(valueExp));
}
}
MethodExpression me = _method.getMethodExpression(faceletContext,
Object.class,
_METHOD_PARAMS);
listener.setMethod(new LegacyMethodBinding(me));
ActionSource actionSource = (ActionSource)parent;
actionSource.addActionListener(listener);
}
}