package com.cloudera.server.web.cmf.commands;

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="8D7C627F986519C26EBBDF2E93B6399A", requiredArguments={@org.jamon.annotations.Argument(name="activeOnly", type="boolean"), @org.jamon.annotations.Argument(name="dataUrl", type="String")}, optionalArguments={@org.jamon.annotations.Argument(name="limit", type="int"), @org.jamon.annotations.Argument(name="offset", type="int"), @org.jamon.annotations.Argument(name="interval", type="int")})
public class CommandsPageFragment extends AbstractTemplateProxy
{
  protected int limit;
  protected int offset;
  protected int interval;

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

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

  public CommandsPageFragment()
  {
    super("/com/cloudera/server/web/cmf/commands/CommandsPageFragment");
  }

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

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

  public final CommandsPageFragment setLimit(int p_limit)
  {
    getImplData().setLimit(p_limit);
    return this;
  }

  public final CommandsPageFragment setOffset(int p_offset)
  {
    getImplData().setOffset(p_offset);
    return this;
  }

  public final CommandsPageFragment setInterval(int p_interval)
  {
    getImplData().setInterval(p_interval);
    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 CommandsPageFragmentImpl(getTemplateManager(), getImplData());
  }

  public Renderer makeRenderer(boolean activeOnly, String dataUrl) {
    return new AbstractRenderer(activeOnly, dataUrl)
    {
      public void renderTo(Writer jamonWriter)
        throws IOException
      {
        CommandsPageFragment.this.render(jamonWriter, this.val$activeOnly, this.val$dataUrl);
      }
    };
  }

  public void render(Writer jamonWriter, boolean activeOnly, String dataUrl) throws IOException
  {
    renderNoFlush(jamonWriter, activeOnly, dataUrl);
    jamonWriter.flush();
  }

  public void renderNoFlush(Writer jamonWriter, boolean activeOnly, String dataUrl) throws IOException
  {
    ImplData implData = getImplData();
    implData.setActiveOnly(activeOnly);
    implData.setDataUrl(dataUrl);
    Intf instance = (Intf)getTemplateManager().constructImpl(this);
    instance.renderNoFlush(jamonWriter);
    reset();
  }

  public static class ImplData extends AbstractTemplateProxy.ImplData
  {
    private boolean m_activeOnly;
    private String m_dataUrl;
    private int m_limit;
    private boolean m_limit__IsNotDefault;
    private int m_offset;
    private boolean m_offset__IsNotDefault;
    private int m_interval;
    private boolean m_interval__IsNotDefault;

    public void setActiveOnly(boolean activeOnly)
    {
      this.m_activeOnly = activeOnly;
    }

    public boolean getActiveOnly() {
      return this.m_activeOnly;
    }

    public void setDataUrl(String dataUrl)
    {
      this.m_dataUrl = dataUrl;
    }

    public String getDataUrl() {
      return this.m_dataUrl;
    }

    public void setLimit(int limit)
    {
      this.m_limit = limit;
      this.m_limit__IsNotDefault = true;
    }

    public int getLimit() {
      return this.m_limit;
    }

    public boolean getLimit__IsNotDefault()
    {
      return this.m_limit__IsNotDefault;
    }

    public void setOffset(int offset)
    {
      this.m_offset = offset;
      this.m_offset__IsNotDefault = true;
    }

    public int getOffset() {
      return this.m_offset;
    }

    public boolean getOffset__IsNotDefault()
    {
      return this.m_offset__IsNotDefault;
    }

    public void setInterval(int interval)
    {
      this.m_interval = interval;
      this.m_interval__IsNotDefault = true;
    }

    public int getInterval() {
      return this.m_interval;
    }

    public boolean getInterval__IsNotDefault()
    {
      return this.m_interval__IsNotDefault;
    }
  }

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