예제 #1
0
 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);
   }
 }
예제 #2
0
 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);
   }
 }
예제 #3
0
  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());
  }