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());
}
}
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);
}
}
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);
}
}
}
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;
}
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);
}
}
}
}
Aggregations