public void populateCategoryCRUDFields() { txtParent.setValue(selectedCategory.getCategoryName()); txtUpdName.setValue(selectedCategory.getCategoryName()); txtUpdDesc.setValue(selectedCategory.getCategoryDesc()); txtUpdCreDate.setValue(selectedCategory.getCategoryCreateDate().toString()); txtUpdCreator.setValue(selectedCategory.getCategoryCreator()); txtUpdParent.setValue(selectedCategory.getCategoryParent()); txtUpdModDate.setValue(selectedCategory.getCategoryModifiedDate().toString()); txtDelName.setValue(selectedCategory.getCategoryName()); txtDelDesc.setValue(selectedCategory.getCategoryDesc()); txtDelCreDate.setValue(selectedCategory.getCategoryCreateDate().toString()); txtDelCreator.setValue(selectedCategory.getCategoryCreator()); txtDelParent.setValue(selectedCategory.getCategoryParent()); txtDelModDate.setValue(selectedCategory.getCategoryModifiedDate().toString()); }
public void deleteCategory() { if (selectedCategory == null) { Notification.show( "Error", "Please select a category from the tree to be deleted", Notification.Type.ERROR_MESSAGE); } else if (selectedCategory.getCategoryParent() == null) { Notification.show( "Error", "Root category cannot be deleted", Notification.Type.ERROR_MESSAGE); } else { categoryTree.deleteItem(selectedCategory); resetFields(); Notification.show("Info", "The category is now deleted", Notification.Type.HUMANIZED_MESSAGE); } }