mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-07-20 06:52:36 +00:00
adjust fxml loading to modular setup
This commit is contained in:
@@ -5,7 +5,6 @@ import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -26,11 +25,9 @@ public class FxmlLoaderFactory {
|
||||
/**
|
||||
* @return A new FXMLLoader instance
|
||||
*/
|
||||
public FXMLLoader construct() {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setControllerFactory(this::constructController);
|
||||
loader.setResources(resourceBundle);
|
||||
return loader;
|
||||
private FXMLLoader construct(String fxmlResourceName) {
|
||||
var url = getClass().getResource(fxmlResourceName);
|
||||
return new FXMLLoader(url, resourceBundle, null, this::constructController);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,10 +38,8 @@ public class FxmlLoaderFactory {
|
||||
* @throws IOException if an error occurs while loading the FXML file
|
||||
*/
|
||||
public FXMLLoader load(String fxmlResourceName) throws IOException {
|
||||
FXMLLoader loader = construct();
|
||||
try (InputStream in = getClass().getResourceAsStream(fxmlResourceName)) {
|
||||
loader.load(in);
|
||||
}
|
||||
FXMLLoader loader = construct(fxmlResourceName);
|
||||
loader.load();
|
||||
return loader;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<Insets topRightBottomLeft="24"/>
|
||||
</padding>
|
||||
<children>
|
||||
<fx:include fx:id="newPasswordScene" source="/fxml/new_password.fxml"/>
|
||||
<fx:include fx:id="newPasswordScene" source="new_password.fxml"/>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<children>
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<fx:include source="/fxml/recoverykey_display.fxml"/>
|
||||
<fx:include source="recoverykey_display.fxml"/>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<ImageView VBox.vgrow="ALWAYS" fitHeight="128" preserveRatio="true" smooth="true" cache="true">
|
||||
<Image url="/img/bot/bot.png"/>
|
||||
<Image url="@../img/bot/bot.png"/>
|
||||
</ImageView>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<Region prefHeight="12" VBox.vgrow="NEVER"/>
|
||||
|
||||
<fx:include fx:id="newPassword" source="/fxml/new_password.fxml"/>
|
||||
<fx:include fx:id="newPassword" source="new_password.fxml"/>
|
||||
|
||||
<CheckBox fx:id="finalConfirmationCheckbox" text="%changepassword.finalConfirmation" wrapText="true"/>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<VBox minWidth="300" alignment="CENTER" visible="${!controller.anyCheckSelected}" managed="${!controller.anyCheckSelected}" >
|
||||
<Label text="%health.check.detail.noSelectedCheck" wrapText="true" alignment="CENTER" />
|
||||
</VBox>
|
||||
<fx:include source="/fxml/health_check_details.fxml" visible="${controller.anyCheckSelected}" managed="${controller.anyCheckSelected}" />
|
||||
<fx:include source="health_check_details.fxml" visible="${controller.anyCheckSelected}" managed="${controller.anyCheckSelected}" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
<ButtonBar buttonMinWidth="120" buttonOrder="+CX">
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
fx:controller="org.cryptomator.ui.mainwindow.MainWindowController"
|
||||
styleClass="main-window">
|
||||
<VBox>
|
||||
<fx:include source="/fxml/main_window_title.fxml" VBox.vgrow="NEVER"/>
|
||||
<fx:include source="main_window_title.fxml" VBox.vgrow="NEVER"/>
|
||||
<StackPane VBox.vgrow="ALWAYS">
|
||||
<SplitPane dividerPositions="0.33" orientation="HORIZONTAL">
|
||||
<fx:include source="/fxml/vault_list.fxml" SplitPane.resizableWithParent="false"/>
|
||||
<fx:include source="/fxml/vault_detail.fxml" SplitPane.resizableWithParent="true"/>
|
||||
<fx:include source="vault_list.fxml" SplitPane.resizableWithParent="false"/>
|
||||
<fx:include source="vault_detail.fxml" SplitPane.resizableWithParent="true"/>
|
||||
</SplitPane>
|
||||
|
||||
<VBox styleClass="drag-n-drop-indicator" visible="${controller.draggingOver}" alignment="TOP_CENTER">
|
||||
@@ -33,5 +33,5 @@
|
||||
</VBox>
|
||||
</StackPane>
|
||||
</VBox>
|
||||
<fx:include source="/fxml/main_window_resize.fxml"/>
|
||||
<fx:include source="main_window_resize.fxml"/>
|
||||
</StackPane>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<FontAwesome5IconView glyph="WRENCH"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_general.fxml"/>
|
||||
<fx:include source="preferences_general.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="volumeTab" id="VOLUME" text="%preferences.volume">
|
||||
@@ -27,7 +27,7 @@
|
||||
<FontAwesome5IconView glyph="HDD"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_volume.fxml"/>
|
||||
<fx:include source="preferences_volume.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="updatesTab" id="UPDATES" text="%preferences.updates">
|
||||
@@ -35,7 +35,7 @@
|
||||
<FontAwesome5IconView glyph="SYNC"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_updates.fxml"/>
|
||||
<fx:include source="preferences_updates.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="contributeTab" id="CONTRIBUTE" text="%preferences.contribute">
|
||||
@@ -43,7 +43,7 @@
|
||||
<FontAwesome5IconView glyph="HEART"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_contribute.fxml"/>
|
||||
<fx:include source="preferences_contribute.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="aboutTab" id="ABOUT" text="%preferences.about">
|
||||
@@ -51,7 +51,7 @@
|
||||
<FontAwesome5IconView glyph="INFO_CIRCLE"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_about.fxml"/>
|
||||
<fx:include source="preferences_about.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<children>
|
||||
<HBox spacing="12" VBox.vgrow="NEVER">
|
||||
<ImageView VBox.vgrow="ALWAYS" fitHeight="64" preserveRatio="true" smooth="true" cache="true">
|
||||
<Image url="/img/bot/bot.png"/>
|
||||
<Image url="@../img/bot/bot.png"/>
|
||||
</ImageView>
|
||||
<VBox spacing="3" HBox.hgrow="ALWAYS" alignment="CENTER_LEFT">
|
||||
<FormattedLabel styleClass="label-large" format="Cryptomator %s" arg1="${controller.applicationVersion}"/>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<Insets topRightBottomLeft="12"/>
|
||||
</padding>
|
||||
<children>
|
||||
<fx:include fx:id="newPassword" source="/fxml/new_password.fxml"/>
|
||||
<fx:include fx:id="newPassword" source="new_password.fxml"/>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<Insets topRightBottomLeft="12"/>
|
||||
</padding>
|
||||
<children>
|
||||
<fx:include source="/fxml/recoverykey_display.fxml"/>
|
||||
<fx:include source="recoverykey_display.fxml"/>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
|
||||
@@ -26,23 +26,23 @@
|
||||
<HBox spacing="12" VBox.vgrow="ALWAYS">
|
||||
<StackPane alignment="CENTER" HBox.hgrow="NEVER">
|
||||
<ImageView VBox.vgrow="ALWAYS" fitWidth="64" preserveRatio="true" smooth="true" cache="true" fx:id="face" visible="false">
|
||||
<Image url="/img/bot/face.png"/>
|
||||
<Image url="@../img/bot/face.png"/>
|
||||
</ImageView>
|
||||
|
||||
<ImageView VBox.vgrow="ALWAYS" fitWidth="64" preserveRatio="true" smooth="true" cache="true" fx:id="leftArm" visible="false">
|
||||
<Image url="/img/bot/arm-l.png"/>
|
||||
<Image url="@../img/bot/arm-l.png"/>
|
||||
</ImageView>
|
||||
|
||||
<ImageView VBox.vgrow="ALWAYS" fitWidth="64" preserveRatio="true" smooth="true" cache="true" fx:id="rightArm" visible="false">
|
||||
<Image url="/img/bot/arm-r.png"/>
|
||||
<Image url="@../img/bot/arm-r.png"/>
|
||||
</ImageView>
|
||||
|
||||
<ImageView VBox.vgrow="ALWAYS" fitWidth="64" preserveRatio="true" smooth="true" cache="true" fx:id="legs" visible="false">
|
||||
<Image url="/img/bot/legs.png"/>
|
||||
<Image url="@../img/bot/legs.png"/>
|
||||
</ImageView>
|
||||
|
||||
<ImageView VBox.vgrow="ALWAYS" fitWidth="64" preserveRatio="true" smooth="true" cache="true" fx:id="body">
|
||||
<Image url="/img/bot/body.png"/>
|
||||
<Image url="@../img/bot/body.png"/>
|
||||
</ImageView>
|
||||
</StackPane>
|
||||
<VBox spacing="6" HBox.hgrow="ALWAYS">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
spacing="24">
|
||||
<children>
|
||||
<ImageView VBox.vgrow="ALWAYS" fitHeight="128" preserveRatio="true" smooth="true" cache="true">
|
||||
<Image url="/img/bot/bot.png"/>
|
||||
<Image url="@../img/bot/bot.png"/>
|
||||
</ImageView>
|
||||
|
||||
<TextFlow styleClass="text-flow" prefWidth="-Infinity" visible="${controller.noVaultPresent}" managed="${controller.noVaultPresent}">
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<FontAwesome5IconView glyph="WRENCH"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/vault_options_general.fxml"/>
|
||||
<fx:include source="vault_options_general.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="mountTab" id="MOUNT" text="%vaultOptions.mount">
|
||||
@@ -25,7 +25,7 @@
|
||||
<FontAwesome5IconView glyph="HDD"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/vault_options_mount.fxml"/>
|
||||
<fx:include source="vault_options_mount.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="keyTab" id="KEY" text="%vaultOptions.masterkey">
|
||||
@@ -33,7 +33,7 @@
|
||||
<FontAwesome5IconView glyph="KEY"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/vault_options_masterkey.fxml"/>
|
||||
<fx:include source="vault_options_masterkey.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="autoLockTab" id="AUTOLOCK" text="%vaultOptions.autoLock">
|
||||
@@ -41,7 +41,7 @@
|
||||
<FontAwesome5IconView glyph="STOPWATCH"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/vault_options_autolock.fxml"/>
|
||||
<fx:include source="vault_options_autolock.fxml"/>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
|
||||
Reference in New Issue
Block a user