|
|
@ -31,7 +31,6 @@ import javafx.stage.DirectoryChooser;
|
|
|
|
import javafx.stage.Modality;
|
|
|
|
import javafx.stage.Modality;
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
import javafx.stage.WindowEvent;
|
|
|
|
import javafx.stage.WindowEvent;
|
|
|
|
import javafx.util.Callback;
|
|
|
|
|
|
|
|
import xyz.wbsite.dbtool.Application;
|
|
|
|
import xyz.wbsite.dbtool.Application;
|
|
|
|
import xyz.wbsite.dbtool.javafx.JavaFxApplication;
|
|
|
|
import xyz.wbsite.dbtool.javafx.JavaFxApplication;
|
|
|
|
import xyz.wbsite.dbtool.javafx.ctrl.ConnectInfoController;
|
|
|
|
import xyz.wbsite.dbtool.javafx.ctrl.ConnectInfoController;
|
|
|
@ -49,6 +48,7 @@ import xyz.wbsite.dbtool.javafx.po.Field;
|
|
|
|
import xyz.wbsite.dbtool.javafx.po.Module;
|
|
|
|
import xyz.wbsite.dbtool.javafx.po.Module;
|
|
|
|
import xyz.wbsite.dbtool.javafx.po.SelectItem;
|
|
|
|
import xyz.wbsite.dbtool.javafx.po.SelectItem;
|
|
|
|
import xyz.wbsite.dbtool.javafx.po.VueOption;
|
|
|
|
import xyz.wbsite.dbtool.javafx.po.VueOption;
|
|
|
|
|
|
|
|
import xyz.wbsite.dbtool.web.frame.utils.StringUtil;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
@ -139,9 +139,11 @@ public class Dialog {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
|
|
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
|
|
|
alert.setTitle("错误");
|
|
|
|
alert.setTitle("错误");
|
|
|
|
|
|
|
|
alert.setX(JavaFxApplication.primaryStage.getX() + JavaFxApplication.primaryStage.getWidth() / 2 - 213);
|
|
|
|
|
|
|
|
alert.setY(JavaFxApplication.primaryStage.getY() + JavaFxApplication.primaryStage.getHeight() / 2 - 70);
|
|
|
|
alert.setHeaderText("");
|
|
|
|
alert.setHeaderText("");
|
|
|
|
alert.setContentText(message);
|
|
|
|
alert.setContentText(message);
|
|
|
|
alert.showAndWait();
|
|
|
|
alert.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -151,55 +153,66 @@ public class Dialog {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
|
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
|
|
alert.setTitle("消息");
|
|
|
|
alert.setTitle("消息");
|
|
|
|
|
|
|
|
alert.setX(JavaFxApplication.primaryStage.getX() + JavaFxApplication.primaryStage.getWidth() / 2 - 213);
|
|
|
|
|
|
|
|
alert.setY(JavaFxApplication.primaryStage.getY() + JavaFxApplication.primaryStage.getHeight() / 2 - 70);
|
|
|
|
alert.setHeaderText("");
|
|
|
|
alert.setHeaderText("");
|
|
|
|
alert.setContentText(message);
|
|
|
|
alert.setContentText(message);
|
|
|
|
alert.showAndWait();
|
|
|
|
alert.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void showProgress(String message) {
|
|
|
|
private static javafx.scene.control.Dialog dialog = null;
|
|
|
|
if (popup != null) {
|
|
|
|
|
|
|
|
popup.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
popup = new Stage();
|
|
|
|
|
|
|
|
popup.setAlwaysOnTop(true);
|
|
|
|
|
|
|
|
popup.initModality(Modality.APPLICATION_MODAL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProgressIndicator indicator = new ProgressIndicator();
|
|
|
|
|
|
|
|
indicator.setPrefSize(30, 30);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VBox root = new VBox();
|
|
|
|
public static void showWait(String message) {
|
|
|
|
root.setPadding(new Insets(50, 80, 50, 80));
|
|
|
|
if (dialog == null) {
|
|
|
|
root.setAlignment(Pos.BASELINE_CENTER);
|
|
|
|
dialog = new javafx.scene.control.Dialog();
|
|
|
|
root.setSpacing(10);
|
|
|
|
dialog.setTitle("提示");
|
|
|
|
|
|
|
|
dialog.setResult("1");
|
|
|
|
|
|
|
|
dialog.setX(JavaFxApplication.primaryStage.getX() + JavaFxApplication.primaryStage.getWidth() / 2 - 68);
|
|
|
|
|
|
|
|
dialog.setY(JavaFxApplication.primaryStage.getY() + JavaFxApplication.primaryStage.getHeight() / 2 - 70);
|
|
|
|
|
|
|
|
|
|
|
|
Label label = new Label(message);
|
|
|
|
GridPane gridPane = new GridPane();
|
|
|
|
root.getChildren().addAll(indicator, label);
|
|
|
|
gridPane.setPrefWidth(200);
|
|
|
|
Scene scene = new Scene(root);
|
|
|
|
gridPane.setHgap(10);
|
|
|
|
|
|
|
|
gridPane.setVgap(10);
|
|
|
|
|
|
|
|
gridPane.setAlignment(Pos.CENTER);
|
|
|
|
|
|
|
|
gridPane.setPadding(new Insets(10, 10, 10, 10));
|
|
|
|
|
|
|
|
dialog.getDialogPane().setContent(gridPane);
|
|
|
|
|
|
|
|
|
|
|
|
popup.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
|
|
|
ProgressIndicator indicator = new ProgressIndicator();
|
|
|
|
@Override
|
|
|
|
indicator.setPrefSize(30, 30);
|
|
|
|
public void handle(WindowEvent event) {
|
|
|
|
gridPane.add(indicator, 0, 0);
|
|
|
|
event.consume();
|
|
|
|
gridPane.add(new Label(message), 0, 1);
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
popup.setScene(scene);
|
|
|
|
|
|
|
|
popup.setTitle("提示");
|
|
|
|
|
|
|
|
popup.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void stopPopup() {
|
|
|
|
public static void stopWait() {
|
|
|
|
if (popup != null) {
|
|
|
|
if (dialog != null) {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
popup.close();
|
|
|
|
dialog.close();
|
|
|
|
|
|
|
|
dialog = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void showDirectoryChooser(File file, DirectoryCall call) {
|
|
|
|
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
|
|
|
|
directoryChooser.setInitialDirectory(file);
|
|
|
|
|
|
|
|
Stage stage = new Stage();
|
|
|
|
|
|
|
|
stage.setX(JavaFxApplication.primaryStage.getX());
|
|
|
|
|
|
|
|
stage.setY(JavaFxApplication.primaryStage.getY());
|
|
|
|
|
|
|
|
File file_ = directoryChooser.showDialog(stage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (file_ != null && call != null) {
|
|
|
|
|
|
|
|
call.call(file_);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void showDBConnectInput() {
|
|
|
|
public static void showDBConnectInput() {
|
|
|
|
Stage stage = new Stage();
|
|
|
|
Stage stage = new Stage();
|
|
|
|
stage.setAlwaysOnTop(true);
|
|
|
|
stage.setAlwaysOnTop(true);
|
|
|
@ -301,7 +314,7 @@ public class Dialog {
|
|
|
|
map.put("password", password);
|
|
|
|
map.put("password", password);
|
|
|
|
map.put("driverClassName", driver);
|
|
|
|
map.put("driverClassName", driver);
|
|
|
|
|
|
|
|
|
|
|
|
Dialog.showProgress("加载中,请稍等...");
|
|
|
|
Dialog.showWait("加载中,请稍等...");
|
|
|
|
new Thread() {
|
|
|
|
new Thread() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
@ -309,7 +322,7 @@ public class Dialog {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Dialog.stopPopup();
|
|
|
|
Dialog.stopWait();
|
|
|
|
stage.close();
|
|
|
|
stage.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -353,19 +366,14 @@ public class Dialog {
|
|
|
|
controller.getSelectModulePath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getSelectModulePath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
Dialog.showDirectoryChooser(null, new Dialog.DirectoryCall() {
|
|
|
|
Stage stage = new Stage();
|
|
|
|
@Override
|
|
|
|
stage.setAlwaysOnTop(true);
|
|
|
|
public void call(File result) {
|
|
|
|
File file = directoryChooser.showDialog(stage);
|
|
|
|
modulePath.setText(result.getAbsolutePath());
|
|
|
|
|
|
|
|
|
|
|
|
if (file == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
modulePath.setText(file.getAbsolutePath());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String projectName = "";
|
|
|
|
String projectName = "";
|
|
|
|
// 尝试查找Windows下的项目名称
|
|
|
|
// 尝试查找Windows下的项目名称
|
|
|
|
String path = file.getAbsolutePath();
|
|
|
|
String path = result.getAbsolutePath();
|
|
|
|
String pathReplace = Tool.replaceSeparator(path, "#");
|
|
|
|
String pathReplace = Tool.replaceSeparator(path, "#");
|
|
|
|
Pattern compile = Pattern.compile("#([^#]*)#src#main#java#");
|
|
|
|
Pattern compile = Pattern.compile("#([^#]*)#src#main#java#");
|
|
|
|
Matcher matcher = compile.matcher(pathReplace);
|
|
|
|
Matcher matcher = compile.matcher(pathReplace);
|
|
|
@ -376,22 +384,22 @@ public class Dialog {
|
|
|
|
apiPath.setText(new File(ProjectManager.getPath(), projectName + "-api").getAbsolutePath());
|
|
|
|
apiPath.setText(new File(ProjectManager.getPath(), projectName + "-api").getAbsolutePath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
controller.getSelectSdkPath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getSelectSdkPath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
Dialog.showDirectoryChooser(null, new Dialog.DirectoryCall() {
|
|
|
|
Stage stage = new Stage();
|
|
|
|
@Override
|
|
|
|
File file = directoryChooser.showDialog(stage);
|
|
|
|
public void call(File result) {
|
|
|
|
|
|
|
|
|
|
|
|
if (file == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String text = modulePath.getText();
|
|
|
|
String text = modulePath.getText();
|
|
|
|
File moduleFile = new File(text);
|
|
|
|
File moduleFile = new File(text);
|
|
|
|
|
|
|
|
|
|
|
|
apiPath.setText(new File(file.getAbsolutePath(), moduleFile.getName() + "-api").getAbsolutePath());
|
|
|
|
apiPath.setText(new File(result.getAbsolutePath(), moduleFile.getName() + "-api").getAbsolutePath());
|
|
|
|
System.out.println(file.getAbsolutePath());
|
|
|
|
System.out.println(result.getAbsolutePath());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -442,12 +450,12 @@ public class Dialog {
|
|
|
|
modulePath.textProperty().addListener(new ChangeListener<String>() {
|
|
|
|
modulePath.textProperty().addListener(new ChangeListener<String>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
|
|
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
|
|
|
Dialog.showProgress("初始化面板");
|
|
|
|
Dialog.showWait("初始化面板");
|
|
|
|
Callable<Object> callable = Executors.callable(new Runnable() {
|
|
|
|
Callable<Object> callable = Executors.callable(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
controller.load();
|
|
|
|
controller.load();
|
|
|
|
Dialog.stopPopup();
|
|
|
|
Dialog.stopWait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Executors.newSingleThreadExecutor().submit(callable);
|
|
|
|
Executors.newSingleThreadExecutor().submit(callable);
|
|
|
@ -481,9 +489,9 @@ public class Dialog {
|
|
|
|
String api = controller.getApiPath().getText();
|
|
|
|
String api = controller.getApiPath().getText();
|
|
|
|
|
|
|
|
|
|
|
|
if (new File(module).exists()) {
|
|
|
|
if (new File(module).exists()) {
|
|
|
|
Dialog.showProgress("生成中...");
|
|
|
|
Dialog.showWait("生成中...");
|
|
|
|
dBmanger.generateApi(new File(module), new File(api), controller.getDomainList(), controller.getData());
|
|
|
|
dBmanger.generateApi(new File(module), new File(api), controller.getDomainList(), controller.getData());
|
|
|
|
Dialog.stopPopup();
|
|
|
|
Dialog.stopWait();
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
@ -531,19 +539,14 @@ public class Dialog {
|
|
|
|
controller.getSelectModulePath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getSelectModulePath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
Dialog.showDirectoryChooser(null, new Dialog.DirectoryCall() {
|
|
|
|
Stage stage = new Stage();
|
|
|
|
@Override
|
|
|
|
stage.setAlwaysOnTop(true);
|
|
|
|
public void call(File result) {
|
|
|
|
File file = directoryChooser.showDialog(stage);
|
|
|
|
modulePath.setText(result.getAbsolutePath());
|
|
|
|
|
|
|
|
|
|
|
|
if (file == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
modulePath.setText(file.getAbsolutePath());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String projectName = "";
|
|
|
|
String projectName = "";
|
|
|
|
// 尝试查找Windows下的项目名称
|
|
|
|
// 尝试查找Windows下的项目名称
|
|
|
|
String path = file.getAbsolutePath();
|
|
|
|
String path = result.getAbsolutePath();
|
|
|
|
String pathReplace = Tool.replaceSeparator(path, "#");
|
|
|
|
String pathReplace = Tool.replaceSeparator(path, "#");
|
|
|
|
Pattern compile = Pattern.compile("#([^#]*)#src#main#java#");
|
|
|
|
Pattern compile = Pattern.compile("#([^#]*)#src#main#java#");
|
|
|
|
Matcher matcher = compile.matcher(pathReplace);
|
|
|
|
Matcher matcher = compile.matcher(pathReplace);
|
|
|
@ -554,22 +557,22 @@ public class Dialog {
|
|
|
|
docPath.setText(new File(ProjectManager.getPath(), projectName + "-doc").getAbsolutePath());
|
|
|
|
docPath.setText(new File(ProjectManager.getPath(), projectName + "-doc").getAbsolutePath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
controller.getSelectDocPath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getSelectDocPath().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
Dialog.showDirectoryChooser(null, new Dialog.DirectoryCall() {
|
|
|
|
Stage stage = new Stage();
|
|
|
|
@Override
|
|
|
|
File file = directoryChooser.showDialog(stage);
|
|
|
|
public void call(File result) {
|
|
|
|
|
|
|
|
|
|
|
|
if (file == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String text = modulePath.getText();
|
|
|
|
String text = modulePath.getText();
|
|
|
|
File moduleFile = new File(text);
|
|
|
|
File moduleFile = new File(text);
|
|
|
|
|
|
|
|
|
|
|
|
docPath.setText(new File(file.getAbsolutePath(), moduleFile.getName() + "-doc").getAbsolutePath());
|
|
|
|
docPath.setText(new File(result.getAbsolutePath(), moduleFile.getName() + "-doc").getAbsolutePath());
|
|
|
|
System.out.println(file.getAbsolutePath());
|
|
|
|
System.out.println(result.getAbsolutePath());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -601,12 +604,12 @@ public class Dialog {
|
|
|
|
modulePath.textProperty().addListener(new ChangeListener<String>() {
|
|
|
|
modulePath.textProperty().addListener(new ChangeListener<String>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
|
|
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
|
|
|
Dialog.showProgress("初始化面板");
|
|
|
|
Dialog.showWait("初始化面板");
|
|
|
|
Callable<Object> callable = Executors.callable(new Runnable() {
|
|
|
|
Callable<Object> callable = Executors.callable(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
controller.load();
|
|
|
|
controller.load();
|
|
|
|
Dialog.stopPopup();
|
|
|
|
Dialog.stopWait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Executors.newSingleThreadExecutor().submit(callable);
|
|
|
|
Executors.newSingleThreadExecutor().submit(callable);
|
|
|
@ -640,9 +643,9 @@ public class Dialog {
|
|
|
|
String api = controller.getDocPath().getText();
|
|
|
|
String api = controller.getDocPath().getText();
|
|
|
|
|
|
|
|
|
|
|
|
if (new File(module).exists()) {
|
|
|
|
if (new File(module).exists()) {
|
|
|
|
Dialog.showProgress("生成中...");
|
|
|
|
Dialog.showWait("生成中...");
|
|
|
|
dBmanger.generateDoc(new File(module), new File(api), controller.getData());
|
|
|
|
dBmanger.generateDoc(new File(module), new File(api), controller.getData());
|
|
|
|
Dialog.stopPopup();
|
|
|
|
Dialog.stopWait();
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
@ -714,7 +717,7 @@ public class Dialog {
|
|
|
|
start.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
start.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
Dialog.stopPopup();
|
|
|
|
Dialog.stopWait();
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
@ -752,33 +755,25 @@ public class Dialog {
|
|
|
|
controller.getCancel().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getCancel().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
stopPopup();
|
|
|
|
stopWait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
controller.getOk().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getOk().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
ProjectManager dBmanger = ManagerFactory.getProjectManager();
|
|
|
|
ProjectManager dBmanger = ManagerFactory.getProjectManager();
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
Dialog.showDirectoryChooser(dBmanger.getPath(), new Dialog.DirectoryCall() {
|
|
|
|
directoryChooser.setInitialDirectory(dBmanger.getPath());
|
|
|
|
@Override
|
|
|
|
Stage stage = new Stage();
|
|
|
|
public void call(File result) {
|
|
|
|
File file = directoryChooser.showDialog(stage);
|
|
|
|
System.out.println("生成目录:" + result.getAbsolutePath());
|
|
|
|
if (file != null) {
|
|
|
|
|
|
|
|
System.out.println("生成目录:" + file.getAbsolutePath());
|
|
|
|
|
|
|
|
AndroidOption androidOption = new AndroidOption();
|
|
|
|
AndroidOption androidOption = new AndroidOption();
|
|
|
|
androidOption.projectName = controller.getName().getText();
|
|
|
|
androidOption.projectName = controller.getName().getText();
|
|
|
|
androidOption.packages = controller.getPackages().getText();
|
|
|
|
androidOption.packages = controller.getPackages().getText();
|
|
|
|
androidOption.domain = controller.getDomain().getText();
|
|
|
|
androidOption.domain = controller.getDomain().getText();
|
|
|
|
|
|
|
|
dBmanger.generate(result.getAbsolutePath(), androidOption);
|
|
|
|
dBmanger.generate(file.getAbsolutePath(), androidOption);
|
|
|
|
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
stage.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
popup = new Stage();
|
|
|
|
popup = new Stage();
|
|
|
@ -789,7 +784,7 @@ public class Dialog {
|
|
|
|
popup.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
|
|
|
popup.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(WindowEvent event) {
|
|
|
|
public void handle(WindowEvent event) {
|
|
|
|
stopPopup();
|
|
|
|
stopWait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
popup.setScene(scene);
|
|
|
|
popup.setScene(scene);
|
|
|
@ -810,32 +805,25 @@ public class Dialog {
|
|
|
|
controller.getCancel().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getCancel().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
stopPopup();
|
|
|
|
stopWait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
controller.getOk().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
controller.getOk().setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
ProjectManager dBmanger = ManagerFactory.getProjectManager();
|
|
|
|
ProjectManager dBmanger = ManagerFactory.getProjectManager();
|
|
|
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
|
|
|
Dialog.showDirectoryChooser(null, new Dialog.DirectoryCall() {
|
|
|
|
directoryChooser.setInitialDirectory(dBmanger.getPath());
|
|
|
|
@Override
|
|
|
|
Stage stage = new Stage();
|
|
|
|
public void call(File result) {
|
|
|
|
File file = directoryChooser.showDialog(stage);
|
|
|
|
System.out.println("生成目录:" + result.getAbsolutePath());
|
|
|
|
if (file != null) {
|
|
|
|
|
|
|
|
System.out.println("生成目录:" + file.getAbsolutePath());
|
|
|
|
|
|
|
|
VueOption vueOption = new VueOption();
|
|
|
|
VueOption vueOption = new VueOption();
|
|
|
|
ToggleGroup type = controller.getType();
|
|
|
|
ToggleGroup type = controller.getType();
|
|
|
|
RadioButton value = (RadioButton) type.selectedToggleProperty().getValue();
|
|
|
|
RadioButton value = (RadioButton) type.selectedToggleProperty().getValue();
|
|
|
|
vueOption.type = value.textProperty().getValue();
|
|
|
|
vueOption.type = value.textProperty().getValue();
|
|
|
|
dBmanger.generate(file.getAbsolutePath(), vueOption);
|
|
|
|
dBmanger.generate(result.getAbsolutePath(), vueOption);
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
stage.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
popup = new Stage();
|
|
|
|
popup = new Stage();
|
|
|
@ -846,7 +834,7 @@ public class Dialog {
|
|
|
|
popup.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
|
|
|
popup.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handle(WindowEvent event) {
|
|
|
|
public void handle(WindowEvent event) {
|
|
|
|
stopPopup();
|
|
|
|
stopWait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
popup.setScene(scene);
|
|
|
|
popup.setScene(scene);
|
|
|
@ -872,7 +860,8 @@ public class Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
dialog.setTitle(title);
|
|
|
|
dialog.setTitle(title);
|
|
|
|
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
|
|
|
|
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
|
|
|
|
|
|
|
|
dialog.setX(JavaFxApplication.primaryStage.getX() + JavaFxApplication.primaryStage.getWidth() / 2 - 115);
|
|
|
|
|
|
|
|
dialog.setY(JavaFxApplication.primaryStage.getY() + JavaFxApplication.primaryStage.getHeight() / 2 - 70);
|
|
|
|
GridPane gridPane = new GridPane();
|
|
|
|
GridPane gridPane = new GridPane();
|
|
|
|
gridPane.setHgap(10);
|
|
|
|
gridPane.setHgap(10);
|
|
|
|
gridPane.setVgap(10);
|
|
|
|
gridPane.setVgap(10);
|
|
|
@ -889,22 +878,15 @@ public class Dialog {
|
|
|
|
gridPane.add(new Label("业务注释:"), 0, 1);
|
|
|
|
gridPane.add(new Label("业务注释:"), 0, 1);
|
|
|
|
gridPane.add(noteField, 1, 1);
|
|
|
|
gridPane.add(noteField, 1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
dialog.setResultConverter(new Callback() {
|
|
|
|
Optional<ButtonType> optional = dialog.showAndWait();
|
|
|
|
@Override
|
|
|
|
if (optional.isPresent() && optional.get() == ButtonType.OK) {
|
|
|
|
public Object call(Object param) {
|
|
|
|
String name = nameField.getText();
|
|
|
|
Map<String, String> hashMap = new HashMap<>();
|
|
|
|
String note = noteField.getText();
|
|
|
|
if (param == ButtonType.OK) {
|
|
|
|
if (StringUtil.isEmpty(name)) {
|
|
|
|
hashMap.put("name", nameField.getText());
|
|
|
|
Dialog.showYesNo("业务方法不能为空");
|
|
|
|
hashMap.put("note", noteField.getText());
|
|
|
|
} else if (inputCall != null) {
|
|
|
|
}
|
|
|
|
inputCall.call(name, note);
|
|
|
|
return hashMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional optional = dialog.showAndWait();
|
|
|
|
|
|
|
|
if (optional.isPresent()) {
|
|
|
|
|
|
|
|
Map<String, String> map = (Map<String, String>) optional.get();
|
|
|
|
|
|
|
|
inputCall.call(map.get("name"),map.get("note"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -929,6 +911,10 @@ public class Dialog {
|
|
|
|
void call(boolean result);
|
|
|
|
void call(boolean result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface DirectoryCall {
|
|
|
|
|
|
|
|
void call(File result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static File findAction(File file) {
|
|
|
|
private static File findAction(File file) {
|
|
|
|
if (file == null) {
|
|
|
|
if (file == null) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|