-
Notifications
You must be signed in to change notification settings - Fork 814
使用 JFXListView 显示实例列表 #5174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
使用 JFXListView 显示实例列表 #5174
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
99a45d1
Create GameItem2
Glavo 8381e11
update
Glavo 80f91b6
update
Glavo da6f82d
update
Glavo 23edd96
update
Glavo b4b4146
update
Glavo 625350a
update
Glavo a96c75a
update
Glavo 1b6e82b
update
Glavo a65c108
update
Glavo d22169a
update
Glavo 4014eb7
update
Glavo 1a50fa3
update
Glavo b56e7fb
update
Glavo 5dfb2de
update
Glavo 3477fee
update
Glavo f4230a8
update
Glavo f950c9b
update
Glavo b477d18
update
Glavo 211eda7
update
Glavo 3a81301
update
Glavo df34499
update
Glavo cb7aa8c
update
Glavo ee2e34e
Merge remote-tracking branch 'upstream/main' into game-popup
Glavo db9cf8d
update
Glavo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
HMCL/src/main/java/org/jackhuang/hmcl/ui/ToolbarListPageSkin2.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * Hello Minecraft! Launcher | ||
| * Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package org.jackhuang.hmcl.ui; | ||
|
|
||
| import com.jfoenix.controls.JFXListView; | ||
| import javafx.beans.binding.Bindings; | ||
| import javafx.geometry.Insets; | ||
| import javafx.geometry.Pos; | ||
| import javafx.scene.Node; | ||
| import javafx.scene.control.SkinBase; | ||
| import javafx.scene.layout.HBox; | ||
| import javafx.scene.layout.Priority; | ||
| import javafx.scene.layout.StackPane; | ||
| import org.jackhuang.hmcl.ui.construct.ComponentList; | ||
| import org.jackhuang.hmcl.ui.construct.SpinnerPane; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| // TODO: Replace ToolbarListPageSkin with this class gradually | ||
| public abstract class ToolbarListPageSkin2<E, P extends ListPageBase<E>> extends SkinBase<P> { | ||
|
|
||
| protected final JFXListView<E> listView; | ||
|
|
||
| public ToolbarListPageSkin2(P skinnable) { | ||
| super(skinnable); | ||
|
|
||
| SpinnerPane spinnerPane = new SpinnerPane(); | ||
| spinnerPane.loadingProperty().bind(skinnable.loadingProperty()); | ||
| spinnerPane.failedReasonProperty().bind(skinnable.failedReasonProperty()); | ||
| spinnerPane.onFailedActionProperty().bind(skinnable.onFailedActionProperty()); | ||
| spinnerPane.getStyleClass().add("large-spinner-pane"); | ||
|
|
||
| ComponentList root = new ComponentList(); | ||
| root.getStyleClass().add("no-padding"); | ||
| StackPane.setMargin(root, new Insets(10)); | ||
|
|
||
| List<Node> toolbarButtons = initializeToolbar(skinnable); | ||
| if (!toolbarButtons.isEmpty()) { | ||
| HBox toolbar = new HBox(); | ||
| toolbar.setAlignment(Pos.CENTER_LEFT); | ||
| toolbar.setPickOnBounds(false); | ||
| toolbar.getChildren().setAll(toolbarButtons); | ||
| root.getContent().add(toolbar); | ||
| } | ||
|
|
||
| { | ||
| this.listView = new JFXListView<>(); | ||
| this.listView.setPadding(Insets.EMPTY); | ||
| ComponentList.setVgrow(listView, Priority.ALWAYS); | ||
| Bindings.bindContent(this.listView.getItems(), skinnable.itemsProperty()); | ||
| root.getContent().add(listView); | ||
| } | ||
|
|
||
| spinnerPane.setContent(root); | ||
|
|
||
| getChildren().setAll(spinnerPane); | ||
| } | ||
|
|
||
| protected abstract List<Node> initializeToolbar(P skinnable); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.