コード例 #1
0
 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";
 }
コード例 #2
0
 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");
     }
   }
 }
コード例 #3
0
 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";
 }