Disable resource allocation pop-up for tasks updated from timesheets

FEA: ItEr77S12AdaptPlanningAccordingTimesheets
This commit is contained in:
Manuel Rego Casasnovas 2012-11-12 13:00:44 +01:00
parent f25897a6a4
commit 2c98e99d63
5 changed files with 32 additions and 11 deletions

View file

@ -107,7 +107,8 @@ public class AllocationConfiguration extends HtmlMacroComponent {
.getCalculatedValue())) {
radio.setChecked(true);
}
radio.setDisabled(formBinder.isAnyManual());
radio.setDisabled(formBinder.isAnyManual()
|| formBinder.isTaskUpdatedFromTimesheets());
}
}
};

View file

@ -423,4 +423,9 @@ public class AllocationRowsHandler {
private ArrayList<AllocationRow> copyOfCurrentRowsToAvoidConcurrentModification() {
return new ArrayList<AllocationRow>(currentRows);
}
public boolean isTaskUpdatedFromTimesheets() {
return task.isUpdatedFromTimesheets();
}
}

View file

@ -216,7 +216,7 @@ public class FormBinder {
boolean disabled = rows.isEmpty()
|| (CalculatedValue.NUMBER_OF_HOURS == c)
|| (c == CalculatedValue.RESOURCES_PER_DAY && !recommendedAllocation)
|| isAnyManual();
|| isAnyManual() || isTaskUpdatedFromTimesheets();
this.effortInput.setDisabled(disabled);
}
@ -244,13 +244,14 @@ public class FormBinder {
allResourcesPerDayVisibilityRule();
applyDisabledRulesOnRows();
this.btnRecommendedAllocation.setDisabled(recommendedAllocation
|| isAnyManual());
|| isAnyManual() || isTaskUpdatedFromTimesheets());
}
private void applyDisabledRulesOnRows() {
for (AllocationRow each : rows) {
each.applyDisabledRules(getCalculatedValue(),
recommendedAllocation, isAnyManual());
recommendedAllocation, isAnyManual()
|| isTaskUpdatedFromTimesheets());
}
}
@ -358,7 +359,7 @@ public class FormBinder {
void applyDisabledRules() {
this.taskWorkableDays.setDisabled(allocationRowsHandler
.getCalculatedValue() == CalculatedValue.END_DATE
|| isAnyManual());
|| isAnyManual() || isTaskUpdatedFromTimesheets());
}
private void initializeDateAndDurationFieldsFromTaskOriginalValues() {
@ -461,7 +462,8 @@ public class FormBinder {
CalculatedValue c = allocationRowsHandler.getCalculatedValue();
this.allResourcesPerDay.setDisabled(rows.isEmpty()
|| c == CalculatedValue.RESOURCES_PER_DAY
|| !recommendedAllocation || isAnyManual());
|| !recommendedAllocation || isAnyManual()
|| isTaskUpdatedFromTimesheets());
this.allResourcesPerDay
.setConstraint(constraintForAllResourcesPerDay());
}
@ -518,6 +520,10 @@ public class FormBinder {
* exit the edition form
*/
public boolean accept() {
if (isTaskUpdatedFromTimesheets()) {
return true;
}
Flagged<AllocationResult, Warnings> result = resourceAllocationModel
.accept();
@ -703,7 +709,8 @@ public class FormBinder {
public void setRecommendedAllocation(Button recommendedAllocation) {
this.btnRecommendedAllocation = recommendedAllocation;
this.btnRecommendedAllocation.setDisabled(isAnyManual());
this.btnRecommendedAllocation.setDisabled(isAnyManual()
|| isTaskUpdatedFromTimesheets());
Util.ensureUniqueListener(recommendedAllocation, Events.ON_CLICK,
new EventListener() {
@Override
@ -935,4 +942,8 @@ public class FormBinder {
return false;
}
public boolean isTaskUpdatedFromTimesheets() {
return allocationRowsHandler.isTaskUpdatedFromTimesheets();
}
}

View file

@ -602,7 +602,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
// On click delete button
Button deleteButton = appendDeleteButton(row);
deleteButton.setDisabled(isAnyManual());
deleteButton.setDisabled(isAnyManualOrTaskUpdatedFromTimesheets());
formBinder.setDeleteButtonFor(data, deleteButton);
deleteButton.addEventListener("onClick", new EventListener() {
@ -671,8 +671,12 @@ public class ResourceAllocationController extends GenericForwardComposer {
return formBinder != null && formBinder.isAnyNotFlat();
}
public boolean isAnyManual() {
return formBinder != null && formBinder.isAnyManual();
public boolean isAnyManualOrTaskUpdatedFromTimesheets() {
if (formBinder == null) {
return false;
}
return formBinder.isAnyManual()
|| formBinder.isTaskUpdatedFromTimesheets();
}
}

View file

@ -64,7 +64,7 @@
<hbox align="bottom" sclass="add-resources-or-criteria">
<newAllocationSelectorCombo id="newAllocationSelectorCombo" behaviour="NON_LIMITING"/>
<button label="${i18n:_('Add')}" onClick="allocationController.onSelectWorkers(newAllocationSelectorCombo)"
disabled="@{allocationController.anyManual}" />
disabled="@{allocationController.isAnyManualOrTaskUpdatedFromTimesheets}" />
<button id="advancedSearchButton" label="${i18n:_('Advanced search')}" onClick="allocationController.goToAdvancedSearch()" />
<checkbox id="extendedViewCheckbox" label="${i18n:_('Extended view')}"
onCheck="allocationController.onCheckExtendedView()"/>