MainUI.java 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. package com.its.dsrc.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.dsrc.domain.NET;
  7. import com.its.dsrc.entity.TbRseCtlr;
  8. import com.its.dsrc.global.AppRepository;
  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.awt.event.MouseAdapter;
  27. import java.awt.event.MouseEvent;
  28. import java.io.File;
  29. import java.io.IOException;
  30. import java.lang.management.ManagementFactory;
  31. import java.util.List;
  32. import java.util.*;
  33. @Slf4j
  34. @Getter
  35. public class MainUI {
  36. private static MainUI _instance = null;
  37. private JFrame jFrame = null;
  38. private final OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
  39. private Timer timer;
  40. private Long tick = Long.valueOf(0);
  41. private TbRseCtlr selObj = null;
  42. private CtlrSttsTableModel ctlrSttsTableModel = null;
  43. private TableCellRenderer cellRenderer = new CtlrSttsTableCellRenderer();
  44. private JPanel rootPanel;
  45. private JPanel pnlCtlr;
  46. private JPanel pnlLog;
  47. private JPanel pnlLogTitle;
  48. private JPanel pnlCtlrTitle;
  49. private JButton btnLogDirOpen;
  50. private JButton btnLogPause;
  51. private JCheckBox chkLogPause;
  52. private JLabel lblSystime;
  53. private JPanel pnlStatusBar;
  54. private JTable tblCtlrList;
  55. private JTextArea taLog;
  56. private JButton btnLogCopy;
  57. private JLabel lblTotal;
  58. private JLabel lblError;
  59. private JLabel lblCpuRate;
  60. private JLabel lblMemoryUsage;
  61. private JPanel pnlControl;
  62. private JButton btnReset;
  63. private JButton btnDisconnect;
  64. private JTextField txtName;
  65. private JTextField txtId;
  66. private boolean isUpdatable;
  67. public static MainUI getInstance() {
  68. return _instance;
  69. }
  70. public void displaySystime() {
  71. lblSystime.setText(" " + SysUtils.getSysTimeStr() + " ");
  72. updateCommSttsTotal();
  73. }
  74. public void displayResource() {
  75. long memoryUsage = Math.round(((double) (osBean.getTotalPhysicalMemorySize() - osBean.getFreePhysicalMemorySize())) / (double) osBean.getTotalPhysicalMemorySize() * 100.0);
  76. lblMemoryUsage.setText(String.valueOf(memoryUsage));
  77. double cpuLoad = osBean.getSystemCpuLoad();
  78. if (cpuLoad >= 0.0 && cpuLoad <= 1.0) {
  79. lblCpuRate.setText(String.valueOf(Math.round(cpuLoad * 100.0)));
  80. } else {
  81. lblCpuRate.setText("---");
  82. }
  83. }
  84. public MainUI(JFrame jFrame) {
  85. System.setProperty("awt.useSystemAAFontSettings", "false"); // AntiAliasing false
  86. this.isUpdatable = false;
  87. this.jFrame = jFrame;
  88. if (_instance == null) {
  89. _instance = this;
  90. }
  91. try {
  92. Font font = Font.createFont(Font.TRUETYPE_FONT, new File("fonts/D2Coding.ttc"));
  93. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  94. ge.registerFont(font);
  95. } catch (FontFormatException e) {
  96. } catch (IOException e) {
  97. }
  98. Font d2font = new Font("D2Coding", Font.PLAIN, 14);
  99. if (d2font != null) {
  100. taLog.setFont(d2font);
  101. }
  102. displaySystime();
  103. displayResource();
  104. timer = new Timer(1000, new ActionListener() {
  105. public void actionPerformed(ActionEvent evt) {
  106. displaySystime();
  107. tick++;
  108. if (tick % 5 == 0) {
  109. displayResource();
  110. }
  111. }
  112. });
  113. timer.start();
  114. chkLogPause.setFocusable(false);
  115. btnLogPause.setFocusable(false);
  116. btnLogDirOpen.setFocusable(false);
  117. btnLogCopy.setFocusable(false);
  118. //initTblListUI();
  119. btnLogPause.addActionListener(new ActionListener() {
  120. @Override
  121. public void actionPerformed(ActionEvent e) {
  122. taLog.setText(null);
  123. }
  124. });
  125. btnLogDirOpen.addActionListener(new ActionListener() {
  126. @Override
  127. public void actionPerformed(ActionEvent e) {
  128. Runtime rt = Runtime.getRuntime();
  129. try {
  130. rt.exec("explorer.exe logs");
  131. } catch (IOException ex) {
  132. throw new RuntimeException(ex);
  133. }
  134. }
  135. });
  136. chkLogPause.addActionListener(new ActionListener() {
  137. @Override
  138. public void actionPerformed(ActionEvent e) {
  139. JTextAreaOutputStream.isLoggingPause = chkLogPause.isSelected();
  140. }
  141. });
  142. btnLogCopy.addActionListener(new ActionListener() {
  143. @Override
  144. public void actionPerformed(ActionEvent e) {
  145. StringSelection stringSelection = new StringSelection(taLog.getText());
  146. Clipboard clpBrd = Toolkit.getDefaultToolkit().getSystemClipboard();
  147. clpBrd.setContents(stringSelection, null);
  148. }
  149. });
  150. tblCtlrList.addMouseListener(new MouseAdapter() {
  151. public void mouseClicked(MouseEvent me) {
  152. // double click
  153. if (me.getClickCount() == 2) {
  154. if (!updateControllerInfo()) {
  155. }
  156. }
  157. }
  158. });
  159. btnDisconnect.addActionListener(new ActionListener() {
  160. @Override
  161. public void actionPerformed(ActionEvent e) {
  162. controlController(1);
  163. }
  164. });
  165. btnReset.addActionListener(new ActionListener() {
  166. @Override
  167. public void actionPerformed(ActionEvent e) {
  168. controlController(2);
  169. }
  170. });
  171. }
  172. /**
  173. * 제어기 명령 처리
  174. *
  175. * @param type
  176. */
  177. public void controlController(int type) {
  178. if (this.selObj == null) {
  179. JOptionPane.showMessageDialog(getRootPanel(), "제어기가 선택되지 않았습니다. 목록을 더블클릭하여 제어기를 선택하세요.", "제어기 선택", JOptionPane.ERROR_MESSAGE);
  180. return;
  181. }
  182. if (this.selObj.getNetState() == NET.CLOSED) {
  183. JOptionPane.showMessageDialog(getRootPanel(), "제어기가 현재 연결이 되어 있지 않습니다.", "제어기 연결 상태", JOptionPane.ERROR_MESSAGE);
  184. return;
  185. }
  186. String message, title;
  187. switch (type) {
  188. case 1:
  189. message = "제어기와의 연결을 종료 하시겠습니까?";
  190. title = "제어기 연결 종료";
  191. break;
  192. case 2:
  193. message = "제어기를 리셋 하시겠습니까?";
  194. title = "제어기 리셋";
  195. break;
  196. default:
  197. return;
  198. }
  199. if (JOptionPane.showConfirmDialog(getRootPanel(), message, title, JOptionPane.YES_NO_OPTION) != 0) {
  200. return;
  201. }
  202. boolean result = false;
  203. switch (type) {
  204. case 1:
  205. result = this.selObj.channelClose();
  206. break;
  207. case 2:
  208. result = (this.selObj.reset(0, 1, null) == 0);
  209. break;
  210. default:
  211. return;
  212. }
  213. if (!result) {
  214. JOptionPane.showMessageDialog(getRootPanel(), "명령 전송이 실패 하였습니다.", title, JOptionPane.ERROR_MESSAGE);
  215. }
  216. }
  217. public boolean updateControllerInfo() {
  218. if (!this.isUpdatable) {
  219. return false;
  220. }
  221. int row = tblCtlrList.getSelectedRow();
  222. if (row < 0) {
  223. return false;
  224. }
  225. txtId.setText("");
  226. txtName.setText("");
  227. CtlrSttsTableModel tableModel = (CtlrSttsTableModel) tblCtlrList.getModel();
  228. selObj = tableModel.getControllerInfo(row);
  229. if (selObj != null) {
  230. txtId.setText(selObj.getRSE_ID());
  231. txtName.setText(selObj.getRSE_NM());
  232. return true;
  233. }
  234. return false;
  235. }
  236. /**
  237. * 목록 헤더 생성
  238. */
  239. private void initTblListUI(List<TbRseCtlr> ctlrList) {
  240. this.ctlrSttsTableModel = new CtlrSttsTableModel(ctlrList);
  241. tblCtlrList.setModel(this.ctlrSttsTableModel);
  242. tblCtlrList.getTableHeader().setOpaque(false);
  243. tblCtlrList.getTableHeader().setBackground(Color.LIGHT_GRAY);
  244. tblCtlrList.setRowMargin(1);
  245. //tblCtlrList.setGridColor(Color.LIGHT_GRAY);
  246. tblCtlrList.setRowHeight(tblCtlrList.getRowHeight() + 5);
  247. //tblCtlrList.setRowSelectionAllowed(true);
  248. //tblCtlrList.setColumnSelectionAllowed(false);
  249. tblCtlrList.setBackground(Color.WHITE);
  250. tblCtlrList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  251. //tblCtlrList.setAutoCreateRowSorter(true); // sorting
  252. //tblCtlrList.addMouseListener(new ListMouseListener(null));
  253. TableColumnModel getColumnModel = tblCtlrList.getColumnModel();
  254. getColumnModel.getColumn(0).setPreferredWidth(30); // "S",
  255. getColumnModel.getColumn(1).setPreferredWidth(50); // "번호",
  256. getColumnModel.getColumn(2).setPreferredWidth(120); // "시설물ID",
  257. getColumnModel.getColumn(3).setPreferredWidth(180); // "명칭",
  258. getColumnModel.getColumn(4).setPreferredWidth(100); // "IP",
  259. //getColumnModel.getColumn(5).setPreferredWidth(0); // "PORT",
  260. getColumnModel.getColumn(6).setPreferredWidth(70); // "연결상태",
  261. // getColumnModel.getColumn(7).setPreferredWidth(50); // "장치상태",
  262. // getColumnModel.getColumn(8).setPreferredWidth(50); // "안테나1",
  263. // getColumnModel.getColumn(9).setPreferredWidth(50); // "안테나2",
  264. // getColumnModel.getColumn(10).setPreferredWidth(50); // "안테나3",
  265. // getColumnModel.getColumn(11).setPreferredWidth(50); // "안테나4",
  266. getColumnModel.getColumn(12).setPreferredWidth(150);
  267. getColumnModel.getColumn(13).setPreferredWidth(150);
  268. getColumnModel.getColumn(0).setMaxWidth(30);
  269. getColumnModel.getColumn(0).setMinWidth(30);
  270. getColumnModel.getColumn(0).setResizable(false);
  271. getColumnModel.getColumn(5).setMinWidth(0);
  272. getColumnModel.getColumn(5).setMaxWidth(0);
  273. getColumnModel.getColumn(5).setWidth(0);
  274. getColumnModel.getColumn(5).setResizable(false);
  275. for (int ii = 7; ii <= 11; ii++) {
  276. getColumnModel.getColumn(ii).setMinWidth(0);
  277. getColumnModel.getColumn(ii).setMaxWidth(0);
  278. getColumnModel.getColumn(ii).setWidth(0);
  279. getColumnModel.getColumn(ii).setResizable(false);
  280. }
  281. Color color = UIManager.getColor("Table.gridColor");
  282. MatteBorder border = new MatteBorder(1, 1, 0, 0, color);
  283. tblCtlrList.setBorder(border);
  284. DefaultTableCellRenderer centerAlign = new DefaultTableCellRenderer();
  285. centerAlign.setHorizontalAlignment(JLabel.CENTER);
  286. for (int ii = 0; ii < getColumnModel.getColumnCount(); ii++) {
  287. getColumnModel.getColumn(ii).setCellRenderer(cellRenderer);
  288. }
  289. this.isUpdatable = true;
  290. }
  291. public void updateCommSttsTotal() {
  292. int ctlrTotal = 0;
  293. int ctlrError = 0;
  294. for (Map.Entry<String, TbRseCtlr> e : AppRepository.getInstance().getCtlrMap().entrySet()) {
  295. TbRseCtlr obj = e.getValue();
  296. if (StringUtils.equals("N", obj.getDEL_YN())) {
  297. ctlrTotal++;
  298. if (!"CMS0".equals(obj.getStts().getCMNC_STTS_CD())) {
  299. ctlrError++;
  300. }
  301. }
  302. }
  303. lblTotal.setText(" " + ctlrTotal + " ");
  304. lblError.setText(" " + ctlrError + " ");
  305. if (this.isUpdatable) {
  306. CtlrSttsTableModel tableModel = (CtlrSttsTableModel) tblCtlrList.getModel();
  307. if (tableModel != null) {
  308. tableModel.fireTableDataChanged();
  309. }
  310. }
  311. }
  312. public void loadControllerInfo() {
  313. log.info("loadControllerInfo: start. {} EA.", AppRepository.getInstance().getCtlrMap().size());
  314. SortedMap<Integer, TbRseCtlr> ctlrMap = new TreeMap<>();
  315. for (Map.Entry<String, TbRseCtlr> e : AppRepository.getInstance().getCtlrMap().entrySet()) {
  316. TbRseCtlr obj = e.getValue();
  317. if (StringUtils.equals("N", obj.getDEL_YN())) {
  318. ctlrMap.put(Integer.valueOf(obj.getID()), obj);
  319. }
  320. }
  321. List<TbRseCtlr> ctlrList = new ArrayList<TbRseCtlr>(ctlrMap.values());
  322. initTblListUI(ctlrList);
  323. updateCommSttsTotal();
  324. log.info("loadControllerInfo: ..end. {} EA.", ctlrList.size());
  325. }
  326. public void updateCtlrStts(TbRseCtlr obj) {
  327. if (!this.isUpdatable) {
  328. return;
  329. }
  330. if (this.ctlrSttsTableModel == null) {
  331. return;
  332. }
  333. for (int ii = 0; ii < this.ctlrSttsTableModel.getRowCount(); ii++) {
  334. if (obj.getRSE_ID().equals(this.ctlrSttsTableModel.getValueAt(ii, 2).toString())) {
  335. int modelRow = tblCtlrList.convertRowIndexToModel(ii);
  336. this.ctlrSttsTableModel.setValue(obj, ii, modelRow);
  337. break;
  338. }
  339. }
  340. CtlrSttsTableModel tableModel = (CtlrSttsTableModel) tblCtlrList.getModel();
  341. if (tableModel != null) {
  342. tableModel.fireTableDataChanged();
  343. }
  344. }
  345. public static void error(String msg) {
  346. MainUI UI = MainUI.getInstance();
  347. if (UI == null || UI.chkLogPause.isSelected()) {
  348. return;
  349. }
  350. synchronized (UI.taLog) {
  351. if (UI.taLog.getLineCount() > 2000) {
  352. UI.taLog.setText(null);
  353. }
  354. UI.taLog.append(msg);
  355. UI.taLog.setCaretPosition(UI.taLog.getDocument().getLength());
  356. }
  357. }
  358. public static void info(String msg) {
  359. MainUI UI = MainUI.getInstance();
  360. if (UI == null || UI.chkLogPause.isSelected()) {
  361. return;
  362. }
  363. synchronized (UI.taLog) {
  364. synchronized (UI.taLog) {
  365. if (UI.taLog.getLineCount() > 2000) {
  366. UI.taLog.setText(null);
  367. }
  368. UI.taLog.append(msg);
  369. UI.taLog.setCaretPosition(UI.taLog.getDocument().getLength());
  370. }
  371. }
  372. }
  373. {
  374. // GUI initializer generated by IntelliJ IDEA GUI Designer
  375. // >>> IMPORTANT!! <<<
  376. // DO NOT EDIT OR ADD ANY CODE HERE!
  377. $$$setupUI$$$();
  378. }
  379. /**
  380. * Method generated by IntelliJ IDEA GUI Designer
  381. * >>> IMPORTANT!! <<<
  382. * DO NOT edit this method OR call it in your code!
  383. *
  384. * @noinspection ALL
  385. */
  386. private void $$$setupUI$$$() {
  387. rootPanel = new JPanel();
  388. rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
  389. pnlCtlr = new JPanel();
  390. pnlCtlr.setLayout(new GridLayoutManager(3, 1, new Insets(10, 4, 0, 4), -1, -1));
  391. 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));
  392. pnlCtlrTitle = new JPanel();
  393. pnlCtlrTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), -1, -1));
  394. 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));
  395. final JLabel label1 = new JLabel();
  396. Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont());
  397. if (label1Font != null) label1.setFont(label1Font);
  398. label1.setHorizontalAlignment(2);
  399. label1.setHorizontalTextPosition(11);
  400. label1.setIcon(new ImageIcon(getClass().getResource("/static/image/controller.png")));
  401. label1.setText("RSE 정보");
  402. 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));
  403. final Spacer spacer1 = new Spacer();
  404. 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));
  405. final JLabel label2 = new JLabel();
  406. Font label2Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label2.getFont());
  407. if (label2Font != null) label2.setFont(label2Font);
  408. label2.setText("RSE 전체: ");
  409. 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));
  410. final JLabel label3 = new JLabel();
  411. Font label3Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label3.getFont());
  412. if (label3Font != null) label3.setFont(label3Font);
  413. label3.setText("통신 이상: ");
  414. 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));
  415. lblTotal = new JLabel();
  416. Font lblTotalFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblTotal.getFont());
  417. if (lblTotalFont != null) lblTotal.setFont(lblTotalFont);
  418. lblTotal.setHorizontalAlignment(0);
  419. lblTotal.setHorizontalTextPosition(0);
  420. lblTotal.setText(" -");
  421. 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));
  422. lblError = new JLabel();
  423. Font lblErrorFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblError.getFont());
  424. if (lblErrorFont != null) lblError.setFont(lblErrorFont);
  425. lblError.setForeground(new Color(-65536));
  426. lblError.setHorizontalAlignment(0);
  427. lblError.setHorizontalTextPosition(0);
  428. lblError.setText(" -");
  429. 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));
  430. final JScrollPane scrollPane1 = new JScrollPane();
  431. 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));
  432. tblCtlrList = new JTable();
  433. Font tblCtlrListFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tblCtlrList.getFont());
  434. if (tblCtlrListFont != null) tblCtlrList.setFont(tblCtlrListFont);
  435. scrollPane1.setViewportView(tblCtlrList);
  436. pnlControl = new JPanel();
  437. pnlControl.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), 1, 1));
  438. pnlCtlr.add(pnlControl, 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));
  439. final Spacer spacer2 = new Spacer();
  440. pnlControl.add(spacer2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  441. btnReset = new JButton();
  442. Font btnResetFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnReset.getFont());
  443. if (btnResetFont != null) btnReset.setFont(btnResetFont);
  444. btnReset.setText("리셋");
  445. pnlControl.add(btnReset, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  446. btnDisconnect = new JButton();
  447. Font btnDisconnectFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnDisconnect.getFont());
  448. if (btnDisconnectFont != null) btnDisconnect.setFont(btnDisconnectFont);
  449. btnDisconnect.setText("연결끊기");
  450. pnlControl.add(btnDisconnect, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  451. txtName = new JTextField();
  452. txtName.setEditable(false);
  453. Font txtNameFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtName.getFont());
  454. if (txtNameFont != null) txtName.setFont(txtNameFont);
  455. txtName.setHorizontalAlignment(2);
  456. txtName.setText("RSE 명칭");
  457. pnlControl.add(txtName, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(200, -1), new Dimension(200, -1), new Dimension(200, -1), 0, false));
  458. txtId = new JTextField();
  459. txtId.setEditable(false);
  460. Font txtIdFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtId.getFont());
  461. if (txtIdFont != null) txtId.setFont(txtIdFont);
  462. txtId.setHorizontalAlignment(0);
  463. txtId.setText("ID");
  464. pnlControl.add(txtId, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(130, -1), new Dimension(130, -1), new Dimension(130, -1), 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.setIcon(new ImageIcon(getClass().getResource("/static/image/select.png")));
  469. label4.setText("선택한 RSE ");
  470. pnlControl.add(label4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  471. pnlLog = new JPanel();
  472. pnlLog.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
  473. 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));
  474. pnlLogTitle = new JPanel();
  475. pnlLogTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), 1, 1));
  476. 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));
  477. final JLabel label5 = new JLabel();
  478. Font label5Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label5.getFont());
  479. if (label5Font != null) label5.setFont(label5Font);
  480. label5.setHorizontalAlignment(2);
  481. label5.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
  482. label5.setText("시스템 로그");
  483. pnlLogTitle.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));
  484. final Spacer spacer3 = new Spacer();
  485. pnlLogTitle.add(spacer3, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  486. btnLogDirOpen = new JButton();
  487. Font btnLogDirOpenFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogDirOpen.getFont());
  488. if (btnLogDirOpenFont != null) btnLogDirOpen.setFont(btnLogDirOpenFont);
  489. btnLogDirOpen.setHorizontalTextPosition(0);
  490. btnLogDirOpen.setText("로그 폴더");
  491. 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));
  492. btnLogPause = new JButton();
  493. Font btnLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogPause.getFont());
  494. if (btnLogPauseFont != null) btnLogPause.setFont(btnLogPauseFont);
  495. btnLogPause.setHorizontalTextPosition(0);
  496. btnLogPause.setText("지우기");
  497. 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));
  498. chkLogPause = new JCheckBox();
  499. Font chkLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkLogPause.getFont());
  500. if (chkLogPauseFont != null) chkLogPause.setFont(chkLogPauseFont);
  501. chkLogPause.setHorizontalAlignment(0);
  502. chkLogPause.setHorizontalTextPosition(11);
  503. chkLogPause.setText("멈춤");
  504. 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));
  505. btnLogCopy = new JButton();
  506. Font btnLogCopyFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogCopy.getFont());
  507. if (btnLogCopyFont != null) btnLogCopy.setFont(btnLogCopyFont);
  508. btnLogCopy.setText("복사");
  509. 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));
  510. final JScrollPane scrollPane2 = new JScrollPane();
  511. Font scrollPane2Font = this.$$$getFont$$$("D2Coding", Font.PLAIN, 12, scrollPane2.getFont());
  512. if (scrollPane2Font != null) scrollPane2.setFont(scrollPane2Font);
  513. 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));
  514. taLog = new JTextArea();
  515. taLog.setBackground(new Color(-16777216));
  516. taLog.setCaretColor(new Color(-1));
  517. taLog.setEditable(false);
  518. Font taLogFont = this.$$$getFont$$$("D2Coding", Font.PLAIN, 14, taLog.getFont());
  519. if (taLogFont != null) taLog.setFont(taLogFont);
  520. taLog.setForeground(new Color(-1));
  521. taLog.setMargin(new Insets(4, 4, 4, 4));
  522. 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");
  523. scrollPane2.setViewportView(taLog);
  524. pnlStatusBar = new JPanel();
  525. pnlStatusBar.setLayout(new GridLayoutManager(1, 7, new Insets(0, 4, 4, 4), -1, -1));
  526. 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));
  527. final Spacer spacer4 = new Spacer();
  528. pnlStatusBar.add(spacer4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  529. lblSystime = new JLabel();
  530. Font lblSystimeFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblSystime.getFont());
  531. if (lblSystimeFont != null) lblSystime.setFont(lblSystimeFont);
  532. lblSystime.setHorizontalAlignment(0);
  533. lblSystime.setHorizontalTextPosition(0);
  534. lblSystime.setText(" 2022-08-04 13:24:33 ");
  535. 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));
  536. final JLabel label6 = new JLabel();
  537. label6.setIcon(new ImageIcon(getClass().getResource("/static/image/on.png")));
  538. label6.setText(" ");
  539. pnlStatusBar.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  540. lblCpuRate = new JLabel();
  541. Font lblCpuRateFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblCpuRate.getFont());
  542. if (lblCpuRateFont != null) lblCpuRate.setFont(lblCpuRateFont);
  543. lblCpuRate.setHorizontalAlignment(2);
  544. lblCpuRate.setHorizontalTextPosition(0);
  545. lblCpuRate.setText(" ");
  546. 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));
  547. lblMemoryUsage = new JLabel();
  548. Font lblMemoryUsageFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblMemoryUsage.getFont());
  549. if (lblMemoryUsageFont != null) lblMemoryUsage.setFont(lblMemoryUsageFont);
  550. lblMemoryUsage.setHorizontalAlignment(2);
  551. lblMemoryUsage.setHorizontalTextPosition(0);
  552. lblMemoryUsage.setText(" ");
  553. 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));
  554. final JLabel label7 = new JLabel();
  555. Font label7Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label7.getFont());
  556. if (label7Font != null) label7.setFont(label7Font);
  557. label7.setHorizontalAlignment(0);
  558. label7.setHorizontalTextPosition(0);
  559. label7.setText(" CPU 사용율(%):");
  560. pnlStatusBar.add(label7, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  561. final JLabel label8 = new JLabel();
  562. Font label8Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label8.getFont());
  563. if (label8Font != null) label8.setFont(label8Font);
  564. label8.setHorizontalAlignment(0);
  565. label8.setHorizontalTextPosition(0);
  566. label8.setText(" 메모리 사용율(%):");
  567. pnlStatusBar.add(label8, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  568. }
  569. /**
  570. * @noinspection ALL
  571. */
  572. private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
  573. if (currentFont == null) return null;
  574. String resultName;
  575. if (fontName == null) {
  576. resultName = currentFont.getName();
  577. } else {
  578. Font testFont = new Font(fontName, Font.PLAIN, 10);
  579. if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
  580. resultName = fontName;
  581. } else {
  582. resultName = currentFont.getName();
  583. }
  584. }
  585. Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
  586. boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
  587. Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
  588. return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
  589. }
  590. /**
  591. * @noinspection ALL
  592. */
  593. public JComponent $$$getRootComponent$$$() {
  594. return rootPanel;
  595. }
  596. }