ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Adding method withPreviousAssociatedResources to the interface of ResourceAllocation
This commit is contained in:
parent
e1ae52a7f6
commit
b9e443f6f5
4 changed files with 18 additions and 0 deletions
|
|
@ -257,6 +257,7 @@ public class GenericResourceAllocation extends
|
|||
return new ArrayList<Resource>(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocatable withPreviousAssociatedResources() {
|
||||
return forResources(getAssociatedResources());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,6 +268,8 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
resourcesPerDay);
|
||||
}
|
||||
|
||||
public abstract IAllocatable withPreviousAssociatedResources();
|
||||
|
||||
protected abstract class AssignmentsAllocation implements IAllocatable {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -173,4 +173,9 @@ public class SpecificResourceAllocation extends
|
|||
p.detach();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocatable withPreviousAssociatedResources() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -470,11 +470,14 @@ class Row {
|
|||
if (isGroupingRow()) {
|
||||
return;
|
||||
}
|
||||
final Intbox intbox = (Intbox) component;
|
||||
component.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
fireCellChanged(item);
|
||||
Integer value = intbox.getValue();
|
||||
allocateOnInterval(getAllocation(), item, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -489,6 +492,13 @@ class Row {
|
|||
}
|
||||
}
|
||||
|
||||
private ResourceAllocation<?> getAllocation() {
|
||||
if (isGroupingRow()) {
|
||||
throw new IllegalStateException("is grouping row");
|
||||
}
|
||||
return aggregate.getAllocationsSortedByStartDate().get(0);
|
||||
}
|
||||
|
||||
private boolean isGroupingRow() {
|
||||
return aggregate.getAllocationsSortedByStartDate().size() > 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue