Eliminate code repetition

FEA: ItEr69S08AdvanceAllocationFix
This commit is contained in:
Óscar González Fernández 2011-01-24 20:47:01 +01:00
parent 880acd78f4
commit b9590a9153

View file

@ -1559,19 +1559,11 @@ class Row {
}
private void reloadHoursOnInterval(Component component, DetailItem item) {
if (isGroupingRow()) {
if (isGroupingRow() || isBeforeTaskStartDate(item)
|| isBeforeLatestConsolidation(item)) {
Label label = (Label) component;
label.setValue(getHoursForDetailItem(item) + "");
label.setClass("calculated-hours");
}
else if (isBeforeTaskStartDate(item)) {
Label label = (Label) component;
label.setValue(getHoursForDetailItem(item) + "");
label.setClass("unmodifiable-hours");
} else if (isBeforeLatestConsolidation(item)) {
Label label = (Label) component;
label.setValue(getHoursForDetailItem(item) + "");
label.setClass("consolidated-hours");
label.setClass(getLabelClassFor(item));
} else {
Intbox intbox = (Intbox) component;
intbox.setValue(getHoursForDetailItem(item));
@ -1581,6 +1573,19 @@ class Row {
}
}
private String getLabelClassFor(DetailItem item) {
if (isGroupingRow()) {
return "calculated-hours";
}
if (isBeforeTaskStartDate(item)) {
return "unmodifiable-hours";
}
if (isBeforeLatestConsolidation(item)) {
return "consolidated-hours";
}
return "";
}
private boolean isBeforeTaskStartDate(DetailItem item) {
return task.getIntraDayStartDate().compareTo(
item.getEndDate().toLocalDate()) >= 0;