/** * Retrieves list of Direction stops from Model and passes over to the View updateStops method * * @throws ServiceUnavailableException */ private void updateDirectionStopsTable(Direction direction) throws ServiceUnavailableException { String[][] stopList = mainModel.getRouteStopsArray( FindStopsHelper.identifyStopsForDirection(direction, mainModel.getAllStopsList())); mainView.enableRefresh(stopsExist(stopList.length)); mainView.updateStopsTable(stopList); }
/** * Method called when the user inputs an address on the user interface and they want to see the * closes bus stops. * * @param address the user entered address */ public void searchPressedAction(String address) { mainView.enableRefresh(false); this.lastAddress = address; try { if (address != null && address.length() > 0) { // Get closest stops to address ArrayList<RouteStopGeoPositionDTO> closestStops = mainModel.getStopsForDisplay(address); // Get stops with next bus times added ArrayList<Stop> stopsList = mainModel.addNextBusTimes(closestStops); // Clear out Route and Stop Information resetAll(); // Update Stops Table with Closest Stops String[][] closestStopsArray = StopsToArray.convert(closestStops); mainView.enableRefresh(stopsExist(closestStopsArray.length)); mainView.updateStopsTable(closestStopsArray); // Draw Closest Stops on Map drawClosestMapStops(stopsList, address); // Update Status mainView.updateStatus(MainView.DEFAULT_STATUS); } } catch (ServiceUnavailableException e) { mainView.notifyAndExit(MainView.NEXTBUS_SERVICE_UNAVAILABLE); } catch (InvalidAddressException e) { mainView.updateStatus(MainView.INVALID_ADDRESS); } }
/** * Retrieves list of Route stops from Model and passes over to the View updateStops method * * @throws ServiceUnavailableException */ private void updateRouteStopsTable(ArrayList<Stop> stopList) throws ServiceUnavailableException { mainView.updateStopsTable(mainModel.getRouteStopsArray(stopList)); }