ItEr59S07RFAspectosGraficosRecursoLimitantesItEr58S08: Revamped appearance of asignment windows

This commit is contained in:
Lorenzo Tilve 2010-06-15 12:18:28 +02:00 committed by Javier Moran Rua
parent ce652caa1a
commit 2d985fa041
6 changed files with 159 additions and 53 deletions

View file

@ -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<Criterion> 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<Criterion> criteria = ((GenericResourceAllocation) resourceAllocation).getCriterions();
return Criterion.getNames(criteria);
}
return StringUtils.EMPTY;
this.resourceOrCriteria = LimitingResourcesController
.getResourceOrCriteria(element.getResourceAllocation());
}
public LimitingResourceQueueElement getOriginal() {

View file

@ -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();
}
}

View file

@ -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;
}

View file

@ -125,7 +125,7 @@
<column label="${i18n:_('Order')}" sort="auto(orderName)"/>
<column label="${i18n:_('Task')}" sort="auto(taskName)"/>
<column label="${i18n:_('Resource / Criteria')}" sort="auto(resourceOrCriteria)"/>
<column label="${i18n:_('Date')}" sort="auto(date)"/>
<column label="${i18n:_('Earlier starting date')}" sort="auto(date)"/>
<column label="${i18n:_('Hours to allocate')}" sort="auto(hoursToAllocate)"/>
<column label="${i18n:_('Operations')}" width="200px"/>
</columns>

View file

@ -2,21 +2,88 @@
<window id="manualAllocationWindow"
apply="org.navalplanner.web.limitingresources.ManualAllocationController"
title="${i18n:_('Manual allocation')}"
width="500px" left="50px" top="50px"
width="600px" left="50px" top="50px"
visible="false"
closable="true"
onClose="manualAllocationController.close(event)">
<!-- Queue element general information -->
<panel title="${i18n:_('Queue Element Information')}:" border="normal">
<panelchildren>
<grid id="gridLimitingOrderElementHours">
<columns>
<column label="${i18n:_('Criteria')}" width="300px" align="center" />
<column label="${i18n:_('Hours')}" align="center" />
</columns>
<rows>
<row>
<label value="@{manualAllocationController.resourceOrCriteria}" />
<label value="@{manualAllocationController.hours}" />
</row>
</rows>
</grid>
</panelchildren>
</panel>
<hbox align="top">
<!-- Select assignable queues -->
<vbox>
<panel title="${i18n:_('Select queue')}" border="normal">
<panel title="${i18n:_('Select queue')}" border="normal" width="280px">
<panelchildren>
<listbox id="listAssignableQueues"
itemRenderer="@{manualAllocationController.queueRenderer}"
mold="select" />
mold="select" width="235px"/>
<div height="20px"/>
<grid id="gridCurrentQueue" sclass="current-queue-information">
<columns>
<column width="95px"/>
</columns>
<rows>
<row><label value="Current queue" /><label value="@{manualAllocationController.currentQueue}" /></row>
<row><label value="Start date" /><label value="@{manualAllocationController.currentStart}" /></row>
<row><label value="End date" /><label value="@{manualAllocationController.currentEnd}" /></row>
</rows></grid>
</panelchildren>
</panel>
</vbox>
<!-- Select date -->
<panel title="${i18n:_('Allocation configuration')}" border="normal">
<panelchildren>
<vbox>
<radiogroup id="radioAllocationDate"
orient="vertical"
onCheck="manualAllocationController.selectRadioAllocationDate(event)">
<grid id="calculationTypesGrid" >
<columns>
<column width="270px"/>
</columns>
<rows>
<row><radio id="earliestDate" label="${i18n:_('Earliest date')}" selected="true" /></row>
<row><radio id="latestDate" label="${i18n:_('Latest date')}" /></row>
<row><hbox><radio id="selectStartDate" label="${i18n:_('Select start date')}" />
<datebox id="startAllocationDate"
onFocus="manualAllocationController.highlightCalendar(event)" /></hbox>
</row>
</rows>
</grid>
</radiogroup>
<checkbox id="cbAllocationType"
label="${i18n:_('Appropriative allocation')}"
onCheck="manualAllocationController.onCheckAllocationType(event)" />
</vbox>
</panelchildren>
</panel>
</hbox>
<!-- Select gap -->
<vbox>
@ -35,32 +102,6 @@
</panel>
</vbox>
<!-- Select date -->
<vbox>
<panel title="${i18n:_('Select date')}" border="normal">
<panelchildren>
<radiogroup id="radioAllocationDate" orient="vertical"
onCheck="manualAllocationController.selectRadioAllocationDate(event)" >
<radio id="earliestDate" label="${i18n:_('Earliest date')}" selected="true" />
<radio id="latestDate" label="${i18n:_('Latest date')}" />
<radio id="selectStartDate" label="${i18n:_('Select start date')}" />
</radiogroup>
<datebox id="startAllocationDate"
onFocus="manualAllocationController.highlightCalendar(event)" />
</panelchildren>
</panel>
</vbox>
<!-- Allocation type -->
<vbox>
<panel title="${i18n:_('Allocation type')}" border="normal">
<panelchildren>
<checkbox id="cbAllocationType"
label="${i18n:_('Appropriative')}"
onCheck="manualAllocationController.onCheckAllocationType(event)"/>
</panelchildren>
</panel>
</vbox>
<separator bar="false" spacing="30px" orient="horizontal"/>

View file

@ -39,8 +39,10 @@
<tabpanels>
<tabpanel>
<!-- Order element information -->
<groupbox mold="3d" closable="false">
<caption label="${i18n:_('Order Element Information')}:" />
<panel title="${i18n:_('Order Element Information')}:" border="normal">
<panelchildren>
<grid id="gridLimitingOrderElementHours">
<columns>
<column label="${i18n:_('Criteria')}" width="200px" align="center"/>
@ -62,11 +64,12 @@
</row>
</rows>
</grid>
</groupbox>
</panelchildren>
</panel>
<!-- Allocations -->
<groupbox mold="3d" style="margin-top: 5px" sclass="assignedresources" closable="false">
<caption label="${i18n:_('Allocations')}" />
<panel style="margin-top: 5px" sclass="assignedresources" closable="false" title="${i18n:_('Allocations')}">
<panelchildren>
<grid id="gridLimitingAllocations"
model="@{limitingAllocationController.resourceAllocationRows}"
rowRenderer="@{limitingAllocationController.gridLimitingAllocationRenderer}"
@ -78,7 +81,8 @@
<column label="${i18n:_('Priority')}" />
</columns>
</grid>
</groupbox>
</panelchildren>
</panel>
</tabpanel>