package db;

import java.io.IOException;

import db.column.ColumnBase;
import db.column.ColumnLabelRenderer;
import web.HTMLWriter;

public class AddButtonLabelRenderer implements ColumnLabelRenderer
{
	private String m_on_click;

    //--------------------------------------------------------------------------

	public
	AddButtonLabelRenderer(String on_click)
	{
		m_on_click = on_click;
	}

    //--------------------------------------------------------------------------

	@Override
	public void
	writeLabel(ColumnBase<?> column, HTMLWriter writer) throws IOException
	{
		writer.write(column.getDisplayName(false));
		writer.setAttribute("id", "add_span");
		writer.tagOpen("span");
		writer.write("<hr style=\"margin:2px 0\">");
		writer.setAttribute("style", "font-weight:normal;");
		writer.aButtonOnClick("add", m_on_click);
		writer.tagClose();
	}
}