private void appendLabelResource(Listitem item) {
ResourceWithItsLoadRatios dataToRender = (ResourceWithItsLoadRatios) item
.getValue();
Listcell cellName = new Listcell();
Resource resource = dataToRender.getResource();
cellName.appendChild(new Label(resource.getShortDescription()));
item.appendChild(cellName);
Listcell cellAvailability = new Listcell();
BigDecimal availability = dataToRender.getRatios()
.getAvailiabilityRatio();
Div totalDiv = new Div();
totalDiv.setStyle("width:50px;height:12px;border: solid 1px black");
Div containedDiv = new Div();
String styleValue = "width:" + availability.movePointRight(2)
+ "%;height:12px;background-color:"
+ calculateRgba(availability) + ";float:left;left:0";
containedDiv.setStyle(styleValue);
Label l = new Label(availability.movePointRight(2).toString() + "%");
l.setStyle("width:50px;margin-left: 12px");
containedDiv.appendChild(l);
totalDiv.appendChild(containedDiv);
cellAvailability.appendChild(totalDiv);
item.appendChild(cellAvailability);
Listcell cellOvertime = new Listcell();
BigDecimal overtime = dataToRender.getRatios().getOvertimeRatio();
Label overtimeLabel = new Label(overtime.toString());
cellOvertime.appendChild(overtimeLabel);
if (!overtime.equals(BigDecimal.ZERO.setScale(2))) {
overtimeLabel.setStyle("position: relative; top: -12px");
Image img = new Image(
"/dashboard/img/value-meaning-negative.png");
img.setStyle("width: 25px; position: relative; top: -5px");
cellOvertime.appendChild(img);
}
item.appendChild(cellOvertime);
}