Eliminate code repetition
FEA: ItEr69S08AdvanceAllocationFix
This commit is contained in:
parent
880acd78f4
commit
b9590a9153
1 changed files with 16 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue