use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class LockedView 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.locked.noFunds")));
setDateColumnCellFactory();
setDetailsColumnCellFactory();
setAddressColumnCellFactory();
setBalanceColumnCellFactory();
addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
detailsColumn.setComparator((o1, o2) -> o1.getTrade().getId().compareTo(o2.getTrade().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 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 bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class OfferBookChartView method initialize.
@Override
public void initialize() {
changeListener = c -> updateChartData();
currencyListItemsListener = c -> {
if (model.getSelectedCurrencyListItem().isPresent())
currencyComboBox.getSelectionModel().select(model.getSelectedCurrencyListItem().get());
};
currencyComboBox = new ComboBox<>();
currencyComboBox.setPromptText(Res.get("list.currency.select"));
currencyComboBox.setConverter(GUIUtil.getCurrencyListItemConverter(Res.get("shared.oneOffer"), Res.get("shared.multipleOffers"), model.preferences));
Label currencyLabel = new AutoTooltipLabel(Res.getWithCol("shared.currency"));
HBox currencyHBox = new HBox();
currencyHBox.setSpacing(5);
currencyHBox.setPadding(new Insets(5, -20, -5, 20));
currencyHBox.setAlignment(Pos.CENTER_LEFT);
currencyHBox.getChildren().addAll(currencyLabel, currencyComboBox);
createChart();
Tuple4<TableView<OfferListItem>, VBox, Button, Label> tupleBuy = getOfferTable(OfferPayload.Direction.BUY);
Tuple4<TableView<OfferListItem>, VBox, Button, Label> tupleSell = getOfferTable(OfferPayload.Direction.SELL);
buyOfferTableView = tupleBuy.first;
sellOfferTableView = tupleSell.first;
leftButton = tupleBuy.third;
rightButton = tupleSell.third;
leftHeaderLabel = tupleBuy.forth;
rightHeaderLabel = tupleSell.forth;
bottomHBox = new HBox();
// 30
bottomHBox.setSpacing(20);
bottomHBox.setAlignment(Pos.CENTER);
HBox.setHgrow(tupleBuy.second, Priority.ALWAYS);
HBox.setHgrow(tupleSell.second, Priority.ALWAYS);
tupleBuy.second.setUserData(OfferPayload.Direction.BUY.name());
tupleSell.second.setUserData(OfferPayload.Direction.SELL.name());
bottomHBox.getChildren().addAll(tupleBuy.second, tupleSell.second);
root.getChildren().addAll(currencyHBox, areaChart, bottomHBox);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class SpreadView method initialize.
@Override
public void initialize() {
tableView = new TableView<>();
GridPane.setRowIndex(tableView, gridRow);
GridPane.setMargin(tableView, new Insets(-10, -15, -10, -15));
GridPane.setVgrow(tableView, Priority.ALWAYS);
GridPane.setHgrow(tableView, Priority.ALWAYS);
root.getChildren().add(tableView);
Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noData"));
placeholder.setWrapText(true);
tableView.setPlaceholder(placeholder);
TableColumn<SpreadItem, SpreadItem> currencyColumn = getCurrencyColumn();
tableView.getColumns().add(currencyColumn);
numberOfOffersColumn = getNumberOfOffersColumn();
tableView.getColumns().add(numberOfOffersColumn);
numberOfBuyOffersColumn = getNumberOfBuyOffersColumn();
tableView.getColumns().add(numberOfBuyOffersColumn);
numberOfSellOffersColumn = getNumberOfSellOffersColumn();
tableView.getColumns().add(numberOfSellOffersColumn);
totalAmountColumn = getTotalAmountColumn();
tableView.getColumns().add(totalAmountColumn);
TableColumn<SpreadItem, SpreadItem> spreadColumn = getSpreadColumn();
tableView.getColumns().add(spreadColumn);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
currencyColumn.setComparator((o1, o2) -> CurrencyUtil.getNameByCode(o1.currencyCode).compareTo(CurrencyUtil.getNameByCode(o2.currencyCode)));
numberOfOffersColumn.setComparator((o1, o2) -> Integer.valueOf(o1.numberOfOffers).compareTo(o2.numberOfOffers));
numberOfBuyOffersColumn.setComparator((o1, o2) -> Integer.valueOf(o1.numberOfBuyOffers).compareTo(o2.numberOfBuyOffers));
numberOfSellOffersColumn.setComparator((o1, o2) -> Integer.valueOf(o1.numberOfSellOffers).compareTo(o2.numberOfSellOffers));
totalAmountColumn.setComparator((o1, o2) -> o1.totalAmount.compareTo(o2.totalAmount));
spreadColumn.setComparator((o1, o2) -> {
Long spreadO1 = o1.priceSpread != null ? o1.priceSpread.getValue() : 0;
Long spreadO2 = o2.priceSpread != null ? o2.priceSpread.getValue() : 0;
return spreadO1.compareTo(spreadO2);
});
numberOfOffersColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getSortOrder().add(numberOfOffersColumn);
itemListChangeListener = c -> updateHeaders();
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class SpreadView method updateHeaders.
private void updateHeaders() {
int numberOfOffers = sortedList.stream().mapToInt(item -> item.numberOfOffers).sum();
int numberOfBuyOffers = sortedList.stream().mapToInt(item -> item.numberOfBuyOffers).sum();
int numberOfSellOffers = sortedList.stream().mapToInt(item -> item.numberOfSellOffers).sum();
String total = formatter.formatCoin(Coin.valueOf(sortedList.stream().mapToLong(item -> item.totalAmount.value).sum()));
numberOfOffersColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.numberOfOffersColumn", numberOfOffers)));
numberOfBuyOffersColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.numberOfBuyOffersColumn", numberOfBuyOffers)));
numberOfSellOffersColumn.setGraphic(new AutoTooltipLabel((Res.get("market.spread.numberOfSellOffersColumn", numberOfSellOffers))));
totalAmountColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.totalAmountColumn", total)));
}
Aggregations