5353import root .javafx .CustomView .ConnectionInfoVBox ;
5454import root .javafx .CustomView .DBConnInfoControl ;
5555import root .javafx .CustomView .ServerConnInfoControl ;
56+ import root .javafx .CustomView .dialogUI .CustomTextInputDialog ;
5657import root .utils .AlertUtils ;
5758import root .utils .UnitUtils .FileSize ;
5859
@@ -208,35 +209,23 @@ public UsageUIType fromString(String string) {
208209 * @param e
209210 */
210211 public void showMonitoringPresetPopup (ActionEvent e ) {
211- // TextInputDialog 생성
212- TextInputDialog presetInputDialog = new TextInputDialog ();
213- // ICON
214- presetInputDialog .setGraphic (new FontAwesomeIconView (FontAwesomeIcon .PENCIL , "30" ));
215- // CSS
216- presetInputDialog .getDialogPane ().getStylesheets ().add (
217- getClass ().getResource (System .getProperty ("resourceBaseDir" ) + "/css/dialog.css" ).toExternalForm ());
218- presetInputDialog .getDialogPane ().getStyleClass ().add ("textInputDialog" );
219- // Dialog ICON
220- Stage stage = (Stage ) presetInputDialog .getDialogPane ().getScene ().getWindow ();
221- stage .getIcons ().add (new Image (
222- this .getClass ().getResource (System .getProperty ("resourceBaseDir" ) + "/image/add_icon.png" ).toString ()));
223- // Button Custom
224- ButtonType okButton = new ButtonType ("입력" , ButtonData .OK_DONE );
225- presetInputDialog .getDialogPane ().getButtonTypes ().removeAll (ButtonType .OK , ButtonType .CANCEL );
226- presetInputDialog .getDialogPane ().getButtonTypes ().addAll (okButton , ButtonType .CANCEL );
227- // Content
228- presetInputDialog .setTitle ("Preset 생성" );
229- presetInputDialog .setHeaderText ("새로운 Monitoring Preset 이름을 입력해주세요." );
230- presetInputDialog .setContentText ("Preset 이름: " );
231- // Result
212+
213+ // Create input dialog
214+ String dialogTitle = "Preset 생성" ;
215+ String dialogHeaderText = "새로운 Monitoring Preset 이름을 입력해주세요." ;
216+ String dialogContentText = "Preset 이름: " ;
217+ CustomTextInputDialog presetInputDialog = new CustomTextInputDialog (dialogTitle , dialogHeaderText ,
218+ dialogContentText );
219+
220+ // Process input result
232221 Optional <String > result = presetInputDialog .showAndWait ();
233222 result .ifPresent (input -> {
234- logger . debug ( "Monitoring Preset 생성 Input: " + input );
223+ // TODO validate input value
235224
225+ // TODO move this logic to propertyService
236226 // 1. Preset명 이용하여 설정파일 생성 (./config/monitoring/{접속정보설정파일명}/{preset명}.properties
237- File connInfoFile = new File (fileChooserText .getText ());
238- String connInfoFileName = connInfoFile .getName ().substring (0 ,
239- connInfoFile .getName ().indexOf (".properties" ));
227+ String connInfoFilePath = fileChooserText .getText ();
228+ String connInfoFileName = connInfoFilePath .substring (0 , connInfoFilePath .indexOf (".properties" ));
240229 String filePath = "./config/monitoring/" + connInfoFileName + "/" + input + ".properties" ;
241230 propRepo .createNewPropertiesFile (filePath , "Monitoring" );
242231
@@ -249,11 +238,9 @@ public void showMonitoringPresetPopup(ActionEvent e) {
249238 reloadingMonitoringSetting (input );
250239
251240 // 4. 성공 Alert 띄우기
252- Alert successAlert = new Alert (AlertType .INFORMATION );
253- successAlert .setHeaderText ("Preset 생성" );
254- successAlert .setContentText ("모니터링여부 설정 Preset이 생성되었습니다." );
255- successAlert .getDialogPane ().setStyle ("-fx-font-family: NanumGothic;" );
256- successAlert .show ();
241+ String successTitle = "Preset 생성" ;
242+ String successContent = "모니터링여부 설정 Preset이 생성되었습니다." ;
243+ AlertUtils .showAlert (AlertType .INFORMATION , successTitle , successContent );
257244 });
258245 }
259246
@@ -468,7 +455,7 @@ private void createMonitoringElements(VBox rootVBox, String[] monitoringElements
468455
469456 for (String s : elementContents ) {
470457 String contentToggleId = mName .replaceAll ("\\ s" , "" ) + s + "ToggleBtn" ;
471-
458+
472459 HBox contentHBox = new HBox ();
473460 Label contentLabel = new Label ();
474461 contentLabel .setText (s );
0 commit comments