ItEr30S06CUAltaMaquina: List of Machines
This commit is contained in:
parent
0d0f1081ff
commit
b228b7c51b
6 changed files with 306 additions and 2 deletions
|
|
@ -170,8 +170,12 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
|
|||
topItem(_("Planification"), "/planner/index.zul");
|
||||
|
||||
topItem(_("Resources"), "/resources/worker/worker.zul",
|
||||
subItem(
|
||||
_("Workers List"), "/resources/worker/worker.zul#list"));
|
||||
subItem(_("Workers List"),
|
||||
"/resources/worker/worker.zul#list"),
|
||||
subItem(_("Machines List"),
|
||||
"/resources/machine/machines.zul#list"),
|
||||
subItem(_("Manage criterions"),
|
||||
"/resources/criterions/criterions-V2.zul"));
|
||||
|
||||
topItem(_("Work reports"), "/workreports/workReportTypes.zul", subItem(
|
||||
_("Work report types"), "/workreports/workReportTypes.zul"),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.resources.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.resources.entities.Machine;
|
||||
|
||||
/*
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
public interface IMachineModel {
|
||||
|
||||
List<Machine> getMachines();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* 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.resources.machine;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.resources.entities.Machine;
|
||||
import org.navalplanner.web.common.IMessagesForUser;
|
||||
import org.navalplanner.web.common.Level;
|
||||
import org.navalplanner.web.common.MessagesForUser;
|
||||
import org.navalplanner.web.common.OnlyOneVisible;
|
||||
import org.navalplanner.web.common.Util;
|
||||
import org.navalplanner.web.common.entrypoints.IURLHandlerRegistry;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.api.Window;
|
||||
|
||||
/**
|
||||
* Controller for {@link Machine} resource <br />
|
||||
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
public class MachineCRUDController extends GenericForwardComposer {
|
||||
|
||||
private Window listWindow;
|
||||
|
||||
private Window editWindow;
|
||||
|
||||
private IMachineModel machineModel;
|
||||
|
||||
private IURLHandlerRegistry URLHandlerRegistry;
|
||||
|
||||
private OnlyOneVisible visibility;
|
||||
|
||||
private IMessagesForUser messagesForUser;
|
||||
|
||||
private Component messagesContainer;
|
||||
|
||||
public MachineCRUDController() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
comp.setVariable("controller", this, true);
|
||||
messagesForUser = new MessagesForUser(messagesContainer);
|
||||
showListWindow();
|
||||
}
|
||||
|
||||
private void showListWindow() {
|
||||
getVisibility().showOnly(listWindow);
|
||||
}
|
||||
|
||||
private OnlyOneVisible getVisibility() {
|
||||
if (visibility == null) {
|
||||
visibility = new OnlyOneVisible(listWindow, editWindow);
|
||||
}
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void goToCreateForm() {
|
||||
// entity.initCreate();
|
||||
editWindow.setTitle(_("Create machine"));
|
||||
showEditWindow();
|
||||
Util.reloadBindings(editWindow);
|
||||
}
|
||||
|
||||
private void showEditWindow() {
|
||||
getVisibility().showOnly(editWindow);
|
||||
}
|
||||
|
||||
public void goToEditForm(Machine machine) {
|
||||
// model.initEdit(machine);
|
||||
editWindow.setTitle(_("Edit machine"));
|
||||
showEditWindow();
|
||||
Util.reloadBindings(editWindow);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
validate();
|
||||
// model.confirmSave();
|
||||
goToList();
|
||||
messagesForUser.showMessage(Level.INFO, _("Machine saved"));
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
// TODO: Validate
|
||||
}
|
||||
|
||||
private void goToList() {
|
||||
getVisibility().showOnly(listWindow);
|
||||
Util.reloadBindings(listWindow);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
goToList();
|
||||
}
|
||||
|
||||
public List<Machine> getMachines() {
|
||||
return machineModel.getMachines();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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.resources.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.resources.daos.IMachineDAO;
|
||||
import org.navalplanner.business.resources.entities.Machine;
|
||||
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;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
@Service
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class MachineModel implements IMachineModel {
|
||||
|
||||
@Autowired
|
||||
IMachineDAO machineDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<Machine> getMachines() {
|
||||
return machineDAO.getAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<!--
|
||||
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="listWindow" title="${i18n:_('Machines list')}">
|
||||
<grid id="listing" model="@{controller.machines}" mold="paging"
|
||||
pageSize="5" fixedLayout="true">
|
||||
<columns>
|
||||
<column label="${i18n:_('Code')}" sort="auto(code)" />
|
||||
<column label="${i18n:_('Name')}" sort="auto(name)" />
|
||||
<column label="${i18n:_('Description')}" sort="auto(description)" />
|
||||
<column label="${i18n:_('Operations')}" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row self="@{each='machine'}" value="@{machine}">
|
||||
<label value="@{machine.code}" />
|
||||
<label value="@{machine.name}" />
|
||||
<label value="@{machine.description}" />
|
||||
<hbox>
|
||||
<button sclass="icono" image="/common/img/ico_editar1.png"
|
||||
hoverImage="/common/img/ico_editar.png"
|
||||
tooltiptext="${i18n:_('Edit')}"
|
||||
onClick="controller.goToEditForm(self.getParent().getParent().value);">
|
||||
</button>
|
||||
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<button id="show_create_form" onClick="controller.goToCreateForm();"
|
||||
label="${i18n:_('Create')}">
|
||||
</button>
|
||||
</window>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<!--
|
||||
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:_('Resources')}"?>
|
||||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
|
||||
<?page id="Create"?>
|
||||
<?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"?>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
|
||||
<?component name="list" inline="true" macroURI="_listMachines.zul"?>
|
||||
<!--
|
||||
<?component name="edition" inline="true" macroURI="_editMachine.zul"?>
|
||||
-->
|
||||
|
||||
<zk>
|
||||
<window self="@{define(content)}"
|
||||
apply="org.navalplanner.web.resources.machine.MachineCRUDController"
|
||||
sclass="machinewindow">
|
||||
<vbox id="messagesContainer" />
|
||||
<list id="listWindow" />
|
||||
<!--
|
||||
<edition id="editWindow" />
|
||||
-->
|
||||
</window>
|
||||
</zk>
|
||||
Loading…
Add table
Reference in a new issue