ItEr58S10CUAsignacionRecursosLimitantesItEr57S11: Prevent moving or modifying task in Gantt if it's limiting and has day assignments
This commit is contained in:
parent
cbfce4d767
commit
1eaa985eeb
14 changed files with 100 additions and 14 deletions
|
|
@ -389,7 +389,8 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
|
|||
|
||||
private boolean canChangeStartDate() {
|
||||
return disabilityConfiguration.isMovingTasksEnabled()
|
||||
&& task.canBeExplicitlyMoved();
|
||||
&& task.canBeExplicitlyMoved()
|
||||
&& !task.isLimitingAndHasDayAssignments();
|
||||
}
|
||||
|
||||
private boolean canChangeEndDate() {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class DefaultFundamentalProperties implements ITaskFundamentalProperties
|
|||
long lengthMilliseconds, String notes,
|
||||
Date hoursAdvanceEndDate,
|
||||
Date advanceEndDate,
|
||||
BigDecimal hoursAdvancePercentage, BigDecimal advancePercentage) {
|
||||
BigDecimal hoursAdvancePercentage, BigDecimal advancePercentage) {
|
||||
this.name = name;
|
||||
this.beginDate = beginDate.getTime();
|
||||
this.lengthMilliseconds = lengthMilliseconds;
|
||||
|
|
@ -167,6 +167,14 @@ public class DefaultFundamentalProperties implements ITaskFundamentalProperties
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isLimiting() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLimitingAndHasDayAssignments() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeExplicitlyResized() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ public interface ITaskFundamentalProperties {
|
|||
|
||||
public boolean isSubcontracted();
|
||||
|
||||
public boolean isLimiting();
|
||||
|
||||
public boolean isLimitingAndHasDayAssignments();
|
||||
|
||||
public boolean canBeExplicitlyResized();
|
||||
|
||||
public String getAssignedStatus();
|
||||
|
|
|
|||
|
|
@ -311,6 +311,14 @@ public abstract class Task implements ITaskFundamentalProperties {
|
|||
return fundamentalProperties.isSubcontracted();
|
||||
}
|
||||
|
||||
public boolean isLimiting() {
|
||||
return fundamentalProperties.isLimiting();
|
||||
}
|
||||
|
||||
public boolean isLimitingAndHasDayAssignments() {
|
||||
return fundamentalProperties.isLimitingAndHasDayAssignments();
|
||||
}
|
||||
|
||||
public boolean canBeExplicitlyResized() {
|
||||
return fundamentalProperties.canBeExplicitlyResized();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class TaskLeaf extends Task {
|
|||
|
||||
@Override
|
||||
public boolean canBeExplicitlyMoved() {
|
||||
return !isSubcontracted();
|
||||
return !(isSubcontracted() || isLimitingAndHasDayAssignments());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -552,6 +552,10 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
return getLimitingResourceQueueElement() != null;
|
||||
}
|
||||
|
||||
public boolean isLimitingAndHasDayAssignments() {
|
||||
return isLimiting() && hasAssignments();
|
||||
}
|
||||
|
||||
public boolean isSatisfied() {
|
||||
return hasAssignments();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,16 @@ public class Task extends TaskElement {
|
|||
return !(getLimitingResourceAllocations().isEmpty());
|
||||
}
|
||||
|
||||
private ResourceAllocation<?> getAssociatedLimitingResourceAllocation() {
|
||||
Set<ResourceAllocation<?>> resourceAllocations = getLimitingResourceAllocations();
|
||||
return (resourceAllocations.size() > 0) ? resourceAllocations.iterator().next() : null;
|
||||
}
|
||||
|
||||
public boolean isLimitingAndHasDayAssignments() {
|
||||
ResourceAllocation<?> resourceAllocation = getAssociatedLimitingResourceAllocation();
|
||||
return (resourceAllocation != null) ? resourceAllocation.isLimitingAndHasDayAssignments() : false;
|
||||
}
|
||||
|
||||
public void addResourceAllocation(ResourceAllocation<?> resourceAllocation) {
|
||||
addResourceAllocation(resourceAllocation, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,6 +409,14 @@ public abstract class TaskElement extends BaseEntity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isLimiting() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLimitingAndHasDayAssignments() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public TaskElement getTopMost() {
|
||||
TaskElement result = this;
|
||||
while (result.getParent() != null) {
|
||||
|
|
|
|||
|
|
@ -561,6 +561,16 @@ public class TaskElementAdapter implements ITaskElementAdapter {
|
|||
return taskElement.isSubcontracted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLimiting() {
|
||||
return taskElement.isLimiting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLimitingAndHasDayAssignments() {
|
||||
return taskElement.isLimitingAndHasDayAssignments();
|
||||
}
|
||||
|
||||
private void stepsBeforePossibleReallocation() {
|
||||
taskDAO.reattach(taskElement);
|
||||
reattachAllResourcesForTask();
|
||||
|
|
|
|||
|
|
@ -234,4 +234,8 @@ public class LimitingAllocationRow {
|
|||
&& resourceAllocation instanceof GenericResourceAllocation;
|
||||
}
|
||||
|
||||
public boolean hasDayAssignments() {
|
||||
return resourceAllocation.hasAssignments();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public class LimitingResourceAllocationController extends GenericForwardComposer
|
|||
|
||||
private Tab tabLimitingResourceAllocation;
|
||||
|
||||
private Tab tabLimitingWorkerSearch;
|
||||
|
||||
private Grid gridLimitingOrderElementHours;
|
||||
|
||||
private Grid gridLimitingAllocations;
|
||||
|
|
@ -93,6 +95,7 @@ public class LimitingResourceAllocationController extends GenericForwardComposer
|
|||
IMessagesForUser messagesForUser) {
|
||||
try {
|
||||
resourceAllocationModel.init(task);
|
||||
tabLimitingWorkerSearch.setDisabled(existsResourceAllocationWithDayAssignments());
|
||||
limitingNewAllocationSelector.setAllocationsAdder(resourceAllocationModel);
|
||||
gridLimitingOrderElementHours.setModel(new ListModelList(
|
||||
resourceAllocationModel.getHoursAggregatedByCriteria()));
|
||||
|
|
@ -173,7 +176,9 @@ public class LimitingResourceAllocationController extends GenericForwardComposer
|
|||
}
|
||||
|
||||
private Intbox intboxHours(final LimitingAllocationRow resourceAllocation) {
|
||||
return bindToHours(new Intbox(), resourceAllocation);
|
||||
Intbox result = bindToHours(new Intbox(), resourceAllocation);
|
||||
result.setDisabled(resourceAllocation.hasDayAssignments());
|
||||
return result;
|
||||
}
|
||||
|
||||
private Intbox bindToHours(Intbox intbox, final LimitingAllocationRow resourceAllocation) {
|
||||
|
|
@ -195,7 +200,9 @@ public class LimitingResourceAllocationController extends GenericForwardComposer
|
|||
}
|
||||
|
||||
private Listbox listboxPriority(final LimitingAllocationRow resourceAllocation) {
|
||||
return bindToPriority(buildPriorityList(resourceAllocation.getPriority()), resourceAllocation);
|
||||
Listbox result = bindToPriority(buildPriorityList(resourceAllocation.getPriority()), resourceAllocation);
|
||||
result.setDisabled(resourceAllocation.hasDayAssignments());
|
||||
return result;
|
||||
}
|
||||
|
||||
private Listbox buildPriorityList(int selectedValue) {
|
||||
|
|
@ -238,4 +245,17 @@ public class LimitingResourceAllocationController extends GenericForwardComposer
|
|||
|
||||
}
|
||||
|
||||
public boolean existsResourceAllocationWithDayAssignments() {
|
||||
final LimitingAllocationRow limitingAllocationRow = getLimitingAllocationRow();
|
||||
return (limitingAllocationRow != null) ? limitingAllocationRow
|
||||
.hasDayAssignments() : false;
|
||||
}
|
||||
|
||||
private LimitingAllocationRow getLimitingAllocationRow() {
|
||||
final List<LimitingAllocationRow> limitingAllocationRows = resourceAllocationModel
|
||||
.getResourceAllocationRows();
|
||||
return (limitingAllocationRows.size() > 0) ? limitingAllocationRows
|
||||
.get(0) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,6 +184,12 @@ public class TaskPropertiesController extends GenericForwardComposer {
|
|||
setOldState(null);
|
||||
originalState = getResourceAllocationType(currentTaskElement);
|
||||
|
||||
final boolean disabled = currentTaskElement.isSubcontracted()
|
||||
|| currentTaskElement.isLimitingAndHasDayAssignments();
|
||||
startConstraintTypes.setDisabled(disabled);
|
||||
startConstraintDate.setDisabled(disabled);
|
||||
lbResourceAllocationType.setDisabled(disabled);
|
||||
|
||||
taskEditFormComposer.init(context.getRelativeTo(), context.getTask());
|
||||
updateComponentValuesForTask();
|
||||
}
|
||||
|
|
@ -335,6 +341,7 @@ public class TaskPropertiesController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private boolean thereIsTransition(ResourceAllocationTypeEnum newState) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,13 @@
|
|||
<tabpanel id="${arg.id}">
|
||||
<tabbox mold="accordion">
|
||||
<tabs>
|
||||
<tab id="tabLimitingResourceAllocation" label="${i18n:_('Limiting resource allocation')}" image="common/img/collapse.gif" />
|
||||
<tab id="tabLimitingWorkerSearch" label="${i18n:_('Resources search')}" image="common/img/collapse.gif"/>
|
||||
<tab id="tabLimitingResourceAllocation"
|
||||
label="${i18n:_('Limiting resource allocation')}"
|
||||
image="common/img/collapse.gif" />
|
||||
|
||||
<tab id="tabLimitingWorkerSearch"
|
||||
label="${i18n:_('Resources search')}"
|
||||
image="common/img/collapse.gif" />
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel>
|
||||
|
|
@ -77,8 +82,8 @@
|
|||
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel>
|
||||
<newAllocationSelector id="limitingNewAllocationSelector"/>
|
||||
<tabpanel >
|
||||
<newAllocationSelector id="limitingNewAllocationSelector" />
|
||||
<hbox>
|
||||
<button label="${i18n:_('Select')}" onClick="limitingAllocationController.onSelectWorkers(event)" />
|
||||
<button label="${i18n:_('Close')}" onClick="limitingAllocationController.onCloseSelectWorkers()" />
|
||||
|
|
|
|||
|
|
@ -52,12 +52,9 @@
|
|||
<row id="startConstraint">
|
||||
<label value="${i18n:_('Constraint')}" />
|
||||
<vbox>
|
||||
<combobox id="startConstraintTypes"
|
||||
disabled="@{editController.isSubcontractedAndIsTask}">
|
||||
</combobox>
|
||||
<combobox id="startConstraintTypes" />
|
||||
<datebox id="startConstraintDate" constraint ="no empty"
|
||||
value="@{editController.startConstraintDate}"
|
||||
disabled="@{editController.isSubcontractedAndIsTask}" />
|
||||
value="@{editController.startConstraintDate}" />
|
||||
</vbox>
|
||||
</row>
|
||||
<row id="resourceAllocationType" visible="@{editController.isTask}">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue