Vector<CodeChunk> chunkVector = new Vector<CodeChunk>(java.util.Arrays.asList(chunks));
/** Generazione dei grouppi di attributi **/
for (int i = 0; i < bean.getFormFieldsGroups().size(); i++)
{
FormFieldsGroup group = bean.getFormFieldsGroups().get(i);
CodeChunk start = new CodeChunk(group.getFromFieldOrder());
start.addHtmlCode("\r\n\r\n<!-- START GROUP: " + group.getTitle() + " -->\r\n");
start.addHtmlCode("<rich:panel header=\"" + group.getTitle() + "\" rendered=\"#{");
start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='CREATE'");
if (!group.getShowOnCreateIf().equals(""))
start.addHtmlCode(" and " + group.getShowOnCreateIf());
start.addHtmlCode(")");
start.addHtmlCode(" or ");
start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='EDIT'");
if (!group.getShowOnEditIf().equals(""))
start.addHtmlCode(" and " + group.getShowOnEditIf());
start.addHtmlCode(")");
start.addHtmlCode(" or ");
start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DISPLAY'");
if (!group.getShowOnDisplayIf().equals(""))
start.addHtmlCode(" and " + group.getShowOnDisplayIf());
start.addHtmlCode(")");
start.addHtmlCode(" or ");
start.addHtmlCode("(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Operation=='DELETE'");
if (!group.getShowOnDeleteIf().equals(""))
start.addHtmlCode(" and " + group.getShowOnDeleteIf());
start.addHtmlCode(")");
start.addHtmlCode("}\" >\r\n\r\n");
start.addHtmlCode("<table width=\"100%\">\r\n");
int idx = getChunkIndex(chunkVector, start);
chunkVector.add(idx, start);
CodeChunk end = new CodeChunk(group.getToFieldOrder());
end.addHtmlCode("</table>\r\n");
end.addHtmlCode("\r\n\r\n</rich:panel>\r\n");
//end.addHtmlCode("<tr:spacer height=\"25\" />\r\n");
end.addHtmlCode("<!-- END GROUP: " + group.getTitle() + " -->\r\n\r\n");
idx = getChunkIndex(chunkVector, end);
chunkVector.add(idx + 1, end);
}