Esempio n. 1
0
  private int getSeatState(Seat seat) {
    if (seat == null || seat.getSalesOrders() == null || seat.getSalesOrders().size() != 1)
      return 0;

    SalesOrder so = seat.getSalesOrders().get(0);
    if (so.getDate() == null) return 0;

    long millis = new Date().getTime() - so.getDate().getTime();
    long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);

    if (minutes < 30) return 1;
    else if (minutes < 60) return 2;
    else if (minutes < 90) return 3;
    else return 4;
  }
Esempio n. 2
0
  @Override
  protected void updateItem(Seat currentItem, Seat newItem) {
    if (newItem == null) {
      unsetLabel(lblSeatTag);
    } else {
      setLabel(lblSeatTag, newItem.tagProperty());

      Platform.runLater(
          () -> {
            getView().setId("seatView" + getSeatState(getItem()));
            lblSeatTag.setId("seatTag" + getSeatState(getItem()));
          });
    }
  }