ItEr37S06ValidacionEProbasFuncionaisItEr36S07: Some UI rearragments at resource allocations forms
This commit is contained in:
parent
0d8ea666ed
commit
e39688d940
2 changed files with 100 additions and 92 deletions
|
|
@ -22,6 +22,7 @@ package org.navalplanner.web.planner.allocation;
|
|||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
|
@ -32,7 +33,6 @@ import org.navalplanner.business.orders.entities.AggregatedHoursGroup;
|
|||
import org.navalplanner.business.planner.entities.AggregateOfResourceAllocations;
|
||||
import org.navalplanner.business.planner.entities.CalculatedValue;
|
||||
import org.navalplanner.business.planner.entities.ResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.SpecificResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.Task;
|
||||
import org.navalplanner.web.common.IMessagesForUser;
|
||||
import org.navalplanner.web.common.MessagesForUser;
|
||||
|
|
@ -138,7 +138,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
super.doAfterCompose(comp);
|
||||
this.window = (Window) comp;
|
||||
messagesForUser = new MessagesForUser(messagesContainer);
|
||||
taskEndDate = new Datebox();
|
||||
allResourcesPerDay = new Decimalbox();
|
||||
makeReadyInputsForCalculationTypes();
|
||||
prepareCalculationTypesGrid();
|
||||
|
|
@ -148,14 +147,13 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
final String width = "300px";
|
||||
taskEndDate.setWidth(width);
|
||||
assignedHoursComponent = new Intbox();
|
||||
assignedHoursComponent.setWidth(width);
|
||||
}
|
||||
|
||||
private void prepareCalculationTypesGrid() {
|
||||
calculationTypesGrid.setModel(new ListModelList(Arrays
|
||||
.asList(CalculationTypeRadio.values())));
|
||||
calculationTypesGrid.setRowRenderer(OnColumnsRowRenderer.create(
|
||||
calculationTypesRenderer(), Arrays.asList(0, 1)));
|
||||
calculationTypesRenderer(), Arrays.asList(0)));
|
||||
}
|
||||
|
||||
private ICellForDetailItemRenderer<Integer, CalculationTypeRadio> calculationTypesRenderer() {
|
||||
|
|
@ -163,11 +161,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
@Override
|
||||
public Component cellFor(Integer column, CalculationTypeRadio data) {
|
||||
if (column == 0) {
|
||||
return data.createRadio();
|
||||
} else {
|
||||
return data.input(ResourceAllocationController.this);
|
||||
}
|
||||
return data.createRadio();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -432,12 +426,18 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
return resourceAllocationModel.getOrderHours();
|
||||
}
|
||||
|
||||
public List<AllocationRow> getResourceAllocations() {
|
||||
return formBinder != null ? formBinder
|
||||
.getCurrentRows() : Collections
|
||||
public List<? extends Object> getResourceAllocations() {
|
||||
return formBinder != null ? plusAggregatingRow(formBinder
|
||||
.getCurrentRows()) : Collections
|
||||
.<AllocationRow> emptyList();
|
||||
}
|
||||
|
||||
private List<Object> plusAggregatingRow(List<AllocationRow> currentRows) {
|
||||
List<Object> result = new ArrayList<Object>(currentRows);
|
||||
result.add(null);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ResourceAllocationRenderer getResourceAllocationRenderer() {
|
||||
return resourceAllocationRenderer;
|
||||
}
|
||||
|
|
@ -485,15 +485,16 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
return new AdvanceAllocationResultReceiver(allocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a {@link SpecificResourceAllocation} item
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
private class ResourceAllocationRenderer implements ListitemRenderer {
|
||||
|
||||
@Override
|
||||
public void render(Listitem item, Object data) throws Exception {
|
||||
renderResourceAllocation(item, (AllocationRow) data);
|
||||
if (data instanceof AllocationRow) {
|
||||
AllocationRow row = (AllocationRow) data;
|
||||
renderResourceAllocation(item, row);
|
||||
} else {
|
||||
renderAggregatingRow(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderResourceAllocation(Listitem item,
|
||||
|
|
@ -515,6 +516,15 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
});
|
||||
}
|
||||
|
||||
private void renderAggregatingRow(Listitem item) {
|
||||
ResourceAllocationController controller = ResourceAllocationController.this;
|
||||
append(item, new Label());
|
||||
append(item, CalculationTypeRadio.NUMBER_OF_HOURS.input(controller));
|
||||
append(item, CalculationTypeRadio.RESOURCES_PER_DAY
|
||||
.input(controller));
|
||||
append(item, new Label());
|
||||
}
|
||||
|
||||
private void removeAllocation(AllocationRow row) {
|
||||
allocationRows.remove(row);
|
||||
Util.reloadBindings(allocationsList);
|
||||
|
|
|
|||
|
|
@ -92,81 +92,79 @@
|
|||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel>
|
||||
<grid id="orderElementHoursGrid">
|
||||
<columns>
|
||||
<column width="200px" label="${i18n:_('Criteria')}"/>
|
||||
<column label="${i18n:_('Hours')}" />
|
||||
</columns>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Total Estimated hours')}:" />
|
||||
<intbox value="@{allocationController.orderHours}" disabled="${true}" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Start')}" />
|
||||
<datebox id="taskStartDateBox" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<!-- Calculation type -->
|
||||
<row>
|
||||
<label value="${i18n:_('Calculation type')}:" />
|
||||
<radiogroup id="calculationTypeSelector"
|
||||
onCheck="allocationController.calculationTypeSelected = self.selectedItem.value;">
|
||||
<grid id="calculationTypesGrid">
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row
|
||||
forEach="${allocationController.calculationTypes}">
|
||||
<radio label="${each.name}"
|
||||
value="${each}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</radiogroup>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<panel style="margin-top: 5px">
|
||||
<panelchildren>
|
||||
<checkbox id="recommendedAllocationCheckbox"></checkbox>
|
||||
<label value="${i18n:_('Recommended Allocation')}" />
|
||||
</panelchildren>
|
||||
</panel>
|
||||
<!-- Assigned resources -->
|
||||
<panel title="${i18n:_('Allocations')}" border="normal" style="margin-top: 5px" sclass="assignedresources">
|
||||
<panelchildren>
|
||||
<vbox id="messagesContainer"></vbox>
|
||||
<listbox id="allocationsList"
|
||||
model="@{allocationController.resourceAllocations}"
|
||||
itemRenderer="@{allocationController.resourceAllocationRenderer}"
|
||||
style="margin-bottom: 5px" fixedLayout="true" rows="4">
|
||||
<listhead>
|
||||
<listheader label="${i18n:_('Name')}" />
|
||||
<listheader
|
||||
label="${i18n:_('Hours')}" />
|
||||
<listheader
|
||||
label="${i18n:_('Resources Per Day')}" />
|
||||
<listheader />
|
||||
</listhead>
|
||||
</listbox>
|
||||
</panelchildren>
|
||||
</panel>
|
||||
<groupbox mold="3d" closable="false">
|
||||
<caption label="${i18n:_('Order Element Information')}:" />
|
||||
<grid id="orderElementHoursGrid">
|
||||
<columns>
|
||||
<column width="200px" label="${i18n:_('Criteria')}"/>
|
||||
<column label="${i18n:_('Hours')}" />
|
||||
</columns>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Total Estimated hours')}:" />
|
||||
<intbox value="@{allocationController.orderHours}" disabled="${true}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</groupbox>
|
||||
<groupbox mold="3d" style="margin-top: 5px" closable="false">
|
||||
<caption label="${i18n:_('Task information')}:" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Start')}" />
|
||||
<datebox id="taskStartDateBox" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('End')}" />
|
||||
<datebox id="taskEndDate" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</groupbox>
|
||||
<groupbox mold="3d" style="margin-top: 5px" closable="false">
|
||||
<caption label="${i18n:_('Calculation type')}:" />
|
||||
<radiogroup id="calculationTypeSelector"
|
||||
onCheck="allocationController.calculationTypeSelected = self.selectedItem.value;">
|
||||
<grid id="calculationTypesGrid">
|
||||
<columns>
|
||||
<column />
|
||||
</columns>
|
||||
</grid>
|
||||
</radiogroup>
|
||||
<hbox>
|
||||
<checkbox id="recommendedAllocationCheckbox" label="${i18n:_('Recommended Allocation')}"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<vbox id="messagesContainer"></vbox>
|
||||
|
||||
<groupbox mold="3d" style="margin-top: 5px" sclass="assignedresources" closable="false">
|
||||
<caption label="${i18n:_('Allocations')}" />
|
||||
<listbox id="allocationsList"
|
||||
model="@{allocationController.resourceAllocations}"
|
||||
itemRenderer="@{allocationController.resourceAllocationRenderer}"
|
||||
style="margin-bottom: 5px" fixedLayout="true" rows="4">
|
||||
<listhead>
|
||||
<listheader label="${i18n:_('Name')}" />
|
||||
<listheader
|
||||
label="${i18n:_('Hours')}" />
|
||||
<listheader
|
||||
label="${i18n:_('Resources Per Day')}" />
|
||||
<listheader />
|
||||
</listhead>
|
||||
</listbox>
|
||||
</groupbox>
|
||||
</tabpanel>
|
||||
|
||||
<!-- Worker search -->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue