use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class WithdrawalView method initialize.
@Override
public void initialize() {
inputsLabel.setText(Res.getWithCol("funds.withdrawal.inputs"));
useAllInputsRadioButton.setText(Res.get("funds.withdrawal.useAllInputs"));
useCustomInputsRadioButton.setText(Res.get("funds.withdrawal.useCustomInputs"));
amountLabel.setText(Res.getWithCol("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()));
feeExcludedRadioButton.setText(Res.get("funds.withdrawal.feeExcluded"));
feeIncludedRadioButton.setText(Res.get("funds.withdrawal.feeIncluded"));
fromLabel.setText(Res.get("funds.withdrawal.fromLabel", Res.getBaseCurrencyCode()));
toLabel.setText(Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode()));
withdrawButton.setText(Res.get("funds.withdrawal.withdrawButton"));
addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
selectColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.select")));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.withdrawal.noFundsAvailable")));
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
setAddressColumnCellFactory();
setBalanceColumnCellFactory();
setSelectColumnCellFactory();
addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
balanceColumn.setComparator((o1, o2) -> o1.getBalance().compareTo(o2.getBalance()));
balanceColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getSortOrder().add(balanceColumn);
balanceListener = new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance, Transaction tx) {
updateList();
}
};
amountListener = (observable, oldValue, newValue) -> {
if (amountTextField.focusedProperty().get()) {
try {
amountAsCoin = formatter.parseToCoin(amountTextField.getText());
} catch (Throwable t) {
log.error("Error at amountTextField input. " + t.toString());
}
}
};
amountFocusListener = (observable, oldValue, newValue) -> {
if (oldValue && !newValue) {
if (amountAsCoin.isPositive())
amountTextField.setText(formatter.formatCoin(amountAsCoin));
else
amountTextField.setText("");
}
};
feeToggleGroup = new ToggleGroup();
feeExcludedRadioButton.setToggleGroup(feeToggleGroup);
feeIncludedRadioButton.setToggleGroup(feeToggleGroup);
feeToggleGroupListener = (observable, oldValue, newValue) -> {
feeExcluded = newValue == feeExcludedRadioButton;
amountLabel.setText(feeExcluded ? Res.getWithCol("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()) : Res.getWithCol("funds.withdrawal.senderAmount", Res.getBaseCurrencyCode()));
};
inputsToggleGroup = new ToggleGroup();
useAllInputsRadioButton.setToggleGroup(inputsToggleGroup);
useCustomInputsRadioButton.setToggleGroup(inputsToggleGroup);
inputsToggleGroupListener = (observable, oldValue, newValue) -> {
useAllInputs.set(newValue == useAllInputsRadioButton);
updateInputSelection();
};
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class BsqTxView method addInformationColumn.
private void addInformationColumn() {
TableColumn<BsqTxListItem, BsqTxListItem> column = new AutoTooltipTableColumn<>(Res.get("shared.information"));
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(160);
column.setCellFactory(new Callback<TableColumn<BsqTxListItem, BsqTxListItem>, TableCell<BsqTxListItem, BsqTxListItem>>() {
@Override
public TableCell<BsqTxListItem, BsqTxListItem> call(TableColumn<BsqTxListItem, BsqTxListItem> column) {
return new TableCell<BsqTxListItem, BsqTxListItem>() {
private AddressWithIconAndDirection field;
@Override
public void updateItem(final BsqTxListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
TxType txType = item.getTxType();
String labelString = Res.get("dao.tx.type.enum." + txType.name());
Label label;
if (item.getConfirmations() > 0 && txType.ordinal() > TxType.INVALID.ordinal()) {
if (item.isBurnedBsqTx() || item.getAmount().isZero()) {
if (field != null)
field.setOnAction(null);
if (txType == TxType.TRANSFER_BSQ) {
if (item.getAmount().isZero())
labelString = Res.get("funds.tx.direction.self");
}
label = new AutoTooltipLabel(labelString);
setGraphic(label);
} else {
// Received
String addressString = item.getAddress();
field = new AddressWithIconAndDirection(item.getDirection(), addressString, AwesomeIcon.EXTERNAL_LINK, item.isReceived());
field.setOnAction(event -> openAddressInBlockExplorer(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", addressString)));
setGraphic(field);
}
} else {
label = new AutoTooltipLabel(labelString);
setGraphic(label);
}
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
tableView.getColumns().add(column);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class ReservedView method setDetailsColumnCellFactory.
private void setDetailsColumnCellFactory() {
detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
detailsColumn.setCellFactory(new Callback<TableColumn<ReservedListItem, ReservedListItem>, TableCell<ReservedListItem, ReservedListItem>>() {
@Override
public TableCell<ReservedListItem, ReservedListItem> call(TableColumn<ReservedListItem, ReservedListItem> column) {
return new TableCell<ReservedListItem, ReservedListItem>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final ReservedListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
Optional<Tradable> tradableOptional = getTradable(item);
if (tradableOptional.isPresent()) {
field = new HyperlinkWithIcon(Res.get("funds.reserved.reserved", item.getAddressEntry().getShortOfferId()), AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
setGraphic(field);
} else if (item.getAddressEntry().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 bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class ReservedView method initialize.
@Override
public void initialize() {
dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details")));
addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.reserved.noFunds")));
setDateColumnCellFactory();
setDetailsColumnCellFactory();
setAddressColumnCellFactory();
setBalanceColumnCellFactory();
addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
detailsColumn.setComparator((o1, o2) -> o1.getOpenOffer().getId().compareTo(o2.getOpenOffer().getId()));
balanceColumn.setComparator((o1, o2) -> o1.getBalance().compareTo(o2.getBalance()));
dateColumn.setComparator((o1, o2) -> {
if (getTradable(o1).isPresent() && getTradable(o2).isPresent())
return getTradable(o2).get().getDate().compareTo(getTradable(o1).get().getDate());
else
return 0;
});
tableView.getSortOrder().add(dateColumn);
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
balanceListener = new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance, Transaction tx) {
updateList();
}
};
openOfferListChangeListener = c -> updateList();
tradeListChangeListener = c -> updateList();
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class AwesomeFontDemo method start.
@Override
public void start(Stage primaryStage) {
Pane root = new FlowPane();
List<AwesomeIcon> values = new ArrayList<>(Arrays.asList(AwesomeIcon.values()));
values.sort((o1, o2) -> o1.name().compareTo(o2.name()));
for (AwesomeIcon icon : values) {
Label label = new AutoTooltipLabel();
Button button = new AutoTooltipButton(icon.name(), label);
AwesomeDude.setIcon(label, icon);
root.getChildren().add(button);
}
primaryStage.setScene(new Scene(root, 900, 850));
primaryStage.show();
}
Aggregations