MainUI.java 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. package com.its.vds.ui;
  2. import com.intellij.uiDesigner.core.GridConstraints;
  3. import com.intellij.uiDesigner.core.GridLayoutManager;
  4. import com.intellij.uiDesigner.core.Spacer;
  5. import com.its.app.utils.SysUtils;
  6. import com.its.vds.entity.TbVdsCtlr;
  7. import com.its.vds.global.AppRepository;
  8. import com.its.vds.service.VdsCtlrService;
  9. import com.sun.management.OperatingSystemMXBean;
  10. import lombok.Getter;
  11. import lombok.extern.slf4j.Slf4j;
  12. import org.apache.commons.lang.StringUtils;
  13. import javax.swing.Timer;
  14. import javax.swing.*;
  15. import javax.swing.border.MatteBorder;
  16. import javax.swing.plaf.FontUIResource;
  17. import javax.swing.table.DefaultTableCellRenderer;
  18. import javax.swing.table.TableCellRenderer;
  19. import javax.swing.table.TableColumnModel;
  20. import javax.swing.text.StyleContext;
  21. import java.awt.*;
  22. import java.awt.datatransfer.Clipboard;
  23. import java.awt.datatransfer.StringSelection;
  24. import java.awt.event.ActionEvent;
  25. import java.awt.event.ActionListener;
  26. import java.io.File;
  27. import java.io.IOException;
  28. import java.lang.management.ManagementFactory;
  29. import java.util.List;
  30. import java.util.*;
  31. @Slf4j
  32. @Getter
  33. public class MainUI {
  34. private static MainUI _instance = null;
  35. private VdsCtlrService vdsCtlrService = null;
  36. OperatingSystemMXBean osBean = null;
  37. private Timer timer;
  38. private Long tick = Long.valueOf(0);
  39. private CtlrSttsTableModel ctlrSttsTableModel;
  40. private TableCellRenderer cellRenderer = new CtlrSttsTableCellRenderer();
  41. private JPanel rootPanel;
  42. private JPanel pnlCtlr;
  43. private JPanel pnlLog;
  44. private JPanel pnlLogTitle;
  45. private JPanel pnlCtlrTitle;
  46. private JButton btnLogDirOpen;
  47. private JButton btnLogPause;
  48. private JCheckBox chkLogPause;
  49. private JLabel lblSystime;
  50. private JPanel pnlStatusBar;
  51. private JTable tblCtlrList;
  52. private JTextArea taLog;
  53. private JButton btnLogCopy;
  54. private JLabel lblTotal;
  55. private JLabel lblError;
  56. private JLabel lblCpuRate;
  57. private JLabel lblMemoryUsage;
  58. public static MainUI getInstance() {
  59. return _instance;
  60. }
  61. public void displaySystime() {
  62. lblSystime.setText(" " + SysUtils.getSysTimeStr() + " ");
  63. updateCommSttsTotal();
  64. }
  65. public void displayResource() {
  66. long memoryUsage = Math.round(((double) (osBean.getTotalPhysicalMemorySize() - osBean.getFreePhysicalMemorySize())) / (double) osBean.getTotalPhysicalMemorySize() * 100.0);
  67. lblMemoryUsage.setText(String.valueOf(memoryUsage));
  68. double cpuLoad = osBean.getSystemCpuLoad();
  69. lblCpuRate.setText(String.valueOf(Math.round(cpuLoad * 100.0)));
  70. }
  71. public MainUI() {
  72. System.setProperty("awt.useSystemAAFontSettings", "false"); // AntiAliasing false
  73. if (_instance == null) {
  74. _instance = this;
  75. }
  76. osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
  77. try {
  78. Font font = Font.createFont(Font.TRUETYPE_FONT, new File("fonts/D2Coding.ttc"));
  79. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  80. ge.registerFont(font);
  81. } catch (FontFormatException e) {
  82. } catch (IOException e) {
  83. }
  84. //taLog.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
  85. Font d2font = new Font("D2Coding", Font.PLAIN, 14);
  86. if (d2font != null) {
  87. taLog.setFont(d2font);
  88. }
  89. // GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  90. // String fontNames[] = ge.getAvailableFontFamilyNames();
  91. // for (int ii = 0; ii < fontNames.length; ii++) {
  92. // log.error("GraphicsEnvironment Fonts: {}", fontNames[ii]);
  93. // }
  94. // final Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
  95. // for (Font font : fonts) {
  96. // log.error("FONTS: {}", font);
  97. // }
  98. displaySystime();
  99. displayResource();
  100. timer = new Timer(1000, new ActionListener() {
  101. public void actionPerformed(ActionEvent evt) {
  102. displaySystime();
  103. tick++;
  104. if (tick % 5 == 0) {
  105. displayResource();
  106. }
  107. }
  108. });
  109. timer.start();
  110. chkLogPause.setFocusable(false);
  111. btnLogPause.setFocusable(false);
  112. btnLogDirOpen.setFocusable(false);
  113. btnLogCopy.setFocusable(false);
  114. //initTblListUI();
  115. btnLogPause.addActionListener(new ActionListener() {
  116. @Override
  117. public void actionPerformed(ActionEvent e) {
  118. taLog.setText(null);
  119. }
  120. });
  121. btnLogDirOpen.addActionListener(new ActionListener() {
  122. @Override
  123. public void actionPerformed(ActionEvent e) {
  124. Runtime rt = Runtime.getRuntime();
  125. try {
  126. rt.exec("explorer.exe logs");
  127. } catch (IOException ex) {
  128. throw new RuntimeException(ex);
  129. }
  130. }
  131. });
  132. chkLogPause.addActionListener(new ActionListener() {
  133. @Override
  134. public void actionPerformed(ActionEvent e) {
  135. JTextAreaOutputStream.isLoggingPause = chkLogPause.isSelected();
  136. }
  137. });
  138. btnLogCopy.addActionListener(new ActionListener() {
  139. @Override
  140. public void actionPerformed(ActionEvent e) {
  141. StringSelection stringSelection = new StringSelection(taLog.getText());
  142. Clipboard clpBrd = Toolkit.getDefaultToolkit().getSystemClipboard();
  143. clpBrd.setContents(stringSelection, null);
  144. }
  145. });
  146. }
  147. /**
  148. * 목록 헤더 생성
  149. */
  150. private void initTblListUI(List<TbVdsCtlr> ctlrList) {
  151. tblCtlrList.getTableHeader().setOpaque(false);
  152. tblCtlrList.getTableHeader().setBackground(Color.LIGHT_GRAY);
  153. tblCtlrList.setRowMargin(1);
  154. //tblCtlrList.setGridColor(Color.LIGHT_GRAY);
  155. tblCtlrList.setRowHeight(tblCtlrList.getRowHeight() + 5);
  156. //tblCtlrList.setRowSelectionAllowed(true);
  157. //tblCtlrList.setColumnSelectionAllowed(false);
  158. ctlrSttsTableModel = new CtlrSttsTableModel(ctlrList);
  159. tblCtlrList.setModel(ctlrSttsTableModel);
  160. tblCtlrList.setBackground(Color.WHITE);
  161. tblCtlrList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  162. //tblCtlrList.setAutoCreateRowSorter(true); // sorting
  163. //tblCtlrList.addMouseListener(new ListMouseListener(null));
  164. TableColumnModel getColumnModel = tblCtlrList.getColumnModel();
  165. getColumnModel.getColumn(0).setPreferredWidth(30); // "S",
  166. getColumnModel.getColumn(1).setPreferredWidth(75); // "번호",
  167. getColumnModel.getColumn(2).setPreferredWidth(75); // "시설물ID",
  168. getColumnModel.getColumn(3).setPreferredWidth(260); // "명칭",
  169. getColumnModel.getColumn(4).setPreferredWidth(120); // "IP",
  170. getColumnModel.getColumn(5).setPreferredWidth(55); // "PORT",
  171. getColumnModel.getColumn(6).setPreferredWidth(70); // "연결상태",
  172. getColumnModel.getColumn(7).setPreferredWidth(50); // "도어",
  173. getColumnModel.getColumn(8).setPreferredWidth(50); // "팬",
  174. getColumnModel.getColumn(9).setPreferredWidth(50); // "히터",
  175. getColumnModel.getColumn(10).setPreferredWidth(50); // "온도",
  176. getColumnModel.getColumn(11).setPreferredWidth(50); // "Video",
  177. getColumnModel.getColumn(12).setPreferredWidth(120);
  178. getColumnModel.getColumn(13).setPreferredWidth(120);
  179. getColumnModel.getColumn(0).setMaxWidth(30);
  180. getColumnModel.getColumn(0).setMinWidth(30);
  181. getColumnModel.getColumn(0).setResizable(false);
  182. Color color = UIManager.getColor("Table.gridColor");
  183. MatteBorder border = new MatteBorder(1, 1, 0, 0, color);
  184. tblCtlrList.setBorder(border);
  185. DefaultTableCellRenderer centerAlign = new DefaultTableCellRenderer();
  186. centerAlign.setHorizontalAlignment(JLabel.CENTER);
  187. for (int ii = 0; ii < getColumnModel.getColumnCount(); ii++) {
  188. getColumnModel.getColumn(ii).setCellRenderer(cellRenderer);
  189. }
  190. }
  191. public void updateCommSttsTotal() {
  192. int ctlrTotal = 0;
  193. int ctlrError = 0;
  194. for (Map.Entry<String, TbVdsCtlr> e : AppRepository.getInstance().getCtlrMap().entrySet()) {
  195. TbVdsCtlr obj = e.getValue();
  196. if (StringUtils.equals("N", obj.getDEL_YN()) && StringUtils.equals("Y", obj.getVALD_YN())) {
  197. ctlrTotal++;
  198. if (!"CMS0".equals(obj.getStts().getCMNC_STTS_CD())) {
  199. ctlrError++;
  200. }
  201. }
  202. }
  203. lblTotal.setText(" " + ctlrTotal + " ");
  204. lblError.setText(" " + ctlrError + " ");
  205. }
  206. public void LoadControllerInfo(VdsCtlrService vdsCtlrService) {
  207. this.vdsCtlrService = vdsCtlrService;
  208. SortedMap<Integer, TbVdsCtlr> ctlrMap = new TreeMap<>();
  209. for (Map.Entry<String, TbVdsCtlr> e : AppRepository.getInstance().getCtlrMap().entrySet()) {
  210. TbVdsCtlr obj = e.getValue();
  211. if (StringUtils.equals("N", obj.getDEL_YN()) && StringUtils.equals("Y", obj.getVALD_YN())) {
  212. ctlrMap.put(Integer.valueOf(obj.getVDS_CTLR_NMBR()), obj);
  213. }
  214. }
  215. List<TbVdsCtlr> ctlrList = new ArrayList<TbVdsCtlr>(ctlrMap.values());
  216. initTblListUI(ctlrList);
  217. // for (Map.Entry<Integer, TbVdsCtlr> e : ctlrMap.entrySet()) {
  218. // TbVdsCtlr obj = e.getValue();
  219. // ctlrSttsTableModel.Add(obj);
  220. // }
  221. updateCommSttsTotal();
  222. }
  223. public void updateCtlrStts(TbVdsCtlr obj) {
  224. //CtlrSttsTableModel ctlrSttsTableModel = (CtlrSttsTableModel)tblCtlrList.getModel();
  225. for (int ii = 0; ii < ctlrSttsTableModel.getRowCount(); ii++) {
  226. if (obj.getVDS_CTLR_ID().equals(ctlrSttsTableModel.getValueAt(ii, 2).toString())) {
  227. int modelRow = tblCtlrList.convertRowIndexToModel(ii);
  228. // //int viewColumn = tblCtlrList.getSelectedColumn();
  229. // int modelColumn = tblCtlrList.convertColumnIndexToModel(4);
  230. // Object cell = tblCtlrList.getValueAt(modelRow, modelColumn);
  231. // log.error("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: {}", cell);
  232. ctlrSttsTableModel.setValue(obj, ii, modelRow);
  233. break;
  234. }
  235. }
  236. }
  237. {
  238. // GUI initializer generated by IntelliJ IDEA GUI Designer
  239. // >>> IMPORTANT!! <<<
  240. // DO NOT EDIT OR ADD ANY CODE HERE!
  241. $$$setupUI$$$();
  242. }
  243. /**
  244. * Method generated by IntelliJ IDEA GUI Designer
  245. * >>> IMPORTANT!! <<<
  246. * DO NOT edit this method OR call it in your code!
  247. *
  248. * @noinspection ALL
  249. */
  250. private void $$$setupUI$$$() {
  251. rootPanel = new JPanel();
  252. rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
  253. pnlCtlr = new JPanel();
  254. pnlCtlr.setLayout(new GridLayoutManager(2, 1, new Insets(10, 4, 0, 4), -1, -1));
  255. rootPanel.add(pnlCtlr, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
  256. pnlCtlrTitle = new JPanel();
  257. pnlCtlrTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), -1, -1));
  258. pnlCtlr.add(pnlCtlrTitle, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
  259. final JLabel label1 = new JLabel();
  260. Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont());
  261. if (label1Font != null) label1.setFont(label1Font);
  262. label1.setHorizontalAlignment(2);
  263. label1.setHorizontalTextPosition(11);
  264. label1.setIcon(new ImageIcon(getClass().getResource("/static/image/controller.png")));
  265. label1.setText("제어기 정보");
  266. pnlCtlrTitle.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  267. final Spacer spacer1 = new Spacer();
  268. pnlCtlrTitle.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  269. final JLabel label2 = new JLabel();
  270. Font label2Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label2.getFont());
  271. if (label2Font != null) label2.setFont(label2Font);
  272. label2.setText("제어기 전체: ");
  273. pnlCtlrTitle.add(label2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  274. final JLabel label3 = new JLabel();
  275. Font label3Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label3.getFont());
  276. if (label3Font != null) label3.setFont(label3Font);
  277. label3.setText("통신 이상: ");
  278. pnlCtlrTitle.add(label3, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  279. lblTotal = new JLabel();
  280. Font lblTotalFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblTotal.getFont());
  281. if (lblTotalFont != null) lblTotal.setFont(lblTotalFont);
  282. lblTotal.setHorizontalAlignment(0);
  283. lblTotal.setHorizontalTextPosition(0);
  284. lblTotal.setText(" -");
  285. pnlCtlrTitle.add(lblTotal, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  286. lblError = new JLabel();
  287. Font lblErrorFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblError.getFont());
  288. if (lblErrorFont != null) lblError.setFont(lblErrorFont);
  289. lblError.setForeground(new Color(-65536));
  290. lblError.setHorizontalAlignment(0);
  291. lblError.setHorizontalTextPosition(0);
  292. lblError.setText(" -");
  293. pnlCtlrTitle.add(lblError, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  294. final JScrollPane scrollPane1 = new JScrollPane();
  295. pnlCtlr.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
  296. tblCtlrList = new JTable();
  297. Font tblCtlrListFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tblCtlrList.getFont());
  298. if (tblCtlrListFont != null) tblCtlrList.setFont(tblCtlrListFont);
  299. scrollPane1.setViewportView(tblCtlrList);
  300. pnlLog = new JPanel();
  301. pnlLog.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
  302. rootPanel.add(pnlLog, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 300), new Dimension(-1, 300), new Dimension(-1, 300), 0, false));
  303. pnlLogTitle = new JPanel();
  304. pnlLogTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), 1, 1));
  305. pnlLog.add(pnlLogTitle, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
  306. final JLabel label4 = new JLabel();
  307. Font label4Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label4.getFont());
  308. if (label4Font != null) label4.setFont(label4Font);
  309. label4.setHorizontalAlignment(2);
  310. label4.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
  311. label4.setText("시스템 로그");
  312. pnlLogTitle.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  313. final Spacer spacer2 = new Spacer();
  314. pnlLogTitle.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  315. btnLogDirOpen = new JButton();
  316. Font btnLogDirOpenFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogDirOpen.getFont());
  317. if (btnLogDirOpenFont != null) btnLogDirOpen.setFont(btnLogDirOpenFont);
  318. btnLogDirOpen.setHorizontalTextPosition(0);
  319. btnLogDirOpen.setText("로그 폴더");
  320. pnlLogTitle.add(btnLogDirOpen, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  321. btnLogPause = new JButton();
  322. Font btnLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogPause.getFont());
  323. if (btnLogPauseFont != null) btnLogPause.setFont(btnLogPauseFont);
  324. btnLogPause.setHorizontalTextPosition(0);
  325. btnLogPause.setText("지우기");
  326. pnlLogTitle.add(btnLogPause, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  327. chkLogPause = new JCheckBox();
  328. Font chkLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkLogPause.getFont());
  329. if (chkLogPauseFont != null) chkLogPause.setFont(chkLogPauseFont);
  330. chkLogPause.setHorizontalAlignment(0);
  331. chkLogPause.setHorizontalTextPosition(11);
  332. chkLogPause.setText("멈춤");
  333. pnlLogTitle.add(chkLogPause, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  334. btnLogCopy = new JButton();
  335. Font btnLogCopyFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogCopy.getFont());
  336. if (btnLogCopyFont != null) btnLogCopy.setFont(btnLogCopyFont);
  337. btnLogCopy.setText("복사");
  338. pnlLogTitle.add(btnLogCopy, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  339. final JScrollPane scrollPane2 = new JScrollPane();
  340. Font scrollPane2Font = this.$$$getFont$$$("D2Coding", Font.PLAIN, 12, scrollPane2.getFont());
  341. if (scrollPane2Font != null) scrollPane2.setFont(scrollPane2Font);
  342. pnlLog.add(scrollPane2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
  343. taLog = new JTextArea();
  344. taLog.setBackground(new Color(-16777216));
  345. taLog.setCaretColor(new Color(-1));
  346. taLog.setEditable(false);
  347. Font taLogFont = this.$$$getFont$$$("D2Coding", Font.PLAIN, 14, taLog.getFont());
  348. if (taLogFont != null) taLog.setFont(taLogFont);
  349. taLog.setForeground(new Color(-1));
  350. taLog.setMargin(new Insets(4, 4, 4, 4));
  351. taLog.setText("[10:50:08.561] [ INFO] ************************************************************************************\n[10:50:08.561] [ INFO] ** Center Communication Server Information **\n[10:50:08.561] [ INFO] ** bindAddress: 0.0.0.0\n[10:50:08.561] [ INFO] ** listenPort: 9901\n[10:50:08.561] [ INFO] ** backlog: 1024\n[10:50:08.561] [ INFO] ** acceptThreads: 16\n[10:50:08.561] [ INFO] ** workerThreads: 16\n[10:50:08.561] [ INFO] ************************************************************************************\n");
  352. scrollPane2.setViewportView(taLog);
  353. pnlStatusBar = new JPanel();
  354. pnlStatusBar.setLayout(new GridLayoutManager(1, 7, new Insets(0, 4, 4, 4), -1, -1));
  355. rootPanel.add(pnlStatusBar, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
  356. final Spacer spacer3 = new Spacer();
  357. pnlStatusBar.add(spacer3, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  358. lblSystime = new JLabel();
  359. Font lblSystimeFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblSystime.getFont());
  360. if (lblSystimeFont != null) lblSystime.setFont(lblSystimeFont);
  361. lblSystime.setHorizontalAlignment(0);
  362. lblSystime.setHorizontalTextPosition(0);
  363. lblSystime.setText(" 2022-08-04 13:24:33 ");
  364. pnlStatusBar.add(lblSystime, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  365. final JLabel label5 = new JLabel();
  366. label5.setIcon(new ImageIcon(getClass().getResource("/static/image/on.png")));
  367. label5.setText(" ");
  368. pnlStatusBar.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  369. lblCpuRate = new JLabel();
  370. Font lblCpuRateFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblCpuRate.getFont());
  371. if (lblCpuRateFont != null) lblCpuRate.setFont(lblCpuRateFont);
  372. lblCpuRate.setHorizontalAlignment(2);
  373. lblCpuRate.setHorizontalTextPosition(0);
  374. lblCpuRate.setText(" ");
  375. pnlStatusBar.add(lblCpuRate, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, -1), new Dimension(40, -1), new Dimension(40, -1), 0, false));
  376. lblMemoryUsage = new JLabel();
  377. Font lblMemoryUsageFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblMemoryUsage.getFont());
  378. if (lblMemoryUsageFont != null) lblMemoryUsage.setFont(lblMemoryUsageFont);
  379. lblMemoryUsage.setHorizontalAlignment(2);
  380. lblMemoryUsage.setHorizontalTextPosition(0);
  381. lblMemoryUsage.setText(" ");
  382. pnlStatusBar.add(lblMemoryUsage, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, -1), new Dimension(40, -1), new Dimension(40, -1), 0, false));
  383. final JLabel label6 = new JLabel();
  384. Font label6Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label6.getFont());
  385. if (label6Font != null) label6.setFont(label6Font);
  386. label6.setHorizontalAlignment(0);
  387. label6.setHorizontalTextPosition(0);
  388. label6.setText(" CPU 사용율(%):");
  389. pnlStatusBar.add(label6, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  390. final JLabel label7 = new JLabel();
  391. Font label7Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label7.getFont());
  392. if (label7Font != null) label7.setFont(label7Font);
  393. label7.setHorizontalAlignment(0);
  394. label7.setHorizontalTextPosition(0);
  395. label7.setText(" 메모리 사용율(%):");
  396. pnlStatusBar.add(label7, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  397. }
  398. /**
  399. * @noinspection ALL
  400. */
  401. private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
  402. if (currentFont == null) return null;
  403. String resultName;
  404. if (fontName == null) {
  405. resultName = currentFont.getName();
  406. } else {
  407. Font testFont = new Font(fontName, Font.PLAIN, 10);
  408. if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
  409. resultName = fontName;
  410. } else {
  411. resultName = currentFont.getName();
  412. }
  413. }
  414. Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
  415. boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
  416. Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
  417. return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
  418. }
  419. /**
  420. * @noinspection ALL
  421. */
  422. public JComponent $$$getRootComponent$$$() {
  423. return rootPanel;
  424. }
  425. }