From 4d4c565ba7c73eaff21e6c6a9a10fcba4c2e58c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Wed, 2 Dec 2009 20:58:28 +0100 Subject: [PATCH] ItEr35S15CUAdministracionCategoriaCosteItEr34S15: listing of CostCategories Implemented the basics of the XXModel, XXController and .zul files to be able to list the existing CostCategories. --- .../CostCategoryCRUDController.java | 88 +++++++++++++++++++ .../web/costcategories/CostCategoryModel.java | 48 ++++++++++ .../ICostCategoryCRUDController.java | 39 ++++++++ .../costcategories/ICostCategoryModel.java | 41 +++++++++ .../costcategories/_editCostCategory.zul | 25 ++++++ .../costcategories/_listCostCategories.zul | 45 ++++++++++ .../webapp/costcategories/costCategory.zul | 38 ++++++++ 7 files changed, 324 insertions(+) create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryCRUDController.java create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryModel.java create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryCRUDController.java create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryModel.java create mode 100644 navalplanner-webapp/src/main/webapp/costcategories/_editCostCategory.zul create mode 100644 navalplanner-webapp/src/main/webapp/costcategories/_listCostCategories.zul create mode 100644 navalplanner-webapp/src/main/webapp/costcategories/costCategory.zul diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryCRUDController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryCRUDController.java new file mode 100644 index 000000000..f01bf70ba --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryCRUDController.java @@ -0,0 +1,88 @@ +/* + * 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 . + */ + +package org.navalplanner.web.costcategories; + +import java.util.List; + +import org.navalplanner.business.costcategories.entities.CostCategory; +import org.navalplanner.web.common.IMessagesForUser; +import org.navalplanner.web.common.MessagesForUser; +import org.navalplanner.web.common.OnlyOneVisible; +import org.navalplanner.web.common.Util; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.util.GenericForwardComposer; +import org.zkoss.zul.api.Window; + +/** + * Controller for CRUD actions over a {@link CostCategory} + * + * @author Jacobo Aragunde Perez + */ +@SuppressWarnings("serial") +public class CostCategoryCRUDController extends GenericForwardComposer + implements ICostCategoryCRUDController { + + private Window listWindow; + + private Window createWindow; + + private ICostCategoryModel costCategoryModel; + + private OnlyOneVisible visibility; + + private IMessagesForUser messagesForUser; + + private Component messagesContainer; + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + comp.setVariable("controller", this, true); + messagesForUser = new MessagesForUser(messagesContainer); + getVisibility().showOnly(listWindow); + } + + @Override + public void goToCreateForm() { + //TODO + } + + @Override + public void goToEditForm(CostCategory costCategory) { + //TODO + } + + @Override + public void goToList() { + getVisibility().showOnly(listWindow); + Util.reloadBindings(listWindow); + } + + public List getCostCategories() { + return costCategoryModel.getCostCategories(); + } + + private OnlyOneVisible getVisibility() { + return (visibility == null) ? new OnlyOneVisible(createWindow, + listWindow) + : visibility; + } +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryModel.java new file mode 100644 index 000000000..9263186af --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/CostCategoryModel.java @@ -0,0 +1,48 @@ +/* + * 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 . + */ + +package org.navalplanner.web.costcategories; + +import java.util.List; + +import org.navalplanner.business.costcategories.daos.ICostCategoryDAO; +import org.navalplanner.business.costcategories.entities.CostCategory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; + +/** + * Model for UI operations related to {@link CostCategory} + * + * @author Jacobo Aragunde Perez + */ +@Service +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class CostCategoryModel implements ICostCategoryModel { + + @Autowired + private ICostCategoryDAO costCategoryDAO; + + @Override + public List getCostCategories() { + return costCategoryDAO.list(CostCategory.class); + } +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryCRUDController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryCRUDController.java new file mode 100644 index 000000000..1405d69cf --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryCRUDController.java @@ -0,0 +1,39 @@ +/* + * 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 . + */ + +package org.navalplanner.web.costcategories; + +import org.navalplanner.business.costcategories.entities.CostCategory; +import org.navalplanner.web.common.entrypoints.EntryPoint; +import org.navalplanner.web.common.entrypoints.EntryPoints; + +@EntryPoints(page = "/costcategories/costCategory.zul", registerAs = "costCategoryCRUD") +public interface ICostCategoryCRUDController { + + @EntryPoint("edit") + public abstract void goToEditForm(CostCategory costCategory); + + @EntryPoint("create") + public abstract void goToCreateForm(); + + @EntryPoint("list") + public abstract void goToList(); + +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryModel.java new file mode 100644 index 000000000..09c4eb7e3 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/costcategories/ICostCategoryModel.java @@ -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 . + */ + +package org.navalplanner.web.costcategories; + +import java.util.List; + +import org.navalplanner.business.costcategories.entities.CostCategory; + +/** + * Model for UI operations related to {@link CostCategory} + * + * @author Jacobo Aragunde Perez + */ +public interface ICostCategoryModel { + + /** + * Get all {@link CostCategory} elements + * + * @return + */ + List getCostCategories(); + +} diff --git a/navalplanner-webapp/src/main/webapp/costcategories/_editCostCategory.zul b/navalplanner-webapp/src/main/webapp/costcategories/_editCostCategory.zul new file mode 100644 index 000000000..0c85e2f81 --- /dev/null +++ b/navalplanner-webapp/src/main/webapp/costcategories/_editCostCategory.zul @@ -0,0 +1,25 @@ + + + + + + + diff --git a/navalplanner-webapp/src/main/webapp/costcategories/_listCostCategories.zul b/navalplanner-webapp/src/main/webapp/costcategories/_listCostCategories.zul new file mode 100644 index 000000000..375df4d76 --- /dev/null +++ b/navalplanner-webapp/src/main/webapp/costcategories/_listCostCategories.zul @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + diff --git a/navalplanner-webapp/src/main/webapp/costcategories/costCategory.zul b/navalplanner-webapp/src/main/webapp/costcategories/costCategory.zul new file mode 100644 index 000000000..91b0648e0 --- /dev/null +++ b/navalplanner-webapp/src/main/webapp/costcategories/costCategory.zul @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + +