Temporarily fix spacing missing. Closes #264

This commit is contained in:
huangyuhui
2018-02-05 00:23:58 +08:00
parent 228fddf902
commit 3abb96e5b9
8 changed files with 36 additions and 27 deletions

View File

@@ -107,6 +107,8 @@ public final class Controllers {
} }
public static JFXDialog dialog(Region content) { public static JFXDialog dialog(Region content) {
// TODO: temp fix
decorator.showDialog(new Region());
return decorator.showDialog(content); return decorator.showDialog(content);
} }
@@ -126,8 +128,8 @@ public final class Controllers {
dialog(new MessageDialogPane(text, title, decorator.getDialog(), type, onAccept)); dialog(new MessageDialogPane(text, title, decorator.getDialog(), type, onAccept));
} }
public static void confirmDialog(String text, String title, Runnable onAccept, Runnable onCacnel) { public static void confirmDialog(String text, String title, Runnable onAccept, Runnable onCancel) {
dialog(new MessageDialogPane(text, title, decorator.getDialog(), onAccept, onCacnel)); dialog(new MessageDialogPane(text, title, decorator.getDialog(), onAccept, onCancel));
} }
public static void inputDialog(String text, Consumer<String> onResult) { public static void inputDialog(String text, Consumer<String> onResult) {

View File

@@ -149,7 +149,6 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
btnMax.fire(); btnMax.fire();
}); });
drawerWrapper.getChildren().remove(dialog);
dialog.setDialogContainer(drawerWrapper); dialog.setDialogContainer(drawerWrapper);
dialog.setOnDialogClosed(e -> dialogShown = false); dialog.setOnDialogClosed(e -> dialogShown = false);
dialog.setOnDialogOpened(e -> dialogShown = true); dialog.setOnDialogOpened(e -> dialogShown = true);

View File

