mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-01-24 14:34:15 +08:00
清理编译警告 (#2148)
This commit is contained in:
parent
9a4286620f
commit
d71815aa3d
@ -625,16 +625,17 @@ public final class FXUtils {
|
|||||||
* @param comboBox the combo box being bound with {@code property}.
|
* @param comboBox the combo box being bound with {@code property}.
|
||||||
* @param property the property being bound with {@code combo box}.
|
* @param property the property being bound with {@code combo box}.
|
||||||
* @see #unbindEnum(JFXComboBox)
|
* @see #unbindEnum(JFXComboBox)
|
||||||
* @deprecated Use {@link ExtendedProperties#selectedItemPropertyFor(ComboBox)}
|
* @see ExtendedProperties#selectedItemPropertyFor(ComboBox)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
public static <T extends Enum<T>> void bindEnum(JFXComboBox<T> comboBox, Property<T> property) {
|
||||||
@Deprecated
|
|
||||||
public static void bindEnum(JFXComboBox<?> comboBox, Property<? extends Enum<?>> property) {
|
|
||||||
unbindEnum(comboBox);
|
unbindEnum(comboBox);
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
ChangeListener<Number> listener = (a, b, newValue) ->
|
T currentValue = property.getValue();
|
||||||
((Property) property).setValue(property.getValue().getClass().getEnumConstants()[newValue.intValue()]);
|
@SuppressWarnings("unchecked")
|
||||||
comboBox.getSelectionModel().select(property.getValue().ordinal());
|
T[] enumConstants = (T[]) currentValue.getClass().getEnumConstants();
|
||||||
|
ChangeListener<Number> listener = (a, b, newValue) -> property.setValue(enumConstants[newValue.intValue()]);
|
||||||
|
|
||||||
|
comboBox.getSelectionModel().select(currentValue.ordinal());
|
||||||
comboBox.getProperties().put("FXUtils.bindEnum.listener", listener);
|
comboBox.getProperties().put("FXUtils.bindEnum.listener", listener);
|
||||||
comboBox.getSelectionModel().selectedIndexProperty().addListener(listener);
|
comboBox.getSelectionModel().selectedIndexProperty().addListener(listener);
|
||||||
}
|
}
|
||||||
@ -645,15 +646,13 @@ public final class FXUtils {
|
|||||||
*
|
*
|
||||||
* @param comboBox the combo box being bound with the property which can be inferred by {@code bindEnum}.
|
* @param comboBox the combo box being bound with the property which can be inferred by {@code bindEnum}.
|
||||||
* @see #bindEnum(JFXComboBox, Property)
|
* @see #bindEnum(JFXComboBox, Property)
|
||||||
* @deprecated Use {@link ExtendedProperties#selectedItemPropertyFor(ComboBox)}
|
* @see ExtendedProperties#selectedItemPropertyFor(ComboBox)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
public static void unbindEnum(JFXComboBox<? extends Enum<?>> comboBox) {
|
||||||
@Deprecated
|
@SuppressWarnings("unchecked")
|
||||||
public static void unbindEnum(JFXComboBox<?> comboBox) {
|
ChangeListener<Number> listener = (ChangeListener<Number>) comboBox.getProperties().remove("FXUtils.bindEnum.listener");
|
||||||
@SuppressWarnings("rawtypes")
|
if (listener != null)
|
||||||
ChangeListener listener = tryCast(comboBox.getProperties().get("FXUtils.bindEnum.listener"), ChangeListener.class).orElse(null);
|
comboBox.getSelectionModel().selectedIndexProperty().removeListener(listener);
|
||||||
if (listener == null) return;
|
|
||||||
comboBox.getSelectionModel().selectedIndexProperty().removeListener(listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,7 +204,6 @@ public final class AdvancedVersionSettingPage extends StackPane implements Decor
|
|||||||
bindProperties();
|
bindProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
void bindProperties() {
|
void bindProperties() {
|
||||||
nativesDirCustomOption.bindBidirectional(versionSetting.nativesDirProperty());
|
nativesDirCustomOption.bindBidirectional(versionSetting.nativesDirProperty());
|
||||||
FXUtils.bindString(txtJVMArgs, versionSetting.javaArgsProperty());
|
FXUtils.bindString(txtJVMArgs, versionSetting.javaArgsProperty());
|
||||||
|
Loading…
Reference in New Issue
Block a user