ItEr57S14AdaptacionAsignacionConsolidacion: changes the resource allocation interface.
adds some changes to previously adapt the content of the resource allocation interface.
This commit is contained in:
parent
e095f784be
commit
1ef862e82b
9 changed files with 142 additions and 115 deletions
|
|
@ -42,7 +42,6 @@ import org.navalplanner.web.planner.allocation.ResourceAllocationController.Deri
|
|||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Checkbox;
|
||||
import org.zkoss.zul.Constraint;
|
||||
import org.zkoss.zul.Decimalbox;
|
||||
import org.zkoss.zul.Detail;
|
||||
|
|
@ -177,8 +176,6 @@ public abstract class AllocationRow {
|
|||
|
||||
private Grid derivedAllocationsGrid;
|
||||
|
||||
private Checkbox satisfiedCheckbox;
|
||||
|
||||
private void initializeResourcesPerDayInput() {
|
||||
resourcesPerDayInput.setConstraint(new SimpleConstraint(
|
||||
SimpleConstraint.NO_NEGATIVE));
|
||||
|
|
@ -419,19 +416,4 @@ public abstract class AllocationRow {
|
|||
}
|
||||
}
|
||||
|
||||
public Checkbox getSatisfiedCheckbox() {
|
||||
if (satisfiedCheckbox != null) {
|
||||
satisfiedCheckbox.setChecked(isSatisfied());
|
||||
return satisfiedCheckbox;
|
||||
}
|
||||
Checkbox result = new Checkbox();
|
||||
result.setChecked(isSatisfied());
|
||||
result.setDisabled(true);
|
||||
return satisfiedCheckbox = result;
|
||||
}
|
||||
|
||||
public void loadSatisfied() {
|
||||
satisfiedCheckbox.setChecked(isSatisfied());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,8 +74,6 @@ public class FormBinder {
|
|||
|
||||
private AllocationResult lastAllocation;
|
||||
|
||||
private Datebox taskStartDateBox;
|
||||
|
||||
private Datebox endDate;
|
||||
|
||||
private Button applyButton;
|
||||
|
|
@ -247,18 +245,6 @@ public class FormBinder {
|
|||
return allocationRowsHandler.getCalculatedValue();
|
||||
}
|
||||
|
||||
public void setTaskStartDateBox(Datebox taskStartDateBox) {
|
||||
this.taskStartDateBox = taskStartDateBox;
|
||||
this.taskStartDateBox.setDisabled(true);
|
||||
loadValueForTaskStartDateBox();
|
||||
onChangeEnableApply(taskStartDateBox);
|
||||
}
|
||||
|
||||
private void loadValueForTaskStartDateBox() {
|
||||
this.taskStartDateBox.setValue(allocationRowsHandler.getTask()
|
||||
.getStartDate());
|
||||
}
|
||||
|
||||
private void onChangeEnableApply(InputElement inputElement) {
|
||||
inputElement.addEventListener(Events.ON_CHANGE, onChangeEnableApply);
|
||||
|
||||
|
|
@ -366,11 +352,29 @@ public class FormBinder {
|
|||
|
||||
private void reloadValues() {
|
||||
loadHoursValues();
|
||||
loadIsSatisfiedValues();
|
||||
loadValueForAssignedHoursComponent();
|
||||
loadValueForTaskStartDateBox();
|
||||
loadValueForEndDate();
|
||||
loadDerivedAllocations();
|
||||
loadSclassRowSatisfied();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void loadSclassRowSatisfied() {
|
||||
try {
|
||||
List<org.zkoss.zul.Row> rows = (List<org.zkoss.zul.Row>) allocationsGrid
|
||||
.getRows().getChildren();
|
||||
for (org.zkoss.zul.Row row : rows) {
|
||||
if (row.getValue() instanceof AllocationRow) {
|
||||
if (!((AllocationRow) row.getValue()).isSatisfied()) {
|
||||
row.setSclass("allocation-not-satisfied");
|
||||
} else {
|
||||
row.setSclass("allocation-satisfied");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadHoursValues() {
|
||||
|
|
@ -379,12 +383,6 @@ public class FormBinder {
|
|||
}
|
||||
}
|
||||
|
||||
private void loadIsSatisfiedValues() {
|
||||
for (AllocationRow each : rows) {
|
||||
each.loadSatisfied();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadDerivedAllocations() {
|
||||
for (AllocationRow each : rows) {
|
||||
each.reloadDerivedAllocationsGrid();
|
||||
|
|
@ -605,9 +603,4 @@ public class FormBinder {
|
|||
return sum;
|
||||
}
|
||||
|
||||
public void setStartDate(Date date) {
|
||||
taskStartDateBox.setValue(date);
|
||||
doApply();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ public interface IResourceAllocationModel extends INewAllocationsAdder {
|
|||
|
||||
ProportionalDistributor addDefaultAllocations();
|
||||
|
||||
Date getTaskStart();
|
||||
|
||||
void setStartDate(Date date);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ import org.zkoss.zul.Columns;
|
|||
import org.zkoss.zul.Datebox;
|
||||
import org.zkoss.zul.Decimalbox;
|
||||
import org.zkoss.zul.Grid;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Intbox;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.ListModelList;
|
||||
|
|
@ -100,7 +101,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
private Intbox assignedHoursComponent;
|
||||
|
||||
private Datebox taskStartDateBox;
|
||||
private Datebox taskStartDatebox = new Datebox();
|
||||
|
||||
private Grid calculationTypesGrid;
|
||||
|
||||
|
|
@ -133,6 +134,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
taskEndDate = new Datebox();
|
||||
allResourcesPerDay = new Decimalbox();
|
||||
newAllocationSelector.setLimitingResourceFilter(false);
|
||||
makeReadyInputsForCalculationTypes();
|
||||
|
|
@ -140,7 +142,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
private void makeReadyInputsForCalculationTypes() {
|
||||
final String width = "300px";
|
||||
final String width = "90px";
|
||||
taskEndDate.setWidth(width);
|
||||
assignedHoursComponent = new Intbox();
|
||||
}
|
||||
|
|
@ -157,11 +159,19 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
@Override
|
||||
public Component cellFor(Integer column, CalculationTypeRadio data) {
|
||||
return data.createRadio();
|
||||
return data.createComponent(getController());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Datebox getTaskEndDate() {
|
||||
return taskEndDate;
|
||||
}
|
||||
|
||||
public ResourceAllocationController getController() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows Resource Allocation window
|
||||
* @param task
|
||||
|
|
@ -180,7 +190,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
formBinder = allocationRows
|
||||
.createFormBinder(resourceAllocationModel);
|
||||
formBinder.setAssignedHoursComponent(assignedHoursComponent);
|
||||
formBinder.setTaskStartDateBox(taskStartDateBox);
|
||||
formBinder.setEndDate(taskEndDate);
|
||||
formBinder.setAllResourcesPerDay(allResourcesPerDay);
|
||||
formBinder.setApplyButton(applyButton);
|
||||
|
|
@ -202,6 +211,10 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
public Date getTaskStart() {
|
||||
return resourceAllocationModel.getTaskStart();
|
||||
}
|
||||
|
||||
public enum HoursRendererColumn {
|
||||
|
||||
|
||||
|
|
@ -224,8 +237,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
@Override
|
||||
public Component cell(HoursRendererColumn column,
|
||||
AggregatedHoursGroup data) {
|
||||
Intbox result = new Intbox(data.getHours());
|
||||
result.setDisabled(true);
|
||||
Label result = new Label(Integer.toString(data.getHours()));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
|
@ -346,6 +358,15 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
public abstract Component input(
|
||||
ResourceAllocationController resourceAllocationController);
|
||||
|
||||
public Component createComponent(
|
||||
ResourceAllocationController resourceAllocationController) {
|
||||
if (this.equals(END_DATE)) {
|
||||
return createHbox(resourceAllocationController.taskEndDate);
|
||||
} else {
|
||||
return createRadio();
|
||||
}
|
||||
}
|
||||
|
||||
public Radio createRadio() {
|
||||
Radio result = new Radio();
|
||||
result.setLabel(getName());
|
||||
|
|
@ -353,6 +374,16 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Hbox createHbox(Datebox datebox) {
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.setSpacing("65px");
|
||||
Radio radio = createRadio();
|
||||
|
||||
hbox.appendChild(radio);
|
||||
hbox.appendChild(datebox);
|
||||
return hbox;
|
||||
}
|
||||
|
||||
public void doTheSelectionOn(Radiogroup radiogroup) {
|
||||
for (int i = 0; i < radiogroup.getItemCount(); i++) {
|
||||
Radio radio = radiogroup.getItemAtIndex(i);
|
||||
|
|
@ -501,8 +532,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
private void renderResourceAllocation(Row row, final AllocationRow data)
|
||||
throws Exception {
|
||||
row.setValue(data);
|
||||
append(row, data.createDetail());
|
||||
append(row, data.getSatisfiedCheckbox());
|
||||
append(row, new Label(data.getName()));
|
||||
append(row, data.getHoursInput());
|
||||
append(row, data.getResourcesPerDayInput());
|
||||
|
|
@ -516,12 +545,16 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
removeAllocation(data);
|
||||
}
|
||||
});
|
||||
|
||||
if (!data.isSatisfied()) {
|
||||
row.setSclass("allocation-not-satisfied");
|
||||
} else {
|
||||
row.setSclass("allocation-satisfied");
|
||||
}
|
||||
}
|
||||
|
||||
private void renderAggregatingRow(Row row) {
|
||||
ResourceAllocationController controller = ResourceAllocationController.this;
|
||||
append(row, new Label());
|
||||
append(row, new Label());
|
||||
append(row, new Label(_("Sum of all rows")));
|
||||
append(row, CalculationTypeRadio.NUMBER_OF_HOURS.input(controller));
|
||||
append(row, CalculationTypeRadio.RESOURCES_PER_DAY
|
||||
|
|
@ -567,7 +600,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
public void setStartDate(Date date) {
|
||||
resourceAllocationModel.setStartDate(date);
|
||||
formBinder.setStartDate(date);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -383,6 +383,14 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
return AggregatedHoursGroup.sum(task.getAggregatedByCriterions());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getTaskStart() {
|
||||
if (task == null) {
|
||||
return null;
|
||||
}
|
||||
return task.getStartDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStartDate(Date date) {
|
||||
if (task != null) {
|
||||
|
|
|
|||
|
|
@ -1261,6 +1261,30 @@ overflow: visible;
|
|||
background-color: #CDE6F5;
|
||||
}
|
||||
|
||||
/* Resource allocation*/
|
||||
.allocation-not-satisfied .resource-allocation tr.z-grid-odd td.z-row-inner, .allocation-not-satisfied tr.z-grid-odd {
|
||||
background-color: #EECCCC;
|
||||
}
|
||||
|
||||
.allocation-not-satisfied td.z-row-inner {
|
||||
background-color: #EECCCC;
|
||||
}
|
||||
|
||||
.assignedresources .allocation-not-satisfied td.z-row-inner {
|
||||
background-color: #EECCCC;
|
||||
}
|
||||
|
||||
.allocation-satisfied .resource-allocation tr.z-grid-odd td.z-row-inner, .allocation-satisfied tr.z-grid-odd {
|
||||
background-color: none;
|
||||
}
|
||||
|
||||
.allocation-satisfied td.z-row-inner {
|
||||
background-color: none;
|
||||
}
|
||||
|
||||
.assignedresources .allocation-satisfied td.z-row-inner {
|
||||
background-color: none;
|
||||
}
|
||||
|
||||
/* Advanced allocation */
|
||||
|
||||
|
|
|
|||
|
|
@ -38,22 +38,22 @@
|
|||
<caption label="${i18n:_('Order Element Information')}:" />
|
||||
<grid id="gridLimitingOrderElementHours">
|
||||
<columns>
|
||||
<column label="${i18n:_('Criteria')}" width="200px" />
|
||||
<column label="${i18n:_('Type')}" width="200px" />
|
||||
<column label="${i18n:_('Hours')}" />
|
||||
<column label="${i18n:_('Criteria')}" width="200px" align="center"/>
|
||||
<column label="${i18n:_('Type')}" width="200px" align="center"/>
|
||||
<column label="${i18n:_('Hours')}" align="center"/>
|
||||
</columns>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column width="200px" />
|
||||
<column width="200px" align="center"/>
|
||||
<column width="200px" align="center"/>
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label />
|
||||
<label value="${i18n:_('Total Estimated hours')}:" />
|
||||
<intbox value="@{limitingAllocationController.orderHours}" disabled="${true}" />
|
||||
<label value="@{limitingAllocationController.orderHours}"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
|
|||
|
|
@ -32,51 +32,41 @@
|
|||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel>
|
||||
<groupbox mold="3d" closable="false">
|
||||
<hbox align="end">
|
||||
<groupbox mold="3d" closable="false" height="170px">
|
||||
<caption label="${i18n:_('Order Element Information')}:" />
|
||||
<grid id="orderElementHoursGrid">
|
||||
<columns>
|
||||
<column width="200px" label="${i18n:_('Criteria')}"/>
|
||||
<column width="200px" label="${i18n:_('Type')}"/>
|
||||
<column label="${i18n:_('Hours')}" />
|
||||
</columns>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label />
|
||||
<label value="${i18n:_('Total Estimated hours')}:" />
|
||||
<intbox value="@{allocationController.orderHours}" disabled="${true}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<vbox align="center">
|
||||
<grid id="orderElementHoursGrid">
|
||||
<columns>
|
||||
<column width="200px" label="${i18n:_('Criteria')}" align="center"/>
|
||||
<column width="150px" label="${i18n:_('Type')}" align="center"/>
|
||||
<column width="100px" label="${i18n:_('Hours')}" align="center"/>
|
||||
</columns>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" align="center"/>
|
||||
<column width="150px" align="center"/>
|
||||
<column width="100px" align="center"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label />
|
||||
<label value="${i18n:_('Total Estimated hours')}:" />
|
||||
<label value="@{allocationController.orderHours}"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</vbox>
|
||||
</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')}:" />
|
||||
|
||||
<groupbox mold="3d" style="margin-top: 5px" closable="false" width="320px" height="170px">
|
||||
<caption label="${i18n:_('Calculation type')}" />
|
||||
<hbox>
|
||||
<label value = "${i18n:_('Task start :')}" />
|
||||
<label value="@{allocationController.taskStart,converter='org.navalplanner.web.common.typeconverters.DateConverter'}" />
|
||||
</hbox>
|
||||
<separator orient="horizontal" spacing="10px"/>
|
||||
<radiogroup id="calculationTypeSelector"
|
||||
onCheck="allocationController.calculationTypeSelected = self.selectedItem.value;">
|
||||
<grid id="calculationTypesGrid">
|
||||
|
|
@ -89,6 +79,7 @@
|
|||
<checkbox id="recommendedAllocationCheckbox" label="${i18n:_('Recommended Allocation')}"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</hbox>
|
||||
|
||||
<groupbox mold="3d" style="margin-top: 5px" sclass="assignedresources" closable="false">
|
||||
<caption label="${i18n:_('Allocations')}" />
|
||||
|
|
@ -97,15 +88,10 @@
|
|||
rowRenderer="@{allocationController.resourceAllocationRenderer}"
|
||||
style="margin-bottom: 5px" fixedLayout="true">
|
||||
<columns>
|
||||
<column />
|
||||
<column label="${i18n:_('Satisfied')}"/>
|
||||
<column label="${i18n:_('Name')}" />
|
||||
<column
|
||||
label="${i18n:_('Hours')}" />
|
||||
<column
|
||||
label="${i18n:_('Resources Per Day')}" />
|
||||
<column
|
||||
label="${i18n:_('Operations')}" />
|
||||
<column label="${i18n:_('Name')}" align="center"/>
|
||||
<column label="${i18n:_('Hours')}" align="center"/>
|
||||
<column label="${i18n:_('Resources Per Day')}" align="center"/>
|
||||
<column width="80px" label="${i18n:_('Operations')}" align="center"/>
|
||||
</columns>
|
||||
</grid>
|
||||
</groupbox>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
|
||||
<window id="editTaskWindow" apply="${editController}" border="normal"
|
||||
width="650px" visible="false">
|
||||
width="870px" visible="false">
|
||||
|
||||
<vbox id="messagesContainer" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue