|
|
|
@ -15,6 +15,7 @@ import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
public class MyApplication {
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
@ -61,14 +62,19 @@ public class MyApplication {
|
|
|
|
|
GridBagConstraints gbc = new GridBagConstraints();
|
|
|
|
|
gbc.insets = new Insets(5, 5, 5, 5);
|
|
|
|
|
|
|
|
|
|
JPanel sizePanel3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
|
|
|
|
sizePanel3.add(new JLabel("A0大小尺寸(英寸) 长:"));
|
|
|
|
|
JTextField a0LongJtf = new JTextField(5);
|
|
|
|
|
sizePanel3.add(a0LongJtf);
|
|
|
|
|
sizePanel3.add(new JLabel("宽:"));
|
|
|
|
|
JTextField a0WidthJt = new JTextField(5);
|
|
|
|
|
sizePanel3.add(a0WidthJt);
|
|
|
|
|
|
|
|
|
|
gbc.gridx = 0;
|
|
|
|
|
gbc.gridy = 0;
|
|
|
|
|
gbc.gridwidth = 2;
|
|
|
|
|
gbc.anchor = GridBagConstraints.WEST;
|
|
|
|
|
paramPanel.add(new JLabel("宗前缀名:"), gbc);
|
|
|
|
|
gbc.gridx = 1;
|
|
|
|
|
gbc.anchor = GridBagConstraints.CENTER;
|
|
|
|
|
JTextField zongPreJtf = new JTextField(20);
|
|
|
|
|
paramPanel.add(zongPreJtf, gbc);
|
|
|
|
|
paramPanel.add(sizePanel3, gbc);
|
|
|
|
|
|
|
|
|
|
JPanel sizePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
|
|
|
|
sizePanel.add(new JLabel("A4大小尺寸(英寸) 长:"));
|
|
|
|
@ -104,26 +110,24 @@ public class MyApplication {
|
|
|
|
|
gbc.gridy = 3;
|
|
|
|
|
gbc.gridwidth = 1;
|
|
|
|
|
gbc.anchor = GridBagConstraints.WEST;
|
|
|
|
|
paramPanel.add(new JLabel("盘大小:"), gbc);
|
|
|
|
|
paramPanel.add(new JLabel("16mm规格盘大小:"), gbc);
|
|
|
|
|
gbc.gridx = 1;
|
|
|
|
|
gbc.anchor = GridBagConstraints.CENTER;
|
|
|
|
|
JTextField plateSizeJtf = new JTextField(20);
|
|
|
|
|
paramPanel.add(plateSizeJtf, gbc);
|
|
|
|
|
|
|
|
|
|
JPanel modePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
|
|
|
|
modePanel.add(new JLabel("模式选择:"));
|
|
|
|
|
String[] modes = {"图片", "word", "pdf"};
|
|
|
|
|
JComboBox<String> modeComboBox = new JComboBox<>(modes);
|
|
|
|
|
modePanel.add(modeComboBox);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gbc.gridx = 0;
|
|
|
|
|
gbc.gridy = 4;
|
|
|
|
|
gbc.gridwidth = 2;
|
|
|
|
|
gbc.gridwidth = 1;
|
|
|
|
|
gbc.anchor = GridBagConstraints.WEST;
|
|
|
|
|
paramPanel.add(modePanel, gbc);
|
|
|
|
|
paramPanel.add(new JLabel("33mm规格盘大小:"), gbc);
|
|
|
|
|
gbc.gridx = 1;
|
|
|
|
|
gbc.anchor = GridBagConstraints.CENTER;
|
|
|
|
|
JTextField plateSizeJtf33 = new JTextField(20);
|
|
|
|
|
paramPanel.add(plateSizeJtf33, gbc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gbc.gridx = 0;
|
|
|
|
|
gbc.gridy = 5;
|
|
|
|
@ -136,11 +140,6 @@ public class MyApplication {
|
|
|
|
|
//添加事件
|
|
|
|
|
jButton.addActionListener(e -> {
|
|
|
|
|
//宗名
|
|
|
|
|
System.out.println(zongPreJtf.getText());
|
|
|
|
|
|
|
|
|
|
//模式
|
|
|
|
|
String selectedValue = (String) modeComboBox.getSelectedItem();
|
|
|
|
|
System.out.println(selectedValue);
|
|
|
|
|
|
|
|
|
|
//a3 图片大小
|
|
|
|
|
System.out.println(a4LongJtf.getText());
|
|
|
|
@ -152,13 +151,14 @@ public class MyApplication {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,String> keyvalue = new HashMap<>();
|
|
|
|
|
keyvalue.put("zong.name.prefix",zongPreJtf.getText());
|
|
|
|
|
keyvalue.put("file.mode",selectedValue);
|
|
|
|
|
keyvalue.put("a0.length",a0LongJtf.getText());
|
|
|
|
|
keyvalue.put("a3.length",a3LongJtf2.getText());
|
|
|
|
|
keyvalue.put("a4.length",a4LongJtf.getText());
|
|
|
|
|
keyvalue.put("a0.width",a0WidthJt.getText());
|
|
|
|
|
keyvalue.put("a3.width",a3WidthJtf2.getText());
|
|
|
|
|
keyvalue.put("a4.width",a4WidthJtf.getText());
|
|
|
|
|
keyvalue.put("plate.size",plateSizeJtf.getText());
|
|
|
|
|
keyvalue.put("plate33.size",plateSizeJtf33.getText());
|
|
|
|
|
try {
|
|
|
|
|
Config.updateConfig(keyvalue);
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
@ -172,8 +172,18 @@ public class MyApplication {
|
|
|
|
|
GridBagConstraints leftGbc = new GridBagConstraints();
|
|
|
|
|
leftGbc.insets = new Insets(5, 5, 5, 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 0;
|
|
|
|
|
leftGbc.gridy = 0;
|
|
|
|
|
leftPanel.add(new JLabel("模式选择:"));
|
|
|
|
|
String[] rollmodes = {"16mm规格", "35mm规格"};
|
|
|
|
|
JComboBox<String> rollmodeComboBox = new JComboBox<>(rollmodes);
|
|
|
|
|
leftGbc.gridx = 1;
|
|
|
|
|
leftGbc.gridwidth = 1;
|
|
|
|
|
leftPanel.add(rollmodeComboBox);
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 0;
|
|
|
|
|
leftGbc.gridy = 1;
|
|
|
|
|
leftPanel.add(new JLabel("分盘目录:"), leftGbc);
|
|
|
|
|
JTextField folderField = new JTextField(20);
|
|
|
|
|
leftGbc.gridx = 1;
|
|
|
|
@ -198,12 +208,16 @@ public class MyApplication {
|
|
|
|
|
leftPanel.add(folderChooserButton, leftGbc);
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 0;
|
|
|
|
|
leftGbc.gridy = 1;
|
|
|
|
|
leftGbc.gridy = 2;
|
|
|
|
|
leftPanel.add(new JLabel("保存路径:"), leftGbc);
|
|
|
|
|
JTextField savePathField = new JTextField(20);
|
|
|
|
|
leftGbc.gridx = 1;
|
|
|
|
|
leftPanel.add(savePathField, leftGbc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JButton savePathChooserButton = new JButton("选择文件夹");
|
|
|
|
|
savePathChooserButton.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
@ -222,7 +236,14 @@ public class MyApplication {
|
|
|
|
|
leftPanel.add(savePathChooserButton, leftGbc);
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 0;
|
|
|
|
|
leftGbc.gridy = 2;
|
|
|
|
|
leftGbc.gridy = 3;
|
|
|
|
|
leftPanel.add(new JLabel("宗前缀名:"), leftGbc);
|
|
|
|
|
JTextField zongFiled = new JTextField(20);
|
|
|
|
|
leftGbc.gridx = 1;
|
|
|
|
|
leftPanel.add(zongFiled, leftGbc);
|
|
|
|
|
|
|
|
|
|
leftGbc.gridx = 0;
|
|
|
|
|
leftGbc.gridy = 4;
|
|
|
|
|
leftGbc.gridwidth = 2;
|
|
|
|
|
leftGbc.anchor = GridBagConstraints.CENTER;
|
|
|
|
|
JButton fenpanJbtn = new JButton("开始分盘");
|
|
|
|
@ -248,6 +269,7 @@ public class MyApplication {
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logTextArea.append(df.format(new Date())+": 开始分盘。。。"+ "\n");
|
|
|
|
|
logTextArea.append(df.format(new Date())+": 分盘中。。。"+ "\n");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 启动一个异步任务
|
|
|
|
@ -258,7 +280,9 @@ public class MyApplication {
|
|
|
|
|
// 模拟耗时操作
|
|
|
|
|
String saveUrl = savePathField.getText()+"/";
|
|
|
|
|
String readUrl = folderField.getText();
|
|
|
|
|
new FenpanService().fenpan(saveUrl,readUrl);
|
|
|
|
|
String s = Objects.requireNonNull(rollmodeComboBox.getSelectedItem()).toString();
|
|
|
|
|
System.out.println(s);
|
|
|
|
|
new FenpanService(s,zongFiled.getText()).fenpan(saveUrl,readUrl);
|
|
|
|
|
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
@ -291,12 +315,14 @@ public class MyApplication {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//加载数据
|
|
|
|
|
zongPreJtf.setText(Config.getParam("zong.name.prefix"));
|
|
|
|
|
a4LongJtf.setText(Config.getParam("a4.length"));
|
|
|
|
|
a0LongJtf.setText(Config.getParam("a0.length"));
|
|
|
|
|
a3LongJtf2.setText(Config.getParam("a3.length"));
|
|
|
|
|
a4WidthJtf.setText(Config.getParam("a4.width"));
|
|
|
|
|
a0WidthJt.setText(Config.getParam("a0.width"));
|
|
|
|
|
a3WidthJtf2.setText(Config.getParam("a3.width"));
|
|
|
|
|
plateSizeJtf.setText(Config.getParam("plate.size"));
|
|
|
|
|
plateSizeJtf33.setText(Config.getParam("plate33.size"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -317,7 +343,7 @@ public class MyApplication {
|
|
|
|
|
leftGbc.gridwidth = 1;
|
|
|
|
|
leftPanel.add(filePathField, leftGbc);
|
|
|
|
|
|
|
|
|
|
JButton fileChooserButton = new JButton("选择文件");
|
|
|
|
|
JButton fileChooserButton = new JButton("选择文件夹");
|
|
|
|
|
leftGbc.gridx = 2;
|
|
|
|
|
leftPanel.add(fileChooserButton, leftGbc);
|
|
|
|
|
|
|
|
|
@ -326,6 +352,7 @@ public class MyApplication {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
|
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
|
|
|
int returnValue = fileChooser.showOpenDialog(null);
|
|
|
|
|
if (returnValue == JFileChooser.APPROVE_OPTION) {
|
|
|
|
|
File selectedFile = fileChooser.getSelectedFile();
|
|
|
|
@ -393,6 +420,7 @@ public class MyApplication {
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
logTextArea.append(df.format(new Date())+": 检查开始。。。"+ "\n");
|
|
|
|
|
logTextArea.append(df.format(new Date())+": 检查中。。。"+ "\n");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 启动一个异步任务
|
|
|
|
@ -497,6 +525,7 @@ public class MyApplication {
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
indexLogTextArea.append(df.format(new Date())+": 索引开始。。。"+ "\n");
|
|
|
|
|
indexLogTextArea.append(df.format(new Date())+": 索引中。。。"+ "\n");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 启动一个异步任务
|
|
|
|
|