public String move() { try { robot.move(); } catch (PositionOutOfBoundException e) { FacesUtils.addMessage(null, FacesMessage.SEVERITY_ERROR, "move.error"); return null; } return "/index.html?faces-redirect=true"; }
public void checkPosition() { if (robot.getPosition() == null) { try { FacesContext.getCurrentInstance().getExternalContext().redirect("place.html"); } catch (IOException e) { FacesUtils.addMessage(null, FacesMessage.SEVERITY_ERROR, "exception.IOException"); } } }
public String place() { try { robot.place(new Position(x, y), facing); } catch (PositionOutOfBoundException e) { FacesUtils.addMessage(null, FacesMessage.SEVERITY_ERROR, "place.invalid"); return null; } return "/index.html?faces-redirect=true"; }