ItemEstruturaDao itemDao = new ItemEstruturaDao(request);
ItemEstruturaIett item = (ItemEstruturaIett)itemDao.buscar(ItemEstruturaIett.class, Long.valueOf( codIett ));
List locaisItem = new ArrayList(item.getItemEstrutLocalIettls());
LocalGrupoLgp localGrupoItem = ((ItemEstrutLocalIettl)locaisItem.get(0)).getLocalItemLit().getLocalGrupoLgp();
// Se a lista de locais n�o estiver vazia
if (!localList.isEmpty() && !localList.isEmpty()){
final int larguraLocal = 250;
final int larguraCampo = 150;
final int larguraTotal = 200;
final int cont=listaExercicios.size();
final int larguraCaixaTexto;
if (80 / cont > 15) {
larguraCaixaTexto = 15;
}
else{
larguraCaixaTexto = (80 / cont );
}
// Criando a tabela
responseHTML.append( "<table width=" + (larguraLocal + cont*larguraCampo + larguraTotal) + "class='layoutFixo' bgcolor='#EAEEF4' style='table-layout: fixed; text-align: left; margin-left: auto; margin-right: auto;' border='0' cellpadding='0' cellspacing='0' > ");
// Inserindo a checkbox superior
responseHTML.append( " <tr> ");
responseHTML.append( " <td colspan=" + (cont + 2) + "valign='top' height='25px'> ");
responseHTML.append( " <input type='checkbox' name='copiarQtde1' id='copiarQtde1' value='true' onchange='checkboxSincroniza(\"copiarQtde1\",\"copiarQtde2\");' > Copiar Quantidade(s) para o(s) exerc�cio(s) posterior(es)? ");
responseHTML.append( " <label ");
responseHTML.append( " id=\"label|-1|-1\"");
responseHTML.append( " class=\"dica\" ");
responseHTML.append( " onmouseover=\"" );
responseHTML.append( " montaTooltipMouseOver(this,\'-1\', \'\', \'-1\', \'\');" );
responseHTML.append( " \"" );
responseHTML.append( " onmouseout=\"" );
responseHTML.append( " montaTooltipMouseOut(\'-1\', \'-1\');" );
responseHTML.append( " \"" );
responseHTML.append( " />" );
responseHTML.append( " <img " );
responseHTML.append( " src=\"" + request.getContextPath() + "/images/dica.png\" " );
responseHTML.append( " align=\"absmiddle\" " );
responseHTML.append( " border=\"0\" " );
responseHTML.append( " onclick=\"" );
responseHTML.append( " montaTooltipMouseClick(\'-1\', \'\', \'-1\', \'\');" );
responseHTML.append( " \" " );
responseHTML.append( " /> " );
responseHTML.append( " " );
responseHTML.append( " <span id=\"span|-1|-1\" ></span>" );
responseHTML.append( " " );
responseHTML.append( " </label>" );
responseHTML.append( " </td> ");
responseHTML.append( " </tr> ");
// Inserindo o t�tulo Exerc�cio
responseHTML.append( " <tr> ");
responseHTML.append( " <td width=" + larguraLocal + " style='font-size: 14px;color: #003366;font-weight: bold;' align='center' > </td>");
responseHTML.append( " <td colspan=\"" + (cont + 1) + "\" style=\"font-size: 14px;color: #003366;font-weight: bold;\" align=\"center\" >Exercicio</td>");
responseHTML.append( " </tr> ");
// Inserindo os t�tulos Local, exerc�cios e Total por Local
responseHTML.append( " <tr> ");
responseHTML.append( " <td width=" + larguraLocal + " style='font-size: 14px;color: #003366;font-weight: bold;' align='center' >Local</td> ");
for (Iterator iterator = listaExercicios.iterator(); iterator.hasNext();) {
ExercicioExe exe = (ExercicioExe) iterator.next();
responseHTML.append( " <td width=" + larguraCampo + " style=\"font-size: 14px;color: #003366;font-weight: bold;\" align=\"center\" > ");
responseHTML.append(exe.getDescricaoExe().toUpperCase() );
responseHTML.append( " </td> ");
}
responseHTML.append( " <td width=" + larguraTotal + " style='font-size: 14px;color: #003366;font-weight: bold;' align='center' >Total por Local</td> ");
responseHTML.append( " <tr> ");
// Inserindo a caixa de sele��o
Set subgrupo = localGrupoItem.getLocalGrupoHierarquiaLgphsByCodLgpPai();
if ( subgrupo!=null && !subgrupo.isEmpty()){
responseHTML.append( " <tr> ");
responseHTML.append( " <td width=" + larguraLocal + " style='font-size: 12px;color: #003366;' align='left' > ");
responseHTML.append( " <table width='90%'> ");
responseHTML.append( " <tr>" );
responseHTML.append( " <td width='25%' align='right'>" );
responseHTML.append( " <img src='../../images/icon_seta_ident.gif'/>" );
responseHTML.append( " </td>" );
responseHTML.append( " <td width='75%'>" );
responseHTML.append( " <select name='subgrupo' id='subgrupo' onchange='carregarlocal();' > ");
int indice = 1;
responseHTML.append( " <option value=" + localGrupoItem.getCodLgp() + " >Selecione</option> ");
for (Iterator itGrupo = subgrupo.iterator(); itGrupo.hasNext();) {
LocalGrupoLgp grupo = (LocalGrupoLgp) itGrupo.next();
if(indice == itemSelecionado){
responseHTML.append( " <option value='" + grupo.getCodLgp() + "' selected='true'>" + grupo.getIdentificacaoLgp() + "</option>" );
}
else {
responseHTML.append( " <option value='" + grupo.getCodLgp() + "' >" + grupo.getIdentificacaoLgp() + "</option>" );
}
indice++;
}
responseHTML.append( " </select> ");
responseHTML.append( " </td>" );