ItEr42S17CUGravacionModelosUnidadesTraballoItEr41S20: Converting MaterialAssignmentsComponent into a superclass

This commit is contained in:
Óscar González Fernández 2010-01-07 20:48:19 +01:00
parent 3aac0cb353
commit 685f2a5feb
6 changed files with 46 additions and 12 deletions

View file

@ -42,7 +42,7 @@ import org.navalplanner.web.common.MessagesForUser;
import org.navalplanner.web.common.OnlyOneVisible;
import org.navalplanner.web.common.Util;
import org.navalplanner.web.orders.materials.AssignedMaterialsToOrderElementController;
import org.navalplanner.web.orders.materials.MaterialAssignmentsComponent;
import org.navalplanner.web.orders.materials.OrderElementMaterialAssignmentsComponent;
import org.navalplanner.web.planner.order.IOrderPlanningGate;
import org.navalplanner.web.tree.TreeComponent;
import org.navalplanner.web.users.OrderAuthorizationController;
@ -231,7 +231,7 @@ public class OrderCRUDController extends GenericForwardComposer {
private void setupAssignedMaterialsToOrderElementController(
Component comp) throws Exception {
MaterialAssignmentsComponent assignmentsComponent = (MaterialAssignmentsComponent) editWindow
OrderElementMaterialAssignmentsComponent assignmentsComponent = (OrderElementMaterialAssignmentsComponent) editWindow
.getFellowIfAny("orderElementMaterials");
assignedMaterialsController = assignmentsComponent.getController();
}

View file

@ -26,7 +26,7 @@ import org.navalplanner.business.orders.entities.OrderLine;
import org.navalplanner.business.orders.entities.OrderLineGroup;
import org.navalplanner.web.common.Util;
import org.navalplanner.web.orders.materials.AssignedMaterialsToOrderElementController;
import org.navalplanner.web.orders.materials.MaterialAssignmentsComponent;
import org.navalplanner.web.orders.materials.OrderElementMaterialAssignmentsComponent;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.SuspendNotAllowedException;
import org.zkoss.zk.ui.event.Event;
@ -116,7 +116,7 @@ public class OrderElementController extends GenericForwardComposer {
private void setupAssignedMaterialsToOrderElementController(Component comp)
throws Exception {
MaterialAssignmentsComponent assignedMaterialsComponent = (MaterialAssignmentsComponent) comp
OrderElementMaterialAssignmentsComponent assignedMaterialsComponent = (OrderElementMaterialAssignmentsComponent) comp
.getFellowIfAny("orderElementMaterials");
assignedMaterialsController = assignedMaterialsComponent
.getController();

View file

@ -25,12 +25,8 @@ import org.zkoss.zk.ui.HtmlMacroComponent;
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public class MaterialAssignmentsComponent extends HtmlMacroComponent {
public abstract class MaterialAssignmentsComponent extends HtmlMacroComponent {
private AssignedMaterialsToOrderElementController controller = new AssignedMaterialsToOrderElementController();
public AssignedMaterialsToOrderElementController getController() {
return controller;
}
public abstract AssignedMaterialsController<?, ?> getController();
}

View file

@ -0,0 +1,36 @@
/*
* 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.orders.materials;
/**
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public class OrderElementMaterialAssignmentsComponent extends
MaterialAssignmentsComponent {
private AssignedMaterialsToOrderElementController controller = new AssignedMaterialsToOrderElementController();
@Override
public AssignedMaterialsToOrderElementController getController() {
return controller;
}
}

View file

@ -23,7 +23,8 @@
<?component name="listOrderElementAdvances" inline="true" macroURI="_listOrderElementAdvances.zul"?>
<?component name="listOrderElementLabels" inline="true" macroURI="_listOrderElementLabels.zul"?>
<?component name="listOrderElementCriterionRequirements" inline="true" macroURI="_listOrderElementCriterionRequirements.zul"?>
<?component name="listOrderElementMaterials" class="org.navalplanner.web.orders.materials.MaterialAssignmentsComponent" macroURI="/orders/components/_listOrderElementMaterials.zul"?>
<?component name="listOrderElementMaterials" class="org.navalplanner.web.orders.materials.OrderElementMaterialAssignmentsComponent"
macroURI="/orders/components/_listOrderElementMaterials.zul"?>
<?component name="listOrderElementTaskQualityForms" inline="true" macroURI="_listOrderElementTaskQualityForms.zul"?>
<window id="${arg.top_id}" title="${i18n:_('Edit order element')}"

View file

@ -24,7 +24,8 @@
<?component name="listOrderElementAdvances" inline="true" macroURI="_listOrderElementAdvances.zul"?>
<?component name="listOrderElementLabels" inline="true" macroURI="_listOrderElementLabels.zul"?>
<?component name="listOrderElementCriterionRequirements" inline="true" macroURI="_listOrderElementCriterionRequirements.zul"?>
<?component name="listOrderElementMaterials" class="org.navalplanner.web.orders.materials.MaterialAssignmentsComponent" macroURI="/orders/components/_listOrderElementMaterials.zul"?>
<?component name="listOrderElementMaterials" class="org.navalplanner.web.orders.materials.OrderElementMaterialAssignmentsComponent"
macroURI="/orders/components/_listOrderElementMaterials.zul"?>
<?component name="listOrderElementTaskQualityForms" inline="true" macroURI="_listOrderElementTaskQualityForms.zul"?>
<?component name="listOrderElementAuthorizations" inline="true" macroURI="_listOrderElementAuthorizations.zul"?>