Search in sources :

Example 1 with DateBean

use of com.github.drbookings.ui.beans.DateBean in project drbookings by DrBookings.

the class MainManager method applyFilter.

public synchronized void applyFilter(final String guestNameFilterString) {
    uiData.addAll(filteredDates);
    filteredDates.clear();
    for (final Iterator<DateBean> it = uiData.iterator(); it.hasNext(); ) {
        final DateBean db = it.next();
        for (final RoomBean rb : db.getRooms()) {
            rb.setBookingFilterString(guestNameFilterString);
        }
        if (!StringUtils.isBlank(guestNameFilterString) && db.isEmpty()) {
            filteredDates.add(db);
            it.remove();
        }
    }
    if (logger.isDebugEnabled()) {
        logger.debug("Filtered dates: " + filteredDates.size());
    }
}
Also used : DateBean(com.github.drbookings.ui.beans.DateBean) RoomBean(com.github.drbookings.ui.beans.RoomBean)

Example 2 with DateBean

use of com.github.drbookings.ui.beans.DateBean in project drbookings by DrBookings.

the class MainManager method removeUiDataCleaning.

private void removeUiDataCleaning(final CleaningEntry cleaningEntry) {
    final Room room = cleaningEntry.getRoom();
    final DateBean db = uiDataMap.get(cleaningEntry.getDate());
    if (db == null) {
        if (logger.isWarnEnabled()) {
            logger.warn("No date entry found for " + cleaningEntry);
        }
    } else {
        db.getRoom(room.getName()).setCleaningEntry(null);
    }
}
Also used : DateBean(com.github.drbookings.ui.beans.DateBean)

Example 3 with DateBean

use of com.github.drbookings.ui.beans.DateBean in project drbookings by DrBookings.

the class BinYearMonth method removeFromMap.

private void removeFromMap(final List<? extends DateBean> removed) {
    for (final DateBean db : removed) {
        final YearMonth ym = YearMonth.from(db.getDate());
        final Collection<DateBean> col = yearMonth2DateBeanMap.get(ym);
        if (col != null) {
            col.remove(db);
        }
    }
}
Also used : DateBean(com.github.drbookings.ui.beans.DateBean) YearMonth(java.time.YearMonth)

Example 4 with DateBean

use of com.github.drbookings.ui.beans.DateBean in project drbookings by DrBookings.

the class MainController method getSelectedDate.

private LocalDate getSelectedDate() {
    ObservableList<DateBean> selectedDate = tableView.getSelectionModel().getSelectedItems();
    if (logger.isDebugEnabled()) {
        logger.debug("Selected date: " + selectedDate);
    }
    LocalDate selectedDate2;
    if (selectedDate == null || selectedDate.isEmpty()) {
        selectedDate2 = LocalDate.now();
    } else {
        selectedDate2 = selectedDate.get(0).getDate();
    }
    return selectedDate2;
}
Also used : DateBean(com.github.drbookings.ui.beans.DateBean) LocalDate(java.time.LocalDate)

Example 5 with DateBean

use of com.github.drbookings.ui.beans.DateBean in project drbookings by DrBookings.

the class MainController method deleteSelected.

private void deleteSelected() {
    final ObservableList<TablePosition> selectedItems = tableView.getSelectionModel().getSelectedCells();
    if (logger.isDebugEnabled()) {
        logger.debug("Delete " + selectedItems);
    }
    for (final TablePosition<DateBean, ?> tp : selectedItems) {
        final int c = tp.getColumn();
        final int r = tp.getRow();
        final TableColumn<DateBean, ?> tableColumn = tp.getTableColumn();
        final Object cellData = tableColumn.getCellData(r);
        if (logger.isDebugEnabled()) {
            logger.debug("Delete in column " + c + ", " + cellData);
        }
        if (cellData instanceof DateBean) {
            final DateBean db = (DateBean) cellData;
            if (db.getRooms().isEmpty()) {
            } else {
                final RoomBean rb = db.getRoom("" + c);
                if (rb.isEmpty()) {
                    continue;
                }
                final BookingBean booking = rb.getFilteredBookingEntries().get(0).getElement();
                if (logger.isDebugEnabled()) {
                    logger.debug("Deleting " + booking);
                }
                manager.removeBooking(booking);
            }
        }
    }
}
Also used : DateBean(com.github.drbookings.ui.beans.DateBean) RoomBean(com.github.drbookings.ui.beans.RoomBean) BookingBean(com.github.drbookings.model.data.BookingBean)

Aggregations

DateBean (com.github.drbookings.ui.beans.DateBean)10 LocalDate (java.time.LocalDate)3 RoomBean (com.github.drbookings.ui.beans.RoomBean)2 YearMonth (java.time.YearMonth)2 DateRange (com.github.drbookings.DateRange)1 BookingBean (com.github.drbookings.model.data.BookingBean)1 SettingsManager (com.github.drbookings.model.settings.SettingsManager)1 BookingSelectionManager (com.github.drbookings.ui.selection.BookingSelectionManager)1 URL (java.net.URL)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Optional (java.util.Optional)1 ResourceBundle (java.util.ResourceBundle)1 TreeMap (java.util.TreeMap)1 Callable (java.util.concurrent.Callable)1 Bindings (javafx.beans.binding.Bindings)1 DoubleProperty (javafx.beans.property.DoubleProperty)1 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)1 FXML (javafx.fxml.FXML)1 Initializable (javafx.fxml.Initializable)1