ItEr41S20CUGravacionModelosUnidadesTraballoItEr40S25: Creating initial listing of available templates

This commit is contained in:
Óscar González Fernández 2010-01-03 17:18:28 +01:00
parent 8863cdd369
commit 755cde54aa
8 changed files with 302 additions and 1 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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 <ogonzalez@igalia.com>
*
*/
public interface IOrderElementTemplateDAO extends
IGenericDAO<OrderElementTemplate, Long> {
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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 <ogonzalez@igalia.com>
*
*/
@Repository
@Scope(BeanDefinition.SCOPE_SINGLETON)
public class OrderElementTemplateDAO extends
GenericDAOHibernate<OrderElementTemplate, Long> implements
IOrderElementTemplateDAO {
}

View file

@ -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"),

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
package org.navalplanner.web.templates;
import java.util.List;
import org.navalplanner.business.templates.entities.OrderElementTemplate;
/**
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public interface IOrderTemplatesModel {
List<OrderElementTemplate> getTemplates();
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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 <ogonzalez@igalia.com>
*
*/
@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<OrderElementTemplate> 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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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 <ogonzalez@igalia.com>
*
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class OrderTemplatesModel implements IOrderTemplatesModel {
@Autowired
private IOrderElementTemplateDAO dao;
@Override
public List<OrderElementTemplate> getTemplates() {
return dao.list(OrderElementTemplate.class);
}
}

View file

@ -0,0 +1,46 @@
<!--
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/>.
-->
<window id="${arg.top_id}" title="${i18n:_('Templates list')}">
<grid id="listing" model="@{templateController.templates}" mold="paging"
pageSize="10" fixedLayout="true">
<columns>
<column label="${i18n:_('Code')}" sort="auto(code)" />
<column label="${i18n:_('Name')}" sort="auto(name)" />
<column label="${i18n:_('Days from Beginning to Start')}"
sort="auto(startAsDaysFromBeginning)" />
<column label="${i18n:_('Days from Beginning to Deadline')}"
sort="auto(endAsDaysFromBeginning)" />
<column label="${i18n:_('Description')}"
sort="auto(description)" />
<column label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='template'}" value="@{template}">
<label value="@{template.code}" />
<label value="@{template.name}" />
<label value="@{template.startAsDaysFromBeginning}" />
<label value="@{template.deadlineAsDaysFromBeginning}" />
<label value="@{template.description}" />
<hbox>
</hbox>
</row>
</rows>
</grid>
</window>

View file

@ -0,0 +1,37 @@
<!--
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:_('Templates')}"?>
<?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"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?component name="list" inline="true" macroURI="_list.zul"?>
<zk>
<zscript><![CDATA[
templateController = orderTemplatesController;
]]>
</zscript>
<div self="@{define(content)}" apply="${templateController}">
<list top_id="listWindow" />
</div>
</zk>