use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class LockedView method setDetailsColumnCellFactory.
private void setDetailsColumnCellFactory() {
detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
detailsColumn.setCellFactory(new Callback<TableColumn<LockedListItem, LockedListItem>, TableCell<LockedListItem, LockedListItem>>() {
@Override
public TableCell<LockedListItem, LockedListItem> call(TableColumn<LockedListItem, LockedListItem> column) {
return new TableCell<LockedListItem, LockedListItem>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final LockedListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
Optional<Tradable> tradableOptional = getTradable(item);
AddressEntry addressEntry = item.getAddressEntry();
if (tradableOptional.isPresent()) {
field = new HyperlinkWithIcon(Res.get("funds.locked.locked", addressEntry.getShortOfferId()), AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
setGraphic(field);
} else if (addressEntry.getContext() == AddressEntry.Context.ARBITRATOR) {
setGraphic(new AutoTooltipLabel(Res.get("shared.arbitratorsFee")));
} else {
setGraphic(new AutoTooltipLabel(Res.get("shared.noDetailsAvailable")));
}
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class TransactionsView method setDetailsColumnCellFactory.
private void setDetailsColumnCellFactory() {
detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
detailsColumn.setCellFactory(new Callback<TableColumn<TransactionsListItem, TransactionsListItem>, TableCell<TransactionsListItem, TransactionsListItem>>() {
@Override
public TableCell<TransactionsListItem, TransactionsListItem> call(TableColumn<TransactionsListItem, TransactionsListItem> column) {
return new TableCell<TransactionsListItem, TransactionsListItem>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final TransactionsListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (item.getDetailsAvailable()) {
field = new HyperlinkWithIcon(item.getDetails(), AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
setGraphic(field);
} else {
setGraphic(new AutoTooltipLabel(item.getDetails()));
}
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class TransactionsView method setRevertTxColumnCellFactory.
private void setRevertTxColumnCellFactory() {
revertTxColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
revertTxColumn.setCellFactory(new Callback<TableColumn<TransactionsListItem, TransactionsListItem>, TableCell<TransactionsListItem, TransactionsListItem>>() {
@Override
public TableCell<TransactionsListItem, TransactionsListItem> call(TableColumn<TransactionsListItem, TransactionsListItem> column) {
return new TableCell<TransactionsListItem, TransactionsListItem>() {
Button button;
@Override
public void updateItem(final TransactionsListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
TransactionConfidence confidence = btcWalletService.getConfidenceForTxId(item.getTxId());
if (confidence != null) {
if (confidence.getConfidenceType() == TransactionConfidence.ConfidenceType.PENDING) {
if (button == null) {
button = new AutoTooltipButton(Res.get("funds.tx.revert"));
setGraphic(button);
}
button.setOnAction(e -> revertTransaction(item.getTxId(), item.getTradable()));
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
};
}
});
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class TransactionsView method setTransactionColumnCellFactory.
private void setTransactionColumnCellFactory() {
transactionColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
transactionColumn.setCellFactory(new Callback<TableColumn<TransactionsListItem, TransactionsListItem>, TableCell<TransactionsListItem, TransactionsListItem>>() {
@Override
public TableCell<TransactionsListItem, TransactionsListItem> call(TableColumn<TransactionsListItem, TransactionsListItem> column) {
return new TableCell<TransactionsListItem, TransactionsListItem>() {
private HyperlinkWithIcon hyperlinkWithIcon;
@Override
public void updateItem(final TransactionsListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
String transactionId = item.getTxId();
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> openTxInBlockExplorer(item));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);
if (hyperlinkWithIcon != null)
hyperlinkWithIcon.setOnAction(null);
}
}
};
}
});
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class WithdrawalView method setSelectColumnCellFactory.
private void setSelectColumnCellFactory() {
selectColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
selectColumn.setCellFactory(new Callback<TableColumn<WithdrawalListItem, WithdrawalListItem>, TableCell<WithdrawalListItem, WithdrawalListItem>>() {
@Override
public TableCell<WithdrawalListItem, WithdrawalListItem> call(TableColumn<WithdrawalListItem, WithdrawalListItem> column) {
return new TableCell<WithdrawalListItem, WithdrawalListItem>() {
CheckBox checkBox = new AutoTooltipCheckBox();
@Override
public void updateItem(final WithdrawalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
checkBox.setOnAction(e -> {
item.setSelected(checkBox.isSelected());
selectForWithdrawal(item);
// If all are selected we select useAllInputsRadioButton
if (observableList.size() == selectedItems.size()) {
inputsToggleGroup.selectToggle(useAllInputsRadioButton);
} else {
// We don't want to get deselected all when we activate the useCustomInputsRadioButton
// so we temporarily disable the listener
inputsToggleGroup.selectedToggleProperty().removeListener(inputsToggleGroupListener);
inputsToggleGroup.selectToggle(useCustomInputsRadioButton);
useAllInputs.set(false);
inputsToggleGroup.selectedToggleProperty().addListener(inputsToggleGroupListener);
}
});
setGraphic(checkBox);
checkBox.setSelected(item.isSelected());
} else {
checkBox.setOnAction(null);
setGraphic(null);
}
}
};
}
});
}
Aggregations