Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/burningtnt/fix3099/auto-in…
Browse files Browse the repository at this point in the history
…stall-page' into prs
  • Loading branch information
burningtnt committed Jul 22, 2024
2 parents 8755e0e + bd22cb0 commit 3cf721d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ public class InstallerItem extends Control {
private final ObjectProperty<EventHandler<? super MouseEvent>> removeActionProperty = new SimpleObjectProperty<>(this, "removeAction");

public interface State {
IllegalStateException SEALED = new IllegalStateException(
"Interface org.jackhuang.hmcl.ui.InstallerItem.State is sealed, whose implementations should ONLY be: org.jackhuang.hmcl.ui.InstallerItem.InstallableState, org.jackhuang.hmcl.ui.InstallerItem.IncompatibleState and org.jackhuang.hmcl.ui.InstallerItem.InstalledState. Are you adding more implementation?"
);
}

public static final class InstallableState implements State {
Expand All @@ -78,7 +75,6 @@ private InstallableState() {

public static final class IncompatibleState implements State {
private final String incompatibleItemName;

private final String incompatibleItemVersion;

public IncompatibleState(String incompatibleItemName, String incompatibleItemVersion) {
Expand All @@ -97,9 +93,7 @@ public String getIncompatibleItemVersion() {

public static final class InstalledState implements State {
private final String version;

private final boolean external;

private final boolean incompatibleWithGame;

public InstalledState(String version, boolean external, boolean incompatibleWithGame) {
Expand Down Expand Up @@ -172,7 +166,7 @@ public ObjectProperty<InstalledState> versionProperty() {
return versionProperty;
}

public ObjectProperty<State> resolvedStatePropery() {
public ObjectProperty<State> resolvedStateProperty() {
return resolvedStateProperty;
}

Expand Down Expand Up @@ -293,7 +287,7 @@ public InstallerItem[] getLibraries() {
}
}

public static class InstallerItemSkin extends SkinBase<InstallerItem> {
private static final class InstallerItemSkin extends SkinBase<InstallerItem> {
private static final PseudoClass LIST_ITEM = PseudoClass.getPseudoClass("list-item");
private static final PseudoClass CARD = PseudoClass.getPseudoClass("card");
private static final WeakListenerHolder holder = new WeakListenerHolder();
Expand Down Expand Up @@ -356,7 +350,7 @@ public static class InstallerItemSkin extends SkinBase<InstallerItem> {
} else if (state instanceof IncompatibleState) {
return i18n("install.installer.incompatible", i18n("install.installer." + ((IncompatibleState) state).incompatibleItemName));
} else {
throw State.SEALED;
throw new AssertionError("Unknown state type: " + state.getClass());
}
}, control.resolvedStateProperty));
BorderPane.setMargin(statusLabel, new Insets(0, 0, 0, 8));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public InstallersPage(WizardController controller, HMCLGameRepository repository
Controllers.dialog(i18n("install.installer.fabric-api.warning"), i18n("message.warning"), MessageDialogPane.MessageType.WARNING);
}

if (!(library.resolvedStatePropery().get() instanceof InstallerItem.IncompatibleState))
if (!(library.resolvedStateProperty().get() instanceof InstallerItem.IncompatibleState))
controller.onNext(new VersionsPage(controller, i18n("install.installer.choose", i18n("install.installer." + libraryId)), gameVersion, downloadProvider, libraryId, () -> controller.onPrev(false)));
});
library.removeActionProperty().set(e -> {
Expand Down

0 comments on commit 3cf721d

Please sign in to comment.