11package com .xwintop .xJavaFxTool .controller ;
22
3+ import static com .xwintop .xJavaFxTool .Main .RESOURCE_BUNDLE ;
4+ import static com .xwintop .xJavaFxTool .utils .Config .Keys .NotepadEnabled ;
5+
36import com .xwintop .xJavaFxTool .controller .index .PluginManageController ;
4- import com .xwintop .xJavaFxTool .controller .index .SystemSettingController ;
57import com .xwintop .xJavaFxTool .model .ToolFxmlLoaderConfiguration ;
68import com .xwintop .xJavaFxTool .services .IndexService ;
79import com .xwintop .xJavaFxTool .services .index .PluginManageService ;
10+ import com .xwintop .xJavaFxTool .services .index .SystemSettingService ;
811import com .xwintop .xJavaFxTool .utils .Config ;
912import com .xwintop .xJavaFxTool .utils .XJavaFxSystemUtil ;
1013import com .xwintop .xJavaFxTool .view .IndexView ;
11- import com .xwintop .xcore .javafx .FxApp ;
12- import com .xwintop .xcore .javafx .dialog .FxDialog ;
1314import com .xwintop .xcore .util .ConfigureUtil ;
1415import com .xwintop .xcore .util .HttpClientUtil ;
1516import com .xwintop .xcore .util .javafx .AlertUtil ;
1617import com .xwintop .xcore .util .javafx .JavaFxSystemUtil ;
1718import com .xwintop .xcore .util .javafx .JavaFxViewUtil ;
19+ import java .io .File ;
20+ import java .io .InputStream ;
21+ import java .net .URL ;
22+ import java .util .ArrayList ;
23+ import java .util .Date ;
24+ import java .util .HashMap ;
25+ import java .util .List ;
26+ import java .util .Map ;
27+ import java .util .ResourceBundle ;
28+ import java .util .jar .JarEntry ;
29+ import java .util .jar .JarFile ;
1830import javafx .application .Platform ;
1931import javafx .event .ActionEvent ;
2032import javafx .fxml .FXML ;
2133import javafx .fxml .FXMLLoader ;
2234import javafx .scene .Parent ;
23- import javafx .scene .control .ButtonType ;
2435import javafx .scene .control .ContextMenu ;
2536import javafx .scene .control .Menu ;
2637import javafx .scene .control .MenuItem ;
3849import org .dom4j .tree .DefaultAttribute ;
3950import org .dom4j .tree .DefaultElement ;
4051
41- import java .io .File ;
42- import java .io .InputStream ;
43- import java .net .URL ;
44- import java .util .*;
45- import java .util .jar .JarEntry ;
46- import java .util .jar .JarFile ;
47-
48- import static com .xwintop .xJavaFxTool .utils .Config .Keys .NotepadEnabled ;
49-
5052/**
5153 * @ClassName: IndexController
5254 * @Description: 主页
@@ -71,9 +73,8 @@ public class IndexController extends IndexView {
7173 private ContextMenu contextMenu = new ContextMenu ();
7274
7375 public static FXMLLoader getFXMLLoader () {
74- ResourceBundle resourceBundle = ResourceBundle .getBundle ("locale.Menu" , Config .defaultLocale );
7576 URL url = Object .class .getResource ("/com/xwintop/xJavaFxTool/fxmlView/Index.fxml" );
76- return new FXMLLoader (url , resourceBundle );
77+ return new FXMLLoader (url , RESOURCE_BUNDLE );
7778 }
7879
7980 @ Override
@@ -240,18 +241,18 @@ public void selectAction(String selectText) {
240241 }
241242
242243 @ FXML
243- private void exitAction (ActionEvent event ) {
244+ private void exitAction () {
244245 Platform .exit ();
245246 System .exit (0 );
246247 }
247248
248249 @ FXML
249- private void closeAllTabAction (ActionEvent event ) {
250+ private void closeAllTabAction () {
250251 tabPaneMain .getTabs ().clear ();
251252 }
252253
253254 @ FXML
254- private void openAllTabAction (ActionEvent event ) {
255+ private void openAllTabAction () {
255256 for (MenuItem value : menuItemMap .values ()) {
256257 value .fire ();
257258 }
@@ -268,7 +269,7 @@ private void addLogConsoleAction(ActionEvent event) {
268269 }
269270
270271 @ FXML
271- private void pluginManageAction (ActionEvent event ) throws Exception {
272+ private void pluginManageAction () throws Exception {
272273 FXMLLoader fXMLLoader = PluginManageController .getFXMLLoader ();
273274 Parent root = fXMLLoader .load ();
274275 PluginManageController pluginManageController = fXMLLoader .getController ();
@@ -277,26 +278,12 @@ private void pluginManageAction(ActionEvent event) throws Exception {
277278 }
278279
279280 @ FXML
280- private void SettingAction (ActionEvent event ) throws Exception {
281-
282- FxDialog <SystemSettingController > dialog = new FxDialog <SystemSettingController >()
283- .setTitle (bundle .getString ("Setting" ))
284- .setBodyFxml ("/com/xwintop/xJavaFxTool/fxmlView/index/SystemSetting.fxml" )
285- .setOwner (FxApp .primaryStage )
286- .setButtonTypes (ButtonType .OK , ButtonType .CANCEL );
287-
288- SystemSettingController controller = dialog .show ();
289-
290- dialog
291- .setButtonHandler (ButtonType .OK , (actionEvent , stage ) -> {
292- controller .applySettings ();
293- stage .close ();
294- })
295- .setButtonHandler (ButtonType .CANCEL , (actionEvent , stage ) -> stage .close ());
281+ private void SettingAction () {
282+ SystemSettingService .openSystemSettings (bundle .getString ("Setting" ));
296283 }
297284
298285 @ FXML
299- private void aboutAction (ActionEvent event ) throws Exception {
286+ private void aboutAction () {
300287 AlertUtil .showInfoAlert (bundle .getString ("aboutText" ) + Config .xJavaFxToolVersions );
301288 }
302289
@@ -307,33 +294,33 @@ private void setLanguageAction(ActionEvent event) throws Exception {
307294 }
308295
309296 @ FXML
310- private void openLogFileAction (ActionEvent event ) throws Exception {
297+ private void openLogFileAction () {
311298 String filePath = "logs/logFile." + DateFormatUtils .format (new Date (), "yyyy-MM-dd" ) + ".log" ;
312299 JavaFxSystemUtil .openDirectory (filePath );
313300 }
314301
315302 @ FXML
316- private void openLogFolderAction (ActionEvent event ) throws Exception {
303+ private void openLogFolderAction () {
317304 JavaFxSystemUtil .openDirectory ("logs/" );
318305 }
319306
320307 @ FXML
321- private void openConfigFolderAction (ActionEvent event ) throws Exception {
308+ private void openConfigFolderAction () {
322309 JavaFxSystemUtil .openDirectory (ConfigureUtil .getConfigurePath ());
323310 }
324311
325312 @ FXML
326- private void openPluginFolderAction (ActionEvent event ) throws Exception {
313+ private void openPluginFolderAction () {
327314 JavaFxSystemUtil .openDirectory ("libs/" );
328315 }
329316
330317 @ FXML
331- private void xwintopLinkOnAction (ActionEvent event ) throws Exception {
318+ private void xwintopLinkOnAction () throws Exception {
332319 HttpClientUtil .openBrowseURLThrowsException ("https://gitee.com/xwintop/xJavaFxTool" );
333320 }
334321
335322 @ FXML
336- private void userSupportAction (ActionEvent event ) throws Exception {
323+ private void userSupportAction () throws Exception {
337324 HttpClientUtil .openBrowseURLThrowsException ("https://support.qq.com/product/127577" );
338325 }
339326}
0 commit comments