package jp.co.cybec.laxide.file.template;

import java.util.*;

public class LetsAjax2ColumnLayoutTemplate
{
  protected static String nl;
  public static synchronized LetsAjax2ColumnLayoutTemplate create(String lineSeparator)
  {
    nl = lineSeparator;
    LetsAjax2ColumnLayoutTemplate result = new LetsAjax2ColumnLayoutTemplate();
    nl = null;
    return result;
  }

  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = NL + "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" + NL + "" + NL + "<html lang=\"ja\">" + NL + "<head>" + NL + "  <meta http-equiv=\"Content-Type\" Content=\"text/html;charset=Shift_JIS\">";
  protected final String TEXT_2 = NL + "    ";
  protected final String TEXT_3 = NL + " " + NL + "  ";
  protected final String TEXT_4 = NL + "    <script type='text/javascript' src='";
  protected final String TEXT_5 = "'></script>";
  protected final String TEXT_6 = NL + "  " + NL + "  <link rel=\"stylesheet\" href=\"./css/LetsAjax2ColumnLayout.css\" type=\"text/css\">";
  protected final String TEXT_7 = NL + "    <link rel=\"stylesheet\" href=\"";
  protected final String TEXT_8 = "\" type=\"text/css\">";
  protected final String TEXT_9 = "  " + NL + "   " + NL + "</head>";
  protected final String TEXT_10 = NL + "    ";
  protected final String TEXT_11 = NL + "  <div id=\"wrapper\">" + NL + "    <div id=\"sideleft\">";
  protected final String TEXT_12 = NL + "         ";
  protected final String TEXT_13 = NL + "    </div>" + NL + "    <div id=\"contents\">";
  protected final String TEXT_14 = NL + "         ";
  protected final String TEXT_15 = NL + "    </div>" + NL + "  </div> " + NL + "</body>" + NL + "</html>";
  protected final String TEXT_16 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
     List headList = (List) ((Map)argument).get("headTagList"); 
       for (Iterator iter = headList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_2);
    stringBuffer.append( iter.next() );
       } 
    stringBuffer.append(TEXT_3);
     List scriptNameList = (List) ((Map)argument).get("scriptNameList"); 
     for (Iterator iter = scriptNameList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_4);
    stringBuffer.append( iter.next() );
    stringBuffer.append(TEXT_5);
     } 
    stringBuffer.append(TEXT_6);
     List cssList = (List) ((Map)argument).get("cssNameList"); 
     for (Iterator iter = cssList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_7);
    stringBuffer.append( iter.next() );
    stringBuffer.append(TEXT_8);
     } 
    stringBuffer.append(TEXT_9);
     List bodyList = (List) ((Map)argument).get("bodyTag"); 
       for (Iterator iter = bodyList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_10);
    stringBuffer.append( iter.next() );
       }  
    stringBuffer.append(TEXT_11);
     List leftList = (List) ((Map)argument).get("sideleft"); 
     for (Iterator iter = leftList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_12);
    stringBuffer.append( iter.next() );
     } 
    stringBuffer.append(TEXT_13);
     List contentsList = (List) ((Map)argument).get("contents"); 
     for (Iterator iter = contentsList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_14);
    stringBuffer.append( iter.next() );
     } 
    stringBuffer.append(TEXT_15);
    stringBuffer.append(TEXT_16);
    return stringBuffer.toString();
  }
}
