From fa7e03207e99b3bd42e872521730cc740e29e80e Mon Sep 17 00:00:00 2001 From: Dirk Lemmermann Date: Wed, 28 Aug 2024 16:45:34 +0200 Subject: [PATCH] Added initial support for a drawer control. --- .../mobile/pages/MobileHomePage.java | 17 ++++------------- .../com/dlsc/jfxcentral2/mobile/mobile.css | 6 +----- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/mobile/src/main/java/com/dlsc/jfxcentral2/mobile/pages/MobileHomePage.java b/mobile/src/main/java/com/dlsc/jfxcentral2/mobile/pages/MobileHomePage.java index e68a1dd0..11935c11 100644 --- a/mobile/src/main/java/com/dlsc/jfxcentral2/mobile/pages/MobileHomePage.java +++ b/mobile/src/main/java/com/dlsc/jfxcentral2/mobile/pages/MobileHomePage.java @@ -173,19 +173,20 @@ private Node createDrawerContent() { ToggleButton title = new ToggleButton("Content"); title.setMaxWidth(Double.MAX_VALUE); title.getStyleClass().add("title"); - title.selectedProperty().bindBidirectional(showDrawerProperty()); + + final int HEIGHT = 200; CategoriesPane content = new CategoriesPane(); content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); content.setAlignment(Pos.CENTER); + content.setPrefHeight(HEIGHT); VBox.setVgrow(content, Priority.ALWAYS); VBox drawer = new VBox(title, content); drawer.getStyleClass().add("drawer"); - drawer.setPrefHeight(300); drawer.setMaxHeight(Region.USE_PREF_SIZE); - drawer.translateYProperty().bind(Bindings.createDoubleBinding(() -> isShowDrawer() ? 0d : drawer.getHeight() - title.getHeight(), showDrawer)); + drawer.translateYProperty().bind(Bindings.createDoubleBinding(() -> title.isSelected() ? 0d: HEIGHT, title.selectedProperty())); Rectangle clip = new Rectangle(); clip.widthProperty().bind(drawer.widthProperty()); @@ -196,16 +197,6 @@ private Node createDrawerContent() { return drawer; } - private final BooleanProperty showDrawer = new SimpleBooleanProperty(this, "showDrawer", true); - - public boolean isShowDrawer() { - return showDrawer.get(); - } - - public BooleanProperty showDrawerProperty() { - return showDrawer; - } - private List getRandomSample(List list, int sampleSize) { if (sampleSize > list.size()) { throw new IllegalArgumentException("Sample size must be less than or equal to the size of the list"); diff --git a/mobile/src/main/resources/com/dlsc/jfxcentral2/mobile/mobile.css b/mobile/src/main/resources/com/dlsc/jfxcentral2/mobile/mobile.css index 09153233..f7028897 100644 --- a/mobile/src/main/resources/com/dlsc/jfxcentral2/mobile/mobile.css +++ b/mobile/src/main/resources/com/dlsc/jfxcentral2/mobile/mobile.css @@ -590,7 +590,7 @@ */ .mobile-search-text-field { -fx-background-radius: 1000px; - -fx-padding: 5px 10px; + -fx-padding: 6px 10px; } .mobile-search-text-field > .ikonli-font-icon { @@ -939,10 +939,6 @@ -fx-background-color: -white; } -.model-list-view .search-wrapper .search-text-field .left-pane { - -fx-padding: 8px; -} - .model-list-view .list-view .model-list-cell { -fx-cell-size: 80px; -fx-padding: 10px 5px;