mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
add or remove tooltip on account tab on renaming
This commit is contained in:
parent
90bfa47046
commit
ff1a9e8a52
1 changed files with 10 additions and 1 deletions
|
@ -1654,7 +1654,7 @@ public class AppController implements Initializable {
|
||||||
subTabLabel.setGraphic(getSubTabGlyph(wallet));
|
subTabLabel.setGraphic(getSubTabGlyph(wallet));
|
||||||
subTabLabel.setContentDisplay(ContentDisplay.TOP);
|
subTabLabel.setContentDisplay(ContentDisplay.TOP);
|
||||||
subTabLabel.setAlignment(Pos.TOP_CENTER);
|
subTabLabel.setAlignment(Pos.TOP_CENTER);
|
||||||
if(TextUtils.computeTextWidth(subTabLabel.getFont(), label, 0.0D) > (90-6)) {
|
if(isSubTabLabelTruncated(subTabLabel, label)) {
|
||||||
subTabLabel.setTooltip(new Tooltip(label));
|
subTabLabel.setTooltip(new Tooltip(label));
|
||||||
}
|
}
|
||||||
subTab.setGraphic(subTabLabel);
|
subTab.setGraphic(subTabLabel);
|
||||||
|
@ -2104,6 +2104,11 @@ public class AppController implements Initializable {
|
||||||
if(optLabel.isPresent()) {
|
if(optLabel.isPresent()) {
|
||||||
String label = optLabel.get();
|
String label = optLabel.get();
|
||||||
subTabLabel.setText(label);
|
subTabLabel.setText(label);
|
||||||
|
if(isSubTabLabelTruncated(subTabLabel, label)) {
|
||||||
|
subTabLabel.setTooltip(new Tooltip(label));
|
||||||
|
} else {
|
||||||
|
subTabLabel.setTooltip(null);
|
||||||
|
}
|
||||||
|
|
||||||
Wallet renamedWallet = AppServices.get().getWallet(walletId);
|
Wallet renamedWallet = AppServices.get().getWallet(walletId);
|
||||||
renamedWallet.setLabel(label);
|
renamedWallet.setLabel(label);
|
||||||
|
@ -2131,6 +2136,10 @@ public class AppController implements Initializable {
|
||||||
return contextMenu;
|
return contextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSubTabLabelTruncated(Label subTabLabel, String label) {
|
||||||
|
return TextUtils.computeTextWidth(subTabLabel.getFont(), label, 0.0D) > (90-6);
|
||||||
|
}
|
||||||
|
|
||||||
private void configureSwitchServer() {
|
private void configureSwitchServer() {
|
||||||
switchServer.getItems().clear();
|
switchServer.getItems().clear();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue