package com.cloudera.server.web.common.include;

import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Constructor;
import org.jamon.AbstractRenderer;
import org.jamon.AbstractTemplateImpl;
import org.jamon.AbstractTemplateProxy;
import org.jamon.AbstractTemplateProxy.ImplData;
import org.jamon.AbstractTemplateProxy.Intf;
import org.jamon.Renderer;
import org.jamon.TemplateManager;
import org.jamon.annotations.Template;

@Template(signature="2806C0951991B633D53421D0CA95622D", requiredArguments={@org.jamon.annotations.Argument(name="url", type="String"), @org.jamon.annotations.Argument(name="tooltip", type="String")}, optionalArguments={@org.jamon.annotations.Argument(name="containerClass", type="String"), @org.jamon.annotations.Argument(name="iframeName", type="String")})
public class UploadForm extends AbstractTemplateProxy
{
  protected String containerClass;
  protected String iframeName;

  public UploadForm(TemplateManager p_manager)
  {
    super(p_manager);
  }

  protected UploadForm(String p_path)
  {
    super(p_path);
  }

  public UploadForm()
  {
    super("/com/cloudera/server/web/common/include/UploadForm");
  }

  protected AbstractTemplateProxy.ImplData makeImplData()
  {
    return new ImplData();
  }

  public ImplData getImplData() {
    return (ImplData)super.getImplData();
  }

  public final UploadForm setContainerClass(String p_containerClass)
  {
    getImplData().setContainerClass(p_containerClass);
    return this;
  }

  public final UploadForm setIframeName(String p_iframeName)
  {
    getImplData().setIframeName(p_iframeName);
    return this;
  }

  public AbstractTemplateImpl constructImpl(Class<? extends AbstractTemplateImpl> p_class)
  {
    try
    {
      return (AbstractTemplateImpl)p_class.getConstructor(new Class[] { TemplateManager.class, ImplData.class }).newInstance(new Object[] { getTemplateManager(), getImplData() });
    }
    catch (RuntimeException e)
    {
      throw e;
    }
    catch (Exception e) {
    }
    throw new RuntimeException(e);
  }

  protected AbstractTemplateImpl constructImpl()
  {
    return new UploadFormImpl(getTemplateManager(), getImplData());
  }

  public Renderer makeRenderer(String url, String tooltip) {
    return new AbstractRenderer(url, tooltip)
    {
      public void renderTo(Writer jamonWriter)
        throws IOException
      {
        UploadForm.this.render(jamonWriter, this.val$url, this.val$tooltip);
      }
    };
  }

  public void render(Writer jamonWriter, String url, String tooltip) throws IOException
  {
    renderNoFlush(jamonWriter, url, tooltip);
    jamonWriter.flush();
  }

  public void renderNoFlush(Writer jamonWriter, String url, String tooltip) throws IOException
  {
    ImplData implData = getImplData();
    implData.setUrl(url);
    implData.setTooltip(tooltip);
    Intf instance = (Intf)getTemplateManager().constructImpl(this);
    instance.renderNoFlush(jamonWriter);
    reset();
  }

  public static class ImplData extends AbstractTemplateProxy.ImplData
  {
    private String m_url;
    private String m_tooltip;
    private String m_containerClass;
    private boolean m_containerClass__IsNotDefault;
    private String m_iframeName;
    private boolean m_iframeName__IsNotDefault;

    public void setUrl(String url)
    {
      this.m_url = url;
    }

    public String getUrl() {
      return this.m_url;
    }

    public void setTooltip(String tooltip)
    {
      this.m_tooltip = tooltip;
    }

    public String getTooltip() {
      return this.m_tooltip;
    }

    public void setContainerClass(String containerClass)
    {
      this.m_containerClass = containerClass;
      this.m_containerClass__IsNotDefault = true;
    }

    public String getContainerClass() {
      return this.m_containerClass;
    }

    public boolean getContainerClass__IsNotDefault()
    {
      return this.m_containerClass__IsNotDefault;
    }

    public void setIframeName(String iframeName)
    {
      this.m_iframeName = iframeName;
      this.m_iframeName__IsNotDefault = true;
    }

    public String getIframeName() {
      return this.m_iframeName;
    }

    public boolean getIframeName__IsNotDefault()
    {
      return this.m_iframeName__IsNotDefault;
    }
  }

  public static abstract interface Intf extends AbstractTemplateProxy.Intf
  {
    public abstract void renderNoFlush(Writer paramWriter)
      throws IOException;
  }
}