ItEr59S08CUAsignacionRecursosLimitantesItEr58S10: Fix bug, on moving queue element, don't remove it unless user clicks on Accept

This commit is contained in:
Diego Pino Garcia 2010-06-02 17:32:29 +02:00 committed by Javier Moran Rua
parent 19da03932c
commit d37a28bc5f
3 changed files with 28 additions and 6 deletions

View file

@ -437,14 +437,23 @@ public class LimitingResourcesController extends GenericForwardComposer {
Util.reloadBindings(gridUnassignedLimitingResourceQueueElements);
}
public void moveTask(LimitingResourceQueueElement element) {
public boolean moveTask(LimitingResourceQueueElement element) {
showManualAllocationWindow(element);
return getManualAllocationWindowStatus() == Messagebox.OK;
}
public int getManualAllocationWindowStatus() {
Integer status = getManualAllocationController().getStatus();
return (status != null) ? status.intValue() : -1;
}
private void showManualAllocationWindow(LimitingResourceQueueElement element) {
ManualAllocationController manualAllocationController = (ManualAllocationController) manualAllocationWindow
.getVariable("manualAllocationController", true);
manualAllocationController.show(element);
getManualAllocationController().show(element);
}
private ManualAllocationController getManualAllocationController() {
return (ManualAllocationController) manualAllocationWindow.getVariable(
"manualAllocationController", true);
}
public void reloadUnassignedLimitingResourceQueueElements() {

View file

@ -361,8 +361,9 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
}
public void moveQueueTask(QueueTask queueTask) {
limitingResourcesController.moveTask(queueTask.getLimitingResourceQueueElement());
queueTask.detach();
if (limitingResourcesController.moveTask(queueTask.getLimitingResourceQueueElement())) {
queueTask.detach();
}
}
}

View file

@ -52,6 +52,7 @@ import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Radiogroup;
import org.zkoss.zul.SimpleListModel;
@ -217,6 +218,7 @@ public class ManualAllocationController extends GenericForwardComposer {
LimitingResourceQueueElement element = getLimitingResourceQueueModel()
.getLimitingResourceQueueElement();
limitingResourcesPanel.appendQueueElementToQueue(element);
setStatus(Messagebox.OK);
closeManualAllocationWindow(e);
}
@ -295,6 +297,7 @@ public class ManualAllocationController extends GenericForwardComposer {
public void cancel() {
self.setVisible(false);
setStatus(Messagebox.CANCEL);
}
public void closeManualAllocationWindow(Event e) {
@ -382,6 +385,7 @@ public class ManualAllocationController extends GenericForwardComposer {
public void show(LimitingResourceQueueElement element) {
try {
setStatus(Messagebox.CANCEL);
setAssignableQueues(element);
getLimitingResourceQueueModel().init(element);
((Window) self).doModal();
@ -398,6 +402,14 @@ public class ManualAllocationController extends GenericForwardComposer {
return queueRenderer;
}
public Integer getStatus() {
return (Integer) self.getVariable("status", true);
}
public void setStatus(int status) {
self.setVariable("status", new Integer(status), true);
}
private class QueueRenderer implements ListitemRenderer {
@Override