📄 staxmonitor.java
字号:
"Add Extension Jar File", true); fAddPluginJarsDialog.setSize(new Dimension(400, 115)); JPanel addPluginJarsPanel = new JPanel(); addPluginJarsPanel.setLayout(new BorderLayout()); fAddPluginJarsTextField = new JTextField(15); fAddPluginJarsTextField.setBorder(new TitledBorder( "Enter extension jar file name here")); addPluginJarsPanel.add(BorderLayout.CENTER, new JScrollPane(fAddPluginJarsTextField)); fAddPluginJarsBrowseButton = new JButton("Browse..."); fAddPluginJarsAddButton = new JButton("Add"); fAddPluginJarsCancelButton = new JButton("Cancel"); JPanel addPluginJarsButtonPanel = new JPanel(); addPluginJarsButtonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); addPluginJarsButtonPanel.add(fAddPluginJarsBrowseButton); addPluginJarsButtonPanel.add(Box.createHorizontalStrut(20)); addPluginJarsButtonPanel.add(fAddPluginJarsAddButton); addPluginJarsButtonPanel.add(Box.createHorizontalStrut(20)); addPluginJarsButtonPanel.add(fAddPluginJarsCancelButton); addPluginJarsPanel.add(BorderLayout.SOUTH, addPluginJarsButtonPanel); fAddPluginJarsAddButton.addActionListener(this); fAddPluginJarsCancelButton.addActionListener(this); fAddPluginJarsBrowseButton.addActionListener(this); fAddPluginJarsDialog.getContentPane().add(addPluginJarsPanel); fEditPluginJarsDialog = new JDialog(this, "Edit Plugin Jar", true); fEditPluginJarsDialog.setSize(new Dimension(400, 115)); JPanel editPluginJarsPanel = new JPanel(); editPluginJarsPanel.setLayout(new BorderLayout()); fEditPluginJarsTextField = new JTextField(15); fEditPluginJarsTextField.setBorder(new TitledBorder( "Update extension jar file name here")); editPluginJarsPanel.add(BorderLayout.CENTER, new JScrollPane(fEditPluginJarsTextField)); fEditPluginJarsSaveButton = new JButton("Save"); fEditPluginJarsCancelButton = new JButton("Cancel"); JPanel editPluginJarsButtonPanel = new JPanel(); editPluginJarsButtonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); editPluginJarsButtonPanel.add(fEditPluginJarsSaveButton); editPluginJarsButtonPanel.add(Box.createHorizontalStrut(20)); editPluginJarsButtonPanel.add(fEditPluginJarsCancelButton); editPluginJarsPanel.add(BorderLayout.SOUTH, editPluginJarsButtonPanel); fEditPluginJarsSaveButton.addActionListener(this); fEditPluginJarsCancelButton.addActionListener(this); fEditPluginJarsDialog.getContentPane().add(editPluginJarsPanel); // Create Options panel JPanel optionsPanel = new JPanel(); optionsPanel.setBorder(new TitledBorder("Options")); optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS)); JPanel displayProcessMonitorPanel = new JPanel(); displayProcessMonitorPanel.setLayout( new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel processMonitor = new JLabel("Update Process Monitor " + "information every "); processMonitor.setForeground(Color.black); displayProcessMonitorPanel.add(processMonitor); fProcessMonitorSecondsField = new JTextField(5); fProcessMonitorSecondsField.setText(fDefaultProcessMonitorSeconds); displayProcessMonitorPanel.add(fProcessMonitorSecondsField); JLabel secondsLabel = new JLabel(" seconds"); secondsLabel.setForeground(Color.black); displayProcessMonitorPanel.add(secondsLabel); JPanel displayElapsedTimePanel = new JPanel(); displayElapsedTimePanel.setLayout( new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel elapsedTime = new JLabel("Update Elapsed Time " + "every "); elapsedTime.setForeground(Color.black); displayElapsedTimePanel.add(elapsedTime); fElapsedTimeSecondsField = new JTextField(5); fElapsedTimeSecondsField.setText(fDefaultElapsedTimeSeconds); secondsLabel = new JLabel(" seconds"); secondsLabel.setForeground(Color.black); displayElapsedTimePanel.add(fElapsedTimeSecondsField); displayElapsedTimePanel.add(secondsLabel); JPanel monitorInfoPanel = new JPanel(); monitorInfoPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); monitorInfoPanel.add(fShowNoSTAXMonitorInformation); JPanel limitMessagesPanel = new JPanel(); limitMessagesPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); fLimitMessagesField = new JTextField(5); fLimitMessagesField.setText(fDefaultLimitMessagesText); limitMessagesPanel.add(fLimitMessages); limitMessagesPanel.add(fLimitMessagesField); fMessageFontNameCB = new JComboBox(); fLogViewerFontNameCB = new JComboBox(); // Add the Dialog font name as the first item in the font combo box // as the first item is the default selection if no selection is made fMessageFontNameCB.addItem("Dialog"); fLogViewerFontNameCB.addItem("Dialog"); // Get the names of all available fonts and add to the font comboboxes GraphicsEnvironment env = GraphicsEnvironment. getLocalGraphicsEnvironment(); String[] fontNames = env.getAvailableFontFamilyNames(); for (int i = 0; i < fontNames.length; i++) { if (!fontNames[i].equals("Dialog")) { fMessageFontNameCB.addItem(fontNames[i]); fLogViewerFontNameCB.addItem(fontNames[i]); } } JPanel messageFontNamePanel = new JPanel(); messageFontNamePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel messageFontName = new JLabel("Messages Font Name: "); fMessageFontNameCB.setFont(new Font("Dialog", Font.PLAIN, 12)); fMessageFontNameCB.setBackground(Color.white); fMessageFontNameCB.addActionListener(this); messageFontNamePanel.add(messageFontName); messageFontNamePanel.add(fMessageFontNameCB); JPanel logViewerFontNamePanel = new JPanel(); logViewerFontNamePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel logViewerFontName = new JLabel("Log Viewer Font Name: "); fLogViewerFontNameCB.setFont(new Font("Dialog", Font.PLAIN, 12)); fLogViewerFontNameCB.setBackground(Color.white); logViewerFontNamePanel.add(logViewerFontName); logViewerFontNamePanel.add(fLogViewerFontNameCB); optionsPanel.add(displayProcessMonitorPanel); optionsPanel.add(displayElapsedTimePanel); optionsPanel.add(monitorInfoPanel); optionsPanel.add(limitMessagesPanel); optionsPanel.add(messageFontNamePanel); optionsPanel.add(logViewerFontNamePanel); fShowNoSTAXMonitorInformation.addItemListener(this); fLimitMessages.addItemListener(this); JPanel machinePanel = new JPanel(); machinePanel.setLayout(new BoxLayout(machinePanel, BoxLayout.Y_AXIS)); machinePanel.add(staxMachinePanel); machinePanel.add(eventMachinePanel); JPanel subjobsPanel = new JPanel(); subjobsPanel.setBorder(new TitledBorder("Sub-jobs")); subjobsPanel.setLayout(new BoxLayout(subjobsPanel, BoxLayout.Y_AXIS)); fAutoMonitorSubjobsRB = new JRadioButton( "Automatically monitor sub-jobs", false); fAutoMonitorRecommendedSubjobsRB = new JRadioButton( "Automatically monitor recommended sub-jobs", true); fNeverAutoMonitorSubjobsRB = new JRadioButton( "Never automatically monitor sub-jobs", false); fAutoMonitorSubjobsRB.addItemListener(this); fAutoMonitorRecommendedSubjobsRB.addItemListener(this); fNeverAutoMonitorSubjobsRB.addItemListener(this); ButtonGroup monitorSubjobsGroup = new ButtonGroup(); monitorSubjobsGroup.add(fAutoMonitorSubjobsRB); monitorSubjobsGroup.add(fAutoMonitorRecommendedSubjobsRB); monitorSubjobsGroup.add(fNeverAutoMonitorSubjobsRB); subjobsPanel.add(fAutoMonitorSubjobsRB); subjobsPanel.add(fAutoMonitorRecommendedSubjobsRB); subjobsPanel.add(fNeverAutoMonitorSubjobsRB); JPanel infoPanel = new JPanel(); infoPanel.setBorder(new TitledBorder("STAX Monitor Info")); infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS)); propertiesTabbedPane.addTab("Machine Info", machinePanel); propertiesTabbedPane.addTab("Options", optionsPanel); propertiesTabbedPane.addTab("Sub-jobs", subjobsPanel); propertiesTabbedPane.addTab("Extensions", extensionsPanel); propertiesTabbedPane.addTab("Extension Jars", pluginJarsPanel); // Set tab colors for (int i = 0; i < propertiesTabbedPane.getTabCount(); i++) { if (i == 0) { propertiesTabbedPane.setBackgroundAt(i, Color.lightGray); } else { propertiesTabbedPane.setBackgroundAt(i, Color.white); propertiesTabbedPane.setForegroundAt(i, Color.darkGray); } } propertiesPanel.add(new JScrollPane(propertiesTabbedPane)); propertiesPanel.add(propertiesButtonPanel); propertiesTabbedPane.addChangeListener(this); fPropertiesDialog.setSize(new Dimension(675, 370)); fPropertiesDialog.getContentPane().add( new JScrollPane(propertiesPanel)); } public void actionPerformed(ActionEvent e) { if (e.getSource() == fPropertiesCancelButton) { fPropertiesDialog.hide(); } else if (e.getSource() == fPropertiesOKButton) { if (validateProperties()) { fStaxMachineName = fStaxMachineNameField.getText(); fStaxServiceName = fStaxServiceNameField.getText(); fEventMachineName = fEventMachineNameField.getText(); fEventServiceName = fEventServiceNameField.getText(); fLimitMessagesFieldText = fLimitMessagesField.getText(); fProcessMonitorSecondsFieldText = fProcessMonitorSecondsField.getText(); fElapsedTimeSecondsFieldText = fElapsedTimeSecondsField.getText(); fMessageFontName = (String)fMessageFontNameCB.getSelectedItem(); fLogViewerFontName = (String)fLogViewerFontNameCB. getSelectedItem(); fPropertiesDialog.hide(); Endpoint staxEndpoint = new Endpoint(fStaxMachineName); fStaxMachineInterface = staxEndpoint.getInterface(); fStaxMachineIdentifier = staxEndpoint.getMachineIdentifier(); fStaxMachinePort = staxEndpoint.getPort(); resolveMachineNames(); saveProperties(); // Check if need to restart Monitor due to a property change boolean restart = false; if (!(fStaxMachineName.equals(fOldStaxMachineName))) { restart = true; } if (!(fStaxServiceName.equals(fOldStaxServiceName))) { restart = true; } if (!(fEventMachineName.equals(fOldEventMachineName))) { restart = true; } if (!(fEventServiceName.equals(fOldEventServiceName))) { restart = true; } if (!(fLocalExtJarFiles.equals(fOldLocalExtJarFiles))) { restart = true; } if (!fPropertiesAtStartup && restart) { JOptionPane.showMessageDialog(this, "You must now shutdown and restart the STAX\n" + "Job Monitor to use the updated properties", "STAX Monitor Properties Updated", JOptionPane.WARNING_MESSAGE); } fOldStaxMachineName = fStaxMachineName; fOldStaxServiceName = fStaxServiceName; fOldEventMachineName = fEventMachineName; fOldEventServiceName = fEventServiceName; fOldLocalExtJarFiles = new Vector(fLocalExtJarFiles); } } else if (e.getSource() == fFileExit) { exit(); System.exit(0); } else if (e.getSource() == fStartNewJobFileExit) { repaint(); fStartNewJobDialog.dispose(); } else if (e.getSource() == fFileProperties) { fStaxMachineNameField.setText(fStaxMachineName); fStaxServiceNameField.setText(fStaxServiceName); fEventMachineNameField.setText(fEventMachineName); fEventServiceNameField.setText(fEventServiceName); fProcessMonitorSecondsField.setText( fProcessMonitorSecondsFieldText); fElapsedTimeSecondsField.setText( fElapsedTimeSecondsFieldText); fPropertiesCancelButton.setEnabled(true); fPropertiesDialog.setLocationRelativeTo(this); fPropertiesDialog.show(); } else if (e.getSource() == fHelpAbout) { ImageIcon image = new ImageIcon(splashURL); SplashScreen splash = new SplashScreen(image, 5000, kSplashText); splash.run(); } else if (e.getSource() == fStartNewJobButton) { showStartNewJobDialog(); } else if (e.getSource() == fJobParametersMenuI
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -