mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Fix rebase errors
This commit is contained in:
parent
5eb5df58e2
commit
e6fd619d1d
@ -17,13 +17,86 @@
|
||||
|
||||
package bisq.desktop.components;
|
||||
|
||||
import bisq.common.UserThread;
|
||||
|
||||
import de.jensd.fx.fontawesome.AwesomeDude;
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
|
||||
import org.controlsfx.control.PopOver;
|
||||
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
import javafx.geometry.Insets;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AutoTooltipTableColumn<S, T> extends TableColumn<S, T> {
|
||||
|
||||
private Label helpIcon;
|
||||
private Boolean hidePopover;
|
||||
private PopOver infoPopover;
|
||||
|
||||
|
||||
public AutoTooltipTableColumn(String text) {
|
||||
super();
|
||||
|
||||
setGraphic(new AutoTooltipLabel(text));
|
||||
setTitle(text);
|
||||
}
|
||||
|
||||
public AutoTooltipTableColumn(String text, String help) {
|
||||
|
||||
setTitleWithHelpText(text, help);
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
setGraphic(new AutoTooltipLabel(title));
|
||||
}
|
||||
|
||||
public void setTitleWithHelpText(String title, String help) {
|
||||
|
||||
final AutoTooltipLabel label = new AutoTooltipLabel(title);
|
||||
|
||||
helpIcon = new Label();
|
||||
AwesomeDude.setIcon(helpIcon, AwesomeIcon.QUESTION_SIGN, "1em");
|
||||
helpIcon.setOpacity(0.4);
|
||||
helpIcon.setOnMouseEntered(e -> {
|
||||
hidePopover = false;
|
||||
final Label helpLabel = new Label(help);
|
||||
helpLabel.setMaxWidth(300);
|
||||
helpLabel.setWrapText(true);
|
||||
helpLabel.setPadding(new Insets(10));
|
||||
showInfoPopOver(helpLabel);
|
||||
});
|
||||
helpIcon.setOnMouseExited(e -> {
|
||||
if (infoPopover != null)
|
||||
infoPopover.hide();
|
||||
hidePopover = true;
|
||||
UserThread.runAfter(() -> {
|
||||
if (hidePopover) {
|
||||
infoPopover.hide();
|
||||
hidePopover = false;
|
||||
}
|
||||
}, 250, TimeUnit.MILLISECONDS);
|
||||
});
|
||||
|
||||
final HBox hBox = new HBox(label, helpIcon);
|
||||
hBox.setStyle("-fx-alignment: center");
|
||||
hBox.setSpacing(4);
|
||||
setGraphic(hBox);
|
||||
}
|
||||
|
||||
private void showInfoPopOver(Node node) {
|
||||
node.getStyleClass().add("default-text");
|
||||
|
||||
infoPopover = new PopOver(node);
|
||||
if (helpIcon.getScene() != null) {
|
||||
infoPopover.setDetachable(false);
|
||||
infoPopover.setArrowLocation(PopOver.ArrowLocation.LEFT_CENTER);
|
||||
|
||||
infoPopover.show(helpIcon, -10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,81 +0,0 @@
|
||||
package io.bisq.gui.components;
|
||||
|
||||
import de.jensd.fx.fontawesome.AwesomeDude;
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import io.bisq.common.UserThread;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.layout.HBox;
|
||||
import org.controlsfx.control.PopOver;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AutoTooltipTableColumn<S, T> extends TableColumn<S, T> {
|
||||
|
||||
private Label helpIcon;
|
||||
private Boolean hidePopover;
|
||||
private PopOver infoPopover;
|
||||
|
||||
|
||||
public AutoTooltipTableColumn(String text) {
|
||||
super();
|
||||
|
||||
setTitle(text);
|
||||
}
|
||||
|
||||
public AutoTooltipTableColumn(String text, String help) {
|
||||
|
||||
setTitleWithHelpText(text, help);
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
setGraphic(new AutoTooltipLabel(title));
|
||||
}
|
||||
|
||||
public void setTitleWithHelpText(String title, String help) {
|
||||
|
||||
final AutoTooltipLabel label = new AutoTooltipLabel(title);
|
||||
|
||||
helpIcon = new Label();
|
||||
AwesomeDude.setIcon(helpIcon, AwesomeIcon.QUESTION_SIGN, "1em");
|
||||
helpIcon.setOpacity(0.4);
|
||||
helpIcon.setOnMouseEntered(e -> {
|
||||
hidePopover = false;
|
||||
final Label helpLabel = new Label(help);
|
||||
helpLabel.setMaxWidth(300);
|
||||
helpLabel.setWrapText(true);
|
||||
helpLabel.setPadding(new Insets(10));
|
||||
showInfoPopOver(helpLabel);
|
||||
});
|
||||
helpIcon.setOnMouseExited(e -> {
|
||||
if (infoPopover != null)
|
||||
infoPopover.hide();
|
||||
hidePopover = true;
|
||||
UserThread.runAfter(() -> {
|
||||
if (hidePopover) {
|
||||
infoPopover.hide();
|
||||
hidePopover = false;
|
||||
}
|
||||
}, 250, TimeUnit.MILLISECONDS);
|
||||
});
|
||||
|
||||
final HBox hBox = new HBox(label, helpIcon);
|
||||
hBox.setStyle("-fx-alignment: center");
|
||||
hBox.setSpacing(4);
|
||||
setGraphic(hBox);
|
||||
}
|
||||
|
||||
private void showInfoPopOver(Node node) {
|
||||
node.getStyleClass().add("default-text");
|
||||
|
||||
infoPopover = new PopOver(node);
|
||||
if (helpIcon.getScene() != null) {
|
||||
infoPopover.setDetachable(false);
|
||||
infoPopover.setArrowLocation(PopOver.ArrowLocation.LEFT_CENTER);
|
||||
|
||||
infoPopover.show(helpIcon, -10);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user