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) {
// TODO: temp fix
decorator.showDialog(new Region());
return decorator.showDialog(content);
}
@@ -126,8 +128,8 @@ public final class Controllers {
dialog(new MessageDialogPane(text, title, decorator.getDialog(), type, onAccept));
}
public static void confirmDialog(String text, String title, Runnable onAccept, Runnable onCacnel) {
dialog(new MessageDialogPane(text, title, decorator.getDialog(), onAccept, onCacnel));
public static void confirmDialog(String text, String title, Runnable onAccept, Runnable onCancel) {
dialog(new MessageDialogPane(text, title, decorator.getDialog(), onAccept, onCancel));
}
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();
});
drawerWrapper.getChildren().remove(dialog);
dialog.setDialogContainer(drawerWrapper);
dialog.setOnDialogClosed(e -> dialogShown = false);
dialog.setOnDialogOpened(e -> dialogShown = true);

View File

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

View File

@@ -95,6 +95,11 @@
-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 {
-fx-font-size: 14.0px;
-fx-pref-width: 400.0px;

View File

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

View File

@@ -28,7 +28,7 @@
</VBox>
</center>
<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" />
</HBox>
</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.choose_bgpath=Choose background path.
launcher.choose_commonpath=Choose common path.
launcher.common_location=Common Location
launcher.common_location=Common Directory
launcher.contact=Contact Us
launcher.crash=Hello Minecraft! Launcher has crashed!
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;
}
@Override
public Scheduler getScheduler() {
return Schedulers.io();
}
public EventManager<FailedEvent<URL>> getOnFailed() {
return onFailed;
}