Adding entry points to MultipleTabsPlannerController, allowing to go to a concrete perspective from the menu.

This commit is contained in:
Óscar González Fernández 2009-12-05 19:32:25 +01:00
parent a2fe60531a
commit e015c61a09
3 changed files with 79 additions and 6 deletions

View file

@ -165,11 +165,13 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
}
public void initializeMenu() {
topItem(_("Scheduling"), "/planner/index.zul", subItem(
_("Company view"), "/planner/index.zul#company_view"), subItem(
_("General resource allocation"),
"/planner/index.zul#company_resources"), subItem(
_("Orders list"), "/planner/index.zul#company_orders"));
topItem(_("Scheduling"), "/planner/index.zul",
subItem(_("Company view"),
"/planner/index.zul;company_scheduling"),
subItem(_("General resource allocation"),
"/planner/index.zul;company_load"),
subItem(_("Orders list"),
"/planner/index.zul;orders_list"));
topItem(_("Resources"), "/resources/worker/worker.zul",
subItem(_("Workers List"),

View file

@ -0,0 +1,41 @@
/*
* 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 org.navalplanner.web.common.entrypoints.EntryPoint;
import org.navalplanner.web.common.entrypoints.EntryPoints;
/**
* Entry points for {@link MultipleTabsPlannerController} <br />
* @author Óscar González Fernández <ogonzalez@igalia.com>
*/
@EntryPoints(page = "/planner/index.zul", registerAs = "globalView")
public interface IGlobalViewEntryPoints {
@EntryPoint("company_scheduling")
public void goToCompanyScheduling();
@EntryPoint("company_load")
public void goToCompanyLoad();
@EntryPoint("orders_list")
public void goToOrdersList();
}

View file

@ -22,11 +22,15 @@ package org.navalplanner.web.planner.tabs;
import static org.navalplanner.web.I18nHelper._;
import static org.zkoss.ganttz.adapters.TabsConfiguration.configure;
import javax.annotation.Resource;
import org.navalplanner.business.common.IAdHocTransactionService;
import org.navalplanner.business.orders.daos.IOrderDAO;
import org.navalplanner.business.orders.entities.Order;
import org.navalplanner.business.planner.daos.ITaskElementDAO;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.web.common.entrypoints.URLHandler;
import org.navalplanner.web.common.entrypoints.URLHandlerRegistry;
import org.navalplanner.web.orders.OrderCRUDController;
import org.navalplanner.web.planner.allocation.AdvancedAllocationController.IBack;
import org.navalplanner.web.planner.company.CompanyPlanningController;
@ -56,7 +60,8 @@ import org.zkoss.zk.ui.util.Composer;
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class MultipleTabsPlannerController implements Composer {
public class MultipleTabsPlannerController implements Composer,
IGlobalViewEntryPoints {
public static final String PLANNIFICATION = _("Scheduling");
@ -103,6 +108,12 @@ public class MultipleTabsPlannerController implements Composer {
@Autowired
private IResourceDAO resourceDAO;
@Autowired
private URLHandlerRegistry registry;
@Resource
private IGlobalViewEntryPoints globalView;
private TabsConfiguration buildTabsConfiguration() {
planningTab = PlanningTabCreator.create(mode,
companyPlanningController, orderPlanningController, orderDAO,
@ -193,6 +204,10 @@ public class MultipleTabsPlannerController implements Composer {
tabsSwitcher = (TabSwitcher) comp;
breadcrumbs = comp.getPage().getFellow("breadcrumbs");
tabsSwitcher.setConfiguration(buildTabsConfiguration());
final URLHandler<IGlobalViewEntryPoints> handler = registry
.getRedirectorFor(IGlobalViewEntryPoints.class);
handler.applyIfMatches(this);
handler.registerListener(this, comp.getPage());
}
private TabsRegistry getTabsRegistry() {
@ -214,4 +229,19 @@ public class MultipleTabsPlannerController implements Composer {
};
}
@Override
public void goToCompanyScheduling() {
getTabsRegistry().show(planningTab);
}
@Override
public void goToCompanyLoad() {
getTabsRegistry().show(resourceLoadTab);
}
@Override
public void goToOrdersList() {
getTabsRegistry().show(ordersTab);
}
}