Added controlsfx dependency and toast notifications for password copying.
This commit is contained in:
parent
f7b54dc182
commit
33e16e40aa
6
pom.xml
6
pom.xml
|
@ -80,6 +80,12 @@
|
|||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.controlsfx/controlsfx -->
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.1stleg</groupId>
|
||||
<artifactId>jnativehook</artifactId>
|
||||
|
|
|
@ -2,6 +2,7 @@ module crystalkeep {
|
|||
requires javafx.fxml;
|
||||
requires javafx.controls;
|
||||
requires jnativehook;
|
||||
requires org.controlsfx.controls;
|
||||
|
||||
opens nl.andrewlalis.crystalkeep.control;
|
||||
opens nl.andrewlalis.crystalkeep;
|
||||
|
|
|
@ -8,6 +8,10 @@ import nl.andrewlalis.crystalkeep.model.CrystalItem;
|
|||
import nl.andrewlalis.crystalkeep.view.ShardTreeItem;
|
||||
import nl.andrewlalis.crystalkeep.view.shard_details.ViewModels;
|
||||
|
||||
/**
|
||||
* This listener will update the shard detail container pane (the main center
|
||||
* content of the application) to show the contents of a selected shard.
|
||||
*/
|
||||
public class ClusterTreeViewItemSelectionListener implements ChangeListener<TreeItem<CrystalItem>> {
|
||||
private final VBox shardDetailContainer;
|
||||
|
||||
|
|
|
@ -8,10 +8,9 @@ import javafx.scene.input.ClipboardContent;
|
|||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.util.Duration;
|
||||
import nl.andrewlalis.crystalkeep.model.shards.LoginCredentialsShard;
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyAdapter;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.controlsfx.control.Notifications;
|
||||
|
||||
public class LoginCredentialsViewModel extends ShardViewModel<LoginCredentialsShard> {
|
||||
public LoginCredentialsViewModel(LoginCredentialsShard shard) {
|
||||
|
@ -63,19 +62,11 @@ public class LoginCredentialsViewModel extends ShardViewModel<LoginCredentialsSh
|
|||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(shard.getPassword());
|
||||
Clipboard.getSystemClipboard().setContent(content);
|
||||
});
|
||||
|
||||
var copyBothButton = new Button("Copy Username and Password");
|
||||
copyBothButton.setOnAction(event -> {
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(shard.getUsername());
|
||||
final Clipboard c = Clipboard.getSystemClipboard();
|
||||
c.setContent(content);
|
||||
var t = new Thread(() -> {
|
||||
while (c.getString().equals(shard.getUsername())) {
|
||||
System.out.println("User hasn't pasted yet");
|
||||
}
|
||||
});
|
||||
Notifications.create()
|
||||
.text("Password copied to clipboard.")
|
||||
.hideAfter(Duration.seconds(3))
|
||||
.owner(gp)
|
||||
.show();
|
||||
});
|
||||
|
||||
passwordActionsPane.getChildren().addAll(showPasswordCheckbox, copyPasswordButton);
|
||||
|
|
Loading…
Reference in New Issue