📄 staxmonitorframe.java
字号:
else if (fClearLogs == STAXMonitorFrame.DISABLED) request.append(" CLEARLOGS Disabled"); if (fLogTCElapsedTime == STAXMonitorFrame.ENABLED) request.append(" LOGTCELAPSEDTIME Enabled"); else if (fLogTCElapsedTime == STAXMonitorFrame.DISABLED) request.append(" LOGTCELAPSEDTIME Disabled"); if (fLogTCNumStarts == STAXMonitorFrame.ENABLED) request.append(" LOGTCNUMSTARTS Enabled"); else if (fLogTCNumStarts == STAXMonitorFrame.DISABLED) request.append(" LOGTCNUMSTARTS Disabled"); if (fLogTCStartStop == STAXMonitorFrame.ENABLED) request.append(" LOGTCSTARTSTOP Enabled"); else if (fLogTCStartStop == STAXMonitorFrame.DISABLED) request.append(" LOGTCSTARTSTOP Disabled"); try { // this handle will be used only to submit the EXECUTE request fHandle = STAXMonitorUtil.getNewSTAFHandle("STAX/JobMonitor/Execute"); } catch (STAFException e) { throw e; } STAFResult executeResult = fHandle.submit2( fStaxMachine, fStaxServiceName, request.toString()); STAXMonitorUtil.freeHandle(fHandle.getHandle()); if (executeResult.rc != 0) { throw new STAFException( executeResult.rc, "Result=" + executeResult.result + "\n\nRequest=STAF " + fStaxMachine + " " + fStaxServiceName + " " + request.toString()); } else { fJobNumber = executeResult.result; } } try { fHandle = STAXMonitorUtil.getNewSTAFHandle( "STAX/JobMonitor/" + fStaxMachine + "/" + fJobNumber); } catch (STAFException e) { throw e; } boolean jobAlreadyHeld = false; if (!newJob) { String request = "HOLD JOB " + fJobNumber; STAFResult holdResult = fHandle.submit2( fStaxMachine, fStaxServiceName, request); if (holdResult.rc != 0) { if (holdResult.rc == BlockAlreadyHeld) { jobAlreadyHeld = true; } else { throw new STAFException(holdResult.rc, "Error holding Job\n" + holdResult.result); } } } setTitle(kMonitorFrameTitle); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if (!fMonitorStopped) { stopMonitor(); } closeMonitor(); } }); fActiveElementsPane.addChangeListener(this); fStatusPane.addChangeListener(this); fInfoPane.addChangeListener(this); JMenuBar mainMenuBar = new JMenuBar(); setJMenuBar(mainMenuBar); fFileMenu = new JMenu("File"); mainMenuBar.add(fFileMenu); fDisplayMenu = new JMenu("Display"); mainMenuBar.add(fDisplayMenu); fViewMenu = new JMenu("View"); mainMenuBar.add(fViewMenu); fFileResubmit = new JMenuItem("Resubmit Job"); fFileResubmit.addActionListener(this); fFileExitAndResubmit = new JMenuItem("Exit and Resubmit Job"); fFileExitAndResubmit.addActionListener(this); fFileExit = new JMenuItem("Exit"); fFileExit.addActionListener(this); fFileMenu.add(fFileResubmit); fFileMenu.add(fFileExitAndResubmit); fFileMenu.insertSeparator(2); fFileMenu.add(fFileExit); fDisplayMenu.add(fDisplayJobLog); fDisplayMenu.add(fDisplayJobUserLog); fDisplayJobLog.addActionListener(this); fDisplayJobUserLog.addActionListener(this); fDataColumns = new Vector(); fDataColumns.addElement(" Name "); fDataColumns.addElement(" Value "); fMessageColumns = new Vector(); fMessageColumns.addElement(" Timestamp "); fMessageColumns.addElement(" Message "); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(Color.white); fSelectionDetailsPanel = new JPanel(); fSelectionDetailsPanel.setLayout(new BorderLayout()); JPanel selectionButtonPanel = new JPanel(); selectionButtonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); JPanel detailsTablePanel = new JPanel(); detailsTablePanel.setLayout(new BorderLayout()); fDetailsTableModel = new STAXMonitorTableModel(fDataColumns, 0); fDetailsModelSorter = new STAXMonitorTableSorter(fDetailsTableModel); fDetailsTable = new JTable(fDetailsModelSorter); fDetailsModelSorter.addMouseListenerToHeaderInTable(fDetailsTable, 1); fDetailsTable.setVisible(false); fDetailsTable.getTableHeader().setVisible(false); updateDetailsTableRenderers(); JPanel messagesPanel = new JPanel(); messagesPanel.setLayout(new BorderLayout()); fMessageTableModel = new STAXMonitorTableModel(fMessageColumns, 0); fMessageModelSorter = new STAXMonitorTableSorter(fMessageTableModel, 0, fMessageFontName); fMessageTable = new JTable(fMessageModelSorter); fMessageModelSorter.addMouseListenerToHeaderInTable(fMessageTable, 1); fMessageTable.getColumnModel().getColumn(0).setCellRenderer( new STAXMonitorTableCellRenderer( Color.black, false, new Font(fMessageFontName, Font.PLAIN, 12))); fMessageTable.getColumnModel().getColumn(0). setHeaderRenderer(new STAXMonitorTableCellRenderer( Color.black, true, new Font(fMessageFontName, Font.BOLD, 12))); fMessageTable.getColumnModel().getColumn(1).setCellRenderer( new STAXMonitorTableCellRenderer( Color.black, false, new Font(fMessageFontName, Font.PLAIN, 12))); fMessageTable.getColumnModel().getColumn(1). setHeaderRenderer(new STAXMonitorTableCellRenderer( Color.black, true, new Font(fMessageFontName, Font.BOLD, 12))); fMessageTable.setFont(new Font(fMessageFontName, Font.PLAIN, 12)); fMessageScrollPane = new JScrollPane(fMessageTable); fMessageScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); fMessageScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); fMessageTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); STAXMonitorUtil.sizeColumnsToFitText(fMessageTable); fInfoPane.add("Messages", fMessageScrollPane); fViewableComponents.put("Messages", fMessageScrollPane); JScrollPane detailsScrollPane = new JScrollPane(fDetailsTable); detailsScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); detailsScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); fDetailsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); STAXMonitorUtil.sizeColumnsToFitText(fDetailsTable); fCurrentSelection = new JLabel(""); fCurrentSelection.setFont(new Font("Dialog", Font.BOLD, 14)); fCurrentSelection.setForeground(new Color(23, 0, 122)); fSelectionDetailsPanel.add(BorderLayout.NORTH, fCurrentSelection); JPanel selectionDetailsPanel1 = new JPanel(); selectionDetailsPanel1.setLayout(new BorderLayout()); fSelectionDetailsPanel.add(BorderLayout.CENTER, detailsScrollPane); int index = fInfoPane.getTabCount(); fInfoPane.setBackgroundAt(index - 1, Color.white); fInfoPane.setForegroundAt(index - 1, Color.darkGray); fMonitorTree = new JTree(); fMonitorTree.setCellRenderer(new STAXMonitorTreeCellRenderer(fShowNoSTAXMonitorInformation)); fMonitorTree.putClientProperty("JTree.lineStyle", "Angled"); fMonitorTree.setShowsRootHandles(true); fMonitorTree.addTreeSelectionListener(this); fMonitorTreeModel = (DefaultTreeModel) fMonitorTree.getModel(); fMonitorTreeModel.setRoot(new STAXMonitorTreeNode()); fMonitorTree.addMouseListener(this); JPanel treeAndSelectionPanel = new JPanel(); treeAndSelectionPanel.setLayout(new BorderLayout()); fActiveJobElementsMenu = new JCheckBoxMenuItem( "Active Job Elements", true); fActiveJobElementsMenu.addActionListener(this); fViewMenu.add(fActiveJobElementsMenu); JScrollPane scrollPane = new JScrollPane(fMonitorTree); fActiveElementsPane.add("Active Job Elements", scrollPane); fActiveElementsPane.setForegroundAt(0, Color.black); fViewableComponents.put("Active Job Elements", scrollPane); JSplitPane horizPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, fActiveElementsPane, fStatusPane); horizPane.setOneTouchExpandable(true); JSplitPane vertPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, horizPane, fInfoPane); vertPane.setOneTouchExpandable(true); JPanel monitorPanel = new JPanel(); monitorPanel.setLayout(new BorderLayout()); monitorPanel.add(vertPane); fSelectionDetailsPanel.setVisible(true); // Handle extensions try { processTablePlugin = new STAXMonitorProcessExtension(); JComponent processTable = processTablePlugin.init(this, newJob, fStaxMachine, fStaxServiceName, fJobNumber); processTable.setVisible(true); Vector notificationTypes = new Vector(); StringTokenizer types = new StringTokenizer(processTablePlugin.getNotificationEventTypes(), " "); while (types.hasMoreElements()) { String type = types.nextToken().toLowerCase(); notificationTypes.add(type); } fRegisteredPlugins.put(processTablePlugin, notificationTypes); fProcessMenu = new JCheckBoxMenuItem( processTablePlugin.getTitle(), true); fProcessMenu.addActionListener(this); fViewMenu.add(fProcessMenu); fViewablePlugins.put(fProcessMenu, processTablePlugin); JScrollPane procScrollPane = new JScrollPane(processTablePlugin.getComponent()); procScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); procScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); fActiveElementsPane.addTab(processTablePlugin.getTitle(), procScrollPane); fViewableComponents.put(processTablePlugin.getTitle(), procScrollPane); int i = fActiveElementsPane.getTabCount(); fActiveElementsPane.setBackgroundAt(i - 1, Color.white); fActiveElementsPane.setForegroundAt(i - 1, Color.darkGray); } catch (STAFException ex) { System.out.println("STAFException thrown during " + "STAXMonitorProcessTablePlugin initialization. RC: " + ex.rc); } try { stafcmdTablePlugin = new STAXMonitorSTAFCmdExtension(); JComponent stafcmdTable = stafcmdTablePlugin.init(this, newJob, fStaxMachine, fStaxServiceName, fJobNumber); stafcmdTable.setVisible(true); Vector notificationTypes = new Vector(); StringTokenizer types = new StringTokenizer(stafcmdTablePlugin.getNotificationEventTypes(), " "); while (types.hasMoreElements()) { String type = types.nextToken().toLowerCase(); notificationTypes.add(type); } fRegisteredPlugins.put(stafcmdTablePlugin, notificationTypes); fSTAFCmdMenu = new JCheckBoxMenuItem( stafcmdTablePlugin.getTitle(), true); fSTAFCmdMenu.addActionListener(this); fViewMenu.add(fSTAFCmdMenu); JScrollPane stafcmdScrollPane =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -