ItEr49S10CUVisualizacionResponsabilidadesTRaballoNaPlanificacionItEr48S10: AllocationRow keeps track if it is satisfied or not.

This commit is contained in:
Óscar González Fernández 2010-02-23 18:50:23 +01:00
parent 41576f6bb5
commit 181fccc1aa
2 changed files with 35 additions and 0 deletions

View file

@ -41,6 +41,7 @@ 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;
@ -175,6 +176,8 @@ public abstract class AllocationRow {
private Grid derivedAllocationsGrid;
private Checkbox satisfiedCheckbox;
private void initializeResourcesPerDayInput() {
resourcesPerDayInput.setConstraint(new SimpleConstraint(
SimpleConstraint.NO_NEGATIVE));
@ -400,4 +403,29 @@ public abstract class AllocationRow {
.createRenderer());
}
public boolean isSatisfied() {
if (temporal != null) {
return temporal.isSatisfied();
} else if (origin != null) {
return origin.isSatisfied();
} else {
return false;
}
}
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());
}
}

View file

@ -366,6 +366,7 @@ public class FormBinder {
private void reloadValues() {
loadHoursValues();
loadIsSatisfiedValues();
loadValueForAssignedHoursComponent();
loadValueForTaskStartDateBox();
loadValueForEndDate();
@ -378,6 +379,12 @@ public class FormBinder {
}
}
private void loadIsSatisfiedValues() {
for (AllocationRow each : rows) {
each.loadSatisfied();
}
}
private void loadDerivedAllocations() {
for (AllocationRow each : rows) {
each.reloadDerivedAllocationsGrid();