|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.docus.sw.fenpan;
|
|
|
|
|
|
|
|
|
|
import com.docus.sw.Config;
|
|
|
|
|
import com.docus.sw.souyin.CheckService;
|
|
|
|
|
import com.docus.sw.souyin.SuoyinService;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
@ -277,9 +278,13 @@ public class MyApplication {
|
|
|
|
|
splitPanel.add(leftPanel, BorderLayout.WEST);
|
|
|
|
|
splitPanel.add(rightPanel, BorderLayout.CENTER);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tabbedPane.addTab("参数设置", paramPanel);
|
|
|
|
|
tabbedPane.addTab("分盘工具", splitPanel);
|
|
|
|
|
tabbedPane.addTab("索引工具", createIndexPanel());
|
|
|
|
|
tabbedPane.addTab("检查工具", checkPanel());
|
|
|
|
|
|
|
|
|
|
frame.add(tabbedPane);
|
|
|
|
|
frame.setVisible(true);
|
|
|
|
@ -294,6 +299,132 @@ public class MyApplication {
|
|
|
|
|
plateSizeJtf.setText(Config.getParam("plate.size"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static JPanel checkPanel(){
|
|
|
|
|
// 分盘工具标签页
|
|
|
|
|
JPanel splitPanel = new JPanel(new BorderLayout());
|
|
|
|
|
JPanel leftPanel = new JPanel(new GridBagLayout());
|
|
|
|
|
GridBagConstraints leftGbc = new GridBagConstraints();
|
|
|
|
|
leftGbc.insets = new Insets(5, 5, 5, 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 0;
|
|
|
|
|
leftGbc.gridy = 0;
|
|
|
|
|
leftGbc.anchor = GridBagConstraints.WEST;
|
|
|
|
|
leftPanel.add(new JLabel("文件路径选择:"), leftGbc);
|
|
|
|
|
JTextField filePathField = new JTextField(20);
|
|
|
|
|
leftGbc.gridx = 1;
|
|
|
|
|
leftGbc.gridwidth = 1;
|
|
|
|
|
leftPanel.add(filePathField, leftGbc);
|
|
|
|
|
|
|
|
|
|
JButton fileChooserButton = new JButton("选择文件");
|
|
|
|
|
leftGbc.gridx = 2;
|
|
|
|
|
leftPanel.add(fileChooserButton, leftGbc);
|
|
|
|
|
|
|
|
|
|
// 文件选择按钮的动作监听器,打开文件选择对话框
|
|
|
|
|
fileChooserButton.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
|
int returnValue = fileChooser.showOpenDialog(null);
|
|
|
|
|
if (returnValue == JFileChooser.APPROVE_OPTION) {
|
|
|
|
|
File selectedFile = fileChooser.getSelectedFile();
|
|
|
|
|
filePathField.setText(selectedFile.getAbsolutePath());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// leftGbc.gridx = 0;
|
|
|
|
|
// leftGbc.gridy = 1;
|
|
|
|
|
// leftGbc.anchor = GridBagConstraints.WEST;
|
|
|
|
|
// leftPanel.add(new JLabel("dpi:"), leftGbc);
|
|
|
|
|
// JTextField dpiField = new JTextField(20);
|
|
|
|
|
// leftGbc.gridx = 1;
|
|
|
|
|
// leftPanel.add(dpiField, leftGbc);
|
|
|
|
|
//
|
|
|
|
|
// leftGbc.gridx = 0;
|
|
|
|
|
// leftGbc.gridy = 2;
|
|
|
|
|
// leftPanel.add(new JLabel("胶片长度:"), leftGbc);
|
|
|
|
|
// JTextField filmLengthField = new JTextField(20);
|
|
|
|
|
// leftGbc.gridx = 1;
|
|
|
|
|
// leftPanel.add(filmLengthField, leftGbc);
|
|
|
|
|
//
|
|
|
|
|
// leftGbc.gridx = 0;
|
|
|
|
|
// leftGbc.gridy = 3;
|
|
|
|
|
// leftPanel.add(new JLabel("图像格式:"), leftGbc);
|
|
|
|
|
// String[] imageFormats = {"图片", "pdf", "word"};
|
|
|
|
|
// JComboBox<String> formatComboBox = new JComboBox<>(imageFormats);
|
|
|
|
|
// leftGbc.gridx = 1;
|
|
|
|
|
// leftPanel.add(formatComboBox, leftGbc);
|
|
|
|
|
//
|
|
|
|
|
// // 添加图像格式选择框的监听器,可以根据选择的格式执行相应操作
|
|
|
|
|
// formatComboBox.addActionListener(new ActionListener() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void actionPerformed(ActionEvent e) {
|
|
|
|
|
// String selectedFormat = (String) formatComboBox.getSelectedItem();
|
|
|
|
|
// // 在这里执行根据选择的格式的操作
|
|
|
|
|
// System.out.println("选择的图像格式: " + selectedFormat);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 1;
|
|
|
|
|
leftGbc.gridy = 4;
|
|
|
|
|
JButton jButton = new JButton("开始检查");
|
|
|
|
|
leftPanel.add(jButton, leftGbc);
|
|
|
|
|
|
|
|
|
|
// ... 其他左边的功能选项,与前面的代码相同 ...
|
|
|
|
|
|
|
|
|
|
// 添加到左右布局
|
|
|
|
|
splitPanel.add(leftPanel, BorderLayout.WEST);
|
|
|
|
|
JTextArea logTextArea = new JTextArea();
|
|
|
|
|
JScrollPane logScrollPane = new JScrollPane(logTextArea);
|
|
|
|
|
logScrollPane.setPreferredSize(new Dimension(200, 200));
|
|
|
|
|
splitPanel.add(logScrollPane, BorderLayout.CENTER);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jButton.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// 在EDT上执行更新操作
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logTextArea.append(df.format(new Date())+": 检查开始。。。"+ "\n");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 启动一个异步任务
|
|
|
|
|
|
|
|
|
|
Thread workerThread = new Thread(() -> {
|
|
|
|
|
// 执行长时间运行的业务操作
|
|
|
|
|
|
|
|
|
|
// 模拟耗时操作
|
|
|
|
|
try {
|
|
|
|
|
new CheckService().index(filePathField.getText());
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
throw new RuntimeException(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
// 在EDT上更新UI
|
|
|
|
|
logTextArea.append(df.format(new Date())+": 检查结束。。。"+ "\n");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
workerThread.start(); // 启动线程
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return splitPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static JPanel createIndexPanel() {
|
|
|
|
|
JPanel indexPanel = new JPanel(new BorderLayout());
|
|
|
|
|
JPanel leftIndexPanel = new JPanel(new GridBagLayout());
|
|
|
|
|