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;
  }
  @Override
  protected void updateItem(SalesOrder currentItem, SalesOrder newItem) {

    if (newItem == null) {
      unsetListView(lvChargeEntries);
      unsetListView(lvPaymentEntries);
      unsetLabel(tfAmountDue);
      disableKeypad();

    } else {
      setListView(lvChargeEntries, newItem.chargeEntriesProperty());
      setListView(lvPaymentEntries, newItem.paymentEntriesProperty());
      setLabel(tfAmountDue, Bindings.concat("Payment Due : ", newItem.dueProperty().asString()));

      if (newItem.hasStatus(SalesOrderStatus.CLOSED) || newItem.hasStatus(SalesOrderStatus.VOID))
        voidText.setText("Reopen");
      else voidText.setText("Void");

      enableKeypad();
    }
  }