mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-08 06:32:18 -04:00
fix sorting of trigger price icon with open offer row (#1874)
This commit is contained in:
parent
7fb7504046
commit
45e54b69e8
1 changed files with 19 additions and 23 deletions
|
@ -1010,35 +1010,31 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
|
||||||
@Override
|
@Override
|
||||||
public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
|
public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
Button button;
|
private final Button button = getRegularIconButton(MaterialDesignIcon.SHIELD_HALF_FULL);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OpenOfferListItem item, boolean empty) {
|
protected void updateItem(final OpenOfferListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item == null || empty) {
|
||||||
if (button == null) {
|
|
||||||
button = getRegularIconButton(MaterialDesignIcon.SHIELD_HALF_FULL);
|
|
||||||
boolean triggerPriceSet = item.getOpenOffer().getTriggerPrice() > 0;
|
|
||||||
button.setVisible(triggerPriceSet);
|
|
||||||
|
|
||||||
if (model.dataModel.isTriggered(item.getOpenOffer())) {
|
|
||||||
button.getGraphic().getStyleClass().add("warning");
|
|
||||||
button.setTooltip(new Tooltip(Res.get("openOffer.triggered")));
|
|
||||||
} else {
|
|
||||||
button.getGraphic().getStyleClass().remove("warning");
|
|
||||||
button.setTooltip(new Tooltip(Res.get("openOffer.triggerPrice", model.getTriggerPrice(item))));
|
|
||||||
}
|
|
||||||
setGraphic(button);
|
|
||||||
}
|
|
||||||
button.setOnAction(event -> onEditOpenOffer(item.getOpenOffer()));
|
|
||||||
} else {
|
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
if (button != null) {
|
button.setOnAction(null);
|
||||||
button.setOnAction(null);
|
return;
|
||||||
button = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean triggerPriceSet = item.getOpenOffer().getTriggerPrice() > 0;
|
||||||
|
button.setVisible(triggerPriceSet);
|
||||||
|
|
||||||
|
if (model.dataModel.isTriggered(item.getOpenOffer())) {
|
||||||
|
button.getGraphic().getStyleClass().add("warning");
|
||||||
|
button.setTooltip(new Tooltip(Res.get("openOffer.triggered")));
|
||||||
|
} else {
|
||||||
|
button.getGraphic().getStyleClass().remove("warning");
|
||||||
|
button.setTooltip(new Tooltip(Res.get("openOffer.triggerPrice", model.getTriggerPrice(item))));
|
||||||
|
}
|
||||||
|
|
||||||
|
button.setOnAction(e -> onEditOpenOffer(item.getOpenOffer()));
|
||||||
|
setGraphic(button);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue