use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class BaseProposalView method createProposalsTableView.
protected void createProposalsTableView(String header, double top) {
TableGroupHeadline proposalsHeadline = new TableGroupHeadline(header);
GridPane.setRowIndex(proposalsHeadline, ++gridRow);
GridPane.setMargin(proposalsHeadline, new Insets(top, -10, -10, -10));
GridPane.setColumnSpan(proposalsHeadline, 2);
root.getChildren().add(proposalsHeadline);
proposalTableView = new TableView<>();
proposalTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
proposalTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
createProposalColumns(proposalTableView);
GridPane.setRowIndex(proposalTableView, gridRow);
GridPane.setMargin(proposalTableView, new Insets(top + 20, -10, 5, -10));
GridPane.setColumnSpan(proposalTableView, 2);
GridPane.setHgrow(proposalTableView, Priority.ALWAYS);
root.getChildren().add(proposalTableView);
proposalTableView.setItems(sortedList);
proposalViewItems.add(proposalsHeadline);
proposalViewItems.add(proposalTableView);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class TraderDisputeView method initialize.
@Override
public void initialize() {
Label label = new AutoTooltipLabel(Res.get("support.filter"));
HBox.setMargin(label, new Insets(5, 0, 0, 0));
filterTextField = new InputTextField();
filterTextField.setText("open");
filterTextFieldListener = (observable, oldValue, newValue) -> applyFilteredListPredicate(filterTextField.getText());
filterBox = new HBox();
filterBox.setSpacing(5);
filterBox.getChildren().addAll(label, filterTextField);
VBox.setVgrow(filterBox, Priority.NEVER);
filterBox.setVisible(false);
filterBox.setManaged(false);
tableView = new TableView<>();
VBox.setVgrow(tableView, Priority.SOMETIMES);
tableView.setMinHeight(150);
root.getChildren().addAll(filterBox, tableView);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
Label placeholder = new AutoTooltipLabel(Res.get("support.noTickets"));
placeholder.setWrapText(true);
tableView.setPlaceholder(placeholder);
tableView.getSelectionModel().clearSelection();
tableView.getColumns().add(getSelectColumn());
TableColumn<Dispute, Dispute> contractColumn = getContractColumn();
tableView.getColumns().add(contractColumn);
TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
tableView.getColumns().add(dateColumn);
TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn();
tableView.getColumns().add(tradeIdColumn);
TableColumn<Dispute, Dispute> buyerOnionAddressColumn = getBuyerOnionAddressColumn();
tableView.getColumns().add(buyerOnionAddressColumn);
TableColumn<Dispute, Dispute> sellerOnionAddressColumn = getSellerOnionAddressColumn();
tableView.getColumns().add(sellerOnionAddressColumn);
TableColumn<Dispute, Dispute> marketColumn = getMarketColumn();
tableView.getColumns().add(marketColumn);
TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
tableView.getColumns().add(roleColumn);
TableColumn<Dispute, Dispute> stateColumn = getStateColumn();
tableView.getColumns().add(stateColumn);
tradeIdColumn.setComparator((o1, o2) -> o1.getTradeId().compareTo(o2.getTradeId()));
dateColumn.setComparator((o1, o2) -> o1.getOpeningDate().compareTo(o2.getOpeningDate()));
buyerOnionAddressColumn.setComparator((o1, o2) -> getBuyerOnionAddressColumnLabel(o1).compareTo(getBuyerOnionAddressColumnLabel(o2)));
sellerOnionAddressColumn.setComparator((o1, o2) -> getSellerOnionAddressColumnLabel(o1).compareTo(getSellerOnionAddressColumnLabel(o2)));
marketColumn.setComparator((o1, o2) -> formatter.getCurrencyPair(o1.getContract().getOfferPayload().getCurrencyCode()).compareTo(o2.getContract().getOfferPayload().getCurrencyCode()));
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getSortOrder().add(dateColumn);
/*inputTextAreaListener = (observable, oldValue, newValue) ->
sendButton.setDisable(newValue.length() == 0
&& tempAttachments.size() == 0 &&
selectedDispute.disputeResultProperty().get() == null);*/
selectedDisputeClosedPropertyListener = (observable, oldValue, newValue) -> {
messagesInputBox.setVisible(!newValue);
messagesInputBox.setManaged(!newValue);
AnchorPane.setBottomAnchor(messageListView, newValue ? 0d : 120d);
};
disputeDirectMessageListListener = c -> scrollToBottom();
keyEventEventHandler = event -> {
if (Utilities.isAltOrCtrlPressed(KeyCode.L, event)) {
Map<String, List<Dispute>> map = new HashMap<>();
disputeManager.getDisputesAsObservableList().stream().forEach(dispute -> {
String tradeId = dispute.getTradeId();
List<Dispute> list;
if (!map.containsKey(tradeId))
map.put(tradeId, new ArrayList<>());
list = map.get(tradeId);
list.add(dispute);
});
List<List<Dispute>> disputeGroups = new ArrayList<>();
map.entrySet().stream().forEach(entry -> disputeGroups.add(entry.getValue()));
disputeGroups.sort((o1, o2) -> !o1.isEmpty() && !o2.isEmpty() ? o1.get(0).getOpeningDate().compareTo(o2.get(0).getOpeningDate()) : 0);
StringBuilder stringBuilder = new StringBuilder();
// We don't translate that as it is not intended for the public
stringBuilder.append("Summary of all disputes (No. of disputes: ").append(disputeGroups.size()).append(")\n\n");
disputeGroups.stream().forEach(disputeGroup -> {
Dispute dispute0 = disputeGroup.get(0);
stringBuilder.append("##########################################################################################/\n").append("## Trade ID: ").append(dispute0.getTradeId()).append("\n").append("## Date: ").append(formatter.formatDateTime(dispute0.getOpeningDate())).append("\n").append("## Is support ticket: ").append(dispute0.isSupportTicket()).append("\n");
if (dispute0.disputeResultProperty().get() != null && dispute0.disputeResultProperty().get().getReason() != null) {
stringBuilder.append("## Reason: ").append(dispute0.disputeResultProperty().get().getReason()).append("\n");
}
stringBuilder.append("##########################################################################################/\n").append("\n");
disputeGroup.stream().forEach(dispute -> {
stringBuilder.append("*******************************************************************************************\n").append("** Trader's ID: ").append(dispute.getTraderId()).append("\n*******************************************************************************************\n").append("\n");
dispute.getDisputeCommunicationMessages().stream().forEach(m -> {
String role = m.isSenderIsTrader() ? ">> Trader's msg: " : "<< Arbitrator's msg: ";
stringBuilder.append(role).append(m.getMessage()).append("\n");
});
stringBuilder.append("\n");
});
stringBuilder.append("\n");
});
String message = stringBuilder.toString();
// We don't translate that as it is not intended for the public
new Popup<>().headLine("All disputes (" + disputeGroups.size() + ")").information(message).width(1000).actionButtonText("Copy").onAction(() -> Utilities.copyToClipboard(message)).show();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.U, event)) {
// Hidden shortcut to re-open a dispute. Allow it also for traders not only arbitrator.
if (selectedDispute != null) {
if (selectedDisputeClosedPropertyListener != null)
selectedDispute.isClosedProperty().removeListener(selectedDisputeClosedPropertyListener);
selectedDispute.setIsClosed(false);
}
} else if (Utilities.isAltOrCtrlPressed(KeyCode.R, event)) {
if (selectedDispute != null) {
PubKeyRing pubKeyRing = selectedDispute.getTraderPubKeyRing();
NodeAddress nodeAddress;
if (pubKeyRing.equals(selectedDispute.getContract().getBuyerPubKeyRing()))
nodeAddress = selectedDispute.getContract().getBuyerNodeAddress();
else
nodeAddress = selectedDispute.getContract().getSellerNodeAddress();
new SendPrivateNotificationWindow(pubKeyRing, nodeAddress, useDevPrivilegeKeys).onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid).show();
}
} else if (Utilities.isAltOrCtrlPressed(KeyCode.ENTER, event)) {
if (selectedDispute != null && messagesInputBox.isVisible() && inputTextArea.isFocused())
onTrySendMessage();
}
};
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class LockedView method setDateColumnCellFactory.
// /////////////////////////////////////////////////////////////////////////////////////////
// ColumnCellFactories
// /////////////////////////////////////////////////////////////////////////////////////////
private void setDateColumnCellFactory() {
dateColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
dateColumn.setCellFactory(new Callback<TableColumn<LockedListItem, LockedListItem>, TableCell<LockedListItem, LockedListItem>>() {
@Override
public TableCell<LockedListItem, LockedListItem> call(TableColumn<LockedListItem, LockedListItem> column) {
return new TableCell<LockedListItem, LockedListItem>() {
@Override
public void updateItem(final LockedListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (getTradable(item).isPresent())
setGraphic(new AutoTooltipLabel(formatter.formatDateTime(getTradable(item).get().getDate())));
else
setGraphic(new AutoTooltipLabel(Res.get("shared.noDateAvailable")));
} else {
setGraphic(null);
}
}
};
}
});
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class MyVotesView method createVoteTableView.
// /////////////////////////////////////////////////////////////////////////////////////////
// Create views
// /////////////////////////////////////////////////////////////////////////////////////////
private void createVoteTableView() {
TableGroupHeadline proposalsHeadline = new TableGroupHeadline(Res.get("dao.proposal.myVotes.header"));
GridPane.setRowIndex(proposalsHeadline, ++gridRow);
GridPane.setMargin(proposalsHeadline, new Insets(-10, -10, -10, -10));
GridPane.setColumnSpan(proposalsHeadline, 2);
root.getChildren().add(proposalsHeadline);
votesTableView = new TableView<>();
votesTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
votesTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
createVoteColumns(votesTableView);
GridPane.setRowIndex(votesTableView, gridRow);
GridPane.setMargin(votesTableView, new Insets(10, -10, 5, -10));
GridPane.setColumnSpan(votesTableView, 2);
GridPane.setHgrow(votesTableView, Priority.ALWAYS);
root.getChildren().add(votesTableView);
votesTableView.setItems(sortedList);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class ArbitratorRegistrationView method buildUI.
private void buildUI() {
GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(30, 25, -1, 25));
gridPane.setHgap(5);
gridPane.setVgap(5);
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHalignment(HPos.RIGHT);
columnConstraints1.setHgrow(Priority.SOMETIMES);
columnConstraints1.setMinWidth(200);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
root.getChildren().add(gridPane);
addTitledGroupBg(gridPane, gridRow, 3, Res.get("account.tab.arbitratorRegistration"));
TextField pubKeyTextField = FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("account.arbitratorRegistration.pubKey"), model.registrationPubKeyAsHex.get(), Layout.FIRST_ROW_DISTANCE).second;
pubKeyTextField.textProperty().bind(model.registrationPubKeyAsHex);
Tuple2<Label, ListView> tuple = addLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
GridPane.setValignment(tuple.first, VPos.TOP);
// noinspection unchecked
languagesListView = tuple.second;
languagesListView.disableProperty().bind(model.registrationEditDisabled);
languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> list) {
return new ListCell<String>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final String item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(LanguageUtil.getDisplayName(item));
removeButton.setOnAction(e -> onRemoveLanguage(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
// noinspection unchecked
languageComboBox = addLabelComboBox(gridPane, ++gridRow).second;
languageComboBox.disableProperty().bind(model.registrationEditDisabled);
languageComboBox.setPromptText(Res.get("shared.addLanguage"));
languageComboBox.setConverter(new StringConverter<String>() {
@Override
public String toString(String code) {
return LanguageUtil.getDisplayName(code);
}
@Override
public String fromString(String s) {
return null;
}
});
languageComboBox.setOnAction(e -> onAddLanguage());
Button registerButton = addButtonAfterGroup(gridPane, ++gridRow, Res.get("account.arbitratorRegistration.register"));
registerButton.disableProperty().bind(model.registrationEditDisabled);
registerButton.setOnAction(e -> onRegister());
Button revokeButton = addButton(gridPane, ++gridRow, Res.get("account.arbitratorRegistration.revoke"));
revokeButton.setDefaultButton(false);
revokeButton.disableProperty().bind(model.revokeButtonDisabled);
revokeButton.setOnAction(e -> onRevoke());
addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("shared.information"), Layout.GROUP_DISTANCE);
Label infoLabel = addMultilineLabel(gridPane, gridRow);
GridPane.setMargin(infoLabel, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
infoLabel.setText(Res.get("account.arbitratorRegistration.info.msg"));
}
Aggregations