Image gfx = ImageManager.getGfx(this.selectedBuilding.getType()
.toString().toLowerCase());
gfx.draw(ox + PADDING + 1, oy + PADDING * 2 + 32);
// Building name
Font fontBig = FontHelper
.getFont(FontHelper.HEMI_HEAD, Color.white, 30);
Font fontNormal = FontHelper.getFont(FontHelper.HEMI_HEAD, Color.white,
20);
int x = ox + PADDING * 2 + 32;
int y = oy + PADDING * 2;
fontBig.drawString(x - 40, y, FontHelper.firstToUpper(I18n
.get(this.selectedBuilding.getI18n())));
// Building level
String temp = I18n.get("global.level") + " : "
+ this.selectedBuilding.getLevel();
fontNormal.drawString(x, y += 40, FontHelper.firstToUpper(temp));
// Current action
String title = null;
BigDecimal maxValue = null;
BigDecimal value = null;
DelayedAction a = getSelectedBuildingAction();
this.selectedBuildingPB.setFilledColor(Color.red);
if (a instanceof BuildingAction) {
BuildingAction ba = (BuildingAction) a;
if (ba.isUpgrade()) {
// Upgrade process
title = FontHelper.firstToUpper(I18n.get("global.upgrading"))
+ "...";
this.selectedBuildingPB.setFilledColor(Color.magenta);
} else if (!ba.isUpgrade()) {
// Building process
title = FontHelper.firstToUpper(I18n.get("global.building"))
+ "...";
}
maxValue = BigDecimal.valueOf(ba.getDuration());
value = BigDecimal.valueOf(ba.getCurrentValue());
} else if (a instanceof ColonyAction) {
ColonyAction sa = (ColonyAction) a;
title = FontHelper.firstToUpper(I18n.get(sa.getI18nKey())) + "...";
this.selectedBuildingPB.setFilledColor(Color.red);
maxValue = BigDecimal.valueOf(sa.getDuration());
value = BigDecimal.valueOf(sa.getCurrentValue());
}
if (a != null) {
fontNormal.drawString(x, y += 35, title);
// Action progress
this.selectedBuildingPB.setMaxValue(maxValue);
this.selectedBuildingPB.setValue(value);
this.selectedBuildingPB.setOX(x);