@@ -30,9 +30,6 @@ import org.jackhuang.hmcl.ui.SVG;
import java.util.Optional; import java.util.Optional;
public final class MessageDialogPane extends StackPane { public final class MessageDialogPane extends StackPane {
private final String text;
private final JFXDialog dialog;
private boolean closingDialog = true; private boolean closingDialog = true;
@FXML @FXML
@@ -49,9 +46,6 @@ public final class MessageDialogPane extends StackPane {
private HBox actions; private HBox actions;
public MessageDialogPane(String text, String title, JFXDialog dialog, int type, Runnable onAccept) { public MessageDialogPane(String text, String title, JFXDialog dialog, int type, Runnable onAccept) {
this.text = text;
this.dialog = dialog;
FXUtils.loadFXML(this, "/assets/fxml/message-dialog.fxml"); FXUtils.loadFXML(this, "/assets/fxml/message-dialog.fxml");
if (title != null) if (title != null)
@@ -64,7 +58,7 @@ public final class MessageDialogPane extends StackPane {
Optional.ofNullable(onAccept).ifPresent(Runnable::run); Optional.ofNullable(onAccept).ifPresent(Runnable::run);
}); });
//actions.getChildren().remove(cancelButton); actions.getChildren().remove(cancelButton);
switch (type) { switch (type) {
case MessageBox.INFORMATION_MESSAGE: case MessageBox.INFORMATION_MESSAGE:
@@ -98,7 +92,7 @@ public final class MessageDialogPane extends StackPane {
acceptButton.setText(Main.i18n("button.yes")); acceptButton.setText(Main.i18n("button.yes"));
cancelButton.setText(Main.i18n("button.no")); cancelButton.setText(Main.i18n("button.no"));
//actions.getChildren().add(cancelButton); actions.getChildren().add(cancelButton);
} }
public void disableClosingDialog() { public void disableClosingDialog() {

View File

@@ -95,6 +95,11 @@
-fx-padding: 5.0 0.0 5.0 0.0; -fx-padding: 5.0 0.0 5.0 0.0;
} }
.jfx-layout-body {
-fx-pref-width: 400px;
-fx-wrap-text: true;
}
.jfx-layout-body .label { .jfx-layout-body .label {
-fx-font-size: 14.0px; -fx-font-size: 14.0px;
-fx-pref-width: 400.0px; -fx-pref-width: 400.0px;

View File

@@ -5,24 +5,28 @@
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import java.lang.String?>
<fx:root xmlns="http://javafx.com/javafx" <fx:root xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
type="StackPane"> type="StackPane">
<HBox spacing="8"> <HBox spacing="8" styleClass="jfx-dialog-layout">
<Label fx:id="graphic" translateX="34" translateY="34" minWidth="40" maxWidth="40" minHeight="40" maxHeight="40" /> <Label fx:id="graphic" translateX="10" translateY="10" minWidth="40" maxWidth="40" minHeight="40" maxHeight="40" />
<JFXDialogLayout> <VBox HBox.hgrow="ALWAYS">
<heading> <StackPane>
<styleClass>
<String fx:value="jfx-layout-heading" />
<String fx:value="title" />
</styleClass>
<Label fx:id="title" text="%message.info" /> <Label fx:id="title" text="%message.info" />
</heading> </StackPane>
<body> <StackPane styleClass="jfx-layout-body">
<Label fx:id="content" wrapText="true" /> <Label fx:id="content" wrapText="true" />
</body> </StackPane>
<actions> <HBox fx:id="actions" styleClass="jfx-layout-actions">
<HBox fx:id="actions" alignment="CENTER_RIGHT"> <JFXButton fx:id="acceptButton" styleClass="dialog-accept" text="%button.ok" />
<JFXButton fx:id="acceptButton" styleClass="dialog-accept" text="%button.ok" /> <JFXButton fx:id="cancelButton" visible="false" styleClass="dialog-cancel" text="%button.cancel" />
<JFXButton fx:id="cancelButton" visible="false" styleClass="dialog-cancel" text="%button.cancel" /> </HBox>
</HBox> </VBox>
</actions>
</JFXDialogLayout>
</HBox> </HBox>
</fx:root> </fx:root>

View File

@@ -28,7 +28,7 @@
</VBox> </VBox>
</center> </center>
<bottom> <bottom>
<HBox alignment="CENTER_RIGHT" style="-fx-padding: 8px;"> <HBox alignment="CENTER_RIGHT" style="-fx-padding: 0 8px 8px 0;">
<JFXButton fx:id="btnCancel" text="%button.cancel" /> <JFXButton fx:id="btnCancel" text="%button.cancel" />
</HBox> </HBox>
</bottom> </bottom>

View File

@@ -166,7 +166,7 @@ launcher.background_location=Background Location
launcher.background_tooltip=The laucher uses a default background.\nIf you use custom background.png, link it and it will be used.\nIf there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.\nIf you set the background setting, this app will use it. launcher.background_tooltip=The laucher uses a default background.\nIf you use custom background.png, link it and it will be used.\nIf there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.\nIf you set the background setting, this app will use it.
launcher.choose_bgpath=Choose background path. launcher.choose_bgpath=Choose background path.
launcher.choose_commonpath=Choose common path. launcher.choose_commonpath=Choose common path.
launcher.common_location=Common Location launcher.common_location=Common Directory
launcher.contact=Contact Us launcher.contact=Contact Us
launcher.crash=Hello Minecraft! Launcher has crashed! launcher.crash=Hello Minecraft! Launcher has crashed!
launcher.crash_out_dated=Hello Minecraft! Launcher has crashed! Your launcher is outdated. Update it! launcher.crash_out_dated=Hello Minecraft! Launcher has crashed! Your launcher is outdated. Update it!

View File

@@ -99,6 +99,11 @@ public class FileDownloadTask extends Task {
stream = null; stream = null;
} }
@Override
public Scheduler getScheduler() {
return Schedulers.io();
}
public EventManager<FailedEvent<URL>> getOnFailed() { public EventManager<FailedEvent<URL>> getOnFailed() {
return onFailed; return onFailed;
} }