diff --git a/download_links.json b/download_links.json index 4c01eef4..e747162b 100644 --- a/download_links.json +++ b/download_links.json @@ -1,5 +1,5 @@ { - "windows": "https://gitee.com/zhoubochina/MooTool/releases/download/v1.5.1/MooTool-1.5.1-windows.exe", - "mac": "https://gitee.com/zhoubochina/MooTool/releases/download/v1.5.1/MooTool_1.5.1.dmg", - "linux": "https://gitee.com/zhoubochina/MooTool/releases/download/v1.5.1/MooTool_1.5.1.deb" + "windows": "https://gitee.com/zhoubochina/MooTool/releases/download/v1.5.2/MooTool-1.5.2-windows.exe", + "mac": "https://gitee.com/zhoubochina/MooTool/releases/download/v1.5.2/MooTool_1.5.2.dmg", + "linux": "https://gitee.com/zhoubochina/MooTool/releases/download/v1.5.2/MooTool_1.5.2.deb" } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1f5fc4d6..347fc80a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.luoboduner.moo.tool MooTool - 1.5.2 + 1.5.3 jar MooTool @@ -40,6 +40,7 @@ 2.0.3 1.16.0 3.8 + 9.2.1 @@ -226,6 +227,12 @@ 3.0.9 + + com.cronutils + cron-utils + ${cron-utils.version} + + @@ -249,41 +256,46 @@ com.luoboduner.moo.tool.App true - --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports + jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports + jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports + jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports + jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -293,23 +305,23 @@ - + - - bundling-for-mac - package - - package - - - mac - false - true - jdk.crypto.ec,jdk.charsets - - + + bundling-for-mac + package + + package + + + mac + false + true + jdk.crypto.ec,jdk.charsets + + diff --git a/src/main/java/com/luoboduner/moo/tool/ui/UiConsts.java b/src/main/java/com/luoboduner/moo/tool/ui/UiConsts.java index 2f0f3bd2..0f9e591e 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/UiConsts.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/UiConsts.java @@ -19,7 +19,7 @@ public class UiConsts { * 软件名称,版本 */ public static final String APP_NAME = "MooTool"; - public static final String APP_VERSION = "v1.5.2"; + public static final String APP_VERSION = "v1.5.3"; public static final int TABLE_ROW_HEIGHT = 30; diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/CommonCronDialog.form b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CommonCronDialog.form new file mode 100644 index 00000000..a78206c5 --- /dev/null +++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CommonCronDialog.form @@ -0,0 +1,655 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/CommonCronDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CommonCronDialog.java new file mode 100644 index 00000000..babcfa9d --- /dev/null +++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CommonCronDialog.java @@ -0,0 +1,387 @@ +package com.luoboduner.moo.tool.ui.dialog; + +import com.formdev.flatlaf.util.SystemInfo; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import com.luoboduner.moo.tool.App; +import com.luoboduner.moo.tool.util.ComponentUtil; +import com.luoboduner.moo.tool.util.ScrollUtil; +import com.luoboduner.moo.tool.util.SystemUtil; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import javax.swing.plaf.FontUIResource; +import javax.swing.text.StyleContext; +import java.awt.*; +import java.awt.event.*; +import java.util.Locale; + +public class CommonCronDialog extends JDialog { + private JPanel contentPane; + private JTextField a0021TextField; + private JScrollPane scrollPane; + private JTextField a01510MONTextField; + private JTextField a015106LTextField; + private JTextField a001014TextField; + private JTextField a00309TextField; + private JTextField a0012WEDTextField; + private JTextField a0012TextField; + private JTextField a01510TextField; + private JTextField a01510TextField2; + private JTextField a01510TextField3; + private JTextField a015102005TextField; + private JTextField a014TextField; + private JTextField a00514TextField; + private JTextField a00514TextField2; + private JTextField a00514TextField3; + private JTextField a0104414TextField; + private JTextField a01510MONTextField1; + private JTextField a0151015TextField; + private JTextField a01510LTextField; + private JTextField a015106LTextField1; + private JTextField a015106LTextField3; + private JTextField a015106TextField; + private JTextField a01510TextField1; + private JTextField a015102017TextField; + private JTextField a014TextField1; + private JTextField a00514TextField1; + private JTextField a00514TextField5; + private JTextField a00514TextField6; + private JTextField a015106LTextField2; + private JTextField a015106TextField1; + + public CommonCronDialog() { + super(App.mainFrame, "常用Cron表达式"); + setContentPane(contentPane); + setAlwaysOnTop(false); + setFocusable(true); + setResizable(true); + setLocationByPlatform(true); + + if (SystemUtil.isMacOs() && SystemInfo.isMacFullWindowContentSupported) { + this.getRootPane().putClientProperty("apple.awt.fullWindowContent", true); + this.getRootPane().putClientProperty("apple.awt.transparentTitleBar", true); + this.getRootPane().putClientProperty("apple.awt.fullscreenable", true); + this.getRootPane().putClientProperty("apple.awt.windowTitleVisible", false); + GridLayoutManager gridLayoutManager = (GridLayoutManager) contentPane.getLayout(); + gridLayoutManager.setMargin(new Insets(28, 0, 0, 0)); + } + + ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.6, 0.8); + + ScrollUtil.smoothPane(scrollPane); + + // call onCancel() when cross is clicked + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + onCancel(); + } + }); + + // call onCancel() on ESCAPE + contentPane.registerKeyboardAction(new ActionListener() { + public void actionPerformed(ActionEvent e) { + onCancel(); + } + }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + } + + private void onOK() { + // add your code here + dispose(); + } + + private void onCancel() { + // add your code here if necessary + dispose(); + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer + * >>> IMPORTANT!! <<< + * DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); + scrollPane = new JScrollPane(); + contentPane.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(33, 2, new Insets(10, 10, 10, 10), -1, -1)); + scrollPane.setViewportView(panel1); + final JLabel label1 = new JLabel(); + label1.setText("每月的1日的凌晨2点"); + panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("周一到周五每天上午10:15"); + panel1.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("2002-2006年的每个月的最后一个星期五上午10:15"); + panel1.add(label3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label4 = new JLabel(); + label4.setText("每天上午10点,下午2点,4点"); + panel1.add(label4, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label5 = new JLabel(); + label5.setText("朝九晚五工作时间内每半小时"); + panel1.add(label5, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label6 = new JLabel(); + label6.setText("每个星期三中午12点"); + panel1.add(label6, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label7 = new JLabel(); + label7.setText("每天中午12点"); + panel1.add(label7, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label8 = new JLabel(); + label8.setText("每天上午10:15"); + panel1.add(label8, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label9 = new JLabel(); + label9.setText("每天上午10:15"); + panel1.add(label9, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label10 = new JLabel(); + label10.setText("每天上午10:15"); + panel1.add(label10, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label11 = new JLabel(); + label11.setText("2005年的每天上午10:15"); + panel1.add(label11, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label12 = new JLabel(); + label12.setText("每天下午2点到下午2:59期间的每1分钟"); + panel1.add(label12, new GridConstraints(11, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label13 = new JLabel(); + label13.setText("每天下午2点到下午2:55期间的每5分钟"); + panel1.add(label13, new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label14 = new JLabel(); + label14.setText("每天下午2点到2:55期间和下午6点到6:55期间的每5分钟"); + panel1.add(label14, new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label15 = new JLabel(); + label15.setText("每天下午2点到下午2:05期间的每1分钟"); + panel1.add(label15, new GridConstraints(14, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label16 = new JLabel(); + label16.setText("每年三月的星期三的下午2:10和2:44"); + panel1.add(label16, new GridConstraints(15, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label17 = new JLabel(); + label17.setText("周一至周五的上午10:15"); + panel1.add(label17, new GridConstraints(16, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label18 = new JLabel(); + label18.setText("每月15日上午10:15"); + panel1.add(label18, new GridConstraints(17, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label19 = new JLabel(); + label19.setText("每月最后一日的上午10:15"); + panel1.add(label19, new GridConstraints(18, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label20 = new JLabel(); + label20.setText("每月的最后一个星期五上午10:15"); + panel1.add(label20, new GridConstraints(19, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label21 = new JLabel(); + label21.setText("2002年至2005年的每月的最后一个星期五上午10:15"); + panel1.add(label21, new GridConstraints(20, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label22 = new JLabel(); + label22.setText("每月的第三个星期五上午10:15"); + panel1.add(label22, new GridConstraints(21, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + a0021TextField = new JTextField(); + a0021TextField.setEditable(false); + a0021TextField.setText("0 0 2 1 * ? *"); + panel1.add(a0021TextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a01510MONTextField = new JTextField(); + a01510MONTextField.setEditable(false); + a01510MONTextField.setText("0 15 10 ? * MON-FRI"); + panel1.add(a01510MONTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015106LTextField = new JTextField(); + a015106LTextField.setEditable(false); + a015106LTextField.setText("0 15 10 ? * 6L 2002-2006"); + panel1.add(a015106LTextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a001014TextField = new JTextField(); + a001014TextField.setEditable(false); + a001014TextField.setText("0 0 10,14,16 * * ?"); + panel1.add(a001014TextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00309TextField = new JTextField(); + a00309TextField.setEditable(false); + a00309TextField.setText("0 0/30 9-17 * * ?"); + panel1.add(a00309TextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a0012WEDTextField = new JTextField(); + a0012WEDTextField.setEditable(false); + a0012WEDTextField.setText("0 0 12 ? * WED"); + panel1.add(a0012WEDTextField, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a0012TextField = new JTextField(); + a0012TextField.setEditable(false); + a0012TextField.setText("0 0 12 * * ?"); + panel1.add(a0012TextField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a01510TextField = new JTextField(); + a01510TextField.setEditable(false); + a01510TextField.setText("0 15 10 ? * *"); + panel1.add(a01510TextField, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a01510TextField2 = new JTextField(); + a01510TextField2.setEditable(false); + a01510TextField2.setText("0 15 10 * * ?"); + panel1.add(a01510TextField2, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a01510TextField3 = new JTextField(); + a01510TextField3.setEditable(false); + a01510TextField3.setText("0 15 10 * * ? *"); + panel1.add(a01510TextField3, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015102005TextField = new JTextField(); + a015102005TextField.setEditable(false); + a015102005TextField.setText("0 15 10 * * ? 2005"); + panel1.add(a015102005TextField, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a014TextField = new JTextField(); + a014TextField.setEditable(false); + a014TextField.setText("0 * 14 * * ?"); + panel1.add(a014TextField, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00514TextField = new JTextField(); + a00514TextField.setEditable(false); + a00514TextField.setText("0 0/5 14 * * ?"); + panel1.add(a00514TextField, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00514TextField2 = new JTextField(); + a00514TextField2.setEditable(false); + a00514TextField2.setText("0 0/5 14,18 * * ?"); + panel1.add(a00514TextField2, new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00514TextField3 = new JTextField(); + a00514TextField3.setEditable(false); + a00514TextField3.setText("0 0-5 14 * * ?"); + panel1.add(a00514TextField3, new GridConstraints(14, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a0104414TextField = new JTextField(); + a0104414TextField.setEditable(false); + a0104414TextField.setText("0 10,44 14 ? 3 WED"); + panel1.add(a0104414TextField, new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a01510MONTextField1 = new JTextField(); + a01510MONTextField1.setEditable(false); + a01510MONTextField1.setText("0 15 10 ? * MON-FRI"); + panel1.add(a01510MONTextField1, new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a0151015TextField = new JTextField(); + a0151015TextField.setEditable(false); + a0151015TextField.setText("0 15 10 15 * ?"); + panel1.add(a0151015TextField, new GridConstraints(17, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a01510LTextField = new JTextField(); + a01510LTextField.setEditable(false); + a01510LTextField.setText("0 15 10 L * ?"); + panel1.add(a01510LTextField, new GridConstraints(18, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015106LTextField1 = new JTextField(); + a015106LTextField1.setEditable(false); + a015106LTextField1.setText("0 15 10 ? * 6L"); + panel1.add(a015106LTextField1, new GridConstraints(19, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015106LTextField3 = new JTextField(); + a015106LTextField3.setEditable(false); + a015106LTextField3.setText("0 15 10 ? * 6L 2002-2005"); + panel1.add(a015106LTextField3, new GridConstraints(20, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015106TextField = new JTextField(); + a015106TextField.setEditable(false); + a015106TextField.setText("0 15 10 ? * 6#3"); + panel1.add(a015106TextField, new GridConstraints(21, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel1.add(panel2, new GridConstraints(22, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JSeparator separator1 = new JSeparator(); + panel2.add(separator1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final JLabel label23 = new JLabel(); + Font label23Font = this.$$$getFont$$$(null, Font.BOLD, -1, label23.getFont()); + if (label23Font != null) label23.setFont(label23Font); + label23.setText("以上来自百度百科"); + panel2.add(label23, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label24 = new JLabel(); + label24.setText("每天10点15分"); + panel1.add(label24, new GridConstraints(23, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label25 = new JLabel(); + label25.setText("2017年每天10点15分"); + panel1.add(label25, new GridConstraints(24, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label26 = new JLabel(); + label26.setText("每天下午的 2点到2点59分每分"); + panel1.add(label26, new GridConstraints(25, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label27 = new JLabel(); + label27.setText("每天下午的 2点到2点59分(整点开始,每隔5分)"); + panel1.add(label27, new GridConstraints(26, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label28 = new JLabel(); + label28.setText("每天下午的 2点到2点59分、18点到18点59分(整点开始,每隔5分)"); + panel1.add(label28, new GridConstraints(27, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label29 = new JLabel(); + label29.setText("每天下午的 2点到2点05分每分"); + panel1.add(label29, new GridConstraints(28, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label30 = new JLabel(); + label30.setText("每月最后一周的星期五的10点15分"); + panel1.add(label30, new GridConstraints(29, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label31 = new JLabel(); + label31.setText("每月的第三周的星期五开始"); + panel1.add(label31, new GridConstraints(30, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + a01510TextField1 = new JTextField(); + a01510TextField1.setEditable(false); + a01510TextField1.setText("0 15 10 * * ? *"); + panel1.add(a01510TextField1, new GridConstraints(23, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015102017TextField = new JTextField(); + a015102017TextField.setEditable(false); + a015102017TextField.setText("0 15 10 * * ? 2017"); + panel1.add(a015102017TextField, new GridConstraints(24, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a014TextField1 = new JTextField(); + a014TextField1.setEditable(false); + a014TextField1.setText("0 * 14 * * ?"); + panel1.add(a014TextField1, new GridConstraints(25, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00514TextField1 = new JTextField(); + a00514TextField1.setEditable(false); + a00514TextField1.setText("0 0/5 14 * * ?"); + panel1.add(a00514TextField1, new GridConstraints(26, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00514TextField5 = new JTextField(); + a00514TextField5.setEditable(false); + a00514TextField5.setText("0 0/5 14,18 * * ?"); + panel1.add(a00514TextField5, new GridConstraints(27, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a00514TextField6 = new JTextField(); + a00514TextField6.setEditable(false); + a00514TextField6.setText("0 0-5 14 * * ?"); + panel1.add(a00514TextField6, new GridConstraints(28, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015106LTextField2 = new JTextField(); + a015106LTextField2.setEditable(false); + a015106LTextField2.setText("0 15 10 ? * 6L"); + panel1.add(a015106LTextField2, new GridConstraints(29, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + a015106TextField1 = new JTextField(); + a015106TextField1.setEditable(false); + a015106TextField1.setText("0 15 10 ? * 6#3"); + panel1.add(a015106TextField1, new GridConstraints(30, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel1.add(panel3, new GridConstraints(31, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JSeparator separator2 = new JSeparator(); + panel3.add(separator2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final JLabel label32 = new JLabel(); + Font label32Font = this.$$$getFont$$$(null, Font.BOLD, -1, label32.getFont()); + if (label32Font != null) label32.setFont(label32Font); + label32.setText("以上来自https://www.pppet.net/changyong.html"); + panel3.add(label32, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(32, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { + if (currentFont == null) return null; + String resultName; + if (fontName == null) { + resultName = currentFont.getName(); + } else { + Font testFont = new Font(fontName, Font.PLAIN, 10); + if (testFont.canDisplay('a') && testFont.canDisplay('1')) { + resultName = fontName; + } else { + resultName = currentFont.getName(); + } + } + Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); + boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); + Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); + return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.java index ad353b47..7abd61fa 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.java @@ -17,10 +17,7 @@ import com.luoboduner.moo.tool.ui.component.TopMenuBar; import com.luoboduner.moo.tool.ui.form.func.*; import com.luoboduner.moo.tool.ui.frame.MainFrame; -import com.luoboduner.moo.tool.util.ComponentUtil; -import com.luoboduner.moo.tool.util.MybatisUtil; -import com.luoboduner.moo.tool.util.ScrollUtil; -import com.luoboduner.moo.tool.util.SystemUtil; +import com.luoboduner.moo.tool.util.*; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -145,8 +142,7 @@ public void windowClosing(WindowEvent e) { App.config.save(); HttpMsgSender.proxy = null; - JOptionPane.showMessageDialog(contentPane, "保存成功!", "成功", - JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(httpSaveButton, "保存", "保存成功", 2000); } catch (Exception e1) { JOptionPane.showMessageDialog(contentPane, "保存失败!\n\n" + e1.getMessage(), "失败", JOptionPane.ERROR_MESSAGE); diff --git a/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.form b/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.form index 6e043f2b..1748a760 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.form +++ b/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.form @@ -113,7 +113,7 @@ - + @@ -121,47 +121,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -175,6 +143,7 @@ + @@ -191,31 +160,95 @@ - - - - - - - - - + + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.java b/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.java index d75d09fb..217ea978 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/form/func/CronForm.java @@ -7,6 +7,7 @@ import com.intellij.uiDesigner.core.Spacer; import com.luoboduner.moo.tool.App; import com.luoboduner.moo.tool.ui.Style; +import com.luoboduner.moo.tool.ui.listener.func.CronListener; import com.luoboduner.moo.tool.util.UndoUtil; import lombok.Getter; @@ -25,17 +26,18 @@ public class CronForm { private JPanel cronPanel; private JTextArea textArea1; - private JTextField textField1; - private JTextField textField2; - private JButton button1; + private JTextField cronExpressionTextField; + private JTextField humanReadableTextField; + private JButton cronToHumanReadableButton; private JButton button2; private JTabbedPane tabbedPane1; private JButton 反解析到UIButton; private JTextField textField3; private JSplitPane splitPane; - private JButton 常用CronButton; + private JButton commonCronButton; private JButton 收藏夹Button; private JButton button3; + private JComboBox localComboBox; private static CronForm cronForm; @@ -56,6 +58,8 @@ public static void init() { cronForm = getInstance(); initUi(); + + CronListener.addListeners(); } private static void initUi() { @@ -119,26 +123,17 @@ private static void initUi() { panel9.setLayout(new GridLayoutManager(4, 1, new Insets(12, 0, 12, 12), -1, -1)); splitPane.setRightComponent(panel9); final JPanel panel10 = new JPanel(); - panel10.setLayout(new GridLayoutManager(3, 5, new Insets(0, 0, 0, 0), -1, -1)); + panel10.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); panel9.add(panel10, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); - final JLabel label1 = new JLabel(); - label1.setText("Cron 表达式"); - panel10.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label2 = new JLabel(); - label2.setText("自然语言"); - panel10.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - textField1 = new JTextField(); - panel10.add(textField1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - textField2 = new JTextField(); - panel10.add(textField2, new GridConstraints(2, 1, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JPanel panel11 = new JPanel(); panel11.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1)); - panel10.add(panel11, new GridConstraints(1, 0, 1, 5, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - button1 = new JButton(); - button1.setIcon(new ImageIcon(getClass().getResource("/icon/arrow-down.png"))); - button1.setText(""); - panel11.add(button1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel10.add(panel11, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + cronToHumanReadableButton = new JButton(); + cronToHumanReadableButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow-down.png"))); + cronToHumanReadableButton.setText(""); + panel11.add(cronToHumanReadableButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); button2 = new JButton(); + button2.setEnabled(false); button2.setIcon(new ImageIcon(getClass().getResource("/icon/arrow-up.png"))); button2.setText(""); panel11.add(button2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); @@ -146,62 +141,85 @@ private static void initUi() { panel11.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel11.add(spacer2, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - 常用CronButton = new JButton(); - 常用CronButton.setText("常用Cron"); - panel10.add(常用CronButton, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel12 = new JPanel(); + panel12.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); + panel10.add(panel12, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("自然语言"); + panel12.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + humanReadableTextField = new JTextField(); + panel12.add(humanReadableTextField, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + localComboBox = new JComboBox(); + final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); + defaultComboBoxModel1.addElement("中文"); + defaultComboBoxModel1.addElement("英文"); + defaultComboBoxModel1.addElement("日文"); + localComboBox.setModel(defaultComboBoxModel1); + panel12.add(localComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel13 = new JPanel(); + panel13.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1)); + panel10.add(panel13, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Cron 表达式"); + panel13.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + cronExpressionTextField = new JTextField(); + panel13.add(cronExpressionTextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + commonCronButton = new JButton(); + commonCronButton.setText("常用Cron"); + panel13.add(commonCronButton, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); 收藏夹Button = new JButton(); 收藏夹Button.setText("收藏夹"); - panel10.add(收藏夹Button, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel13.add(收藏夹Button, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); button3 = new JButton(); button3.setIcon(new ImageIcon(getClass().getResource("/icon/favorite.png"))); button3.setText(""); - panel10.add(button3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JPanel panel12 = new JPanel(); - panel12.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - panel9.add(panel12, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + panel13.add(button3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel14 = new JPanel(); + panel14.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + panel9.add(panel14, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JScrollPane scrollPane1 = new JScrollPane(); - panel12.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + panel14.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); textArea1 = new JTextArea(); textArea1.setText(""); scrollPane1.setViewportView(textArea1); - final JPanel panel13 = new JPanel(); - panel13.setLayout(new GridLayoutManager(2, 7, new Insets(30, 0, 0, 0), -1, -1)); - panel9.add(panel13, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JPanel panel15 = new JPanel(); + panel15.setLayout(new GridLayoutManager(2, 7, new Insets(30, 0, 0, 0), -1, -1)); + panel9.add(panel15, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("秒"); - panel13.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setText("分钟"); - panel13.add(label4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label5 = new JLabel(); label5.setText("小时"); - panel13.add(label5, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label5, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label6 = new JLabel(); label6.setText("日"); - panel13.add(label6, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label6, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label7 = new JLabel(); label7.setText("月"); - panel13.add(label7, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label7, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label8 = new JLabel(); label8.setText("星期"); - panel13.add(label8, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label8, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label9 = new JLabel(); label9.setText("年"); - panel13.add(label9, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel15.add(label9, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JTextField textField1 = new JTextField(); + panel15.add(textField1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); + final JTextField textField2 = new JTextField(); + panel15.add(textField2, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); final JTextField textField4 = new JTextField(); - panel13.add(textField4, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); + panel15.add(textField4, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); final JTextField textField5 = new JTextField(); - panel13.add(textField5, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); + panel15.add(textField5, new GridConstraints(1, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); + textField3 = new JTextField(); + panel15.add(textField3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); final JTextField textField6 = new JTextField(); - panel13.add(textField6, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); + panel15.add(textField6, new GridConstraints(1, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); final JTextField textField7 = new JTextField(); - panel13.add(textField7, new GridConstraints(1, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); - textField3 = new JTextField(); - panel13.add(textField3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); - final JTextField textField8 = new JTextField(); - panel13.add(textField8, new GridConstraints(1, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); - final JTextField textField9 = new JTextField(); - panel13.add(textField9, new GridConstraints(1, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); + panel15.add(textField7, new GridConstraints(1, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false)); 反解析到UIButton = new JButton(); 反解析到UIButton.setText("反解析到UI"); panel9.add(反解析到UIButton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); diff --git a/src/main/java/com/luoboduner/moo/tool/ui/form/func/HostForm.java b/src/main/java/com/luoboduner/moo/tool/ui/form/func/HostForm.java index 6eeebebc..c24953e1 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/form/func/HostForm.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/form/func/HostForm.java @@ -416,7 +416,7 @@ private static void highlightHostMenu(String hostName) { findButton = new JButton(); findButton.setIcon(new ImageIcon(getClass().getResource("/icon/find_dark.png"))); findButton.setText(""); - findButton.setToolTipText("新建(Ctrl+N)"); + findButton.setToolTipText("查找(Ctrl+F)"); controlPanel.add(findButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportButton = new JButton(); exportButton.setIcon(new ImageIcon(getClass().getResource("/icon/export_dark.png"))); diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/TabListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/TabListener.java index 70028ae7..a48f8ab5 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/listener/TabListener.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/TabListener.java @@ -52,7 +52,6 @@ public void stateChanged(ChangeEvent e) { } break; case 12: - case 13: if (warnFlag) { JOptionPane.showMessageDialog(MainWindow.getInstance().getMainPanel(), "\n该功能尚未实现,目前仅供UI预览\n" + "\n", "预览提示", diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ColorBoardListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ColorBoardListener.java index 1434527e..4b1b85b2 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ColorBoardListener.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ColorBoardListener.java @@ -10,6 +10,7 @@ import com.luoboduner.moo.tool.ui.dialog.FavoriteColorDialog; import com.luoboduner.moo.tool.ui.form.func.ColorBoardForm; import com.luoboduner.moo.tool.ui.frame.FavoriteColorFrame; +import com.luoboduner.moo.tool.util.AlertUtil; import com.luoboduner.moo.tool.util.ColorUtil; import javax.swing.*; @@ -63,13 +64,10 @@ public static void addListeners() { }); colorBoardForm.getCopyButton().addActionListener(e -> { try { - colorBoardForm.getCopyButton().setEnabled(false); ClipboardUtil.setStr(colorBoardForm.getColorCodeTextField().getText()); - JOptionPane.showMessageDialog(colorBoardForm.getColorBoardPanel(), "已复制!", "成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(colorBoardForm.getCopyButton(), "复制", "已复制", 2000); } catch (Exception e1) { logger.error(e1); - } finally { - colorBoardForm.getCopyButton().setEnabled(true); } }); colorBoardForm.getCodeTypeComboBox().addItemListener(e -> { diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CronListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CronListener.java new file mode 100644 index 00000000..f6421484 --- /dev/null +++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CronListener.java @@ -0,0 +1,66 @@ +package com.luoboduner.moo.tool.ui.listener.func; + +import cn.hutool.log.Log; +import cn.hutool.log.LogFactory; +import com.cronutils.descriptor.CronDescriptor; +import com.cronutils.model.CronType; +import com.cronutils.model.definition.CronDefinition; +import com.cronutils.model.definition.CronDefinitionBuilder; +import com.cronutils.parser.CronParser; +import com.luoboduner.moo.tool.App; +import com.luoboduner.moo.tool.ui.dialog.CommonCronDialog; +import com.luoboduner.moo.tool.ui.form.func.CronForm; +import org.apache.commons.lang3.exception.ExceptionUtils; + +import javax.swing.*; +import java.util.Locale; + +/** + *
+ * CronListener
+ * 
+ * + * @author RememBerBer + * @since 2023/09/03. + */ +public class CronListener { + private static final Log logger = LogFactory.get(); + + public static void addListeners() { + CronForm cronForm = CronForm.getInstance(); + // cron转自然语言按钮 + cronForm.getCronToHumanReadableButton().addActionListener(e -> { + try { + String cronExpression = cronForm.getCronExpressionTextField().getText(); + + String selectedLocaleStr = cronForm.getLocalComboBox().getSelectedItem().toString(); + + Locale selectedLocale = Locale.getDefault(); + switch (selectedLocaleStr) { + case "中文" -> selectedLocale = Locale.CHINESE; + case "英文" -> selectedLocale = Locale.ENGLISH; + case "日文" -> selectedLocale = Locale.JAPANESE; + default -> { + } + } + CronDescriptor descriptor = CronDescriptor.instance(selectedLocale); + CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ); + CronParser parser = new CronParser(cronDefinition); + String description = descriptor.describe(parser.parse(cronExpression)); + + cronForm.getHumanReadableTextField().setText(description); + } catch (Exception ex) { + JOptionPane.showMessageDialog(App.mainFrame, "转换失败!\n\n" + ex.getMessage(), "失败", + JOptionPane.ERROR_MESSAGE); + logger.error(ExceptionUtils.getStackTrace(ex)); + } + }); + + cronForm.getCommonCronButton().addActionListener(e -> { + CommonCronDialog commonCronDialog = new CommonCronDialog(); + commonCronDialog.pack(); + commonCronDialog.setVisible(true); + }); + + } +} diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CryptoListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CryptoListener.java index e75ce2de..8069421e 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CryptoListener.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/CryptoListener.java @@ -21,6 +21,7 @@ import cn.hutool.log.LogFactory; import com.luoboduner.moo.tool.App; import com.luoboduner.moo.tool.ui.form.func.CryptoForm; +import com.luoboduner.moo.tool.util.AlertUtil; import org.apache.commons.lang3.exception.ExceptionUtils; import javax.swing.*; @@ -242,7 +243,7 @@ public static void addListeners() { cryptoForm.getCopyUuidButton().addActionListener(e -> { try { ClipboardUtil.setStr(cryptoForm.getUuidTextField().getText()); - JOptionPane.showMessageDialog(cryptoForm.getCryptoPanel(), "内容已经复制到剪贴板!", "复制成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(cryptoForm.getCopyUuidButton(), "复制", "已复制", 2000); } catch (Exception e1) { logger.error(e1); } @@ -251,7 +252,7 @@ public static void addListeners() { cryptoForm.getCopyRandomNumButton().addActionListener(e -> { try { ClipboardUtil.setStr(cryptoForm.getRandomNumTextField().getText()); - JOptionPane.showMessageDialog(cryptoForm.getCryptoPanel(), "内容已经复制到剪贴板!", "复制成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(cryptoForm.getCopyRandomNumButton(), "复制", "已复制", 2000); } catch (Exception e1) { logger.error(e1); } @@ -260,7 +261,7 @@ public static void addListeners() { cryptoForm.getCopyRadomStringButton().addActionListener(e -> { try { ClipboardUtil.setStr(cryptoForm.getRandomStringTextField().getText()); - JOptionPane.showMessageDialog(cryptoForm.getCryptoPanel(), "内容已经复制到剪贴板!", "复制成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(cryptoForm.getCopyRadomStringButton(), "复制", "已复制", 2000); } catch (Exception e1) { logger.error(e1); } @@ -269,7 +270,7 @@ public static void addListeners() { cryptoForm.getCopyRandomPasswordButton().addActionListener(e -> { try { ClipboardUtil.setStr(cryptoForm.getRandomPasswordTextField().getText()); - JOptionPane.showMessageDialog(cryptoForm.getCryptoPanel(), "内容已经复制到剪贴板!", "复制成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(cryptoForm.getCopyRandomPasswordButton(), "复制", "已复制", 2000); } catch (Exception e1) { logger.error(e1); } diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ImageListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ImageListener.java index 1d3564a9..ba331917 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ImageListener.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/ImageListener.java @@ -7,6 +7,7 @@ import com.luoboduner.moo.tool.ui.dialog.Base64Dialog; import com.luoboduner.moo.tool.ui.form.MainWindow; import com.luoboduner.moo.tool.ui.form.func.ImageForm; +import com.luoboduner.moo.tool.util.AlertUtil; import com.luoboduner.moo.tool.util.SystemUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -392,7 +393,9 @@ public static void getImageFromClipboard() { private static void copyToClipboard() { try { ClipboardUtil.setImage(selectedImage); - JOptionPane.showMessageDialog(App.mainFrame, "已复制图片到剪贴板!"); + ImageForm imageForm = ImageForm.getInstance(); + AlertUtil.buttonInfo(imageForm.getCopyToClipboardButton(), "复制到剪贴板", "已复制", 2000); + } catch (Exception e1) { JOptionPane.showMessageDialog(App.mainFrame, "复制失败!\n\n" + e1.getMessage(), "失败", JOptionPane.ERROR_MESSAGE); log.error(ExceptionUtils.getStackTrace(e1)); diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/TimeConvertListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/TimeConvertListener.java index d87b6d0c..54a27b69 100644 --- a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/TimeConvertListener.java +++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/TimeConvertListener.java @@ -5,6 +5,7 @@ import cn.hutool.log.Log; import cn.hutool.log.LogFactory; import com.luoboduner.moo.tool.ui.form.func.TimeConvertForm; +import com.luoboduner.moo.tool.util.AlertUtil; import com.luoboduner.moo.tool.util.ConsoleUtil; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.time.DateFormatUtils; @@ -72,46 +73,38 @@ public void keyReleased(KeyEvent e) { }); timeConvertForm.getCopyCurrentGmtButton().addActionListener(e -> ThreadUtil.execute(() -> { try { - timeConvertForm.getCopyCurrentGmtButton().setEnabled(false); ClipboardUtil.setStr(timeConvertForm.getCurrentGmtLabel().getText()); - JOptionPane.showMessageDialog(timeConvertForm.getTimeConvertPanel(), "已复制!", "成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(timeConvertForm.getCopyCurrentGmtButton(), "复制", "已复制", 2000); + } catch (Exception e1) { logger.error(e1); - } finally { - timeConvertForm.getCopyCurrentGmtButton().setEnabled(true); } })); timeConvertForm.getCopyCurrentTimestampButton().addActionListener(e -> ThreadUtil.execute(() -> { try { - timeConvertForm.getCopyCurrentTimestampButton().setEnabled(false); ClipboardUtil.setStr(timeConvertForm.getCurrentTimestampLabel().getText()); - JOptionPane.showMessageDialog(timeConvertForm.getTimeConvertPanel(), "已复制!", "成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(timeConvertForm.getCopyCurrentTimestampButton(), "复制", "已复制", 2000); + } catch (Exception e1) { logger.error(e1); - } finally { - timeConvertForm.getCopyCurrentTimestampButton().setEnabled(true); } })); timeConvertForm.getCopyGeneratedTimestampButton().addActionListener(e -> ThreadUtil.execute(() -> { try { - timeConvertForm.getCopyGeneratedTimestampButton().setEnabled(false); ClipboardUtil.setStr(timeConvertForm.getTimestampTextField().getText()); - JOptionPane.showMessageDialog(timeConvertForm.getTimeConvertPanel(), "已复制!", "成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(timeConvertForm.getCopyGeneratedTimestampButton(), "复制", "已复制", 2000); + } catch (Exception e1) { logger.error(e1); - } finally { - timeConvertForm.getCopyGeneratedTimestampButton().setEnabled(true); } })); timeConvertForm.getCopyGeneratedLocalTimeButton().addActionListener(e -> ThreadUtil.execute(() -> { try { - timeConvertForm.getCopyGeneratedLocalTimeButton().setEnabled(false); ClipboardUtil.setStr(timeConvertForm.getGmtTextField().getText()); - JOptionPane.showMessageDialog(timeConvertForm.getTimeConvertPanel(), "已复制!", "成功", JOptionPane.INFORMATION_MESSAGE); + AlertUtil.buttonInfo(timeConvertForm.getCopyGeneratedLocalTimeButton(), "复制", "已复制", 2000); + } catch (Exception e1) { logger.error(e1); - } finally { - timeConvertForm.getCopyGeneratedLocalTimeButton().setEnabled(true); } })); diff --git a/src/main/java/com/luoboduner/moo/tool/util/AlertUtil.java b/src/main/java/com/luoboduner/moo/tool/util/AlertUtil.java new file mode 100644 index 00000000..e8185fa5 --- /dev/null +++ b/src/main/java/com/luoboduner/moo/tool/util/AlertUtil.java @@ -0,0 +1,18 @@ +package com.luoboduner.moo.tool.util; + +import javax.swing.*; + +public class AlertUtil { + public static void buttonInfo(JButton button, String textBefore, String text, int millions) { + // button显示text的内容,millions后恢复 + button.setText(text); + new Thread(() -> { + try { + Thread.sleep(millions); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + button.setText(textBefore); + }).start(); + } +} diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json index 498d710d..25c4a7dc 100644 --- a/src/main/resources/version_summary.json +++ b/src/main/resources/version_summary.json @@ -1,5 +1,5 @@ { - "currentVersion": "v1.5.2", + "currentVersion": "v1.5.3", "versionIndex": { "v0.0.0": "0", "v1.0.0": "1", @@ -23,7 +23,8 @@ "v1.4.8": "19", "v1.5.0": "20", "v1.5.1": "21", - "v1.5.2": "22" + "v1.5.2": "22", + "v1.5.3": "23" }, "versionDetailList": [ { @@ -140,6 +141,11 @@ "version": "v1.5.2", "title": "JetBrains Mono font字体问题优化", "log": "● 修复:由于使用的FlatLaf的JetBrains Mono font字体在MacOS上存在兼容性问题,将其从默认调整为可选\n\n" + }, + { + "version": "v1.5.3", + "title": "优化复制成功等操作的提示行为", + "log": "● 全局:优化复制成功等操作的提示行为,减少鼠标点击次数\n● Host:Host功能查找按钮的提示文本错误修正 by wangshun\n● Cron:增加cron表达式转自然语言功能\n● Cron:增加常用cron表达式\n\n" } ] } \ No newline at end of file