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 move() { try { robot.move(); } catch (PositionOutOfBoundException e) { FacesUtils.addMessage(null, FacesMessage.SEVERITY_ERROR, "move.error"); return null; } return "/index.html?faces-redirect=true"; }
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"; }
public String right() { robot.rotateRight(); return "/index.html?faces-redirect=true"; }
public String left() { robot.rotateLeft(); return "/index.html?faces-redirect=true"; }