|
|
@@ -562,6 +562,7 @@ public class MainController {
|
|
|
// ── Seller ──
|
|
|
|
|
|
private void setupMyBookTable() {
|
|
|
+ myBookTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
|
|
myBookIdCol.setCellValueFactory(new PropertyValueFactory<>("bookId"));
|
|
|
myBookTitleCol.setCellValueFactory(new PropertyValueFactory<>("title"));
|
|
|
myBookPriceCol.setCellValueFactory(new PropertyValueFactory<>("sellingPrice"));
|
|
|
@@ -570,9 +571,14 @@ public class MainController {
|
|
|
@Override
|
|
|
protected void updateItem(Void item, boolean empty) {
|
|
|
super.updateItem(item, empty);
|
|
|
+ if (empty || getIndex() < 0 || getIndex() >= getTableView().getItems().size()) {
|
|
|
+ setText(null);
|
|
|
+ setGraphic(null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
Book book = getTableView().getItems().get(getIndex());
|
|
|
Integer status = book != null ? book.getStatus() : null;
|
|
|
- if (empty || status == null) {
|
|
|
+ if (status == null) {
|
|
|
setText(null);
|
|
|
setGraphic(null);
|
|
|
} else {
|
|
|
@@ -621,7 +627,7 @@ public class MainController {
|
|
|
@Override
|
|
|
protected void updateItem(Void item, boolean empty) {
|
|
|
super.updateItem(item, empty);
|
|
|
- if (empty) {
|
|
|
+ if (empty || getIndex() < 0 || getIndex() >= getTableView().getItems().size()) {
|
|
|
setGraphic(null);
|
|
|
} else {
|
|
|
Book b = getTableView().getItems().get(getIndex());
|