123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749 |
- package com.its.cctv.ui;
- import com.intellij.uiDesigner.core.GridConstraints;
- import com.intellij.uiDesigner.core.GridLayoutManager;
- import com.intellij.uiDesigner.core.Spacer;
- import com.its.app.AppUtils;
- import com.its.app.utils.SysUtils;
- import com.its.cctv.config.DebugConfig;
- import com.its.cctv.domain.NET;
- import com.its.cctv.entity.TbCctvCtlr;
- import com.its.cctv.global.AppRepository;
- import com.sun.management.OperatingSystemMXBean;
- import lombok.Getter;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.commons.lang.StringUtils;
- import javax.swing.Timer;
- import javax.swing.*;
- import javax.swing.border.MatteBorder;
- import javax.swing.plaf.FontUIResource;
- import javax.swing.table.DefaultTableCellRenderer;
- import javax.swing.table.TableCellRenderer;
- import javax.swing.table.TableColumnModel;
- import javax.swing.text.StyleContext;
- import java.awt.*;
- import java.awt.datatransfer.Clipboard;
- import java.awt.datatransfer.StringSelection;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import java.io.File;
- import java.io.IOException;
- import java.lang.management.ManagementFactory;
- import java.util.List;
- import java.util.*;
- @Slf4j
- @Getter
- public class MainUI {
- private static MainUI _instance = null;
- private SubUIController subUIController = null;
- private JFrame jFrame = null;
- private final OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
- private Timer timer;
- private Long tick = Long.valueOf(0);
- private TbCctvCtlr selObj = null;
- private CtlrSttsTableModel ctlrSttsTableModel = null;
- private TableCellRenderer cellRenderer = new CtlrSttsTableCellRenderer();
- private JPanel rootPanel;
- private JPanel pnlCtlr;
- private JPanel pnlLog;
- private JPanel pnlLogTitle;
- private JPanel pnlCtlrTitle;
- private JButton btnLogDirOpen;
- private JButton btnLogPause;
- private JCheckBox chkLogPause;
- private JLabel lblSystime;
- private JPanel pnlStatusBar;
- private JTable tblCtlrList;
- private JTextArea taLog;
- private JButton btnLogCopy;
- private JLabel lblTotal;
- private JLabel lblError;
- private JLabel lblCpuRate;
- private JLabel lblMemoryUsage;
- private JPanel pnlControl;
- private JButton btnControl;
- private JButton btnResetSw;
- private JButton btnResetHw;
- private JButton btnDisconnect;
- private JTextField txtName;
- private JTextField txtId;
- private JCheckBox chkPtzControl;
- private boolean isUpdatable;
- private DebugConfig debugConfig;
- public static MainUI getInstance() {
- return _instance;
- }
- public void displaySystime() {
- lblSystime.setText(" " + SysUtils.getSysTimeStr() + " ");
- updateCommSttsTotal();
- }
- public void displayResource() {
- long memoryUsage = Math.round(((double) (osBean.getTotalPhysicalMemorySize() - osBean.getFreePhysicalMemorySize())) / (double) osBean.getTotalPhysicalMemorySize() * 100.0);
- lblMemoryUsage.setText(String.valueOf(memoryUsage));
- double cpuLoad = osBean.getSystemCpuLoad();
- if (cpuLoad >= 0.0 && cpuLoad <= 1.0) {
- lblCpuRate.setText(String.valueOf(Math.round(cpuLoad * 100.0)));
- } else {
- lblCpuRate.setText("---");
- }
- }
- public MainUI(JFrame jFrame) {
- System.setProperty("awt.useSystemAAFontSettings", "false"); // AntiAliasing false
- this.debugConfig = (DebugConfig) AppUtils.getBean(DebugConfig.class);
- this.isUpdatable = false;
- this.jFrame = jFrame;
- if (_instance == null) {
- _instance = this;
- subUIController = new SubUIController(jFrame);
- subUIController.setVisible(false);
- }
- try {
- Font font = Font.createFont(Font.TRUETYPE_FONT, new File("fonts/D2Coding.ttc"));
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
- ge.registerFont(font);
- } catch (FontFormatException e) {
- } catch (IOException e) {
- }
- Font d2font = new Font("D2Coding", Font.PLAIN, 14);
- if (d2font != null) {
- taLog.setFont(d2font);
- }
- displaySystime();
- displayResource();
- timer = new Timer(1000, new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- displaySystime();
- tick++;
- if (tick % 5 == 0) {
- displayResource();
- }
- }
- });
- timer.start();
- chkPtzControl.setSelected(this.debugConfig.isSttsLog());
- chkLogPause.setFocusable(false);
- btnLogPause.setFocusable(false);
- btnLogDirOpen.setFocusable(false);
- btnLogCopy.setFocusable(false);
- //initTblListUI();
- btnLogPause.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- taLog.setText(null);
- }
- });
- btnLogDirOpen.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- Runtime rt = Runtime.getRuntime();
- try {
- rt.exec("explorer.exe logs");
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
- });
- chkPtzControl.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- debugConfig.setSttsLog(chkPtzControl.isSelected());
- }
- });
- chkLogPause.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- JTextAreaOutputStream.isLoggingPause = chkLogPause.isSelected();
- }
- });
- btnLogCopy.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- StringSelection stringSelection = new StringSelection(taLog.getText());
- Clipboard clpBrd = Toolkit.getDefaultToolkit().getSystemClipboard();
- clpBrd.setContents(stringSelection, null);
- }
- });
- tblCtlrList.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent me) {
- // double click
- if (me.getClickCount() == 2) {
- if (!updateControllerInfo()) {
- // if (subUIController.isVisible()) {
- // subUIController.setVisible(false);
- // }
- }
- }
- }
- });
- btnDisconnect.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- controlController(1);
- }
- });
- btnResetHw.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- controlController(2);
- }
- });
- btnResetSw.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- controlController(3);
- }
- });
- btnControl.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- controlController(4);
- }
- });
- }
- // private void showStream() {
- // String streamUrl = "rtsp://118.40.176.110:1935/live/CCAM0020.stream";
- // System.setProperty("apple.awt.graphics.UseQuartz", "false");
- //
- //
- // pipe = new Pipeline("pipeline");
- // pipe.getBus().connect(new Bus.ERROR() {
- // public void errorMessage(GstObject source, int code, String message) {
- // System.out.println("Error occurred: " + message);
- // Gst.quit();
- // }
- // });
- // pipe.getBus().connect(new Bus.STATE_CHANGED() {
- // public void stateChanged(GstObject source, State old, State current, State pending) {
- // if (source == pipe) {
- // System.out.println("Pipeline state changed from " + old + " to " + current);
- // }
- // }
- // });
- // pipe.getBus().connect(new Bus.EOS() {
- // public void endOfStream(GstObject source) {
- // System.out.println("Finished playing file");
- // Gst.quit();
- // }
- // });
- //
- // pipe.getBus().connect(new Bus.TAG() {
- // public void tagsFound(GstObject source, TagList tagList) {
- // for (String tag : tagList.getTagNames()) {
- // System.out.println("Found tag " + tag + " = "
- // + tagList.getValue(tag, 0));
- // }
- // }
- // });
- //
- // final Element source = ElementFactory.make("rtspsrc", "Source");
- // final Element demux = ElementFactory.make("rtpmp4vdepay", "Depay");
- // final Element decoder = ElementFactory.make("ffdec_mpeg4", "Decoder");
- // final Element colorspace = ElementFactory.make("ffmpegcolorspace", "Colorspace");
- // //final Element sink = ElementFactory.make ("autovideosink", "Output");
- //
- // SwingUtilities.invokeLater(new Runnable() {
- // public void run() {
- // // Create the video component and link it in
- // VideoComponent videoComponent = new VideoComponent();
- // Element videosink = videoComponent.getElement();
- //
- // source.connect(new Element.PAD_ADDED() {
- // public void padAdded(Element element, Pad pad) {
- // pad.link(demux.getStaticPad("sink"));
- // }
- // });
- //
- // Pad p = new Pad(null, PadDirection.SRC);
- // source.addPad(p);
- //
- // source.set("location", streamUrl); //replace this with your source
- //
- // pipe.addMany(source, demux, decoder, colorspace, videosink);
- // Element.linkMany(demux, decoder, colorspace, videosink);
- //
- // // Now create a JFrame to display the video output
- // JFrame frame = new JFrame("Swing Video Test");
- // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- // frame.add(videoComponent, BorderLayout.CENTER);
- // videoComponent.setPreferredSize(new Dimension(720, 576));
- // frame.pack();
- // frame.setVisible(true);
- //
- // // Start the pipeline processing
- // pipe.play();
- // }
- // });
- // }
- /**
- * 제어기 명령 처리
- *
- * @param type
- */
- public void controlController(int type) {
- if (this.selObj == null) {
- JOptionPane.showMessageDialog(getRootPanel(), "제어기가 선택되지 않았습니다. 목록을 더블클릭하여 제어기를 선택하세요.", "제어기 선택", JOptionPane.ERROR_MESSAGE);
- return;
- }
- if (this.selObj.getNetState() == NET.CLOSED) {
- JOptionPane.showMessageDialog(getRootPanel(), "제어기가 현재 연결이 되어 있지 않습니다.", "제어기 연결 상태", JOptionPane.ERROR_MESSAGE);
- return;
- }
- boolean isDirectCmd = true;
- String message = "", title = "";
- switch (type) {
- case 1:
- message = "제어기와의 연결을 종료 하시겠습니까?";
- title = "제어기 연결 종료";
- break;
- case 2:
- message = "제어기를 리셋(HW) 하시겠습니까?";
- title = "제어기 리셋(HW)";
- break;
- case 3:
- message = "제어기를 리셋(SW) 하시겠습니까?";
- title = "제어기 리셋(SW)";
- break;
- case 4:
- isDirectCmd = false;
- break;
- default:
- return;
- }
- if (isDirectCmd) {
- if (JOptionPane.showConfirmDialog(getRootPanel(), message, title, JOptionPane.YES_NO_OPTION) != 0) {
- return;
- }
- }
- boolean result = false;
- switch (type) {
- case 1:
- result = this.selObj.channelClose();
- break;
- case 2:
- result = this.selObj.resetHw();
- break;
- case 3:
- result = this.selObj.resetSw();
- break;
- case 4:
- result = true;
- if (!this.subUIController.isVisible()) {
- this.subUIController.setVisible(true);
- }
- this.subUIController.setState(JFrame.NORMAL);
- break;
- default:
- return;
- }
- if (!result) {
- JOptionPane.showMessageDialog(getRootPanel(), "명령 전송이 실패 하였습니다.", title, JOptionPane.ERROR_MESSAGE);
- }
- }
- public boolean updateControllerInfo() {
- if (subUIController.isVisible()) {
- //subUIController.setVisible(false);
- }
- if (!this.isUpdatable) {
- return false;
- }
- int row = tblCtlrList.getSelectedRow();
- if (row < 0) {
- JOptionPane.showMessageDialog(getRootPanel(), "목록에서 CCTV 를 선택해주세요.", "CCTV 제어", JOptionPane.ERROR_MESSAGE);
- return false;
- }
- txtId.setText("");
- txtName.setText("");
- CtlrSttsTableModel tableModel = (CtlrSttsTableModel) tblCtlrList.getModel();
- this.selObj = tableModel.getControllerInfo(row);
- if (this.selObj != null) {
- txtId.setText(selObj.getCCTV_CTLR_ID());
- txtName.setText(selObj.getCCTV_NM());
- subUIController.updateInfo(selObj);
- //if (!subUIController.isVisible()) {
- // subUIController.setVisible(true);
- //}
- //subUIController.setState(JFrame.NORMAL);
- return true;
- }
- return false;
- }
- /**
- * 목록 헤더 생성
- */
- private void initTblListUI(List<TbCctvCtlr> ctlrList) {
- this.ctlrSttsTableModel = new CtlrSttsTableModel(ctlrList);
- tblCtlrList.setModel(this.ctlrSttsTableModel);
- tblCtlrList.getTableHeader().setOpaque(false);
- tblCtlrList.getTableHeader().setBackground(Color.LIGHT_GRAY);
- tblCtlrList.setRowMargin(1);
- //tblCtlrList.setGridColor(Color.LIGHT_GRAY);
- tblCtlrList.setRowHeight(tblCtlrList.getRowHeight() + 5);
- //tblCtlrList.setRowSelectionAllowed(true);
- //tblCtlrList.setColumnSelectionAllowed(false);
- tblCtlrList.setBackground(Color.WHITE);
- tblCtlrList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- //tblCtlrList.setAutoCreateRowSorter(true); // sorting
- //tblCtlrList.addMouseListener(new ListMouseListener(null));
- TableColumnModel getColumnModel = tblCtlrList.getColumnModel();
- getColumnModel.getColumn(0).setPreferredWidth(30); // "S",
- getColumnModel.getColumn(1).setPreferredWidth(65); // "번호",
- getColumnModel.getColumn(2).setPreferredWidth(110); // "CCTV ID",
- getColumnModel.getColumn(3).setPreferredWidth(190); // "명칭",
- getColumnModel.getColumn(4).setPreferredWidth(120); // "IP",
- getColumnModel.getColumn(5).setPreferredWidth(55); // "PORT",
- getColumnModel.getColumn(6).setPreferredWidth(70); // "연결상태",
- getColumnModel.getColumn(7).setPreferredWidth(50); // "도어",
- getColumnModel.getColumn(8).setPreferredWidth(50); // "팬",
- getColumnModel.getColumn(9).setPreferredWidth(50); // "히터",
- getColumnModel.getColumn(10).setPreferredWidth(50); // "온도",
- getColumnModel.getColumn(11).setPreferredWidth(50); // "영상",
- getColumnModel.getColumn(12).setPreferredWidth(170); // "P / T / Z / F",
- getColumnModel.getColumn(13).setPreferredWidth(125);
- getColumnModel.getColumn(14).setPreferredWidth(125);
- getColumnModel.getColumn(0).setMaxWidth(30);
- getColumnModel.getColumn(0).setMinWidth(30);
- getColumnModel.getColumn(0).setResizable(false);
- Color color = UIManager.getColor("Table.gridColor");
- MatteBorder border = new MatteBorder(1, 1, 0, 0, color);
- tblCtlrList.setBorder(border);
- DefaultTableCellRenderer centerAlign = new DefaultTableCellRenderer();
- centerAlign.setHorizontalAlignment(JLabel.CENTER);
- for (int ii = 0; ii < getColumnModel.getColumnCount(); ii++) {
- getColumnModel.getColumn(ii).setCellRenderer(cellRenderer);
- }
- this.isUpdatable = true;
- }
- public void updateCommSttsTotal() {
- int ctlrTotal = 0;
- int ctlrError = 0;
- for (Map.Entry<String, TbCctvCtlr> e : AppRepository.getInstance().getCtlrMap().entrySet()) {
- TbCctvCtlr obj = e.getValue();
- if (StringUtils.equals("N", obj.getDEL_YN())) {
- ctlrTotal++;
- if (!"CMS0".equals(obj.getStts().getCMNC_STTS_CD())) {
- ctlrError++;
- }
- }
- }
- lblTotal.setText(" " + ctlrTotal + " ");
- lblError.setText(" " + ctlrError + " ");
- if (this.isUpdatable) {
- CtlrSttsTableModel tableModel = (CtlrSttsTableModel) tblCtlrList.getModel();
- if (tableModel != null) {
- tableModel.fireTableDataChanged();
- }
- }
- }
- public void LoadControllerInfo() {
- SortedMap<Integer, TbCctvCtlr> ctlrMap = new TreeMap<>();
- for (Map.Entry<String, TbCctvCtlr> e : AppRepository.getInstance().getCtlrMap().entrySet()) {
- TbCctvCtlr obj = e.getValue();
- if (StringUtils.equals("N", obj.getDEL_YN())) {
- ctlrMap.put(Integer.valueOf(obj.getCCTV_CTLR_NMBR()), obj);
- }
- }
- List<TbCctvCtlr> ctlrList = new ArrayList<TbCctvCtlr>(ctlrMap.values());
- initTblListUI(ctlrList);
- updateCommSttsTotal();
- }
- public void updateCtlrStts(TbCctvCtlr obj) {
- if (!this.isUpdatable) {
- return;
- }
- if (this.ctlrSttsTableModel == null) {
- return;
- }
- for (int ii = 0; ii < this.ctlrSttsTableModel.getRowCount(); ii++) {
- if (obj.getCCTV_CTLR_ID().equals(this.ctlrSttsTableModel.getValueAt(ii, 2).toString())) {
- int modelRow = tblCtlrList.convertRowIndexToModel(ii);
- this.ctlrSttsTableModel.setValue(obj, ii, modelRow);
- break;
- }
- }
- CtlrSttsTableModel tableModel = (CtlrSttsTableModel) tblCtlrList.getModel();
- if (tableModel != null) {
- tableModel.fireTableDataChanged();
- }
- }
- {
- // GUI initializer generated by IntelliJ IDEA GUI Designer
- // >>> IMPORTANT!! <<<
- // DO NOT EDIT OR ADD ANY CODE HERE!
- $$$setupUI$$$();
- }
- /**
- * Method generated by IntelliJ IDEA GUI Designer
- * >>> IMPORTANT!! <<<
- * DO NOT edit this method OR call it in your code!
- *
- * @noinspection ALL
- */
- private void $$$setupUI$$$() {
- rootPanel = new JPanel();
- rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
- pnlCtlr = new JPanel();
- pnlCtlr.setLayout(new GridLayoutManager(3, 1, new Insets(10, 4, 0, 4), -1, -1));
- 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));
- pnlCtlrTitle = new JPanel();
- pnlCtlrTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), -1, -1));
- 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));
- final JLabel label1 = new JLabel();
- Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont());
- if (label1Font != null) label1.setFont(label1Font);
- label1.setHorizontalAlignment(2);
- label1.setHorizontalTextPosition(11);
- label1.setIcon(new ImageIcon(getClass().getResource("/static/image/controller.png")));
- label1.setText("제어기 정보");
- 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));
- final Spacer spacer1 = new Spacer();
- 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));
- final JLabel label2 = new JLabel();
- Font label2Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label2.getFont());
- if (label2Font != null) label2.setFont(label2Font);
- label2.setText("제어기 전체: ");
- 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));
- final JLabel label3 = new JLabel();
- Font label3Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label3.getFont());
- if (label3Font != null) label3.setFont(label3Font);
- label3.setText("통신 이상: ");
- 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));
- lblTotal = new JLabel();
- Font lblTotalFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblTotal.getFont());
- if (lblTotalFont != null) lblTotal.setFont(lblTotalFont);
- lblTotal.setHorizontalAlignment(0);
- lblTotal.setHorizontalTextPosition(0);
- lblTotal.setText(" -");
- 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));
- lblError = new JLabel();
- Font lblErrorFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblError.getFont());
- if (lblErrorFont != null) lblError.setFont(lblErrorFont);
- lblError.setForeground(new Color(-65536));
- lblError.setHorizontalAlignment(0);
- lblError.setHorizontalTextPosition(0);
- lblError.setText(" -");
- 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));
- final JScrollPane scrollPane1 = new JScrollPane();
- 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));
- tblCtlrList = new JTable();
- Font tblCtlrListFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tblCtlrList.getFont());
- if (tblCtlrListFont != null) tblCtlrList.setFont(tblCtlrListFont);
- scrollPane1.setViewportView(tblCtlrList);
- pnlControl = new JPanel();
- pnlControl.setLayout(new GridLayoutManager(1, 8, new Insets(0, 0, 0, 2), 1, 1));
- 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));
- btnControl = new JButton();
- Font btnControlFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnControl.getFont());
- if (btnControlFont != null) btnControl.setFont(btnControlFont);
- btnControl.setText("제어");
- pnlControl.add(btnControl, new GridConstraints(0, 7, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- final Spacer spacer2 = new Spacer();
- 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));
- btnResetSw = new JButton();
- Font btnResetSwFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnResetSw.getFont());
- if (btnResetSwFont != null) btnResetSw.setFont(btnResetSwFont);
- btnResetSw.setText("리셋(SW)");
- pnlControl.add(btnResetSw, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- btnResetHw = new JButton();
- Font btnResetHwFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnResetHw.getFont());
- if (btnResetHwFont != null) btnResetHw.setFont(btnResetHwFont);
- btnResetHw.setText("리셋(HW)");
- pnlControl.add(btnResetHw, 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));
- btnDisconnect = new JButton();
- Font btnDisconnectFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnDisconnect.getFont());
- if (btnDisconnectFont != null) btnDisconnect.setFont(btnDisconnectFont);
- btnDisconnect.setText("연결끊기");
- 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));
- txtName = new JTextField();
- txtName.setEditable(false);
- Font txtNameFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtName.getFont());
- if (txtNameFont != null) txtName.setFont(txtNameFont);
- txtName.setHorizontalAlignment(2);
- txtName.setText("제어기 명칭");
- 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));
- txtId = new JTextField();
- txtId.setEditable(false);
- Font txtIdFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtId.getFont());
- if (txtIdFont != null) txtId.setFont(txtIdFont);
- txtId.setHorizontalAlignment(0);
- txtId.setText("ID");
- pnlControl.add(txtId, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
- final JLabel label4 = new JLabel();
- Font label4Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label4.getFont());
- if (label4Font != null) label4.setFont(label4Font);
- label4.setIcon(new ImageIcon(getClass().getResource("/static/image/select.png")));
- label4.setText("선택한 제어기 ");
- 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));
- pnlLog = new JPanel();
- pnlLog.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
- 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, 200), new Dimension(-1, 200), new Dimension(-1, 200), 0, false));
- pnlLogTitle = new JPanel();
- pnlLogTitle.setLayout(new GridLayoutManager(1, 7, new Insets(0, 0, 0, 2), 1, 1));
- 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));
- final JLabel label5 = new JLabel();
- Font label5Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label5.getFont());
- if (label5Font != null) label5.setFont(label5Font);
- label5.setHorizontalAlignment(2);
- label5.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
- label5.setText("시스템 로그");
- 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));
- final Spacer spacer3 = new Spacer();
- 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));
- btnLogDirOpen = new JButton();
- Font btnLogDirOpenFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogDirOpen.getFont());
- if (btnLogDirOpenFont != null) btnLogDirOpen.setFont(btnLogDirOpenFont);
- btnLogDirOpen.setHorizontalTextPosition(0);
- btnLogDirOpen.setText("로그 폴더");
- pnlLogTitle.add(btnLogDirOpen, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- btnLogPause = new JButton();
- Font btnLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogPause.getFont());
- if (btnLogPauseFont != null) btnLogPause.setFont(btnLogPauseFont);
- btnLogPause.setHorizontalTextPosition(0);
- btnLogPause.setText("지우기");
- pnlLogTitle.add(btnLogPause, 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));
- chkLogPause = new JCheckBox();
- Font chkLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkLogPause.getFont());
- if (chkLogPauseFont != null) chkLogPause.setFont(chkLogPauseFont);
- chkLogPause.setHorizontalAlignment(0);
- chkLogPause.setHorizontalTextPosition(11);
- chkLogPause.setText("멈춤");
- pnlLogTitle.add(chkLogPause, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- btnLogCopy = new JButton();
- Font btnLogCopyFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogCopy.getFont());
- if (btnLogCopyFont != null) btnLogCopy.setFont(btnLogCopyFont);
- btnLogCopy.setText("복사");
- pnlLogTitle.add(btnLogCopy, 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));
- chkPtzControl = new JCheckBox();
- Font chkPtzControlFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkPtzControl.getFont());
- if (chkPtzControlFont != null) chkPtzControl.setFont(chkPtzControlFont);
- chkPtzControl.setHorizontalAlignment(0);
- chkPtzControl.setText("상태정보 ");
- pnlLogTitle.add(chkPtzControl, 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));
- final JScrollPane scrollPane2 = new JScrollPane();
- Font scrollPane2Font = this.$$$getFont$$$("D2Coding", Font.PLAIN, 12, scrollPane2.getFont());
- if (scrollPane2Font != null) scrollPane2.setFont(scrollPane2Font);
- 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));
- taLog = new JTextArea();
- taLog.setBackground(new Color(-16777216));
- taLog.setCaretColor(new Color(-1));
- taLog.setEditable(false);
- Font taLogFont = this.$$$getFont$$$("D2Coding", Font.PLAIN, 14, taLog.getFont());
- if (taLogFont != null) taLog.setFont(taLogFont);
- taLog.setForeground(new Color(-1));
- taLog.setMargin(new Insets(4, 4, 4, 4));
- 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");
- scrollPane2.setViewportView(taLog);
- pnlStatusBar = new JPanel();
- pnlStatusBar.setLayout(new GridLayoutManager(1, 7, new Insets(0, 4, 4, 4), -1, -1));
- 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));
- final Spacer spacer4 = new Spacer();
- 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));
- lblSystime = new JLabel();
- Font lblSystimeFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblSystime.getFont());
- if (lblSystimeFont != null) lblSystime.setFont(lblSystimeFont);
- lblSystime.setHorizontalAlignment(0);
- lblSystime.setHorizontalTextPosition(0);
- lblSystime.setText(" 2022-08-04 13:24:33 ");
- 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));
- final JLabel label6 = new JLabel();
- label6.setIcon(new ImageIcon(getClass().getResource("/static/image/on.png")));
- label6.setText(" ");
- 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));
- lblCpuRate = new JLabel();
- Font lblCpuRateFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblCpuRate.getFont());
- if (lblCpuRateFont != null) lblCpuRate.setFont(lblCpuRateFont);
- lblCpuRate.setHorizontalAlignment(2);
- lblCpuRate.setHorizontalTextPosition(0);
- lblCpuRate.setText(" ");
- 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));
- lblMemoryUsage = new JLabel();
- Font lblMemoryUsageFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblMemoryUsage.getFont());
- if (lblMemoryUsageFont != null) lblMemoryUsage.setFont(lblMemoryUsageFont);
- lblMemoryUsage.setHorizontalAlignment(2);
- lblMemoryUsage.setHorizontalTextPosition(0);
- lblMemoryUsage.setText(" ");
- 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));
- final JLabel label7 = new JLabel();
- Font label7Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label7.getFont());
- if (label7Font != null) label7.setFont(label7Font);
- label7.setHorizontalAlignment(0);
- label7.setHorizontalTextPosition(0);
- label7.setText(" CPU 사용율(%):");
- 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));
- final JLabel label8 = new JLabel();
- Font label8Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label8.getFont());
- if (label8Font != null) label8.setFont(label8Font);
- label8.setHorizontalAlignment(0);
- label8.setHorizontalTextPosition(0);
- label8.setText(" 메모리 사용율(%):");
- 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));
- }
- /**
- * @noinspection ALL
- */
- private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
- if (currentFont == null) return null;
- String resultName;
- if (fontName == null) {
- resultName = currentFont.getName();
- } else {
- Font testFont = new Font(fontName, Font.PLAIN, 10);
- if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
- resultName = fontName;
- } else {
- resultName = currentFont.getName();
- }
- }
- Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
- boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
- Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
- return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
- }
- /**
- * @noinspection ALL
- */
- public JComponent $$$getRootComponent$$$() {
- return rootPanel;
- }
- }
|