Hi,
how can I embed the sorted list iList I get at the end of the second while in the html I get in the first while?
It was ok previously with SortedMap except this class doesn't allow duplicates, and I need to print out duplicates too which ArrayList allows?
Thanks for your help.
how can I embed the sorted list iList I get at the end of the second while in the html I get in the first while?
Code:
ArrayList list = new ArrayList();
Iterator i = items.iterator();
while(i.hasNext())
{
double pc;
Item item = (Item) i.next();
if(item.getNextStage().getStageId() == Stage.DONE)
{
pc = 100.0;
} else {
int done = item.getHistory().size();
int total = item.getItemType().getStages().size();
pc = 100.0 * done / total;
}
list.add(new Double(pc));
String html = "";
html += "<td class=columnwhite>" +item.getItemType().getDescription()+ "</td>";
html += "<td class=columnwhite>" +item.getSystem().getName()+ "</td>";
html += "<td class=columnwhite>" +item.getJtd()+ "</td>";
html += "<td class=columnwhite>" +item.getTag()+ "</td>";
html += "<td class=columnwhite>" +item.getStage().getStageTemplate().getDescription()+ "</td>";
html += "<td class=columnwhite>" +item.getNextStage().getStageTemplate().getDescription()+ "</td>";
//here I need the result of the sorted list
html += "<td class=columnwhite>" +roundPercentage.format(pc)+ "%</td>";
html += "<td class=columnwhite width=75><table width=100% border=0 cellspacing=0 cellpadding=0 style=border:1px solid #000000;><tr>";
if (pc > 0.00001) {
html += "<td width=" +pc+ "><img src=images/bargrph_blue.gif width=100% height=10></td>";
}
if (pc < 100.00000) {
html += "<td bgcolor=#CCCCFF><img src=images/bargrph_spacer.gif width=1 height=10></td>";
}
html += "</tr></table></td></tr>";
}//end while
Collections.sort(list);
Iterator iList = list.iterator();
while(iList.hasNext())
{
out.print(iList.next());
}
Thanks for your help.