public void addNewStationByList() { showDialog = ""; addWaysForm = false; addWayBean.setAddWaysResult(""); addWayBean.setPrice(0.0); addWayBean.setTime(null); if (!stationsForNewRoute.contains(newStation)) { showDialog = "Станция добавлена"; if (stationsForNewRoute.size() > 0) { addWaysForm = checkWay(); } else { stationsForNewRoute.add(newStation); addWaysForm = false; } } else { showDialog = "Станция уже была добавлена"; addWaysForm = false; } }
public String updatePage() { if ("Маршрут успешно добавлен".equals(message)) { addWaysForm = false; stationsForNewRoute = new ArrayList<String>(); showDialog = ""; routeName = ""; addWayBean.setAddWaysResult(""); return "manager_page.xhtml?faces-redirect=true"; } return ""; }
public void addWay() { if (addWayBean.getPrice() == null || addWayBean.getPrice() <= 0 || addWayBean.getTime() == null) { addWayBean.setAddWaysResult("Поля некорректно заполнены"); return; } addWaysForm = false; stationsForNewRoute.add(newStation); addWayBean.setStationA(stationsForNewRoute.get(stationsForNewRoute.size() - 2)); addWayBean.setStationB(stationsForNewRoute.get(stationsForNewRoute.size() - 1)); addWayBean.setAddWaysResult( routeService.addWay( addWayBean.getPrice(), addWayBean.getTime(), addWayBean.getStationA(), addWayBean.getStationB())); }