Beispiel #1
0
 private void addItemButtonActionPerformed(java.awt.event.ActionEvent evt) {
   // call the controller
   ShoppingListController erc = new ShoppingListController();
   error = erc.createItem(itemNameTextField.getText());
   // update visuals
   refreshData();
 }
Beispiel #2
0
 private void addToShoppingListButtonActionPerformed(java.awt.event.ActionEvent evt) {
   error = "";
   if (selectedItem < 1) error = error + "Item needs to be selected for registration! ";
   if (selectedStoreVisit < 1)
     error = error + "Store Visit needs to be selected for registration!";
   error = error.trim();
   if (error.length() == 0) {
     // call the controller
     ShoppingListController erc = new ShoppingListController();
     error = erc.addToShoppingList(items.get(selectedItem), storeVisits.get(selectedStoreVisit));
   }
   // update visuals
   refreshData();
 }
Beispiel #3
0
 private void addStoreVisitButtonActionPerformed(java.awt.event.ActionEvent evt) {
   // call the controller
   ShoppingListController erc = new ShoppingListController();
   Calendar calendar = Calendar.getInstance();
   calendar.setTime((Date) storeVisitStartTimeSpinner.getValue());
   Time startTime = new Time(calendar.getTime().getTime());
   calendar.setTime((Date) storeVisitEndTimeSpinner.getValue());
   Time endTime = new Time(calendar.getTime().getTime());
   error =
       erc.createStoreVisit(
           storeVisitNameTextField.getText(),
           (java.sql.Date) storeVisitDatePicker.getModel().getValue(),
           startTime,
           endTime);
   // update visuals
   refreshData();
 }