src/Controller/AddProductController.java
/**
     * * Search Button Handlers searches for Part by ID and Part name. If
     * search field is empty and the button is clicked then an error is thrown.
     * If a part ID or name is not found in inventory then an INFORMATION alert
     * is thrown. If a part ID or name is found then then the part is returned
     * and added to a temporary list that populates the AddTable list view.
     *
     * @param event
     */
Search Button Handlers searches for Part by ID and Part name. If
search field is empty and the button is clicked then an error is thrown.
If a part ID or name is not found in inventory then an INFORMATION alert
is thrown. If a part ID or name is found then then the part is returned
and added to a temporary list that populates the AddTable list view.

@param event
Search Button Handlers searches for Part by ID and Part name . If search field is empty and the button is clicked then an error is thrown . If a part ID or name is not found in inventory then an INFORMATION alert is thrown . If a part ID or name is found then then the part is returned and added to a temporary list that populates the AddTable list view . @param event
@FXML
    private void searchBtnHandler(ActionEvent event) {
        String partSearchString = searchField.getText();
        int searchedPartIndex;
        if (partSearchString.equals("")) {
            System.err.println("Empty search field present. Part search could not be conducted.");
            Alert emptySearchField = new Alert(Alert.AlertType.INFORMATION);
            emptySearchField.setTitle("ERROR: EMPTY FIELD");
            emptySearchField.setHeaderText("Unable to process search");
            emptySearchField.setContentText("Search field cannot be blank.");
            emptySearchField.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 searchBtnHandler ( ActionEvent event ) { String partSearchString = searchField . getText ( ) ; int searchedPartIndex ; if ( partSearchString . equals ( "" ) ) { System . err . println ( "Empty search field present. Part search could not be conducted." ) ; Alert emptySearchField = new Alert ( Alert . AlertType . INFORMATION ) ; emptySearchField . setTitle ( "ERROR: EMPTY FIELD" ) ; emptySearchField . setHeaderText ( "Unable to process search" ) ; emptySearchField . setContentText ( "Search field cannot be blank." ) ; emptySearchField . 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 ( "" ) ; } }
* Search Button Handlers searches for Part by ID and Part name.
* Search Button Handlers searches for Part by ID and Part name .