Extract method in order to encapsulate the rule in one place
FEA: ItEr69S08AdvanceAllocationFix
This commit is contained in:
parent
b9590a9153
commit
f975a8a112
1 changed files with 9 additions and 9 deletions
|
|
@ -1510,17 +1510,19 @@ class Row {
|
|||
}
|
||||
|
||||
Component hoursOnInterval(DetailItem item) {
|
||||
Component result =
|
||||
isGroupingRow() || isBeforeTaskStartDate(item) ||
|
||||
isBeforeLatestConsolidation(item) ?
|
||||
new Label() :
|
||||
disableIfNeeded(item, noNegativeIntbox());
|
||||
Component result = cannotBeEdited(item) ? new Label()
|
||||
: disableIfNeeded(item, noNegativeIntbox());
|
||||
reloadHoursOnInterval(result, item);
|
||||
componentsByDetailItem.put(item, result);
|
||||
addListenerIfNeeded(item, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean cannotBeEdited(DetailItem item) {
|
||||
return isGroupingRow() || isBeforeTaskStartDate(item) ||
|
||||
isBeforeLatestConsolidation(item);
|
||||
}
|
||||
|
||||
private Intbox disableIfNeeded(DetailItem item, Intbox intBox) {
|
||||
intBox.setDisabled(restriction.isDisabledEditionOn(item));
|
||||
return intBox;
|
||||
|
|
@ -1534,8 +1536,7 @@ class Row {
|
|||
|
||||
private void addListenerIfNeeded(final DetailItem item,
|
||||
final Component component) {
|
||||
if (isGroupingRow() || isBeforeTaskStartDate(item) ||
|
||||
isBeforeLatestConsolidation(item)) {
|
||||
if (cannotBeEdited(item)) {
|
||||
return;
|
||||
}
|
||||
final Intbox intbox = (Intbox) component;
|
||||
|
|
@ -1559,8 +1560,7 @@ class Row {
|
|||
}
|
||||
|
||||
private void reloadHoursOnInterval(Component component, DetailItem item) {
|
||||
if (isGroupingRow() || isBeforeTaskStartDate(item)
|
||||
|| isBeforeLatestConsolidation(item)) {
|
||||
if (cannotBeEdited(item)) {
|
||||
Label label = (Label) component;
|
||||
label.setValue(getHoursForDetailItem(item) + "");
|
||||
label.setClass(getLabelClassFor(item));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue