From 0921d44085b16a4c2e6d8f10ab6bacfa38124acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Wed, 7 Oct 2009 19:07:13 +0200 Subject: [PATCH] ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Not allowing negative values at cells --- .../allocation/AdvancedAllocationController.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java index 549778cc8..de3df6f3a 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java @@ -392,7 +392,7 @@ class Row { } private Component buildAllHours() { - return isGroupingRow() ? new Label() : new Intbox(); + return isGroupingRow() ? new Label() : noNegativeIntbox(); } private void addListenerIfNeeded(Component allHoursComponent) { @@ -452,14 +452,21 @@ class Row { } Component hoursOnInterval(DetailItem item) { - Component result = isGroupingRow() ? new Label() : new Intbox(); + Component result = isGroupingRow() ? new Label() : noNegativeIntbox(); reloadHoursOnInterval(result, item); componentsByDetailItem.put(item, result); addListenerIfNeeded(item, result); return result; } - private void addListenerIfNeeded(final DetailItem item, Component component) { + private Intbox noNegativeIntbox() { + Intbox result = new Intbox(); + result.setConstraint("no negative, no empty"); + return result; + } + + private void addListenerIfNeeded(final DetailItem item, + final Component component) { if (isGroupingRow()) { return; }