ItEr32S12CUAsignacionGrupoRecursosAPlanificacionItEr31S15: Advanced allocation dummy tab added.

This commit is contained in:
Óscar González Fernández 2009-10-27 23:55:30 +01:00
parent e1fbe2757c
commit ad10de4f1e
2 changed files with 66 additions and 1 deletions

View file

@ -0,0 +1,50 @@
/*
* This file is part of ###PROJECT_NAME###
*
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.navalplanner.web.planner.tabs;
import static org.navalplanner.web.I18nHelper._;
import org.navalplanner.web.planner.tabs.CreatedOnDemandTab.IComponentCreator;
import org.zkoss.ganttz.extensions.ITab;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Label;
/**
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public class AdvancedAllocationTabCreator {
private static final String ADVANCED_ALLOCATION_VIEW = _("Advanced Allocation");
public static ITab create() {
return new CreatedOnDemandTab(ADVANCED_ALLOCATION_VIEW,
new IComponentCreator() {
@Override
public Component create(Component parent) {
Label result = new Label();
result.setParent(parent);
result.setValue("WIP");
return result;
}
});
}
}

View file

@ -127,10 +127,12 @@ public class MultipleTabsPlannerController implements Composer {
}
});
final State<Void> typeChanged = typeChangedState();
ITab advancedAllocation = AdvancedAllocationTabCreator.create();
return TabsConfiguration.create()
.add(tabWithNameReloading(planningTab, typeChanged))
.add(tabWithNameReloading(resourceLoadTab, typeChanged))
.add(tabWithNameReloading(ordersTab, typeChanged));
.add(tabWithNameReloading(ordersTab, typeChanged))
.add(visibleOnlyOnOrderMode(advancedAllocation));
}
private ChangeableTab tabWithNameReloading(ITab tab,
@ -150,6 +152,19 @@ public class MultipleTabsPlannerController implements Composer {
return typeChanged;
}
private ChangeableTab visibleOnlyOnOrderMode(ITab tab) {
final State<Boolean> state = State.create(mode.isOf(ModeType.ORDER));
ChangeableTab result = configure(tab).visibleOn(state);
mode.addListener(new ModeTypeChangedListener() {
@Override
public void typeChanged(ModeType oldType, ModeType newType) {
state.changeValueTo(ModeType.ORDER == newType);
}
});
return result;
}
@Override
public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
tabsSwitcher = (TabSwitcher) comp;