Moxkiriyaプロジェクト事前開発用の作業部屋
修订版 | 5a43448089149519d2dea859fcb03abcb6980c2d (tree) |
---|---|
时间 | 2018-10-09 17:49:30 |
作者 | Harold_Andoh <andolloyd@gmai...> |
Commiter | Harold_Andoh |
[Moxkiriya7]
@@ -88,6 +88,11 @@ public class Main extends Application { | ||
88 | 88 | } while(closeType != WikiMainWindow.CloseType.EXIT); |
89 | 89 | } catch(Exception e) { |
90 | 90 | e.printStackTrace(); |
91 | + } finally { | |
92 | + if(wikiMainWindow_ != null) { | |
93 | + wikiMainWindow_.closeSession(); | |
94 | + } | |
95 | + primaryStage_.hide(); | |
91 | 96 | } |
92 | 97 | } |
93 | 98 |
@@ -97,26 +102,29 @@ public class Main extends Application { | ||
97 | 102 | */ |
98 | 103 | private WikiMainWindow.CloseType showWikiMainWindow() throws Exception { |
99 | 104 | WikiMainWindow.CloseType closeType = WikiMainWindow.CloseType.EXIT; |
105 | + String appRoot = settingManager_.get(SettingManager.SETINGKEY_MOXKIRIYAROOT); | |
100 | 106 | |
101 | - String appRoot = settingManager_.get(SettingManager.SETINGKEY_MOXKIRIYAROOT); | |
102 | - File wikirootPath = new File(appRoot + "/" + WikiEngine.WIKIROOT_DIRECTORY); | |
103 | - | |
104 | - if (wikirootPath != null) { | |
105 | - wikirootPath.mkdirs(); | |
106 | - | |
107 | - wikiMainWindow_ = new WikiMainWindow(primaryStage_, resources_); | |
108 | - | |
109 | - /* | |
110 | - * wikirootに MainPageを構築する。 | |
111 | - */ | |
112 | - wikiMainWindow_.buildWikiMainTree(wikirootPath); | |
113 | - | |
114 | - /* | |
115 | - * 外部リンクアイコン画像をApprootにアップロードする。 | |
116 | - */ | |
117 | - wikiMainWindow_.uploadResourcefile(appRoot + "/", "icon/Icon_External_Link.png"); | |
118 | - | |
119 | - closeType = wikiMainWindow_.show(); | |
107 | + if(appRoot != null) { | |
108 | + File wikirootPath = new File(appRoot + "/" + WikiEngine.WIKIROOT_DIRECTORY); | |
109 | + | |
110 | + if (wikirootPath != null) { | |
111 | + wikirootPath.mkdirs(); | |
112 | + | |
113 | + wikiMainWindow_ = new WikiMainWindow(primaryStage_, resources_); | |
114 | + | |
115 | + /* | |
116 | + * wikirootに MainPageを構築する。 | |
117 | + */ | |
118 | + wikiMainWindow_.buildWikiMainTree(wikirootPath); | |
119 | + | |
120 | + /* | |
121 | + * 外部リンクアイコン画像をApprootにアップロードする。 | |
122 | + */ | |
123 | + wikiMainWindow_.uploadResourcefile(appRoot + "/icon/Icon_External_Link.png", | |
124 | + "icon/Icon_External_Link.png"); | |
125 | + | |
126 | + closeType = wikiMainWindow_.show(); | |
127 | + } | |
120 | 128 | } |
121 | 129 | |
122 | 130 | return closeType; |
@@ -164,9 +172,15 @@ public class Main extends Application { | ||
164 | 172 | Hashtable<String, String> settingsTable = dialog.getSettingsTable(); |
165 | 173 | String path = settingManager_.get(SettingManager.SETTINGSKEY_MOXKIRIYA_USER_DIR); |
166 | 174 | |
167 | - settingManager_.putParty(selectedParty, dialog.getDefaultPartyCheckValue()); | |
168 | - settingManager_.savePartyConfig(path); | |
169 | - settingManager_.saveSettingConfig(path, selectedParty, settingsTable); | |
170 | - settingManager_.loadSettingFiles(path); | |
175 | + if(selectedParty.isEmpty() == true) { | |
176 | + selectedParty = dialog.getPartyName(); | |
177 | + } | |
178 | + | |
179 | + if(selectedParty.isEmpty() != true) { | |
180 | + settingManager_.putParty(selectedParty, dialog.getDefaultPartyCheckValue()); | |
181 | + settingManager_.savePartyConfig(path); | |
182 | + settingManager_.saveSettingConfig(path, selectedParty, settingsTable); | |
183 | + settingManager_.loadSettingFiles(path); | |
184 | + } | |
171 | 185 | } |
172 | 186 | } |
@@ -279,14 +279,16 @@ public class SettingManager { | ||
279 | 279 | * @param isDefault |
280 | 280 | */ |
281 | 281 | public void putParty(String partyName, boolean isDefault) { |
282 | - if(isDefault == true) { | |
283 | - Set<String> keySet = partyTable_.keySet(); | |
284 | - | |
285 | - for(String key: keySet) { | |
286 | - partyTable_.put(key, false); | |
282 | + if(partyName.isEmpty() != true) { | |
283 | + if(isDefault == true) { | |
284 | + Set<String> keySet = partyTable_.keySet(); | |
285 | + | |
286 | + for(String key: keySet) { | |
287 | + partyTable_.put(key, false); | |
288 | + } | |
287 | 289 | } |
290 | + partyTable_.put(partyName, isDefault); | |
288 | 291 | } |
289 | - partyTable_.put(partyName, isDefault); | |
290 | 292 | } |
291 | 293 | |
292 | 294 | /** |
@@ -399,14 +399,12 @@ public class WikiMainWindowController implements Initializable { | ||
399 | 399 | AlertDialog dialog = new AlertDialog(AlertDialog.MessageType.SuccessImport); |
400 | 400 | dialog.showDialog(stage_, resourceBundle_); |
401 | 401 | stage_.hide(); |
402 | - stage_.getOwner().hide(); | |
403 | 402 | } catch (Exception e) { |
404 | 403 | e.printStackTrace(); |
405 | 404 | try { |
406 | 405 | AlertDialog dialog = new AlertDialog(AlertDialog.MessageType.FailureImport); |
407 | 406 | dialog.showDialog(stage_, resourceBundle_); |
408 | 407 | stage_.hide(); |
409 | - stage_.getOwner().hide(); | |
410 | 408 | } catch (Exception e1) { |
411 | 409 | e1.printStackTrace(); |
412 | 410 | } |
@@ -452,7 +450,6 @@ public class WikiMainWindowController implements Initializable { | ||
452 | 450 | editMode_ = EditMode.NONE; |
453 | 451 | wikiEngine_.cancelCheckout(); |
454 | 452 | stage_.hide(); |
455 | - stage_.getOwner().hide(); | |
456 | 453 | } |
457 | 454 | } |
458 | 455 | else { |