3737import root .core .domain .enums .MonitoringType ;
3838import root .core .domain .enums .RoundingDigits ;
3939import root .core .domain .enums .UsageUIType ;
40+ import root .core .domain .exceptions .PropertyNotFoundException ;
41+ import root .core .domain .exceptions .PropertyNotLoadedException ;
4042import root .core .service .contracts .PropertyService ;
4143import root .javafx .CustomView .ConnectionInfoVBox ;
4244import root .javafx .CustomView .DBConnInfoControl ;
@@ -99,7 +101,12 @@ public void initialize(URL location, ResourceBundle resources) {
99101 // [설정] - [모니터링 여부 설정] - Preset 변경 Event
100102 monitoringPresetComboBox .valueProperty ().addListener ((options , oldValue , newValue ) -> {
101103 if (newValue != null ) {
102- loadMonitoringConfigFile (propService .getMonitoringPresetFilePath (newValue ));
104+ try {
105+ loadMonitoringConfigFile (propService .getMonitoringPresetFilePath (newValue ));
106+ } catch (PropertyNotLoadedException e ) {
107+ log .error (e .getMessage ());
108+ AlertUtils .showPropertyNotLoadedAlert ();
109+ }
103110 }
104111 });
105112 } else {
@@ -111,15 +118,25 @@ public void initialize(URL location, ResourceBundle resources) {
111118 fileSizeCB .getItems ().addAll (FileSize .values ());
112119 fileSizeCB .getSelectionModel ().select (propService .getDefaultFileSizeUnit ());
113120 fileSizeCB .valueProperty ().addListener ((options , oldValue , newValue ) -> {
114- propService .saveCommonConfig ("unit.filesize" , newValue .getUnit ());
121+ try {
122+ propService .saveCommonConfig ("unit.filesize" , newValue .getUnit ());
123+ } catch (PropertyNotLoadedException e ) {
124+ log .error (e .getMessage ());
125+ AlertUtils .showPropertyNotLoadedAlert ();
126+ }
115127 });
116128
117129 /* 실행 설정 탭 - 반올림 자릿수 콤보박스 */
118130 // 반올림 자릿수 콤보박스 아이템 설정
119131 roundingDigitsCB .getItems ().addAll (RoundingDigits .values ());
120132 roundingDigitsCB .getSelectionModel ().select (propService .getDefaultRoundingDigits ());
121133 roundingDigitsCB .valueProperty ().addListener ((options , oldValue , newValue ) -> {
122- propService .saveCommonConfig ("unit.rounding" , String .valueOf (newValue .getDigits ()));
134+ try {
135+ propService .saveCommonConfig ("unit.rounding" , String .valueOf (newValue .getDigits ()));
136+ } catch (PropertyNotLoadedException e ) {
137+ log .error (e .getMessage ());
138+ AlertUtils .showPropertyNotLoadedAlert ();
139+ }
123140 });
124141 roundingDigitsCB .setConverter (new StringConverter <RoundingDigits >() {
125142 @ Override
@@ -137,7 +154,12 @@ public RoundingDigits fromString(String digits) {
137154 usageUICB .getItems ().addAll (UsageUIType .values ());
138155 usageUICB .getSelectionModel ().select (propService .getDefaultUsageUIType ());
139156 usageUICB .valueProperty ().addListener ((options , oldValue , newValue ) -> {
140- propService .saveCommonConfig ("usage-ui-type" , newValue .getCode ());
157+ try {
158+ propService .saveCommonConfig ("usage-ui-type" , newValue .getCode ());
159+ } catch (PropertyNotLoadedException e ) {
160+ log .error (e .getMessage ());
161+ AlertUtils .showPropertyNotLoadedAlert ();
162+ }
141163 });
142164 usageUICB .setConverter (new StringConverter <UsageUIType >() {
143165 @ Override
@@ -171,7 +193,12 @@ public void showMonitoringPresetPopup(ActionEvent e) {
171193 result .ifPresent (input -> {
172194 // TODO validate input value
173195 // 1. Preset명 이용하여 설정파일 생성 + 접속정보설정파일에 Preset 설정파일 경로 추가
174- propService .addMonitoringPreset (fileChooserText .getText (), input );
196+ try {
197+ propService .addMonitoringPreset (fileChooserText .getText (), input );
198+ } catch (PropertyNotLoadedException e1 ) {
199+ log .error (e1 .getMessage ());
200+ AlertUtils .showPropertyNotLoadedAlert ();
201+ }
175202
176203 // 3. 모니터링 여부 Config and Preset ComboBox 재로딩
177204 reloadingMonitoringSetting (input );
@@ -249,6 +276,7 @@ private void loadSelectedConfigFile(String absoluteFilePath) {
249276 * [설정] - [모니터링 여부 설정] - 모니터링 여부 설정파일을 불러온다.
250277 *
251278 * @param filePath
279+ * @throws PropertyNotFoundException
252280 */
253281 private void loadMonitoringConfigFile (String filePath ) {
254282 log .debug ("Load monitoring config file: " + filePath );
@@ -347,9 +375,10 @@ private void createMonitoringElements(VBox rootVBox, List<MonitoringYN> dbYnList
347375
348376 /**
349377 * [설정] - 설정파일을 불러온 후, 동적 UI를 생성한다.
378+ * @throws PropertyNotFoundException
350379 */
351380 @ SuppressWarnings ("unchecked" )
352- private void createSettingDynamicElements () {
381+ private void createSettingDynamicElements () throws PropertyNotFoundException {
353382
354383 List <JdbcConnectionInfo > jdbcConnInfoList = propService
355384 .getJdbcConnInfoList (propService .getMonitoringDBNameList ());
@@ -392,14 +421,20 @@ private void createSettingDynamicElements() {
392421 * [설정] - [모니터링여부설정] - Preset을 다시 불러온다.
393422 *
394423 * @param curPresetName
424+ * @throws PropertyNotFoundException
395425 */
396426 private void reloadingMonitoringSetting (String presetName ) {
397427 // 최종 읽을 파일 경로
398428 String readPresetName = "" ;
399429
400430 // Preset Combo Clear
401431 monitoringPresetComboBox .getItems ().clear ();
402- monitoringPresetComboBox .getItems ().addAll (propService .getMonitoringPresetNameList ());
432+ try {
433+ monitoringPresetComboBox .getItems ().addAll (propService .getMonitoringPresetNameList ());
434+ } catch (PropertyNotLoadedException e ) {
435+ log .error (e .getMessage ());
436+ AlertUtils .showPropertyNotLoadedAlert ();
437+ }
403438
404439 // 지정된 Preset이 없다면 최근 사용된 Preset으로 세팅한다.
405440 // 만약 최근 사용된 Preset이 없다면 첫번째 Preset으로 세팅한다.
@@ -419,7 +454,12 @@ private void reloadingMonitoringSetting(String presetName) {
419454 // ComboBox 선택 및 Preset 파일 읽기
420455 if (!StringUtils .isEmpty (readPresetName )) {
421456 monitoringPresetComboBox .getSelectionModel ().select (readPresetName );
422- loadMonitoringConfigFile (propService .getMonitoringPresetFilePath (readPresetName ));
457+ try {
458+ loadMonitoringConfigFile (propService .getMonitoringPresetFilePath (readPresetName ));
459+ } catch (PropertyNotLoadedException e ) {
460+ log .error (e .getMessage ());
461+ AlertUtils .showPropertyNotLoadedAlert ();
462+ }
423463 }
424464 }
425465
@@ -465,17 +505,22 @@ public void createNewConfigFile(ActionEvent e) {
465505 AlertUtils .showAlert (AlertType .ERROR , "접속정보 설정파일 생성" , "설정파일명을 입력해주세요." );
466506 return ;
467507 }
468-
469- // TODO 입력값 검사 (영어만)
470- // 1. 접속정보 설정파일 생성 + default 모니터링여부 Preset 설정파일 생성
471- String newSettingFile = propService .addConnectionInfoSetting (input );
472-
473- // 2. Set Node Visible
474- setVisible (noConnInfoConfigAP , false );
475- setVisible (noMonitoringConfigAP , false );
476-
477- // 3. 생성된 설정파일 Load
478- loadSelectedConfigFile (newSettingFile );
508+
509+ try {
510+ // TODO 입력값 검사 (영어만)
511+ // 1. 접속정보 설정파일 생성 + default 모니터링여부 Preset 설정파일 생성
512+ String newSettingFile = propService .addConnectionInfoSetting (input );
513+
514+ // 2. Set Node Visible
515+ setVisible (noConnInfoConfigAP , false );
516+ setVisible (noMonitoringConfigAP , false );
517+
518+ // 3. 생성된 설정파일 Load
519+ loadSelectedConfigFile (newSettingFile );
520+ } catch (PropertyNotLoadedException e1 ) {
521+ log .error (e1 .getMessage ());
522+ AlertUtils .showPropertyNotLoadedAlert ();
523+ }
479524 });
480525 }
481526}
0 commit comments