ItEr30S15RFVisualizacionMultiplesProxectosItEr29S18: Passing the controller as argument. The controller is now managed by spring. Removing no longer working file.
This commit is contained in:
parent
2ba923e9ee
commit
c933de2f01
4 changed files with 22 additions and 85 deletions
|
|
@ -36,6 +36,9 @@ import org.navalplanner.web.common.MessagesForUser;
|
|||
import org.navalplanner.web.common.OnlyOneVisible;
|
||||
import org.navalplanner.web.common.Util;
|
||||
import org.navalplanner.web.planner.IOrderPlanningControllerEntryPoints;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Label;
|
||||
|
|
@ -45,11 +48,14 @@ import org.zkoss.zul.api.Window;
|
|||
* Controller for CRUD actions <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
@org.springframework.stereotype.Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class OrderCRUDController extends GenericForwardComposer {
|
||||
|
||||
private static final org.apache.commons.logging.Log LOG = LogFactory
|
||||
.getLog(OrderCRUDController.class);
|
||||
|
||||
@Autowired
|
||||
private IOrderModel orderModel;
|
||||
|
||||
private IMessagesForUser messagesForUser;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@ import static org.navalplanner.web.I18nHelper._;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.navalplanner.business.orders.entities.Order;
|
||||
import org.navalplanner.web.common.Util;
|
||||
import org.navalplanner.web.orders.OrderCRUDController;
|
||||
import org.navalplanner.web.planner.CompanyPlanningController;
|
||||
import org.navalplanner.web.planner.tabs.CreatedOnDemandTab.IComponentCreator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -65,6 +67,9 @@ public class MultipleTabsPlannerController {
|
|||
@Autowired
|
||||
private CompanyPlanningController companyPlanningController;
|
||||
|
||||
@Autowired
|
||||
private OrderCRUDController orderCRUDController;
|
||||
|
||||
public TabsConfiguration getTabs() {
|
||||
if (tabsConfiguration == null) {
|
||||
tabsConfiguration = buildTabsConfiguration();
|
||||
|
|
@ -183,13 +188,13 @@ public class MultipleTabsPlannerController {
|
|||
return new CreatedOnDemandTab(ORDERS_VIEW,
|
||||
new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
Map<String, Object> args = new HashMap<String, Object>();
|
||||
args.put("orderController", orderCRUDController);
|
||||
org.zkoss.zk.ui.Component result = Executions.createComponents(
|
||||
"/orders/_ordersTab.zul",
|
||||
parent,
|
||||
null);
|
||||
"/orders/_ordersTab.zul", parent, args);
|
||||
createBindingsFor(result);
|
||||
Util.reloadBindings(result);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@
|
|||
<?component name="edition" inline="true" macroURI="_edition.zul"?>
|
||||
<?component name="orderElement" inline="true" macroURI="_editOrderElement.zul"?>
|
||||
<zk>
|
||||
<window apply="org.navalplanner.web.orders.OrderCRUDController">
|
||||
<zscript><![CDATA[
|
||||
orderController = arg.get("orderController");
|
||||
]]>
|
||||
</zscript>
|
||||
<window apply="${orderController}">
|
||||
<vbox id="messagesContainer"></vbox>
|
||||
<list top_id="listWindow" />
|
||||
<edition top_id="createWindow" title="${i18n:_('Create')}"
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
<!--
|
||||
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/>.
|
||||
-->
|
||||
|
||||
<?page title="${i18n:_('Navalpro: Orders')}"?>
|
||||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
|
||||
<?page id="List"?>
|
||||
<?init class="org.zkoss.zk.ui.util.Composition" arg0="/common/layout/template.zul"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_v01.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_zk.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/resources/css/resources.css"?>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<?component name="list" inline="true" macroURI="_list.zul"?>
|
||||
<?component name="edition" inline="true" macroURI="_edition.zul"?>
|
||||
<?component name="orderElement" inline="true" macroURI="_editOrderElement.zul"?>
|
||||
|
||||
<zk>
|
||||
<window self="@{define(content)}"
|
||||
apply="org.navalplanner.web.orders.OrderCRUDController">
|
||||
<vbox id="messagesContainer"></vbox>
|
||||
<list top_id="listWindow" />
|
||||
<edition top_id="createWindow" title="${i18n:_('Create')}"
|
||||
save_button_label="${i18n:_('Save')}" cancel_button_label="${i18n:_('Cancel')}" />
|
||||
<edition top_id="editWindow" title="${i18n:_('Edit order')}"
|
||||
save_button_label="${i18n:_('Save')}" cancel_button_label="${i18n:_('Cancel')}" />
|
||||
<orderElement top_id="editOrderElement" title="${i18n:_('Edit order element')}"
|
||||
back_button_label="${i18n:_('Back')}" />
|
||||
|
||||
<window visible="@{controller.confirmingRemove}"
|
||||
id="confirmRemove" title="${i18n:_('Confirm')}" width="500px"
|
||||
position="center">
|
||||
<vbox>
|
||||
<hbox>
|
||||
<i18n value="Confirm deleting {0} ?" arg0="@{controller.order.name}"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<button label="${i18n:_('Yes')}"
|
||||
onClick="controller.remove(controller.order);" />
|
||||
<button label="${i18n:_('No')}"
|
||||
onClick="controller.cancelRemove();" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
||||
<window visible="@{controller.confirmingSchedule}"
|
||||
id="confirmSchedule" title="${i18n:_('Confirm')}" width="500px"
|
||||
position="center">
|
||||
<vbox>
|
||||
<hbox>
|
||||
<i18n value="Confirm scheduling {0} ?" arg0="@{controller.order.name}"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<button label="${i18n:_('Yes')}"
|
||||
onClick="controller.schedule();" />
|
||||
<button label="${i18n:_('No')}"
|
||||
onClick="controller.cancelSchedule();" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
</window>
|
||||
|
||||
</zk>
|
||||
Loading…
Add table
Reference in a new issue