[Bug #833] Fix bug

Now the recommended allocation doesn't have toggle behaviour.

FEA: ItEr69S04BugFixing
This commit is contained in:
Óscar González Fernández 2011-02-01 18:02:06 +01:00
parent 6aed9e08ff
commit 3d8fd0c218
4 changed files with 23 additions and 15 deletions

View file

@ -195,6 +195,7 @@ public class AllocationRowsHandler {
if (row.isModifying()) {
requestedToRemove.add(row.getOrigin());
}
formBinder.rowRemoved();
}
public Set<ResourceAllocation<?>> getAllocationsRequestedToRemove() {

View file

@ -120,8 +120,6 @@ public class FormBinder {
private Button btnRecommendedAllocation;
private boolean recommendedAllocationIsPressed = false;
private ProportionalDistributor hoursDistributorForRecommendedAllocation;
private ResourcesPerDay.ResourcesPerDayDistributor resourcesPerDayDistributorForRecommendedAllocation;
@ -231,6 +229,7 @@ public class FormBinder {
workableDaysAndDatesBinder.applyDisabledRules();
allResourcesPerDayVisibilityRule();
applyDisabledRulesOnRows();
this.btnRecommendedAllocation.setDisabled(recommendedAllocation);
}
private void applyDisabledRulesOnRows() {
@ -658,16 +657,22 @@ public class FormBinder {
}
}
public void setRecommendedAllocation(Button recommendedAllocation) {
this.btnRecommendedAllocation = recommendedAllocation;
Util.ensureUniqueListener(recommendedAllocation, Events.ON_CLICK,
new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
activatingRecommendedAllocation();
}
});
}
public EventListener getRecommendedAllocationListener() {
return new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
recommendedAllocationIsPressed = !recommendedAllocationIsPressed;
if (recommendedAllocationIsPressed) {
activatingRecommendedAllocation();
} else {
deactivatingRecommendedAllocation();
}
activatingRecommendedAllocation();
}
};
}
@ -713,6 +718,10 @@ public class FormBinder {
AllocationRow.assignResourcesPerDay(rows, forRows);
}
public void rowRemoved() {
deactivatingRecommendedAllocation();
}
private void deactivatingRecommendedAllocation() {
this.recommendedAllocation = false;
allHoursInput
@ -847,4 +856,5 @@ public class FormBinder {
this.behaviour = behaviour;
}
}

View file

@ -255,8 +255,8 @@ public class ResourceAllocationController extends GenericForwardComposer {
private void initializeTaskInformationComponent() {
taskInformation.initializeGridTaskRows(resourceAllocationModel
.getHoursAggregatedByCriterions());
taskInformation.onRecomendAllocation(formBinder
.getRecommendedAllocationListener());
formBinder.setRecommendedAllocation(taskInformation
.getBtnRecommendedAllocation());
taskInformation.onCalculateTotalHours(new ITotalHoursCalculationListener() {
@Override

View file

@ -29,8 +29,6 @@ import org.zkoss.ganttz.timetracker.ICellForDetailItemRenderer;
import org.zkoss.ganttz.timetracker.OnColumnsRowRenderer;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlMacroComponent;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Button;
import org.zkoss.zul.Footer;
import org.zkoss.zul.Grid;
@ -75,9 +73,8 @@ public class TaskInformation extends HtmlMacroComponent {
gridTaskRows.setRowRenderer(newTaskRowsRenderer());
}
public void onRecomendAllocation(EventListener eventListener) {
Util.ensureUniqueListener(btnRecommendedAllocation, Events.ON_CLICK,
eventListener);
public Button getBtnRecommendedAllocation() {
return btnRecommendedAllocation;
}
public void showRecomendedAllocationButton() {