From 2d985fa04134cfba3413b9a8411e3aefb293c8e9 Mon Sep 17 00:00:00 2001 From: Lorenzo Tilve Date: Tue, 15 Jun 2010 12:18:28 +0200 Subject: [PATCH] ItEr59S07RFAspectosGraficosRecursoLimitantesItEr58S08: Revamped appearance of asignment windows --- .../LimitingResourcesController.java | 29 ++--- .../ManualAllocationController.java | 58 +++++++++- .../main/webapp/common/css/navalplan_zk.css | 4 + .../limitingResourcesLayout.zul | 2 +- .../limitingresources/manualAllocation.zul | 103 ++++++++++++------ .../_tabPanelLimitingResourceAllocation.zul | 16 ++- 6 files changed, 159 insertions(+), 53 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourcesController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourcesController.java index 74432f911..b1000e684 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourcesController.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/LimitingResourcesController.java @@ -205,6 +205,20 @@ public class LimitingResourcesController extends GenericForwardComposer { .getEarlierStartDateBecauseOfGantt()); } + public static String getResourceOrCriteria( + ResourceAllocation resourceAllocation) { + if (resourceAllocation instanceof SpecificResourceAllocation) { + final Resource resource = ((SpecificResourceAllocation) resourceAllocation) + .getResource(); + return (resource != null) ? resource.getName() : ""; + } else if (resourceAllocation instanceof GenericResourceAllocation) { + Set criteria = ((GenericResourceAllocation) resourceAllocation) + .getCriterions(); + return Criterion.getNames(criteria); + } + return StringUtils.EMPTY; + } + /** * DTO for list of unassigned {@link LimitingResourceQueueElement} * @@ -235,19 +249,8 @@ public class LimitingResourcesController extends GenericForwardComposer { this.taskName = taskName; this.date = DATE_FORMAT.format(date); this.hoursToAllocate = element.getIntentedTotalHours(); - this.resourceOrCriteria = getResourceOrCriteria(element.getResourceAllocation()); - } - - private String getResourceOrCriteria(ResourceAllocation resourceAllocation) { - if (resourceAllocation instanceof SpecificResourceAllocation) { - final Resource resource = ((SpecificResourceAllocation) resourceAllocation) - .getResource(); - return (resource != null) ? resource.getName() : ""; - } else if (resourceAllocation instanceof GenericResourceAllocation) { - Set criteria = ((GenericResourceAllocation) resourceAllocation).getCriterions(); - return Criterion.getNames(criteria); - } - return StringUtils.EMPTY; + this.resourceOrCriteria = LimitingResourcesController + .getResourceOrCriteria(element.getResourceAllocation()); } public LimitingResourceQueueElement getOriginal() { diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/ManualAllocationController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/ManualAllocationController.java index 3a7e4ae18..89229c91f 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/ManualAllocationController.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/limitingresources/ManualAllocationController.java @@ -31,11 +31,12 @@ import org.apache.commons.lang.Validate; import org.joda.time.LocalDate; import org.navalplanner.business.planner.entities.ResourceAllocation; import org.navalplanner.business.planner.limiting.entities.DateAndHour; +import org.navalplanner.business.planner.limiting.entities.Gap; import org.navalplanner.business.planner.limiting.entities.LimitingResourceAllocator; import org.navalplanner.business.planner.limiting.entities.LimitingResourceQueueElement; -import org.navalplanner.business.planner.limiting.entities.Gap; import org.navalplanner.business.resources.entities.LimitingResourceQueue; import org.navalplanner.business.resources.entities.Resource; +import org.navalplanner.web.common.Util; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -49,6 +50,7 @@ import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Checkbox; import org.zkoss.zul.Datebox; +import org.zkoss.zul.Grid; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listitem; @@ -90,6 +92,9 @@ public class ManualAllocationController extends GenericForwardComposer { private final CandidateGapRenderer candidateGapRenderer = new CandidateGapRenderer(); + private Grid gridLimitingOrderElementHours; + private Grid gridCurrentQueue; + public ManualAllocationController() { } @@ -108,6 +113,11 @@ public class ManualAllocationController extends GenericForwardComposer { startAllocationDate = (Datebox) self.getFellowIfAny("startAllocationDate"); cbAllocationType = (Checkbox) self.getFellowIfAny("cbAllocationType"); + + gridLimitingOrderElementHours = (Grid) self + .getFellowIfAny("gridLimitingOrderElementHours"); + gridCurrentQueue = (Grid) self + .getFellowIfAny("gridCurrentQueue"); } public void setLimitingResourcesPanel(LimitingResourcesPanel limitingResourcesPanel) { @@ -203,7 +213,7 @@ public class ManualAllocationController extends GenericForwardComposer { } public void selectRadioAllocationDate(Event event) { - Radiogroup radiogroup = (Radiogroup) event.getTarget().getParent(); + Radiogroup radiogroup = (Radiogroup) event.getTarget().getFellow("radioAllocationDate"); startAllocationDate.setDisabled(radiogroup.getSelectedIndex() != 2); } @@ -482,7 +492,10 @@ public class ManualAllocationController extends GenericForwardComposer { clear(); setAssignableQueues(element); getLimitingResourceQueueModel().init(element); + Util.reloadBindings(gridLimitingOrderElementHours); + Util.reloadBindings(gridCurrentQueue); ((Window) self).doModal(); + ((Window) self).setTitle(_("Manual assignment")); } catch (SuspendNotAllowedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -531,4 +544,45 @@ public class ManualAllocationController extends GenericForwardComposer { enableRadiobuttons(checkbox.isChecked()); } + public int getHours() { + if (getBeingEditedElement() == null) { + return 0; + } + return getBeingEditedElement().getIntentedTotalHours(); + } + + public String getResourceOrCriteria() { + if (getBeingEditedElement() == null) { + return ""; + } + return LimitingResourcesController + .getResourceOrCriteria(getBeingEditedElement() + .getResourceAllocation()); + } + + public String getCurrentQueue() { + if (getBeingEditedElement() == null + || getBeingEditedElement().getLimitingResourceQueue() == null) { + return _("Unnasigned"); + } + return getBeingEditedElement().getLimitingResourceQueue().getResource() + .getName(); + } + + public String getCurrentStart() { + if (getBeingEditedElement() == null + || getBeingEditedElement().getStartDate() == null) { + return _("Unnasigned"); + } + return getBeingEditedElement().getStartDate().toString(); + } + + public String getCurrentEnd() { + if (getBeingEditedElement() == null + || getBeingEditedElement().getEndDate() == null) { + return _("Unnasigned"); + } + return getBeingEditedElement().getEndDate().toString(); + } + } diff --git a/navalplanner-webapp/src/main/webapp/common/css/navalplan_zk.css b/navalplanner-webapp/src/main/webapp/common/css/navalplan_zk.css index 8cabe25b8..31660384a 100644 --- a/navalplanner-webapp/src/main/webapp/common/css/navalplan_zk.css +++ b/navalplanner-webapp/src/main/webapp/common/css/navalplan_zk.css @@ -1341,3 +1341,7 @@ tr.z-tree-row-seld .z-row-cnt { .readonly .z-grid-body .z-row-inner { background-color: #CCCCCC; } + +.current-queue-information .z-grid-body { + overflow: hidden; +} \ No newline at end of file diff --git a/navalplanner-webapp/src/main/webapp/limitingresources/limitingResourcesLayout.zul b/navalplanner-webapp/src/main/webapp/limitingresources/limitingResourcesLayout.zul index b1bed24cb..c62e40489 100644 --- a/navalplanner-webapp/src/main/webapp/limitingresources/limitingResourcesLayout.zul +++ b/navalplanner-webapp/src/main/webapp/limitingresources/limitingResourcesLayout.zul @@ -125,7 +125,7 @@ - + diff --git a/navalplanner-webapp/src/main/webapp/limitingresources/manualAllocation.zul b/navalplanner-webapp/src/main/webapp/limitingresources/manualAllocation.zul index 21b5f9681..f6cab1524 100644 --- a/navalplanner-webapp/src/main/webapp/limitingresources/manualAllocation.zul +++ b/navalplanner-webapp/src/main/webapp/limitingresources/manualAllocation.zul @@ -2,21 +2,88 @@ + + + + + + + + + + + + + + + + + + + + - - + + mold="select" width="235px"/> +
+ + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35,32 +102,6 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/navalplanner-webapp/src/main/webapp/planner/_tabPanelLimitingResourceAllocation.zul b/navalplanner-webapp/src/main/webapp/planner/_tabPanelLimitingResourceAllocation.zul index 3a246da52..abf556ea1 100644 --- a/navalplanner-webapp/src/main/webapp/planner/_tabPanelLimitingResourceAllocation.zul +++ b/navalplanner-webapp/src/main/webapp/planner/_tabPanelLimitingResourceAllocation.zul @@ -39,8 +39,10 @@ - - + + + + @@ -62,11 +64,12 @@ - + + - - + + - + +