65 lines
2.1 KiB
Java
65 lines
2.1 KiB
Java
|
|
package com.zhangmeng.minio;
|
||
|
|
|
||
|
|
import com.google.common.eventbus.Subscribe;
|
||
|
|
import com.zhangmeng.minio.controller.MinioController;
|
||
|
|
import com.zhangmeng.minio.message.Message;
|
||
|
|
import com.zhangmeng.minio.utils.ConfigUtils;
|
||
|
|
import com.zhangmeng.minio.utils.EventBusUtils;
|
||
|
|
import com.zhangmeng.minio.utils.MinioUtils;
|
||
|
|
import javafx.application.Application;
|
||
|
|
import javafx.fxml.FXMLLoader;
|
||
|
|
import javafx.scene.Parent;
|
||
|
|
import javafx.scene.Scene;
|
||
|
|
import javafx.stage.Stage;
|
||
|
|
import lombok.extern.log4j.Log4j;
|
||
|
|
import org.apache.log4j.Logger;
|
||
|
|
import org.apache.log4j.spi.LoggerFactory;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author zhangmeng
|
||
|
|
* @version 1.0
|
||
|
|
* @date 2024-03-07 14:24
|
||
|
|
*/
|
||
|
|
public class MiniToolsApplication extends Application {
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void start(Stage primaryStage) throws Exception {
|
||
|
|
|
||
|
|
MinioUtils.objectMap.put(MinioUtils.primaryStage,primaryStage);
|
||
|
|
|
||
|
|
Parent root = FXMLLoader.load(this.getClass().getResource("/fxml/main.fxml"));
|
||
|
|
primaryStage.setScene(new Scene(root));
|
||
|
|
primaryStage.setTitle("javafx minio 工具");
|
||
|
|
primaryStage.show();
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void init() throws Exception {
|
||
|
|
EventBusUtils.getDefault().register(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void stop() throws Exception {
|
||
|
|
EventBusUtils.getDefault().unregister(this);
|
||
|
|
MinioController minioController = (MinioController) MinioUtils.objectMap.get(MinioUtils.minioController);
|
||
|
|
if (minioController != null){
|
||
|
|
EventBusUtils.getDefault().unregister(minioController);
|
||
|
|
System.out.println("EventBusUtils.getDefault().unregister(minioController)");
|
||
|
|
}
|
||
|
|
System.out.println("EventBusUtils.getDefault().unregister(MiniToolsApplication) ");
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void main(String[] args) {
|
||
|
|
launch(args);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Subscribe
|
||
|
|
public void handlerMessage(Message message){
|
||
|
|
System.out.println(message.getMsg());
|
||
|
|
MinioController minioController = (MinioController) MinioUtils.objectMap.get(MinioUtils.minioController);
|
||
|
|
minioController.reload();
|
||
|
|
|
||
|
|
ConfigUtils.getDefaultConfig();
|
||
|
|
}
|
||
|
|
}
|