From fbbb3469f100fc5383d60593b38e2255650d5676 Mon Sep 17 00:00:00 2001 From: mkpaz Date: Sat, 27 May 2023 18:41:24 +0400 Subject: [PATCH] Add controls overview page --- .../atlantafx/sampler/layout/MainModel.java | 5 +- .../sampler/page/showcase/OverviewPage.java | 87 +++ .../sampler/assets/fxml/overview.fxml | 604 ++++++++++++++++++ 3 files changed, 695 insertions(+), 1 deletion(-) create mode 100755 sampler/src/main/java/atlantafx/sampler/page/showcase/OverviewPage.java create mode 100644 sampler/src/main/resources/atlantafx/sampler/assets/fxml/overview.fxml diff --git a/sampler/src/main/java/atlantafx/sampler/layout/MainModel.java b/sampler/src/main/java/atlantafx/sampler/layout/MainModel.java index 2bffbda..d9a5ad8 100644 --- a/sampler/src/main/java/atlantafx/sampler/layout/MainModel.java +++ b/sampler/src/main/java/atlantafx/sampler/layout/MainModel.java @@ -57,6 +57,7 @@ import atlantafx.sampler.page.general.IconsPage; import atlantafx.sampler.page.general.ThemePage; import atlantafx.sampler.page.general.TypographyPage; import atlantafx.sampler.page.showcase.BlueprintsPage; +import atlantafx.sampler.page.showcase.OverviewPage; import atlantafx.sampler.page.showcase.filemanager.FileManagerPage; import atlantafx.sampler.page.showcase.musicplayer.MusicPlayerPage; import java.util.HashMap; @@ -230,7 +231,8 @@ public class MainModel { showcases.getChildren().setAll( NAV_TREE.get(BlueprintsPage.class), NAV_TREE.get(FileManagerPage.class), - NAV_TREE.get(MusicPlayerPage.class) + NAV_TREE.get(MusicPlayerPage.class), + NAV_TREE.get(OverviewPage.class) ); var root = NavTree.Item.root(); @@ -331,6 +333,7 @@ public class MainModel { map.put(BlueprintsPage.class, NavTree.Item.page(BlueprintsPage.NAME, BlueprintsPage.class)); map.put(FileManagerPage.class, NavTree.Item.page(FileManagerPage.NAME, FileManagerPage.class)); map.put(MusicPlayerPage.class, NavTree.Item.page(MusicPlayerPage.NAME, MusicPlayerPage.class)); + map.put(OverviewPage.class, NavTree.Item.page(OverviewPage.NAME, OverviewPage.class)); return map; } diff --git a/sampler/src/main/java/atlantafx/sampler/page/showcase/OverviewPage.java b/sampler/src/main/java/atlantafx/sampler/page/showcase/OverviewPage.java new file mode 100755 index 0000000..3e794bf --- /dev/null +++ b/sampler/src/main/java/atlantafx/sampler/page/showcase/OverviewPage.java @@ -0,0 +1,87 @@ +/* SPDX-License-Identifier: MIT */ + +package atlantafx.sampler.page.showcase; + +import static javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED; + +import atlantafx.base.theme.Styles; +import atlantafx.sampler.Resources; +import atlantafx.sampler.page.Page; +import atlantafx.sampler.util.NodeUtils; +import java.io.IOException; +import java.net.URI; +import javafx.fxml.FXMLLoader; +import javafx.geometry.Pos; +import javafx.scene.Node; +import javafx.scene.Parent; +import javafx.scene.control.ScrollPane; +import javafx.scene.layout.Pane; +import javafx.scene.layout.Priority; +import javafx.scene.layout.VBox; +import org.jetbrains.annotations.Nullable; + +public final class OverviewPage extends ScrollPane implements Page { + + public static final String NAME = "Overview"; + private final VBox wrapper; + + @Override + public String getName() { + return NAME; + } + + public OverviewPage() { + super(); + + try { + wrapper = new VBox(); + wrapper.setAlignment(Pos.TOP_CENTER); + wrapper.getStyleClass().add(Styles.BG_DEFAULT); + + var loader = new FXMLLoader( + Resources.getResource("assets/fxml/overview.fxml").toURL() + ); + Parent fxmlContent = loader.load(); + ((Pane) fxmlContent).setMaxWidth(Page.MAX_WIDTH); + VBox.setVgrow(fxmlContent, Priority.ALWAYS); + wrapper.getChildren().setAll(fxmlContent); + + NodeUtils.setScrollConstraints(this, AS_NEEDED, true, AS_NEEDED, true); + setMaxHeight(20_000); + setContent(wrapper); + } catch (IOException e) { + throw new RuntimeException("Unable to load FXML file", e); + } + + setId("blueprints"); + } + + @Override + public Parent getView() { + return this; + } + + @Override + public boolean canDisplaySourceCode() { + return true; + } + + @Override + public boolean canChangeThemeSettings() { + return true; + } + + @Override + public @Nullable URI getJavadocUri() { + return null; + } + + @Override + public Node getSnapshotTarget() { + return wrapper; + } + + @Override + public void reset() { + } +} diff --git a/sampler/src/main/resources/atlantafx/sampler/assets/fxml/overview.fxml b/sampler/src/main/resources/atlantafx/sampler/assets/fxml/overview.fxml new file mode 100644 index 0000000..288f972 --- /dev/null +++ b/sampler/src/main/resources/atlantafx/sampler/assets/fxml/overview.fxml @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +