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

import java.util.*;

public class LetsAjax2ColumnHeaderLayoutTemplate
{
  protected static String nl;
  public static synchronized LetsAjax2ColumnHeaderLayoutTemplate create(String lineSeparator)
  {
    nl = lineSeparator;
    LetsAjax2ColumnHeaderLayoutTemplate result = new LetsAjax2ColumnHeaderLayoutTemplate();
    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 + "  <link rel=\"stylesheet\" href=\"./css/LetsAjax2ColumnHeaderLayout.css\" type=\"text/css\">";
  protected final String TEXT_4 = NL + "    <script type='text/javascript' src='";
  protected final String TEXT_5 = "'></script>";
  protected final String TEXT_6 = NL + "    <link rel=\"stylesheet\" href=\"";
  protected final String TEXT_7 = "\" type=\"text/css\">";
  protected final String TEXT_8 = "  " + NL + "</head>";
  protected final String TEXT_9 = NL + "    ";
  protected final String TEXT_10 = NL + "  <div id=\"wrapper\">" + NL + "    <div id=\"header\">";
  protected final String TEXT_11 = NL + "           ";
  protected final String TEXT_12 = NL + "    </div>" + NL + "    <div id=\"subwrapper\">" + NL + "      <div id=\"sideleft\">";
  protected final String TEXT_13 = NL + "           ";
  protected final String TEXT_14 = NL + "      </div>" + NL + "      <div id=\"contents\">";
  protected final String TEXT_15 = NL + "           ";
  protected final String TEXT_16 = NL + "      </div>" + NL + "    </div>" + NL + "  </div>" + NL + "</body>" + NL + "</html>";
  protected final String TEXT_17 = 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);
     } 
     List cssList = (List) ((Map)argument).get("cssNameList"); 
     for (Iterator iter = cssList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_6);
    stringBuffer.append( iter.next() );
    stringBuffer.append(TEXT_7);
     } 
    stringBuffer.append(TEXT_8);
     List bodyList = (List) ((Map)argument).get("bodyTag"); 
       for (Iterator iter = bodyList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_9);
    stringBuffer.append( iter.next() );
       }  
    stringBuffer.append(TEXT_10);
     List headeryList = (List) ((Map)argument).get("header"); 
     for (Iterator iter = headeryList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_11);
    stringBuffer.append( iter.next() );
     } 
    stringBuffer.append(TEXT_12);
     List sideleftList = (List) ((Map)argument).get("sideleft"); 
     for (Iterator iter = sideleftList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_13);
    stringBuffer.append( iter.next() );
     } 
    stringBuffer.append(TEXT_14);
     List contentsList = (List) ((Map)argument).get("contents"); 
     for (Iterator iter = contentsList.iterator(); iter.hasNext(); ) { 
    stringBuffer.append(TEXT_15);
    stringBuffer.append( iter.next() );
     } 
    stringBuffer.append(TEXT_16);
    stringBuffer.append(TEXT_17);
    return stringBuffer.toString();
  }
}
