mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 04:31:27 +00:00
fxml cleanup
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package org.cryptomator.ui.mainwindow;
|
||||
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.binding.IntegerBinding;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.TransferMode;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
@@ -39,8 +39,8 @@ public class MainWindowController implements FxController {
|
||||
private final VaultFactory vaultFactory;
|
||||
private final WrongFileAlertComponent.Builder wrongFileAlert;
|
||||
public HBox titleBar;
|
||||
public VBox dragAndDropRegion;
|
||||
public VBox dragNDropIndicator;
|
||||
public VBox root;
|
||||
public Pane dragAndDropIndicator;
|
||||
public Region resizer;
|
||||
private double xOffset;
|
||||
private double yOffset;
|
||||
@@ -75,18 +75,18 @@ public class MainWindowController implements FxController {
|
||||
window.setHeight(event.getSceneY());
|
||||
});
|
||||
updateChecker.automaticallyCheckForUpdatesIfEnabled();
|
||||
dragNDropIndicator.setVisible(false);
|
||||
dragAndDropRegion.setOnDragOver(event -> {
|
||||
if (event.getGestureSource() != dragAndDropRegion && event.getDragboard().hasFiles()) {
|
||||
dragAndDropIndicator.setVisible(false);
|
||||
root.setOnDragOver(event -> {
|
||||
if (event.getGestureSource() != root && event.getDragboard().hasFiles()) {
|
||||
/* allow for both copying and moving, whatever user chooses */
|
||||
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
|
||||
dragNDropIndicator.setVisible(true);
|
||||
dragAndDropIndicator.setVisible(true);
|
||||
}
|
||||
event.consume();
|
||||
});
|
||||
dragAndDropRegion.setOnDragExited(event -> dragNDropIndicator.setVisible(false));
|
||||
dragAndDropRegion.setOnDragDropped(event -> {
|
||||
if (event.getGestureSource() != dragAndDropRegion && event.getDragboard().hasFiles()) {
|
||||
root.setOnDragExited(event -> dragAndDropIndicator.setVisible(false));
|
||||
root.setOnDragDropped(event -> {
|
||||
if (event.getGestureSource() != root && event.getDragboard().hasFiles()) {
|
||||
/* allow for both copying and moving, whatever user chooses */
|
||||
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
|
||||
File dropped = event.getDragboard().getFiles().get(0);
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.shape.Rectangle?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:id="dragAndDropRegion"
|
||||
fx:id="root"
|
||||
fx:controller="org.cryptomator.ui.mainwindow.MainWindowController"
|
||||
styleClass="main-window">
|
||||
<HBox styleClass="title" fx:id="titleBar" alignment="CENTER" minHeight="50" maxHeight="50" VBox.vgrow="NEVER" spacing="6">
|
||||
@@ -50,12 +51,13 @@
|
||||
<fx:include source="/fxml/vault_detail.fxml" SplitPane.resizableWithParent="true"/>
|
||||
</SplitPane>
|
||||
<Region styleClass="resizer" StackPane.alignment="BOTTOM_RIGHT" fx:id="resizer" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity"/>
|
||||
<VBox fx:id="dragNDropIndicator">
|
||||
<padding>
|
||||
<Insets topRightBottomLeft="20"/>
|
||||
</padding>
|
||||
<Rectangle arcHeight="4" arcWidth="4" fill="gainsboro" strokeType="CENTERED" strokeWidth="3" strokeDashArray="20, 20" strokeLineJoin="ROUND" stroke="black" height="${dragAndDropRegion.height - 90}"
|
||||
width="${dragAndDropRegion.width - 40}"/>
|
||||
</VBox>
|
||||
<!-- TODO: use css instead of adding a Rectangle: -->
|
||||
<Pane fx:id="dragAndDropIndicator">
|
||||
<StackPane.margin>
|
||||
<Insets topRightBottomLeft="24"/>
|
||||
</StackPane.margin>
|
||||
<Rectangle arcHeight="4" arcWidth="4" fill="gainsboro" strokeType="CENTERED" strokeWidth="3" strokeDashArray="20, 20" strokeLineJoin="ROUND" stroke="black" height="${dragAndDropIndicator.height}"
|
||||
width="${dragAndDropIndicator.width}"/>
|
||||
</Pane>
|
||||
</StackPane>
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user