1212import org .apache .commons .lang3 .ArrayUtils ;
1313
1414import com .jfoenix .controls .JFXComboBox ;
15+ import com .jfoenix .controls .JFXToggleButton ;
1516
1617import de .jensd .fx .glyphs .fontawesome .FontAwesomeIcon ;
18+ import javafx .event .ActionEvent ;
1719import javafx .fxml .FXML ;
1820import javafx .fxml .Initializable ;
1921import javafx .scene .Node ;
2224import javafx .scene .control .SplitPane ;
2325import javafx .scene .input .ScrollEvent ;
2426import javafx .scene .layout .AnchorPane ;
27+ import javafx .util .StringConverter ;
2528import root .core .domain .ASMDiskUsage ;
2629import root .core .domain .ArchiveUsage ;
2730import root .core .domain .MonitoringResult ;
2831import root .core .domain .MonitoringYN ;
2932import root .core .domain .OSDiskUsage ;
3033import root .core .domain .TableSpaceUsage ;
31- import root .core .domain .MonitoringYN .MonitoringTypeAndYN ;
3234import root .core .domain .enums .MonitoringType ;
35+ import root .core .domain .enums .RoundingDigits ;
3336import root .core .repository .implement .PropertyRepositoryImpl ;
3437import root .core .service .contracts .PropertyService ;
3538import root .core .service .implement .FilePropertyService ;
3639import root .javafx .CustomView .CustomTreeTableView ;
3740import root .javafx .CustomView .CustomTreeView ;
3841import root .javafx .CustomView .MonitoringTableView ;
42+ import root .utils .UnitUtils .FileSize ;
3943
4044public class RunMenuController implements Initializable {
4145
@@ -60,6 +64,15 @@ public class RunMenuController implements Initializable {
6064 @ FXML
6165 AnchorPane serverPresetAP ;
6266
67+ @ FXML
68+ JFXComboBox <FileSize > fileSizeCB ;
69+
70+ @ FXML
71+ JFXComboBox <RoundingDigits > roundingDigitsCB ;
72+
73+ @ FXML
74+ JFXToggleButton resultSaveToggleBtn ;
75+
6376 @ FXML
6477 ScrollPane mainScrollPane ;
6578
@@ -117,39 +130,23 @@ public void initialize(URL location, ResourceBundle resources) {
117130 connInfoFileListComboBox .getSelectionModel ().select (lastUseConnInfoFile );
118131 }
119132
120- List <MonitoringYN > list = new ArrayList <>();
121- List <MonitoringTypeAndYN > childList = new ArrayList <>();
122- childList .add (new MonitoringTypeAndYN (MonitoringType .ARCHIVE , true ));
123- childList .add (new MonitoringTypeAndYN (MonitoringType .TABLE_SPACE , true ));
124- childList .add (new MonitoringTypeAndYN (MonitoringType .ASM_DISK , true ));
125- list .add (new MonitoringYN ("DB1" , childList ));
126-
127- List <MonitoringYN > list2 = new ArrayList <>();
128- List <MonitoringTypeAndYN > childList2 = new ArrayList <>();
129- childList2 .add (new MonitoringTypeAndYN (MonitoringType .OS_DISK , false ));
130- childList2 .add (new MonitoringTypeAndYN (MonitoringType .ALERT_LOG , false ));
131- list2 .add (new MonitoringYN ("SERVER1" , childList2 ));
132- addMonitoringPresetPreview (list , list2 );
133-
134133 /* 2. 모니터링 여부 설정 */
135134 // 2-1. 모니터링 여부 Preset 콤보박스 아이템 설정
136135 String curConnInfoFile = connInfoFileListComboBox .getSelectionModel ().getSelectedItem ();
137136 propService .loadMonitoringInfoConfig (curConnInfoFile );
138137 List <String > presetFileList = propService .getMonitoringPresetNameList ();
139138 if (presetFileList == null || presetFileList .size () == 0 ) {
140139 // TODO 모니터링 여부 Preset 설정파일이 없는 경우
141- addMonitoringPresetPreview (list , list2 );
140+ addMonitoringPresetPreview (new ArrayList <>(), new ArrayList <>() );
142141 } else {
143142 presetFileListComboBox .getItems ().addAll (presetFileList );
144- }
143+ }
145144
146145 // 2-2. 모니터링 여부 Preset 콤보박스 아이템 변경 리스너 설정
147146 presetFileListComboBox .valueProperty ().addListener ((observable , oldValue , newValue ) -> {
148- System .out .println (newValue );
149- System .out .println (propService .getMonitoringPresetFilePath (newValue ));
150- // List<DBMonitoringYN> dbPresets = propService.getMonitoringDBNameList();
151- // List<ServerMonitoringYN> serverPresets = propService.getMonitoringServerNameList();
152- // addMonitoringPresetPreview(dbPresets, serverPresets);
147+ List <MonitoringYN > dbYnList = propService .getDBMonitoringYnList (newValue );
148+ List <MonitoringYN > serverYnList = propService .getServerMonitoringYnList (newValue );
149+ addMonitoringPresetPreview (dbYnList , serverYnList );
153150 });
154151
155152 // 2-3. 모니터링 여부 Preset 콤보박스 초기값 설정
@@ -161,6 +158,30 @@ public void initialize(URL location, ResourceBundle resources) {
161158 presetFileListComboBox .getSelectionModel ().select (lastUsePresetFileName );
162159 }
163160
161+ /* 3. 기타 설정 및 실행 */
162+ // 3-1. 조회결과 단위 콤보박스
163+ // 조회결과 단위 콤보박스 아이템 설정
164+ fileSizeCB .getItems ().addAll (FileSize .values ());
165+ fileSizeCB .getSelectionModel ().select (propService .getDefaultFileSizeUnit ());
166+
167+ // 3-2. 반올림 자릿수 콤보박스
168+ roundingDigitsCB .getItems ().addAll (RoundingDigits .values ());
169+ roundingDigitsCB .getSelectionModel ().select (propService .getDefaultRoundingDigits ());
170+ roundingDigitsCB .setConverter (new StringConverter <RoundingDigits >() {
171+ @ Override
172+ public String toString (RoundingDigits digits ) {
173+ return String .valueOf (digits .getDigits ());
174+ }
175+
176+ @ Override
177+ public RoundingDigits fromString (String digits ) {
178+ return RoundingDigits .find (digits );
179+ }
180+ });
181+
182+ // 3-3. 모니터링 결과 저장 여부
183+ resultSaveToggleBtn .selectedProperty ().set (true );
184+
164185 // 실행결과 TableView 생성 및 Column 추가
165186 MonitoringTableView <ArchiveUsage > archiveTable = addMonitoringTableView (archiveAP , ArchiveUsage .class );
166187 archiveTable .addColumn ("Archive" , "archiveName" );
@@ -275,4 +296,21 @@ private void addMonitoringPresetPreview(List<MonitoringYN> dbYnList, List<Monito
275296 setAnchorPaneAnchor (serverCtv , 0 , 0 , 0 , 0 );
276297 serverPresetAP .getChildren ().add (serverCtv );
277298 }
299+
300+ /**
301+ * 모니터링 실행
302+ *
303+ * @param e
304+ */
305+ public void monitoringRunBtn (ActionEvent e ) {
306+ // TODO 선택된 접속정보 설정 파일, 모니터링 여부 설정파일, 기타 설정을 모두 읽어와 모니터링을 실행한다.
307+
308+ }
309+
310+ /**
311+ * 모니터링 결과를 TableView에 렌더링한다.
312+ */
313+ public void showMonitoringResult () {
314+ // TODO 모니터링 결과를 매개변수로 전달받아 TableView에 렌더링한다.
315+ }
278316}
0 commit comments