mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-07-20 06:52:36 +00:00
adding context menu to vault list
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.cryptomator.ui.mainwindow;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
@@ -22,6 +23,7 @@ public class VaultListController implements FxController {
|
||||
|
||||
private final ObservableList<Vault> vaults;
|
||||
private final ObjectProperty<Vault> selectedVault;
|
||||
private final BooleanBinding noVaultSelected;
|
||||
private final VaultListCellFactory cellFactory;
|
||||
private final AddVaultWizardComponent.Builder addVaultWizard;
|
||||
private final RemoveVaultComponent.Builder removeVault;
|
||||
@@ -35,6 +37,7 @@ public class VaultListController implements FxController {
|
||||
this.cellFactory = cellFactory;
|
||||
this.addVaultWizard = addVaultWizard;
|
||||
this.removeVault = removeVault;
|
||||
this.noVaultSelected = selectedVault.isNull();
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
@@ -63,4 +66,14 @@ public class VaultListController implements FxController {
|
||||
LOG.debug("Cannot remove a vault if none is selected.");
|
||||
}
|
||||
}
|
||||
|
||||
// Getter and Setter
|
||||
|
||||
public BooleanBinding noVaultSelectedProperty() {
|
||||
return noVaultSelected;
|
||||
}
|
||||
|
||||
public boolean isNoVaultSelected() {
|
||||
return noVaultSelected.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ContextMenu?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.Tooltip?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
@@ -15,7 +17,17 @@
|
||||
fx:controller="org.cryptomator.ui.mainwindow.VaultListController"
|
||||
minWidth="206">
|
||||
<StackPane VBox.vgrow="ALWAYS">
|
||||
<ListView fx:id="vaultList" editable="true"/>
|
||||
<ListView fx:id="vaultList" editable="true">
|
||||
<contextMenu>
|
||||
<ContextMenu fx:id="test">
|
||||
<!-- TODO: add style class to contextmenu & its entries -->
|
||||
<items>
|
||||
<MenuItem text="%main.vaultlist.contextMenu.add" onAction="#didClickAddVault"/>
|
||||
<MenuItem text="%main.vaultlist.contextMenu.remove" onAction="#didClickRemoveVault" disable="${controller.noVaultSelected}"/>
|
||||
</items>
|
||||
</ContextMenu>
|
||||
</contextMenu>
|
||||
</ListView>
|
||||
<AnchorPane fx:id="onboardingOverlay">
|
||||
<HBox AnchorPane.leftAnchor="10" AnchorPane.rightAnchor="10" AnchorPane.bottomAnchor="100" alignment="BOTTOM_LEFT">
|
||||
<Label textAlignment="CENTER" text="%main.vaultlist.emptyList.onboardingInstruction" wrapText="true"/>
|
||||
|
||||
@@ -104,6 +104,8 @@ main.closeBtn.tooltip=Close
|
||||
main.preferencesBtn.tooltip=Preferences
|
||||
## Vault List
|
||||
main.vaultlist.emptyList.onboardingInstruction=Click here to add a vault
|
||||
main.vaultlist.contextMenu.add=Add Vault
|
||||
main.vaultlist.contextMenu.remove=Remove Vault
|
||||
## Vault Detail
|
||||
main.vaultDetail.lockedStatus=LOCKED
|
||||
main.vaultDetail.unlockedStatus=UNLOCKED
|
||||
|
||||
Reference in New Issue
Block a user