ItEr37S11CUAdministracionMateriaisItEr36S13: Show warning message on adding a new material in general view (user should select a category)

This commit is contained in:
Diego Pino Garcia 2009-12-03 11:50:08 +01:00 committed by Javier Moran Rua
parent 90d8106836
commit f02672fa60
2 changed files with 5 additions and 2 deletions

View file

@ -80,6 +80,8 @@ public class MaterialsController extends
private Textbox txtCategory;
private Button btnAddMaterial;
private IMessagesForUser messagesForUser;
private Component messagesContainer;
@ -268,7 +270,7 @@ public class MaterialsController extends
public void addMaterialToMaterialCategory(Treeitem treeitem) {
if (treeitem == null) {
return;
throw new WrongValueException(btnAddMaterial, _("Cannot insert material in general view. Please, select a category"));
}
final MaterialCategory materialCategory = (MaterialCategory) treeitem.getValue();
materialsModel.addMaterialToMaterialCategory(materialCategory);

View file

@ -72,7 +72,8 @@
<panel title="${i18n:_('Materials')}"
border="normal">
<panelchildren>
<button label="${i18n:_('Add')}"
<button id="btnAddMaterial"
label="${i18n:_('Add')}"
onClick="materialsController.addMaterialToMaterialCategory(categoriesTree.selectedItem)" />
<separator spacing="15px" orient="horizontal" />
<newdatasortablegrid id="gridMaterials"