package de.vanitasvitae.imi.codes; import java.util.List; import de.vanitasvitae.imi.codes.types.SampleTubeCode; public class HtmlTableStringBuilder { private StringBuilder html; /** * Generated a HTML String which contains a table of {@link SampleTubeCode SampleTubeCodes}. * * @param title Title which gets inserted as level 2 header. * @param codes list of codes */ public HtmlTableStringBuilder(String title, List codes) { html = new StringBuilder("\n") .append("\n") .append("\n") .append("\n") .append("") .append("") .append("\n"); // Add title html.append("

").append(title).append("

\n"); // Open table html.append("\n") .append("\n") .append("\n") .append("\n"); // Append table entries for (SampleTubeCode c : codes) { html.append("\n") .append("\n") .append("\n"); } // Close table html.append("
Code
").append(c.toString()).append("
\n"); // Close body and html html.append("\n"); html.append(""); } @Override public String toString() { return html.toString(); } }