MainUI.java 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. package com.its.traf.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.traf.global.AppRepository;
  7. import com.its.traf.global.TrafJobVo;
  8. import com.sun.management.OperatingSystemMXBean;
  9. import lombok.Getter;
  10. import lombok.extern.slf4j.Slf4j;
  11. import javax.swing.Timer;
  12. import javax.swing.*;
  13. import javax.swing.border.MatteBorder;
  14. import javax.swing.plaf.FontUIResource;
  15. import javax.swing.table.TableCellRenderer;
  16. import javax.swing.table.TableColumnModel;
  17. import javax.swing.text.StyleContext;
  18. import java.awt.*;
  19. import java.awt.datatransfer.Clipboard;
  20. import java.awt.datatransfer.StringSelection;
  21. import java.awt.event.ActionEvent;
  22. import java.awt.event.ActionListener;
  23. import java.awt.event.MouseAdapter;
  24. import java.awt.event.MouseEvent;
  25. import java.io.File;
  26. import java.io.IOException;
  27. import java.lang.management.ManagementFactory;
  28. import java.util.List;
  29. import java.util.*;
  30. @Slf4j
  31. @Getter
  32. public class MainUI {
  33. private static MainUI _instance = null;
  34. private SubUIController subUIController = null;
  35. private JFrame jFrame = null;
  36. private final OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
  37. private Timer timer;
  38. private Long tick = Long.valueOf(0);
  39. private TrafJobVo selObj = null;
  40. private TrafPrcsTableModel trafPrcsTableModel = null;
  41. private TrafPrcsTableModel trafStatTableModel = null;
  42. private TableCellRenderer cellPrcsRender = new TrafPrcsTableCellRenderer();
  43. private TableCellRenderer cellStatRender = new TrafPrcsTableCellRenderer();
  44. private JPanel rootPanel;
  45. private JPanel pnlCtlr;
  46. private JPanel pnlLog;
  47. private JPanel pnlLogTitle;
  48. private JButton btnLogDirOpen;
  49. private JButton btnLogPause;
  50. private JCheckBox chkLogPause;
  51. private JLabel lblSystime;
  52. private JPanel pnlStatusBar;
  53. private JTextArea taLog;
  54. private JButton btnLogCopy;
  55. private JLabel lblCpuRate;
  56. private JLabel lblMemoryUsage;
  57. private JTabbedPane tabInfo;
  58. private JPanel tabPrcs;
  59. private JTable listPrcs;
  60. private JPanel tabStat;
  61. private JTable listStat;
  62. private boolean isUpdatable;
  63. public static MainUI getInstance() {
  64. return _instance;
  65. }
  66. public void displaySystime() {
  67. lblSystime.setText(" " + SysUtils.getSysTimeStr() + " ");
  68. }
  69. public void displayResource() {
  70. long memoryUsage = Math.round(((double) (this.osBean.getTotalPhysicalMemorySize() - this.osBean.getFreePhysicalMemorySize())) / (double) this.osBean.getTotalPhysicalMemorySize() * 100.0);
  71. lblMemoryUsage.setText(String.valueOf(memoryUsage));
  72. double cpuLoad = this.osBean.getSystemCpuLoad();
  73. // double cpuLoad = getCpuLoad();
  74. // long t = System.currentTimeMillis();
  75. // while ((System.currentTimeMillis() < t + 5000)) {
  76. // if (cpuLoad >= 0.0 && cpuLoad <= 1.0) {
  77. // break;
  78. // }
  79. // cpuLoad = osBean.getSystemCpuLoad();
  80. // }
  81. if (cpuLoad >= 0.0 && cpuLoad <= 1.0) {
  82. lblCpuRate.setText(String.valueOf(Math.round(cpuLoad * 100.0)));
  83. } else {
  84. lblCpuRate.setText("---");
  85. }
  86. // try {
  87. // MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
  88. // ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem");
  89. // AttributeList list = mbs.getAttributes(name, new String[]{"ProcessCpuLoad"});
  90. //
  91. // log.error("{}", mbs);
  92. // log.error("{}", name);
  93. // log.error("{}", list);
  94. //
  95. // } catch (Exception ex) {
  96. // }
  97. }
  98. // public double getCpuLoad() {
  99. // OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
  100. // double load;
  101. // try {
  102. // Method method = OperatingSystemMXBean.class.getMethod("getSystemLoadAverage", new Class<?>[0]);
  103. // load = (Double) method.invoke(operatingSystemMXBean, new Object[0]);
  104. // if (load == -1) {
  105. // OperatingSystemMXBean bean = (OperatingSystemMXBean) operatingSystemMXBean;
  106. // load = bean.getSystemCpuLoad();
  107. // }
  108. // } catch (Throwable e) {
  109. // load = -1;
  110. // }
  111. // return load;
  112. // }
  113. //
  114. // public float getCpuUsed() {
  115. // OperatingSystemMXBean osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
  116. // long previousJvmProcessCpuTime = osMXBean.getProcessCpuTime();
  117. // int sleepTime = 350;
  118. // try {
  119. // TimeUnit.MILLISECONDS.sleep(sleepTime);
  120. // } catch (InterruptedException e) {
  121. // log.error("InterruptedException occurred while MemoryCollector sleeping...");
  122. // }
  123. // long elapsedProcessCpuTime = osMXBean.getProcessCpuTime() - previousJvmProcessCpuTime;
  124. // long elapsedJvmUptime = sleepTime;
  125. // //long totalElapsedJvmUptime = elapsedJvmUptime * osMXBean.getAvailableProcessors() ;
  126. // long totalElapsedJvmUptime = elapsedJvmUptime;
  127. // //System.out.println("echo cpu processors num " + osMXBean.getAvailableProcessors());
  128. // float cpuUsage = elapsedProcessCpuTime / (totalElapsedJvmUptime * 10000F);
  129. // return (float) (Math.round(cpuUsage * 10) / 10);
  130. // }
  131. public MainUI(JFrame jFrame) {
  132. System.setProperty("awt.useSystemAAFontSettings", "false"); // AntiAliasing false
  133. this.isUpdatable = false;
  134. this.jFrame = jFrame;
  135. if (_instance == null) {
  136. _instance = this;
  137. subUIController = new SubUIController(jFrame);
  138. subUIController.setVisible(false);
  139. }
  140. try {
  141. Font font = Font.createFont(Font.TRUETYPE_FONT, new File("fonts/D2Coding.ttc"));
  142. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  143. ge.registerFont(font);
  144. } catch (FontFormatException e) {
  145. } catch (IOException e) {
  146. }
  147. Font d2font = new Font("D2Coding", Font.PLAIN, 14);
  148. if (d2font != null) {
  149. taLog.setFont(d2font);
  150. }
  151. displaySystime();
  152. displayResource();
  153. timer = new Timer(1000, new ActionListener() {
  154. public void actionPerformed(ActionEvent evt) {
  155. displaySystime();
  156. tick++;
  157. if (tick % 5 == 0) {
  158. displayResource();
  159. }
  160. }
  161. });
  162. timer.start();
  163. chkLogPause.setFocusable(false);
  164. btnLogPause.setFocusable(false);
  165. btnLogDirOpen.setFocusable(false);
  166. btnLogCopy.setFocusable(false);
  167. btnLogPause.addActionListener(new ActionListener() {
  168. @Override
  169. public void actionPerformed(ActionEvent e) {
  170. taLog.setText(null);
  171. }
  172. });
  173. btnLogDirOpen.addActionListener(new ActionListener() {
  174. @Override
  175. public void actionPerformed(ActionEvent e) {
  176. Runtime rt = Runtime.getRuntime();
  177. try {
  178. rt.exec("explorer.exe logs");
  179. } catch (IOException ex) {
  180. throw new RuntimeException(ex);
  181. }
  182. }
  183. });
  184. chkLogPause.addActionListener(new ActionListener() {
  185. @Override
  186. public void actionPerformed(ActionEvent e) {
  187. JTextAreaOutputStream.isLoggingPause = chkLogPause.isSelected();
  188. }
  189. });
  190. btnLogCopy.addActionListener(new ActionListener() {
  191. @Override
  192. public void actionPerformed(ActionEvent e) {
  193. StringSelection stringSelection = new StringSelection(taLog.getText());
  194. Clipboard clpBrd = Toolkit.getDefaultToolkit().getSystemClipboard();
  195. clpBrd.setContents(stringSelection, null);
  196. }
  197. });
  198. listPrcs.addMouseListener(new MouseAdapter() {
  199. public void mouseClicked(MouseEvent me) {
  200. if (me.getClickCount() == 2) {
  201. updateControllerInfo(listPrcs);
  202. }
  203. }
  204. });
  205. listStat.addMouseListener(new MouseAdapter() {
  206. public void mouseClicked(MouseEvent me) {
  207. if (me.getClickCount() == 2) {
  208. updateControllerInfo(listStat);
  209. }
  210. }
  211. });
  212. }
  213. private boolean updateControllerInfo(JTable listInfo) {
  214. if (subUIController.isVisible()) {
  215. subUIController.setVisible(false);
  216. }
  217. if (!this.isUpdatable) {
  218. return false;
  219. }
  220. int row = listInfo.getSelectedRow();
  221. if (row < 0) {
  222. return false;
  223. }
  224. TrafPrcsTableModel tableModel = (TrafPrcsTableModel) listInfo.getModel();
  225. selObj = tableModel.getControllerInfo(row);
  226. if (selObj != null) {
  227. subUIController.updateInfo(selObj);
  228. if (!subUIController.isVisible()) {
  229. subUIController.setVisible(true);
  230. }
  231. return true;
  232. }
  233. return true;
  234. }
  235. /**
  236. * 목록 헤더 생성
  237. */
  238. private void initTblListUI(List<TrafJobVo> prcsList, List<TrafJobVo> statList) {
  239. this.trafPrcsTableModel = new TrafPrcsTableModel(prcsList);
  240. this.trafStatTableModel = new TrafPrcsTableModel(statList);
  241. listPrcs.setModel(this.trafPrcsTableModel);
  242. listStat.setModel(this.trafStatTableModel);
  243. listPrcs.getTableHeader().setOpaque(false);
  244. listPrcs.getTableHeader().setBackground(Color.LIGHT_GRAY);
  245. listPrcs.setRowMargin(1);
  246. listPrcs.setRowHeight(listPrcs.getRowHeight() + 5);
  247. listPrcs.setBackground(Color.WHITE);
  248. listPrcs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  249. TableColumnModel getColumnModel = listPrcs.getColumnModel();
  250. getColumnModel.getColumn(0).setPreferredWidth(30); // "S",
  251. getColumnModel.getColumn(1).setPreferredWidth(180); // "작업명",
  252. getColumnModel.getColumn(2).setPreferredWidth(230); // "타겟",
  253. getColumnModel.getColumn(3).setPreferredWidth(150); // "시작시각",
  254. getColumnModel.getColumn(4).setPreferredWidth(150); // "종료시각",
  255. getColumnModel.getColumn(5).setPreferredWidth(60); // "건수(EA)",
  256. getColumnModel.getColumn(6).setPreferredWidth(60); // "작업시간(ms)",
  257. getColumnModel.getColumn(7).setPreferredWidth(60); // "평균작업시간",
  258. getColumnModel.getColumn(0).setMaxWidth(30);
  259. getColumnModel.getColumn(0).setMinWidth(30);
  260. getColumnModel.getColumn(0).setResizable(false);
  261. Color color = UIManager.getColor("Table.gridColor");
  262. MatteBorder border = new MatteBorder(1, 1, 0, 0, color);
  263. listPrcs.setBorder(border);
  264. for (int ii = 0; ii < getColumnModel.getColumnCount(); ii++) {
  265. getColumnModel.getColumn(ii).setCellRenderer(this.cellPrcsRender);
  266. }
  267. listStat.getTableHeader().setOpaque(false);
  268. listStat.getTableHeader().setBackground(Color.LIGHT_GRAY);
  269. listStat.setRowMargin(1);
  270. listStat.setRowHeight(listStat.getRowHeight() + 5);
  271. listStat.setBackground(Color.WHITE);
  272. listStat.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  273. TableColumnModel getColumnModel_ = listStat.getColumnModel();
  274. getColumnModel_.getColumn(0).setPreferredWidth(30); // "S",
  275. getColumnModel_.getColumn(1).setPreferredWidth(140); // "작업명",
  276. getColumnModel_.getColumn(2).setPreferredWidth(220); // "타겟",
  277. getColumnModel_.getColumn(3).setPreferredWidth(140); // "시작시각",
  278. getColumnModel_.getColumn(4).setPreferredWidth(140); // "종료시각",
  279. getColumnModel_.getColumn(5).setPreferredWidth(70); // "건수(EA)",
  280. getColumnModel_.getColumn(6).setPreferredWidth(70); // "작업시간(ms)",
  281. getColumnModel_.getColumn(7).setPreferredWidth(70); // "평균작업시간",
  282. getColumnModel_.getColumn(0).setMaxWidth(30);
  283. getColumnModel_.getColumn(0).setMinWidth(30);
  284. getColumnModel_.getColumn(0).setResizable(false);
  285. listStat.setBorder(border);
  286. for (int ii = 0; ii < getColumnModel_.getColumnCount(); ii++) {
  287. getColumnModel_.getColumn(ii).setCellRenderer(this.cellStatRender);
  288. }
  289. this.isUpdatable = true;
  290. }
  291. public void LoadControllerInfo() {
  292. SortedMap<Integer, TrafJobVo> prcsMap = new TreeMap<>();
  293. for (Map.Entry<Integer, TrafJobVo> e : AppRepository.getInstance().getPrcsMap().entrySet()) {
  294. TrafJobVo obj = e.getValue();
  295. prcsMap.put(obj.getJobSeq(), obj);
  296. }
  297. SortedMap<Integer, TrafJobVo> statMap = new TreeMap<>();
  298. for (Map.Entry<Integer, TrafJobVo> e : AppRepository.getInstance().getStatMap().entrySet()) {
  299. TrafJobVo obj = e.getValue();
  300. statMap.put(obj.getJobSeq(), obj);
  301. }
  302. // List<TrafPrcsVo> prcsList = new ArrayList<TrafPrcsVo>(AppRepository.getInstance().getPrcsMap().values());
  303. // List<TrafPrcsVo> statList = new ArrayList<TrafPrcsVo>(AppRepository.getInstance().getStatMap().values());
  304. List<TrafJobVo> prcsList = new ArrayList<TrafJobVo>(prcsMap.values());
  305. List<TrafJobVo> statList = new ArrayList<TrafJobVo>(statMap.values());
  306. initTblListUI(prcsList, statList);
  307. }
  308. public void updateTrafPrcs() {
  309. if (!this.isUpdatable) {
  310. return;
  311. }
  312. try {
  313. TrafPrcsTableModel tableModel = (TrafPrcsTableModel) this.listPrcs.getModel();
  314. if (tableModel != null) {
  315. tableModel.fireTableDataChanged();
  316. }
  317. } catch (ClassCastException e) {
  318. log.error("Cast MainUI.updateTrafPrcs Error");
  319. }
  320. }
  321. public void updateTrafStat() {
  322. if (!this.isUpdatable) {
  323. return;
  324. }
  325. try {
  326. TrafPrcsTableModel tableModel = (TrafPrcsTableModel) this.listStat.getModel();
  327. if (tableModel != null) {
  328. tableModel.fireTableDataChanged();
  329. }
  330. } catch (ClassCastException e) {
  331. log.error("Cast MainUI.updateTrafStat Error");
  332. }
  333. }
  334. {
  335. // GUI initializer generated by IntelliJ IDEA GUI Designer
  336. // >>> IMPORTANT!! <<<
  337. // DO NOT EDIT OR ADD ANY CODE HERE!
  338. $$$setupUI$$$();
  339. }
  340. /**
  341. * Method generated by IntelliJ IDEA GUI Designer
  342. * >>> IMPORTANT!! <<<
  343. * DO NOT edit this method OR call it in your code!
  344. *
  345. * @noinspection ALL
  346. */
  347. private void $$$setupUI$$$() {
  348. rootPanel = new JPanel();
  349. rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
  350. pnlCtlr = new JPanel();
  351. pnlCtlr.setLayout(new GridLayoutManager(1, 1, new Insets(10, 4, 0, 4), -1, -1));
  352. 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));
  353. tabInfo = new JTabbedPane();
  354. Font tabInfoFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tabInfo.getFont());
  355. if (tabInfoFont != null) tabInfo.setFont(tabInfoFont);
  356. pnlCtlr.add(tabInfo, 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, new Dimension(200, 200), null, 0, false));
  357. tabPrcs = new JPanel();
  358. tabPrcs.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
  359. Font tabPrcsFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tabPrcs.getFont());
  360. if (tabPrcsFont != null) tabPrcs.setFont(tabPrcsFont);
  361. tabInfo.addTab(" 교통정보가공 ", tabPrcs);
  362. final JScrollPane scrollPane1 = new JScrollPane();
  363. tabPrcs.add(scrollPane1, 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));
  364. listPrcs = new JTable();
  365. scrollPane1.setViewportView(listPrcs);
  366. tabStat = new JPanel();
  367. tabStat.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
  368. Font tabStatFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tabStat.getFont());
  369. if (tabStatFont != null) tabStat.setFont(tabStatFont);
  370. tabInfo.addTab(" 통계정보생성 ", tabStat);
  371. final JScrollPane scrollPane2 = new JScrollPane();
  372. tabStat.add(scrollPane2, 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));
  373. listStat = new JTable();
  374. scrollPane2.setViewportView(listStat);
  375. pnlLog = new JPanel();
  376. pnlLog.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
  377. 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, 250), new Dimension(-1, 250), new Dimension(-1, 250), 0, false));
  378. pnlLogTitle = new JPanel();
  379. pnlLogTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), 1, 1));
  380. 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));
  381. final JLabel label1 = new JLabel();
  382. Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont());
  383. if (label1Font != null) label1.setFont(label1Font);
  384. label1.setHorizontalAlignment(2);
  385. label1.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
  386. label1.setText("시스템 로그");
  387. pnlLogTitle.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));
  388. final Spacer spacer1 = new Spacer();
  389. pnlLogTitle.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  390. btnLogDirOpen = new JButton();
  391. Font btnLogDirOpenFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogDirOpen.getFont());
  392. if (btnLogDirOpenFont != null) btnLogDirOpen.setFont(btnLogDirOpenFont);
  393. btnLogDirOpen.setHorizontalTextPosition(0);
  394. btnLogDirOpen.setText("로그 폴더");
  395. 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));
  396. btnLogPause = new JButton();
  397. Font btnLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogPause.getFont());
  398. if (btnLogPauseFont != null) btnLogPause.setFont(btnLogPauseFont);
  399. btnLogPause.setHorizontalTextPosition(0);
  400. btnLogPause.setText("지우기");
  401. 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));
  402. chkLogPause = new JCheckBox();
  403. Font chkLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkLogPause.getFont());
  404. if (chkLogPauseFont != null) chkLogPause.setFont(chkLogPauseFont);
  405. chkLogPause.setHorizontalAlignment(0);
  406. chkLogPause.setHorizontalTextPosition(11);
  407. chkLogPause.setText("멈춤");
  408. 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));
  409. btnLogCopy = new JButton();
  410. Font btnLogCopyFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogCopy.getFont());
  411. if (btnLogCopyFont != null) btnLogCopy.setFont(btnLogCopyFont);
  412. btnLogCopy.setText("복사");
  413. 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));
  414. final JScrollPane scrollPane3 = new JScrollPane();
  415. Font scrollPane3Font = this.$$$getFont$$$("D2Coding", Font.PLAIN, 12, scrollPane3.getFont());
  416. if (scrollPane3Font != null) scrollPane3.setFont(scrollPane3Font);
  417. pnlLog.add(scrollPane3, 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));
  418. taLog = new JTextArea();
  419. taLog.setBackground(new Color(-16777216));
  420. taLog.setCaretColor(new Color(-1));
  421. taLog.setEditable(false);
  422. Font taLogFont = this.$$$getFont$$$("D2Coding", Font.PLAIN, 14, taLog.getFont());
  423. if (taLogFont != null) taLog.setFont(taLogFont);
  424. taLog.setForeground(new Color(-1));
  425. taLog.setMargin(new Insets(4, 4, 4, 4));
  426. 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");
  427. scrollPane3.setViewportView(taLog);
  428. pnlStatusBar = new JPanel();
  429. pnlStatusBar.setLayout(new GridLayoutManager(1, 7, new Insets(0, 4, 4, 4), -1, -1));
  430. 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));
  431. final Spacer spacer2 = new Spacer();
  432. pnlStatusBar.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  433. lblSystime = new JLabel();
  434. Font lblSystimeFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblSystime.getFont());
  435. if (lblSystimeFont != null) lblSystime.setFont(lblSystimeFont);
  436. lblSystime.setHorizontalAlignment(0);
  437. lblSystime.setHorizontalTextPosition(0);
  438. lblSystime.setText(" 2022-08-04 13:24:33 ");
  439. 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));
  440. final JLabel label2 = new JLabel();
  441. label2.setIcon(new ImageIcon(getClass().getResource("/static/image/on.png")));
  442. label2.setText(" ");
  443. pnlStatusBar.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  444. lblCpuRate = new JLabel();
  445. Font lblCpuRateFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblCpuRate.getFont());
  446. if (lblCpuRateFont != null) lblCpuRate.setFont(lblCpuRateFont);
  447. lblCpuRate.setHorizontalAlignment(2);
  448. lblCpuRate.setHorizontalTextPosition(0);
  449. lblCpuRate.setText(" ");
  450. 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));
  451. lblMemoryUsage = new JLabel();
  452. Font lblMemoryUsageFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblMemoryUsage.getFont());
  453. if (lblMemoryUsageFont != null) lblMemoryUsage.setFont(lblMemoryUsageFont);
  454. lblMemoryUsage.setHorizontalAlignment(2);
  455. lblMemoryUsage.setHorizontalTextPosition(0);
  456. lblMemoryUsage.setText(" ");
  457. 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));
  458. final JLabel label3 = new JLabel();
  459. Font label3Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label3.getFont());
  460. if (label3Font != null) label3.setFont(label3Font);
  461. label3.setHorizontalAlignment(0);
  462. label3.setHorizontalTextPosition(0);
  463. label3.setText(" CPU 사용율(%):");
  464. pnlStatusBar.add(label3, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  465. final JLabel label4 = new JLabel();
  466. Font label4Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label4.getFont());
  467. if (label4Font != null) label4.setFont(label4Font);
  468. label4.setHorizontalAlignment(0);
  469. label4.setHorizontalTextPosition(0);
  470. label4.setText(" 메모리 사용율(%):");
  471. pnlStatusBar.add(label4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  472. }
  473. /**
  474. * @noinspection ALL
  475. */
  476. private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
  477. if (currentFont == null) return null;
  478. String resultName;
  479. if (fontName == null) {
  480. resultName = currentFont.getName();
  481. } else {
  482. Font testFont = new Font(fontName, Font.PLAIN, 10);
  483. if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
  484. resultName = fontName;
  485. } else {
  486. resultName = currentFont.getName();
  487. }
  488. }
  489. Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
  490. boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
  491. Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
  492. return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
  493. }
  494. /**
  495. * @noinspection ALL
  496. */
  497. public JComponent $$$getRootComponent$$$() {
  498. return rootPanel;
  499. }
  500. }