Merge branch 'javafx' of https://github.com/huanghongxun/HMCL into javafx

This commit is contained in:
huangyuhui
2018-08-14 00:10:48 +08:00
2 changed files with 8 additions and 16 deletions

View File

@@ -27,7 +27,6 @@ import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.setting.Settings; import org.jackhuang.hmcl.setting.Settings;
import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.task.TaskExecutor; import org.jackhuang.hmcl.task.TaskExecutor;
import org.jackhuang.hmcl.ui.construct.DialogCloseEvent;
import org.jackhuang.hmcl.ui.construct.InputDialogPane; import org.jackhuang.hmcl.ui.construct.InputDialogPane;
import org.jackhuang.hmcl.ui.construct.MessageBox; import org.jackhuang.hmcl.ui.construct.MessageBox;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane; import org.jackhuang.hmcl.ui.construct.MessageDialogPane;
@@ -163,15 +162,6 @@ public final class Controllers {
return pane; return pane;
} }
/**
* Use {@link DialogCloseEvent}
*/
public static void closeDialog(Region content) {
if (stage == null) // shut down
return;
decorator.closeDialog(content);
}
public static void navigate(Node node) { public static void navigate(Node node) {
if (decorator.getNowPage() == node) if (decorator.getNowPage() == node)
decorator.showPage(null); decorator.showPage(null);

View File

@@ -615,18 +615,20 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void closeDialog(Node node) { private void closeDialog(Node node) {
FXUtils.checkFxUserThread(); FXUtils.checkFxUserThread();
Optional.ofNullable(node.getProperties().get(PROPERTY_DIALOG_CLOSE_HANDLER)) Optional.ofNullable(node.getProperties().get(PROPERTY_DIALOG_CLOSE_HANDLER))
.ifPresent(handler -> node.removeEventHandler(DialogCloseEvent.CLOSE, (EventHandler<DialogCloseEvent>) handler)); .ifPresent(handler -> node.removeEventHandler(DialogCloseEvent.CLOSE, (EventHandler<DialogCloseEvent>) handler));
dialogPane.pop(node); if (dialog != null) {
dialogPane.pop(node);
if (dialogPane.getChildren().isEmpty()) { if (dialogPane.getChildren().isEmpty()) {
dialog.close(); dialog.close();
dialog = null; dialog = null;
dialogPane = null; dialogPane = null;
}
} }
} }