📄 staxmonitor.java
字号:
public void run() { seedExistingJobs(); } }; try { SwingUtilities.invokeAndWait(runnable); } catch (InterruptedException e) { } catch (InvocationTargetException e) { } if (!jobIDToMonitor.equals("")) { repaint(); synchronized(fActiveJobsModelSorter) { int rows = fActiveJobsTable.getRowCount(); int rowIndex = -1; for (int r = 0; r < rows; r++) { String jobNumber = ((Integer)fActiveJobsTable.getValueAt (r, 0)).toString(); if (jobNumber.equals(jobIDToMonitor)) { rowIndex = r; break; } } if (rowIndex == -1) { showErrorDialog(this, "JobID " + jobIDToMonitor + " was not found."); } else { monitorExistingJob(jobIDToMonitor, rowIndex); } } repaint(); } fStartNewJobDialog.setTitle(fStartNewJobTitle + " " + fCurrentJobParmsFile); fStartNewJobFileSave.setEnabled(false); fWizardSaveButton.addActionListener(this); fWizardPreviewXMLButton.addActionListener(this); fWizardCancelButton.addActionListener(this); (new Thread(this)).start(); fElapsedTime = new MonitorElapsedTime(); fElapsedTime.start(); if (!(fStartNewJobParmFileName.equals(""))) { File jobParmsFile = new File(fStartNewJobParmFileName); if (!jobParmsFile.exists()) { showErrorDialog(this, "Job Parameters File does not exist\n" + "File: " + fStartNewJobParmFileName); exit(); System.exit(0); } if (!(loadJobParms(fStartNewJobParmFileName))) { exit(); System.exit(0); } submitNewJob(); fCurrentJobParmsNotSaved = false; fCurrentJobParmsFile = fStartNewJobParmFileName; fStartNewJobDialog.setTitle(fStartNewJobTitle + " " + fStartNewJobParmFileName); } } public void loadExtensions() { // Get, Validate, and Load Monitor Extensions before show main panel String errorText = ""; STAFResult result; result = loadLocalExtensions(); if (result.rc != 0) { if (!errorText.equals("")) errorText += "\n\n"; errorText += "Errors Validating Local Monitor Extensions:" + result.result; } result = loadSTAXServiceExtensions(); if (result.rc != 0) { if (!errorText.equals("")) errorText += "\n\n"; errorText += "Errors Validating STAX Service Monitor " + "Extensions:" + result.result; } if (!errorText.equals("")) { showErrorDialog(this, errorText, "STAX Monitor Extension Errors"); } // Load STAX Registered Monitor Extensions table information Iterator iter = fMonitorExtensionMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); String extName = (String)entry.getKey(); ExtensionInfo extInfo = (ExtensionInfo)entry.getValue(); Object rowData[] = new Object[fExtensionsColumns.size()]; rowData[fExtensionsColumns.indexOf(EXT_COLUMN_NAME)] = extName; rowData[fExtensionsColumns.indexOf(EXT_COLUMN_VERSION)] = extInfo.getVersion(); if (extInfo.getSource() == STAX_SERVICE_EXTENSION) { rowData[fExtensionsColumns.indexOf(EXT_COLUMN_SOURCE)] = fStaxMachineName; } else { rowData[fExtensionsColumns.indexOf(EXT_COLUMN_SOURCE)] = extInfo.getSourceStr(); } rowData[fExtensionsColumns.indexOf(EXT_COLUMN_JARFILE)] = extInfo.getJarFileName(); rowData[fExtensionsColumns.indexOf(EXT_COLUMN_OVERRIDES)] = extInfo.getOverriddenJarFileName(); rowData[fExtensionsColumns.indexOf(EXT_COLUMN_PREREQ)] = extInfo.getRequiredMonitorVersion(); rowData[fExtensionsColumns.indexOf(EXT_COLUMN_DESCRIPTION)] = extInfo.getDescription(); fExtensionsTableModel.addRow(rowData); } fExtensionsTable.updateUI(); STAXMonitorUtil.updateRowHeights(fExtensionsTable, 1); STAXMonitorUtil.sizeColumnsToFitText(fExtensionsTable); } public void displayMonitorExtensions() { // Display the registered STAX Monitor Extensions StringBuffer output = new StringBuffer( "\nRegistered STAX Monitor Extensions:\n\n"); if (!fMonitorExtensionMap.isEmpty()) { Iterator iter = fMonitorExtensionMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); String extName = (String)entry.getKey(); ExtensionInfo extInfo = (ExtensionInfo)entry.getValue(); String sourceMachine; if (extInfo.getSource() == STAX_SERVICE_EXTENSION) sourceMachine = fStaxMachineName; else sourceMachine = extInfo.getSourceStr(); output.append("Monitor Extension : " + extName + "\nVersion : " + extInfo.getVersion() + "\nSource Machine : " + sourceMachine + "\nJar File Name : " + extInfo.getJarFileName() + "\nOverridden Jar File : " + extInfo.getOverriddenJarFileName() + "\nMonitor Version Prereq: " + extInfo.getRequiredMonitorVersion() + "\nDescription : " + extInfo.getDescription() + "\n\n"); } } else { output.append("None\n\n"); } System.out.println(output.toString()); } public void createPropertiesDialog() { fPropertiesDialog = new JDialog(this, "STAX Monitor Properties", true); JPanel propertiesPanel = new JPanel(); propertiesPanel.setLayout(new BoxLayout(propertiesPanel, BoxLayout.Y_AXIS)); JTabbedPane propertiesTabbedPane = new JTabbedPane(); JPanel staxMachinePanel = new JPanel(); staxMachinePanel.setBorder(new TitledBorder("STAX Machine")); staxMachinePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); fStaxMachineNameField = new JTextField(19); fStaxMachineNameField.setText(fStaxMachineName); fStaxServiceNameField = new JTextField(7); fStaxServiceNameField.setText(fStaxServiceName); staxMachinePanel.add(Box.createHorizontalStrut(5)); staxMachinePanel.add(new JLabel("Machine: ")); staxMachinePanel.add(fStaxMachineNameField); staxMachinePanel.add(Box.createHorizontalStrut(5)); staxMachinePanel.add(new JLabel("STAX Service Name: ")); staxMachinePanel.add(fStaxServiceNameField); staxMachinePanel.add(Box.createHorizontalStrut(5)); JPanel eventMachinePanel = new JPanel(); eventMachinePanel.setBorder(new TitledBorder("Event Machine")); eventMachinePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); fEventMachineNameField = new JTextField(19); fEventMachineNameField.setText(fEventMachineName); fEventMachineNameField.setEditable(false); fEventServiceNameField = new JTextField(7); fEventServiceNameField.setText(fEventServiceName); fEventServiceNameField.setEditable(false); eventMachinePanel.add(Box.createHorizontalStrut(5)); eventMachinePanel.add(new JLabel("Machine: ")); eventMachinePanel.add(fEventMachineNameField); eventMachinePanel.add(Box.createHorizontalStrut(5)); eventMachinePanel.add(new JLabel("Event Service Name: ")); eventMachinePanel.add(fEventServiceNameField); JPanel propertiesButtonPanel = new JPanel(); propertiesButtonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); propertiesButtonPanel.add(fPropertiesOKButton); propertiesButtonPanel.add(Box.createHorizontalStrut(20)); propertiesButtonPanel.add(fPropertiesCancelButton); fPropertiesOKButton.addActionListener(this); fPropertiesCancelButton.addActionListener(this); // Create Extensions panel JPanel extensionsPanel = new JPanel(new GridLayout(1,0)); extensionsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); extensionsPanel.setBorder(new TitledBorder("STAX Monitor Extensions")); extensionsPanel.add(Box.createHorizontalStrut(10)); fExtensionsColumns = new Vector(); fExtensionsColumns.addElement(EXT_COLUMN_NAME); fExtensionsColumns.addElement(EXT_COLUMN_VERSION); fExtensionsColumns.addElement(EXT_COLUMN_SOURCE); fExtensionsColumns.addElement(EXT_COLUMN_JARFILE); fExtensionsColumns.addElement(EXT_COLUMN_OVERRIDES); fExtensionsColumns.addElement(EXT_COLUMN_PREREQ); fExtensionsColumns.addElement(EXT_COLUMN_DESCRIPTION); fExtensionsTableModel = new STAXMonitorTableModel( fExtensionsColumns, 0); fExtensionsModelSorter = new STAXMonitorTableSorter( fExtensionsTableModel, 0); fExtensionsTable = new JTable(fExtensionsModelSorter); fExtensionsModelSorter.addMouseListenerToHeaderInTable( fExtensionsTable, 1); fExtensionsTable.addMouseListener(this); fExtensionsTable.getSelectionModel().addListSelectionListener(this); updateExtensionsTableRenderers(); fExtensionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fExtensionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fExtensionsTable.setRowSelectionAllowed(true); STAXMonitorUtil.sizeColumnsToFitText(fExtensionsTable); JScrollPane extensionsScrollPane = new JScrollPane(fExtensionsTable); extensionsScrollPane.setPreferredSize(new Dimension(620,220)); extensionsPanel.add(extensionsScrollPane); // Create Extension Jar Files Panel fLocalExtJarFiles = new Vector(); JPanel pluginJarsPanel = new JPanel(); pluginJarsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); pluginJarsPanel.setBorder(new TitledBorder( "Local Extension Jar Files")); pluginJarsPanel.add(Box.createHorizontalStrut(10)); fPluginJarsList = new JList(fLocalExtJarFiles); fPluginJarsList.setModel(new DefaultListModel()); fPluginJarsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fPluginJarsList.setCellRenderer(new STAXJobListCellRenderer()); fPluginJarsList.addMouseListener(this); JPanel pluginJarsButtonPanel = new JPanel(); pluginJarsButtonPanel.setLayout(new BoxLayout(pluginJarsButtonPanel, BoxLayout.Y_AXIS)); fPluginJarsAddButton = new JButton("Add..."); fPluginJarsAddButton.addActionListener(this); fPluginJarsDeleteButton = new JButton("Delete"); fPluginJarsDeleteButton.addActionListener(this); fPluginJarsDeleteAllButton = new JButton("Delete All"); fPluginJarsDeleteAllButton.addActionListener(this); pluginJarsButtonPanel.add(fPluginJarsAddButton); pluginJarsButtonPanel.add(Box.createVerticalStrut(5)); pluginJarsButtonPanel.add(fPluginJarsDeleteButton); pluginJarsButtonPanel.add(Box.createVerticalStrut(5)); pluginJarsButtonPanel.add(fPluginJarsDeleteAllButton); JScrollPane fPluginJarsScrollPane = new JScrollPane(fPluginJarsList); fPluginJarsScrollPane.setPreferredSize(new Dimension(500,220)); pluginJarsPanel.add(fPluginJarsScrollPane); pluginJarsPanel.add(Box.createHorizontalStrut(10)); pluginJarsPanel.add(pluginJarsButtonPanel); fAddPluginJarsDialog = new JDialog(this,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -