package com.sujay.accessibility.client;

import com.smartgwt.client.widgets.HTMLFlow;

public class CustomHeader extends HTMLFlow {

	public enum Header {
		H1("h1"), H2("h2"), H3("h3"), H4("h4"), H5("h5"), H6("h6");

		private String headerTag;

		Header(final String type) {
			headerTag = type;
		}

		public String getHeaderTag() {
			return headerTag;
		}
	}

	public CustomHeader(final Header headerType, final String headerTitle) {
		super();
		final StringBuilder content = new StringBuilder();
		content.append(getHeaderBeginTag(headerType));
		content.append(headerTitle);
		content.append(getHeaderEndTag(headerType));
		this.setContents(content.toString());
	}

	private String getHeaderBeginTag(final Header headerType) {
		final StringBuilder begin = new StringBuilder("<");
		begin.append(headerType.getHeaderTag());
		begin.append(">");
		return begin.toString();
	}

	private String getHeaderEndTag(final Header headerType) {
		final StringBuilder end = new StringBuilder("</");
		end.append(headerType.getHeaderTag());
		end.append(">");
		return end.toString();
	}

}
