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 updateCategory() { if (txtUpdName.getValue().trim().equals(selectedCategory.getCategoryName()) && txtUpdDesc.getValue().trim().equals(selectedCategory.getCategoryDesc())) { Notification.show( "No change", "No changes had been made to the selected category", Notification.Type.WARNING_MESSAGE); } else if (txtUpdName.getValue().trim().equals("")) { Notification.show( "No change", "Category name cannot be empty", Notification.Type.WARNING_MESSAGE); } else { String catUpdName = txtUpdName.getValue().trim(); String catUpdDesc = txtUpdDesc.getValue().trim(); categoryTree.updateItem(catUpdName, catUpdDesc, selectedCategory); resetFields(); Notification.show("Info", "The category is now updated", Notification.Type.HUMANIZED_MESSAGE); } }