src/Controller/AddProductController.java
/**
     * * Executes part search when the ENTER key is typed while the search
     * field is in focus.
     *
     * @param event
     */
Executes part search when the ENTER key is typed while the search
field is in focus.

@param event
Executes part search when the ENTER key is typed while the search field is in focus . @param event
@FXML
    private void searchFieldEnterHandler(KeyEvent event) {
        if (event.getCode() == KeyCode.ENTER) {
            String partSearchString = searchField.getText();
            int searchedPartIndex;
            if (partSearchString.equals("")) {
                System.err.println("Empty search field present. Search cannot be conducted.");
                Alert emptySearch = new Alert(Alert.AlertType.INFORMATION);
                emptySearch.setTitle("ERROR: EMPTY FIELD");
                emptySearch.setHeaderText("Unable to process search");
                emptySearch.setContentText("Search field cannot be blank.");
                emptySearch.showAndWait();
            } else if (Inventory.lookupPart(partSearchString) == -1) {
                System.err.println("Part not found. Search returned no results.");
                Alert partNotFound = new Alert(Alert.AlertType.INFORMATION);
                partNotFound.setTitle("ERROR: PART NOT FOUND");
                partNotFound.setHeaderText("Unable to locate part");
                partNotFound.setContentText("The Part ID or name entered was not found in inventory.");
                partNotFound.showAndWait();
            } else {
                System.out.println("Part search succeeded. Add parts table view updated.");
                searchedPartIndex = Inventory.lookupPart(partSearchString);
                Part searchedPart = Inventory.getAllParts().get(searchedPartIndex);
                ObservableList<Part> searchedPartList = FXCollections.observableArrayList();
                searchedPartList.add(searchedPart);
                addTable.setItems(searchedPartList);
                searchField.setText("");
            }
        }
    }
@ FXML private void searchFieldEnterHandler ( KeyEvent event ) { if ( event . getCode ( ) == KeyCode . ENTER ) { String partSearchString = searchField . getText ( ) ; int searchedPartIndex ; if ( partSearchString . equals ( "" ) ) { System . err . println ( "Empty search field present. Search cannot be conducted." ) ; Alert emptySearch = new Alert ( Alert . AlertType . INFORMATION ) ; emptySearch . setTitle ( "ERROR: EMPTY FIELD" ) ; emptySearch . setHeaderText ( "Unable to process search" ) ; emptySearch . setContentText ( "Search field cannot be blank." ) ; emptySearch . showAndWait ( ) ; } else if ( Inventory . lookupPart ( partSearchString ) == - 1 ) { System . err . println ( "Part not found. Search returned no results." ) ; Alert partNotFound = new Alert ( Alert . AlertType . INFORMATION ) ; partNotFound . setTitle ( "ERROR: PART NOT FOUND" ) ; partNotFound . setHeaderText ( "Unable to locate part" ) ; partNotFound . setContentText ( "The Part ID or name entered was not found in inventory." ) ; partNotFound . showAndWait ( ) ; } else { System . out . println ( "Part search succeeded. Add parts table view updated." ) ; searchedPartIndex = Inventory . lookupPart ( partSearchString ) ; Part searchedPart = Inventory . getAllParts ( ) . get ( searchedPartIndex ) ; ObservableList < Part > searchedPartList = FXCollections . observableArrayList ( ) ; searchedPartList . add ( searchedPart ) ; addTable . setItems ( searchedPartList ) ; searchField . setText ( "" ) ; } } }
* Executes part search when the ENTER key is typed while the search
 field is in focus.
* Executes part search when the ENTER key is typed while the search field is in focus .