Skip to content

Commit

Permalink
Have a placeholder in the bottom of LIstPage
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghongxun committed Feb 12, 2019
1 parent 12b47e7 commit b62f949
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/ListPageSkin.java
Expand Up @@ -19,12 +19,13 @@

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXScrollPane;

import javafx.beans.binding.Bindings;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.SkinBase;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import org.jackhuang.hmcl.setting.Theme;
Expand All @@ -36,6 +37,7 @@ public ListPageSkin(ListPage<?> skinnable) {
super(skinnable);

SpinnerPane spinnerPane = new SpinnerPane();
Pane placeholder = new Pane();

StackPane contentPane = new StackPane();
{
Expand All @@ -48,9 +50,12 @@ public ListPageSkin(ListPage<?> skinnable) {
list.setSpacing(10);
list.setPadding(new Insets(10));

VBox content = new VBox();
content.getChildren().setAll(list, placeholder);

Bindings.bindContent(list.getChildren(), skinnable.itemsProperty());

scrollPane.setContent(list);
scrollPane.setContent(content);
JFXScrollPane.smoothScrolling(scrollPane);
}

Expand Down Expand Up @@ -86,7 +91,13 @@ public ListPageSkin(ListPage<?> skinnable) {
});
}

contentPane.getChildren().setAll(scrollPane, vBox);
// Keep a blank space to prevent buttons from blocking up mod items.
BorderPane group = new BorderPane();
group.setPickOnBounds(false);
group.setBottom(vBox);
placeholder.minHeightProperty().bind(vBox.heightProperty());

contentPane.getChildren().setAll(scrollPane, group);
}

spinnerPane.loadingProperty().bind(skinnable.loadingProperty());
Expand Down

0 comments on commit b62f949

Please sign in to comment.