ItEr47S04ValidacionEProbasFuncionaisItEr46S04: [Bug #290] Fixing bug.

Instead of throwing an exception a message is shown. It's pending
formatting it better.
This commit is contained in:
Óscar González Fernández 2010-02-13 23:15:19 +01:00
parent aabfdce7d6
commit bab66fa26b
2 changed files with 24 additions and 7 deletions

View file

@ -50,6 +50,7 @@ import org.navalplanner.business.planner.entities.StretchesFunction.Type;
import org.navalplanner.web.common.IMessagesForUser;
import org.navalplanner.web.common.Level;
import org.navalplanner.web.common.MessagesForUser;
import org.navalplanner.web.common.OnlyOneVisible;
import org.navalplanner.web.planner.allocation.streches.StrechesFunctionConfiguration;
import org.navalplanner.web.resourceload.ResourceLoadModel;
import org.zkoss.ganttz.timetracker.ICellForDetailItemRenderer;
@ -383,7 +384,6 @@ public class AdvancedAllocationController extends GenericForwardComposer {
private void setInputData(IBack back, List<AllocationInput> allocationInputs) {
Validate.notNull(back);
Validate.noNullElements(allocationInputs);
Validate.isTrue(!allocationInputs.isEmpty());
this.back = back;
this.allocationInputs = allocationInputs;
}
@ -397,17 +397,26 @@ public class AdvancedAllocationController extends GenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
normalLayout = comp.getFellow("normalLayout");
noDataLayout = comp.getFellow("noDataLayout");
onlyOneVisible = new OnlyOneVisible(normalLayout, noDataLayout);
this.associatedComponent = comp;
loadAndInitializeComponents();
}
private void loadAndInitializeComponents() {
messages = new MessagesForUser(associatedComponent
.getFellow("messages"));
createComponents();
insertComponentsInLayout();
timeTrackerComponent.afterCompose();
table.afterCompose();
if (allocationInputs.isEmpty()) {
onlyOneVisible.showOnly(noDataLayout);
} else {
onlyOneVisible.showOnly(normalLayout);
createComponents();
insertComponentsInLayout();
timeTrackerComponent.afterCompose();
table.afterCompose();
}
}
private void createComponents() {
@ -482,6 +491,10 @@ public class AdvancedAllocationController extends GenericForwardComposer {
private List<Row> rowsCached = null;
private Map<AllocationInput, Row> groupingRows = new HashMap<AllocationInput, Row>();
private OnlyOneVisible onlyOneVisible;
private Component normalLayout;
private Component noDataLayout;
private List<Row> getRows() {
if (rowsCached != null) {
return rowsCached;

View file

@ -20,14 +20,18 @@
<?page title="${i18n:_('Navalpro: Scheduling')}"?>
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
<zk>
<zk xmlns:n="http://www.zkoss.org/2005/zk/native">
<zscript><![CDATA[
advancedAllocationController = arg.get("advancedAllocationController");
]]>
</zscript>
<borderlayout width="auto" apply="${advancedAllocationController}" class="advancedallocationlayout">
<div id="noDataLayout">
<n:h4>${i18n:_('No Allocations have been done')}</n:h4>
</div>
<borderlayout id="normalLayout" width="auto" apply="${advancedAllocationController}" class="advancedallocationlayout">
<north height="30px" border="0">
<hbox align="center">
<button label="${i18n:_('Accept')}" id="acceptButton" class="planner-command" />