Skip to content

Commit 9714b53

Browse files
committed
Create 'MonitoringResultTableViewAP'
1 parent 5a7149e commit 9714b53

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package root.javafx.Controller;
2+
3+
import java.io.IOException;
4+
import java.util.ArrayList;
5+
import java.util.HashMap;
6+
import java.util.List;
7+
import java.util.Map;
8+
9+
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
10+
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
11+
import javafx.collections.FXCollections;
12+
import javafx.fxml.FXML;
13+
import javafx.fxml.FXMLLoader;
14+
import javafx.scene.control.Label;
15+
import javafx.scene.layout.AnchorPane;
16+
import javafx.scene.layout.HBox;
17+
import javafx.scene.layout.StackPane;
18+
import javafx.scene.text.Font;
19+
import root.core.domain.MonitoringResult;
20+
import root.core.domain.enums.MonitoringType;
21+
import root.javafx.CustomView.MonitoringTableView;
22+
import root.javafx.DI.DependencyInjection;
23+
24+
public class MonitoringResultTableViewAP extends AnchorPane {
25+
26+
@FXML
27+
private Label aliasLabel;
28+
29+
@FXML
30+
private Label monitoringTimeLabel;
31+
32+
@FXML
33+
private StackPane tableViewSP;
34+
35+
@FXML
36+
private HBox tableViewHBox;
37+
38+
private static final Map<MonitoringType, String> titleMap = new HashMap<>();
39+
static {
40+
titleMap.put(MonitoringType.ARCHIVE, "Archive 사용량");
41+
titleMap.put(MonitoringType.TABLE_SPACE, "TableSpace 사용량");
42+
titleMap.put(MonitoringType.ASM_DISK, "ASM Disk 사용량");
43+
titleMap.put(MonitoringType.OS_DISK, "OS Disk 사용량");
44+
}
45+
46+
private Map<MonitoringType, MonitoringTableView<? extends MonitoringResult>> tableViewMap = new HashMap<>();
47+
48+
private Map<MonitoringType, List<Object>> tableDataListMap = new HashMap<>();
49+
50+
public MonitoringResultTableViewAP() {
51+
try {
52+
FXMLLoader loader = DependencyInjection.getLoader("/fxml/MonitoringResultTableViewAP.fxml");
53+
loader.setController(this);
54+
loader.setRoot(this);
55+
loader.load();
56+
} catch (IOException e) {
57+
e.printStackTrace();
58+
}
59+
}
60+
61+
/**
62+
* 모니터링 결과 TableView를 추가한다.
63+
*
64+
* @param type
65+
*/
66+
private void addMonitoringTableView(MonitoringType type) {
67+
AnchorPane tableViewWrapper = new AnchorPane();
68+
tableViewWrapper.setMinWidth(350);
69+
70+
Label titleLabel = new Label();
71+
titleLabel.setText(titleMap.get(type));
72+
titleLabel.setFont(Font.font("Noto Sans Korean Regular"));
73+
74+
FontAwesomeIconView icon = new FontAwesomeIconView(FontAwesomeIcon.ASTERISK, "9");
75+
titleLabel.setGraphic(icon);
76+
77+
AnchorPane.setTopAnchor(titleLabel, 0.0);
78+
AnchorPane.setLeftAnchor(titleLabel, 0.0);
79+
AnchorPane.setRightAnchor(titleLabel, 0.0);
80+
81+
MonitoringTableView<? extends MonitoringResult> tableView = new MonitoringTableView<>();
82+
AnchorPane.setTopAnchor(tableView, 20.0);
83+
AnchorPane.setLeftAnchor(tableView, 0.0);
84+
AnchorPane.setRightAnchor(tableView, 0.0);
85+
AnchorPane.setBottomAnchor(tableView, 0.0);
86+
tableViewMap.put(type, tableView);
87+
88+
tableViewWrapper.getChildren().addAll(titleLabel, tableView);
89+
tableViewHBox.getChildren().add(tableViewWrapper);
90+
}
91+
92+
/**
93+
* TableView 컬럼을 추가한다.
94+
*
95+
* @param type
96+
* @param title
97+
* @param fieldName
98+
*/
99+
public void addTableViewColumn(MonitoringType type, String title, String fieldName) {
100+
if (tableViewMap.get(type) == null) {
101+
addMonitoringTableView(type);
102+
}
103+
tableViewMap.get(type).addColumn(title, fieldName);
104+
}
105+
106+
public <T extends MonitoringResult> void setTableData(MonitoringType type, List<T> dataList) {
107+
List<Object> list = tableDataListMap.get(type);
108+
if (list == null) {
109+
list = new ArrayList<>();
110+
}
111+
112+
list.clear();
113+
list.addAll(dataList);
114+
115+
MonitoringTableView<T> tableView = (MonitoringTableView<T>) tableViewMap.get(type);
116+
tableView.setItems(FXCollections.observableArrayList(dataList));
117+
}
118+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import com.jfoenix.controls.JFXButton?>
4+
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
5+
<?import java.lang.String?>
6+
<?import javafx.geometry.Insets?>
7+
<?import javafx.scene.Cursor?>
8+
<?import javafx.scene.control.Label?>
9+
<?import javafx.scene.control.Separator?>
10+
<?import javafx.scene.layout.AnchorPane?>
11+
<?import javafx.scene.layout.HBox?>
12+
<?import javafx.scene.layout.StackPane?>
13+
<?import javafx.scene.layout.VBox?>
14+
<?import javafx.scene.text.Font?>
15+
16+
17+
<fx:root type="AnchorPane" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
18+
<children>
19+
<VBox layoutY="5.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="5.0">
20+
<children>
21+
<AnchorPane>
22+
<children>
23+
<Label fx:id="dbMonitoringTimeLabel" text="Monitoring Time" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="0.0">
24+
<padding>
25+
<Insets left="5.0" right="5.0" />
26+
</padding>
27+
<font>
28+
<Font name="Noto Sans Korean Regular" size="12.0" />
29+
</font>
30+
<graphic>
31+
<FontAwesomeIconView fill="#003b8e" glyphName="CLOCK_ALT" size="15" strokeWidth="0.0" />
32+
</graphic>
33+
</Label>
34+
<HBox alignment="CENTER_LEFT" maxHeight="30.0" minHeight="30.0" prefHeight="30.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
35+
<children>
36+
<JFXButton fx:id="prevConnInfoBtn" ellipsisString="" graphicTextGap="0.0" maxWidth="30.0" minWidth="30.0" ripplerFill="BLACK" style="-fx-border-radius: 30px;" textAlignment="CENTER" textOverrun="CLIP">
37+
<styleClass>
38+
<String fx:value="bold" />
39+
<String fx:value="basic-font" />
40+
</styleClass>
41+
<cursor>
42+
<Cursor fx:constant="HAND" />
43+
</cursor>
44+
<font>
45+
<Font size="1.0" />
46+
</font>
47+
<graphic>
48+
<FontAwesomeIconView glyphName="ANGLE_LEFT" size="20" />
49+
</graphic>
50+
</JFXButton>
51+
<Label fx:id="aliasLabel" text="DB Alias">
52+
<graphic>
53+
<FontAwesomeIconView fill="#003b8e" glyphName="DATABASE" size="15" strokeWidth="0.0" />
54+
</graphic>
55+
<padding>
56+
<Insets left="5.0" right="5.0" />
57+
</padding>
58+
<font>
59+
<Font name="Noto Sans Korean Regular" size="12.0" />
60+
</font>
61+
</Label>
62+
<JFXButton fx:id="nextConnInfoBtn" ellipsisString="" graphicTextGap="0.0" maxWidth="30.0" minWidth="30.0" ripplerFill="BLACK" style="-fx-border-radius: 30px;" textAlignment="CENTER" textOverrun="CLIP">
63+
<styleClass>
64+
<String fx:value="bold" />
65+
<String fx:value="basic-font" />
66+
</styleClass>
67+
<cursor>
68+
<Cursor fx:constant="HAND" />
69+
</cursor>
70+
<font>
71+
<Font size="1.0" />
72+
</font>
73+
<graphic>
74+
<FontAwesomeIconView glyphName="ANGLE_RIGHT" size="20" />
75+
</graphic>
76+
</JFXButton>
77+
</children>
78+
</HBox>
79+
</children>
80+
</AnchorPane>
81+
<Separator prefWidth="200.0" />
82+
</children>
83+
</VBox>
84+
<StackPane fx:id="tableViewSP" layoutY="45.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="45.0">
85+
<children>
86+
<HBox fx:id="tableViewHBox">
87+
<padding>
88+
<Insets left="10.0" right="10.0" />
89+
</padding>
90+
</HBox>
91+
</children>
92+
</StackPane>
93+
</children>
94+
</fx:root>

0 commit comments

Comments
 (0)