ItEr25S12AltaTipoDeEtiquetas: Added editLabelType form
This commit is contained in:
parent
59d5fa9c75
commit
3a79797d5b
5 changed files with 70 additions and 8 deletions
|
|
@ -10,6 +10,19 @@ import org.navalplanner.business.labels.entities.LabelType;
|
|||
*/
|
||||
public interface ILabelTypeModel {
|
||||
|
||||
/**
|
||||
* Removes {@link LabelType}
|
||||
*
|
||||
* @param labelType
|
||||
*/
|
||||
void confirmDelete(LabelType labelType);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LabelType getLabelType();
|
||||
|
||||
/**
|
||||
* Returns all {@link LabelType}
|
||||
*
|
||||
|
|
@ -18,10 +31,8 @@ public interface ILabelTypeModel {
|
|||
List<LabelType> getLabelTypes();
|
||||
|
||||
/**
|
||||
* Removes {@link LabelType}
|
||||
*
|
||||
* @param labelType
|
||||
*/
|
||||
void confirmDelete(LabelType labelType);
|
||||
void prepareForCreate();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import static org.navalplanner.web.I18nHelper._;
|
|||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.labels.entities.LabelType;
|
||||
import org.navalplanner.web.common.OnlyOneVisible;
|
||||
import org.navalplanner.web.common.Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -21,13 +22,17 @@ import org.zkoss.zul.Window;
|
|||
*/
|
||||
public class LabelTypeCRUDController extends GenericForwardComposer {
|
||||
|
||||
Window listWindow;
|
||||
|
||||
Grid labelTypes;
|
||||
|
||||
@Autowired
|
||||
ILabelTypeModel labelTypeModel;
|
||||
|
||||
private Window listWindow;
|
||||
|
||||
private Window editWindow;
|
||||
|
||||
private Grid labelTypes;
|
||||
|
||||
private OnlyOneVisible visibility;
|
||||
|
||||
public LabelTypeCRUDController() {
|
||||
|
||||
}
|
||||
|
|
@ -36,6 +41,14 @@ public class LabelTypeCRUDController extends GenericForwardComposer {
|
|||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
comp.setVariable("controller", this, true);
|
||||
getVisibility().showOnly(listWindow);
|
||||
}
|
||||
|
||||
public OnlyOneVisible getVisibility() {
|
||||
if (visibility == null) {
|
||||
visibility = new OnlyOneVisible(listWindow, editWindow);
|
||||
}
|
||||
return visibility;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
@ -43,6 +56,10 @@ public class LabelTypeCRUDController extends GenericForwardComposer {
|
|||
return labelTypeModel.getLabelTypes();
|
||||
}
|
||||
|
||||
public LabelType getLabelType() {
|
||||
return labelTypeModel.getLabelType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop up confirm remove dialog
|
||||
*
|
||||
|
|
@ -60,4 +77,12 @@ public class LabelTypeCRUDController extends GenericForwardComposer {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void goToCreateForm() {
|
||||
labelTypeModel.prepareForCreate();
|
||||
editWindow.setTitle(_("Create label type"));
|
||||
getVisibility().showOnly(editWindow);
|
||||
Util.reloadBindings(editWindow);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
public class LabelTypeModel implements ILabelTypeModel {
|
||||
|
||||
@Autowired
|
||||
ILabelTypeDAO labelTypeDAO;
|
||||
private ILabelTypeDAO labelTypeDAO;
|
||||
|
||||
private LabelType labelType;
|
||||
|
||||
public LabelTypeModel() {
|
||||
|
||||
|
|
@ -41,4 +43,14 @@ public class LabelTypeModel implements ILabelTypeModel {
|
|||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareForCreate() {
|
||||
labelType = LabelType.create("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelType getLabelType() {
|
||||
return labelType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
<window id="${arg.id}" title="${arg.title}" border="normal">
|
||||
<vbox>
|
||||
<hbox>
|
||||
<label value="${i18n:_('Name')}"/>
|
||||
<textbox value="@{controller.labelType.name}"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<button label="${i18n:_('Save')}"/>
|
||||
<button label="${i18n:_('Cancel')}"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
|
@ -8,10 +8,12 @@
|
|||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
|
||||
<?component name="list" inline="true" macroURI="_listLabelTypes.zul"?>
|
||||
<?component name="edit" inline="true" macroURI="_editLabelType.zul"?>
|
||||
|
||||
<zk>
|
||||
<window self="@{define(content)}"
|
||||
apply="org.navalplanner.web.labels.LabelTypeCRUDController">
|
||||
<list id="listWindow"/>
|
||||
<edit id="editWindow"/>
|
||||
</window>
|
||||
</zk>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue