Exemplo n.º 1
0
 @FXML
 boolean setLottoSuperStarNumber(String s) {
   if (lotto.setSuperStarNumber(s)) {
     enablePanes();
     return true;
   }
   return false;
 }
Exemplo n.º 2
0
 @FXML
 boolean setLottoStarNumber(Integer i) {
   if (lotto.setStarNumber(i)) {
     enablePanes();
     return true;
   }
   return false;
 }
Exemplo n.º 3
0
  private void enablePanes() {
    if (lotto.numbers.size() == 5
        && lotto.starNumbers.size() == 2
        && lotto.getDate().length() > 0) {

      tab_uploadSingle.setDisable(false);
    } else {
      tab_uploadSingle.setDisable(true);
    }
  }
Exemplo n.º 4
0
  void getFileContent(File file) throws JAXBException, FileNotFoundException {
    JAXBContext jc = JAXBContext.newInstance("ch.bfh.ti.lottery.tickets");
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    File tmpFile = new File("ticPool.xml");

    // UnMashal the XML - File

    Tickets tickets = (Tickets) unmarshaller.unmarshal(file);
    int columnCount = 1;
    for (int i = 0; i < tickets.getTicket().size(); i++) {

      /*
       * every loop is a ticket
       */

      if (tickets.getTicket().get(i) instanceof Ticket) {
        Ticket ticket = (Ticket) tickets.getTicket().get(i);
        int ticketId = ticket.getTicketId();

        String time =
            ticket.getTimeStamp().getDay()
                + "."
                + ticket.getTimeStamp().getMonth()
                + "."
                + ticket.getTimeStamp().getYear();
        if (ticket.getValidity() == 1 && lotto.getDate().equals(time)) { // &&
          SuperStars superStar = ticket.getSuperStars();

          for (int j = 0; j < ticket.getPlays().getPlay().size(); j++) {

            Play play = (Play) ticket.getPlays().getPlay().get(j);
            Numbers numbers = play.getNumbers();
            Stars stars = play.getStars();

            int hasSuperStar = 0;
            int playId = play.getPlayId();
            int tmp = 0;
            int starTmp = 0;

            for (int number : numbers.getNumber()) {
              // System.out.println(number + "-" +
              // lotto.getNumbers());
              if (lotto.getNumbers().contains(number)) {
                tmp++;
                // System.out.println("HIT" + tmp);
              }
            }
            // System.out.println(" Spiel ENDE");

            for (int starNumber : stars.getStar()) {
              if (lotto.getStarNumbers().contains(starNumber)) {
                starTmp++;
              }
            }

            for (SuperStar ele : superStar.getSuperStar()) {
              if (ele.isSelected()) {
                if (lotto.getSuperStar().equals(ele.getValue())) {
                  hasSuperStar = 1;
                }
              }
            }

            grid_ListResults.addColumn(columnCount, new Pane());
            grid_ListResults.add(new Label(ticketId + "-" + playId), 0, columnCount);
            grid_ListResults.add(new Label(tmp + ""), 1, columnCount);
            grid_ListResults.add(new Label(starTmp + ""), 2, columnCount);
            grid_ListResults.add(new Label(hasSuperStar + ""), 3, columnCount);
            columnCount++;
          }
        }
      }
    }
    System.out.println("Fertig");
  }
Exemplo n.º 5
0
 @FXML
 void setSuperStar(ActionEvent event) {
   TextField tmp = (TextField) event.getSource();
   lotto.setSuperStarNumber(tmp.getText());
 }
Exemplo n.º 6
0
 @FXML
 void setLottoDate(ActionEvent event) {
   TextField tmp = (TextField) event.getSource();
   lotto.setDate(tmp.getText());
   enablePanes();
 }