ItEr58S10CUAsignacionRecursosLimitantesItEr57S11: Move queue element position inside queue or between queues
This commit is contained in:
parent
a6289c337a
commit
178b4ea5d1
4 changed files with 45 additions and 17 deletions
|
|
@ -750,9 +750,17 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
Validate.notNull(queue);
|
||||
Validate.notNull(startTime);
|
||||
|
||||
removeDaysAssignmentsIfAny(beingEdited);
|
||||
return assignLimitingResourceQueueElementToQueueAt(beingEdited, queue, startTime);
|
||||
}
|
||||
|
||||
public void removeDaysAssignmentsIfAny(LimitingResourceQueueElement element) {
|
||||
final ResourceAllocation<?> resourceAllocation = element.getResourceAllocation();
|
||||
if (!resourceAllocation.getAssignments().isEmpty()) {
|
||||
resourceAllocation.removeLimitingDayAssignments();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(LimitingResourceQueueElement element) {
|
||||
beingEdited = retrieveQueueElementFromModel(element);
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ public class LimitingResourcesController implements Composer {
|
|||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
manualAllocateLimitingResourceQueueElement(element);
|
||||
showManualAllocationWindow(element.getOriginal());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
|
@ -430,21 +430,6 @@ public class LimitingResourcesController implements Composer {
|
|||
}
|
||||
}
|
||||
|
||||
private void manualAllocateLimitingResourceQueueElement(LimitingResourceQueueElementDTO dto) {
|
||||
LimitingResourceQueueElement element = dto.getOriginal();
|
||||
try {
|
||||
setAssignableQueues(element);
|
||||
limitingResourceQueueModel.init(element);
|
||||
manualAllocationWindow.doModal();
|
||||
} catch (SuspendNotAllowedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void showErrorMessage(String error) {
|
||||
try {
|
||||
Messagebox.show(error, _("Error"), Messagebox.OK, Messagebox.ERROR);
|
||||
|
|
@ -466,6 +451,20 @@ public class LimitingResourcesController implements Composer {
|
|||
|
||||
}
|
||||
|
||||
private void showManualAllocationWindow(LimitingResourceQueueElement element) {
|
||||
try {
|
||||
setAssignableQueues(element);
|
||||
limitingResourceQueueModel.init(element);
|
||||
manualAllocationWindow.doModal();
|
||||
} catch (SuspendNotAllowedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<LimitingResourceQueue> getLimitingResourceQueues() {
|
||||
return limitingResourceQueueModel.getLimitingResourceQueues();
|
||||
}
|
||||
|
|
@ -766,4 +765,8 @@ public class LimitingResourcesController implements Composer {
|
|||
return "{\"color\": \"blue\", \"bgcolor\": \"white\"}";
|
||||
}
|
||||
|
||||
public void moveTask(LimitingResourceQueueElement element) {
|
||||
showManualAllocationWindow(element);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,4 +360,9 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
dependencyList.removeDependencyComponents(task);
|
||||
}
|
||||
|
||||
public void moveQueueTask(QueueTask queueTask) {
|
||||
limitingResourcesController.moveTask(queueTask.getLimitingResourceQueueElement());
|
||||
queueTask.detach();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,10 +258,22 @@ public class QueueComponent extends XulElement implements
|
|||
unnasign(choosen);
|
||||
}
|
||||
});
|
||||
menuBuilder.item(_("Move"), "",
|
||||
new ItemAction<QueueTask>() {
|
||||
@Override
|
||||
public void onEvent(QueueTask choosen, Event event) {
|
||||
moveQueueTask(choosen);
|
||||
}
|
||||
});
|
||||
divElement.setContext(menuBuilder.createWithoutSettingContext());
|
||||
}
|
||||
}
|
||||
|
||||
private void moveQueueTask(QueueTask queueTask) {
|
||||
LimitingResourcesPanel panel = LimitingResourcesPanel.getLimitingResourcesPanel(this);
|
||||
panel.moveQueueTask(queueTask);
|
||||
}
|
||||
|
||||
private void unnasign(QueueTask choosen) {
|
||||
final LimitingResourcesPanel panel = LimitingResourcesPanel
|
||||
.getLimitingResourcesPanel(choosen.getParent());
|
||||
|
|
@ -279,4 +291,4 @@ public class QueueComponent extends XulElement implements
|
|||
appendContextMenus();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue