From fe17a21697cc749c3c87ded85c0c3e8b209b8821 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Tue, 4 Oct 2011 14:07:42 +0200 Subject: [PATCH] Change assignment function information from Label for Listbox in resource allocation pop-up FEA: ItEr75S23FixAllocationModel --- .../web/planner/allocation/AllocationRow.java | 28 +++++++++++++------ .../ResourceAllocationController.java | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationRow.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationRow.java index 2cf9def70..20166da33 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationRow.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationRow.java @@ -74,6 +74,8 @@ import org.zkoss.zul.Decimalbox; import org.zkoss.zul.Detail; import org.zkoss.zul.Grid; import org.zkoss.zul.Label; +import org.zkoss.zul.Listbox; +import org.zkoss.zul.Listitem; import org.zkoss.zul.SimpleConstraint; import org.zkoss.zul.SimpleListModel; @@ -289,7 +291,7 @@ public abstract class AllocationRow { private Grid derivedAllocationsGrid; - private Label assignmentFunctionLabel = new Label(); + private Listbox assignmentFunctionListbox; public AllocationRow(CalculatedValue calculatedValue) { this.currentCalculatedValue = calculatedValue; @@ -346,17 +348,25 @@ public abstract class AllocationRow { effortInput.setSclass("assigned-hours-input"); effortInput.setConstraint(constraintForHoursInput()); loadEffort(); - updateAssignmentFunctionLabel(); + + assignmentFunctionListbox = new Listbox(); + assignmentFunctionListbox.setMold("select"); + + updateAssignmentFunctionListbox(); } - private void updateAssignmentFunctionLabel() { + private void updateAssignmentFunctionListbox() { AssignmentFunction function = getAssignmentFunction(); + Listitem listitemFunctionName; if (function == null) { - assignmentFunctionLabel.setValue(_(AssignmentFunctionName.FLAT - .toString())); + listitemFunctionName = new Listitem( + _(AssignmentFunctionName.FLAT.toString())); } else { - assignmentFunctionLabel.setValue(_(function.getName())); + listitemFunctionName = new Listitem(_(function.getName())); } + assignmentFunctionListbox.getChildren().clear(); + assignmentFunctionListbox.appendChild(listitemFunctionName); + assignmentFunctionListbox.setSelectedItem(listitemFunctionName); } public abstract ResourcesPerDayModification toResourcesPerDayModification( @@ -480,7 +490,7 @@ public abstract class AllocationRow { } public void loadAssignmentFunctionName() { - updateAssignmentFunctionLabel(); + updateAssignmentFunctionListbox(); } protected EffortDuration getEffortFromInput() { @@ -782,8 +792,8 @@ public abstract class AllocationRow { }); } - public Label getAssignmentFunctionLabel() { - return assignmentFunctionLabel; + public Listbox getAssignmentFunctionListbox() { + return assignmentFunctionListbox; } } diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java index 854fb83b2..82ff6e4ab 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java @@ -617,7 +617,7 @@ public class ResourceAllocationController extends GenericForwardComposer { data.getRealResourcesPerDay()); realResourcesPerDay.setStyle("float: right; padding-right: 1em;"); - append(row, data.getAssignmentFunctionLabel()); + append(row, data.getAssignmentFunctionListbox()); // On click delete button Button deleteButton = appendDeleteButton(row);