ItEr24S08CUAsignacionGrupoRecursosAPlanificacionItEr23S10: [FixBug] Added Save task button
This commit is contained in:
parent
c4acadced6
commit
a4f19c2dec
4 changed files with 37 additions and 5 deletions
|
|
@ -142,4 +142,9 @@ public interface IResourceAllocationModel {
|
|||
*/
|
||||
void cancel();
|
||||
|
||||
/**
|
||||
* Save task
|
||||
*/
|
||||
void save();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
resourceAllocationModel.setTask(task);
|
||||
resourceAllocationModel.setGanttTask(ganttTask);
|
||||
|
||||
// Add generic resources to resources list
|
||||
updateGenericResourceAllocationPercentage();
|
||||
// Add new generic resources to resources list
|
||||
addGenericResources();
|
||||
|
||||
Util.reloadBindings(window);
|
||||
try {
|
||||
window.doModal();
|
||||
|
|
@ -90,6 +90,17 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GenericResourceAllocationPercentage initial value is the sum of all
|
||||
* {@link ResourceAllocation} percentages
|
||||
*/
|
||||
private void updateGenericResourceAllocationPercentage() {
|
||||
BigDecimal genericPercentage = resourceAllocationModel
|
||||
.getSumPercentageResourceAllocations();
|
||||
genericResourceAllocationPercentage.setValue(genericPercentage
|
||||
.scaleByPowerOfTen(2).setScale(2, BigDecimal.ROUND_HALF_EVEN));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check how many {@link ResourceAllocation} object can be assigned to this
|
||||
* {@link Task} and add them to {@link ResourceAllocation} list
|
||||
|
|
@ -217,13 +228,23 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public void cancel() {
|
||||
clear();
|
||||
self.setVisible(false);
|
||||
close();
|
||||
resourceAllocationModel.cancel();
|
||||
}
|
||||
|
||||
private void close() {
|
||||
self.setVisible(false);
|
||||
clear();
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
genericResourceAllocationPercentage.setValue(null);
|
||||
resourcesList.getItems().clear();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
resourceAllocationModel.save();
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -306,4 +306,10 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
task.clearResourceAllocations();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void save() {
|
||||
taskElementDAO.save(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
</listbox>
|
||||
|
||||
<hbox>
|
||||
<button label="${i18n:_('Save')}" />
|
||||
<button label="${i18n:_('Save')}" onClick="allocationController.save()" />
|
||||
<button label="${i18n:_('Cancel')}" onClick="allocationController.cancel()" />
|
||||
<button label="${i18n:_('Search resources...')}"
|
||||
onClick="allocationController.showSearchResources()" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue