Update information about assignment function in allocation row
When apply button is used in resource allocation pop-up, assignment function information needs to be updated in the case that a manual allocation is converted to flat. FEA: ItEr75S23FixAllocationModel
This commit is contained in:
parent
ee182c77f9
commit
8136cb5380
3 changed files with 33 additions and 17 deletions
|
|
@ -43,6 +43,7 @@ import org.navalplanner.business.calendars.entities.ThereAreHoursOnWorkHoursCalc
|
|||
import org.navalplanner.business.calendars.entities.ThereAreHoursOnWorkHoursCalculator.ThereAreNoValidPeriods;
|
||||
import org.navalplanner.business.calendars.entities.ThereAreHoursOnWorkHoursCalculator.ValidPeriodsDontHaveCapacity;
|
||||
import org.navalplanner.business.planner.entities.AssignmentFunction;
|
||||
import org.navalplanner.business.planner.entities.AssignmentFunction.AssignmentFunctionName;
|
||||
import org.navalplanner.business.planner.entities.CalculatedValue;
|
||||
import org.navalplanner.business.planner.entities.DerivedAllocation;
|
||||
import org.navalplanner.business.planner.entities.ResourceAllocation;
|
||||
|
|
@ -288,6 +289,8 @@ public abstract class AllocationRow {
|
|||
|
||||
private Grid derivedAllocationsGrid;
|
||||
|
||||
private Label assignmentFunctionLabel = new Label();
|
||||
|
||||
public AllocationRow(CalculatedValue calculatedValue) {
|
||||
this.currentCalculatedValue = calculatedValue;
|
||||
this.origin = null;
|
||||
|
|
@ -343,6 +346,17 @@ public abstract class AllocationRow {
|
|||
effortInput.setSclass("assigned-hours-input");
|
||||
effortInput.setConstraint(constraintForHoursInput());
|
||||
loadEffort();
|
||||
updateAssignmentFunctionLabel();
|
||||
}
|
||||
|
||||
private void updateAssignmentFunctionLabel() {
|
||||
AssignmentFunction function = getAssignmentFunction();
|
||||
if (function == null) {
|
||||
assignmentFunctionLabel.setValue(_(AssignmentFunctionName.FLAT
|
||||
.toString()));
|
||||
} else {
|
||||
assignmentFunctionLabel.setValue(_(function.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ResourcesPerDayModification toResourcesPerDayModification(
|
||||
|
|
@ -465,6 +479,10 @@ public abstract class AllocationRow {
|
|||
effortInput.setValue(getEffort());
|
||||
}
|
||||
|
||||
public void loadAssignmentFunctionName() {
|
||||
updateAssignmentFunctionLabel();
|
||||
}
|
||||
|
||||
protected EffortDuration getEffortFromInput() {
|
||||
return effortInput.getValue() != null ? effortInput
|
||||
.getEffortDurationValue()
|
||||
|
|
@ -501,6 +519,9 @@ public abstract class AllocationRow {
|
|||
}
|
||||
|
||||
private AssignmentFunction getAssignmentFunction() {
|
||||
if (temporal != null) {
|
||||
return temporal.getAssignmentFunction();
|
||||
}
|
||||
if (origin != null) {
|
||||
return origin.getAssignmentFunction();
|
||||
}
|
||||
|
|
@ -760,4 +781,8 @@ public abstract class AllocationRow {
|
|||
});
|
||||
}
|
||||
|
||||
public Label getAssignmentFunctionLabel() {
|
||||
return assignmentFunctionLabel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -540,6 +540,7 @@ public class FormBinder {
|
|||
loadValueForEffortInput();
|
||||
loadDerivedAllocations();
|
||||
loadSclassRowSatisfied();
|
||||
loadAssignmentFunctionNames();
|
||||
workableDaysAndDatesBinder.afterApplicationReloadValues();
|
||||
Util.reloadBindings(allocationsGrid);
|
||||
}
|
||||
|
|
@ -563,6 +564,12 @@ public class FormBinder {
|
|||
}
|
||||
}
|
||||
|
||||
private void loadAssignmentFunctionNames() {
|
||||
for (AllocationRow each : rows) {
|
||||
each.loadAssignmentFunctionName();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadEffortValues() {
|
||||
for (AllocationRow each : rows) {
|
||||
each.loadEffort();
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ import org.apache.commons.lang.Validate;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.navalplanner.business.orders.entities.AggregatedHoursGroup;
|
||||
import org.navalplanner.business.planner.entities.AssignmentFunction;
|
||||
import org.navalplanner.business.planner.entities.AssignmentFunction.AssignmentFunctionName;
|
||||
import org.navalplanner.business.planner.entities.CalculatedValue;
|
||||
import org.navalplanner.business.planner.entities.DerivedAllocation;
|
||||
import org.navalplanner.business.planner.entities.ResourceAllocation;
|
||||
|
|
@ -637,7 +635,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
data.getRealResourcesPerDay());
|
||||
realResourcesPerDay.setStyle("float: right; padding-right: 1em;");
|
||||
|
||||
appendFunctionInformation(row, data);
|
||||
append(row, data.getAssignmentFunctionLabel());
|
||||
|
||||
// On click delete button
|
||||
Button deleteButton = appendDeleteButton(row);
|
||||
|
|
@ -657,20 +655,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
private void appendFunctionInformation(Row row, final AllocationRow data) {
|
||||
ResourceAllocation<?> allocation = data.getOrigin();
|
||||
Label functionName = new Label(
|
||||
_(AssignmentFunctionName.FLAT.toString()));
|
||||
if (allocation != null) {
|
||||
AssignmentFunction function = allocation
|
||||
.getAssignmentFunction();
|
||||
if (function != null) {
|
||||
functionName.setValue(_(function.getName()));
|
||||
}
|
||||
}
|
||||
append(row, functionName);
|
||||
}
|
||||
|
||||
private void renderAggregatingRow(Row row) {
|
||||
ResourceAllocationController controller = ResourceAllocationController.this;
|
||||
append(row, new Label());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue