Package org.primefaces.component.filedownload

Source Code of org.primefaces.component.filedownload.FileDownloadTag

package org.primefaces.component.filedownload;

import javax.el.ValueExpression;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.event.ActionListener;
import javax.faces.webapp.UIComponentClassicTagBase;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class FileDownloadTag extends TagSupport {

  private ValueExpression value;
 
  public int doStartTag() throws JspException {

    ActionListener actionListener = new FileDownloadActionListener(value);

    UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);

    if(tag == null)
      throw new JspException("FileDownload component needs to be enclosed in a UICommand component");

    if(tag.getCreated()) {
      UIComponent component = tag.getComponentInstance();
      ((ActionSource) component).addActionListener(actionListener);
    }

    return SKIP_BODY;
  }

  public ValueExpression getValue() {
    return value;
  }

  public void setValue(ValueExpression value) {
    this.value = value;
  }
 
  public void release() {
    value = null;
  }
}
TOP

Related Classes of org.primefaces.component.filedownload.FileDownloadTag

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.