From 755cde54aab36c993f2b5c8f2609e42ebd8e5cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Sun, 3 Jan 2010 17:18:28 +0100 Subject: [PATCH] ItEr41S20CUGravacionModelosUnidadesTraballoItEr40S25: Creating initial listing of available templates --- .../daos/IOrderElementTemplateDAO.java | 32 +++++++++ .../daos/OrderElementTemplateDAO.java | 39 +++++++++++ .../web/common/CustomMenuController.java | 4 +- .../web/templates/IOrderTemplatesModel.java | 33 ++++++++++ .../templates/OrderTemplatesController.java | 65 +++++++++++++++++++ .../web/templates/OrderTemplatesModel.java | 47 ++++++++++++++ .../src/main/webapp/templates/_list.zul | 46 +++++++++++++ .../src/main/webapp/templates/templates.zul | 37 +++++++++++ 8 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/IOrderElementTemplateDAO.java create mode 100644 navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/OrderElementTemplateDAO.java create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/templates/IOrderTemplatesModel.java create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesController.java create mode 100644 navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesModel.java create mode 100644 navalplanner-webapp/src/main/webapp/templates/_list.zul create mode 100644 navalplanner-webapp/src/main/webapp/templates/templates.zul diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/IOrderElementTemplateDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/IOrderElementTemplateDAO.java new file mode 100644 index 000000000..479aa3458 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/IOrderElementTemplateDAO.java @@ -0,0 +1,32 @@ +/* + * 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.business.templates.daos; + +import org.navalplanner.business.common.daos.IGenericDAO; +import org.navalplanner.business.templates.entities.OrderElementTemplate; + +/** + * @author Óscar González Fernández + * + */ +public interface IOrderElementTemplateDAO extends + IGenericDAO { + +} diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/OrderElementTemplateDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/OrderElementTemplateDAO.java new file mode 100644 index 000000000..b5fd4b696 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/templates/daos/OrderElementTemplateDAO.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.business.templates.daos; + +import org.navalplanner.business.common.daos.GenericDAOHibernate; +import org.navalplanner.business.templates.entities.OrderElementTemplate; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Repository; + + +/** + * @author Óscar González Fernández + * + */ +@Repository +@Scope(BeanDefinition.SCOPE_SINGLETON) +public class OrderElementTemplateDAO extends + GenericDAOHibernate implements + IOrderElementTemplateDAO { + +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/common/CustomMenuController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/common/CustomMenuController.java index 246f29cf4..69741694e 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/common/CustomMenuController.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/common/CustomMenuController.java @@ -196,7 +196,9 @@ public class CustomMenuController extends Div implements IMenuItemsRegister { topItem(_("Scheduling"), "/planner/index.zul", "", subItem(_("Company view"), "/planner/index.zul;company_scheduling","01-introducion.html"), subItem(_("General resource allocation"),"/planner/index.zul;company_load","01-introducion.html#id1"), - subItem(_("Orders list"), "/planner/index.zul;orders_list","01-introducion.html#id2")); + subItem(_("Orders list"), "/planner/index.zul;orders_list","01-introducion.html#id2"), + subItem(_("Templates list"), "/templates/templates.zul","")); + topItem(_("Resources"), "/resources/worker/worker.zul", "", subItem(_("Workers List"), "/resources/worker/worker.zul","05-recursos.html#xesti-n-de-traballadores"), diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/IOrderTemplatesModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/IOrderTemplatesModel.java new file mode 100644 index 000000000..53f2d9ec7 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/IOrderTemplatesModel.java @@ -0,0 +1,33 @@ +/* + * 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.templates; + +import java.util.List; + +import org.navalplanner.business.templates.entities.OrderElementTemplate; + +/** + * @author Óscar González Fernández + * + */ +public interface IOrderTemplatesModel { + + List getTemplates(); +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesController.java new file mode 100644 index 000000000..b62a340fb --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesController.java @@ -0,0 +1,65 @@ +/* + * 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.templates; + +import java.util.List; + +import org.navalplanner.business.templates.entities.OrderElementTemplate; +import org.navalplanner.web.common.OnlyOneVisible; +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.Window; + +/** + * @author Óscar González Fernández + * + */ +@org.springframework.stereotype.Component +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class OrderTemplatesController extends GenericForwardComposer{ + + @Autowired + private IOrderTemplatesModel model; + + private OnlyOneVisible cachedOnlyOneVisible; + + private Window listWindow; + + public List getTemplates() { + return model.getTemplates(); + } + + private OnlyOneVisible getVisibility() { + if (cachedOnlyOneVisible == null) { + cachedOnlyOneVisible = new OnlyOneVisible(listWindow); + } + return cachedOnlyOneVisible; + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + getVisibility().showOnly(listWindow); + } + +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesModel.java new file mode 100644 index 000000000..226d91305 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/templates/OrderTemplatesModel.java @@ -0,0 +1,47 @@ +/* + * 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.templates; + +import java.util.List; + +import org.navalplanner.business.templates.daos.IOrderElementTemplateDAO; +import org.navalplanner.business.templates.entities.OrderElementTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +/** + * @author Óscar González Fernández + * + */ +@Component +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class OrderTemplatesModel implements IOrderTemplatesModel { + + @Autowired + private IOrderElementTemplateDAO dao; + + @Override + public List getTemplates() { + return dao.list(OrderElementTemplate.class); + } + +} diff --git a/navalplanner-webapp/src/main/webapp/templates/_list.zul b/navalplanner-webapp/src/main/webapp/templates/_list.zul new file mode 100644 index 000000000..5cca4fb8b --- /dev/null +++ b/navalplanner-webapp/src/main/webapp/templates/_list.zul @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/navalplanner-webapp/src/main/webapp/templates/templates.zul b/navalplanner-webapp/src/main/webapp/templates/templates.zul new file mode 100644 index 000000000..e94a40acf --- /dev/null +++ b/navalplanner-webapp/src/main/webapp/templates/templates.zul @@ -0,0 +1,37 @@ + + + + + + + + + + + + + +
+ +
+