ItEr29S08CUCreacionProxectoPlanificacionItEr28S09: Wiring ViewSwitcher

This commit is contained in:
Óscar González Fernández 2009-10-05 17:30:32 +02:00
parent 3808619b42
commit 719abbe71f
4 changed files with 68 additions and 3 deletions

View file

@ -0,0 +1,43 @@
/*
* 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.common;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.zkoss.zk.ui.util.Composer;
/**
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class ViewSwitcher implements Composer {
private org.zkoss.zk.ui.Component parent;
@Override
public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
this.parent = comp;
}
}

View file

@ -22,6 +22,7 @@ package org.navalplanner.web.planner;
import org.navalplanner.business.orders.entities.Order;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.web.common.ViewSwitcher;
import org.navalplanner.web.common.entrypoints.IURLHandlerRegistry;
import org.navalplanner.web.common.entrypoints.URLHandler;
import org.navalplanner.web.planner.IOrderPlanningModel.IConfigurationOnTransaction;
@ -41,6 +42,9 @@ import org.zkoss.ganttz.adapters.PlannerConfiguration;
public class OrderPlanningController implements
IOrderPlanningControllerEntryPoints {
@Autowired
private ViewSwitcher viewSwitcher;
@Autowired
private ResourceAllocationController resourceAllocationController;
@ -102,4 +106,8 @@ public class OrderPlanningController implements
return calendarAllocationController;
}
public ViewSwitcher getViewSwitcher() {
return viewSwitcher;
}
}

View file

@ -46,6 +46,7 @@ import org.navalplanner.web.common.IMessagesForUser;
import org.navalplanner.web.common.Level;
import org.navalplanner.web.common.MessagesForUser;
import org.navalplanner.web.common.Util;
import org.navalplanner.web.common.ViewSwitcher;
import org.navalplanner.web.common.components.WorkerSearch;
import org.navalplanner.web.planner.PlanningState;
import org.springframework.beans.factory.config.BeanDefinition;
@ -78,6 +79,8 @@ import org.zkoss.zul.api.Window;
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class ResourceAllocationController extends GenericForwardComposer {
private ViewSwitcher switcher;
private IResourceAllocationModel resourceAllocationModel;
private ResourceAllocationRenderer resourceAllocationRenderer = new ResourceAllocationRenderer();
@ -469,4 +472,12 @@ public class ResourceAllocationController extends GenericForwardComposer {
});
}
}
public ViewSwitcher getSwitcher() {
return switcher;
}
public void setSwitcher(ViewSwitcher switcher) {
this.switcher = switcher;
}
}

View file

@ -32,17 +32,20 @@
macroURI="/resources/search/worker_search.zul" ?>
<zk>
<zscript><![CDATA[
planningController = orderPlanningController;
allocationController = planningController.resourceAllocationController;
splittingTaskController = planningController.splittingController;
calendarController = planningController.calendarAllocationController;
switcher = planningController.viewSwitcher;
allocationController.switcher = switcher;
]]>
</zscript>
<planner id="planner" self="@{define(content)}">
</planner>
<div apply="${switcher}" self="@{define(content)}">
<planner id="planner">
</planner>
</div>
<div id="idContextMenuTaskAssignment"></div>