Refactor assets/resources

This commit is contained in:
mkpaz 2023-05-27 21:33:16 +04:00
parent f4f1309372
commit b834072a1d
35 changed files with 25 additions and 27 deletions

@ -9,7 +9,7 @@ import atlantafx.sampler.event.DefaultEventBus;
import atlantafx.sampler.event.NavEvent; import atlantafx.sampler.event.NavEvent;
import atlantafx.sampler.page.Page; import atlantafx.sampler.page.Page;
import atlantafx.sampler.page.components.AccordionPage; import atlantafx.sampler.page.components.AccordionPage;
import atlantafx.sampler.page.components.AnimationsPage; import atlantafx.sampler.page.general.AnimationsPage;
import atlantafx.sampler.page.components.BreadcrumbsPage; import atlantafx.sampler.page.components.BreadcrumbsPage;
import atlantafx.sampler.page.components.ButtonPage; import atlantafx.sampler.page.components.ButtonPage;
import atlantafx.sampler.page.components.CalendarPage; import atlantafx.sampler.page.components.CalendarPage;

@ -166,7 +166,7 @@ public final class AccordionPage extends OutlinePage {
disabledBlock.setDisable(true); disabledBlock.setDisable(true);
var imageBlock = new TitledPane("_Image", new VBox(10, var imageBlock = new TitledPane("_Image", new VBox(10,
new ImageView(new Image(Resources.getResourceAsStream("images/20_min_adventure.jpg"))), new ImageView(new Image(Resources.getResourceAsStream("images/fun/20_min_adventure.jpg"))),
new TextFlow(new Text(FAKER.rickAndMorty().quote())) new TextFlow(new Text(FAKER.rickAndMorty().quote()))
)); ));
imageBlock.animatedProperty().bind(animatedProperty); imageBlock.animatedProperty().bind(animatedProperty);

@ -103,9 +103,7 @@ public class TilePage extends OutlinePage {
); );
var img = new ImageView(new Image( var img = new ImageView(new Image(
Resources.getResourceAsStream( Resources.getResourceAsStream("images/avatars/avatar1.png")
"assets/fxml/blueprints/resources/avatar1.png"
)
)); ));
img.setFitWidth(64); img.setFitWidth(64);
img.setFitHeight(64); img.setFitHeight(64);

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
package atlantafx.sampler.page.components; package atlantafx.sampler.page.general;
import static javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED; import static javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED;
import static javafx.scene.control.ScrollPane.ScrollBarPolicy.NEVER; import static javafx.scene.control.ScrollPane.ScrollBarPolicy.NEVER;
@ -36,10 +36,10 @@ public final class AnimationsPage extends StackPane implements Page {
private static final int OUTLINE_WIDTH = 250; private static final int OUTLINE_WIDTH = 250;
private static final Duration DURATION = Duration.millis(2000); private static final Duration DURATION = Duration.millis(2000);
private static final ImageView ANIMATED_NODE = new ImageView(new Image( private static final ImageView ANIMATED_NODE = new ImageView(new Image(
Resources.getResourceAsStream("images/saitama.png") Resources.getResourceAsStream("images/fun/saitama.png")
)); ));
private static final ImageView ANIMATED_BG = new ImageView(new Image( private static final ImageView ANIMATED_BG = new ImageView(new Image(
Resources.getResourceAsStream("images/saitama-bg.png") Resources.getResourceAsStream("images/fun/saitama-bg.png")
)); ));
@Override @Override

@ -153,7 +153,7 @@ class SceneBuilderDialog extends ModalDialog {
private Pane createStartScreen() { private Pane createStartScreen() {
var previewImg = new ImageView(new Image( var previewImg = new ImageView(new Image(
Resources.getResourceAsStream("images/scene-builder-in-action.jpg") Resources.getResourceAsStream("images/scene-builder/scene-builder-in-action.jpg")
)); ));
previewImg.setFitWidth(280); previewImg.setFitWidth(280);
previewImg.setFitHeight(190); previewImg.setFitHeight(190);
@ -257,7 +257,7 @@ class SceneBuilderDialog extends ModalDialog {
private Pane createThemeScreen() { private Pane createThemeScreen() {
var icon = new ImageView(new Image( var icon = new ImageView(new Image(
Resources.getResourceAsStream("images/color-palette.png") Resources.getResourceAsStream("images/scene-builder/color-palette.png")
)); ));
icon.setFitWidth(64); icon.setFitWidth(64);
icon.setFitHeight(64); icon.setFitHeight(64);
@ -323,14 +323,14 @@ class SceneBuilderDialog extends ModalDialog {
private Pane createExecScreen() { private Pane createExecScreen() {
var menuImg = new ImageView(new Image( var menuImg = new ImageView(new Image(
Resources.getResourceAsStream("images/scene-builder-themes.png") Resources.getResourceAsStream("images/scene-builder/scene-builder-themes.png")
)); ));
menuImg.setFitWidth(280); menuImg.setFitWidth(280);
menuImg.setFitHeight(210); menuImg.setFitHeight(210);
menuImg.setCursor(Cursor.HAND); menuImg.setCursor(Cursor.HAND);
var test = new ImageView(new Image( var test = new ImageView(new Image(
Resources.getResourceAsStream("images/scene-builder-themes.png") Resources.getResourceAsStream("images/scene-builder/scene-builder-themes.png")
)); ));
test.setPickOnBounds(true); test.setPickOnBounds(true);

@ -46,7 +46,7 @@ public final class ThemePage extends OutlinePage {
private static final ThemeManager TM = ThemeManager.getInstance(); private static final ThemeManager TM = ThemeManager.getInstance();
private static final String DEFAULT_FONT_ID = "Default"; private static final String DEFAULT_FONT_ID = "Default";
private static final Image SCENE_BUILDER_ICON = new Image( private static final Image SCENE_BUILDER_ICON = new Image(
Resources.getResourceAsStream("images/scene-builder_32.png") Resources.getResourceAsStream("images/scene-builder/scene-builder_32.png")
); );
@Override @Override

@ -37,7 +37,7 @@ public final class BlueprintsPage extends ScrollPane implements Page {
wrapper.setAlignment(Pos.TOP_CENTER); wrapper.setAlignment(Pos.TOP_CENTER);
var loader = new FXMLLoader( var loader = new FXMLLoader(
Resources.getResource("assets/fxml/blueprints/index.fxml").toURL() Resources.getResource("fxml/blueprints/index.fxml").toURL()
); );
Parent fxmlContent = loader.load(); Parent fxmlContent = loader.load();
((Pane) fxmlContent).setMaxWidth(Page.MAX_WIDTH); ((Pane) fxmlContent).setMaxWidth(Page.MAX_WIDTH);

@ -39,7 +39,7 @@ public final class OverviewPage extends ScrollPane implements Page {
wrapper.getStyleClass().add(Styles.BG_DEFAULT); wrapper.getStyleClass().add(Styles.BG_DEFAULT);
var loader = new FXMLLoader( var loader = new FXMLLoader(
Resources.getResource("assets/fxml/overview.fxml").toURL() Resources.getResource("fxml/overview.fxml").toURL()
); );
Parent fxmlContent = loader.load(); Parent fxmlContent = loader.load();
((Pane) fxmlContent).setMaxWidth(Page.MAX_WIDTH); ((Pane) fxmlContent).setMaxWidth(Page.MAX_WIDTH);

@ -5,7 +5,7 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import org.kordamp.ikonli.javafx.FontIcon?> <?import org.kordamp.ikonli.javafx.FontIcon?>
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="180.0" spacing="10.0" styleClass="sample" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"> <VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="180.0" spacing="10.0" styleClass="sample" xmlns="http://javafx.com/javafx/19">
<children> <children>
<Button defaultButton="true" mnemonicParsing="false" prefWidth="150.0" text="Button"> <Button defaultButton="true" mnemonicParsing="false" prefWidth="150.0" text="Button">
<graphic> <graphic>

@ -54,17 +54,17 @@
<children> <children>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/avatar1.png" /> <Image url="@../../images/avatars/avatar1.png" />
</image> </image>
</ImageView> </ImageView>
<ImageView fitHeight="32.0" fitWidth="32.0" layoutX="10.0" layoutY="10.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="32.0" fitWidth="32.0" layoutX="10.0" layoutY="10.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/avatar2.png" /> <Image url="@../../images/avatars/avatar2.png" />
</image> </image>
</ImageView> </ImageView>
<ImageView fitHeight="32.0" fitWidth="32.0" layoutX="42.0" layoutY="10.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="32.0" fitWidth="32.0" layoutX="42.0" layoutY="10.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/avatar3.png" /> <Image url="@../../images/avatars/avatar3.png" />
</image> </image>
</ImageView> </ImageView>
<Spacer /> <Spacer />

@ -107,7 +107,7 @@
<children> <children>
<ImageView fitHeight="80.0" fitWidth="80.0" pickOnBounds="true" preserveRatio="true" GridPane.rowSpan="2147483647"> <ImageView fitHeight="80.0" fitWidth="80.0" pickOnBounds="true" preserveRatio="true" GridPane.rowSpan="2147483647">
<image> <image>
<Image url="@resources/rainbow_rising.png" /> <Image url="@../../images/album_covers/rainbow_rising.png" />
</image> </image>
</ImageView> </ImageView>
<Label styleClass="text-caption" text="A Light in the Black" GridPane.columnIndex="1"> <Label styleClass="text-caption" text="A Light in the Black" GridPane.columnIndex="1">
@ -157,7 +157,7 @@
<children> <children>
<ImageView fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/accept_blind-rage.png" /> <Image url="@../../images/album_covers/accept_blind-rage.png" />
</image> </image>
</ImageView> </ImageView>
<VBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> <VBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS">
@ -194,7 +194,7 @@
<children> <children>
<ImageView fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/soen_lotus.png" /> <Image url="@../../images/album_covers/soen_lotus.png" />
</image> </image>
</ImageView> </ImageView>
<VBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> <VBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS">
@ -231,7 +231,7 @@
<children> <children>
<ImageView fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/opeth_blackwater-park.png" /> <Image url="@../../images/album_covers/opeth_blackwater-park.png" />
</image> </image>
</ImageView> </ImageView>
<VBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> <VBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS">

@ -14,7 +14,7 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="350.0" spacing="10.0" styleClass="sample" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"> <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="350.0" spacing="10.0" styleClass="sample" xmlns="http://javafx.com/javafx/19">
<padding> <padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding> </padding>
@ -38,7 +38,7 @@
<children> <children>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/avatar4.png" /> <Image url="@../../images/avatars/avatar4.png" />
</image> </image>
</ImageView> </ImageView>
<Label text="Gethin Peters" /> <Label text="Gethin Peters" />
@ -55,7 +55,7 @@
<children> <children>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/avatar5.png" /> <Image url="@../../images/avatars/avatar5.png" />
</image> </image>
</ImageView> </ImageView>
<Label text="Gerard Gallagher" /> <Label text="Gerard Gallagher" />
@ -72,7 +72,7 @@
<children> <children>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@resources/avatar6.png" /> <Image url="@../../images/avatars/avatar6.png" />
</image> </image>
</ImageView> </ImageView>
<Label text="Betty Lopez" /> <Label text="Betty Lopez" />

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB