Fix not syncing observable list
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.account;
|
|||||||
|
|
||||||
import javafx.beans.property.*;
|
import javafx.beans.property.*;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.control.Control;
|
import javafx.scene.control.Control;
|
||||||
import javafx.scene.control.Skin;
|
import javafx.scene.control.Skin;
|
||||||
import javafx.scene.control.ToggleGroup;
|
import javafx.scene.control.ToggleGroup;
|
||||||
@@ -47,13 +48,16 @@ public class AccountList extends Control implements DecoratorPage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private ToggleGroup toggleGroup;
|
private ToggleGroup toggleGroup;
|
||||||
|
private final ObservableList<AccountListItem> accountItems;
|
||||||
|
|
||||||
public AccountList() {
|
public AccountList() {
|
||||||
toggleGroup = new ToggleGroup();
|
toggleGroup = new ToggleGroup();
|
||||||
|
|
||||||
items.bindContent(MappedObservableList.create(
|
accountItems = MappedObservableList.create(
|
||||||
Accounts.accountsProperty(),
|
Accounts.accountsProperty(),
|
||||||
account -> new AccountListItem(toggleGroup, account)));
|
account -> new AccountListItem(toggleGroup, account));
|
||||||
|
|
||||||
|
items.bindContent(accountItems);
|
||||||
|
|
||||||
selectedAccount.bindBidirectional(Accounts.selectedAccountProperty());
|
selectedAccount.bindBidirectional(Accounts.selectedAccountProperty());
|
||||||
toggleGroup.selectedToggleProperty().addListener((o, a, toggle) -> {
|
toggleGroup.selectedToggleProperty().addListener((o, a, toggle) -> {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.profile;
|
|||||||
|
|
||||||
import javafx.beans.property.*;
|
import javafx.beans.property.*;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.control.Control;
|
import javafx.scene.control.Control;
|
||||||
import javafx.scene.control.Skin;
|
import javafx.scene.control.Skin;
|
||||||
import javafx.scene.control.ToggleGroup;
|
import javafx.scene.control.ToggleGroup;
|
||||||
@@ -47,13 +48,16 @@ public class ProfileList extends Control implements DecoratorPage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private ToggleGroup toggleGroup;
|
private ToggleGroup toggleGroup;
|
||||||
|
private final ObservableList<ProfileListItem> profileItems;
|
||||||
|
|
||||||
public ProfileList() {
|
public ProfileList() {
|
||||||
toggleGroup = new ToggleGroup();
|
toggleGroup = new ToggleGroup();
|
||||||
|
|
||||||
items.bindContent(MappedObservableList.create(
|
profileItems = MappedObservableList.create(
|
||||||
Profiles.profilesProperty(),
|
Profiles.profilesProperty(),
|
||||||
profile -> new ProfileListItem(toggleGroup, profile)));
|
profile -> new ProfileListItem(toggleGroup, profile));
|
||||||
|
|
||||||
|
items.bindContent(profileItems);
|
||||||
|
|
||||||
selectedProfile.bindBidirectional(Profiles.selectedProfileProperty());
|
selectedProfile.bindBidirectional(Profiles.selectedProfileProperty());
|
||||||
toggleGroup.selectedToggleProperty().addListener((o, a, toggle) -> {
|
toggleGroup.selectedToggleProperty().addListener((o, a, toggle) -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user