Skip to content

Commit 01b98b9

Browse files
committed
Set label text (history's monitoring datetime) when inquiry monitoring history
1 parent 0e41b89 commit 01b98b9

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/main/java/root/javafx/Controller/MonitoringAPController.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.Collections;
88
import java.util.HashMap;
99
import java.util.List;
10+
import java.util.Locale;
1011
import java.util.Map;
1112
import java.util.stream.Collectors;
1213

@@ -64,6 +65,9 @@ public class MonitoringAPController<T extends MonitoringResult> extends BorderPa
6465

6566
@FXML
6667
DatePicker inquiryDatePicker;
68+
69+
@FXML
70+
Label historyDateTimeLabel;
6771

6872
@FXML
6973
Pagination pagination;
@@ -240,6 +244,15 @@ public void syncTableData(String id, int index) {
240244

241245
// Sync monitoring prequency UI
242246
syncPrequency(prequencyTimeDivBtn.getText());
247+
248+
// Sync history monitoring datetime
249+
if(tableData != null && !tableData.isEmpty()) {
250+
String monitoringDateTime = tableData.get(0).getMonitoringDateTime();
251+
historyDateTimeLabel.setText(DateUtils.convertDateFormat("yyyyMMddHHmmss", "yyyy-MM-dd HH:mm:ss",
252+
monitoringDateTime, Locale.KOREA));
253+
} else {
254+
historyDateTimeLabel.setText("기록을 조회해주세요.");
255+
}
243256
}
244257

245258
/**
@@ -366,9 +379,22 @@ private void syncPrequency(String timeDiv) {
366379
prequencyHBox.getChildren().add(new PrequencyButton(countByTime.get(i)));
367380
}
368381
}
369-
382+
370383
public void showPrevHistory(ActionEvent e) {
384+
String selected = aliasComboBox.getSelectionModel().getSelectedItem();
385+
386+
// Clear data
387+
clearTableData(selected);
371388

389+
Map<String, List<T>> allDataList = inquiryMonitoringHistory();
390+
if (allDataList == null || allDataList.size() == 0) {
391+
AlertUtils.showAlert(AlertType.INFORMATION, "조회결과 없음", "해당일자의 모니터링 기록이 없습니다.");
392+
return;
393+
}
394+
395+
// Add and Sync data
396+
addTableDataSet(selected, allDataList);
397+
syncTableData(selected, 0);
372398
}
373399

374400
public void showNextHistory(ActionEvent e) {

src/main/resources/fxml/MonitoringAP.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<FontAwesomeIconView glyphName="ANGLE_LEFT" size="13" />
3737
</graphic>
3838
</JFXButton>
39-
<Label styleClass="basic-font" text="2022-03-25 00:00:00">
39+
<Label fx:id="historyDateTimeLabel" styleClass="basic-font" text="기록을 조회해주세요.">
4040
<graphic>
4141
<FontAwesomeIconView fill="#003b8e" glyphName="CLOCK_ALT" size="15" strokeWidth="0.0" />
4242
</graphic>

0 commit comments

Comments
 (0)